- Exhumed: Clean up some more switch case statements in doPlayerItemPickups().

This commit is contained in:
Mitchell Richters 2023-03-24 22:39:50 +11:00
parent b99e2fa600
commit 935450251a

View file

@ -210,7 +210,9 @@ void doPlayerItemPickups(Player* const pPlayer)
case 11: // Bubble Nest case 11: // Bubble Nest
{ {
pPlayer->nAir += 10; pPlayer->nAir += 10;
if (pPlayer->nAir > 100) {
if (pPlayer->nAir > 100)
{
pPlayer->nAir = 100; // TODO - constant pPlayer->nAir = 100; // TODO - constant
} }
@ -224,75 +226,57 @@ void doPlayerItemPickups(Player* const pPlayer)
} }
case 12: // Still Beating Heart case 12: // Still Beating Heart
if (GrabItem(pPlayer->nPlayer, kItemHeart))
{ {
if (GrabItem(pPlayer->nPlayer, kItemHeart)) {
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break; break;
}
case 13: // Scarab amulet(Invicibility) case 13: // Scarab amulet(Invicibility)
if (GrabItem(pPlayer->nPlayer, kItemInvincibility))
{ {
if (GrabItem(pPlayer->nPlayer, kItemInvincibility)) {
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break; break;
}
case 14: // Severed Slave Hand(double damage) case 14: // Severed Slave Hand(double damage)
if (GrabItem(pPlayer->nPlayer, kItemDoubleDamage))
{ {
if (GrabItem(pPlayer->nPlayer, kItemDoubleDamage)) {
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break; break;
}
case 15: // Unseen eye(Invisibility) case 15: // Unseen eye(Invisibility)
if (GrabItem(pPlayer->nPlayer, kItemInvisibility))
{ {
if (GrabItem(pPlayer->nPlayer, kItemInvisibility)) {
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break; break;
}
case 16: // Torch case 16: // Torch
if (GrabItem(pPlayer->nPlayer, kItemTorch))
{ {
if (GrabItem(pPlayer->nPlayer, kItemTorch)) {
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break; break;
}
case 17: // Sobek Mask case 17: // Sobek Mask
if (GrabItem(pPlayer->nPlayer, kItemMask))
{ {
if (GrabItem(pPlayer->nPlayer, kItemMask)) {
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break; break;
}
case 19: // Extra Life case 19: // Extra Life
if (pPlayer->nLives < kMaxPlayerLives)
{ {
nSound = -1;
if (pPlayer->nLives >= kMaxPlayerLives) {
break;
}
pPlayer->nLives++; pPlayer->nLives++;
tintGreen = 32; tintGreen = 32;
tintRed = 32; tintRed = 32;
pickFlag |= kPickupDefaults; pickFlag |= kPickupDefaults;
} }
break;
// FIXME - lots of repeated code from here down!!
case 20: // sword pickup?? case 20: // sword pickup??
{ {
var_40 = 0; var_40 = 0;