]> icculus.org git repositories - btb/d2x.git/blob - main/hostage.c
added debug info for illegal side type (d1x r1.2, r1.4, r1.2, r1.2)
[btb/d2x.git] / main / hostage.c
1 /* $Id: hostage.c,v 1.3 2003-10-10 09:36:35 btb Exp $ */
2 /*
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
13 */
14
15 /*
16  *
17  * Code to render and manipulate hostages
18  *
19  * Old Log:
20  * Revision 1.1  1995/05/16  15:26:24  allender
21  * Initial revision
22  *
23  * Revision 2.0  1995/02/27  11:28:36  john
24  * New version 2.0, which has no anonymous unions, builds with
25  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
26  *
27  * Revision 1.65  1995/02/22  13:45:54  allender
28  * remove anonymous unions from object structure
29  *
30  * Revision 1.64  1995/02/13  20:34:57  john
31  * Lintized
32  *
33  * Revision 1.63  1995/01/15  19:41:48  matt
34  * Ripped out hostage faces for registered version
35  *
36  * Revision 1.62  1995/01/14  19:16:53  john
37  * First version of new bitmap paging code.
38  *
39  * Revision 1.61  1994/12/19  16:35:09  john
40  * Made hoastage playback end when ship dies.
41  *
42  * Revision 1.60  1994/12/06  16:30:41  yuan
43  * Localization
44  *
45  * Revision 1.59  1994/11/30  17:32:46  matt
46  * Put hostage_face_clip array back in so editor would work
47  *
48  * Revision 1.58  1994/11/30  17:22:13  matt
49  * Ripped out hostage faces in shareware version
50  *
51  * Revision 1.57  1994/11/30  16:11:25  matt
52  * Use correct constant for hostage voice
53  *
54  * Revision 1.56  1994/11/27  23:15:19  matt
55  * Made changes for new mprintf calling convention
56  *
57  * Revision 1.55  1994/11/19  19:53:44  matt
58  * Added code to full support different hostage head clip & message for
59  * each hostage.
60  *
61  * Revision 1.54  1994/11/19  16:35:15  matt
62  * Got rid of unused code, & made an array smaller
63  *
64  * Revision 1.53  1994/11/14  12:42:03  matt
65  * Increased palette flash when hostage rescued
66  *
67  * Revision 1.52  1994/10/28  14:43:09  john
68  * Added sound volumes to all sound calls.
69  *
70  * Revision 1.51  1994/10/23  02:10:57  matt
71  * Got rid of obsolete hostage_info stuff
72  *
73  * Revision 1.50  1994/10/22  00:08:44  matt
74  * Fixed up problems with bonus & game sequencing
75  * Player doesn't get credit for hostages unless he gets them out alive
76  *
77  * Revision 1.49  1994/10/20  22:52:49  matt
78  * Fixed compiler warnings
79  *
80  * Revision 1.48  1994/10/20  21:25:44  matt
81  * Took out silly scale down/scale up code for hostage anim
82  *
83  * Revision 1.47  1994/10/20  12:47:28  matt
84  * Replace old save files (MIN/SAV/HOT) with new LVL files
85  *
86  * Revision 1.46  1994/10/04  15:33:33  john
87  * Took out the old PLAY_SOUND??? code and replaced it
88  * with direct calls into digi_link_??? so that all sounds
89  * can be made 3d.
90  *
91  * Revision 1.45  1994/09/28  23:10:46  matt
92  * Made hostage rescue do palette flash
93  *
94  * Revision 1.44  1994/09/20  00:11:00  matt
95  * Finished gauges for Status Bar, including hostage video display.
96  *
97  * Revision 1.43  1994/09/15  21:24:19  matt
98  * Changed system to keep track of whether & what cockpit is up
99  * Made hostage clip not queue when no cockpit
100  *
101  *
102  * Revision 1.42  1994/08/25  13:45:19  matt
103  * Made hostage vclips queue
104  *
105  * Revision 1.41  1994/08/14  23:15:06  matt
106  * Added animating bitmap hostages, and cleaned up vclips a bit
107  *
108  * Revision 1.40  1994/08/12  22:41:11  john
109  * Took away Player_stats; add Players array.
110  *
111  * Revision 1.39  1994/07/14  22:06:35  john
112  * Fix radar/hostage vclip conflict.
113  *
114  * Revision 1.38  1994/07/12  18:40:21  yuan
115  * Tweaked location of radar and hostage screen...
116  * Still needs work.
117  *
118  *
119  * Revision 1.37  1994/07/07  09:52:17  john
120  * Moved hostage screen.
121  *
122  * Revision 1.36  1994/07/06  15:23:52  john
123  * Revamped hostage sound.
124  *
125  * Revision 1.35  1994/07/06  15:14:54  john
126  * Added hostage sound effect picking.
127  *
128  * Revision 1.34  1994/07/06  13:25:33  john
129  * Added compress hostages functions.
130  *
131  * Revision 1.33  1994/07/06  12:52:59  john
132  * Fixed compiler warnings.
133  *
134  * Revision 1.32  1994/07/06  12:43:50  john
135  * Made generic messages for hostages.
136  *
137  * Revision 1.31  1994/07/06  10:55:07  john
138  * New structures for hostages.
139  *
140  * Revision 1.30  1994/07/05  12:49:09  john
141  * Put functionality of New Hostage spec into code.
142  *
143  * Revision 1.29  1994/07/02  13:08:47  matt
144  * Increment stats when hostage rescued
145  *
146  * Revision 1.28  1994/07/01  18:07:46  john
147  * y
148  *
149  * Revision 1.27  1994/07/01  18:07:03  john
150  * *** empty log message ***
151  *
152  * Revision 1.26  1994/07/01  17:55:26  john
153  * First version of not-working hostage system.
154  *
155  * Revision 1.25  1994/06/27  15:53:21  john
156  * #define'd out the newdemo stuff
157  *
158  *
159  * Revision 1.24  1994/06/20  16:08:52  john
160  * Added volume control; made doors 3d sounds.
161  *
162  * Revision 1.23  1994/06/16  10:15:32  yuan
163  * Fixed location of face.
164  *
165  * Revision 1.22  1994/06/15  15:05:33  john
166  * *** empty log message ***
167  *
168  * Revision 1.21  1994/06/14  21:15:20  matt
169  * Made rod objects draw lighted or not depending on a parameter, so the
170  * materialization effect no longer darkens.
171  *
172  * Revision 1.20  1994/06/08  18:16:26  john
173  * Bunch of new stuff that basically takes constants out of the code
174  * and puts them into bitmaps.tbl.
175  *
176  * Revision 1.19  1994/06/02  19:30:08  matt
177  * Moved texture-mapped rod drawing stuff (used for hostage & now for the
178  * materialization center) to object.c
179  *
180  *
181  */
182
183 #ifdef HAVE_CONFIG_H
184 #include <conf.h>
185 #endif
186
187 #ifdef RCS
188 static char rcsid[] = "$Id: hostage.c,v 1.3 2003-10-10 09:36:35 btb Exp $";
189 #endif
190
191 #include <stdio.h>
192 #include <stdlib.h>
193 #include <string.h>
194
195 #include "error.h"
196
197 #include "inferno.h"
198 #include "object.h"
199 #include "game.h"
200 #include "player.h"
201 #include "gauges.h"
202 #include "hostage.h"
203 #include "vclip.h"
204 #include "newdemo.h"
205 #include "text.h"
206
207
208 //------------- Globaly used hostage variables --------------------------------
209
210 int N_hostage_types = 0;                                        // Number of hostage types
211 int Hostage_vclip_num[MAX_HOSTAGE_TYPES];       // vclip num for each tpye of hostage
212
213
214 //-------------- Renders a hostage --------------------------------------------
215 void draw_hostage(object *obj)
216 {
217         draw_object_tmap_rod(obj, Vclip[obj->rtype.vclip_info.vclip_num].frames[obj->rtype.vclip_info.framenum], 1);
218 }
219
220
221 //------------- Called once when a hostage is rescued -------------------------
222 void hostage_rescue(int blah)
223 {
224         //mprintf((0, "Rescued hostage %d", hostage_number));
225
226         PALETTE_FLASH_ADD(0, 0, 25);            //small blue flash
227
228         Players[Player_num].hostages_on_board++;
229
230         // Do an audio effect
231         if (Newdemo_state != ND_STATE_PLAYBACK)
232                 digi_play_sample(SOUND_HOSTAGE_RESCUED, F1_0);
233
234         HUD_init_message(TXT_HOSTAGE_RESCUED);
235 }