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