]> git.mxchange.org Git - quix0rs-blobwars.git/blobdiff - src/mapEditor.cpp
Fix compilation of the mapEditor.
[quix0rs-blobwars.git] / src / mapEditor.cpp
index 037715620c4b3e26549f39ac806758a640a4e549..edcf430dfc99f6562cac5678a7b2f5d4fadd9a61 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
@@ -20,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "mapEditor.h"
 
+MedalServer medalServer;
 Config config;
 ReplayData replayData;
 
@@ -60,7 +62,7 @@ void showMap(int *mapX, int *mapY)
 {
        SDL_FillRect(graphics.screen, NULL, graphics.black);
 
-       engine.keyState[SDLK_SPACE] = 0;
+       engine.keyState[SDL_SCANCODE_SPACE] = 0;
        int moveTimer = 0;
 
        while (true)
@@ -69,7 +71,7 @@ void showMap(int *mapX, int *mapY)
                engine.getInput();
                config.populate();
 
-               if (engine.keyState[SDLK_SPACE])
+               if (engine.keyState[SDL_SCANCODE_SPACE])
                        break;
                        
                for (int x = 0 ; x < MAPWIDTH ; x++)
@@ -99,16 +101,16 @@ void showMap(int *mapX, int *mapY)
 
                if (moveTimer == 0)
                {
-                       if (engine.keyState[SDLK_LEFT])
+                       if (engine.keyState[SDL_SCANCODE_LEFT])
                                *mapX -= 1;
 
-                       if (engine.keyState[SDLK_RIGHT])
+                       if (engine.keyState[SDL_SCANCODE_RIGHT])
                                *mapX += 1;
 
-                       if (engine.keyState[SDLK_UP])
+                       if (engine.keyState[SDL_SCANCODE_UP])
                                *mapY -= 1;
 
-                       if (engine.keyState[SDLK_DOWN])
+                       if (engine.keyState[SDL_SCANCODE_DOWN])
                                *mapY += 1;
                }
 
@@ -123,7 +125,7 @@ void showMap(int *mapX, int *mapY)
                SDL_Delay(16);
        }
 
-       engine.keyState[SDLK_SPACE] = 0;
+       engine.keyState[SDL_SCANCODE_SPACE] = 0;
 }
 
 int nextBlock(int current, int dir)
@@ -267,7 +269,7 @@ void collectMapData()
                if (!strstr(string, " ENEMY \""))
                {
                        str = new String;
-                       strncpy(str->string, string, sizeof str->string);
+                       strlcpy(str->string, string, sizeof str->string);
                        stringTail->next = str;
                        stringTail = str;
                }
@@ -319,7 +321,7 @@ void newMap(const char *name)
 
                fprintf(fp, "EMH TILESET gfx/grasslands\n");
                fprintf(fp, "EMH BACKGROUND gfx/grasslands/stone.jpg\n");
-               fprintf(fp, "EMH MUSIC music/viking.mod\n");
+               fprintf(fp, "EMH MUSIC music/tunnel\n");
 
                fprintf(fp, "EMH ALPHATILES 1 2 3 200 201 202 203 204 244 245 246 -1\n");
 
@@ -363,7 +365,7 @@ void addTileDecoration()
                }
        }
        
-       engine.keyState[SDLK_F1] = 0;
+       engine.keyState[SDL_SCANCODE_F1] = 0;
 }
 
 void fillHorizontal(int block, int x, int y)
