File: conv.h

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (346 lines) | stat: -rw-r--r-- 9,013 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346

/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef M4_ADV_R_CONV_H
#define M4_ADV_R_CONV_H

#include "common/array.h"
#include "m4/m4_types.h"

namespace M4 {

#define _GC(X) _G(conversations).X

#define CONV_WAIT_FOR_INPUT		1
#define CONV_HALT_FOREVER		2
#define CONV_HALT				3
#define CONV_INPUT_OK			4
#define CONV_DO_NOTHING			5

#define CONV_PLAYER_TALKING		1
#define CONV_NON_PLAYER_TALKING	0

#define DLG_FLUSH_LEFT			-1
#define DLG_FLUSH_RIGHT			-2
#define DLG_FLUSH_TOP			-3
#define DLG_FLUSH_BOTTOM		-4
#define DLG_CENTER_H			-5
#define DLG_CENTER_V			-6


//from: prochunk.h
#define	C_ASGN_CHUNK				((int32) ('C' << 24) | ('A' << 16) | ('S' << 8) | 'N')

#define	ASGN_CHUNK					((int32) ('A' << 24) | ('S' << 16) | ('G' << 8) | 'N')

#define	HIDE_CHUNK					((int32) ('H' << 24) | ('I' << 16) | ('D' << 8) | 'E')
#define	UHID_CHUNK					((int32) ('U' << 24) | ('H' << 16) | ('I' << 8) | 'D')
#define	DSTR_CHUNK					((int32) ('D' << 24) | ('S' << 16) | ('T' << 8) | 'R')
#define	CHDE_CHUNK					((int32) ('C' << 24) | ('H' << 16) | ('D' << 8) | 'E')
#define	CUHD_CHUNK					((int32) ('C' << 24) | ('U' << 16) | ('H' << 8) | 'D')
#define	CDST_CHUNK					((int32) ('D' << 24) | ('D' << 16) | ('T' << 8) | 'S')

#define	CONV_CHUNK					((int32) ('C' << 24) | ('O' << 16) | ('N' << 8) | 'V')
#define	DECL_CHUNK					((int32) ('D' << 24) | ('E' << 16) | ('C' << 8) | 'L')

#define	FALL_CHUNK					((int32) ('F' << 24) | ('A' << 16) | ('L' << 8) | 'L')
#define	LNODE_CHUNK					((int32) ('L' << 24) | ('N' << 16) | ('O' << 8) | 'D')
#define	NODE_CHUNK					((int32) ('N' << 24) | ('O' << 16) | ('D' << 8) | 'E')
#define	ENTRY_CHUNK					((int32) ('E' << 24) | ('T' << 16) | ('R' << 8) | 'Y')
#define	TEXT_CHUNK					((int32) ('T' << 24) | ('E' << 16) | ('X' << 8) | 'T')

//reply
#define	REPLY_CHUNK					((int32) ('R' << 24) | ('P' << 16) | ('L' << 8) | 'Y')
#define	WEIGHT_REPLY_CHUNK			((int32) ('W' << 24) | ('R' << 16) | ('P' << 8) | 'L')
#define	WEIGHT_PREPLY_CHUNK			((int32) ('W' << 24) | ('P' << 16) | ('R' << 8) | 'L')
#define	COND_REPLY_CHUNK			((int32) ('C' << 24) | ('R' << 16) | ('P' << 8) | 'L')

#define	MESSAGE_CHUNK				((int32) ('M' << 24) | ('E' << 16) | ('S' << 8) | 'G')

// goto
#define	GOTO_CHUNK					((int32) ('G' << 24) | ('O' << 16) | ('T' << 8) | 'O')
#define	EXIT_GOTO_CHUNK				((int32) ('E' << 24) | ('X' << 16) | ('I' << 8) | 'T')
#define	COND_GOTO_CHUNK				((int32) ('C' << 24) | ('C' << 16) | ('G' << 8) | 'O')

#define	COND_EXIT_GOTO_CHUNK		((int32) ('C' << 24) | ('E' << 16) | ('G' << 8) | 'O')


struct Conv {
	int32 chunkSize = 0;
	char *conv = nullptr;
	int32 myCNode = 0;
	int32 exit_now = 0;
	int32 node_hash = 0;

