#include "../cl_shared.h"
#include "../ui/ui_main.h"
#include "../../shared/parse.h"
#include "cp_campaign.h"
#include "cp_messageoptions.h"
#include "cp_messageoptions_callbacks.h"
#include "cp_time.h"
#include "save/save_messageoptions.h"
Go to the source code of this file.
Functions | |
CASSERT (lengthof(nt_strings)==NT_NUM_NOTIFYTYPE) | |
void | MSO_Set (const int listIndex, const notify_t type, const int optionType, const qboolean activate, const qboolean sendCommands) |
Function updates pause or notification settings. | |
static void | MSO_Set_f (void) |
Function callback used to initialize values for messageoptions and for manual setting changes. | |
static void | MSO_SetAll_f (void) |
Function callback that sets all message options settings for one option type to given value. | |
message_t * | MSO_CheckAddNewMessage (const notify_t messagecategory, const char *title, const char *text, qboolean popup, messageType_t type, void *pedia) |
Adds a new message to message stack. It uses message settings to verify whether sound should be played and whether game should stop. | |
qboolean | MSO_SaveXML (mxml_node_t *p) |
saves current notification and pause settings | |
qboolean | MSO_LoadXML (mxml_node_t *p) |
Restores the notification and pause settings from savegame. | |
void | MSO_ParseSettings (const char *name, const char **text) |
parses message options settings from file. | |
void | MSO_ParseCategories (const char *name, const char **text) |
Parses a messagecategory script section. These categories are used to group notification types. | |
void | MSO_Init (void) |
void | MSO_Shutdown (void) |
Variables | |
const char * | nt_strings [NT_NUM_NOTIFYTYPE] |
valid notification types that may cause pause / notice | |
messageSettings_t | messageSettings [NT_NUM_NOTIFYTYPE] |
Definition in file cp_messageoptions.c.
CASSERT | ( | lengthof(nt_strings) | = =NT_NUM_NOTIFYTYPE |
) |
message_t* MSO_CheckAddNewMessage | ( | const notify_t | messagecategory, | |
const char * | title, | |||
const char * | text, | |||
qboolean | popup, | |||
messageType_t | type, | |||
void * | pedia | |||
) |
Adds a new message to message stack. It uses message settings to verify whether sound should be played and whether game should stop.
messagecategory | category for notification | |
[in] | title | Already translated message/mail title |
[in] | text | Already translated message/mail body |
[in] | popup | Show this as a popup, too? |
[in] | type | The message type |
[in] | pedia | Pointer to technology (only if needed) |
Definition at line 190 of file cp_messageoptions.c.
References CL_GameTimeStop(), and MS_AddNewMessageSound().
Referenced by AII_UpdateOneInstallationDelay(), AIR_Refuel(), AIRFIGHT_ExecuteActions(), INS_BuildInstallation_f(), INS_DestroyInstallation(), INS_UpdateInstallationData(), NAT_SetHappiness(), PR_DisassemblingFrame(), PR_ProductionFrame(), PR_ProductionIncrease_f(), PR_QueueNext(), RS_MarkCollected(), RS_MarkOneResearchable(), RS_ResearchFinish(), RS_ResearchRun(), TR_EmptyTransferCargo(), TR_TransferAlienAfterMissionStart(), TR_TransferEnd(), TR_TransferStart_f(), UFO_CampaignCheckEvents(), UFO_SearchAircraftTarget(), and UR_ProcessActive().
void MSO_Init | ( | void | ) |
Definition at line 381 of file cp_messageoptions.c.
References Cmd_AddCommand(), MSO_InitCallbacks(), MSO_Set_f(), and MSO_SetAll_f().
Referenced by MS_MessageInit().
qboolean MSO_LoadXML | ( | mxml_node_t * | p | ) |
Restores the notification and pause settings from savegame.
Definition at line 228 of file cp_messageoptions.c.
References Com_Printf(), MSO_MSTATE_REINIT, MSO_NOTIFY, MSO_PAUSE, MSO_Set(), MSO_SetMenuState(), MSO_SOUND, mxml_GetBool(), mxml_GetNextNode(), mxml_GetNode(), mxml_GetString(), NT_NUM_NOTIFYTYPE, nt_strings, qfalse, qtrue, SAVE_MESSAGEOPTIONS_MESSAGEOPTIONS, SAVE_MESSAGEOPTIONS_NAME, SAVE_MESSAGEOPTIONS_NOTIFY, SAVE_MESSAGEOPTIONS_PAUSE, SAVE_MESSAGEOPTIONS_SOUND, SAVE_MESSAGEOPTIONS_TYPE, and type.
Referenced by SAV_Init().
void MSO_ParseCategories | ( | const char * | name, | |
const char ** | text | |||
) |
Parses a messagecategory script section. These categories are used to group notification types.
name | ||
text |
Definition at line 304 of file cp_messageoptions.c.
References msgCategoryEntry_s::category, ccs, Com_EParse(), Com_Parse(), Com_Printf(), cp_campaignPool, msgCategory_s::first, msgCategory_s::id, msgCategory_s::idx, msgCategoryEntry_s::isCategory, msgCategory_s::last, MAX_MESSAGECATEGORIES, MAX_VAR, Mem_PoolStrDup, ccs_s::messageCategories, ccs_s::msgCategoryEntries, MSO_MSTATE_REINIT, MSO_SetMenuState(), msgCategoryEntry_s::next, msgCategoryEntry_s::notifyType, NT_NUM_NOTIFYTYPE, nt_strings, ccs_s::numMsgCategories, ccs_s::numMsgCategoryEntries, msgCategoryEntry_s::previous, qfalse, qtrue, and msgCategoryEntry_s::settings.
Referenced by CL_ParseScriptFirst().
void MSO_ParseSettings | ( | const char * | name, | |
const char ** | text | |||
) |
parses message options settings from file.
name | ||
text |
Definition at line 266 of file cp_messageoptions.c.
References Cmd_ExecuteString(), Com_EParse(), Com_Parse(), Com_Printf(), MSO_MSTATE_REINIT, MSO_SetMenuState(), qfalse, and va().
Referenced by CL_ParseScriptFirst().
qboolean MSO_SaveXML | ( | mxml_node_t * | p | ) |
saves current notification and pause settings
Definition at line 205 of file cp_messageoptions.c.
References messageSettings_s::doNotify, messageSettings_s::doPause, messageSettings_s::doSound, mxml_AddBoolValue(), mxml_AddNode(), mxml_AddString(), NT_NUM_NOTIFYTYPE, nt_strings, qtrue, SAVE_MESSAGEOPTIONS_MESSAGEOPTIONS, SAVE_MESSAGEOPTIONS_NAME, SAVE_MESSAGEOPTIONS_NOTIFY, SAVE_MESSAGEOPTIONS_PAUSE, SAVE_MESSAGEOPTIONS_SOUND, SAVE_MESSAGEOPTIONS_TYPE, and type.
Referenced by SAV_Init().
void MSO_Set | ( | const int | listIndex, | |
const notify_t | type, | |||
const int | optionType, | |||
const qboolean | activate, | |||
const qboolean | sendCommands | |||
) |
Function updates pause or notification settings.
listIndex | listIndex in menu to update via confunc | |
type | notification type to update | |
optionType | option type that should be updated | |
activate | flag indicating whether setting should be activated (qtrue) or deactivated | |
sendCommands | flag indicating whether confunc command to update menu button should be sent |
Definition at line 79 of file cp_messageoptions.c.
References messageSettings_s::doNotify, messageSettings_s::doPause, messageSettings_s::doSound, MSO_MSTATE_PREPARED, MSO_NOTIFY, MSO_SetMenuState(), NTMASK_PAUSE, NTMASK_SOUND, qfalse, and UI_ExecuteConfunc().
Referenced by MSO_LoadXML(), MSO_Set_f(), MSO_SetAll_f(), and MSO_Toggle_f().
static void MSO_Set_f | ( | void | ) | [static] |
Function callback used to initialize values for messageoptions and for manual setting changes.
Definition at line 114 of file cp_messageoptions.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), MSO_NOTIFY, MSO_PAUSE, MSO_Set(), MSO_SOUND, NT_NUM_NOTIFYTYPE, nt_strings, qfalse, and type.
Referenced by MSO_Init().
static void MSO_SetAll_f | ( | void | ) | [static] |
Function callback that sets all message options settings for one option type to given value.
Definition at line 151 of file cp_messageoptions.c.
References Cmd_Argc(), Cmd_Argv(), Com_Printf(), MSO_MSTATE_PREPARED, MSO_NOTIFY, MSO_PAUSE, MSO_Set(), MSO_SetMenuState(), MSO_SOUND, NT_NUM_NOTIFYTYPE, qfalse, qtrue, and type.
Referenced by MSO_Init().
void MSO_Shutdown | ( | void | ) |
Definition at line 388 of file cp_messageoptions.c.
References Cmd_RemoveCommand(), and MSO_ShutdownCallbacks().
Referenced by CP_RemoveCampaignCallbackCommands().
messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE] |
array holding actual message settings for every notify type
Definition at line 66 of file cp_messageoptions.c.
Referenced by MSO_BackupSettings_f(), and MSO_RestoreSettings_f().
const char* nt_strings[NT_NUM_NOTIFYTYPE] |
{ N_("installation_installed"), N_("installation_removed"), N_("installation_replaced"), N_("aircraft_refueled"), N_("aircraft_cannotrefuel"), N_("installation_build_started"), N_("installation_build_finished"), N_("installation_destroyed"), N_("research_new_proposed"), N_("research_halted"), N_("research_completed"), N_("production_started"), N_("production_finished"), N_("production_failed"), N_("production_queue_empty"), N_("nation_happiness_changed"), N_("nation_unhappy"), N_("nation_pleased"), N_("transfer_started"), N_("transfer_completed_success"), N_("transfer_lost"), N_("transfer_aliens_defered"), N_("transfer_uforecovery_finished"), N_("ufo_spotted"), N_("ufo_signal_lost"), N_("ufo_attacking"), }
valid notification types that may cause pause / notice
Definition at line 35 of file cp_messageoptions.c.
Referenced by MSO_LoadXML(), MSO_ParseCategories(), MSO_SaveXML(), MSO_Set_f(), and MSO_Toggle_f().