Open BlackShadow opened 5 years ago
Be very careful when changing variables in weapons code, any change in timing could have unexpected side-effects.
@SamVanheer I can confirm these fixes are tested and doesn't break any weapons.
The crowbar never plays it's idle animations.
There's also the crowbar idle animations and the tripmines attaching animations (sequence names: arm1 and place)
@Don576 I'll look into that
@CS-PRO1 Those animations are beta animations, Valve dropped those animations during development.
More info : https://youtu.be/e59bvmvXPk0?t=202
They're still not cut tho. Maybe they were intended to be in the final one. Or maybe implement just "place" and drop "arm1"
@CS-PRO1 They're "leftover" from beta. These are common things in development. Devs became lazy or rush things and forgot delete those kinds of things. That's why they called "leftover".
I looked up idle animations of Crowbar and it seems Valve never implemented them. I don't really know if Valve dropped the idea during development or forgot adding them.
I looked up idle animations of Crowbar and it seems Valve never implemented them. I don't really know if Valve dropped the idea during development or forgot adding them.
I don't think so, in HL:S they work as intended.
Note that the Crowbar doesn't have a WeaponIdle
method at all, and the Source SDK handles it by using a common base class that looks up animations by act, so that could just be an unintentional side-effect rather than intended behavior.
I've seen SC had fixed Idle for crowbar but I dunno if it's possible to implement in HL tho.
It's possible, but they didn't added. As the Sam said they not even added WeaponIdle and this made me think straight away they cut the crowbar animations.
Gauss: Gauss's idle animation's are completely broken. This issue appears to be in Steam version. Retail version seems to be working properly.
I tested this in versions 1.0.1.6 and 1.0.0.5 (release build), and there didn't appear to be an idle animation for the Tau Cannon/Gauss. Perhaps this was an unused animation, like the one for the crowbar?
EDIT: Also checked version 1.1.1.0 of the WON (Retail) version, also doesn't appear to be present there either.
Gauss: Gauss's idle animation's are completely broken. This issue appears to be in Steam version. Retail version seems to be working properly.
I tested this in versions 1.0.1.6 and 1.0.0.5 (release build), and there didn't appear to be an idle animation for the Tau Cannon/Gauss. Perhaps this was an unused animation, like the one for the crowbar?
EDIT: Also checked version 1.1.1.0 of the WON (Retail) version, also doesn't appear to be present there either.
Judging from code Gauss's idle animations are intended because it has WeaponIdle. It doesn't work because of strings are missing.
The Gauss's idle animations are disabled because there's a return statement before SendWeaponAnim
:
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/gauss.cpp#L568-L590
It's been like that since SDK 1.0 so it's probably intentional.
BUGBUGBUG - Only bug i could found with this fix is Shotgun continues to reload delayed when weapons switched during reload.
This happens because Shotgun's reload depends on m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
And the reason why it's happens because we've changed m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
time to 3.0 from 1.0 And that makes Shotgun reload is a bit delayed. I've tried few things but i couldn't find a proper fix.
BUGBUGBUG - Only bug i could found with this fix is Shotgun continues to reload delayed when weapons switched during reload.
This happens because Shotgun's reload depends on
m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
This is happens because we changed
m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
time to 3.0 from 1.0 And that makes Shotgun reload is a bit delayed. I've tried few things to fix this but i couldn't fix a proper fix.
I did notice this as well. Hopefully someone finds a fix for this.
BUGBUGBUG - Only bug i could found with this fix is Shotgun continues to reload delayed when weapons switched during reload.
This happens because Shotgun's reload depends on
m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
And the reason why it's happens because we've changed
m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
time to 3.0 from 1.0 And that makes Shotgun reload is a bit delayed. I've tried few things but i couldn't find a proper fix.
My recommendation is to not change DefaultDeploy
and instead changing the idle time separately in those weapons that need a different delay. That way other weapons are unaffected.
BUGBUGBUG - Only bug i could found with this fix is Shotgun continues to reload delayed when weapons switched during reload. This happens because Shotgun's reload depends on
m_flTimeWeaponIdle = UTIL_WeaponTimeBase()
And the reason why it's happens because we've changedm_flTimeWeaponIdle = UTIL_WeaponTimeBase()
time to 3.0 from 1.0 And that makes Shotgun reload is a bit delayed. I've tried few things but i couldn't find a proper fix.My recommendation is to not change
DefaultDeploy
and instead changing the idle time separately in those weapons that need a different delay. That way other weapons are unaffected.
How would you do that? I'm new to this sorta stuff, so I wouldn't know.
if (DefaultDeploy(stuff))
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;
}
if (DefaultDeploy(stuff)) { m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0; }
What would I put in the place of "stuff"? Would I be replacing szViewModel, szWeaponModel, etc. with specific weapon names?
Using the satchel as an example: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/satchel.cpp#L292-L305
Modify it to look like this:
BOOL CSatchel::Deploy( )
{
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1.0;
//m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 );
BOOL result = FALSE;
if ( m_chargeReady )
result = DefaultDeploy( "models/v_satchel_radio.mdl", "models/p_satchel_radio.mdl", SATCHEL_RADIO_DRAW, "hive" );
else
result = DefaultDeploy( "models/v_satchel.mdl", "models/p_satchel.mdl", SATCHEL_DRAW, "trip" );
if (result)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
}
return result;
}
Note how i've commented out the first assignment since the value is overwritten anyway. I've also replaced the return statement on the last line since that line was never reached before.
Also keep in mind that some weapon functions are duplicated on the client side for prediction: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/hl/hl_weapons.cpp#L211-L224
If you modify the server side you also need to modify the client side so everything stays in sync.
So then for the snark, it would change from this:
BOOL CSqueak::Deploy( ) { // play hunt sound float flRndSound = RANDOM_FLOAT ( 0 , 1 );
if ( flRndSound <= 0.5 ) EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, 100); else EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "squeek/sqk_hunt3.wav", 1, ATTN_NORM, 0, 100);
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
return DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" ); }
To this?
BOOL CSqueak::Deploy( ) { // play hunt sound float flRndSound = RANDOM_FLOAT ( 0 , 1 );
if ( flRndSound <= 0.5 ) EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, 100); else EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "squeek/sqk_hunt3.wav", 1, ATTN_NORM, 0, 100); if (result) { m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3; }
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
return result; }
Am I getting this right?
No.
BOOL CSqueak::Deploy( )
{
// play hunt sound
float flRndSound = RANDOM_FLOAT ( 0 , 1 );
if ( flRndSound <= 0.5 )
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "squeek/sqk_hunt2.wav", 1, ATTN_NORM, 0, 100);
else
EMIT_SOUND_DYN(ENT(pev), CHAN_VOICE, "squeek/sqk_hunt3.wav", 1, ATTN_NORM, 0, 100);
m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME;
BOOL result = DefaultDeploy( "models/v_squeak.mdl", "models/p_squeak.mdl", SQUEAK_UP, "squeak" );
if (result)
{
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3;
}
return result;
}
I'd suggest learning C++ before trying to figure stuff like this out, you really need to understand what's going on to fix stuff like this.
I'd suggest learning C++ before trying to figure stuff like this out, you really need to understand what's going on to fix stuff like this.
I learn better by example. Thanks for the clarification though.
A few notes:
Instead of commenting out RetireWeapon
for the hand grenade the code for that should be changed to handle exhaustible weapons properly in general.
Modify this: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/weapons.cpp#L1182-L1190
To include this:
void CBasePlayerWeapon::RetireWeapon()
{
// first, no viewmodel at all.
m_pPlayer->pev->viewmodel = iStringNull;
m_pPlayer->pev->weaponmodel = iStringNull;
//m_pPlayer->pev->viewmodelindex = NULL;
g_pGameRules->GetNextBestWeapon( m_pPlayer, this );
//If we're still equipped and we couldn't switch to another weapon, dequip this one
if (CanHolster() && m_pPlayer->m_pActiveItem == this)
{
m_pPlayer->SwitchWeapon(nullptr);
}
}
And modify this: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/dlls/player.cpp#L4648-L4666
To include this:
BOOL CBasePlayer :: SwitchWeapon( CBasePlayerItem *pWeapon )
{
if (pWeapon && !pWeapon->CanDeploy() )
{
return FALSE;
}
ResetAutoaim( );
if (m_pActiveItem)
{
m_pActiveItem->Holster( );
}
m_pActiveItem = pWeapon;
if (pWeapon)
{
pWeapon->Deploy();
}
return TRUE;
}
This allows switching to no weapon. When a weapon is retired, if the player still has it equipped after an attempted switch to next best weapon and the current weapon can be holstered the player's current weapon will be holstered.
If you then pick up ammo for that weapon it will be deployed as usual.
See also #3073 for a bug affecting Snark primary attack and #3069 for a bug that can cause the Snark's deploy animation to not play sometimes.
@kisak-valve DONT FORGET DIS and could someone open a pull request or something pls?
Hi,
Some weapons animations can't and won't animate properly because there's not enough time given to them to play it or some of them are straight broken. I'll be listing these weapons with their fixes.
Side Note: These fixes won't effect gameplay in any way. These are just cosmetic fix. These fixes make game look more proper. Also HD models are compatiable with these fixes.
RPG: RPG's fidget animation can't animate properly because there's not enough time given to it.
To fix this:
Change:
To:
Gauss: Gauss's idle animation's are completely broken. This issue appears to be in Steam version. Retail version seems to be working properly.
To fix this:
Change:
To:
Hand Grenade: Hand Grenade is supposed to play HANDGRENADE_DRAW animation after player threw a grenade.
Commenting out "m_flReleaseThrow = 0;" fixes our issue. Thanks to @SamVanHeer pointing this out.
However after player ran out of grenades and pick up a grenade, it won't show up until player switch weapons.
We can easily fix this issue by removing " RetireWeapon(); "
Satchel and Snark (Squeak):
Satchel can't animate it's draw animation properly. This issue happens in Snark as well.
in weapons.cpp:
This fixes draw animation problem. All i did was change, "m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0;" to "m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 3.0;"
This gives enough time to play draw animation to these weapons.