	int32 mode = 0;
	int32 c_entry_num = 0;
	Common::Array<int32 *> _pointers;
};

struct ConvDisplayData {
	char *text[16];
	char *snd_files[16];
	char mesg[1024];
	char *mesg_snd_file;
	int	num_txt_ents;
	int	player_non_player;
	int	player_choice;
};

#include "common/pack-start.h"	// START STRUCT PACKING

struct conv_chunk {
	int32 tag;
	int32 size;
} PACKED_STRUCT;

struct decl_chunk {
	int32 tag;
	int32 val;
	int32 flags;
	int32 addrIndex;	// Index into Conv::_pointers array
} PACKED_STRUCT;

struct fall_chunk {
	int32 tag;
	int32 val;
	int32 index;
} PACKED_STRUCT;

struct node_chunk {
	int32 tag;
	int32 hash;
	int32 size;
	int32 num_entries;
} PACKED_STRUCT;

struct lnode_chunk {
	int32 tag;
	int32 hash;
	int32 size;
	int32 entry_num;
	int32 num_entries;
} PACKED_STRUCT;

struct entry_chunk {
	int32 tag;
	int32 size;
	int32 status;
} PACKED_STRUCT;

struct text_chunk {
	int32 tag;
	int32 size;
} PACKED_STRUCT;

struct mesg_chunk {
	int32 tag;
	int32 size;
} PACKED_STRUCT;

struct reply_chunk {
	int32 tag;
	int32 index;		// Where the message is located.
} PACKED_STRUCT;

struct c_reply_chunk {
	int32 tag;
	int32 op_l;
	int32 op;
	int32 op_r;
	int32 index;		// Where the message is located.
} PACKED_STRUCT;

struct w_reply_chunk {
	int32 tag;
	int32 num_replies;
} PACKED_STRUCT;

struct w_entry_chunk {
	int32 weight;
	int32 index;		// Where the message is located.
} PACKED_STRUCT;

struct goto_chunk {
	int32 tag;
	int32 index;		// Where the node is located.
} PACKED_STRUCT;

struct c_goto_chunk {
	int32 tag;
	int32 opnd1;		// Where the decl is located.
	int32 op;
	int32 opnd2;		// Integer value.
	int32 index;		// Where the node is located.
} PACKED_STRUCT;

struct misc_chunk {
	int32 tag;
	int32 index;		// Where the entry is located.
} PACKED_STRUCT;

struct c_misc_chunk {
	int32 tag;

	int32 c_op_l;	// Where the decl is located.
	int32 c_op;
	int32 c_op_r;	// Integer value.

	int32 index;		// Where the entry is located.
} PACKED_STRUCT;

struct assign_chunk {
	int32 tag;
	int32 index;		// Where the decl is located.
	int32 op;
	int32 opnd1;		// Integer value.
} PACKED_STRUCT;

struct c_assign_chunk {
	int32 tag;

	int32 c_op_l;	// Where the decl is located.
	int32 c_op;
	int32 c_op_r;	// Integer value.

	int32 index;		// Where the decl is located.
	int32 op;
	int32 opnd1;		// Integer value.
} PACKED_STRUCT;

#include "common/pack-end.h"	// END STRUCT PACKING

/**
  "xxxxxxxx"  means the size you have calculated a conversation box to be,
   x      x   given the sentences that are in it, and whatever border
   x      x   space you may have in it.  The boxes in Figure A may be
   xxxxxxxx   where the user wants to place them.  Obviously, the user
			  won't try to put them out in hyperspace, but may do this
			  if he wants the box to be flush with a corner (to grow
			  up, down, left, or right.)   Figure B is the re-calculated
			  coordinates of the boxes in order to get them onto the
			  background.  The new boxes should not be in the interface
			  or in the letterboxed areas at the top and bottom.




		   xxxxxxxxx
		   x   (d) x
		   x       x             Figure A                       xxxxxxxxxxxx
   0,0     xxxxxxxxx                                            x      (b) x
																x          x
																x          x
							 (letterbox at top)                 xxxxxxxxxxxx




							 (background)









														xxxxxxxxxxxxx
														x     (c)   x
														x           x
														x           x
														x           x
														x           x
 xxxxxxxxxxxxxxxxxx                                     x           x
 x                x                                     xxxxxxxxxxxxx
 x                x         (interface)
 x                x
 x                x
 x                x
 x                x         (letterbox at bottom)
 x                x
 x                x
 x (a)            x                                                  640,479
 xxxxxxxxxxxxxxxxxx






								 Figure B
   0,0






		   xxxxxxxx                                       xxxxxxxxxxx
		   x  (d) x                                       x     (b) x
		   x      x                                       x         x
		   xxxxxxxx                                       x         x
														  xxxxxxxxxxx
		 xxxxxxxxxxxxxxxxxx
		 x                x
		 x                x
		 x                x                             xxxxxxxxxxxxx
		 x                x                             x     (c)   x
		 x                x                             x           x
		 x                x                             x           x
		 x                x                             x           x
		 x (a)            x                             x           x
		 xxxxxxxxxxxxxxxxxx                             xxxxxxxxxxxxx











																	 640,479




  If someone says to draw conversation box (a) at the location in Figure 1,
  then have it automatically re-position itself into where it is in Figure 2.
  The extra space around the newly re-positioned box should be about 10 pixels
  wide and/or tall.  Make the spacing visually look identical.  In other
  words, if the height of the border is 10 pixels, the width on the side of
  the new conversation box may need to be 15.  You may have to experiment
  with this.  In even other words, you should correct for the aspect ration.

  The same thing should work for boxes (b), (c), and (d).
*/
void set_dlg_rect();

void conv_go(Conv *c);

} // End of namespace M4

#endif