/*
-Copyright (C) 2004 Parallel Realities
+Copyright (C) 2004-2011 Parallel Realities
+Copyright (C) 2011-2015 Perpendicular Dimensions
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
case ITEM_SPREAD:
player.currentWeapon = &weapon[item->id];
game.currentWeapon = item->id;
- audio.playSound(SND_GETWEAPON, CH_ITEM);
+ audio.playSound(SND_GETWEAPON, CH_ITEM, item->x);
break;
case ITEM_POINTS:
case ITEM_POINTS2:
case ITEM_POINTS6:
case ITEM_POINTS7:
addPlayerScore(item->value);
- audio.playSound(SND_ITEM, CH_ITEM);
+ audio.playSound(SND_ITEM, CH_ITEM, item->x);
break;
case ITEM_CHERRY:
case ITEM_DOUBLECHERRY:
case ITEM_TRIPLECHERRY:
Math::limitInt(&(player.health += item->value), 0, MAX_HEALTH);
- audio.playSound(SND_GULP + (Math::prand() % 2), CH_ITEM);
+ audio.playSound(SND_GULP + (Math::prand() % 2), CH_ITEM, item->x);
break;
case ITEM_MISC:
item->owner = &player;
case ITEM_MISC_NOSHOW:
- audio.playSound(SND_ITEM, CH_ITEM);
+ audio.playSound(SND_ITEM, CH_ITEM, item->x);
break;
}
case 'o':
case 'U':
case 'u':
- sprintf(string, _("Picked up an %s"), item->name);
+ snprintf(string, sizeof string, _("Picked up an %s"), item->name);
break;
default:
- sprintf(string, _("Picked up a %s"), item->name);
+ snprintf(string, sizeof string, _("Picked up a %s"), item->name);
break;
}
void doItems()
{
Entity *item = (Entity*)map.itemList.getHead();
- Entity *previous = item;
-
- int x, y;
while (item->next != NULL)
{
- previous = item;
+ Entity *previous = item;
item = (Entity*)item->next;
continue;
}
- x = (int)(item->x - engine.playerPosX);
- y = (int)(item->y - engine.playerPosY);
+ int x = (int)(item->x - engine.playerPosX);
+ int y = (int)(item->y - engine.playerPosY);
item->think();