From 2b4a9af9f7693a7715ae77f491157baac7257b10 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 10 Dec 2016 20:31:46 +0100 Subject: [PATCH] Rename debug mode to dev tools The new config is then "Devtools" and the command line option is --devtools, -d. --- CMakeLists.txt | 2 +- DEBUG-OPTIONS.txt => DEVTOOLS.txt | 55 ++++++++++++++++++++----------- Source/Account.cpp | 4 +-- Source/Game.h | 2 +- Source/GameDraw.cpp | 4 +-- Source/GameTick.cpp | 20 +++++------ Source/Globals.cpp | 2 +- Source/Menu.cpp | 10 +++--- Source/Person.cpp | 2 +- Source/Settings.cpp | 6 ++-- Source/Settings.h | 2 +- Source/main.cpp | 6 ++-- 12 files changed, 66 insertions(+), 49 deletions(-) rename DEBUG-OPTIONS.txt => DEVTOOLS.txt (86%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 793cb70..087eafe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,6 +289,6 @@ endif(APPLE) install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/CONTENT-LICENSE.txt ${CMAKE_SOURCE_DIR}/COPYING.txt - ${CMAKE_SOURCE_DIR}/DEBUG-OPTIONS.txt + ${CMAKE_SOURCE_DIR}/DEVTOOLS.txt ${CMAKE_SOURCE_DIR}/README.md DESTINATION ${LUGARU_DOCDIR}) diff --git a/DEBUG-OPTIONS.txt b/DEVTOOLS.txt similarity index 86% rename from DEBUG-OPTIONS.txt rename to DEVTOOLS.txt index 945f099..d765ab6 100644 --- a/DEBUG-OPTIONS.txt +++ b/DEVTOOLS.txt @@ -1,11 +1,25 @@ -Lugaru +Lugaru Developer Tools +====================== ----------Pass --debug option to the binary for these to work---------- +Activation +---------- -Note: debug key must be pressed as if on a qwerty +- Pass --devtools option to the binary for these to work +- Or add the following to your config.txt: -~=console (map mapname, save mapname, quit) -tab=minimap + Devtools: + 1 + +Key bindings +------------ + +Note: dev keys must be pressed as if on a QWERTY keyboard. + +General +~~~~~~~ + +~ = console (map mapname, save mapname, quit) +tab = minimap super+z = restart level shift+k = win level @@ -22,8 +36,9 @@ alt+shift+o = change enemy's type (rabbit/wolf) (main player if ctrl is pressed) alt+i = explode nearby head alt+shift+i = explode nearby enemy +Map editor +~~~~~~~~~~ -Map editor: alt+m = toggle editor mode m = place object p = place enemy @@ -39,7 +54,9 @@ control+p = make/connect pathfind waypoint period/comma = select pathfind waypoints shift+comma = delete pathfind waypoint -Console commands: +Console commands +---------------- + f is floating point, i is integer, b is boolean, str is string. Map mapname where mapname is the name of a map in the maps folder @@ -54,18 +71,18 @@ Noclothes = remove all clothes Clothes str = add clothes str.png Included clothes include: -shirt -longsleeve -earwrap -footwrap -pants -fancypants -scar -headband -leatherwristleft -leatherwristright -leatherarmor -leatherpants +Shirt +LongSleeve +EarWrap +FootWrap +Pants +FancyPants +Scar +Headband +LeatherWristLeft +LeatherWristRight +LeatherArmor +LeatherPants Skybox = toggle skybox (i.e. turn off to get fog) Sky Tint f f f = r,g,b colors from 0 to 1 for the sky diff --git a/Source/Account.cpp b/Source/Account.cpp index b3d42c7..bfaa3d4 100644 --- a/Source/Account.cpp +++ b/Source/Account.cpp @@ -27,7 +27,7 @@ along with Lugaru. If not, see . using namespace std; -extern bool debugmode; +extern bool devtools; vector Account::accounts = vector(); @@ -100,7 +100,7 @@ void Account::winCampaignLevel(int choice, float score, float time) void Account::winLevel(int level, float score, float time) { - if (!debugmode) { + if (!devtools) { if (score > highscore[level]) highscore[level] = score; if (time < fasttime[level] || fasttime[level] == 0) diff --git a/Source/Game.h b/Source/Game.h index 68a23a3..96ec815 100644 --- a/Source/Game.h +++ b/Source/Game.h @@ -217,7 +217,7 @@ SDL_bool sdlEventProc(const SDL_Event &e); -enum optionIndex { UNKNOWN, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS, DEBUG }; +enum optionIndex { UNKNOWN, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS, DEVTOOLS }; /* Number of options + 1 */ const int commandLineOptionsNumber = 9; diff --git a/Source/GameDraw.cpp b/Source/GameDraw.cpp index a0c92d5..87a982b 100644 --- a/Source/GameDraw.cpp +++ b/Source/GameDraw.cpp @@ -62,7 +62,7 @@ extern float motionbluramount; extern bool isclient; extern bool alwaysblur; extern bool velocityblur; -extern bool debugmode; +extern bool devtools; extern int mainmenu; extern int bloodtoggle; extern int difficulty; @@ -1150,7 +1150,7 @@ int Game::DrawGLScene(StereoSide side) glColor4f(.5, .5, .5, 1); - if ((texttoggle || editorenabled) && debugmode && !mainmenu) { + if ((texttoggle || editorenabled) && devtools && !mainmenu) { sprintf (string, "The framespersecond is %d.", (int)(fps)); text->glPrint(10, 30, string, 0, .8, 1024, 768); diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 5dfc393..e738a42 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -90,7 +90,7 @@ extern bool mousejump; extern float viewdistance; extern bool freeze; extern XYZ windvector; -extern bool debugmode; +extern bool devtools; int leveltheme; extern int mainmenu; extern int oldmainmenu; @@ -1639,10 +1639,10 @@ void doTutorial() } } -void doDebugKeys() +void doDevKeys() { float headprop, bodyprop, armprop, legprop; - if (!debugmode) { + if (!devtools) { return; } @@ -4604,14 +4604,14 @@ void Game::Tick() leveltime += multiplier; //keys - if (Input::isKeyDown(SDL_SCANCODE_LALT) && Input::isKeyPressed(SDL_SCANCODE_V) && debugmode) { + if (Input::isKeyDown(SDL_SCANCODE_LALT) && Input::isKeyPressed(SDL_SCANCODE_V) && devtools) { freeze = !freeze; if (freeze) { OPENAL_SetFrequency(OPENAL_ALL); } } - if (Input::isKeyPressed(consolekey) && debugmode) { + if (Input::isKeyPressed(consolekey) && devtools) { console = !console; if (console) { OPENAL_SetFrequency(OPENAL_ALL); @@ -4976,7 +4976,7 @@ void Game::Tick() hawkcalldelay = 16 + abs(Random() % 8); } - doDebugKeys(); + doDevKeys(); doAttacks(); @@ -5002,7 +5002,7 @@ void Game::Tick() (whichlevel != -2 && (Input::isKeyDown(SDL_SCANCODE_Z) && Input::isKeyDown(SDL_SCANCODE_LGUI) && - debugmode) || + devtools) || (Input::isKeyDown(jumpkey) && !respawnkeydown && !oldattackkey && @@ -5772,7 +5772,7 @@ void Game::Tick() Person::players[i]->crouchtogglekeydown = 1; } else Person::players[i]->velocity.y = 5; - if (mousejump && i == 0 && debugmode) { + if (mousejump && i == 0 && devtools) { if (!Person::players[i]->isLanding()) Person::players[i]->tempdeltav = deltav; if (Person::players[i]->tempdeltav < 0) @@ -5797,7 +5797,7 @@ void Game::Tick() if (Person::players[i]->animTarget == jumpupanim && (((!floatjump && !editorenabled) || - !debugmode) || + !devtools) || Person::players[i]->aitype != playercontrolled)) { if (Person::players[i]->jumppower > multiplier * 6) { Person::players[i]->velocity.y += multiplier * 6; @@ -5808,7 +5808,7 @@ void Game::Tick() Person::players[i]->jumppower = 0; } } - if (((floatjump || editorenabled) && debugmode) && i == 0) + if (((floatjump || editorenabled) && devtools) && i == 0) Person::players[i]->velocity.y += multiplier * 30; } diff --git a/Source/Globals.cpp b/Source/Globals.cpp index c5a336e..d8d430d 100644 --- a/Source/Globals.cpp +++ b/Source/Globals.cpp @@ -148,7 +148,7 @@ float envsoundvol[30] = {0}; float envsoundlife[30] = {0}; int numenvsounds; -bool debugmode = false; +bool devtools = false; bool gamestarted = false; diff --git a/Source/Menu.cpp b/Source/Menu.cpp index 9e08d74..af6fe29 100644 --- a/Source/Menu.cpp +++ b/Source/Menu.cpp @@ -329,7 +329,7 @@ void Menu::updateControlsMenu() setText(6, (string)"Draw: " + (keyselect == 6 ? "_" : Input::keyToChar(drawkey))); setText(7, (string)"Throw: " + (keyselect == 7 ? "_" : Input::keyToChar(throwkey))); setText(8, (string)"Attack: " + (keyselect == 8 ? "_" : Input::keyToChar(attackkey))); - if (debugmode) { + if (devtools) { setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey))); } } @@ -389,10 +389,10 @@ void Menu::Load() addButton(6, "", 10 + 40, 160); addButton(7, "", 10 + 30, 120); addButton(8, "", 10 + 20, 80); - if (debugmode) { + if (devtools) { addButton(9, "", 10 + 10, 40); } - addButton(debugmode ? 10 : 9, "Back", 10, 10); + addButton(devtools ? 10 : 9, "Back", 10, 10); updateControlsMenu(); break; case 5: { @@ -688,11 +688,11 @@ void Menu::Tick() case 4: if (!waiting) { fireSound(); - if (selected < (debugmode ? 10 : 9) && keyselect == -1) + if (selected < (devtools ? 10 : 9) && keyselect == -1) keyselect = selected; if (keyselect != -1) setKeySelected(); - if (selected == (debugmode ? 10 : 9)) { + if (selected == (devtools ? 10 : 9)) { flash(); mainmenu = 3; } diff --git a/Source/Person.cpp b/Source/Person.cpp index acd6647..cada57b 100644 --- a/Source/Person.cpp +++ b/Source/Person.cpp @@ -523,7 +523,7 @@ void Person::CheckKick() * * USES: * GameTick/doPlayerCollisions - spread fire between players - * GameTick/doDebugKeys - press f to ignite + * GameTick/doDevKeys - press f to ignite * Person::DoStuff - spread fire from lit campfires and bushes */ void Person::CatchFire() diff --git a/Source/Settings.cpp b/Source/Settings.cpp index fd3e03d..e962d0b 100644 --- a/Source/Settings.cpp +++ b/Source/Settings.cpp @@ -52,7 +52,7 @@ void DefaultSettings() velocityblur = 0; volume = 0.8f; ambientsound = 1; - debugmode = 0; + devtools = 0; crouchkey = SDL_SCANCODE_LSHIFT; jumpkey = SDL_SCANCODE_SPACE; @@ -245,8 +245,8 @@ bool LoadSettings() ipstream >> damageeffects; } else if ( !strncmp(setting, "Text", 4) ) { ipstream >> texttoggle; - } else if ( !strncmp(setting, "Debug", 5) ) { - ipstream >> debugmode; + } else if ( !strncmp(setting, "Devtools", 5) ) { + ipstream >> devtools; } else if ( !strncmp(setting, "Show Points", 11) ) { ipstream >> showpoints; } else if ( !strncmp(setting, "Always Blur", 11) ) { diff --git a/Source/Settings.h b/Source/Settings.h index 942d163..ac14df3 100644 --- a/Source/Settings.h +++ b/Source/Settings.h @@ -40,7 +40,7 @@ extern float oldgamespeed; extern int difficulty; extern bool damageeffects; extern bool texttoggle; -extern bool debugmode; +extern bool devtools; extern bool showpoints; extern bool showdamagebar; extern bool alwaysblur; diff --git a/Source/main.cpp b/Source/main.cpp index 10f2459..f90f620 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -581,7 +581,7 @@ const option::Descriptor usage[] = {SOUND, OPENAL_OUTPUT_OSS, "", "force-oss", option::Arg::None, " --force-oss Force use of OSS back-end." }, {OPENALINFO, 0, "", "openal-info", option::Arg::None, " --openal-info Print info about OpenAL at launch." }, {SHOWRESOLUTIONS, 0, "", "showresolutions", option::Arg::None, " --showresolutions List the resolutions found by SDL at launch." }, - {DEBUG, 0, "d", "debug", option::Arg::None, " -d, --debug Activates console, level editor and debug information." }, + {DEVTOOLS, 0, "d", "devtools", option::Arg::None, " -d, --devtools Activates developer tools: console, level editor and debug information." }, {0,0,0,0,0,0} }; @@ -635,8 +635,8 @@ int main(int argc, char **argv) return 42; } - if (commandLineOptions[DEBUG]) { - debugmode = true; + if (commandLineOptions[DEVTOOLS]) { + devtools = true; } bool gameDone = false; -- 2.39.5