DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

[Code] Motorbike/Motorcycle Tutorial by Kuki
Page 1 of 2 Goto page 1, 2  Next
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Kuki
Can I Play Daddy
Can I Play Daddy


Joined: 16 Mar 2003
Last Visit: 18 Jan 2010

Topics: 6
Posts: 43
Location: Torun/Olsztyn, Poland
poland.gif

PostPosted: Fri Nov 21, 2003 10:53 am
   Subject: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Here's a simple motorbike tutorial (mbike like the one in Project:Weltuntergang) I made some time ago. Maybe the code doesn't look great, (... blah blah blah ....) but it works (well, there may be a { missing somewhere, but I think I corrected it). Smile).Have fun!

Kuki

Open the WL_DEF.H file -add the lines in blue to the "gamestate" structure:

::: CODE :::

    boolean mbike;   // is the player riding on the mbike
    int motospeed;   // what's the bike's speed
    boolean left;    // are you turning left
    boolean right;   // are you turning right



Open the WL_GAME.C file - in the "SetupGameLevel" routine, add: (ADD LINES IN BLUE)

::: CODE :::

    if (!loadedgame)
    {
    gamestate.TimeCount=
    .
    .
    .
    gamestate.treasurecount=0;

    if (gamestate.mapon==0 && gamestate.episode==0) // first level, first episode
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
    }
    else
      gamestate.mbike=false;

    }
These lines set mbike to true, left & right to false and motospeed to 0 on certain level(s) (you set the levels you need the mbike to work on by modifying the above code).

