diff --git a/src/d_netcmd.c b/src/d_netcmd.c index b58334da6..823099cf6 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -1118,6 +1118,7 @@ void D_RegisterClientCommands(void) COM_AddCommand("noclip", Command_CheatNoClip_f); COM_AddCommand("god", Command_CheatGod_f); COM_AddCommand("setrings", Command_Setrings_f); + COM_AddCommand("setspheres", Command_Setspheres_f); COM_AddCommand("setlives", Command_Setlives_f); COM_AddCommand("setscore", Command_Setscore_f); COM_AddCommand("devmode", Command_Devmode_f); @@ -2094,6 +2095,10 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...) case CHEAT_RESPAWNAT: COPY(WRITEINT32, INT32); break; + + case CHEAT_SPHERES: + COPY(WRITEINT16, int); + break; } #undef COPY @@ -6242,6 +6247,17 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum) break; } + case CHEAT_SPHERES: { + INT16 spheres = READINT16(*cp); + + // P_GivePlayerSpheres does value clamping + player->spheres = 0; + P_GivePlayerSpheres(player, spheres); + + CV_CheaterWarning(targetPlayer, va("spheres = %d", spheres)); + break; + } + case NUMBER_OF_CHEATS: break; } diff --git a/src/m_cheat.c b/src/m_cheat.c index 17e85e775..0db6a5b9b 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -560,6 +560,14 @@ void Command_Setrings_f(void) D_Cheat(consoleplayer, CHEAT_RINGS, atoi(COM_Argv(1))); } +void Command_Setspheres_f(void) +{ + REQUIRE_CHEATS; + REQUIRE_INLEVEL; + + D_Cheat(consoleplayer, CHEAT_SPHERES, atoi(COM_Argv(1))); +} + void Command_Setlives_f(void) { REQUIRE_CHEATS; diff --git a/src/m_cheat.h b/src/m_cheat.h index bf7fc79be..835832500 100644 --- a/src/m_cheat.h +++ b/src/m_cheat.h @@ -40,6 +40,7 @@ typedef enum { CHEAT_ANGLE, CHEAT_RESPAWNAT, CHEAT_GIVEPOWERUP, + CHEAT_SPHERES, NUMBER_OF_CHEATS } cheat_t; @@ -75,6 +76,7 @@ void Command_CheatNoClip_f(void); void Command_CheatGod_f(void); void Command_Savecheckpoint_f(void); void Command_Setrings_f(void); +void Command_Setspheres_f(void); void Command_Setlives_f(void); void Command_Setscore_f(void); void Command_Devmode_f(void);