mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
K_AnyPowerUpRemaining: return bit mask
This commit is contained in:
parent
8e23d66540
commit
6aa6b8c939
3 changed files with 8 additions and 4 deletions
|
|
@ -212,6 +212,8 @@ typedef enum
|
|||
NUMPOWERUPS = ENDOFPOWERUPS - FIRSTPOWERUP,
|
||||
} kartitems_t;
|
||||
|
||||
#define POWERUP_BIT(x) (1 << ((x) - FIRSTPOWERUP))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
KSHIELD_NONE = 0,
|
||||
|
|
|
|||
|
|
@ -27,17 +27,19 @@ tic_t K_PowerUpRemaining(const player_t* player, kartitems_t powerup)
|
|||
}
|
||||
}
|
||||
|
||||
boolean K_AnyPowerUpRemaining(const player_t* player)
|
||||
UINT32 K_AnyPowerUpRemaining(const player_t* player)
|
||||
{
|
||||
UINT32 mask = 0;
|
||||
|
||||
for (int k = FIRSTPOWERUP; k < ENDOFPOWERUPS; ++k)
|
||||
{
|
||||
if (K_PowerUpRemaining(player, static_cast<kartitems_t>(k)))
|
||||
{
|
||||
return true;
|
||||
mask |= POWERUP_BIT(k);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return mask;
|
||||
}
|
||||
|
||||
void K_GivePowerUp(player_t* player, kartitems_t powerup, tic_t time)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
tic_t K_PowerUpRemaining(const player_t *player, kartitems_t powerup);
|
||||
boolean K_AnyPowerUpRemaining(const player_t *player);
|
||||
UINT32 K_AnyPowerUpRemaining(const player_t *player); // returns POWERUP_BIT mask
|
||||
void K_GivePowerUp(player_t *player, kartitems_t powerup, tic_t timer);
|
||||
void K_DropPowerUps(player_t *player);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue