diff --git a/src/client/valve/view.c b/src/client/valve/view.c index fe83d5dc..8546cd1a 100644 --- a/src/client/valve/view.c +++ b/src/client/valve/view.c @@ -14,18 +14,37 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -void View_UpdateWeapon(entity vm, entity mflash) +void +View_UpdateWeapon(entity vm, entity mflash) { player pl = (player)pSeat->ePlayer; - - if (pSeat->fLastWeapon != pl.activeweapon) { - pSeat->fLastWeapon = pl.activeweapon; - if (pl.activeweapon) { - Weapons_Draw(); - skel_delete( mflash.skeletonindex ); - mflash.skeletonindex = skel_create( vm.modelindex ); - pSeat->fNumBones = skel_get_numbones( mflash.skeletonindex ) + 1; - pSeat->fEjectBone = pSeat->fNumBones + 1; - } + + /* only bother upon change */ + if (pSeat->fLastWeapon == pl.activeweapon) { + return; } + pSeat->fLastWeapon = pl.activeweapon; + + if (!pl.activeweapon) { + return; + } + + /* hack, we changed the wep, move this into Game_Input/PMove */ + Weapons_Draw(); + + /* we forced a weapon call outside the prediction, + * thus we need to update all the net variables to + * make sure these updates are recognized. this is + * vile but it'll have to do for now */ + pl.net_w_attack_next = pl.w_attack_next; + pl.net_w_idle_next = pl.w_idle_next; + pl.netviewzoom = pl.viewzoom; + pl.net_weapontime = pl.weapontime; + + /* figure out when the attachments start. in FTE attachments for + * HLMDL are treated as bones. they start at numbones + 1 */ + skel_delete( mflash.skeletonindex ); + mflash.skeletonindex = skel_create( vm.modelindex ); + pSeat->fNumBones = skel_get_numbones( mflash.skeletonindex ) + 1; + pSeat->fEjectBone = pSeat->fNumBones + 1; }