User:Altazimuth/Code Guide

From Eternity Wiki
Jump to: navigation, search

Eternity's code is built up of .cpp (C++ source code) and .h (header) files split into various prefixes (though dependencies such as libpng may use regular C source files). Each one refers to specific facets of the code. Functions from these files will also be appropriately prefixed (note that the files have lower case prefixes, which functions have upper case).

Source File Classification
Prefix/Visual Studio Folder Name Meaning Explanation Further Reading
A_ Action Pointer Code Code and functions associated with actor states/frames List of codepointers
ACS_ ACS Code Code and functions that handle the loading and execution of Action Code Script ACS scripting
AM_ Automap Code Code and functions associated with the Automap Automap
AMX_ Small Code Code and functions to handle Small (DEPRECATED) Small
C_ Console Code Code and functions associated with the Console Console
Cam Camera Code Line of sight checking for cameras
Confuse libConfuse Code Code and functions associated with the libConfuse configuration file parser library
D_ Core Code Core engine code such as initialisation, main loop, and high-level netcode
doom Doom Code Files that came from the original Doom engine
E_ Eternity Extensions Code and functions handling things that Eternity introduces like Eternity Definition Files and ExtraData EDF and ExtraData
EV_ Events Code Code and functions handling in-game events, as well as the line system and sector specials Action specials
F_ Finale Code Code and functions that handle game completion, final screen animations, and screen wipe effects
G_ Game State FSA Code Contains the finite-state automaton for game state, as well as demo playback and recording
GL OpenGL Code Code and functions that initialise and handle the OpenGL backend of the engine
HAL Hardware Abstraction Layer Code Code that introduces layers of abstraction between software and hardware Hardware abstraction layer
HU_ Head-up Display Code Code and functions that handle the overlay and display of the player's HUD
IN Intermission Code Code and functions that handle level intermission screens
M_ Miscellaneous Utilities
MetaAPI Metatables and objects Handles stuff like storage of multiple types in an associative array, or provision of an adapter class for storage of qstrings as metatable properties
Misc Miscellaneous Code
Mn_ Menu Code Code and functions that run the menu engine
P_ Playsim/Playloop Covers a huge range of stuff like animations, portals, chasecam, etc.
R_ Rendering Code Code and functions that handle the rendering of the game
S_ Sound Code Code and functions that handle sound loading and playback
SDL_ SDL Code Mid-level code that uses the Simple DirectMedia Layer
ST_ Status Bar Code Code and functions that handle and define the status bar and palette indicates (e.g. bersek)
T_ Plane Mover Code General plane mover routines (e.g. crushers, platforms, lifts)
TXT_ Text Code Code and functions that handle the display of text
V_ Video Code Code and functions that load and verify patches/pngs, store images internally, handle buffers, and various other video functionality
W_ WAD/Resource Code Code functions that define and handles WADs/ZIPs, their loading, their formats, lump handling
Win32 Windows Code Code needed specifically for Windows machines
XL_ Parsing Code Parsing code for EMAPINFO, Hexen MAPINFO, MUSINFO, Hexen Script Lumps (SNDINFO/MUSINFO), and SNDINFO
Z_ Zone Memory Allocation Code Code to perform zone memory allocation, and to define the zone API

Basic Control Flow[edit]

The "main" (where we start) is located in i_main.cpp. In here various systems are initialised and then the real main function where the program happens is called: D_DoomMain(), located in d_main.cpp. In here D_DoomInit() and some other initialisation is performed. From here the game enters its main game loop within the block of code after the while(1).