UFO: Alien Invasion
cp_messageoptions.h
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2022 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24 
25 #pragma once
26 
27 #include "cp_messages.h"
28 
30 typedef enum nt_s {
60 
62 } notify_t;
63 
65 typedef enum ntmask_s {
66  NTMASK_NOTIFY = 1 << 0,
67  NTMASK_PAUSE = 1 << 1,
68  NTMASK_SOUND = 1 << 2
69 } notifyMask_t;
70 
72 typedef enum msgcategorymask_s {
75 
77 #define MSO_PAUSE (NTMASK_PAUSE | NTMASK_NOTIFY)
78 
79 #define MSO_NOTIFY (NTMASK_NOTIFY)
80 
81 #define MSO_SOUND (NTMASK_SOUND | NTMASK_NOTIFY)
82 
86 typedef struct messageSettings_s {
87  bool doPause;
88  bool doNotify;
89  bool doSound;
91 
92 #define MAX_MESSAGECATEGORIES 16
93 typedef struct msgCategoryEntry_s {
94  const char* notifyType;
95  struct msgCategory_s* category;
96  struct msgCategoryEntry_s* next;
97  struct msgCategoryEntry_s* previous;
99  bool isCategory;
101 
102 typedef struct msgCategory_s {
103  int idx;
104  const char* name;
107 } msgCategory_t;
108 
110 extern char const* const nt_strings[NT_NUM_NOTIFYTYPE];
111 
112 uiMessageListNodeMessage_t* MSO_CheckAddNewMessage(const notify_t messagecategory, const char* title, const char* text, messageType_t type = MSG_STANDARD, technology_t* pedia = nullptr, bool popup = false);
113 void MSO_ParseMessageSettings(const char* name, const char** text);
114 void MSO_Set(const int listIndex, const notify_t type, const int optionType, const bool activate, const bool sendCommands);
115 void MSO_Init(void);
116 void MSO_Shutdown(void);
messageSettings_t messageSettings[NT_NUM_NOTIFYTYPE]
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
msgCategoryMask_t
bitmask values for storing msgcategory state
bool isCategory
notifyMask_t
bitmask values for storing msgoptions
struct msgCategoryEntry_s * next
messageType_t
Definition: cp_messages.h:32
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.
void MSO_Shutdown(void)
struct msgCategoryEntry_s * previous
msgCategoryEntry_t * first
const char * notifyType
struct msgCategory_s * category
msgCategoryEntry_t * last
void MSO_ParseMessageSettings(const char *name, const char **text)
parses message options settings from file.
messageSettings_t * settings
const char * name
void MSO_Init(void)
This is the technology parsed from research.ufo.
Definition: cp_research.h:139
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
Definition: r_gl.h:110
structure holding pause and notify settings for a notify type.
uiMessageListNodeMessage_t * MSO_CheckAddNewMessage(const notify_t messagecategory, const char *title, const char *text, messageType_t type=MSG_STANDARD, technology_t *pedia=nullptr, bool popup=false)
Adds a new message to message stack. It uses message settings to verify whether sound should be playe...
char const *const nt_strings[NT_NUM_NOTIFYTYPE]
valid notification types that may cause pause / notice
notify_t
Notify types.