Add Settings menu and an Unlocck All button

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/35/head
Nic0Nic0Nii 10 months ago
parent 7be77e92a5
commit 4f6d9b09e3
  1. 1
      Adventures in Lestoria/Menu.cpp
  2. 1
      Adventures in Lestoria/Menu.h
  3. 3
      Adventures in Lestoria/MenuType.h
  4. 4
      Adventures in Lestoria/OverworldMenuWindow.cpp
  5. 5
      Adventures in Lestoria/SaveFile.cpp
  6. 4
      Adventures in Lestoria/SaveFile.h
  7. 63
      Adventures in Lestoria/SettingsWindow.cpp
  8. 6
      Adventures in Lestoria/TODO.txt
  9. 2
      Adventures in Lestoria/assets/config/MonsterStrategies.txt

@ -96,6 +96,7 @@ void Menu::InitializeMenus(){
InitializeSaveFileWindow();
InitializeLoadGameWindow();
InitializeUserIDWindow();
InitializeSettingsWindow();
for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);type<MenuType::ENUM_END;type=MenuType(int(type+1))){
if(menus.count(type)==0){

@ -103,6 +103,7 @@ class Menu:public IAttributable{
static void InitializeSaveFileWindow();
static void InitializeLoadGameWindow();
static void InitializeUserIDWindow();
static void InitializeSettingsWindow();
friend class AiL;
friend class ItemInfo;

@ -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 <EFBFBD> 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
@ -61,6 +61,7 @@ enum MenuType{
SAVE_FILE_NAME,
LOAD_GAME,
USER_ID,
SETTINGS,
///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
///////////////////////////////////////////////////////////

@ -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 <EFBFBD> 2023 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
@ -56,7 +56,7 @@ void Menu::InitializeOverworldMenuWindow(){
return true;
})END;
overworldMenuWindow->ADD("Inventory Button",MenuComponent)(geom2d::rect<float>{{4,12+28*2},{88,24}},"Inventory",[](MenuFuncData data){Menu::OpenMenu(INVENTORY);return true;})END;
overworldMenuWindow->ADD("Settings Button",MenuComponent)(geom2d::rect<float>{{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){/*Menu::OpenMenu(SETTINGS_MENU);*/return true;})END;
overworldMenuWindow->ADD("Settings Button",MenuComponent)(geom2d::rect<float>{{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){Menu::OpenMenu(SETTINGS);return true;})END;
overworldMenuWindow->ADD("Quit Button",MenuComponent)(geom2d::rect<float>{{4,12+28*4},{88,24}},"Quit Game",[](MenuFuncData data){
Menu::CloseAllMenus();
SaveFile::SaveGame();

@ -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);
@ -373,3 +374,7 @@ const std::string_view SaveFile::GetUserID(){
const void SaveFile::SetUserID(std::string_view userID){
SaveFile::username=userID;
}
bool SaveFile::IsOnline(){
return onlineMode;
}

@ -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 <EFBFBD> 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();

@ -0,0 +1,63 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
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 <EFBFBD> 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;
});
}

@ -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.

@ -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.

Loading…
Cancel
Save