1 /*
2 ==============================================================================
3 
4 SUPERTANK
5 
6 ==============================================================================
7 */
8 
9 #include "g_local.h"
10 #include "m_supertank.h"
11 
12 qboolean visible (edict_t *self, edict_t *other);
13 
14 static int	sound_pain1;
15 static int	sound_pain2;
16 static int	sound_pain3;
17 static int	sound_death;
18 static int	sound_search1;
19 static int	sound_search2;
20 
21 static	int	tread_sound;
22 
23 void BossExplode (edict_t *self);
24 
TreadSound(edict_t * self)25 void TreadSound (edict_t *self)
26 {
27 	gi.sound (self, CHAN_VOICE, tread_sound, 1, ATTN_NORM, 0);
28 }
29 
supertank_search(edict_t * self)30 void supertank_search (edict_t *self)
31 {
32 	if (random() < 0.5)
33 		gi.sound (self, CHAN_VOICE, sound_search1, 1, ATTN_NORM, 0);
34 	else
35 		gi.sound (self, CHAN_VOICE, sound_search2, 1, ATTN_NORM, 0);
36 }
37 
38 
39 void supertank_dead (edict_t *self);
40 void supertankRocket (edict_t *self);
41 void supertankMachineGun (edict_t *self);
42 void supertank_reattack1(edict_t *self);
43 
44 
45 //
46 // stand
47 //
48 
49 mframe_t supertank_frames_stand []=
50 {
51 	ai_stand, 0, NULL,
52 	ai_stand, 0, NULL,
53 	ai_stand, 0, NULL,
54 	ai_stand, 0, NULL,
55 	ai_stand, 0, NULL,
56 	ai_stand, 0, NULL,
57 	ai_stand, 0, NULL,
58 	ai_stand, 0, NULL,
59 	ai_stand, 0, NULL,
60 	ai_stand, 0, NULL,
61 	ai_stand, 0, NULL,
62 	ai_stand, 0, NULL,
63 	ai_stand, 0, NULL,
64 	ai_stand, 0, NULL,
65 	ai_stand, 0, NULL,
66 	ai_stand, 0, NULL,
67 	ai_stand, 0, NULL,
68 	ai_stand, 0, NULL,
69 	ai_stand, 0, NULL,
70 	ai_stand, 0, NULL,
71 	ai_stand, 0, NULL,
72 	ai_stand, 0, NULL,
73 	ai_stand, 0, NULL,
74 	ai_stand, 0, NULL,
75 	ai_stand, 0, NULL,
76 	ai_stand, 0, NULL,
77 	ai_stand, 0, NULL,
78 	ai_stand, 0, NULL,
79 	ai_stand, 0, NULL,
80 	ai_stand, 0, NULL,
81 	ai_stand, 0, NULL,
82 	ai_stand, 0, NULL,
83 	ai_stand, 0, NULL,
84 	ai_stand, 0, NULL,
85 	ai_stand, 0, NULL,
86 	ai_stand, 0, NULL,
87 	ai_stand, 0, NULL,
88 	ai_stand, 0, NULL,
89 	ai_stand, 0, NULL,
90 	ai_stand, 0, NULL,
91 	ai_stand, 0, NULL,
92 	ai_stand, 0, NULL,
93 	ai_stand, 0, NULL,
94 	ai_stand, 0, NULL,
95 	ai_stand, 0, NULL,
96 	ai_stand, 0, NULL,
97 	ai_stand, 0, NULL,
98 	ai_stand, 0, NULL,
99 	ai_stand, 0, NULL,
100 	ai_stand, 0, NULL,
101 	ai_stand, 0, NULL,
102 	ai_stand, 0, NULL,
103 	ai_stand, 0, NULL,
104 	ai_stand, 0, NULL,
105 	ai_stand, 0, NULL,
106 	ai_stand, 0, NULL,
107 	ai_stand, 0, NULL,
108 	ai_stand, 0, NULL,
109 	ai_stand, 0, NULL,
110 	ai_stand, 0, NULL
111 };
112 mmove_t	supertank_move_stand = {FRAME_stand_1, FRAME_stand_60, supertank_frames_stand, NULL};
113 
supertank_stand(edict_t * self)114 void supertank_stand (edict_t *self)
115 {
116 	self->monsterinfo.currentmove = &supertank_move_stand;
117 }
118 
119 
120 mframe_t supertank_frames_run [] =
121 {
122 	ai_run, 12,	TreadSound,
123 	ai_run, 12,	NULL,
124 	ai_run, 12,	NULL,
125 	ai_run, 12,	NULL,
126 	ai_run, 12,	NULL,
127 	ai_run, 12,	NULL,
128 	ai_run, 12,	NULL,
129 	ai_run, 12,	NULL,
130 	ai_run, 12,	NULL,
131 	ai_run, 12,	NULL,
132 	ai_run, 12,	NULL,
133 	ai_run, 12,	NULL,
134 	ai_run, 12,	NULL,
135 	ai_run, 12,	NULL,
136 	ai_run, 12,	NULL,
137 	ai_run, 12,	NULL,
138 	ai_run, 12,	NULL,
139 	ai_run, 12,	NULL
140 };
141 mmove_t	supertank_move_run = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_run, NULL};
142 
143 //
144 // walk
145 //
146 
147 
148 mframe_t supertank_frames_forward [] =
149 {
150 	ai_walk, 4,	TreadSound,
151 	ai_walk, 4,	NULL,
152 	ai_walk, 4,	NULL,
153 	ai_walk, 4,	NULL,
154 	ai_walk, 4,	NULL,
155 	ai_walk, 4,	NULL,
156 	ai_walk, 4,	NULL,
157 	ai_walk, 4,	NULL,
158 	ai_walk, 4,	NULL,
159 	ai_walk, 4,	NULL,
160 	ai_walk, 4,	NULL,
161 	ai_walk, 4,	NULL,
162 	ai_walk, 4,	NULL,
163 	ai_walk, 4,	NULL,
164 	ai_walk, 4,	NULL,
165 	ai_walk, 4,	NULL,
166 	ai_walk, 4,	NULL,
167 	ai_walk, 4,	NULL
168 };
169 mmove_t	supertank_move_forward = {FRAME_forwrd_1, FRAME_forwrd_18, supertank_frames_forward, NULL};
170 
supertank_forward(edict_t * self)171 void supertank_forward (edict_t *self)
172 {
173 		self->monsterinfo.currentmove = &supertank_move_forward;
174 }
175 
supertank_walk(edict_t * self)176 void supertank_walk (edict_t *self)
177 {
178 		self->monsterinfo.currentmove = &supertank_move_forward;
179 }
180 
supertank_run(edict_t * self)181 void supertank_run (edict_t *self)
182 {
183 	if (self->monsterinfo.aiflags & AI_STAND_GROUND)
184 		self->monsterinfo.currentmove = &supertank_move_stand;
185 	else
186 		self->monsterinfo.currentmove = &supertank_move_run;
187 }
188 
189 mframe_t supertank_frames_turn_right [] =
190 {
191 	ai_move,	0,	TreadSound,
192 	ai_move,	0,	NULL,
193 	ai_move,	0,	NULL,
194 	ai_move,	0,	NULL,
195 	ai_move,	0,	NULL,
196 	ai_move,	0,	NULL,
197 	ai_move,	0,	NULL,
198 	ai_move,	0,	NULL,
199 	ai_move,	0,	NULL,
200 	ai_move,	0,	NULL,
201 	ai_move,	0,	NULL,
202 	ai_move,	0,	NULL,
203 	ai_move,	0,	NULL,
204 	ai_move,	0,	NULL,
205 	ai_move,	0,	NULL,
206 	ai_move,	0,	NULL,
207 	ai_move,	0,	NULL,
208 	ai_move,	0,	NULL
209 };
210 mmove_t supertank_move_turn_right = {FRAME_right_1, FRAME_right_18, supertank_frames_turn_right, supertank_run};
211 
212 mframe_t supertank_frames_turn_left [] =
213 {
214 	ai_move,	0,	TreadSound,
215 	ai_move,	0,	NULL,
216 	ai_move,	0,	NULL,
217 	ai_move,	0,	NULL,
218 	ai_move,	0,	NULL,
219 	ai_move,	0,	NULL,
220 	ai_move,	0,	NULL,
221 	ai_move,	0,	NULL,
222 	ai_move,	0,	NULL,
223 	ai_move,	0,	NULL,
224 	ai_move,	0,	NULL,
225 	ai_move,	0,	NULL,
226 	ai_move,	0,	NULL,
227 	ai_move,	0,	NULL,
228 	ai_move,	0,	NULL,
229 	ai_move,	0,	NULL,
230 	ai_move,	0,	NULL,
231 	ai_move,	0,	NULL
232 };
233 mmove_t supertank_move_turn_left = {FRAME_left_1, FRAME_left_18, supertank_frames_turn_left, supertank_run};
234 
235 
236 mframe_t supertank_frames_pain3 [] =
237 {
238 	ai_move,	0,	NULL,
239 	ai_move,	0,	NULL,
240 	ai_move,	0,	NULL,
241 	ai_move,	0,	NULL
242 };
243 mmove_t supertank_move_pain3 = {FRAME_pain3_9, FRAME_pain3_12, supertank_frames_pain3, supertank_run};
244 
245 mframe_t supertank_frames_pain2 [] =
246 {
247 	ai_move,	0,	NULL,
248 	ai_move,	0,	NULL,
249 	ai_move,	0,	NULL,
250 	ai_move,	0,	NULL
251 };
252 mmove_t supertank_move_pain2 = {FRAME_pain2_5, FRAME_pain2_8, supertank_frames_pain2, supertank_run};
253 
254 mframe_t supertank_frames_pain1 [] =
255 {
256 	ai_move,	0,	NULL,
257 	ai_move,	0,	NULL,
258 	ai_move,	0,	NULL,
259 	ai_move,	0,	NULL
260 };
261 mmove_t supertank_move_pain1 = {FRAME_pain1_1, FRAME_pain1_4, supertank_frames_pain1, supertank_run};
262 
263 mframe_t supertank_frames_death1 [] =
264 {
265 	ai_move,	0,	NULL,
266 	ai_move,	0,	NULL,
267 	ai_move,	0,	NULL,
268 	ai_move,	0,	NULL,
269 	ai_move,	0,	NULL,
270 	ai_move,	0,	NULL,
271 	ai_move,	0,	NULL,
272 	ai_move,	0,	NULL,
273 	ai_move,	0,	NULL,
274 	ai_move,	0,	NULL,
275 	ai_move,	0,	NULL,
276 	ai_move,	0,	NULL,
277 	ai_move,	0,	NULL,
278 	ai_move,	0,	NULL,
279 	ai_move,	0,	NULL,
280 	ai_move,	0,	NULL,
281 	ai_move,	0,	NULL,
282 	ai_move,	0,	NULL,
283 	ai_move,	0,	NULL,
284 	ai_move,	0,	NULL,
285 	ai_move,	0,	NULL,
286 	ai_move,	0,	NULL,
287 	ai_move,	0,	NULL,
288 	ai_move,	0,	BossExplode
289 };
290 mmove_t supertank_move_death = {FRAME_death_1, FRAME_death_24, supertank_frames_death1, supertank_dead};
291 
292 mframe_t supertank_frames_backward[] =
293 {
294 	ai_walk, 0,	TreadSound,
295 	ai_walk, 0,	NULL,
296 	ai_walk, 0,	NULL,
297 	ai_walk, 0,	NULL,
298 	ai_walk, 0,	NULL,
299 	ai_walk, 0,	NULL,
300 	ai_walk, 0,	NULL,
301 	ai_walk, 0,	NULL,
302 	ai_walk, 0,	NULL,
303 	ai_walk, 0,	NULL,
304 	ai_walk, 0,	NULL,
305 	ai_walk, 0,	NULL,
306 	ai_walk, 0,	NULL,
307 	ai_walk, 0,	NULL,
308 	ai_walk, 0,	NULL,
309 	ai_walk, 0,	NULL,
310 	ai_walk, 0,	NULL,
311 	ai_walk, 0,	NULL
312 };
313 mmove_t	supertank_move_backward = {FRAME_backwd_1, FRAME_backwd_18, supertank_frames_backward, NULL};
314 
315 mframe_t supertank_frames_attack4[]=
316 {
317 	ai_move,	0,	NULL,
318 	ai_move,	0,	NULL,
319 	ai_move,	0,	NULL,
320 	ai_move,	0,	NULL,
321 	ai_move,	0,	NULL,
322 	ai_move,	0,	NULL
323 };
324 mmove_t supertank_move_attack4 = {FRAME_attak4_1, FRAME_attak4_6, supertank_frames_attack4, supertank_run};
325 
326 mframe_t supertank_frames_attack3[]=
327 {
328 	ai_move,	0,	NULL,
329 	ai_move,	0,	NULL,
330 	ai_move,	0,	NULL,
331 	ai_move,	0,	NULL,
332 	ai_move,	0,	NULL,
333 	ai_move,	0,	NULL,
334 	ai_move,	0,	NULL,
335 	ai_move,	0,	NULL,
336 	ai_move,	0,	NULL,
337 	ai_move,	0,	NULL,
338 	ai_move,	0,	NULL,
339 	ai_move,	0,	NULL,
340 	ai_move,	0,	NULL,
341 	ai_move,	0,	NULL,
342 	ai_move,	0,	NULL,
343 	ai_move,	0,	NULL,
344 	ai_move,	0,	NULL,
345 	ai_move,	0,	NULL,
346 	ai_move,	0,	NULL,
347 	ai_move,	0,	NULL,
348 	ai_move,	0,	NULL,
349 	ai_move,	0,	NULL,
350 	ai_move,	0,	NULL,
351 	ai_move,	0,	NULL,
352 	ai_move,	0,	NULL,
353 	ai_move,	0,	NULL,
354 	ai_move,	0,	NULL
355 };
356 mmove_t supertank_move_attack3 = {FRAME_attak3_1, FRAME_attak3_27, supertank_frames_attack3, supertank_run};
357 
358 mframe_t supertank_frames_attack2[]=
359 {
360 	ai_charge,	0,	NULL,
361 	ai_charge,	0,	NULL,
362 	ai_charge,	0,	NULL,
363 	ai_charge,	0,	NULL,
364 	ai_charge,	0,	NULL,
365 	ai_charge,	0,	NULL,
366 	ai_charge,	0,	NULL,
367 	ai_charge,	0,	supertankRocket,
368 	ai_move,	0,	NULL,
369 	ai_move,	0,	NULL,
370 	ai_move,	0,	supertankRocket,
371 	ai_move,	0,	NULL,
372 	ai_move,	0,	NULL,
373 	ai_move,	0,	supertankRocket,
374 	ai_move,	0,	NULL,
375 	ai_move,	0,	NULL,
376 	ai_move,	0,	NULL,
377 	ai_move,	0,	NULL,
378 	ai_move,	0,	NULL,
379 	ai_move,	0,	NULL,
380 	ai_move,	0,	NULL,
381 	ai_move,	0,	NULL,
382 	ai_move,	0,	NULL,
383 	ai_move,	0,	NULL,
384 	ai_move,	0,	NULL,
385 	ai_move,	0,	NULL,
386 	ai_move,	0,	NULL
387 };
388 mmove_t supertank_move_attack2 = {FRAME_attak2_1, FRAME_attak2_27, supertank_frames_attack2, supertank_run};
389 
390 mframe_t supertank_frames_attack1[]=
391 {
392 	ai_charge,	0,	supertankMachineGun,
393 	ai_charge,	0,	supertankMachineGun,
394 	ai_charge,	0,	supertankMachineGun,
395 	ai_charge,	0,	supertankMachineGun,
396 	ai_charge,	0,	supertankMachineGun,
397 	ai_charge,	0,	supertankMachineGun,
398 
399 };
400 mmove_t supertank_move_attack1 = {FRAME_attak1_1, FRAME_attak1_6, supertank_frames_attack1, supertank_reattack1};
401 
402 mframe_t supertank_frames_end_attack1[]=
403 {
404 	ai_move,	0,	NULL,
405 	ai_move,	0,	NULL,
406 	ai_move,	0,	NULL,
407 	ai_move,	0,	NULL,
408 	ai_move,	0,	NULL,
409 	ai_move,	0,	NULL,
410 	ai_move,	0,	NULL,
411 	ai_move,	0,	NULL,
412 	ai_move,	0,	NULL,
413 	ai_move,	0,	NULL,
414 	ai_move,	0,	NULL,
415 	ai_move,	0,	NULL,
416 	ai_move,	0,	NULL,
417 	ai_move,	0,	NULL
418 };
419 mmove_t supertank_move_end_attack1 = {FRAME_attak1_7, FRAME_attak1_20, supertank_frames_end_attack1, supertank_run};
420 
421 
supertank_reattack1(edict_t * self)422 void supertank_reattack1(edict_t *self)
423 {
424 	if (visible(self, self->enemy))
425 		if (random() < 0.9)
426 			self->monsterinfo.currentmove = &supertank_move_attack1;
427 		else
428 			self->monsterinfo.currentmove = &supertank_move_end_attack1;
429 	else
430 		self->monsterinfo.currentmove = &supertank_move_end_attack1;
431 }
432 
supertank_pain(edict_t * self,edict_t * other,float kick,int damage)433 void supertank_pain (edict_t *self, edict_t *other, float kick, int damage)
434 {
435 
436 	if (self->health < (self->max_health / 2))
437 			self->s.skinnum = 1;
438 
439 	if (level.time < self->pain_debounce_time)
440 			return;
441 
442 	// Lessen the chance of him going into his pain frames
443 	if (damage <=25)
444 		if (random()<0.2)
445 			return;
446 
447 	// Don't go into pain if he's firing his rockets
448 	if (skill->value >= 2)
449 		if ( (self->s.frame >= FRAME_attak2_1) && (self->s.frame <= FRAME_attak2_14) )
450 			return;
451 
452 	self->pain_debounce_time = level.time + 3;
453 
454 	if (skill->value == 3)
455 		return;		// no pain anims in nightmare
456 
457 	if (damage <= 10)
458 	{
459 		gi.sound (self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM,0);
460 		self->monsterinfo.currentmove = &supertank_move_pain1;
461 	}
462 	else if (damage <= 25)
463 	{
464 		gi.sound (self, CHAN_VOICE, sound_pain3, 1, ATTN_NORM,0);
465 		self->monsterinfo.currentmove = &supertank_move_pain2;
466 	}
467 	else
468 	{
469 		gi.sound (self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM,0);
470 		self->monsterinfo.currentmove = &supertank_move_pain3;
471 	}
472 };
473 
474 
supertankRocket(edict_t * self)475 void supertankRocket (edict_t *self)
476 {
477 	vec3_t	forward, right;
478 	vec3_t	start;
479 	vec3_t	dir;
480 	vec3_t	vec;
481 	int		flash_number;
482 
483 	if(!self->enemy || !self->enemy->inuse)		//PGM
484 		return;									//PGM
485 
486 	if (self->s.frame == FRAME_attak2_8)
487 		flash_number = MZ2_SUPERTANK_ROCKET_1;
488 	else if (self->s.frame == FRAME_attak2_11)
489 		flash_number = MZ2_SUPERTANK_ROCKET_2;
490 	else // (self->s.frame == FRAME_attak2_14)
491 		flash_number = MZ2_SUPERTANK_ROCKET_3;
492 
493 	AngleVectors (self->s.angles, forward, right, NULL);
494 	G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
495 
496 	VectorCopy (self->enemy->s.origin, vec);
497 	vec[2] += self->enemy->viewheight;
498 	VectorSubtract (vec, start, dir);
499 	VectorNormalize (dir);
500 
501 	monster_fire_rocket (self, start, dir, 50, 500, flash_number);
502 }
503 
supertankMachineGun(edict_t * self)504 void supertankMachineGun (edict_t *self)
505 {
506 	vec3_t	dir;
507 	vec3_t	vec;
508 	vec3_t	start;
509 	vec3_t	forward, right;
510 	int		flash_number;
511 
512 	if(!self->enemy || !self->enemy->inuse)		//PGM
513 		return;									//PGM
514 
515 	flash_number = MZ2_SUPERTANK_MACHINEGUN_1 + (self->s.frame - FRAME_attak1_1);
516 
517 	//FIXME!!!
518 	dir[0] = 0;
519 	dir[1] = self->s.angles[1];
520 	dir[2] = 0;
521 
522 	AngleVectors (dir, forward, right, NULL);
523 	G_ProjectSource (self->s.origin, monster_flash_offset[flash_number], forward, right, start);
524 
525 	if (self->enemy)
526 	{
527 		VectorCopy (self->enemy->s.origin, vec);
528 		VectorMA (vec, 0, self->enemy->velocity, vec);
529 		vec[2] += self->enemy->viewheight;
530 		VectorSubtract (vec, start, forward);
531 		VectorNormalize (forward);
532   }
533 
534 	monster_fire_bullet (self, start, forward, 6, 4, DEFAULT_BULLET_HSPREAD, DEFAULT_BULLET_VSPREAD, flash_number);
535 }
536 
537 
supertank_attack(edict_t * self)538 void supertank_attack(edict_t *self)
539 {
540 	vec3_t	vec;
541 	float	range;
542 	//float	r;
543 
544 	VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
545 	range = VectorLength (vec);
546 
547 	//r = random();
548 
549 	// Attack 1 == Chaingun
550 	// Attack 2 == Rocket Launcher
551 
552 	if (range <= 160)
553 	{
554 		self->monsterinfo.currentmove = &supertank_move_attack1;
555 	}
556 	else
557 	{	// fire rockets more often at distance
558 		if (random() < 0.3)
559 			self->monsterinfo.currentmove = &supertank_move_attack1;
560 		else
561 			self->monsterinfo.currentmove = &supertank_move_attack2;
562 	}
563 }
564 
565 
566 //
567 // death
568 //
569 
supertank_dead(edict_t * self)570 void supertank_dead (edict_t *self)
571 {
572 	VectorSet (self->mins, -60, -60, 0);
573 	VectorSet (self->maxs, 60, 60, 72);
574 	self->movetype = MOVETYPE_TOSS;
575 	self->svflags |= SVF_DEADMONSTER;
576 	self->nextthink = 0;
577 	gi.linkentity (self);
578 }
579 
580 
BossExplode(edict_t * self)581 void BossExplode (edict_t *self)
582 {
583 	vec3_t	org;
584 	int		n;
585 
586 	self->think = BossExplode;
587 	VectorCopy (self->s.origin, org);
588 	org[2] += 24 + (rand()&15);
589 	switch (self->count++)
590 	{
591 	case 0:
592 		org[0] -= 24;
593 		org[1] -= 24;
594 		break;
595 	case 1:
596 		org[0] += 24;
597 		org[1] += 24;
598 		break;
599 	case 2:
600 		org[0] += 24;
601 		org[1] -= 24;
602 		break;
603 	case 3:
604 		org[0] -= 24;
605 		org[1] += 24;
606 		break;
607 	case 4:
608 		org[0] -= 48;
609 		org[1] -= 48;
610 		break;
611 	case 5:
612 		org[0] += 48;
613 		org[1] += 48;
614 		break;
615 	case 6:
616 		org[0] -= 48;
617 		org[1] += 48;
618 		break;
619 	case 7:
620 		org[0] += 48;
621 		org[1] -= 48;
622 		break;
623 	case 8:
624 		self->s.sound = 0;
625 		for (n= 0; n < 4; n++)
626 			ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", 500, GIB_ORGANIC);
627 		for (n= 0; n < 8; n++)
628 			ThrowGib (self, "models/objects/gibs/sm_metal/tris.md2", 500, GIB_METALLIC);
629 		ThrowGib (self, "models/objects/gibs/chest/tris.md2", 500, GIB_ORGANIC);
630 		ThrowHead (self, "models/objects/gibs/gear/tris.md2", 500, GIB_METALLIC);
631 		self->deadflag = DEAD_DEAD;
632 		return;
633 	}
634 
635 	gi.WriteByte (svc_temp_entity);
636 	gi.WriteByte (TE_EXPLOSION1);
637 	gi.WritePosition (org);
638 	gi.multicast (self->s.origin, MULTICAST_PVS);
639 
640 	self->nextthink = level.time + 0.1;
641 }
642 
643 
supertank_die(edict_t * self,edict_t * inflictor,edict_t * attacker,int damage,vec3_t point)644 void supertank_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
645 {
646 	gi.sound (self, CHAN_VOICE, sound_death, 1, ATTN_NORM, 0);
647 	self->deadflag = DEAD_DEAD;
648 	self->takedamage = DAMAGE_NO;
649 	self->count = 0;
650 	self->monsterinfo.currentmove = &supertank_move_death;
651 }
652 
653 
654 //===========
655 //PGM
supertank_blocked(edict_t * self,float dist)656 qboolean supertank_blocked (edict_t *self, float dist)
657 {
658 	if(blocked_checkshot (self, 0.25 + (0.05 * skill->value) ))
659 		return true;
660 
661 	if(blocked_checkplat (self, dist))
662 		return true;
663 
664 	return false;
665 }
666 //PGM
667 //===========
668 
669 //
670 // monster_supertank
671 //
672 
673 /*QUAKED monster_supertank (1 .5 0) (-64 -64 0) (64 64 72) Ambush Trigger_Spawn Sight
674 */
SP_monster_supertank(edict_t * self)675 void SP_monster_supertank (edict_t *self)
676 {
677 	if (deathmatch->value)
678 	{
679 		G_FreeEdict (self);
680 		return;
681 	}
682 
683 	sound_pain1 = gi.soundindex ("bosstank/btkpain1.wav");
684 	sound_pain2 = gi.soundindex ("bosstank/btkpain2.wav");
685 	sound_pain3 = gi.soundindex ("bosstank/btkpain3.wav");
686 	sound_death = gi.soundindex ("bosstank/btkdeth1.wav");
687 	sound_search1 = gi.soundindex ("bosstank/btkunqv1.wav");
688 	sound_search2 = gi.soundindex ("bosstank/btkunqv2.wav");
689 
690 //	self->s.sound = gi.soundindex ("bosstank/btkengn1.wav");
691 	tread_sound = gi.soundindex ("bosstank/btkengn1.wav");
692 
693 	self->movetype = MOVETYPE_STEP;
694 	self->solid = SOLID_BBOX;
695 	self->s.modelindex = gi.modelindex ("models/monsters/boss1/tris.md2");
696 	VectorSet (self->mins, -64, -64, 0);
697 	VectorSet (self->maxs, 64, 64, 112);
698 
699 	self->health = 1500;
700 	self->gib_health = -500;
701 	self->mass = 800;
702 
703 	self->pain = supertank_pain;
704 	self->die = supertank_die;
705 	self->monsterinfo.stand = supertank_stand;
706 	self->monsterinfo.walk = supertank_walk;
707 	self->monsterinfo.run = supertank_run;
708 	self->monsterinfo.dodge = NULL;
709 	self->monsterinfo.attack = supertank_attack;
710 	self->monsterinfo.search = supertank_search;
711 	self->monsterinfo.melee = NULL;
712 	self->monsterinfo.sight = NULL;
713 	self->monsterinfo.blocked = supertank_blocked;		//PGM
714 
715 	gi.linkentity (self);
716 
717 	self->monsterinfo.currentmove = &supertank_move_stand;
718 	self->monsterinfo.scale = MODEL_SCALE;
719 
720 	walkmonster_start(self);
721 
722 	//PMM
723 	self->monsterinfo.aiflags |= AI_IGNORE_SHOTS;
724 	//pmm
725 }
726