Reset Bobbing Level

Moderator: GZDoom Developers

Post Reply
User avatar
some_random_guy
Posts: 61
Joined: Fri Apr 29, 2011 5:20 pm
Location: here

Reset Bobbing Level

Post by some_random_guy »

I noticed that when weapons bob during A_WeaponReady, it seems to keep a variable that only varies as you move.

Would it be hard to reset this variable, so that, for example, when your weapon is going through an animation and the animation finishes
that the weapon sprite doesn't "jump" to it's bobbing position? I mean, just so you get what I mean, fire the Doom shotgun, and while you're
pumping the action, move for a second or so. Doesn't the sprite move to where it would have been if you moved for a second without firing?

Creating a function so that you can reset the bobbing position to the position the sprite starts in when starting the level, it would make the
sprite sequences look a lot smoother.

...this is one of many things that would make the ZDoom engine go from "awesome" to "purely beautiful". :)
User avatar
Snarboo
Posts: 2599
Joined: Tue Nov 29, 2005 4:37 am

Re: Reset Bobbing Level

Post by Snarboo »

I'm not entirely sure what you mean but this already sort of exists. You could simply place [wiki]A_WeaponReady[/wiki] on the weapon's firing frames so that the weapon bobs while shooting.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Reset Bobbing Level

Post by FDARI »

I wonder if A_WeaponReady has side effects.
I have had a weapon with A_WeaponReady(WRF_NOFIRE) in its firing state.
First press and hold shows gritted teeth mugshot.
Second press and hold shows normal mugshot. (Just looking about.)

I could take a closer look at A_WeaponReady and see what internal work it performs.

I also tested a special use of A_WeaponReady without bobbing and only allowing primary fire, as a variant of A_ReFire, and I recall it had unexpected side-effects. (However, I am using it for a strife-assault gun altfire.)

I'm not sure A_WeaponReady is a good solution in this case.
a: It depends on the side effects.
b: It must be called frequently to look smooth.
User avatar
XutaWoo
Posts: 4005
Joined: Sat Dec 30, 2006 4:25 pm
Location: beautiful hills of those who are friends
Contact:

Re: Reset Bobbing Level

Post by XutaWoo »

FDARI wrote:I also tested a special use of A_WeaponReady without bobbing and only allowing primary fire, as a variant of A_ReFire, and I recall it had unexpected side-effects.
If you mean that it didn't go into it's Hold state, well, yeah. A_ReFire is what sets the variable for whether or not to go to the Hold state, with only one other function (A_CancelRefire, I think?) ever acting on said variable. So if you use A_WeaponReady, it's obviously just going to keep going to its Fire state (unless A_ReFire is called and then skipped, then it will go directly to the Hold state until A_ReFire (or A_CancelReFire or whatever) is called or the weapon is switched away.
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Reset Bobbing Level

Post by FDARI »

EDIT: I have strayed from the topic. I have something (on topic) to add, which will be put at the top of this post if it is ready within the next 30 minutes. (Status update: Couldn't do it at first; Local and nationwide network issues.)

Sorry to derail, I'll be brief: That is not what I meant.
Spoiler: Somewhat brief, at least
User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Reset Bobbing Level

Post by FDARI »

I have not observed the described behaviour in the game, but I don't have an eye for details. This is what I've found in code:

Weapon bob-position consists of a distance from centre and an angle.

The angle depends only on how long the level has been running (number of tics).
The distance depends on player movement.

The weapon position is updated every tic (possibly not when you view the game through a non-player camera).
When you stand still, and when you do not call A_WeaponReady, bob-distance is adjusted towards 0 (centre).
When you move and A_WeaponReady is called (with bobbing), bob-distance is adjusted towards a value determined by your movement.

The code implies a relatively smooth behaviour.
The angle is updated all the time.
The distance from centre is adjusted for smooth movement. Towards 0 in non-bobbing states.

Is this consistent with what OP observes, and is this a correct interpretation of the code?
User avatar
some_random_guy
Posts: 61
Joined: Fri Apr 29, 2011 5:20 pm
Location: here

Re: Reset Bobbing Level

Post by some_random_guy »

FDARI wrote:I'm not sure A_WeaponReady is a good solution in this case.
a: It depends on the side effects.
b: It must be called frequently to look smooth.
This is kinda what I mean, except I don't always want to call A_WeaponReady.
I want to be able to reset the bobbing sequence so that it doesn't always return to a position based upon how far the player is from a center-point,
especially when I am not constantly calling A_WeaponReady

If you need more clarification, specify what needs clarifying, then I'll clarify! :o

EDIT: I know that this seems like a mere coding efficiency feature, but it would actually allow for a more classic look while cleaning up the
small jump in the bobbing. If I constantly call A_WeaponReady I can't get that "classic" look like the original Doom since it would always be bobbing.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”