Skip to content

Commit

Permalink
- Exhumed: Clean up first few switch case statements in `doPlayerItem…
Browse files Browse the repository at this point in the history
…Pickups()`.
  • Loading branch information
mjr4077au committed Mar 24, 2023
1 parent 48803b3 commit 7f4b9d2
Showing 1 changed file with 7 additions and 30 deletions.
37 changes: 7 additions & 30 deletions source/games/exhumed/src/playerpickups.cpp
Expand Up @@ -112,41 +112,37 @@ void doPlayerItemPickups(Player* const pPlayer)
switch (itemtype)
{
case 0: // Speed Loader
{
if (AddAmmo(pPlayer->nPlayer, 1, pPickupActor->spr.hitag))
{
nSound = StaticSound[kSoundAmmoPickup];
pickFlag |= kPickupDefaults;
}

break;
}

case 1: // Fuel Canister
{
if (AddAmmo(pPlayer->nPlayer, 3, pPickupActor->spr.hitag))
{
nSound = StaticSound[kSoundAmmoPickup];
pickFlag |= kPickupDefaults;
}
break;
}

case 2: // M - 60 Ammo Belt
{
if (AddAmmo(pPlayer->nPlayer, 2, pPickupActor->spr.hitag))
{
nSound = StaticSound[kSoundAmmoPickup];
CheckClip(pPlayer->nPlayer);
pickFlag |= kPickupDefaults;
}
break;
}

case 3: // Grenade
case 21:
case 49:
{
if (AddAmmo(pPlayer->nPlayer, 4, 1))
{
nSound = StaticSound[kSoundAmmoPickup];

if (!(pPlayer->nPlayerWeapons & 0x10))
{
pPlayer->nPlayerWeapons |= 0x10;
Expand All @@ -157,31 +153,14 @@ void doPlayerItemPickups(Player* const pPlayer)
{
pPickupActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
DestroyItemAnim(pPickupActor);

// loc_1BA74: - repeated block, see in default case
if (pPlayer->nPlayer == nLocalPlayer)
{
if (nItemText[statBase] > -1 && nTotalPlayers == 1)
{
pickupMessage(statBase);
}

TintPalette(tintRed * 4, tintGreen * 4, 0);

if (nSound > -1)
{
PlayLocalSound(nSound, 0);
}
}
break;
pickFlag |= kPickupOnConsole;
}
else
{
pickFlag |= kPickupDefaults;
}
}
break;
}

case 4: // Pickable item
case 9: // Pickable item
Expand All @@ -199,15 +178,13 @@ void doPlayerItemPickups(Player* const pPlayer)
case 38:
case 45:
case 52:
{
pickFlag |= kPickupDefaults;
}
break;

case 5: // Map
{
GrabMap();
pickFlag |= kPickupDefaults;
}
break;

case 6: // Berry Twig
{
Expand Down

0 comments on commit 7f4b9d2

Please sign in to comment.