Add setspheres command

This commit is contained in:
James R 2023-06-14 22:03:01 -07:00
parent 5546f7e7a7
commit 427ab44471
3 changed files with 26 additions and 0 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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);