Forum

Quake 2 Double Jump

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Quake 2 Double Jump

Postby ArchAngel » Sun Jun 26, 2011 4:03 pm

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

Postby ArchAngel » Sun Jun 26, 2011 7:06 pm

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;
ArchAngel
 
Posts: 37
Joined: Fri Jun 03, 2011 7:33 pm

Postby Barnes » Mon Jun 27, 2011 9:07 am

nice :) i'm add this with dm flag option
User avatar
Barnes
 
Posts: 226
Joined: Thu Dec 24, 2009 2:26 pm
Location: Russia, Moscow


Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest