Quake 2 Double Jump

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
ArchAngel
Posts: 37
Joined: Fri Jun 03, 2011 7:33 pm

Quake 2 Double Jump

Post by ArchAngel »

Ok I'm trying to code a double jump function in Quake 2 similar to what we see in Unreal Tournament (not just the physics exploit), however what I've got doesn't seem to work at all.

In pmove.c:

in pml_t -
Add -

Code: Select all

qboolean	doublejump;	//EGL Double Jump support
In PM_CheckJump
Change

Code: Select all

if (pm->groundentity == NULL)
  return;
to

Code: Select all

if (pm->groundentity == NULL)
	{
		if(pml.doublejump == false)	//EGL Double Jump
		{
			pml.doublejump = true;
			if(pml.velocity[2] > 0)	//Still rising?
			{
				if(pml.velocity[2] < 270)
					pml.velocity[2] = 270;
			}
		}
		return;		// in air, so no effect
	}
While the double jumping bit works fine, the check to see if we're already double jumping does nothing at all. I'm wondering if the pml struct is recreated per frame and so being wiped.

Any thoughts?

(Incidentally EGL has nothing to do with EGLQuake... them's just my initials)
ArchAngel
Posts: 37
Joined: Fri Jun 03, 2011 7:33 pm

Post by ArchAngel »

Fixed it :)

Code: Select all

if (pm->groundentity == NULL)
	{
		if(pm->s.pm_flags & PMF_DOUBLE_JUMP)	//EGL Double Jump
		{
			pm->s.pm_flags |= PMF_JUMP_HELD;
			pm->s.pm_flags  &= ~PMF_DOUBLE_JUMP;
			if(pml.velocity[2] > 0)	//Still rising?
			{
				if(pml.velocity[2] < 270)
					pml.velocity[2] = 270;
			}
		}
		return;		// in air, so no effect
	}

	pm->s.pm_flags |= PMF_JUMP_HELD;

	pm->groundentity = NULL;
	pml.velocity[2] += 270;
	if (pml.velocity[2] < 270)
		pml.velocity[2] = 270;
	pm->s.pm_flags |= PMF_DOUBLE_JUMP;
Barnes
Posts: 232
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow
Contact:

Post by Barnes »

nice :) i'm add this with dm flag option
Post Reply