- port from NBlood: Show all available powerups in HUD.

This commit is contained in:
Christoph Oelckers 2020-11-23 07:49:36 +01:00
parent 3f14886830
commit 6b889cbb77

View file

@ -262,14 +262,15 @@ private:
//---------------------------------------------------------------------------
//
// ok
//
//
//---------------------------------------------------------------------------
enum { nPowerUps = 11 };
void sortPowerUps(POWERUPDISPLAY* powerups) {
for (int i = 1; i < 5; i++)
for (int i = 1; i < nPowerUps; i++)
{
for (int j = 0; j < 5 - i; j++)
for (int j = 0; j < nPowerUps - i; j++)
{
if (powerups[j].remainingDuration > powerups[j + 1].remainingDuration)
{
@ -292,28 +293,27 @@ private:
if (!hud_powerupduration)
return;
// NoOne to author: the following powerups can be safely added in this list:
// kPwUpFeatherFall - (used in some user addons, makes player immune to fall damage)
// kPwUpGasMask - (used in some user addons, makes player immune to choke damage)
// kPwUpDoppleganger - (works in multiplayer, it swaps player's team colors, so enemy team player thinks it's a team mate)
// kPwUpAsbestArmor - (used in some user addons, makes player immune to fire damage and draws hud)
// kPwUpGrowShroom - (grows player size, works only if gModernMap == true)
// kPwUpShrinkShroom - (shrinks player size, works only if gModernMap == true)
POWERUPDISPLAY powerups[nPowerUps];
powerups[0] = { gPowerUpInfo[kPwUpShadowCloak].picnum, 0.4f, 0, pPlayer->pwUpTime[kPwUpShadowCloak] }; // Invisibility
powerups[1] = { gPowerUpInfo[kPwUpReflectShots].picnum, 0.4f, 5, pPlayer->pwUpTime[kPwUpReflectShots] }; // Reflects enemy shots
powerups[2] = { gPowerUpInfo[kPwUpDeathMask].picnum, 0.3f, 9, pPlayer->pwUpTime[kPwUpDeathMask] }; // Invulnerability
powerups[3] = { gPowerUpInfo[kPwUpTwoGuns].picnum, 0.3f, 5, pPlayer->pwUpTime[kPwUpTwoGuns] }; // Guns Akimbo
powerups[4] = { gPowerUpInfo[kPwUpShadowCloakUseless].picnum, 0.4f, 9, pPlayer->pwUpTime[kPwUpShadowCloakUseless] }; // Does nothing, only appears at near the end of Cryptic Passage's Lost Monastery (CP04)
POWERUPDISPLAY powerups[5];
powerups[0] = { gPowerUpInfo[kPwUpShadowCloak].picnum, 0.4f, 0, pPlayer->pwUpTime[kPwUpShadowCloak] }; // invisibility
powerups[1] = { gPowerUpInfo[kPwUpReflectShots].picnum, 0.4f, 5, pPlayer->pwUpTime[kPwUpReflectShots] };
powerups[2] = { gPowerUpInfo[kPwUpDeathMask].picnum, 0.3f, 9, pPlayer->pwUpTime[kPwUpDeathMask] }; // invulnerability
powerups[3] = { gPowerUpInfo[kPwUpTwoGuns].picnum, 0.3f, 5, pPlayer->pwUpTime[kPwUpTwoGuns] };
// does nothing, only appears at near the end of Cryptic Passage's Lost Monastery (CP04)
powerups[4] = { gPowerUpInfo[kPwUpShadowCloakUseless].picnum, 0.4f, 9, pPlayer->pwUpTime[kPwUpShadowCloakUseless] };
// Not in official maps, but custom maps can use them
powerups[5] = { gPowerUpInfo[kPwUpFeatherFall].picnum, 0.3f, 7, pPlayer->pwUpTime[kPwUpFeatherFall] }; // Makes player immune to fall damage
powerups[6] = { gPowerUpInfo[kPwUpGasMask].picnum, 0.4f, 4, pPlayer->pwUpTime[kPwUpGasMask] }; // Makes player immune to choke damage
powerups[7] = { gPowerUpInfo[kPwUpDoppleganger].picnum, 0.5f, 5, pPlayer->pwUpTime[kPwUpDoppleganger] }; // Works in multiplayer, it swaps player's team colors, so enemy team player thinks it's a team mate
powerups[8] = { gPowerUpInfo[kPwUpAsbestArmor].picnum, 0.3f, 9, pPlayer->pwUpTime[kPwUpAsbestArmor] }; // Makes player immune to fire damage and draws HUD
powerups[9] = { gPowerUpInfo[kPwUpGrowShroom].picnum, 0.4f, 4, pPlayer->pwUpTime[kPwUpGrowShroom] }; // Grows player size, works only if gModernMap == true
powerups[10] = { gPowerUpInfo[kPwUpShrinkShroom].picnum, 0.4f, 4, pPlayer->pwUpTime[kPwUpShrinkShroom] }; // Shrinks player size, works only if gModernMap == true
sortPowerUps(powerups);
const int warningTime = 5;
const int x = 15;
int y = -50;
for (int i = 0; i < 5; i++)
for (int i = 0; i < nPowerUps; i++)
{
if (powerups[i].remainingDuration)
{