Hexen source code

From DoomWiki.org

The Hexen source code, the C language files from which the HEXEN.EXE file can be generated by a compiler, were released in January, 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 Heretic source code.

Licensing[edit]

The Hexen 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.

Technical details[edit]

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 Hexen source as released is for the original MS-DOS version of the game, as most of the other existing ports of Hexen were to other architectures such as game consoles. As a result, the sources as released cannot be compiled without substantial modification to remove dangling calls to the DMX API.

The Hexen game engine is a direct modification of the Heretic code base, and retains most of the new functionalities added there while extending some of them further. Significant technological additions made by Raven to the Doom engine for Hexen include a hub save system allowing non-linear progress through interconnected sets of maps (similar systems would later be used in Strife and in id's own Quake 2); a C-language-based scripting language called ACS which allows for implementation of map- and hub-specific logic; a new extended map format with parameterized actions; the ability to move walls within the game world in the form of polyobjects; storage of data on maps, sounds, music, and sector sound sequences inside text script lumps; support for CD audio music; and a player class system, allowing the player to play as any one of three different characters. In addition, network gameplay capability was expanded to accommodate up to eight players.

Files[edit]

Files Description
a_action.c Additional action functions for non-enemy objects such as trees, pottery, suits of armor, earthquakes, etc.
am_data.h Two-dimensional line models for the automap, included into am_map.c
am_map.c, am_map.h Automap, retaining most modifications made in Heretic.
ct_chat.c, ct_chat.h Re-implementation of multiplayer chat, partially derived from Doom's hu_stuff.c
d_net.c System-independent networking code
defs.inc Watcom assembler header containing various macro definitions for rendering code
f_finale.c Finale screen code; entirely rewritten from Heretic, this is used only at the very end of the game.
g_game.c High-level game stuff: transitions between game states, level exits, main game event responder, setting up new games, demo recording
h2_main.c Main program module; initialization, main loop, command-line parameters, wad file loading, demo sequence.
h2def.h Constants used throughout the source code
i_cdmus.c, i_cdmus.h Support for playback of Redbook Audio CD music; DOS- and Watcom-specific code which requires the MSCDEX driver to be loaded.
i_cyber.c Code for interfacing with the Logitech CyberMan 3D mouse. This code was also used by the DOS version of Doom.
i_header.h Header for the low-level sound engine code, for both digital sound effects and music.
i_ibm.c 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.
i_ibm_a.asm x86 assembly for a division by zero exception handler which causes the error to be ignored, and low-level joystick interfacing.
i_sound.c, i_sound.h Additional system-dependent sound code; interface to the DMX library
in_lude.c Hexen intermission, for display of stats during deathmatch. Also handles inter-hub text message screens.
info.c, info.h Tables of data used by the game: sprite name table, thing data table, frame table. Generated by id's multigen tool from a script.
linear.asm x86 assembly versions of Doom core drawing routines R_DrawSpan and R_DrawColumn.
m_misc.c Miscellaneous functions: text rendering, configuration file loading, writing screenshots
mn_menu.c Hexen menu system, based on Heretic's.
p_acs.c Implementation of the ACS scripting system's bytecode interpreter.
p_anim.c Parsing of ANIMDEFS lump to obtain data on animated flats and textures; global animation of textures and lightning effects.
p_ceilng.c Ceiling movement
p_doors.c Door movement
p_enemy.c Monster AI
p_floor.c Floor movement
p_inter.c Object interaction: item pickup functions, object damage functions
p_lights.c Animated lights
p_local.h Global header for functions in the p_* section
p_map.c Object movement: collisions, teleportation, detecting for injury
p_maputl.c Library functions for p_map.c: blockmap code
p_mobj.c Basic object control functions: creating/destroying objects, movement, etc.
p_plats.c Lifts and platforms
p_pspr.c PSprite (weapon sprite) functions
p_setup.c Loading of map data and setup
p_sight.c 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.
p_spec.c, p_spec.h Special effects: texture animations, line triggers, floor/ceiling/lighting changes
p_switch.c Wall switches
p_telept.c Handling of teleporter lines
p_things.c Linedef and ACS script actions for manipulation of actors.
p_tick.c Base thinker code
p_user.c Player point-of-view code (weapon bobbing, player object thinker, etc.)
po_man.c Polyobjects
r_bsp.c BSP tree traversal
r_data.c Initialisation of data (textures, etc.) for use in the rendering code
r_draw.c Fast drawing functions
r_local.h Header containing declarations for all r_* modules; significantly larger than in the Doom source release.
r_main.c Entrypoint into rendering code
r_plane.c Rendering of planes (floor/ceilings)
r_segs.c Rendering of walls
r_things.c Rendering of sprites
sb_bar.c Hexen status bar and HUD code, based on Heretic's but with substantial modifications.
sc_man.c Generic text script parsing system used for MAPINFO, SNDINFO, ANIMDEFS, and other similar lumps.
sn_sonix.c Sound sequence engine for customization of sector sound behaviors; loading of SNDSEQ lump.
sounds.c, sounds.h Sound/music tables
soundst.h Declarations for the high-level sound and music code.
st_start.c, st_start.h Implementation of the graphical startup loading sequence, which replaced Heretic's text mode loading screen.
sv_save.c Reimplementation of saving and loading games, with support for the hub system.
tables.c Lookup tables for fast sine/cosine
textdefs.h String constants used throughout the source code.
v_video.c Generic image patch rendering (for menu, etc.)
w_wad.c WAD loading code
xddefs.h Basic data structures used to represent levels on disk, in Hexen's new map format.
z_zone.c Zone memory allocator

Non-source and obsolete files[edit]

Several non-source-code and obsolete source files were included with the Hexen source release.

Files Description
drcoord.h An Objective-C header file, probably from one of id's development tools such as DoomEd.
dstrings.h String constants formerly used throughout the game engine, including episode end texts. All are left over from Doom and Heretic. Redundant to the new file textdefs.h, which replaced it.
hex.lnk Linker directive file for Watcom's linker, to generate the executable from the compiled objects.
license.txt Copy of the official text of the GNU General Public License, version 2.0
m.bat DOS batch file used to run wmake, Watcom's make program, with up to nine arguments.
make.bat DOS batch file which simply runs wmake with no further arguments. Likely unused.
MAKEFILE Primary MAKEFILE for compiling, assembling, linking, and stripping the hexen.exe file, and appending the DOS extender stub.
oldd_net.c An obsolete version of d_net.c left over from Heretic.
SourceReadme.txt Plain-text readme file stating the factuals of the source release by Activision and Raven.
t.bat DOS batch file for playtesting a fresh build of the game.
template.c A mostly empty C source code file with Raven's standard code header and section delimiters, as used in most of their new modules created for Hexen.
vgaview.h Another Objective-C header, probably part of id's development tool chain.
w.bat DOS batch file to run Wadlink
wadlink.wl Script for building the various versions of the Hexen IWAD using id's Wadlink tool

See also[edit]

External links[edit]