FS2_Open
Open source remastering of the Freespace 2 engine
missionmessage.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell
5  * or otherwise commercially exploit the source or things you created based on the
6  * source.
7  *
8 */
9 
10 
11 
12 #ifndef _MISSIONMESSAGE_H
13 #define _MISSIONMESSAGE_H
14 
15 #include "anim/packunpack.h"
16 #include "globalincs/globals.h" // include so that we can gets defs for lengths of tokens
17 #include "graphics/generic.h"
18 
19 class ship;
20 
21 //Bumped to 500 from 300 06/15/2004 -C
22 
23 // keep seperate lists of AVI's and wav files. I suspect that many messages will have
24 // duplicate avi's for different messages. Seperate list for wave files since some messages
25 // might not have wave file information.
26 
27 typedef struct message_extra {
29  int num;
32 
35 
36 // defines for message priorities
37 #define MESSAGE_PRIORITY_LOW 1
38 #define MESSAGE_PRIORITY_NORMAL 2
39 #define MESSAGE_PRIORITY_HIGH 3
40 
41 // defines for how quickly we should send a message
42 #define MESSAGE_TIME_IMMEDIATE 1
43 #define MESSAGE_TIME_SOON 2
44 #define MESSAGE_TIME_ANYTIME 3
45 
46 // sources for messages
47 #define MESSAGE_SOURCE_SHIP 1
48 #define MESSAGE_SOURCE_WINGMAN 2
49 #define MESSAGE_SOURCE_COMMAND 3
50 #define MESSAGE_SOURCE_SPECIAL 4
51 #define MESSAGE_SOURCE_NONE 5
52 
53 // define used for sender of a message when you want it to be Terran Command
54 #define DEFAULT_COMMAND "Command"
55 
56 // defines for message id's used in FreeSpace code. Callers to message_send_to_player() should
57 // probably use these defines.
58 
59 typedef struct builtin_message {
60  char *name;
62  int max_count;
63  int min_delay;
65 
67 extern int Current_mission_mood;
68 
69 // this number in this define should match the number of elements in the next array
70 #define MAX_BUILTIN_MESSAGE_TYPES 45
71 
73 
74 #define MESSAGE_ARRIVE_ENEMY 0
75 #define MESSAGE_ATTACK_TARGET 1
76 #define MESSAGE_BETA_ARRIVED 2
77 #define MESSAGE_CHECK_6 3
78 #define MESSAGE_ENGAGE 4
79 #define MESSAGE_GAMMA_ARRIVED 5
80 #define MESSAGE_HELP 6
81 #define MESSAGE_PRAISE 7
82 #define MESSAGE_REINFORCEMENTS 8
83 #define MESSAGE_IGNORE 9
84 #define MESSAGE_NOSIR 10
85 #define MESSAGE_OOPS 11
86 #define MESSAGE_PERMISSION 12
87 #define MESSAGE_STRAY 13
88 #define MESSAGE_WARP_OUT 14
89 #define MESSAGE_YESSIR 15
90 #define MESSAGE_REARM_ON_WAY 16
91 #define MESSAGE_ON_WAY 17
92 #define MESSAGE_REARM_WARP 18
93 #define MESSAGE_NO_TARGET 19
94 #define MESSAGE_DOCK_YES 20
95 #define MESSAGE_REPAIR_DONE 21
96 #define MESSAGE_REPAIR_ABORTED 22
97 #define MESSAGE_HAMMER_SWINE 23
98 #define MESSAGE_REARM_REQUEST 24 // wingman messages player when he calls a support ship
99 #define MESSAGE_DISABLE_TARGET 25
100 #define MESSAGE_DISARM_TARGET 26
101 #define MESSAGE_PLAYER_DIED 27 // message sent when player starts death roll
102 #define MESSAGE_WINGMAN_SCREAM 28
103 #define MESSAGE_SUPPORT_KILLED 29
104 #define MESSAGE_ALL_CLEAR 30
105 #define MESSAGE_ALL_ALONE 31 // message sent when player is last ship left and primary objectives still exist
106 #define MESSAGE_REPAIR_REQUEST 32
107 #define MESSAGE_DELTA_ARRIVED 33
108 #define MESSAGE_EPSILON_ARRIVED 34
109 #define MESSAGE_INSTRUCTOR_HIT 35
110 #define MESSAGE_INSTRUCTOR_ATTACK 36
111 #define MESSAGE_STRAY_WARNING 37
112 #define MESSAGE_STRAY_WARNING_FINAL 38
113 #define MESSAGE_AWACS_75 39
114 #define MESSAGE_AWACS_25 40
115 #define MESSAGE_PRAISE_SELF 41
116 #define MESSAGE_HIGH_PRAISE 42
117 #define MESSAGE_REARM_PRIMARIES 43
118 #define MESSAGE_PRIMARIES_LOW 44
119 
120 typedef struct MissionMessage {
121  char name[NAME_LENGTH]; // used to identify this message
122  char message[MESSAGE_LENGTH]; // actual message
123  int persona_index; // which persona says this message
124  int multi_team; // multiplayer team filter (important for TvT only)
125  int mood;
127 
128  // unions for avi/wave information. Because of issues with Fred, we are using
129  // the union to specify either the index into the avi or wave arrays above,
130  // or refernce the name directly. The currently plan is to only have Fred reference
131  // the name field!!!
132  union {
133  int index; // index of avi file to play
134  char *name;
135  } avi_info;
136 
137  union {
138  int index;
139  char *name;
140  } wave_info;
141 
142 } MMessage;
143 
145 
146 typedef struct pmessage {
147  //anim_instance *anim; // handle of anim currently playing
148  generic_anim *anim_data; // animation data to be used by the talking head HUD gauge handler
149  int start_frame; // the start frame needed to play the animation
150  bool play_anim; // used to tell HUD gauges if they should be playing or not
151  int wave; // handle of wave currently playing
152  int id; // id of message currently playing
153  int priority; // priority of message currently playing
154  int shipnum; // shipnum of ship sending this message, -1 if from Terran command
155  int builtin_type; // if a builtin message, type of the message
156 } pmessage;
157 
158 extern pmessage Playing_messages[2];
159 
160 extern int Num_messages_playing;
161 extern int Num_messages;
162 extern int Num_builtin_messages; // from messages.tbl -- index of message location to load mission specific messages into
163 extern int Message_shipnum; // used to display info on hud when message is sent
164 
165 // variable, etc for persona information
166 #define MAX_PERSONA_TYPES 4
167 
168 // flags for personas. the type flags must be sequential starting from 0, and must match
169 // the persona_type_names defined in missionmessage.cpp
170 #define PERSONA_FLAG_WINGMAN (1<<0)
171 #define PERSONA_FLAG_SUPPORT (1<<1)
172 #define PERSONA_FLAG_LARGE (1<<2) // for large ships
173 #define PERSONA_FLAG_COMMAND (1<<3) // for terran command
174 // be sure that MAX_PERSONA_TYPES is always 1 greater than the last type bitfield above!!!
175 
176 #define PERSONA_FLAG_VASUDAN (1<<30)
177 #define PERSONA_FLAG_USED (1<<31)
178 
179 typedef struct persona_s {
181  int flags;
182  int species;
184 } Persona;
185 
186 extern Persona *Personas;
187 extern int Num_personas;
188 extern int Default_command_persona;
189 extern int Praise_self_percentage;
190 
191 // function to parse a message from either messages.tbl or the mission file. Both files have the
192 // exact same format, so this function just gets reused in both instances.
193 void message_parse(bool importing_from_fsm = false);
194 void persona_parse();
195 
196 void messages_init();
198 void message_mission_close();
199 void message_queue_process();
200 int message_is_playing();
201 void message_maybe_distort();
203 void message_kill_all( int kill_all );
204 
205 void message_queue_message( int message_num, int priority, int timing, char *who_from, int source, int group, int delay, int builtin_type=-1 );
206 
207 // functions which send messages to player -- called externally
208 void message_send_unique_to_player( char *id, void *data, int source, int priority, int group, int delay);
209 void message_send_builtin_to_player( int type, ship *shipp, int priority, int timing, int group, int delay, int multi_target, int multi_team_filter );
210 
211 // functions to deal with personas
212 int message_persona_name_lookup( char *name );
213 
214 // preload mission messages (this is called by the level paging code when running with low memory)
216 
217 // given a message id#, should it be filtered for me?
218 int message_filter_multi(int id);
219 
220 // Goober5000
222 
223 // m!m
224 void message_load_wave(int index, const char *filename);
225 
226 // Kazan
227 // Use these functions with caution as everything else uses indexes... so make sure if you're going to
228 // use these there will be no remove_messages called before your message is displayed.
229 
230 // these two are probably safe
231 // if change_message fails to find the message it'll fall through to add_message
232 bool add_message(char *name, char *message, int persona_index, int multi_team);
233 bool change_message(char *name, char *message, int persona_index, int multi_team);
234 
235 #endif
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
int Default_command_persona
int Num_personas
int Praise_self_percentage
struct persona_s Persona
GLuint index
Definition: Glext.h:5608
struct pmessage pmessage
int Num_builtin_messages
GLboolean GLuint group
Definition: Glext.h:10591
SCP_vector< MMessage > Messages
char name[NAME_LENGTH]
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: Glext.h:5156
int message_is_playing()
void message_pagein_mission_messages()
struct builtin_message builtin_message
ship * shipp
Definition: lua.cpp:9162
GLenum type
Definition: Gl.h:1492
void message_parse(bool importing_from_fsm=false)
void messages_init()
void message_queue_message(int message_num, int priority, int timing, char *who_from, int source, int group, int delay, int builtin_type=-1)
int Message_shipnum
char * filename
void message_mission_close()
void message_send_builtin_to_player(int type, ship *shipp, int priority, int timing, int group, int delay, int multi_target, int multi_team_filter)
union MissionMessage::@254 avi_info
struct message_extra message_extra
void message_queue_process()
int Current_mission_mood
struct MissionMessage MMessage
Definition: ship.h:534
int Num_messages_playing
pmessage Playing_messages[2]
void message_kill_all(int kill_all)
#define MESSAGE_LENGTH
Definition: globals.h:23
generic_anim anim_data
SCP_vector< message_extra > Message_avis
SCP_vector< message_extra > Message_waves
Persona * Personas
generic_anim * anim_data
GLuint const GLchar * name
Definition: Glext.h:5608
union MissionMessage::@255 wave_info
int Num_messages
void message_load_wave(int index, const char *filename)
void message_mission_shutdown()
#define NAME_LENGTH
Definition: globals.h:15
bool play_anim
bool substitute_missing_messages
int message_persona_name_lookup(char *name)
int message_filter_multi(int id)
bool add_message(char *name, char *message, int persona_index, int multi_team)
int builtin_type
GLenum GLsizei GLenum GLenum const GLvoid * data
Definition: Gl.h:1509
SCP_vector< SCP_string > Builtin_moods
void message_maybe_distort()
bool change_message(char *name, char *message, int persona_index, int multi_team)
builtin_message Builtin_messages[]
GLsizei GLsizei GLchar * source
Definition: Glext.h:5625
void message_send_unique_to_player(char *id, void *data, int source, int priority, int group, int delay)
SCP_vector< int > excluded_moods
bool message_filename_is_generic(char *filename)
void persona_parse()
int message_anim_is_playing()