diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index b6d1b3f2..69130ed0 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -96,6 +96,7 @@ void Menu::InitializeMenus(){ InitializeSaveFileWindow(); InitializeLoadGameWindow(); InitializeUserIDWindow(); + InitializeSettingsWindow(); for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);typeADD("Inventory Button",MenuComponent)(geom2d::rect{{4,12+28*2},{88,24}},"Inventory",[](MenuFuncData data){Menu::OpenMenu(INVENTORY);return true;})END; - overworldMenuWindow->ADD("Settings Button",MenuComponent)(geom2d::rect{{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){/*Menu::OpenMenu(SETTINGS_MENU);*/return true;})END; + overworldMenuWindow->ADD("Settings Button",MenuComponent)(geom2d::rect{{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){Menu::OpenMenu(SETTINGS);return true;})END; overworldMenuWindow->ADD("Quit Button",MenuComponent)(geom2d::rect{{4,12+28*4},{88,24}},"Quit Game",[](MenuFuncData data){ Menu::CloseAllMenus(); SaveFile::SaveGame(); diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 3682f0d0..645cb771 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -51,6 +51,7 @@ INCLUDE_game size_t SaveFile::saveFileID=0; std::string SaveFile::saveFileName=""; std::string SaveFile::username=""; +bool SaveFile::onlineMode=false; const size_t SaveFile::GetSaveFileCount(){ std::filesystem::create_directories("save_file_path"_S); @@ -372,4 +373,8 @@ const std::string_view SaveFile::GetUserID(){ } const void SaveFile::SetUserID(std::string_view userID){ SaveFile::username=userID; +} + +bool SaveFile::IsOnline(){ + return onlineMode; } \ No newline at end of file diff --git a/Adventures in Lestoria/SaveFile.h b/Adventures in Lestoria/SaveFile.h index df4dd9d5..78fc7968 100644 --- a/Adventures in Lestoria/SaveFile.h +++ b/Adventures in Lestoria/SaveFile.h @@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Portions of this software are copyright © 2023 The FreeType +Portions of this software are copyright � 2023 The FreeType Project (www.freetype.org). Please see LICENSE_FT.txt for more information. All rights reserved. */ @@ -52,10 +52,12 @@ class SaveFile{ static size_t saveFileID; static std::string saveFileName; static std::string username; + static bool onlineMode; public: static const std::string_view GetSaveFileName(); static const void SetSaveFileName(std::string_view saveFileName); static const size_t GetSaveFileCount(); + static bool IsOnline(); static const std::string_view GetUserID(); static const void SetUserID(std::string_view userID); static const void SaveGame(); diff --git a/Adventures in Lestoria/SettingsWindow.cpp b/Adventures in Lestoria/SettingsWindow.cpp new file mode 100644 index 00000000..8ddb526e --- /dev/null +++ b/Adventures in Lestoria/SettingsWindow.cpp @@ -0,0 +1,63 @@ +#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 � 2023 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "Menu.h" +#include "MenuComponent.h" +#include "SoundEffect.h" +#include "DEFINES.h" +#include "olcUTIL_DataFile.h" +#include "Unlock.h" + +INCLUDE_DATA + +void Menu::InitializeSettingsWindow(){ + vf2d windowSize=game->WINDOW_SIZE-vf2d{28,28}; + Menu*settingsWindow=CreateMenu(SETTINGS,CENTERED,windowSize); + + settingsWindow->ADD("Unlock All Button",MenuComponent)({{4,4},{72,12}},"Unlock All",[](MenuFuncData data){ + for(auto&[key,size]:DATA["Levels"]){ + Unlock::UnlockArea(key); + } + SoundEffect::PlaySFX("Buy Item",SoundEffect::CENTERED); + return true; + }); + settingsWindow->ADD("Go Back",MenuComponent)({windowSize/2-vf2d{36,16},{72,12}},"Go Back",[](MenuFuncData data){ + Menu::CloseMenu(); + return true; + }); +} \ No newline at end of file diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 0d0f6295..a3b8241a 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -24,6 +24,12 @@ Story proofreading/correcting/storyboarding - Title Screen setpieces - Emscripten saving/loading files locally or cloud, can choose at menu. + -> New Game: Add checkbox to turn online saving on. + If clicked, prompts the user to enter a username for online saving to occur on. + Username gets stored and online mode is turned on. + -> Load Game: Two tabs at the top, Default will be "Local Saves". Second tab says "Online Saves". + If Local Saves is clicked, repopulate the list with the files from the metadata file. + If Online Saves is clicked, repopulate the list with the files from the metadata_online file received. - Lock up unimplemented classes. diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 034ba4e6..399fb69e 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -368,6 +368,7 @@ MonsterStrategy Wisp Color = 247, 157, 0, 255 # There are 6 rows of wisps and we want them to spawn outside the arena + # - (6 * Wisp Height) = How far above the arena to spawn. Wisp Pattern Spawn Y = -144 # Amount of time the wisp fades out after hitting the player. @@ -452,6 +453,7 @@ MonsterStrategy Wisp Color = 247, 95, 0, 255 # There are 6 rows of wisps and we want them to spawn outside the arena + # - (6 * Wisp Height) = How far above the arena to spawn. Wisp Pattern Spawn Y = -144 # Amount of time the wisp fades out after hitting the player.