]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/items.cpp
Added .gitignore to ignore certain files + fixed access rights on Makefile* as
[quix0rs-blobwars.git] / src / items.cpp
index 4c28235a3c4073832c949a215443a23be7a407fb..5b78d4a1a3b568708ac21e2ac4608ca596eff332 100644 (file)
@@ -235,7 +235,7 @@ void pickUpItem(Entity *item)
                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:
@@ -245,18 +245,18 @@ void pickUpItem(Entity *item)
                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;
        }
 
@@ -362,13 +362,10 @@ void showCarriedItems()
 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;
                
@@ -377,8 +374,8 @@ void doItems()
                        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();