diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index efe38a9f..81734dbb 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -3326,9 +3326,12 @@ void AiL::RenderFadeout(){ if(fadeOutDuration>0){ fadeOutDuration=std::max(0.f,fadeOutDuration-GetElapsedTime()); if(fadeOutDuration==0){ + SetMosaicEffect(1U); GameState::_ChangeState(transitionState); + }else{ + SetMosaicEffect(util::lerp(1U,mosaicEffectTransition,1-(fadeOutDuration/fadeOutTotalTime))); + alpha=uint8_t(util::lerp(0,255,1-(fadeOutDuration/fadeOutTotalTime))); } - alpha=uint8_t(util::lerp(0,255,1-(fadeOutDuration/fadeOutTotalTime))); }else if(fadeInDuration>0){ if(!disableFadeIn){ diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 5dfeb0ad..fe717f0b 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -172,6 +172,7 @@ private: bool paused=false; bool gameInitialized=false; ResourcePack gamepack; + uint8_t mosaicEffectTransition=1U; void ValidateGameStatus(); void _PrepareLevel(MapName map,MusicChange changeMusic); diff --git a/Adventures in Lestoria/GameState.cpp b/Adventures in Lestoria/GameState.cpp index 889062b6..b097b795 100644 --- a/Adventures in Lestoria/GameState.cpp +++ b/Adventures in Lestoria/GameState.cpp @@ -70,9 +70,10 @@ void GameState::_ChangeState(States::State newState){ STATE->OnStateChange(prevState); } -void GameState::ChangeState(States::State newState,float fadeOutDuration){ +void GameState::ChangeState(States::State newState,float fadeOutDuration,uint8_t mosaicEffect){ if(fadeOutDuration>0){ game->fadeOutDuration=game->fadeOutTotalTime=game->fadeInDuration=fadeOutDuration; + game->mosaicEffectTransition=mosaicEffect; game->transitionState=newState; }else{ _ChangeState(newState); diff --git a/Adventures in Lestoria/GameState.h b/Adventures in Lestoria/GameState.h index 7d7ab123..86ed8479 100644 --- a/Adventures in Lestoria/GameState.h +++ b/Adventures in Lestoria/GameState.h @@ -73,6 +73,6 @@ public: virtual void GetAnyKeyRelease(Key k); virtual void GetAnyMousePress(int32_t mouseButton); virtual void GetAnyMouseRelease(int32_t mouseButton); - static void ChangeState(States::State newState,float fadeOutDuration=0); + static void ChangeState(States::State newState,float fadeOutDuration=0,uint8_t mosaicEffect=1U); virtual void OnLevelLoad()=0; }; \ No newline at end of file diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp index 5dcfc166..0ddfb280 100644 --- a/Adventures in Lestoria/State_OverworldMap.cpp +++ b/Adventures in Lestoria/State_OverworldMap.cpp @@ -235,9 +235,9 @@ void State_OverworldMap::StartLevel(){ VisualNovel::LoadVisualNovel(State_OverworldMap::GetCurrentConnectionPoint().map); }else if(State_OverworldMap::GetCurrentConnectionPoint().type.starts_with("HUB")){ - GameState::ChangeState(States::GAME_HUB,0.3f); + GameState::ChangeState(States::GAME_HUB,0.3f,10U); }else{ - GameState::ChangeState(States::GAME_RUN,0.3f); + GameState::ChangeState(States::GAME_RUN,0.3f,10U); } } diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 59c0d79e..7b701dc5 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -2,8 +2,6 @@ February 28th -> Begin Internal Game Playtesting March 6th -> Discord/Friend Playtesting March 30th -> Public Demo Release -- Mosaic transition on level load - Add Bonus XP when completing a stage - Hide mouse cursor during controller play. Reveal it again during mouse play. diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index e0cf076e..ff30aac1 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 7674 +#define VERSION_BUILD 7690 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/VisualNovel.cpp b/Adventures in Lestoria/VisualNovel.cpp index 02d81eb1..ac04a76f 100644 --- a/Adventures in Lestoria/VisualNovel.cpp +++ b/Adventures in Lestoria/VisualNovel.cpp @@ -43,6 +43,7 @@ All rights reserved. #include "Unlock.h" #include "Menu.h" #include "util.h" +#include "SaveFile.h" INCLUDE_game INCLUDE_GFX @@ -180,7 +181,7 @@ void VisualNovel::LoadVisualNovel(std::string storyLevelName){ for(std::unique_ptr&command:storyLevelData.at(storyLevelName)){ novel.commands.push_back(command.get()); } - GameState::ChangeState(States::STORY,0.5f); + GameState::ChangeState(States::STORY,0.5f,10U); novel.ExecuteNextCommand(); novel.prevTheme=Menu::GetCurrentTheme().GetThemeName(); Menu::themeSelection="Purple"; @@ -247,18 +248,29 @@ void VisualNovel::Draw(){ vf2d nameDisplayPos={24.f,game->GetScreenSize().y-60.f}; vf2d nameDisplayWindowSize={48.f,-12.f}; if(speakerDisplayName.length()>0){ + if(std::find_if(rightCharacters.begin(),rightCharacters.end(),[&](std::string&rightCharacter){ + return rightCharacter==std::string(speakerDisplayName.begin(),speakerDisplayName.end()); + })!=rightCharacters.end()){ //Found the character on the right side, so the box should also be drawn on the right side. + nameDisplayPos={game->ScreenWidth()-24.f-nameDisplayWindowSize.x,game->GetScreenSize().y-60.f}; + } Menu::DrawThemedWindow(nameDisplayPos,nameDisplayWindowSize); } + std::u32string displayedName=speakerDisplayName; + std::u32string saveFileName; + saveFileName.assign(SaveFile::GetSaveFileName().begin(),SaveFile::GetSaveFileName().end()); + if(displayedName==U"You"){ + displayedName=saveFileName; + } vf2d dialogDisplayPos={24.f,game->GetScreenSize().y-48.f}; vf2d dialogDisplaySize={game->GetScreenSize().x-48.f,20.f}; Menu::DrawThemedWindow(dialogDisplayPos,dialogDisplaySize); FontRect dialogTextSize=font.GetStringBounds(activeText); - FontRect speakerTextSize=font.GetStringBounds(speakerDisplayName); - if(speakerDisplayName.length()>0){ - game->DrawShadowStringDecal(font,nameDisplayPos-vf2d{10,7}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize.size/2+speakerTextSize.offset/2,speakerDisplayName); + FontRect speakerTextSize=font.GetStringBounds(displayedName); + if(displayedName.length()>0){ + game->DrawShadowStringDecal(font,nameDisplayPos-vf2d{10,7}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize.size/2+speakerTextSize.offset/2,displayedName); game->DrawShadowStringDecal(font,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText); }else{ - game->DrawDropShadowStringDecal(narratorFont,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText); + game->DrawDropShadowStringDecal(narratorFont,dialogDisplayPos-vf2d{10,6}+dialogTextSize.offset,activeText,{190,190,220}); } float yOffset=util::lerp(dialogDisplaySize.y+12,-8,textScrollTime/maxTextScrollTime); game->DrawPolygonDecal( @@ -317,6 +329,9 @@ RightCommand::RightCommand(std::vectorcharacters) CommandType::CommandType RightCommand::GetType(){return CommandType::RIGHT;} void SpeakerCommand::Execute(VisualNovel&vn){ + if(displayedName=="You"){ + vn.speakerDisplayName.assign(SaveFile::GetSaveFileName().begin(),SaveFile::GetSaveFileName().end()); + } vn.speakerDisplayName.assign(displayedName.begin(),displayedName.end()); vn.actualSpeakerName.assign(actualSpeakerName.begin(),actualSpeakerName.end()); vn.ExecuteNextCommand(); @@ -329,11 +344,23 @@ CommandType::CommandType SpeakerCommand::GetType(){return CommandType::SPEAKER;} void DialogCommand::Execute(VisualNovel&vn){ if(dialog.size()<=0)return; + #pragma region Process "[You]" in Dialog. + std::u32string _dialog; + _dialog.assign(dialog.begin(),dialog.end()); + std::u32string processedDialog=_dialog; + size_t playerNameReplacePos=processedDialog.find(U"[You]"); + while(playerNameReplacePos!=std::u32string::npos){ + std::u32string saveFileName; + saveFileName.assign(SaveFile::GetSaveFileName().begin(),SaveFile::GetSaveFileName().end()); + processedDialog=processedDialog.replace(playerNameReplacePos,U"[You]"s.length(),saveFileName); + playerNameReplacePos=processedDialog.find(U"[You]"); + } + #pragma endregion vn.textScrollTime=VisualNovel::maxTextScrollTime; bool mustDisplay=vn.activeText.length()==0; Font*displayFont=&VisualNovel::font; if(vn.actualSpeakerName.length()==0)displayFont=&VisualNovel::narratorFont; - std::u32string newText=util::WrapText(game,vn.activeText+(vn.activeText.length()>0?U" ":U"")+std::u32string(dialog.begin(),dialog.end()),game->GetScreenSize().x-24,*displayFont,{1,1}); + std::u32string newText=util::WrapText(game,vn.activeText+(vn.activeText.length()>0?U" ":U"")+std::u32string(processedDialog.begin(),processedDialog.end()),game->GetScreenSize().x-24,*displayFont,{1,1}); if(VisualNovel::font.GetStringBounds(newText).size.y>48){//Hit the maximum of 3 lines. if(!mustDisplay){ vn.commandIndex--; diff --git a/Adventures in Lestoria/assets/config/story/Chapter 1.txt b/Adventures in Lestoria/assets/config/story/Chapter 1.txt index c1dff6f7..34d281f5 100644 --- a/Adventures in Lestoria/assets/config/story/Chapter 1.txt +++ b/Adventures in Lestoria/assets/config/story/Chapter 1.txt @@ -80,7 +80,7 @@ Sherman's response surprises you a bit. You did not expect anyone from the Scien [You] -I'm [Player Name]. Adventurer and Hunter. +I'm [You]. Adventurer and Hunter. [] diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index b53d058e..3d50173e 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