diff --git a/Adventures in Lestoria/Adventures in Lestoria.tiled-project b/Adventures in Lestoria/Adventures in Lestoria.tiled-project index 6e14e954..4bb6b020 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.tiled-project +++ b/Adventures in Lestoria/Adventures in Lestoria.tiled-project @@ -232,8 +232,8 @@ "Boss", "Story", "Blacksmith", - "Unspecified", - "World Map" + "World Map", + "Hub" ], "valuesAsFlags": false }, @@ -284,7 +284,7 @@ "name": "Level Type", "propertyType": "LevelType", "type": "string", - "value": "Unspecified" + "value": "World Map" }, { "name": "Optimize", diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 35a44b8b..3544dc8b 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -540,6 +540,10 @@ + + + + @@ -735,6 +739,10 @@ + + + + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 10c5ac7f..6393e5c8 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -46,9 +46,6 @@ {45ecf440-1472-4e9a-a4d9-e9eac538a2b0} - - {da28101e-32b6-4e32-a19a-e0d2636d5eea} - {f36af2ba-e884-4e50-b7bd-7e6aa9a8528c} @@ -195,9 +192,6 @@ Header Files\Interface - - Header Files\Game States - Header Files\Interface @@ -447,6 +441,12 @@ Header Files\Interface + + Header Files\State + + + Header Files\State + @@ -767,6 +767,9 @@ Source Files + + Source Files\Game States + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 52d9471c..736132b3 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -842,7 +842,7 @@ void AiL::RenderTile(TileRenderData&tileSheet,Pixel col){ int tileSheetWidth=tileSheet.tileSheet.tileset->tileset->Sprite()->width/tileSheet.tileSheet.tileset->tilewidth; int tileSheetX=animatedIndex%tileSheetWidth; int tileSheetY=animatedIndex/tileSheetWidth; - view.DrawPartialDecal(tileSheet.pos,{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},tileSheet.tileSheet.tileset->tileset->Decal(),vi2d{tileSheetX,tileSheetY},{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},col); + view.DrawPartialDecal(tileSheet.pos,{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},tileSheet.tileSheet.tileset->tileset->Decal(),vi2d{tileSheetX,tileSheetY}*vf2d{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},col); }else{ view.DrawPartialDecal(tileSheet.pos,{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},tileSheet.tileSheet.tileset->tileset->Decal(),tileSheet.tileSheetPos,{float(tileSheet.tileSheet.tileset->tilewidth),float(tileSheet.tileSheet.tileset->tileheight)},col); } @@ -1740,6 +1740,8 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){ } void AiL::LoadLevel(MapName map){ + if(game->MAP_DATA.count(map)==0)ERR(std::format("WARNING! Could not load map {}! Does not exist! Refer to levels.txt for valid maps.",map)); + SPAWNER_LIST.clear(); foregroundTileGroups.clear(); upperForegroundTileGroups.clear(); diff --git a/Adventures in Lestoria/GameState.cpp b/Adventures in Lestoria/GameState.cpp index d12f9512..ea2ecc25 100644 --- a/Adventures in Lestoria/GameState.cpp +++ b/Adventures in Lestoria/GameState.cpp @@ -37,11 +37,11 @@ All rights reserved. #pragma endregion #include "AdventuresInLestoria.h" #include "GameState.h" -#include "State_GameRun.h" #include "State_OverworldMap.h" #include "State_MainMenu.h" #include "State_LevelComplete.h" #include "State_Story.h" +#include "State_GameHub.h" INCLUDE_game @@ -53,6 +53,7 @@ void GameState::Initialize(){ NEW_STATE(States::MAIN_MENU,State_MainMenu); NEW_STATE(States::LEVEL_COMPLETE,State_LevelComplete); NEW_STATE(States::STORY,State_Story); + NEW_STATE(States::GAME_HUB,State_GameHub); GameState::ChangeState(States::MAIN_MENU); } diff --git a/Adventures in Lestoria/GameState.h b/Adventures in Lestoria/GameState.h index 63af0cd0..7c9ed481 100644 --- a/Adventures in Lestoria/GameState.h +++ b/Adventures in Lestoria/GameState.h @@ -45,6 +45,7 @@ class AiL; namespace States{ enum State{ GAME_RUN, + GAME_HUB, OVERWORLD_MAP, MAIN_MENU, LEVEL_COMPLETE, diff --git a/Adventures in Lestoria/LevelCompleteWindow.cpp b/Adventures in Lestoria/LevelCompleteWindow.cpp index 8858645d..97e335ca 100644 --- a/Adventures in Lestoria/LevelCompleteWindow.cpp +++ b/Adventures in Lestoria/LevelCompleteWindow.cpp @@ -65,7 +65,7 @@ void Menu::InitializeLevelCompleteWindow(){ auto nextButtonAction=[](MenuFuncData data){ Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map); - GameState::ChangeState(States::OVERWORLD_MAP,0.5f); + GameState::ChangeState(States::GAME_HUB,0.25f); return true; }; diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index f9932623..86cc5d34 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -672,7 +672,7 @@ bool Player::CanAct(){ } bool Player::CanAct(Ability&ability){ - return knockUpTimer==0&&!ability.waitForRelease&&(ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK&&GameState::STATE==GameState::states[States::GAME_RUN]; + return knockUpTimer==0&&!ability.waitForRelease&&(ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK&&(GameState::STATE==GameState::states[States::GAME_RUN]||GameState::STATE==GameState::states[States::GAME_HUB]); } bool Player::HasIframes(){ diff --git a/Adventures in Lestoria/State_GameHub.cpp b/Adventures in Lestoria/State_GameHub.cpp new file mode 100644 index 00000000..98e93938 --- /dev/null +++ b/Adventures in Lestoria/State_GameHub.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 "State_GameHub.h" +#include "AdventuresInLestoria.h" +#include "DEFINES.h" +#include "Menu.h" +#include "ItemDrop.h" +#include "VisualNovel.h" +#include "State_OverworldMap.h" +#include "GameEvent.h" + +INCLUDE_MONSTER_LIST +INCLUDE_game + +void State_GameHub::OnStateChange(GameState*prevState){ + if(Menu::IsMenuOpen()){ + Menu::CloseAllMenus(); + } + game->GetPlayer()->SetState(State::NORMAL); + + game->LoadLevel("HUB"); +} +void State_GameHub::OnUserUpdate(AiL*game){ + State_GameRun::OnUserUpdate(game); +} +void State_GameHub::Draw(AiL*game){ + State_GameRun::Draw(game); +} \ No newline at end of file diff --git a/Adventures in Lestoria/State_GameHub.h b/Adventures in Lestoria/State_GameHub.h new file mode 100644 index 00000000..d391c6ee --- /dev/null +++ b/Adventures in Lestoria/State_GameHub.h @@ -0,0 +1,48 @@ +#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 +#pragma once +#include "State_GameRun.h" +#include "olcPGEX_ViewPort.h" + +class State_GameHub:public State_GameRun{ + ViewPort port; + Renderable r; + virtual void OnStateChange(GameState*prevState)override final; + virtual void OnUserUpdate(AiL*game)override final; + virtual void Draw(AiL*game)override final; +}; \ No newline at end of file diff --git a/Adventures in Lestoria/State_GameRun.h b/Adventures in Lestoria/State_GameRun.h index eeb63b1c..f7d873a6 100644 --- a/Adventures in Lestoria/State_GameRun.h +++ b/Adventures in Lestoria/State_GameRun.h @@ -42,9 +42,10 @@ All rights reserved. class State_GameRun:public GameState{ ViewPort port; Renderable r; - virtual void OnStateChange(GameState*prevState)override final; - virtual void OnUserUpdate(AiL*game)override final; - virtual void Draw(AiL*game)override final; +protected: + virtual void OnStateChange(GameState*prevState)override; + virtual void OnUserUpdate(AiL*game)override; + virtual void Draw(AiL*game)override; void FontTest(); void FontSpriteTest(); }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 99ed463d..c41e6c1f 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 6507 +#define VERSION_BUILD 6515 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/Hub.tmx b/Adventures in Lestoria/assets/Campaigns/Hub.tmx index 409d4822..bca562e9 100644 --- a/Adventures in Lestoria/assets/Campaigns/Hub.tmx +++ b/Adventures in Lestoria/assets/Campaigns/Hub.tmx @@ -3,7 +3,7 @@ - + diff --git a/Adventures in Lestoria/assets/Campaigns/World_Map.tmx b/Adventures in Lestoria/assets/Campaigns/World_Map.tmx index 012158c3..b5079f03 100644 --- a/Adventures in Lestoria/assets/Campaigns/World_Map.tmx +++ b/Adventures in Lestoria/assets/Campaigns/World_Map.tmx @@ -672,8 +672,6 @@ - - diff --git a/Adventures in Lestoria/assets/config/levels.txt b/Adventures in Lestoria/assets/config/levels.txt index ab3c51f2..fd00077e 100644 --- a/Adventures in Lestoria/assets/config/levels.txt +++ b/Adventures in Lestoria/assets/config/levels.txt @@ -98,4 +98,8 @@ Levels { Map File = Boss_1_B.tmx } + HUB + { + Map File = Hub.tmx + } } \ No newline at end of file