Setup Guide for Chocolate Wolf 3D for Xcode6

Install SDL

Chocolate Wolf depends on the Simple DirectMedia Layer library. It is currently at version 2.x but the 1.x version is required. I used the following:

SDL-1.2.15.dmg: https://www.libsdl.org/download-1.2.php

SDL_mixer-1.2.12.dmg: http://www.libsdl.org/projects/SDL_mixer/release-1.2.html

Setup Chocolate Wolf

  1. Fork, clone or download Chocolate Wolf 3D
  2. Open project in Xcode6 macosx/Chocolate Wolfenstein 3D.xcodeproj
  3. Compile.. error: ld: library not found for -lSDL

Setup SDL linkage

First add SDL and SDL_Mixer frameworks using the plus icon under Linked Frameworks and Libraries as pictured below.

wolf-sdl-00.jpg

fig 1: add sdl frameworks

Next remove the linker flags set under Other Linker Flags as pictured below:

wolf-sdl-01.jpg

fig 2: remove linker flags

Now when you try to run the project, you should see the following output:

wolf-sdl-02.jpg

fig 3: run should work

Setup Run Scheme

Next setup the arguments we would like to pass to the command by creating a new run scheme.

wolf-sdl-04.jpg

fig 4: add new scheme and edit

wolf-sdl-03.jpg

fig 5: set options

Where is the Executable?

The executable is compiled to a directory path of the following form:

/Users/USERNAME/Library/Developer/Xcode/DerivedData/Chocolate_Wolfenstein_3D-UNIQUEID/Build/Products/Debug/Chocolate Wolfenstein 3D.app/Contents/MacOS/Chocolate Wolfenstein 3D

Running the executable from the command line produces this message:

NO WOLFENSTEIN 3-D DATA FILES to be found!

But running from Xcode gives the same help output like figure 3. What is going on?

Adding a breakpoint to SDLMain.m like the figure below will help us track down the issue:

wolf-sdl-05.jpg

Then run in Xcode, the debugger will pause at the breakpoint. Check process list via the terminal and we can see the problem:

~ ps -ef | grep Choco 501 30327 30328 0 3:10PM ?? 0:00.07 /Users/foo/Library/Developer/Xcode/DerivedData/Chocolate_Wolfenstein_3D-guawrtpzibctogdjzioueczpckkg/Build/Products/Debug/Chocolate Wolfenstein 3D.app/Contents/MacOS/Chocolate Wolfenstein 3D –res 1280 800 –windowed-mouse –tedlevel 2 –hard –nowait -NSDocumentRevisionsDebugMode YES

Problem is the argument: -NSDocumentRevisionsDebugMode YES

Remove breakpoint, edit scheme, uncheck "Document Revisions".

wolf-sdl-06.jpg

Run again and you should see:

NO WOLFENSTEIN 3-D DATA FILES to be found!

Buy Wolf3D

If you do not already own a copy, you can buy Wolfenstein 3D at 3DRealms website.

Install on a Windows machine or vm, once installed, find files with WL6 extension and copy files back to OSX:

AUDIOHED.WL6 CONFIG.WL6 MAPHEAD.WL6 VGAGRAPH.WL6 VSWAP.WL6 AUDIOT.WL6 GAMEMAPS.WL6 VGADICT.WL6 VGAHEAD.WL6

Put the files in the following path (yours will be slightly different):

/Users/USERNAME/Library/Developer/Xcode/DerivedData/Chocolate_Wolfenstein_3D-UNIQUEID/Build/Products/Debug/

Trying to run now, you should still get the same message:

NO WOLFENSTEIN 3-D DATA FILES to be found!

Configure Data Files

This is because the header version.h must be changed to reflect the version of Wolf3D data files you are using. For me, I bought mine from 3DRealms and needed to configure like:

/* Defines used for different versions */

//#define SPEAR
//#define SPEARDEMO
//#define UPLOAD
//#define GOODTIMES
#define CARMACIZED
//#define APOGEE_1_0
//#define APOGEE_1_1
//#define APOGEE_1_2

Update Data Files (Optional)

GitHub user @clobber suggests upgrading your data files. I'll include those instructions here:

"I'd like to recommend removing another possible headache from the setup process. ECWolf includes a patch utility that will patch your Wolf3D game files to the latest (final) version, the v1.4 GT/ID/Activision release. This way, if one wants to run Wolf3D but isn't quite sure which version their game files are, they can just use the patch utility and then set the following in version.h. Then everybody will be on the same version of Wolf3D without a doubt."

//#define SPEAR
//#define SPEARDEMO
//#define UPLOAD
#define GOODTIMES
#define CARMACIZED
//#define APOGEE_1_0
//#define APOGEE_1_1
//#define APOGEE_1_2
//#define JAPAN

It Works!

Running again in Xcode should work now, skipping intro and taking you straight to level 2, as we configured in figure 5.

wolf-sdl-07.jpg

You might first be interested in the game loop. Here is an example of adding a print statement into the game loop.

Good luck hacking!