From fbfc75df717edbd93ea4d084e45de1c85b487bee Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 20 Aug 2023 05:08:53 -0700 Subject: [PATCH 01/12] Item box autospin --- src/d_netcmd.c | 15 +- src/d_player.h | 5 +- src/deh_tables.c | 2 +- src/g_demo.c | 8 ++ src/g_game.c | 9 +- src/g_game.h | 1 + src/k_hud.c | 154 ++++++++++++--------- src/k_hud.h | 2 + src/k_menu.h | 1 + src/k_menufunc.c | 1 + src/k_profiles.c | 16 +++ src/k_profiles.h | 3 +- src/k_roulette.c | 25 ++++ src/m_random.h | 2 + src/menus/options-profiles-1.c | 3 + src/menus/options-profiles-edit-controls.c | 6 + src/p_saveg.c | 2 + 17 files changed, 185 insertions(+), 70 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index f49647810..a90167104 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1061,6 +1061,7 @@ void D_RegisterClientCommands(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { CV_RegisterVar(&cv_kickstartaccel[i]); + CV_RegisterVar(&cv_autospin[i]); CV_RegisterVar(&cv_shrinkme[i]); CV_RegisterVar(&cv_deadzone[i]); CV_RegisterVar(&cv_rumble[i]); @@ -1815,6 +1816,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) enum { WP_KICKSTARTACCEL = 1<<0, WP_SHRINKME = 1<<1, + WP_AUTOSPIN = 1<<2, }; void WeaponPref_Send(UINT8 ssplayer) @@ -1824,6 +1826,9 @@ void WeaponPref_Send(UINT8 ssplayer) if (cv_kickstartaccel[ssplayer].value) prefs |= WP_KICKSTARTACCEL; + if (cv_autospin[ssplayer].value) + prefs |= WP_AUTOSPIN; + if (cv_shrinkme[ssplayer].value) prefs |= WP_SHRINKME; @@ -1839,6 +1844,9 @@ void WeaponPref_Save(UINT8 **cp, INT32 playernum) if (player->pflags & PF_KICKSTARTACCEL) prefs |= WP_KICKSTARTACCEL; + if (player->pflags & PF_AUTOSPIN) + prefs |= WP_AUTOSPIN; + if (player->pflags & PF_SHRINKME) prefs |= WP_SHRINKME; @@ -1851,17 +1859,20 @@ void WeaponPref_Parse(UINT8 **cp, INT32 playernum) UINT8 prefs = READUINT8(*cp); - player->pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME); + player->pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME|PF_AUTOSPIN); if (prefs & WP_KICKSTARTACCEL) player->pflags |= PF_KICKSTARTACCEL; + if (prefs & WP_AUTOSPIN) + player->pflags |= PF_AUTOSPIN; + if (prefs & WP_SHRINKME) player->pflags |= PF_SHRINKME; if (leveltime < 2) { - // BAD HACK: No other place I tried to slot this in + // BAD HACK: No other place I ried to slot this in // made it work for the host when they initally host, // so this will have to do. K_UpdateShrinkCheat(player); diff --git a/src/d_player.h b/src/d_player.h index 6d6e887d1..2c25bd4d2 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -64,7 +64,9 @@ typedef enum { PF_GODMODE = 1<<0, // Immortal. No lightsnake from pits either - // free: 1<<1 and 1<<2 + // free: 1<<1 + + PF_AUTOSPIN = 1<<2, // Accessibility: Non-deterministic item box, no manual stop. // Look back VFX has been spawned // TODO: Is there a better way to track this? @@ -437,6 +439,7 @@ struct itemroulette_t boolean eggman; boolean ringbox; + boolean autospin; }; // enum for bot item priorities diff --git a/src/deh_tables.c b/src/deh_tables.c index 97a78e936..8db5279b0 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5931,7 +5931,7 @@ const char *const PLAYERFLAG_LIST[] = { // free: 1<<1 and 1<<2 (name un-matchable) "\x01", - "\x01", + "AUTOSPIN", // Item box accessibility // Look back VFX has been spawned // TODO: Is there a better way to track this? diff --git a/src/g_demo.c b/src/g_demo.c index 7f58d289e..e73dde2e9 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -137,6 +137,7 @@ demoghost *ghosts = NULL; #define DEMO_KICKSTART 0x02 #define DEMO_SHRINKME 0x04 #define DEMO_BOT 0x08 +#define DEMO_AUTOSPIN 0x10 // For demos #define ZT_FWD 0x0001 @@ -2474,6 +2475,8 @@ void G_BeginRecording(void) i |= DEMO_SPECTATOR; if (player->pflags & PF_KICKSTARTACCEL) i |= DEMO_KICKSTART; + if (player->pflags & PF_AUTOSPIN) + i |= DEMO_AUTOSPIN; if (player->pflags & PF_SHRINKME) i |= DEMO_SHRINKME; if (player->bot == true) @@ -3436,6 +3439,11 @@ void G_DoPlayDemo(const char *defdemoname) else players[p].pflags &= ~PF_KICKSTARTACCEL; + if (flags & DEMO_AUTOSPIN) + players[p].pflags |= PF_AUTOSPIN; + else + players[p].pflags &= ~PF_AUTOSPIN; + if (flags & DEMO_SHRINKME) players[p].pflags |= PF_SHRINKME; else diff --git a/src/g_game.c b/src/g_game.c index 08fc60159..1cacc3440 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -408,6 +408,13 @@ consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS] = { CVAR_INIT ("kickstartaccel4", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange4) }; +consvar_t cv_autospin[MAXSPLITSCREENPLAYERS] = { + CVAR_INIT ("autospin", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange), + CVAR_INIT ("autospin2", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange2), + CVAR_INIT ("autospin3", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange3), + CVAR_INIT ("autospin4", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange4) +}; + consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS] = { CVAR_INIT ("shrinkme", "Off", CV_CALL, CV_OnOff, weaponPrefChange), CVAR_INIT ("shrinkme2", "Off", CV_CALL, CV_OnOff, weaponPrefChange2), @@ -2216,7 +2223,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) totalring = players[player].totalring; xtralife = players[player].xtralife; - pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL|PF_SHRINKME|PF_SHRINKACTIVE)); + pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL|PF_SHRINKME|PF_SHRINKACTIVE|PF_AUTOSPIN)); // SRB2kart memcpy(&itemRoulette, &players[player].itemRoulette, sizeof (itemRoulette)); diff --git a/src/g_game.h b/src/g_game.h index 72e9ce005..f9aead0f4 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -95,6 +95,7 @@ extern consvar_t cv_songcredits; extern consvar_t cv_pauseifunfocused; extern consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_autospin[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS]; diff --git a/src/k_hud.c b/src/k_hud.c index 569304485..69cad88d6 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -193,6 +193,8 @@ static patch_t *kp_bossret[4]; static patch_t *kp_trickcool[2]; +patch_t *kp_autospin; + patch_t *kp_capsuletarget_arrow[2][2]; patch_t *kp_capsuletarget_icon[2]; patch_t *kp_capsuletarget_far[2]; @@ -710,6 +712,8 @@ void K_LoadKartHUDGraphics(void) HU_UpdatePatch(&kp_trickcool[0], "K_COOL1"); HU_UpdatePatch(&kp_trickcool[1], "K_COOL2"); + HU_UpdatePatch(&kp_autospin, "A11YITEM"); + sprintf(buffer, "K_BOSB0x"); for (i = 0; i < 8; i++) { @@ -2743,70 +2747,92 @@ static void K_drawRingCounter(boolean gametypeinfoshown) static void K_drawKartAccessibilityIcons(boolean gametypeinfoshown, INT32 fx) { - INT32 fy = LAPS_Y-14; - INT32 splitflags = V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_SPLITSCREEN; - //INT32 step = 1; -- if there's ever more than one accessibility icon - - fx += LAPS_X; - - if (r_splitscreen < 2) // adjust to speedometer height - { - if (gametypeinfoshown) - { - fy -= 11; - - if ((gametyperules & (GTR_BUMPERS|GTR_CIRCUIT)) == GTR_BUMPERS) - fy -= 4; - } - else - { - fy += 9; - } - } - else - { - fx = LAPS_X+43; - fy = LAPS_Y; - if (!(stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]])) // If we are not P1 or P3... - { - splitflags ^= (V_SNAPTOLEFT|V_SNAPTORIGHT); - fx = (BASEVIDWIDTH/2) - (fx + 10); - //step = -step; - } - } - - if (stplyr->pflags & PF_KICKSTARTACCEL) // just KICKSTARTACCEL right now, maybe more later - { - SINT8 col = 0, wid, fil, ofs; - UINT8 i = 7; - ofs = (stplyr->kickstartaccel == ACCEL_KICKSTART) ? 1 : 0; - fil = i-(stplyr->kickstartaccel*i)/ACCEL_KICKSTART; - - V_DrawFill(fx+4, fy+ofs-1, 2, 1, 31|V_SLIDEIN|splitflags); - V_DrawFill(fx, (fy+ofs-1)+8, 10, 1, 31|V_SLIDEIN|splitflags); - - while (i--) - { - wid = (i/2)+1; - V_DrawFill(fx+4-wid, fy+ofs+i, 2+(wid*2), 1, 31|V_SLIDEIN|splitflags); - if (fil > 0) - { - if (i < fil) - col = 23; - else if (i == fil) - col = 3; - else - col = 5 + (i-fil)*2; - } - else if ((leveltime % 7) == i) - col = 0; - else - col = 3; - V_DrawFill(fx+5-wid, fy+ofs+i, (wid*2), 1, col|V_SLIDEIN|splitflags); - } - - //fx += step*12; - } + INT32 fy = LAPS_Y-14; + INT32 splitflags = V_SNAPTOLEFT|V_SNAPTOBOTTOM|V_SPLITSCREEN; + + boolean mirror = false; + + fx += LAPS_X; + + if (r_splitscreen < 2) // adjust to speedometer height + { + if (gametypeinfoshown) + { + fy -= 11; + + if ((gametyperules & (GTR_BUMPERS|GTR_CIRCUIT)) == GTR_BUMPERS) + fy -= 4; + } + else + { + fy += 9; + } + } + else + { + fx = LAPS_X+44; + fy = LAPS_Y; + if (!(stplyr == &players[displayplayers[0]] || stplyr == &players[displayplayers[2]])) // If we are not P1 or P3... + { + splitflags ^= (V_SNAPTOLEFT|V_SNAPTORIGHT); + fx = (BASEVIDWIDTH/2) - fx; + mirror = true; + } + } + + // Kickstart Accel + if (stplyr->pflags & PF_KICKSTARTACCEL) + { + if (mirror) + fx -= 10; + + SINT8 col = 0, wid, fil, ofs; + UINT8 i = 7; + ofs = (stplyr->kickstartaccel == ACCEL_KICKSTART) ? 1 : 0; + fil = i-(stplyr->kickstartaccel*i)/ACCEL_KICKSTART; + + V_DrawFill(fx+4, fy+ofs-1, 2, 1, 31|V_SLIDEIN|splitflags); + V_DrawFill(fx, (fy+ofs-1)+8, 10, 1, 31|V_SLIDEIN|splitflags); + + while (i--) + { + wid = (i/2)+1; + V_DrawFill(fx+4-wid, fy+ofs+i, 2+(wid*2), 1, 31|V_SLIDEIN|splitflags); + if (fil > 0) + { + if (i < fil) + col = 23; + else if (i == fil) + col = 3; + else + col = 5 + (i-fil)*2; + } + else if ((leveltime % 7) == i) + col = 0; + else + col = 3; + V_DrawFill(fx+5-wid, fy+ofs+i, (wid*2), 1, col|V_SLIDEIN|splitflags); + } + + if (mirror) + fx--; + else + fx += 10 + 1; + } + + // Auto Roulette + if (stplyr->pflags & PF_AUTOSPIN) + { + if (mirror) + fx -= 12; + + V_DrawScaledPatch(fx, fy-1, V_SLIDEIN|splitflags, kp_autospin); + + if (mirror) + fx--; + else + fx += 12 + 1; + } } static void K_drawKartSpeedometer(boolean gametypeinfoshown) diff --git a/src/k_hud.h b/src/k_hud.h index 041243d5b..384a2bed2 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -61,6 +61,8 @@ extern patch_t *kp_capsuletarget_near[8]; extern patch_t *kp_superflickytarget[4]; +extern patch_t *kp_autospin; + extern patch_t *kp_button_a[2][2]; extern patch_t *kp_button_b[2][2]; extern patch_t *kp_button_c[2][2]; diff --git a/src/k_menu.h b/src/k_menu.h index 70f6b79c3..235386197 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -981,6 +981,7 @@ extern INT16 controlleroffsets[][2]; extern consvar_t cv_dummyprofilename; extern consvar_t cv_dummyprofileplayername; extern consvar_t cv_dummyprofilekickstart; +extern consvar_t cv_dummyprofileautospin; extern consvar_t cv_dummyprofilerumble; void M_ResetOptions(void); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 8a596b663..2df5c4177 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -1215,6 +1215,7 @@ void M_Init(void) CV_RegisterVar(&cv_dummyprofilename); CV_RegisterVar(&cv_dummyprofileplayername); CV_RegisterVar(&cv_dummyprofilekickstart); + CV_RegisterVar(&cv_dummyprofileautospin); CV_RegisterVar(&cv_dummyprofilerumble); CV_RegisterVar(&cv_dummygpdifficulty); diff --git a/src/k_profiles.c b/src/k_profiles.c index f0a0a8e89..34d61bc10 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -68,6 +68,7 @@ profile_t* PR_MakeProfile( strcpy(new->follower, fname); new->followercolor = fcol; new->kickstartaccel = false; + new->autospin = false; // Copy from gamecontrol directly as we'll be setting controls up directly in the profile. memcpy(new->controls, controlarray, sizeof(new->controls)); @@ -84,6 +85,7 @@ profile_t* PR_MakeProfileFromPlayer(const char *prname, const char *pname, const // Player bound cvars: new->kickstartaccel = cv_kickstartaccel[pnum].value; + new->autospin = cv_autospin[pnum].value; new->rumble = cv_rumble[pnum].value; return new; @@ -270,6 +272,7 @@ void PR_SaveProfiles(void) // Consvars. WRITEUINT8(save.p, profilesList[i]->kickstartaccel); + WRITEUINT8(save.p, profilesList[i]->autospin); WRITEUINT8(save.p, profilesList[i]->rumble); // Controls. @@ -407,6 +410,18 @@ void PR_LoadProfiles(void) // Consvars. profilesList[i]->kickstartaccel = (boolean)READUINT8(save.p); + + // 6->7, add autospin + if (version < 7) + { + profilesList[i]->autospin = false; + + } + else + { + profilesList[i]->autospin = (boolean)READUINT8(save.p); + } + if (version < 4) { profilesList[i]->rumble = true; @@ -459,6 +474,7 @@ static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum) { // toggles CV_StealthSetValue(&cv_kickstartaccel[playernum], p->kickstartaccel); + CV_StealthSetValue(&cv_autospin[playernum], p->autospin); // set controls... memcpy(&gamecontrol[playernum], p->controls, sizeof(gamecontroldefault)); diff --git a/src/k_profiles.h b/src/k_profiles.h index d08c350be..b78a1daf2 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -31,7 +31,7 @@ extern "C" { #define SKINNAMESIZE 16 #define PROFILENAMELEN 6 -#define PROFILEVER 6 +#define PROFILEVER 7 #define MAXPROFILES 16 #define PROFILESFILE "ringprofiles.prf" #define PROFILE_GUEST 0 @@ -74,6 +74,7 @@ struct profile_t // Player-specific consvars. // @TODO: List all of those boolean kickstartaccel; // cv_kickstartaccel + boolean autospin; // cv_autospin boolean rumble; // cv_rumble // Finally, control data itself diff --git a/src/k_roulette.c b/src/k_roulette.c index f54b2c9e4..4552b7b18 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -1074,6 +1074,7 @@ static void K_InitRoulette(itemroulette_t *const roulette) roulette->active = true; roulette->eggman = false; roulette->ringbox = false; + roulette->autospin = false; for (i = 0; i < MAXPLAYERS; i++) { @@ -1235,6 +1236,12 @@ static void K_CalculateRouletteSpeed(itemroulette_t *const roulette) return; } + if (roulette->autospin == true) + { + roulette->speed = ROULETTE_SPEED_FASTEST; + return; + } + if (K_TimeAttackRules() == true) { // Time Attack rules; use a consistent speed. @@ -1296,6 +1303,10 @@ void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulet if (player != NULL) { roulette->baseDist = K_UndoMapScaling(player->distancetofinish); + + if (player->pflags & PF_AUTOSPIN) + roulette->autospin = true; + K_CalculateRouletteSpeed(roulette); } @@ -1456,6 +1467,9 @@ void K_StartItemRoulette(player_t *const player, boolean ringbox) K_FillItemRouletteData(player, roulette, ringbox); + if (roulette->autospin) + roulette->index = P_RandomRange(PR_AUTOSPIN, 0, roulette->itemListLen - 1); + if (K_PlayerUsesBotMovement(player) == true) { K_BotPickItemPriority(player); @@ -1586,6 +1600,10 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) // Waited way too long, forcefully confirm the item. confirmItem = true; } + else if (roulette->autospin) + { + confirmItem = (roulette->speed > 15); + } else { // We can stop our item when we choose. @@ -1616,6 +1634,10 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) { // D2 fudge factor. Roulette was originally designed and tested with this delay. UINT8 fudgedDelay = (player->cmd.latency <= 2) ? 0 : player->cmd.latency - 2; + + if (roulette->autospin) + fudgedDelay = 0; // We didn't manually stop this, you jackwagon + while (fudgedDelay > 0) { UINT8 gap = (roulette->speed - roulette->tics); // How long has the roulette been on this entry? @@ -1671,6 +1693,9 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) roulette->elapsed++; + if (roulette->autospin && (roulette->elapsed % 5 == 0) && (roulette->elapsed > TICRATE)) + roulette->speed++; + if (roulette->tics == 0) { roulette->index = (roulette->index + 1) % roulette->itemListLen; diff --git a/src/m_random.h b/src/m_random.h index 54d3698a8..a4b22f7d1 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -78,6 +78,8 @@ typedef enum PR_BOTS, // Bot spawning + PR_AUTOSPIN, // Item box accessibility + PRNUMCLASS } pr_class_t; diff --git a/src/menus/options-profiles-1.c b/src/menus/options-profiles-1.c index 020be1858..6fb145b67 100644 --- a/src/menus/options-profiles-1.c +++ b/src/menus/options-profiles-1.c @@ -30,6 +30,7 @@ menu_t OPTIONS_ProfilesDef = { consvar_t cv_dummyprofilename = CVAR_INIT ("dummyprofilename", "", CV_HIDDEN, NULL, NULL); consvar_t cv_dummyprofileplayername = CVAR_INIT ("dummyprofileplayername", "", CV_HIDDEN, NULL, NULL); consvar_t cv_dummyprofilekickstart = CVAR_INIT ("dummyprofilekickstart", "Off", CV_HIDDEN, CV_OnOff, NULL); +consvar_t cv_dummyprofileautospin = CVAR_INIT ("dummyprofileautospin", "Off", CV_HIDDEN, CV_OnOff, NULL); consvar_t cv_dummyprofilerumble = CVAR_INIT ("dummyprofilerumble", "On", CV_HIDDEN, CV_OnOff, NULL); void M_ProfileSelectInit(INT32 choice) @@ -93,6 +94,7 @@ static void M_StartEditProfile(INT32 c) CV_StealthSet(&cv_dummyprofilename, optionsmenu.profile->profilename); CV_StealthSet(&cv_dummyprofileplayername, optionsmenu.profile->playername); CV_StealthSetValue(&cv_dummyprofilekickstart, optionsmenu.profile->kickstartaccel); + CV_StealthSetValue(&cv_dummyprofileautospin, optionsmenu.profile->kickstartaccel); CV_StealthSetValue(&cv_dummyprofilerumble, optionsmenu.profile->rumble); } else @@ -100,6 +102,7 @@ static void M_StartEditProfile(INT32 c) CV_StealthSet(&cv_dummyprofilename, ""); CV_StealthSet(&cv_dummyprofileplayername, ""); CV_StealthSetValue(&cv_dummyprofilekickstart, 0); // off + CV_StealthSetValue(&cv_dummyprofileautospin, 0); // off CV_StealthSetValue(&cv_dummyprofilerumble, 1); // on } diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index 9ef5b590f..6f155d2af 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -91,6 +91,9 @@ menuitem_t OPTIONS_ProfileControls[] = { {IT_CONTROL | IT_CVAR, "KICKSTART ACCEL", "Hold A to auto-accel. Tap it to cancel.", NULL, {.cvar = &cv_dummyprofilekickstart}, 0, 0}, + {IT_CONTROL | IT_CVAR, "AUTO SPIN", "Automatically stop the item box on a random result.", + NULL, {.cvar = &cv_dummyprofileautospin}, 0, 0}, + {IT_HEADER, "EXTRA", "", NULL, {NULL}, 0, 0}, @@ -187,6 +190,7 @@ static void M_ProfileControlSaveResponse(INT32 choice) SINT8 belongsto = PR_ProfileUsedBy(optionsmenu.profile); // Save the profile optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; + optionsmenu.profile->autospin = cv_dummyprofileautospin.value; optionsmenu.profile->rumble = cv_dummyprofilerumble.value; memcpy(&optionsmenu.profile->controls, optionsmenu.tempcontrols, sizeof(gamecontroldefault)); @@ -196,6 +200,7 @@ static void M_ProfileControlSaveResponse(INT32 choice) { memcpy(&gamecontrol[belongsto], optionsmenu.tempcontrols, sizeof(gamecontroldefault)); CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value); + CV_SetValue(&cv_autospin[belongsto], cv_dummyprofileautospin.value); CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value); } @@ -213,6 +218,7 @@ void M_ProfileControlsConfirm(INT32 choice) M_ProfileControlSaveResponse(MA_YES); optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel. + optionsmenu.profile->autospin = cv_dummyprofileautospin.value; // We should really just rip this entire construct out at some point optionsmenu.profile->rumble = cv_dummyprofilerumble.value; // And rumble too! // Reapply player 1's real profile. diff --git a/src/p_saveg.c b/src/p_saveg.c index f948c7fa0..2a9ad6710 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -623,6 +623,7 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT32(save->p, players[i].itemRoulette.elapsed); WRITEUINT8(save->p, players[i].itemRoulette.eggman); WRITEUINT8(save->p, players[i].itemRoulette.ringbox); + WRITEUINT8(save->p, players[i].itemRoulette.autospin); // sonicloopsvars_t WRITEFIXED(save->p, players[i].loop.radius); @@ -1058,6 +1059,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].itemRoulette.elapsed = (tic_t)READUINT32(save->p); players[i].itemRoulette.eggman = (boolean)READUINT8(save->p); players[i].itemRoulette.ringbox = (boolean)READUINT8(save->p); + players[i].itemRoulette.autospin = (boolean)READUINT8(save->p); // sonicloopsvars_t players[i].loop.radius = READFIXED(save->p); From 573a44fbfe44cb7f75851e3818f9b26485aa0a6c Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 20 Aug 2023 16:03:05 -0700 Subject: [PATCH 02/12] Auto Spin todos --- src/k_roulette.c | 2 +- src/menus/options-profiles-edit-controls.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/k_roulette.c b/src/k_roulette.c index 4552b7b18..dcbd27109 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -1595,7 +1595,7 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) if (roulette->elapsed > TICRATE>>1) // Prevent accidental immediate item confirm { - if (roulette->elapsed > TICRATE<<4 || (roulette->eggman && roulette->elapsed > TICRATE*4)) + if (roulette->elapsed > TICRATE<<4 || (roulette->eggman && !roulette->autospin && roulette->elapsed > TICRATE*4)) { // Waited way too long, forcefully confirm the item. confirmItem = true; diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index 6f155d2af..0988d2ccb 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -91,7 +91,7 @@ menuitem_t OPTIONS_ProfileControls[] = { {IT_CONTROL | IT_CVAR, "KICKSTART ACCEL", "Hold A to auto-accel. Tap it to cancel.", NULL, {.cvar = &cv_dummyprofilekickstart}, 0, 0}, - {IT_CONTROL | IT_CVAR, "AUTO SPIN", "Automatically stop the item box on a random result.", + {IT_CONTROL | IT_CVAR, "AUTO SPIN", "Item roulette auto-stops on a random result.", NULL, {.cvar = &cv_dummyprofileautospin}, 0, 0}, {IT_HEADER, "EXTRA", "", From 88f54b298e87db4fec18d16743995766c407817e Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 20 Aug 2023 16:03:43 -0700 Subject: [PATCH 03/12] Auto Spin review fixup --- src/d_netcmd.c | 2 +- src/menus/options-profiles-1.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a90167104..bc0f3602a 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1872,7 +1872,7 @@ void WeaponPref_Parse(UINT8 **cp, INT32 playernum) if (leveltime < 2) { - // BAD HACK: No other place I ried to slot this in + // BAD HACK: No other place I tried to slot this in // made it work for the host when they initally host, // so this will have to do. K_UpdateShrinkCheat(player); diff --git a/src/menus/options-profiles-1.c b/src/menus/options-profiles-1.c index 6fb145b67..7c96a490b 100644 --- a/src/menus/options-profiles-1.c +++ b/src/menus/options-profiles-1.c @@ -94,7 +94,7 @@ static void M_StartEditProfile(INT32 c) CV_StealthSet(&cv_dummyprofilename, optionsmenu.profile->profilename); CV_StealthSet(&cv_dummyprofileplayername, optionsmenu.profile->playername); CV_StealthSetValue(&cv_dummyprofilekickstart, optionsmenu.profile->kickstartaccel); - CV_StealthSetValue(&cv_dummyprofileautospin, optionsmenu.profile->kickstartaccel); + CV_StealthSetValue(&cv_dummyprofileautospin, optionsmenu.profile->autospin); CV_StealthSetValue(&cv_dummyprofilerumble, optionsmenu.profile->rumble); } else From 3900189199ad118b0b4696a20b55d11c5cf73458 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 20 Aug 2023 16:26:34 -0700 Subject: [PATCH 04/12] Auto Spin -> Auto Roulette --- src/d_netcmd.c | 18 +++++++++--------- src/d_player.h | 4 ++-- src/deh_tables.c | 2 +- src/g_demo.c | 20 ++++++++++---------- src/g_game.c | 12 ++++++------ src/g_game.h | 2 +- src/k_hud.c | 8 ++++---- src/k_hud.h | 2 +- src/k_menu.h | 2 +- src/k_menufunc.c | 2 +- src/k_profiles.c | 14 +++++++------- src/k_profiles.h | 2 +- src/k_roulette.c | 20 ++++++++++---------- src/m_random.h | 2 +- src/menus/options-profiles-1.c | 6 +++--- src/menus/options-profiles-edit-controls.c | 10 +++++----- src/p_saveg.c | 4 ++-- 17 files changed, 65 insertions(+), 65 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index bc0f3602a..b0af9f6d3 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1061,7 +1061,7 @@ void D_RegisterClientCommands(void) for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { CV_RegisterVar(&cv_kickstartaccel[i]); - CV_RegisterVar(&cv_autospin[i]); + CV_RegisterVar(&cv_autoroulette[i]); CV_RegisterVar(&cv_shrinkme[i]); CV_RegisterVar(&cv_deadzone[i]); CV_RegisterVar(&cv_rumble[i]); @@ -1816,7 +1816,7 @@ static void Got_NameAndColor(UINT8 **cp, INT32 playernum) enum { WP_KICKSTARTACCEL = 1<<0, WP_SHRINKME = 1<<1, - WP_AUTOSPIN = 1<<2, + WP_AUTOROULETTE = 1<<2, }; void WeaponPref_Send(UINT8 ssplayer) @@ -1826,8 +1826,8 @@ void WeaponPref_Send(UINT8 ssplayer) if (cv_kickstartaccel[ssplayer].value) prefs |= WP_KICKSTARTACCEL; - if (cv_autospin[ssplayer].value) - prefs |= WP_AUTOSPIN; + if (cv_autoroulette[ssplayer].value) + prefs |= WP_AUTOROULETTE; if (cv_shrinkme[ssplayer].value) prefs |= WP_SHRINKME; @@ -1844,8 +1844,8 @@ void WeaponPref_Save(UINT8 **cp, INT32 playernum) if (player->pflags & PF_KICKSTARTACCEL) prefs |= WP_KICKSTARTACCEL; - if (player->pflags & PF_AUTOSPIN) - prefs |= WP_AUTOSPIN; + if (player->pflags & PF_AUTOROULETTE) + prefs |= WP_AUTOROULETTE; if (player->pflags & PF_SHRINKME) prefs |= WP_SHRINKME; @@ -1859,13 +1859,13 @@ void WeaponPref_Parse(UINT8 **cp, INT32 playernum) UINT8 prefs = READUINT8(*cp); - player->pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME|PF_AUTOSPIN); + player->pflags &= ~(PF_KICKSTARTACCEL|PF_SHRINKME|PF_AUTOROULETTE); if (prefs & WP_KICKSTARTACCEL) player->pflags |= PF_KICKSTARTACCEL; - if (prefs & WP_AUTOSPIN) - player->pflags |= PF_AUTOSPIN; + if (prefs & WP_AUTOROULETTE) + player->pflags |= PF_AUTOROULETTE; if (prefs & WP_SHRINKME) player->pflags |= PF_SHRINKME; diff --git a/src/d_player.h b/src/d_player.h index 2c25bd4d2..292ec12f4 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -66,7 +66,7 @@ typedef enum // free: 1<<1 - PF_AUTOSPIN = 1<<2, // Accessibility: Non-deterministic item box, no manual stop. + PF_AUTOROULETTE = 1<<2, // Accessibility: Non-deterministic item box, no manual stop. // Look back VFX has been spawned // TODO: Is there a better way to track this? @@ -439,7 +439,7 @@ struct itemroulette_t boolean eggman; boolean ringbox; - boolean autospin; + boolean autoroulette; }; // enum for bot item priorities diff --git a/src/deh_tables.c b/src/deh_tables.c index 8db5279b0..4ef20cf36 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -5931,7 +5931,7 @@ const char *const PLAYERFLAG_LIST[] = { // free: 1<<1 and 1<<2 (name un-matchable) "\x01", - "AUTOSPIN", // Item box accessibility + "AUTOROULETTE", // Item box accessibility // Look back VFX has been spawned // TODO: Is there a better way to track this? diff --git a/src/g_demo.c b/src/g_demo.c index e73dde2e9..b7b708ed4 100644 --- a/src/g_demo.c +++ b/src/g_demo.c @@ -133,11 +133,11 @@ demoghost *ghosts = NULL; #define DF_ENCORE 0x40 #define DF_MULTIPLAYER 0x80 // This demo was recorded in multiplayer mode! -#define DEMO_SPECTATOR 0x01 -#define DEMO_KICKSTART 0x02 -#define DEMO_SHRINKME 0x04 -#define DEMO_BOT 0x08 -#define DEMO_AUTOSPIN 0x10 +#define DEMO_SPECTATOR 0x01 +#define DEMO_KICKSTART 0x02 +#define DEMO_SHRINKME 0x04 +#define DEMO_BOT 0x08 +#define DEMO_AUTOROULETTE 0x10 // For demos #define ZT_FWD 0x0001 @@ -2475,8 +2475,8 @@ void G_BeginRecording(void) i |= DEMO_SPECTATOR; if (player->pflags & PF_KICKSTARTACCEL) i |= DEMO_KICKSTART; - if (player->pflags & PF_AUTOSPIN) - i |= DEMO_AUTOSPIN; + if (player->pflags & PF_AUTOROULETTE) + i |= DEMO_AUTOROULETTE; if (player->pflags & PF_SHRINKME) i |= DEMO_SHRINKME; if (player->bot == true) @@ -3439,10 +3439,10 @@ void G_DoPlayDemo(const char *defdemoname) else players[p].pflags &= ~PF_KICKSTARTACCEL; - if (flags & DEMO_AUTOSPIN) - players[p].pflags |= PF_AUTOSPIN; + if (flags & DEMO_AUTOROULETTE) + players[p].pflags |= PF_AUTOROULETTE; else - players[p].pflags &= ~PF_AUTOSPIN; + players[p].pflags &= ~PF_AUTOROULETTE; if (flags & DEMO_SHRINKME) players[p].pflags |= PF_SHRINKME; diff --git a/src/g_game.c b/src/g_game.c index 1cacc3440..97d28c395 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -408,11 +408,11 @@ consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS] = { CVAR_INIT ("kickstartaccel4", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange4) }; -consvar_t cv_autospin[MAXSPLITSCREENPLAYERS] = { - CVAR_INIT ("autospin", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange), - CVAR_INIT ("autospin2", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange2), - CVAR_INIT ("autospin3", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange3), - CVAR_INIT ("autospin4", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange4) +consvar_t cv_autoroulette[MAXSPLITSCREENPLAYERS] = { + CVAR_INIT ("autoroulette", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange), + CVAR_INIT ("autoroulette2", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange2), + CVAR_INIT ("autoroulette3", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange3), + CVAR_INIT ("autoroulette4", "Off", CV_SAVE|CV_CALL, CV_OnOff, weaponPrefChange4) }; consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS] = { @@ -2223,7 +2223,7 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps) totalring = players[player].totalring; xtralife = players[player].xtralife; - pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL|PF_SHRINKME|PF_SHRINKACTIVE|PF_AUTOSPIN)); + pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL|PF_SHRINKME|PF_SHRINKACTIVE|PF_AUTOROULETTE)); // SRB2kart memcpy(&itemRoulette, &players[player].itemRoulette, sizeof (itemRoulette)); diff --git a/src/g_game.h b/src/g_game.h index f9aead0f4..858b4ff8d 100644 --- a/src/g_game.h +++ b/src/g_game.h @@ -95,7 +95,7 @@ extern consvar_t cv_songcredits; extern consvar_t cv_pauseifunfocused; extern consvar_t cv_kickstartaccel[MAXSPLITSCREENPLAYERS]; -extern consvar_t cv_autospin[MAXSPLITSCREENPLAYERS]; +extern consvar_t cv_autoroulette[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_shrinkme[MAXSPLITSCREENPLAYERS]; extern consvar_t cv_deadzone[MAXSPLITSCREENPLAYERS]; diff --git a/src/k_hud.c b/src/k_hud.c index 69cad88d6..af15b474a 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -193,7 +193,7 @@ static patch_t *kp_bossret[4]; static patch_t *kp_trickcool[2]; -patch_t *kp_autospin; +patch_t *kp_autoroulette; patch_t *kp_capsuletarget_arrow[2][2]; patch_t *kp_capsuletarget_icon[2]; @@ -712,7 +712,7 @@ void K_LoadKartHUDGraphics(void) HU_UpdatePatch(&kp_trickcool[0], "K_COOL1"); HU_UpdatePatch(&kp_trickcool[1], "K_COOL2"); - HU_UpdatePatch(&kp_autospin, "A11YITEM"); + HU_UpdatePatch(&kp_autoroulette, "A11YITEM"); sprintf(buffer, "K_BOSB0x"); for (i = 0; i < 8; i++) @@ -2821,12 +2821,12 @@ static void K_drawKartAccessibilityIcons(boolean gametypeinfoshown, INT32 fx) } // Auto Roulette - if (stplyr->pflags & PF_AUTOSPIN) + if (stplyr->pflags & PF_AUTOROULETTE) { if (mirror) fx -= 12; - V_DrawScaledPatch(fx, fy-1, V_SLIDEIN|splitflags, kp_autospin); + V_DrawScaledPatch(fx, fy-1, V_SLIDEIN|splitflags, kp_autoroulette); if (mirror) fx--; diff --git a/src/k_hud.h b/src/k_hud.h index 384a2bed2..d982c851b 100644 --- a/src/k_hud.h +++ b/src/k_hud.h @@ -61,7 +61,7 @@ extern patch_t *kp_capsuletarget_near[8]; extern patch_t *kp_superflickytarget[4]; -extern patch_t *kp_autospin; +extern patch_t *kp_autoroulette; extern patch_t *kp_button_a[2][2]; extern patch_t *kp_button_b[2][2]; diff --git a/src/k_menu.h b/src/k_menu.h index 235386197..69ec29542 100644 --- a/src/k_menu.h +++ b/src/k_menu.h @@ -981,7 +981,7 @@ extern INT16 controlleroffsets[][2]; extern consvar_t cv_dummyprofilename; extern consvar_t cv_dummyprofileplayername; extern consvar_t cv_dummyprofilekickstart; -extern consvar_t cv_dummyprofileautospin; +extern consvar_t cv_dummyprofileautoroulette; extern consvar_t cv_dummyprofilerumble; void M_ResetOptions(void); diff --git a/src/k_menufunc.c b/src/k_menufunc.c index 2df5c4177..54b0f26b7 100644 --- a/src/k_menufunc.c +++ b/src/k_menufunc.c @@ -1215,7 +1215,7 @@ void M_Init(void) CV_RegisterVar(&cv_dummyprofilename); CV_RegisterVar(&cv_dummyprofileplayername); CV_RegisterVar(&cv_dummyprofilekickstart); - CV_RegisterVar(&cv_dummyprofileautospin); + CV_RegisterVar(&cv_dummyprofileautoroulette); CV_RegisterVar(&cv_dummyprofilerumble); CV_RegisterVar(&cv_dummygpdifficulty); diff --git a/src/k_profiles.c b/src/k_profiles.c index 34d61bc10..817392d68 100644 --- a/src/k_profiles.c +++ b/src/k_profiles.c @@ -68,7 +68,7 @@ profile_t* PR_MakeProfile( strcpy(new->follower, fname); new->followercolor = fcol; new->kickstartaccel = false; - new->autospin = false; + new->autoroulette = false; // Copy from gamecontrol directly as we'll be setting controls up directly in the profile. memcpy(new->controls, controlarray, sizeof(new->controls)); @@ -85,7 +85,7 @@ profile_t* PR_MakeProfileFromPlayer(const char *prname, const char *pname, const // Player bound cvars: new->kickstartaccel = cv_kickstartaccel[pnum].value; - new->autospin = cv_autospin[pnum].value; + new->autoroulette = cv_autoroulette[pnum].value; new->rumble = cv_rumble[pnum].value; return new; @@ -272,7 +272,7 @@ void PR_SaveProfiles(void) // Consvars. WRITEUINT8(save.p, profilesList[i]->kickstartaccel); - WRITEUINT8(save.p, profilesList[i]->autospin); + WRITEUINT8(save.p, profilesList[i]->autoroulette); WRITEUINT8(save.p, profilesList[i]->rumble); // Controls. @@ -411,15 +411,15 @@ void PR_LoadProfiles(void) // Consvars. profilesList[i]->kickstartaccel = (boolean)READUINT8(save.p); - // 6->7, add autospin + // 6->7, add autoroulette if (version < 7) { - profilesList[i]->autospin = false; + profilesList[i]->autoroulette = false; } else { - profilesList[i]->autospin = (boolean)READUINT8(save.p); + profilesList[i]->autoroulette = (boolean)READUINT8(save.p); } if (version < 4) @@ -474,7 +474,7 @@ static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum) { // toggles CV_StealthSetValue(&cv_kickstartaccel[playernum], p->kickstartaccel); - CV_StealthSetValue(&cv_autospin[playernum], p->autospin); + CV_StealthSetValue(&cv_autoroulette[playernum], p->autoroulette); // set controls... memcpy(&gamecontrol[playernum], p->controls, sizeof(gamecontroldefault)); diff --git a/src/k_profiles.h b/src/k_profiles.h index b78a1daf2..8fc72212f 100644 --- a/src/k_profiles.h +++ b/src/k_profiles.h @@ -74,7 +74,7 @@ struct profile_t // Player-specific consvars. // @TODO: List all of those boolean kickstartaccel; // cv_kickstartaccel - boolean autospin; // cv_autospin + boolean autoroulette; // cv_autoroulette boolean rumble; // cv_rumble // Finally, control data itself diff --git a/src/k_roulette.c b/src/k_roulette.c index dcbd27109..8bc351822 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -1074,7 +1074,7 @@ static void K_InitRoulette(itemroulette_t *const roulette) roulette->active = true; roulette->eggman = false; roulette->ringbox = false; - roulette->autospin = false; + roulette->autoroulette = false; for (i = 0; i < MAXPLAYERS; i++) { @@ -1236,7 +1236,7 @@ static void K_CalculateRouletteSpeed(itemroulette_t *const roulette) return; } - if (roulette->autospin == true) + if (roulette->autoroulette == true) { roulette->speed = ROULETTE_SPEED_FASTEST; return; @@ -1304,8 +1304,8 @@ void K_FillItemRouletteData(const player_t *player, itemroulette_t *const roulet { roulette->baseDist = K_UndoMapScaling(player->distancetofinish); - if (player->pflags & PF_AUTOSPIN) - roulette->autospin = true; + if (player->pflags & PF_AUTOROULETTE) + roulette->autoroulette = true; K_CalculateRouletteSpeed(roulette); } @@ -1467,8 +1467,8 @@ void K_StartItemRoulette(player_t *const player, boolean ringbox) K_FillItemRouletteData(player, roulette, ringbox); - if (roulette->autospin) - roulette->index = P_RandomRange(PR_AUTOSPIN, 0, roulette->itemListLen - 1); + if (roulette->autoroulette) + roulette->index = P_RandomRange(PR_AUTOROULETTE, 0, roulette->itemListLen - 1); if (K_PlayerUsesBotMovement(player) == true) { @@ -1595,12 +1595,12 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) if (roulette->elapsed > TICRATE>>1) // Prevent accidental immediate item confirm { - if (roulette->elapsed > TICRATE<<4 || (roulette->eggman && !roulette->autospin && roulette->elapsed > TICRATE*4)) + if (roulette->elapsed > TICRATE<<4 || (roulette->eggman && !roulette->autoroulette && roulette->elapsed > TICRATE*4)) { // Waited way too long, forcefully confirm the item. confirmItem = true; } - else if (roulette->autospin) + else if (roulette->autoroulette) { confirmItem = (roulette->speed > 15); } @@ -1635,7 +1635,7 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) // D2 fudge factor. Roulette was originally designed and tested with this delay. UINT8 fudgedDelay = (player->cmd.latency <= 2) ? 0 : player->cmd.latency - 2; - if (roulette->autospin) + if (roulette->autoroulette) fudgedDelay = 0; // We didn't manually stop this, you jackwagon while (fudgedDelay > 0) @@ -1693,7 +1693,7 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) roulette->elapsed++; - if (roulette->autospin && (roulette->elapsed % 5 == 0) && (roulette->elapsed > TICRATE)) + if (roulette->autoroulette && (roulette->elapsed % 5 == 0) && (roulette->elapsed > TICRATE)) roulette->speed++; if (roulette->tics == 0) diff --git a/src/m_random.h b/src/m_random.h index a4b22f7d1..f3e81f938 100644 --- a/src/m_random.h +++ b/src/m_random.h @@ -78,7 +78,7 @@ typedef enum PR_BOTS, // Bot spawning - PR_AUTOSPIN, // Item box accessibility + PR_AUTOROULETTE, // Item box accessibility PRNUMCLASS } pr_class_t; diff --git a/src/menus/options-profiles-1.c b/src/menus/options-profiles-1.c index 7c96a490b..b27578c75 100644 --- a/src/menus/options-profiles-1.c +++ b/src/menus/options-profiles-1.c @@ -30,7 +30,7 @@ menu_t OPTIONS_ProfilesDef = { consvar_t cv_dummyprofilename = CVAR_INIT ("dummyprofilename", "", CV_HIDDEN, NULL, NULL); consvar_t cv_dummyprofileplayername = CVAR_INIT ("dummyprofileplayername", "", CV_HIDDEN, NULL, NULL); consvar_t cv_dummyprofilekickstart = CVAR_INIT ("dummyprofilekickstart", "Off", CV_HIDDEN, CV_OnOff, NULL); -consvar_t cv_dummyprofileautospin = CVAR_INIT ("dummyprofileautospin", "Off", CV_HIDDEN, CV_OnOff, NULL); +consvar_t cv_dummyprofileautoroulette = CVAR_INIT ("dummyprofileautoroulette", "Off", CV_HIDDEN, CV_OnOff, NULL); consvar_t cv_dummyprofilerumble = CVAR_INIT ("dummyprofilerumble", "On", CV_HIDDEN, CV_OnOff, NULL); void M_ProfileSelectInit(INT32 choice) @@ -94,7 +94,7 @@ static void M_StartEditProfile(INT32 c) CV_StealthSet(&cv_dummyprofilename, optionsmenu.profile->profilename); CV_StealthSet(&cv_dummyprofileplayername, optionsmenu.profile->playername); CV_StealthSetValue(&cv_dummyprofilekickstart, optionsmenu.profile->kickstartaccel); - CV_StealthSetValue(&cv_dummyprofileautospin, optionsmenu.profile->autospin); + CV_StealthSetValue(&cv_dummyprofileautoroulette, optionsmenu.profile->autoroulette); CV_StealthSetValue(&cv_dummyprofilerumble, optionsmenu.profile->rumble); } else @@ -102,7 +102,7 @@ static void M_StartEditProfile(INT32 c) CV_StealthSet(&cv_dummyprofilename, ""); CV_StealthSet(&cv_dummyprofileplayername, ""); CV_StealthSetValue(&cv_dummyprofilekickstart, 0); // off - CV_StealthSetValue(&cv_dummyprofileautospin, 0); // off + CV_StealthSetValue(&cv_dummyprofileautoroulette, 0); // off CV_StealthSetValue(&cv_dummyprofilerumble, 1); // on } diff --git a/src/menus/options-profiles-edit-controls.c b/src/menus/options-profiles-edit-controls.c index 0988d2ccb..dc648abd6 100644 --- a/src/menus/options-profiles-edit-controls.c +++ b/src/menus/options-profiles-edit-controls.c @@ -91,8 +91,8 @@ menuitem_t OPTIONS_ProfileControls[] = { {IT_CONTROL | IT_CVAR, "KICKSTART ACCEL", "Hold A to auto-accel. Tap it to cancel.", NULL, {.cvar = &cv_dummyprofilekickstart}, 0, 0}, - {IT_CONTROL | IT_CVAR, "AUTO SPIN", "Item roulette auto-stops on a random result.", - NULL, {.cvar = &cv_dummyprofileautospin}, 0, 0}, + {IT_CONTROL | IT_CVAR, "AUTO ROULETTE", "Item roulette auto-stops on a random result.", + NULL, {.cvar = &cv_dummyprofileautoroulette}, 0, 0}, {IT_HEADER, "EXTRA", "", NULL, {NULL}, 0, 0}, @@ -190,7 +190,7 @@ static void M_ProfileControlSaveResponse(INT32 choice) SINT8 belongsto = PR_ProfileUsedBy(optionsmenu.profile); // Save the profile optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; - optionsmenu.profile->autospin = cv_dummyprofileautospin.value; + optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; optionsmenu.profile->rumble = cv_dummyprofilerumble.value; memcpy(&optionsmenu.profile->controls, optionsmenu.tempcontrols, sizeof(gamecontroldefault)); @@ -200,7 +200,7 @@ static void M_ProfileControlSaveResponse(INT32 choice) { memcpy(&gamecontrol[belongsto], optionsmenu.tempcontrols, sizeof(gamecontroldefault)); CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value); - CV_SetValue(&cv_autospin[belongsto], cv_dummyprofileautospin.value); + CV_SetValue(&cv_autoroulette[belongsto], cv_dummyprofileautoroulette.value); CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value); } @@ -218,7 +218,7 @@ void M_ProfileControlsConfirm(INT32 choice) M_ProfileControlSaveResponse(MA_YES); optionsmenu.profile->kickstartaccel = cv_dummyprofilekickstart.value; // Make sure to save kickstart accel. - optionsmenu.profile->autospin = cv_dummyprofileautospin.value; // We should really just rip this entire construct out at some point + optionsmenu.profile->autoroulette = cv_dummyprofileautoroulette.value; // We should really just rip this entire construct out at some point optionsmenu.profile->rumble = cv_dummyprofilerumble.value; // And rumble too! // Reapply player 1's real profile. diff --git a/src/p_saveg.c b/src/p_saveg.c index 2a9ad6710..e8448c255 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -623,7 +623,7 @@ static void P_NetArchivePlayers(savebuffer_t *save) WRITEUINT32(save->p, players[i].itemRoulette.elapsed); WRITEUINT8(save->p, players[i].itemRoulette.eggman); WRITEUINT8(save->p, players[i].itemRoulette.ringbox); - WRITEUINT8(save->p, players[i].itemRoulette.autospin); + WRITEUINT8(save->p, players[i].itemRoulette.autoroulette); // sonicloopsvars_t WRITEFIXED(save->p, players[i].loop.radius); @@ -1059,7 +1059,7 @@ static void P_NetUnArchivePlayers(savebuffer_t *save) players[i].itemRoulette.elapsed = (tic_t)READUINT32(save->p); players[i].itemRoulette.eggman = (boolean)READUINT8(save->p); players[i].itemRoulette.ringbox = (boolean)READUINT8(save->p); - players[i].itemRoulette.autospin = (boolean)READUINT8(save->p); + players[i].itemRoulette.autoroulette = (boolean)READUINT8(save->p); // sonicloopsvars_t players[i].loop.radius = READFIXED(save->p); From b4b09ffd3352e4ab6e56d2ac755868867082cec1 Mon Sep 17 00:00:00 2001 From: AJ Martinez Date: Sun, 20 Aug 2023 20:44:06 -0700 Subject: [PATCH 05/12] Auto Roulette: stop after 2 seconds max speed --- src/k_roulette.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/k_roulette.c b/src/k_roulette.c index 8bc351822..3dce1b705 100644 --- a/src/k_roulette.c +++ b/src/k_roulette.c @@ -1602,7 +1602,8 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) } else if (roulette->autoroulette) { - confirmItem = (roulette->speed > 15); + // confirmItem = (roulette->speed > 15); + confirmItem = (roulette->elapsed == TICRATE*2); } else { @@ -1693,8 +1694,10 @@ void K_KartItemRoulette(player_t *const player, ticcmd_t *const cmd) roulette->elapsed++; + /* if (roulette->autoroulette && (roulette->elapsed % 5 == 0) && (roulette->elapsed > TICRATE)) roulette->speed++; + */ if (roulette->tics == 0) { From 019546e84699cc557d9ac5913db31dabfb72e56a Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 25 Aug 2023 14:42:01 -0400 Subject: [PATCH 06/12] Add server join splash Just wanted to give literally any possibility of seeing the server contact as a client --- src/d_clisrv.c | 17 +++++++- src/d_clisrv.h | 8 +++- src/d_main.c | 2 - src/d_netcmd.c | 2 - src/st_stuff.c | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ src/v_video.cpp | 14 +++++- src/v_video.h | 6 +-- 7 files changed, 148 insertions(+), 11 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 53bbaf0b6..79f081e41 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -163,6 +163,7 @@ static UINT8 localtextcmd[MAXSPLITSCREENPLAYERS][MAXTEXTCMD]; static tic_t neededtic; SINT8 servernode = 0; // the number of the server node char connectedservername[MAXSERVERNAME]; +char connectedservercontact[MAXSERVERCONTACT]; /// \brief do we accept new players? /// \todo WORK! boolean acceptnewnode = true; @@ -1283,6 +1284,9 @@ static boolean SV_SendServerConfig(INT32 node) memcpy(netbuffer->u.servercfg.server_context, server_context, 8); + strncpy(netbuffer->u.servercfg.server_name, cv_servername.string, MAXSERVERNAME); + strncpy(netbuffer->u.servercfg.server_contact, cv_server_contact.string, MAXSERVERCONTACT); + { const size_t len = sizeof (serverconfig_pak); @@ -3799,6 +3803,9 @@ void SV_ResetServer(void) // clear server_context memset(server_context, '-', 8); + memset(connectedservername, 0, MAXSERVERNAME); + memset(connectedservercontact, 0, MAXSERVERCONTACT); + CV_RevertNetVars(); // Copy our unlocks to a place where net material can grab at/overwrite them safely. @@ -3811,9 +3818,10 @@ void SV_ResetServer(void) DEBFILE("\n-=-=-=-=-=-=-= Server Reset =-=-=-=-=-=-=-\n\n"); } -static inline void SV_GenContext(void) +static void SV_GenContext(void) { UINT8 i; + // generate server_context, as exactly 8 bytes of randomly mixed A-Z and a-z // (hopefully M_Random is initialized!! if not this will be awfully silly!) for (i = 0; i < 8; i++) @@ -3824,6 +3832,9 @@ static inline void SV_GenContext(void) else // lowercase server_context[i] = 'a'+(a-26); } + + strncpy(connectedservername, cv_servername.string, MAXSERVERNAME); + strncpy(connectedservercontact, cv_server_contact.string, MAXSERVERCONTACT); } // @@ -4874,7 +4885,11 @@ static void HandlePacketFromAwayNode(SINT8 node) G_SetGametype(netbuffer->u.servercfg.gametype); modifiedgame = netbuffer->u.servercfg.modifiedgame; + memcpy(server_context, netbuffer->u.servercfg.server_context, 8); + + strncpy(connectedservername, netbuffer->u.servercfg.server_name, MAXSERVERNAME); + strncpy(connectedservercontact, netbuffer->u.servercfg.server_contact, MAXSERVERCONTACT); } #ifdef HAVE_DISCORDRPC diff --git a/src/d_clisrv.h b/src/d_clisrv.h index e2dd85bff..fdcf4d0fe 100644 --- a/src/d_clisrv.h +++ b/src/d_clisrv.h @@ -43,6 +43,9 @@ applications may follow different packet versions. #define HU_MAXMSGLEN 223 +#define MAXSERVERNAME 32 +#define MAXSERVERCONTACT 1024 + // Networking and tick handling related. #define BACKUPTICS 512 // more than enough for most timeouts.... #define CLIENTBACKUPTICS 32 @@ -226,6 +229,9 @@ struct serverconfig_pak UINT8 maxplayer; boolean allownewplayer; boolean discordinvites; + + char server_name[MAXSERVERNAME]; + char server_contact[MAXSERVERCONTACT]; } ATTRPACK; struct filetx_pak @@ -276,7 +282,6 @@ struct clientconfig_pak #define SV_DEDICATED 0x40 // server is dedicated #define SV_LOTSOFADDONS 0x20 // flag used to ask for full file list in d_netfil -#define MAXSERVERNAME 32 #define MAXFILENEEDED 915 #define MAX_MIRROR_LENGTH 256 // This packet is too large @@ -509,6 +514,7 @@ extern UINT16 software_MAXPACKETLENGTH; extern boolean acceptnewnode; extern SINT8 servernode; extern char connectedservername[MAXSERVERNAME]; +extern char connectedservercontact[MAXSERVERCONTACT]; extern UINT32 ourIP; extern uint8_t lastReceivedKey[MAXNETNODES][MAXSPLITSCREENPLAYERS][PUBKEYLENGTH]; extern uint8_t lastSentChallenge[MAXNETNODES][CHALLENGELENGTH]; diff --git a/src/d_main.c b/src/d_main.c index fd05bc3cd..c17737060 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1913,8 +1913,6 @@ void D_SRB2Main(void) COM_BufExecute(); // ensure the command buffer gets executed before the map starts (+skin) - strncpy(connectedservername, cv_servername.string, MAXSERVERNAME); - if (M_CheckParm("-gametype") && M_IsNextParm()) { // from Command_Map_f diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 7ad288f25..20425deee 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3012,8 +3012,6 @@ static void Command_Map_f(void) multiplayer = true; netgame = false; - strncpy(connectedservername, cv_servername.string, MAXSERVERNAME); - if (cv_maxconnections.value < ssplayers+1) CV_SetValue(&cv_maxconnections, ssplayers+1); diff --git a/src/st_stuff.c b/src/st_stuff.c index c7166c414..b6581e71a 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1303,6 +1303,113 @@ void ST_AskToJoinEnvelope(void) } #endif +static INT32 ST_ServerSplash_OpacityFlag(INT32 opacity) +{ + if (opacity >= NUMTRANSMAPS) + { + return 0; + } + + opacity = max(opacity, 1); + return (NUMTRANSMAPS - opacity) << V_ALPHASHIFT; +} + +static void ST_DrawServerSplash(void) +{ + static const fixed_t SPLASH_LEN = (FRACUNIT * TICRATE) * 3; + static const fixed_t SPLASH_WAIT = (FRACUNIT * TICRATE) / 2; + + static fixed_t splashTime = -SPLASH_WAIT; + static char prevContext[8] = {0}; + + if (memcmp(prevContext, server_context, 8) != 0) + { + // Context changed, we want to draw it again + splashTime = -SPLASH_WAIT; + memcpy(prevContext, server_context, 8); + } + + if (lt_ticker < lt_endtime) + { + // Level title is running rn + return; + } + + if (splashTime >= SPLASH_LEN) + { + // We finished drawing it + return; + } + + splashTime += renderdeltatics; + if (splashTime <= 0) + { + // We're waiting a tiny bit to draw it + return; + } + + const INT32 splashTic = splashTime >> FRACBITS; + INT32 opacity = NUMTRANSMAPS; + if (splashTic < NUMTRANSMAPS) + { + opacity = splashTic; + } + else if (splashTic > (SPLASH_LEN >> FRACBITS) - NUMTRANSMAPS) + { + opacity = (SPLASH_LEN >> FRACBITS) - splashTic; + } + INT32 opacityFlag = ST_ServerSplash_OpacityFlag(opacity); + + patch_t *gridPatch = W_CachePatchName("MOTDBG", PU_CACHE); + fixed_t gridX = -splashTime / 3; + fixed_t gridY = (BASEVIDHEIGHT - gridPatch->height) * FRACUNIT; + INT32 gridOpacity = ST_ServerSplash_OpacityFlag(opacity / 2); + fixed_t maxX = (vid.width * FRACUNIT) / vid.dupx; + + while (gridX < maxX) + { + V_DrawFixedPatch( + gridX, gridY, + FRACUNIT, + (V_SNAPTOLEFT|V_SNAPTOBOTTOM) | V_SUBTRACT | gridOpacity, + gridPatch, + NULL + ); + + gridX += (gridPatch->width * FRACUNIT); + } + + patch_t *iconPatch = W_CachePatchName("MOTDICON", PU_CACHE); + fixed_t iconX = (BASEVIDWIDTH - 16 - iconPatch->width) * FRACUNIT; + fixed_t iconY = (BASEVIDHEIGHT - 8 - iconPatch->height) * FRACUNIT; + V_DrawFixedPatch( + iconX, iconY, + FRACUNIT, + (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, + iconPatch, + NULL + ); + + fixed_t textX = (BASEVIDWIDTH - 16 - 36) * FRACUNIT; + fixed_t textY = (BASEVIDHEIGHT - 24) * FRACUNIT; + + if (connectedservercontact[0] != 0) + { + V_DrawRightAlignedThinStringAtFixed( + textX, textY, + (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, + va("Contact @ %s", connectedservercontact) + ); + textY -= (10 * FRACUNIT); + } + + V_DrawRightAlignedStringAtFixed( + textX, textY, + (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, + connectedservername + ); +} + void ST_Drawer(void) { boolean stagetitle = false; // Decide whether to draw the stage title or not @@ -1377,6 +1484,9 @@ void ST_Drawer(void) if (stagetitle) ST_drawTitleCard(); + if (netgame) + ST_DrawServerSplash(); + // Replay manual-save stuff if (demo.recording && multiplayer && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime) { diff --git a/src/v_video.cpp b/src/v_video.cpp index 17519f894..351ff4d46 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -2789,12 +2789,24 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st V_DrawThinString(x, y, option, string); } -void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { x -= (V_ThinStringWidth(string, option) / 2) * FRACUNIT; V_DrawThinStringAtFixed(x, y, option, string); } +void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= V_StringWidth(string, option) * FRACUNIT; + V_DrawStringAtFixed(x, y, option, string); +} + +void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) +{ + x -= (V_StringWidth(string, option) / 2) * FRACUNIT; + V_DrawStringAtFixed(x, y, option, string); +} + void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string) { x -= V_ThinStringWidth(string, option) * FRACUNIT; diff --git a/src/v_video.h b/src/v_video.h index 7a26591dc..f7c32505c 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -334,16 +334,14 @@ void V_DrawRightAlignedThinString(INT32 x, INT32 y, INT32 option, const char *st #define V_DrawStringAtFixed( x,y,option,string ) \ V__DrawOneScaleString (x,y,FRACUNIT,option,NULL,HU_FONT,string) +void V_DrawCenteredStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); +void V_DrawRightAlignedStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); #define V_DrawThinStringAtFixed( x,y,option,string ) \ V__DrawOneScaleString (x,y,FRACUNIT,option,NULL,TINY_FONT,string) void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); - -void V_DrawCenteredThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); -void V_DrawRightAlignedThinStringAtFixed(fixed_t x, fixed_t y, INT32 option, const char *string); - // Draws a titlecard font string. // timer: when the letters start appearing (leave to 0 to disable) // threshold: when the letters start disappearing (leave to 0 to disable) (both are INT32 in case you supply negative values...) From 819ebc4c268c8d61335afa1b1304a65e5600c5ee Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 25 Aug 2023 14:51:21 -0400 Subject: [PATCH 07/12] Highlight contact with shoutcolor --- src/st_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index b6581e71a..20f090585 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1398,7 +1398,7 @@ static void ST_DrawServerSplash(void) V_DrawRightAlignedThinStringAtFixed( textX, textY, (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, - va("Contact @ %s", connectedservercontact) + va("Contact @ %c%s", '\x80' + cv_shoutcolor.value, connectedservercontact) ); textY -= (10 * FRACUNIT); } From c2c46aca58b67d6e764bdb5fdce1f5e5f5437917 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 25 Aug 2023 14:56:50 -0400 Subject: [PATCH 08/12] Add note about MOTDICON --- src/st_stuff.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/st_stuff.c b/src/st_stuff.c index 20f090585..970b6d377 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1379,6 +1379,9 @@ static void ST_DrawServerSplash(void) gridX += (gridPatch->width * FRACUNIT); } + // We're a bit crunched atm to do this but hopefully in the future + // the icon can be made a bmp file on the hard drive that the server + // sends on client join instead. patch_t *iconPatch = W_CachePatchName("MOTDICON", PU_CACHE); fixed_t iconX = (BASEVIDWIDTH - 16 - iconPatch->width) * FRACUNIT; fixed_t iconY = (BASEVIDHEIGHT - 8 - iconPatch->height) * FRACUNIT; From 2a6865047714efada23dac4a63478e559df67aef Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Fri, 25 Aug 2023 15:08:53 -0400 Subject: [PATCH 09/12] Clear name/contact with strncpy instead of memset Probably doesn't matter, but it satisfies my OCD better --- src/d_clisrv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 79f081e41..0c8d736de 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -3803,8 +3803,8 @@ void SV_ResetServer(void) // clear server_context memset(server_context, '-', 8); - memset(connectedservername, 0, MAXSERVERNAME); - memset(connectedservercontact, 0, MAXSERVERCONTACT); + strncpy(connectedservername, "\0", MAXSERVERNAME); + strncpy(connectedservercontact, "\0", MAXSERVERCONTACT); CV_RevertNetVars(); From 92bd71496e9df6e23e9edafbb2c61d7148124fcb Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 25 Aug 2023 21:41:15 +0100 Subject: [PATCH 10/12] VC review - Continue showing up on main in-game pause menu - Flip to top half of screen, to avoid conflict with Round Queue - Show over most UI, including menu --- src/k_menudraw.c | 7 ++++++ src/st_stuff.c | 61 ++++++++++++++++++++++++++---------------------- src/st_stuff.h | 2 ++ 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 23c989505..800ff3c6c 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -825,6 +825,13 @@ void M_Drawer(void) } } + if (netgame && Playing()) + { + boolean mainpause_open = menuactive && currentMenu == &PAUSE_MainDef; + + ST_DrawServerSplash(!mainpause_open); + } + // focus lost notification goes on top of everything, even the former everything if (window_notinfocus && cv_showfocuslost.value) { diff --git a/src/st_stuff.c b/src/st_stuff.c index 970b6d377..748d6da1d 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1314,7 +1314,7 @@ static INT32 ST_ServerSplash_OpacityFlag(INT32 opacity) return (NUMTRANSMAPS - opacity) << V_ALPHASHIFT; } -static void ST_DrawServerSplash(void) +void ST_DrawServerSplash(boolean timelimited) { static const fixed_t SPLASH_LEN = (FRACUNIT * TICRATE) * 3; static const fixed_t SPLASH_WAIT = (FRACUNIT * TICRATE) / 2; @@ -1335,7 +1335,8 @@ static void ST_DrawServerSplash(void) return; } - if (splashTime >= SPLASH_LEN) + if (timelimited + && splashTime >= SPLASH_LEN) { // We finished drawing it return; @@ -1354,29 +1355,35 @@ static void ST_DrawServerSplash(void) { opacity = splashTic; } - else if (splashTic > (SPLASH_LEN >> FRACBITS) - NUMTRANSMAPS) + else if (timelimited + && splashTic > (SPLASH_LEN >> FRACBITS) - NUMTRANSMAPS) { opacity = (SPLASH_LEN >> FRACBITS) - splashTic; } + INT32 opacityFlag = ST_ServerSplash_OpacityFlag(opacity); patch_t *gridPatch = W_CachePatchName("MOTDBG", PU_CACHE); - fixed_t gridX = -splashTime / 3; - fixed_t gridY = (BASEVIDHEIGHT - gridPatch->height) * FRACUNIT; - INT32 gridOpacity = ST_ServerSplash_OpacityFlag(opacity / 2); - fixed_t maxX = (vid.width * FRACUNIT) / vid.dupx; - while (gridX < maxX) + if (gridPatch && gridPatch->width) { - V_DrawFixedPatch( - gridX, gridY, - FRACUNIT, - (V_SNAPTOLEFT|V_SNAPTOBOTTOM) | V_SUBTRACT | gridOpacity, - gridPatch, - NULL - ); + fixed_t gridX = -(splashTime / 3) % (gridPatch->width * FRACUNIT); + fixed_t gridY = (gridPatch->height) * FRACUNIT; + INT32 gridOpacity = ST_ServerSplash_OpacityFlag(opacity / 2); + fixed_t maxX = (vid.width * FRACUNIT) / vid.dupx; - gridX += (gridPatch->width * FRACUNIT); + while (gridX < maxX) + { + V_DrawFixedPatch( + gridX, gridY, + FRACUNIT, + (V_SNAPTOLEFT|V_SNAPTOBOTTOM) | V_SUBTRACT | V_VFLIP | gridOpacity, + gridPatch, + NULL + ); + + gridX += (gridPatch->width * FRACUNIT); + } } // We're a bit crunched atm to do this but hopefully in the future @@ -1384,7 +1391,7 @@ static void ST_DrawServerSplash(void) // sends on client join instead. patch_t *iconPatch = W_CachePatchName("MOTDICON", PU_CACHE); fixed_t iconX = (BASEVIDWIDTH - 16 - iconPatch->width) * FRACUNIT; - fixed_t iconY = (BASEVIDHEIGHT - 8 - iconPatch->height) * FRACUNIT; + fixed_t iconY = (8) * FRACUNIT; V_DrawFixedPatch( iconX, iconY, FRACUNIT, @@ -1394,7 +1401,15 @@ static void ST_DrawServerSplash(void) ); fixed_t textX = (BASEVIDWIDTH - 16 - 36) * FRACUNIT; - fixed_t textY = (BASEVIDHEIGHT - 24) * FRACUNIT; + fixed_t textY = (24 - 8) * FRACUNIT; + + V_DrawRightAlignedStringAtFixed( + textX, textY, + (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, + connectedservername + ); + + textY += 10*FRACUNIT; if (connectedservercontact[0] != 0) { @@ -1403,14 +1418,7 @@ static void ST_DrawServerSplash(void) (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, va("Contact @ %c%s", '\x80' + cv_shoutcolor.value, connectedservercontact) ); - textY -= (10 * FRACUNIT); } - - V_DrawRightAlignedStringAtFixed( - textX, textY, - (V_SNAPTORIGHT|V_SNAPTOBOTTOM) | opacityFlag, - connectedservername - ); } void ST_Drawer(void) @@ -1487,9 +1495,6 @@ void ST_Drawer(void) if (stagetitle) ST_drawTitleCard(); - if (netgame) - ST_DrawServerSplash(); - // Replay manual-save stuff if (demo.recording && multiplayer && demo.savebutton && demo.savebutton + 3*TICRATE < leveltime) { diff --git a/src/st_stuff.h b/src/st_stuff.h index 44aa5f251..c406bdcaf 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -75,6 +75,8 @@ void ST_preLevelTitleCardDrawer(void); extern tic_t lt_ticker, lt_lasttic; extern tic_t lt_exitticker, lt_endtime; +void ST_DrawServerSplash(boolean timelimited); + // return if player a is in the same team as player b boolean ST_SameTeam(player_t *a, player_t *b); From 4d08f5e88858c50e77043bfa1dc09b4d202a463e Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 25 Aug 2023 21:41:49 +0100 Subject: [PATCH 11/12] Move Song Credits down by 8 pixels to avoid overlap with top-region MOTD --- src/hu_stuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index e97d41183..fd9fa3c97 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1952,7 +1952,7 @@ void HU_DrawSongCredits(void) } else { - y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 32) * FRACUNIT; + y = (r_splitscreen ? (BASEVIDHEIGHT/2)-4 : 40) * FRACUNIT; } INT32 bgt = (NUMTRANSMAPS/2) + (cursongcredit.trans / 2); From c194ccb81a42829a314174f890808133dc147044 Mon Sep 17 00:00:00 2001 From: James R Date: Fri, 25 Aug 2023 17:18:11 -0700 Subject: [PATCH 12/12] Remove more unused cvars - respawnitem - respawnitemtime - respawndelay - startinglives --- src/d_netcmd.c | 13 ------------- src/d_netcmd.h | 7 +------ src/p_mobj.c | 4 ---- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 569420626..6193dca52 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -244,8 +244,6 @@ static CV_PossibleValue_t usemouse_cons_t[] = {{0, "Off"}, {1, "On"}, {2, "Force static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; -static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; - static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; static CV_PossibleValue_t pause_cons_t[] = {{0, "Server"}, {1, "All"}, {0, NULL}}; @@ -267,11 +265,6 @@ consvar_t cv_duelspectatorreentry = CVAR_INIT ("duelspectatorreentry", "180", CV static CV_PossibleValue_t antigrief_cons_t[] = {{10, "MIN"}, {180, "MAX"}, {0, "Off"}, {0, NULL}}; consvar_t cv_antigrief = CVAR_INIT ("antigrief", "30", CV_NETVAR, antigrief_cons_t, NULL); -consvar_t cv_startinglives = CVAR_INIT ("startinglives", "3", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, startingliveslimit_cons_t, NULL); - -static CV_PossibleValue_t respawntime_cons_t[] = {{1, "MIN"}, {30, "MAX"}, {0, "Off"}, {0, NULL}}; -consvar_t cv_respawntime = CVAR_INIT ("respawndelay", "1", CV_NETVAR|CV_CHEAT, respawntime_cons_t, NULL); - consvar_t cv_seenames = CVAR_INIT ("seenames", "On", CV_SAVE, CV_OnOff, NULL); // names @@ -753,10 +746,6 @@ void D_RegisterServerCommands(void) // for master server connection AddMServCommands(); - // p_mobj.c - CV_RegisterVar(&cv_itemrespawntime); - CV_RegisterVar(&cv_itemrespawn); - // misc CV_RegisterVar(&cv_pointlimit); CV_RegisterVar(&cv_numlaps); @@ -774,7 +763,6 @@ void D_RegisterServerCommands(void) K_RegisterKartStuff(); // SRB2kart - CV_RegisterVar(&cv_startinglives); CV_RegisterVar(&cv_countdowntime); CV_RegisterVar(&cv_overtime); CV_RegisterVar(&cv_pause); @@ -789,7 +777,6 @@ void D_RegisterServerCommands(void) CV_RegisterVar(&cv_spectatorreentry); CV_RegisterVar(&cv_duelspectatorreentry); CV_RegisterVar(&cv_antigrief); - CV_RegisterVar(&cv_respawntime); // d_clisrv CV_RegisterVar(&cv_maxconnections); diff --git a/src/d_netcmd.h b/src/d_netcmd.h index acf6b8336..ebd24b266 100644 --- a/src/d_netcmd.h +++ b/src/d_netcmd.h @@ -49,10 +49,6 @@ extern consvar_t cv_seenames; extern consvar_t cv_usemouse; extern consvar_t cv_joyscale[MAXSPLITSCREENPLAYERS]; -// normally in p_mobj but the .h is not read -extern consvar_t cv_itemrespawntime; -extern consvar_t cv_itemrespawn; - extern consvar_t cv_pointlimit; extern consvar_t cv_timelimit; extern consvar_t cv_numlaps; @@ -70,7 +66,7 @@ extern consvar_t cv_countdowntime; extern consvar_t cv_mute; extern consvar_t cv_pause; -extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_maxplayers, cv_respawntime; +extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_maxplayers; extern consvar_t cv_spectatorreentry, cv_duelspectatorreentry, cv_antigrief; // SRB2kart items @@ -113,7 +109,6 @@ extern consvar_t cv_alttitle, cv_itemfinder; extern consvar_t cv_inttime, cv_advancemap; extern consvar_t cv_overtime; -extern consvar_t cv_startinglives; // for F_finale.c extern consvar_t cv_rollingdemos; diff --git a/src/p_mobj.c b/src/p_mobj.c index bea139da0..481849eb2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11380,10 +11380,6 @@ void P_RemoveSavegameMobj(mobj_t *mobj) P_UnlinkThinker((thinker_t*)mobj); } -static CV_PossibleValue_t respawnitemtime_cons_t[] = {{1, "MIN"}, {300, "MAX"}, {0, NULL}}; -consvar_t cv_itemrespawntime = CVAR_INIT ("respawnitemtime", "2", CV_NETVAR|CV_CHEAT, respawnitemtime_cons_t, NULL); -consvar_t cv_itemrespawn = CVAR_INIT ("respawnitem", "On", CV_NETVAR|CV_CHEAT, CV_OnOff, NULL); - static void P_SpawnPrecipitationAt(fixed_t basex, fixed_t basey) { INT32 j, k;