|
|
|
@ -38,6 +38,7 @@ SUCH DAMAGE. |
|
|
|
|
#include "DEFINES.h" |
|
|
|
|
#include "Unlock.h" |
|
|
|
|
#include "Menu.h" |
|
|
|
|
#include "util.h" |
|
|
|
|
|
|
|
|
|
INCLUDE_game |
|
|
|
|
INCLUDE_GFX |
|
|
|
@ -177,6 +178,7 @@ void VisualNovel::LoadVisualNovel(std::string storyLevelName){ |
|
|
|
|
} |
|
|
|
|
void VisualNovel::Update(){ |
|
|
|
|
if(game->KEY_CONFIRM.Pressed()){ |
|
|
|
|
activeText=""; |
|
|
|
|
novel.ExecuteNextCommand(); |
|
|
|
|
} |
|
|
|
|
locationDisplayTime=std::max(0.f,locationDisplayTime-game->GetElapsedTime()); |
|
|
|
@ -204,8 +206,14 @@ void VisualNovel::Draw(){ |
|
|
|
|
game->DrawShadowStringPropDecal(game->GetScreenSize()/2-textSize/2,locationDisplayText,WHITE,VERY_DARK_BLUE,{2.f,2.f}); |
|
|
|
|
} |
|
|
|
|
if(activeText.length()>0){ |
|
|
|
|
Menu::DrawThemedWindow({24.f,game->GetScreenSize().y-60.f},{48.f,-12.f}); |
|
|
|
|
Menu::DrawThemedWindow({24.f,game->GetScreenSize().y-48.f},{game->GetScreenSize().x-48.f,20.f}); |
|
|
|
|
vf2d nameDisplayPos={24.f,game->GetScreenSize().y-60.f}; |
|
|
|
|
vf2d nameDisplayWindowSize={48.f,-12.f}; |
|
|
|
|
Menu::DrawThemedWindow(nameDisplayPos,nameDisplayWindowSize); |
|
|
|
|
vf2d dialogDisplayPos={24.f,game->GetScreenSize().y-48.f}; |
|
|
|
|
Menu::DrawThemedWindow(dialogDisplayPos,{game->GetScreenSize().x-48.f,20.f}); |
|
|
|
|
vf2d speakerTextSize=game->GetTextSizeProp(speakerDisplayName); |
|
|
|
|
game->DrawShadowStringPropDecal(nameDisplayPos-vf2d{10,8}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize/2,speakerDisplayName); |
|
|
|
|
game->DrawShadowStringPropDecal(dialogDisplayPos-vf2d{10,10},activeText); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -220,6 +228,7 @@ void LocationCommand::Execute(VisualNovel&vn){ |
|
|
|
|
} |
|
|
|
|
LocationCommand::LocationCommand(std::string location) |
|
|
|
|
:location(location){} |
|
|
|
|
CommandType::CommandType LocationCommand::GetType(){return CommandType::LOCATION;} |
|
|
|
|
|
|
|
|
|
void BackgroundCommand::Execute(VisualNovel&vn){ |
|
|
|
|
vn.backgroundFilename=backgroundFilename; |
|
|
|
@ -227,6 +236,7 @@ void BackgroundCommand::Execute(VisualNovel&vn){ |
|
|
|
|
} |
|
|
|
|
BackgroundCommand::BackgroundCommand(std::string backgroundFilename) |
|
|
|
|
:backgroundFilename(backgroundFilename){} |
|
|
|
|
CommandType::CommandType BackgroundCommand::GetType(){return CommandType::BACKGROUND;} |
|
|
|
|
|
|
|
|
|
void LeftCommand::Execute(VisualNovel&vn){ |
|
|
|
|
vn.leftCharacters=characters; |
|
|
|
@ -234,6 +244,7 @@ void LeftCommand::Execute(VisualNovel&vn){ |
|
|
|
|
} |
|
|
|
|
LeftCommand::LeftCommand(std::vector<std::string>characters) |
|
|
|
|
:characters(characters){} |
|
|
|
|
CommandType::CommandType LeftCommand::GetType(){return CommandType::LEFT;} |
|
|
|
|
|
|
|
|
|
void RightCommand::Execute(VisualNovel&vn){ |
|
|
|
|
vn.rightCharacters=characters; |
|
|
|
@ -241,6 +252,7 @@ void RightCommand::Execute(VisualNovel&vn){ |
|
|
|
|
} |
|
|
|
|
RightCommand::RightCommand(std::vector<std::string>characters) |
|
|
|
|
:characters(characters){} |
|
|
|
|
CommandType::CommandType RightCommand::GetType(){return CommandType::RIGHT;} |
|
|
|
|
|
|
|
|
|
void SpeakerCommand::Execute(VisualNovel&vn){ |
|
|
|
|
vn.speakerDisplayName=displayedName; |
|
|
|
@ -251,12 +263,29 @@ SpeakerCommand::SpeakerCommand(std::string speaker) |
|
|
|
|
:displayedName(speaker),actualSpeakerName(speaker){} |
|
|
|
|
SpeakerCommand::SpeakerCommand(std::string displayedName,std::string speaker) |
|
|
|
|
:displayedName(displayedName),actualSpeakerName(speaker){} |
|
|
|
|
CommandType::CommandType SpeakerCommand::GetType(){return CommandType::SPEAKER;} |
|
|
|
|
|
|
|
|
|
void DialogCommand::Execute(VisualNovel&vn){ |
|
|
|
|
vn.activeText=dialog; |
|
|
|
|
bool mustDisplay=vn.activeText.length()==0; |
|
|
|
|
std::string newText=util::WrapText(game,vn.activeText+(vn.activeText.length()>0?" ":"")+dialog,game->GetScreenSize().x-48,true,{1,1}); |
|
|
|
|
if(game->GetTextSizeProp(newText).y>40){//Hit the maximum of 3 lines.
|
|
|
|
|
if(!mustDisplay){ |
|
|
|
|
vn.commandIndex--; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
vn.activeText=newText; |
|
|
|
|
if(vn.commandIndex<vn.commands.size()){ |
|
|
|
|
CommandType::CommandType nextCommandType=vn.commands[vn.commandIndex]->GetType(); |
|
|
|
|
if(nextCommandType==CommandType::DIALOG){ //Only add to dialog when the next command type is a dialog as well.
|
|
|
|
|
vn.ExecuteNextCommand();
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
DialogCommand::DialogCommand(std::string dialog) |
|
|
|
|
:dialog(dialog){} |
|
|
|
|
CommandType::CommandType DialogCommand::GetType(){return CommandType::DIALOG;} |
|
|
|
|
|
|
|
|
|
void PauseCommand::Execute(VisualNovel&vn){} |
|
|
|
|
PauseCommand::PauseCommand(){} |
|
|
|
|
CommandType::CommandType PauseCommand::GetType(){return CommandType::PAUSE;} |