Implemented unlocking of areas via clearing stages. Game fade in/out for state transitions. Asset loading for visual novel assets. Visual Novel command execution code implemented. Visual Novel basic rendering and input handling enabled.

This commit is contained in:
2023-11-28 18:29:06 -06:00
parent 3601e8b83a
commit a7f13e0077
21 changed files with 279 additions and 127 deletions
+9 -3
View File
@@ -41,6 +41,7 @@ SUCH DAMAGE.
#include "drawutil.h"
#include "MenuLabel.h"
#include "EncountersSpawnListScrollableWindowComponent.h"
#include "VisualNovel.h"
INCLUDE_MONSTER_LIST
INCLUDE_game
@@ -51,6 +52,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){
game->LoadLevel(WORLD_MAP);
if(Menu::IsMenuOpen()){
Menu::CloseAllMenus();
}
@@ -84,7 +86,7 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
for(int neighborInd:currentConnectionPoint->neighbors){
if(neighborInd==-1)continue;
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
if(Unlock::IsUnlocked(neighbor.name)&&&cp==&neighbor){
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor){
currentConnectionPoint=&neighbor;
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos);
@@ -141,6 +143,10 @@ ConnectionPoint&State_OverworldMap::GetCurrentConnectionPoint(){
}
void State_OverworldMap::StartLevel(){
game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map));
GameState::ChangeState(States::GAME_RUN);
if(State_OverworldMap::GetCurrentConnectionPoint().map.starts_with("STORY")){
VisualNovel::LoadVisualNovel(State_OverworldMap::GetCurrentConnectionPoint().map);
}else{
game->LoadLevel(LEVEL_NAMES.at(State_OverworldMap::GetCurrentConnectionPoint().map));
GameState::ChangeState(States::GAME_RUN);
}
}