1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13 See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20 #include "g_local.h"
21
22
23 //
24 // monster weapons
25 //
26
27 //FIXME mosnters should call these with a totally accurate direction
28 // and we can mess it up based on skill. Spread should be for normal
29 // and we can tighten or loosen based on skill. We could muck with
30 // the damages too, but I'm not sure that's such a good idea.
monster_fire_bullet(edict_t * self,vec3_t start,vec3_t dir,int damage,int kick,int hspread,int vspread,int flashtype)31 void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype)
32 {
33 fire_bullet (self, start, dir, damage, kick, hspread, vspread, MOD_UNKNOWN);
34
35 gi.WriteByte (svc_muzzleflash2);
36 gi.WriteShort (self - g_edicts);
37 gi.WriteByte (flashtype);
38 gi.multicast (start, MULTICAST_PVS);
39 }
40
monster_fire_shotgun(edict_t * self,vec3_t start,vec3_t aimdir,int damage,int kick,int hspread,int vspread,int count,int flashtype)41 void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype)
42 {
43 fire_shotgun (self, start, aimdir, damage, kick, hspread, vspread, count, MOD_UNKNOWN);
44
45 gi.WriteByte (svc_muzzleflash2);
46 gi.WriteShort (self - g_edicts);
47 gi.WriteByte (flashtype);
48 gi.multicast (start, MULTICAST_PVS);
49 }
50
monster_fire_blaster(edict_t * self,vec3_t start,vec3_t dir,int damage,int speed,int flashtype,int effect)51 void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect)
52 {
53 fire_blaster (self, start, dir, damage, speed, effect, false);
54
55 gi.WriteByte (svc_muzzleflash2);
56 gi.WriteShort (self - g_edicts);
57 gi.WriteByte (flashtype);
58 gi.multicast (start, MULTICAST_PVS);
59 }
60
monster_fire_grenade(edict_t * self,vec3_t start,vec3_t aimdir,int damage,int speed,int flashtype)61 void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype)
62 {
63 fire_grenade (self, start, aimdir, damage, speed, 2.5, damage+40);
64
65 gi.WriteByte (svc_muzzleflash2);
66 gi.WriteShort (self - g_edicts);
67 gi.WriteByte (flashtype);
68 gi.multicast (start, MULTICAST_PVS);
69 }
70
monster_fire_rocket(edict_t * self,vec3_t start,vec3_t dir,int damage,int speed,int flashtype)71 void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype)
72 {
73 fire_rocket (self, start, dir, damage, speed, damage+20, damage);
74
75 gi.WriteByte (svc_muzzleflash2);
76 gi.WriteShort (self - g_edicts);
77 gi.WriteByte (flashtype);
78 gi.multicast (start, MULTICAST_PVS);
79 }
80
monster_fire_railgun(edict_t * self,vec3_t start,vec3_t aimdir,int damage,int kick,int flashtype)81 void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype)
82 {
83 fire_rail (self, start, aimdir, damage, kick);
84
85 gi.WriteByte (svc_muzzleflash2);
86 gi.WriteShort (self - g_edicts);
87 gi.WriteByte (flashtype);
88 gi.multicast (start, MULTICAST_PVS);
89 }
90
monster_fire_bfg(edict_t * self,vec3_t start,vec3_t aimdir,int damage,int speed,int kick,float damage_radius,int flashtype)91 void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype)
92 {
93 fire_bfg (self, start, aimdir, damage, speed, damage_radius);
94
95 gi.WriteByte (svc_muzzleflash2);
96 gi.WriteShort (self - g_edicts);
97 gi.WriteByte (flashtype);
98 gi.multicast (start, MULTICAST_PVS);
99 }
100
101
102
103 //
104 // Monster utility functions
105 //
106
M_FliesOff(edict_t * self)107 static void M_FliesOff (edict_t *self)
108 {
109 self->s.effects &= ~EF_FLIES;
110 self->s.sound = 0;
111 }
112
M_FliesOn(edict_t * self)113 static void M_FliesOn (edict_t *self)
114 {
115 if (self->waterlevel)
116 return;
117 self->s.effects |= EF_FLIES;
118 self->s.sound = gi.soundindex ("infantry/inflies1.wav");
119 self->think = M_FliesOff;
120 self->nextthink = level.time + 60;
121 }
122
M_FlyCheck(edict_t * self)123 void M_FlyCheck (edict_t *self)
124 {
125 if (self->waterlevel)
126 return;
127
128 if (random() > 0.5)
129 return;
130
131 self->think = M_FliesOn;
132 self->nextthink = level.time + 5 + 10 * random();
133 }
134
AttackFinished(edict_t * self,float time)135 void AttackFinished (edict_t *self, float time)
136 {
137 self->monsterinfo.attack_finished = level.time + time;
138 }
139
140
M_CheckGround(edict_t * ent)141 void M_CheckGround (edict_t *ent)
142 {
143 vec3_t point;
144 trace_t trace;
145
146 if (ent->flags & (FL_SWIM|FL_FLY))
147 return;
148
149 if (ent->velocity[2] > 100)
150 {
151 ent->groundentity = NULL;
152 return;
153 }
154
155 // if the hull point one-quarter unit down is solid the entity is on ground
156 point[0] = ent->s.origin[0];
157 point[1] = ent->s.origin[1];
158 point[2] = ent->s.origin[2] - 0.25;
159
160 trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, point, ent, MASK_MONSTERSOLID);
161
162 // check steepness
163 if ( trace.plane.normal[2] < 0.7 && !trace.startsolid)
164 {
165 ent->groundentity = NULL;
166 return;
167 }
168
169 // ent->groundentity = trace.ent;
170 // ent->groundentity_linkcount = trace.ent->linkcount;
171 // if (!trace.startsolid && !trace.allsolid)
172 // VectorCopy (trace.endpos, ent->s.origin);
173 if (!trace.startsolid && !trace.allsolid)
174 {
175 VectorCopy (trace.endpos, ent->s.origin);
176 ent->groundentity = trace.ent;
177 ent->groundentity_linkcount = trace.ent->linkcount;
178 ent->velocity[2] = 0;
179 }
180 }
181
182
M_CatagorizePosition(edict_t * ent)183 void M_CatagorizePosition (edict_t *ent)
184 {
185 vec3_t point;
186 int cont;
187
188 //
189 // get waterlevel
190 //
191 point[0] = ent->s.origin[0];
192 point[1] = ent->s.origin[1];
193 point[2] = ent->s.origin[2] + ent->mins[2] + 1;
194 cont = gi.pointcontents (point);
195
196 if (!(cont & MASK_WATER))
197 {
198 ent->waterlevel = 0;
199 ent->watertype = 0;
200 return;
201 }
202
203 ent->watertype = cont;
204 ent->waterlevel = 1;
205 point[2] += 26;
206 cont = gi.pointcontents (point);
207 if (!(cont & MASK_WATER))
208 return;
209
210 ent->waterlevel = 2;
211 point[2] += 22;
212 cont = gi.pointcontents (point);
213 if (cont & MASK_WATER)
214 ent->waterlevel = 3;
215 }
216
217
M_WorldEffects(edict_t * ent)218 void M_WorldEffects (edict_t *ent)
219 {
220 int dmg;
221
222 if (ent->health > 0)
223 {
224 if (!(ent->flags & FL_SWIM))
225 {
226 if (ent->waterlevel < 3)
227 {
228 ent->air_finished = level.time + 12;
229 }
230 else if (ent->air_finished < level.time)
231 { // drown!
232 if (ent->pain_debounce_time < level.time)
233 {
234 dmg = 2 + 2 * floor(level.time - ent->air_finished);
235 if (dmg > 15)
236 dmg = 15;
237 T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
238 ent->pain_debounce_time = level.time + 1;
239 }
240 }
241 }
242 else
243 {
244 if (ent->waterlevel > 0)
245 {
246 ent->air_finished = level.time + 9;
247 }
248 else if (ent->air_finished < level.time)
249 { // suffocate!
250 if (ent->pain_debounce_time < level.time)
251 {
252 dmg = 2 + 2 * floor(level.time - ent->air_finished);
253 if (dmg > 15)
254 dmg = 15;
255 T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR, MOD_WATER);
256 ent->pain_debounce_time = level.time + 1;
257 }
258 }
259 }
260 }
261
262 if (ent->waterlevel == 0)
263 {
264 if (ent->flags & FL_INWATER)
265 {
266 gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_out.wav"), 1, ATTN_NORM, 0);
267 ent->flags &= ~FL_INWATER;
268 }
269 return;
270 }
271
272 if ((ent->watertype & CONTENTS_LAVA) && !(ent->flags & FL_IMMUNE_LAVA))
273 {
274 if (ent->damage_debounce_time < level.time)
275 {
276 ent->damage_debounce_time = level.time + 0.2;
277 T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 10*ent->waterlevel, 0, 0, MOD_LAVA);
278 }
279 }
280 if ((ent->watertype & CONTENTS_SLIME) && !(ent->flags & FL_IMMUNE_SLIME))
281 {
282 if (ent->damage_debounce_time < level.time)
283 {
284 ent->damage_debounce_time = level.time + 1;
285 T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 4*ent->waterlevel, 0, 0, MOD_SLIME);
286 }
287 }
288
289 if ( !(ent->flags & FL_INWATER) )
290 {
291 if (!(ent->svflags & SVF_DEADMONSTER))
292 {
293 if (ent->watertype & CONTENTS_LAVA)
294 if (random() <= 0.5)
295 gi.sound (ent, CHAN_BODY, gi.soundindex("player/lava1.wav"), 1, ATTN_NORM, 0);
296 else
297 gi.sound (ent, CHAN_BODY, gi.soundindex("player/lava2.wav"), 1, ATTN_NORM, 0);
298 else if (ent->watertype & CONTENTS_SLIME)
299 gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
300 else if (ent->watertype & CONTENTS_WATER)
301 gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
302 }
303
304 ent->flags |= FL_INWATER;
305 ent->damage_debounce_time = 0;
306 }
307 }
308
309
M_droptofloor(edict_t * ent)310 void M_droptofloor (edict_t *ent)
311 {
312 vec3_t end;
313 trace_t trace;
314
315 ent->s.origin[2] += 1;
316 VectorCopy (ent->s.origin, end);
317 end[2] -= 256;
318
319 trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID);
320
321 if (trace.fraction == 1 || trace.allsolid)
322 return;
323
324 VectorCopy (trace.endpos, ent->s.origin);
325
326 gi.linkentity (ent);
327 M_CheckGround (ent);
328 M_CatagorizePosition (ent);
329 }
330
331
M_SetEffects(edict_t * ent)332 void M_SetEffects (edict_t *ent)
333 {
334 ent->s.effects &= ~(EF_COLOR_SHELL|EF_POWERSCREEN);
335 ent->s.renderfx &= ~(RF_SHELL_RED|RF_SHELL_GREEN|RF_SHELL_BLUE);
336
337 if (ent->monsterinfo.aiflags & AI_RESURRECTING)
338 {
339 ent->s.effects |= EF_COLOR_SHELL;
340 ent->s.renderfx |= RF_SHELL_RED;
341 }
342
343 if (ent->health <= 0)
344 return;
345
346 if (ent->powerarmor_time > level.time)
347 {
348 if (ent->monsterinfo.power_armor_type == POWER_ARMOR_SCREEN)
349 {
350 ent->s.effects |= EF_POWERSCREEN;
351 }
352 else if (ent->monsterinfo.power_armor_type == POWER_ARMOR_SHIELD)
353 {
354 ent->s.effects |= EF_COLOR_SHELL;
355 ent->s.renderfx |= RF_SHELL_GREEN;
356 }
357 }
358 }
359
360
M_MoveFrame(edict_t * self)361 void M_MoveFrame (edict_t *self)
362 {
363 mmove_t *move;
364 int index;
365
366 move = self->monsterinfo.currentmove;
367 self->nextthink = level.time + FRAMETIME;
368
369 if ((self->monsterinfo.nextframe) && (self->monsterinfo.nextframe >= move->firstframe) && (self->monsterinfo.nextframe <= move->lastframe))
370 {
371 self->s.frame = self->monsterinfo.nextframe;
372 self->monsterinfo.nextframe = 0;
373 }
374 else
375 {
376 if (self->s.frame == move->lastframe)
377 {
378 if (move->endfunc)
379 {
380 move->endfunc (self);
381
382 // regrab move, endfunc is very likely to change it
383 move = self->monsterinfo.currentmove;
384
385 // check for death
386 if (self->svflags & SVF_DEADMONSTER)
387 return;
388 }
389 }
390
391 if (self->s.frame < move->firstframe || self->s.frame > move->lastframe)
392 {
393 self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
394 self->s.frame = move->firstframe;
395 }
396 else
397 {
398 if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
399 {
400 self->s.frame++;
401 if (self->s.frame > move->lastframe)
402 self->s.frame = move->firstframe;
403 }
404 }
405 }
406
407 index = self->s.frame - move->firstframe;
408 if (move->frame[index].aifunc)
409 {
410 if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
411 move->frame[index].aifunc (self, move->frame[index].dist * self->monsterinfo.scale);
412 else
413 move->frame[index].aifunc (self, 0);
414 }
415 if (move->frame[index].thinkfunc)
416 move->frame[index].thinkfunc (self);
417 }
418
419
monster_think(edict_t * self)420 void monster_think (edict_t *self)
421 {
422 M_MoveFrame (self);
423 if (self->linkcount != self->monsterinfo.linkcount)
424 {
425 self->monsterinfo.linkcount = self->linkcount;
426 M_CheckGround (self);
427 }
428 M_CatagorizePosition (self);
429 M_WorldEffects (self);
430 M_SetEffects (self);
431 }
432
433
434 /*
435 ================
436 monster_use
437
438 Using a monster makes it angry at the current activator
439 ================
440 */
monster_use(edict_t * self,edict_t * other,edict_t * activator)441 void monster_use (edict_t *self, edict_t *other, edict_t *activator)
442 {
443 if (self->enemy)
444 return;
445 if (self->health <= 0)
446 return;
447 if (activator->flags & FL_NOTARGET)
448 return;
449 if (!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY))
450 return;
451
452 // delay reaction so if the monster is teleported, its sound is still heard
453 self->enemy = activator;
454 FoundTarget (self);
455 }
456
457
458 void monster_start_go (edict_t *self);
459
460
monster_triggered_spawn(edict_t * self)461 void monster_triggered_spawn (edict_t *self)
462 {
463 self->s.origin[2] += 1;
464 KillBox (self);
465
466 self->solid = SOLID_BBOX;
467 self->movetype = MOVETYPE_STEP;
468 self->svflags &= ~SVF_NOCLIENT;
469 self->air_finished = level.time + 12;
470 gi.linkentity (self);
471
472 monster_start_go (self);
473
474 if (self->enemy && !(self->spawnflags & 1) && !(self->enemy->flags & FL_NOTARGET))
475 {
476 FoundTarget (self);
477 }
478 else
479 {
480 self->enemy = NULL;
481 }
482 }
483
monster_triggered_spawn_use(edict_t * self,edict_t * other,edict_t * activator)484 void monster_triggered_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
485 {
486 // we have a one frame delay here so we don't telefrag the guy who activated us
487 self->think = monster_triggered_spawn;
488 self->nextthink = level.time + FRAMETIME;
489 if (activator->client)
490 self->enemy = activator;
491 self->use = monster_use;
492 }
493
monster_triggered_start(edict_t * self)494 void monster_triggered_start (edict_t *self)
495 {
496 self->solid = SOLID_NOT;
497 self->movetype = MOVETYPE_NONE;
498 self->svflags |= SVF_NOCLIENT;
499 self->nextthink = 0;
500 self->use = monster_triggered_spawn_use;
501 }
502
503
504 /*
505 ================
506 monster_death_use
507
508 When a monster dies, it fires all of its targets with the current
509 enemy as activator.
510 ================
511 */
monster_death_use(edict_t * self)512 void monster_death_use (edict_t *self)
513 {
514 self->flags &= ~(FL_FLY|FL_SWIM);
515 self->monsterinfo.aiflags &= AI_GOOD_GUY;
516
517 if (self->item)
518 {
519 Drop_Item (self, self->item);
520 self->item = NULL;
521 }
522
523 if (self->deathtarget)
524 self->target = self->deathtarget;
525
526 if (!self->target)
527 return;
528
529 G_UseTargets (self, self->enemy);
530 }
531
532
533 //============================================================================
534
monster_start(edict_t * self)535 qboolean monster_start (edict_t *self)
536 {
537 if (deathmatch->value)
538 {
539 G_FreeEdict (self);
540 return false;
541 }
542
543 if ((self->spawnflags & 4) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
544 {
545 self->spawnflags &= ~4;
546 self->spawnflags |= 1;
547 // gi.dprintf("fixed spawnflags on %s at %s\n", self->classname, vtos(self->s.origin));
548 }
549
550 if (!(self->monsterinfo.aiflags & AI_GOOD_GUY))
551 level.total_monsters++;
552
553 self->nextthink = level.time + FRAMETIME;
554 self->svflags |= SVF_MONSTER;
555 self->s.renderfx |= RF_FRAMELERP;
556 self->takedamage = DAMAGE_AIM;
557 self->air_finished = level.time + 12;
558 self->use = monster_use;
559 self->max_health = self->health;
560 self->clipmask = MASK_MONSTERSOLID;
561
562 self->s.skinnum = 0;
563 self->deadflag = DEAD_NO;
564 self->svflags &= ~SVF_DEADMONSTER;
565
566 if (!self->monsterinfo.checkattack)
567 self->monsterinfo.checkattack = M_CheckAttack;
568 VectorCopy (self->s.origin, self->s.old_origin);
569
570 if (st.item)
571 {
572 self->item = FindItemByClassname (st.item);
573 if (!self->item)
574 gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item);
575 }
576
577 // randomize what frame they start on
578 if (self->monsterinfo.currentmove)
579 self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1));
580
581 return true;
582 }
583
monster_start_go(edict_t * self)584 void monster_start_go (edict_t *self)
585 {
586 vec3_t v;
587
588 if (self->health <= 0)
589 return;
590
591 // check for target to combat_point and change to combattarget
592 if (self->target)
593 {
594 qboolean notcombat;
595 qboolean fixup;
596 edict_t *target;
597
598 target = NULL;
599 notcombat = false;
600 fixup = false;
601 while ((target = G_Find (target, FOFS(targetname), self->target)) != NULL)
602 {
603 if (strcmp(target->classname, "point_combat") == 0)
604 {
605 self->combattarget = self->target;
606 fixup = true;
607 }
608 else
609 {
610 notcombat = true;
611 }
612 }
613 if (notcombat && self->combattarget)
614 gi.dprintf("%s at %s has target with mixed types\n", self->classname, vtos(self->s.origin));
615 if (fixup)
616 self->target = NULL;
617 }
618
619 // validate combattarget
620 if (self->combattarget)
621 {
622 edict_t *target;
623
624 target = NULL;
625 while ((target = G_Find (target, FOFS(targetname), self->combattarget)) != NULL)
626 {
627 if (strcmp(target->classname, "point_combat") != 0)
628 {
629 gi.dprintf("%s at (%i %i %i) has a bad combattarget %s : %s at (%i %i %i)\n",
630 self->classname, (int)self->s.origin[0], (int)self->s.origin[1], (int)self->s.origin[2],
631 self->combattarget, target->classname, (int)target->s.origin[0], (int)target->s.origin[1],
632 (int)target->s.origin[2]);
633 }
634 }
635 }
636
637 if (self->target)
638 {
639 self->goalentity = self->movetarget = G_PickTarget(self->target);
640 if (!self->movetarget)
641 {
642 gi.dprintf ("%s can't find target %s at %s\n", self->classname, self->target, vtos(self->s.origin));
643 self->target = NULL;
644 self->monsterinfo.pausetime = 100000000;
645 self->monsterinfo.stand (self);
646 }
647 else if (strcmp (self->movetarget->classname, "path_corner") == 0)
648 {
649 VectorSubtract (self->goalentity->s.origin, self->s.origin, v);
650 self->ideal_yaw = self->s.angles[YAW] = vectoyaw(v);
651 self->monsterinfo.walk (self);
652 self->target = NULL;
653 }
654 else
655 {
656 self->goalentity = self->movetarget = NULL;
657 self->monsterinfo.pausetime = 100000000;
658 self->monsterinfo.stand (self);
659 }
660 }
661 else
662 {
663 self->monsterinfo.pausetime = 100000000;
664 self->monsterinfo.stand (self);
665 }
666
667 self->think = monster_think;
668 self->nextthink = level.time + FRAMETIME;
669 }
670
671
walkmonster_start_go(edict_t * self)672 void walkmonster_start_go (edict_t *self)
673 {
674 if (!(self->spawnflags & 2) && level.time < 1)
675 {
676 M_droptofloor (self);
677
678 if (self->groundentity)
679 if (!M_walkmove (self, 0, 0))
680 gi.dprintf ("%s in solid at %s\n", self->classname, vtos(self->s.origin));
681 }
682
683 if (!self->yaw_speed)
684 self->yaw_speed = 20;
685 self->viewheight = 25;
686
687 monster_start_go (self);
688
689 if (self->spawnflags & 2)
690 monster_triggered_start (self);
691 }
692
walkmonster_start(edict_t * self)693 void walkmonster_start (edict_t *self)
694 {
695 self->think = walkmonster_start_go;
696 monster_start (self);
697 }
698
699
flymonster_start_go(edict_t * self)700 void flymonster_start_go (edict_t *self)
701 {
702 if (!M_walkmove (self, 0, 0))
703 gi.dprintf ("%s in solid at %s\n", self->classname, vtos(self->s.origin));
704
705 if (!self->yaw_speed)
706 self->yaw_speed = 10;
707 self->viewheight = 25;
708
709 monster_start_go (self);
710
711 if (self->spawnflags & 2)
712 monster_triggered_start (self);
713 }
714
715
flymonster_start(edict_t * self)716 void flymonster_start (edict_t *self)
717 {
718 self->flags |= FL_FLY;
719 self->think = flymonster_start_go;
720 monster_start (self);
721 }
722
723
swimmonster_start_go(edict_t * self)724 void swimmonster_start_go (edict_t *self)
725 {
726 if (!self->yaw_speed)
727 self->yaw_speed = 10;
728 self->viewheight = 10;
729
730 monster_start_go (self);
731
732 if (self->spawnflags & 2)
733 monster_triggered_start (self);
734 }
735
swimmonster_start(edict_t * self)736 void swimmonster_start (edict_t *self)
737 {
738 self->flags |= FL_SWIM;
739 self->think = swimmonster_start_go;
740 monster_start (self);
741 }
742