ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.67k stars 619 forks source link

[CS - Bug] cl_lw 0 swaps hand that holds a weapon #1096

Open ghost opened 11 years ago

ghost commented 11 years ago

How to reproduce:

perhaps it's related with https://github.com/ValveSoftware/halflife/issues/120

Also, with cl_righthand 1 you should hold all your weapon in right hand, but with cl_lw 0 your knife is on the opposite side.

I didn't test it with cl_righthand 0

JohanCorn commented 5 years ago

Basically if you use cl_righthand 1 and cl_lw 1 all weapons appear in the correct (right) hand. If you set cl_lw 0 while you holding the knife all weapons (except the knife) will be transformed to left or while you holding any guns only the knife will be transformed to left hand.

So if you change the cvar it will do interesting inversed thing depend on you are holding a knife or a gun. It is my observation. :)

SamVanheer commented 5 years ago

This happens because the renderer forces the knife to to be flipped so it's in the correct hand, meaning for the knife cl_righthand->value = !cl_righthand->value.

It determines if you're holding the knife using the global variable g_bHoldingKnife, which is set in HUD_WeaponsPostThink, which operates on data that is only valid if cl_lw is enabled. The server won't send weapon data if the client has it turned off (see SV_WriteClientdataToMessage in the engine), so it's probably using the last received copy of the weapon data to determine which weapon is active.

As a result, turning off prediction while the knife is selected will make the renderer think you're always using the knife, and conversely not having it selected will make it never flip the model.

I suppose it could be fixed by replacing the global with a model name check, just like the other checks for whether to render weapons that can be zoomed in while zoomed in.

Note that this check also exists for things like whether you're holding a shield (also flipped in CZ only) as well as whether you're in a bomb zone (used to predict whether to cancel the predicted C4 plant animation) and updating the team menu so changing the cvar, or just turning it off to begin with could break some features in CS.

JohanCorn commented 5 years ago

It's seems EZ. Can you fix this in the next release? Thanks!

JohanCorn commented 5 years ago

Dear @mikela-valve can you or will you fix this in the next release? Thanks for info! :)

dFasdGii commented 3 months ago

Still actual issue