From e504c77c060192f2f383925c97ca8592eaaf3586 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20Chilliet?= Date: Mon, 30 Jan 2017 18:52:37 +0100 Subject: [PATCH] Fixed bindings or documentation to make sure both are consistent with each other --- Docs/DEVTOOLS.txt | 6 +++--- Source/GameTick.cpp | 27 +++++++++++++-------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Docs/DEVTOOLS.txt b/Docs/DEVTOOLS.txt index 4ed8008..5685038 100644 --- a/Docs/DEVTOOLS.txt +++ b/Docs/DEVTOOLS.txt @@ -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 diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 8178050..284438a 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -300,11 +300,11 @@ int Game::findClosestPlayer() int closest = -1; float closestdist = std::numeric_limits::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(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); - } - } } } -- 2.39.5