MCS' Coding Tips

Compiling the code for Spear of Destiny

   Written by MCS
   Tested by Quinnsey and BrotherTank

Main Page


Wolfenstein 3D
Texture Library

MCS' Coding
Tips - "Success"!





Original Wolf 3D


Other Stuff


Email us!
I first posted this tutorial in Yahoo's Spear of Destiny Fanclub in December 2000. Unfortunately, this club closed its doors some time ago, so I thought it would be good to repost it here.

Some things have been modified in order to reflect today's knowledge. I also tried to add some background information for those who are interested. If not, just follow the instructions and all should be good to go.

1. Modifying the version file

As you probably know, there were many versions of Wolf that use basically the same code (shareware, registered, Spanish and Japanese for instance). In the code, there are #IFDEF statements to determine between the different versions that the engine is dealing with.
At compile time, the compiler will extract the definitions for the version to use from the file
VERSION.H, which by default contains the definitions for the registered Wolf version.
Your source code package contains renamed version files for each type supported. Locate the file
SODVER.H, which must be used for compilation of Spear of Destiny.

Remove or rename the file VERSION.H and after that, rename SODVER.H to VERSION.H

The compiler  will now load the definitions for Spear of Destiny.

2. Removing the obsolete ReadThis referrals

The original Wolf had a Read This! feature. Spear of Destiny didn't. But for some odd reason, ID didn't remove some lines referring to it. To avoid compiler errors, we have to remove these lines manually.

Open WL_TEXT.C and remove the following lines:



As you might want to restore the ReadThis function in your Spear of Destiny addon, it might be wise just to comment out the lines mentioned above, so that they can be used later.
For more information, please check the
"Read This" tutorial in this section. It has been written for Wolf, but it should work for SOD as well.

In Wolf, the Readthis can be accessed from the menu, but also with the F1 key when you're in a game. To avoid the game to crash when pressing F1 in Spear, we have to disable its function for the time being.

Open WL_MENU.C and remove (or comment out) the following lines:

case sc_F1:
#ifdef SPEAR
  #ifdef GOODTIMES
goto finishup;

3. Correcting a genuine ID bug :-)

Yes, that's right. If you try to compile the SOD code as is, you will get a warning message. No big deal, but now we're here, we might as well correct it.

To get rid of the warning, do the following:

WL_ACT2.C and locate the A_Dormant function:

void A_Dormant (objtype *ob)

and make the following modifications in there:

"unsigned tile;" with "objtype *tile;"

Replace "if (tile<256)" with "if (tile && tile<objlist)"

The code should compile without any warnings now (and the function should be still functional)

4. Removing the Copy Protection.

The original Spear of Destiny is copy-protected. You had to answer some questions in order to gain access to the game. I assume you don't want this to be the case in your add-on.

a. To remove the copy protection routine:

Open WL_INTER.C and do a search for "Copy Protection"

If found, remove all lines beginning from the "#IFDEF SPEAR" right above, until end of file.

b. To remove the call to this routine:

Open WL_MAIN. C and do a search for "CopyProtection();

If found, remove the line.

5. Altering the signon screen.

When you execute your new Spear EXE, you will notice that you still get the red Wolf "signon screen" (the first screen with the hardware and memory indicators)
This is due to the fact that this screen is pre-compiled in
SIGNON.OBJ and cannot be altered in the source.
You can replace it by your own signon screen though. Please check the tutorial "Modifying the signon screen" in this section.
If you prefer to use the original blue Spear screen, you can download it

6. Altering the game palette.

Spear uses a color palette that's slightly different from Wolf's. If you browse through Spear's VSWAP, you'll notice that some sprite colors are screwed up.
You can download the Spear palette
here. Notice that if you use this palette, some graphics will still look ugly in FloEdit, but they'll look OK in the game.

Well, that's all. Good luck with your upcoming Spear addon :-)