Now Open WL_AGENT.C - in the "T_Player" routine add: (ADD LINES IN BLUE)
[ Use No Doors, Elevators, Secrets, Weapons, or Change Weapons while on the mbike ]
::: CODE :::
    if (gamestate.mbike!=true) {

   CheckWeaponChange();   
   if (buttonstate[bt_use]...
   .
   .
   .
   Cmd_Fire ();
     }


- in the "ControlMovement" Routine add: (the most improtant part - driving the bike) (LINES IN BLUE)

::: CODE :::
       
//
// side to side move
//

  if (gamestate.mbike!=true)      // no strafe on a mbike
  {

   if (buttonstate[bt_strafe])
   {
   //
   // strafing
   //
   //
      if (controlx > 0)
      {
         angle = ob->angle - ANGLES/4;
         if (angle < 0)
            angle += ANGLES;
   .
   .
   .
   .
   
      angle = ob->angle + ANGLES/2;
      if (angle >= ANGLES)
         angle -= ANGLES;
      Thrust (angle,controly*BACKMOVESCALE);      // move backwards
   }

  }
   else
   {
      if (controlx > 0)      // this section sets left & rigth to true/false depending on the keys that player presses
      {
      gamestate.left=true;
      gamestate.right=false;
      }
      else if (controlx < 0)
      {
      gamestate.left=false;
      gamestate.right=true;
      }
      else
      {
      gamestate.left=false;
      gamestate.right=false;
      }

      anglefrac += controlx*.5;      // turning - you may adjust this line and/or add some gamestate.motospeed dependencies
      angleunits = anglefrac/ANGLESCALE;
      anglefrac -= angleunits*ANGLESCALE;
      ob->angle -= angleunits;

      if (ob->angle >= ANGLES)
         ob->angle -= ANGLES;
      if (ob->angle < 0)
         ob->angle += ANGLES;

    if (controly > 0 )               // brakes
   {
   if (gamestate.motospeed>controly)
   gamestate.motospeed-=controly*2;
   else if (gamestate.motospeed>=0-controly)
   gamestate.motospeed=0;
   else
   gamestate.motospeed+=controly*2   
   SD_PlaySound (DIESND); //use some BRAKESND instead, this may cause problems, not well tested!!!
   }
    else if (controly < 0)            // accelerate
   {
    if (gamestate.motospeed<30000)
    gamestate.motospeed-=controly*.5;
    else
    gamestate.motospeed=30000;
    SD_PlaySound (HITWALLSND); //use some ENGINESND instead, this may cause problems, not well tested!!!
   }
    else   // no keys pressed - bike slowly reduces it's speed
   {
   if (gamestate.motospeed<0)
   gamestate.motospeed+=10;
   else if (gamestate.motospeed>0)
   gamestate.motospeed-=1;
   }
   Thrust (ob->angle,gamestate.motospeed);
    }


   if (gamestate.victoryflag)      // watching the BJ actor
      return;


- in the "TryMove" routine (kills an enemy when he's hit with big speed): (ADD LINES IN BLUE)
::: CODE :::

for (y=yl;y<=yh;y++)
      for (x=xl;x<=xh;x++)
      {
         check = actorat[x][y];
         if (check > objlist
         && (check->flags & FL_SHOOTABLE) )
         {
            deltax = ob->x - check->x;
            if (deltax < -MINACTORDIST || deltax > MINACTORDIST)
               continue;
            deltay = ob->y - check->y;
            if (deltay < -MINACTORDIST || deltay > MINACTORDIST)
               continue;

            if (gamestate.mbike==true && (gamestate.motospeed>=2000 || gamestate.motospeed<=-2000))   //adjust the speed to your liking
            {
            KillActor(actorat[x][y]);
            return true;
            }


            return false;
         }
      }

   return true;

- in the "DrawWeapon" routine we add to it the code below in Blue: (status bar weapon pic)

::: CODE :::
void DrawWeapon (void)
{
   if (gamestate.mbike!=true)
   StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);
   else
   StatusDrawPic (32,8,MBIKEPIC); // use your own picture

}


- in the "ClipMove" routine (what to do after mbike hits an object/wall with a certain speed) we add the lines in Blue:
::: CODE :::

if (noclip && ob->x > 2*TILEGLOBAL && ob->y > 2*TILEGLOBAL &&
   ob->x < (((long)(mapwidth-1))<<TILESHIFT)
   && ob->y < (((long)(mapheight-1))<<TILESHIFT) )
      return;      // walk through walls

   if (gamestate.mbike==true)
   {
      if (gamestate.motospeed<=200)      // very slow or backwards movement - just set the speed to 0
      gamestate.motospeed=0;
      else      // if we're riding faster... (you should add crash sound here, probably something like the sound stuff just below this "+" section. I didn't add it cause I have some problems with sound in Wolf and can't test it)
      {
         if (gamestate.motospeed>=5000) // take damage if you're driving really fast, damage depends on the speed
{
         TakeDamage (gamestate.motospeed/500, NULL);
      SD_PlaySound (EVASND); // use some CRASHSND of your creation instead
}
      gamestate.motospeed=-0.3*gamestate.motospeed; // bounce
      }      // so that you won't get into a wall
      ob->x=basex;
      ob->y=basey;
      return;
   }


   if (!SD_SoundPlaying())
      SD_PlaySound (HITWALLSND);


Open the WL_DRAW.C file - in the "DrawPlayerWeapon" routine (draws sprite appropriate to the side you're turning as the weapon in player's hands) add the lines in Blue:
::: CODE :::

#ifndef SPEAR
   if (gamestate.victoryflag)
   {
      if (player->state == &s_deathcam && (TimeCount&32) )
         SimpleScaleShape(viewwidth/2,SPR_DEATHCAM,viewheight+1);
      return;
   }
#endif
   if (gamestate.mbike == true)
   {
   if (gamestate.left == true)
   {
    SimpleScaleShape(viewwidth/2,SPR_CHAINATK1,viewheight+1); // change SPR_* here and below to your own ones
    return;
   }
   else if (gamestate.right == true)
   {
    SimpleScaleShape(viewwidth/2,SPR_KNIFEATK2,viewheight+1);
    return;
   }
    SimpleScaleShape(viewwidth/2,SPR_PISTOLATK3,viewheight+1);
    return;
   }


   if (gamestate.weapon != -1)
   {
      shapenum = weaponscale[gamestate.weapon]+gamestate.weaponframe;
      SimpleScaleShape(viewwidth/2,shapenum,viewheight+1);
   }

Save and Compile.... Add your new "MBIKEPIC" graphic as you would any other graphic (define in WL_DEF.H file). You should have a working MotorBike if all has gone well...
Hope you enjoyed it Smile
Kuki
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Sun Dec 21, 2003 12:41 pm
   Subject: Re: Motorbike tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've easily manage to get an item, fade out and then in so your on hte bike, but how would I

1) replace the player when he "gets on the bike"
2) have the image of the bike dissapear and then reappear when the player presses Enter which gets them off the bike

can anyone help?

