mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Sealed Star Emeralds retarget when their carrier dies
This commit is contained in:
parent
20d6dcda88
commit
162591efdb
1 changed files with 28 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
|||
#include "../r_main.h"
|
||||
#include "../s_sound.h"
|
||||
#include "../tables.h"
|
||||
#include "../g_game.h"
|
||||
|
||||
#define emerald_type(o) ((o)->extravalue1)
|
||||
#define emerald_anim_start(o) ((o)->movedir)
|
||||
|
|
@ -126,6 +127,33 @@ static void Obj_EmeraldOrbitPlayer(mobj_t *emerald)
|
|||
fixed_t x = FixedMul(r, FCOS(emerald->angle));
|
||||
fixed_t y = FixedMul(r, FSIN(emerald->angle));
|
||||
|
||||
// Multiplayer Sealed Stars can become unwinnable if someone deathpits with the emerald. Find a player to retarget!
|
||||
if ((gametyperules & GTR_CATCHER) && emerald_orbit(emerald)->player && (emerald_orbit(emerald)->player->pflags & PF_NOCONTEST))
|
||||
{
|
||||
player_t *bestplayer = emerald_orbit(emerald)->player;
|
||||
|
||||
for (int i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (!playeringame[i])
|
||||
continue;
|
||||
if (players[i].spectator)
|
||||
continue;
|
||||
if (players[i].pflags & PF_NOCONTEST)
|
||||
continue;
|
||||
if (!(players[i].mo && !P_MobjWasRemoved(players[i].mo)))
|
||||
continue;
|
||||
if ((bestplayer->pflags & PF_NOCONTEST) || (players[i].distancetofinish < bestplayer->distancetofinish))
|
||||
bestplayer = &players[i];
|
||||
}
|
||||
|
||||
if (!(bestplayer->pflags & PF_NOCONTEST))
|
||||
{
|
||||
P_MoveOrigin(emerald, bestplayer->mo->x, bestplayer->mo->y, bestplayer->mo->z);
|
||||
Obj_BeginEmeraldOrbit(emerald, bestplayer->mo, 100 * mapobjectscale, 64, 0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
P_MoveOrigin(
|
||||
emerald,
|
||||
emerald_orbit(emerald)->x + x,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue