diff options
| author | Jeff Kent <jeff@jkent.net> | 2017-04-13 11:30:00 +0000 | 
|---|---|---|
| committer | /dev/humancontroller <devhc@example.com> | 2017-04-15 17:20:41 +0200 | 
| commit | 26e25997647bfcc8692a2209e5670d4c0119ea8c (patch) | |
| tree | be69b2f824a6b749e12849a8b6da32e6ca59d1a0 /src/game | |
| parent | b4c0348da140348f3cbb48cfe544c5682c9e5d34 (diff) | |
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
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/bg_misc.c | 48 | ||||
| -rw-r--r-- | src/game/bg_pmove.c | 16 | ||||
| -rw-r--r-- | src/game/bg_public.h | 4 | ||||
| -rw-r--r-- | src/game/g_active.c | 7 | ||||
| -rw-r--r-- | src/game/g_admin.c | 4 | ||||
| -rw-r--r-- | src/game/g_client.c | 3 | ||||
| -rw-r--r-- | src/game/g_cmds.c | 10 | ||||
| -rw-r--r-- | src/game/g_trigger.c | 8 | ||||
| -rw-r--r-- | src/game/g_weapon.c | 6 | 
9 files changed, 33 insertions, 73 deletions
diff --git a/src/game/bg_misc.c b/src/game/bg_misc.c index 1a55ed0..2641305 100644 --- a/src/game/bg_misc.c +++ b/src/game/bg_misc.c @@ -4959,62 +4959,16 @@ void BG_PlayerStateToEntityStateExtraPolate( playerState_t *ps, entityState_t *s  /*  ======================== -BG_UnpackAmmoArray - -Extract the ammo quantity from the array -======================== -*/ -void BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ) -{ -  int   ammoarray[ 32 ]; -  int   i; - -  for( i = 0; i <= 15; i++ ) -    ammoarray[ i ] = psAmmo[ i ]; - -  for( i = 16; i <= 31; i++ ) -    ammoarray[ i ] = psAmmo2[ i - 16 ]; - -  if( ammo != NULL ) -    *ammo = ammoarray[ weapon ] & 0x0FFF; - -  if( clips != NULL ) -    *clips = ( ammoarray[ weapon ] >> 12 ) & 0x0F; -} - -/* -======================== -BG_PackAmmoArray - -Pack the ammo quantity into the array -======================== -*/ -void BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ) -{ -  int   weaponvalue; - -  weaponvalue = ammo | ( clips << 12 ); - -  if( weapon <= 15 ) -    psAmmo[ weapon ] = weaponvalue; -  else if( weapon >= 16 ) -    psAmmo2[ weapon - 16 ] = weaponvalue; -} - -/* -========================  BG_WeaponIsFull  Check if a weapon has full ammo  ========================  */ -qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int psAmmo[ ], int psAmmo2[ ] ) +qboolean BG_WeaponIsFull( weapon_t weapon, int stats[ ], int ammo, int clips )  {    int maxAmmo, maxClips; -  int ammo, clips;    BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips ); -  BG_UnpackAmmoArray( weapon, psAmmo, psAmmo2, &ammo, &clips );    if( BG_InventoryContainsUpgrade( UP_BATTPACK, stats ) )      maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c index 88707bd..73ee6d9 100644 --- a/src/game/bg_pmove.c +++ b/src/game/bg_pmove.c @@ -2796,8 +2796,8 @@ 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 ); +  ammo = pm->ps->ammo; +  clips = pm->ps->clips;    BG_FindAmmoForWeapon( pm->ps->weapon, NULL, &maxClips );    // check for out of ammo @@ -2825,7 +2825,8 @@ static void PM_Weapon( void )          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 ); +    pm->ps->ammo = ammo; +    pm->ps->clips = clips;      //allow some time for the weapon to be raised      pm->ps->weaponstate = WEAPON_RAISING; @@ -3079,13 +3080,15 @@ static void PM_Weapon( void )      else        ammo--; -    BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips ); +    pm->ps->ammo = ammo; +    pm->ps->clips = clips;    }    else if( pm->ps->weapon == WP_ALEVEL3_UPG && attack3 )    {      //special case for slowblob      ammo--; -    BG_PackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, ammo, clips ); +    pm->ps->ammo = ammo; +    pm->ps->clips = clips;    }    //FIXME: predicted angles miss a problem?? @@ -3291,7 +3294,8 @@ void PmoveSingle( pmove_t *pmove )    pm = pmove; -  BG_UnpackAmmoArray( pm->ps->weapon, pm->ps->ammo, pm->ps->powerups, &ammo, &clips ); +  ammo = pm->ps->ammo; +  clips = pm->ps->clips;    // 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 e0e6233..817b7aa 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -1109,9 +1109,7 @@ typedef struct  //TA: -void      BG_UnpackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int *ammo, int *clips ); -void      BG_PackAmmoArray( int weapon, int psAmmo[ ], int psAmmo2[ ], int ammo, int clips ); -qboolean  BG_WeaponIsFull( weapon_t weapon, int stats[ ], int psAmmo[ ], int psAmmo2[ ] ); +qboolean  BG_WeaponIsFull( weapon_t weapon, int stats[ ], int ammo, int clips );  void      BG_AddWeaponToInventory( int weapon, int stats[ ] );  void      BG_RemoveWeaponFromInventory( int weapon, int stats[ ] );  qboolean  BG_InventoryContainsWeapon( int weapon, int stats[ ] ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 5b167a5..147aabc 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -800,7 +800,7 @@ void ClientTimerActions( gentity_t *ent, int msec )      {        int ammo; -      BG_UnpackAmmoArray( WP_LUCIFER_CANNON, client->ps.ammo, client->ps.powerups, &ammo, NULL ); +      ammo = client->ps.ammo;        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; @@ -1099,12 +1099,13 @@ void ClientTimerActions( gentity_t *ent, int msec )        int ammo, maxAmmo;        BG_FindAmmoForWeapon( WP_ALEVEL3_UPG, &maxAmmo, NULL ); -      BG_UnpackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, &ammo, NULL ); +      ammo = client->ps.ammo;        if( ammo < maxAmmo )        {          ammo++; -        BG_PackAmmoArray( WP_ALEVEL3_UPG, client->ps.ammo, client->ps.powerups, ammo, 0 ); +        client->ps.ammo = ammo; +        client->ps.clips = 0;        }      }    } diff --git a/src/game/g_admin.c b/src/game/g_admin.c index de59a47..5761586 100644 --- a/src/game/g_admin.c +++ b/src/game/g_admin.c @@ -4716,8 +4716,8 @@ qboolean G_admin_denyweapon( gentity_t *ent, int skiparg )            BG_AddWeaponToInventory( WP_MACHINEGUN, vic->client->ps.stats );            BG_FindAmmoForWeapon( WP_MACHINEGUN, &maxAmmo, &maxClips ); -          BG_PackAmmoArray( WP_MACHINEGUN, vic->client->ps.ammo, vic->client->ps.powerups, -                            maxAmmo, maxClips ); +          vic->client->ps.ammo = maxAmmo; +          vic->client->ps.clips = maxClips;            G_ForceWeaponChange( vic, WP_MACHINEGUN );            vic->client->ps.stats[ STAT_MISC ] = 0;            ClientUserinfoChanged( pids[ 0 ], qfalse ); diff --git a/src/game/g_client.c b/src/game/g_client.c index 00ed443..ef35f16 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1847,7 +1847,8 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles    BG_FindAmmoForWeapon( weapon, &maxAmmo, &maxClips );    BG_AddWeaponToInventory( weapon, client->ps.stats ); -  BG_PackAmmoArray( weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips ); +  client->ps.ammo = maxAmmo; +  client->ps.clips = maxClips;    ent->client->ps.stats[ STAT_PCLASS ] = ent->client->pers.classSelection;    ent->client->ps.stats[ STAT_PTEAM ] = ent->client->pers.teamSelection; diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 5c5101b..1233e31 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -445,7 +445,8 @@ void Cmd_Give_f( gentity_t *ent )          BG_InventoryContainsUpgrade( UP_BATTPACK, client->ps.stats ) )        maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); -    BG_PackAmmoArray( client->ps.weapon, client->ps.ammo, client->ps.powerups, maxAmmo, maxClips ); +    client->ps.ammo = maxAmmo; +    client->ps.clips = maxClips;    }  } @@ -3850,8 +3851,8 @@ void Cmd_Buy_f( gentity_t *ent )          BG_InventoryContainsUpgrade( UP_BATTPACK, ent->client->ps.stats ) )        maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER ); -    BG_PackAmmoArray( weapon, ent->client->ps.ammo, ent->client->ps.powerups, -                      maxAmmo, maxClips ); +    ent->client->ps.ammo = maxAmmo; +    ent->client->ps.clips = maxClips;      G_ForceWeaponChange( ent, weapon ); @@ -4073,7 +4074,8 @@ void Cmd_Sell_f( gentity_t *ent )                  BG_FindUsesEnergyForWeapon( j ) &&                  !BG_FindInfinteAmmoForWeapon( j ) )              { -              BG_PackAmmoArray( j, ent->client->ps.ammo, ent->client->ps.powerups, 0, 0 ); +              ent->client->ps.ammo = 0; +              ent->client->ps.clips = 0;              }            }          } diff --git a/src/game/g_trigger.c b/src/game/g_trigger.c index 2b5b25a..0ac34bb 100644 --- a/src/game/g_trigger.c +++ b/src/game/g_trigger.c @@ -1099,8 +1099,8 @@ 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, &maxClips ); -  BG_UnpackAmmoArray( other->client->ps.weapon, other->client->ps.ammo, other->client->ps.powerups, -                      &ammo, &clips ); +  ammo = other->client->ps.ammo; +  clips = other->client->ps.clips;    if( ( ammo + self->damage ) > maxAmmo )    { @@ -1115,8 +1115,8 @@ 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, -                    ammo, clips ); +  other->client->ps.ammo = ammo; +  other->client->ps.clips = clips;  }  /* diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 4da6205..e2d0183 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -97,7 +97,7 @@ void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo )      if( BG_InventoryContainsWeapon( i, ent->client->ps.stats ) &&          weaponType && !BG_FindInfinteAmmoForWeapon( i ) &&          !BG_WeaponIsFull( i, ent->client->ps.stats, -          ent->client->ps.ammo, ent->client->ps.powerups ) ) +          ent->client->ps.ammo, ent->client->ps.clips ) )      {        BG_FindAmmoForWeapon( i, &maxAmmo, &maxClips ); @@ -109,8 +109,8 @@ void G_GiveClientMaxAmmo( gentity_t *ent, qboolean buyingEnergyAmmo )            maxAmmo = (int)( (float)maxAmmo * BATTPACK_MODIFIER );        } -      BG_PackAmmoArray( i, ent->client->ps.ammo, ent->client->ps.powerups, -                        maxAmmo, maxClips ); +      ent->client->ps.ammo = maxAmmo; +      ent->client->ps.clips = maxClips;        restoredAmmo = qtrue;      }  | 
