From 4a466c2b390f658bf612ffb02a6c7246ac7edd94 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20BERNIGAUD?= Date: Tue, 10 May 2011 19:37:16 +0200 Subject: [PATCH] some cleanup --- Source/GameTick.cpp | 63 ++++++--------------------------------------- Source/Settings.cpp | 6 +++++ 2 files changed, 14 insertions(+), 55 deletions(-) diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 2a22f25..7f72347 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1130,8 +1130,6 @@ void Screenshot (void) save_image(temp); } - - void Game::SetUpLighting(){ if(environment==snowyenvironment) light.setColors(.65,.65,.7,.4,.4,.44); @@ -1263,7 +1261,7 @@ int Game::checkcollide(XYZ startpoint,XYZ endpoint,int what){ return -1; } -void Game::Setenvironment(int which) +void Game::Setenvironment(int which) { LOGFUNC; @@ -1317,8 +1315,7 @@ void Game::Setenvironment(int which) texdetail=temptexdetail; - } - if(environment==desertenvironment){ + } else if(environment==desertenvironment){ windvector=0; windvector.z=2; LoadTexture(":Data:Textures:deserttree.png",&objects.treetextureptr,0,1); @@ -1356,8 +1353,7 @@ void Game::Setenvironment(int which) texdetail=temptexdetail; - } - if(environment==grassyenvironment){ + } else if(environment==grassyenvironment){ windvector=0; windvector.z=2; LoadTexture(":Data:Textures:tree.png",&objects.treetextureptr,0,1); @@ -1401,7 +1397,6 @@ void Game::Setenvironment(int which) texdetail=temptexdetail; } - void Game::Loadlevel(int which){ stealthloading=0; whichlevel=which; @@ -2127,8 +2122,6 @@ void Game::Loadlevel(const char *name){ visibleloading=0; } - - /* Values of mainmenu : 1 Main menu @@ -2280,12 +2273,7 @@ void Game::MenuTick(){ break; case 8: flash(); - - if(newdetail>2) newdetail=detail; - if(newdetail<0) newdetail=detail; - if(newscreenwidth<0) newscreenwidth=screenwidth; - if(newscreenheight<0) newscreenheight=screenheight; - + SaveSettings(*this); mainmenu=gameon?2:1; break; @@ -2324,13 +2312,6 @@ void Game::MenuTick(){ flash(); mainmenu=3; - - if(newdetail>2) newdetail=detail; - if(newdetail<0) newdetail=detail; - if(newscreenwidth>3000) newscreenwidth=screenwidth; - if(newscreenwidth<0) newscreenwidth=screenwidth; - if(newscreenheight>3000) newscreenheight=screenheight; - if(newscreenheight<0) newscreenheight=screenheight; } } break; @@ -2485,12 +2466,7 @@ void Game::MenuTick(){ if(Input::isKeyDown(SDLK_q) && Input::isKeyDown(SDLK_LMETA)){ tryquit=1; - if(mainmenu==3){ - if(newdetail>2) newdetail=detail; - if(newdetail<0) newdetail=detail; - if(newscreenwidth<0) newscreenwidth=screenwidth; - if(newscreenheight<0) newscreenheight=screenheight; - + if(mainmenu==3) { SaveSettings(*this); } } @@ -2932,8 +2908,6 @@ void Game::doTutorial(){ } } - - void Game::doDebugKeys(){ float headprop,bodyprop,armprop,legprop; if(debugmode){ @@ -3727,8 +3701,6 @@ void Game::doDebugKeys(){ } } - - void Game::doJumpReversals(){ for(int k=0;k2) - newdetail=detail; - if(newdetail<0) - newdetail=detail; - if(newscreenwidth<0) - newscreenwidth=screenwidth; - if(newscreenheight<0) - newscreenheight=screenheight; SaveSettings(*this); } //effects @@ -6120,12 +6080,7 @@ void Game::Tick(){ if(Input::isKeyDown(SDLK_q)&&Input::isKeyDown(SDLK_LMETA)){ tryquit=1; - if(mainmenu==3){ - if(newdetail>2)newdetail=detail; - if(newdetail<0)newdetail=detail; - if(newscreenwidth<0)newscreenwidth=screenwidth; - if(newscreenheight<0)newscreenheight=screenheight; - + if(mainmenu==3) { SaveSettings(*this); } } @@ -7581,9 +7536,7 @@ void Game::Tick(){ Screenshot(); } - - -void Game::TickOnce(){ +void Game::TickOnce(){ if(mainmenu) rotation+=multiplier*5; else @@ -7600,7 +7553,7 @@ void Game::TickOnce(){ } } -void Game::TickOnceAfter(){ +void Game::TickOnceAfter(){ static XYZ colviewer; static XYZ coltarget; static XYZ target; diff --git a/Source/Settings.cpp b/Source/Settings.cpp index dce0e0e..52ecbeb 100644 --- a/Source/Settings.cpp +++ b/Source/Settings.cpp @@ -44,6 +44,12 @@ void DefaultSettings(Game &game) { } void SaveSettings(Game &game) { + if(game.newdetail<0) game.newdetail=0; + if(game.newdetail>2) game.newdetail=2; + if(game.newscreenwidth>3000) game.newscreenwidth=screenwidth; + if(game.newscreenwidth<0) game.newscreenwidth=screenwidth; + if(game.newscreenheight>3000) game.newscreenheight=screenheight; + if(game.newscreenheight<0) game.newscreenheight=screenheight; ofstream opstream(ConvertFileName(":Data:config.txt", "w")); opstream << "Screenwidth:\n"; opstream << game.newscreenwidth; -- 2.39.5