_________________
~ James
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 15 Oct 2017

Topics: 22
Posts: 1281
Location: Rauma - Finland
finland.gif

PostPosted: Tue Dec 30, 2003 3:49 pm
   Subject: Re: Motorbike tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Set flag 'mbike' to TRUE and refresh the screen to make player ride the bike. And set it to FALSE and refresh the screen to make player walk.

I didn't read the tutorial so I'm only guessing... (Time is precious)

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
jamez
I am Death Incarnate
I am Death Incarnate


Joined: 16 Mar 2003
Last Visit: 13 Aug 2016

Topics: 13
Posts: 186
Location: Yorkshire, UK
uk.gif

PostPosted: Sun Jan 04, 2004 9:39 am
   Subject: Re: Motorbike tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

well duh Smile

lol

I easily made a object (a motor bike) which when you cross turns into a motor bike and you drive a way, then you come back to the object and you go back to walking, but using some spear code (spearx,speary,spearangle,spearflag;) i made it so you touch the motor bike and you move forward a few spaces, your on a bike and you got running over guards picking up objects etc... and if you want to quit press End and (using spear code) your back to the bike, i may modify this further although I dont know if this will be used in PVphase II

_________________
~ James
Kuki
Can I Play Daddy
Can I Play Daddy


Joined: 16 Mar 2003
Last Visit: 18 Jan 2010

Topics: 6
Posts: 43
Location: Torun/Olsztyn, Poland
poland.gif

PostPosted: Mon Jan 05, 2004 7:20 am
   Subject: Re: Motorbike tutorial
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It's nice to see people find this tutorial useful.

I always wanted to make a pickable mbike but newer found time to play with it... But I don't think it's very difficult. Good luck jamez!

Kuki
andy3012
DieHard Guard
DieHard Guard


Joined: 02 Jul 2004
Last Visit: 15 Feb 2008

Topics: 29
Posts: 292
Location: England
uk.gif

PostPosted: Fri Jul 16, 2004 11:42 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

you could make a grand feft auto type game, like you could use the locked door code, and make it when you try and use that certain vheicle you have to find the keys or something.
Dr. Chainsaw
DieHard Guard
DieHard Guard


Joined: 22 Aug 2005
Last Visit: 04 Apr 2013

Topics: 17
Posts: 286

uk.gif

PostPosted: Sun Nov 20, 2005 7:30 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

how do I make it so you can use the bike on more than one level?
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Sun Nov 20, 2005 10:08 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dr. Chainsaw wrote:
how do I make it so you can use the bike on more than one level?


Look way up.... At the top of the tutorial are the lines:

::: CODE :::

   if (gamestate.mapon==0 && gamestate.episode==0) // first level, first episode
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;
    }
    else
      gamestate.mbike=false;


This is where it says use on first level (gamestate.mapon-1) in the first episode (gamestate.episode - 1).

To change that to work on other levels.... try something like:

::: CODE :::

   if (gamestate.episode==0) // first episode
   switch (gamestate.mapon)
    case 0: // first level
        // Other Levels get added here as case statements (remember it's "espisode-1")
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
       break;
    }
    default:
       gamestate.mbike=false;
       break;


That should work and make it so that you can use it on any level.

BrotherTank
Dr. Chainsaw
DieHard Guard
DieHard Guard


Joined: 22 Aug 2005
Last Visit: 04 Apr 2013

Topics: 17
Posts: 286

uk.gif

PostPosted: Mon Nov 21, 2005 10:25 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I still can't get it to work.

was this what I was ment to do?

::: CODE :::
  if (gamestate.episode==0) // first episode
   switch (gamestate.mapon)
    case 0: // first level
        // Other Levels get added here as case statements (remember it's "espisode-1")
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
       break;
    }
    default:
       gamestate.mbike=false;
       break;
    case 1:
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
       break;
    }
    default:
       gamestate.mbike=false;
       break;
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Mon Nov 21, 2005 4:44 pm
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dr. Chainsaw wrote:
I still can't get it to work.

was this what I was ment to do?

::: CODE :::
  if (gamestate.episode==0) // first episode
   switch (gamestate.mapon)
    case 0: // first level
        // Other Levels get added here as case statements (remember it's "espisode-1")
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
       break;
    }
    default:
       gamestate.mbike=false;
       break;
    case 1:
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
       break;
    }
    default:
       gamestate.mbike=false;
       break;


