Netsync setrings and setlives

- setrings no longer subtracts totalrings
- removed INFLIVES
This commit is contained in:
James R 2022-09-29 04:50:55 -07:00
parent 57a3c4109c
commit db92d9068e
5 changed files with 33 additions and 27 deletions

View file

@ -1995,6 +1995,13 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
switch (cheat)
{
case CHEAT_RINGS:
case CHEAT_LIVES:
// If you're confused why 'int' instead of
// 'SINT8', search online: 'default argument promotions'
COPY(WRITESINT8, int);
break;
case CHEAT_SCALE:
COPY(WRITEFIXED, fixed_t);
break;
@ -5495,6 +5502,28 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
break;
}
case CHEAT_RINGS: {
SINT8 rings = READSINT8(*cp);
// P_GivePlayerRings does value clamping
player->rings = 0;
P_GivePlayerRings(player, rings);
CV_CheaterWarning(targetPlayer, va("rings = %d", rings));
break;
}
case CHEAT_LIVES: {
SINT8 lives = READSINT8(*cp);
// P_GivePlayerLives does value clamping
player->lives = 0;
P_GivePlayerLives(player, lives);
CV_CheaterWarning(targetPlayer, va("lives = %d", lives));
break;
}
case CHEAT_SCALE: {
const fixed_t smin = FRACUNIT/100;
const fixed_t smax = 100*FRACUNIT;

View file

@ -602,7 +602,4 @@ typedef struct player_s
#endif
} player_t;
// Value for infinite lives
#define INFLIVES 0x7F
#endif

View file

@ -6347,9 +6347,6 @@ struct int_const_s const INT_CONST[] = {
{"PA_DRIFT",PA_DRIFT},
{"PA_HURT",PA_HURT},
// 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},

View file

@ -748,13 +748,7 @@ void Command_Setrings_f(void)
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
if (COM_Argc() > 1)
{
// P_GivePlayerRings does value clamping
players[consoleplayer].rings = 0;
P_GivePlayerRings(&players[consoleplayer], atoi(COM_Argv(1)));
players[consoleplayer].totalring -= atoi(COM_Argv(1)); //undo totalring addition done in P_GivePlayerRings
}
D_Cheat(consoleplayer, CHEAT_RINGS, atoi(COM_Argv(1)));
}
void Command_Setlives_f(void)
@ -762,20 +756,7 @@ void Command_Setlives_f(void)
REQUIRE_CHEATS;
REQUIRE_INLEVEL;
if (COM_Argc() > 1)
{
SINT8 lives = atoi(COM_Argv(1));
if (lives == -1)
{
players[consoleplayer].lives = INFLIVES; // infinity!
}
else
{
// P_GivePlayerLives does value clamping
players[consoleplayer].lives = 0;
P_GivePlayerLives(&players[consoleplayer], atoi(COM_Argv(1)));
}
}
D_Cheat(consoleplayer, CHEAT_LIVES, atoi(COM_Argv(1)));
}
//

View file

@ -22,6 +22,8 @@
typedef enum {
CHEAT_NOCLIP,
CHEAT_GOD,
CHEAT_RINGS,
CHEAT_LIVES,
CHEAT_SCALE,
CHEAT_FLIP,
CHEAT_HURT,