Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/etlegacy/etlegacy.git
Browse files Browse the repository at this point in the history
  • Loading branch information
IR4T4 committed Sep 20, 2017
2 parents 69d7040 + 7eda3a5 commit dde6cb7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 70 deletions.
37 changes: 5 additions & 32 deletions src/cgame/cg_draw_hud.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,39 +776,11 @@ static int CG_PlayerAmmoValue(int *ammo, int *clips, int *akimboammo)
return weap;
}

// FIXME: table weapon ?
switch (weap) // some weapons don't draw ammo count text
// it uses ammo ?
// some weapons don't draw ammo count
if (!GetWeaponTableData(weap)->uses)
{
case WP_AMMO:
case WP_MEDKIT:
case WP_KNIFE:
case WP_KNIFE_KABAR:
case WP_PLIERS:
case WP_SMOKE_MARKER:
case WP_DYNAMITE:
case WP_SATCHEL:
case WP_SATCHEL_DET:
case WP_SMOKE_BOMB:
case WP_BINOCULARS:
return weap;

case WP_LANDMINE:
case WP_MEDIC_SYRINGE:
case WP_MEDIC_ADRENALINE:
case WP_GRENADE_LAUNCHER:
case WP_GRENADE_PINEAPPLE:
case WP_FLAMETHROWER:
case WP_MORTAR:
case WP_MORTAR2:
case WP_MORTAR_SET:
case WP_MORTAR2_SET:
case WP_PANZERFAUST:
case WP_BAZOOKA:
skipammo = qtrue;
break;

default:
break;
}

if ((cg.snap->ps.eFlags & EF_MG42_ACTIVE) || (cg.snap->ps.eFlags & EF_MOUNTEDTANK) || (cg.snap->ps.eFlags & EF_AAGUN_ACTIVE))
Expand Down Expand Up @@ -861,7 +833,8 @@ static int CG_PlayerAmmoValue(int *ammo, int *clips, int *akimboammo)
*ammo += *clips;
}

if (skipammo)
// some weapons don't draw ammo clip count text (1 -> 1 ammo/clip -> no clip)
if (GetWeaponTableData(weap)->maxClip == 1)
{
*clips = -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cgame/cg_weapons.c
Original file line number Diff line number Diff line change
Expand Up @@ -2581,7 +2581,7 @@ void CG_AddPlayerWeapon(refEntity_t *parent, playerState_t *ps, centity_t *cent)

CG_PositionRotatedEntityOnTag(&gun, parent, "tag_weapon");
}
else if ((!ps || cg.renderingThirdPerson) && GetWeaponTableData(weaponNum)->isMortar)
else if ((!ps || cg.renderingThirdPerson) && (GetWeaponTableData(weaponNum)->isMortar && GetWeaponTableData(weaponNum)->isMortarSet))
{
CG_PositionEntityOnTag(&gun, parent, "tag_weapon2", 0, NULL);
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/bg_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ weaponTable_t weaponTable[WP_NUM_WEAPONS] =
{ WP_MOBILE_BROWNING_SET, TEAM_ALLIES, WP_MOBILE_BROWNING, WP_MOBILE_MG42_SET, WP_NONE, WP_MOBILE_BROWNING, WP_MOBILE_BROWNING, qfalse, qfalse, 18, qfalse, qtrue, 2500, 0.9f, 0, 0, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qtrue, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, 55, 55, 0, "MOBILE BROWNING", WS_BROWNING, 450, 1, 150, 0, 150, 3000, DELAY_LOW, 66, 1500, 300, 0, 1250, 0, "", "browning", MOD_MOBILE_BROWNING, MOD_MOBILE_BROWNING }, // WP_MOBILE_BROWNING_SET // 50
{ WP_MORTAR2, TEAM_ALLIES, WP_MORTAR2_SET, WP_MORTAR, WP_NONE, WP_MORTAR2, WP_MORTAR2, qfalse, qfalse, 1, qtrue, qtrue, 0, 0, 0, 0, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, 0, 0, 0, "GRANATWERFER", WS_MORTAR2, 15, 1, 1, 0, 0, 0, DELAY_HW, 1600, 0, 0, 0, 1000, 0, "", "axis_mortar", MOD_MORTAR2, MOD_MORTAR2 }, // WP_MORTAR2 // 51
{ WP_MORTAR2_SET, TEAM_ALLIES, WP_MORTAR2, WP_MORTAR_SET, WP_NONE, WP_MORTAR2, WP_MORTAR2, qfalse, qfalse, 0, qtrue, qtrue, 0, 0, 400, 400, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, qfalse, qtrue, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, 0, 0, 0, "GRANATWERFER", WS_MORTAR2, 16, 1, 1, 12, 0, 0, DELAY_HW, 1400, 0, 0, 0, 1667, 0, "mortar_grenade", "axis_mortar_set", MOD_MORTAR2, MOD_MORTAR2 }, // WP_MORTAR2_SET // 52
{ WP_BAZOOKA, TEAM_ALLIES, WP_NONE, WP_PANZERFAUST, WP_NONE, WP_BAZOOKA, WP_BAZOOKA, qfalse, qfalse, 400, qtrue, qfalse, 0, 0, 400, 300, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, 0, 0, 0, "BAZOOKA", WS_BAZOOKA, 4, 1, 1, 0, 4, 1000, DELAY_HW, 2000, 0, 0, 250, 250, 32000.f, "rocket", "bazooka", MOD_BAZOOKA, MOD_BAZOOKA }, // WP_BAZOOKA // 53
{ WP_BAZOOKA, TEAM_ALLIES, WP_NONE, WP_PANZERFAUST, WP_NONE, WP_BAZOOKA, WP_BAZOOKA, qfalse, qfalse, 400, qtrue, qfalse, 0, 0, 400, 300, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, qfalse, qfalse, qfalse, qfalse, qtrue, qfalse, 0, 0, 0, "BAZOOKA", WS_BAZOOKA, 4, 1, 1, 0, 4, 1000, DELAY_HW, 2000, 0, 0, 250, 250, 32000.f, "rocket", "bazooka", MOD_BAZOOKA, MOD_BAZOOKA }, // WP_BAZOOKA // 53
};

/**
Expand Down
56 changes: 20 additions & 36 deletions src/game/bg_pmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -2635,7 +2635,7 @@ static void PM_BeginWeaponChange(weapon_t oldWeapon, weapon_t newWeapon, qboolea
pm->ps->weaponstate = WEAPON_DROPPING;
}

if (newWeapon == weaponTable[oldWeapon].weapAlts)
if (newWeapon == GetWeaponTableData(oldWeapon)->weapAlts)
{
pm->ps->weaponTime += GetWeaponTableData(oldWeapon)->switchTimeBegin;
}
Expand All @@ -2651,7 +2651,6 @@ static void PM_BeginWeaponChange(weapon_t oldWeapon, weapon_t newWeapon, qboolea
static void PM_FinishWeaponChange(void)
{
weapon_t oldweapon, newweapon = (weapon_t)pm->ps->nextWeapon;
qboolean doSwitchAnim = qtrue;

// Cannot switch to an invalid weapon
if (!IS_VALID_WEAPON(newweapon))
Expand Down Expand Up @@ -2708,59 +2707,44 @@ static void PM_FinishWeaponChange(void)
return;
}

// play an animation
if (newweapon == GetWeaponTableData(oldweapon)->weapAlts)
{
if (GetWeaponTableData(newweapon)->isRifle && !pm->ps->ammoclip[BG_FindAmmoForWeapon(oldweapon)])
{
doSwitchAnim = qfalse;
}
else
{
pm->ps->weaponTime += GetWeaponTableData(newweapon)->switchTimeFinish;
return;
}
}
else
{
pm->ps->weaponTime += 250; // dropping/raising usually takes 1/4 sec.
}

BG_UpdateConditionValue(pm->ps->clientNum, ANIM_COND_WEAPON, newweapon, qtrue);
pm->ps->weaponTime += GetWeaponTableData(newweapon)->switchTimeFinish;
BG_UpdateConditionValue(pm->ps->clientNum, ANIM_COND_WEAPON, newweapon, qtrue);

// play an animation
if (doSwitchAnim)
{
if (newweapon == GetWeaponTableData(oldweapon)->weapAlts)
if (pm->ps->eFlags & EF_PRONE)
{
if (pm->ps->eFlags & EF_PRONE)
{
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_DO_ALT_WEAPON_MODE_PRONE, qfalse, qfalse);
}
else
{
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_DO_ALT_WEAPON_MODE, qfalse, qfalse);
}
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_DO_ALT_WEAPON_MODE_PRONE, qfalse, qfalse);
}
else
{
if (pm->ps->eFlags & EF_PRONE)
{
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_RAISEWEAPONPRONE, qfalse, qfalse);
}
else
{
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_RAISEWEAPON, qfalse, qfalse);
}
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_DO_ALT_WEAPON_MODE, qfalse, qfalse);
}

// alt weapon switch was played when switching away, just go into idle
if (GetWeaponTableData(oldweapon)->weapAlts == newweapon)
PM_StartWeaponAnim(PM_AltSwitchToForWeapon(newweapon));
}
else
{
pm->ps->weaponTime += 250; // dropping/raising usually takes 1/4 sec.
BG_UpdateConditionValue(pm->ps->clientNum, ANIM_COND_WEAPON, newweapon, qtrue);

if (pm->ps->eFlags & EF_PRONE)
{
PM_StartWeaponAnim(PM_AltSwitchToForWeapon(newweapon));
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_RAISEWEAPONPRONE, qfalse, qfalse);
}
else
{
PM_StartWeaponAnim(PM_RaiseAnimForWeapon(newweapon));
BG_AnimScriptEvent(pm->ps, pm->character->animModelInfo, ANIM_ET_RAISEWEAPON, qfalse, qfalse);
}

PM_StartWeaponAnim(PM_RaiseAnimForWeapon(newweapon));
}
}

Expand Down

0 comments on commit dde6cb7

Please sign in to comment.