Not quite.... You seem to have a problem with the case command.... it's done like this:

::: CODE :::

  if (gamestate.episode==0) // first episode
   switch (gamestate.mapon)  // Other Levels get added here as case statements (remember it's "espisode-1")
    case 0: // first level
    case 1: // Level 2 - Episode 1
    {
       gamestate.mbike=true;
       gamestate.motospeed=0;
       gamestate.left=false;
       gamestate.right=false;   
       break;
    }
    default:
       gamestate.mbike=false;
       break;


It's not that hard... really... need it on more than one episode??

::: CODE :::

  switch (gamestate.episode)
  {
      case 0: // Episode 1
      case 3: // Episode 4
      {
          switch (gamestate.mapon)  // Other Levels get added here as case statements (remember it's "espisode-1")
          {
              case 0: // first level
              case 1: // Level 2 - Episode 1
              {
                   gamestate.mbike=true;
                   gamestate.motospeed=0;
                   gamestate.left=false;
                   gamestate.right=false;   
                   break;
              }
              default:
                  gamestate.mbike=false;
                  break;
           }
      }
  }


BrotherTank
Dr. Chainsaw
DieHard Guard
DieHard Guard


Joined: 22 Aug 2005
Last Visit: 04 Apr 2013

Topics: 17
Posts: 286

uk.gif

PostPosted: Tue Nov 22, 2005 7:42 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

YES!! Too Cool Too Cool It works now. Thxs for your help!
Andrew
Bring 'em On
Bring 'em On


Joined: 30 Nov 2004
Last Visit: 16 Jun 2016

Topics: 14
Posts: 139
Location: Rhode Island
usa.gif

PostPosted: Sun Mar 19, 2006 8:51 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How do I add the the Status image to the game and how do i add the 3 pictures of the bike in the game?

_________________
You see homer you are suffering from PSI…
Poor Self Esteem… wait that’s not I that’s supposed to be an E
THE SIGN IS WRONG THEY ARE ALL WRONG!!!!
-The Simpsons
Dr. Chainsaw
DieHard Guard
DieHard Guard


Joined: 22 Aug 2005
Last Visit: 04 Apr 2013

Topics: 17
Posts: 286

uk.gif

PostPosted: Sun Mar 19, 2006 9:10 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just add a new image called MBIKEPIC like shown here;

::: CODE :::
void DrawWeapon (void)
{
   if (gamestate.mbike!=true)
   StatusDrawPic (32,8,KNIFEPIC+gamestate.weapon);
   else
   StatusDrawPic (32,8,MBIKEPIC); // use your own picture
}


To add the sprites just change this bit to have SPR_BIKE1,SPR_BIKE2,SPR_BIKE3 instead of CHAINATK etc...

::: CODE :::

 if (gamestate.mbike == true)
   {
   if (gamestate.left == true)
   {
    SimpleScaleShape(viewwidth/2,SPR_CHAINATK1,viewheight+1); // change SPR_* here and below to your own ones
    return;
   }
   else if (gamestate.right == true)
   {
    SimpleScaleShape(viewwidth/2,SPR_KNIFEATK2,viewheight+1);
    return;
   }
    SimpleScaleShape(viewwidth/2,SPR_PISTOLATK3,viewheight+1);
    return;
   }


Geek hope that helps...
Andrew
Bring 'em On
Bring 'em On


Joined: 30 Nov 2004
Last Visit: 16 Jun 2016

Topics: 14
Posts: 139
Location: Rhode Island
usa.gif

PostPosted: Sun Mar 19, 2006 9:15 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

oh no i was talking about adding my OWN like with FLO edit sorry if i wasnt clear on that Embarassed

_________________
You see homer you are suffering from PSI…
Poor Self Esteem… wait that’s not I that’s supposed to be an E
THE SIGN IS WRONG THEY ARE ALL WRONG!!!!
-The Simpsons
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Wed Jun 20, 2007 10:17 pm
   Subject: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

::: CODE :::
gamestate.motospeed=0;

Changing the value of this changes what?

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 13:41 ago.

Topics: 161
Posts: 8021
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Thu Jun 21, 2007 6:04 pm
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

