]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/map.cpp
Added .gitignore to ignore certain files + fixed access rights on Makefile* as
[quix0rs-blobwars.git] / src / map.cpp
index d0206ccc524584e33f0ab6487fa336c89cd52daf..45559d3959ac9d70491aafddd9bc55246a436d28 100644 (file)
@@ -298,8 +298,6 @@ void showMap(int centerX, int centerY)
        
        graphics.blit(background, 0, 0, panel, false);
        
-       int color = graphics.black;
-       
        for (int y = 0 ; y < 48 ; y++)
        {
                for (int x = 0 ; x < 64 ; x++)
@@ -317,15 +315,15 @@ void showMap(int centerX, int centerY)
        {
                for (int x = 0 ; x < 64 ; x++)
                {
-                       color = -1;
+                       int color = graphics.black;
 
                        if (map.data[x1 + x][y1 + y] == MAP_AIR)
                        {
-                               color = -1;
+                               color = graphics.black;
                        }
                        else if (map.data[x1 + x][y1 + y] == MAP_WATER)
                        {
-                               color = -1;
+                               color = graphics.black;
                        }
                        else if (map.data[x1 + x][y1 + y] == MAP_SLIME)
                        {
@@ -337,7 +335,7 @@ void showMap(int centerX, int centerY)
                        }
                        else if (map.data[x1 + x][y1 + y] >= MAP_DECORATION)
                        {
-                               color = -1;
+                               color = graphics.black;
                                
                                if (map.data[x1 + x][y1 + y - 1] == MAP_WATER)
                                {
@@ -353,7 +351,7 @@ void showMap(int centerX, int centerY)
                                color = graphics.darkGreen;
                        }
 
-                       if (color > -1)
+                       if (color != graphics.black)
                        {
                                graphics.drawRect(x * 5, y * 5, 5, 5, color, panel);
                        }
@@ -415,6 +413,9 @@ void showMap(int centerX, int centerY)
 
                if ((config.isControl(CONTROL::MAP)) || (config.isControl(CONTROL::PAUSE)) || (engine.keyState[SDL_SCANCODE_ESCAPE]))
                {
+                       engine.keyState[SDL_SCANCODE_ESCAPE] = 0;
+                       config.resetControl(CONTROL::MAP);
+                       config.resetControl(CONTROL::PAUSE);
                        break;
                }
 
@@ -512,7 +513,7 @@ void evaluateMapAttribute(Entity *ent, int mapAttribute)
                                        
                                        if (ent->dy < 0)
                                        {
-                                               audio.playSound(SND_WATEROUT, CH_TOUCH);
+                                               audio.playSound(SND_WATEROUT, CH_TOUCH, ent->x);
                                        }
 
                                        ent->checkEnvironment();
@@ -529,7 +530,7 @@ void evaluateMapAttribute(Entity *ent, int mapAttribute)
 
                        if (ent->environment == ENV_AIR)
                        {
-                               audio.playSound(SND_WATERIN, CH_TOUCH);
+                               audio.playSound(SND_WATERIN, CH_TOUCH, ent->x);
                                if ((mapAttribute == MAP_SLIME) || (mapAttribute == MAP_LAVA))
                                        ent->thinktime = 1;
                        }