Genesis3D Programming - Genesis3D University is your resource for Genesis3D Game development



mainpage_menu.gif (4453 bytes)
2dart_menu.gif (3990 bytes)
3dmodeling_menu.gif (4513 bytes)
leveldesign_menu.gif (4781 bytes)
prog_menu.gif (4927 bytes)
yools_menu.gif (3923 bytes)
ref_menu.gif (4496 bytes)
links_meu.gif (4796 bytes)
forum_menu.gif (4089 bytes)
contact_menu.gif (4546 bytes)

Download 
Genesis3D v1.1

G3DU Forum

Official Forum


Free web hosting


Add
cheat codes
http://Welcome.to/Genesis3D-University 

 

Add Cheat Codes

After a couple of e-mails asking about this I wanted to post this.

It is only a small modification to the existing Gtest code.

This is just a basic way to read the user's input to the console,
and use that information to make decisions in the code.
There are better ways to do this but it works :) and will point
you in the right direction.





****At the beginning of Console.c after the other Includes add this****

#include "string.h"
char Cheats[21]; // Added for Cheat Codes


In Console.c (Console_ParseTokens)

****Replace with this Console_ParseTokens with this (of course make it what you want / add what you want)*****

//================================================================================
//Console_ParseTokens
//================================================================================
geBoolean Console_ParseTokens(Console_Console *Console)
{

char GODON[ ] = "MYGOD";
char GODOFF[ ] = "MYGODOFF";

int result, result2;

if (Console->CursorX <= 0)// Nothing to parse
{
return GE_TRUE;
}

//assuming you want more than one code to turn it on or off

result = _stricmp( Cheats, GODON );
result2 = _stricmp( Cheats ,GODOFF);

if(result == 0)
{
if (GodMode == GE_FALSE)
{
Console_Printf(Console, "GOD Mode Is On Cheater. \n");
GodMode = !GodMode;
}

else
{
Console_Printf(Console, "GOD Mode Is Still On Cheater. \n");

}

}

if(result2 == 0)
{
if (GodMode == GE_TRUE)
{
Console_Printf(Console, "GOD Mode Is Now Off. \n");
GodMode = !GodMode;
}
else
{
Console_Printf(Console, "GOD Mode Is Still Off. \n");
}

}


Console_Printf(Console, "\n");

return GE_TRUE;


}

****Replace this in (Console_KeyDown)****

//================================================================================
//Console_KeyDown
//================================================================================
geBoolean Console_KeyDown(Console_Console *Console, int32 Key, geBoolean Cmd)
{
assert(Console);
Cheats[Console->CursorX] = '\0';//Added for Cheat Codes

if (Key == VK_LEFT || Key == VK_RIGHT || Key == VK_UP || Key == VK_DOWN || Key == VK_ESCAPE)
return GE_TRUE;

if (Key == 33)// Page up
{
Console_Scroll(Console, -1, GE_FALSE);


return GE_TRUE;
}

else if (Key == 34)// Page down
{
Console_Scroll(Console, 1, GE_FALSE);


return GE_TRUE;
}
else if (Key == VK_RETURN || Key == '\n')
{
if (Console->CursorX <= 0)
return GE_TRUE;

if (Console->CursorY < Console->StopY-1)
Console->CursorY++;
else// When it gets to the bottom of the screen, start scrolling...
Console_Scroll(Console, 1, GE_TRUE);

Console->TextBuffer[Console->CursorPos] = '\n';
MoveCursorPos(Console, 1);

if (Cmd)

Console_ParseTokens(Console);

// Must set to 0 after parse tokens, so it can use it to see where we are in the
// buffer
Console->CursorX = 0;

return GE_TRUE;
}
else if (Key == VK_BACK)
{
if (Console->CursorX <= 0)
return GE_TRUE;

Console->CursorX--;
MoveCursorPos(Console, -1);

return GE_TRUE;
}
else if (Console->CursorX >= Console->StopX)// Too much on one line
return GE_TRUE;

//Console->TokenBuffer[Console->CursorX] = Key;
Console->TextBuffer[Console->CursorPos] = (char)Key;

Cheats[Console->CursorX] = (char)Key; //Added for Cheat Codes



Console->CursorX++;

MoveCursorPos(Console, 1);

return GE_TRUE;
}

****Change This In (Console_ToggleActive)****

//================================================================================
//Console_ToggleActive
//================================================================================
geBoolean Console_ToggleActive(Console_Console *Console)
{
assert(Console);

Console->Active = !Console->Active;
Console_Printf(Console, "\n"); //added for Cheat Codes (just clears a line when the console is pulled)

return GE_TRUE;
}


****Note:
If you want this for GodMode the you should also comment out this in Bot.c like this****


//if (GetAsyncKeyState('I') & 0x8000)
//{
//GodMode = !GodMode;
//GenVSI_ConsoleHeaderPrintf(VSI, DBot->ClientPlayer->ClientHandle, GE_TRUE, "God Mode %d", GodMode);
//}

****Also you may want to clean up all the messages that refer to Console_Printf in the other files that you find useless****

****End Changes****

This is just a basic GodMode cheat but it will allow you to modify the ParseTokens area in
a better code style and add more Cheats.

-Bob

*******


 

Get Genesis3D University on CD !

The Genesis3d UNIVERSITY [G3DU] CD 
Many tutorials, file downloads and more, all on one CD, imagine that! 
Over 530 megs of files!  Just look over all of this website, to  get an idea of the CD contents. 

To review the CD content and to Find out how to get yours.  HERE

******

 

 

 

To report "errors" and to post comments e-mail us at KenDeel@mail.com

This Website Created and Hosted by OtherWorlds InterActive.
Copyright (c)1999-2001 OtherWorlds InterActive 
All rights reserved.