-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathC5_ACT4.C
414 lines (328 loc) · 10.8 KB
/
C5_ACT4.C
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
/* Catacomb Armageddon Source Code
* Copyright (C) 1993-2014 Flat Rock Software
*
* 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 2 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
// C4_PLAY.C
#include "DEF.H"
#pragma hdrstop
/*
=============================================================================
LOCAL CONSTANTS
=============================================================================
*/
//-------------------------------------------------------------------------
//
// ARCH OBJECTS
//
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// ARCH
//-------------------------------------------------------------------------
void SpawnArch(int tilex, int tiley, int num);
extern statetype s_arch_1;
extern statetype s_arch_2;
extern statetype s_arch_3;
extern statetype s_arch_4;
extern statetype s_arch_5;
extern statetype s_arch_6;
extern statetype s_arch_7;
extern statetype s_arch_8;
extern statetype s_arch_9;
extern statetype s_arch_10;
extern statetype s_arch_11;
extern statetype s_arch_12;
extern statetype s_arch_13;
statetype s_arch_1 = {ARCH1PIC, 20, NULL, &s_arch_1};
statetype s_arch_2 = {ARCH2PIC, 20, NULL, &s_arch_2};
statetype s_arch_3 = {ARCH3PIC, 20, NULL, &s_arch_3};
statetype s_arch_4 = {ARCH4PIC, 20, NULL, &s_arch_4};
statetype s_arch_5 = {ARCH5PIC, 20, NULL, &s_arch_5};
statetype s_arch_6 = {ARCH6PIC, 20, NULL, &s_arch_6};
statetype s_arch_7 = {ARCH7PIC, 20, NULL, &s_arch_7};
statetype s_arch_8 = {ARCH8PIC, 20, NULL, &s_arch_8};
statetype s_arch_9 = {ARCH9PIC, 20, NULL, &s_arch_9};
statetype s_arch_10 = {ARCH10PIC, 20, NULL, &s_arch_10};
statetype s_arch_11 = {ARCH11PIC, 20, NULL, &s_arch_11};
statetype s_arch_12 = {ARCH12PIC, 20, NULL, &s_arch_12};
statetype s_arch_13 = {ARCH13PIC, 20, NULL, &s_arch_13};
void SpawnArch (int tilex, int tiley, int num)
{
statetype *objstate;
switch (num)
{
case 1:
objstate = &s_arch_1;
break;
case 2:
objstate = &s_arch_2;
break;
case 3:
objstate = &s_arch_3;
break;
case 4:
objstate = &s_arch_4;
break;
case 5:
objstate = &s_arch_5;
break;
case 6:
objstate = &s_arch_6;
break;
case 7:
objstate = &s_arch_7;
break;
case 8:
objstate = &s_arch_8;
break;
case 9:
objstate = &s_arch_9;
break;
case 10:
objstate = &s_arch_10;
break;
case 11:
objstate = &s_arch_11;
break;
case 12:
objstate = &s_arch_12;
break;
case 13:
objstate = &s_arch_13;
break;
}
ASpawnNewObj(tilex,tiley,objstate,PIXRADIUS*35);
new->obclass = solidobj;
new->flags &= ~of_shootable;
}
//-------------------------------------------------------------------------
//
// MISC OBJECTS
//
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// COLUMN, SULPHUR GAS HOLE, FIRE POT, FOUNTAIN
//-------------------------------------------------------------------------
void SpawnMiscObjects(int tilex, int tiley, int num);
extern statetype s_column;
extern statetype s_sulphur_gas_1;
extern statetype s_sulphur_gas_2;
extern statetype s_sulphur_gas_3;
extern statetype s_fire_pot_1;
extern statetype s_fire_pot_2;
extern statetype s_fountain;
statetype s_column = {COLUMNPIC, 20, NULL, &s_column};
statetype s_sulphur_gas_1 = {SULPHUR_GAS_1PIC, 20, NULL, &s_sulphur_gas_2};
statetype s_sulphur_gas_2 = {SULPHUR_GAS_2PIC, 20, NULL, &s_sulphur_gas_3};
statetype s_sulphur_gas_3 = {SULPHUR_GAS_3PIC, 20, NULL, &s_sulphur_gas_1};
statetype s_fire_pot_1 = {FIRE_POT_1PIC, 20, NULL, &s_fire_pot_2};
statetype s_fire_pot_2 = {FIRE_POT_2PIC, 20, NULL, &s_fire_pot_1};
statetype s_fountain = {WFOUNTAINPIC, 20, NULL, &s_fountain};
void SpawnMiscObjects(int tilex, int tiley, int num)
{
statetype *objstate;
switch (num)
{
case 1:
objstate = &s_column;
break;
case 2:
objstate = &s_sulphur_gas_1;
break;
case 3:
objstate = &s_fire_pot_1;
break;
case 4:
objstate = &s_fountain;
break;
}
SpawnNewObj(tilex,tiley,objstate,PIXRADIUS*35);
new->obclass = realsolidobj;
if (num == 2)
new->flags &= ~of_shootable;
else
new->flags |= of_shootable;
}
#if 0
void SpawnColumn(int tilex, int tiley);
extern statetype s_column;
statetype s_column = {COLUMNPIC, 20, NULL, &s_column};
void SpawnColumn(int tilex, int tiley)
{
SpawnNewObj(tilex,tiley,&s_column,PIXRADIUS*35);
new->obclass = realsolidobj;
new->flags |= of_shootable;
}
//-------------------------------------------------------------------------
// SULPHUR GAS
//-------------------------------------------------------------------------
void SpawnSulphurGas(int tilex, int tiley);
extern statetype s_sulphur_gas_1;
extern statetype s_sulphur_gas_2;
extern statetype s_sulphur_gas_3;
statetype s_sulphur_gas_1 = {SULPHUR_GAS_1PIC, 20, NULL, &s_sulphur_gas_2};
statetype s_sulphur_gas_2 = {SULPHUR_GAS_2PIC, 20, NULL, &s_sulphur_gas_3};
statetype s_sulphur_gas_3 = {SULPHUR_GAS_3PIC, 20, NULL, &s_sulphur_gas_1};
void SpawnSulphurGas(int tilex, int tiley)
{
SpawnNewObj(tilex,tiley,&s_sulphur_gas_1,PIXRADIUS*35);
new->obclass = realsolidobj;
new->flags &= ~of_shootable;
}
//-------------------------------------------------------------------------
// FIRE POT
//-------------------------------------------------------------------------
void SpawnFirePot(int tilex, int tiley);
extern statetype s_fire_pot_1;
extern statetype s_fire_pot_2;
statetype s_fire_pot_1 = {FIRE_POT_1PIC, 20, NULL, &s_fire_pot_2};
statetype s_fire_pot_2 = {FIRE_POT_2PIC, 20, NULL, &s_fire_pot_1};
void SpawnFirePot(int tilex, int tiley)
{
SpawnNewObj(tilex,tiley,&s_fire_pot_1,PIXRADIUS*35);
new->obclass = realsolidobj;
new->flags |= of_shootable;
}
//------------------------------------------------------------------------
// FOUNTAIN
//------------------------------------------------------------------------
void SpawnFountain(int tilex, int tiley);
extern statetype s_fountain;
statetype s_fountain = {WFOUNTAINPIC, 20, NULL, &s_fountain};
void SpawnFountain(int tilex, int tiley)
{
SpawnNewObj(tilex,tiley,&s_fountain,PIXRADIUS*35);
new->obclass = realsolidobj;
new->flags |= of_shootable;
}
#endif
//------------------------------------------------------------------------
// FORCE FIELD
//------------------------------------------------------------------------
void SpawnForceField(int tilex, int tiley);
void T_ForceField(objtype *ob);
void T_ForceFieldRemove(objtype *ob);
extern statetype s_force_field_1;
extern statetype s_force_field_2;
extern statetype s_force_field_3;
extern statetype s_force_field_4;
extern statetype s_force_field_die1;
statetype s_force_field_1 = {FORCE_FIELD_1PIC, 10, T_ForceField, &s_force_field_2};
statetype s_force_field_2 = {FORCE_FIELD_2PIC, 10, T_ForceField, &s_force_field_3};
statetype s_force_field_3 = {FORCE_FIELD_3PIC, 10, T_ForceField, &s_force_field_4};
statetype s_force_field_4 = {FORCE_FIELD_4PIC, 10, T_ForceField, &s_force_field_1};
statetype s_force_field_die = {0,0,T_ForceFieldRemove,&s_force_field_die1};
statetype s_force_field_die1 = {0,0,NULL,NULL};
void SpawnForceField(int tilex, int tiley)
{
SpawnNewObj(tilex,tiley,&s_force_field_1,PIXRADIUS*35);
new->obclass = solidobj;
new->hitpoints = EasyHitPoints(20);
new->flags |= of_forcefield; //sets bit 7 :: makes it nonsolid, but also detectable
// without adding another object type!
new->flags |= of_shootable;
}
void T_ForceField(objtype *ob)
{
long move,deltax,deltay,size;
size = (long)ob->size + player->size;
deltax = ob->x - player->x;
deltay = ob->y - player->y;
if (deltax <= size && deltax >= -size
&& deltay <= size && deltay >= -size)
TakeDamage (20);
}
void T_ForceFieldRemove(objtype *ob)
{
actorat[ob->tilex][ob->tiley] = 0;
}
//------------------------------------------------------------------------
// SKELETON HANGING FROM CEILING
//------------------------------------------------------------------------
void SpawnSkeletonHanging(int tilex, int tiley);
void T_SkelHangThink(objtype *ob);
extern statetype s_skeleton_hanging;
statetype s_skeleton_hanging = {SKEL_HANGPIC, 20, T_SkelHangThink, &s_skeleton_hanging};
void SpawnSkeletonHanging(int tilex, int tiley)
{
unsigned tile;
SpawnNewObj(tilex,tiley,&s_skeleton_hanging,PIXRADIUS*35);
new->obclass = solidobj;
tile = *(mapsegs[2]+farmapylookup[tiley+1]+tilex);
if (tile)
new->temp1 = (tile>>8)*30;
else
new->temp1 = (3*60)+random(4*60);
new->flags |= of_shootable;
}
void T_SkelHangThink(objtype *ob)
{
ob->temp1 -= realtics;
if (ob->temp1 <= 0)
{
ob->state = &s_skel_1;
ob->ticcount = ob->state->tictime;
ob->obclass = skeletonobj;
ob->speed = 2036;
ob->flags |= of_shootable;
ob->hitpoints = EasyHitPoints(12);
}
}
/////////////////////////////////////////////////////////////////////////////
//
// EasyHitPoints
//
// Checks to see if the player has selected the easy mode for playing.
// If so then the normal hit points are cut in half.
// This is when the object is spawned.
//
// Parms
// NrmHitPts - the normal hit points
//
// Returns
// Half of NrmHitPts
//
/////////////////////////////////////////////////////////////////////////////
int EasyHitPoints(int NrmHitPts)
{
if (EASYMODEON) // Wimpy, Wimpy, Wimpy!!!!!
{
return(NrmHitPts/4);
}
else
return(NrmHitPts);
}
/////////////////////////////////////////////////////////////////////////////
//
// EasyDoDamage
//
// Checks to see if the player has selected the easy mode for playing.
// If so then the normal amount of damage is cut in half.
// This is called each time a monster does damage.
//
// Parms
// Damage - the normal damage taken
//
// Returns
// Half of Damage
//
/////////////////////////////////////////////////////////////////////////////
int EasyDoDamage(int Damage)
{
if (EASYMODEON) // Wimpy, Wimpy, Wimpy!!!!!
return(Damage/2);
else
return(Damage);
}