]> git.jsancho.org Git - lugaru.git/commitdiff
Fixed bindings or documentation to make sure both are consistent with each other
authorCôme Chilliet <come@chilliet.eu>
Mon, 30 Jan 2017 17:52:37 +0000 (18:52 +0100)
committerCôme Chilliet <come@chilliet.eu>
Mon, 30 Jan 2017 17:52:37 +0000 (18:52 +0100)
Docs/DEVTOOLS.txt
Source/GameTick.cpp

index 4ed8008380fbeda4223b46854b010444f48c63de..5685038295aaccc091476a9c6dbfbb970ada16b1 100644 (file)
@@ -49,11 +49,11 @@ alt+shift+i = explode nearby enemy
 Map editor:
 
 alt+m = toggle editor mode
-m = place object
+o = place object
 p = place enemy
 shift+p = place waypoint
-delete = delete most recently made object
-shift+delete = delete most recently made player
+delete = delete closest object
+shift+delete = delete closest player
 up/down = change size of next object
 control+up/down = change tilt of next object
 left/right = change rotation of next object
index 81780500ffa30acba2823aca35dd58d7d7d24fb1..284438a1f1f549f1faf29e45b5ba11ef7b96b08c 100644 (file)
@@ -300,11 +300,11 @@ int Game::findClosestPlayer()
     int closest = -1;
     float closestdist = std::numeric_limits<float>::max();
 
-    for (unsigned i = 1; i < Person::players.size(); i++) {
+    for (unsigned int i = 1; i < Person::players.size(); i++) {
         float distance = distsq(&Person::players[i]->coords, &Person::players[0]->coords);
         if (distance < closestdist) {
             closestdist = distance;
-            closest = i;
+            closest = (int)i;
         }
     }
     return closest;
@@ -1363,21 +1363,24 @@ void doDevKeys()
     }
 
     if (editorenabled) {
+        /* Closest player deletion */
         if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
             int closest = findClosestPlayer();
-            if (closest >= 0) {
+            if (closest > 0) {
                 Person::players.erase(Person::players.begin() + closest);
             }
         }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+        /* Closest object deletion */
+        if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
             int closest = findClosestObject();
             if (closest >= 0) {
-                Object::objects[closest]->position.y -= 500;
+                Object::DeleteObject(closest);
             }
         }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        /* Add object */
+        if (Input::isKeyPressed(SDL_SCANCODE_O) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
             if (Object::objects.size() < max_objects - 1) {
                 XYZ scenecoords;
                 scenecoords.x = Person::players[0]->coords.x;
@@ -1406,7 +1409,8 @@ void doDevKeys()
             }
         }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+        /* Add player */
+        if (Input::isKeyPressed(SDL_SCANCODE_P) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
             Person::players.push_back(shared_ptr<Person>(new Person()));
 
             Person::players.back()->id = Person::players.size() - 1;
@@ -1502,6 +1506,7 @@ void doDevKeys()
             Person::players.back()->loaded = true;
         }
 
+        /* Add waypoint */
         if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
             if (Person::players.back()->numwaypoints < 90) {
                 Person::players.back()->waypoints[Person::players.back()->numwaypoints] = Person::players[0]->coords;
@@ -1510,6 +1515,7 @@ void doDevKeys()
             }
         }
 
+        /* Connect waypoint */
         if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
             if (numpathpoints < 30) {
                 bool connected, alreadyconnected;
@@ -1641,13 +1647,6 @@ void doDevKeys()
                 editorpitch = -.01;
             }
         }
-
-        if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Object::objects.size() && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            int closest = findClosestObject();
-            if (closest >= 0) {
-                Object::DeleteObject(closest);
-            }
-        }
     }
 }