Let savecheckpoint work online, work at all

Actually respawns you at this location! 😃

Uses object Z position instead of floor height.
This commit is contained in:
James R 2022-09-29 03:53:30 -07:00 committed by GenericHeroGuy
parent 2462a5fcba
commit 9f6e9c109e
3 changed files with 27 additions and 6 deletions

View file

@ -2114,6 +2114,12 @@ void D_Cheat(INT32 playernum, INT32 cheat, ...)
switch (cheat)
{
case CHEAT_SAVECHECKPOINT:
COPY(WRITEFIXED, fixed_t); // x
COPY(WRITEFIXED, fixed_t); // y
COPY(WRITEFIXED, fixed_t); // z
break;
case CHEAT_RINGS:
case CHEAT_LIVES:
// If you're confused why 'int' instead of
@ -5719,6 +5725,20 @@ static void Got_Cheat(UINT8 **cp, INT32 playernum)
break;
}
case CHEAT_SAVECHECKPOINT: {
fixed_t x = READFIXED(*cp);
fixed_t y = READFIXED(*cp);
fixed_t z = READFIXED(*cp);
player->starpostx = x>>FRACBITS;
player->starposty = y>>FRACBITS;
player->starpostz = z>>FRACBITS;
CV_CheaterWarning(targetPlayer, va("temporary checkpoint created at %d, %d, %d",
x / FRACUNIT, y / FRACUNIT, z / FRACUNIT));
break;
}
case CHEAT_RINGS: {
SINT8 rings = READSINT8(*cp);

View file

@ -659,15 +659,15 @@ void Command_Dumplua_f(void)
void Command_Savecheckpoint_f(void)
{
mobj_t *thing = players[consoleplayer].mo;
REQUIRE_DEVMODE;
REQUIRE_INLEVEL;
REQUIRE_SINGLEPLAYER;
players[consoleplayer].starpostx = players[consoleplayer].mo->x;
players[consoleplayer].starposty = players[consoleplayer].mo->y;
players[consoleplayer].starpostz = players[consoleplayer].mo->floorz;
CONS_Printf(M_GetText("Temporary checkpoint created at %d, %d, %d\n"), players[consoleplayer].starpostx, players[consoleplayer].starposty, players[consoleplayer].starpostz);
if (!P_MobjWasRemoved(thing))
{
D_Cheat(consoleplayer, CHEAT_SAVECHECKPOINT, thing->x, thing->y, thing->z);
}
}
// Like M_GetAllEmeralds() but for console devmode junkies.

View file

@ -26,6 +26,7 @@ extern "C" {
typedef enum {
CHEAT_NOCLIP,
CHEAT_GOD,
CHEAT_SAVECHECKPOINT,
CHEAT_RINGS,
CHEAT_LIVES,
CHEAT_SCALE,