Overlay re-centering issues

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Overlay re-centering issues

Re: Overlay re-centering issues

by Major Cooke » Mon Oct 31, 2016 2:06 pm

...Oh. Snap! The example above is on the player actor itself, and I did make OverlayX/Y/ID() for similar purposes. Well, there I go. Guess I won't have to wait for zscript after all. I think this can be closed.

Re: Overlay re-centering issues

by Graf Zahl » Mon Oct 31, 2016 1:46 pm

Whether you reset it by letting A_WeaponReady reset it or by letting A_WeaponOffset reset it shouldn't matter, should it? Or are you trying to set the offset in one overlay from another one? If that's the case, I fear my answer is indeed WFDS.

Re: Overlay re-centering issues

by Major Cooke » Mon Oct 31, 2016 1:34 pm

Which means I'm going to just have to rely on hard numbers rather than the add flag. Great...

Welp, I know this won't be a problem with scripting thanks to local variables in weapons.

Re: Overlay re-centering issues

by Graf Zahl » Mon Oct 31, 2016 1:30 pm

Code: Select all

void DoReadyWeaponToBob (AActor *self)
{
	if (self && self->player && self->player->ReadyWeapon)
	{
		// Prepare for bobbing action.
		self->player->WeaponState |= WF_WEAPONBOBBING;
		self->player->GetPSprite(PSP_WEAPON)->x = 0;
		self->player->GetPSprite(PSP_WEAPON)->y = WEAPONTOP;
	}
}
Yep, that's where the weapon offset gets reset. I assume you want this but without setting the WF_WEAPONBOBBIN, right? can'T you replace the A_WeaponReady call with A_WeaponOffset?

Re: Overlay re-centering issues

by Major Cooke » Mon Oct 31, 2016 1:25 pm

Hmm. It seems WRF_NOBOB is the cause of it. But removing that causes some weird funkiness to go on and attempts to ALWAYS recenter it in that case, disregarding the added offsets. (I did a search & replace for |WRF_NOBOB to nothing in Decorate/Weapons/RocketLauncher.AED)

Re: Overlay re-centering issues

by Major Cooke » Mon Oct 31, 2016 1:13 pm

Turns out I commented out the overlay bit needed to run this piece.

Download here. Graf, what you have should suffice already.
Spoiler: Option 1: Use attachment
Spoiler: Option 2: Uncomment line
Go to console: D4D_TurningBehavior 1; give d4rocketlauncher; sv_infiniteammo 1. When you turn about, the weapon automatically recenters itself as expected. But when you fire, that's when it goes kinda weird.
Attachments
D4Dt.pk3
Option 2: Load after d4d.pk3
(5.97 KiB) Downloaded 37 times

Re: Overlay re-centering issues

by Graf Zahl » Mon Oct 31, 2016 1:02 pm

How can we test? Where is this weapon? The fragment is not enough.

Re: Overlay re-centering issues

by Major Cooke » Mon Oct 31, 2016 12:59 pm

But that's the problem. I want it to stay centered at all times. So I still think of it as a bug.

Also I tried calling A_WeaponReady during this, for the rocket launcher itself with WRF_NOFIRE|WRF_NOBOB. Didn't help.

Re: Overlay re-centering issues

by Graf Zahl » Mon Oct 31, 2016 12:12 pm

Does this mean [not a bug]? I haven't looked into this yet.

Re: Overlay re-centering issues

by Leonard2 » Mon Oct 31, 2016 12:06 pm

Calling A_WeaponReady resets the offsets.

Overlay re-centering issues

by Major Cooke » Mon Oct 31, 2016 10:50 am

This was a feature I was working on for D4D v2 but the centering only ever happens after the firing is finished, no matter what i try.


Code: Select all

//==========================================================================
    // Overlay:         Gun Shifting (WIP)
    // Offsets the weapon whenever turning the camera angle/pitch.
    //==========================================================================
    // (Currently buggy with firing weapons. Needs more fine tuning.)
    Overlay.AnglePitch:
        M666 A 1
        {
            if (GetCvar(D4D_TurningBehavior))
            {
                if (abs(user_offsets[0]) < 10.0)
                {
                    user_offsets[0] += (GetPlayerInput(INPUT_YAW,DefPtr) / 32767.0) * 10.0;
                    //A_LogFloat(user_offsets[0]);
                }
                if (user_offsets[0] != 0.0)
                {
                    if (user_offsets[0] < 1.0 && user_offsets[0] > -1.0)
                    {
                        A_WeaponOffset(user_offsets[0],0,WOF_ADD);
                        user_offsets[0] = 0;
                    }
                    else if (user_offsets[0] < 0.0)
                    {
                        A_WeaponOffset(user_offsets[0],0,WOF_ADD);
                        user_offsets[0] += 1.0;
                    }
                    else if (user_offsets[0] > 0.0)
                    {
                        A_WeaponOffset(user_offsets[0],0,WOF_ADD);
                        user_offsets[0] -= 1.0;
                    }
                }
            }
            else
            {    A_SetTics(35);    }
        }
        Loop

Top