commit 27ae0175
More hardcoded values replaced with constants
git-svn-id: https://blockattack.svn.sourceforge.net/svnroot/blockattack/trunk@63 9d7177f8-192b-0410-8f35-a16a89829b06
Changed files
| M | source/code/BlockGame.hpp before |
| M | source/code/main.cpp before |
| M | source/code/mainVars.hpp before |
diff --git a/source/code/BlockGame.hpp b/source/code/BlockGame.hpp
index c84197e..2630b4e 100644
--- a/source/code/BlockGame.hpp
+++ b/source/code/BlockGame.hpp
@@ -961,9 +961,9 @@ public:
if (chainSize[chain]<chainSize[board[i][j]/10000000])
chain = board[i][j]/10000000;
- theBallManeger.addBall(topx+40+i*50, topy+600-j*50, true, board[i][j]%10);
- theBallManeger.addBall(topx+i*50, topy+600-j*50, false, board[i][j]%10);
- theExplosionManeger.addExplosion(topx-10+i*50, topy+590-j*50);
+ theBallManeger.addBall(topx+40+i*bsize, topy+bsize*12-j*bsize, true, board[i][j]%10);
+ theBallManeger.addBall(topx+i*bsize, topy+bsize*12-j*bsize, false, board[i][j]%10);
+ theExplosionManeger.addExplosion(topx-10+i*bsize, topy+bsize*12-10-j*bsize);
board[i][j]=-2;
}
}
@@ -1077,7 +1077,7 @@ public:
dead=true;
string tempS = itoa(chainSize[chain]);
if (chainSize[chain]>1)
- theTextManeger.addText(topx-10+j*50, topy+600-i*50, tempS, 1000);
+ theTextManeger.addText(topx-10+j*bsize, topy+12*bsize-i*bsize, tempS, 1000);
}
}
} //This was there text was added
@@ -1262,7 +1262,7 @@ public:
void MoveCursor(char way) {
if (!bGameOver) //If game over nothing happends
{
- if ((way == 'N') && ((cursory<10)||(TowerHeight>12) ||(((pixels==50)||(pixels==0)) && (cursory<11))))
+ if ((way == 'N') && ((cursory<10)||(TowerHeight>12) ||(((pixels==bsize)||(pixels==0)) && (cursory<11))))
cursory++;
if ((way == 'S') && (cursory>0))
cursory--;
@@ -1351,12 +1351,12 @@ public:
//Pushes a single pixel, so it appears to scrool
void PushPixels() {
nrPushedPixel++;
- if ((pixels < 50) && TowerHeight<13) {
+ if ((pixels < bsize) && TowerHeight<13) {
pixels++;
}
else
PushLine();
- if (pixels>50)
+ if (pixels>bsize)
pixels=0;
}
@@ -1794,11 +1794,11 @@ public:
for (int i=0;((i<13)&&(i<30));i++)
for (int j=0;j<6;j++) {
if ((board[j][i]%10 != -1) && (board[j][i]%10 < 7) && ((board[j][i]/1000000)%10==0)) {
- DrawIMG(bricks[board[j][i]%10], sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(bricks[board[j][i]%10], sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((board[j][i]/BLOCKWAIT)%10==1)
- DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2], sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2], sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((board[j][i]/BLOCKHANG)%10==1)
- DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2], sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2], sBoard, j*bsize, bsize*12-i*bsize-pixels);
}
if ((board[j][i]/1000000)%10==1) {
@@ -1813,38 +1813,38 @@ public:
if (i<1) under = -1;
else under = board[j][i-1];
if ((left == number)&&(right == number)&&(over == number)&&(under == number))
- DrawIMG(garbageFill, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageFill, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left != number)&&(right == number)&&(over == number)&&(under == number))
- DrawIMG(garbageL, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageL, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right != number)&&(over == number)&&(under == number))
- DrawIMG(garbageR, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageR, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right == number)&&(over != number)&&(under == number))
- DrawIMG(garbageT, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageT, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right == number)&&(over == number)&&(under != number))
- DrawIMG(garbageB, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageB, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left != number)&&(right == number)&&(over != number)&&(under == number))
- DrawIMG(garbageTL, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageTL, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left != number)&&(right == number)&&(over == number)&&(under != number))
- DrawIMG(garbageBL, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageBL, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right != number)&&(over != number)&&(under == number))
- DrawIMG(garbageTR, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageTR, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right != number)&&(over == number)&&(under != number))
- DrawIMG(garbageBR, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageBR, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right != number)&&(over != number)&&(under != number))
- DrawIMG(garbageMR, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageMR, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left == number)&&(right == number)&&(over != number)&&(under != number))
- DrawIMG(garbageM, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageM, sBoard, j*bsize, bsize*12-i*bsize-pixels);
if ((left != number)&&(right == number)&&(over != number)&&(under != number))
- DrawIMG(garbageML, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageML, sBoard, j*bsize, bsize*12-i*bsize-pixels);
}
if ((board[j][i]/1000000)%10==2) {
if (j==0)
- DrawIMG(garbageGML, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageGML, sBoard, j*bsize, bsize*12-i*bsize-pixels);
else
if (j==5)
- DrawIMG(garbageGMR, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageGMR, sBoard, j*bsize, bsize*12-i*bsize-pixels);
else
- DrawIMG(garbageGM, sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(garbageGM, sBoard, j*bsize, bsize*12-i*bsize-pixels);
}
}
const int j = 0;
@@ -1863,7 +1863,7 @@ public:
if (i<1) under = -1;
else under = board[j][i-1];
if (((left != number)&&(right == number)&&(over != number)&&(under == number))&&(garbageSize>0)) {
- DrawIMG(smiley[board[j][i]%4], sBoard, 100, 600-i*50-pixels+25*garbageSize);
+ DrawIMG(smiley[board[j][i]%4], sBoard, 2*bsize, 12*bsize-i*bsize-pixels+(bsize/2)*garbageSize);
}
if (!((left != number)&&(right == number)&&(over == number)&&(under == number))) //not in garbage
{
@@ -1878,7 +1878,7 @@ public:
}
for (int i=0;i<6;i++)
if (board[i][0]!=-1)
- DrawIMG(transCover, sBoard, i*50, 600-pixels); //Make the appering blocks transperant
+ DrawIMG(transCover, sBoard, i*bsize, 12*bsize-pixels); //Make the appering blocks transperant
}
@@ -1962,37 +1962,37 @@ public:
for (int i=0;((i<13)&&(i<30));i++)
for (int j=0;j<6;j++) {
if ((board[j][i]%10 != -1) && (board[j][i]%30 < 7)) {
- DrawIMG(bricks[board[j][i]%10], sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(bricks[board[j][i]%10], sBoard, j*bsize, 12*bsize-i*bsize-pixels);
if (bbomb[j][i])
- DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2], sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(bomb[(SDL_GetTicks()/BOMBTIME)%2], sBoard, j*bsize, 12*bsize-i*bsize-pixels);
if (getReady[j][i])
- DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2], sBoard, j*50, 600-i*50-pixels);
+ DrawIMG(ready[(SDL_GetTicks()/READYTIME)%2], sBoard, j*bsize, 12*bsize-i*bsize-pixels);
}
if (board[j][i]%30>6) {
if (board[j][i]%30==7)
- DrawIMG(garbageR, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageR, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==9)
- DrawIMG(garbageML, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageML, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==10)
- DrawIMG(garbageMR, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageMR, sBoard, j*bsize, bsize-i*bsize-pixels); //good
if (board[j][i]%30==11)
- DrawIMG(garbageTR, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageTR, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==12)
- DrawIMG(garbageTL, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageTL, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==13)
- DrawIMG(garbageBL, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageBL, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==14)
- DrawIMG(garbageBR, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageBR, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==15)
- DrawIMG(garbageM, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageM, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==16)
- DrawIMG(garbageFill, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageFill, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==17)
- DrawIMG(garbageT, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageT, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==18)
- DrawIMG(garbageB, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageB, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
if (board[j][i]%30==19)
- DrawIMG(garbageL, sBoard, j*50, 600-i*50-pixels); //good
+ DrawIMG(garbageL, sBoard, j*bsize, 12*bsize-i*bsize-pixels); //good
//cout << "IS: " << board[j][i] << endl;
}
@@ -2002,7 +2002,7 @@ public:
int garbageSize=0;
for (int i=0;i<20;i++) {
if ((board[0][i]%30==12)&&(garbageSize>0)) {
- DrawIMG(smiley[0], sBoard, 100, 600-i*50-pixels+25*garbageSize);
+ DrawIMG(smiley[0], sBoard, 2*bsize, bsize-i*bsize-pixels+(bsize/2)*garbageSize);
}
if (board[0][i]%30!=19) //not in garbage
{
@@ -2029,7 +2029,7 @@ public:
PaintBricks();
else
SimplePaintBricks();
- if (stageClear) DrawIMG(blackLine, sBoard, 0, 700+50*(stageClearLimit-linesCleared)-pixels-1);
+ if (stageClear) DrawIMG(blackLine, sBoard, 0, bsize*(12+2)+bsize*(stageClearLimit-linesCleared)-pixels-1);
if (puzzleMode&&(!bGameOver)) {
//We need to write nr. of moves left!
strHolder = "Moves left: " + itoa(MovesLeft);
@@ -2074,7 +2074,7 @@ public:
SFont_Write(sBoard, fBlueFont, 5, 5, strHolder.c_str());
}
#endif
- if (!bGameOver)DrawIMG(cursor[(SDL_GetTicks()/600)%2],sBoard,cursorx*50-4,550-cursory*50-pixels-4);
+ if (!bGameOver)DrawIMG(cursor[(SDL_GetTicks()/600)%2],sBoard,cursorx*bsize-4,11*bsize-cursory*bsize-pixels-4);
if (SDL_GetTicks()<gameStartedAt)
{
int currentCounter = abs((int)SDL_GetTicks()-(int)gameStartedAt)/1000;
@@ -2083,13 +2083,13 @@ public:
lastCounter = currentCounter;
switch (currentCounter) {
case 2:
- DrawIMG(counter[2], sBoard, 100, 250);
+ DrawIMG(counter[2], sBoard, 2*bsize, 5*bsize);
break;
case 1:
- DrawIMG(counter[1], sBoard, 100, 250);
+ DrawIMG(counter[1], sBoard, 2*bsize, 5*bsize);
break;
case 0:
- DrawIMG(counter[0], sBoard, 100, 250);
+ DrawIMG(counter[0], sBoard, 2*bsize, 5*bsize);
break;
default:
break;
@@ -2102,10 +2102,10 @@ public:
lastCounter = -1;
}
if ((bGameOver)&&(!editorMode))
- if (hasWonTheGame)DrawIMG(iWinner, sBoard, 0, 250);
- else if (bDraw) DrawIMG(iDraw, sBoard, 0, 250);
+ if (hasWonTheGame)DrawIMG(iWinner, sBoard, 0, 5*bsize);
+ else if (bDraw) DrawIMG(iDraw, sBoard, 0, 5*bsize);
else
- DrawIMG(iGameOver, sBoard, 0, 250);
+ DrawIMG(iGameOver, sBoard, 0, 5*bsize);
}
//Updates evrything, if not called nothing happends
diff --git a/source/code/main.cpp b/source/code/main.cpp
index ee981aa..29dcac1 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -24,6 +24,9 @@ Copyright (C) 2008 Poul Sander
http://blockattack.sf.net
*/
+#include <string.h>
+
+
@@ -1613,7 +1616,7 @@ int OpenControlsBox(int x, int y, int player)
Uint8 *keys;
bool done =false;
char *keyname;
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
while (!done)
{
SDL_Delay(10);
@@ -1817,7 +1820,7 @@ bool OpenDialogbox(int x, int y, char *name)
ReadKeyboard rk = ReadKeyboard(name);
Uint8* keys;
string strHolder;
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
while (!done)
{
@@ -1884,7 +1887,7 @@ bool OpenDialogbox(int x, int y, char *name)
//Draws the highscores
void DrawHighscores(int x, int y, bool endless)
{
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
if (endless) SFont_Write(screen,fBlueFont,x+100,y+100,"Endless:");
else SFont_Write(screen,fBlueFont,x+100,y+100,"Time Trial:");
@@ -1915,7 +1918,7 @@ void DrawHighscores(int x, int y, bool endless)
void DrawStats()
{
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
int y = 5;
const int y_spacing = 30;
@@ -1952,7 +1955,7 @@ void DrawStats()
SFont_Write(screen,fBlueFont,10,y,((string)("Seconds: "+itoa(ct.seconds))).c_str());
y-=y_spacing*4; //Four rows back
- const int x_offset3 = 1024/3+10; //Ofset for three rows
+ const int x_offset3 = xsize/3+10; //Ofset for three rows
SFont_Write(screen,fBlueFont,x_offset3,y,"Play time: ");
ct = TimeHandler::getTime("playTime");
y+=y_spacing;
@@ -1964,7 +1967,7 @@ void DrawStats()
y+=y_spacing;
SFont_Write(screen,fBlueFont,x_offset3,y,((string)("Seconds: "+itoa(ct.seconds))).c_str());
- const int x_offset = 1024/2+10;
+ const int x_offset = xsize/2+10;
y = 5+y_spacing*2;
SFont_Write(screen,fBlueFont,x_offset,y,"VS CPU (win/loss)");
for(int i=0;i<7;i++)
@@ -1983,7 +1986,6 @@ void OpenScoresDisplay()
int mousex,mousey;
bool done = false; //We are done!
int page = 0;
- const int ysize = 768;
const int numberOfPages = 3;
//button coodinates:
const int scoreX = buttonXsize*2;
@@ -2116,7 +2118,7 @@ bool OpenFileDialogbox(int x, int y, char *name)
#endif
Uint8* keys;
string strHolder;
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
DrawIMG(bForward,background,x+460,y+420);
DrawIMG(bBack,background,x+20,y+420);
@@ -2212,7 +2214,7 @@ bool SelectThemeDialogbox(int x, int y, char *name)
#endif
Uint8* keys;
string strHolder;
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
DrawIMG(bForward,background,x+460,y+420);
DrawIMG(bBack,background,x+20,y+420);
@@ -2312,7 +2314,7 @@ bool OpenReplayDialogbox(int x, int y, char *name)
cout << "Directory sat" << endl;
Uint8* keys;
string strHolder;
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(background,screen,0,0);
DrawIMG(bForward,background,x+460,y+420);
DrawIMG(bBack,background,x+20,y+420);
@@ -2680,14 +2682,18 @@ void DrawEverything(int xsize, int ysize,BlockGame &theGame, BlockGame &theGame2
//Generates the standard background
void MakeBackground(int xsize,int ysize)
{
- DrawIMG(backgroundImage,background,0,0);
+ int w = backgroundImage->w;
+ int h = backgroundImage->h;
+ for(int i=0;i*w<xsize;i++)
+ for(int j=0;j*h<ysize;j++)
+ DrawIMG(backgroundImage,background,i*w,j*h);
standardBackground = true;
}
//Generates the background with red board backs
void MakeBackground(int xsize,int ysize,BlockGame &theGame, BlockGame &theGame2)
{
- DrawIMG(backgroundImage,background,0,0);
+ MakeBackground(xsize,ysize);
DrawIMG(boardBackBack,background,theGame.topx-60,theGame.topy-68);
DrawIMG(boardBackBack,background,theGame2.topx-60,theGame2.topy-68);
standardBackground = false;
@@ -2695,7 +2701,7 @@ void MakeBackground(int xsize,int ysize,BlockGame &theGame, BlockGame &theGame2)
void MakeBackground(int xsize, int ysize, BlockGame &theGame)
{
- DrawIMG(backgroundImage,background,0,0);
+ MakeBackground(xsize,ysize);
DrawIMG(boardBackBack,background,theGame.topx-60,theGame.topy-68);
standardBackground = false;
}
@@ -2718,7 +2724,7 @@ int PuzzleLevelSelect()
int nowTime=SDL_GetTicks();
ifstream puzzleFile(puzzleSavePath.c_str(),ios::binary);
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
if (puzzleFile)
{
for (int i=0;(i<nrOfPuzzles)&&(!puzzleFile.eof()); i++)
@@ -2814,7 +2820,7 @@ int StageLevelSelect()
//Keeps track of background;
//int nowTime=SDL_GetTicks();
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
ifstream stageFile(stageClearSavePath.c_str(),ios::binary);
if (stageFile)
{
@@ -2960,7 +2966,7 @@ int startSingleVs()
int mousex, mousey; //To allow mouse
bool done = false; //When are we done?
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
DrawIMG(changeButtonsBack,background,xplace,yplace);
SFont_Write(background,fBlueFont,xplace+10,yplace+10,"1 : Very Easy");
SFont_Write(background,fBlueFont,xplace+10,yplace+40,"2 : Easy");
@@ -3072,9 +3078,9 @@ void startVsMenu()
//Keeps track of background;
//int nowTime=SDL_GetTicks();
- MakeBackground(1024,768);
+ MakeBackground(xsize,ysize);
SFont_Write(background,fBlueFont,360,650,"Press ESC to accept");
- DrawIMG(bBack,background,1024/2-120/2,600);
+ DrawIMG(bBack,background,xsize/2-120/2,600);
do
{
//nowTime=SDL_GetTicks();
@@ -3188,7 +3194,7 @@ void startVsMenu()
if ((mousex>xplace+50+i*40+300)&&(mousex<xplace+50+i*40+30+300)&&(mousey>yplace+330)&&(mousey<yplace+330+30))
player2handicap=i;
}
- if ((mousex>1024/2-120/2)&&(mousex<1024/2+120/2)&&(mousey>600)&&(mousey<640))
+ if ((mousex>xsize/2-120/2)&&(mousex<xsize/2+120/2)&&(mousey>600)&&(mousey<640))
done = true;
}
@@ -3328,8 +3334,6 @@ int main(int argc, char *argv[])
SoundEnabled = true;
MusicEnabled = true;
- xsize = 1024; //screen size x
- int ysize = 768; //screen size y
int mousex, mousey; //Mouse coordinates
showOptions = false;
b1playerOpen = false;
@@ -3452,7 +3456,7 @@ int main(int argc, char *argv[])
//SDL_FreeSurface(icon);
//Copyright notice:
- cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << endl << "http://blockattack.sf.net" << endl << "Copyright 2004-2008 Poul Sander" << endl <<
+ cout << "Block Attack - Rise of the Blocks (" << VERSION_NUMBER << ")" << endl << "http://blockattack.sf.net" << endl << "Copyright 2004-2009 Poul Sander" << endl <<
"A SDL based game (see www.libsdl.org)" << endl <<
"The game is availeble under the GPL, see COPYING for details." << endl;
#if defined(_WIN32)
@@ -3486,10 +3490,6 @@ int main(int argc, char *argv[])
strcpy(player1name, "Player 1 \0");
strcpy(player2name, "Player 2 \0");
-#if NETWORK
- strcpy(serverAddress, "192.168.0.2 \0");
-#endif
-
Config *configSettings = Config::getInstance();
//configSettings->setString("aNumber"," A string");
//configSettings->save();
@@ -3564,9 +3564,16 @@ int main(int argc, char *argv[])
cout << "Unable to load options file, using default values" << endl;
}
}
+
+#if NETWORK
+ strcpy(serverAddress, "192.168.0.2 \0");
+ if(configSettings->exists("address0"))
+ {
+ strcpy(serverAddress, " \0");
+ strncpy(serverAddress,configSettings->getString("address0").c_str(),sizeof(serverAddress)-1);
+ }
+#endif
- xsize = 1024;
- ysize = 768;
if (singlePuzzle)
{
xsize=300;
diff --git a/source/code/mainVars.hpp b/source/code/mainVars.hpp
index f8f5271..3418e00 100644
--- a/source/code/mainVars.hpp
+++ b/source/code/mainVars.hpp
@@ -257,6 +257,8 @@ Uint8 player2handicap=0;
unsigned long int currentTime; //contains the current time, so we don't call SDL_GetTickets() too often...
int xsize = 1024;
+int ysize = 768;
+int bsize = 50;
//Stores the players names (way to long, but at least no buffer overflows (max length is 16 for display reasons))
char player1name[30];
@@ -333,14 +335,14 @@ struct ButtonCords
};
ButtonCords cordNextButton = {
-cordNextButton.x = 150+(150-buttonXsize)/2,
-cordNextButton.y = 500,
+cordNextButton.x = 3*bsize+(3*bsize-buttonXsize)/2,
+cordNextButton.y = 10*bsize,
cordNextButton.xsize = buttonXsize,
cordNextButton.ysize = buttonYsize};
ButtonCords cordRetryButton = {
-cordRetryButton.x = (150-buttonXsize)/2,
-cordRetryButton.y = 500,
+cordRetryButton.x = (3*bsize-buttonXsize)/2,
+cordRetryButton.y = 10*bsize,
cordRetryButton.xsize = buttonXsize,
cordRetryButton.ysize = buttonYsize
};