halflife icon indicating copy to clipboard operation
halflife copied to clipboard

Opposing Force Capture the Flag | Speed Powerup is disabled.

Open djearthquake opened this issue 5 years ago • 14 comments

The OpFor CTF Jump Pack differs from the Half-Life Jump Pack in that this item (like all other OpFor CTF Power-Up items) can only be carried by one player at a time. At some point it stopped working.

djearthquake avatar Mar 07 '19 02:03 djearthquake

https://github.com/ValveSoftware/halflife/issues/1857 is a link to this issue.

Finished AMXX patch.

djearthquake avatar Jul 07 '19 16:07 djearthquake

The sound effect is also not firing.

djearthquake avatar Jul 13 '19 14:07 djearthquake

What do you mean by "forward"?

SamVanheer avatar Jul 17 '19 12:07 SamVanheer

Player does not get the long jump.

djearthquake avatar Jul 17 '19 12:07 djearthquake

The speed powerup doesn't give the player item_longjump when it should.

agrastiOs avatar Jul 17 '19 13:07 agrastiOs

This happens because at some point the Opposing Force player physics code was reverted to the vanilla Half-Life code. #1025 was caused by the same change.

This is where the missing code starts: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/pm_shared/pm_shared.c#L2570

It involves checking a second physics keyvalue jpj.

If you have the original code on file you should restore it, otherwise i can reverse engineer it from the WON version and provide you with a patch to match the original code. This code also checks a cvar sv_dmjumpsound and possibly other things so i'd need to compare it and extract the additions and changes.

SamVanheer avatar Jul 17 '19 14:07 SamVanheer

Sam, I do not have the source code as a consumer. That was a nasty rumor in the 1990's that it is all open source or something to that effect. Now I pinned this up it is also missing the sound effect to go with it as you noticed too. The other power_ups were unaffected so there very well might be something to pattern from what remains in the translations.

djearthquake avatar Jul 17 '19 15:07 djearthquake

My post was aimed at @mikela-valve. He indicated that the earliest source code Valve has on file already has prediction code in it, which might be too new to have this code in it as well.

SamVanheer avatar Jul 17 '19 15:07 SamVanheer

Hi guys, but there is a patch for this problem? Because with Opposing Force on steam, jump pack speed powerup still not working on Capture the Flag maps. Or can I make a mod to make it works again? Thanks

tankalf avatar Apr 04 '20 09:04 tankalf

Please read the thread again sir. Both questions have been answered already. Link to opensource patch. https://forums.alliedmods.net/showthread.php?t=317504

djearthquake avatar Apr 05 '20 03:04 djearthquake

@djearthquake please don't close the issue because it still exists in vanilla Op4. Mike added it to the milestone so it's still scheduled for a fix.

SamVanheer avatar Apr 05 '20 10:04 SamVanheer

Please read the thread again sir. Both questions have been answered already. Link to opensource patch. https://forums.alliedmods.net/showthread.php?t=317504

Thanks for your reply. Please excuse me, but I'm not a nerd in these. I read the forum link, and I found 2 files. But I didn't find any guide. What have I to do with these 2 files? amx_op4ctfix.sma and op4ctfix.sma ? Because I can't find files with the same name to overwrite in my Steam Gearbox install folder. Thanks a lot, and hope you can help me...

tankalf avatar Apr 05 '20 11:04 tankalf

@tankalf: Amxx is a metamod. That script is a plugin for it. @Solokiller: This is a duplicate to https://github.com/ValveSoftware/halflife/issues/1857.

djearthquake avatar May 14 '20 17:05 djearthquake

Note that in addition to the jump pack code being missing from the player physics code the code to play the jump sound is also missing.

So this code needs to be modified: https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/pm_shared/pm_shared.c#L2570-L2600

To do this:

qboolean cansuperjump = false, canjumppackjump = false;

// See if user can super long jump?
cansuperjump = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "slj")) == 1;
canjumppackjump = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "jpj")) == 1;

// Acclerate upward
// If we are ducking...
if ((0 != pmove->bInDuck) || (pmove->flags & FL_DUCKING) != 0)
{
	// Adjust for super long jump module
	// UNDONE -- note this should be based on forward angles, not current velocity.
	if ((cansuperjump || canjumppackjump) &&
		(pmove->cmd.buttons & IN_DUCK) != 0 &&
		(pmove->flDuckTime > 0) &&
		Length(pmove->velocity) > 50)
	{
		pmove->punchangle[0] = -5;

		for (i = 0; i < 2; i++)
		{
			pmove->velocity[i] = pmove->forward[i] * PLAYER_LONGJUMP_SPEED * 1.6;
		}

		pmove->velocity[2] = sqrt(2 * 800 * 56.0);

		if (canjumppackjump)
		{
			pmove->PM_PlaySound(CHAN_STATIC, "ctf/pow_big_jump.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
		}
	}
	else
	{
		pmove->velocity[2] = sqrt(2 * 800 * 45.0);
	}
}
else
{
	pmove->velocity[2] = sqrt(2 * 800 * 45.0);
}

The sound is already precached in ClientPrecache.

Opposing Force also used to check for sv_dmjumpsound to play the sound for the regular long jump, but because synchronizing cvars to the client isn't really possible here that code can't be implemented properly. WON only checks the cvar on the server side.

As a workaround you could pass it as a physics info value, but that buffer is only so large so it could end up filled to capacity if too much gets added to it.

SamVanheer avatar Jan 23 '22 18:01 SamVanheer