Internally show censored text, but actual label must return the uncensored text of a TextEntryLabel/MenuLabel. Since emscripten doesn't have multi-threaded audio buffering, we immediately mute on stage load to prevent stuttering / bad noise. Fix HUB being a requirement when it's not a stage that can be unlocked for returning to camp conditions. Release Build 7852.

pull/35/head
sigonasr2 9 months ago
parent a51d3bc898
commit 469c360e51
  1. 19
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 1
      Adventures in Lestoria/Audio.cpp
  3. 2
      Adventures in Lestoria/DeathMenu.cpp
  4. 2
      Adventures in Lestoria/LevelCompleteWindow.cpp
  5. 20
      Adventures in Lestoria/MenuLabel.h
  6. 2
      Adventures in Lestoria/Player.cpp
  7. 4
      Adventures in Lestoria/State_Death.cpp
  8. 2
      Adventures in Lestoria/State_GameRun.cpp
  9. 10
      Adventures in Lestoria/TextEntryLabel.h
  10. 2
      Adventures in Lestoria/Version.h
  11. BIN
      x64/Release/Adventures in Lestoria.exe

@ -2031,7 +2031,10 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
ItemDrop::drops.clear(); ItemDrop::drops.clear();
GameEvent::events.clear(); GameEvent::events.clear();
Audio::SetBGMPitch(1.f); 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())); game->view.SetZoom(1.f,game->view.WorldToScreen(game->camera.GetViewPosition()));
SetMosaicEffect(1U); SetMosaicEffect(1U);
worldColor=WHITE; worldColor=WHITE;
@ -2323,8 +2326,22 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
}); });
#pragma endregion #pragma endregion
LoadingScreen::AddPhase([&](){
#ifdef __EMSCRIPTEN__
Audio::muted=false;
Audio::UpdateBGMVolume();
#endif
pathfinder.Initialize();
return true;
});
#pragma region Setup Pathfinding (Loading Phase 9) #pragma region Setup Pathfinding (Loading Phase 9)
LoadingScreen::AddPhase([&](){ LoadingScreen::AddPhase([&](){
Audio::SetAudioEvent("Default Volume");
#ifdef __EMSCRIPTEN__
Audio::muted=false;
Audio::UpdateBGMVolume();
#endif
pathfinder.Initialize(); pathfinder.Initialize();
return true; return true;
}); });

