ValveSoftware / halflife

Half-Life 1 engine based games
Other
3.72k stars 625 forks source link

Opposing Force Capture the Flag | Speed Powerup is disabled. #2103

Open djearthquake opened 5 years ago

djearthquake commented 5 years ago

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 commented 5 years ago

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

Finished AMXX patch.

djearthquake commented 5 years ago

The sound effect is also not firing.

SamVanheer commented 5 years ago

What do you mean by "forward"?

djearthquake commented 5 years ago

Player does not get the long jump.

agrastiOs commented 5 years ago

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

SamVanheer commented 5 years ago

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.

djearthquake commented 5 years ago

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.

SamVanheer commented 5 years ago

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.

tankalf commented 4 years ago

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

djearthquake commented 4 years ago

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

SamVanheer commented 4 years ago

@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.

tankalf commented 4 years ago

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...

djearthquake commented 4 years ago

@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.

SamVanheer commented 2 years ago

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.