diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 26b3ed9d..934853c2 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2031,7 +2031,10 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ ItemDrop::drops.clear(); GameEvent::events.clear(); Audio::SetBGMPitch(1.f); - Audio::SetAudioEvent("Default Volume"); + #ifdef __EMSCRIPTEN__ + Audio::muted=true; + Audio::UpdateBGMVolume(); + #endif game->view.SetZoom(1.f,game->view.WorldToScreen(game->camera.GetViewPosition())); SetMosaicEffect(1U); worldColor=WHITE; @@ -2322,9 +2325,23 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ return true; }); #pragma endregion + + LoadingScreen::AddPhase([&](){ + #ifdef __EMSCRIPTEN__ + Audio::muted=false; + Audio::UpdateBGMVolume(); + #endif + pathfinder.Initialize(); + return true; + }); #pragma region Setup Pathfinding (Loading Phase 9) LoadingScreen::AddPhase([&](){ + Audio::SetAudioEvent("Default Volume"); + #ifdef __EMSCRIPTEN__ + Audio::muted=false; + Audio::UpdateBGMVolume(); + #endif pathfinder.Initialize(); return true; }); diff --git a/Adventures in Lestoria/Audio.cpp b/Adventures in Lestoria/Audio.cpp index eb422048..2ec3c283 100644 --- a/Adventures in Lestoria/Audio.cpp +++ b/Adventures in Lestoria/Audio.cpp @@ -129,7 +129,6 @@ void Audio::PrepareBGM(const std::string_view sound,const bool loop){ StopBGM(); //Stop any currently playing track. Self().playParams={std::string(sound),loop}; Self().playBGMWaitTime=0.7f; - #pragma region Internal Loading Loop Setup Self().trackLoadStarted=false; Self().trackLoadComplete=false; diff --git a/Adventures in Lestoria/DeathMenu.cpp b/Adventures in Lestoria/DeathMenu.cpp index ca3da953..5ba808fa 100644 --- a/Adventures in Lestoria/DeathMenu.cpp +++ b/Adventures in Lestoria/DeathMenu.cpp @@ -55,7 +55,7 @@ void Menu::InitializeDeathWindow(){ return true; },ButtonAttr::FIT_TO_LABEL)END; deathWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect{{6.f,28.f},{84.f,24.f}},"Return to Camp",[](MenuFuncData data){ - if(!Unlock::IsUnlocked("HUB")){ + if(!Unlock::IsUnlocked("STORY_1_1")){ GameState::ChangeState(States::OVERWORLD_MAP); }else{ GameState::ChangeState(States::GAME_HUB); diff --git a/Adventures in Lestoria/LevelCompleteWindow.cpp b/Adventures in Lestoria/LevelCompleteWindow.cpp index 84c407af..b0f6bb63 100644 --- a/Adventures in Lestoria/LevelCompleteWindow.cpp +++ b/Adventures in Lestoria/LevelCompleteWindow.cpp @@ -70,7 +70,7 @@ void Menu::InitializeLevelCompleteWindow(){ auto nextButtonAction=[](MenuFuncData data){ Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map); Merchant::RandomizeTravelingMerchant(); - if(Unlock::IsUnlocked("HUB")){ + if(Unlock::IsUnlocked("STORY_1_1")){ GameState::ChangeState(States::GAME_HUB,0.25f); }else{ GameState::ChangeState(States::OVERWORLD_MAP,0.25f); diff --git a/Adventures in Lestoria/MenuLabel.h b/Adventures in Lestoria/MenuLabel.h index f85f1936..58d10956 100644 --- a/Adventures in Lestoria/MenuLabel.h +++ b/Adventures in Lestoria/MenuLabel.h @@ -54,6 +54,7 @@ protected: bool rightAlign=false; bool proportional=true; bool runOnLabelChangeFunc=false; + bool censored=false; std::functiononLabelChangeFunc; //Specific wrapping members. @@ -85,17 +86,20 @@ protected: } inline virtual void DrawDecal(ViewPort&window,bool focused)override{ MenuComponent::DrawDecal(window,focused); + std::string censoredTextEntry; + censoredTextEntry=std::accumulate(GetLabel().begin(),GetLabel().end(),""s,[](std::string currentStr,const char&c){return std::move(currentStr)+'*';}); + std::string_view finalLabel=censored?censoredTextEntry:GetLabel(); vf2d adjustedScale={scale,scale}; vf2d labelTextSize= proportional? - vf2d(game->GetWrappedTextSizeProp(GetLabel(),rect.size.x-2,adjustedScale)): - vf2d(game->GetWrappedTextSize(GetLabel(),rect.size.x-2,adjustedScale)); + vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-2,adjustedScale)): + vf2d(game->GetWrappedTextSize(finalLabel,rect.size.x-2,adjustedScale)); if(fitToLabel){ labelTextSize= proportional? - vf2d(game->GetTextSizeProp(GetLabel())*adjustedScale): - vf2d(game->GetTextSize(GetLabel())*adjustedScale); + vf2d(game->GetTextSizeProp(finalLabel)*adjustedScale): + vf2d(game->GetTextSize(finalLabel)*adjustedScale); float sizeRatio=(labelTextSize.x)/(rect.size.x-2); if(sizeRatio>1){ adjustedScale.x/=sizeRatio; @@ -134,15 +138,15 @@ protected: }else{ if(shadow){ if(proportional){ - window.DrawShadowStringPropDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); + window.DrawShadowStringPropDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); }else{ - window.DrawShadowStringDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); + window.DrawShadowStringDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); } }else{ if(proportional){ - window.DrawStringPropDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); + window.DrawStringPropDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); }else{ - window.DrawStringDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); + window.DrawStringDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f); } } } diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index d092c6a0..6e8b83e3 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -1010,7 +1010,7 @@ void Player::CheckEndZoneCollision(){ if(endZoneStandTime>="Player.End Zone Wait Time"_F){ Component(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed"); Component(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP"); - if(Unlock::IsUnlocked("HUB")){ + if(Unlock::IsUnlocked("STORY_1_1")){ Component(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed\nto Camp"); }else{ Component(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed"); diff --git a/Adventures in Lestoria/State_Death.cpp b/Adventures in Lestoria/State_Death.cpp index 5e874ae6..def24fb4 100644 --- a/Adventures in Lestoria/State_Death.cpp +++ b/Adventures in Lestoria/State_Death.cpp @@ -54,7 +54,7 @@ void State_Death::OnStateChange(GameState*prevState){ Menu::CloseAllMenus(); } game->GetPlayer()->SetState(State::DEATH); - if(!Unlock::IsUnlocked("HUB")){ + if(!Unlock::IsUnlocked("STORY_1_1")){ Component(DEATH,"Return to Camp Button")->SetLabel(" Return to \nStage Select"); }else{ Component(DEATH,"Return to Camp Button")->SetLabel("Return to Camp"); @@ -65,7 +65,7 @@ void State_Death::OnStateChange(GameState*prevState){ } void State_Death::OnLevelLoad(){ Component(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( - !Unlock::IsUnlocked("HUB")||game->GetCurrentMapName()=="HUB" + !Unlock::IsUnlocked("STORY_1_1")||game->GetCurrentMapName()=="HUB" ); } void State_Death::OnUserUpdate(AiL*game){ diff --git a/Adventures in Lestoria/State_GameRun.cpp b/Adventures in Lestoria/State_GameRun.cpp index 4229caac..95fd1428 100644 --- a/Adventures in Lestoria/State_GameRun.cpp +++ b/Adventures in Lestoria/State_GameRun.cpp @@ -78,7 +78,7 @@ void State_GameRun::OnStateChange(GameState*prevState){ } void State_GameRun::OnLevelLoad(){ Component(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( - !Unlock::IsUnlocked("HUB")||game->GetCurrentMapName()=="HUB" + !Unlock::IsUnlocked("STORY_1_1")||game->GetCurrentMapName()=="HUB" ); if(!Tutorial::TaskIsComplete(TutorialTaskName::MOVE_AROUND)){ Tutorial::SetNextTask(TutorialTaskName::MOVE_AROUND); diff --git a/Adventures in Lestoria/TextEntryLabel.h b/Adventures in Lestoria/TextEntryLabel.h index d1d8b57e..a8386bbb 100644 --- a/Adventures in Lestoria/TextEntryLabel.h +++ b/Adventures in Lestoria/TextEntryLabel.h @@ -46,11 +46,12 @@ protected: std::string lastTextEntryStr; float blinkTimer=0; uint8_t charLimit=16; - bool censored=false; std::functiononTextChangeCallbackFunc; public: inline TextEntryLabel(geom2d::rectrect,std::functiononTextChangeCallbackFunc=TEXTCHANGE_DONOTHING,const bool censored=false,const uint8_t charLimit=16,float scale=1,ComponentAttr attributes=ComponentAttr::NONE) - :MenuLabel(rect,"",scale,attributes),onTextChangeCallbackFunc(onTextChangeCallbackFunc),censored(censored),charLimit(charLimit){} + :MenuLabel(rect,"",scale,attributes),onTextChangeCallbackFunc(onTextChangeCallbackFunc),charLimit(charLimit){ + this->censored=censored; + } inline virtual void Update(AiL*game)override{ MenuLabel::Update(game); @@ -65,7 +66,6 @@ public: onTextChangeCallbackFunc(lastTextEntryStr); } censoredTextEntry=std::accumulate(textEntry.begin(),textEntry.end(),""s,[](std::string currentStr,const char&c){return std::move(currentStr)+'*';}); - std::cout<IsTextEntryEnabled()){ @@ -84,10 +84,6 @@ public: } inline const std::string&GetLabel()const override{ - if(!censored){ - return game->TextEntryGetString(); - }else{ - return MenuLabel::GetLabel(); - } + return game->TextEntryGetString(); } }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index fbb4aa4e..a48f8b02 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 4 #define VERSION_PATCH 0 -#define VERSION_BUILD 7850 +#define VERSION_BUILD 7852 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 681bdd75..aaf867db 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