From 81e2cb4aa52a2427d600277fa1f41ddc0f704a28 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Mar 2018 17:05:36 -0500 Subject: [PATCH 01/10] Attempted to fix how voting handles no votes I don't know exactly what it did previously since I never actually observed what happens, but now in dedicated servers it will wait for time to run out, then if there's no votes by that time it will just go onto nextlevel --- src/d_netcmd.c | 12 ++++++++++-- src/y_inter.c | 26 ++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 09fa39ff7..3099ca45b 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2003,8 +2003,16 @@ void D_PickVote(void) key = M_RandomKey(numvotes); - WRITESINT8(p, temppicks[key]); - WRITESINT8(p, templevels[key]); + if (numvotes > 0) + { + WRITESINT8(p, temppicks[key]); + WRITESINT8(p, templevels[key]); + } + else + { + WRITESINT8(p, -1); + WRITESINT8(p, 0); + } SendNetXCmd(XD_PICKVOTE, &buf, 2); } diff --git a/src/y_inter.c b/src/y_inter.c index 8fdbac278..ed651ce3b 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -2510,11 +2510,19 @@ static void Y_UnloadVoteData(void) // void Y_SetupVoteFinish(SINT8 pick, SINT8 level) { + if (pick == -1) // No other votes? We gotta get out of here, then! + { + timer = 0; + Y_UnloadVoteData(); + Y_FollowIntermission(); + return; + } + if (pickedvote == -1) { INT32 i; SINT8 votecompare = -1; - boolean allsame = true; + INT32 endtype = 0; voteclient.rsynctime = 0; @@ -2523,16 +2531,26 @@ void Y_SetupVoteFinish(SINT8 pick, SINT8 level) if ((playeringame[i] && !players[i].spectator) && votes[i] == -1 && !splitscreen) votes[i] = 3; - if (votes[i] == -1) + if (votes[i] == -1 || endtype > 1) // Don't need to go on continue; if (votecompare == -1) + { votecompare = votes[i]; + endtype = 1; + } else if (votes[i] != votecompare) - allsame = false; + endtype = 2; } - if (allsame) + if (endtype == 0) // Might as well put this here, too. + { + timer = 0; + Y_UnloadVoteData(); + Y_FollowIntermission(); + return; + } + else if (endtype == 1) // Only one unique vote, so just end it immediately. { voteendtic = votetic + (5*TICRATE); S_StartSound(NULL, sfx_kc48); From 3d84c3fe2e9a64ceee2f425adfaa45e84843eb3b Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Mar 2018 17:20:13 -0500 Subject: [PATCH 02/10] Hopefully this fixes item throwing & distribution in mobjscale maps --- src/k_kart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 104ed9cb3..79b6533f4 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -587,7 +587,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) && players[i].kartstuff[k_position] < player->kartstuff[k_position]) pdis += P_AproxDistance(P_AproxDistance(players[i].mo->x - player->mo->x, players[i].mo->y - player->mo->y), - players[i].mo->z - player->mo->z) / FRACUNIT + players[i].mo->z - player->mo->z) / mapheaderinfo[gamemap-1]->mobj_scale * (pingame - players[i].kartstuff[k_position]) / ((pingame - 1) * (pingame + 1) / 3); } @@ -1997,9 +1997,9 @@ static mobj_t *K_ThrowKartItem(player_t *player, boolean missile, mobjtype_t map INT32 HEIGHT; if (dir == 2) - HEIGHT = 40*FRACUNIT + player->mo->momz; + HEIGHT = 40*(mapheaderinfo[gamemap-1]->mobj_scale) + player->mo->momz; else - HEIGHT = 30*FRACUNIT + player->mo->momz; + HEIGHT = 30*(mapheaderinfo[gamemap-1]->mobj_scale) + player->mo->momz; mo->momx = player->mo->momx + FixedMul(FINECOSINE(fa), PROJSPEED); mo->momy = player->mo->momy + FixedMul(FINESINE(fa), PROJSPEED); From ab35dc6dbbc5251e2dd5cde15022747fc16f6123 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Mar 2018 19:00:16 -0500 Subject: [PATCH 03/10] Some unlockable stuff MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Secrets renamed to Extras - Extras leads to the checklist instead of another menu - Credits & Sound Test are on the Options menu now - New title screen cheat for unlocking everything ("banana", or "← ↑ → → ↑ ← ↓ → Enter") --- src/m_cheat.c | 24 +++++++++++++++--------- src/m_menu.c | 33 ++++++++++++++++++--------------- src/sounds.h | 14 +++++++------- 3 files changed, 40 insertions(+), 31 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index b468d7331..f7476fca2 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -74,19 +74,20 @@ typedef struct static UINT8 cheatf_warp(void) { - if (modifiedgame) - return 0; + UINT8 i; + + /*if (modifiedgame) + return 0;*/ if (menuactive && currentMenu != &MainDef) return 0; // Only on the main menu! - S_StartSound(0, sfx_itemup); + S_StartSound(0, sfx_kc42); - // Temporarily unlock stuff. + // Temporarily unlock EVERYTHING. G_SetGameModified(false); - unlockables[1].unlocked = true; // credits - unlockables[2].unlocked = true; // sound test - //unlockables[16].unlocked = true; // level select + for (i = 0; i < MAXUNLOCKABLES; i++) + unlockables[i].unlocked = true; // Refresh secrets menu existing. M_ClearMenus(true); @@ -135,14 +136,19 @@ static UINT8 cheatf_devmode(void) static cheatseq_t cheat_warp = { 0, cheatf_warp, - { SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff } + //{ SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE('x'), SCRAMBLE('v'), SCRAMBLE('i'), 0xff } + { SCRAMBLE('b'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), 0xff } }; static cheatseq_t cheat_warp_joy = { 0, cheatf_warp, - { SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), + /*{ SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), + SCRAMBLE(KEY_ENTER), 0xff }*/ + { SCRAMBLE(KEY_LEFTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_RIGHTARROW), + SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_UPARROW), SCRAMBLE(KEY_LEFTARROW), + SCRAMBLE(KEY_DOWNARROW), SCRAMBLE(KEY_RIGHTARROW), SCRAMBLE(KEY_ENTER), 0xff } }; diff --git a/src/m_menu.c b/src/m_menu.c index 95086d4d9..b498e4848 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -207,8 +207,8 @@ menu_t MessageDef; menu_t SPauseDef; // Sky Room -static void M_CustomLevelSelect(INT32 choice); -static void M_CustomWarp(INT32 choice); +//static void M_CustomLevelSelect(INT32 choice); +//static void M_CustomWarp(INT32 choice); FUNCNORETURN static ATTRNORETURN void M_UltimateCheat(INT32 choice); static void M_LoadGameLevelSelect(INT32 choice); static void M_GetAllEmeralds(INT32 choice); @@ -231,7 +231,7 @@ static void M_ConfirmSpectate(INT32 choice); static void M_ConfirmEnterGame(INT32 choice); static void M_ConfirmTeamScramble(INT32 choice); static void M_ConfirmTeamChange(INT32 choice); -static void M_SecretsMenu(INT32 choice); +//static void M_SecretsMenu(INT32 choice); static void M_SetupChoosePlayer(INT32 choice); static void M_QuitSRB2(INT32 choice); menu_t SP_MainDef, MP_MainDef, OP_MainDef; @@ -475,11 +475,11 @@ static consvar_t cv_dummystaff = {"dummystaff", "0", CV_HIDEN|CV_CALL, dummystaf // --------- static menuitem_t MainMenu[] = { - {IT_CALL |IT_STRING, NULL, "Secrets", M_SecretsMenu, 84}, - {IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 92}, - {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 100}, - {IT_CALL |IT_STRING, NULL, "Options", M_Options, 108}, - {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, + {IT_SUBMENU|IT_STRING, NULL, "Extras", &SR_UnlockChecklistDef, 84}, + {IT_CALL |IT_STRING, NULL, "1 Player", M_SinglePlayerMenu, 92}, + {IT_SUBMENU|IT_STRING, NULL, "Multiplayer", &MP_MainDef, 100}, + {IT_CALL |IT_STRING, NULL, "Options", M_Options, 108}, + {IT_CALL |IT_STRING, NULL, "Quit Game", M_QuitSRB2, 116}, }; typedef enum @@ -1040,6 +1040,9 @@ static menuitem_t OP_MainMenu[] = {IT_SUBMENU | IT_STRING, NULL, "Game Options...", &OP_GameOptionsDef, 70}, {IT_SUBMENU | IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, + + {IT_CALL | IT_STRING, NULL, "Play Credits", M_Credits, 90}, + {IT_KEYHANDLER | IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 100}, }; static menuitem_t OP_ControlsMenu[] = @@ -2692,7 +2695,7 @@ void M_StartControlPanel(void) if (!Playing()) { // Secret menu! - MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED); + //MainMenu[secrets].status = (M_AnySecretUnlocked()) ? (IT_STRING | IT_CALL) : (IT_DISABLED); currentMenu = &MainDef; itemOn = singleplr; @@ -4403,7 +4406,7 @@ static void M_HandleSoundTest(INT32 choice) } // Entering secrets menu -static void M_SecretsMenu(INT32 choice) +/*static void M_SecretsMenu(INT32 choice) { INT32 i, j, ul; UINT8 done[MAXUNLOCKABLES]; @@ -4478,7 +4481,7 @@ static void M_SecretsMenu(INT32 choice) } M_SetupNextMenu(&SR_MainDef); -} +}*/ // ================== // NEW GAME FUNCTIONS @@ -4496,14 +4499,14 @@ static void M_NewGame(void) M_SetupChoosePlayer(0); } -static void M_CustomWarp(INT32 choice) +/*static void M_CustomWarp(INT32 choice) { INT32 ul = skyRoomMenuTranslations[choice-1]; startmap = (INT16)(unlockables[ul].variable); M_SetupChoosePlayer(0); -} +}*/ static void M_Credits(INT32 choice) { @@ -4513,7 +4516,7 @@ static void M_Credits(INT32 choice) F_StartCredits(); } -static void M_CustomLevelSelect(INT32 choice) +/*static void M_CustomLevelSelect(INT32 choice) { INT32 ul = skyRoomMenuTranslations[choice-1]; @@ -4528,7 +4531,7 @@ static void M_CustomLevelSelect(INT32 choice) M_PrepareLevelSelect(); M_SetupNextMenu(&SR_LevelSelectDef); -} +}*/ // ================== // SINGLE PLAYER MENU diff --git a/src/sounds.h b/src/sounds.h index 142c4a4e3..2a004e4c6 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -583,7 +583,7 @@ typedef enum sfx_kc2c, sfx_kc2d, sfx_kc2e, - sfx_kc2f, + sfx_kc2f, // Pogo Spring sfx_kc30, sfx_kc31, sfx_kc32, @@ -593,7 +593,7 @@ typedef enum sfx_kc36, sfx_kc37, sfx_kc38, - sfx_kc39, + sfx_kc39, // Voting roulette sfx_kc3a, sfx_kc3b, sfx_kc3c, @@ -602,15 +602,15 @@ typedef enum sfx_kc3f, sfx_kc40, sfx_kc41, - sfx_kc42, + sfx_kc42, // Unlock everything cheat sfx_kc43, sfx_kc44, sfx_kc45, sfx_kc46, sfx_kc47, - sfx_kc48, + sfx_kc48, // Vote picked sfx_kc49, - sfx_kc4a, + sfx_kc4a, // Voting beep sfx_kc4b, sfx_kc4c, sfx_kc4d, @@ -625,8 +625,8 @@ typedef enum sfx_kc56, sfx_kc57, sfx_kc58, - sfx_kc59, - sfx_kc5a, + sfx_kc59, // Shrink + sfx_kc5a, // Grow sfx_kc5b, sfx_kc5c, sfx_kc5d, From 283241ba41856dd8708300d862a7aa08b28423f6 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Thu, 1 Mar 2018 19:07:07 -0500 Subject: [PATCH 04/10] And a few more fixes that went under my nose For later: fix sound test in the options menu, make the cheat notif sound only play if it can unlock something --- src/m_menu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/m_menu.c b/src/m_menu.c index b498e4848..1775dc9e5 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1041,8 +1041,8 @@ static menuitem_t OP_MainMenu[] = {IT_SUBMENU | IT_STRING, NULL, "Game Options...", &OP_GameOptionsDef, 70}, {IT_SUBMENU | IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, - {IT_CALL | IT_STRING, NULL, "Play Credits", M_Credits, 90}, - {IT_KEYHANDLER | IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 100}, + {IT_CALL | IT_STRING, NULL, "Play Credits", M_Credits, 100}, + //{IT_KEYHANDLER | IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110}, }; static menuitem_t OP_ControlsMenu[] = @@ -1578,7 +1578,7 @@ menu_t SR_UnlockChecklistDef = { NULL, 1, - &SR_MainDef, + &MainDef, //&SR_MainDef SR_UnlockChecklistMenu, M_DrawChecklist, 280, 185, From 28f5a874d41f4df7a389b7e2fe9f06f7b98ac8e4 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Fri, 2 Mar 2018 00:02:26 -0500 Subject: [PATCH 05/10] Revamped race position Should support ties for real now :V --- src/g_game.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 89725ce6b..f71e9e15b 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2764,7 +2764,8 @@ mapthing_t *G_FindRaceStart(INT32 playernum) { if (numcoopstarts) { - INT32 i, pos = 0; + UINT8 i; + UINT8 pos = 0; // SRB2Kart: figure out player spawn pos from points if (!playeringame[playernum] || players[playernum].spectator) @@ -2772,34 +2773,47 @@ mapthing_t *G_FindRaceStart(INT32 playernum) for (i = 0; i < MAXPLAYERS; i++) { - if (i == playernum) - continue; if (!playeringame[i] || players[i].spectator) continue; - if (players[i].score > players[playernum].score) - pos++; - if (i != 0) + if (i == playernum) + continue; + + if (players[i].score < players[playernum].score) { - INT32 j; - for (j = 0; j < i; j++) // I don't like loops in loops, but is needed to resolve ties :< + UINT8 j; + UINT8 num = 0; + + for (j = 0; j < MAXPLAYERS; j++) // I hate similar loops inside loops... :< { - if (i == j) - continue; if (!playeringame[j] || players[j].spectator) continue; - if (players[i].score == players[j].score) - pos++; + if (j == playernum) + continue; + if (j == i) + continue; + if (players[j].score == players[i].score) + num++; } + + if (num > 1) // found dupes + pos++; + } + else + { + if (players[i].score > players[playernum].score || i < playernum) + pos++; } } if (G_CheckSpot(playernum, playerstarts[pos % numcoopstarts])) return playerstarts[pos % numcoopstarts]; - // Your spot isn't available? Go for the old behavior - // if there's 6 players in a map with 3 player starts, this spawns them 1/2/3/1/2/3. - if (G_CheckSpot(playernum, playerstarts[playernum % numcoopstarts])) - return playerstarts[playernum % numcoopstarts]; + // Your spot isn't available? Find whatever you can get first. + for (i = 0; i < numcoopstarts; i++) + { + if (G_CheckSpot(playernum, playerstarts[i])) + return playerstarts[i]; + } // SRB2Kart: We have solid players, so this behavior is less ideal. // Don't bother checking to see if the player 1 start is open. From 3385df84cec891c7dc5cf26d0e80220c6127ff26 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 4 Mar 2018 14:28:29 -0500 Subject: [PATCH 06/10] General fixes - Flame trails don't spawn if you're not on the ground - Mobjscale: Shells are now the correct speed - Mobjscale: Explosion's wipeout hit height scales --- src/k_kart.c | 10 ++++++---- src/p_mobj.c | 18 +++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 79b6533f4..409f2afec 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1487,7 +1487,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; - player->mo->momz = 18*FRACUNIT; + player->mo->momz = 18*(mapheaderinfo[gamemap-1]->mobj_scale); player->mo->momx = player->mo->momy = 0; player->kartstuff[k_mushroomtimer] = 0; @@ -1847,6 +1847,11 @@ void K_SpawnDriftTrail(player_t *player) I_Assert(player->mo != NULL); I_Assert(!P_MobjWasRemoved(player->mo)); + if (!P_IsObjectOnGround(player->mo) + || player->kartstuff[k_bootimer] != 0 + || (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]))) + return; + if (player->mo->eflags & MFE_VERTICALFLIP) ground = player->mo->ceilingz - FixedMul(mobjinfo[MT_MUSHROOMTRAIL].height, player->mo->scale); else @@ -1859,9 +1864,6 @@ void K_SpawnDriftTrail(player_t *player) for (i = 0; i < 2; i++) { - if (player->kartstuff[k_bootimer] != 0 || (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer])) - continue; - newx = player->mo->x + P_ReturnThrustX(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); newy = player->mo->y + P_ReturnThrustY(player->mo, travelangle + ((i&1) ? -1 : 1)*ANGLE_135, FixedMul(24*FRACUNIT, player->mo->scale)); #ifdef ESLOPE diff --git a/src/p_mobj.c b/src/p_mobj.c index bd10d8983..c113d3d06 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7787,9 +7787,9 @@ void P_MobjThinker(mobj_t *mobj) P_SpawnGhostMobj(mobj); if (gamespeed == 0) - finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); + finalspeed = FixedMul(finalspeed, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); else if (gamespeed == 2) - finalspeed = FixedMul(finalspeed, FRACUNIT+FRACUNIT/4); + finalspeed = FixedMul(finalspeed, (mapheaderinfo[gamemap-1]->mobj_scale)+(mapheaderinfo[gamemap-1]->mobj_scale/4)); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->x+mobj->momx, mobj->y+mobj->momy); if (mobj->health <= 5) @@ -7797,7 +7797,7 @@ void P_MobjThinker(mobj_t *mobj) INT32 i; for (i = 5; i >= mobj->health; i--) { - finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); + finalspeed = FixedMul(finalspeed, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); } P_InstaThrust(mobj, mobj->angle, finalspeed); } @@ -7822,8 +7822,8 @@ void P_MobjThinker(mobj_t *mobj) case MT_REDITEM: { sector_t *sec2; - fixed_t topspeed = 64*FRACUNIT; - fixed_t distbarrier = 512*FRACUNIT; + fixed_t topspeed = 64*(mapheaderinfo[gamemap-1]->mobj_scale); + fixed_t distbarrier = 512*(mapheaderinfo[gamemap-1]->mobj_scale); fixed_t distaway; P_SpawnGhostMobj(mobj); @@ -7835,13 +7835,13 @@ void P_MobjThinker(mobj_t *mobj) if (gamespeed == 0) { - topspeed = FixedMul(topspeed, FRACUNIT-FRACUNIT/4); - distbarrier = FixedMul(distbarrier, FRACUNIT-FRACUNIT/4); + topspeed = FixedMul(topspeed, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); + distbarrier = FixedMul(distbarrier, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); } else if (gamespeed == 2) { - topspeed = FixedMul(topspeed, FRACUNIT+FRACUNIT/4); - distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4); + topspeed = FixedMul(topspeed, (mapheaderinfo[gamemap-1]->mobj_scale)+(mapheaderinfo[gamemap-1]->mobj_scale/4)); + distbarrier = FixedMul(distbarrier, (mapheaderinfo[gamemap-1]->mobj_scale)+(mapheaderinfo[gamemap-1]->mobj_scale/4); } if (gametype == GT_RACE && mobj->tracer) From 18ece8db5e7b97eef4ee92f3768436bf43a12943 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 4 Mar 2018 15:27:52 -0500 Subject: [PATCH 07/10] Made a lot of gametype checks use either G_RaceGametype or G_BattleGametype Should make it a lot easier to add more gametypes later. Also some minor fixes: - Changed up how shell speed scales in mobjscale juuuust slightly, so it's less messy - Fixed CHECK showing spectators --- src/d_clisrv.c | 6 ++-- src/d_netcmd.c | 12 ++++---- src/g_game.c | 10 +++---- src/hu_stuff.c | 10 +++---- src/k_kart.c | 80 ++++++++++++++++++++++++++------------------------ src/p_enemy.c | 14 ++++----- src/p_inter.c | 16 +++++----- src/p_map.c | 14 ++++----- src/p_mobj.c | 37 +++++++++++++---------- src/p_setup.c | 6 ++-- src/p_spec.c | 8 ++--- src/p_user.c | 20 ++++++------- 12 files changed, 120 insertions(+), 113 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 3d864e392..9485e9105 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -2473,9 +2473,9 @@ static void CL_RemovePlayer(INT32 playernum) if (G_TagGametype()) //Check if you still have a game. Location flexible. =P P_CheckSurvivors(); - else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) - K_CheckBalloons(); // SRB2Kart - else if (gametype == GT_RACE || gametype == GT_COMPETITION) + else if (G_BattleGametype()) // SRB2Kart + K_CheckBalloons(); + else if (G_RaceGametype()) P_CheckRacers(); } diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 3099ca45b..fbf2dee07 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3229,7 +3229,7 @@ static void Got_Teamchange(UINT8 **cp, INT32 playernum) // In tag, check to see if you still have a game. if (G_TagGametype()) P_CheckSurvivors(); - else if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) + else if (G_BattleGametype()) K_CheckBalloons(); // SRB2Kart } @@ -4114,7 +4114,7 @@ static void PointLimit_OnChange(void) static void NumLaps_OnChange(void) { // Just don't be verbose - if (gametype == GT_RACE) + if (G_RaceGametype()) CONS_Printf(M_GetText("Number of laps set to %d\n"), cv_numlaps.value); } @@ -5194,23 +5194,23 @@ static void Command_ShowTime_f(void) static void KartFrantic_OnChange(void) { if (cv_kartfrantic.value != franticitems && gamestate == GS_LEVEL) - CONS_Printf(M_GetText("Frantic Items will be turned %s next round.\n"), cv_kartfrantic.value ? M_GetText("on") : M_GetText("off")); + CONS_Printf(M_GetText("Frantic items will be turned %s next round.\n"), cv_kartfrantic.value ? M_GetText("on") : M_GetText("off")); } static void KartSpeed_OnChange(void) { - if (cv_kartspeed.value != gamespeed && gametype == GT_RACE && gamestate == GS_LEVEL) + if (cv_kartspeed.value != gamespeed && G_RaceGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Game speed will be changed to \"%s\" next round.\n"), cv_kartspeed.string); } static void KartMirror_OnChange(void) { - if (cv_kartmirror.value != mirrormode && gametype == GT_RACE && gamestate == GS_LEVEL) + if (cv_kartmirror.value != mirrormode && G_RaceGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Mirror Mode will be turned %s next round.\n"), cv_kartmirror.value ? M_GetText("on") : M_GetText("off")); } static void KartComeback_OnChange(void) { - if (cv_kartcomeback.value != comeback && gametype == GT_MATCH && gamestate == GS_LEVEL) + if (cv_kartcomeback.value != comeback && G_BattleGametype() && gamestate == GS_LEVEL) CONS_Printf(M_GetText("Karma Comeback will be turned %s next round.\n"), cv_kartcomeback.value ? M_GetText("on") : M_GetText("off")); } \ No newline at end of file diff --git a/src/g_game.c b/src/g_game.c index f71e9e15b..2013d77e4 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -3099,11 +3099,11 @@ boolean G_BattleGametype(void) // // G_RaceGametype // -// Returns true in racing gamemodes, previously was G_PlatformGametype. +// Returns true in Race gamemodes, previously was G_PlatformGametype. // boolean G_RaceGametype(void) { - return (gametype == GT_RACE); //(gametype == GT_COOP || gametype == GT_RACE || gametype == GT_COMPETITION); + return (gametype == GT_RACE); } // @@ -3313,7 +3313,7 @@ static void G_DoCompleted(void) I_Error("Followed map %d to invalid map %d\n", prevmap + 1, nextmap + 1); // wrap around in race - if (nextmap >= 1100-1 && nextmap <= 1102-1 && (gametype == GT_RACE || gametype == GT_COMPETITION)) + if (nextmap >= 1100-1 && nextmap <= 1102-1 && G_RaceGametype()) nextmap = (INT16)(spstage_start-1); if (gametype == GT_COOP && token) @@ -3408,8 +3408,8 @@ static void G_DoWorldDone(void) { if (server) { - if (gametype == GT_RACE) // SRB2kart - // don't reset player between maps + if (G_RaceGametype()) + // SRB2kart: don't reset player between maps D_MapChange(nextmap+1, gametype, ultimatemode, false, 0, false, false); else // resetplayer in match/tag/CTF for more equality diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 3941e6c1b..c3c04bedd 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1394,7 +1394,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I V_DrawSmallScaledPatch(x-32, y-4, 0, tagico); } - if (gametype == GT_RACE) + if (G_RaceGametype()) { if (circuitmap) { @@ -1564,7 +1564,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline } // All data drawn with thin string for space. - if (gametype == GT_RACE) + if (G_RaceGametype()) { if (circuitmap) { @@ -1708,7 +1708,7 @@ static void HU_DrawRankings(void) V_DrawCenteredString(192, 16, 0, va("%u", redscore)); } - if (gametype != GT_RACE && gametype != GT_COMPETITION && gametype != GT_COOP) + if (!G_RaceGametype()) { if (cv_timelimit.value && timelimitintics > 0) { @@ -1768,7 +1768,7 @@ static void HU_DrawRankings(void) tab[i].num = -1; tab[i].name = 0; - if (gametype == GT_RACE && !circuitmap) + if (G_RaceGametype() && !circuitmap) tab[i].count = INT32_MAX; } @@ -1781,7 +1781,7 @@ static void HU_DrawRankings(void) { if (playeringame[i] && !players[i].spectator) { - if (gametype == GT_RACE) + if (G_RaceGametype()) { if (circuitmap) { diff --git a/src/k_kart.c b/src/k_kart.c index 409f2afec..b0519f82f 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -514,7 +514,7 @@ static INT32 K_KartGetItemOdds(INT32 pos, INT32 itemnum) { INT32 newodds; - if (gametype == GT_MATCH) + if (G_BattleGametype()) newodds = K_KartItemOddsBalloons[itemnum-1][pos]; else newodds = K_KartItemOddsDistance_Retro[itemnum-1][pos]; @@ -594,7 +594,7 @@ static void K_KartItemRouletteByDistance(player_t *player, ticcmd_t *cmd) player->kartstuff[k_itemclose] = 0; // Reset the item window closer. - if (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) // Battle Mode + if (G_BattleGametype()) // Battle Mode { useodds = (player->kartstuff[k_balloon]-avgballoon)+2; // 0 is two balloons below average, 2 is average, 4 is two balloons above average if (useodds > 4) @@ -1088,7 +1088,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd) if (player->kartstuff[k_lapanimation]) player->kartstuff[k_lapanimation]--; - if (gametype != GT_RACE && (player->exiting || player->kartstuff[k_comebacktimer])) + if (G_BattleGametype() && (player->exiting || player->kartstuff[k_comebacktimer])) { if (player->exiting) { @@ -1298,7 +1298,7 @@ fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower) break; } - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) kartspeed = 1; k_speed += kartspeed*3; // 153 - 177 @@ -1315,7 +1315,7 @@ fixed_t K_GetKartAccel(player_t *player) fixed_t k_accel = 32; // 36; UINT8 kartspeed = player->kartspeed; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) kartspeed = 1; //k_accel += 3 * (9 - kartspeed); // 36 - 60 @@ -1327,7 +1327,7 @@ fixed_t K_GetKartAccel(player_t *player) UINT16 K_GetKartFlashing(void) { UINT16 tics = flashingtics; - if (gametype != GT_RACE) + if (G_BattleGametype()) { tics *= 2; //tics += (3*TICRATE/8) * (player->kartspeed-1); @@ -1376,7 +1376,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) || player->kartstuff[k_startimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_bootimer] > 0 - || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; if (source && source != player->mo && source->player && !source->player->kartstuff[k_sounds]) @@ -1388,7 +1388,7 @@ void K_SpinPlayer(player_t *player, mobj_t *source) player->kartstuff[k_mushroomtimer] = 0; player->kartstuff[k_driftboost] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (source && source->player && player != source->player) P_AddPlayerScore(source->player, 1); @@ -1440,13 +1440,13 @@ void K_SquishPlayer(player_t *player, mobj_t *source) if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || player->kartstuff[k_startimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_bootimer] > 0 - || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; player->kartstuff[k_mushroomtimer] = 0; player->kartstuff[k_driftboost] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (source && source->player && player != source->player) P_AddPlayerScore(source->player, 1); @@ -1484,7 +1484,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju if (player->powers[pw_flashing] > 0 || player->kartstuff[k_squishedtimer] > 0 || (player->kartstuff[k_spinouttimer] > 0 && player->kartstuff[k_spinout] > 0) || player->kartstuff[k_startimer] > 0 || player->kartstuff[k_growshrinktimer] > 0 || player->kartstuff[k_bootimer] > 0 - || (gametype != GT_RACE && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) + || (G_BattleGametype() && ((player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]) || player->kartstuff[k_comebackmode] == 1))) return; player->mo->momz = 18*(mapheaderinfo[gamemap-1]->mobj_scale); @@ -1493,7 +1493,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *source) // A bit of a hack, we ju player->kartstuff[k_mushroomtimer] = 0; player->kartstuff[k_driftboost] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (source && source->player && player != source->player) { @@ -1549,7 +1549,7 @@ void K_StealBalloon(player_t *player, player_t *victim, boolean force) fixed_t newx, newy; mobj_t *newmo; - if (gametype == GT_RACE) + if (!G_BattleGametype()) return; if (player->health <= 0 || victim->health <= 0) @@ -1849,7 +1849,7 @@ void K_SpawnDriftTrail(player_t *player) if (!P_IsObjectOnGround(player->mo) || player->kartstuff[k_bootimer] != 0 - || (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer]))) + || (G_BattleGametype() && player->kartstuff[k_balloon] <= 0 && player->kartstuff[k_comebacktimer])) return; if (player->mo->eflags & MFE_VERTICALFLIP) @@ -2085,8 +2085,8 @@ static void K_DoBooSteal(player_t *player) && player != &players[i] && !players[i].exiting && !players[i].spectator // Player in-game // Can steal from this player - && ((gametype == GT_RACE && players[i].kartstuff[k_position] < player->kartstuff[k_position]) - || (gametype != GT_RACE && players[i].kartstuff[k_balloon] > 0)) + && ((G_RaceGametype() && players[i].kartstuff[k_position] < player->kartstuff[k_position]) + || (G_BattleGametype() && players[i].kartstuff[k_balloon] > 0)) // Has an item && (players[i].kartstuff[k_magnet] @@ -2115,7 +2115,7 @@ static void K_DoBooSteal(player_t *player) prandom = P_RandomFixed(); - if ((gametype == GT_RACE && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Get longer invisibility for nothing + if ((G_RaceGametype() && player->kartstuff[k_position] == 1) || numplayers == 0) // No-one can be stolen from? Get longer invisibility for nothing { player->kartstuff[k_bootimer] = bootime; player->kartstuff[k_bootaketimer] = boostealtime; @@ -2422,7 +2422,7 @@ static void K_KartDrift(player_t *player, boolean onground) UINT8 kartspeed = player->kartspeed; fixed_t dsone, dstwo; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) kartspeed = 1; // IF YOU CHANGE THESE: MAKE SURE YOU UPDATE THE SAME VALUES IN p_mobjc, "case MT_DRIFT:" @@ -2558,7 +2558,7 @@ static void K_KartUpdatePosition(player_t *player) if (!playeringame[i] || players[i].spectator || !players[i].mo) continue; - if (gametype == GT_RACE) + if (G_RaceGametype()) { if ((((players[i].starpostnum) + (numstarposts + 1) * players[i].laps) > ((player->starpostnum) + (numstarposts + 1) * player->laps))) @@ -2634,7 +2634,7 @@ static void K_KartUpdatePosition(player_t *player) } } } - else if (gametype == GT_MATCH) + else if (G_BattleGametype()) { if (player->exiting) return; @@ -2763,7 +2763,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) // Race Spectator if (netgame && player->jointime < 1 - && gametype == GT_RACE && countdown) + && G_RaceGametype() && countdown) { player->spectator = true; player->powers[pw_nocontrol] = 5; @@ -2841,7 +2841,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_startimer] = itemtime; // Activate it K_PlayTauntSound(player->mo); player->kartstuff[k_star] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) player->kartstuff[k_poweritemtimer] = 10*TICRATE; player->kartstuff[k_itemclose] = 10; player->pflags |= PF_ATTACKDOWN; @@ -3158,7 +3158,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(player->mo, sfx_mario3); player->pflags |= PF_ATTACKDOWN; player->kartstuff[k_megashroom] = 0; - if (gametype != GT_RACE) + if (G_BattleGametype()) player->kartstuff[k_poweritemtimer] = 10*TICRATE; player->kartstuff[k_itemclose] = 10; } @@ -3221,7 +3221,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) if (player->kartstuff[k_growshrinktimer] == 26) S_StartSound(player->mo, sfx_mario8); - if ((gametype != GT_RACE) + if ((G_BattleGametype()) && (player->kartstuff[k_star] || player->kartstuff[k_megashroom] || player->kartstuff[k_startimer] || player->kartstuff[k_growshrinktimer] > 0)) player->kartstuff[k_poweritemtimer] = 10*TICRATE; @@ -3253,7 +3253,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->flags2 &= ~MF2_DONTDRAW; } - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) // dead in match? you da bomb + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) // dead in match? you da bomb { K_StripItems(player); player->mo->flags2 |= MF2_SHADOW; @@ -3281,7 +3281,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) else player->mo->tracer->flags2 &= ~MF2_DONTDRAW; } - else if (gametype == GT_RACE || player->kartstuff[k_balloon] > 0) + else if (G_RaceGametype() || player->kartstuff[k_balloon] > 0) { player->mo->flags2 &= ~MF2_SHADOW; if (player->mo->tracer && player->mo->tracer->state == &states[S_PLAYERBOMB]) @@ -3297,7 +3297,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->mo->friction += 4608; if (player->speed > 0 && cmd->forwardmove < 0 && player->mo->friction == 59392) player->mo->friction += 1608; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) { player->mo->friction += 1228; @@ -3389,7 +3389,7 @@ void K_CheckBalloons(void) if (!multiplayer) return; - if (gametype != GT_MATCH) + if (!G_BattleGametype()) return; if (gameaction == ga_completed) @@ -4340,7 +4340,7 @@ static void K_drawKartPositionFaces(void) if (rankplayer[i] != myplayer) { V_DrawSmallTranslucentPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin]); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4352,7 +4352,7 @@ static void K_drawKartPositionFaces(void) else { V_DrawSmallScaledPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin]); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4377,7 +4377,7 @@ static void K_drawKartPositionFaces(void) if (rankplayer[i] != myplayer) { V_DrawSmallTranslucentMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin], colormap); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4389,7 +4389,7 @@ static void K_drawKartPositionFaces(void) else { V_DrawSmallMappedPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, faceprefix[players[rankplayer[i]].skin], colormap); - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] > 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] > 0) { for (j = 0; j < players[rankplayer[i]].kartstuff[k_balloon]; j++) { @@ -4412,14 +4412,14 @@ static void K_drawKartPositionFaces(void) if (rankplayer[i] != myplayer) { - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] <= 0) V_DrawSmallTranslucentPatch(FACE_X-2, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_ranknoballoons); else V_DrawSmallTranslucentPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, localpatch); } else { - if (gametype == GT_MATCH && players[rankplayer[i]].kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && players[rankplayer[i]].kartstuff[k_balloon] <= 0) V_DrawSmallScaledPatch(FACE_X-2, Y, V_HUDTRANS|V_SNAPTOLEFT, kp_ranknoballoons); else V_DrawSmallScaledPatch(FACE_X, Y, V_HUDTRANS|V_SNAPTOLEFT, localpatch); @@ -4559,9 +4559,11 @@ static void K_drawKartPlayerCheck(void) for (i = 0; i < MAXPLAYERS; i++) { - if (&players[i] == stplyr) + if (!playeringame[i] || players[i].spectator) continue; - if (!(players[i].mo)) + if (!players[i].mo) + continue; + if (&players[i] == stplyr) continue; if ((players[i].kartstuff[k_startimer] <= 0) && (leveltime & 2)) @@ -4968,7 +4970,7 @@ void K_drawKartHUD(void) K_initKartHUD(); // Draw full screen stuff that turns off the rest of the HUD - if ((gametype != GT_RACE) + if ((G_BattleGametype()) && (stplyr->exiting || (stplyr->kartstuff[k_balloon] <= 0 && stplyr->kartstuff[k_comebacktimer] @@ -5029,7 +5031,7 @@ void K_drawKartHUD(void) if (!stplyr->spectator) // Bottom of the screen elements, don't need in spectate mode { - if (gametype == GT_RACE) // Race-only elements + if (G_RaceGametype()) // Race-only elements { // Draw the lap counter K_drawKartLaps(); @@ -5047,7 +5049,7 @@ void K_drawKartHUD(void) K_DrawKartPositionNum(stplyr->kartstuff[k_position]); } } - else if (gametype == GT_MATCH) // Battle-only + else if (G_BattleGametype()) // Battle-only { // Draw the hits left! K_drawKartBalloonsOrKarma(); diff --git a/src/p_enemy.c b/src/p_enemy.c index 380e60a39..7508b39c3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -3926,7 +3926,7 @@ static inline boolean PIT_GrenadeRing(mobj_t *thing) return true; if (thing->player && (thing->player->kartstuff[k_bootimer] - || (gametype == GT_MATCH && thing->player && thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebacktimer]))) + || (G_BattleGametype() && thing->player && thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebacktimer]))) return true; if ((gametype == GT_CTF || gametype == GT_TEAMMATCH) @@ -8143,7 +8143,7 @@ void A_ItemPop(mobj_t *actor) remains->flags2 &= ~MF2_AMBUSH; - if (gametype != GT_RACE) + if (G_BattleGametype()) numgotboxes++; P_RemoveMobj(actor); @@ -8213,14 +8213,14 @@ void A_RedShellChase(mobj_t *actor) && actor->target->player->ctfteam == player->ctfteam) continue; - if (gametype == GT_RACE) // Only in races, in match and CTF you should go after any nearby players + if (G_RaceGametype()) // Only in races, in match and CTF you should go after any nearby players { // USER TARGET if (actor->target->player->kartstuff[k_position] != (player->kartstuff[k_position] + 1)) // Red Shells only go after the person directly ahead of you -Sryder continue; } - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (player->kartstuff[k_balloon] <= 0) continue; @@ -8231,7 +8231,7 @@ void A_RedShellChase(mobj_t *actor) } } - if ((gametype == GT_RACE) || (gametype != GT_RACE // If in match etc. only home in when you get close enough, in race etc. home in all the time + if ((G_RaceGametype()) || (G_BattleGametype() // If in match etc. only home in when you get close enough, in race etc. home in all the time && P_AproxDistance(P_AproxDistance(player->mo->x-actor->x, player->mo->y-actor->y), player->mo->z-actor->z) < RING_DIST && player->kartstuff[k_balloon] > 0)) @@ -8242,7 +8242,7 @@ void A_RedShellChase(mobj_t *actor) // done looking if (actor->lastlook == stop) { - if (gametype == GT_RACE) + if (G_RaceGametype()) actor->lastlook = -2; return; } @@ -8289,7 +8289,7 @@ void A_BobombExplode(mobj_t *actor) if (mo2 == actor || mo2->type == MT_BOMBEXPLOSIONSOUND) // Don't explode yourself! Endless loop! continue; - if (gametype == GT_MATCH && actor->target && actor->target->player && actor->target->player->kartstuff[k_balloon] <= 0 && mo2 == actor->target) + if (G_BattleGametype() && actor->target && actor->target->player && actor->target->player->kartstuff[k_balloon] <= 0 && mo2 == actor->target) continue; if (P_AproxDistance(P_AproxDistance(mo2->x - actor->x, mo2->y - actor->y), mo2->z - actor->z) > actor->info->painchance) diff --git a/src/p_inter.c b/src/p_inter.c index 84c602dec..7d4b70c73 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -158,7 +158,7 @@ boolean P_CanPickupItem(player_t *player, boolean weapon) //if (player->powers[pw_flashing] > (flashingtics/4)*3 && player->powers[pw_flashing] <= flashingtics) // return false; - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) // No balloons in Match + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) // No balloons in Match return false; if (player->kartstuff[k_magnettimer]) // You should probably collect stuff when you're attracting it :V @@ -418,7 +418,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { case MT_RANDOMITEM: // SRB2kart case MT_FLINGRANDOMITEM: - if (gametype != GT_RACE && player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && player->kartstuff[k_balloon] <= 0) { if (player->kartstuff[k_comebackmode] == 0 && !player->kartstuff[k_comebacktimer]) { @@ -433,7 +433,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (!P_CanPickupItem(player, false) && special->tracer != toucher) return; - if (gametype != GT_RACE && special->tracer && special->tracer->player) + if (G_BattleGametype() && special->tracer && special->tracer->player) { special->tracer->player->kartstuff[k_comebackmode] = 0; @@ -2294,7 +2294,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source) } } } - else if (gametype == GT_MATCH) + else if (G_BattleGametype()) { K_CheckBalloons(); } @@ -2576,7 +2576,7 @@ static inline void P_NiGHTSDamage(mobj_t *target, mobj_t *source) player->flyangle += 180; // Shuffle's BETTERNIGHTSMOVEMENT? player->flyangle %= 360; - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) player->drillmeter -= 5*20; else { @@ -2750,7 +2750,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) player->pflags &= ~(PF_CARRIED|PF_SLIDING|PF_ITEMHANG|PF_MACESPIN|PF_ROPEHANG|PF_NIGHTSMODE); // Burst weapons and emeralds in Match/CTF only - if (source && (gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF)) + if (source && (G_BattleGametype())) { P_PlayerRingBurst(player, player->health - 1); P_PlayerEmeraldBurst(player, false); @@ -2794,7 +2794,7 @@ static void P_KillPlayer(player_t *player, mobj_t *source, INT32 damage) HU_DoCEcho(va("%s\\is no longer super.\\\\\\\\", player_names[player-players])); }*/ - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (player->kartstuff[k_balloon] > 0) { @@ -3190,7 +3190,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da // Sudden-Death mode if (source && source->type == MT_PLAYER) { - if ((gametype == GT_MATCH || gametype == GT_TEAMMATCH || gametype == GT_CTF) && cv_suddendeath.value + if ((G_BattleGametype()) && cv_suddendeath.value && !player->powers[pw_flashing] && !player->powers[pw_invulnerability]) damage = 10000; } diff --git a/src/p_map.c b/src/p_map.c index aac39c86f..15557ed4c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -383,7 +383,7 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails) || (gametype == GT_MATCH) || (G_GametypeHasTeams() && tails->ctfteam != sonic->ctfteam)) sonic->pflags &= ~PF_CARRIED; */ - if (tails->spectator || sonic->spectator || gametype == GT_RACE) // SRB2kart + if (tails->spectator || sonic->spectator || G_RaceGametype()) // SRB2kart sonic->pflags &= ~PF_CARRIED; else { @@ -1652,18 +1652,18 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing->player->kartstuff[k_growshrinktimer] || thing->player->kartstuff[k_squishedtimer] || thing->player->kartstuff[k_bootimer] || thing->player->kartstuff[k_spinouttimer] || thing->player->kartstuff[k_startimer] || thing->player->kartstuff[k_justbumped] - || (gametype != GT_RACE && (thing->player->kartstuff[k_balloon] <= 0 + || (G_BattleGametype() && (thing->player->kartstuff[k_balloon] <= 0 && (thing->player->kartstuff[k_comebacktimer] || thing->player->kartstuff[k_comebackmode] == 1))) || tmthing->player->kartstuff[k_growshrinktimer] || tmthing->player->kartstuff[k_squishedtimer] || tmthing->player->kartstuff[k_bootimer] || tmthing->player->kartstuff[k_spinouttimer] || tmthing->player->kartstuff[k_startimer] || tmthing->player->kartstuff[k_justbumped] - || (gametype != GT_RACE && (tmthing->player->kartstuff[k_balloon] <= 0 + || (G_BattleGametype() && (tmthing->player->kartstuff[k_balloon] <= 0 && (tmthing->player->kartstuff[k_comebacktimer] || tmthing->player->kartstuff[k_comebackmode] == 1)))) { return true; } - if (gametype != GT_RACE) + if (G_BattleGametype()) { if ((thing->player->kartstuff[k_balloon] <= 0 && thing->player->kartstuff[k_comebackmode] == 0) || (tmthing->player->kartstuff[k_balloon] <= 0 && tmthing->player->kartstuff[k_comebackmode] == 0)) @@ -1686,7 +1686,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (P_IsObjectOnGround(thing) && tmthing->momz < 0) { K_KartBouncing(tmthing, thing, true, false); - if (gametype != GT_RACE && tmthing->player->kartstuff[k_feather] & 2) + if (G_BattleGametype() && tmthing->player->kartstuff[k_feather] & 2) { K_StealBalloon(tmthing->player, thing->player, false); K_SpinPlayer(thing->player, tmthing); @@ -1695,7 +1695,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else if (P_IsObjectOnGround(tmthing) && thing->momz < 0) { K_KartBouncing(thing, tmthing, true, false); - if (gametype != GT_RACE && thing->player->kartstuff[k_feather] & 2) + if (G_BattleGametype() && thing->player->kartstuff[k_feather] & 2) { K_StealBalloon(thing->player, tmthing->player, false); K_SpinPlayer(tmthing->player, thing); @@ -1704,7 +1704,7 @@ static boolean PIT_CheckThing(mobj_t *thing) else K_KartBouncing(tmthing, thing, false, false); - if (gametype != GT_RACE) + if (G_BattleGametype()) { if (thing->player->kartstuff[k_mushroomtimer] && !(tmthing->player->kartstuff[k_mushroomtimer])) { diff --git a/src/p_mobj.c b/src/p_mobj.c index c113d3d06..2f6cb42fc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6525,7 +6525,7 @@ void P_MobjThinker(mobj_t *mobj) INT32 HEIGHT; fixed_t radius; - if (gametype != GT_RACE && mobj->target->player->kartstuff[k_balloon] <= 0) + if (G_BattleGametype() && mobj->target->player->kartstuff[k_balloon] <= 0) kartspeed = 1; dsone = 26*4 + kartspeed*2 + (9 - mobj->target->player->kartweight); @@ -6845,7 +6845,7 @@ void P_MobjThinker(mobj_t *mobj) fixed_t scale = mobj->target->scale; mobj->color = mobj->target->color; - if (!netgame || gametype == GT_RACE + if (!netgame || G_RaceGametype() || mobj->target->player == &players[displayplayer] || mobj->target->player->kartstuff[k_balloon] <= 0 || (mobj->target->player->mo->flags2 & MF2_DONTDRAW)) @@ -7787,9 +7787,9 @@ void P_MobjThinker(mobj_t *mobj) P_SpawnGhostMobj(mobj); if (gamespeed == 0) - finalspeed = FixedMul(finalspeed, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); + finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); else if (gamespeed == 2) - finalspeed = FixedMul(finalspeed, (mapheaderinfo[gamemap-1]->mobj_scale)+(mapheaderinfo[gamemap-1]->mobj_scale/4)); + finalspeed = FixedMul(finalspeed, FRACUNIT+FRACUNIT/4); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->x+mobj->momx, mobj->y+mobj->momy); if (mobj->health <= 5) @@ -7797,12 +7797,14 @@ void P_MobjThinker(mobj_t *mobj) INT32 i; for (i = 5; i >= mobj->health; i--) { - finalspeed = FixedMul(finalspeed, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); + finalspeed = FixedMul(finalspeed, FRACUNIT-FRACUNIT/4); } + finalspeed = FixedMul(finalspeed, mapheaderinfo[gamemap-1]->mobj_scale); P_InstaThrust(mobj, mobj->angle, finalspeed); } else { + finalspeed = FixedMul(finalspeed, mapheaderinfo[gamemap-1]->mobj_scale); P_InstaThrust(mobj, mobj->angle, finalspeed); } @@ -7822,8 +7824,8 @@ void P_MobjThinker(mobj_t *mobj) case MT_REDITEM: { sector_t *sec2; - fixed_t topspeed = 64*(mapheaderinfo[gamemap-1]->mobj_scale); - fixed_t distbarrier = 512*(mapheaderinfo[gamemap-1]->mobj_scale); + fixed_t topspeed = 64*FRACUNIT; + fixed_t distbarrier = 512*FRACUNIT; fixed_t distaway; P_SpawnGhostMobj(mobj); @@ -7835,16 +7837,19 @@ void P_MobjThinker(mobj_t *mobj) if (gamespeed == 0) { - topspeed = FixedMul(topspeed, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); - distbarrier = FixedMul(distbarrier, (mapheaderinfo[gamemap-1]->mobj_scale)-(mapheaderinfo[gamemap-1]->mobj_scale/4)); + topspeed = FixedMul(topspeed, FRACUNIT-FRACUNIT/4); + distbarrier = FixedMul(distbarrier, FRACUNIT-FRACUNIT/4); } else if (gamespeed == 2) { - topspeed = FixedMul(topspeed, (mapheaderinfo[gamemap-1]->mobj_scale)+(mapheaderinfo[gamemap-1]->mobj_scale/4)); - distbarrier = FixedMul(distbarrier, (mapheaderinfo[gamemap-1]->mobj_scale)+(mapheaderinfo[gamemap-1]->mobj_scale/4); + topspeed = FixedMul(topspeed, FRACUNIT+FRACUNIT/4); + distbarrier = FixedMul(distbarrier, FRACUNIT+FRACUNIT/4); } - if (gametype == GT_RACE && mobj->tracer) + distbarrier = FixedMul(distbarrier, mapheaderinfo[gamemap-1]->mobj_scale); + topspeed = FixedMul(topspeed, mapheaderinfo[gamemap-1]->mobj_scale); + + if (G_RaceGametype() && mobj->tracer) { distaway = P_AproxDistance(mobj->tracer->x - mobj->x, mobj->tracer->y - mobj->y); if (distaway < distbarrier) @@ -7857,7 +7862,7 @@ void P_MobjThinker(mobj_t *mobj) } } - if (gametype != GT_RACE) + if (G_BattleGametype()) { mobj->friction -= 1228; if (mobj->friction > FRACUNIT) @@ -9310,7 +9315,7 @@ void P_RespawnSpecials(void) mobj_t *mo = NULL; mapthing_t *mthing = NULL; - if (gametype != GT_RACE) // Battle Mode vers + if (G_BattleGametype()) // Battle Mode vers { P_RespawnBattleSpecials(); return; @@ -9600,7 +9605,7 @@ void P_SpawnPlayer(INT32 playernum) overheadarrow->flags2 |= MF2_DONTDRAW; P_SetScale(overheadarrow, mobj->destscale); - if (gametype != GT_RACE) + if (G_BattleGametype()) { /*INT32 i; INT32 pcount = 0; @@ -10005,7 +10010,7 @@ void P_SpawnMapThing(mapthing_t *mthing) if (!cv_powerstones.value) return; - if (!(gametype == GT_MATCH || gametype == GT_CTF)) + if (!G_BattleGametype()) return; runemeraldmanager = true; diff --git a/src/p_setup.c b/src/p_setup.c index cc707baf5..7f722548f 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2871,7 +2871,7 @@ boolean P_SetupLevel(boolean skipprecip) CONS_Printf(M_GetText("No player currently available to become IT. Awaiting available players.\n")); } - else if (gametype == GT_RACE && server && cv_usemapnumlaps.value) + else if (G_RaceGametype() && server && cv_usemapnumlaps.value) CV_StealthSetValue(&cv_numlaps, mapheaderinfo[gamemap - 1]->numlaps); // =========== @@ -2978,12 +2978,12 @@ boolean P_SetupLevel(boolean skipprecip) // SRB2Kart: map load variables if (modeattacking) gamespeed = 2; - else if (gametype == GT_MATCH) + else if (G_BattleGametype()) gamespeed = 0; else gamespeed = cv_kartspeed.value; - if (gametype == GT_MATCH) + if (G_BattleGametype()) mirrormode = false; else mirrormode = cv_kartmirror.value; diff --git a/src/p_spec.c b/src/p_spec.c index 2042e4923..46e6685d4 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4133,10 +4133,10 @@ DoneSection2: case 10: // Finish Line // SRB2kart - 150117 - if (gametype == GT_RACE && (player->starpostcount >= numstarposts/2 || player->exiting)) + if (G_RaceGametype() && (player->starpostcount >= numstarposts/2 || player->exiting)) player->kartstuff[k_starpostwp] = player->kartstuff[k_waypoint] = 0; // - if (gametype == GT_RACE && !player->exiting) + if (G_RaceGametype() && !player->exiting) { if (player->starpostcount >= numstarposts/2) // srb2kart: must have touched *enough* starposts (was originally "(player->starpostnum == numstarposts)") { @@ -5617,7 +5617,7 @@ void P_SpawnSpecials(INT32 fromnetsave) switch(GETSECSPECIAL(sector->special, 4)) { case 10: // Circuit finish line - if (gametype == GT_RACE) + if (G_RaceGametype()) circuitmap = true; break; } @@ -6378,7 +6378,7 @@ void P_SpawnSpecials(INT32 fromnetsave) break; case 308: // Race-only linedef executor. Triggers once. - if (gametype != GT_RACE && gametype != GT_COMPETITION) + if (!G_RaceGametype()) lines[i].special = 0; break; diff --git a/src/p_user.c b/src/p_user.c index f873f1a33..155694faf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -350,7 +350,7 @@ UINT8 P_FindLowestMare(void) mobj_t *mo2; UINT8 mare = UINT8_MAX; - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) return 0; // scan the thinkers @@ -685,7 +685,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) P_RestoreMusic(player); P_SetMobjState(player->mo->tracer, S_SUPERTRANS1); - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) { if (player->drillmeter < 48*20) player->drillmeter = 48*20; @@ -1653,7 +1653,7 @@ void P_DoPlayerExit(player_t *player) && (!player->spectator && ((!modifiedgame || savemoddata) && !demoplayback))) legitimateexit = true; - if (gametype == GT_RACE || gametype == GT_COMPETITION) // If in Race Mode, allow + if (G_RaceGametype()) // If in Race Mode, allow { // SRB2kart 120217 if (!countdown && !(netgame || multiplayer)) @@ -1696,7 +1696,7 @@ void P_DoPlayerExit(player_t *player) if (P_CheckRacers()) player->exiting = (14*TICRATE)/5 + 1; } - else if (gametype != GT_RACE) + else if (G_BattleGametype()) player->exiting = 8*TICRATE + 1; // Battle Mode exiting else player->exiting = (14*TICRATE)/5 + 2; // Accidental death safeguard??? @@ -5794,7 +5794,7 @@ static void P_NiGHTSMovement(player_t *player) && !player->exiting) player->nightstime--; } - else if (gametype != GT_RACE && gametype != GT_COMPETITION + else if (!G_RaceGametype() && !(player->mo->tracer->state >= &states[S_SUPERTRANS1] && player->mo->tracer->state <= &states[S_SUPERTRANS9]) && !(player->capsule && player->capsule->reactiontime) && !player->exiting) @@ -5947,7 +5947,7 @@ static void P_NiGHTSMovement(player_t *player) { player->mo->momx = player->mo->momy = 0; - if (gametype != GT_RACE && gametype != GT_COMPETITION) + if (!G_RaceGametype()) P_SetObjectMomZ(player->mo, 30*FRACUNIT, false); player->mo->tracer->angle += ANGLE_11hh; @@ -8111,7 +8111,7 @@ static void P_DeathThink(player_t *player) } } - if ((gametype == GT_RACE || gametype == GT_COMPETITION || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0)) + if ((G_RaceGametype() || (gametype == GT_COOP && (multiplayer || netgame))) && (player->lives <= 0)) { // Return to level music if (netgame) @@ -9251,7 +9251,7 @@ void P_PlayerThink(player_t *player) I_Error("player %s is in PST_REBORN\n", sizeu1(playeri)); #endif - if (gametype == GT_RACE || gametype == GT_COMPETITION) + if (G_RaceGametype()) { INT32 i; @@ -9304,7 +9304,7 @@ void P_PlayerThink(player_t *player) // If it is set, start subtracting // Don't allow it to go back to 0 - if (player->exiting > 1 && (player->exiting < 3*TICRATE || gametype != GT_RACE)) // SRB2kart - "&& player->exiting > 1" + if (player->exiting > 1 && (player->exiting < 3*TICRATE || !G_RaceGametype())) // SRB2kart - "&& player->exiting > 1" player->exiting--; if (player->exiting && countdown2) @@ -9667,7 +9667,7 @@ void P_PlayerThink(player_t *player) || (splitscreen > 1 && player == &players[thirddisplayplayer]) || (splitscreen > 2 && player == &players[fourthdisplayplayer])) && player->kartstuff[k_bootimer] == 0 && player->kartstuff[k_growshrinktimer] <= 0 - && (player->kartstuff[k_comebacktimer] == 0 || (gametype == GT_RACE || player->kartstuff[k_balloon] > 0))) + && (player->kartstuff[k_comebacktimer] == 0 || (G_RaceGametype() || player->kartstuff[k_balloon] > 0))) { if (player->powers[pw_flashing] > 0 && player->powers[pw_flashing] < K_GetKartFlashing() && (leveltime & 1)) player->mo->flags2 |= MF2_DONTDRAW; From 80690136d6bf05aa1dd389e418e0ae13350c7f01 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 4 Mar 2018 15:59:51 -0500 Subject: [PATCH 08/10] mobjscale: MT_FIREDITEM fix --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2f6cb42fc..4fa18fdb5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -7082,7 +7082,7 @@ void P_MobjThinker(mobj_t *mobj) { x = mobj->target->x; y = mobj->target->y; - z = mobj->target->z + 80*FRACUNIT; + z = mobj->target->z + 80*(mapheaderinfo[gamemap-1]->mobj_scale); } P_TeleportMove(mobj, x, y, z); break; From 76e317c111fcda990d53712ff9a4764cbac00cc1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 4 Mar 2018 18:42:06 -0500 Subject: [PATCH 09/10] Unlock all cheat no longer sets game modified if it can't find anything to unlock Sound test is also in the Options menu now. --- src/m_cheat.c | 20 ++++++++++++++++---- src/m_cond.c | 2 -- src/m_menu.c | 15 +++++++++++++-- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index f7476fca2..fed76eddb 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -75,6 +75,7 @@ typedef struct static UINT8 cheatf_warp(void) { UINT8 i; + boolean success = false; /*if (modifiedgame) return 0;*/ @@ -82,12 +83,23 @@ static UINT8 cheatf_warp(void) if (menuactive && currentMenu != &MainDef) return 0; // Only on the main menu! - S_StartSound(0, sfx_kc42); - // Temporarily unlock EVERYTHING. - G_SetGameModified(false); for (i = 0; i < MAXUNLOCKABLES; i++) - unlockables[i].unlocked = true; + { + if (!unlockables[i].conditionset) + continue; + if (!unlockables[i].unlocked) + { + unlockables[i].unlocked = true; + success = true; + } + } + + if (success) + { + G_SetGameModified(false); + S_StartSound(0, sfx_kc42); + } // Refresh secrets menu existing. M_ClearMenus(true); diff --git a/src/m_cond.c b/src/m_cond.c index 2dfb502a4..729323655 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -117,8 +117,6 @@ unlockable_t unlockables[MAXUNLOCKABLES] = /* 02 */ {"Chaotic Kart Cup", "Collect 15 Emblems", 0, 2, SECRET_NONE, 0, false, false, 0}, /* 03 */ {"Record Attack", "", 0, -1, SECRET_RECORDATTACK, 0, true, true, 0}, - /* 04 */ {"Play Credits", "", 10, -1, SECRET_CREDITS, 0, true, true, 0}, - /* 05 */ {"Sound Test", "", 20, -1, SECRET_SOUNDTEST, 0, true, true, 0}, }; // Default number of emblems and extra emblems diff --git a/src/m_menu.c b/src/m_menu.c index 1775dc9e5..6c5e71f13 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -1042,7 +1042,7 @@ static menuitem_t OP_MainMenu[] = {IT_SUBMENU | IT_STRING, NULL, "Server Options...", &OP_ServerOptionsDef, 80}, {IT_CALL | IT_STRING, NULL, "Play Credits", M_Credits, 100}, - //{IT_KEYHANDLER | IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110}, + {IT_KEYHANDLER | IT_STRING, NULL, "Sound Test", M_HandleSoundTest, 110}, }; static menuitem_t OP_ControlsMenu[] = @@ -1792,7 +1792,18 @@ menu_t MP_PlayerSetupDef = }; // Options -menu_t OP_MainDef = DEFAULTMENUSTYLE("M_OPTTTL", OP_MainMenu, &MainDef, 60, 30); +menu_t OP_MainDef = +{ + "M_OPTTTL", + sizeof (OP_MainMenu)/sizeof (menuitem_t), + &MainDef, + OP_MainMenu, + M_DrawSkyRoom, + 60, 30, + 0, + NULL +}; + menu_t OP_ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlsMenu, &OP_MainDef, 60, 30); //menu_t OP_ControlListDef = DEFAULTMENUSTYLE("M_CONTRO", OP_ControlListMenu, &OP_ControlsDef, 60, 30); menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlsDef); From e7a04e6d7a0616926012709ee05ed3a3b58f3fe6 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 4 Mar 2018 18:57:34 -0500 Subject: [PATCH 10/10] whoop, minor thing --- src/m_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_menu.c b/src/m_menu.c index 6c5e71f13..88fcd33b3 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -688,7 +688,7 @@ static menuitem_t SR_LevelSelectMenu[] = static menuitem_t SR_UnlockChecklistMenu[] = { - {IT_SUBMENU | IT_STRING, NULL, "NEXT", &SR_MainDef, 192}, + {IT_SUBMENU | IT_STRING, NULL, "NEXT", &MainDef, 192}, }; static menuitem_t SR_EmblemHintMenu[] =