Add in arrow indicators for accessible locations on the overworld stage map. Move saving of the game to overworld map state change event.
This commit is contained in:
parent
c7eca2b771
commit
0e4dbfd9f7
@ -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()));
|
||||
game->GetPlayer()->AddXP(game->GetPlayer()->GetAccumulatedXP());
|
||||
game->GetPlayer()->SetState(State::NORMAL);
|
||||
SaveFile::SaveGame();
|
||||
Menu::OpenMenu(LEVEL_COMPLETE);
|
||||
};
|
||||
void State_LevelComplete::OnUserUpdate(AiL*game){
|
||||
|
@ -51,6 +51,7 @@ All rights reserved.
|
||||
|
||||
INCLUDE_MONSTER_LIST
|
||||
INCLUDE_game
|
||||
INCLUDE_GFX
|
||||
|
||||
std::vector<ConnectionPoint>State_OverworldMap::connections;
|
||||
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.
|
||||
}
|
||||
void State_OverworldMap::OnStateChange(GameState*prevState){
|
||||
SaveFile::SaveGame();
|
||||
game->LoadLevel("WORLD_MAP");
|
||||
if(Menu::IsMenuOpen()){
|
||||
Menu::CloseAllMenus();
|
||||
@ -186,16 +188,45 @@ void State_OverworldMap::Draw(AiL*game){
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma region Audio Test
|
||||
std::stringstream eventText;
|
||||
eventText<<"Event Set to: ";
|
||||
eventText<<std::quoted(Audio::GetAudioEvent());
|
||||
std::stringstream audioText;
|
||||
audioText<<"Audio Track Set to: ";
|
||||
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))});
|
||||
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))});
|
||||
#pragma endregion
|
||||
|
||||
//In radians.
|
||||
using AngleTotal=float;
|
||||
using Count=uint8_t;
|
||||
using MedianAngle=std::pair<AngleTotal,Count>;
|
||||
using ConnectionPointIndex=float;
|
||||
|
||||
auto GetAngle=[](MedianAngle angle){
|
||||
return angle.first/angle.second;
|
||||
};
|
||||
|
||||
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){
|
||||
for(ConnectionPoint&connection:connections){
|
||||
|
@ -13,6 +13,7 @@ Settings Menu
|
||||
- Fix Stage Completed screen, item displays can hit the scrollbar.
|
||||
|
||||
- Stage Loot Config
|
||||
- Initial Crafting of Gear.
|
||||
|
||||
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.
|
||||
- Resource Packs
|
||||
|
||||
- Hold mouse down to increase quantity
|
||||
|
||||
- Getting hurt has additional effects.
|
||||
|
||||
|
||||
|
@ -42,15 +42,6 @@ std::set<std::string>Unlock::unlocks;
|
||||
|
||||
void Unlock::Initialize(){
|
||||
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){
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 6200
|
||||
#define VERSION_BUILD 6212
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -663,8 +663,6 @@
|
||||
</object>
|
||||
<object id="16" name="Story III" type="StagePlate" x="160" y="612" width="20" height="24">
|
||||
<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="Type" propertytype="StageType" value="STORY"/>
|
||||
<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_R1 = themes/button_r1.png
|
||||
GFX_Button_Face_R2 = themes/button_r2.png
|
||||
GFX_Overworld_Arrow = overworld_arrow.png
|
||||
GFX_Exclamation = exclamation.png
|
||||
|
||||
# Ability Icons
|
||||
GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png
|
||||
|
BIN
Adventures in Lestoria/assets/exclamation.png
Normal file
BIN
Adventures in Lestoria/assets/exclamation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 589 B |
BIN
Adventures in Lestoria/assets/overworld_arrow.png
Normal file
BIN
Adventures in Lestoria/assets/overworld_arrow.png
Normal file
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);
|
||||
}
|
||||
|
||||
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)
|
||||
long double operator""_Pixels(long double unitDist);
|
Loading…
x
Reference in New Issue
Block a user