Doom source code oddities

Doom lives up to its name in the source code. Here is a list of some stupid, useless and funny 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.
 * 1) define SCREENWIDTH 320

d_englsh.h
Does someone care?

// The following should NOT be changed unless it seems // just AWFULLY necessary
 * 1) define HUSTR_PLRGREEN "Green: "
 * 2) define HUSTR_PLRINDIGO "Indigo: "
 * 3) define HUSTR_PLRBROWN "Brown: "
 * 4) 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_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? // // EV_SlidingDoor : slide a door horizontally // (animate midtexture, then set noblocking line) //
 * 1) if 0 // ABANDONED TO THE MISTS OF TIME!!!

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.

// ?
 * 1) define MAXWIDTH=1120;
 * 2) 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 charcheat_noclip_seq[] = { 0xb2, 0x26, 0xea, 0x2a, 0xb2,// idspispopd 0xea, 0x2a, 0xf6, 0x2a, 0x26, 0xff };

wi_stuff.c
for (i=0;inanims;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. C Graphic Codes