Add setscore cheat, sets player's point count

This commit is contained in:
James R 2023-03-02 22:08:30 -08:00
parent b2fb1b4ccd
commit 58f07987f9
3 changed files with 24 additions and 0 deletions

View file

@ -1083,6 +1083,7 @@ void D_RegisterClientCommands(void)
COM_AddCommand("god", Command_CheatGod_f);
COM_AddCommand("setrings", Command_Setrings_f);
COM_AddCommand("setlives", Command_Setlives_f);
COM_AddCommand("setscore", Command_Setscore_f);
COM_AddCommand("devmode", Command_Devmode_f);
COM_AddCommand("savecheckpoint", Command_Savecheckpoint_f);
COM_AddCommand("scale", Command_Scale_f);
@ -2051,6 +2052,10 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
COPY(WRITESINT8, int);
COPY(WRITEUINT8, unsigned int);
break;
case CHEAT_SCORE:
COPY(WRITEUINT32, UINT32);
break;
}
#undef COPY
@ -5739,6 +5744,15 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
break;
}
case CHEAT_SCORE: {
UINT32 score = READUINT32(*cp);
player->roundscore = score;
CV_CheaterWarning(targetPlayer, va("score = %u", score));
break;
}
case NUMBER_OF_CHEATS:
break;
}

View file

@ -763,6 +763,14 @@ void Command_Setlives_f(void)
D_Cheat(consoleplayer, CHEAT_LIVES, atoi(COM_Argv(1)));
}
void Command_Setscore_f(void)
{
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
D_Cheat(consoleplayer, CHEAT_SCORE, atoi(COM_Argv(1)));
}
void Command_Grayscale_f(void)
{
REQUIRE_CHEATS;

View file

@ -35,6 +35,7 @@ typedef enum {
CHEAT_RELATIVE_TELEPORT,
CHEAT_DEVMODE,
CHEAT_GIVEITEM,
CHEAT_SCORE,
NUMBER_OF_CHEATS
} cheat_t;
@ -71,6 +72,7 @@ void Command_CheatGod_f(void);
void Command_Savecheckpoint_f(void);
void Command_Setrings_f(void);
void Command_Setlives_f(void);
void Command_Setscore_f(void);
void Command_Devmode_f(void);
void Command_Scale_f(void);
void Command_Gravflip_f(void);