From 474dae85f64d5e1e14be635ae90332017fe2bb62 Mon Sep 17 00:00:00 2001 From: devZoGok Date: Sat, 12 Nov 2022 12:02:20 +0200 Subject: [PATCH] new mappings --- Assets/Scripts/options.lua | 2 ++ Assets/Scripts/unitData.lua | 6 +----- Assets/Scripts/vehicleData.lua | 3 --- activeGameState.cpp | 12 ++++++++++-- activeGameState.h | 3 ++- binds.h | 4 +++- defConfigs.h | 16 ++++++++++------ inGameAppState.cpp | 7 ++++--- 8 files changed, 32 insertions(+), 21 deletions(-) diff --git a/Assets/Scripts/options.lua b/Assets/Scripts/options.lua index e93e239..0fd9024 100644 --- a/Assets/Scripts/options.lua +++ b/Assets/Scripts/options.lua @@ -33,6 +33,8 @@ mappings = { {bind = 29, trigger = 55, action = true, bindType = 0, inOptions = true}, {bind = 30, trigger = 56, action = true, bindType = 0, inOptions = true}, {bind = 31, trigger = 57, action = true, bindType = 0, inOptions = true}, + {bind = 32, trigger = 66, action = true, bindType = 0, inOptions = true}, + {bind = 32, trigger = 256, action = true, bindType = 0, inOptions = true}, } graphics = { resolution = {x = 1366, y = 768} diff --git a/Assets/Scripts/unitData.lua b/Assets/Scripts/unitData.lua index f0ed4ab..a857bf5 100644 --- a/Assets/Scripts/unitData.lua +++ b/Assets/Scripts/unitData.lua @@ -23,11 +23,7 @@ unitType = { } health = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500} -speed = {.025, .025, .05, .05, .1, .1, .1, .1, .1, .1, .15} -destinationOffset = {.75, .75, 1, 1, .1, .1, .1, .1, .1, .5, .5} -anglePrecision = {.1, .1, .1, .1, .1, .1, .1, .1, .1, 3, 3} cost = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500} -maxTurnAngle = {.1, .1, .5, .5, 1, 1, .5, .5, 1, 2, 2} range = {15, 15, 14, 14, 13, 13, 12, 12, 15, 25} unitCornerPoints = { @@ -255,7 +251,7 @@ unitCuboidDimensions = { } }; -unitAxisLength = {8, 8,6,6,5, 5,8, 8, 7,2,2} +unitAxisLength = {8, 8, 6, 6, 5, 5, 8, 8, 7, 2, 2} lineOfSight = {5, 8, 4, 4, 3, 3, 6, 6, 3, 3, 8} name = { "Battleship", "Battleship", diff --git a/Assets/Scripts/vehicleData.lua b/Assets/Scripts/vehicleData.lua index f0ed4ab..bb88499 100644 --- a/Assets/Scripts/vehicleData.lua +++ b/Assets/Scripts/vehicleData.lua @@ -22,13 +22,10 @@ unitType = { UnitType.AIR, UnitType.AIR } -health = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500} speed = {.025, .025, .05, .05, .1, .1, .1, .1, .1, .1, .15} destinationOffset = {.75, .75, 1, 1, .1, .1, .1, .1, .1, .5, .5} anglePrecision = {.1, .1, .1, .1, .1, .1, .1, .1, .1, 3, 3} -cost = {500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500} maxTurnAngle = {.1, .1, .5, .5, 1, 1, .5, .5, 1, 2, 2} -range = {15, 15, 14, 14, 13, 13, 12, 12, 15, 25} unitCornerPoints = { { diff --git a/activeGameState.cpp b/activeGameState.cpp index 63423a5..31e563c 100755 --- a/activeGameState.cpp +++ b/activeGameState.cpp @@ -221,12 +221,13 @@ namespace battleship{ color = Vector3::VEC_J; break; case Order::TYPE::ATTACK: + case Order::TYPE::LAUNCH: color = Vector3::VEC_I; break; case Order::TYPE::PATROL: color = Vector3::VEC_K; break; - case Order::TYPE::LAUNCH: + case Order::TYPE::BUILD: color = Vector3(1, 1, 0); break; } @@ -345,7 +346,8 @@ namespace battleship{ } break; case Bind::LOOK_AROUND: - lookingAround = isPressed; + if(!placingStructure) + lookingAround = isPressed; break; case Bind::HALT: for (Unit *u : selectedUnits) @@ -401,6 +403,12 @@ namespace battleship{ } break; + case Bind::SELECT_STRUCTURE: + placingStructure = true; + break; + case Bind::DESELECT_STRUCTURE: + placingStructure = false; + break; } } diff --git a/activeGameState.h b/activeGameState.h index f713e1a..bbfd2ae 100755 --- a/activeGameState.h +++ b/activeGameState.h @@ -20,6 +20,7 @@ namespace battleship{ void update(); void onAction(int, bool); void onAnalog(int, float); + inline bool isPlacingStructure(){return placingStructure;} inline void setSelectingLaunchPoint(bool s){this->selectingGuidedMissileTarget=s;} inline Player* getPlayer(){return mainPlayer;} inline std::vector& getSelectedUnits(){return selectedUnits;} @@ -47,7 +48,7 @@ namespace battleship{ std::vector unitLightNodes; std::vector unitGroups[9], selectedUnits; std::vector targets; - bool isSelectionBox = false, shiftPressed = false, controlPressed = false, selectingPatrolPoints = false, selectingGuidedMissileTarget = false, lookingAround = false; + bool isSelectionBox = false, shiftPressed = false, controlPressed = false, selectingPatrolPoints = false, selectingGuidedMissileTarget = false, lookingAround = false, placingStructure = false; int playerId, zooms = 0; const int NUM_MAX_ZOOMS = 10; float depth = 1; diff --git a/binds.h b/binds.h index 6839313..4592508 100644 --- a/binds.h +++ b/binds.h @@ -34,7 +34,9 @@ namespace battleship{ GROUP_6, GROUP_7, GROUP_8, - GROUP_9 + GROUP_9, + SELECT_STRUCTURE, + DESELECT_STRUCTURE }; } diff --git a/defConfigs.h b/defConfigs.h index 73c418f..882f925 100755 --- a/defConfigs.h +++ b/defConfigs.h @@ -19,9 +19,9 @@ namespace battleship{ const static int numAppStates = 3; const static int numStaticBinds[numAppStates]{6, 0, 5}; - const static int numConfBinds[numAppStates]{0, 1, 20}; + const static int numConfBinds[numAppStates]{0, 1, 22}; const static int maxStaticBinds = 6; - const static int maxConfBinds = 20; + const static int maxConfBinds = 22; const static Bind staticBinds[numAppStates][maxStaticBinds]{ { @@ -66,7 +66,9 @@ namespace battleship{ Bind::GROUP_6, Bind::GROUP_7, Bind::GROUP_8, - Bind::GROUP_9 + Bind::GROUP_9, + Bind::SELECT_STRUCTURE, + Bind::DESELECT_STRUCTURE } }; @@ -113,7 +115,9 @@ namespace battleship{ GLFW_KEY_6, GLFW_KEY_7, GLFW_KEY_8, - GLFW_KEY_9 + GLFW_KEY_9, + GLFW_KEY_B, + GLFW_KEY_ESCAPE } }; @@ -125,7 +129,7 @@ namespace battleship{ const static bool isConfKey[numAppStates][maxConfBinds]{ {}, {1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; const static bool isStaticAction[numAppStates][maxStaticBinds]{ @@ -136,7 +140,7 @@ namespace battleship{ const static bool isConfAction[numAppStates][maxConfBinds]{ {}, {1}, - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; int calcSumStaticBinds(int, bool); diff --git a/inGameAppState.cpp b/inGameAppState.cpp index cc3c3d1..1297c80 100755 --- a/inGameAppState.cpp +++ b/inGameAppState.cpp @@ -317,9 +317,10 @@ namespace battleship{ void InGameAppState::onAction(int bind, bool isPressed) { switch((Bind)bind){ - case Bind::TOGGLE_MAIN_MENU: - if(isPressed)toggleMainMenu(); - break; + case Bind::TOGGLE_MAIN_MENU: + if(isPressed && !activeState->isPlacingStructure()) + toggleMainMenu(); + break; } }