Doom source code oddities

From DoomWiki.org

Revision as of 20:33, 10 February 2018 by Ryan W (talk | contribs) (fix link to disambiguation page)


Doom lives up to its name in the source code. Here is a list of some stupid, useless and funny source code.

Doom source code

am_map.c

An odd string that had intrigued dehackers for a long time:

static fuck = 0;

// For debugging only
if (      fl->a.x < 0 || fl->a.x >= f_w
       || fl->a.y < 0 || fl->a.y >= f_h
       || fl->b.x < 0 || fl->b.x >= f_w
       || fl->b.y < 0 || fl->b.y >= f_h)
{
   fprintf(stderr, "fuck %d \r", fuck++);
   return;
}

doomdef.h

Guys, let's try to keep the programming language flamewars out of the main header files, okay?

// Defines suck. C sucks.
// C++ might sucks for OOP, but it sure is a better C.
// So there.
#define SCREENWIDTH  320

34 levels in Doom II?

// Game mode handling - identify IWAD version
//  to handle IWAD dependend animations etc.
typedef enum
{
  shareware,	// DOOM 1 shareware, E1, M9
  registered,	// DOOM 1 registered, E3, M27
  commercial,	// DOOM 2 retail, E1 M34
  // DOOM 2 german edition not handled
  retail,	// DOOM 1 retail, E4, M36
  indetermined	// Well, no IWAD found.
  
} GameMode_t;

d_englsh.h

Does someone care?

// The following should NOT be changed unless it seems
// just AWFULLY necessary

#define HUSTR_PLRGREEN  "Green: "
#define HUSTR_PLRINDIGO "Indigo: "
#define HUSTR_PLRBROWN  "Brown: "
#define HUSTR_PLRRED    "Red: "

d_main.c

Ever wondered where the -wart command line parameter got its name?

p = M_CheckParm ("-wart");
if (p)
{
    myargv[p][4] = 'p';     // big hack, change to -warp

    ...

dstrings.c

Mysterious "additional" messages found added to the list of "are you sure you want to quit?" messages:

char* endmsg[NUM_QUITMESSAGES+1]=
{
  // DOOM1
  QUITMSG,
  "please don't leave, there's more\ndemons to toast!",
  ...
 
  // QuitDOOM II messages
  "you want to quit?\nthen, thou hast lost an eighth!",
  ...
 
  // FinalDOOM?
  "fuck you, pussy!\nget the fuck out!",
  "you quit and i'll jizz\nin your cystholes!",
  "if you leave, i'll make\nthe lord drink my jizz.",
  "hey, ron! can we say\n'fuck' in the game?",
  "i'd leave: this is just\nmore monsters and levels.\nwhat a load.",
  "suck it down, asshole!\nyou're a fucking wimp!",
  "don't quit now! we're \nstill spending your money!",
 
  // Internal debug. Different style, too.
  "THIS IS NO MESSAGE!\nPage intentionally left blank."
};

f_wipe.c

Can anyone optimize my ass?

// makes this wipe faster (in theory)
// to have stuff in column-major format
wipe_shittyColMajorXform((short*)wipe_scr_start, width/2, height);
wipe_shittyColMajorXform((short*)wipe_scr_end, width/2, height);

hu_stuff.c

if (showMessages || message_dontfuckwithme)
{
   // display message if necessary
   if ((plr->message && !message_nottobefuckedwith)
       || (plr->message && message_dontfuckwithme))
   {
       HUlib_addMessageToSText(&w_message, 0, plr->message);
       plr->message = 0;
       message_on = true;
       message_counter = HU_MSGTIMEOUT;
       message_nottobefuckedwith = message_dontfuckwithme;
       message_dontfuckwithme = 0;
   }
} // else message_on = false;

i_sound.c

Is this even supposed to work?

int I_SoundIsPlaying(int handle)
{
    // Ouch.
    return gametic < handle;
}

i_video.c

//
// I_StartFrame
//
void I_StartFrame (void)
{
    // er? 
}
//
// I_UpdateNoBlit
//
void I_UpdateNoBlit (void)
{
    // what is this?
}

p_door.c

// UNUSED
// Separate into p_slidoor.c?

#if 0           // ABANDONED TO THE MISTS OF TIME!!!
//
// EV_SlidingDoor : slide a door horizontally
// (animate midtexture, then set noblocking line)
//

r_defs.h

Does anyone know?

//
// Now what is a visplane, anyway?
//
typedef struct
{
...
} visplane_t;

r_draw.c

It's a good idea to document magic numbers before you forget what they mean.

// ?
#define MAXWIDTH			=1120;
#define MAXHEIGHT			=832;

r_main.c

What the Doom coders think about using the ASCII character 0x08 (cursor to left), used in the loading bar. Remember this line? "R_Init: Init DOOM refresh daemon - [................................................]"

//	Really complex printing shit...

r_plane.c

What is so important that it should only be executed at game startup?

//
// R_InitPlanes
// Only at game startup.
//
void R_InitPlanes (void)
{
  // Doh!
}

st_stuff.c

Someone thinks the cheats in the source code are not obfuscated enough.

// Massive bunches of cheat shit
//  to keep it from being easy to figure them out.
// Yeah, right...

So that is what the cheat code for no-clipping means...

// Smashing Pumpkins Into Samml Piles Of Putried Debris. 
unsigned char	cheat_noclip_seq[] =
{
    0xb2, 0x26, 0xea, 0x2a, 0xb2,	// idspispopd
    0xea, 0x2a, 0xf6, 0x2a, 0x26, 0xff
};

wi_stuff.c

for (i=0;i<a->nanims;i++)
{
    // MONDO HACK!
    if (wbs->epsd != 1 || j != 8) 
    {
        // animations
        sprintf(name, "WIA%d%.2d%.2d", wbs->epsd, j, i);  
        a->p[i] = W_CacheLumpName(name, PU_STATIC);
    }
    else
    {
        // HACK ALERT!
        a->p[i] = anims[1][4].p[i]; 
    }
}

z_zone.c

//      Zone Memory Allocation, perhaps NeXT ObjectiveC inspired.
//	Remark: this was the only stuff that, according
//	 to John Carmack, might have been useful for
//	 Quake.


Heretic source code

i_sound.c

The Raven Software coders were not very happy with how they had to work through the sound code:

// Why PC's Suck, Reason #8712

They also objected to the MUS format's lack of considerations towards the MIDI standard:

//  snd_MaxVolume = 127;
//Damn you, Dave Taylor!