diff options
author | Tim Angus <tim@ngus.net> | 2007-09-25 13:41:22 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2007-09-25 13:41:22 +0000 |
commit | ef5690eecfe614cee99b56d32b3634980b9a0e9d (patch) | |
tree | ba3dc9966502bb5bb4b67a8bc17823af9a579998 /src/cgame | |
parent | 1b2c5b4e113fb1f182158f7c7b191717b79e3836 (diff) |
* Replace "powerups" state data with "misc"
* Remove ps->ammo[ ] and replace with ps->ammo and ps->clips; this means
only one ammo using weapon may be carried at once, but this is the
case anyway
* No need for BG_(Un)PackAmmoArray anymore, so remove them
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_animmapobj.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_draw.c | 31 | ||||
-rw-r--r-- | src/cgame/cg_ents.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 8 | ||||
-rw-r--r-- | src/cgame/cg_predict.c | 8 | ||||
-rw-r--r-- | src/cgame/cg_scanner.c | 2 | ||||
-rw-r--r-- | src/cgame/cg_tutorial.c | 5 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 27 |
8 files changed, 25 insertions, 64 deletions
diff --git a/src/cgame/cg_animmapobj.c b/src/cgame/cg_animmapobj.c index 2e80b7e9..12253149 100644 --- a/src/cgame/cg_animmapobj.c +++ b/src/cgame/cg_animmapobj.c @@ -75,7 +75,7 @@ void CG_ModelDoor( centity_t *cent ) ent.nonNormalizedAxes = qtrue; //setup animation - anim.firstFrame = es->powerups; + anim.firstFrame = es->misc; anim.numFrames = es->weapon; anim.reversed = !es->legsAnim; anim.flipflop = qfalse; @@ -168,7 +168,7 @@ void CG_AnimMapObj( centity_t *cent ) } //setup animation - anim.firstFrame = es->powerups; + anim.firstFrame = es->misc; anim.numFrames = es->weapon; anim.reversed = qfalse; anim.flipflop = qfalse; diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 61745111..cb990e4a 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -841,7 +841,7 @@ static void CG_DrawPlayerPoisonBarbs( rectDef_t *rect, vec4_t color, qhandle_t s qboolean vertical; int iconsize, numBarbs, i; - BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &numBarbs, NULL ); + numBarbs = ps->ammo; if( height > width ) { @@ -926,7 +926,7 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color ) break; default: - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL ); + value = ps->ammo; break; } @@ -1085,7 +1085,7 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color ) break; default: - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value ); + value = ps->clips; if( value > -1 ) { @@ -1410,25 +1410,11 @@ float CG_GetValue( int ownerDraw ) { case CG_PLAYER_AMMO_VALUE: if( cent->currentState.weapon ) - { - int value; - - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, - &value, NULL ); - - return value; - } + return ps->ammo; break; case CG_PLAYER_CLIPS_VALUE: if( cent->currentState.weapon ) - { - int value; - - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, - NULL, &value ); - - return value; - } + return ps->clips; break; case CG_PLAYER_HEALTH: return ps->stats[ STAT_HEALTH ]; @@ -2378,14 +2364,13 @@ CG_DrawWeaponIcon */ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color ) { - int ammo, clips, maxAmmo; + int maxAmmo; centity_t *cent; playerState_t *ps; cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips ); BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, NULL ); // don't display if dead @@ -2397,9 +2382,9 @@ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color ) CG_RegisterWeapon( cent->currentState.weapon ); - if( clips == 0 && !BG_FindInfinteAmmoForWeapon( cent->currentState.weapon ) ) + if( ps->clips == 0 && !BG_FindInfinteAmmoForWeapon( cent->currentState.weapon ) ) { - float ammoPercent = (float)ammo / (float)maxAmmo; + float ammoPercent = (float)ps->ammo / (float)maxAmmo; if( ammoPercent < 0.33f ) { diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c index 2d2e8089..17f1a7d3 100644 --- a/src/cgame/cg_ents.c +++ b/src/cgame/cg_ents.c @@ -581,7 +581,7 @@ static void CG_Portal( centity_t *cent ) CrossProduct( ent.axis[ 0 ], ent.axis[ 1 ], ent.axis[ 2 ] ); ent.reType = RT_PORTALSURFACE; - ent.oldframe = s1->powerups; + ent.oldframe = s1->misc; ent.frame = s1->frame; // rotation speed ent.skinNum = s1->clientNum / 256.0 * 360; // roll offset @@ -799,7 +799,7 @@ static void CG_Lev2ZapChain( centity_t *cent ) if( es->time <= 0 ) continue; - source = &cg_entities[ es->powerups ]; + source = &cg_entities[ es->misc ]; target = &cg_entities[ es->time ]; break; diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index b594330e..bc3aaa47 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2012,7 +2012,7 @@ void CG_Player( centity_t *cent ) qboolean shadow = qfalse; float shadowPlane; entityState_t *es = ¢->currentState; - pClass_t class = ( es->powerups >> 8 ) & 0xFF; + pClass_t class = ( es->misc >> 8 ) & 0xFF; float scale; vec3_t tempAxis[ 3 ], tempAxis2[ 3 ]; vec3_t angles; @@ -2379,7 +2379,7 @@ void CG_Corpse( centity_t *cent ) legs.nonNormalizedAxes = qtrue; } - //CG_AddRefEntityWithPowerups( &legs, es->powerups, ci->team ); + //CG_AddRefEntityWithPowerups( &legs, es->misc, ci->team ); trap_R_AddRefEntityToScene( &legs ); // if the model failed, allow the default nullmodel to be displayed @@ -2404,7 +2404,7 @@ void CG_Corpse( centity_t *cent ) torso.shadowPlane = shadowPlane; torso.renderfx = renderfx; - //CG_AddRefEntityWithPowerups( &torso, es->powerups, ci->team ); + //CG_AddRefEntityWithPowerups( &torso, es->misc, ci->team ); trap_R_AddRefEntityToScene( &torso ); // @@ -2423,7 +2423,7 @@ void CG_Corpse( centity_t *cent ) head.shadowPlane = shadowPlane; head.renderfx = renderfx; - //CG_AddRefEntityWithPowerups( &head, es->powerups, ci->team ); + //CG_AddRefEntityWithPowerups( &head, es->misc, ci->team ); trap_R_AddRefEntityToScene( &head ); } } diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index e34fe8df..59a1641b 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -138,7 +138,7 @@ static void CG_ClipMoveToEntities ( const vec3_t start, const vec3_t mins, bmaxs[ 2 ] = zu; if( i == cg_numSolidEntities ) - BG_FindBBoxForClass( ( ent->powerups >> 8 ) & 0xFF, bmins, bmaxs, NULL, NULL, NULL ); + BG_FindBBoxForClass( ( ent->misc >> 8 ) & 0xFF, bmins, bmaxs, NULL, NULL, NULL ); cmodel = trap_CM_TempBoxModel( bmins, bmaxs ); VectorCopy( vec3_origin, angles ); @@ -504,12 +504,6 @@ static int CG_IsUnacceptableError( playerState_t *ps, playerState_t *pps ) return 16; } - for( i = 0; i < MAX_WEAPONS; i++ ) - { - if( pps->ammo[ i ] != ps->ammo[ i ] ) - return 18; - } - if( pps->generic1 != ps->generic1 || pps->loopSound != ps->loopSound ) { diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c index 0711c1db..195b6d76 100644 --- a/src/cgame/cg_scanner.c +++ b/src/cgame/cg_scanner.c @@ -82,7 +82,7 @@ void CG_UpdateEntityPositions( void ) } else if( cent->currentState.eType == ET_PLAYER ) { - int team = cent->currentState.powerups & 0x00FF; + int team = cent->currentState.misc & 0x00FF; if( team == PTE_ALIENS ) { diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index e5fc9eb5..888e9e1a 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -396,7 +396,6 @@ CG_HumanText static void CG_HumanText( char *text, playerState_t *ps ) { char *name; - int ammo, clips; upgrade_t upgrade = UP_NONE; if( cg.weaponSelect <= 32 ) @@ -407,9 +406,7 @@ static void CG_HumanText( char *text, playerState_t *ps ) upgrade = cg.weaponSelect - 32; } - BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &ammo, &clips ); - - if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( ps->weapon ) ) + if( !ps->ammo && !ps->clips && !BG_FindInfinteAmmoForWeapon( ps->weapon ) ) { //no ammo switch( ps->weapon ) diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index deae4e0b..613cddb2 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1109,14 +1109,6 @@ CG_WeaponSelectable */ static qboolean CG_WeaponSelectable( weapon_t weapon ) { - //int ammo, clips; - // - //BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); - // - // this is a pain in the ass - //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) - // return qfalse; - if( !BG_InventoryContainsWeapon( weapon, cg.snap->ps.stats ) ) return qfalse; @@ -1201,18 +1193,11 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) { if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) ) continue; - - { - int ammo, clips; - - BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); - - if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) - colinfo[ numItems ] = 1; - else - colinfo[ numItems ] = 0; - - } + + if( !ps->ammo && !ps->clips && !BG_FindInfinteAmmoForWeapon( i ) ) + colinfo[ numItems ] = 1; + else + colinfo[ numItems ] = 0; if( i == cg.weaponSelect ) selectedItem = numItems; @@ -1229,7 +1214,7 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) colinfo[ numItems ] = 0; if( !BG_FindUsableForUpgrade ( i ) ) colinfo[ numItems ] = 2; - + if( i == cg.weaponSelect - 32 ) selectedItem = numItems; |