Add in arrow indicators for accessible locations on the overworld stage map. Move saving of the game to overworld map state change event.

pull/35/head
sigonasr2 10 months ago
parent c7eca2b771
commit 0e4dbfd9f7
  1. 1
      Adventures in Lestoria/State_LevelComplete.cpp
  2. 51
      Adventures in Lestoria/State_OverworldMap.cpp
  3. 3
      Adventures in Lestoria/TODO.txt
  4. 9
      Adventures in Lestoria/Unlock.cpp
  5. 2
      Adventures in Lestoria/Version.h
  6. 2
      Adventures in Lestoria/assets/Campaigns/World_Map.tmx
  7. 2
      Adventures in Lestoria/assets/config/gfx/gfx.txt
  8. BIN
      Adventures in Lestoria/assets/exclamation.png
  9. BIN
      Adventures in Lestoria/assets/overworld_arrow.png
  10. 14
      Adventures in Lestoria/util.h

@ -52,7 +52,6 @@ void State_LevelComplete::OnStateChange(GameState*prevState){
Component<MenuLabel>(MenuType::LEVEL_COMPLETE,"Level EXP Gain Outline")->SetLabel(std::format("+{} Exp",game->GetPlayer()->GetAccumulatedXP())); Component<MenuLabel>(MenuType::LEVEL_COMPLETE,"Level EXP Gain Outline")->SetLabel(std::format("+{} Exp",game->GetPlayer()->GetAccumulatedXP()));
game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP()); game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP());
game->GetPlayer()->SetState(State::NORMAL); game->GetPlayer()->SetState(State::NORMAL);
SaveFile::SaveGame();
Menu::OpenMenu(LEVEL_COMPLETE); Menu::OpenMenu(LEVEL_COMPLETE);
}; };
void State_LevelComplete::OnUserUpdate(AiL*game){ void State_LevelComplete::OnUserUpdate(AiL*game){

@ -51,6 +51,7 @@ All rights reserved.
INCLUDE_MONSTER_LIST INCLUDE_MONSTER_LIST
INCLUDE_game INCLUDE_game
INCLUDE_GFX
std::vector<ConnectionPoint>State_OverworldMap::connections; std::vector<ConnectionPoint>State_OverworldMap::connections;
ConnectionPoint*State_OverworldMap::currentConnectionPoint=nullptr; ConnectionPoint*State_OverworldMap::currentConnectionPoint=nullptr;
@ -59,6 +60,7 @@ State_OverworldMap::State_OverworldMap(){
SetStageMarker("Stage I-I"); //Eventually we will load the game from a file and this will not be necessary. We just set it to this for now. SetStageMarker("Stage I-I"); //Eventually we will load the game from a file and this will not be necessary. We just set it to this for now.
} }
void State_OverworldMap::OnStateChange(GameState*prevState){ void State_OverworldMap::OnStateChange(GameState*prevState){
SaveFile::SaveGame();
game->LoadLevel("WORLD_MAP"); game->LoadLevel("WORLD_MAP");
if(Menu::IsMenuOpen()){ if(Menu::IsMenuOpen()){
Menu::CloseAllMenus(); Menu::CloseAllMenus();
@ -186,16 +188,45 @@ void State_OverworldMap::Draw(AiL*game){
break; break;
} }
} }
#pragma region Audio Test
std::stringstream eventText; //In radians.
eventText<<"Event Set to: "; using AngleTotal=float;
eventText<<std::quoted(Audio::GetAudioEvent()); using Count=uint8_t;
std::stringstream audioText; using MedianAngle=std::pair<AngleTotal,Count>;
audioText<<"Audio Track Set to: "; using ConnectionPointIndex=float;
audioText<<std::quoted(Audio::GetTrackName());
if(lastEventTime!=5.0f)game->DrawShadowStringPropDecal({2,game->ScreenHeight()-36.f},eventText.str(),{255,255,255,uint8_t(util::lerp(255,0,lastEventTime/5.0f))},{0,0,0,uint8_t(util::lerp(255,0,lastEventTime/5.0f))}); auto GetAngle=[](MedianAngle angle){
if(lastAudioTime!=5.0f)game->DrawShadowStringPropDecal({2,game->ScreenHeight()-20.f},audioText.str(),{255,255,255,uint8_t(util::lerp(255,0,lastAudioTime/5.0f))},{0,0,0,uint8_t(util::lerp(255,0,lastAudioTime/5.0f))}); return angle.first/angle.second;
#pragma endregion };
std::map<ConnectionPointIndex,MedianAngle>neighbors;
for(int direction=0;int index:currentConnectionPoint->neighbors){
if(index!=-1){
ConnectionPoint&neighbor=connections[index];
if(!Unlock::IsUnlocked(neighbor)){
direction++;
continue;
}
float arrowAngle=direction*0.5f*PI-0.5f*PI;
if(neighbors.count(index)){
if(arrowAngle==0.f)neighbors[index].first+=2*PI;
neighbors[index].first+=circ_add(0,2*PI+arrowAngle,0,2*PI);
neighbors[index].second++;
}else{
neighbors[index]={circ_add(0,arrowAngle,0,2*PI),1};
}
}
direction++;
}
float arrowDist=fmod(game->GetRuntime(),1.0f)<0.5f?14:18;
for(auto&[index,medianAngle]:neighbors){
game->view.DrawRotatedDecal(game->GetPlayer()->GetPos()+vf2d{arrowDist,GetAngle(medianAngle)}.cart()+vf2d{0.f,1.f},GFX["overworld_arrow.png"].Decal(),GetAngle(medianAngle),GFX["overworld_arrow.png"].Sprite()->Size()/2,{1.f,1.f},{0,0,0});
game->view.DrawRotatedDecal(game->GetPlayer()->GetPos()+vf2d{arrowDist,GetAngle(medianAngle)}.cart(),GFX["overworld_arrow.png"].Decal(),GetAngle(medianAngle),GFX["overworld_arrow.png"].Sprite()->Size()/2,{1.f,1.f},{199,48,55});
}
}; };
void State_OverworldMap::SetStageMarker(std::string connectionName){ void State_OverworldMap::SetStageMarker(std::string connectionName){
for(ConnectionPoint&connection:connections){ for(ConnectionPoint&connection:connections){

@ -13,6 +13,7 @@ Settings Menu
- Fix Stage Completed screen, item displays can hit the scrollbar. - Fix Stage Completed screen, item displays can hit the scrollbar.
- Stage Loot Config - Stage Loot Config
- Initial Crafting of Gear.
January 31st January 31st
============ ============
@ -37,6 +38,8 @@ ERR messages become just output messages in release build and won't crash the ga
- Hide mouse cursor during controller play. Reveal it again during mouse play. - Hide mouse cursor during controller play. Reveal it again during mouse play.
- Resource Packs - Resource Packs
- Hold mouse down to increase quantity
- Getting hurt has additional effects. - Getting hurt has additional effects.

@ -42,15 +42,6 @@ std::set<std::string>Unlock::unlocks;
void Unlock::Initialize(){ void Unlock::Initialize(){
UnlockArea("WORLD_MAP"); UnlockArea("WORLD_MAP");
UnlockArea("CAMPAIGN_1_1");
UnlockArea("BOSS_1");
UnlockArea("CAMPAIGN_1_2");
UnlockArea("CAMPAIGN_1_3");
UnlockArea("CAMPAIGN_1_4");
UnlockArea("CAMPAIGN_1_5");
UnlockArea("CAMPAIGN_1_6");
UnlockArea("CAMPAIGN_1_7");
UnlockArea("CAMPAIGN_1_8");
} }
void Unlock::UnlockArea(std::string mapName){ void Unlock::UnlockArea(std::string mapName){

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 6200 #define VERSION_BUILD 6212
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -663,8 +663,6 @@
</object> </object>
<object id="16" name="Story III" type="StagePlate" x="160" y="612" width="20" height="24"> <object id="16" name="Story III" type="StagePlate" x="160" y="612" width="20" height="24">
<properties> <properties>
<property name="Connection 1" type="object" value="0"/>
<property name="Connection 2" type="object" value="0"/>
<property name="Map" propertytype="Level" value="STORY_1_3"/> <property name="Map" propertytype="Level" value="STORY_1_3"/>
<property name="Type" propertytype="StageType" value="STORY"/> <property name="Type" propertytype="StageType" value="STORY"/>
<property name="Unlock Condition" propertytype="Level" value="BOSS_1"/> <property name="Unlock Condition" propertytype="Level" value="BOSS_1"/>

@ -60,6 +60,8 @@ Images
GFX_Button_Face_L2 = themes/button_l2.png GFX_Button_Face_L2 = themes/button_l2.png
GFX_Button_Face_R1 = themes/button_r1.png GFX_Button_Face_R1 = themes/button_r1.png
GFX_Button_Face_R2 = themes/button_r2.png GFX_Button_Face_R2 = themes/button_r2.png
GFX_Overworld_Arrow = overworld_arrow.png
GFX_Exclamation = exclamation.png
# Ability Icons # Ability Icons
GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

@ -58,5 +58,19 @@ namespace olc::util{
std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale); std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale);
} }
template<class TL, class TR>
constexpr auto circ_add(
const TL& lhs,
const TR& rhs,
const decltype(lhs + rhs) rmin = 0,
const decltype(lhs + rhs) rmax = 360)
{
auto c = lhs + rhs;
auto range = rmax - rmin;
while (c >= rmax) c -= range;
while (c < rmin) c += range;
return c;
}
//Converts unit distances to pixels. (Every 100 units = 24 pixels) //Converts unit distances to pixels. (Every 100 units = 24 pixels)
long double operator""_Pixels(long double unitDist); long double operator""_Pixels(long double unitDist);
Loading…
Cancel
Save