SState aggregates all the state variables of OpenMortal that do not belong to the backend.
More...
#include <State.h>
List of all members.
Detailed Description
SState aggregates all the state variables of OpenMortal that do not belong to the backend.
This includes transient variables such as the current game mode (e.g. SStade::IN_DEMO) and configuration variables (such as the keyboard layout).
SState is a singlular object, and is accessed with a global pointer, g_oState. All other frontend modules access the state through this object. The state is made persistent through it's methods, Load() and Save(). Load() is called on program start, Save() is called when the program exits.
The State is the way the CMenu communicate with the rest of the system. For example, if the user chooses "Quit" from the menu, the m_bQuitFlag is set to true, and the program will react accordingly.
The state's most important properties are:
- m_enGameMode: The mode changes when a game is started or the game ends (either in the GameOver screen, or via the "Surrender Game" menu option).
- m_bQuitFlag: This is set if the program receives a quit event from the operating system (e.g. KILL signal, window close event, etc), or the user chooses "Quit" from the menu. Once the quit flag is set, the program will abort. All main loops check the value of the quit flag, and will break as soon as it is true.
- m_bFullScreen: Quite simply, it is true in fullscreen mode, and false in windowed mode. The user can change this via the menu. The State's ToggleFullscreen() method will switch between fullscreen and windowed mode. Maybe this functionality doesn't belong to the State? ...
- Sound properties: Mixing rate, number of channels, volume, etc.
- m_aiPlayerKeys: A double array of each player's keys. This is used most often in processing SDL key events: if the event's keysym matches a value in m_aiPlayerKeys, that means that a meaningful key was pushed or released.
Member Enumeration Documentation
|
- Enumeration values:
-
IN_DEMO |
The game is currently in "demo" mode: displaying the intro screens, etc. |
IN_SINGLE |
The game is in single-player mode. |
IN_MULTI |
The game is in multi-player mode. |
IN_NETWORK |
There is against a network opponent in progress. |
IN_CHAT |
The user is on MortalNet. |
|
|
- Enumeration values:
-
Team_ONE_VS_ONE |
|
Team_GOOD_VS_EVIL |
|
Team_CUSTOM |
|
|
Constructor & Destructor Documentation
Member Function Documentation
void SState::SetLanguage |
( |
const char * |
a_pcLanguage |
) |
|
|
void SState::SetServer |
( |
const char * |
a_pcServer |
) |
|
|
void SState::ToggleFullscreen |
( |
|
) |
|
|
Member Data Documentation
The documentation for this struct was generated from the following files: