/////////////////////////
//ITEM CODE//
////////////////////////
if (player)
{
thinker_t *think;
mobj_t *mo;
for (think = thinkercap.next; think != &thinkercap; think = think->next)
{
if (think->function.acp1 != (actionf_p1)P_MobjThinker) // Eliminate anything except Mobjs
continue;
mo = (mobj_t *)think;
// If the mobj doesn't have any health, or if it's disappearing, ignore it.
if ((mo->health <= 0) || (mo->state == &states[S_DISS]))
continue;
// Ignore anything EXCEPT powerup items
if (mo->type != MT_FIREUP && mo->type != MT_BOMBUP && mo->type != MT_SPEEDUP && mo->type != MT_FULLFIRE)
continue;
// Out of range? Skip it.
if (P_AproxDistance(P_AproxDistance(player->mo->x-mo->x, player->mo->y-mo->y),
player->mo->z-mo->z) > 20*FRACUNIT)
continue;
P_KillMobj(mo, NULL, NULL);
S_StartSound(NULL, sfx_getitem);
if (mo->type == MT_FIREUP)
player->firepower += 1;
else if (mo->type == MT_BOMBUP)
player->bombcount += 1;
else if (mo->type == MT_SPEEDUP)
player->speedcount += 1;
else if (mo->type == MT_FULLFIRE)
player->firepower += 5;
}
}
// Cap the limit on the bomb, fire, and speed items.
if (player->bombcount >= MAXBOMBS)
player->bombcount = MAXBOMBS;
if (player->firepower >= MAXFIREPOWER)
player->firepower = MAXFIREPOWER;
if (player->speedcount >= MAXSPEED)
player->speedcount = MAXSPEED;
//////////////////////////////////////
//END OF ITEM CODE//
//////////////////////////////////////