@@ -2243,7 +2243,7 @@ ImGui::SetTooltip("%s", tooltip_buffer); \
22432243
22442244 // --- Network Mode ---
22452245 ImGui::Text (" Network Mode" );
2246- int mode = app_settings-> network_mode ;
2246+ int mode = temp_settings. network_mode ;
22472247 ImGui::RadioButton (" Singleplayer" , &mode, NETWORK_SINGLEPLAYER);
22482248 if (ImGui::IsItemHovered ()) {
22492249 char tooltip_buf[256 ];
@@ -2270,18 +2270,17 @@ ImGui::SetTooltip("%s", tooltip_buffer); \
22702270 " Connects to a Host and receives progress updates." );
22712271 ImGui::SetTooltip (" %s" , tooltip_buf);
22722272 }
2273- app_settings->network_mode = (NetworkMode) mode;
2274-
2275- ImGui::Separator ();
2276- ImGui::Spacing ();
2273+ temp_settings.network_mode = (NetworkMode) mode;
22772274
22782275 // --- Host Settings ---
2279- if (app_settings->network_mode == NETWORK_HOST) {
2276+ if (temp_settings.network_mode == NETWORK_HOST) {
2277+ ImGui::Separator ();
2278+ ImGui::Spacing ();
22802279 ImGui::Text (" Host Settings" );
22812280 ImGui::Spacing ();
22822281
22832282 ImGui::SetNextItemWidth (120 .0f );
2284- ImGui::InputText (" Port" , app_settings-> host_port , sizeof (app_settings-> host_port ),
2283+ ImGui::InputText (" Port" , temp_settings. host_port , sizeof (temp_settings. host_port ),
22852284 ImGuiInputTextFlags_CharsDecimal);
22862285 if (ImGui::IsItemHovered ()) {
22872286 char tooltip_buf[256 ];
@@ -2292,30 +2291,52 @@ ImGui::SetTooltip("%s", tooltip_buffer); \
22922291 }
22932292
22942293 ImGui::Spacing ();
2294+ ImGui::Separator ();
2295+ ImGui::Spacing ();
2296+
2297+ // --- Goal Merging Logic (per goal type) ---
22952298 ImGui::Text (" Goal Merging Logic" );
2296- int logic = app_settings->coop_goal_logic ;
2297- ImGui::RadioButton (" Max Progress" , &logic, COOP_TRACK_MAX_PROGRESS);
2298- if (ImGui::IsItemHovered ()) {
2299- char tooltip_buf[256 ];
2300- snprintf (tooltip_buf, sizeof (tooltip_buf),
2301- " Use whichever player has the most criteria completed for each goal." );
2302- ImGui::SetTooltip (" %s" , tooltip_buf);
2303- }
2304- ImGui::RadioButton (" First to Start" , &logic, COOP_TRACK_FIRST_START);
2305- if (ImGui::IsItemHovered ()) {
2306- char tooltip_buf[256 ];
2307- snprintf (tooltip_buf, sizeof (tooltip_buf),
2308- " Track whoever triggered the first criterion of each goal (by timestamp)." );
2309- ImGui::SetTooltip (" %s" , tooltip_buf);
2310- }
2311- ImGui::RadioButton (" Any Completion" , &logic, COOP_TRACK_ANY_COMPLETION);
2312- if (ImGui::IsItemHovered ()) {
2313- char tooltip_buf[256 ];
2314- snprintf (tooltip_buf, sizeof (tooltip_buf),
2315- " A goal is complete if any player has finished it." );
2316- ImGui::SetTooltip (" %s" , tooltip_buf);
2299+ ImGui::TextDisabled (" Controls how progress is combined when multiple players track the same goals." );
2300+ ImGui::Spacing ();
2301+
2302+ // Global merging logic (will become per-section in the future)
2303+ const char *goal_type_labels[] = {
2304+ advancements_label_plural_uppercase, " Statistics" , " Custom Goals" , " Multi-Stage Goals"
2305+ };
2306+ int logic = temp_settings.coop_goal_logic ;
2307+ for (int i = 0 ; i < 4 ; i++) {
2308+ if (i > 0 ) ImGui::Spacing ();
2309+ ImGui::PushID (i);
2310+ ImGui::BeginDisabled (i > 0 ); // Only Advancements editable for now, rest follows
2311+ ImGui::Text (" %s:" , goal_type_labels[i]);
2312+ ImGui::SameLine ();
2313+ ImGui::RadioButton (" Max Progress" , &logic, COOP_TRACK_MAX_PROGRESS);
2314+ if (ImGui::IsItemHovered (ImGuiHoveredFlags_AllowWhenDisabled)) {
2315+ char tooltip_buf[256 ];
2316+ snprintf (tooltip_buf, sizeof (tooltip_buf),
2317+ " Use whichever player has the most criteria completed for each goal." );
2318+ ImGui::SetTooltip (" %s" , tooltip_buf);
2319+ }
2320+ ImGui::SameLine ();
2321+ ImGui::RadioButton (" First to Start" , &logic, COOP_TRACK_FIRST_START);
2322+ if (ImGui::IsItemHovered (ImGuiHoveredFlags_AllowWhenDisabled)) {
2323+ char tooltip_buf[256 ];
2324+ snprintf (tooltip_buf, sizeof (tooltip_buf),
2325+ " Track whoever triggered the first criterion of each goal (by timestamp)." );
2326+ ImGui::SetTooltip (" %s" , tooltip_buf);
2327+ }
2328+ ImGui::SameLine ();
2329+ ImGui::RadioButton (" Any Completion" , &logic, COOP_TRACK_ANY_COMPLETION);
2330+ if (ImGui::IsItemHovered (ImGuiHoveredFlags_AllowWhenDisabled)) {
2331+ char tooltip_buf[256 ];
2332+ snprintf (tooltip_buf, sizeof (tooltip_buf),
2333+ " A goal is complete if any player has finished it." );
2334+ ImGui::SetTooltip (" %s" , tooltip_buf);
2335+ }
2336+ ImGui::EndDisabled ();
2337+ ImGui::PopID ();
23172338 }
2318- app_settings-> coop_goal_logic = (CoopGoalLogic) logic;
2339+ temp_settings. coop_goal_logic = (CoopGoalLogic) logic;
23192340
23202341 ImGui::Spacing ();
23212342 ImGui::Separator ();
@@ -2324,43 +2345,41 @@ ImGui::SetTooltip("%s", tooltip_buffer); \
23242345 // Invite Code Generation (placeholder - will be functional with networking)
23252346 ImGui::Text (" Invite Code" );
23262347 ImGui::TextDisabled (" Generate an invite code to share with receivers." );
2327- if (ImGui::Button (" Generate Invite Code" )) {
2328- // TODO: Generate Base64 invite code from public IP + port
2348+ if (ImGui::Button (" Generate & Copy Invite Code" )) {
2349+ // TODO: Generate Base64 invite code from public IP + port, copy to clipboard
23292350 }
23302351 if (ImGui::IsItemHovered ()) {
23312352 char tooltip_buf[256 ];
23322353 snprintf (tooltip_buf, sizeof (tooltip_buf),
2333- " Generates a Base64 invite code encoding your IP and port.\n "
2354+ " Generates a Base64 invite code encoding your IP and port,\n "
2355+ " and copies it to your clipboard.\n "
23342356 " Share this privately with receivers." );
23352357 ImGui::SetTooltip (" %s" , tooltip_buf);
23362358 }
23372359 }
23382360
23392361 // --- Receiver Settings ---
2340- if (app_settings->network_mode == NETWORK_RECEIVER) {
2362+ if (temp_settings.network_mode == NETWORK_RECEIVER) {
2363+ ImGui::Separator ();
2364+ ImGui::Spacing ();
23412365 ImGui::Text (" Receiver Settings" );
23422366 ImGui::Spacing ();
23432367
2344- ImGui::SetNextItemWidth (400 .0f );
2345- ImGui::InputText (" Invite Code" , app_settings->receiver_invite_code ,
2346- sizeof (app_settings->receiver_invite_code ),
2347- ImGuiInputTextFlags_Password);
2348- if (ImGui::IsItemHovered ()) {
2349- char tooltip_buf[256 ];
2350- snprintf (tooltip_buf, sizeof (tooltip_buf),
2351- " Paste the invite code from the Host.\n "
2352- " Input is masked to protect the Host's IP." );
2353- ImGui::SetTooltip (" %s" , tooltip_buf);
2354- }
2355-
2356- ImGui::Spacing ();
2357- if (ImGui::Button (" Connect" )) {
2358- // TODO: Decode invite code and connect to host
2368+ if (ImGui::Button (" Paste Invite Code & Connect" )) {
2369+ const char *clipboard = SDL_GetClipboardText ();
2370+ if (clipboard && clipboard[0 ] != ' \0 ' ) {
2371+ strncpy (temp_settings.receiver_invite_code , clipboard,
2372+ sizeof (temp_settings.receiver_invite_code ) - 1 );
2373+ temp_settings.receiver_invite_code [sizeof (temp_settings.receiver_invite_code ) - 1 ] = ' \0 ' ;
2374+ SDL_SetClipboardText (" " );
2375+ // TODO: Decode invite code and connect to host
2376+ }
23592377 }
23602378 if (ImGui::IsItemHovered ()) {
23612379 char tooltip_buf[256 ];
23622380 snprintf (tooltip_buf, sizeof (tooltip_buf),
2363- " Decode the invite code and connect to the Host's co-op session." );
2381+ " Pastes the invite code from your clipboard, clears the clipboard\n "
2382+ " to prevent leaking the Host's connection info, and connects to the session." );
23642383 ImGui::SetTooltip (" %s" , tooltip_buf);
23652384 }
23662385 }
0 commit comments