1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 */
16
17 #ifndef UQM_COMM_H_
18 #define UQM_COMM_H_
19
20 #include "globdata.h"
21 #include "units.h"
22 #include "libs/compiler.h"
23 #include "libs/gfxlib.h"
24 #include "commglue.h"
25 // for CONVERSATION
26
27 #ifdef COMM_INTERNAL
28
29 #define SLIDER_Y 107
30 #define SLIDER_HEIGHT 15
31
32 #include "commanim.h"
33
34 #if defined(__cplusplus)
35 extern "C" {
36 #endif
37
38 extern LOCDATA CommData;
39
40 static inline BOOLEAN
haveTalkingAnim(void)41 haveTalkingAnim (void)
42 {
43 return CommData.AlienTalkDesc.NumFrames > 0;
44 }
45
46 static inline BOOLEAN
haveTransitionAnim(void)47 haveTransitionAnim (void)
48 {
49 return CommData.AlienTransitionDesc.NumFrames > 0;
50 }
51
52 static inline BOOLEAN
wantTalkingAnim(void)53 wantTalkingAnim (void)
54 {
55 return !(CommData.AlienTalkDesc.AnimFlags & PAUSE_TALKING);
56 }
57
58 static inline void
setRunTalkingAnim(void)59 setRunTalkingAnim (void)
60 {
61 CommData.AlienTalkDesc.AnimFlags |= WAIT_TALKING;
62 }
63
64 static inline void
clearRunTalkingAnim(void)65 clearRunTalkingAnim (void)
66 {
67 CommData.AlienTalkDesc.AnimFlags &= ~WAIT_TALKING;
68 }
69
70 static inline BOOLEAN
runningTalkingAnim(void)71 runningTalkingAnim (void)
72 {
73 return (CommData.AlienTalkDesc.AnimFlags & WAIT_TALKING);
74 }
75
76 static inline void
setRunIntroAnim(void)77 setRunIntroAnim (void)
78 {
79 CommData.AlienTransitionDesc.AnimFlags |= TALK_INTRO;
80 }
81
82 static inline BOOLEAN
runningIntroAnim(void)83 runningIntroAnim (void)
84 {
85 return (CommData.AlienTransitionDesc.AnimFlags & TALK_INTRO);
86 }
87
88 static inline void
setStopTalkingAnim(void)89 setStopTalkingAnim (void)
90 {
91 CommData.AlienTalkDesc.AnimFlags |= TALK_DONE;
92 }
93
94 static inline void
clearStopTalkingAnim(void)95 clearStopTalkingAnim (void)
96 {
97 CommData.AlienTalkDesc.AnimFlags &= ~TALK_DONE;
98 }
99
100 static inline BOOLEAN
signaledStopTalkingAnim(void)101 signaledStopTalkingAnim (void)
102 {
103 return CommData.AlienTalkDesc.AnimFlags & TALK_DONE;
104 }
105
106 #endif
107
108 #define TEXT_X_OFFS 1
109 #define TEXT_Y_OFFS 1
110 #define SIS_TEXT_WIDTH (SIS_SCREEN_WIDTH - (TEXT_X_OFFS << 1))
111
112 extern void init_communication (void);
113 extern void uninit_communication (void);
114
115 extern COUNT InitCommunication (CONVERSATION which_comm);
116 extern void RaceCommunication (void);
117
118 #define WAIT_TRACK_ALL ((COUNT)~0)
119 extern void AlienTalkSegue (COUNT wait_track);
120 BOOLEAN getLineWithinWidth(TEXT *pText, const char **startNext,
121 SIZE maxWidth, COUNT maxChars);
122
123 extern RECT CommWndRect; /* comm window rect */
124
125 typedef enum
126 {
127 CIM_CROSSFADE_SPACE,
128 CIM_CROSSFADE_WINDOW,
129 CIM_CROSSFADE_SCREEN,
130 CIM_FADE_IN_SCREEN,
131
132 CIM_DEFAULT = CIM_CROSSFADE_SPACE,
133 } CommIntroMode;
134 extern void SetCommIntroMode (CommIntroMode, TimeCount howLong);
135
136 extern void EnableTalkingAnim (BOOLEAN enable);
137
138 #if defined(__cplusplus)
139 }
140 #endif
141
142 #endif /* UQM_COMM_H_ */
143