Compile prefer it’s 1992

August tenth, 2014
I’ve been tinkering with the vanilla supply code of Wolfenstein 3D from 1992. Although it
is greater than 20 years previous and has rotten for contemporary techniques, you may nonetheless compile it should you recreate the surroundings.
All you want is :
- Wolfenstein 3D supply code.
- DosBox.
- The Compiler Borland C++ 3.1.
- Wolfenstein 3D shareware (for the belongings).
Setup filesystem
Open a command line and create two folders, one for every DOS drive wanted:
cd ~ mkdir system cd system mkdir c mkdir a cd ~
Obtain
- Obtain Borland 3.1 to
system/a
. - Obtain Wolfenstein 3D supply code to
system/c
- Obtain VGA information to
system/c
(the aim of these is defined on the backside of this web page.
cd system/a curl -O http://fabiensanglard.web/Compile_Like_Its_1992/instruments/BCPP31.zip cd ../c curl -O http://fabiensanglard.web/Compile_Like_Its_1992/instruments/wolfsrc.zip curl -O http://fabiensanglard.web/Compile_Like_Its_1992/instruments/vgafiles.zip
Now now we have all of the information within the filesytem. Simply to test, sort:
cd .. discover ~/system
You must have the next :
/Customers/fabiensanglard/system /Customers/fabiensanglard/system/a /Customers/fabiensanglard/system/a/BCPP31.zip /Customers/fabiensanglard/system/c /Customers/fabiensanglard/system/c/vgafiles.zip /Customers/fabiensanglard/system/c/wolfsrc.zip
Decompress every part
cd ~/system/a unzip BCPP31.zip cd ~/system/c unzip vgafiles.zip unzip wolfsrc.zip
DosBox
Obtain and begin DosBox:
Mount
Mount the filesystem, one folder for every drive :
Z:/> mount c ~/system/c Z:/> mount a ~/system/a
Set up the compiler
Now’s time to put in Borland C++ 3.1 :
Z:> a: A:> cd BCPP31 A:> set up
Press enter when you choose the supply drive ( it ought to already be A drive )
Depart all of the default settings and choose “Begin Set up”:
The warnings will inform you that Microsoft home windows folder couldn’t be discovered however it’s not wanted anyway,
simply press Enter.
Set up Wolfenstein 3D supply code
We have now a system working and a compiler on it: Time to decompress (once more) the supply code.
A:> c: C:> cd C:> set up
Sort ‘C’
Preserve the default path: WOLFSRC
Y to create the listing.
Putting in !
Compiling
Begin Borland C++ 3.1:
C:> cd C:> cd borlandc C:> cd bin C:> bc.exe
After urgent OK, use the mouse or the shortcuts to Mission -> Open Mission ....WOLFSRCWOLF3D.PRJ
:
Choose Choices -> Directories and alter the worth as observe :
Embody Directories: C:BORLANDCINCLUDE Library Directories: C:BORLANDCLIB Ouptput Directories: OBJ Supply Directories: C:WOLFSRC
Let’s attempt to compile: Compile -> Construct All
We get an error: “Can not discover executable TASM”
Exit Borland C++, we have to set the PATH:
C:> CD .. C:> PATH=C:BORLANDCBIN C:> BC.EXE
Attempt to compile once more (Compile -> Construct All):
Compiling did work however the linking failed: “Unable to search out OBJ file” as a result of the trail of SIGNON.OBJ and GAMEPAL.OBJ in mistaken within the mission:
They’re marked in C:SOURCEWOLF
:
Delete them from the mission (Choose and the Projext -> Delete merchandise). Add them once more by way of PROJECT -> Add Merchandise… . Add WOLFSRCOBJSIGNON.OBJ
and WOLFSRCOBJGAMEPAL.OBJ
Attempt to compile once more by way of (Compile -> Construct All)
IT WORKED ! However will it run ?
Getting the belongings
Obtain the shareware model and even higher: Buy as full model on Wolfenstein 3D.
cd ~/system/c curl -O http://fabiensanglard.web/Compile_Like_Its_1992/instruments/1wolf14.zip unzip 1wolf14.zip
Return to DosBox and set up the sport to C:WOLF3D
.
C:> c: C:> cd C:> cd 1wolf14 C:1WOLF14> set up
After set up of the sport, copy the .EXE we simply compiled to the sport folder,
C:> c: C:> cd wolf3d C:WOLF3D> copy WOLF3D.EXE WOLF3D.OLD C:WOLF3D> copy ../WOLRSRC/WOLF.EXE .
Working the sport
Attempt to run it:
C:> cd wolf3d C:WOLF3D> copy WOLF3D.EXE WOLF3D.OLD C:WOLF3D> copy ../WOLRSRC/OBJ/WOLF3D.EXE . C:WOLF3D> WOLF3D.EXE
Hm, that appears bizarre…..
Uh…
What ?
I didn’t keep in mind it like that….
Okay one thing should be very mistaken right here !!
What occurred ?
It has to do with the manufacturing entry pipeline and the way they’re utilized by the engine.
When Adrian Carmack and Kevin Cloud have been completed crafting all of the graphic information, they used a instrument (IGRABed) to pack them collectively.
The output was made of three+2 information.
- VGAHEAD.WL1
- VGAGRAPH.WL1
- VGADICT.WL1
The VGAHEAD file is an index containing tips that could the VGAGRAPH the place the info is saved huffman compressed. VGADICT
accommodates the huffman dictionaries to decompress the info.
The 2 different information produced:
Are compiled into engine as seen within the following drawing :
What are the .H
and .EQU
information wanted for? In brief, to permit entry by identify. When IGRABed assembled all information
it could additionally create an enum with matching indices:
GRE.H
enum{ H_WOLFLOGOPIC GETPSYCHEDPIC L_GUYPIC . . } graphicnums
GRE.EQU
H_WOLFLOGOPIC = 0 GETPSYCHEDPIC = 1 L_GUYPIC = 2
This fashion when the engine requested a specific asset, it may use a logical identify (L_GUYPIC) as a substitute of a “magic quantity” (2).
Meaning the engine shipped with the indices of the pictures within the VGA information HARD-CODED. For the reason that belongings and
codebase developed after transport wolf3D shareware (with Spears of Future), the newly compiled sport indices don’t
match the placement within the authentic belongings information.
Working the sport (once more)
Luckily there’s a easy answer to this drawback: Someone regenerated the VGA belongings in order that they match the indices within the .H and .EQU
launched with the supply code. Simply copy these information (should you use the shareware belongings you’ll have to change the file extension from .WL6 to .WL1).
C:> copy C:vgafilesVGADICT.WL6 C:WOLF3DVGADICT.WL1 C:> copy C:vgafilesVGAGRAPH.WL6 C:WOLF3DVGAGRAPH.WL1 C:> copy C:vgafilesVGAHEAD.WL6 C:WOLF3DVGAHEAD.WL1
Let’s attempt once more:
C:WOLF3D> WOLF3D.EXE
It really works !!
But we’re will not be completed !
VGA framebuffer and display side ratio
It will not be apparent to those that by no means noticed the unique sport however the DosBox picture above will not be what individuals noticed in 1992.
The VGA framebuffer was 320×200 however the CRT displays had a facet ratio of 4:3. Which imply the framebuffer was stretched vertically
when despatched to the monitor. DosBox has an choice to compensate for that :
vi ~/Library/Preferences/DOSBox 0.74 Preferences [render] # frameskip: What number of frames DOSBox skips earlier than drawing one. # side: Do side correction, in case your output technique would not assist scaling this will sluggish issues down!. # scaler: Scaler used to enlarge/improve low decision modes. # If 'compelled' is appended, then the scaler shall be used even when the end result may not be desired. # Attainable values: none, normal2x, normal3x, advmame2x, advmame3x, advinterp2x, advinterp3x, ... frameskip=0 side=false scaler=normal2x
Change that side to true:
Strive once more :
C:WOLF3D> WOLF3D.EXE
Lastly, IT WORKS !
Advisable Readings
Â
@