Saving and loading saves items in proper sorted order. Fixed bug with get inventory slot function. Connection point data is now static.

This commit is contained in:
2024-01-01 07:49:07 -06:00
parent 0d6ab94fda
commit ad1e2260cf
24 changed files with 271 additions and 406 deletions
+12 -5
View File
@@ -52,6 +52,7 @@ INCLUDE_MONSTER_LIST
INCLUDE_game
std::vector<ConnectionPoint>State_OverworldMap::connections;
ConnectionPoint*State_OverworldMap::currentConnectionPoint=nullptr;
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.
@@ -111,7 +112,7 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
if(neighborInd==-1)continue;
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor){
currentConnectionPoint=&neighbor;
UpdateCurrentConnectionPoint(neighbor);
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos);
if(angleTo>=-3*PI/4&&angleTo<-PI/4){
@@ -125,10 +126,6 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
}else{
game->GetPlayer()->UpdateWalkingAnimation(LEFT);
}
Component<MenuLabel>(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
Component<EncountersSpawnListScrollableWindowComponent>(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(currentConnectionPoint->levelDataExists&&!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
break;
}
}
@@ -177,4 +174,14 @@ void State_OverworldMap::StartLevel(){
game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map));
GameState::ChangeState(States::GAME_RUN);
}
}
void State_OverworldMap::UpdateCurrentConnectionPoint(const ConnectionPoint&connection){
currentConnectionPoint=const_cast<ConnectionPoint*>(&connection);
Component<MenuLabel>(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
Component<EncountersSpawnListScrollableWindowComponent>(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(currentConnectionPoint->levelDataExists&&!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
}