Skip to content

Added PM_CheckStuck hook to prevent non-native gameplay changes#578

Open
Tankfird wants to merge 1 commit intoYaLTeR:masterfrom
Tankfird:checkstuck-fix
Open

Added PM_CheckStuck hook to prevent non-native gameplay changes#578
Tankfird wants to merge 1 commit intoYaLTeR:masterfrom
Tankfird:checkstuck-fix

Conversation

@Tankfird
Copy link

The PM_PlayerMove hook was calling PM_CheckStuck() for bxt_fire_on_stuck check. The issue with this is the function tries to unstick the player every few frames using static int rgStuckLast[MAX_CLIENTS][2]; to keep track of the last offset to use. The call in the hook would sometimes cause it to take the path

i = PM_GetRandomStuckOffsets(pmove->player_index, pmove->server, offset);
VectorAdd(base, offset, test);
if ( ( hitent = pmove->PM_TestPlayerPosition ( test, NULL ) ) == -1 )
{
	//Con_DPrintf("Nudged\n");

	PM_ResetStuckOffsets( pmove->player_index, pmove->server );

	if (i >= 27)
		VectorCopy ( test, pmove->origin );

	return 0;
}
int PM_GetRandomStuckOffsets(int nIndex, int server, vec3_t offset)
{
 // Last time we did a full
	int idx;
	idx = rgStuckLast[nIndex][server]++;

	VectorCopy(rgv3tStuckTable[idx % 54], offset);

	return (idx % 54);
}

void PM_ResetStuckOffsets(int nIndex, int server)
{
	rgStuckLast[nIndex][server] = 0;
}

Which resets the rgStuckLast to 0 and normally return 0; would cause normal player movement code to run, this is skipped in the hook.

Ingame you can use bxt_ch_set_pos_offset 0 0 -0.1 with bxt_hud_velocity 1 while moving on the ground, normal stuck behavior you'll see velocity quickly get cleared out with just gravity in zvel. Currently with bxt loaded it might never reach that and you'll maintain velocity while stuck. This may have affected some op4 speedruns as we use the rope to get stuck in the ground with velocity to then object boost for speed. Also may have allowed some other stuck tricks to work (tripmines, snarks, etc.), might desync some TAS.

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

Successfully merging this pull request may close these issues.

1 participant