diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index 8d832915..d196ca1a 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -350,6 +350,10 @@
+
+
+
+
@@ -594,6 +598,10 @@
+
+
+
+
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
index 39983308..c62eaad3 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
@@ -459,6 +459,9 @@
Header Files
+
+ Header Files
+
@@ -803,6 +806,9 @@
Source Files
+
+ Source Files
+
diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp
index 49e43183..91a040e2 100644
--- a/Adventures in Lestoria/AdventuresInLestoria.cpp
+++ b/Adventures in Lestoria/AdventuresInLestoria.cpp
@@ -75,6 +75,7 @@ All rights reserved.
#ifndef __EMSCRIPTEN__
#include "discord.h"
#endif
+#include "GameSettings.h"
INCLUDE_EMITTER_LIST
INCLUDE_ITEM_CATEGORIES
@@ -298,6 +299,10 @@ bool AiL::OnUserCreate(){
bool AiL::OnUserUpdate(float fElapsedTime){
levelTime+=fElapsedTime;
+ if(GetMousePos()!=lastMousePos){
+ lastMouseMovement=0.f;
+ lastMousePos=GetMousePos();
+ }else lastMouseMovement+=fElapsedTime;
if(!GamePaused()){
GameState::STATE->OnUserUpdate(this);
}
@@ -1163,7 +1168,7 @@ void AiL::RenderWorld(float fElapsedTime){
#pragma endregion
RenderTile(*tile,{255,255,255,uint8_t(255-tile->tileOpacity/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
float distToPlayer=geom2d::line(player->GetPos(),tile->pos+vf2d{12,12}).length();
- if(distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
+ if(GameSettings::TerrainCollisionBoxesEnabled()&&distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
geom2d::rectcollision=tile->tileSheet.tileset->collision[tile->tileID].collision;
distToPlayer/=4;
if(distToPlayer<1){distToPlayer=1;}
@@ -1330,7 +1335,7 @@ void AiL::RenderWorld(float fElapsedTime){
#pragma endregion
RenderTile(*tile,{255,255,255,uint8_t(255-tile->tileOpacity/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
float distToPlayer=geom2d::line(player->GetPos(),tile->pos+vf2d{12,12}).length();
- if(distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
+ if(GameSettings::TerrainCollisionBoxesEnabled()&&distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
geom2d::rectcollision=tile->tileSheet.tileset->collision[tile->tileID].collision;
distToPlayer/=4;
if(distToPlayer<1){distToPlayer=1;}
@@ -1657,6 +1662,7 @@ vf2d AiL::GetWorldMousePos(){
}
void AiL::SetupWorldShake(float duration){
+ if(!GameSettings::ScreenShakeEnabled())return;
worldShakeVel={13,-13};
worldShakeTime=duration;
worldShake=vf2d{player->GetPos()};
@@ -3224,8 +3230,14 @@ void AiL::GetAnyMouseRelease(int32_t mouseButton){
#pragma endregion
GameState::STATE->GetAnyMouseRelease(mouseButton);
+ lastMouseMovement=0.f;
}
void AiL::GetAnyMousePress(int32_t mouseButton){
GameState::STATE->GetAnyMousePress(mouseButton);
+ lastMouseMovement=0.f;
+}
+
+const float AiL::LastMouseMovement()const{
+ return lastMouseMovement;
}
\ No newline at end of file
diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h
index 2827377d..386d6f37 100644
--- a/Adventures in Lestoria/AdventuresInLestoria.h
+++ b/Adventures in Lestoria/AdventuresInLestoria.h
@@ -160,6 +160,8 @@ private:
Pixel worldColor=WHITE;
std::functionworldColorFunc=[](vi2d pos){return WHITE;};
std::map>ZONE_LIST;
+ float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with.
+ vi2d lastMousePos={};
void ValidateGameStatus();
#ifndef __EMSCRIPTEN__
@@ -277,6 +279,8 @@ public:
//Returns the zones of any given stage
const std::map>&GetZones(const std::string_view mapName)const;
void AddZone(const std::string_view zoneName,const ZoneData&zone);
+ //Returns the last time the mouse was moved or interacted with.
+ const float LastMouseMovement()const;
struct TileGroupData{
vi2d tilePos;
diff --git a/Adventures in Lestoria/Checkbox.h b/Adventures in Lestoria/Checkbox.h
index 89bba065..0eca8147 100644
--- a/Adventures in Lestoria/Checkbox.h
+++ b/Adventures in Lestoria/Checkbox.h
@@ -39,6 +39,7 @@ All rights reserved.
#include "MenuComponent.h"
#include "AdventuresInLestoria.h"
+#include "SoundEffect.h"
INCLUDE_game
@@ -48,7 +49,7 @@ protected:
ToggleFunc onToggle;
inline void Toggle(){
- checked=!checked;
+ SetChecked(!checked);
onToggle(ToggleFuncData{*Menu::menus[parentMenu],game,Menu::menus[parentMenu]->components[name],parentComponent,checked});
}
public:
@@ -65,6 +66,11 @@ public:
inline void SetChecked(bool checked){
this->checked=checked;
+ if(checked){
+ SoundEffect::PlaySFX("Toggle On",SoundEffect::CENTERED);
+ }else{
+ SoundEffect::PlaySFX("Toggle Off",SoundEffect::CENTERED);
+ }
}
inline void DrawDecal(ViewPort&window,bool focused)override{
diff --git a/Adventures in Lestoria/GameSettings.cpp b/Adventures in Lestoria/GameSettings.cpp
new file mode 100644
index 00000000..14d00c94
--- /dev/null
+++ b/Adventures in Lestoria/GameSettings.cpp
@@ -0,0 +1,70 @@
+#pragma region License
+/*
+License (OLC-3)
+~~~~~~~~~~~~~~~
+
+Copyright 2024 Joshua Sigona
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions or derivations of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions or derivative works in binary form must reproduce the above
+copyright notice. This list of conditions and the following disclaimer must be
+reproduced in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+Portions of this software are copyright © 2024 The FreeType
+Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
+All rights reserved.
+*/
+#pragma endregion
+
+#include "GameSettings.h"
+
+bool GameSettings::screenShake=true;
+bool GameSettings::rumble=true;
+bool GameSettings::terrainCollisionBoxes=true;
+bool GameSettings::keyboardAutoAim=false;
+
+const bool GameSettings::ScreenShakeEnabled(){
+ return screenShake;
+}
+const bool GameSettings::RumbleEnabled(){
+ return rumble;
+}
+const bool GameSettings::TerrainCollisionBoxesEnabled(){
+ return terrainCollisionBoxes;
+}
+const bool GameSettings::KeyboardAutoAimEnabled(){
+ return keyboardAutoAim;
+}
+
+void GameSettings::SetScreenShake(bool screenShakeEnabled){
+ screenShake=screenShakeEnabled;
+}
+void GameSettings::SetRumble(bool rumbleEnabled){
+ rumble=rumbleEnabled;
+}
+void GameSettings::SetTerrainCollisionBoxes(bool terrainCollisionBoxesEnabled){
+ terrainCollisionBoxes=terrainCollisionBoxesEnabled;
+}
+void GameSettings::SetKeyboardAutoAim(bool autoAimEnabled){
+ keyboardAutoAim=autoAimEnabled;
+}
\ No newline at end of file
diff --git a/Adventures in Lestoria/GameSettings.h b/Adventures in Lestoria/GameSettings.h
new file mode 100644
index 00000000..18e6c430
--- /dev/null
+++ b/Adventures in Lestoria/GameSettings.h
@@ -0,0 +1,54 @@
+#pragma region License
+/*
+License (OLC-3)
+~~~~~~~~~~~~~~~
+
+Copyright 2024 Joshua Sigona
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions or derivations of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions or derivative works in binary form must reproduce the above
+copyright notice. This list of conditions and the following disclaimer must be
+reproduced in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+Portions of this software are copyright © 2024 The FreeType
+Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
+All rights reserved.
+*/
+#pragma endregion
+#pragma once
+
+class GameSettings{
+ static bool screenShake;
+ static bool rumble;
+ static bool terrainCollisionBoxes;
+ static bool keyboardAutoAim;
+public:
+ static const bool ScreenShakeEnabled();
+ static const bool RumbleEnabled();
+ static const bool TerrainCollisionBoxesEnabled();
+ static const bool KeyboardAutoAimEnabled();
+ static void SetScreenShake(bool screenShakeEnabled);
+ static void SetRumble(bool rumbleEnabled);
+ static void SetTerrainCollisionBoxes(bool terrainCollisionBoxesEnabled);
+ static void SetKeyboardAutoAim(bool autoAimEnabled);
+};
\ No newline at end of file
diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp
index ce0dfbfd..b7edd338 100644
--- a/Adventures in Lestoria/Key.cpp
+++ b/Adventures in Lestoria/Key.cpp
@@ -40,6 +40,7 @@ All rights reserved.
#include "AdventuresInLestoria.h"
#include "olcPGEX_Gamepad.h"
#include "Menu.h"
+#include "GameSettings.h"
INCLUDE_game
INCLUDE_GFX
@@ -564,6 +565,7 @@ const bool Input::AxesActive(){
}
void Input::StartVibration(){
+ if(!GameSettings::RumbleEnabled())return;
if(UsingGamepad()){
for(GamePad*gamepad:GamePad::getGamepads()){
if(gamepad->stillConnected){
diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp
index a022e4af..501df64a 100644
--- a/Adventures in Lestoria/Menu.cpp
+++ b/Adventures in Lestoria/Menu.cpp
@@ -163,6 +163,12 @@ void Menu::Update(AiL*game){
}
for(auto&[key,button]:components){
+ if(button->F(A::RUMBLE_TIMER)>0.f){
+ button->F(A::RUMBLE_TIMER)=std::max(button->F(A::RUMBLE_TIMER)-game->GetElapsedTime(),0.f);
+ if(button->F(A::RUMBLE_TIMER)==0.f){
+ Input::StopVibration();
+ }
+ }
if(!button->disable||!button->disableOutsideWindow){
button->hovered=false;
}
@@ -316,35 +322,37 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
}
}
- for(auto&[input,data]:inputGroups){
- if(Menu::alreadyClicked)break;
- bool activated=false;
- switch(input.GetEngageType()){
- case Released:{
- activated=input.GetGroup().Released();
- }break;
- case Pressed:{
- activated=input.GetGroup().Pressed();
- }break;
- case PressedDAS:{
- activated=input.GetGroup().PressedDAS();
- }break;
- case Held:{
- activated=input.GetGroup().Held();
- }break;
- case Analog:{
- activated=input.GetGroup().Analog()!=0.f;
- }break;
- [[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
- }
+ if(!Menu::UsingMouseNavigation()){
+ for(auto&[input,data]:inputGroups){
+ if(Menu::alreadyClicked)break;
+ bool activated=false;
+ switch(input.GetEngageType()){
+ case Released:{
+ activated=input.GetGroup().Released();
+ }break;
+ case Pressed:{
+ activated=input.GetGroup().Pressed();
+ }break;
+ case PressedDAS:{
+ activated=input.GetGroup().PressedDAS();
+ }break;
+ case Held:{
+ activated=input.GetGroup().Held();
+ }break;
+ case Analog:{
+ activated=input.GetGroup().Analog()!=0.f;
+ }break;
+ [[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
+ }
- if(activated){
- auto&action=data.second;
- if(std::holds_alternative(action))Component(type,std::get(action))->Click();
- else
- if(std::holds_alternative>(action))std::get>(action)(type);
- else{
- ERR("WARNING! Navigation data has an unrecognized type or is empty! This should not be happening!")
+ if(activated){
+ auto&action=data.second;
+ if(std::holds_alternative(action))Component(type,std::get(action))->Click();
+ else
+ if(std::holds_alternative>(action))std::get>(action)(type);
+ else{
+ ERR("WARNING! Navigation data has an unrecognized type or is empty! This should not be happening!")
+ }
}
}
}
diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h
index c0d39f68..bdc3fc0c 100644
--- a/Adventures in Lestoria/MonsterAttribute.h
+++ b/Adventures in Lestoria/MonsterAttribute.h
@@ -99,4 +99,5 @@ enum class Attribute{
KEYBIND,
ITEM_SLOT,
MERCHANT_ITEM_SLOT,
+ RUMBLE_TIMER, //NOTE: This timer automatically counts down inside of Menu.cpp!! Stops controller rumble when the timer ends.
};
\ No newline at end of file
diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp
index 3b4f0305..5b336559 100644
--- a/Adventures in Lestoria/Player.cpp
+++ b/Adventures in Lestoria/Player.cpp
@@ -54,6 +54,7 @@ All rights reserved.
#include "olcPGEX_Gamepad.h"
#include "ProgressBar.h"
#include "MenuLabel.h"
+#include "GameSettings.h"
INCLUDE_MONSTER_DATA
INCLUDE_MONSTER_LIST
@@ -1293,7 +1294,7 @@ const vf2d Player::GetWorldAimingLocation(){
}
const vf2d Player::GetAimingLocation(){
- if(Input::UsingGamepad()){
+ if(UsingAutoAim()){
float xAxis=0.f,yAxis=0.f;
#pragma region Manual Aiming
for(GamePad*gamepad:GamePad::getGamepads()){
@@ -1334,4 +1335,7 @@ const vf2d Player::GetAimingLocation(){
}else{
return game->GetMousePos();
}
+}
+const bool Player::UsingAutoAim()const{
+ return (GameSettings::KeyboardAutoAimEnabled()&&game->LastMouseMovement()>=2.f)||Input::UsingGamepad();
}
\ No newline at end of file
diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h
index 9574ecda..8d1b559b 100644
--- a/Adventures in Lestoria/Player.h
+++ b/Adventures in Lestoria/Player.h
@@ -301,6 +301,7 @@ private:
//Set playerInvoked to false when you don't want a movement loop due to collisions.
//Typical usage is playerInvoked is true on first call, and playerInvoked is false on all subsequent chained calls.
bool _SetY(float y,const bool playerInvoked=true);
+ const bool UsingAutoAim()const;
protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;
diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp
index 8562d11f..0a49f35d 100644
--- a/Adventures in Lestoria/SaveFile.cpp
+++ b/Adventures in Lestoria/SaveFile.cpp
@@ -47,6 +47,7 @@ All rights reserved.
#include "LoadFileButton.h"
#include "Checkbox.h"
#include "InputDisplayComponent.h"
+#include "GameSettings.h"
INCLUDE_game
@@ -123,6 +124,12 @@ const void SaveFile::SaveGame(){
saveFile["Game Time"].SetReal(game->GetRuntime());
saveFile["TravelingMerchant"].SetString(std::string(Merchant::GetCurrentTravelingMerchant().GetKeyName()));
+ saveFile["Screen Shake"].SetBool(GameSettings::ScreenShakeEnabled());
+ saveFile["Controller Rumble"].SetBool(GameSettings::RumbleEnabled());
+ saveFile["Terrain Collision Boxes"].SetBool(GameSettings::TerrainCollisionBoxesEnabled());
+ saveFile["Keyboard Auto-Aim"].SetBool(GameSettings::KeyboardAutoAimEnabled());
+ saveFile["Fullscreen"].SetBool(game->IsFullscreen());
+
#pragma region Save Keyboard/Controller mappings
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
const int menuRowCount=DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()/2+1;
@@ -276,6 +283,12 @@ void SaveFile::LoadFile(){
game->GetPlayer()->RecalculateEquipStats();
if(loadFile.HasProperty("TravelingMerchant"))Merchant::SetTravelingMerchant(loadFile["TravelingMerchant"].GetString());
+ if(loadFile.HasProperty("Screen Shake"))GameSettings::SetScreenShake(loadFile["Screen Shake"].GetBool());
+ if(loadFile.HasProperty("Controller Rumble"))GameSettings::SetRumble(loadFile["Controller Rumble"].GetBool());
+ if(loadFile.HasProperty("Terrain Collision Boxes"))GameSettings::SetTerrainCollisionBoxes(loadFile["Terrain Collision Boxes"].GetBool());
+ if(loadFile.HasProperty("Keyboard Auto-Aim"))GameSettings::SetKeyboardAutoAim(loadFile["Keyboard Auto-Aim"].GetBool());
+ if(loadFile.HasProperty("Fullscreen"))game->SetFullScreen(loadFile["Fullscreen"].GetBool());
+
#pragma region Load Keyboard/Controller mappings
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
const int menuRowCount=DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()/2+1;
diff --git a/Adventures in Lestoria/SettingsWindow.cpp b/Adventures in Lestoria/SettingsWindow.cpp
index 7c1e2c79..6be9e53d 100644
--- a/Adventures in Lestoria/SettingsWindow.cpp
+++ b/Adventures in Lestoria/SettingsWindow.cpp
@@ -48,6 +48,7 @@ All rights reserved.
#include "Slider.h"
#include "Checkbox.h"
#include "InputDisplayComponent.h"
+#include "GameSettings.h"
INCLUDE_DATA
INCLUDE_game
@@ -59,7 +60,7 @@ void Menu::InitializeSettingsWindow(){
vf2d windowSize=WINDOW_SIZE-vf2d{28,28};
Menu*settingsWindow=CreateMenu(SETTINGS,CENTERED,windowSize);
- settingsWindow->ADD("Unlock All Button",MenuComponent)(geom2d::rect{{4,windowSize.y-12},{72,12}},"Unlock All",[](MenuFuncData data){
+ settingsWindow->ADD("Unlock All Button",MenuComponent)(geom2d::rect{{4,windowSize.y},{72,12}},"Unlock All",[](MenuFuncData data){
for(auto&cp:State_OverworldMap::connections){
Unlock::UnlockArea(cp.map);
}
@@ -85,14 +86,39 @@ void Menu::InitializeSettingsWindow(){
Menu::menus[SETTINGS]->F(A::LAST_SFX_VOLUME)=val;
}
})END;
- settingsWindow->ADD("Terrain Collision Boxes Checkbox",Checkbox)(geom2d::rect{{windowSize.x/2-88.f,84},{16.f,16.f}},[](ToggleFuncData data){
+ settingsWindow->ADD("Screen Shake Checkbox",Checkbox)(geom2d::rect{{4.f,84},{16.f,16.f}},[](ToggleFuncData data){
+ GameSettings::SetScreenShake(data.checked);
return true;
},true)END;
- settingsWindow->ADD("Terrain Collision Boxes Label",MenuLabel)(geom2d::rect{{windowSize.x/2-68.f,84},{windowSize.x/2+54.f,16.f}},"Terrain Collision Boxes",1.f,ComponentAttr::SHADOW)END;
- settingsWindow->ADD("Keyboard Play Auto-Aim Checkbox",Checkbox)(geom2d::rect{{windowSize.x/2-88.f,104},{16.f,16.f}},[](ToggleFuncData data){
+ settingsWindow->ADD("Screen Shake Label",MenuLabel)(geom2d::rect{{22.f,84},{windowSize.x/2-24.f,16.f}},"Screen Shake",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
+ settingsWindow->ADD("Controller Rumble Checkbox",Checkbox)(geom2d::rect{{4.f,104},{16.f,16.f}},[](ToggleFuncData data){
+ GameSettings::SetRumble(data.checked);
+ if(GameSettings::RumbleEnabled()){
+ Input::StartVibration();
+ data.component.lock()->F(A::RUMBLE_TIMER)=0.3f;
+ }else{
+ Input::StopVibration();
+ }
+ return true;
+ },true)END;
+ settingsWindow->ADD("Controller Rumble Label",MenuLabel)(geom2d::rect{{22.f,104},{windowSize.x/2-24.f,16.f}},"Gamepad Rumble",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
+
+ settingsWindow->ADD("Terrain Collision Boxes Checkbox",Checkbox)(geom2d::rect{{windowSize.x/2+4.f,84},{16.f,16.f}},[](ToggleFuncData data){
+ GameSettings::SetTerrainCollisionBoxes(data.checked);
+ return true;
+ },true)END;
+ settingsWindow->ADD("Terrain Collision Boxes Label",MenuLabel)(geom2d::rect{{windowSize.x/2+22.f,84},{windowSize.x/2-24.f,16.f}},"Terrain Collision Boxes",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
+ settingsWindow->ADD("Keyboard Play Auto-Aim Checkbox",Checkbox)(geom2d::rect{{windowSize.x/2+4.f,104},{16.f,16.f}},[](ToggleFuncData data){
+ GameSettings::SetKeyboardAutoAim(data.checked);
return true;
},false)END;
- settingsWindow->ADD("Keyboard Play Auto-Aim Label",MenuLabel)(geom2d::rect{{windowSize.x/2-68.f,104},{windowSize.x/2+54.f,16.f}},"Keyboard Aim Assist\n (For Keyboard Only Players)",1.f,ComponentAttr::SHADOW)END;
+ settingsWindow->ADD("Keyboard Play Auto-Aim Label",MenuLabel)(geom2d::rect{{windowSize.x/2+22.f,104},{windowSize.x/2-24.f,16.f}},"Aim Assist\n(No Mouse Players)",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
+ #ifndef __EMSCRIPTEN__
+ settingsWindow->ADD("Fullscreen Toggle Checkbox",Checkbox)(geom2d::rect{{windowSize.x/2+4.f,124},{16.f,16.f}},[](ToggleFuncData data){
+ return true;
+ },false)END;
+ settingsWindow->ADD("Fullscreen Toggle Label",MenuLabel)(geom2d::rect{{windowSize.x/2+22.f,124},{windowSize.x/2-24.f,16.f}},"Fullscreen",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
+ #endif
#pragma region Setup all input displays as keyboard controls.
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
@@ -116,20 +142,20 @@ void Menu::InitializeSettingsWindow(){
};
#pragma endregion
- settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",[&](MenuFuncData data){
+ settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect{{28,144.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",[&](MenuFuncData data){
ChangeKeybindDisplayType(KEY);
Component(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Keyboard Mappings");
Menu::OpenMenu(INPUT_KEY_DISPLAY);
return true;
},vf2d{1.5f,2.f})END;
- settingsWindow->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",[&](MenuFuncData data){
+ settingsWindow->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect{{28,172.f},vf2d{windowSize.x-32,24}},"Controller Bindings",[&](MenuFuncData data){
ChangeKeybindDisplayType(CONTROLLER);
Component(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Controller Mappings");
Menu::OpenMenu(INPUT_KEY_DISPLAY);
return true;
},vf2d{1.5f,2.f})END;
- settingsWindow->ADD("Go Back",MenuComponent)(geom2d::rect{vf2d{windowSize.x/2.f,windowSize.y}-vf2d{36,16},{72,12}},"Go Back",[](MenuFuncData data){
+ settingsWindow->ADD("Go Back",MenuComponent)(geom2d::rect{vf2d{windowSize.x/2.f,windowSize.y}-vf2d{36,4},{72,12}},"Go Back",[](MenuFuncData data){
Menu::CloseMenu();
return true;
})END;
diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt
index cb8c83c6..3c1ded4b 100644
--- a/Adventures in Lestoria/TODO.txt
+++ b/Adventures in Lestoria/TODO.txt
@@ -9,6 +9,9 @@ January 1st
- Add screen shake and rumble as a toggle.
+- Fullscreen toggle
+ > Implement fullscreen capabilities for the PGE.
+
- Toggle between Playstation / Xbox controller gamepad displays
- Rebind FACELEFT/FACERIGHT menu keys (as they are used constantly throughout menus and would need to be rebinded if the player wants). (Or make confirm/back not rebindable)
@@ -31,8 +34,6 @@ January 31st
- Save window position and size
-- Fullscreen toggle
-
- Condense stage track (loading times)
- If you enter the keyboard config menu and press a controller button, it cancels the request. If you enter the controller config menu and press a keyboard/mouse button, it also cancels the request.
\ No newline at end of file
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index 54a550d7..8b145885 100644
--- a/Adventures in Lestoria/Version.h
+++ b/Adventures in Lestoria/Version.h
@@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
-#define VERSION_BUILD 7326
+#define VERSION_BUILD 7344
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt
index f187f8be..052da250 100644
--- a/Adventures in Lestoria/assets/config/audio/events.txt
+++ b/Adventures in Lestoria/assets/config/audio/events.txt
@@ -181,6 +181,16 @@ Events
File[1] = slime_walk2.ogg, 10%
File[2] = slime_walk3.ogg, 10%
}
+ Toggle On
+ {
+ # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
+ File[0] = toggle_on.ogg, 100%
+ }
+ Toggle Off
+ {
+ # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
+ File[0] = toggle_off.ogg, 100%
+ }
Ursule Dead
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
diff --git a/Adventures in Lestoria/assets/sounds/toggle_off.ogg b/Adventures in Lestoria/assets/sounds/toggle_off.ogg
new file mode 100644
index 00000000..0bee8fa3
Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/toggle_off.ogg differ
diff --git a/Adventures in Lestoria/assets/sounds/toggle_on.ogg b/Adventures in Lestoria/assets/sounds/toggle_on.ogg
new file mode 100644
index 00000000..d971c6cf
Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/toggle_on.ogg differ
diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h
index 1495d2b3..35f4f888 100644
--- a/Adventures in Lestoria/olcPixelGameEngine.h
+++ b/Adventures in Lestoria/olcPixelGameEngine.h
@@ -1067,6 +1067,8 @@ namespace olc
const olc::vi2d& GetScreenPixelSize() const;
// Gets "screen" size
const olc::vi2d& GetScreenSize() const;
+ const bool IsFullscreen()const;
+ void SetFullScreen(bool bFullscreen);
// Gets any files dropped this frame
const std::vector& GetDroppedFiles() const;
const olc::vi2d& GetDroppedFilesPoint() const;
@@ -1352,7 +1354,6 @@ namespace olc
std::vector> vKeyboardMap;
-
// State of keyboard
bool pKeyNewState[256] = { 0 };
bool pKeyOldState[256] = { 0 };
@@ -2269,6 +2270,14 @@ namespace olc
const olc::vi2d& PixelGameEngine::GetScreenSize() const
{ return vScreenSize; }
+ const bool PixelGameEngine::IsFullscreen()const{
+ return bFullScreen;
+ }
+
+ void PixelGameEngine::SetFullScreen(bool bFullscreen){
+ //TODO: Implement fullscreen capabilities.
+ }
+
const olc::vi2d& PixelGameEngine::GetWindowMouse() const
{ return vMouseWindowPos; }
diff --git a/Adventures in Lestoria/olcUTIL_DataFile.h b/Adventures in Lestoria/olcUTIL_DataFile.h
index af30496e..d899a077 100644
--- a/Adventures in Lestoria/olcUTIL_DataFile.h
+++ b/Adventures in Lestoria/olcUTIL_DataFile.h
@@ -135,6 +135,12 @@ namespace olc::utils
return GetString(nItem).starts_with('T')||GetString(nItem).starts_with('t');
}
+ // Sets the Boolean Value of a Property
+ inline void SetBool(const bool b, const size_t nItem = 0)
+ {
+ b?SetString("True",nItem):SetString("False",nItem);
+ }
+
// Sets the Integer Value of a Property (for a given index)
inline void SetInt(const int32_t n, const size_t nItem = 0)
{
diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe
index 1bc322b4..b6907ec9 100644
Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