From f97ec304935c6b881df080a56d9c5197c5824ea1 Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 4 Mar 2018 15:27:52 -0500 Subject: [PATCH] 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 3d864e39..9485e910 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 3099ca45..fbf2dee0 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 f71e9e15..2013d77e 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 3941e6c1..c3c04bed 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 409f2afe..b0519f82 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 380e60a3..7508b39c 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 84c602de..7d4b70c7 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 aac39c86..15557ed4 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 c113d3d0..2f6cb42f 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 cc707baf..7f722548 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 2042e492..46e6685d 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 f873f1a3..155694fa 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;