[Closed] +weapon.alwaysbob

Moderator: GZDoom Developers

Re: +weapon.alwaysbob

Postby D2JK » Sat Jan 07, 2017 7:10 am

Well, I can, but it's probably not what you think; rather than modifying the internal bobbing function, I'm simply continuously calling A_WeaponOffset with some custom variables.

Code: Select allExpand view
Bobbing:          // Weapon overlay state
 TNT1 A 0 A_WeaponOffset(invoker.TWOX + V * Cos(12 * level.maptime)  ,  invoker.TWOY + V * (Sin(24 * level.maptime) + 1) , WOF_INTERPOLATE);

These expressions together produce a figure 8 - motion. The two variables, TWOX and TWOY stand for "Target Weapon Offset X/Y", and they dictate the center point of the motion. The weapons have their standard bobbing disabled by the use of WRF_NOBOB flag*. Also, as the actual weapon offsets aren't modified here, it's necessary to manually check for TWOY's value and call A_Lower once, when deselecting a weapon.

It's a bit complicated to use, so I shouldn't recommend it to you or anyone (and I'll probably refactor or replace this myself in the near future). :P But it works for now, at least, and looks ok.

* I actually have +WEAPON.NOBOB enabled for each weapon, but apparently it's still necessary to use WRF_NOBOB flag when calling A_WeaponReady. Otherwise, the function will negate this custom bobbing.
Joined: 30 Aug 2014


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests