@ -139,6 +139,14 @@ void VisualNovel::Initialize(){
if ( line . find ( " {PAUSE " ) ! = std : : string : : npos ) { //Pause command
if ( arguments . size ( ) ! = 0 ) ERR ( " Arguments size is " < < arguments . size ( ) < < " . Expecting no arguments. " )
data . push_back ( std : : make_unique < PauseCommand > ( ) ) ;
} else
if ( line . find ( " {AUDIOPITCH " ) ! = std : : string : : npos ) { //Pause command
if ( arguments . size ( ) ! = 1 ) ERR ( " Arguments size is " < < arguments . size ( ) < < " . Expecting only 1 argument. " )
data . push_back ( std : : make_unique < AudioPitchCommand > ( arguments [ 0 ] ) ) ;
} else
if ( line . find ( " {BGM " ) ! = std : : string : : npos ) { //Pause command
if ( arguments . size ( ) ! = 1 ) ERR ( " Arguments size is " < < arguments . size ( ) < < " . Expecting only 1 argument. " )
data . push_back ( std : : make_unique < BGMCommand > ( arguments [ 0 ] ) ) ;
} else {
ERR ( " Unknown command " < < line < < " . Could not parse! " ) ;
}
@ -181,12 +189,14 @@ void VisualNovel::LoadVisualNovel(std::string storyLevelName){
for ( std : : unique_ptr < Command > & command : storyLevelData . at ( storyLevelName ) ) {
novel . commands . push_back ( command . get ( ) ) ;
}
Audio : : PlayBGM ( " story " ) ;
GameState : : ChangeState ( States : : STORY , 0.5f , 10U ) ;
novel . ExecuteNextCommand ( ) ;
novel . prevTheme = Menu : : GetCurrentTheme ( ) . GetThemeName ( ) ;
Menu : : themeSelection = " Purple " ;
}
void VisualNovel : : Update ( ) {
Audio : : SetBGMPitch ( audioPitch ) ;
if ( transitionTime = = 0 & & game - > KEY_CONFIRM . Pressed ( ) ) {
activeText = U " " ;
novel . ExecuteNextCommand ( ) ;
@ -383,4 +393,20 @@ CommandType::CommandType DialogCommand::GetType(){return CommandType::DIALOG;}
void PauseCommand : : Execute ( VisualNovel & vn ) { }
PauseCommand : : PauseCommand ( ) { }
CommandType : : CommandType PauseCommand : : GetType ( ) { return CommandType : : PAUSE ; }
CommandType : : CommandType PauseCommand : : GetType ( ) { return CommandType : : PAUSE ; }
void AudioPitchCommand : : Execute ( VisualNovel & vn ) {
vn . audioPitch = pitch ;
vn . ExecuteNextCommand ( ) ;
}
AudioPitchCommand : : AudioPitchCommand ( std : : string pitch )
: pitch ( std : : stof ( pitch ) ) { }
CommandType : : CommandType AudioPitchCommand : : GetType ( ) { return CommandType : : AUDIOPITCH ; }
void BGMCommand : : Execute ( VisualNovel & vn ) {
Audio : : PlayBGM ( songName ) ;
vn . ExecuteNextCommand ( ) ;
}
BGMCommand : : BGMCommand ( std : : string songName )
: songName ( songName ) { }
CommandType : : CommandType BGMCommand : : GetType ( ) { return CommandType : : BGM ; }