mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-03 20:26:05 +00:00
Add back to resynch & savegame, shorten names of a few variables
This commit is contained in:
parent
cf1c7f9f10
commit
285de3357d
13 changed files with 198 additions and 136 deletions
|
|
@ -570,11 +570,6 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
|||
|
||||
for (j = 0; j < NUMPOWERS; ++j)
|
||||
rsp->powers[j] = (UINT16)SHORT(players[i].powers[j]);
|
||||
for (j = 0; j < NUMKARTSTUFF; ++j)
|
||||
rsp->kartstuff[j] = LONG(players[i].kartstuff[j]); // SRB2kart
|
||||
|
||||
rsp->frameangle = (angle_t)LONG(players[i].frameangle); // SRB2kart
|
||||
rsp->airtime = (tic_t)LONG(players[i].airtime);
|
||||
|
||||
// Score is resynched in the rspfirm resync packet
|
||||
rsp->health = 0; // resynched with mo health
|
||||
|
|
@ -641,6 +636,23 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
|||
|
||||
rsp->splitscreenindex = players[i].splitscreenindex;
|
||||
|
||||
// SRB2kart
|
||||
for (j = 0; j < NUMKARTSTUFF; ++j)
|
||||
rsp->kartstuff[j] = LONG(players[i].kartstuff[j]);
|
||||
|
||||
rsp->frameangle = (angle_t)LONG(players[i].frameangle);
|
||||
rsp->airtime = (tic_t)LONG(players[i].airtime);
|
||||
|
||||
// respawnvars_t
|
||||
rsp->respawn_state = players[i].respawn.state;
|
||||
rsp->respawn_pointx = (fixed_t)LONG(players[i].respawn.pointx);
|
||||
rsp->respawn_pointy = (fixed_t)LONG(players[i].respawn.pointy);
|
||||
rsp->respawn_pointz = (fixed_t)LONG(players[i].respawn.pointz);
|
||||
rsp->respawn_flip = players[i].respawn.flip;
|
||||
rsp->respawn_timer = (tic_t)LONG(players[i].respawn.timer);
|
||||
rsp->respawn_distanceleft = (UINT32)LONG(players[i].respawn.distanceleft);
|
||||
rsp->respawn_dropdash = (tic_t)LONG(players[i].respawn.dropdash);
|
||||
|
||||
rsp->hasmo = false;
|
||||
//Transfer important mo information if the player has a body.
|
||||
//This lets us resync players even if they are dead.
|
||||
|
|
@ -690,11 +702,6 @@ static void resynch_read_player(resynch_pak *rsp)
|
|||
|
||||
for (j = 0; j < NUMPOWERS; ++j)
|
||||
players[i].powers[j] = (UINT16)SHORT(rsp->powers[j]);
|
||||
for (j = 0; j < NUMKARTSTUFF; ++j)
|
||||
players[i].kartstuff[j] = LONG(rsp->kartstuff[j]); // SRB2kart
|
||||
|
||||
players[i].frameangle = (angle_t)LONG(rsp->frameangle); // SRB2kart
|
||||
players[i].airtime = (tic_t)LONG(rsp->airtime);
|
||||
|
||||
// Score is resynched in the rspfirm resync packet
|
||||
players[i].health = rsp->health;
|
||||
|
|
@ -760,6 +767,23 @@ static void resynch_read_player(resynch_pak *rsp)
|
|||
|
||||
players[i].splitscreenindex = rsp->splitscreenindex;
|
||||
|
||||
// SRB2kart
|
||||
for (j = 0; j < NUMKARTSTUFF; ++j)
|
||||
players[i].kartstuff[j] = LONG(rsp->kartstuff[j]);
|
||||
|
||||
players[i].frameangle = (angle_t)LONG(rsp->frameangle);
|
||||
players[i].airtime = (tic_t)LONG(rsp->airtime);
|
||||
|
||||
// respawnvars_t
|
||||
players[i].respawn.state = rsp->respawn_state;
|
||||
players[i].respawn.pointx = (fixed_t)LONG(rsp->respawn_pointx);
|
||||
players[i].respawn.pointy = (fixed_t)LONG(rsp->respawn_pointy);
|
||||
players[i].respawn.pointz = (fixed_t)LONG(rsp->respawn_pointz);
|
||||
players[i].respawn.flip = (boolean)rsp->respawn_flip;
|
||||
players[i].respawn.timer = (tic_t)LONG(rsp->respawn_timer);
|
||||
players[i].respawn.distanceleft = (UINT32)LONG(rsp->respawn_distanceleft);
|
||||
players[i].respawn.dropdash = (tic_t)LONG(rsp->respawn_dropdash);
|
||||
|
||||
//We get a packet for each player in game.
|
||||
if (!playeringame[i])
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -213,10 +213,6 @@ typedef struct
|
|||
|
||||
UINT16 powers[NUMPOWERS];
|
||||
|
||||
INT32 kartstuff[NUMKARTSTUFF]; // SRB2kart
|
||||
angle_t frameangle; // SRB2kart
|
||||
tic_t airtime;
|
||||
|
||||
// Score is resynched in the confirm resync packet
|
||||
INT32 health;
|
||||
SINT8 lives;
|
||||
|
|
@ -281,6 +277,21 @@ typedef struct
|
|||
|
||||
UINT8 splitscreenindex;
|
||||
|
||||
// SRB2kart
|
||||
INT32 kartstuff[NUMKARTSTUFF];
|
||||
angle_t frameangle;
|
||||
tic_t airtime;
|
||||
|
||||
// respawnvars_t
|
||||
UINT8 respawn_state;
|
||||
fixed_t respawn_pointx;
|
||||
fixed_t respawn_pointy;
|
||||
fixed_t respawn_pointz;
|
||||
boolean respawn_flip;
|
||||
tic_t respawn_timer;
|
||||
UINT32 respawn_distanceleft;
|
||||
tic_t respawn_dropdash;
|
||||
|
||||
//player->mo stuff
|
||||
UINT8 hasmo; // Boolean
|
||||
|
||||
|
|
|
|||
|
|
@ -420,15 +420,15 @@ typedef enum
|
|||
// player_t struct for all respawn variables
|
||||
typedef struct respawnvars_s
|
||||
{
|
||||
UINT8 respawnstate; // 0: not respawning, 1: heading towards respawn point, 2: about to drop
|
||||
UINT8 state; // 0: not respawning, 1: heading towards respawn point, 2: about to drop
|
||||
waypoint_t *wp; // Waypoint that we're going towards, NULL if the position isn't linked to one
|
||||
INT32 pointx; // Respawn position coords to go towards
|
||||
INT32 pointy;
|
||||
INT32 pointz;
|
||||
fixed_t pointx; // Respawn position coords to go towards
|
||||
fixed_t pointy;
|
||||
fixed_t pointz;
|
||||
boolean flip; // Flip upside down or not
|
||||
INT32 timer; // Time left on respawn animation once you're there
|
||||
tic_t timer; // Time left on respawn animation once you're there
|
||||
UINT32 distanceleft; // How far along the course to respawn you
|
||||
INT32 dropdash; // Drop Dash charge timer
|
||||
tic_t dropdash; // Drop Dash charge timer
|
||||
} respawnvars_t;
|
||||
|
||||
// ========================================================================
|
||||
|
|
@ -477,7 +477,7 @@ typedef struct player_s
|
|||
INT16 rturn_max[MAXPREDICTTICS]; // Ditto but for full-right
|
||||
UINT32 distancetofinish;
|
||||
waypoint_t *nextwaypoint;
|
||||
respawnvars_t respawnvars; // Respawn info
|
||||
respawnvars_t respawn; // Respawn info
|
||||
tic_t airtime; // Keep track of how long you've been in the air
|
||||
|
||||
// Bit flags.
|
||||
|
|
|
|||
13
src/g_game.c
13
src/g_game.c
|
|
@ -1588,7 +1588,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
// SRB2kart - no additional angle if not moving
|
||||
if ((player->mo && player->speed > 0) // Moving
|
||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
||||
|| (player->respawnvars.respawnstate != RESPAWNST_NONE) // Respawning
|
||||
|| (player->respawn.state != RESPAWNST_NONE) // Respawning
|
||||
|| (player->spectator || objectplacing)) // Not a physical player
|
||||
lang += (cmd->angleturn<<16);
|
||||
|
||||
|
|
@ -2539,7 +2539,7 @@ static inline void G_PlayerFinishLevel(INT32 player)
|
|||
P_FlashPal(p, 0, 0); // Resets
|
||||
|
||||
p->starpostnum = 0;
|
||||
memset(&p->respawnvars, 0, sizeof (p->respawnvars));
|
||||
memset(&p->respawn, 0, sizeof (p->respawn));
|
||||
|
||||
// SRB2kart: Increment the "matches played" counter.
|
||||
if (player == consoleplayer)
|
||||
|
|
@ -2588,6 +2588,7 @@ void G_PlayerReborn(INT32 player)
|
|||
SINT8 pity;
|
||||
|
||||
// SRB2kart
|
||||
respawnvars_t respawn;
|
||||
INT32 itemtype;
|
||||
INT32 itemamount;
|
||||
INT32 itemroulette;
|
||||
|
|
@ -2673,6 +2674,8 @@ void G_PlayerReborn(INT32 player)
|
|||
wanted = players[player].kartstuff[k_wanted];
|
||||
}
|
||||
|
||||
memcpy(&respawn, &players[player].respawn, sizeof (respawn));
|
||||
|
||||
p = &players[player];
|
||||
memset(p, 0, sizeof (*p));
|
||||
|
||||
|
|
@ -2721,6 +2724,8 @@ void G_PlayerReborn(INT32 player)
|
|||
p->kartstuff[k_eggmanblame] = -1;
|
||||
p->kartstuff[k_lastdraft] = -1;
|
||||
|
||||
memcpy(&p->respawn, &respawn, sizeof (p->respawn));
|
||||
|
||||
// Don't do anything immediately
|
||||
p->pflags |= PF_USEDOWN;
|
||||
p->pflags |= PF_ATTACKDOWN;
|
||||
|
|
@ -4663,7 +4668,7 @@ void G_InitNew(UINT8 pencoremode, const char *mapname, boolean resetplayer, bool
|
|||
{
|
||||
players[i].playerstate = PST_REBORN;
|
||||
players[i].starpostnum = 0;
|
||||
memset(&players[i].respawnvars, 0, sizeof (players[i].respawnvars));
|
||||
memset(&players[i].respawn, 0, sizeof (players[i].respawn));
|
||||
|
||||
#if 0
|
||||
if (netgame || multiplayer)
|
||||
|
|
@ -5185,7 +5190,7 @@ void G_ReadDemoTiccmd(ticcmd_t *cmd, INT32 playernum)
|
|||
// SRB2kart: Copy-pasted from ticcmd building, removes that crappy demo cam
|
||||
if (((players[displayplayers[0]].mo && players[displayplayers[0]].speed > 0) // Moving
|
||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
||||
|| (players[displayplayers[0]].respawnvars.respawnstate != RESPAWNST_NONE) // Respawning
|
||||
|| (players[displayplayers[0]].respawn.state != RESPAWNST_NONE) // Respawning
|
||||
|| (players[displayplayers[0]].spectator || objectplacing)) // Not a physical player
|
||||
&& !(players[displayplayers[0]].kartstuff[k_spinouttimer]
|
||||
&& (players[displayplayers[0]].kartstuff[k_sneakertimer] || players[displayplayers[0]].kartstuff[k_levelbooster]))) // Spinning and boosting cancels out spinout
|
||||
|
|
|
|||
18
src/k_kart.c
18
src/k_kart.c
|
|
@ -963,8 +963,8 @@ void K_KartBouncing(mobj_t *mobj1, mobj_t *mobj2, boolean bounce, boolean solid)
|
|||
|| (mobj2->player && mobj2->player->playerstate != PST_LIVE))
|
||||
return;
|
||||
|
||||
if ((mobj1->player && mobj1->player->respawnvars.respawnstate != RESPAWNST_NONE)
|
||||
|| (mobj2->player && mobj2->player->respawnvars.respawnstate != RESPAWNST_NONE))
|
||||
if ((mobj1->player && mobj1->player->respawn.state != RESPAWNST_NONE)
|
||||
|| (mobj2->player && mobj2->player->respawn.state != RESPAWNST_NONE))
|
||||
return;
|
||||
|
||||
{ // Don't bump if you're flashing
|
||||
|
|
@ -4842,7 +4842,7 @@ static void K_UpdateEngineSounds(player_t *player, ticcmd_t *cmd)
|
|||
#endif
|
||||
return;
|
||||
|
||||
if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->respawnvars.respawnstate == RESPAWNST_DROP)) // Startup boosts
|
||||
if ((leveltime >= starttime-(2*TICRATE) && leveltime <= starttime) || (player->respawn.state == RESPAWNST_DROP)) // Startup boosts
|
||||
targetsnd = ((cmd->buttons & BT_ACCELERATE) ? 12 : 0);
|
||||
else
|
||||
targetsnd = (((6*cmd->forwardmove)/25) + ((player->speed / mapobjectscale)/5))/2;
|
||||
|
|
@ -5243,7 +5243,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
if (player->playerstate == PST_DEAD || (player->respawnvars.respawnstate == RESPAWNST_MOVE)) // Ensure these are set correctly here
|
||||
if (player->playerstate == PST_DEAD || (player->respawn.state == RESPAWNST_MOVE)) // Ensure these are set correctly here
|
||||
{
|
||||
player->mo->colorized = false;
|
||||
player->mo->color = player->skincolor;
|
||||
|
|
@ -5419,7 +5419,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
if (player->kartstuff[k_invincibilitytimer])
|
||||
player->kartstuff[k_invincibilitytimer]--;
|
||||
|
||||
if ((player->respawnvars.respawnstate == RESPAWNST_NONE) && player->kartstuff[k_growshrinktimer] != 0)
|
||||
if ((player->respawn.state == RESPAWNST_NONE) && player->kartstuff[k_growshrinktimer] != 0)
|
||||
{
|
||||
if (player->kartstuff[k_growshrinktimer] > 0)
|
||||
player->kartstuff[k_growshrinktimer]--;
|
||||
|
|
@ -5489,7 +5489,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (G_BattleGametype() && player->kartstuff[k_bumper] > 0
|
||||
&& !player->kartstuff[k_spinouttimer] && !player->kartstuff[k_squishedtimer]
|
||||
&& (player->respawnvars.respawnstate == RESPAWNST_DROP) && !player->powers[pw_flashing])
|
||||
&& (player->respawn.state == RESPAWNST_DROP) && !player->powers[pw_flashing])
|
||||
{
|
||||
player->kartstuff[k_wanted]++;
|
||||
if (battleovertime.enabled >= 10*TICRATE)
|
||||
|
|
@ -5809,13 +5809,13 @@ static waypoint_t *K_GetPlayerNextWaypoint(player_t *player)
|
|||
|
||||
// Respawn point should only be updated when we're going to a nextwaypoint
|
||||
if ((updaterespawn) &&
|
||||
(player->respawnvars.respawnstate == RESPAWNST_NONE) &&
|
||||
(player->respawn.state == RESPAWNST_NONE) &&
|
||||
(bestwaypoint != NULL) &&
|
||||
(bestwaypoint != player->nextwaypoint) &&
|
||||
(K_GetWaypointIsSpawnpoint(bestwaypoint)) &&
|
||||
(K_GetWaypointIsEnabled(bestwaypoint) == true))
|
||||
{
|
||||
player->respawnvars.wp = bestwaypoint;
|
||||
player->respawn.wp = bestwaypoint;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6513,7 +6513,7 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
if (player && player->mo && player->mo->health > 0 && !player->spectator && !(player->exiting || mapreset) && leveltime > starttime
|
||||
&& player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && (player->respawnvars.respawnstate == RESPAWNST_NONE))
|
||||
&& player->kartstuff[k_spinouttimer] == 0 && player->kartstuff[k_squishedtimer] == 0 && (player->respawn.state == RESPAWNST_NONE))
|
||||
{
|
||||
// First, the really specific, finicky items that function without the item being directly in your item slot.
|
||||
// Karma item dropping
|
||||
|
|
|
|||
122
src/k_respawn.c
122
src/k_respawn.c
|
|
@ -72,11 +72,11 @@ static void K_RespawnAtWaypoint(player_t *player, waypoint_t *waypoint)
|
|||
return;
|
||||
}
|
||||
|
||||
player->respawnvars.pointx = waypoint->mobj->x;
|
||||
player->respawnvars.pointy = waypoint->mobj->y;
|
||||
player->respawnvars.pointz = waypoint->mobj->z;
|
||||
player->respawnvars.flip = (waypoint->mobj->flags2 & MF2_OBJECTFLIP);
|
||||
player->respawnvars.pointz += K_RespawnOffset(player, player->respawnvars.flip);
|
||||
player->respawn.pointx = waypoint->mobj->x;
|
||||
player->respawn.pointy = waypoint->mobj->y;
|
||||
player->respawn.pointz = waypoint->mobj->z;
|
||||
player->respawn.flip = (waypoint->mobj->flags2 & MF2_OBJECTFLIP);
|
||||
player->respawn.pointz += K_RespawnOffset(player, player->respawn.flip);
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -91,7 +91,7 @@ void K_DoIngameRespawn(player_t *player)
|
|||
return;
|
||||
}
|
||||
|
||||
if (player->respawnvars.respawnstate != RESPAWNST_NONE)
|
||||
if (player->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -108,11 +108,11 @@ void K_DoIngameRespawn(player_t *player)
|
|||
player->kartstuff[k_pogospring] = 0;
|
||||
|
||||
// Set up respawn position if invalid
|
||||
if (player->respawnvars.wp != NULL)
|
||||
if (player->respawn.wp != NULL)
|
||||
{
|
||||
const UINT32 dist = RESPAWN_DIST + (player->airtime * 32);
|
||||
player->respawnvars.distanceleft = (dist * mapobjectscale) / FRACUNIT;
|
||||
K_RespawnAtWaypoint(player, player->respawnvars.wp);
|
||||
player->respawn.distanceleft = (dist * mapobjectscale) / FRACUNIT;
|
||||
K_RespawnAtWaypoint(player, player->respawn.wp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -165,57 +165,57 @@ void K_DoIngameRespawn(player_t *player)
|
|||
if (beststart == NULL)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "No respawn points!\n");
|
||||
player->respawnvars.pointx = 0;
|
||||
player->respawnvars.pointy = 0;
|
||||
player->respawnvars.pointz = 0;
|
||||
player->respawnvars.flip = false;
|
||||
player->respawn.pointx = 0;
|
||||
player->respawn.pointy = 0;
|
||||
player->respawn.pointz = 0;
|
||||
player->respawn.flip = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
sector_t *s;
|
||||
fixed_t z = (beststart->options >> ZSHIFT) * FRACUNIT;
|
||||
|
||||
player->respawnvars.pointx = beststart->x << FRACBITS;
|
||||
player->respawnvars.pointy = beststart->y << FRACBITS;
|
||||
player->respawn.pointx = beststart->x << FRACBITS;
|
||||
player->respawn.pointy = beststart->y << FRACBITS;
|
||||
|
||||
s = R_PointInSubsector(beststart->x << FRACBITS, beststart->y << FRACBITS)->sector;
|
||||
|
||||
player->respawnvars.flip = (beststart->options & MTF_OBJECTFLIP);
|
||||
player->respawn.flip = (beststart->options & MTF_OBJECTFLIP);
|
||||
|
||||
if (player->respawnvars.flip == true)
|
||||
if (player->respawn.flip == true)
|
||||
{
|
||||
player->respawnvars.pointz = (
|
||||
player->respawn.pointz = (
|
||||
#ifdef ESLOPE
|
||||
s->c_slope ? P_GetZAt(s->c_slope, player->respawnvars.pointx, player->respawnvars.pointy) :
|
||||
s->c_slope ? P_GetZAt(s->c_slope, player->respawn.pointx, player->respawn.pointy) :
|
||||
#endif
|
||||
s->ceilingheight);
|
||||
|
||||
if (z != 0)
|
||||
{
|
||||
player->respawnvars.pointz -= z;
|
||||
player->respawn.pointz -= z;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player->respawnvars.pointz = (
|
||||
player->respawn.pointz = (
|
||||
#ifdef ESLOPE
|
||||
s->f_slope ? P_GetZAt(s->f_slope, player->respawnvars.pointx, player->respawnvars.pointy) :
|
||||
s->f_slope ? P_GetZAt(s->f_slope, player->respawn.pointx, player->respawn.pointy) :
|
||||
#endif
|
||||
s->floorheight);
|
||||
|
||||
if (z)
|
||||
{
|
||||
player->respawnvars.pointz += z;
|
||||
player->respawn.pointz += z;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
player->respawnvars.pointz += K_RespawnOffset(player, player->respawnvars.flip);
|
||||
player->respawnvars.distanceleft = 0;
|
||||
player->respawn.pointz += K_RespawnOffset(player, player->respawn.flip);
|
||||
player->respawn.distanceleft = 0;
|
||||
}
|
||||
|
||||
player->respawnvars.timer = RESPAWN_TIME;
|
||||
player->respawnvars.respawnstate = RESPAWNST_MOVE;
|
||||
player->respawn.timer = RESPAWN_TIME;
|
||||
player->respawn.state = RESPAWNST_MOVE;
|
||||
}
|
||||
|
||||
/*--------------------------------------------------
|
||||
|
|
@ -286,9 +286,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
|||
S_StartSound(player->mo, sfx_s3kcas);
|
||||
}
|
||||
|
||||
dest.x = player->respawnvars.pointx;
|
||||
dest.y = player->respawnvars.pointy;
|
||||
dest.z = player->respawnvars.pointz;
|
||||
dest.x = player->respawn.pointx;
|
||||
dest.y = player->respawn.pointy;
|
||||
dest.z = player->respawn.pointz;
|
||||
|
||||
dist = P_AproxDistance(P_AproxDistance(
|
||||
player->mo->x - dest.x,
|
||||
|
|
@ -309,13 +309,13 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
|||
P_SetThingPosition(player->mo);
|
||||
|
||||
// Find the next waypoint to head towards
|
||||
if (player->respawnvars.wp != NULL)
|
||||
if (player->respawn.wp != NULL)
|
||||
{
|
||||
size_t nwp = K_NextRespawnWaypointIndex(player->respawnvars.wp);
|
||||
size_t nwp = K_NextRespawnWaypointIndex(player->respawn.wp);
|
||||
|
||||
if (nwp == SIZE_MAX)
|
||||
{
|
||||
player->respawnvars.respawnstate = RESPAWNST_DROP;
|
||||
player->respawn.state = RESPAWNST_DROP;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -325,34 +325,34 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
|||
dest.x, dest.y
|
||||
);
|
||||
|
||||
if ((player->respawnvars.distanceleft == 0)
|
||||
&& (K_GetWaypointIsSpawnpoint(player->respawnvars.wp) == true))
|
||||
if ((player->respawn.distanceleft == 0)
|
||||
&& (K_GetWaypointIsSpawnpoint(player->respawn.wp) == true))
|
||||
{
|
||||
// Alright buddy, that's the end of the ride.
|
||||
player->respawnvars.respawnstate = RESPAWNST_DROP;
|
||||
player->respawn.state = RESPAWNST_DROP;
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->respawnvars.distanceleft > player->respawnvars.wp->nextwaypointdistances[nwp])
|
||||
if (player->respawn.distanceleft > player->respawn.wp->nextwaypointdistances[nwp])
|
||||
{
|
||||
player->respawnvars.distanceleft -= player->respawnvars.wp->nextwaypointdistances[nwp];
|
||||
player->respawn.distanceleft -= player->respawn.wp->nextwaypointdistances[nwp];
|
||||
}
|
||||
else
|
||||
{
|
||||
player->respawnvars.distanceleft = 0;
|
||||
player->respawn.distanceleft = 0;
|
||||
}
|
||||
|
||||
player->respawnvars.wp = player->respawnvars.wp->nextwaypoints[nwp];
|
||||
K_RespawnAtWaypoint(player, player->respawnvars.wp);
|
||||
player->respawn.wp = player->respawn.wp->nextwaypoints[nwp];
|
||||
K_RespawnAtWaypoint(player, player->respawn.wp);
|
||||
|
||||
dest.x = player->respawnvars.pointx;
|
||||
dest.y = player->respawnvars.pointy;
|
||||
dest.z = player->respawnvars.pointz;
|
||||
dest.x = player->respawn.pointx;
|
||||
dest.y = player->respawn.pointy;
|
||||
dest.z = player->respawn.pointz;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We can now drop!
|
||||
player->respawnvars.respawnstate = RESPAWNST_DROP;
|
||||
player->respawn.state = RESPAWNST_DROP;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -394,9 +394,9 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
|||
step.z = FixedMul(FINESINE(stepva >> ANGLETOFINESHIFT), 2*stepamt);
|
||||
}
|
||||
|
||||
laserdist = player->respawnvars.distanceleft;
|
||||
laserwp = player->respawnvars.wp;
|
||||
laserflip = player->respawnvars.flip;
|
||||
laserdist = player->respawn.distanceleft;
|
||||
laserwp = player->respawn.wp;
|
||||
laserflip = player->respawn.flip;
|
||||
|
||||
laser.x = player->mo->x + (step.x / 2);
|
||||
laser.y = player->mo->y + (step.y / 2);
|
||||
|
|
@ -531,7 +531,7 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
|
|||
--------------------------------------------------*/
|
||||
static void K_DropDashWait(player_t *player)
|
||||
{
|
||||
player->respawnvars.timer--;
|
||||
player->respawn.timer--;
|
||||
|
||||
if (leveltime % 8 == 0)
|
||||
{
|
||||
|
|
@ -622,19 +622,19 @@ static void K_HandleDropDash(player_t *player)
|
|||
|
||||
if ((cmd->buttons & BT_ACCELERATE) && !player->kartstuff[k_spinouttimer]) // Since we're letting players spin out on respawn, don't let them charge a dropdash in this state. (It wouldn't work anyway)
|
||||
{
|
||||
player->respawnvars.dropdash++;
|
||||
player->respawn.dropdash++;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->respawnvars.dropdash = 0;
|
||||
player->respawn.dropdash = 0;
|
||||
}
|
||||
|
||||
if (player->respawnvars.dropdash == TICRATE/4)
|
||||
if (player->respawn.dropdash == TICRATE/4)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_ddash);
|
||||
}
|
||||
|
||||
if ((player->respawnvars.dropdash >= TICRATE/4) && (player->respawnvars.dropdash & 1))
|
||||
if ((player->respawn.dropdash >= TICRATE/4) && (player->respawn.dropdash & 1))
|
||||
{
|
||||
player->mo->colorized = true;
|
||||
}
|
||||
|
|
@ -645,7 +645,7 @@ static void K_HandleDropDash(player_t *player)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((cmd->buttons & BT_ACCELERATE) && (player->respawnvars.dropdash >= TICRATE/4))
|
||||
if ((cmd->buttons & BT_ACCELERATE) && (player->respawn.dropdash >= TICRATE/4))
|
||||
{
|
||||
S_StartSound(player->mo, sfx_s23c);
|
||||
player->kartstuff[k_startboost] = 50;
|
||||
|
|
@ -653,7 +653,7 @@ static void K_HandleDropDash(player_t *player)
|
|||
}
|
||||
|
||||
player->mo->colorized = false;
|
||||
player->respawnvars.dropdash = 0;
|
||||
player->respawn.dropdash = 0;
|
||||
|
||||
//P_PlayRinglossSound(player->mo);
|
||||
P_PlayerRingBurst(player, 3);
|
||||
|
|
@ -689,7 +689,7 @@ static void K_HandleDropDash(player_t *player)
|
|||
K_CheckBumpers();
|
||||
}
|
||||
|
||||
player->respawnvars.respawnstate = RESPAWNST_NONE;
|
||||
player->respawn.state = RESPAWNST_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -700,18 +700,18 @@ static void K_HandleDropDash(player_t *player)
|
|||
--------------------------------------------------*/
|
||||
void K_RespawnChecker(player_t *player)
|
||||
{
|
||||
if (player->respawnvars.respawnstate == RESPAWNST_NONE)
|
||||
if (player->respawn.state == RESPAWNST_NONE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->spectator)
|
||||
{
|
||||
player->respawnvars.respawnstate = RESPAWNST_NONE;
|
||||
player->respawn.state = RESPAWNST_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (player->respawnvars.respawnstate)
|
||||
switch (player->respawn.state)
|
||||
{
|
||||
case RESPAWNST_MOVE:
|
||||
player->mo->momx = player->mo->momy = player->mo->momz = 0;
|
||||
|
|
@ -719,7 +719,7 @@ void K_RespawnChecker(player_t *player)
|
|||
return;
|
||||
case RESPAWNST_DROP:
|
||||
player->mo->momx = player->mo->momy = 0;
|
||||
if (player->respawnvars.timer > 0)
|
||||
if (player->respawn.timer > 0)
|
||||
{
|
||||
player->mo->momz = 0;
|
||||
K_DropDashWait(player);
|
||||
|
|
@ -730,7 +730,7 @@ void K_RespawnChecker(player_t *player)
|
|||
}
|
||||
return;
|
||||
default:
|
||||
player->respawnvars.respawnstate = RESPAWNST_NONE;
|
||||
player->respawn.state = RESPAWNST_NONE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -682,11 +682,11 @@ void Command_Savecheckpoint_f(void)
|
|||
REQUIRE_INLEVEL;
|
||||
REQUIRE_SINGLEPLAYER;
|
||||
|
||||
players[consoleplayer].respawnvars.pointx = players[consoleplayer].mo->x;
|
||||
players[consoleplayer].respawnvars.pointy = players[consoleplayer].mo->y;
|
||||
players[consoleplayer].respawnvars.pointz = players[consoleplayer].mo->floorz;
|
||||
players[consoleplayer].respawn.pointx = players[consoleplayer].mo->x;
|
||||
players[consoleplayer].respawn.pointy = players[consoleplayer].mo->y;
|
||||
players[consoleplayer].respawn.pointz = players[consoleplayer].mo->floorz;
|
||||
|
||||
CONS_Printf(M_GetText("Temporary checkpoint created at %d, %d, %d\n"), players[consoleplayer].respawnvars.pointx, players[consoleplayer].respawnvars.pointy, players[consoleplayer].respawnvars.pointz);
|
||||
CONS_Printf(M_GetText("Temporary checkpoint created at %d, %d, %d\n"), players[consoleplayer].respawn.pointx, players[consoleplayer].respawn.pointy, players[consoleplayer].respawn.pointz);
|
||||
}
|
||||
|
||||
// Like M_GetAllEmeralds() but for console devmode junkies.
|
||||
|
|
|
|||
|
|
@ -5679,15 +5679,15 @@ void A_MixUp(mobj_t *actor)
|
|||
z = players[one].mo->z;
|
||||
angle = players[one].mo->angle;
|
||||
|
||||
starpostx = players[one].respawnvars.pointx;
|
||||
starposty = players[one].respawnvars.pointy;
|
||||
starpostz = players[one].respawnvars.pointz;
|
||||
starpostx = players[one].respawn.pointx;
|
||||
starposty = players[one].respawn.pointy;
|
||||
starpostz = players[one].respawn.pointz;
|
||||
starpostnum = players[one].starpostnum;
|
||||
|
||||
mflags2 = players[one].mo->flags2;
|
||||
|
||||
P_MixUp(players[one].mo, players[two].mo->x, players[two].mo->y, players[two].mo->z, players[two].mo->angle,
|
||||
players[two].respawnvars.pointx, players[two].respawnvars.pointy, players[two].respawnvars.pointz,
|
||||
players[two].respawn.pointx, players[two].respawn.pointy, players[two].respawn.pointz,
|
||||
players[two].starpostnum, 0, 0,
|
||||
players[two].mo->flags2);
|
||||
|
||||
|
|
@ -5749,9 +5749,9 @@ void A_MixUp(mobj_t *actor)
|
|||
transspeed[counter] = players[i].speed;
|
||||
transtracer[counter] = players[i].mo->tracer;
|
||||
|
||||
spposition[counter][0] = players[i].respawnvars.pointx;
|
||||
spposition[counter][1] = players[i].respawnvars.pointy;
|
||||
spposition[counter][2] = players[i].respawnvars.pointz;
|
||||
spposition[counter][0] = players[i].respawn.pointx;
|
||||
spposition[counter][1] = players[i].respawn.pointy;
|
||||
spposition[counter][2] = players[i].respawn.pointz;
|
||||
starpostnum[counter] = players[i].starpostnum;
|
||||
|
||||
flags2[counter] = players[i].mo->flags2;
|
||||
|
|
@ -8605,7 +8605,7 @@ void A_SPBChase(mobj_t *actor)
|
|||
if (players[i].mo->health <= 0)
|
||||
continue; // dead
|
||||
|
||||
if (players[i].respawnvars.respawnstate != RESPAWNST_NONE)
|
||||
if (players[i].respawn.state != RESPAWNST_NONE)
|
||||
continue;*/ // respawning
|
||||
|
||||
if (players[i].kartstuff[k_position] < bestrank)
|
||||
|
|
@ -8782,7 +8782,7 @@ void A_SPBChase(mobj_t *actor)
|
|||
|
||||
actor->lastlook = -1; // Just make sure this is reset
|
||||
|
||||
if (!player || !player->mo || player->mo->health <= 0 || (player->respawnvars.respawnstate != RESPAWNST_NONE))
|
||||
if (!player || !player->mo || player->mo->health <= 0 || (player->respawn.state != RESPAWNST_NONE))
|
||||
{
|
||||
// No one there? Completely STOP.
|
||||
actor->momx = actor->momy = actor->momz = 0;
|
||||
|
|
|
|||
16
src/p_map.c
16
src/p_map.c
|
|
@ -3041,24 +3041,24 @@ void P_HitSpecialLines(mobj_t *thing, fixed_t x, fixed_t y, fixed_t momx, fixed_
|
|||
// trace along the three leading corners
|
||||
if (momx > 0)
|
||||
{
|
||||
leadx = thing->x + thing->radius;
|
||||
trailx = thing->x - thing->radius;
|
||||
leadx = x + thing->radius;
|
||||
trailx = x - thing->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
leadx = thing->x - thing->radius;
|
||||
trailx = thing->x + thing->radius;
|
||||
leadx = x - thing->radius;
|
||||
trailx = x + thing->radius;
|
||||
}
|
||||
|
||||
if (momy > 0)
|
||||
{
|
||||
leady = thing->y + thing->radius;
|
||||
traily = thing->y - thing->radius;
|
||||
leady = y + thing->radius;
|
||||
traily = y - thing->radius;
|
||||
}
|
||||
else
|
||||
{
|
||||
leady = thing->y - thing->radius;
|
||||
traily = thing->y + thing->radius;
|
||||
leady = y - thing->radius;
|
||||
traily = y + thing->radius;
|
||||
}
|
||||
|
||||
P_PathTraverse(leadx, leady, leadx + momx, leady + momy, PT_ADDLINES, PTR_GetSpecialLines);
|
||||
|
|
|
|||
10
src/p_mobj.c
10
src/p_mobj.c
|
|
@ -3751,7 +3751,7 @@ static void P_PlayerMobjThinker(mobj_t *mobj)
|
|||
|
||||
// Zoom tube
|
||||
if ((mobj->tracer && mobj->tracer->type == MT_TUBEWAYPOINT)
|
||||
|| (mobj->player->respawnvars.respawnstate == RESPAWNST_MOVE))
|
||||
|| (mobj->player->respawn.state == RESPAWNST_MOVE))
|
||||
{
|
||||
P_HitSpecialLines(mobj, mobj->x, mobj->y, mobj->momx, mobj->momy);
|
||||
P_UnsetThingPosition(mobj);
|
||||
|
|
@ -12042,7 +12042,7 @@ void P_MovePlayerToSpawn(INT32 playernum, mapthing_t *mthing)
|
|||
else
|
||||
z = floor;
|
||||
|
||||
if (p->respawnvars.respawnstate != RESPAWNST_NONE)
|
||||
if (p->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
z += K_RespawnOffset(p, (mthing->options & MTF_OBJECTFLIP));
|
||||
}
|
||||
|
|
@ -12082,8 +12082,8 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
K_DoIngameRespawn(p);
|
||||
|
||||
P_UnsetThingPosition(mobj);
|
||||
mobj->x = p->respawnvars.pointx;
|
||||
mobj->y = p->respawnvars.pointy;
|
||||
mobj->x = p->respawn.pointx;
|
||||
mobj->y = p->respawn.pointy;
|
||||
P_SetThingPosition(mobj);
|
||||
sector = R_PointInSubsector(mobj->x, mobj->y)->sector;
|
||||
|
||||
|
|
@ -12098,7 +12098,7 @@ void P_MovePlayerToStarpost(INT32 playernum)
|
|||
#endif
|
||||
sector->ceilingheight;
|
||||
|
||||
z = p->respawnvars.pointz;
|
||||
z = p->respawn.pointz;
|
||||
|
||||
if (z < floor)
|
||||
z = floor;
|
||||
|
|
|
|||
|
|
@ -141,10 +141,6 @@ static void P_NetArchivePlayers(void)
|
|||
|
||||
for (j = 0; j < NUMPOWERS; j++)
|
||||
WRITEUINT16(save_p, players[i].powers[j]);
|
||||
for (j = 0; j < NUMKARTSTUFF; j++)
|
||||
WRITEINT32(save_p, players[i].kartstuff[j]);
|
||||
|
||||
WRITEANGLE(save_p, players[i].frameangle);
|
||||
|
||||
WRITEUINT8(save_p, players[i].playerstate);
|
||||
WRITEUINT32(save_p, players[i].pflags);
|
||||
|
|
@ -270,15 +266,30 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT8(save_p, players[i].kartweight);
|
||||
//
|
||||
|
||||
for (j = 0; j < NUMKARTSTUFF; j++)
|
||||
WRITEINT32(save_p, players[i].kartstuff[j]);
|
||||
|
||||
for (j = 0; j < MAXPREDICTTICS; j++)
|
||||
{
|
||||
WRITEINT16(save_p, players[i].lturn_max[j]);
|
||||
WRITEINT16(save_p, players[i].rturn_max[j]);
|
||||
}
|
||||
|
||||
WRITEANGLE(save_p, players[i].frameangle);
|
||||
WRITEUINT32(save_p, players[i].distancetofinish);
|
||||
WRITEUINT32(save_p, K_GetWaypointHeapIndex(players[i].nextwaypoint));
|
||||
WRITEUINT32(save_p, players[i].airtime);
|
||||
|
||||
// respawnvars_t
|
||||
WRITEUINT8(save_p, players[i].respawn.state);
|
||||
WRITEUINT32(save_p, K_GetWaypointHeapIndex(players[i].respawn.wp));
|
||||
WRITEFIXED(save_p, players[i].respawn.pointx);
|
||||
WRITEFIXED(save_p, players[i].respawn.pointy);
|
||||
WRITEFIXED(save_p, players[i].respawn.pointz);
|
||||
WRITEUINT8(save_p, players[i].respawn.flip);
|
||||
WRITEUINT32(save_p, players[i].respawn.timer);
|
||||
WRITEUINT32(save_p, players[i].respawn.distanceleft);
|
||||
WRITEUINT32(save_p, players[i].respawn.dropdash);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -316,10 +327,6 @@ static void P_NetUnArchivePlayers(void)
|
|||
|
||||
for (j = 0; j < NUMPOWERS; j++)
|
||||
players[i].powers[j] = READUINT16(save_p);
|
||||
for (j = 0; j < NUMKARTSTUFF; j++)
|
||||
players[i].kartstuff[j] = READINT32(save_p);
|
||||
|
||||
players[i].frameangle = READANGLE(save_p);
|
||||
|
||||
players[i].playerstate = READUINT8(save_p);
|
||||
players[i].pflags = READUINT32(save_p);
|
||||
|
|
@ -436,15 +443,30 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].kartweight = READUINT8(save_p);
|
||||
//
|
||||
|
||||
for (j = 0; j < NUMKARTSTUFF; j++)
|
||||
players[i].kartstuff[j] = READINT32(save_p);
|
||||
|
||||
for (j = 0; j < MAXPREDICTTICS; j++)
|
||||
{
|
||||
players[i].lturn_max[j] = READINT16(save_p);
|
||||
players[i].rturn_max[j] = READINT16(save_p);
|
||||
}
|
||||
|
||||
players[i].frameangle = READANGLE(save_p);
|
||||
players[i].distancetofinish = READUINT32(save_p);
|
||||
players[i].nextwaypoint = (waypoint_t *)(size_t)READUINT32(save_p);
|
||||
players[i].airtime = READUINT32(save_p);
|
||||
|
||||
// respawnvars_t
|
||||
players[i].respawn.state = READUINT8(save_p);
|
||||
players[i].respawn.wp = (waypoint_t *)(size_t)READUINT32(save_p);
|
||||
players[i].respawn.pointx = READFIXED(save_p);
|
||||
players[i].respawn.pointy = READFIXED(save_p);
|
||||
players[i].respawn.pointz = READFIXED(save_p);
|
||||
players[i].respawn.flip = (boolean)READUINT8(save_p);
|
||||
players[i].respawn.timer = READUINT32(save_p);
|
||||
players[i].respawn.distanceleft = READUINT32(save_p);
|
||||
players[i].respawn.dropdash = READUINT32(save_p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,9 +95,9 @@ void P_MixUp(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
|
|||
thing->player->speed = 0;
|
||||
|
||||
// Starpost information
|
||||
thing->player->respawnvars.pointx = starpostx;
|
||||
thing->player->respawnvars.pointy = starposty;
|
||||
thing->player->respawnvars.pointz = starpostz;
|
||||
thing->player->respawn.pointx = starpostx;
|
||||
thing->player->respawn.pointy = starposty;
|
||||
thing->player->respawn.pointz = starpostz;
|
||||
thing->player->starpostnum = starpostnum;
|
||||
|
||||
P_ResetPlayer(thing->player);
|
||||
|
|
|
|||
|
|
@ -5773,7 +5773,7 @@ static void P_MovePlayer(player_t *player)
|
|||
// Kart: store the current turn range for later use
|
||||
if ((player->mo && player->speed > 0) // Moving
|
||||
|| (leveltime > starttime && (cmd->buttons & BT_ACCELERATE && cmd->buttons & BT_BRAKE)) // Rubber-burn turn
|
||||
|| (player->respawnvars.respawnstate != RESPAWNST_NONE) // Respawning
|
||||
|| (player->respawn.state != RESPAWNST_NONE) // Respawning
|
||||
|| (player->spectator || objectplacing)) // Not a physical player
|
||||
{
|
||||
player->lturn_max[leveltime%MAXPREDICTTICS] = K_GetKartTurnValue(player, KART_FULLTURN)+1;
|
||||
|
|
@ -8604,12 +8604,12 @@ void P_PlayerThink(player_t *player)
|
|||
player->linkcount = 0;
|
||||
}
|
||||
|
||||
if (player->respawnvars.respawnstate != RESPAWNST_NONE)
|
||||
if (player->respawn.state != RESPAWNST_NONE)
|
||||
{
|
||||
K_RespawnChecker(player);
|
||||
player->rmomx = player->rmomy = 0;
|
||||
|
||||
if (player->respawnvars.respawnstate == RESPAWNST_DROP)
|
||||
if (player->respawn.state == RESPAWNST_DROP)
|
||||
{
|
||||
// Allows some turning
|
||||
P_MovePlayer(player);
|
||||
|
|
@ -8808,7 +8808,7 @@ void P_PlayerThink(player_t *player)
|
|||
if (!(//player->pflags & PF_NIGHTSMODE ||
|
||||
player->kartstuff[k_hyudorotimer] // SRB2kart - fixes Hyudoro not flashing when it should.
|
||||
|| player->kartstuff[k_growshrinktimer] > 0 // Grow doesn't flash either.
|
||||
|| (player->respawnvars.respawnstate != RESPAWNST_NONE) // Respawn timer (for drop dash effect)
|
||||
|| (player->respawn.state != RESPAWNST_NONE) // Respawn timer (for drop dash effect)
|
||||
|| (player->pflags & PF_TIMEOVER) // NO CONTEST explosion
|
||||
|| (G_BattleGametype() && player->kartstuff[k_bumper] <= 0 && player->kartstuff[k_comebacktimer])
|
||||
|| leveltime < starttime)) // Level intro
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue