1 /*
2 * Copyright(c) 1997-2001 Id Software, Inc.
3 * Copyright(c) 2002 The Quakeforge Project.
4 * Copyright(c) 2006 Quetoo.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or(at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 *
15 * See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21 
22 /*
23 
24 floater
25 
26 */
27 
28 #include "g_local.h"
29 #include "m_float.h"
30 
31 
32 static int sound_attack2;
33 static int sound_attack3;
34 static int sound_death1;
35 static int sound_idle;
36 static int sound_pain1;
37 static int sound_pain2;
38 static int sound_sight;
39 
40 
floater_sight(edict_t * self,edict_t * other)41 void floater_sight(edict_t *self, edict_t *other){
42 	gi.sound(self, CHAN_VOICE, sound_sight, 1, ATTN_NORM, 0);
43 }
44 
floater_idle(edict_t * self)45 void floater_idle(edict_t *self){
46 	gi.sound(self, CHAN_VOICE, sound_idle, 1, ATTN_IDLE, 0);
47 }
48 
49 
50 //void floater_stand1(edict_t *self);
51 void floater_dead(edict_t *self);
52 void floater_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
53 void floater_run(edict_t *self);
54 void floater_wham(edict_t *self);
55 void floater_zap(edict_t *self);
56 
57 
floater_fire_blaster(edict_t * self)58 void floater_fire_blaster(edict_t *self){
59 	vec3_t start;
60 	vec3_t forward, right;
61 	vec3_t end;
62 	vec3_t dir;
63 	int effect;
64 
65 	if((self->s.frame == FRAME_attak104) ||(self->s.frame == FRAME_attak107))
66 		effect = EF_HYPERBLASTER;
67 	else
68 		effect = 0;
69 	AngleVectors(self->s.angles, forward, right, NULL);
70 	G_ProjectSource(self->s.origin, monster_flash_offset[MZ2_FLOAT_BLASTER_1], forward, right, start);
71 
72 	VectorCopy(self->enemy->s.origin, end);
73 	end[2] += self->enemy->viewheight;
74 	VectorSubtract(end, start, dir);
75 
76 	monster_fire_blaster(self, start, dir, 1, 1000, MZ2_FLOAT_BLASTER_1, effect);
77 }
78 
79 
80 mframe_t floater_frames_stand1 [] =
81 	{
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 		{ai_stand, 0, NULL},
112 		{ai_stand, 0, NULL},
113 		{ai_stand, 0, NULL},
114 		{ai_stand, 0, NULL},
115 		{ai_stand, 0, NULL},
116 		{ai_stand, 0, NULL},
117 		{ai_stand, 0, NULL},
118 		{ai_stand, 0, NULL},
119 		{ai_stand, 0, NULL},
120 		{ai_stand, 0, NULL},
121 		{ai_stand, 0, NULL},
122 		{ai_stand, 0, NULL},
123 		{ai_stand, 0, NULL},
124 		{ai_stand, 0, NULL},
125 		{ai_stand, 0, NULL},
126 		{ai_stand, 0, NULL},
127 		{ai_stand, 0, NULL},
128 		{ai_stand, 0, NULL},
129 		{ai_stand, 0, NULL},
130 		{ai_stand, 0, NULL},
131 		{ai_stand, 0, NULL},
132 		{ai_stand, 0, NULL},
133 		{ai_stand, 0, NULL}
134 	};
135 mmove_t floater_move_stand1 = {FRAME_stand101, FRAME_stand152, floater_frames_stand1, NULL};
136 
137 mframe_t floater_frames_stand2 [] =
138 	{
139 		{ai_stand, 0, NULL},
140 		{ai_stand, 0, NULL},
141 		{ai_stand, 0, NULL},
142 		{ai_stand, 0, NULL},
143 		{ai_stand, 0, NULL},
144 		{ai_stand, 0, NULL},
145 		{ai_stand, 0, NULL},
146 		{ai_stand, 0, NULL},
147 		{ai_stand, 0, NULL},
148 		{ai_stand, 0, NULL},
149 		{ai_stand, 0, NULL},
150 		{ai_stand, 0, NULL},
151 		{ai_stand, 0, NULL},
152 		{ai_stand, 0, NULL},
153 		{ai_stand, 0, NULL},
154 		{ai_stand, 0, NULL},
155 		{ai_stand, 0, NULL},
156 		{ai_stand, 0, NULL},
157 		{ai_stand, 0, NULL},
158 		{ai_stand, 0, NULL},
159 		{ai_stand, 0, NULL},
160 		{ai_stand, 0, NULL},
161 		{ai_stand, 0, NULL},
162 		{ai_stand, 0, NULL},
163 		{ai_stand, 0, NULL},
164 		{ai_stand, 0, NULL},
165 		{ai_stand, 0, NULL},
166 		{ai_stand, 0, NULL},
167 		{ai_stand, 0, NULL},
168 		{ai_stand, 0, NULL},
169 		{ai_stand, 0, NULL},
170 		{ai_stand, 0, NULL},
171 		{ai_stand, 0, NULL},
172 		{ai_stand, 0, NULL},
173 		{ai_stand, 0, NULL},
174 		{ai_stand, 0, NULL},
175 		{ai_stand, 0, NULL},
176 		{ai_stand, 0, NULL},
177 		{ai_stand, 0, NULL},
178 		{ai_stand, 0, NULL},
179 		{ai_stand, 0, NULL},
180 		{ai_stand, 0, NULL},
181 		{ai_stand, 0, NULL},
182 		{ai_stand, 0, NULL},
183 		{ai_stand, 0, NULL},
184 		{ai_stand, 0, NULL},
185 		{ai_stand, 0, NULL},
186 		{ai_stand, 0, NULL},
187 		{ai_stand, 0, NULL},
188 		{ai_stand, 0, NULL},
189 		{ai_stand, 0, NULL},
190 		{ai_stand, 0, NULL}
191 	};
192 mmove_t floater_move_stand2 = {FRAME_stand201, FRAME_stand252, floater_frames_stand2, NULL};
193 
floater_stand(edict_t * self)194 void floater_stand(edict_t *self){
195 	if(random() <= 0.5)
196 		self->monsterinfo.currentmove = &floater_move_stand1;
197 	else
198 		self->monsterinfo.currentmove = &floater_move_stand2;
199 }
200 
201 mframe_t floater_frames_activate [] =
202 	{
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},
212 		{ai_move, 0, NULL},
213 		{ai_move, 0, NULL},
214 		{ai_move, 0, NULL},
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 		{ai_move, 0, NULL}
233 	};
234 mmove_t floater_move_activate = {FRAME_actvat01, FRAME_actvat31, floater_frames_activate, NULL};
235 
236 mframe_t floater_frames_attack1 [] =
237 	{
238 		{ai_charge, 0, NULL},   // Blaster attack
239 		{ai_charge, 0, NULL},
240 		{ai_charge, 0, NULL},
241 		{ai_charge, 0, floater_fire_blaster},   // BOOM(0, -25.8, 32.5)	-- LOOP Starts
242 		{ai_charge, 0, floater_fire_blaster},
243 		{ai_charge, 0, floater_fire_blaster},
244 		{ai_charge, 0, floater_fire_blaster},
245 		{ai_charge, 0, floater_fire_blaster},
246 		{ai_charge, 0, floater_fire_blaster},
247 		{ai_charge, 0, floater_fire_blaster},
248 		{ai_charge, 0, NULL},
249 		{ai_charge, 0, NULL},
250 		{ai_charge, 0, NULL},
251 		{ai_charge, 0, NULL}  //							-- LOOP Ends
252 	};
253 mmove_t floater_move_attack1 = {FRAME_attak101, FRAME_attak114, floater_frames_attack1, floater_run};
254 
255 mframe_t floater_frames_attack2 [] =
256 	{
257 		{ai_charge, 0, NULL},   // Claws
258 		{ai_charge, 0, NULL},
259 		{ai_charge, 0, NULL},
260 		{ai_charge, 0, NULL},
261 		{ai_charge, 0, NULL},
262 		{ai_charge, 0, NULL},
263 		{ai_charge, 0, NULL},
264 		{ai_charge, 0, NULL},
265 		{ai_charge, 0, NULL},
266 		{ai_charge, 0, NULL},
267 		{ai_charge, 0, NULL},
268 		{ai_charge, 0, floater_wham},   // WHAM(0, -45, 29.6)		-- LOOP Starts
269 		{ai_charge, 0, NULL},
270 		{ai_charge, 0, NULL},
271 		{ai_charge, 0, NULL},
272 		{ai_charge, 0, NULL},
273 		{ai_charge, 0, NULL},
274 		{ai_charge, 0, NULL},
275 		{ai_charge, 0, NULL},   //							-- LOOP Ends
276 		{ai_charge, 0, NULL},
277 		{ai_charge, 0, NULL},
278 		{ai_charge, 0, NULL},
279 		{ai_charge, 0, NULL},
280 		{ai_charge, 0, NULL},
281 		{ai_charge, 0, NULL}
282 	};
283 mmove_t floater_move_attack2 = {FRAME_attak201, FRAME_attak225, floater_frames_attack2, floater_run};
284 
285 mframe_t floater_frames_attack3 [] =
286 	{
287 		{ai_charge, 0, NULL},
288 		{ai_charge, 0, NULL},
289 		{ai_charge, 0, NULL},
290 		{ai_charge, 0, NULL},
291 		{ai_charge, 0, NULL},
292 		{ai_charge, 0, NULL},
293 		{ai_charge, 0, NULL},
294 		{ai_charge, 0, NULL},
295 		{ai_charge, 0, floater_zap},   //								-- LOOP Starts
296 		{ai_charge, 0, NULL},
297 		{ai_charge, 0, NULL},
298 		{ai_charge, 0, NULL},
299 		{ai_charge, 0, NULL},
300 		{ai_charge, 0, NULL},
301 		{ai_charge, 0, NULL},
302 		{ai_charge, 0, NULL},
303 		{ai_charge, 0, NULL},
304 		{ai_charge, 0, NULL},
305 		{ai_charge, 0, NULL},
306 		{ai_charge, 0, NULL},
307 		{ai_charge, 0, NULL},
308 		{ai_charge, 0, NULL},
309 		{ai_charge, 0, NULL},
310 		{ai_charge, 0, NULL},
311 		{ai_charge, 0, NULL},
312 		{ai_charge, 0, NULL},
313 		{ai_charge, 0, NULL},
314 		{ai_charge, 0, NULL},
315 		{ai_charge, 0, NULL},   //								-- LOOP Ends
316 		{ai_charge, 0, NULL},
317 		{ai_charge, 0, NULL},
318 		{ai_charge, 0, NULL},
319 		{ai_charge, 0, NULL},
320 		{ai_charge, 0, NULL}
321 	};
322 mmove_t floater_move_attack3 = {FRAME_attak301, FRAME_attak334, floater_frames_attack3, floater_run};
323 
324 mframe_t floater_frames_death [] =
325 	{
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 		{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 	};
340 mmove_t floater_move_death = {FRAME_death01, FRAME_death13, floater_frames_death, floater_dead};
341 
342 mframe_t floater_frames_pain1 [] =
343 	{
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 	};
352 mmove_t floater_move_pain1 = {FRAME_pain101, FRAME_pain107, floater_frames_pain1, floater_run};
353 
354 mframe_t floater_frames_pain2 [] =
355 	{
356 		{ai_move, 0, NULL},
357 		{ai_move, 0, NULL},
358 		{ai_move, 0, NULL},
359 		{ai_move, 0, NULL},
360 		{ai_move, 0, NULL},
361 		{ai_move, 0, NULL},
362 		{ai_move, 0, NULL},
363 		{ai_move, 0, NULL}
364 	};
365 mmove_t floater_move_pain2 = {FRAME_pain201, FRAME_pain208, floater_frames_pain2, floater_run};
366 
367 mframe_t floater_frames_pain3 [] =
368 	{
369 		{ai_move, 0, NULL},
370 		{ai_move, 0, NULL},
371 		{ai_move, 0, NULL},
372 		{ai_move, 0, NULL},
373 		{ai_move, 0, NULL},
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 	};
382 mmove_t floater_move_pain3 = {FRAME_pain301, FRAME_pain312, floater_frames_pain3, floater_run};
383 
384 mframe_t floater_frames_walk [] =
385 	{
386 		{ai_walk, 5, NULL},
387 		{ai_walk, 5, NULL},
388 		{ai_walk, 5, NULL},
389 		{ai_walk, 5, NULL},
390 		{ai_walk, 5, NULL},
391 		{ai_walk, 5, NULL},
392 		{ai_walk, 5, NULL},
393 		{ai_walk, 5, NULL},
394 		{ai_walk, 5, NULL},
395 		{ai_walk, 5, NULL},
396 		{ai_walk, 5, NULL},
397 		{ai_walk, 5, NULL},
398 		{ai_walk, 5, NULL},
399 		{ai_walk, 5, NULL},
400 		{ai_walk, 5, NULL},
401 		{ai_walk, 5, NULL},
402 		{ai_walk, 5, NULL},
403 		{ai_walk, 5, NULL},
404 		{ai_walk, 5, NULL},
405 		{ai_walk, 5, NULL},
406 		{ai_walk, 5, NULL},
407 		{ai_walk, 5, NULL},
408 		{ai_walk, 5, NULL},
409 		{ai_walk, 5, NULL},
410 		{ai_walk, 5, NULL},
411 		{ai_walk, 5, NULL},
412 		{ai_walk, 5, NULL},
413 		{ai_walk, 5, NULL},
414 		{ai_walk, 5, NULL},
415 		{ai_walk, 5, NULL},
416 		{ai_walk, 5, NULL},
417 		{ai_walk, 5, NULL},
418 		{ai_walk, 5, NULL},
419 		{ai_walk, 5, NULL},
420 		{ai_walk, 5, NULL},
421 		{ai_walk, 5, NULL},
422 		{ai_walk, 5, NULL},
423 		{ai_walk, 5, NULL},
424 		{ai_walk, 5, NULL},
425 		{ai_walk, 5, NULL},
426 		{ai_walk, 5, NULL},
427 		{ai_walk, 5, NULL},
428 		{ai_walk, 5, NULL},
429 		{ai_walk, 5, NULL},
430 		{ai_walk, 5, NULL},
431 		{ai_walk, 5, NULL},
432 		{ai_walk, 5, NULL},
433 		{ai_walk, 5, NULL},
434 		{ai_walk, 5, NULL},
435 		{ai_walk, 5, NULL},
436 		{ai_walk, 5, NULL},
437 		{ai_walk, 5, NULL}
438 	};
439 mmove_t floater_move_walk = {FRAME_stand101, FRAME_stand152, floater_frames_walk, NULL};
440 
441 mframe_t floater_frames_run [] =
442 	{
443 		{ai_run, 13, NULL},
444 		{ai_run, 13, NULL},
445 		{ai_run, 13, NULL},
446 		{ai_run, 13, NULL},
447 		{ai_run, 13, NULL},
448 		{ai_run, 13, NULL},
449 		{ai_run, 13, NULL},
450 		{ai_run, 13, NULL},
451 		{ai_run, 13, NULL},
452 		{ai_run, 13, NULL},
453 		{ai_run, 13, NULL},
454 		{ai_run, 13, NULL},
455 		{ai_run, 13, NULL},
456 		{ai_run, 13, NULL},
457 		{ai_run, 13, NULL},
458 		{ai_run, 13, NULL},
459 		{ai_run, 13, NULL},
460 		{ai_run, 13, NULL},
461 		{ai_run, 13, NULL},
462 		{ai_run, 13, NULL},
463 		{ai_run, 13, NULL},
464 		{ai_run, 13, NULL},
465 		{ai_run, 13, NULL},
466 		{ai_run, 13, NULL},
467 		{ai_run, 13, NULL},
468 		{ai_run, 13, NULL},
469 		{ai_run, 13, NULL},
470 		{ai_run, 13, NULL},
471 		{ai_run, 13, NULL},
472 		{ai_run, 13, NULL},
473 		{ai_run, 13, NULL},
474 		{ai_run, 13, NULL},
475 		{ai_run, 13, NULL},
476 		{ai_run, 13, NULL},
477 		{ai_run, 13, NULL},
478 		{ai_run, 13, NULL},
479 		{ai_run, 13, NULL},
480 		{ai_run, 13, NULL},
481 		{ai_run, 13, NULL},
482 		{ai_run, 13, NULL},
483 		{ai_run, 13, NULL},
484 		{ai_run, 13, NULL},
485 		{ai_run, 13, NULL},
486 		{ai_run, 13, NULL},
487 		{ai_run, 13, NULL},
488 		{ai_run, 13, NULL},
489 		{ai_run, 13, NULL},
490 		{ai_run, 13, NULL},
491 		{ai_run, 13, NULL},
492 		{ai_run, 13, NULL},
493 		{ai_run, 13, NULL},
494 		{ai_run, 13, NULL}
495 	};
496 mmove_t floater_move_run = {FRAME_stand101, FRAME_stand152, floater_frames_run, NULL};
497 
floater_run(edict_t * self)498 void floater_run(edict_t *self){
499 	if(self->monsterinfo.aiflags & AI_STAND_GROUND)
500 		self->monsterinfo.currentmove = &floater_move_stand1;
501 	else
502 		self->monsterinfo.currentmove = &floater_move_run;
503 }
504 
floater_walk(edict_t * self)505 void floater_walk(edict_t *self){
506 	self->monsterinfo.currentmove = &floater_move_walk;
507 }
508 
floater_wham(edict_t * self)509 void floater_wham(edict_t *self){
510 	static	vec3_t aim = {MELEE_DISTANCE, 0, 0};
511 	gi.sound(self, CHAN_WEAPON, sound_attack3, 1, ATTN_NORM, 0);
512 	fire_hit(self, aim, 5 + rand() % 6, -50);
513 }
514 
floater_zap(edict_t * self)515 void floater_zap(edict_t *self){
516 	vec3_t forward, right;
517 	vec3_t origin;
518 	vec3_t dir;
519 	vec3_t offset;
520 
521 	VectorSubtract(self->enemy->s.origin, self->s.origin, dir);
522 
523 	AngleVectors(self->s.angles, forward, right, NULL);
524 	//FIXME use a flash and replace these two lines with the commented one
525 	VectorSet(offset, 18.5, -0.9, 10);
526 	G_ProjectSource(self->s.origin, offset, forward, right, origin);
527 	//	G_ProjectSource(self->s.origin, monster_flash_offset[flash_number], forward, right, origin);
528 
529 	gi.sound(self, CHAN_WEAPON, sound_attack2, 1, ATTN_NORM, 0);
530 
531 	//FIXME use the flash, Luke
532 	gi.WriteByte(svc_temp_entity);
533 	gi.WriteByte(TE_SPLASH);
534 	gi.WriteByte(32);
535 	gi.WritePosition(origin);
536 	gi.WriteDir(dir);
537 	gi.WriteByte(1);  //sparks
538 	gi.multicast(origin, MULTICAST_PVS);
539 
540 	T_Damage(self->enemy, self, self, dir, self->enemy->s.origin, vec3_origin, 5 + rand() % 6, -10, DAMAGE_ENERGY, MOD_UNKNOWN);
541 }
542 
floater_attack(edict_t * self)543 void floater_attack(edict_t *self){
544 	self->monsterinfo.currentmove = &floater_move_attack1;
545 }
546 
547 
floater_melee(edict_t * self)548 void floater_melee(edict_t *self){
549 	if(random() < 0.5)
550 		self->monsterinfo.currentmove = &floater_move_attack3;
551 	else
552 		self->monsterinfo.currentmove = &floater_move_attack2;
553 }
554 
555 
floater_pain(edict_t * self,edict_t * other,float kick,int damage)556 void floater_pain(edict_t *self, edict_t *other, float kick, int damage){
557 	int n;
558 
559 	if(self->health <(self->max_health / 2))
560 		self->s.skinnum = 1;
561 
562 	if(level.time < self->pain_debounce_time)
563 		return;
564 
565 	self->pain_debounce_time = level.time + 3;
566 	if(skill->value == 3)
567 		return;  // no pain anims in nightmare
568 
569 	n =(rand() + 1) % 3;
570 	if(n == 0){
571 		gi.sound(self, CHAN_VOICE, sound_pain1, 1, ATTN_NORM, 0);
572 		self->monsterinfo.currentmove = &floater_move_pain1;
573 	} else {
574 		gi.sound(self, CHAN_VOICE, sound_pain2, 1, ATTN_NORM, 0);
575 		self->monsterinfo.currentmove = &floater_move_pain2;
576 	}
577 }
578 
floater_dead(edict_t * self)579 void floater_dead(edict_t *self){
580 	VectorSet(self->mins, -16, -16, -24);
581 	VectorSet(self->maxs, 16, 16, -8);
582 	self->movetype = MOVETYPE_TOSS;
583 	self->svflags |= SVF_DEADMONSTER;
584 	self->nextthink = 0;
585 	gi.linkentity(self);
586 }
587 
floater_die(edict_t * self,edict_t * inflictor,edict_t * attacker,int damage,vec3_t point)588 void floater_die(edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point){
589 	gi.sound(self, CHAN_VOICE, sound_death1, 1, ATTN_NORM, 0);
590 	BecomeExplosion1(self);
591 }
592 
593 /*QUAKED monster_floater(1 .5 0)(-16 -16 -24)(16 16 32) Ambush Trigger_Spawn Sight
594 */
SP_monster_floater(edict_t * self)595 void SP_monster_floater(edict_t *self){
596 	if(deathmatch->value){
597 		G_FreeEdict(self);
598 		return;
599 	}
600 
601 	sound_attack2 = gi.soundindex("floater/fltatck2.wav");
602 	sound_attack3 = gi.soundindex("floater/fltatck3.wav");
603 	sound_death1 = gi.soundindex("floater/fltdeth1.wav");
604 	sound_idle = gi.soundindex("floater/fltidle1.wav");
605 	sound_pain1 = gi.soundindex("floater/fltpain1.wav");
606 	sound_pain2 = gi.soundindex("floater/fltpain2.wav");
607 	sound_sight = gi.soundindex("floater/fltsght1.wav");
608 
609 	gi.soundindex("floater/fltatck1.wav");
610 
611 	self->s.sound = gi.soundindex("floater/fltsrch1.wav");
612 
613 	self->movetype = MOVETYPE_STEP;
614 	self->solid = SOLID_BBOX;
615 	self->s.modelindex = gi.modelindex("models/monsters/float/tris.md2");
616 	VectorSet(self->mins, -24, -24, -24);
617 	VectorSet(self->maxs, 24, 24, 32);
618 
619 	self->health = 200;
620 	self->gib_health = -80;
621 	self->mass = 300;
622 
623 	self->pain = floater_pain;
624 	self->die = floater_die;
625 
626 	self->monsterinfo.stand = floater_stand;
627 	self->monsterinfo.walk = floater_walk;
628 	self->monsterinfo.run = floater_run;
629 	//	self->monsterinfo.dodge = floater_dodge;
630 	self->monsterinfo.attack = floater_attack;
631 	self->monsterinfo.melee = floater_melee;
632 	self->monsterinfo.sight = floater_sight;
633 	self->monsterinfo.idle = floater_idle;
634 
635 	gi.linkentity(self);
636 
637 	if(random() <= 0.5)
638 		self->monsterinfo.currentmove = &floater_move_stand1;
639 	else
640 		self->monsterinfo.currentmove = &floater_move_stand2;
641 
642 	self->monsterinfo.scale = MODEL_SCALE;
643 
644 	flymonster_start(self);
645 }
646