26 #include "../../cl_shared.h"
28 #include "../../ui/ui_main.h"
29 #include "../../ui/ui_data.h"
57 const char*
id =
va(
"%d", idx);
63 Sys_Error(
"MSO_InitList: The first entry must be a category");
99 cgi->UI_ExecuteConfunc(
"ms_disable %i", visible);
103 cgi->UI_ExecuteConfunc(
"ms_enable %i", visible);
112 cgi->UI_ExecuteConfunc(
"ms_disable %i", visible);
141 if (
cgi->Cmd_Argc() == 2) {
155 if (
cgi->Cmd_Argc() != 3)
156 cgi->Com_Printf(
"Usage: %s <listId> <pause|notify|sound>\n",
cgi->
Cmd_Argv(0));
176 cgi->Com_Printf(
"Toggle command with selected category entry ignored.\n");
183 if (type == NT_NUM_NOTIFYTYPE) {
184 cgi->Com_Printf(
"Unrecognized messagetype during toggle '%s' ignored\n", selectedEntry->
notifyType);
208 if (
cgi->Cmd_Argc() < 2)
222 memcpy(backupMessageSettings,
messageSettings,
sizeof(backupMessageSettings));
248 {
"msgoptions_toggle",
MSO_Toggle_f,
"Toggles pause, notification or sound setting for a message category"},
249 {
"msgoptions_scroll",
MSO_Scroll_f,
"Scroll callback function for message options menu text"},
250 {
"msgoptions_init",
MSO_Init_f,
"Initializes message options menu"},
253 {
nullptr,
nullptr,
nullptr}
257 OBJSET(backupMessageSettings, 1);
259 cgi->Cmd_TableAddList(msgOptionsCallbacks);
264 cgi->Cmd_TableRemoveList(msgOptionsCallbacks);
structure holding pause and notify settings for a notify type.
void Sys_Error(const char *error,...)
static int messageList_scroll
static void MSOCB_Init(void)
initializes message options menu by showing as much button lines as needed.
QGL_EXTERN GLint GLenum type
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
static void MSO_UpdateVisibleButtons(void)
Executes confuncs to update visible message options lines.
uiNode_t *IMPORT * UI_OptionIteratorNextOption(uiOptionIterator_t *iterator)
static msoMenuState_t msoMenuState
uiNode_t *IMPORT * UI_InitOptionIteratorAtIndex(int index, uiNode_t *option, uiOptionIterator_t *iterator)
#define MSO_SOUND
notification type: play notification sound
char const *const nt_strings[NT_NUM_NOTIFYTYPE]
valid notification types that may cause pause / notice
void MSO_InitCallbacks(void)
void MSO_SetMenuState(const msoMenuState_t newState, const bool callInit, const bool preserveIndex)
Header file for messageoptions related stuff.
#define MSO_PAUSE
notification type: pause game
static void MSO_Scroll_f(void)
Function to update message options menu after scrolling. Updates all visible button lines based on co...
#define OPTIONEXTRADATACONST(node)
static const cmdList_t msgOptionsCallbacks[]
#define OPTIONEXTRADATA(node)
messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE]
const cgame_import_t * cgi
static void MSO_Init_f(void)
initializes message options menu by showing as much button lines as needed.
msgCategoryEntry_t msgCategoryEntries[NT_NUM_NOTIFYTYPE+MAX_MESSAGECATEGORIES]
static void MSO_Toggle_f(void)
Function for menu buttons to update message settings.
Atomic structure used to define most of the UI.
static int visibleMSOEntries
enum msoMenuState_s msoMenuState_t
uiNode_t *IMPORT * UI_GetOption(int dataId)
int numMsgCategoryEntries
static void MSO_InitList(void)
Initializes menu texts for scrollable area.
static int messageList_size
void MSO_Set(const int listIndex, const notify_t type, const int optionType, const bool activate, const bool sendCommands)
Function updates pause or notification settings.
Header file for single player campaign control.
enum nt_s notify_t
Notify types.
struct msgCategory_s * category
static void MSO_RestoreSettings_f(void)
Restores actual settings from backup settings variable.
messageSettings_t * settings
const char uiNode_t *IMPORT * UI_AddOption(uiNode_t **tree, const char *name, const char *label, const char *value)
void MSO_ShutdownCallbacks(void)
messageSettings_t backupMessageSettings[NT_NUM_NOTIFYTYPE]
#define MSO_NOTIFY
notification type: add notification message
Header file for menu related console command callbacks.
const char *IMPORT * Cmd_Argv(int n)
static void MSO_BackupSettings_f(void)
Saves actual settings into backup settings variable.