1 //Copyright Paul Reiche, Fred Ford. 1992-2002
2 
3 /*
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17  */
18 
19 #ifndef UQM_COMMGLUE_H_
20 #define UQM_COMMGLUE_H_
21 
22 #include "globdata.h"
23 #include "resinst.h"
24 #include "libs/sound/trackplayer.h"
25 #include "libs/callback.h"
26 
27 #if defined(__cplusplus)
28 extern "C" {
29 #endif
30 
31 typedef enum {
32 	ARILOU_CONVERSATION,
33 	CHMMR_CONVERSATION,
34 	COMMANDER_CONVERSATION,
35 	ORZ_CONVERSATION,
36 	PKUNK_CONVERSATION,
37 	SHOFIXTI_CONVERSATION,
38 	SPATHI_CONVERSATION,
39 	SUPOX_CONVERSATION,
40 	THRADD_CONVERSATION,
41 	UTWIG_CONVERSATION,
42 	VUX_CONVERSATION,
43 	YEHAT_CONVERSATION,
44 	MELNORME_CONVERSATION,
45 	DRUUGE_CONVERSATION,
46 	ILWRATH_CONVERSATION,
47 	MYCON_CONVERSATION,
48 	SLYLANDRO_CONVERSATION,
49 	UMGAH_CONVERSATION,
50 	URQUAN_CONVERSATION,
51 	ZOQFOTPIK_CONVERSATION,
52 	SYREEN_CONVERSATION,
53 	BLACKURQ_CONVERSATION,
54 	TALKING_PET_CONVERSATION,
55 	SLYLANDRO_HOME_CONVERSATION,
56 	URQUAN_DRONE_CONVERSATION,
57 	YEHAT_REBEL_CONVERSATION,
58 	INVALID_CONVERSATION,
59 } CONVERSATION;
60 
61 extern LOCDATA CommData;
62 extern UNICODE shared_phrase_buf[2048];
63 
64 #define PLAYER_SAID(r,i) ((r)==(i))
65 #define PHRASE_ENABLED(p) \
66 		(*(UNICODE *)GetStringAddress ( \
67 				SetAbsStringTableIndex (CommData.ConversationPhrases, (p)-1) \
68 				) != '\0')
69 #define DISABLE_PHRASE(p) \
70 		(*(UNICODE *)GetStringAddress ( \
71 				SetAbsStringTableIndex (CommData.ConversationPhrases, (p)-1) \
72 				) = '\0')
73 
74 #define Response(i,a) \
75 		DoResponsePhrase(i,(RESPONSE_FUNC)a,0)
76 
77 enum
78 {
79 	GLOBAL_PLAYER_NAME = -1000000,
80 	GLOBAL_SHIP_NAME,
81 	GLOBAL_ALLIANCE_NAME,
82 };
83 
84 typedef COUNT RESPONSE_REF;
85 
86 typedef void (*RESPONSE_FUNC) (RESPONSE_REF R);
87 
88 extern void DoResponsePhrase (RESPONSE_REF R, RESPONSE_FUNC
89 		response_func, UNICODE *ContstructStr);
90 extern void DoNPCPhrase (UNICODE *pStr);
91 
92 // The CallbackFunction is queued and executes synchronously
93 // on the Starcon2Main thread
94 extern void NPCPhrase_cb (int index, CallbackFunction cb);
95 #define NPCPhrase(index) NPCPhrase_cb ((index), NULL)
96 extern void NPCPhrase_splice (int index);
97 extern void NPCNumber (int number, const char *fmt);
98 
99 #define ALLIANCE_NAME_BUFSIZE 256
100 extern void GetAllianceName (UNICODE *buf, RESPONSE_REF name_1);
101 
102 extern void construct_response (UNICODE *buf, int R /* promoted from
103 		RESPONSE_REF */, ...);
104 
105 typedef enum {
106 	Segue_peace,
107 			// When initiating a conversation, open comms directly.
108 			// When terminating a conversation, depart in peace.
109 	Segue_hostile,
110 			// When initiating a conversation, offer the choice to attack.
111 			// When terminating a conversation, go into battle.
112 	Segue_victory,
113 			// (when terminating a conversation) instant victory
114 	Segue_defeat,
115 			// (when terminating a conversation) game over
116 } Segue;
117 
118 void setSegue (Segue segue);
119 Segue getSegue (void);
120 
121 extern LOCDATA* init_race (CONVERSATION comm_id);
122 
123 extern LOCDATA* init_arilou_comm (void);
124 
125 extern LOCDATA* init_blackurq_comm (void);
126 
127 extern LOCDATA* init_chmmr_comm (void);
128 
129 extern LOCDATA* init_commander_comm (void);
130 
131 extern LOCDATA* init_druuge_comm (void);
132 
133 extern LOCDATA* init_ilwrath_comm (void);
134 
135 extern LOCDATA* init_melnorme_comm (void);
136 
137 extern LOCDATA* init_mycon_comm (void);
138 
139 extern LOCDATA* init_orz_comm (void);
140 
141 extern LOCDATA* init_pkunk_comm (void);
142 
143 extern LOCDATA* init_rebel_yehat_comm (void);
144 
145 extern LOCDATA* init_shofixti_comm (void);
146 
147 extern LOCDATA* init_slyland_comm (void);
148 
149 extern LOCDATA* init_slylandro_comm (void);
150 
151 extern LOCDATA* init_spahome_comm (void);
152 
153 extern LOCDATA* init_spathi_comm (void);
154 
155 extern LOCDATA* init_starbase_comm (void);
156 
157 extern LOCDATA* init_supox_comm (void);
158 
159 extern LOCDATA* init_syreen_comm (void);
160 
161 extern LOCDATA* init_talkpet_comm (void);
162 
163 extern LOCDATA* init_thradd_comm (void);
164 
165 extern LOCDATA* init_umgah_comm (void);
166 
167 extern LOCDATA* init_urquan_comm (void);
168 
169 extern LOCDATA* init_utwig_comm (void);
170 
171 extern LOCDATA* init_vux_comm (void);
172 
173 extern LOCDATA* init_yehat_comm (void);
174 
175 extern LOCDATA* init_zoqfot_comm (void);
176 
177 extern LOCDATA* init_umgah_comm (void);
178 
179 #if defined(__cplusplus)
180 }
181 #endif
182 
183 #endif /* UQM_COMMGLUE_H_ */
184