Welcome to part four of our Special Edition Tutorials. This is a small interum tutorial which covers a couple of  bugs in the previous installments. First off it adjusts the Gamma when using the Direct3D driver so it will no longer appear greyscale(I apologize for this one, I never used the D3D drivers, I was using Glide). Second and most importantly we will add a simple one line routine that will allow us to actually move in the direction that we are facing(rather than always moving straight ahead).

This are both simple one line additions and both take place inside of your rpg.c file.

First off go to around line 80 and edit your code to look something like this: (Yellow = Changes):

//tell Genesis the use our selected video Driver in our selected video mode
if (!geEngine_SetDriverAndMode(Engine, Driver, Mode)) {
MessageBox(NULL,"Set Driver/Mode failed","Error",MB_OK);
_exit(-1);
}
geEngine_SetGamma(Engine, 1.0f);
//create a world object from a BSP file. Of course you'll need to edit the path.

World = geWorld_Create("maps\\genvs.bsp");

The "greyscale" appearance resulted from the Gamma being set to an obsenely high 50.0f(the highest the gamma can actually go is 3.0f). Setting it to 1.0 returns it to the default value.

Next we need to modify our code so that we will move in the direction that we are facing. Venture to around line 320 and you modify your code to look something like this:

// Execute any movement that may have taken place.

    oldpos = Xform.Translation;   //old position
        newpos = Xform.Translation;   //new position

        geXForm3d_SetYRotation(&Xform,Angles.Y); //which way are we facing?
        geXForm3d_GetIn(&Xform,&In); //get forward vector
        geVec3d_MA(&oldpos,forwardspeed,&In,&newpos); //Move

        Result=geWorld_Collision(World,&Mins,&Maxs,&oldpos,&newpos,GE_COLLIDE_MODELS,0xffffffff,&Collision); //checks for collision

Well there you have it. Two lines of code and our tutorial is much improved. Until the next tutorial, enjoy!

As always you can send comments or suggestions for this tutorial to erasmushurt@earthlink.net.

[Hyperlinkleisten stehen in diesem Web nicht zur Verfügung]