commit e3e0644e
VS config now has seperate gfx
git-svn-id: https://blockattack.svn.sourceforge.net/svnroot/blockattack/trunk@47 9d7177f8-192b-0410-8f35-a16a89829b06
Changed files
| A | Game/gfx/bVsGameConfig.png |
| M | source/code/block.make before |
| M | source/code/common.cc before |
| M | source/code/main.cpp before |
| M | source/code/mainVars.hpp before |
diff --git a/Game/gfx/bVsGameConfig.png b/Game/gfx/bVsGameConfig.png
new file mode 100755
index 0000000..f50a4ef
Binary files /dev/null and b/Game/gfx/bVsGameConfig.png differ
diff --git a/source/code/block.make b/source/code/block.make
index 98a8bb9..73a3f8b 100644
--- a/source/code/block.make
+++ b/source/code/block.make
@@ -5,6 +5,7 @@ CPP=g++
BASE_CFLAGS=-c $(shell sdl-config --cflags)
BASE_LIBS=$(shell sdl-config --libs) -lSDL_image -lSDL_mixer
+#For developement only
ifndef DEBUG
DEBUG=1
endif
@@ -13,10 +14,12 @@ ifndef NETWORK
NETWORK=1
endif
+#Never use the apstract fs, it is not implemented and just linking it breaks on some systems
ifndef USE_ABSTRACT_FS
USE_ABSTRACT_FS=0
endif
+#Compile with debug information or optimized.
ifeq ($(DEBUG),1)
BASE_CFLAGS += -g -DDEBUG=1
else
diff --git a/source/code/common.cc b/source/code/common.cc
index 2dd3a3d..40d8296 100644
--- a/source/code/common.cc
+++ b/source/code/common.cc
@@ -180,8 +180,8 @@ void Config::load()
while(!inFile.eof())
{
inFile >> key;
- if(key==previuskey)
- continue;
+ if(key==previuskey) //the last entry will be read 2 times if a linebreak is missing in the end
+ continue;
previuskey = key;
inFile.get(); //Read the space between the key and the content
inFile.getline(value,MAX_VAR_LENGTH);
@@ -211,13 +211,13 @@ void Config::save()
if(outFile)
{
- //outFile << statMap.size() << endl;
map<string,string>::iterator iter;
for(iter = configMap.begin(); iter != configMap.end(); iter++)
{
outFile << iter->first << " " << iter->second << endl;
}
- outFile << "\n";
+ outFile << "\n"; //The last entry in the file will be read double if a linebreak is missing
+ //This is checked on load too in case a user changes it himself.
}
}
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 7d218d9..d1e5664 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -189,6 +189,8 @@ void loadTheme(string themeName)
CONVERT(b2players);
reloadIMG(&bVsMode,themeName+"/bVsGame.png");
CONVERT(bVsMode);
+ reloadIMG(&bVsModeConfig,themeName+"/bVsGameConfig.png");
+ CONVERT(bVsModeConfig);
reloadIMG(&bPuzzle,themeName+"/bPuzzle.png");
CONVERT(bPuzzle);
reloadIMG(&bStageClear,themeName+"/bStageClear.png");
@@ -442,6 +444,7 @@ int InitImages()
&& (b1player = IMG_Load2((char*)"gfx/bOnePlayer.png"))
&& (b2players = IMG_Load2((char*)"gfx/bTwoPlayers.png"))
&& (bVsMode = IMG_Load2((char*)"gfx/bVsGame.png"))
+ && (bVsModeConfig = IMG_Load2((char*)"gfx/bVsGameConfig.png"))
&& (bPuzzle = IMG_Load2((char*)"gfx/bPuzzle.png"))
&& (bStageClear = IMG_Load2((char*)"gfx/bStageClear.png"))
&& (bTimeTrial = IMG_Load2((char*)"gfx/bTimeTrial.png"))
@@ -572,6 +575,7 @@ int InitImages()
CONVERT(b1player);
CONVERT(b2players);
CONVERT(bVsMode);
+ CONVERT(bVsModeConfig);
CONVERT(bPuzzle);
CONVERT(bStageClear);
CONVERT(bTimeTrial);
@@ -723,6 +727,7 @@ void UnloadImages()
SDL_FreeSurface(b1player);
SDL_FreeSurface(b2players);
SDL_FreeSurface(bVsMode);
+ SDL_FreeSurface(bVsModeConfig);
SDL_FreeSurface(bPuzzle);
SDL_FreeSurface(bStageClear);
SDL_FreeSurface(bTimeTrial);
@@ -2433,7 +2438,7 @@ void DrawEverything(int xsize, int ysize,BlockGame &theGame, BlockGame &theGame2
{
DrawIMG(bConfigure,screen,120,40);
DrawIMG(bSelectPuzzle,screen,120,80);
- DrawIMG(bVsMode,screen,120,120);
+ DrawIMG(bVsModeConfig,screen,120,120);
DrawIMG(bTheme,screen,120,160);
}
if (bReplayOpen)
@@ -4638,7 +4643,7 @@ int main(int argc, char *argv[])
Stats::getInstance()->save();
//Frees memory from music and fonts
- //This is done after writing of options since it often crashes the program :(
+ //This is done after writing of configurations and stats since it often crashes the program :(
UnloadImages();
diff --git a/source/code/mainVars.hpp b/source/code/mainVars.hpp
index 3376b04..39a7750 100644
--- a/source/code/mainVars.hpp
+++ b/source/code/mainVars.hpp
@@ -55,6 +55,7 @@ SDL_Surface *backBoard; //Stores the background to the board
SDL_Surface *b1player;
SDL_Surface *b2players;
SDL_Surface *bVsMode;
+SDL_Surface *bVsModeConfig; //Added in 1.4.0
SDL_Surface *bStageClear;
SDL_Surface *bPuzzle;
SDL_Surface *bNewGame; //The New Game botton