diff options
author | /dev/humancontroller <devhc@example.com> | 2017-04-15 00:09:21 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-04-15 17:24:18 +0200 |
commit | f96c783035aa842af6f7b04a37b09ca5ec4de437 (patch) | |
tree | a64a0e04c5a723e83626055aedc2e174e865ab34 | |
parent | cd6f59f1d7b5ddf00f3817f6b8fb9ee83a85494c (diff) |
fix clanging sounds when using the fast math floating point calculations in cgame
-rw-r--r-- | src/cgame/cg_buildable.c | 6 | ||||
-rw-r--r-- | 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; |