X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FSettings.cpp;h=ef3cebe22e9f5ead286eff1659636a12d9d2fd93;hb=9f74842b2c68ce6c62ddf9374252ac99e31879ca;hp=9642cb941d04195695d466060758539295249af9;hpb=326621743b8eea53a3a040f657ad77e9f19fc7da;p=lugaru.git diff --git a/Source/Settings.cpp b/Source/Settings.cpp index 9642cb9..ef3cebe 100644 --- a/Source/Settings.cpp +++ b/Source/Settings.cpp @@ -28,7 +28,7 @@ void DefaultSettings(Game &game) { velocityblur=0; volume = 0.8f; ambientsound=1; - vblsync=0; + vblsync=1; debugmode=0; game.crouchkey=SDLK_LSHIFT; @@ -40,10 +40,17 @@ void DefaultSettings(Game &game) { game.drawkey=SDLK_e; game.throwkey=SDLK_q; game.attackkey=MOUSEBUTTON1; + game.consolekey=SDLK_BACKQUOTE; game.chatkey=SDLK_t; } 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; @@ -116,6 +123,8 @@ void SaveSettings(Game &game) { opstream << Input::keyToChar(game.throwkey); opstream << "\nAttack key:\n"; opstream << Input::keyToChar(game.attackkey); + opstream << "\nConsole key:\n"; + opstream << Input::keyToChar(game.consolekey); opstream << "\nChat key:\n"; opstream << Input::keyToChar(game.chatkey); opstream << "\nDamage bar:\n"; @@ -145,6 +154,7 @@ bool LoadSettings(Game &game) { // skip blank lines // assume lines starting with spaces are all blank if ( strlen(setting) == 0 || setting[0] == ' ' || setting[0] == '\t') continue; + //~ printf("setting : %s\n",setting); if ( ipstream.eof() || ipstream.fail() ) { fprintf(stderr, "Error reading config file: Got setting name '%s', but value can't be read\n", setting); @@ -214,34 +224,37 @@ bool LoadSettings(Game &game) { ipstream >> volume; } else if ( !strncmp(setting, "Forward key", 11) ) { ipstream.getline( string, sizeof(string) ); - game.forwardkey = CharToKey(string); + game.forwardkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Back key", 8) ) { ipstream.getline( string, sizeof(string) ); - game.backkey = CharToKey(string); + game.backkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Left key", 8) ) { ipstream.getline( string, sizeof(string) ); - game.leftkey = CharToKey(string); + game.leftkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Right key", 9) ) { ipstream.getline( string, sizeof(string) ); - game.rightkey = CharToKey(string); + game.rightkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Jump key", 8) ) { ipstream.getline( string, sizeof(string) ); - game.jumpkey = CharToKey(string); + game.jumpkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Crouch key", 10) ) { ipstream.getline( string, sizeof(string) ); - game.crouchkey = CharToKey(string); + game.crouchkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Draw key", 8) ) { ipstream.getline( string, sizeof(string) ); - game.drawkey = CharToKey(string); + game.drawkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Throw key", 9) ) { ipstream.getline( string, sizeof(string) ); - game.throwkey = CharToKey(string); + game.throwkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Attack key", 10) ) { ipstream.getline( string, sizeof(string) ); - game.attackkey = CharToKey(string); + game.attackkey = Input::CharToKey(string); + } else if ( !strncmp(setting, "Console key", 11) ) { + ipstream.getline( string, sizeof(string) ); + game.consolekey = Input::CharToKey(string); } else if ( !strncmp(setting, "Chat key", 8) ) { ipstream.getline( string, sizeof(string) ); - game.chatkey = CharToKey(string); + game.chatkey = Input::CharToKey(string); } else if ( !strncmp(setting, "Damage bar", 10) ) { ipstream >> showdamagebar; } else if ( !strncmp(setting, "StereoMode", 10) ) {