Heretic source code
The Heretic source code, the C language files from which the HERETIC.EXE file can be generated by a compiler, were released on January 11, 1999, by Kenn Hoekstra of Activision, acting in concert with Raven Software, shortly following the release of the Doom source code by John Carmack of id Software. It was simultaneously released with the Hexen source code.
The Heretic source was initially released under a standard Activision EULA which limited the legal ability of many source ports, particularly those which had transitioned to the GNU General Public License in late 1999, to use the code. This was later corrected in a re-release by James Monroe after a long campaign by the community to have the license changed.
Unlike the Doom source release, which was based on the Linux sources to avoid release of any of the proprietary DMX sound library's API or code, the Heretic source as released is for the original MS-DOS version of the game (Heretic itself was not ported to any other platforms, so there was little choice to be made in this matter). As a result, the sources as released cannot be compiled without substantial modification to remove dangling calls to the DMX API.
Significant technological additions made by Raven to the Doom engine for Heretic include translucency for sprites and screen patches, ambient sounds, the ability of the player to look up and down to a limited degree, and an inventory system. In addition, many modules were entirely rewritten with similar but different functionality, including the entirety of the menus, status bar, intermission, multiplayer chat system, HUD, save game code, and low-level video refresh.
It is of particular note that Heretic runs in a DOS planar video Mode 13h, as opposed to the tweaked non-planar Mode Y which was used by Doom. Both modes have an effective resolution of 320x200 with a physical aspect ratio of 4:3, but Mode 13h notoriously does not support page flipping, which can cause a perceived lower framerate.
Compared to the Doom source code, there is significant enjambment of unrelated functionality into single modules, and a severe lack of well-separated header files, resulting in a complete rebuild of the engine with even minor modifications to the code. It is believed the much improved state of the Doom source release by comparison was thanks to the work done by Bernd Kreimeier for his planned book release, and that as a result, the Heretic source release is a much better representation of what the Doom engine looked like in its most unadulterated form.
The released source code is for the final 1.3 version of Heretic and includes support for the Shadow of the Serpent Riders expansion which was added in that version.
File and function prefixes
Some files within the source code have one- or two-letter prefixes to denote their subsystem. Some functions also have one-, two-, or even three-letter prefixes.
- Automap code.
- Multiplayer chat code.
- Initialisation/general code.
- "Finale" (end of game) code.
- Main game loop/control.
- System-specific code.
- Intermission screen code.
- Miscellaneous code.
- Menu code.
- Game logic/behaviour.
- Rendering engine.
- Status bar.
- General graphic rendering.
- WAD file loading.
- Zone memory allocation system.
|Two-dimensional line models for the automap, included into am_map.c
|Automap; modified in particular to display keys on the easiest skill, and to draw a parallax scrolling parchment background.
|Re-implementation of multiplayer chat, partially derived from Doom's hu_stuff.c
|System-independent main function, and setup code; a notable addition is the text-mode startup LOADING screen similar to ENDOOM.
|System-independent networking code
|Watcom assembler header containing various macro definitions for rendering code
|Basic data structures used to represent levels on disk
|Constants used throughout the source code
|String constants used throughout the game engine, including episode end texts. Some texts are left over from Doom.
|Finale screen code; largely but not entirely rewritten from Doom
|High-level game stuff: transitions between game states, level exits, main game event responder, setting up new games, demo recording
|Code for interfacing with the Logitech CyberMan 3D mouse. This code was also used by the DOS version of Doom.
|Header for the low-level sound engine code, for both digital sound effects and music.
|Main entry point; sound and music; joystick, mouse, and keyboard code; low-level screen update and video mode initialization; DPMI and timer initialization; low-level networking. SNDCURVE lump is used here.
|x86 assembly for a division by zero exception handler which causes the error to be ignored, and low-level joystick interfacing.
|Additional system-dependent sound code; interface to the DMX library
|Heretic intermission, for display of player scores/frags and episode maps between levels. Completely original, not based on Doom's wi_stuff.c
|Tables of data used by the game: sprite name table, thing data table, frame table. Generated by id's multigen tool from a script.
|x86 assembly versions of Doom core drawing routines R_DrawSpan and R_DrawColumn.
|Miscellaneous functions: text rendering, configuration file loading, writing screenshots
|Heretic menu system. Completely original, not based on Doom's m_menu.c
|Object interaction: item pickup functions, object damage functions
|Global header for functions in the p_* section
|Object movement: collisions, teleportation, detecting for injury
|Library functions for p_map.c: blockmap code
|Basic object control functions: creating/destroying objects, movement, etc.
|Lifts and platforms
|PSprite (weapon sprite) functions
|Loading of map data and setup
|Line-of-sight/visibility checking for monsters. Highly notable for containing the faster but buggier LOS algorithm also used by Doom 1.2 and prior versions.
|Special effects: texture animations, line triggers, floor/ceiling/lighting changes
|Handling of teleporter lines
|Base thinker code
|Player point-of-view code (weapon bobbing, player object thinker, etc.)
|BSP tree traversal
|Initialisation of data (textures, etc.) for use in the rendering code
|Fast drawing functions. TINTTAB lump is used here.
|Header containing declarations for all r_* modules; significantly larger than in the Doom source release.
|Entrypoint into rendering code
|Rendering of planes (floor/ceilings)
|Rendering of walls
|Rendering of sprites
|Heretic status bar and HUD code. Completely new code, not based on Doom's st_stuff.c, st_lib.c, or hu_stuff.c. Also handles cheats.
|Declarations for the high-level sound and music code.
|Lookup tables for fast sine/cosine
|Generic image patch rendering (for menu, etc.)
|WAD loading code
|Zone memory allocator
Non-source and obsolete files
Several non-source-code and obsolete source files were included with the Heretic source release.
|A copy of the COLORMAP lump from the IWAD.
|A version of d_net.c with a comment from Chris Rhinehart. Unclear if this should be included when compiling rather than d_net.c.
|A copy of the DEMO1 lump from the IWAD.
|An Objective-C header file, probably from one of id's development tools such as DoomEd.
|Obsolete version of dstrings.h.
|Obsolete version of g_game.c.
|A DOS batch file used to playtest a fresh build of the game.
|hdemo1.lmp - hdemo3.lmp
|The three demos from the registered version of the IWAD.
|Configuration file for running the lint analysis tool on the source code.
|Obsolete version of in_lude.c.
|Copy of the official text of the GNU General Public License, version 2.0.
|DOS batch file used to run wmake, Watcom's make program, with up to nine arguments.
|Primary MAKEFILE for compiling, assembling, linking, and stripping the heretic.exe file, and appending the DOS extender stub.
|Yet two more obsolete versions of d_net.c.
|Plain-text readme file stating the factuals of the source release by Activision and Raven.
|Linker directive file for Watcom's linker, to generate the executable from the compiled objects.
|A debugging map file showing the compiled addresses of all symbols in the last build of heretic.exe as performed by Raven.
|A copy of the TINTTAB lump from the IWAD.
|Another Objective-C header, probably part of id's development tool chain.
|Scripts for building the various versions of the Heretic IWAD using id's wadlink tool.
- Doom source code
- Doom source code files
- Heretic source ports
- Hexen source code
- Raven source code licensing
- Strife source code
- The Heretic and Hexen source code on Sourceforge
- Unofficial repository on GitHub
- The recreation of various revisions of Heretic source code by gamesrc-ver-recreation on Bitbucket
- Staff (11 January 1999). "Heretic and Hexen source code release page." Raven Software website (archived 🏛). Retrieved 8 August 2023.