Collaboration diagram for Gameplay State:
Files | |
file | gamestate.c |
Implements the operating state for game play (STATE_CODES::STATE_PLAY). | |
file | gamestate.h |
Defines the functions used for STATE_CODES::STATE_PLAY. | |
Functions | |
int | GameInit () |
Initalizes the data needed for gameplay. | |
int | GameRun () |
Runs the body of the Game Simulation Loop. | |
int | GameUninit () |
Removes the data needed for gameplay and prepares the system to handle another operating state. | |
static Bool | GraphicReset () |
Reloads all the graphics for the game. | |
static void | RenderScore (Bool forceRender) |
Renders the score for the red and blue teams to the upper left and right corners of the display. | |
static void | SetupScrolling () |
Determines if the battlefield is too large to fit on screen and sets dInfo.scrollField (DisplayInfo::scrollField) accordingly. | |
Variables | |
RenderItem | background |
The background image. | |
Uint8 | eventState [EC_MAX] |
The event codes that are used to process user input in a way that separates the exact input used from the code that responds to the input. |
int GameInit | ( | ) |
Initalizes the data needed for gameplay.
Definition at line 186 of file gamestate.c.
References AddMessage(), AddPlayer(), AddRenderItem(), AppendPlayerData(), background, colorVals, RenderItem_t::data, dInfo, EC_MAX, eventState, Player_t::flags, frameTime, gameOpts, GenericSurfaceRenderer(), GetLocalPlayerName(), GraphicReset(), GameOptions_t::height, InitGameConfig(), LAYER_BACKGROUND, LAYER_NAMES, LAYER_OBSTACLES, LAYER_TANKS, LAYER_TEXT, layers, DisplayInfo_t::lh, RenderItem_t::loc, localPlayer, Player_t::localUpdate, DisplayInfo_t::luh, DisplayInfo_t::luw, DisplayInfo_t::lw, MAX_PLAYERS, menuSettings, NETSTATE_SERVER, networkState, ObstacleInit(), DisplayInfo_t::ph, Player_t::pid, PlacePlayerLabel(), PlaceRenderItem(), PLAYER_ACTIVE, PLAYER_DEAD, PLAYER_SHOT, PLAYER_UPDATE_IDENT, players, DisplayInfo_t::pw, RenderItem_t::renderer, DisplayInfo_t::scrollField, SetLayerOffset(), SetupScrolling(), Player_t::shell, DisplayInfo_t::showGame, SRV_FRAME_OFFSET, STATE_BFLDERR, STATE_ERROR, Player_t::tank, MenuSettings_t::team, Player_t::team, TEXTITEM_BLUESCORE, TEXTITEM_REDSCORE, textItems, TextUnsetState(), TRUE, GameOptions_t::width, Player_t::x, and Player_t::y.
Here is the call graph for this function:
int GameRun | ( | ) |
Runs the body of the Game Simulation Loop.
Definition at line 382 of file gamestate.c.
References AddMessage(), AppendPlayerData(), background, ClearRenderItem(), dInfo, DisablePlayerLabels(), DisplayInfo_t::display, EC_BACKWARD, EC_FIRE, EC_FORWARD, EC_FS_TOGGLE, EC_ROTLEFT, EC_ROTRIGHT, eventState, FALSE, GameOptions_t::flags, Player_t::flags, ForceRenderAll(), frameTime, gameOpts, HandleInput(), RenderItem_t::loc, localPlayer, MAX_PLAYERS, NETSTATE_CLIENT, NETSTATE_SERVER, networkState, OPT_UPDATESCORE, DisplayInfo_t::ph, PlaceRenderItem(), PLAYER_ACTIVE, PLAYER_CLIENT_MASK, PLAYER_UPDATE_ITEMS, players, ProcessNetworkMessages(), DisplayInfo_t::pw, RenderItem_t::renderer, RenderScore(), ResizeWindow(), SetupScrolling(), DisplayInfo_t::showLabels, SolidFillRenderer(), STATE_ERROR, STATE_MENUROOT, STATE_QUIT, and TRUE.
Here is the call graph for this function:
int GameUninit | ( | ) |
Removes the data needed for gameplay and prepares the system to handle another operating state.
Definition at line 341 of file gamestate.c.
References background, border, RenderItem_t::data, dInfo, FALSE, ForceRenderAll(), FRAME_DURATION, frameTime, GenericSurfaceRenderer(), MAX_PLAYERS, players, RemoveAllNotices(), RemovePlayer(), RemoveRenderItem(), RenderItem_t::renderer, SetupScrolling(), DisplayInfo_t::showGame, STATE_OK, StopAllSounds(), TextUnsetState(), and UninitGameConfig().
Here is the call graph for this function:
static Bool GraphicReset | ( | ) | [static] |
Reloads all the graphics for the game.
Intended for use during the game initalization and after a full screen toggle operation in Windows.
Definition at line 140 of file gamestate.c.
References background, COLOR_REGBACK, COLOR_TEXT, COLOR_WHITE, colorFmtInd, colorVals, RenderItem_t::data, dInfo, DisplayInfo_t::display, FASTEST_SURFACE, ForceRenderAll(), GenericSurfaceRenderer(), RenderItem_t::loc, DisplayInfo_t::ph, DisplayInfo_t::pw, RenderItem_t::renderer, RenderScore(), SetupColorVals(), SetupScrolling(), SolidFillRenderer(), TextSetupStatePlay(), and TRUE.
Referenced by GameInit().
Here is the call graph for this function:
static void RenderScore | ( | Bool | forceRender | ) | [static] |
Renders the score for the red and blue teams to the upper left and right corners of the display.
forceRender | True to force rendering of both scores. If false, the scores will only be rendered if they have changed. |
Definition at line 77 of file gamestate.c.
References COLOR_RED, colorFmtInd, dInfo, FONT_SCORE, gameOpts, RenderItem_t::loc, PlaceRenderItem(), DisplayInfo_t::pw, scores, TEAM_RED, GameOptions_t::teamScore, TEXTITEM_BLUESCORE, TEXTITEM_REDSCORE, textItems, and TextRenderString().
Referenced by GameRun(), and GraphicReset().
Here is the call graph for this function:
static void SetupScrolling | ( | ) | [static] |
Determines if the battlefield is too large to fit on screen and sets dInfo.scrollField (DisplayInfo::scrollField) accordingly.
If the field fits, the affected layer offsets are set to zero.
Definition at line 116 of file gamestate.c.
References dInfo, FALSE, gameOpts, GameOptions_t::height, LAYER_NAMES, LAYER_OBSTACLES, LAYER_TANKS, layers, DisplayInfo_t::lh, DisplayInfo_t::lw, DisplayInfo_t::scrollField, SetLayerOffset(), TRUE, and GameOptions_t::width.
Referenced by GameInit(), GameRun(), GameUninit(), and GraphicReset().
Here is the call graph for this function:
The background image.
When its data pointer is set to NULL, the image has not been loaded.
Definition at line 55 of file gamestate.c.
Uint8 eventState[EC_MAX] |
The event codes that are used to process user input in a way that separates the exact input used from the code that responds to the input.
Separates the key-specific input code from the event response code.
Definition at line 51 of file gamestate.c.
Referenced by GameInit(), GameRun(), and MenuRun().