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 "globalincs/globals.h" // include so that we can gets defs for lengths of tokens 16 #include "anim/packunpack.h" 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 { 28 char name[MAX_FILENAME_LEN]; 29 int num; 30 generic_anim anim_data; 31 } message_extra; 32 33 extern SCP_vector<message_extra> Message_avis; 34 extern SCP_vector<message_extra> Message_waves; 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; 61 int occurrence_chance; 62 int max_count; 63 int min_delay; 64 } builtin_message; 65 66 extern SCP_vector<SCP_string> Builtin_moods; 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 72 extern builtin_message Builtin_messages[]; 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; 126 SCP_vector<int> excluded_moods; 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 144 extern SCP_vector<MMessage> Messages; 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 { 180 char name[NAME_LENGTH]; 181 int flags; 182 int species; 183 } Persona; 184 185 extern Persona *Personas; 186 extern int Num_personas; 187 extern int Default_command_persona; 188 extern int Praise_self_percentage; 189 190 // function to parse a message from either messages.tbl or the mission file. Both files have the 191 // exact same format, so this function just gets reused in both instances. 192 void message_parse(bool importing_from_fsm = false); 193 void persona_parse(); 194 195 void messages_init(); 196 void message_mission_shutdown(); 197 void message_mission_close(); 198 void message_queue_process(); 199 int message_is_playing(); 200 void message_maybe_distort(); 201 int message_anim_is_playing(); 202 void message_kill_all( int kill_all ); 203 204 void message_queue_message( int message_num, int priority, int timing, char *who_from, int source, int group, int delay, int builtin_type=-1 ); 205 206 // functions which send messages to player -- called externally 207 void message_send_unique_to_player( char *id, void *data, int source, int priority, int group, int delay); 208 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 ); 209 210 // functions to deal with personas 211 int message_persona_name_lookup( char *name ); 212 213 // preload mission messages (this is called by the level paging code when running with low memory) 214 void message_pagein_mission_messages(); 215 216 // given a message id#, should it be filtered for me? 217 int message_filter_multi(int id); 218 219 // Goober5000 220 bool message_filename_is_generic(char *filename); 221 222 // Kazan 223 // Use these functions with caution as everything else uses indexes... so make sure if you're going to 224 // use these there will be no remove_messages called before your message is displayed. 225 226 // these two are probably safe 227 // if change_message fails to find the message it'll fall through to add_message 228 bool add_message(char *name, char *message, int persona_index, int multi_team); 229 bool change_message(char *name, char *message, int persona_index, int multi_team); 230 231 #endif 232