]> 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 70279d9924dab9d1da5958b16fc6b3d18f1e818a..45559d3959ac9d70491aafddd9bc55246a436d28 100644 (file)
@@ -1,5 +1,6 @@
 /*
-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
@@ -293,12 +294,10 @@ void showMap(int centerX, int centerY)
        
        SDL_Surface *panel = graphics.createSurface(320, 240);
        SDL_Surface *background = graphics.loadImage("gfx/main/mapBackground.png");
-       SDL_SetAlpha(background, SDL_SRCALPHA|SDL_RLEACCEL, 130);
+       SDL_SetAlpha(background, 130);
        
        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++)
@@ -316,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)
                        {
@@ -336,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)
                                {
@@ -352,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);
                        }
@@ -393,13 +392,15 @@ void showMap(int centerX, int centerY)
        graphics.drawString(_("Enemies"), 430, 410, TXT_LEFT, graphics.screen);
 
        graphics.setFontSize(1);
-       sprintf(string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
+       snprintf(string, sizeof string, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
        graphics.drawString(string, 320, 60, TXT_CENTERED, graphics.screen);
        graphics.drawString(_("Press Button to Continue..."), 320, 450, TXT_CENTERED, graphics.screen);
 
        engine.flushInput();
        engine.clearInput();
 
+       doMusicInfo(-1);
+
        while (true)
        {
                engine.getInput();
@@ -410,8 +411,11 @@ void showMap(int centerX, int centerY)
                graphics.drawRect(160, 120, 320, 240, graphics.black, graphics.white, graphics.screen);
                graphics.blit(panel, 160, 120, graphics.screen, false);
 
-               if ((config.isControl(CONTROL::MAP)) || (config.isControl(CONTROL::PAUSE)) || (engine.keyState[SDLK_ESCAPE]))
+               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;
                }
 
@@ -509,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();
@@ -526,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;
                        }
@@ -647,7 +651,7 @@ void parseMapDataLine(const char *line, int y)
 
                while (true)
                {
-                       *line++;
+                       line++;
 
                        if (*line == ' ')
                                break;