Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snarks have their movetype changed to MOVETYPE_BOUNCE unconditionally when not in water #3175

Open
SamVanheer opened this issue Nov 28, 2021 · 1 comment

Comments

@SamVanheer
Copy link

SamVanheer commented Nov 28, 2021

The snark has an incorrect if statement here:

// float
if (pev->waterlevel != 0)
{
if (pev->movetype == MOVETYPE_BOUNCE)
{
pev->movetype = MOVETYPE_FLY;
}
pev->velocity = pev->velocity * 0.9;
pev->velocity.z += 8.0;
}
else if (pev->movetype = MOVETYPE_FLY)
{
pev->movetype = MOVETYPE_BOUNCE;
}

This conditional check changes the value of the movetype to MOVETYPE_FLY and then immediately after that to MOVETYPE_BOUNCE.

The intended behavior of this code is to restore the Snark's movetype to bounce when it leaves water, but only if its previous movetype was fly.

Although the Snark's behavior is still correct barring changes to the movetype from outside the Snark's code, this check should be fixed so modders can safely change the movetype without having to deal with this overriding behavior.

The fix:

else if (pev->movetype == MOVETYPE_FLY)
{
	pev->movetype = MOVETYPE_BOUNCE;
}
@SamVanheer
Copy link
Author

This also applies to Opposing Force's Penguin grenade, since its code is a copy of the Snark.

SamVanheer added a commit to twhl-community/halflife-op4-updated that referenced this issue Dec 6, 2021
SamVanheer added a commit to twhl-community/halflife-unified-sdk that referenced this issue Jan 10, 2022
@SamVanheer SamVanheer reopened this Nov 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant