From 26e25997647bfcc8692a2209e5670d4c0119ea8c Mon Sep 17 00:00:00 2001 From: Jeff Kent Date: Thu, 13 Apr 2017 11:30:00 +0000 Subject: multi-protocol: change the playerState_t and entityState_t structs to the versions in the latest code base this includes changing how ammo and clips r stored --- src/cgame/cg_draw.c | 23 +++++++---------------- src/cgame/cg_predict.c | 7 ++----- src/cgame/cg_tutorial.c | 3 ++- src/cgame/cg_weapons.c | 6 ++++-- 4 files changed, 15 insertions(+), 24 deletions(-) (limited to 'src/cgame') diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 82df413..1a3ecae 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -855,7 +855,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 ) { @@ -940,7 +940,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; } @@ -1099,7 +1099,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 ) { @@ -1425,23 +1425,13 @@ 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: @@ -2404,7 +2394,8 @@ void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color ) cent = &cg_entities[ cg.snap->ps.clientNum ]; ps = &cg.snap->ps; - BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips ); + ammo = ps->ammo; + clips = ps->clips; BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, NULL ); // don't display if dead diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c index 34f00c4..e20eb1d 100644 --- a/src/cgame/cg_predict.c +++ b/src/cgame/cg_predict.c @@ -504,11 +504,8 @@ 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->ammo != ps->ammo || pps->clips != ps->clips ) + return 18; if( pps->generic1 != ps->generic1 || pps->loopSound != ps->loopSound ) diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c index 5ad29b7..c418726 100644 --- a/src/cgame/cg_tutorial.c +++ b/src/cgame/cg_tutorial.c @@ -407,7 +407,8 @@ static void CG_HumanText( char *text, playerState_t *ps ) upgrade = cg.weaponSelect - 32; } - BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &ammo, &clips ); + ammo = ps->ammo; + clips = ps->clips; if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( ps->weapon ) ) { diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index deae4e0..135e441 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1111,7 +1111,8 @@ static qboolean CG_WeaponSelectable( weapon_t weapon ) { //int ammo, clips; // - //BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); + //ammo = cg.snap->ps.ammo; + //clips = cg.snap->ps.clips // // this is a pain in the ass //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) @@ -1205,7 +1206,8 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) { int ammo, clips; - BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips ); + ammo = cg.snap->ps.ammo; + clips = cg.snap->ps.clips; if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) colinfo[ numItems ] = 1; -- cgit