Permalink
Browse files

cgame/game: use BG_PlayerMounted macro

  • Loading branch information...
Aranud committed Jan 12, 2018
1 parent f45cb51 commit ddcaf99b03afcac62c050a39e6298cd3298474a6
Showing with 13 additions and 11 deletions.
  1. +2 −2 src/cgame/cg_draw_hud.c
  2. +1 −1 src/cgame/cg_weapons.c
  3. +8 −6 src/game/bg_pmove.c
  4. +2 −2 src/game/g_active.c
View
@@ -781,7 +781,7 @@ static int CG_PlayerAmmoValue(int *ammo, int *clips, int *akimboammo)
return weap;
}
if ((cg.snap->ps.eFlags & EF_MG42_ACTIVE) || (cg.snap->ps.eFlags & EF_MOUNTEDTANK) || (cg.snap->ps.eFlags & EF_AAGUN_ACTIVE))
if (BG_PlayerMounted(cg.snap->ps.eFlags))
{
if (cg_entities[cg_entities[cg_entities[cg.snap->ps.clientNum].tagParent].tankparent].currentState.density & 8)
{
@@ -1149,7 +1149,7 @@ skillType_t CG_ClassSkillForPosition(clientInfo_t *ci, int pos)
return SK_BATTLE_SENSE;
case 2:
// draw soldier level if using a heavy weapon instead of light weapons icon
if ((pm && (pm->ps->persistant[PERS_HWEAPON_USE] || (pm->ps->eFlags & EF_MOUNTEDTANK) || GetWeaponTableData(pm->ps->weapon)->isHeavyWeapon)) && ci->cls != PC_SOLDIER)
if ((pm && (BG_PlayerMounted(pm->ps->eFlags) || GetWeaponTableData(pm->ps->weapon)->isHeavyWeapon)) && ci->cls != PC_SOLDIER)
{
return SK_HEAVY_WEAPONS;
}
View
@@ -3162,7 +3162,7 @@ void CG_AddViewWeapon(playerState_t *ps)
// allow the gun to be completely removed
if ((!cg_drawGun.integer))
{
if ((cg.predictedPlayerState.eFlags & EF_FIRING) && !(cg.predictedPlayerState.eFlags & (EF_MG42_ACTIVE | EF_AAGUN_ACTIVE | EF_MOUNTEDTANK)))
if ((cg.predictedPlayerState.eFlags & EF_FIRING) && !BG_PlayerMounted(cg.predictedPlayerState.eFlags))
{
vec3_t origin;
View
@@ -831,8 +831,8 @@ static qboolean PM_CheckProne(void)
return qfalse;
}
// no prone when using mg42's
if (pm->ps->persistant[PERS_HWEAPON_USE] || (pm->ps->eFlags & EF_MOUNTEDTANK))
// no prone when player is mounted
if (BG_PlayerMounted(pm->ps->eFlags))
{
return qfalse;
}
@@ -891,7 +891,7 @@ static qboolean PM_CheckProne(void)
{
if (pm->waterlevel > 1 ||
pm->ps->pm_type == PM_DEAD ||
(pm->ps->eFlags & EF_MOUNTEDTANK) ||
BG_PlayerMounted(pm->ps->eFlags) ||
((pm->cmd.doubleTap == DT_BACK || pm->cmd.upmove > 10 || (pm->cmd.wbuttons & WBUTTON_PRONE)) && pm->cmd.serverTime - pm->pmext->proneTime > pronedelay))
{
trace_t trace;
@@ -2861,7 +2861,7 @@ void PM_CoolWeapons(void)
// note: we are still cooling WP_NONE and other non bullet weapons
if (pm->ps->weapon && GetWeaponTableData(pm->ps->weapon)->canHeat)
{
if (pm->ps->persistant[PERS_HWEAPON_USE] || (pm->ps->eFlags & EF_MOUNTEDTANK))
if (BG_PlayerMounted(pm->ps->eFlags))
{
// floor to prevent 8-bit wrap
pm->ps->curWeapHeat = floor(((float)pm->ps->weapHeat[WP_DUMMY_MG42] / (float)GetWeaponTableData(WP_DUMMY_MG42)->maxHeat) * 255.0f);
@@ -3001,6 +3001,8 @@ void PM_AdjustAimSpreadScale(void)
*/
static qboolean PM_MountedFire(void)
{
Com_Printf("Mounted Fire %d\n", pm->ps->persistant[PERS_HWEAPON_USE]);
switch (pm->ps->persistant[PERS_HWEAPON_USE])
{
case 1:
@@ -3750,8 +3752,8 @@ static void PM_Weapon(void)
// take an ammo away if not infinite
if (PM_WeaponAmmoAvailable(pm->ps->weapon) != -1)
{
// check for being mounted on mg42
if (!(pm->ps->persistant[PERS_HWEAPON_USE]) && !(pm->ps->eFlags & EF_MOUNTEDTANK))
// check for being mounted
if (!BG_PlayerMounted(pm->ps->eFlags))
{
PM_WeaponUseAmmo(pm->ps->weapon, ammoNeeded);
}
View
@@ -732,7 +732,7 @@ qboolean ClientInactivityTimer(gclient_t *client)
if (client->pers.cmd.forwardmove || client->pers.cmd.rightmove || client->pers.cmd.upmove ||
(client->pers.cmd.wbuttons & (WBUTTON_ATTACK2 | WBUTTON_LEANLEFT | WBUTTON_LEANRIGHT)) ||
(client->pers.cmd.buttons & BUTTON_ATTACK) ||
(client->ps.eFlags & (EF_MOUNTEDTANK | EF_MG42_ACTIVE | EF_AAGUN_ACTIVE)) ||
BG_PlayerMounted(client->ps.eFlags) ||
(client->ps.pm_type == PM_DEAD /*&& !(client->ps.eFlags & EF_PLAYDEAD)*/)) // playdead sets PM_DEAD, so check if playing dead ...
{
client->inactivityWarning = qfalse;
@@ -2053,7 +2053,7 @@ void WolfReviveBbox(gentity_t *self)
gentity_t *hit = G_TestEntityPosition(self);
vec3_t mins, maxs;
if (hit && (hit->s.number == ENTITYNUM_WORLD || (hit->client && (hit->client->ps.persistant[PERS_HWEAPON_USE] || (hit->client->ps.eFlags & EF_MOUNTEDTANK)))))
if (hit && (hit->s.number == ENTITYNUM_WORLD || (hit->client && BG_PlayerMounted(hit->client->ps.eFlags))))
{
G_DPrintf("WolfReviveBbox: Player stuck in world or MG 42 using player\n");
// Move corpse directly to the person who revived them

0 comments on commit ddcaf99

Please sign in to comment.