MCS' Coding Tips
                 "Success!"



  
How to enable more than 60 levels

   Written by MCS
   Tested by Quinnsey


   
Main Page

News

Wolfenstein 3D
Texture Library


MCS' Coding
Tips - "Success"!


Utilities

Spear
Resurrection


Wolfendoom

Wolf
Collection


Original Wolf 3D

Doom/Duke
maps


Other Stuff

Links

Questions?
Email us!
The original source code is limited to 60 levels. However, it's possible to expand this amount by making a few simple changes to the engine. In this example, I'll use the code of the "seamless level progression" tutorial, found on the main Codingtips page.
I'll show you how to add 4 extra levels, so the maximum will be 64. Using this method, you can add as many levels as you like, until you'll run out of memory (I tested things up to 120 levels without any problems so far).

1. Increasing the maximum number of maps

The maximum number of maps to be loaded by the cache manager has been limited to 60. To modify this, open
ID_CA.H and you'll see the very first line of code:

#define NUMMAPS  60
change this into
#define NUMMAPS  64

2. Adding extra map definitions

Open
MAPSWL6.H and scroll down until you see:

 
MAP4L10PATH_MAP,         // 60
  LASTMAP

 
Change this into

 
LEVEL61_MAP, 
  LEVEL62_MAP, 
  LEVEL63_MAP, 
  LEVEL64_MAP, 
  LASTMAP


3. Adding par times

Open
WL_INTER.C and do a search for

LRstruct LevelRatios[60];

Change this into

LRstruct LevelRatios[64];

Next, locate the line
// WOLFENSTEIN PAR TIMES
Scroll down until you reach the par time line for level 60, and add 4 extra lines like this:

{1, "01:00"}, // level 61
{1, "01:00"}, // level 62
{1, "01:00"}, // level 63
{1, "01:00"}, // level 64


4. Assigning music cues

Of course you want the new levels to have some music as well.
Open
WL_PLAY.C and locate these lines:

ULTIMATE_MUS, // Boss level
FUNKYOU_MUS


Just add four music cue names after these ones (mind the colon!)

5. Adding ceiling colors

Open
WL_DRAW.C and locate this block:

unsigned vgaCeiling[]=
{
#ifndef SPEAR
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xbfbf,
0x4e4e,0x4e4e,0x4e4e,0x1d1d,0x8d8d,0x4e4e,0x1d1d,0x2d2d,0x1d1d,0x8d8d,
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x1d1d,0x2d2d,0xdddd,0x1d1d,0x1d1d,0x9898,

0x1d1d,0x9d9d,0x2d2d,0xdddd,0xdddd,0x9d9d,0x2d2d,0x4d4d,0x1d1d,0xdddd,
0x7d7d,0x1d1d,0x2d2d,0x2d2d,0xdddd,0xd7d7,0x1d1d,0x1d1d,0x1d1d,0x2d2d,
0x1d1d,0x1d1d,0x1d1d,0x1d1d,0xdddd,0xdddd,0x7d7d,0xdddd,0xdddd,0xdddd


Add extra code for the 4 extra levels here (again, mind the colon)

6. Adjusting the Tab-W level cheat

You might want to be able to warp to the extra levels as well.
Open
WL_DEBUG.C and do a search for

#ifndef SPEAR
   if (level>0 && level<61)

  
and change this into

#ifndef SPEAR
   if (level>0 && level<65)

  
If you have more than 99 levels, also make this modification:
esc = !US_LineInput (px,py,str,NULL,true,2,0);
should read
esc = !US_LineInput (px,py,str,NULL,true,3,0);

7. Adjusting the status bar display (99+ levels only)

If you want more than 99 levels, you might want the status bar to be able to display 3 level digits instead of two.
To do so, open
WL_AGENT.C and locate this line:

LatchNumber (2,16,2,gamestate.mapon+1);
and change into
LatchNumber (2,16,3,gamestate.mapon+1);

8. Adding the extra levels to your project data files.

Unfortunately, MapEdit cannot handle more than 60 levels. So you either have to use FloEdit's map editor, or you just can design your extra levels in a separate session of MapEdit, export the extra floors into separate floor files and reimport them into FloEdit's map editor using Flo's level import function. To do so, select the "User Defined" checkbox at connection time, and enter 64 levels and a unique extension. Also, don't forget to rename things back to WL6 after the import session. Please refer to FloEdit's helptext for more information about object types and importing levels.

CAUTION: once you successfully created a working GAMEMAPS file with more than 60 levels using the method described above, NEVER use MapEdit with this file again to make any modifications. If you do so, your extra maps will be LOST and cannot be retrieved anymore!!

An example of 120 levels can be downloaded
here (levels 61 up to 119 are all the same, you don't expect me to design 60 levels for demonstration purposes only, I hope :-) It's only there to show you that it actually works. You need the original Wolf data files to run it.
Just use the
Tab-W cheat or the tedlevel parameter to jump to the higher levels.

Success!
MCS