From 365a59f1863ff044b17376bf76aca6b9c1a6f482 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 16 Aug 2018 11:34:57 -0400 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 792360ea97a5ba948d81c798d95693029a99b062 Mon Sep 17 00:00:00 2001 From: Digiku Date: Fri, 17 Aug 2018 09:09:10 -0400 Subject: [PATCH 5/6] 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 6/6] 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 {