1 /*
2 ==============================================================================
3 
4 insane
5 
6 ==============================================================================
7 */
8 
9 #include "g_local.h"
10 #include "m_insane.h"
11 
12 
13 static int	sound_fist;
14 static int	sound_shake;
15 static int	sound_moan;
16 static int	sound_scream[8];
17 
insane_fist(edict_t * self)18 void insane_fist (edict_t *self)
19 {
20 	gi.sound (self, CHAN_VOICE, sound_fist, 1, ATTN_IDLE, 0);
21 }
22 
insane_shake(edict_t * self)23 void insane_shake (edict_t *self)
24 {
25 	gi.sound (self, CHAN_VOICE, sound_shake, 1, ATTN_IDLE, 0);
26 }
27 
insane_moan(edict_t * self)28 void insane_moan (edict_t *self)
29 {
30 	gi.sound (self, CHAN_VOICE, sound_moan, 1, ATTN_IDLE, 0);
31 }
32 
insane_scream(edict_t * self)33 void insane_scream (edict_t *self)
34 {
35 	gi.sound (self, CHAN_VOICE, sound_scream[rand()%8], 1, ATTN_IDLE, 0);
36 }
37 
38 
39 void insane_stand (edict_t *self);
40 void insane_dead (edict_t *self);
41 void insane_cross (edict_t *self);
42 void insane_walk (edict_t *self);
43 void insane_run (edict_t *self);
44 void insane_checkdown (edict_t *self);
45 void insane_checkup (edict_t *self);
46 void insane_onground (edict_t *self);
47 
48 
49 mframe_t insane_frames_stand_normal [] =
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, insane_checkdown
57 };
58 mmove_t insane_move_stand_normal = {FRAME_stand60, FRAME_stand65, insane_frames_stand_normal, insane_stand};
59 
60 mframe_t insane_frames_stand_insane [] =
61 {
62 	ai_stand,	0,	insane_shake,
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,	insane_checkdown
92 };
93 mmove_t insane_move_stand_insane = {FRAME_stand65, FRAME_stand94, insane_frames_stand_insane, insane_stand};
94 
95 mframe_t insane_frames_uptodown [] =
96 {
97 	ai_move,	0,	NULL,
98 	ai_move,	0,	NULL,
99 	ai_move,	0,	NULL,
100 	ai_move,	0,	NULL,
101 	ai_move,	0,	NULL,
102 	ai_move,	0,	NULL,
103 	ai_move,	0,	NULL,
104 	ai_move,	0,	insane_moan,
105 	ai_move,	0,	NULL,
106 	ai_move,	0,	NULL,
107 
108 	ai_move,	0,	NULL,
109 	ai_move,	0,	NULL,
110 	ai_move,	0,	NULL,
111 	ai_move,	0,	NULL,
112 	ai_move,	0,	NULL,
113 	ai_move,	0,	NULL,
114 	ai_move,	0,	NULL,
115 	ai_move,	0,	NULL,
116 	ai_move,	0,	NULL,
117 	ai_move,	0,	NULL,
118 
119 	ai_move,	2.7,	NULL,
120 	ai_move,	4.1,	NULL,
121 	ai_move,	6,		NULL,
122 	ai_move,	7.6,	NULL,
123 	ai_move,	3.6,	NULL,
124 	ai_move,	0,	NULL,
125 	ai_move,	0,	NULL,
126 	ai_move,	0,	insane_fist,
127 	ai_move,	0,	NULL,
128 	ai_move,	0,	NULL,
129 
130 	ai_move,	0,	NULL,
131 	ai_move,	0,	NULL,
132 	ai_move,	0,	NULL,
133 	ai_move,	0,	insane_fist,
134 	ai_move,	0,	NULL,
135 	ai_move,	0,	NULL,
136 	ai_move,	0,	NULL,
137 	ai_move,	0,	NULL,
138 	ai_move,	0,	NULL,
139 	ai_move,	0,	NULL
140 };
141 mmove_t insane_move_uptodown = {FRAME_stand1, FRAME_stand40, insane_frames_uptodown, insane_onground};
142 
143 
144 mframe_t insane_frames_downtoup [] =
145 {
146 	ai_move,	-0.7,	NULL,			// 41
147 	ai_move,	-1.2,	NULL,			// 42
148 	ai_move,	-1.5,		NULL,		// 43
149 	ai_move,	-4.5,		NULL,		// 44
150 	ai_move,	-3.5,	NULL,			// 45
151 	ai_move,	-0.2,	NULL,			// 46
152 	ai_move,	0,	NULL,			// 47
153 	ai_move,	-1.3,	NULL,			// 48
154 	ai_move,	-3,	NULL,				// 49
155 	ai_move,	-2,	NULL,			// 50
156 	ai_move,	0,	NULL,				// 51
157 	ai_move,	0,	NULL,				// 52
158 	ai_move,	0,	NULL,				// 53
159 	ai_move,	-3.3,	NULL,			// 54
160 	ai_move,	-1.6,	NULL,			// 55
161 	ai_move,	-0.3,	NULL,			// 56
162 	ai_move,	0,	NULL,				// 57
163 	ai_move,	0,	NULL,				// 58
164 	ai_move,	0,	NULL				// 59
165 };
166 mmove_t insane_move_downtoup = {FRAME_stand41, FRAME_stand59, insane_frames_downtoup, insane_stand};
167 
168 mframe_t insane_frames_jumpdown [] =
169 {
170 	ai_move,	0.2,	NULL,
171 	ai_move,	11.5,	NULL,
172 	ai_move,	5.1,	NULL,
173 	ai_move,	7.1,	NULL,
174 	ai_move,	0,	NULL
175 };
176 mmove_t insane_move_jumpdown = {FRAME_stand96, FRAME_stand100, insane_frames_jumpdown, insane_onground};
177 
178 
179 mframe_t insane_frames_down [] =
180 {
181 	ai_move,	0,		NULL,		// 100
182 	ai_move,	0,		NULL,
183 	ai_move,	0,		NULL,
184 	ai_move,	0,		NULL,
185 	ai_move,	0,		NULL,
186 	ai_move,	0,		NULL,
187 	ai_move,	0,		NULL,
188 	ai_move,	0,		NULL,
189 	ai_move,	0,		NULL,
190 	ai_move,	0,		NULL,
191 	ai_move,	0,		NULL,		// 110
192 	ai_move,	-1.7,		NULL,
193 	ai_move,	-1.6,		NULL,
194 	ai_move,	0,		NULL,
195 	ai_move,	0,		NULL,
196 	ai_move,	0,		NULL,
197 	ai_move,	0,		insane_fist,
198 	ai_move,	0,		NULL,
199 	ai_move,	0,		NULL,
200 	ai_move,	0,		NULL,
201 	ai_move,	0,		NULL,		// 120
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 	ai_move,	0,		NULL,
210 	ai_move,	0,		NULL,
211 	ai_move,	0,		NULL,		// 130
212 	ai_move,	0,		NULL,
213 	ai_move,	0,		NULL,
214 	ai_move,	0,		insane_moan,
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,		// 140
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,		// 150
232 	ai_move,	0.5,		NULL,
233 	ai_move,	0,		NULL,
234 	ai_move,	-0.2,		insane_scream,
235 	ai_move,	0,		NULL,
236 	ai_move,	0.2,		NULL,
237 	ai_move,	0.4,		NULL,
238 	ai_move,	0.6,		NULL,
239 	ai_move,	0.8,		NULL,
240 	ai_move,	0.7,		NULL,
241 	ai_move,	0,		insane_checkup		// 160
242 };
243 mmove_t insane_move_down = {FRAME_stand100, FRAME_stand160, insane_frames_down, insane_onground};
244 
245 mframe_t insane_frames_walk_normal [] =
246 {
247 	ai_walk,	0,		insane_scream,
248 	ai_walk,	2.5,	NULL,
249 	ai_walk,	3.5,	NULL,
250 	ai_walk,	1.7,	NULL,
251 	ai_walk,	2.3,	NULL,
252 	ai_walk,	2.4,	NULL,
253 	ai_walk,	2.2,	NULL,
254 	ai_walk,	4.2,	NULL,
255 	ai_walk,	5.6,	NULL,
256 	ai_walk,	3.3,	NULL,
257 	ai_walk,	2.4,	NULL,
258 	ai_walk,	0.9,	NULL,
259 	ai_walk,	0,		NULL
260 };
261 mmove_t insane_move_walk_normal = {FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_walk};
262 mmove_t insane_move_run_normal = {FRAME_walk27, FRAME_walk39, insane_frames_walk_normal, insane_run};
263 
264 mframe_t insane_frames_walk_insane [] =
265 {
266 	ai_walk,	0,		insane_scream,		// walk 1
267 	ai_walk,	3.4,	NULL,		// walk 2
268 	ai_walk,	3.6,	NULL,		// 3
269 	ai_walk,	2.9,	NULL,		// 4
270 	ai_walk,	2.2,	NULL,		// 5
271 	ai_walk,	2.6,	NULL,		// 6
272 	ai_walk,	0,		NULL,		// 7
273 	ai_walk,	0.7,	NULL,		// 8
274 	ai_walk,	4.8,	NULL,		// 9
275 	ai_walk,	5.3,	NULL,		// 10
276 	ai_walk,	1.1,	NULL,		// 11
277 	ai_walk,	2,		NULL,		// 12
278 	ai_walk,	0.5,	NULL,		// 13
279 	ai_walk,	0,		NULL,		// 14
280 	ai_walk,	0,		NULL,		// 15
281 	ai_walk,	4.9,	NULL,		// 16
282 	ai_walk,	6.7,	NULL,		// 17
283 	ai_walk,	3.8,	NULL,		// 18
284 	ai_walk,	2,		NULL,		// 19
285 	ai_walk,	0.2,	NULL,		// 20
286 	ai_walk,	0,		NULL,		// 21
287 	ai_walk,	3.4,	NULL,		// 22
288 	ai_walk,	6.4,	NULL,		// 23
289 	ai_walk,	5,		NULL,		// 24
290 	ai_walk,	1.8,	NULL,		// 25
291 	ai_walk,	0,		NULL		// 26
292 };
293 mmove_t insane_move_walk_insane = {FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_walk};
294 mmove_t insane_move_run_insane = {FRAME_walk1, FRAME_walk26, insane_frames_walk_insane, insane_run};
295 
296 mframe_t insane_frames_stand_pain [] =
297 {
298 	ai_move,	0,		NULL,
299 	ai_move,	0,		NULL,
300 	ai_move,	0,		NULL,
301 	ai_move,	0,		NULL,
302 	ai_move,	0,		NULL,
303 	ai_move,	0,		NULL,
304 	ai_move,	0,		NULL,
305 	ai_move,	0,		NULL,
306 	ai_move,	0,		NULL,
307 	ai_move,	0,		NULL,
308 	ai_move,	0,		NULL
309 };
310 mmove_t insane_move_stand_pain = {FRAME_st_pain2, FRAME_st_pain12, insane_frames_stand_pain, insane_run};
311 
312 mframe_t insane_frames_stand_death [] =
313 {
314 	ai_move,	0,		NULL,
315 	ai_move,	0,		NULL,
316 	ai_move,	0,		NULL,
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 	ai_move,	0,		NULL,
324 	ai_move,	0,		NULL,
325 	ai_move,	0,		NULL,
326 	ai_move,	0,		NULL,
327 	ai_move,	0,		NULL,
328 	ai_move,	0,		NULL,
329 	ai_move,	0,		NULL,
330 	ai_move,	0,		NULL
331 };
332 mmove_t insane_move_stand_death = {FRAME_st_death2, FRAME_st_death18, insane_frames_stand_death, insane_dead};
333 
334 mframe_t insane_frames_crawl [] =
335 {
336 	ai_walk,	0,		insane_scream,
337 	ai_walk,	1.5,	NULL,
338 	ai_walk,	2.1,	NULL,
339 	ai_walk,	3.6,	NULL,
340 	ai_walk,	2,		NULL,
341 	ai_walk,	0.9,	NULL,
342 	ai_walk,	3,		NULL,
343 	ai_walk,	3.4,	NULL,
344 	ai_walk,	2.4,	NULL
345 };
346 mmove_t insane_move_crawl = {FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL};
347 mmove_t insane_move_runcrawl = {FRAME_crawl1, FRAME_crawl9, insane_frames_crawl, NULL};
348 
349 mframe_t insane_frames_crawl_pain [] =
350 {
351 	ai_move,	0,		NULL,
352 	ai_move,	0,		NULL,
353 	ai_move,	0,		NULL,
354 	ai_move,	0,		NULL,
355 	ai_move,	0,		NULL,
356 	ai_move,	0,		NULL,
357 	ai_move,	0,		NULL,
358 	ai_move,	0,		NULL,
359 	ai_move,	0,		NULL
360 };
361 mmove_t insane_move_crawl_pain = {FRAME_cr_pain2, FRAME_cr_pain10, insane_frames_crawl_pain, insane_run};
362 
363 mframe_t insane_frames_crawl_death [] =
364 {
365 	ai_move,	0,		NULL,
366 	ai_move,	0,		NULL,
367 	ai_move,	0,		NULL,
368 	ai_move,	0,		NULL,
369 	ai_move,	0,		NULL,
370 	ai_move,	0,		NULL,
371 	ai_move,	0,		NULL
372 };
373 mmove_t insane_move_crawl_death = {FRAME_cr_death10, FRAME_cr_death16, insane_frames_crawl_death, insane_dead};
374 
375 mframe_t insane_frames_cross [] =
376 {
377 	ai_move,	0,		insane_moan,
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 	ai_move,	0,		NULL,
388 	ai_move,	0,		NULL,
389 	ai_move,	0,		NULL,
390 	ai_move,	0,		NULL,
391 	ai_move,	0,		NULL
392 };
393 mmove_t insane_move_cross = {FRAME_cross1, FRAME_cross15, insane_frames_cross, insane_cross};
394 
395 mframe_t insane_frames_struggle_cross [] =
396 {
397 	ai_move,	0,		insane_scream,
398 	ai_move,	0,		NULL,
399 	ai_move,	0,		NULL,
400 	ai_move,	0,		NULL,
401 	ai_move,	0,		NULL,
402 	ai_move,	0,		NULL,
403 	ai_move,	0,		NULL,
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 };
413 mmove_t insane_move_struggle_cross = {FRAME_cross16, FRAME_cross30, insane_frames_struggle_cross, insane_cross};
414 
insane_cross(edict_t * self)415 void insane_cross (edict_t *self)
416 {
417 	if (random() < 0.8)
418 		self->monsterinfo.currentmove = &insane_move_cross;
419 	else
420 		self->monsterinfo.currentmove = &insane_move_struggle_cross;
421 }
422 
insane_walk(edict_t * self)423 void insane_walk (edict_t *self)
424 {
425 	if ( self->spawnflags & 16 )			// Hold Ground?
426 		if (self->s.frame == FRAME_cr_pain10)
427 		{
428 			self->monsterinfo.currentmove = &insane_move_down;
429 			return;
430 		}
431 	if (self->spawnflags & 4)
432 		self->monsterinfo.currentmove = &insane_move_crawl;
433 	else
434 		if (random() <= 0.5)
435 			self->monsterinfo.currentmove = &insane_move_walk_normal;
436 		else
437 			self->monsterinfo.currentmove = &insane_move_walk_insane;
438 }
439 
insane_run(edict_t * self)440 void insane_run (edict_t *self)
441 {
442 	if ( self->spawnflags & 16 )			// Hold Ground?
443 		if (self->s.frame == FRAME_cr_pain10)
444 		{
445 			self->monsterinfo.currentmove = &insane_move_down;
446 			return;
447 		}
448 	if (self->spawnflags & 4)				// Crawling?
449 		self->monsterinfo.currentmove = &insane_move_runcrawl;
450 	else
451 		if (random() <= 0.5)				// Else, mix it up
452 			self->monsterinfo.currentmove = &insane_move_run_normal;
453 		else
454 			self->monsterinfo.currentmove = &insane_move_run_insane;
455 }
456 
457 
insane_pain(edict_t * self,edict_t * other,float kick,int damage)458 void insane_pain (edict_t *self, edict_t *other, float kick, int damage)
459 {
460 	int	l,r;
461 
462 //	if (self->health < (self->max_health / 2))
463 //		self->s.skinnum = 1;
464 
465 	if (level.time < self->pain_debounce_time)
466 		return;
467 
468 	self->pain_debounce_time = level.time + 3;
469 
470 	r = 1 + (rand()&1);
471 	if (self->health < 25)
472 		l = 25;
473 	else if (self->health < 50)
474 		l = 50;
475 	else if (self->health < 75)
476 		l = 75;
477 	else
478 		l = 100;
479 	gi.sound (self, CHAN_VOICE, gi.soundindex (va("player/male/pain%i_%i.wav", l, r)), 1, ATTN_IDLE, 0);
480 
481 	if (skill->value == 3)
482 		return;		// no pain anims in nightmare
483 
484 	// Don't go into pain frames if crucified.
485 	if (self->spawnflags & 8)
486 	{
487 		self->monsterinfo.currentmove = &insane_move_struggle_cross;
488 		return;
489 	}
490 
491 	if  ( ((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160)) )
492 	{
493 		self->monsterinfo.currentmove = &insane_move_crawl_pain;
494 	}
495 	else
496 		self->monsterinfo.currentmove = &insane_move_stand_pain;
497 
498 }
499 
insane_onground(edict_t * self)500 void insane_onground (edict_t *self)
501 {
502 	self->monsterinfo.currentmove = &insane_move_down;
503 }
504 
insane_checkdown(edict_t * self)505 void insane_checkdown (edict_t *self)
506 {
507 //	if ( (self->s.frame == FRAME_stand94) || (self->s.frame == FRAME_stand65) )
508 	if (self->spawnflags & 32)				// Always stand
509 		return;
510 	if (random() < 0.3)
511 		if (random() < 0.5)
512 			self->monsterinfo.currentmove = &insane_move_uptodown;
513 		else
514 			self->monsterinfo.currentmove = &insane_move_jumpdown;
515 }
516 
insane_checkup(edict_t * self)517 void insane_checkup (edict_t *self)
518 {
519 	// If Hold_Ground and Crawl are set
520 	if ( (self->spawnflags & 4) && (self->spawnflags & 16) )
521 		return;
522 	if (random() < 0.5)
523 		self->monsterinfo.currentmove = &insane_move_downtoup;
524 
525 }
526 
insane_stand(edict_t * self)527 void insane_stand (edict_t *self)
528 {
529 	if (self->spawnflags & 8)			// If crucified
530 	{
531 		self->monsterinfo.currentmove = &insane_move_cross;
532 		self->monsterinfo.aiflags |= AI_STAND_GROUND;
533 	}
534 	// If Hold_Ground and Crawl are set
535 	else if ( (self->spawnflags & 4) && (self->spawnflags & 16) )
536 		self->monsterinfo.currentmove = &insane_move_down;
537 	else
538 		if (random() < 0.5)
539 			self->monsterinfo.currentmove = &insane_move_stand_normal;
540 		else
541 			self->monsterinfo.currentmove = &insane_move_stand_insane;
542 }
543 
insane_dead(edict_t * self)544 void insane_dead (edict_t *self)
545 {
546 	if (self->spawnflags & 8)
547 	{
548 		self->flags |= FL_FLY;
549 	}
550 	else
551 	{
552 		VectorSet (self->mins, -16, -16, -24);
553 		VectorSet (self->maxs, 16, 16, -8);
554 		self->movetype = MOVETYPE_TOSS;
555 	}
556 	self->svflags |= SVF_DEADMONSTER;
557 	self->nextthink = 0;
558 	gi.linkentity (self);
559 }
560 
561 
insane_die(edict_t * self,edict_t * inflictor,edict_t * attacker,int damage,vec3_t point)562 void insane_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
563 {
564 	int		n;
565 
566 	if (self->health <= self->gib_health)
567 	{
568 		gi.sound (self, CHAN_VOICE, gi.soundindex ("misc/udeath.wav"), 1, ATTN_IDLE, 0);
569 		for (n= 0; n < 2; n++)
570 			ThrowGib (self, "models/objects/gibs/bone/tris.md2", damage, GIB_ORGANIC);
571 		for (n= 0; n < 4; n++)
572 			ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", damage, GIB_ORGANIC);
573 		ThrowHead (self, "models/objects/gibs/head2/tris.md2", damage, GIB_ORGANIC);
574 		self->deadflag = DEAD_DEAD;
575 		return;
576 	}
577 
578 	if (self->deadflag == DEAD_DEAD)
579 		return;
580 
581 	gi.sound (self, CHAN_VOICE, gi.soundindex(va("player/male/death%i.wav", (rand()%4)+1)), 1, ATTN_IDLE, 0);
582 
583 	self->deadflag = DEAD_DEAD;
584 	self->takedamage = DAMAGE_YES;
585 
586 	if (self->spawnflags & 8)
587 	{
588 		insane_dead (self);
589 	}
590 	else
591 	{
592 		if ( ((self->s.frame >= FRAME_crawl1) && (self->s.frame <= FRAME_crawl9)) || ((self->s.frame >= FRAME_stand99) && (self->s.frame <= FRAME_stand160)) )
593 			self->monsterinfo.currentmove = &insane_move_crawl_death;
594 		else
595 			self->monsterinfo.currentmove = &insane_move_stand_death;
596 	}
597 }
598 
599 
600 /*QUAKED misc_insane (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn CRAWL CRUCIFIED STAND_GROUND ALWAYS_STAND
601 */
SP_misc_insane(edict_t * self)602 void SP_misc_insane (edict_t *self)
603 {
604 //	static int skin = 0;	//@@
605 
606 	if (deathmatch->value)
607 	{
608 		G_FreeEdict (self);
609 		return;
610 	}
611 
612 	sound_fist = gi.soundindex ("insane/insane11.wav");
613 	sound_shake = gi.soundindex ("insane/insane5.wav");
614 	sound_moan = gi.soundindex ("insane/insane7.wav");
615 	sound_scream[0] = gi.soundindex ("insane/insane1.wav");
616 	sound_scream[1] = gi.soundindex ("insane/insane2.wav");
617 	sound_scream[2] = gi.soundindex ("insane/insane3.wav");
618 	sound_scream[3] = gi.soundindex ("insane/insane4.wav");
619 	sound_scream[4] = gi.soundindex ("insane/insane6.wav");
620 	sound_scream[5] = gi.soundindex ("insane/insane8.wav");
621 	sound_scream[6] = gi.soundindex ("insane/insane9.wav");
622 	sound_scream[7] = gi.soundindex ("insane/insane10.wav");
623 
624 	self->movetype = MOVETYPE_STEP;
625 	self->solid = SOLID_BBOX;
626 	self->s.modelindex = gi.modelindex("models/monsters/insane/tris.md2");
627 
628 	VectorSet (self->mins, -16, -16, -24);
629 	VectorSet (self->maxs, 16, 16, 32);
630 
631 	self->health = 100;
632 	self->gib_health = -50;
633 	self->mass = 300;
634 
635 	self->pain = insane_pain;
636 	self->die = insane_die;
637 
638 	self->monsterinfo.stand = insane_stand;
639 	self->monsterinfo.walk = insane_walk;
640 	self->monsterinfo.run = insane_run;
641 	self->monsterinfo.dodge = NULL;
642 	self->monsterinfo.attack = NULL;
643 	self->monsterinfo.melee = NULL;
644 	self->monsterinfo.sight = NULL;
645 	self->monsterinfo.aiflags |= AI_GOOD_GUY;
646 
647 //@@
648 //	self->s.skinnum = skin;
649 //	skin++;
650 //	if (skin > 12)
651 //		skin = 0;
652 
653 	gi.linkentity (self);
654 
655 	if (self->spawnflags & 16)				// Stand Ground
656 		self->monsterinfo.aiflags |= AI_STAND_GROUND;
657 
658 	self->monsterinfo.currentmove = &insane_move_stand_normal;
659 
660 	self->monsterinfo.scale = MODEL_SCALE;
661 
662 	if (self->spawnflags & 8)					// Crucified ?
663 	{
664 		VectorSet (self->mins, -16, 0, 0);
665 		VectorSet (self->maxs, 16, 8, 32);
666 		self->flags |= FL_NO_KNOCKBACK;
667 		flymonster_start (self);
668 	}
669 	else
670 	{
671 		walkmonster_start (self);
672 		self->s.skinnum = rand()%3;
673 	}
674 }
675