mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-02-20 19:02:37 +00:00
Don't allow the player to respawn on a mapthing if it will collide them with another player
Mainly effects battle where match starts are used, race will be effected at the beginning of races though
This commit is contained in:
parent
890637c4ab
commit
1f6877e1e7
3 changed files with 26 additions and 0 deletions
|
@ -2411,6 +2411,9 @@ static boolean G_CheckSpot(INT32 playernum, mapthing_t *mthing)
|
|||
if (!P_CheckPosition(players[playernum].mo, x, y))
|
||||
return false;
|
||||
|
||||
if (!K_CheckPlayersRespawnColliding(playernum, x, y))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
22
src/k_kart.c
22
src/k_kart.c
|
@ -2475,6 +2475,28 @@ void K_DoBouncePad(player_t *player, fixed_t vertispeed)
|
|||
S_StartSound(player->mo, sfx_boing);
|
||||
}
|
||||
|
||||
// Returns false if this player being placed here causes them to collide with any other player
|
||||
// Used in g_game.c for match etc. respawning
|
||||
// This does not check along the z because the z is not correctly set for the spawnee at this point
|
||||
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y)
|
||||
{
|
||||
INT32 i;
|
||||
fixed_t p1radius = players[playernum].mo->radius;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playernum == i || !playeringame[i] || players[i].spectator || !players[i].mo || players[i].mo->health <= 0
|
||||
|| players[i].playerstate != PST_LIVE || (players[i].mo->flags & MF_NOCLIP) || (players[i].mo->flags & MF_NOCLIPTHING))
|
||||
continue;
|
||||
|
||||
if (abs(x - players[i].mo->x) < (p1radius + players[i].mo->radius)
|
||||
&& abs(y - players[i].mo->y) < (p1radius + players[i].mo->radius))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// countersteer is how strong the controls are telling us we are turning
|
||||
// turndir is the direction the controls are telling us to turn, -1 if turning right and 1 if turning left
|
||||
static INT16 K_GetKartDriftValue(player_t *player, fixed_t countersteer)
|
||||
|
|
|
@ -27,6 +27,7 @@ void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32
|
|||
void K_SpawnDriftTrail(player_t *player);
|
||||
void K_DoMushroom(player_t *player, boolean doPFlag, boolean startboost);
|
||||
void K_DoBouncePad(player_t *player, fixed_t vertispeed);
|
||||
boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y);
|
||||
INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue);
|
||||
void K_MomentumToFacing(player_t *player);
|
||||
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower);
|
||||
|
|
Loading…
Reference in a new issue