How to compile Jan Lonnberg's port of Ken's Labyrinth (LAB3D-SDL-2.1.zip) at the command prompt using VC6/VC7. Notes by Ken Silverman (01/07/2003) ------------------------------------------------------------------------------- Step 1. Make sure you have at least these files in your GAME directory: LAB-SDL makefile for VC6/VC7: MAKEFILE (see Step 4) LAB-SDL source: C files: LAB3D.C INIT.C GRAPHX.C SUBS.C SETUP.C ADLIBEMU.C OLDLAB3D.C H files: LAB3D.H ADLIBEMU.H Other files: KEN.RC KEN.ICO \SDL_H\*.* (see Step 2) Ken's Labyrinth data: All 6 KZP files and: HISCORE.DAT INSTS.DAT TABLES.DAT Other files used by SDL version: KSMMIDI.TXT SETTINGS.INI SDL files: SDL.LIB SDLMAIN.LIB SDL.DLL Step 2. Download SDL-devel-1.2.6-VC6.zip from http://www.libsdl.org & unzip. Copy/Move the .H files from SDL-1.2.6\include\*.* into "\SDL_H" (relative to the LABSDL source/game directory). Copy/Move *.LIB and *.DLL into the source/game directory. Step 3. Apply the following changes to the source code: LAB3D.H: insert this right before the #include : #define WIN32_LEAN_AND_MEAN #include LAB3D.H: Put the #ifndef...#endif around this: #ifndef _MSC_VER #include #endif LAB3D.H: Add this anywhere after the gl.h declaration: #ifndef GL_BGR #define GL_BGR GL_BGR_EXT #endif SUBS.C: comment out this harmless line to fix compiler warning: //owalnum = walnume; if (using VC6): { RPCNDR.H: (located somewhere in your Visual C include directory): Change all occurences of "source" to "Source". Change all occurences of "target" to "Target". } else if (using VC7): { MSXML.H: (located somewhere in your Visual C include directory): On lines 2206 and 2675: Change "target" to "Target" On lines 2207 and 2676: Change "data" to "Data" } I have no idea if the above is a VC bug or not. I suggest you make a backup of RPCNDR.H or MSXML.H before making my proposed changes. I don't know how it affects other applications, but it fixes the long list of compile errors for SETUP.C in Jan Lonnberg's code so I'm happy :) Step 4. Copy & paste the following text (between the dashes) to a file and save it as "makefile". Then put in in your Jan Lonnberg source code directory: #------------------------------------------------------------------------- #Makefile for VC6 or VC7. To compile, type: "nmake" at command prompt CFLAGS=/c /MD /ISDL_H /Os /Gs /G6fy /nologo labsdl.exe: lab3d.obj init.obj graphx.obj subs.obj setup.obj adlibemu.obj\ oldlab3d.obj icon.res; link /out:labsdl.exe lab3d init graphx subs\ setup adlibemu oldlab3d icon.res winmm.lib kernel32.lib user32.lib\ glu32.lib opengl32.lib glu32.lib ole32.lib shell32.lib sdlmain.lib\ sdl.lib uuid.lib /opt:nowin98 /entry:mainCRTStartup /subsystem:windows\ /nologo lab3d.obj : lab3d.c lab3d.h adlibemu.h; cl lab3d.c $(CFLAGS) init.obj : init.c lab3d.h adlibemu.h; cl init.c $(CFLAGS) graphx.obj : graphx.c lab3d.h ; cl graphx.c $(CFLAGS) subs.obj : subs.c lab3d.h adlibemu.h; cl subs.c $(CFLAGS) setup.obj : setup.c lab3d.h ; cl setup.c $(CFLAGS) oldlab3d.obj: oldlab3d.c lab3d.h ; cl oldlab3d.c $(CFLAGS) adlibemu.obj: adlibemu.c ; cl adlibemu.c $(CFLAGS) icon.res : ken.ico ken.rc ; rc /fo icon.res /r ken.rc #------------------------------------------------------------------------- Note about makefile: Please be aware that WIN98 doesn't come with the VC7 Run-time libraries, so if you use the /MD compiler option (which results in much smaller EXE's), people without VC7 may get "DLL not found" errors. Step 5: Change to the source directory and type "nmake"! You may need to set your VC environment (path, lib, include environment variables) so it's set up for compiling at the command line. If it isn't, you'll need to find VCVARS32.BAT (usually in your VC's \bin directory) and run it. Step 6. This step is optional. I like to compress the EXE using my favorite compressor: UPX. With "upx -9 labsdl.exe", I get: LABSDL.EXE = 87,040 bytes. (The size will vary depending on version of source or compiler options.) You can get the latest version here: http://upx.sourceforge.net -------------------------------------------------------------------------------