Created
April 17, 2016 17:59
-
-
Save napolux/75be88db4512739e8e463730e330e301 to your computer and use it in GitHub Desktop.
Sega Saturn example code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**************************************************************/ | |
/* Trigger jumping if needed, also variable height jump logic */ | |
Man_JumpTrigger() | |
{ | |
if ( Man.JumpFudge ) | |
{ | |
Man.JumpFudge--; | |
} | |
if ( Man.Mode != M_Crouch || Man_StandingRoom() ) // ok if not crouched, or there is headroom | |
{ | |
if (Pad_Jump->Pressed) /* jump button pressed */ | |
{ | |
if ((Man.Contact || (Man.Mode == M_Hang) || Man.JumpFudge) && Pad_Jump->Triggered && !Man.Blocking) /* and not already jumping */ | |
{ | |
if (Man.Mode == M_Hang && Pad1.Down.Pressed) | |
{ | |
Man.Contact=0; | |
Man.Mode=M_Jump; | |
Man.AnimBase = LS_Jumping; /* Change base anim to jumping */ | |
Man_TriggerSeq(LS_Jump); /* start the jumping start anim */ | |
Man.YV.f = 0x10000; /* and have no YV */ | |
Man.Y.i += 4; /* and have no YV */ | |
} | |
else | |
{ | |
Pad_Jump->Triggered = 0; | |
if ( !JetPacCheat ) | |
Man.YV.f = -0x00080000; /* Initial jump speed */ | |
else | |
Man.YV.f = -0x00008000; // Initial speed in Jetpac mode | |
Man.Contact = 0; /* not on the ground any more */ | |
Man.JumpTime = 0; /* just started jumping */ | |
Man.AnimBase = LS_Jumping; /* Change base anim to jumping */ | |
Man_TriggerSeq(LS_Jump); /* start the jumping start anim */ | |
Man.XV.f+=Man.FlyVel; | |
if (Man.HangEnd && Man.Mode == M_Hang) // if hanging | |
{ // and on the end of a path | |
Man.HangEnd = 0; | |
Man.X.i += 12*Man.Facing; // the move past end of path | |
Man.JumpTime = -3; // bit more fixed v jump time | |
} | |
Man.Mode = M_Jump; /* change mode to jumping */ | |
} | |
} | |
else /* Already jumping */ | |
{ | |
if (Man.JumpTime++ < MaxJumpTime) /* Still in initial jump period */ | |
Man.YV.f -= 0x0005000; /* So can maintain jump YV */ | |
} | |
} | |
else /* jump button not pressed */ | |
{ | |
Man.JumpTime = MaxJumpTime+1; /* so can't alter YV again until landed */ | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment