Fix tile animations. Add in game hub state.

pull/35/head
sigonasr2 10 months ago
parent b1cdc78a87
commit 18810875a5
  1. 6
      Adventures in Lestoria/Adventures in Lestoria.tiled-project
  2. 8
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  3. 15
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  4. 4
      Adventures in Lestoria/AdventuresInLestoria.cpp
  5. 3
      Adventures in Lestoria/GameState.cpp
  6. 1
      Adventures in Lestoria/GameState.h
  7. 2
      Adventures in Lestoria/LevelCompleteWindow.cpp
  8. 2
      Adventures in Lestoria/Player.cpp
  9. 63
      Adventures in Lestoria/State_GameHub.cpp
  10. 48
      Adventures in Lestoria/State_GameHub.h
  11. 7
      Adventures in Lestoria/State_GameRun.h
  12. 2
      Adventures in Lestoria/Version.h
  13. 2
      Adventures in Lestoria/assets/Campaigns/Hub.tmx
  14. 2
      Adventures in Lestoria/assets/Campaigns/World_Map.tmx
  15. 4
      Adventures in Lestoria/assets/config/levels.txt

@ -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",

@ -540,6 +540,10 @@
<ClInclude Include="SoundEffect.h" />
<ClInclude Include="SpawnEncounterLabel.h" />
<ClInclude Include="State.h" />
<ClInclude Include="State_GameHub.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="State_GameRun.h" />
<ClInclude Include="State_LevelComplete.h">
<SubType>
@ -735,6 +739,10 @@
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="State_GameHub.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="State_GameRun.cpp" />
<ClCompile Include="State_LevelComplete.cpp">
<SubType>

@ -46,9 +46,6 @@
<Filter Include="Header Files\Interface">
<UniqueIdentifier>{45ecf440-1472-4e9a-a4d9-e9eac538a2b0}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Game States">
<UniqueIdentifier>{da28101e-32b6-4e32-a19a-e0d2636d5eea}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Game States">
<UniqueIdentifier>{f36af2ba-e884-4e50-b7bd-7e6aa9a8528c}</UniqueIdentifier>
</Filter>
@ -195,9 +192,6 @@
<ClInclude Include="MenuLabel.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
<ClInclude Include="GameState.h">
<Filter>Header Files\Game States</Filter>
</ClInclude>
<ClInclude Include="MenuItemButton.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
@ -447,6 +441,12 @@
<ClInclude Include="Checkbox.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
<ClInclude Include="GameState.h">
<Filter>Header Files\State</Filter>
</ClInclude>
<ClInclude Include="State_GameHub.h">
<Filter>Header Files\State</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">
@ -767,6 +767,9 @@
<ClCompile Include="SettingsWindow.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="State_GameHub.cpp">
<Filter>Source Files\Game States</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

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

@ -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);
}

@ -45,6 +45,7 @@ class AiL;
namespace States{
enum State{
GAME_RUN,
GAME_HUB,
OVERWORLD_MAP,
MAIN_MENU,
LEVEL_COMPLETE,

@ -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;
};

@ -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(){

@ -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 © 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);
}

@ -0,0 +1,48 @@
#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 © 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;
};

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

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

@ -3,7 +3,7 @@
<properties>
<property name="Backdrop" propertytype="Backdrop" value="forest"/>
<property name="Background Music" propertytype="BGM" value="foresty_loop1"/>
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
<property name="Level Type" propertytype="LevelType" value="Hub"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="2913" source="../maps/No_Shadow_Campfire_24x24.tsx"/>

@ -672,8 +672,6 @@
<object id="17" name="Stage B-I" type="StagePlate" x="156.25" y="475.75" width="44" height="16">
<properties>
<property name="Connection 2 - East" type="object" value="18"/>
<property name="Connection 3 - South" type="object" value="0"/>
<property name="Connection 4 - West" type="object" value="0"/>
<property name="Map" propertytype="Level" value="CAMPAIGN_1_B1"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_5"/>

@ -98,4 +98,8 @@ Levels
{
Map File = Boss_1_B.tmx
}
HUB
{
Map File = Hub.tmx
}
}
Loading…
Cancel
Save