User:Monster Iestyn/Source Code Documentation/d_main.h

From SRB2 Wiki
Jump to navigation Jump to search
This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.
Online link GitHub entry
File type C header file
#include guard __D_MAIN__

Includes

Externs

Data name Data type Non-extern location(s) Description
advancedemo boolean d_main.c If true, this returns the game to the title screen the next time the game tries to run a gametic.

Note: In Doom Legacy and early versions of SRB2, this originally was a flag for the game to call the now-removed D_DoAdvanceDemo function, so that the game could advance through demo sequences at the title screen.

rendergametic tic_t d_main.c Stores the most recent gametic value the game's display was updated for, i.e. the last time a frame was rendered in-game. This prevents the game from being rendered again for the same gametic, unless no new tics have been processed for several runs of D_SRB2Loop's loop (which can be caused by a netgame server hanging or a netsplit occurring).
srb2home[256] char d_main.c The path to the "home" directory as a string. This is used to look for files such as config.cfg and the save game data files.
usehome boolean d_main.c If true, the "home" directory should be used.
*pandf const char d_main.c File path format string, used for loading SRB2's resource files. This is normally set to "%s" PATHSEP "%s".
srb2path[256] char d_main.c The path to SRB2's directory as a string. This is used to look for SRB2's resource files (i.e.: srb2.srb, zones.dta, etc.)

Function prototypes

Function name Return type Params Defined in Attributes Description
D_SRB2Loop void none d_main.c FUNCNORETURN The main game loop function. This function should never return. Called by the main() function (or WinMain for the DirectX Windows port).
D_SRB2Main void none d_main.c Calls all startup code, parses command line options. Called by the main() function (or WinMain for the DirectX Windows port).
D_PostEvent void const event_t *ev d_main.c Adds a new event to the events array. This is called by the I/O functions when input is detected.
D_PostEvent_end void none d_main.c DOS only; declared only if DOXYGEN is not defined

For the DOS port of SRB2, this is used by Allegro to lock the memory for the D_PostEvent function, as D_PostEvent is used by timer routines (see src/djgppdos/i_system.c). For other ports of SRB2 this has no effect.

D_ProcessEvents void none d_main.c Processes all new events and sends them to the responder functions.
D_Home const char * none d_main.c Returns the path to the "home" directory as a string, or NULL if no home directory is set or needed.
D_AdvanceDemo void none d_main.c Sets advancedemo to true. This is called by G_CheckDemoStatus when a demo has finished being played back.
D_StartTitle void none d_main.c Starts up the title screen. If this is used in a netgame (typically after clearing the game in Co-op mode, and after the credits has finished), this instead warps to the first Single Player map.