]> git.jsancho.org Git - lugaru.git/commitdiff
Devtools: Add clotheslist cmd and fix devkeys in console
authorRémi Verschelde <rverschelde@gmail.com>
Sat, 11 Feb 2017 14:28:38 +0000 (15:28 +0100)
committerRémi Verschelde <rverschelde@gmail.com>
Sat, 11 Feb 2017 14:29:26 +0000 (15:29 +0100)
The `clotheslist` and `clotheslistnear` can be used to list the
clothes (and their tint) of a player in the terminal.
The other fix prevents text input in the console from activating
devtools hotkeys (e.g. "p" placing a player).

Docs/DEVTOOLS.txt
Source/Devtools/ConsoleCmds.cpp
Source/Devtools/ConsoleCmds.def
Source/GameTick.cpp

index db82aac66f627560eb50e46455b7a3b6cde8100b..10d040c194723369c018696b0332fb683abccdc2 100644 (file)
@@ -160,6 +160,8 @@ clothes (string) - adds clothes to your character.
     folder of type ".png". You may add any png file in that folder and use it
     with the clothes command. See Decal Editing to create such files.
 clothesnear - does the same for the character nearest to you.
     folder of type ".png". You may add any png file in that folder and use it
     with the clothes command. See Decal Editing to create such files.
 clothesnear - does the same for the character nearest to you.
+clotheslist - lists the clothes of the main player (and their tint).
+clotheslistnear - does the same for the character nearest to you.
 
 Skybox
 ~~~~~~
 
 Skybox
 ~~~~~~
index f6e9dc83b162c0e453a5f394445fe7ea9ac7c4f1..10f37e81398eb6cbdf3a0a9701911d38cb04f848 100644 (file)
@@ -160,6 +160,18 @@ static void set_clothes(int pnum, const char* args)
     Person::players[pnum]->DoMipmaps();
 }
 
     Person::players[pnum]->DoMipmaps();
 }
 
+static void list_clothes(int pnum)
+{
+    printf("Clothes from player %d:\n", pnum);
+    for (int i = 0; i < Person::players[pnum]->numclothes; i++) {
+        printf("%s (%f %f %f)\n",
+               Person::players[pnum]->clothes[i],
+               Person::players[pnum]->clothestintr[i],
+               Person::players[pnum]->clothestintg[i],
+               Person::players[pnum]->clothestintb[i]);
+    }
+}
+
 /* Console commands themselves */
 
 void ch_quit(const char*)
 /* Console commands themselves */
 
 void ch_quit(const char*)
@@ -438,6 +450,19 @@ void ch_clothesnear(const char* args)
     }
 }
 
     }
 }
 
+void ch_clotheslist(const char*)
+{
+    list_clothes(0);
+}
+
+void ch_clotheslistnear(const char*)
+{
+    int closest = findClosestPlayer();
+    if (closest >= 0) {
+        list_clothes(closest);
+    }
+}
+
 void ch_belt(const char*)
 {
     Person::players[0]->skeleton.clothes = !Person::players[0]->skeleton.clothes;
 void ch_belt(const char*)
 {
     Person::players[0]->skeleton.clothes = !Person::players[0]->skeleton.clothes;
index 162636e06c12d12bbe762a939b1b4006d14a0c5c..eb90dde73aba420263870a78e6555edc42698c3c 100644 (file)
@@ -42,6 +42,8 @@ DECLARE_COMMAND(armornear)
 DECLARE_COMMAND(metal)
 DECLARE_COMMAND(clothes)
 DECLARE_COMMAND(clothesnear)
 DECLARE_COMMAND(metal)
 DECLARE_COMMAND(clothes)
 DECLARE_COMMAND(clothesnear)
+DECLARE_COMMAND(clotheslist)
+DECLARE_COMMAND(clotheslistnear)
 DECLARE_COMMAND(noclothes)
 DECLARE_COMMAND(noclothesnear)
 DECLARE_COMMAND(belt)
 DECLARE_COMMAND(noclothes)
 DECLARE_COMMAND(noclothesnear)
 DECLARE_COMMAND(belt)
index c1b038671b454c23beb94698377197e455d84ca6..0b83cedef7f4e3853d76b4f4bd27118ceb94e6c6 100644 (file)
@@ -1022,18 +1022,6 @@ void Game::ProcessInput()
         printf("Stereo separation increased to %f\n", stereoseparation);
     }
 
         printf("Stereo separation increased to %f\n", stereoseparation);
     }
 
-    /* Devtools */
-    if (devtools && !mainmenu) {
-        ProcessDevInput();
-    }
-}
-
-void Game::ProcessDevInput()
-{
-    if (!devtools || mainmenu) {
-        return;
-    }
-
     /* Console */
     if (Input::isKeyPressed(consolekey)) {
         console = !console;
     /* Console */
     if (Input::isKeyPressed(consolekey)) {
         console = !console;
@@ -1045,6 +1033,18 @@ void Game::ProcessDevInput()
         }
     }
 
         }
     }
 
+    /* Devtools */
+    if (devtools && !mainmenu && !console) {
+        ProcessDevInput();
+    }
+}
+
+void Game::ProcessDevInput()
+{
+    if (!devtools || mainmenu || console) {
+        return;
+    }
+
     if (Input::isKeyDown(SDL_SCANCODE_LALT)) {
         /* Enable editor */
         if (Input::isKeyPressed(SDL_SCANCODE_M) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
     if (Input::isKeyDown(SDL_SCANCODE_LALT)) {
         /* Enable editor */
         if (Input::isKeyPressed(SDL_SCANCODE_M) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {