Fix Egon gun resetting animation when another weapon has just been deployed

This commit is contained in:
Sam V 2023-06-20 17:26:23 +02:00
parent ad50584478
commit d368aecb22
5 changed files with 11 additions and 2 deletions

View file

@ -25,7 +25,7 @@
* Fixed being able to break scripted_sequence by +using friendly NPCs to make them follow player [#200](https://github.com/SamVanheer/halflife-updated/issues/200) (Thanks Oxofemple. for reporting this and FreeSlave for finding the solution)
* Fixed potential incorrect facing in scripted sequence (Thanks FreeSlave)
* Made the Linux version link statically to the C++ runtime to help avoid problems when running mods on older systems (Thanks a1ba and FreeSlave)
* Fixed Egon not stopping its attack animation if the attack button is held down and ammo runs out
* Fixed Egon not stopping its attack animation if the attack button is held down and ammo runs out (Thanks the man)
* Fixed scientists crashing when speaking fear dialogue when enemy has been removed
* Disabled fall think function for weapons when the player picks it up to prevent possible double-pickup which removes the weapon and crashes the game

View file

@ -34,6 +34,8 @@ bool g_runfuncs = false;
// reset it to NULL as appropriate
struct local_state_s* g_finalstate = NULL;
int g_CurrentWeaponId = WEAPON_NONE;
/*
====================
COM_Log

View file

@ -37,3 +37,4 @@ extern Vector v_angles;
extern Vector v_client_aimangles;
extern float g_lastFOV;
extern struct local_state_s* g_finalstate;
extern int g_CurrentWeaponId;

View file

@ -20,6 +20,7 @@
#include "cbase.h"
#include "weapons.h"
#include "com_weapons.h"
#include "const.h"
#include "entity_state.h"
#include "cl_entity.h"
@ -1441,7 +1442,11 @@ void EV_EgonStop(event_args_t* args)
pFlare = NULL;
}
gEngfuncs.pEventAPI->EV_WeaponAnimation(EGON_IDLE1, 0);
// HACK: only reset animation if the Egon is still equipped.
if (g_CurrentWeaponId == WEAPON_EGON)
{
gEngfuncs.pEventAPI->EV_WeaponAnimation(EGON_IDLE1, 0);
}
}
}
//======================

View file

@ -926,4 +926,5 @@ void DLLEXPORT HUD_PostRunCmd(struct local_state_s* from, struct local_state_s*
// All games can use FOV state
g_lastFOV = to->client.fov;
g_CurrentWeaponId = to->client.m_iId;
}