(Old basic code tutorial) Adding Godmode and Noclip Cheats from Wolf Planet forum

View previous topic View next topic Go down

(Old basic code tutorial) Adding Godmode and Noclip Cheats from Wolf Planet forum

Post by Officer-M. John (Admin) on Fri Nov 25, 2016 11:58 am

This is two tutorials I wrote up for my first forum, and thought I'd put them here for any n00bs:

------------------------------------------------------------------

Enabling the NoClip Debug cheat

For those who like playing with debug mode, this is how to enable the NoClip function for Wolfenstein.

Open WL_DEBUG.C and do a search for "noclip". You should get this:

Code:

#ifdef SPEAR
   else if (Keyboard[sc_N])         // N = no clip
   {
      noclip^=1;
      CenterWindow (18,3);
      if (noclip)
         US_PrintCentered ("No clipping ON");
      else
         US_PrintCentered ("No clipping OFF");
      VW_UpdateScreen();
      IN_Ack ();
      return 1;
   }
#endif

To enable it, simply delete the "#ifdef SPEAR" and "#endif" statements.

Code:

else if (Keyboard[sc_N])         // N = no clip
   {
      noclip^=1;
      CenterWindow (18,3);
      if (noclip)
         US_PrintCentered ("No clipping ON");
      else
         US_PrintCentered ("No clipping OFF");
      VW_UpdateScreen();
      IN_Ack ();
      return 1;
   }

How about enabling NoClip as a normal cheat? Simply open WL_PLAY.C and search for "MLI". You should get the following:

Code:

   //
   // SECRET CHEAT CODE: 'MLI'
   //
   if (Keyboard[sc_M] &&
      Keyboard[sc_L] &&
      Keyboard[sc_I])
   {
      gamestate.health = 100;
      gamestate.ammo = 99;
      gamestate.keys = 3;
      gamestate.score = 0;
      gamestate.TimeCount += 42000L;
      GiveWeapon (wp_chaingun);

      DrawWeapon();
      DrawHealth();
      DrawKeys();
      DrawAmmo();
      DrawScore();

Above this cheat, type the following:

Code:

   //
   // SECRET NOCLIP CHEAT
   //
   if (Keyboard[sc_J] &&      //You can customize these
      Keyboard[sc_K] &&   //keys to suit your needs
      Keyboard[sc_L])      //in your code.

   {
      noclip^=1;
      CenterWindow (18,3);
      if (noclip)
         US_PrintCentered ("No clipping ON");   //You may customize this message
      else
         US_PrintCentered ("No clipping OFF");   //You may customize this message
      VW_UpdateScreen();
      IN_Ack ();
      return 1;
   }

When you compile, you may get a warning which reads that such and such can't return a value, but you just ignore that. Now when in the game, pressing the keys JKL will activate NoClip mode, allowing you to go through walls!

~~~~~~~~~~~~~~~~~~~~

Activating the God Mode cheat in Wolfenstein.

In Spear of Destiny, pressing TAB-G-F10 activated GodMode. This cheat was not available in the original, so here's how to activate it.

Open up WL_PLAY.C and search for godmode until you get this:

Code:

#ifdef SPEAR
   //
   // SECRET CHEAT CODE: TAB-G-F10
   //
   if (Keyboard[sc_Tab] &&
      Keyboard[sc_G] &&
      Keyboard[sc_F10])
   {
      WindowH = 160;
      if (godmode)
      {
         Message ("God mode OFF");
         SD_PlaySound (NOBONUSSND);
      }
      else
      {
         Message ("God mode ON");
         SD_PlaySound (ENDBONUS2SND);
      }

      IN_Ack();
      godmode ^= 1;
      DrawAllPlayBorderSides ();
      IN_ClearKeysDown();
      return;
   }
   #endif

"#ifdef SPEAR" means that the cheat is only active in Spear of Destiny. To fix this, simply delete or comment out "#ifdef SPEAR" and "#endif". Now the cheat is accessable in Wolfenstein.

Before you compile, you will have to change the sounds used in this code; namely "NOBONUSSND" and "ENDBONUS2SND" as they are only available in Spear of Destiny. I would change them to "BONUS1SND" and "BONUS2SND". The code would now look like this:

Code:

   //
   // SECRET CHEAT CODE: TAB-G-F10
   //
   if (Keyboard[sc_Tab] &&
      Keyboard[sc_G] &&
      Keyboard[sc_F10])
   {
      WindowH = 160;
      if (godmode)
      {
         Message ("God mode OFF");
         SD_PlaySound (BONUS1SND);
      }
      else
      {
         Message ("God mode ON");
         SD_PlaySound (BONUS2SND);
      }

      IN_Ack();
      godmode ^= 1;
      DrawAllPlayBorderSides ();
      IN_ClearKeysDown();
      return;
   }

Now, the last thing you can do is customize the messages and buttons to activate godmode. In this next example I have changed the code to G-O-D and customized the message to read "You're invincible!". It now looks like this:

Code:

//
   // SECRET CHEAT CODE: G-O-D   You don't need to change this line
   //
   if (Keyboard[sc_G] &&
      Keyboard[sc_O] &&
      Keyboard[sc_D])
   {
      WindowH = 160;
      if (godmode)
      {
         Message ("You're gonna die!");   //you're custom message
         SD_PlaySound (BONUS1SND);
      }
      else
      {
         Message ("You're Invincible!");   //you're custom message
         SD_PlaySound (BONUS2SND);
      }

      IN_Ack();
      godmode ^= 1;
      DrawAllPlayBorderSides ();
      IN_ClearKeysDown();
      return;
   }

Save, compile, and play. Simple.

--------------------------------------------------------

I hope this helps someone learn more about the code.

There you go
-Deathshead

Writte by Deathshead on Thu Apr 07, 2005 9:10 am
avatar
Officer-M. John (Admin)
Admin

Posts : 328
Join date : 2015-10-02
Age : 19

View user profile http://wolf3dfanboys.usersboard.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum