diff --git a/client/entities/base_character.cpp b/client/entities/base_character.cpp index becb773..7ecc275 100644 --- a/client/entities/base_character.cpp +++ b/client/entities/base_character.cpp @@ -21,6 +21,7 @@ */ #include "base_character.hpp" +//TODO: remove this #include "config_utility.hpp" //------------------------- diff --git a/client/entities/entity.hpp b/client/entities/entity.hpp index d0f712a..1b6ef16 100644 --- a/client/entities/entity.hpp +++ b/client/entities/entity.hpp @@ -26,6 +26,7 @@ #include "vector2.hpp" //The base class for all objects in the world +//TODO: write a better hierarchy class Entity { public: virtual void Update(); diff --git a/client/entities/local_character.cpp b/client/entities/local_character.cpp index 16c1eff..013af5f 100644 --- a/client/entities/local_character.cpp +++ b/client/entities/local_character.cpp @@ -26,6 +26,7 @@ bool LocalCharacter::ProcessCollisionGrid(std::list boxList) { for(auto& box : boxList) { if (box.CheckOverlap(origin + bounds)) { + //TODO: write a better collision system origin -= motion; motion = {0, 0}; return true; diff --git a/client/gameplay_scenes/world_logic.cpp b/client/gameplay_scenes/world_logic.cpp index 51c06af..62b88e2 100644 --- a/client/gameplay_scenes/world_logic.cpp +++ b/client/gameplay_scenes/world_logic.cpp @@ -229,9 +229,14 @@ void World::MouseWheel(SDL_MouseWheelEvent const& event) { // } -void World::KeyDown(SDL_KeyboardEvent const& key) { +void World::KeyDown(SDL_KeyboardEvent const& event) { + //BUGFIX: SDL2 introduced key repeats, so I need to ignore it + if (event.repeat) { + return; + } + //hotkeys - switch(key.keysym.sym) { + switch(event.keysym.sym) { case SDLK_ESCAPE: //TODO: (3) the escape key should actually control menus and stuff SendLogoutRequest(); @@ -243,7 +248,7 @@ void World::KeyDown(SDL_KeyboardEvent const& key) { return; } Vector2 motion = localCharacter->GetMotion(); - switch(key.keysym.sym) { + switch(event.keysym.sym) { case SDLK_w: motion.y -= CHARACTER_WALKING_SPEED; break; @@ -270,13 +275,18 @@ void World::KeyDown(SDL_KeyboardEvent const& key) { SendLocalCharacterMovement(); } -void World::KeyUp(SDL_KeyboardEvent const& key) { +void World::KeyUp(SDL_KeyboardEvent const& event) { + //BUGFIX: SDL2 introduced key repeats, so I need to ignore it + if (event.repeat) { + return; + } + //character movement if (!localCharacter) { return; } Vector2 motion = localCharacter->GetMotion(); - switch(key.keysym.sym) { + switch(event.keysym.sym) { case SDLK_w: motion.y = std::min(0.0, motion.y += CHARACTER_WALKING_SPEED); break; diff --git a/client/menu_scenes/lobby_menu.cpp b/client/menu_scenes/lobby_menu.cpp index 3fd1143..bdff03a 100644 --- a/client/menu_scenes/lobby_menu.cpp +++ b/client/menu_scenes/lobby_menu.cpp @@ -68,7 +68,7 @@ LobbyMenu::LobbyMenu(int* const argClientIndex, int* const argAccountIndex): //pseudo-list selection boundingBox = {300, 50, 200, 12}; - //DEBUG: hacked together a highlight box + //hacked together a highlight box highlightImage.Create(GetRenderer(), 300, 12, {49, 150, 5, 255}); //Eat incoming packets diff --git a/common b/common index 2dd2aea..93a955c 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 2dd2aead13f62a3658bdddb3777a383a19949c97 +Subproject commit 93a955caf97d62369f9f94ab4a4894b0b2ece308