PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => Console/Mobile Game Development => Topic started by: Sadler on January 03, 2013, 04:28:08 AM

Title: Article on programming the Saturn in 1995
Post by: Sadler on January 03, 2013, 04:28:08 AM
Ran across this article on programming the Saturn (http://cowboyprogramming.com/2010/06/03/1995-programming-on-the-sega-saturn/) in 1995. Thought it was pretty interesting so I figured I'd share it here. :D
Title: Re: Article on programming the Saturn in 1995
Post by: _joshuaTurbo on January 04, 2013, 08:06:03 AM
/**************************************************************/
/* 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 */
    }

  }

}

I always heard that the Saturn was hard to program for... but damn.
Title: Re: Article on programming the Saturn in 1995
Post by: nodtveidt on January 04, 2013, 07:07:39 PM
Meh, that's pretty basic stuff right there... very clean, standard C. The code in question is clearly a state controller with some very basic math. I'm more puzzled by the fact that the forum says "Quote from: Saturn Assembly on September 16, 1973, 04:56:45 PM"... 1973? ...really?
Title: Re: Article on programming the Saturn in 1995
Post by: SignOfZeta on January 04, 2013, 07:18:59 PM
The Saturn is OG.

I thought you knew...
Title: Re: Article on programming the Saturn in 1995
Post by: _joshuaTurbo on January 08, 2013, 07:22:34 AM
Meh, that's pretty basic stuff right there... very clean, standard C. The code in question is clearly a state controller with some very basic math. I'm more puzzled by the fact that the forum says "Quote from: Saturn Assembly on September 16, 1973, 04:56:45 PM"... 1973? ...really?

LOL I was screwing around with this bit of the 'quote' section= date=1357373259

Not sure how to make it go to 1995 or 1996.  :P
Title: Re: Article on programming the Saturn in 1995
Post by: Necromancer on January 08, 2013, 08:31:57 AM
Learn to tell time, a$$hole!

 :mrgreen:
Title: Re: Article on programming the Saturn in 1995
Post by: Arkhan on January 08, 2013, 08:42:12 AM
Meh, that's pretty basic stuff right there... very clean, standard C. The code in question is clearly a state controller with some very basic math. I'm more puzzled by the fact that the forum says "Quote from: Saturn Assembly on September 16, 1973, 04:56:45 PM"... 1973? ...really?


LOL I was screwing around with this bit of the 'quote' section= date=1357373259

Not sure how to make it go to 1995 or 1996.  :P



That's Epoch time.


http://www.epochconverter.com/


GET SOME, BITCH
Title: Re: Article on programming the Saturn in 1995
Post by: spenoza on January 19, 2013, 03:22:01 AM

I always heard that the Saturn was hard to program for... but damn.

Looks pretty clean to me. I don't necessarily follow all of it, but the comments help clear much of it up. The Saturn was hard to program for if you wanted optimized code that actually took advantage of its horsepower and features (which was in abundance, if you could figure out how to use it). If you're just programming something pretty basic it is likely just like any other system.