AFAIK, any value above Zero will set bike in motion the moment you're on it. I'm not sure a direction for the bike to move is specified when you first appear on it, so I wouldn't mess around with the value unless you know how to tell the code what direction to point the bike when you've set it in motion.
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Thu Jun 21, 2007 9:48 pm
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm getting an error:
::: CODE :::

Undefined Symbol 'mbike'
Undefined Symbol 'motospeed'
Undefined Symbol 'left'
Undefined Symbol 'right'
Undefined Symbol 'mbike'

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Fri Jun 22, 2007 1:27 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Check to make sure that you added the lines in the tutorial that add them into the game... ie declare them... been a while since I looked at the tutorial... they may even get added to the gamestate variables in your wl_def.h file...

Either way... the error is saying they are missing and not declared.... The errror is similar to the one you had when you changed the scalers... and add Ripper's Removing the Scalers tutorial... remember those variables... same thing here... find the declarations and make sure you added them all...

Greg
BrotherTank
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Fri Jun 22, 2007 6:59 am
   Subject: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

so how do i define them? is it somthing different than what i did in the other topic? ("dumb noobie question")

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 1:42 ago.

Topics: 70
Posts: 3686

blank.gif

PostPosted: Fri Jun 22, 2007 7:12 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Open the WL_DEF.H file and add the lines to the gamestate structure:

::: CODE :::

    boolean mbike;   // is the player riding on the mbike
    int motospeed;   // what's the bike's speed
    boolean left;    // are you turning left
    boolean right;   // are you turning right[/color]
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Fri Jun 22, 2007 9:16 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I have this, its still not working...

::: CODE :::
//---------------
//
// gamestate structure
//
//---------------

typedef   struct
{
   int         difficulty;
   int         mapon;
   long      oldscore,score,nextextra;
   int         lives;
   int         health;
   int         ammo;
   int         keys;
   weapontype      bestweapon,weapon,chosenweapon;

   int         faceframe;
   int         attackframe,attackcount,weaponframe;

   int         episode,secretcount,treasurecount,killcount,
            secrettotal,treasuretotal,killtotal;
   long      TimeCount;
   long      killx,killy;
   boolean      victoryflag;      // set during victory animations
} gametype;


typedef   enum   {
   ex_stillplaying,
   ex_completed,
   ex_died,
   ex_warped,
   ex_resetgame,
   ex_loadedgame,
   ex_victorious,
   ex_abort,
   ex_demodone,
   ex_secretlevel
} exit_t;

boolean mbike;   // is the player riding on the mbike
    int motospeed;   // what's the bike's speed
    boolean left;    // are you turning left
    boolean right;   // are you turning right

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 1:42 ago.

Topics: 70
Posts: 3686

blank.gif

PostPosted: Fri Jun 22, 2007 9:19 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

::: CODE :::
//---------------
//
// gamestate structure
//
//---------------

typedef   struct
{
   int         difficulty;
   int         mapon;
   long      oldscore,score,nextextra;
   int         lives;
   int         health;
   int         ammo;
   int         keys;
   weapontype      bestweapon,weapon,chosenweapon;

   int         faceframe;
   int         attackframe,attackcount,weaponframe;

   int         episode,secretcount,treasurecount,killcount,
            secrettotal,treasuretotal,killtotal;
   long      TimeCount;
   long      killx,killy;
   boolean      victoryflag;      // set during victory animations
           
   boolean mbike;   // is the player riding on the mbike
   int motospeed;   // what's the bike's speed
   boolean left;    // are you turning left
   boolean right;   // are you turning right

} gametype;


typedef   enum   {
   ex_stillplaying,
   ex_completed,
   ex_died,
   ex_warped,
   ex_resetgame,
   ex_loadedgame,
   ex_victorious,
   ex_abort,
   ex_demodone,
   ex_secretlevel
} exit_t;


Try this.
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Fri Jun 22, 2007 9:22 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

2 more errors...
::: CODE :::

WL_agent.c 257 Statement Missing
WL_agent.c 608 Undefined Symbol 'Mbikepic'

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 1:42 ago.

Topics: 70
Posts: 3686

blank.gif

PostPosted: Fri Jun 22, 2007 9:33 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

You have to add another image (Mbikepic):

http://www.areyep.com/Codingtips/addimage.html

As for the other one, you missed an ; or a bracket somewhere.
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Fri Jun 22, 2007 9:38 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Does the image go before or after the pics that replace the gun that you are holding (the one above your HUD) and where in WL_Def do i put the new image definition? Isn't the adding new images for the first set of images (non sprites)

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 1:42 ago.

Topics: 70
Posts: 3686

blank.gif

PostPosted: Fri Jun 22, 2007 9:48 am
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The image doesn't need to be defined in WL_DEF.H. Have you taken a look at the link I posted? That's all you need for adding an image.
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Fri Jun 22, 2007 12:24 pm
   Subject: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

::: CODE :::
   GOTGATLINGPIC,                       // 131
      MUTANTBJPIC,                         // 132
      PAUSEDPIC,                           // 133
      GETPSYCHEDPIC,                       // 134
                NEWPIC,                              // 135
      NEW2PIC,              // 136
      NEW3PIC,              // 137

      ORDERSCREEN=139,
      ERRORSCREEN,                         // 137
      T_HELPART,                           // 138
      T_DEMO0,                             // 139
      T_DEMO1,                             // 140
      T_DEMO2,                             // 141
      T_DEMO3,                             // 142
      T_ENDART1,                           // 143
      T_ENDART2,                           // 144
      T_ENDART3,                           // 145
      T_ENDART4,                           // 146
      T_ENDART5,                           // 147
      T_ENDART6,                           // 148
      ENUMEND
        } graphicnums;

//
// Data LUMPs
//
#define README_LUMP_START      3
#define README_LUMP_END         9

#define CONTROLS_LUMP_START      10
#define CONTROLS_LUMP_END      42

#define LEVELEND_LUMP_START      43
#define LEVELEND_LUMP_END      85

#define LATCHPICS_LUMP_START      91
#define LATCHPICS_LUMP_END      137


//
// Amount of each data item
//
#define NUMCHUNKS    152
#define NUMFONT      2
#define NUMFONTM     0
#define NUMPICS      135
#define NUMPICM      0
#define NUMSPRITES   0
#define NUMTILE8     72
#define NUMTILE8M    0
#define NUMTILE16    0
#define NUMTILE16M   0
#define NUMTILE32    0
#define NUMTILE32M   0
#define NUMEXTERNS   13
//
// File offsets for data items
//
#define STRUCTPIC    0

#define STARTFONT    1
#define STARTFONTM   3
#define STARTPICS    3
#define STARTPICM    138
#define STARTSPRITES 138
#define STARTTILE8   138
#define STARTTILE8M  139
#define STARTTILE16  139
#define STARTTILE16M 139
#define STARTTILE32  139
#define STARTTILE32M 139
#define STARTEXTERNS 139
//


Still not working

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
ronwolf1705
Moderator
<B>Moderator</B>


Joined: 31 Jul 2006
Last Visit: 1:42 ago.

Topics: 70
Posts: 3686

blank.gif

PostPosted: Fri Jun 22, 2007 12:43 pm
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

You have to add Mbikepic after NEW3PIC, and change the numbers, as said in the tutorial.
Born4battle
DieHard SS
DieHard SS


Joined: 24 Mar 2006
Last Visit: 21 Jun 2014

Topics: 37
Posts: 388
Location: Cherry Chocolate Reign!!!
usa.gif

PostPosted: Fri Jun 22, 2007 3:23 pm
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

NEWPIC is supposed to be the Bike, am I needing 3 graphics total? or only one graphic

_________________
Thunderstorm "War is a conflict that does not determine who is right, but who is left." Thunderstorm
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

Topics: 153
Posts: 2255
Location: Ontario
canada.gif

PostPosted: Fri Jun 22, 2007 5:05 pm
   Subject: Re: [Code] Motorbike/Motorcycle Tutorial by Kuki
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

You need 1 Pic in the Vgagraph graphics listing for the Statusbar image.. like the other weapons... and then 3 pics in the vswap - aka the Spritelist in wl_def.h file. The vgagraph image should probably be inserted after the the chaingun image.

Then remove all the #define numbers and replace that code with this:

::: CODE :::

//
// Data LUMPs
//
#ifndef SPEAR  // Wolfenstein Data Lumps

   #define README_LUMP_START        (H_BJPIC) 
   #define README_LUMP_END          (C_OPTIONSPIC-1)

   #define CONTROLS_LUMP_START      (C_OPTIONSPIC)
   #define CONTROLS_LUMP_END        (L_GUYPIC-1)

   #define LEVELEND_LUMP_START      (L_GUYPIC)
   #define LEVELEND_LUMP_END        (STATUSBARPIC-1)

   #define LATCHPICS_LUMP_START     (KNIFEPIC)
   #define LATCHPICS_LUMP_END       (STARTTILE8-1)

