]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
Moved default scale and default damage tolerance to PersonType.
[lugaru.git] / Source / GameTick.cpp
index 0b83cedef7f4e3853d76b4f4bd27118ceb94e6c6..92a36c992b99881b728470993711c5eb629f69c5 100644 (file)
@@ -1022,20 +1022,23 @@ void Game::ProcessInput()
         printf("Stereo separation increased to %f\n", stereoseparation);
     }
 
-    /* Console */
-    if (Input::isKeyPressed(consolekey)) {
-        console = !console;
-        if (console) {
-            OPENAL_SetFrequency(OPENAL_ALL);
-        } else {
-            freeze = 0;
-            waiting = false;
+    /* Devtools */
+    if (devtools && !mainmenu) {
+        /* Console */
+        if (Input::isKeyPressed(consolekey)) {
+            console = !console;
+            if (console) {
+                OPENAL_SetFrequency(OPENAL_ALL);
+            } else {
+                freeze = 0;
+                waiting = false;
+            }
         }
-    }
 
-    /* Devtools */
-    if (devtools && !mainmenu && !console) {
-        ProcessDevInput();
+        /* Other devtools, disabled when the console is shown */
+        if (!console) {
+            ProcessDevInput();
+        }
     }
 }
 
@@ -1051,23 +1054,26 @@ void Game::ProcessDevInput()
             editorenabled = !editorenabled;
             if (editorenabled) {
                 Person::players[0]->damagetolerance = 100000;
+                Person::players[0]->damage = 0;
+                Person::players[0]->permanentdamage = 0;
+                Person::players[0]->superpermanentdamage = 0;
+                Person::players[0]->burnt = 0;
+                Person::players[0]->bloodloss = 0;
+                Person::players[0]->deathbleeding = 0;
             } else {
                 Person::players[0]->damagetolerance = 200;
             }
-            Person::players[0]->damage = 0; // these lines were in both if and else, but I think they would better fit in the if
-            Person::players[0]->permanentdamage = 0;
-            Person::players[0]->superpermanentdamage = 0;
-            Person::players[0]->bloodloss = 0;
-            Person::players[0]->deathbleeding = 0;
         }
 
         /* Nullify damage and give 200000 health */
         if (Input::isKeyPressed(SDL_SCANCODE_H)) {
             Person::players[0]->damagetolerance = 200000;
             Person::players[0]->damage = 0;
-            Person::players[0]->burnt = 0;
             Person::players[0]->permanentdamage = 0;
             Person::players[0]->superpermanentdamage = 0;
+            Person::players[0]->burnt = 0;
+            Person::players[0]->bloodloss = 0;
+            Person::players[0]->deathbleeding = 0;
         }
 
         /* Change environment */
@@ -1207,22 +1213,8 @@ void Game::ProcessDevInput()
             }
 
             if (closest >= 0) {
-                if (Person::players[closest]->creature == rabbittype) {
-                    Person::players[closest]->creature = wolftype;
-                    Person::players[closest]->whichskin = 0;
-                    Person::players[closest]->skeletonLoad();
-                    Person::players[closest]->scale *= 1.15;
-
-                    Person::players[closest]->damagetolerance = 300;
-                } else { // wolftype
-                    Person::players[closest]->creature = rabbittype;
-                    Person::players[closest]->whichskin = 0;
-                    Person::players[closest]->skeletonLoad(true);
-
-                    Person::players[closest]->scale /= 1.15;
-
-                    Person::players[closest]->damagetolerance = 200;
-                }
+                person_type nextType = static_cast<person_type>((Person::players[closest]->creature + 1) % PersonType::types.size());
+                Person::players[closest]->changeCreatureType(nextType);
             }
         }