From cf6185bb505f0bddedb0db770f90580491c326bc Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Mon, 1 Jan 2024 08:00:14 -0600 Subject: [PATCH] Game saves when exiting to the main menu or quitting the game in general. Rings are now properly in the Accessories tab instead of the equipment tab. Fixed using == comparison instead of bitwise AND comparisons for accessory detection. --- Crawler/Crawler.cpp | 3 +++ Crawler/Item.cpp | 4 ++-- Crawler/OverworldMenuWindow.cpp | 2 ++ Crawler/Version.h | 2 +- Crawler/assets/config/items/Accessories.txt | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index f23bf084..c5215c47 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -2076,6 +2076,9 @@ bool Crawler::IsReflectiveTile(TilesheetData tileSheet,int tileID){ } bool Crawler::OnUserDestroy(){ + if(GameState::STATE!=GameState::states[States::MAIN_MENU]){ //If we're on the main menu, we don't have a save file loaded. So we would skip saving the game. + SaveFile::SaveGame(); + } GFX.Reset(); for(auto&[key,value]:MAP_DATA){ if(MAP_DATA[key].optimizedTile!=nullptr){ diff --git a/Crawler/Item.cpp b/Crawler/Item.cpp index 9acaa0ef..df0be2b8 100644 --- a/Crawler/Item.cpp +++ b/Crawler/Item.cpp @@ -1033,13 +1033,13 @@ const bool EnhancementInfo::CanBeEnhanced()const{ const bool ItemInfo::IsWeapon()const{ - return slot==EquipSlot::WEAPON; + return slot&EquipSlot::WEAPON; } const bool ItemInfo::IsArmor()const{ return IsEquippable()&&!IsWeapon()&&!IsAccessory(); } const bool ItemInfo::IsAccessory()const{ - return slot==EquipSlot::RING1||slot==EquipSlot::RING2; + return slot&EquipSlot::RING1||slot&EquipSlot::RING2; } const bool Item::IsWeapon()const{ diff --git a/Crawler/OverworldMenuWindow.cpp b/Crawler/OverworldMenuWindow.cpp index 208b54e6..af995a86 100644 --- a/Crawler/OverworldMenuWindow.cpp +++ b/Crawler/OverworldMenuWindow.cpp @@ -40,6 +40,7 @@ All rights reserved. #include "Crawler.h" #include "CharacterRotatingDisplay.h" #include "ClassInfo.h" +#include "SaveFile.h" INCLUDE_game INCLUDE_GFX @@ -58,6 +59,7 @@ void Menu::InitializeOverworldMenuWindow(){ overworldMenuWindow->ADD("Settings Button",MenuComponent)({{4,12+28*3},{88,24}},"Settings",[](MenuFuncData data){/*Menu::OpenMenu(SETTINGS_MENU);*/return true;})END; overworldMenuWindow->ADD("Quit Button",MenuComponent)({{4,12+28*4},{88,24}},"Quit Game",[](MenuFuncData data){ Menu::CloseAllMenus(); + SaveFile::SaveGame(); game->ResetGame(); return true; })END; diff --git a/Crawler/Version.h b/Crawler/Version.h index 0552c6a6..c3ca6c8e 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5256 +#define VERSION_BUILD 5260 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/config/items/Accessories.txt b/Crawler/assets/config/items/Accessories.txt index baae1af0..0b82d42f 100644 --- a/Crawler/assets/config/items/Accessories.txt +++ b/Crawler/assets/config/items/Accessories.txt @@ -3,7 +3,7 @@ Equipment Ring of the Slime King { Slot = Ring1,Ring2 - ItemCategory = Equipment + ItemCategory = Accessories # See ItemStats.txt for valid stat names StatValues = Health,Attack,Mana,Move Spd % @@ -15,7 +15,7 @@ Equipment Ring of the Bear { Slot = Ring1,Ring2 - ItemCategory = Equipment + ItemCategory = Accessories # See ItemStats.txt for valid stat names StatValues = Health,Attack,Mana