#else // Spear Data Lumps

   #define BACKDROP_LUMP_START      (C_BACKDROPPIC)
   #define BACKDROP_LUMP_END        (C_CUSTOMIZEPIC-1)

   #define CONTROL_LUMP_START       (C_CUSTOMIZEPIC)
   #define CONTROL_LUMP_END         (C_OPTIONSPIC-1)

   #define OPTIONS_LUMP_START       (C_OPTIONSPIC)
   #define OPTIONS_LUMP_END         (C_OPTIONSPIC)

   #define SOUND_LUMP_START         (C_FXTITLEPIC)
   #define SOUND_LUMP_END           (C_HOWTOUGHPIC-1)

   #define NEWGAME_LUMP_START       (C_HOWTOUGHPIC)
   #define NEWGAME_LUMP_END         (C_DISKLOADING1PIC-1)

   #define LOADSAVE_LUMP_START      (C_DISKLOADING1PIC)
   #define LOADSAVE_LUMP_END        (HIGHSCORESPIC-1)

   #define HIGHSCORES_LUMP_START    (HIGHSCORESPIC)
   #define HIGHSCORES_LUMP_END      (C_WONSPEARPIC)

#ifndef SPEARDEMO
   #define ENDGAME_LUMP_START       (BJCOLLAPSE1PIC)
   #define ENDGAME_LUMP_END         (L_GUYPIC-1)
#endif

   #define LEVELEND_LUMP_START      (L_GUYPIC)
   #define LEVELEND_LUMP_END        (TITLE1PIC-1)

   #define TITLESCREEN_LUMP_START   (TITLE1PIC)
   #define TITLESCREEN_LUMP_END     (TITLE2PIC)

#ifndef SPEARDEMO
   #define ENDGAME1_LUMP_START      (ENDSCREEN11PIC)
   #define ENDGAME1_LUMP_END        (ENDSCREEN12PIC-1)

   #define ENDGAME2_LUMP_START      (ENDSCREEN12PIC)
   #define ENDGAME2_LUMP_END        (ENDSCREEN12PIC)

   #define EASTEREGG_LUMP_START     (IDGUYS1PIC)
   #define EASTEREGG_LUMP_END       (IDGUYS2PIC)

   #define COPYPROT_LUMP_START      (COPYPROTTOPPIC)
   #define COPYPROT_LUMP_END        (KNIFEPIC-1)
#endif
   #define LATCHPICS_LUMP_START     (KNIFEPIC)
   #define LATCHPICS_LUMP_END       (STARTTILE8 - 1)
#endif
//
// Amount of each data item
//
#define NUMCHUNKS                   (ENUMEND)
#define NUMFONT                     2
#define NUMPICS                     (STARTTILE8-3)
#define NUMTILE8                    72
//
// File offsets for data items
//
#define STRUCTPIC                   0
#define STARTFONT                   1
#define STARTPICS                   3

   #define NUMFONTM                 0
   #define NUMSPRITES               0
   #define NUMPICM                  0 
   #define NUMTILE8M                0
   #define NUMTILE16                0
   #define NUMTILE16M               0
   #define NUMTILE32                0
   #define NUMTILE32M               0
   #define NUMEXTERNS               (ENUMEND - STARTTILE8 + 1)
   #define STARTFONTM               3
   #define STARTPICM                (STARTTILE8)
   #define STARTSPRITES             (STARTTILE8)
   #define STARTTILE8               (STARTTILE8)
   #define STARTTILE8M              (STARTTILE8+1)
   #define STARTTILE16              (STARTTILE8+1)
   #define STARTTILE16M             (STARTTILE8+1)
   #define STARTTILE32              (STARTTILE8+1)
   #define STARTTILE32M             (STARTTILE8+1)
   #define STARTEXTERNS             (STARTTILE8+1)   


Greg
BrotherTank
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 2 Goto page 1, 2  Next
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2410 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 1733 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2003 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2734 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 609 Tue Jul 29, 2003 3:00 pm
Codetech84 View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group