Death: respawn from where you died and take an invisible lightsnake

This commit is contained in:
James R 2022-06-09 22:49:30 -07:00
parent 7a8f3ee88b
commit 1800970ed9
5 changed files with 17 additions and 3 deletions

View file

@ -281,6 +281,7 @@ typedef struct respawnvars_s
tic_t airtimer; // Time spent in the air before respawning
UINT32 distanceleft; // How far along the course to respawn you
tic_t dropdash; // Drop Dash charge timer
boolean truedeath; // Your soul has left your body
} respawnvars_t;
// player_t struct for all bot variables

View file

@ -278,6 +278,7 @@ void K_DoIngameRespawn(player_t *player)
player->respawn.state = RESPAWNST_MOVE;
player->respawn.airtimer = player->airtime;
player->respawn.truedeath = false;
}
/*--------------------------------------------------
@ -567,7 +568,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
lasersteps--;
}
if (lasersteps == 0) // Don't spawn them beyond the respawn point.
// Respawning after death: everything about the player
// is invisible
if (!player->respawn.truedeath && lasersteps == 0) // Don't spawn them beyond the respawn point.
{
mobj_t *lasermo = P_SpawnMobj(laser.x, laser.y, laser.z + (player->mo->height / 2), MT_DEZLASER);

View file

@ -1076,6 +1076,11 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget
target->player->playerstate = PST_DEAD;
// respawn from where you died
target->player->respawn.pointx = target->x;
target->player->respawn.pointy = target->y;
target->player->respawn.pointz = target->z;
if (target->player == &players[consoleplayer])
{
// don't die in auto map,

View file

@ -11250,8 +11250,6 @@ void P_MovePlayerToStarpost(INT32 playernum)
mobj_t *mobj = p->mo;
I_Assert(mobj != NULL);
K_DoIngameRespawn(p);
P_UnsetThingPosition(mobj);
mobj->x = p->respawn.pointx;
mobj->y = p->respawn.pointy;
@ -11293,6 +11291,11 @@ void P_MovePlayerToStarpost(INT32 playernum)
else
p->drawangle = mobj->angle; // default to the camera angle
K_DoIngameRespawn(p);
p->respawn.truedeath = true;
mobj->renderflags |= RF_DONTDRAW;
P_AfterPlayerSpawn(playernum);
}

View file

@ -373,6 +373,7 @@ static void P_NetArchivePlayers(void)
WRITEUINT32(save_p, players[i].respawn.airtimer);
WRITEUINT32(save_p, players[i].respawn.distanceleft);
WRITEUINT32(save_p, players[i].respawn.dropdash);
WRITEUINT8(save_p, players[i].respawn.truedeath);
// botvars_t
WRITEUINT8(save_p, players[i].botvars.difficulty);
@ -654,6 +655,7 @@ static void P_NetUnArchivePlayers(void)
players[i].respawn.airtimer = READUINT32(save_p);
players[i].respawn.distanceleft = READUINT32(save_p);
players[i].respawn.dropdash = READUINT32(save_p);
players[i].respawn.truedeath = READUINT8(save_p);
// botvars_t
players[i].botvars.difficulty = READUINT8(save_p);