@ -129,7 +129,6 @@ void Audio::PrepareBGM(const std::string_view sound,const bool loop){
StopBGM(); //Stop any currently playing track. StopBGM(); //Stop any currently playing track.
Self().playParams={std::string(sound),loop}; Self().playParams={std::string(sound),loop};
Self().playBGMWaitTime=0.7f; Self().playBGMWaitTime=0.7f;
#pragma region Internal Loading Loop Setup #pragma region Internal Loading Loop Setup
Self().trackLoadStarted=false; Self().trackLoadStarted=false;
Self().trackLoadComplete=false; Self().trackLoadComplete=false;

@ -55,7 +55,7 @@ void Menu::InitializeDeathWindow(){
return true; return true;
},ButtonAttr::FIT_TO_LABEL)END; },ButtonAttr::FIT_TO_LABEL)END;
deathWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect<float>{{6.f,28.f},{84.f,24.f}},"Return to Camp",[](MenuFuncData data){ deathWindow->ADD("Return to Camp Button",MenuComponent)(geom2d::rect<float>{{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); GameState::ChangeState(States::OVERWORLD_MAP);
}else{ }else{
GameState::ChangeState(States::GAME_HUB); GameState::ChangeState(States::GAME_HUB);

@ -70,7 +70,7 @@ void Menu::InitializeLevelCompleteWindow(){
auto nextButtonAction=[](MenuFuncData data){ auto nextButtonAction=[](MenuFuncData data){
Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map); Unlock::UnlockArea(State_OverworldMap::GetCurrentConnectionPoint().map);
Merchant::RandomizeTravelingMerchant(); Merchant::RandomizeTravelingMerchant();
if(Unlock::IsUnlocked("HUB")){ if(Unlock::IsUnlocked("STORY_1_1")){
GameState::ChangeState(States::GAME_HUB,0.25f); GameState::ChangeState(States::GAME_HUB,0.25f);
}else{ }else{
GameState::ChangeState(States::OVERWORLD_MAP,0.25f); GameState::ChangeState(States::OVERWORLD_MAP,0.25f);

@ -54,6 +54,7 @@ protected:
bool rightAlign=false; bool rightAlign=false;
bool proportional=true; bool proportional=true;
bool runOnLabelChangeFunc=false; bool runOnLabelChangeFunc=false;
bool censored=false;
std::function<void(std::string_view newLabel)>onLabelChangeFunc; std::function<void(std::string_view newLabel)>onLabelChangeFunc;
//Specific wrapping members. //Specific wrapping members.
@ -85,17 +86,20 @@ protected:
} }
inline virtual void DrawDecal(ViewPort&window,bool focused)override{ inline virtual void DrawDecal(ViewPort&window,bool focused)override{
MenuComponent::DrawDecal(window,focused); 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 adjustedScale={scale,scale};
vf2d labelTextSize= vf2d labelTextSize=
proportional? proportional?
vf2d(game->GetWrappedTextSizeProp(GetLabel(),rect.size.x-2,adjustedScale)): vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-2,adjustedScale)):
vf2d(game->GetWrappedTextSize(GetLabel(),rect.size.x-2,adjustedScale)); vf2d(game->GetWrappedTextSize(finalLabel,rect.size.x-2,adjustedScale));
if(fitToLabel){ if(fitToLabel){
labelTextSize= labelTextSize=
proportional? proportional?
vf2d(game->GetTextSizeProp(GetLabel())*adjustedScale): vf2d(game->GetTextSizeProp(finalLabel)*adjustedScale):
vf2d(game->GetTextSize(GetLabel())*adjustedScale); vf2d(game->GetTextSize(finalLabel)*adjustedScale);
float sizeRatio=(labelTextSize.x)/(rect.size.x-2); float sizeRatio=(labelTextSize.x)/(rect.size.x-2);
if(sizeRatio>1){ if(sizeRatio>1){
adjustedScale.x/=sizeRatio; adjustedScale.x/=sizeRatio;
@ -134,15 +138,15 @@ protected:
}else{ }else{
if(shadow){ if(shadow){
if(proportional){ if(proportional){
window.DrawShadowStringPropDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f); window.DrawShadowStringPropDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f);
}else{ }else{
window.DrawShadowStringDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f); window.DrawShadowStringDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f);
} }
}else{ }else{
if(proportional){ if(proportional){
window.DrawStringPropDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f); window.DrawStringPropDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f);
}else{ }else{
window.DrawStringDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f); window.DrawStringDecal(drawPos,finalLabel,WHITE,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-2,1.0f);
} }
} }
} }

