diff options
author | Tim Angus <tim@ngus.net> | 2009-10-04 22:40:52 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:39 +0000 |
commit | aede0859509b743e8a76c2ad055ae94d0545af88 (patch) | |
tree | 16942dbb3df86891aad9b89e88a7fd427f607680 /src/cgame | |
parent | ea0ff0071ed313c479693f1d2e1b9a2da167a891 (diff) |
* Reduce generic1 to 10 bits
* Remove buildable health scaling/masking stuff; 10 bits is plenty now
* Potentially fix bug where many PVS entering buildables would inappropriately
make damaged sounds
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_buildable.c | 16 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 2 | ||||
-rw-r--r-- | src/cgame/cg_tutorial.c | 4 |
4 files changed, 15 insertions, 11 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c index 1f882a3a..db6eb539 100644 --- a/src/cgame/cg_buildable.c +++ b/src/cgame/cg_buildable.c @@ -633,8 +633,8 @@ static void CG_BuildableParticleEffects( centity_t *cent ) { entityState_t *es = ¢->currentState; team_t team = BG_Buildable( es->modelindex )->team; - int health = es->generic1 & B_HEALTH_MASK; - float healthFrac = (float)health / B_HEALTH_MASK; + int health = es->generic1; + float healthFrac = (float)health / BG_Buildable( es->modelindex )->health; if( !( es->eFlags & EF_B_SPAWNED ) ) return; @@ -955,8 +955,8 @@ static void CG_BuildableStatusDisplay( centity_t *cent ) return; } - health = es->generic1 & B_HEALTH_MASK; - healthScale = (float)health / B_HEALTH_MASK; + health = es->generic1; + healthScale = (float)health / BG_Buildable( es->modelindex )->health; if( health > 0 && healthScale < 0.01f ) healthScale = 0.01f; @@ -1412,10 +1412,10 @@ void CG_Buildable( centity_t *cent ) trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, weapon->readySound ); } - health = es->generic1 & B_HEALTH_MASK; - healthScale = (float)health / B_HEALTH_MASK; + health = es->generic1; + healthScale = (float)health / BG_Buildable( es->modelindex )->health; - if( healthScale < cent->lastBuildableHealthScale && + if( health < cent->lastBuildableHealth && ( es->eFlags & EF_B_SPAWNED ) ) { if( cent->lastBuildableDamageSoundTime + BUILDABLE_SOUND_PERIOD < cg.time ) @@ -1432,7 +1432,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_ents.c b/src/cgame/cg_ents.c index eed57686..96e5faf6 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -1015,6 +1015,10 @@ static void CG_CEntityPVSEnter( centity_t *cent ) case ET_MISSILE: CG_LaunchMissile( cent ); break; + + case ET_BUILDABLE: + cent->lastBuildableHealth = es->generic1; + break; } //clear any particle systems from previous uses of this centity_t diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index 68895d72..6b87f7c2 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -650,7 +650,7 @@ typedef struct centity_s particleSystem_t *buildablePS; buildableStatus_t buildableStatus; buildableCache_t buildableCache; // so we don't recalculate things - float lastBuildableHealthScale; + float lastBuildableHealth; int lastBuildableDamageSoundTime; lightFlareStatus_t lfs; diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index 8db27d23..75bca690 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -156,8 +156,8 @@ static entityState_t *CG_BuildableInRange( playerState_t *ps, float *healthFract if( healthFraction ) { - health = es->generic1 & B_HEALTH_MASK; - *healthFraction = (float)health / B_HEALTH_MASK; + health = es->generic1; + *healthFraction = (float)health / BG_Buildable( es->modelindex )->health; } if( es->eType == ET_BUILDABLE && |