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();
|
LoadingScreen::Reset();
|
||||||
previousLevel=currentLevel;
|
previousLevel=currentLevel;
|
||||||
currentLevel=map;
|
currentLevel=map;
|
||||||
loadingWaitTime=0.f;
|
game->loadingWaitTime=0.f;
|
||||||
|
|
||||||
#pragma region Reset all data (Loading phase 1)
|
#pragma region Reset all data (Loading phase 1)
|
||||||
LoadingScreen::AddPhase([&](){
|
LoadingScreen::AddPhase([&](){
|
||||||
@ -2029,7 +2029,6 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
|||||||
DAMAGENUMBER_LIST.clear();
|
DAMAGENUMBER_LIST.clear();
|
||||||
backgroundEffects.clear();
|
backgroundEffects.clear();
|
||||||
foregroundEffects.clear();
|
foregroundEffects.clear();
|
||||||
ZONE_LIST.clear();
|
|
||||||
ItemDrop::drops.clear();
|
ItemDrop::drops.clear();
|
||||||
GameEvent::events.clear();
|
GameEvent::events.clear();
|
||||||
Audio::SetBGMPitch(1.f);
|
Audio::SetBGMPitch(1.f);
|
||||||
@ -2064,6 +2063,15 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
#pragma endregion
|
#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)
|
#pragma region Monster Spawn Data Setup (Loading phase 2)
|
||||||
LoadingScreen::AddPhase([&](){
|
LoadingScreen::AddPhase([&](){
|
||||||
@ -2370,6 +2378,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
|||||||
for(int trackID:track.GetChannelIDs()){
|
for(int trackID:track.GetChannelIDs()){
|
||||||
audioEngine.Engine().Play(trackID,true);
|
audioEngine.Engine().Play(trackID,true);
|
||||||
}
|
}
|
||||||
|
Audio::muted=false;
|
||||||
|
Audio::UpdateBGMVolume();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -174,6 +174,7 @@ private:
|
|||||||
ResourcePack gamepack;
|
ResourcePack gamepack;
|
||||||
uint8_t mosaicEffectTransition=1U;
|
uint8_t mosaicEffectTransition=1U;
|
||||||
float saveGameDisplayTime=0.f;
|
float saveGameDisplayTime=0.f;
|
||||||
|
float loadingWaitTime=0.f;
|
||||||
|
|
||||||
void ValidateGameStatus();
|
void ValidateGameStatus();
|
||||||
void _PrepareLevel(MapName map,MusicChange changeMusic);
|
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
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
SUCH DAMAGE.
|
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.
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
@ -84,7 +84,7 @@ bool Warrior::AutoAttack(){
|
|||||||
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
|
||||||
swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F;
|
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);
|
SetState(State::SWING_SWORD);
|
||||||
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
SetAnimationBasedOnTargetingDirection(dirToEnemy);
|
||||||
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user