Prediction: Unbreak Weapons_Draw by setting the roll-back values of

predicted variables. This is because we're doing something that happens
outside the prediction... this should be more elegant but it works for now.
This commit is contained in:
Marco Cawthorne 2019-09-08 12:19:27 +02:00
parent 8d9b03f6ca
commit bca3a1f713

View file

@ -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;
}