diff options
author | Tim Angus <tim@ngus.net> | 2004-10-17 15:44:13 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2004-10-17 15:44:13 +0000 |
commit | 2c67a10f6799fa7a062f30f6310391bf60c02d5f (patch) | |
tree | f797cc67ac1bcb4780ff15b555ed652f7aa00119 /src | |
parent | 7ccb349bbdaedd979fb67db17eef757915c8d74a (diff) |
* Gave some of the shared functions more sensible names
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 14 | ||||
-rw-r--r-- | src/cgame/cg_players.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 4 | ||||
-rw-r--r-- | src/cgame/cg_weapons.c | 18 | ||||
-rw-r--r-- | src/game/bg_misc.c | 131 | ||||
-rw-r--r-- | src/game/bg_pmove.c | 32 | ||||
-rw-r--r-- | src/game/bg_public.h | 24 | ||||
-rw-r--r-- | src/game/g_active.c | 24 | ||||
-rw-r--r-- | src/game/g_buildable.c | 6 | ||||
-rw-r--r-- | src/game/g_client.c | 10 | ||||
-rw-r--r-- | src/game/g_cmds.c | 74 | ||||
-rw-r--r-- | src/game/g_combat.c | 6 | ||||
-rw-r--r-- | src/game/g_trigger.c | 8 | ||||
-rw-r--r-- | src/game/g_weapon.c | 4 |
14 files changed, 216 insertions, 143 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index d321d34e..88e1ffc0 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -856,7 +856,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, NULL ); + BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &numBarbs, NULL, NULL ); if( height > width ) { @@ -941,7 +941,7 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color ) break; default: - BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL, NULL ); break; } @@ -977,7 +977,7 @@ CG_DrawHumanScanner */ static void CG_DrawHumanScanner( rectDef_t *rect, qhandle_t shader ) { - if( BG_gotItem( UP_HELMET, cg.snap->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_HELMET, cg.snap->ps.stats ) ) CG_Scanner( rect, shader ); } @@ -1100,7 +1100,7 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color ) break; default: - BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL ); if( value > -1 ) { @@ -1393,7 +1393,7 @@ float CG_GetValue( int ownerDraw ) { int value; - BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL, NULL ); return value; @@ -1404,7 +1404,7 @@ float CG_GetValue( int ownerDraw ) { int value; - BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL ); return value; @@ -2169,7 +2169,7 @@ 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, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL ); BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, &maxClips, NULL ); // don't display if dead diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c index 5b6bfc3a..2a1ca0f4 100644 --- a/src/cgame/cg_players.c +++ b/src/cgame/cg_players.c @@ -2053,7 +2053,7 @@ void CG_Player( centity_t *cent ) //rotate lerpAngles to floor if( es->eFlags & EF_WALLCLIMB && - BG_rotateAxis( es->angles2, tempAxis, tempAxis2, qtrue, es->eFlags & EF_WALLCLIMBCEILING ) ) + BG_RotateAxis( es->angles2, tempAxis, tempAxis2, qtrue, es->eFlags & EF_WALLCLIMBCEILING ) ) AxisToAngles( tempAxis2, angles ); else VectorCopy( cent->lerpAngles, angles ); @@ -2072,7 +2072,7 @@ void CG_Player( centity_t *cent ) //rotate the legs axis to back to the wall if( es->eFlags & EF_WALLCLIMB && - BG_rotateAxis( es->angles2, legs.axis, tempAxis, qfalse, es->eFlags & EF_WALLCLIMBCEILING ) ) + BG_RotateAxis( es->angles2, legs.axis, tempAxis, qfalse, es->eFlags & EF_WALLCLIMBCEILING ) ) AxisCopy( tempAxis, legs.axis ); //smooth out WW transitions so the model doesn't hop around diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index a8844206..5cad60c3 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -546,13 +546,13 @@ static void CG_SetUIVars( void ) //determine what the player is carrying for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( BG_gotWeapon( i, cg.snap->ps.stats ) && + if( BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) && BG_FindPurchasableForWeapon( i ) ) strcat( carriageCvar, va( "W%d ", i ) ); } for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_gotItem( i, cg.snap->ps.stats ) ) + if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) ) strcat( carriageCvar, va( "U%d ", i ) ); } strcat( carriageCvar, "$" ); diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c index d16d2f5f..2fc0d7f7 100644 --- a/src/cgame/cg_weapons.c +++ b/src/cgame/cg_weapons.c @@ -1339,7 +1339,7 @@ void CG_DrawItemSelect( 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, NULL ); + BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips, NULL ); BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, &maxClips, NULL ); // don't display if dead @@ -1366,7 +1366,7 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( !BG_gotWeapon( i, cg.snap->ps.stats ) ) + if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) ) continue; if( i == cg.weaponSelect ) @@ -1379,7 +1379,7 @@ void CG_DrawItemSelect( rectDef_t *rect, vec4_t color ) for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( !BG_gotItem( i, cg.snap->ps.stats ) ) + if( !BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) ) continue; if( i == cg.weaponSelect - 32 ) @@ -1439,7 +1439,7 @@ void CG_DrawItemSelectText( rectDef_t *rect, float scale, int textStyle ) if( cg.weaponSelect <= 32 ) { if( cg_weapons[ cg.weaponSelect ].registered && - BG_gotWeapon( cg.weaponSelect, cg.snap->ps.stats ) ) + BG_InventoryContainsWeapon( cg.weaponSelect, cg.snap->ps.stats ) ) { if( name = cg_weapons[ cg.weaponSelect ].humanName ) { @@ -1452,7 +1452,7 @@ void CG_DrawItemSelectText( rectDef_t *rect, float scale, int textStyle ) else if( cg.weaponSelect > 32 ) { if( cg_upgrades[ cg.weaponSelect - 32 ].registered && - BG_gotItem( cg.weaponSelect - 32, cg.snap->ps.stats ) ) + BG_InventoryContainsUpgrade( cg.weaponSelect - 32, cg.snap->ps.stats ) ) { if( name = cg_upgrades[ cg.weaponSelect - 32 ].humanName ) { @@ -1476,13 +1476,13 @@ static qboolean CG_WeaponSelectable( int i ) { int ammo, clips, maxclips; - BG_unpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips, &maxclips ); + BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips, &maxclips ); //TA: this is a pain in the ass /* if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) ) return qfalse;*/ - if( !BG_gotWeapon( i, cg.snap->ps.stats ) ) + if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) ) return qfalse; return qtrue; @@ -1496,7 +1496,7 @@ CG_UpgradeSelectable */ static qboolean CG_UpgradeSelectable( int i ) { - if( !BG_gotItem( i, cg.snap->ps.stats ) ) + if( !BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) ) return qfalse; return qtrue; @@ -1613,7 +1613,7 @@ void CG_Weapon_f( void ) cg.weaponSelectTime = cg.time; - if( !BG_gotWeapon( num, cg.snap->ps.stats ) ) + if( !BG_InventoryContainsWeapon( num, cg.snap->ps.stats ) ) return; // don't have the weapon cg.weaponSelect = num; diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index f39f1ec0..06e41d76 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4509,11 +4509,11 @@ void BG_PlayerStateToEntityState( playerState_t *ps, entityState_t *s, qboolean s->modelindex2 = 0; for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_gotItem( i, ps->stats ) ) + if( BG_InventoryContainsUpgrade( i, ps->stats ) ) { s->modelindex |= 1 << i; - if( BG_activated( i, ps->stats ) ) + if( BG_UpgradeIsActive( i, ps->stats ) ) s->modelindex2 |= 1 << i; } } @@ -4619,11 +4619,11 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_gotItem( i, ps->stats ) ) + if( BG_InventoryContainsUpgrade( i, ps->stats ) ) { s->modelindex |= 1 << i; - if( BG_activated( i, ps->stats ) ) + if( BG_UpgradeIsActive( i, ps->stats ) ) s->modelindex2 |= 1 << i; } } @@ -4640,8 +4640,14 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s s->generic1 = ps->generic1; } -//TA: extract the ammo quantity from the array -void BG_unpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ) +/* +======================== +BG_UnpackAmmoArray + +Extract the ammo quantity from the array +======================== +*/ +void BG_UnpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ) { int ammoarray[32]; int i; @@ -4662,8 +4668,14 @@ void BG_unpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int * *maxclips = ( ammoarray[ weapon ] >> 13 ) & 0x07; } -//TA: pack the ammo quantity into the array -void BG_packAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ) +/* +======================== +BG_PackAmmoArray + +Pack the ammo quantity into the array +======================== +*/ +void BG_PackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ) { int weaponvalue; @@ -4675,8 +4687,14 @@ void BG_packAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clip ammo2[ weapon - 16 ] = weaponvalue; } -//TA: pack weapons into the array -void BG_packWeapon( int weapon, int stats[ ] ) +/* +======================== +BG_AddWeaponToInventory + +Give a player a weapon +======================== +*/ +void BG_AddWeaponToInventory( int weapon, int stats[ ] ) { int weaponList; @@ -4693,8 +4711,14 @@ void BG_packWeapon( int weapon, int stats[ ] ) stats[ STAT_SLOTS ] |= BG_FindSlotsForWeapon( weapon ); } -//TA: remove weapons from the array -void BG_removeWeapon( int weapon, int stats[ ] ) +/* +======================== +BG_RemoveWeaponToInventory + +Take a weapon from a player +======================== +*/ +void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] ) { int weaponList; @@ -4708,8 +4732,14 @@ void BG_removeWeapon( int weapon, int stats[ ] ) stats[ STAT_SLOTS ] &= ~BG_FindSlotsForWeapon( weapon ); } -//TA: check whether array contains weapon -qboolean BG_gotWeapon( int weapon, int stats[ ] ) +/* +======================== +BG_InventoryContainsWeapon + +Does the player hold a weapon? +======================== +*/ +qboolean BG_InventoryContainsWeapon( int weapon, int stats[ ] ) { int weaponList; @@ -4718,8 +4748,14 @@ qboolean BG_gotWeapon( int weapon, int stats[ ] ) return( weaponList & ( 1 << weapon ) ); } -//TA: pack items into array -void BG_packItem( int item, int stats[ ] ) +/* +======================== +BG_AddUpgradeToInventory + +Give the player an upgrade +======================== +*/ +void BG_AddUpgradeToInventory( int item, int stats[ ] ) { stats[ STAT_ITEMS ] |= ( 1 << item ); @@ -4729,39 +4765,76 @@ void BG_packItem( int item, int stats[ ] ) stats[ STAT_SLOTS ] |= BG_FindSlotsForUpgrade( item ); } -//TA: remove items from array -void BG_removeItem( int item, int stats[ ] ) +/* +======================== +BG_RemoveUpgradeFromInventory + +Take an upgrade from the player +======================== +*/ +void BG_RemoveUpgradeFromInventory( int item, int stats[ ] ) { stats[ STAT_ITEMS ] &= ~( 1 << item ); stats[ STAT_SLOTS ] &= ~BG_FindSlotsForUpgrade( item ); } -//TA: check if item is in array -qboolean BG_gotItem( int item, int stats[ ] ) +/* +======================== +BG_InventoryContainsUpgrade + +Does the player hold an upgrade? +======================== +*/ +qboolean BG_InventoryContainsUpgrade( int item, int stats[ ] ) { return( stats[ STAT_ITEMS ] & ( 1 << item ) ); } -//TA: set item active in array -void BG_activateItem( int item, int stats[ ] ) +/* +======================== +BG_ActivateUpgrade + +Activates an upgrade +======================== +*/ +void BG_ActivateUpgrade( int item, int stats[ ] ) { stats[ STAT_ACTIVEITEMS ] |= ( 1 << item ); } -//TA: set item deactive in array -void BG_deactivateItem( int item, int stats[ ] ) +/* +======================== +BG_DeactivateUpgrade + +Deactivates an upgrade +======================== +*/ +void BG_DeactivateUpgrade( int item, int stats[ ] ) { stats[ STAT_ACTIVEITEMS ] &= ~( 1 << item ); } -//TA: check if item active in array -qboolean BG_activated( int item, int stats[ ] ) +/* +======================== +BG_UpgradeIsActive + +Is this upgrade active? +======================== +*/ +qboolean BG_UpgradeIsActive( int item, int stats[ ] ) { return( stats[ STAT_ACTIVEITEMS ] & ( 1 << item ) ); } -qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], +/* +=============== +BG_RotateAxis + +Shared axis rotation function +=============== +*/ +qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ) { vec3_t refNormal = { 0.0f, 0.0f, 1.0f }; @@ -4869,13 +4942,13 @@ int BG_GetValueOfHuman( playerState_t *ps ) for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_gotItem( i, ps->stats ) ) + if( BG_InventoryContainsUpgrade( i, ps->stats ) ) worth += BG_FindPriceForUpgrade( i ); } for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( BG_gotWeapon( i, ps->stats ) ) + if( BG_InventoryContainsWeapon( i, ps->stats ) ) worth += BG_FindPriceForWeapon( i ); } diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index ebfe0b15..9c29b96b 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -374,8 +374,8 @@ static float PM_CmdScale( usercmd_t *cmd ) if( pm->ps->stats[ STAT_STATE ] & SS_CREEPSLOWED ) { - if( BG_gotItem( UP_LIGHTARMOUR, pm->ps->stats ) || - BG_gotItem( UP_BATTLESUIT, pm->ps->stats ) ) + if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, pm->ps->stats ) || + BG_InventoryContainsUpgrade( UP_BATTLESUIT, pm->ps->stats ) ) modifier *= CREEP_ARMOUR_MODIFIER; else modifier *= CREEP_MODIFIER; @@ -2572,7 +2572,7 @@ static void PM_BeginWeaponChange( int weapon ) if( weapon < WP_NONE || weapon >= WP_NUM_WEAPONS ) return; - if( !BG_gotWeapon( weapon, pm->ps->stats ) && weapon != WP_NONE ) + if( !BG_InventoryContainsWeapon( weapon, pm->ps->stats ) && weapon != WP_NONE ) return; if( pm->ps->weaponstate == WEAPON_DROPPING ) @@ -2603,7 +2603,7 @@ static void PM_FinishWeaponChange( void ) if( weapon < WP_NONE || weapon >= WP_NUM_WEAPONS ) weapon = WP_NONE; - if( !BG_gotWeapon( weapon, pm->ps->stats ) ) + if( !BG_InventoryContainsWeapon( weapon, pm->ps->stats ) ) weapon = WP_NONE; pm->ps->weapon = weapon; @@ -2690,12 +2690,12 @@ static void PM_Weapon( void ) else if( pm->cmd.weapon > 32 ) { //if trying to toggle an upgrade, toggle it - if( BG_gotItem( pm->cmd.weapon - 32, pm->ps->stats ) ) //sanity check + if( BG_InventoryContainsUpgrade( pm->cmd.weapon - 32, pm->ps->stats ) ) //sanity check { - if( BG_activated( pm->cmd.weapon - 32, pm->ps->stats ) ) - BG_deactivateItem( pm->cmd.weapon - 32, pm->ps->stats ); + if( BG_UpgradeIsActive( pm->cmd.weapon - 32, pm->ps->stats ) ) + BG_DeactivateUpgrade( pm->cmd.weapon - 32, pm->ps->stats ); else - BG_activateItem( pm->cmd.weapon - 32, pm->ps->stats ); + BG_ActivateUpgrade( pm->cmd.weapon - 32, pm->ps->stats ); } } pm->ps->pm_flags |= PMF_USE_ITEM_HELD; @@ -2734,7 +2734,7 @@ static void PM_Weapon( void ) // start the animation even if out of ammo - BG_unpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); + BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); // check for out of ammo if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( pm->ps->weapon ) ) @@ -2754,10 +2754,10 @@ static void PM_Weapon( void ) } if( BG_FindUsesEnergyForWeapon( pm->ps->weapon ) && - BG_gotItem( UP_BATTPACK, pm->ps->stats ) ) + BG_InventoryContainsUpgrade( UP_BATTPACK, pm->ps->stats ) ) ammo = (int)( (float)ammo * BATTPACK_MODIFIER ); - BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); //allow some time for the weapon to be raised pm->ps->weaponstate = WEAPON_RAISING; @@ -2980,13 +2980,13 @@ static void PM_Weapon( void ) else ammo--; - BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); } else if( pm->ps->weapon == WP_DRAGOON_UPG && attack3 ) { //special case for slowblob ammo--; - BG_packAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); + BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips, maxclips ); } //FIXME: predicted angles miss a problem?? @@ -3125,7 +3125,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) AnglesToAxis( tempang, axis ); if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) || - !BG_rotateAxis( ps->grapplePoint, axis, rotaxis, qfalse, + !BG_RotateAxis( ps->grapplePoint, axis, rotaxis, qfalse, ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) ) AxisCopy( axis, rotaxis ); @@ -3147,7 +3147,7 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) ps->viewangles[ i ] = tempang[ i ]; //pull the view into the lock point - if( ps->pm_type == PM_GRABBED && !BG_gotItem( UP_BATTLESUIT, ps->stats ) ) + if( ps->pm_type == PM_GRABBED && !BG_InventoryContainsUpgrade( UP_BATTLESUIT, ps->stats ) ) { vec3_t dir, angles; @@ -3191,7 +3191,7 @@ void PmoveSingle( pmove_t *pmove ) pm = pmove; - BG_unpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); + BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips, &maxclips ); // this counter lets us debug movement problems with a journal // by setting a conditional breakpoint fot the previous frame diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 3755c559..d3a79fa7 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1063,18 +1063,18 @@ typedef struct //TA: -void BG_unpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ); -void BG_packAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ); -void BG_packWeapon( int weapon, int stats[ ] ); -void BG_removeWeapon( int weapon, int stats[ ] ); -qboolean BG_gotWeapon( int weapon, int stats[ ] ); -void BG_packItem( int item, int stats[ ] ); -void BG_removeItem( int item, int stats[ ] ); -qboolean BG_gotItem( int item, int stats[ ] ); -void BG_activateItem( int item, int stats[ ] ); -void BG_deactivateItem( int item, int stats[ ] ); -qboolean BG_activated( int item, int stats[ ] ); -qboolean BG_rotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], +void BG_UnpackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int *quan, int *clips, int *maxclips ); +void BG_PackAmmoArray( int weapon, int ammo[ ], int ammo2[ ], int quan, int clips, int maxclips ); +void BG_AddWeaponToInventory( int weapon, int stats[ ] ); +void BG_RemoveWeaponFromInventory( int weapon, int stats[ ] ); +qboolean BG_InventoryContainsWeapon( int weapon, int stats[ ] ); +void BG_AddUpgradeToInventory( int item, int stats[ ] ); +void BG_RemoveUpgradeFromInventory( int item, int stats[ ] ); +qboolean BG_InventoryContainsUpgrade( int item, int stats[ ] ); +void BG_ActivateUpgrade( int item, int stats[ ] ); +void BG_DeactivateUpgrade( int item, int stats[ ] ); +qboolean BG_UpgradeIsActive( int item, int stats[ ] ); +qboolean BG_RotateAxis( vec3_t surfNormal, vec3_t inAxis[ 3 ], vec3_t outAxis[ 3 ], qboolean inverse, qboolean ceiling ); void BG_PositionBuildableRelativeToPlayer( const playerState_t *ps, const vec3_t mins, const vec3_t maxs, diff --git a/src/game/g_active.c b/src/game/g_active.c index f056d4c2..44014ab9 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -472,13 +472,13 @@ void ClientTimerActions( gentity_t *ent, int msec ) if( aForward <= 64 ) client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; - if( BG_gotItem( UP_JETPACK, client->ps.stats ) && BG_activated( UP_JETPACK, client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) ) client->ps.stats[ STAT_STATE ] &= ~SS_SPEEDBOOST; if( ( client->ps.stats[ STAT_STATE ] & SS_SPEEDBOOST ) && ucmd->upmove >= 0 ) { //subtract stamina - if( BG_gotItem( UP_LIGHTARMOUR, client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, client->ps.stats ) ) client->ps.stats[ STAT_STAMINA ] -= STAMINA_LARMOUR_TAKE; else client->ps.stats[ STAT_STAMINA ] -= STAMINA_SPRINT_TAKE; @@ -575,7 +575,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) { int ammo; - BG_unpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); + BG_UnpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); if( client->ps.stats[ STAT_MISC ] < LCANNON_TOTAL_CHARGE && ucmd->buttons & BUTTON_ATTACK ) client->ps.stats[ STAT_MISC ] += ( 100.0f / LCANNON_CHARGE_TIME ) * LCANNON_TOTAL_CHARGE; @@ -692,12 +692,12 @@ void ClientTimerActions( gentity_t *ent, int msec ) int ammo, maxAmmo; BG_FindAmmoForWeapon( WP_DRAGOON_UPG, &maxAmmo, NULL, NULL ); - BG_unpackAmmoArray( WP_DRAGOON_UPG, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); + BG_UnpackAmmoArray( WP_DRAGOON_UPG, client->ps.ammo, client->ps.powerups, &ammo, NULL, NULL ); if( ammo < maxAmmo ) { ammo++; - BG_packAmmoArray( WP_DRAGOON_UPG, client->ps.ammo, client->ps.powerups, ammo, 0, 0 ); + BG_PackAmmoArray( WP_DRAGOON_UPG, client->ps.ammo, client->ps.powerups, ammo, 0, 0 ); } } } @@ -983,7 +983,7 @@ void ClientThink_real( gentity_t *ent ) else if( client->ps.stats[ STAT_STATE ] & SS_BLOBLOCKED || client->ps.stats[ STAT_STATE ] & SS_GRABBED ) client->ps.pm_type = PM_GRABBED; - else if( BG_gotItem( UP_JETPACK, client->ps.stats ) && BG_activated( UP_JETPACK, client->ps.stats ) ) + else if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) ) client->ps.pm_type = PM_JETPACK; else client->ps.pm_type = PM_NORMAL; @@ -1016,13 +1016,13 @@ void ClientThink_real( gentity_t *ent ) client->ps.gravity = g_gravity.value; - if( BG_gotItem( UP_ANTITOXIN, client->ps.stats ) && - BG_activated( UP_ANTITOXIN, client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_ANTITOXIN, client->ps.stats ) && + BG_UpgradeIsActive( UP_ANTITOXIN, client->ps.stats ) ) { if( client->ps.stats[ STAT_STATE ] & SS_POISONED ) { //remove anti toxin - BG_removeItem( UP_ANTITOXIN, client->ps.stats ); + BG_RemoveUpgradeFromInventory( UP_ANTITOXIN, client->ps.stats ); client->ps.stats[ STAT_STATE ] &= ~SS_POISONED; } @@ -1044,8 +1044,8 @@ void ClientThink_real( gentity_t *ent ) client->ps.stats[ STAT_STATE ] &= ~SS_CREEPSLOWED; //randomly disable the jet pack if damaged - if( BG_gotItem( UP_JETPACK, client->ps.stats ) && - BG_activated( UP_JETPACK, client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_JETPACK, client->ps.stats ) && + BG_UpgradeIsActive( UP_JETPACK, client->ps.stats ) ) { if( client->lastDamageTime + JETPACK_DISABLE_TIME > level.time ) { @@ -1055,7 +1055,7 @@ void ClientThink_real( gentity_t *ent ) //switch jetpack off if no reactor if( !level.reactorPresent ) - BG_deactivateItem( UP_JETPACK, client->ps.stats ); + BG_DeactivateUpgrade( UP_JETPACK, client->ps.stats ); } // set up for pmove diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index fd0a5b49..38c493c8 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -1239,7 +1239,7 @@ void ABooster_Touch( gentity_t *self, gentity_t *other, trace_t *trace ) //restore ammo, if any BG_FindAmmoForWeapon( client->ps.weapon, &ammo, &clips, &maxClips ); - BG_packAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); + BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); if( !( client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) ) { @@ -1474,10 +1474,10 @@ void HRpt_Use( gentity_t *self, gentity_t *other, gentity_t *activator ) BG_FindAmmoForWeapon( weapon, &maxAmmo, NULL, &maxClips ); - if( BG_gotItem( UP_BATTPACK, ps->stats ) ) + if( BG_InventoryContainsUpgrade( UP_BATTPACK, ps->stats ) ) maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); - BG_packAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips ); + BG_PackAmmoArray( weapon, ps->ammo, ps->powerups, maxAmmo, maxClips, maxClips ); G_AddEvent( activator, EV_RPTUSE_SOUND, 0 ); activator->client->lastRefilTime = level.time; diff --git a/src/game/g_client.c b/src/game/g_client.c index da2f3d25..441b2266 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -996,7 +996,7 @@ void ClientUserinfoChanged( int clientNum ) client->pers.maxHealth = 0; // set model - if( client->ps.stats[ STAT_PCLASS ] == PCL_H_BASE && BG_gotItem( UP_BATTLESUIT, client->ps.stats ) ) + if( client->ps.stats[ STAT_PCLASS ] == PCL_H_BASE && BG_InventoryContainsUpgrade( UP_BATTLESUIT, client->ps.stats ) ) { Com_sprintf( buffer, MAX_QPATH, "%s/%s", BG_FindModelNameForClass( PCL_H_BSUIT ), BG_FindSkinNameForClass( PCL_H_BSUIT ) ); @@ -1365,7 +1365,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles // clear entity values if( ent->client->pers.classSelection == PCL_H_BASE ) { - BG_packWeapon( WP_BLASTER, client->ps.stats ); + BG_AddWeaponToInventory( WP_BLASTER, client->ps.stats ); weapon = client->pers.humanItemSelection; } else if( client->sess.sessionTeam != TEAM_SPECTATOR ) @@ -1374,8 +1374,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles weapon = WP_NONE; BG_FindAmmoForWeapon( weapon, &ammo, &clips, &maxClips ); - BG_packWeapon( weapon, client->ps.stats ); - BG_packAmmoArray( weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); + BG_AddWeaponToInventory( weapon, client->ps.stats ); + BG_PackAmmoArray( weapon, client->ps.ammo, client->ps.powerups, ammo, clips, maxClips ); ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.classSelection; ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.teamSelection; @@ -1467,7 +1467,7 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles for( i = WP_NUM_WEAPONS - 1; i > 0 ; i-- ) { - if( BG_gotWeapon( i, client->ps.stats ) ) + if( BG_InventoryContainsWeapon( i, client->ps.stats ) ) { client->ps.weapon = i; break; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index c1d492b5..3dd7c672 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -260,7 +260,7 @@ void Cmd_Give_f( gentity_t *ent ) if( give_all || Q_stricmp( name, "weapons" ) == 0 ) { - BG_packWeapon( ( 1 << WP_NUM_WEAPONS ) - 1 - ( 1 << WP_NONE ), ent->client->ps.stats ); + BG_AddWeaponToInventory( ( 1 << WP_NUM_WEAPONS ) - 1 - ( 1 << WP_NONE ), ent->client->ps.stats ); if( !give_all ) return; @@ -269,7 +269,7 @@ void Cmd_Give_f( gentity_t *ent ) if( give_all || Q_stricmp( name, "ammo" ) == 0 ) { for( i = 0; i < MAX_WEAPONS; i++ ) - BG_packAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, 999, 0, 0 ); + BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, 999, 0, 0 ); if( !give_all ) return; @@ -1343,9 +1343,9 @@ void Cmd_ActivateItem_f( gentity_t *ent ) if( ent->client->pers.teamSelection != PTE_HUMANS ) return; - if( upgrade != UP_NONE && BG_gotItem( upgrade, ent->client->ps.stats ) ) - BG_activateItem( upgrade, ent->client->ps.stats ); - else if( weapon != WP_NONE && BG_gotWeapon( weapon, ent->client->ps.stats ) ) + if( upgrade != UP_NONE && BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) + BG_ActivateUpgrade( upgrade, ent->client->ps.stats ); + else if( weapon != WP_NONE && BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) { //force a weapon change ent->client->ps.pm_flags |= PMF_WEAPON_SWITCH; @@ -1374,8 +1374,8 @@ void Cmd_DeActivateItem_f( gentity_t *ent ) if( ent->client->pers.teamSelection != PTE_HUMANS ) return; - if( BG_gotItem( upgrade, ent->client->ps.stats ) ) - BG_deactivateItem( upgrade, ent->client->ps.stats ); + if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) + BG_DeactivateUpgrade( upgrade, ent->client->ps.stats ); else trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) ); } @@ -1413,7 +1413,7 @@ void Cmd_ToggleItem_f( gentity_t *ent ) if( i == WP_BLASTER ) continue; - if( BG_gotWeapon( i, ent->client->ps.stats ) ) + if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) ) { weapon = i; break; @@ -1428,12 +1428,12 @@ void Cmd_ToggleItem_f( gentity_t *ent ) ent->client->ps.pm_flags |= PMF_WEAPON_SWITCH; trap_SendServerCommand( ent-g_entities, va( "weaponswitch %d", weapon ) ); } - else if( BG_gotItem( upgrade, ent->client->ps.stats ) ) + else if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) { - if( BG_activated( upgrade, ent->client->ps.stats ) ) - BG_deactivateItem( upgrade, ent->client->ps.stats ); + if( BG_UpgradeIsActive( upgrade, ent->client->ps.stats ) ) + BG_DeactivateUpgrade( upgrade, ent->client->ps.stats ); else - BG_activateItem( upgrade, ent->client->ps.stats ); + BG_ActivateUpgrade( upgrade, ent->client->ps.stats ); } else trap_SendServerCommand( ent-g_entities, va( "print \"You don't have the %s\n\"", s ) ); @@ -1454,13 +1454,13 @@ void Cmd_Buy_f( gentity_t *ent ) for( i = UP_NONE; i < UP_NUM_UPGRADES; i++ ) { - if( BG_gotItem( i, ent->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( i, ent->client->ps.stats ) ) numItems++; } for( i = WP_NONE; i < WP_NUM_WEAPONS; i++ ) { - if( BG_gotWeapon( i, ent->client->ps.stats ) ) + if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) ) numItems++; } @@ -1494,7 +1494,7 @@ void Cmd_Buy_f( gentity_t *ent ) if( weapon != WP_NONE ) { //already got this? - if( BG_gotWeapon( weapon, ent->client->ps.stats ) ) + if( BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) { G_TriggerMenu( ent->client->ps.clientNum, MN_H_ITEMHELD ); return; @@ -1542,14 +1542,14 @@ void Cmd_Buy_f( gentity_t *ent ) } //add to inventory - BG_packWeapon( weapon, ent->client->ps.stats ); + BG_AddWeaponToInventory( weapon, ent->client->ps.stats ); BG_FindAmmoForWeapon( weapon, &quan, &clips, &maxClips ); if( BG_FindUsesEnergyForWeapon( weapon ) && - BG_gotItem( UP_BATTPACK, ent->client->ps.stats ) ) + BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) ) quan = (int)( (float)quan * BATTPACK_MODIFIER ); - BG_packAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups, + BG_PackAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups, quan, clips, maxClips ); //force a weapon change @@ -1567,7 +1567,7 @@ void Cmd_Buy_f( gentity_t *ent ) weapon_t weaponAmmo; //already got this? - if( BG_gotItem( upgrade, ent->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) { G_TriggerMenu( ent->client->ps.clientNum, MN_H_ITEMHELD ); return; @@ -1618,7 +1618,7 @@ void Cmd_Buy_f( gentity_t *ent ) else weaponType = !BG_FindUsesEnergyForWeapon( i ); - if( BG_gotWeapon( i, ent->client->ps.stats ) && + if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) && weaponType && !BG_FindInfinteAmmoForWeapon( i ) ) { @@ -1629,11 +1629,11 @@ void Cmd_Buy_f( gentity_t *ent ) G_AddEvent( ent, EV_RPTUSE_SOUND, 0 ); ent->client->lastRefilTime = level.time; - if( BG_gotItem( UP_BATTPACK, ent->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) ) quan = (int)( (float)quan * BATTPACK_MODIFIER ); } - BG_packAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, + BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, quan, clips, maxClips ); } } @@ -1641,7 +1641,7 @@ void Cmd_Buy_f( gentity_t *ent ) else { //add to inventory - BG_packItem( upgrade, ent->client->ps.stats ); + BG_AddUpgradeToInventory( upgrade, ent->client->ps.stats ); } //subtract from funds @@ -1708,7 +1708,7 @@ void Cmd_Sell_f( gentity_t *ent ) } //remove weapon if carried - if( BG_gotWeapon( weapon, ent->client->ps.stats ) ) + if( BG_InventoryContainsWeapon( weapon, ent->client->ps.stats ) ) { //guard against selling the HBUILD weapons exploit if( ( weapon == WP_HBUILD || weapon == WP_HBUILD2 ) && @@ -1718,7 +1718,7 @@ void Cmd_Sell_f( gentity_t *ent ) return; } - BG_removeWeapon( weapon, ent->client->ps.stats ); + BG_RemoveWeaponFromInventory( weapon, ent->client->ps.stats ); //add to funds G_AddCreditToClient( ent->client, (short)BG_FindPriceForWeapon( weapon ) ); @@ -1735,9 +1735,9 @@ void Cmd_Sell_f( gentity_t *ent ) else if( upgrade != UP_NONE ) { //remove upgrade if carried - if( BG_gotItem( upgrade, ent->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( upgrade, ent->client->ps.stats ) ) { - BG_removeItem( upgrade, ent->client->ps.stats ); + BG_RemoveUpgradeFromInventory( upgrade, ent->client->ps.stats ); if( upgrade == UP_BATTPACK ) { @@ -1746,11 +1746,11 @@ void Cmd_Sell_f( gentity_t *ent ) //remove energy for( j = WP_NONE; j < WP_NUM_WEAPONS; j++ ) { - if( BG_gotWeapon( j, ent->client->ps.stats ) && + if( BG_InventoryContainsWeapon( j, ent->client->ps.stats ) && BG_FindUsesEnergyForWeapon( j ) && !BG_FindInfinteAmmoForWeapon( j ) ) { - BG_packAmmoArray( j, ent->client->ps.ammo, ent->client->ps.powerups, 0, 0, 0 ); + BG_PackAmmoArray( j, ent->client->ps.ammo, ent->client->ps.powerups, 0, 0, 0 ); } } } @@ -1767,9 +1767,9 @@ void Cmd_Sell_f( gentity_t *ent ) { for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ ) { - if( BG_gotWeapon( i, ent->client->ps.stats ) && i != WP_BLASTER ) + if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) && i != WP_BLASTER ) { - BG_removeWeapon( i, ent->client->ps.stats ); + BG_RemoveWeaponFromInventory( i, ent->client->ps.stats ); //add to funds G_AddCreditToClient( ent->client, (short)BG_FindPriceForWeapon( i ) ); @@ -1789,9 +1789,9 @@ void Cmd_Sell_f( gentity_t *ent ) for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { //remove upgrade if carried - if( BG_gotItem( i, ent->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( i, ent->client->ps.stats ) ) { - BG_removeItem( i, ent->client->ps.stats ); + BG_RemoveUpgradeFromInventory( i, ent->client->ps.stats ); if( i == UP_BATTPACK ) { @@ -1800,11 +1800,11 @@ void Cmd_Sell_f( gentity_t *ent ) //remove energy for( j = WP_NONE; j < WP_NUM_WEAPONS; j++ ) { - if( BG_gotWeapon( j, ent->client->ps.stats ) && + if( BG_InventoryContainsWeapon( j, ent->client->ps.stats ) && BG_FindUsesEnergyForWeapon( j ) && !BG_FindInfinteAmmoForWeapon( j ) ) { - BG_packAmmoArray( j, ent->client->ps.ammo, ent->client->ps.powerups, 0, 0, 0 ); + BG_PackAmmoArray( j, ent->client->ps.ammo, ent->client->ps.powerups, 0, 0, 0 ); } } } @@ -1945,8 +1945,8 @@ Cmd_Boost_f */ void Cmd_Boost_f( gentity_t *ent ) { - if( BG_gotItem( UP_JETPACK, ent->client->ps.stats ) && - BG_activated( UP_JETPACK, ent->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_JETPACK, ent->client->ps.stats ) && + BG_UpgradeIsActive( UP_JETPACK, ent->client->ps.stats ) ) return; if( ent->client->pers.cmd.buttons & BUTTON_WALKING ) diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 13a5739e..160bac49 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -197,7 +197,7 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int //TA: deactivate all upgrades for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) - BG_deactivateItem( i, self->client->ps.stats ); + BG_DeactivateUpgrade( i, self->client->ps.stats ); // broadcast the death event to everyone ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY ); @@ -764,7 +764,7 @@ static float G_CalcDamageModifier( vec3_t point, gentity_t *targ, gentity_t *att for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ ) { - if( BG_gotItem( i, targ->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( i, targ->client->ps.stats ) ) { for( j = 0; j < g_numArmourRegions[ i ]; j++ ) { @@ -1066,7 +1066,7 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, if( attacker->client && attacker->client->ps.stats[ STAT_STATE ] & SS_BOOSTED ) { if( !( targ->client->ps.stats[ STAT_STATE ] & SS_POISONED ) && - !BG_gotItem( UP_BATTLESUIT, targ->client->ps.stats ) && + !BG_InventoryContainsUpgrade( UP_BATTLESUIT, targ->client->ps.stats ) && mod != MOD_CHIMERA_ZAP ) { targ->client->ps.stats[ STAT_STATE ] |= SS_POISONED; diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index 01279cd6..c3edef8d 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -825,7 +825,7 @@ void trigger_equipment_trigger( gentity_t *self, gentity_t *activator ) //otherwise check against the lists for( i = 0; self->wTriggers[ i ] != WP_NONE; i++ ) { - if( BG_gotWeapon( self->wTriggers[ i ], activator->client->ps.stats ) ) + if( BG_InventoryContainsWeapon( self->wTriggers[ i ], activator->client->ps.stats ) ) { G_UseTargets( self, activator ); return; @@ -834,7 +834,7 @@ void trigger_equipment_trigger( gentity_t *self, gentity_t *activator ) for( i = 0; self->uTriggers[ i ] != UP_NONE; i++ ) { - if( BG_gotItem( self->uTriggers[ i ], activator->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( self->uTriggers[ i ], activator->client->ps.stats ) ) { G_UseTargets( self, activator ); return; @@ -1092,7 +1092,7 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) self->timestamp = level.time + FRAMETIME; BG_FindAmmoForWeapon( other->client->ps.weapon, &maxAmmo, NULL, NULL ); - BG_unpackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, + BG_UnpackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, &ammo, &clips, &maxClips ); if( ( ammo + self->damage ) > maxAmmo ) @@ -1108,7 +1108,7 @@ void trigger_ammo_touch( gentity_t *self, gentity_t *other, trace_t *trace ) else ammo += self->damage; - BG_packAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, + BG_PackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, ammo, clips, maxClips ); } diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 59f513a0..26454f59 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -805,10 +805,10 @@ void poisonCloud( gentity_t *ent ) if( humanPlayer->client && humanPlayer->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { - if( BG_gotItem( UP_LIGHTARMOUR, humanPlayer->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_LIGHTARMOUR, humanPlayer->client->ps.stats ) ) continue; - if( BG_gotItem( UP_BATTLESUIT, humanPlayer->client->ps.stats ) ) + if( BG_InventoryContainsUpgrade( UP_BATTLESUIT, humanPlayer->client->ps.stats ) ) continue; trap_Trace( &tr, muzzle, NULL, NULL, humanPlayer->s.origin, humanPlayer->s.number, MASK_SHOT ); |