@@ -550,26 +552,26 @@ int main(int argc, char *argv[])
 
                if (allowMove == 0)
                {
-                       if (engine.keyState[SDLK_UP]) {mapY--; allowMove = MOVESPEED;}
-                       if (engine.keyState[SDLK_DOWN]) {mapY++; allowMove = MOVESPEED;}
-                       if (engine.keyState[SDLK_LEFT]) {mapX--; allowMove = MOVESPEED;}
-                       if (engine.keyState[SDLK_RIGHT]) {mapX++; allowMove = MOVESPEED;}
+                       if (engine.keyState[SDL_SCANCODE_UP]) {mapY--; allowMove = MOVESPEED;}
+                       if (engine.keyState[SDL_SCANCODE_DOWN]) {mapY++; allowMove = MOVESPEED;}
+                       if (engine.keyState[SDL_SCANCODE_LEFT]) {mapX--; allowMove = MOVESPEED;}
+                       if (engine.keyState[SDL_SCANCODE_RIGHT]) {mapX++; allowMove = MOVESPEED;}
 
-                       if (engine.keyState[SDLK_PAGEDOWN]) {mapY += 10; allowMove = MOVESPEED;}
-                       if (engine.keyState[SDLK_PAGEUP]) {mapY -= 10; allowMove = MOVESPEED;}
+                       if (engine.keyState[SDL_SCANCODE_PAGEDOWN]) {mapY += 10; allowMove = MOVESPEED;}
+                       if (engine.keyState[SDL_SCANCODE_PAGEUP]) {mapY -= 10; allowMove = MOVESPEED;}
 
-                       if (engine.keyState[SDLK_1]) editing = 0;
-                       if (engine.keyState[SDLK_2]) editing = 1;
-                       if (engine.keyState[SDLK_3]) editing = 2;
+                       if (engine.keyState[SDL_SCANCODE_1]) editing = 0;
+                       if (engine.keyState[SDL_SCANCODE_2]) editing = 1;
+                       if (engine.keyState[SDL_SCANCODE_3]) editing = 2;
                        
-                       if (engine.keyState[SDLK_0]) fillHorizontal(currentBlock, mapX + x, mapY + y);
+                       if (engine.keyState[SDL_SCANCODE_0]) fillHorizontal(currentBlock, mapX + x, mapY + y);
 
-                       if (engine.keyState[SDLK_F1]) addTileDecoration();
+                       if (engine.keyState[SDL_SCANCODE_F1]) addTileDecoration();
 
-                       if (engine.keyState[SDLK_ESCAPE]) break;
+                       if (engine.keyState[SDL_SCANCODE_ESCAPE]) break;
                }
 
-               if (engine.keyState[SDLK_PERIOD])
+               if (engine.keyState[SDL_SCANCODE_PERIOD])
                {
                        switch (editing)
                        {
@@ -584,10 +586,10 @@ int main(int argc, char *argv[])
                                        break;
                        }
 
-                       engine.keyState[SDLK_PERIOD] = 0;
+                       engine.keyState[SDL_SCANCODE_PERIOD] = 0;
                }
 
-               if (engine.keyState[SDLK_COMMA])
+               if (engine.keyState[SDL_SCANCODE_COMMA])
                {
                        switch (editing)
                        {
@@ -602,7 +604,7 @@ int main(int argc, char *argv[])
                                        break;
                        }
 
-                       engine.keyState[SDLK_COMMA] = 0;
+                       engine.keyState[SDL_SCANCODE_COMMA] = 0;
                }
 
                Math::limitInt(&currentMonster, 0, MAX_ENEMIES - 1);
@@ -614,9 +616,9 @@ int main(int argc, char *argv[])
                if (defItem[currentItem].sprite[0] == NULL)
                        currentItem = 0;
 
-               if (engine.keyState[SDLK_SPACE]) {showMap(&mapX, &mapY);}
+               if (engine.keyState[SDL_SCANCODE_SPACE]) {showMap(&mapX, &mapY);}
 
-               if (engine.keyState[SDLK_s]) {saveMap(game.mapName); engine.keyState[SDLK_s] = 0;}
+               if (engine.keyState[SDL_SCANCODE_S]) {saveMap(game.mapName); engine.keyState[SDL_SCANCODE_S] = 0;}
 
                if (mapX < 0) mapX = 0;
                if (mapY < 0) mapY = 0;