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