Remove (most) stuttering from web build when loading stage sound.
This commit is contained in:
parent
eb069a0012
commit
12db8ed839
@ -2008,7 +2008,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
LoadingScreen::Reset();
|
||||
previousLevel=currentLevel;
|
||||
currentLevel=map;
|
||||
loadingWaitTime=0.f;
|
||||
game->loadingWaitTime=0.f;
|
||||
|
||||
#pragma region Reset all data (Loading phase 1)
|
||||
LoadingScreen::AddPhase([&](){
|
||||
@ -2029,7 +2029,6 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
DAMAGENUMBER_LIST.clear();
|
||||
backgroundEffects.clear();
|
||||
foregroundEffects.clear();
|
||||
ZONE_LIST.clear();
|
||||
ItemDrop::drops.clear();
|
||||
GameEvent::events.clear();
|
||||
Audio::SetBGMPitch(1.f);
|
||||
@ -2065,6 +2064,15 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
});
|
||||
#pragma endregion
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
LoadingScreen::AddPhase([&](){
|
||||
Audio::muted=true;
|
||||
Audio::UpdateBGMVolume();
|
||||
game->loadingWaitTime+=game->GetElapsedTime();
|
||||
return game->loadingWaitTime>=0.4f;
|
||||
});
|
||||
#endif
|
||||
|
||||
#pragma region Monster Spawn Data Setup (Loading phase 2)
|
||||
LoadingScreen::AddPhase([&](){
|
||||
for(auto&[key,value]:MAP_DATA[GetCurrentLevel()].SpawnerData){
|
||||
@ -2370,6 +2378,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
||||
for(int trackID:track.GetChannelIDs()){
|
||||
audioEngine.Engine().Play(trackID,true);
|
||||
}
|
||||
Audio::muted=false;
|
||||
Audio::UpdateBGMVolume();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -174,6 +174,7 @@ private:
|
||||
ResourcePack gamepack;
|
||||
uint8_t mosaicEffectTransition=1U;
|
||||
float saveGameDisplayTime=0.f;
|
||||
float loadingWaitTime=0.f;
|
||||
|
||||
void ValidateGameStatus();
|
||||
void _PrepareLevel(MapName map,MusicChange changeMusic);
|
||||
|
@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
||||
|
||||
Portions of this software are copyright © 2024 The FreeType
|
||||
Portions of this software are copyright <EFBFBD> 2024 The FreeType
|
||||
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||
All rights reserved.
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ bool Warrior::AutoAttack(){
|
||||
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
||||
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
||||
|
||||
float dirToEnemy=geom2d::float<rect>(GetPos(),closest->GetPos()).vector().polar().y;
|
||||
float dirToEnemy=geom2d::line<float>(GetPos(),closest->GetPos()).vector().polar().y;
|
||||
SetState(State::SWING_SWORD);
|
||||
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
||||
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
||||
|
Loading…
x
Reference in New Issue
Block a user