From 4281c9ca103eb2ab718e0311f61f04ff2717fd00 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 26 Mar 2018 01:40:15 -0400 Subject: [PATCH 01/34] Nightserize: Reset player another/flyangle on new mare --- src/p_user.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index f422e9b65..bdc493a75 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -758,6 +758,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->marebegunat = leveltime; player->rings = 0; + player->flyangle = 0; + player->anotherflyangle = 0; } else { From ac8be33752cae1e293c180bb3349c0cefe8c0519 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 26 Mar 2018 01:54:38 -0400 Subject: [PATCH 02/34] Reset player->another/flyangle on any Nightserize or DeNightserize --- src/p_user.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index bdc493a75..6a87f8ca3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -586,6 +586,8 @@ static void P_DeNightserizePlayer(player_t *player) player->climbing = 0; player->mo->fuse = 0; player->speed = 0; + player->flyangle = 0; + player->anotherflyangle = 0; P_SetTarget(&player->mo->target, NULL); P_SetTarget(&player->axis1, P_SetTarget(&player->axis2, NULL)); @@ -659,6 +661,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->speed = 0; player->climbing = 0; player->secondjump = 0; + player->flyangle = 0; + player->anotherflyangle = 0; player->powers[pw_shield] = SH_NONE; player->powers[pw_super] = 0; @@ -758,8 +762,6 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->marebegunat = leveltime; player->rings = 0; - player->flyangle = 0; - player->anotherflyangle = 0; } else { From 3fbffb0b4da81a622f682b52df5c81ecc5d3bb8b Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 30 Mar 2018 14:36:49 -0400 Subject: [PATCH 03/34] Add player_t marelap and marebonuslap, with logic --- src/d_player.h | 2 ++ src/g_game.c | 2 ++ src/lua_playerlib.c | 8 ++++++++ src/p_map.c | 17 ++++++++++++----- src/p_saveg.c | 4 ++++ src/p_setup.c | 1 + src/p_user.c | 4 ++++ 7 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e1350fe67..f919eddb0 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -455,6 +455,8 @@ typedef struct player_s boolean bonustime; // Capsule destroyed, now it's bonus time! mobj_t *capsule; // Go inside the capsule UINT8 mare; // Current mare + UINT8 marelap; // Current mare lap + UINT8 marebonuslap; // Current mare lap starting from bonus time // Statistical purposes. tic_t marebegunat; // Leveltime when mare begun diff --git a/src/g_game.c b/src/g_game.c index 9db9c413b..a2e9b881a 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2230,6 +2230,8 @@ void G_PlayerReborn(INT32 player) if (p->mare == 255) p->mare = 0; + p->marelap = p->marebonuslap = 0; + // Check to make sure their color didn't change somehow... if (G_GametypeHasTeams()) { diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 12b2646d0..9b5aa6fdc 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -288,6 +288,10 @@ static int player_get(lua_State *L) LUA_PushUserdata(L, plr->capsule, META_MOBJ); else if (fastcmp(field,"mare")) lua_pushinteger(L, plr->mare); + else if (fastcmp(field,"marelap")) + lua_pushinteger(L, plr->marelap); + else if (fastcmp(field,"marebonuslap")) + lua_pushinteger(L, plr->marebonuslap); else if (fastcmp(field,"marebegunat")) lua_pushinteger(L, plr->marebegunat); else if (fastcmp(field,"startedtime")) @@ -564,6 +568,10 @@ static int player_set(lua_State *L) } else if (fastcmp(field,"mare")) plr->mare = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"marelap")) + plr->marelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"marebonuslap")) + plr->marebonuslap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"marebegunat")) plr->marebegunat = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"startedtime")) diff --git a/src/p_map.c b/src/p_map.c index 6d1760596..565680e22 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -905,24 +905,31 @@ static boolean PIT_CheckThing(mobj_t *thing) P_SetTarget(&thing->target, tmthing); } - // Respawn rings and items + // NiGHTS lap logic if ((tmthing->type == MT_NIGHTSDRONE || thing->type == MT_NIGHTSDRONE) && (tmthing->player || thing->player)) { mobj_t *droneobj = (tmthing->type == MT_NIGHTSDRONE) ? tmthing : thing; player_t *pl = (droneobj == thing) ? tmthing->player : thing->player; - // Must be in bonus time, and must be NiGHTS, must wait about a second + // Must be NiGHTS, must wait about a second // must be flying in the SAME DIRECTION as the last time you came through. // not (your direction) xor (stored direction) // In other words, you can't u-turn and respawn rings near the drone. - if (pl->bonustime && (pl->powers[pw_carry] == CR_NIGHTSMODE) && (INT32)leveltime > droneobj->extravalue2 && ( + if ((pl->powers[pw_carry] == CR_NIGHTSMODE) && (INT32)leveltime > droneobj->extravalue2 && ( !(pl->anotherflyangle >= 90 && pl->anotherflyangle <= 270) ^ (droneobj->extravalue1 >= 90 && droneobj->extravalue1 <= 270) )) { - // Reload all the fancy ring stuff! - P_ReloadRings(); + pl->marelap++; + + if (pl->bonustime) + { + pl->marebonuslap++; + + // Respawn rings and items + P_ReloadRings(); + } } droneobj->extravalue1 = pl->anotherflyangle; droneobj->extravalue2 = (INT32)leveltime + TICRATE; diff --git a/src/p_saveg.c b/src/p_saveg.c index 029df08f4..59d1775a8 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -197,6 +197,8 @@ static void P_NetArchivePlayers(void) WRITEUINT8(save_p, players[i].drilldelay); WRITEUINT8(save_p, players[i].bonustime); WRITEUINT8(save_p, players[i].mare); + WRITEUINT8(save_p, players[i].marelap); + WRITEUINT8(save_p, players[i].marebonuslap); WRITEUINT32(save_p, players[i].marebegunat); WRITEUINT32(save_p, players[i].startedtime); @@ -384,6 +386,8 @@ static void P_NetUnArchivePlayers(void) players[i].drilldelay = READUINT8(save_p); players[i].bonustime = (boolean)READUINT8(save_p); players[i].mare = READUINT8(save_p); + players[i].marelap = READUINT8(save_p); + players[i].marebonuslap = READUINT8(save_p); players[i].marebegunat = READUINT32(save_p); players[i].startedtime = READUINT32(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index a9fc57652..f3e92abce 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2350,6 +2350,7 @@ static void P_LevelInitStuff(void) players[i].linkcount = players[i].linktimer = 0; players[i].flyangle = players[i].anotherflyangle = 0; players[i].nightstime = players[i].mare = 0; + players[i].marelap = 0; players[i].marebonuslap = 0; P_SetTarget(&players[i].capsule, NULL); players[i].drillmeter = 40*20; diff --git a/src/p_user.c b/src/p_user.c index f422e9b65..a6fe9e315 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -399,6 +399,8 @@ boolean P_TransferToNextMare(player_t *player) CONS_Debug(DBG_NIGHTS, "Mare is %d\n", mare); player->mare = mare; + player->marelap = 0; + player->marebonuslap = 0; // scan the thinkers // to find the closest axis point @@ -586,6 +588,8 @@ static void P_DeNightserizePlayer(player_t *player) player->climbing = 0; player->mo->fuse = 0; player->speed = 0; + player->marelap = 0; + player->marebonuslap = 0; P_SetTarget(&player->mo->target, NULL); P_SetTarget(&player->axis1, P_SetTarget(&player->axis2, NULL)); From 294d5831665e9b23b19d90540fb2a9da7db80b0f Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 2 Apr 2018 10:02:16 -0400 Subject: [PATCH 04/34] Dumb stupid hack where NiGHTS faces you upon Nightserizing Because I can't figure out how to tell which player angle is "forward" in an axis track. --- src/p_user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/p_user.c b/src/p_user.c index f422e9b65..24c3f1249 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -770,6 +770,11 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->texttimer = (UINT8)(110 - timeinmap); } + // make NiGHTS face you only upon Nightserizing (w/ attitude!) + // calculate player->angle_pos ourselves because it won't be set the first time + if (player->mo->target) + player->mo->angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y); + player->powers[pw_carry] = CR_NIGHTSMODE; } From 49682f58bf12edebe73bbc1c5406036001f390b6 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 2 Apr 2018 15:21:19 -0400 Subject: [PATCH 05/34] Make NiGHTS face forward or backward upon Nightserizing --- src/p_user.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 24c3f1249..8f1d2f380 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -770,10 +770,14 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->texttimer = (UINT8)(110 - timeinmap); } - // make NiGHTS face you only upon Nightserizing (w/ attitude!) + // force NiGHTS to face forward or backward // calculate player->angle_pos ourselves because it won't be set the first time if (player->mo->target) - player->mo->angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y); + player->mo->angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y) + + ((player->mo->target->flags2 & MF2_AMBUSH) ? // if axis is invert, take the opposite right angle + (player->flyangle > 90 && player->flyangle < 270 ? ANGLE_90 : -ANGLE_90) + : (player->flyangle > 90 && player->flyangle < 270 ? -ANGLE_90 : ANGLE_90) + ); player->powers[pw_carry] = CR_NIGHTSMODE; } From 7cf2c78522400da5337d05260bbc911757b2332b Mon Sep 17 00:00:00 2001 From: Digiku Date: Sat, 7 Apr 2018 06:28:31 -0400 Subject: [PATCH 06/34] Fix whitespace weirdness --- src/p_user.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 19ddde833..d59b4ec15 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -777,10 +777,9 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) // force NiGHTS to face forward or backward if (player->mo->target) player->mo->angle = R_PointToAngle2(player->mo->target->x, player->mo->target->y, player->mo->x, player->mo->y) // player->angle_pos, won't be set on first instance - + ((player->mo->target->flags2 & MF2_AMBUSH) ? // if axis is invert, take the opposite right angle - (player->flyangle > 90 && player->flyangle < 270 ? ANGLE_90 : -ANGLE_90) - : (player->flyangle > 90 && player->flyangle < 270 ? -ANGLE_90 : ANGLE_90) - ); + + ((player->mo->target->flags2 & MF2_AMBUSH) ? // if axis is invert, take the opposite right angle + (player->flyangle > 90 && player->flyangle < 270 ? ANGLE_90 : -ANGLE_90) + : (player->flyangle > 90 && player->flyangle < 270 ? -ANGLE_90 : ANGLE_90)); player->powers[pw_carry] = CR_NIGHTSMODE; } From d58445fdf3425af786f729a9ef9b89f0a1628d64 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 10 Aug 2018 16:17:28 -0400 Subject: [PATCH 07/34] Set player->finishedrings upon new mare (Forgot this line from the player->spheres merge, so let's straggle here) --- src/p_user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_user.c b/src/p_user.c index 5f1284ef8..b7336b545 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -746,6 +746,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->texttimer = 4*TICRATE; player->textvar = 4; // Score and grades player->finishedspheres = (INT16)(player->spheres); + player->finishedrings = (INT16)(player->rings); // Add score to temp leaderboards if (!(netgame||multiplayer) && P_IsLocalPlayer(player)) From 18b5b70822a88a8dfffa68dd4fff91ac9cc3ed82 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 10 Aug 2018 16:30:49 -0400 Subject: [PATCH 08/34] Add lastmarelap and lastmarebonuslap player variables --- src/d_player.h | 2 ++ src/lua_playerlib.c | 8 ++++++++ src/p_saveg.c | 4 ++++ src/p_setup.c | 1 + src/p_user.c | 10 ++++++++-- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index cea3d5130..498b7166d 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -468,6 +468,8 @@ typedef struct player_s UINT32 marescore; // score for this nights stage UINT32 lastmarescore; // score for the last mare UINT8 lastmare; // previous mare + UINT8 lastmarelap; // previous mare lap + UINT8 lastmarebonuslap; // previous mare bonus lap INT32 maxlink; // maximum link obtained UINT8 texttimer; // nights_texttime should not be local UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 345f4a4d0..7deefa7ff 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -310,6 +310,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->lastmarescore); else if (fastcmp(field,"lastmare")) lua_pushinteger(L, plr->lastmare); + else if (fastcmp(field,"lastmarelap")) + lua_pushinteger(L, plr->lastmarelap); + else if (fastcmp(field,"lastmarebonuslap")) + lua_pushinteger(L, plr->lastmarebonuslap); else if (fastcmp(field,"maxlink")) lua_pushinteger(L, plr->maxlink); else if (fastcmp(field,"texttimer")) @@ -594,6 +598,10 @@ static int player_set(lua_State *L) plr->lastmarescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmare")) plr->lastmare = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastmarelap")) + plr->lastmarelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lastmarebonuslap")) + plr->lastmarebonuslap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"maxlink")) plr->maxlink = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"texttimer")) diff --git a/src/p_saveg.c b/src/p_saveg.c index 729342424..2b48cc783 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -209,6 +209,8 @@ static void P_NetArchivePlayers(void) WRITEUINT32(save_p, players[i].marescore); WRITEUINT32(save_p, players[i].lastmarescore); WRITEUINT8(save_p, players[i].lastmare); + WRITEUINT8(save_p, players[i].lastmarelap); + WRITEUINT8(save_p, players[i].lastmarebonuslap); WRITEINT32(save_p, players[i].maxlink); WRITEUINT8(save_p, players[i].texttimer); WRITEUINT8(save_p, players[i].textvar); @@ -400,6 +402,8 @@ static void P_NetUnArchivePlayers(void) players[i].marescore = READUINT32(save_p); players[i].lastmarescore = READUINT32(save_p); players[i].lastmare = READUINT8(save_p); + players[i].lastmarelap = READUINT8(save_p); + players[i].lastmarebonuslap = READUINT8(save_p); players[i].maxlink = READINT32(save_p); players[i].texttimer = READUINT8(save_p); players[i].textvar = READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 46f77536d..e4b6034b1 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2381,6 +2381,7 @@ static void P_LevelInitStuff(void) players[i].maxlink = players[i].startedtime =\ players[i].finishedtime = players[i].finishedspheres =\ players[i].finishedrings = players[i].lastmare =\ + players[i].lastmarelap = players[i].lastmarebonuslap =\ players[i].marebegunat = players[i].textvar =\ players[i].texttimer = players[i].linkcount =\ players[i].linktimer = players[i].flyangle =\ diff --git a/src/p_user.c b/src/p_user.c index b7336b545..99ecb8154 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -637,7 +637,7 @@ static void P_DeNightserizePlayer(player_t *player) // NiGHTS Time! void P_NightserizePlayer(player_t *player, INT32 nighttime) { - INT32 oldmare; + UINT8 oldmare, oldmarelap, oldmarebonuslap; // Bots can't be NiGHTSerized, silly!1 :P if (player->bot) @@ -684,6 +684,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) } oldmare = player->mare; + oldmarelap = player->marelap; + oldmarebonuslap = player->marebonuslap; if (!P_TransferToNextMare(player)) { @@ -711,6 +713,8 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) players[i].texttimer = (3 * TICRATE) - 10; players[i].textvar = 4; // Score and grades players[i].lastmare = players[i].mare; + players[i].lastmarelap = players[i].marelap; + players[i].lastmarebonuslap = players[i].marebonuslap; if (G_IsSpecialStage(gamemap)) { players[i].finishedspheres = (INT16)total_spheres; @@ -742,7 +746,9 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) // Spheres bonus P_AddPlayerScore(player, (player->spheres) * 50); - player->lastmare = (UINT8)oldmare; + player->lastmare = oldmare; + player->lastmarelap = oldmarelap; + player->lastmarebonuslap = oldmarebonuslap; player->texttimer = 4*TICRATE; player->textvar = 4; // Score and grades player->finishedspheres = (INT16)(player->spheres); From 4e02171c2350400602bbf421a8d0af56b4fdc99a Mon Sep 17 00:00:00 2001 From: mazmazz Date: Fri, 10 Aug 2018 17:12:26 -0400 Subject: [PATCH 09/34] Add lapbegunat and lapstartedtime player variables There is no lapfinishedtime because [mare]finishedtime refers to when Egg Capsule is destroyed. That concept does not apply to laps. --- src/d_player.h | 2 ++ src/lua_playerlib.c | 8 ++++++++ src/p_inter.c | 2 ++ src/p_map.c | 2 ++ src/p_saveg.c | 4 ++++ src/p_setup.c | 3 ++- src/p_user.c | 3 ++- 7 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 498b7166d..648867b92 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -463,6 +463,8 @@ typedef struct player_s tic_t marebegunat; // Leveltime when mare begun tic_t startedtime; // Time which you started this mare with. tic_t finishedtime; // Time it took you to finish the mare (used for display) + tic_t lapbegunat; // Leveltime when lap begun + tic_t lapstartedtime; // Time which you started this lap with. INT16 finishedspheres; // The spheres you had left upon finishing the mare INT16 finishedrings; // The rings/stars you had left upon finishing the mare UINT32 marescore; // score for this nights stage diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 7deefa7ff..114aa27b0 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -300,6 +300,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->startedtime); else if (fastcmp(field,"finishedtime")) lua_pushinteger(L, plr->finishedtime); + else if (fastcmp(field,"lapbegunat")) + lua_pushinteger(L, plr->lapbegunat); + else if (fastcmp(field,"lapstartedtime")) + lua_pushinteger(L, plr->lapstartedtime); else if (fastcmp(field,"finishedspheres")) lua_pushinteger(L, plr->finishedspheres); else if (fastcmp(field,"finishedrings")) @@ -588,6 +592,10 @@ static int player_set(lua_State *L) plr->startedtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedtime")) plr->finishedtime = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lapbegunat")) + plr->lapbegunat = (tic_t)luaL_checkinteger(L, 3); + else if (fastcmp(field,"lapstartedtime")) + plr->lapstartedtime = (tic_t)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedspheres")) plr->finishedspheres = (INT16)luaL_checkinteger(L, 3); else if (fastcmp(field,"finishedrings")) diff --git a/src/p_inter.c b/src/p_inter.c index ce8bba6b6..e7590439e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1134,6 +1134,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { player->nightstime += special->info->speed; player->startedtime += special->info->speed; + player->lapstartedtime += special->info->speed; P_RestoreMusic(player); } else @@ -1143,6 +1144,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) { players[i].nightstime += special->info->speed; players[i].startedtime += special->info->speed; + players[i].lapstartedtime += special->info->speed; P_RestoreMusic(&players[i]); } if (special->info->deathsound != sfx_None) diff --git a/src/p_map.c b/src/p_map.c index 415e2bac1..7d3538573 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1114,6 +1114,8 @@ static boolean PIT_CheckThing(mobj_t *thing) )) { pl->marelap++; + pl->lapbegunat = leveltime; + pl->lapstartedtime = pl->nightstime; if (pl->bonustime) { diff --git a/src/p_saveg.c b/src/p_saveg.c index 2b48cc783..e18802f57 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -204,6 +204,8 @@ static void P_NetArchivePlayers(void) WRITEUINT32(save_p, players[i].marebegunat); WRITEUINT32(save_p, players[i].startedtime); WRITEUINT32(save_p, players[i].finishedtime); + WRITEUINT32(save_p, players[i].lapbegunat); + WRITEUINT32(save_p, players[i].lapstartedtime); WRITEINT16(save_p, players[i].finishedspheres); WRITEINT16(save_p, players[i].finishedrings); WRITEUINT32(save_p, players[i].marescore); @@ -397,6 +399,8 @@ static void P_NetUnArchivePlayers(void) players[i].marebegunat = READUINT32(save_p); players[i].startedtime = READUINT32(save_p); players[i].finishedtime = READUINT32(save_p); + players[i].lapbegunat = READUINT32(save_p); + players[i].lapstartedtime = READUINT32(save_p); players[i].finishedspheres = READINT16(save_p); players[i].finishedrings = READINT16(save_p); players[i].marescore = READUINT32(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index e4b6034b1..4b10f431c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2387,7 +2387,8 @@ static void P_LevelInitStuff(void) players[i].linktimer = players[i].flyangle =\ players[i].anotherflyangle = players[i].nightstime =\ players[i].mare = players[i].marelap =\ - players[i].marebonuslap = players[i].realtime =\ + players[i].marebonuslap = players[i].lapbegunat =\ + players[i].lapstartedtime = players[i].realtime =\ players[i].exiting = 0; // i guess this could be part of the above but i feel mildly uncomfortable implicitly casting diff --git a/src/p_user.c b/src/p_user.c index 99ecb8154..06f42dcad 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -666,7 +666,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->followitem = skins[DEFAULTNIGHTSSKIN].followitem; } - player->nightstime = player->startedtime = nighttime*TICRATE; + player->nightstime = player->startedtime = player->lapstartedtime = nighttime*TICRATE; player->bonustime = false; P_RestoreMusic(player); @@ -762,6 +762,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) player->lastmarescore = player->marescore; player->marescore = 0; player->marebegunat = leveltime; + player->lapbegunat = leveltime; player->spheres = player->rings = 0; } From 5938a5797070d9c5c1293f7bb90b245307266bc6 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sun, 12 Aug 2018 19:57:33 -0400 Subject: [PATCH 10/34] totalmarelap and totalmarebonuslap player variables --- src/d_player.h | 2 ++ src/lua_playerlib.c | 8 ++++++++ src/p_map.c | 4 +++- src/p_saveg.c | 4 ++++ src/p_setup.c | 1 + 5 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/d_player.h b/src/d_player.h index 648867b92..e7e6e4827 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -472,6 +472,8 @@ typedef struct player_s UINT8 lastmare; // previous mare UINT8 lastmarelap; // previous mare lap UINT8 lastmarebonuslap; // previous mare bonus lap + UINT8 totalmarelap; // total mare lap + UINT8 totalmarebonuslap; // total mare bonus lap INT32 maxlink; // maximum link obtained UINT8 texttimer; // nights_texttime should not be local UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 114aa27b0..67efe7710 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -318,6 +318,10 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->lastmarelap); else if (fastcmp(field,"lastmarebonuslap")) lua_pushinteger(L, plr->lastmarebonuslap); + else if (fastcmp(field,"totalmarelap")) + lua_pushinteger(L, plr->totalmarelap); + else if (fastcmp(field,"totalmarebonuslap")) + lua_pushinteger(L, plr->totalmarebonuslap); else if (fastcmp(field,"maxlink")) lua_pushinteger(L, plr->maxlink); else if (fastcmp(field,"texttimer")) @@ -610,6 +614,10 @@ static int player_set(lua_State *L) plr->lastmarelap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmarebonuslap")) plr->lastmarebonuslap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarelap")) + plr->totalmarelap = (UINT8)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarebonuslap")) + plr->totalmarebonuslap = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"maxlink")) plr->maxlink = (INT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"texttimer")) diff --git a/src/p_map.c b/src/p_map.c index 7d3538573..6e5e03a8d 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1114,12 +1114,14 @@ static boolean PIT_CheckThing(mobj_t *thing) )) { pl->marelap++; + pl->totalmarelap++; pl->lapbegunat = leveltime; pl->lapstartedtime = pl->nightstime; - if (pl->bonustime) + if (pl->bonustime) { pl->marebonuslap++; + pl->totalmarebonuslap++; // Respawn rings and items P_ReloadRings(); diff --git a/src/p_saveg.c b/src/p_saveg.c index e18802f57..bcc582cd0 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -213,6 +213,8 @@ static void P_NetArchivePlayers(void) WRITEUINT8(save_p, players[i].lastmare); WRITEUINT8(save_p, players[i].lastmarelap); WRITEUINT8(save_p, players[i].lastmarebonuslap); + WRITEUINT8(save_p, players[i].totalmarelap); + WRITEUINT8(save_p, players[i].totalmarebonuslap); WRITEINT32(save_p, players[i].maxlink); WRITEUINT8(save_p, players[i].texttimer); WRITEUINT8(save_p, players[i].textvar); @@ -408,6 +410,8 @@ static void P_NetUnArchivePlayers(void) players[i].lastmare = READUINT8(save_p); players[i].lastmarelap = READUINT8(save_p); players[i].lastmarebonuslap = READUINT8(save_p); + players[i].totalmarelap = READUINT8(save_p); + players[i].totalmarebonuslap = READUINT8(save_p); players[i].maxlink = READINT32(save_p); players[i].texttimer = READUINT8(save_p); players[i].textvar = READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index 4b10f431c..ee462193d 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2382,6 +2382,7 @@ static void P_LevelInitStuff(void) players[i].finishedtime = players[i].finishedspheres =\ players[i].finishedrings = players[i].lastmare =\ players[i].lastmarelap = players[i].lastmarebonuslap =\ + players[i].totalmarelap = players[i].totalmarebonuslap =\ players[i].marebegunat = players[i].textvar =\ players[i].texttimer = players[i].linkcount =\ players[i].linktimer = players[i].flyangle =\ From ec8d26402929b5099e2fd922a707c04d98070cf3 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sun, 12 Aug 2018 19:59:34 -0400 Subject: [PATCH 11/34] totalmarescore player variable for NiGHTS scoring # Conflicts: # src/p_setup.c --- src/d_player.h | 1 + src/lua_playerlib.c | 4 ++++ src/p_saveg.c | 2 ++ src/p_setup.c | 4 ++-- src/p_user.c | 2 ++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index e7e6e4827..fd41c7621 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -469,6 +469,7 @@ typedef struct player_s INT16 finishedrings; // The rings/stars you had left upon finishing the mare UINT32 marescore; // score for this nights stage UINT32 lastmarescore; // score for the last mare + UINT32 totalmarescore; // score for all mares UINT8 lastmare; // previous mare UINT8 lastmarelap; // previous mare lap UINT8 lastmarebonuslap; // previous mare bonus lap diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c index 67efe7710..f973061f1 100644 --- a/src/lua_playerlib.c +++ b/src/lua_playerlib.c @@ -312,6 +312,8 @@ static int player_get(lua_State *L) lua_pushinteger(L, plr->marescore); else if (fastcmp(field,"lastmarescore")) lua_pushinteger(L, plr->lastmarescore); + else if (fastcmp(field,"totalmarescore")) + lua_pushinteger(L, plr->totalmarescore); else if (fastcmp(field,"lastmare")) lua_pushinteger(L, plr->lastmare); else if (fastcmp(field,"lastmarelap")) @@ -608,6 +610,8 @@ static int player_set(lua_State *L) plr->marescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmarescore")) plr->lastmarescore = (UINT32)luaL_checkinteger(L, 3); + else if (fastcmp(field,"totalmarescore")) + plr->totalmarescore = (UINT32)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmare")) plr->lastmare = (UINT8)luaL_checkinteger(L, 3); else if (fastcmp(field,"lastmarelap")) diff --git a/src/p_saveg.c b/src/p_saveg.c index bcc582cd0..22d43f358 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -210,6 +210,7 @@ static void P_NetArchivePlayers(void) WRITEINT16(save_p, players[i].finishedrings); WRITEUINT32(save_p, players[i].marescore); WRITEUINT32(save_p, players[i].lastmarescore); + WRITEUINT32(save_p, players[i].totalmarescore); WRITEUINT8(save_p, players[i].lastmare); WRITEUINT8(save_p, players[i].lastmarelap); WRITEUINT8(save_p, players[i].lastmarebonuslap); @@ -407,6 +408,7 @@ static void P_NetUnArchivePlayers(void) players[i].finishedrings = READINT16(save_p); players[i].marescore = READUINT32(save_p); players[i].lastmarescore = READUINT32(save_p); + players[i].totalmarescore = READUINT32(save_p); players[i].lastmare = READUINT8(save_p); players[i].lastmarelap = READUINT8(save_p); players[i].lastmarebonuslap = READUINT8(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index ee462193d..368b95dd5 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2389,8 +2389,8 @@ static void P_LevelInitStuff(void) players[i].anotherflyangle = players[i].nightstime =\ players[i].mare = players[i].marelap =\ players[i].marebonuslap = players[i].lapbegunat =\ - players[i].lapstartedtime = players[i].realtime =\ - players[i].exiting = 0; + players[i].lapstartedtime = players[i].totalmarescore =\ + players[i].realtime = players[i].exiting = 0; // i guess this could be part of the above but i feel mildly uncomfortable implicitly casting players[i].gotcontinue = false; diff --git a/src/p_user.c b/src/p_user.c index 06f42dcad..9d677b4bc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -733,6 +733,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) G_AddTempNightsRecords(players[i].marescore, leveltime - player->marebegunat, players[i].mare + 1); // transfer scores anyway + players[i].totalmarescore += players[i].marescore; players[i].lastmarescore = players[i].marescore; players[i].marescore = 0; @@ -759,6 +760,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1)); // Starting a new mare, transfer scores + player->totalmarescore += players[i].marescore; player->lastmarescore = player->marescore; player->marescore = 0; player->marebegunat = leveltime; From 0c8e2ffd7872df0342f483176a0e9e70d2d18fc4 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sun, 12 Aug 2018 19:26:18 -0400 Subject: [PATCH 12/34] Totalmarescore typo --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 9d677b4bc..8177338da 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -760,7 +760,7 @@ void P_NightserizePlayer(player_t *player, INT32 nighttime) G_AddTempNightsRecords(player->marescore, leveltime - player->marebegunat, (UINT8)(oldmare + 1)); // Starting a new mare, transfer scores - player->totalmarescore += players[i].marescore; + player->totalmarescore += player->marescore; player->lastmarescore = player->marescore; player->marescore = 0; player->marebegunat = leveltime; From d8c565407c077bacc79998f390783814676a87c1 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Mon, 13 Aug 2018 14:16:33 -0400 Subject: [PATCH 13/34] MaxBonusLives level header option for # of lives in score tally --- src/dehacked.c | 2 ++ src/doomstat.h | 1 + src/lua_maplib.c | 2 ++ src/p_setup.c | 1 + src/y_inter.c | 8 ++++++-- 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index fb0f958c3..bae73f989 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -1203,6 +1203,8 @@ static void readlevelheader(MYFILE *f, INT32 num) deh_warning("Level header %d: invalid bonus type number %d", num, i); } + else if (fastcmp(word, "MAXBONUSLIVES")) + mapheaderinfo[num-1]->maxbonuslives = (SINT8)i; else if (fastcmp(word, "LEVELFLAGS")) mapheaderinfo[num-1]->levelflags = (UINT8)i; else if (fastcmp(word, "MENUFLAGS")) diff --git a/src/doomstat.h b/src/doomstat.h index 24b9e5753..651540ecc 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -244,6 +244,7 @@ typedef struct SINT8 unlockrequired; ///< Is an unlockable required to play this level? -1 if no. UINT8 levelselect; ///< Is this map available in the level select? If so, which map list is it available in? SINT8 bonustype; ///< What type of bonus does this level have? (-1 for null.) + SINT8 maxbonuslives; ///< How many bonus lives to award at Intermission? (-1 for unlimited.) UINT8 levelflags; ///< LF_flags: merged eight booleans into one UINT8 for space, see below UINT8 menuflags; ///< LF2_flags: options that affect record attack / nights mode menus diff --git a/src/lua_maplib.c b/src/lua_maplib.c index f1bfcb8f1..a8360d9dd 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1784,6 +1784,8 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->levelselect); else if (fastcmp(field,"bonustype")) lua_pushinteger(L, header->bonustype); + else if (fastcmp(field,"maxbonuslives")) + lua_pushinteger(L, header->maxbonuslives); else if (fastcmp(field,"levelflags")) lua_pushinteger(L, header->levelflags); else if (fastcmp(field,"menuflags")) diff --git a/src/p_setup.c b/src/p_setup.c index c62f281b3..17ca730e2 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -225,6 +225,7 @@ static void P_ClearSingleMapHeaderInfo(INT16 i) mapheaderinfo[num]->unlockrequired = -1; mapheaderinfo[num]->levelselect = 0; mapheaderinfo[num]->bonustype = 0; + mapheaderinfo[num]->maxbonuslives = -1; mapheaderinfo[num]->levelflags = 0; mapheaderinfo[num]->menuflags = 0; #if 1 // equivalent to "FlickyList = DEMO" diff --git a/src/y_inter.c b/src/y_inter.c index 966d84477..e1fd14a79 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1874,7 +1874,9 @@ static void Y_AwardCoopBonuses(void) players[i].score = MAXSCORE; } - ptlives = (!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0; + ptlives = min( + ((!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0), + (mapheaderinfo[prevmap]->maxbonuslives < 0 ? INT32_MAX : mapheaderinfo[prevmap]->maxbonuslives)); if (ptlives) P_GivePlayerLives(&players[i], ptlives); @@ -1918,7 +1920,9 @@ static void Y_AwardSpecialStageBonus(void) players[i].score = MAXSCORE; // grant extra lives right away since tally is faked - ptlives = (!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0; + ptlives = min( + ((!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0), + (mapheaderinfo[prevmap]->maxbonuslives < 0 ? INT32_MAX : mapheaderinfo[prevmap]->maxbonuslives)); if (ptlives) P_GivePlayerLives(&players[i], ptlives); From 1cb68a615eb294d682e808febd792400e067b863 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Tue, 14 Aug 2018 11:10:10 -0400 Subject: [PATCH 14/34] Make LE Ring triggers accept spheres for NiGHTS levels --- src/p_spec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_spec.c b/src/p_spec.c index 103312b52..1d842a0bb 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -1493,10 +1493,10 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!playeringame[i] || players[i].spectator) continue; - if (!players[i].mo || players[i].rings <= 0) + if (!players[i].mo || ((maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings) <= 0) continue; - rings += players[i].rings; + rings += (maptol & TOL_NIGHTS) ? players[i].spheres : players[i].rings; } } else @@ -1504,7 +1504,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller if (!(actor && actor->player)) return false; // no player to count rings from here, sorry - rings = actor->player->rings; + rings = (maptol & TOL_NIGHTS) ? actor->player->spheres : actor->player->rings; } if (triggerline->flags & ML_NOCLIMB) From 55d2da2201f43f1a1e64b7172d617c85dfcea6ff Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 18:42:20 -0400 Subject: [PATCH 15/34] Fix NiGHTS Bumper player positioning --- src/p_inter.c | 8 +------- src/p_user.c | 9 +++++++++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index ce8bba6b6..21f580a99 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1005,13 +1005,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) player->flyangle = special->threshold; player->speed = FixedMul(special->info->speed, special->scale); - // Potentially causes axis transfer failures. - // Also rarely worked properly anyway. - //P_UnsetThingPosition(player->mo); - //player->mo->x = special->x; - //player->mo->y = special->y; - //P_SetThingPosition(player->mo); - toucher->z = special->z+(special->height/4); + P_SetTarget(&player->mo->hnext, special); // Reference bumper for position correction on next tic } else // More like a spring { diff --git a/src/p_user.c b/src/p_user.c index fd09b0847..595e9566e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6175,6 +6175,15 @@ static void P_NiGHTSMovement(player_t *player) S_ChangeMusicInternal((((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? "_ntime" : "_drown"), false); + if (player->bumpertime == TICRATE/2) + { + // Center player to bumper here because if you try to set player's position in P_TouchSpecialThing case MT_NIGHTSBUMPER, + // that position is fudged in the time between that routine in the previous tic + // and reaching here in the current tic + P_TeleportMove(player->mo, player->mo->hnext->x, player->mo->hnext->y, player->mo->hnext->z + (player->mo->hnext->height/4)); + P_SetTarget(&player->mo->hnext, NULL); + } + if (player->mo->z < player->mo->floorz) player->mo->z = player->mo->floorz; From 67da64a06456de84e435e5bf26cbe521e09f0e59 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 18:50:28 -0400 Subject: [PATCH 16/34] Use more efficient position setting. For Z, also adjust for bumper mobj scale. --- src/p_user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index 595e9566e..551b7c5f3 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6180,7 +6180,11 @@ static void P_NiGHTSMovement(player_t *player) // Center player to bumper here because if you try to set player's position in P_TouchSpecialThing case MT_NIGHTSBUMPER, // that position is fudged in the time between that routine in the previous tic // and reaching here in the current tic - P_TeleportMove(player->mo, player->mo->hnext->x, player->mo->hnext->y, player->mo->hnext->z + (player->mo->hnext->height/4)); + P_UnsetThingPosition(player->mo); + player->mo->x = player->mo->hnext->x; + player->mo->y = player->mo->hnext->y; + player->mo->z = player->mo->hnext->z + FixedMul(player->mo->hnext->height/4, player->mo->hnext->scale); + P_SetThingPosition(player->mo); P_SetTarget(&player->mo->hnext, NULL); } From 432c1ab86284cbc86434354287aafe26bb6ae6be Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 19:09:54 -0400 Subject: [PATCH 17/34] Also center non-NiGHTS players on NiGHTS bumpers --- src/p_user.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 551b7c5f3..a647bfba0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -6174,20 +6174,6 @@ static void P_NiGHTSMovement(player_t *player) // S_StartSound(NULL, sfx_timeup); // that creepy "out of time" music from NiGHTS. Dummied out, as some on the dev team thought it wasn't Sonic-y enough (Mystic, notably). Uncomment to restore. -SH S_ChangeMusicInternal((((maptol & TOL_NIGHTS) && !G_IsSpecialStage(gamemap)) ? "_ntime" : "_drown"), false); - - if (player->bumpertime == TICRATE/2) - { - // Center player to bumper here because if you try to set player's position in P_TouchSpecialThing case MT_NIGHTSBUMPER, - // that position is fudged in the time between that routine in the previous tic - // and reaching here in the current tic - P_UnsetThingPosition(player->mo); - player->mo->x = player->mo->hnext->x; - player->mo->y = player->mo->hnext->y; - player->mo->z = player->mo->hnext->z + FixedMul(player->mo->hnext->height/4, player->mo->hnext->scale); - P_SetThingPosition(player->mo); - P_SetTarget(&player->mo->hnext, NULL); - } - if (player->mo->z < player->mo->floorz) player->mo->z = player->mo->floorz; @@ -9821,7 +9807,19 @@ void P_PlayerThink(player_t *player) P_ResetScore(player); } else + { + if (player->bumpertime == TICRATE/2 && player->mo->hnext) + { + // Center player to NiGHTS bumper here because if you try to set player's position in + // P_TouchSpecialThing case MT_NIGHTSBUMPER, that position is fudged in the time + // between that routine in the previous tic + // and reaching here in the current tic + P_TeleportMove(player->mo, player->mo->hnext->x, player->mo->hnext->y + , player->mo->hnext->z + FixedMul(player->mo->hnext->height/4, player->mo->hnext->scale)); + P_SetTarget(&player->mo->hnext, NULL); + } P_MovePlayer(player); + } if (!player->mo) return; // P_MovePlayer removed player->mo. From 08f35c0792e3081a1021a69a275c682fc4a01bfa Mon Sep 17 00:00:00 2001 From: mazmazz Date: Wed, 15 Aug 2018 23:40:42 -0400 Subject: [PATCH 18/34] Don't apply autobrake on NiGHTS bumpers --- src/p_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index a647bfba0..3a4906a67 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -9943,7 +9943,8 @@ void P_PlayerThink(player_t *player) || player->panim == PA_PAIN || !player->mo->health || player->climbing - || player->pflags & (PF_SPINNING|PF_SLIDING)) + || player->pflags & (PF_SPINNING|PF_SLIDING) + || player->bumpertime) player->pflags &= ~PF_APPLYAUTOBRAKE; else if (currentlyonground || player->powers[pw_tailsfly]) player->pflags |= PF_APPLYAUTOBRAKE; From 365a59f1863ff044b17376bf76aca6b9c1a6f482 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 11:34:57 -0400 Subject: [PATCH 19/34] Revert "SETSPHERES console command for debugging/cheating" This reverts commit 4cb7036f513ea9a0c1c743a1de69c40294597c27. --- src/d_netcmd.c | 1 - src/m_cheat.c | 17 ----------------- src/m_cheat.h | 1 - src/p_inter.c | 2 +- 4 files changed, 1 insertion(+), 20 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 0cb1d4497..c901fabd5 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -822,7 +822,6 @@ void D_RegisterClientCommands(void) COM_AddCommand("getallemeralds", Command_Getallemeralds_f); COM_AddCommand("resetemeralds", Command_Resetemeralds_f); COM_AddCommand("setrings", Command_Setrings_f); - COM_AddCommand("setspheres", Command_Setspheres_f); COM_AddCommand("setlives", Command_Setlives_f); COM_AddCommand("setcontinues", Command_Setcontinues_f); COM_AddCommand("devmode", Command_Devmode_f); diff --git a/src/m_cheat.c b/src/m_cheat.c index b572b84eb..5ac742270 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -890,23 +890,6 @@ void Command_Setrings_f(void) } } -void Command_Setspheres_f(void) -{ - REQUIRE_INLEVEL; - REQUIRE_SINGLEPLAYER; - REQUIRE_NOULTIMATE; - REQUIRE_PANDORA; - - if (COM_Argc() > 1) - { - // P_GivePlayerRings does value clamping - players[consoleplayer].spheres = 0; - P_GivePlayerSpheres(&players[consoleplayer], atoi(COM_Argv(1))); - - G_SetGameModified(multiplayer); - } -} - void Command_Setlives_f(void) { REQUIRE_INLEVEL; diff --git a/src/m_cheat.h b/src/m_cheat.h index 31f650b3f..951c7a16a 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -51,7 +51,6 @@ void Command_Savecheckpoint_f(void); void Command_Getallemeralds_f(void); void Command_Resetemeralds_f(void); void Command_Setrings_f(void); -void Command_Setspheres_f(void); void Command_Setlives_f(void); void Command_Setcontinues_f(void); void Command_Devmode_f(void); diff --git a/src/p_inter.c b/src/p_inter.c index ce8bba6b6..e740b62d1 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3409,7 +3409,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) return; // If no health, don't spawn ring! - if (((maptol & TOL_NIGHTS) && player->spheres <= 0) || (!(maptol & TOL_NIGHTS) && player->rings <= 0)) + if (player->rings <= 0) num_rings = 0; if (num_rings > 32 && player->powers[pw_carry] != CR_NIGHTSFALL) From 03c4a626c314f3bc17c4ab74dcec09955c0e4efe Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 11:35:35 -0400 Subject: [PATCH 20/34] Line from revert --- src/p_inter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_inter.c b/src/p_inter.c index e740b62d1..ce8bba6b6 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3409,7 +3409,7 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) return; // If no health, don't spawn ring! - if (player->rings <= 0) + if (((maptol & TOL_NIGHTS) && player->spheres <= 0) || (!(maptol & TOL_NIGHTS) && player->rings <= 0)) num_rings = 0; if (num_rings > 32 && player->powers[pw_carry] != CR_NIGHTSFALL) From 7474e073f85a1c96b1e2fea06ca1aa23791c4c88 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 12:13:57 -0400 Subject: [PATCH 21/34] Change SETRINGS to support player->spheres in NiGHTS --- src/m_cheat.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 5ac742270..6e346de91 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -880,11 +880,20 @@ void Command_Setrings_f(void) if (COM_Argc() > 1) { - // P_GivePlayerRings does value clamping - players[consoleplayer].rings = 0; - P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); - if (!G_IsSpecialStage(gamemap) || !(maptol & TOL_NIGHTS)) - players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings + if (!(maptol & TOL_NIGHTS)) + { + // P_GivePlayerRings does value clamping + players[consoleplayer].rings = 0; + P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); + if (!G_IsSpecialStage(gamemap)) + players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings + } + else + { + players[consoleplayer].spheres = 0; + P_GivePlayerSpheres(&player[consoleplayer], atoi(COM_Argv(1))); + // no totalsphere addition to revert + } G_SetGameModified(multiplayer); } From 6a0175147f904abfd67ab85081895ee3f802994b Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 12:14:41 -0400 Subject: [PATCH 22/34] Checkpoint (unfinished): player->totalsphere --- src/g_game.c | 3 +++ src/m_cheat.c | 3 ++- src/p_user.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/g_game.c b/src/g_game.c index 52358a8b9..1c7abb00e 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2075,6 +2075,7 @@ void G_PlayerReborn(INT32 player) INT32 exiting; INT16 numboxes; INT16 totalring; + INT16 totalsphere; UINT8 laps; UINT8 mare; UINT8 skincolor; @@ -2103,6 +2104,7 @@ void G_PlayerReborn(INT32 player) numboxes = players[player].numboxes; laps = players[player].laps; totalring = players[player].totalring; + totalsphere = players[player].totalsphere; skincolor = players[player].skincolor; skin = players[player].skin; @@ -2187,6 +2189,7 @@ void G_PlayerReborn(INT32 player) p->numboxes = numboxes; p->laps = laps; p->totalring = totalring; + p->totalsphere = totalsphere; p->mare = mare; if (bot) diff --git a/src/m_cheat.c b/src/m_cheat.c index 6e346de91..37a55ab99 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -892,7 +892,8 @@ void Command_Setrings_f(void) { players[consoleplayer].spheres = 0; P_GivePlayerSpheres(&player[consoleplayer], atoi(COM_Argv(1))); - // no totalsphere addition to revert + if (!G_IsSpecialStage(gamemap)) + players[consoleplayer].totalsphere -= atoi(COM_Argv(1)); //undo totalsphere addition done in P_GivePlayerRings } G_SetGameModified(multiplayer); diff --git a/src/p_user.c b/src/p_user.c index fd09b0847..e7a53d0be 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -963,6 +963,8 @@ void P_GivePlayerSpheres(player_t *player, INT32 num_spheres) player->spheres += num_spheres; + player->totalsphere += num_spheres; + // Can only get up to 9999 spheres, sorry! if (player->spheres > 9999) player->spheres = 9999; From 18b6b53722bd256c5c8f6706f4f53e73b0ef99d3 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 16:49:15 -0400 Subject: [PATCH 23/34] Adjust vertical angle and forwards/backwards of NiGHTS bumper in objectplace --- src/m_cheat.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/m_cheat.c b/src/m_cheat.c index b572b84eb..aed3a3e92 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1194,11 +1194,47 @@ void OP_NightsObjectplace(player_t *player) // This places a bumper! if (cmd->buttons & BT_TOSSFLAG) { + UINT16 vertangle = (UINT16)(player->anotherflyangle % 360); + UINT16 newflags, newz; + player->pflags |= PF_ATTACKDOWN; if (!OP_HeightOkay(player, false)) return; mt = OP_CreateNewMapThing(player, (UINT16)mobjinfo[MT_NIGHTSBUMPER].doomednum, false); + newz = min((mt->options >> ZSHIFT) - (mobjinfo[MT_NIGHTSBUMPER].height/4), 0); + // height offset: from P_TouchSpecialThing case MT_NIGHTSBUMPER + + // clockwise + if (vertangle >= 75 && vertangle < 105) // up + newflags = 3; + else if (vertangle >= 105 && vertangle < 135) // 60 upward tilt + newflags = 2; + else if (vertangle >= 135 && vertangle < 165) // 30 upward tilt + newflags = 1; + //else if (vertangle >= 165 && vertangle < 195) // forward, see else case + // newflags = 0; + else if (vertangle >= 195 && vertangle < 225) // 30 downward tilt + newflags = 11; + else if (vertangle >= 225 && vertangle < 255) // 60 downward tilt + newflags = 10; + else if (vertangle >= 255 && vertangle < 285) // down + newflags = 9; + else if (vertangle >= 285 && vertangle < 315) // 60 downward tilt backwards + newflags = 8; + else if (vertangle >= 315 && vertangle < 345) // 30 downward tilt backwards + newflags = 7; + else if (vertangle >= 345 || vertangle < 15) // backwards + newflags = 6; + else if (vertangle >= 15 && vertangle < 45) // 30 upward tilt backwards + newflags = 5; + else if (vertangle >= 45 && vertangle < 75) // 60 upward tilt backwards + newflags = 4; + else // forward + newflags = 0; + + mt->options = (newz << ZSHIFT) | newflags; + P_SpawnMapThing(mt); } From e8c221f69182d818d8ebd582b0b160be62692b3f Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 21:21:43 -0400 Subject: [PATCH 24/34] Place backwards Bumpers with the correct Thing angle --- src/m_cheat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/m_cheat.c b/src/m_cheat.c index aed3a3e92..53998c522 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -1235,6 +1235,11 @@ void OP_NightsObjectplace(player_t *player) mt->options = (newz << ZSHIFT) | newflags; + // if NiGHTS is facing backwards, orient the Thing angle forwards so that the sprite angle + // displays correctly. Backwards movement via the Thing flags is unaffected. + if (vertangle < 90 || vertangle > 270) + mt->angle = (mt->angle + 180) % 360; + P_SpawnMapThing(mt); } From 792360ea97a5ba948d81c798d95693029a99b062 Mon Sep 17 00:00:00 2001 From: Digiku Date: Fri, 17 Aug 2018 09:09:10 -0400 Subject: [PATCH 25/34] Revert "Checkpoint (unfinished): player->totalsphere" This reverts commit 6a0175147f904abfd67ab85081895ee3f802994b --- src/g_game.c | 3 --- src/m_cheat.c | 3 +-- src/p_user.c | 2 -- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index 1c7abb00e..52358a8b9 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -2075,7 +2075,6 @@ void G_PlayerReborn(INT32 player) INT32 exiting; INT16 numboxes; INT16 totalring; - INT16 totalsphere; UINT8 laps; UINT8 mare; UINT8 skincolor; @@ -2104,7 +2103,6 @@ void G_PlayerReborn(INT32 player) numboxes = players[player].numboxes; laps = players[player].laps; totalring = players[player].totalring; - totalsphere = players[player].totalsphere; skincolor = players[player].skincolor; skin = players[player].skin; @@ -2189,7 +2187,6 @@ void G_PlayerReborn(INT32 player) p->numboxes = numboxes; p->laps = laps; p->totalring = totalring; - p->totalsphere = totalsphere; p->mare = mare; if (bot) diff --git a/src/m_cheat.c b/src/m_cheat.c index 37a55ab99..6e346de91 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -892,8 +892,7 @@ void Command_Setrings_f(void) { players[consoleplayer].spheres = 0; P_GivePlayerSpheres(&player[consoleplayer], atoi(COM_Argv(1))); - if (!G_IsSpecialStage(gamemap)) - players[consoleplayer].totalsphere -= atoi(COM_Argv(1)); //undo totalsphere addition done in P_GivePlayerRings + // no totalsphere addition to revert } G_SetGameModified(multiplayer); diff --git a/src/p_user.c b/src/p_user.c index e7a53d0be..fd09b0847 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -963,8 +963,6 @@ void P_GivePlayerSpheres(player_t *player, INT32 num_spheres) player->spheres += num_spheres; - player->totalsphere += num_spheres; - // Can only get up to 9999 spheres, sorry! if (player->spheres > 9999) player->spheres = 9999; From e943259057cd08970b7d5d9056fb6669393d9574 Mon Sep 17 00:00:00 2001 From: Digiku Date: Fri, 17 Aug 2018 09:11:59 -0400 Subject: [PATCH 26/34] Remove unnecessary totalring deduction condition Because it would be triggered by !(maptol & TOL_NIGHTS) in the old code anyway --- src/m_cheat.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 6e346de91..8372683aa 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -885,8 +885,7 @@ void Command_Setrings_f(void) // P_GivePlayerRings does value clamping players[consoleplayer].rings = 0; P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1))); - if (!G_IsSpecialStage(gamemap)) - players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings + players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings } else { From aa863e481e7dd2baff6938316fdf3ac13d7ff2a9 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 20:09:39 +0100 Subject: [PATCH 27/34] Add INFLIVES macro, to make it easier to find infinite lives-related code --- src/d_player.h | 5 ++++- src/hu_stuff.c | 4 ++-- src/m_cheat.c | 2 +- src/m_menu.c | 6 +++--- src/p_inter.c | 2 +- src/p_user.c | 8 ++++---- src/st_stuff.c | 10 +++++----- src/y_inter.c | 4 ++-- 8 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index 7bee5f337..59f9ba42a 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -382,7 +382,7 @@ typedef struct player_s fixed_t height; // Bounding box changes. fixed_t spinheight; - SINT8 lives; + SINT8 lives; // number of lives - if == INFLIVES, the player has infinite lives SINT8 continues; // continues that player has acquired SINT8 xtralife; // Ring Extra Life counter @@ -491,4 +491,7 @@ typedef struct player_s #endif } player_t; +// Value for infinite lives +#define INFLIVES 0x7F + #endif diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 28438599c..6697eb09b 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -1275,7 +1275,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I } } - if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != 0x7f)) //show lives + if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE|(greycheck ? V_60TRANS : 0), va("%dx", players[tab[i].num].lives)); else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT) { @@ -1413,7 +1413,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline | (greycheck ? V_TRANSLUCENT : 0) | V_ALLOWLOWERCASE, name); - if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != 0x7f)) //show lives + if (G_GametypeUsesLives() && !(gametype == GT_COOP && (cv_cooplives.value == 0 || cv_cooplives.value == 3)) && (players[tab[i].num].lives != INFLIVES)) //show lives V_DrawRightAlignedString(x, y+4, V_ALLOWLOWERCASE, va("%dx", players[tab[i].num].lives)); else if (G_TagGametype() && players[tab[i].num].pflags & PF_TAGIT) V_DrawSmallScaledPatch(x-28, y-4, 0, tagico); diff --git a/src/m_cheat.c b/src/m_cheat.c index b572b84eb..56bef02a3 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -918,7 +918,7 @@ void Command_Setlives_f(void) { SINT8 lives = atoi(COM_Argv(1)); if (lives == -1) - players[consoleplayer].lives = 0x7f; // infinity! + players[consoleplayer].lives = INFLIVES; // infinity! else { // P_GivePlayerLives does value clamping diff --git a/src/m_menu.c b/src/m_menu.c index f99f5d860..778f24ad9 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5277,7 +5277,7 @@ static void M_PandorasBox(INT32 choice) CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].spheres, 0)); else CV_StealthSetValue(&cv_dummyrings, max(players[consoleplayer].rings, 0)); - if (players[consoleplayer].lives == 0x7f) + if (players[consoleplayer].lives == INFLIVES) CV_StealthSetValue(&cv_dummylives, -1); else CV_StealthSetValue(&cv_dummylives, players[consoleplayer].lives); @@ -6334,7 +6334,7 @@ skipsign: y += 25; tempx = x + 10; - if (savegameinfo[savetodraw].lives != 0x7f + if (savegameinfo[savetodraw].lives != INFLIVES && savegameinfo[savetodraw].lives > 9) tempx -= 4; @@ -6361,7 +6361,7 @@ skiplife: V_DrawScaledPatch(tempx + 9, y + 2, 0, patch); tempx += 16; - if (savegameinfo[savetodraw].lives == 0x7f) + if (savegameinfo[savetodraw].lives == INFLIVES) V_DrawCharacter(tempx, y + 1, '\x16', false); else V_DrawString(tempx, y, 0, va("%d", savegameinfo[savetodraw].lives)); diff --git a/src/p_inter.c b/src/p_inter.c index ce8bba6b6..a4493c466 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2253,7 +2253,7 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget if ((target->player->lives <= 1) && (netgame || multiplayer) && (gametype == GT_COOP) && (cv_cooplives.value == 0)) ; - else if (!target->player->bot && !target->player->spectator && !G_IsSpecialStage(gamemap) && (target->player->lives != 0x7f) + else if (!target->player->bot && !target->player->spectator && !G_IsSpecialStage(gamemap) && (target->player->lives != INFLIVES) && G_GametypeUsesLives()) { target->player->lives -= 1; // Lose a life Tails 03-11-2000 diff --git a/src/p_user.c b/src/p_user.c index fd09b0847..100663d91 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -927,7 +927,7 @@ void P_GivePlayerRings(player_t *player, INT32 num_rings) player->rings = 0; // Now extra life bonuses are handled here instead of in P_MovePlayer, since why not? - if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives() && player->lives != 0x7f) + if (!ultimatemode && !modeattacking && !G_IsSpecialStage(gamemap) && G_GametypeUsesLives() && player->lives != INFLIVES) { INT32 gainlives = 0; @@ -986,7 +986,7 @@ void P_GivePlayerLives(player_t *player, INT32 numlives) if (gamestate == GS_LEVEL) { - if (player->lives == 0x7f || (gametype != GT_COOP && gametype != GT_COMPETITION)) + if (player->lives == INFLIVES || (gametype != GT_COOP && gametype != GT_COMPETITION)) { P_GivePlayerRings(player, 100*numlives); return; @@ -8377,7 +8377,7 @@ boolean P_GetLives(player_t *player) if (!(netgame || multiplayer) || (gametype != GT_COOP) || (cv_cooplives.value == 1) - || (player->lives == 0x7f)) + || (player->lives == INFLIVES)) return true; if ((cv_cooplives.value == 2 || cv_cooplives.value == 0) && player->lives > 0) @@ -8404,7 +8404,7 @@ boolean P_GetLives(player_t *player) { if (cv_cooplives.value == 2 && (P_IsLocalPlayer(player) || P_IsLocalPlayer(&players[maxlivesplayer]))) S_StartSound(NULL, sfx_jshard); // placeholder - if (players[maxlivesplayer].lives != 0x7f) + if (players[maxlivesplayer].lives != INFLIVES) players[maxlivesplayer].lives--; player->lives++; if (player->lives < 1) diff --git a/src/st_stuff.c b/src/st_stuff.c index 0079b8da9..5fbd2eafc 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -807,7 +807,7 @@ static void ST_drawLivesArea(void) // lives number if (gametype == GT_RACE) { - livescount = 0x7f; + livescount = INFLIVES; notgreyedout = true; } else if ((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 3) @@ -826,9 +826,9 @@ static void ST_drawLivesArea(void) if (players[i].lives > 1) notgreyedout = true; - if (players[i].lives == 0x7f) + if (players[i].lives == INFLIVES) { - livescount = 0x7f; + livescount = INFLIVES; break; } else if (livescount < 99) @@ -837,11 +837,11 @@ static void ST_drawLivesArea(void) } else { - livescount = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? 0x7f : stplyr->lives); + livescount = (((netgame || multiplayer) && gametype == GT_COOP && cv_cooplives.value == 0) ? INFLIVES : stplyr->lives); notgreyedout = true; } - if (livescount == 0x7f) + if (livescount == INFLIVES) V_DrawCharacter(hudinfo[HUD_LIVES].x+50, hudinfo[HUD_LIVES].y+8, '\x16' | 0x80 | hudinfo[HUD_LIVES].f|V_PERPLAYER|V_HUDTRANS, false); else diff --git a/src/y_inter.c b/src/y_inter.c index 966d84477..fff6d2ebf 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -1874,7 +1874,7 @@ static void Y_AwardCoopBonuses(void) players[i].score = MAXSCORE; } - ptlives = (!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0; + ptlives = (!ultimatemode && !modeattacking && players[i].lives != INFLIVES) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0; if (ptlives) P_GivePlayerLives(&players[i], ptlives); @@ -1918,7 +1918,7 @@ static void Y_AwardSpecialStageBonus(void) players[i].score = MAXSCORE; // grant extra lives right away since tally is faked - ptlives = (!ultimatemode && !modeattacking && players[i].lives != 0x7f) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0; + ptlives = (!ultimatemode && !modeattacking && players[i].lives != INFLIVES) ? max((players[i].score/50000) - (oldscore/50000), 0) : 0; if (ptlives) P_GivePlayerLives(&players[i], ptlives); From d2a4408610a8246662da2fdad207280eceb34f9d Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 20:27:40 +0100 Subject: [PATCH 28/34] Make switch case for stplyr->textvar in ST_drawNightsRecords --- src/st_stuff.c | 100 +++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 5fbd2eafc..9483cf449 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1361,60 +1361,64 @@ static void ST_drawNightsRecords(void) if (stplyr->texttimer < TICRATE/2) aflag |= (9 - 9*stplyr->texttimer/(TICRATE/2)) << V_ALPHASHIFT; - // A "Bonus Time Start" by any other name... - if (stplyr->textvar == 1) + switch (stplyr->textvar) { - V_DrawCenteredString(BASEVIDWIDTH/2, 52, V_GREENMAP|aflag, M_GetText("GET TO THE GOAL!")); - V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag, M_GetText("SCORE MULTIPLIER START!")); - - if (stplyr->finishedtime) + case 1: // A "Bonus Time Start" by any other name... { - V_DrawString(BASEVIDWIDTH/2 - 48, 140, aflag, "TIME:"); - V_DrawString(BASEVIDWIDTH/2 - 48, 148, aflag, "BONUS:"); - V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, V_ORANGEMAP|aflag, va("%d", (stplyr->startedtime - stplyr->finishedtime)/TICRATE)); - V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, V_ORANGEMAP|aflag, va("%d", (stplyr->finishedtime/TICRATE) * 100)); + V_DrawCenteredString(BASEVIDWIDTH/2, 52, V_GREENMAP|aflag, M_GetText("GET TO THE GOAL!")); + V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag, M_GetText("SCORE MULTIPLIER START!")); + + if (stplyr->finishedtime) + { + V_DrawString(BASEVIDWIDTH/2 - 48, 140, aflag, "TIME:"); + V_DrawString(BASEVIDWIDTH/2 - 48, 148, aflag, "BONUS:"); + V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 140, V_ORANGEMAP|aflag, va("%d", (stplyr->startedtime - stplyr->finishedtime)/TICRATE)); + V_DrawRightAlignedString(BASEVIDWIDTH/2 + 48, 148, V_ORANGEMAP|aflag, va("%d", (stplyr->finishedtime/TICRATE) * 100)); + } + break; } - } - - // Get n [more] Spheres - else if (stplyr->textvar <= 3 && stplyr->textvar >= 2) - { - if (!stplyr->capsule) - return; - - // Yes, this string is an abomination. - V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag, - va(M_GetText("\x80GET\x82 %d\x80 %s%s%s!"), stplyr->capsule->health, - (stplyr->textvar == 3) ? M_GetText("MORE ") : "", - (G_IsSpecialStage(gamemap)) ? "SPHERE" : "CHIP", - (stplyr->capsule->health > 1) ? "S" : "")); - } - - // End Bonus - else if (stplyr->textvar == 4) - { - V_DrawString(BASEVIDWIDTH/2 - 56, 140, aflag, (G_IsSpecialStage(gamemap)) ? "SPHERES:" : "CHIPS:"); - V_DrawString(BASEVIDWIDTH/2 - 56, 148, aflag, "BONUS:"); - V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 140, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres)); - V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 148, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres * 50)); - ST_DrawNightsOverlayNum((BASEVIDWIDTH/2 + 56)<lastmarescore, nightsnum, SKINCOLOR_AZURE); - - // If new record, say so! - if (!(netgame || multiplayer) && G_GetBestNightsScore(gamemap, stplyr->lastmare + 1) <= stplyr->lastmarescore) + case 2: // Get n Spheres + case 3: // Get n more Spheres { - if (stplyr->texttimer & 16) - V_DrawCenteredString(BASEVIDWIDTH/2, 184, V_YELLOWMAP|aflag, "* NEW RECORD *"); - } + if (!stplyr->capsule) + return; - if (P_HasGrades(gamemap, stplyr->lastmare + 1)) - { - if (aflag) - V_DrawTranslucentPatch(BASEVIDWIDTH/2 + 60, 160, aflag, - ngradeletters[P_GetGrade(stplyr->lastmarescore, gamemap, stplyr->lastmare)]); - else - V_DrawScaledPatch(BASEVIDWIDTH/2 + 60, 160, 0, - ngradeletters[P_GetGrade(stplyr->lastmarescore, gamemap, stplyr->lastmare)]); + // Yes, this string is an abomination. + V_DrawCenteredString(BASEVIDWIDTH/2, 60, aflag, + va(M_GetText("\x80GET\x82 %d\x80 %s%s%s!"), stplyr->capsule->health, + (stplyr->textvar == 3) ? M_GetText("MORE ") : "", + (G_IsSpecialStage(gamemap)) ? "SPHERE" : "CHIP", + (stplyr->capsule->health > 1) ? "S" : "")); + break; } + case 4: // End Bonus + { + V_DrawString(BASEVIDWIDTH/2 - 56, 140, aflag, (G_IsSpecialStage(gamemap)) ? "SPHERES:" : "CHIPS:"); + V_DrawString(BASEVIDWIDTH/2 - 56, 148, aflag, "BONUS:"); + V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 140, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres)); + V_DrawRightAlignedString(BASEVIDWIDTH/2 + 56, 148, V_ORANGEMAP|aflag, va("%d", stplyr->finishedspheres * 50)); + ST_DrawNightsOverlayNum((BASEVIDWIDTH/2 + 56)<lastmarescore, nightsnum, SKINCOLOR_AZURE); + + // If new record, say so! + if (!(netgame || multiplayer) && G_GetBestNightsScore(gamemap, stplyr->lastmare + 1) <= stplyr->lastmarescore) + { + if (stplyr->texttimer & 16) + V_DrawCenteredString(BASEVIDWIDTH/2, 184, V_YELLOWMAP|aflag, "* NEW RECORD *"); + } + + if (P_HasGrades(gamemap, stplyr->lastmare + 1)) + { + if (aflag) + V_DrawTranslucentPatch(BASEVIDWIDTH/2 + 60, 160, aflag, + ngradeletters[P_GetGrade(stplyr->lastmarescore, gamemap, stplyr->lastmare)]); + else + V_DrawScaledPatch(BASEVIDWIDTH/2 + 60, 160, 0, + ngradeletters[P_GetGrade(stplyr->lastmarescore, gamemap, stplyr->lastmare)]); + } + break; + } + default: + break; } } From 0948b12eae9f7f42060b99ca70da3865dbb54a61 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 21:13:45 +0100 Subject: [PATCH 29/34] ST_drawNiGHTSHUD tweaks: Split NiGHTS link drawing into its own function, remove "minlink" hack and just do things properly --- src/st_stuff.c | 108 ++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 9483cf449..bd0f4e1e7 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1454,20 +1454,60 @@ static skincolors_t linkColor[2][NUMLINKCOLORS] = { {SKINCOLOR_SEAFOAM, SKINCOLOR_CYAN, SKINCOLOR_WAVE, SKINCOLOR_SAPPHIRE, SKINCOLOR_VAPOR, SKINCOLOR_BUBBLEGUM, SKINCOLOR_VIOLET, SKINCOLOR_RUBY, SKINCOLOR_FLAME, SKINCOLOR_SUNSET, SKINCOLOR_SANDY, SKINCOLOR_LIME}}; +static void ST_drawNiGHTSLink(void) +{ + static INT32 prevsel[2] = {0, 0}, prevtime[2] = {0, 0}; + const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0); + INT32 sel = ((stplyr->linkcount-1) / 5) % NUMLINKCOLORS, aflag = V_PERPLAYER, mag = ((stplyr->linkcount-1 >= 300) ? 1 : 0); + skincolors_t colornum; + fixed_t x, y, scale; + + if (sel != prevsel[q]) + { + prevsel[q] = sel; + prevtime[q] = 2 + mag; + } + + if (stplyr->powers[pw_nights_linkfreeze] && (!(stplyr->powers[pw_nights_linkfreeze] & 2) || (stplyr->powers[pw_nights_linkfreeze] > flashingtics))) + colornum = SKINCOLOR_ICY; + else + colornum = linkColor[mag][sel]; + + aflag |= ((stplyr->linktimer < 2*TICRATE/3) + ? (9 - 9*stplyr->linktimer/(2*TICRATE/3)) << V_ALPHASHIFT + : 0); + + y = (160+11)<linkcount-1), nightsnum, colornum); + V_DrawFixedPatch(x+(4*scale), y, scale, aflag, nightslink, + colornum == 0 ? colormaps : R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE)); + + // Show remaining link time left in debug + if (cv_debug & DBG_NIGHTSBASIC) + V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_SNAPTOBOTTOM, va("End in %d.%02d", stplyr->linktimer/TICRATE, G_TicsToCentiseconds(stplyr->linktimer))); +} + + static void ST_drawNiGHTSHUD(void) { INT32 origamount; - INT32 minlink = 1; INT32 total_spherecount; const boolean oldspecialstage = (G_IsSpecialStage(gamemap) && !(maptol & TOL_NIGHTS)); - // Cheap hack: don't display when the score is showing (it popping up for a split second when exiting a map is intentional) - if (oldspecialstage || (stplyr->texttimer && stplyr->textvar == 4)) - minlink = INT32_MAX; - // When debugging, show "0 Link". - else if (cv_debug & DBG_NIGHTSBASIC) - minlink = 0; - // Drill meter if ( #ifdef HAVE_BLUA @@ -1512,55 +1552,15 @@ static void ST_drawNiGHTSHUD(void) }*/ // Link drawing - if ( + if (!oldspecialstage + // Don't display when the score is showing (it popping up for a split second when exiting a map is intentional) + && !(stplyr->texttimer && stplyr->textvar == 4) #ifdef HAVE_BLUA - LUA_HudEnabled(hud_nightslink) && + && LUA_HudEnabled(hud_nightslink) #endif - stplyr->linkcount > minlink) + && ((cv_debug & DBG_NIGHTSBASIC) || stplyr->linkcount > 1)) // When debugging, show "0 Link". { - static INT32 prevsel[2] = {0, 0}, prevtime[2] = {0, 0}; - const UINT8 q = ((splitscreen && stplyr == &players[secondarydisplayplayer]) ? 1 : 0); - INT32 sel = ((stplyr->linkcount-1) / 5) % NUMLINKCOLORS, aflag = V_PERPLAYER, mag = ((stplyr->linkcount-1 >= 300) ? 1 : 0); - skincolors_t colornum; - fixed_t x, y, scale; - - if (sel != prevsel[q]) - { - prevsel[q] = sel; - prevtime[q] = 2 + mag; - } - - if (stplyr->powers[pw_nights_linkfreeze] && (!(stplyr->powers[pw_nights_linkfreeze] & 2) || (stplyr->powers[pw_nights_linkfreeze] > flashingtics))) - colornum = SKINCOLOR_ICY; - else - colornum = linkColor[mag][sel]; - - aflag |= ((stplyr->linktimer < 2*TICRATE/3) - ? (9 - 9*stplyr->linktimer/(2*TICRATE/3)) << V_ALPHASHIFT - : 0); - - y = (160+11)<linkcount-1), nightsnum, colornum); - V_DrawFixedPatch(x+(4*scale), y, scale, aflag, nightslink, - colornum == 0 ? colormaps : R_GetTranslationColormap(TC_DEFAULT, colornum, GTC_CACHE)); - - // Show remaining link time left in debug - if (cv_debug & DBG_NIGHTSBASIC) - V_DrawCenteredString(BASEVIDWIDTH/2, 180, V_SNAPTOBOTTOM, va("End in %d.%02d", stplyr->linktimer/TICRATE, G_TicsToCentiseconds(stplyr->linktimer))); + ST_drawNiGHTSLink(); } if (gametype == GT_RACE || gametype == GT_COMPETITION) From 6a88a65b94f4dbe5c5afd346ffbdc2e2a418f798 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 22:00:37 +0100 Subject: [PATCH 30/34] Add quick macro for drawing the 1st person timer icons with timer string, add comments to ST_drawPowerupHUD --- src/st_stuff.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index bd0f4e1e7..d86e53f8c 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1205,6 +1205,10 @@ static void ST_drawPowerupHUD(void) if (stplyr->spectator || stplyr->playerstate != PST_LIVE) return; +// ------- +// Shields +// ------- + // Graue 06-18-2004: no V_NOSCALESTART, no SCX, no SCY, snap to right if (stplyr->powers[pw_shield] & SH_NOSTACK) { @@ -1247,6 +1251,10 @@ static void ST_drawPowerupHUD(void) offs -= shieldoffs[q]; +// --------- +// CTF flags +// --------- + // YOU have a flag. Display a monitor-like icon for it. if (stplyr->gotflag) { @@ -1264,11 +1272,20 @@ static void ST_drawPowerupHUD(void) offs -= flagoffs[q]; +// -------------------- +// Timer-based powerups +// -------------------- + +#define DRAWTIMERICON(patch, timer) \ + V_DrawSmallScaledPatch(offs, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, patch); \ + V_DrawRightAlignedThinString(offs + 16, hudinfo[HUD_POWERUPS].y + 8, V_PERPLAYER|hudinfo[HUD_POWERUPS].f, va("%d", timer/TICRATE)); + + // Invincibility, both from monitor and after being hit invulntime = stplyr->powers[pw_flashing] ? stplyr->powers[pw_flashing] : stplyr->powers[pw_invulnerability]; + // Note: pw_flashing always makes the icon flicker regardless of time, unlike pw_invulnerability if (stplyr->powers[pw_invulnerability] > 3*TICRATE || (invulntime && leveltime & 1)) { - V_DrawSmallScaledPatch(offs, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, invincibility); - V_DrawRightAlignedThinString(offs + 16, hudinfo[HUD_POWERUPS].y + 8, V_PERPLAYER|hudinfo[HUD_POWERUPS].f, va("%d", invulntime/TICRATE)); + DRAWTIMERICON(invincibility, invulntime) } if (invulntime > 7) @@ -1281,10 +1298,10 @@ static void ST_drawPowerupHUD(void) offs -= a; } + // Super Sneakers if (stplyr->powers[pw_sneakers] > 3*TICRATE || (stplyr->powers[pw_sneakers] && leveltime & 1)) { - V_DrawSmallScaledPatch(offs, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, sneakers); - V_DrawRightAlignedThinString(offs + 16, hudinfo[HUD_POWERUPS].y + 8, V_PERPLAYER|hudinfo[HUD_POWERUPS].f, va("%d", stplyr->powers[pw_sneakers]/TICRATE)); + DRAWTIMERICON(sneakers, stplyr->powers[pw_sneakers]) } if (stplyr->powers[pw_sneakers] > 7) @@ -1297,12 +1314,13 @@ static void ST_drawPowerupHUD(void) offs -= a; } + // Gravity Boots if (stplyr->powers[pw_gravityboots] > 3*TICRATE || (stplyr->powers[pw_gravityboots] && leveltime & 1)) { - V_DrawSmallScaledPatch(offs, hudinfo[HUD_POWERUPS].y, V_PERPLAYER|hudinfo[HUD_POWERUPS].f|V_HUDTRANS, gravboots); - V_DrawRightAlignedThinString(offs + 16, hudinfo[HUD_POWERUPS].y + 8, V_PERPLAYER|hudinfo[HUD_POWERUPS].f, va("%d", stplyr->powers[pw_gravityboots]/TICRATE)); + DRAWTIMERICON(gravboots, stplyr->powers[pw_gravityboots]) } +#undef DRAWTIMERICON #undef ICONSEP } From e2c280504bfb811beaf595c8238fe1823b13109c Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 22:09:48 +0100 Subject: [PATCH 31/34] Make switch case for cv_seenames.value in ST_Drawer --- src/st_stuff.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index d86e53f8c..507cb5903 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2470,15 +2470,22 @@ void ST_Drawer(void) #ifdef SEENAMES if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo) { - if (cv_seenames.value == 1) - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); - else if (cv_seenames.value == 2) - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, - va("%s%s", G_GametypeHasTeams() ? ((seenplayer->ctfteam == 1) ? "\x85" : "\x84") : "", player_names[seenplayer-players])); - else //if (cv_seenames.value == 3) - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, - va("%s%s", !G_RingSlingerGametype() || (G_GametypeHasTeams() && players[consoleplayer].ctfteam == seenplayer->ctfteam) - ? "\x83" : "\x85", player_names[seenplayer-players])); + switch (cv_seenames.value) + { + case 1: // Colorless + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); + break; + case 2: // Team + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, + va("%s%s", G_GametypeHasTeams() ? ((seenplayer->ctfteam == 1) ? "\x85" : "\x84") : "", player_names[seenplayer-players])); + break; + case 3: // Ally/Foe + default: + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, + va("%s%s", !G_RingSlingerGametype() || (G_GametypeHasTeams() && players[consoleplayer].ctfteam == seenplayer->ctfteam) + ? "\x83" : "\x85", player_names[seenplayer-players])); + break; + } } #endif From 011459790f9f3421b80a4f78f5c92baaddafa7ae Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 22:18:52 +0100 Subject: [PATCH 32/34] Add INFLIVES as a constant that Lua/SOC can use --- src/dehacked.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 76a65fcc2..127b367c8 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7610,6 +7610,9 @@ struct { {"WEP_RAIL",WEP_RAIL}, {"NUM_WEAPONS",NUM_WEAPONS}, + // Value for infinite lives + {"INFLIVES", INFLIVES}, + // Got Flags, for player->gotflag! // Used to be MF_ for some stupid reason, now they're GF_ to stop them looking like mobjflags {"GF_REDFLAG",GF_REDFLAG}, From aee7dce891e251d2da42ce48ecef2c91d36db225 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 23 Aug 2018 23:00:15 +0100 Subject: [PATCH 33/34] Rewrite seenames HUD code even more; use text color flags rather than the special text color chars --- src/st_stuff.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 507cb5903..c4bec135f 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -2470,22 +2470,26 @@ void ST_Drawer(void) #ifdef SEENAMES if (cv_seenames.value && cv_allowseenames.value && displayplayer == consoleplayer && seenplayer && seenplayer->mo) { + INT32 c = 0; switch (cv_seenames.value) { case 1: // Colorless - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, player_names[seenplayer-players]); break; case 2: // Team - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, - va("%s%s", G_GametypeHasTeams() ? ((seenplayer->ctfteam == 1) ? "\x85" : "\x84") : "", player_names[seenplayer-players])); + if (G_GametypeHasTeams()) + c = (seenplayer->ctfteam == 1) ? V_REDMAP : V_BLUEMAP; break; case 3: // Ally/Foe default: - V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF, - va("%s%s", !G_RingSlingerGametype() || (G_GametypeHasTeams() && players[consoleplayer].ctfteam == seenplayer->ctfteam) - ? "\x83" : "\x85", player_names[seenplayer-players])); + // Green = Ally, Red = Foe + if (G_GametypeHasTeams()) + c = (players[consoleplayer].ctfteam == seenplayer->ctfteam) ? V_GREENMAP : V_REDMAP; + else // Everyone is an ally, or everyone is a foe! + c = (G_RingSlingerGametype()) ? V_REDMAP : V_GREENMAP; break; } + + V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT/2 + 15, V_HUDTRANSHALF|c, player_names[seenplayer-players]); } #endif From 1c5080151da9f9bb390d08c5827012fbd3687ec1 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Wed, 29 Aug 2018 20:46:08 +0100 Subject: [PATCH 34/34] Fix typo introduced by changes to the setrings command --- src/m_cheat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 652451749..0937e40fe 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -890,7 +890,7 @@ void Command_Setrings_f(void) else { players[consoleplayer].spheres = 0; - P_GivePlayerSpheres(&player[consoleplayer], atoi(COM_Argv(1))); + P_GivePlayerSpheres(&players[consoleplayer], atoi(COM_Argv(1))); // no totalsphere addition to revert }