From f96c783035aa842af6f7b04a37b09ca5ec4de437 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sat, 15 Apr 2017 00:09:21 +0200 Subject: fix clanging sounds when using the fast math floating point calculations in cgame --- src/cgame/cg_buildable.c | 6 ++---- src/cgame/cg_local.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index eed8e0e..68fc4c2 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -1211,7 +1211,6 @@ void CG_Buildable( centity_t *cent ) buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex ); float scale; int health; - float healthScale; //must be before EF_NODRAW check if( team == BIT_ALIENS ) @@ -1397,9 +1396,8 @@ void CG_Buildable( centity_t *cent ) } health = es->generic1 & B_HEALTH_MASK; - healthScale = (float)health / B_HEALTH_MASK; - if( healthScale < cent->lastBuildableHealthScale && ( es->generic1 & B_SPAWNED_TOGGLEBIT ) ) + if( health < cent->lastBuildableHealth && ( es->generic1 & B_SPAWNED_TOGGLEBIT ) ) { if( cent->lastBuildableDamageSoundTime + BUILDABLE_SOUND_PERIOD < cg.time ) { @@ -1415,7 +1413,7 @@ void CG_Buildable( centity_t *cent ) } } - cent->lastBuildableHealthScale = healthScale; + cent->lastBuildableHealth = health; //smoke etc for damaged buildables CG_BuildableParticleEffects( cent ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index ed7d7cc..cea59f0 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -639,7 +639,7 @@ typedef struct centity_s buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set particleSystem_t *buildablePS; buildableStatus_t buildableStatus; - float lastBuildableHealthScale; + int lastBuildableHealth; int lastBuildableDamageSoundTime; lightFlareStatus_t lfs; -- cgit