mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Add S-Monitor power-up
- Give Invincibility effect to player - Bumping players does not extend Invincibility time while power-up is active
This commit is contained in:
parent
299a8b707c
commit
b0b7bf8185
5 changed files with 35 additions and 1 deletions
|
|
@ -463,6 +463,7 @@ typedef struct {
|
|||
|
||||
// player_t struct for power-ups
|
||||
struct powerupvars_t {
|
||||
UINT16 superTimer;
|
||||
mobj_t *flickyController;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8090,6 +8090,11 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
if (player->powerup.superTimer > 0)
|
||||
{
|
||||
player->powerup.superTimer--;
|
||||
}
|
||||
|
||||
if (player->guardCooldown)
|
||||
player->guardCooldown--;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ tic_t K_PowerUpRemaining(const player_t* player, kartitems_t powerup)
|
|||
{
|
||||
switch (powerup)
|
||||
{
|
||||
case POWERUP_SMONITOR:
|
||||
return player->powerup.superTimer;
|
||||
|
||||
case POWERUP_SUPERFLICKY:
|
||||
return Obj_SuperFlickySwarmTime(player->powerup.flickyController);
|
||||
|
||||
|
|
@ -20,6 +23,11 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
|
|||
{
|
||||
switch (powerup)
|
||||
{
|
||||
case POWERUP_SMONITOR:
|
||||
K_DoInvincibility(player, time);
|
||||
player->powerup.superTimer += time;
|
||||
break;
|
||||
|
||||
case POWERUP_SUPERFLICKY:
|
||||
if (K_PowerUpRemaining(player, POWERUP_SUPERFLICKY))
|
||||
{
|
||||
|
|
@ -38,6 +46,19 @@ void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
|
|||
|
||||
void K_DropPowerUps(player_t* player)
|
||||
{
|
||||
auto simple_drop = [player](kartitems_t powerup, auto& timer)
|
||||
{
|
||||
tic_t remaining = K_PowerUpRemaining(player, powerup);
|
||||
|
||||
if (remaining)
|
||||
{
|
||||
K_DropPaperItem(player, powerup, remaining);
|
||||
timer = 0;
|
||||
}
|
||||
};
|
||||
|
||||
simple_drop(POWERUP_SMONITOR, player->powerup.superTimer);
|
||||
|
||||
if (K_PowerUpRemaining(player, POWERUP_SUPERFLICKY))
|
||||
{
|
||||
mobj_t* swarm = player->powerup.flickyController;
|
||||
|
|
|
|||
|
|
@ -2418,7 +2418,8 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
if (source && source != player->mo && source->player)
|
||||
{
|
||||
// Extend the invincibility if the hit was a direct hit.
|
||||
if (inflictor == source && source->player->invincibilitytimer)
|
||||
if (inflictor == source && source->player->invincibilitytimer &&
|
||||
!K_PowerUpRemaining(player, POWERUP_SMONITOR))
|
||||
{
|
||||
tic_t kinvextend;
|
||||
|
||||
|
|
|
|||
|
|
@ -634,6 +634,9 @@ static void P_NetArchivePlayers(savebuffer_t *save)
|
|||
// ACS has read access to this, so it has to be net-communicated.
|
||||
// It is the ONLY roundcondition that is sent over the wire and I'd like it to stay that way.
|
||||
WRITEUINT32(save->p, players[i].roundconditions.unlocktriggers);
|
||||
|
||||
// powerupvars_t
|
||||
WRITEUINT16(save->p, players[i].powerup.superTimer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1059,6 +1062,9 @@ static void P_NetUnArchivePlayers(savebuffer_t *save)
|
|||
// It is the ONLY roundcondition that is sent over the wire and I'd like it to stay that way.
|
||||
players[i].roundconditions.unlocktriggers = READUINT32(save->p);
|
||||
|
||||
// powerupvars_t
|
||||
players[i].powerup.superTimer = READUINT16(save->p);
|
||||
|
||||
//players[i].viewheight = P_GetPlayerViewHeight(players[i]); // scale cannot be factored in at this point
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue