Descriptions of files in the neo/framework folder.
- The name of each section refers to the C++ files (.h and .cpp) with the same name. For example, Common indicates the files Common.h and Common.cpp.
- Some sections will show a file extension to mark a single file with no companion, such as CVarSystem.h.
- A "+ description" note means that the file contains a detailed description of one or several classes.
- A class name between parentheses signifies that it is inherited: SubClass (BaseClass).
=Common
The abstract class idCommon is inherited by idCommonLocal, and declares methods to:
- initialise and shut down the game
- run the game loop: idCommon::Frame() is continuously called in the main function (WinMain()) in neo/sys/win32/win_main.cpp
idCommonLocal
- idCommonLocal::DPrintf() will display a message in the console only if the
developer
CVar (com_developer
in the C++ code) is set to 1.
=Console
idConsole (an abstract class) and its subclass, idConsoleLocal.
Contains special commands (Enter, Ctrl + L, PageUp, etc.) for the console.
=CVarSystem.h (+ description)
idCVar is the class behind all game variables that can modified through the console (console variables, or CVars).
=DeclManager (+ description)
Classes (.h) :
- idDeclBase
- idDecl
- idDeclManager
Classes (.cpp) :
- idDeclType
- idDeclFolder
- idDeclLocal
- idDeclFile
- idDeclManagerLocal
Many files have access to an idDeclManager object called declManager
(Game_local.cpp).
This object has a method called idDeclManagerLocal::FindMaterial(), which will find a given material in the base folder.
Note: declManager
is an idDeclManager object, and its FindMaterial() method is a pure virtual function. However, it is initialised with an idDeclManagerLocal object (DeclManager.cpp, line ~249), which enables it to use the idDeclManagerLocal::FindMaterial() implementation.
It was likely declared as idDeclManager to provide a simplified interface to those using it.
=DeclPDA
Classes (.h) :
- idDeclEmail
- idDeclVideo
- idDeclAudio
- idDeclPDA (idDecl): the main class for all PDA functions. I don't believe this class displays anything on the screen, as it has no member of type idUserInterface.
=EventLoop
Classe : idEventLoop
idEventLoop receives events and sends them throughout the engine.
In addition, this class takes care of journaling. Journaling is a secure way to save data: a temporary file holds the new data, waiting until it is complete before transferring it to its final location; this avoids writing errors and corruption if the application crashes.
Only one object of type idEventLoop is created, in EventLoop.cpp.
idEventLoop eventLoopLocal;
idEventLoop *eventLoop = &eventLoopLocal;
Note: This kind of code appears elsewhere in the engine, but in most cases the first object is an instance of a "local" class and the second, an instance of the base class, as in neo/game/Game_local.cpp:
idGameLocal gameLocal;
idGame * game = &gameLocal; // statically pointed at an idGameLocal
In this example, idGame is an abstract interface used to allow access to only certain public functions. But in EventLoop.cpp, it looks like eventLoopLocal
is created locally, on the stack, just so it can be automatically deleted when the program exits. It isn't used anywhere else.
=File
Classes :
- idFile
- idFile_Memory (idFile)
- idFile_BitMsg (idFile)
- idFile_Permanent (idFile)
- idFile_InZip (idFile)
The idFile class can be used to read or modify a file.
=FileSystem (+ description)
Classes (.h) :
- idFileList
- idModList
- idFileSystem
Classes (.cpp) :
- idDEntry (idStrList)
- idFileSystemLocal (idFileSystem)
- idInitExclusions
Notable structures:
- pack_t: (probably) contains information about a .pak (resource) file.
- directory_t: two strings, one for Doom 3's root folder (
path
), and the other for a resource's subfolder (gamedir
). This type of object is used almost exclusively by the searchpath_s struct. - searchpath_s / searchpath_t: like directory_t and pack_t, this structure is only used in FileSystem.cpp. It holds two pointers: one for a directory_t and another for a pack_t.
idFileSystemLocal
- idFileSystemLocal::AddGameDirectory() defines a resource folder. It is called in idFileSystemLocal::SetupGameDirectories() to specify the four default resource folders (
fs_basepath
,fs_cdpath
,fs_devpath
etfs_savepath
).
=KeyInput
All keyboard keys used in the game are specified here (enum keyNum_t). International characters are also dealt with.
All of idKeyInput's methods are static.
- idKeyInput::SetBinding() links a key to an action.
- idKeyInput::GetUsercmdAction() returns the index (int) of the action associated to a pressed key. For example, the W key is for moving forward, the space bar is for jumping, etc.
- idKeyInput::KeysFromBinding() returns the name (const char *) of the action associated with a key (this function is called more than once during initialisation).
=Licensee
This file contains no classes. It declares several constants that are used at various places in the code, such as the name of the game (GAME_NAME
), the main resource folder (CD_BASEDIR
), the configuration file (CONFIG_FILE
), etc.
Notable constants:
BASE_GAMEDIR
: the resource folder (base by default). Note that Doom will search for this folder in the executable's directory, even if thefs_basepath
CVar is set to another folder
=Session
- idSessionLocal::Draw() is likely the rendering engine's front end: it also makes sure
guiTest
(idUserInterface) has a value; if so, the gui is rendered to the screen with the following line:guiTest->Redraw( com_frameTime );
- idSessionLocal::StartMenu() displays Doom 3's main menu, but it is also called when the game is paused, because the main menu also serves as the Pause menu.
- idSessionLocal::TestGUI() is called when the
testgui
command is used in the console; it sets the value of an idUserInterface object namedguiTest
. (See idSessionLocal::Draw().)
=UsercmdGen
idUsercmdGen (abstract) and its subclass, idUsercmdGenLocal.
The enum usercmdButton_t (in UsercmdGen.cpp) holds all possible player actions (moving forward, moving backward, jumping...).
The class usercmd_t is defined in UsercmdGen.h.