|
|
@ -177,11 +177,12 @@ void VisualNovel::LoadVisualNovel(std::string storyLevelName){ |
|
|
|
Menu::themeSelection="Purple"; |
|
|
|
Menu::themeSelection="Purple"; |
|
|
|
} |
|
|
|
} |
|
|
|
void VisualNovel::Update(){ |
|
|
|
void VisualNovel::Update(){ |
|
|
|
if(game->KEY_CONFIRM.Pressed()){ |
|
|
|
if(transitionTime==0&&game->KEY_CONFIRM.Pressed()){ |
|
|
|
activeText=""; |
|
|
|
activeText=""; |
|
|
|
novel.ExecuteNextCommand(); |
|
|
|
novel.ExecuteNextCommand(); |
|
|
|
} |
|
|
|
} |
|
|
|
locationDisplayTime=std::max(0.f,locationDisplayTime-game->GetElapsedTime()); |
|
|
|
locationDisplayTime=std::max(0.f,locationDisplayTime-game->GetElapsedTime()); |
|
|
|
|
|
|
|
transitionTime=std::max(0.f,transitionTime-game->GetElapsedTime()); |
|
|
|
} |
|
|
|
} |
|
|
|
void VisualNovel::ExecuteNextCommand(){ |
|
|
|
void VisualNovel::ExecuteNextCommand(){ |
|
|
|
if(commandIndex<commands.size()){ |
|
|
|
if(commandIndex<commands.size()){ |
|
|
@ -195,7 +196,14 @@ void VisualNovel::ExecuteNextCommand(){ |
|
|
|
} |
|
|
|
} |
|
|
|
void VisualNovel::Draw(){ |
|
|
|
void VisualNovel::Draw(){ |
|
|
|
if(backgroundFilename!=""){ |
|
|
|
if(backgroundFilename!=""){ |
|
|
|
game->DrawDecal({0,0},GFX["backgrounds/"+backgroundFilename].Decal()); |
|
|
|
float alpha=1; |
|
|
|
|
|
|
|
if(transitionTime>0){ |
|
|
|
|
|
|
|
alpha=util::lerp(0,1,1-(transitionTime/maxTransitionTime)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(prevBackgroundFilename!=""){ |
|
|
|
|
|
|
|
game->DrawDecal({0,0},GFX["backgrounds/"+prevBackgroundFilename].Decal()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
game->DrawDecal({0,0},GFX["backgrounds/"+backgroundFilename].Decal(),{1,1},{255,255,255,uint8_t(255*alpha)}); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
game->FillRectDecal({0,0},game->GetScreenSize()); |
|
|
|
game->FillRectDecal({0,0},game->GetScreenSize()); |
|
|
|
} |
|
|
|
} |
|
|
@ -208,7 +216,9 @@ void VisualNovel::Draw(){ |
|
|
|
if(activeText.length()>0){ |
|
|
|
if(activeText.length()>0){ |
|
|
|
vf2d nameDisplayPos={24.f,game->GetScreenSize().y-60.f}; |
|
|
|
vf2d nameDisplayPos={24.f,game->GetScreenSize().y-60.f}; |
|
|
|
vf2d nameDisplayWindowSize={48.f,-12.f}; |
|
|
|
vf2d nameDisplayWindowSize={48.f,-12.f}; |
|
|
|
Menu::DrawThemedWindow(nameDisplayPos,nameDisplayWindowSize); |
|
|
|
if(speakerDisplayName.length()>0){ |
|
|
|
|
|
|
|
Menu::DrawThemedWindow(nameDisplayPos,nameDisplayWindowSize); |
|
|
|
|
|
|
|
} |
|
|
|
vf2d dialogDisplayPos={24.f,game->GetScreenSize().y-48.f}; |
|
|
|
vf2d dialogDisplayPos={24.f,game->GetScreenSize().y-48.f}; |
|
|
|
Menu::DrawThemedWindow(dialogDisplayPos,{game->GetScreenSize().x-48.f,20.f}); |
|
|
|
Menu::DrawThemedWindow(dialogDisplayPos,{game->GetScreenSize().x-48.f,20.f}); |
|
|
|
vf2d speakerTextSize=game->GetTextSizeProp(speakerDisplayName); |
|
|
|
vf2d speakerTextSize=game->GetTextSizeProp(speakerDisplayName); |
|
|
@ -231,7 +241,9 @@ LocationCommand::LocationCommand(std::string location) |
|
|
|
CommandType::CommandType LocationCommand::GetType(){return CommandType::LOCATION;} |
|
|
|
CommandType::CommandType LocationCommand::GetType(){return CommandType::LOCATION;} |
|
|
|
|
|
|
|
|
|
|
|
void BackgroundCommand::Execute(VisualNovel&vn){ |
|
|
|
void BackgroundCommand::Execute(VisualNovel&vn){ |
|
|
|
|
|
|
|
vn.prevBackgroundFilename=vn.backgroundFilename; |
|
|
|
vn.backgroundFilename=backgroundFilename; |
|
|
|
vn.backgroundFilename=backgroundFilename; |
|
|
|
|
|
|
|
vn.transitionTime=2.0f; |
|
|
|
vn.ExecuteNextCommand(); |
|
|
|
vn.ExecuteNextCommand(); |
|
|
|
} |
|
|
|
} |
|
|
|
BackgroundCommand::BackgroundCommand(std::string backgroundFilename) |
|
|
|
BackgroundCommand::BackgroundCommand(std::string backgroundFilename) |
|
|
|