@ -1010,7 +1010,7 @@ void Player::CheckEndZoneCollision(){
if(endZoneStandTime>="Player.End Zone Wait Time"_F){ if(endZoneStandTime>="Player.End Zone Wait Time"_F){
Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed"); Component<MenuLabel>(LEVEL_COMPLETE,"Stage Complete Label")->SetLabel("Stage Completed");
Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP"); Component<MenuComponent>(LEVEL_COMPLETE,"Level Details Outline")->SetLabel("Complete Bonus\n +10% XP");
if(Unlock::IsUnlocked("HUB")){ if(Unlock::IsUnlocked("STORY_1_1")){
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed\nto Camp"); Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed\nto Camp");
}else{ }else{
Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed"); Component<MenuComponent>(LEVEL_COMPLETE,"Next Button")->SetLabel("Proceed");

@ -54,7 +54,7 @@ void State_Death::OnStateChange(GameState*prevState){
Menu::CloseAllMenus(); Menu::CloseAllMenus();
} }
game->GetPlayer()->SetState(State::DEATH); game->GetPlayer()->SetState(State::DEATH);
if(!Unlock::IsUnlocked("HUB")){ if(!Unlock::IsUnlocked("STORY_1_1")){
Component<MenuComponent>(DEATH,"Return to Camp Button")->SetLabel(" Return to \nStage Select"); Component<MenuComponent>(DEATH,"Return to Camp Button")->SetLabel(" Return to \nStage Select");
}else{ }else{
Component<MenuComponent>(DEATH,"Return to Camp Button")->SetLabel("Return to Camp"); Component<MenuComponent>(DEATH,"Return to Camp Button")->SetLabel("Return to Camp");
@ -65,7 +65,7 @@ void State_Death::OnStateChange(GameState*prevState){
} }
void State_Death::OnLevelLoad(){ void State_Death::OnLevelLoad(){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( Component<MenuComponent>(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){ void State_Death::OnUserUpdate(AiL*game){

@ -78,7 +78,7 @@ void State_GameRun::OnStateChange(GameState*prevState){
} }
void State_GameRun::OnLevelLoad(){ void State_GameRun::OnLevelLoad(){
Component<MenuComponent>(MenuType::PAUSE,"Return to Camp Button")->SetGrayedOut( Component<MenuComponent>(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)){ if(!Tutorial::TaskIsComplete(TutorialTaskName::MOVE_AROUND)){
Tutorial::SetNextTask(TutorialTaskName::MOVE_AROUND); Tutorial::SetNextTask(TutorialTaskName::MOVE_AROUND);

@ -46,11 +46,12 @@ protected:
std::string lastTextEntryStr; std::string lastTextEntryStr;
float blinkTimer=0; float blinkTimer=0;
uint8_t charLimit=16; uint8_t charLimit=16;
bool censored=false;
std::function<void(std::string_view updatedLabel)>onTextChangeCallbackFunc; std::function<void(std::string_view updatedLabel)>onTextChangeCallbackFunc;
public: public:
inline TextEntryLabel(geom2d::rect<float>rect,std::function<void(std::string_view updatedLabel)>onTextChangeCallbackFunc=TEXTCHANGE_DONOTHING,const bool censored=false,const uint8_t charLimit=16,float scale=1,ComponentAttr attributes=ComponentAttr::NONE) inline TextEntryLabel(geom2d::rect<float>rect,std::function<void(std::string_view updatedLabel)>onTextChangeCallbackFunc=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{ inline virtual void Update(AiL*game)override{
MenuLabel::Update(game); MenuLabel::Update(game);
@ -65,7 +66,6 @@ public:
onTextChangeCallbackFunc(lastTextEntryStr); onTextChangeCallbackFunc(lastTextEntryStr);
} }
censoredTextEntry=std::accumulate(textEntry.begin(),textEntry.end(),""s,[](std::string currentStr,const char&c){return std::move(currentStr)+'*';}); censoredTextEntry=std::accumulate(textEntry.begin(),textEntry.end(),""s,[](std::string currentStr,const char&c){return std::move(currentStr)+'*';});
std::cout<<censoredTextEntry<<std::endl;
std::string_view finalLabel=censored?censoredTextEntry:textEntry; std::string_view finalLabel=censored?censoredTextEntry:textEntry;
if(game->IsTextEntryEnabled()){ if(game->IsTextEntryEnabled()){
@ -84,10 +84,6 @@ public:
} }
inline const std::string&GetLabel()const override{ inline const std::string&GetLabel()const override{
if(!censored){
return game->TextEntryGetString(); return game->TextEntryGetString();
}else{
return MenuLabel::GetLabel();
}
} }
}; };

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 4 #define VERSION_MINOR 4
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 7850 #define VERSION_BUILD 7852
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

Loading…
Cancel
Save