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.2f;
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 
416 	if (move->frame[index].thinkfunc)
417 		move->frame[index].thinkfunc (self);
418 }
419 
420 
monster_think(edict_t * self)421 void monster_think (edict_t *self)
422 {
423 	M_MoveFrame (self);
424 	if (self->linkcount != self->monsterinfo.linkcount)
425 	{
426 		self->monsterinfo.linkcount = self->linkcount;
427 		M_CheckGround (self);
428 	}
429 	M_CatagorizePosition (self);
430 	M_WorldEffects (self);
431 	M_SetEffects (self);
432 }
433 
434 
435 /*
436 ================
437 monster_use
438 
439 Using a monster makes it angry at the current activator
440 ================
441 */
monster_use(edict_t * self,edict_t * other,edict_t * activator)442 void monster_use (edict_t *self, edict_t *other, edict_t *activator)
443 {
444 	if (self->enemy)
445 		return;
446 	if (self->health <= 0)
447 		return;
448 	if (activator->flags & FL_NOTARGET)
449 		return;
450 	if (!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY))
451 		return;
452 
453 // delay reaction so if the monster is teleported, its sound is still heard
454 	self->enemy = activator;
455 	FoundTarget (self);
456 }
457 
458 
459 void monster_start_go (edict_t *self);
460 
461 
monster_triggered_spawn(edict_t * self)462 void monster_triggered_spawn (edict_t *self)
463 {
464 	self->s.origin[2] += 1;
465 	KillBox (self);
466 
467 	self->solid = SOLID_BBOX;
468 	self->movetype = MOVETYPE_STEP;
469 	self->svflags &= ~SVF_NOCLIENT;
470 	self->air_finished = level.time + 12;
471 	gi.linkentity (self);
472 
473 	monster_start_go (self);
474 
475 	if (self->enemy && !(self->spawnflags & 1) && !(self->enemy->flags & FL_NOTARGET))
476 	{
477 		FoundTarget (self);
478 	}
479 	else
480 	{
481 		self->enemy = NULL;
482 	}
483 }
484 
monster_triggered_spawn_use(edict_t * self,edict_t * other,edict_t * activator)485 void monster_triggered_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
486 {
487 	// we have a one frame delay here so we don't telefrag the guy who activated us
488 	self->think = monster_triggered_spawn;
489 	self->nextthink = level.time + FRAMETIME;
490 	if (activator->client)
491 		self->enemy = activator;
492 	self->use = monster_use;
493 }
494 
monster_triggered_start(edict_t * self)495 void monster_triggered_start (edict_t *self)
496 {
497 	self->solid = SOLID_NOT;
498 	self->movetype = MOVETYPE_NONE;
499 	self->svflags |= SVF_NOCLIENT;
500 	self->nextthink = 0;
501 	self->use = monster_triggered_spawn_use;
502 }
503 
504 
505 /*
506 ================
507 monster_death_use
508 
509 When a monster dies, it fires all of its targets with the current
510 enemy as activator.
511 ================
512 */
monster_death_use(edict_t * self)513 void monster_death_use (edict_t *self)
514 {
515 	self->flags &= ~(FL_FLY|FL_SWIM);
516 	self->monsterinfo.aiflags &= AI_GOOD_GUY;
517 
518 	if (self->item)
519 	{
520 		Drop_Item (self, self->item);
521 		self->item = NULL;
522 	}
523 
524 	if (self->deathtarget)
525 		self->target = self->deathtarget;
526 
527 	if (!self->target)
528 		return;
529 
530 	G_UseTargets (self, self->enemy);
531 }
532 
533 
534 //============================================================================
535 
monster_start(edict_t * self)536 qboolean monster_start (edict_t *self)
537 {
538 	if (deathmatch->value)
539 	{
540 		G_FreeEdict (self);
541 		return false;
542 	}
543 
544 	if ((self->spawnflags & 4) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
545 	{
546 		self->spawnflags &= ~4;
547 		self->spawnflags |= 1;
548 //		gi.dprintf("fixed spawnflags on %s at %s\n", self->classname, vtos(self->s.origin));
549 	}
550 
551 	if (!(self->monsterinfo.aiflags & AI_GOOD_GUY))
552 		level.total_monsters++;
553 
554 	self->nextthink = level.time + FRAMETIME;
555 	self->svflags |= SVF_MONSTER;
556 	self->s.renderfx |= RF_FRAMELERP;
557 	self->takedamage = DAMAGE_AIM;
558 	self->air_finished = level.time + 12;
559 	self->use = monster_use;
560 	self->max_health = self->health;
561 	self->clipmask = MASK_MONSTERSOLID;
562 
563 	self->s.skinnum = 0;
564 	self->deadflag = DEAD_NO;
565 	self->svflags &= ~SVF_DEADMONSTER;
566 
567 	if (!self->monsterinfo.checkattack)
568 		self->monsterinfo.checkattack = M_CheckAttack;
569 	VectorCopy (self->s.origin, self->s.old_origin);
570 
571 	if (st.item)
572 	{
573 		self->item = FindItemByClassname (st.item);
574 		if (!self->item)
575 			gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item);
576 	}
577 
578 	// randomize what frame they start on
579 	if (self->monsterinfo.currentmove)
580 		self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1));
581 
582 	return true;
583 }
584 
monster_start_go(edict_t * self)585 void monster_start_go (edict_t *self)
586 {
587 	vec3_t	v;
588 
589 	if (self->health <= 0)
590 		return;
591 
592 	// check for target to combat_point and change to combattarget
593 	if (self->target)
594 	{
595 		qboolean	notcombat;
596 		qboolean	fixup;
597 		edict_t		*target;
598 
599 		target = NULL;
600 		notcombat = false;
601 		fixup = false;
602 		while ((target = G_Find (target, FOFS(targetname), self->target)) != NULL)
603 		{
604 			if (strcmp(target->classname, "point_combat") == 0)
605 			{
606 				self->combattarget = self->target;
607 				fixup = true;
608 			}
609 			else
610 			{
611 				notcombat = true;
612 			}
613 		}
614 		if (notcombat && self->combattarget)
615 			gi.dprintf("%s at %s has target with mixed types\n", self->classname, vtos(self->s.origin));
616 		if (fixup)
617 			self->target = NULL;
618 	}
619 
620 	// validate combattarget
621 	if (self->combattarget)
622 	{
623 		edict_t		*target;
624 
625 		target = NULL;
626 		while ((target = G_Find (target, FOFS(targetname), self->combattarget)) != NULL)
627 		{
628 			if (strcmp(target->classname, "point_combat") != 0)
629 			{
630 				gi.dprintf("%s at (%i %i %i) has a bad combattarget %s : %s at (%i %i %i)\n",
631 					self->classname, (int)self->s.origin[0], (int)self->s.origin[1], (int)self->s.origin[2],
632 					self->combattarget, target->classname, (int)target->s.origin[0], (int)target->s.origin[1],
633 					(int)target->s.origin[2]);
634 			}
635 		}
636 	}
637 
638 	if (self->target)
639 	{
640 		self->goalentity = self->movetarget = G_PickTarget(self->target);
641 		if (!self->movetarget)
642 		{
643 			gi.dprintf ("%s can't find target %s at %s\n", self->classname, self->target, vtos(self->s.origin));
644 			self->target = NULL;
645 			self->monsterinfo.pausetime = 100000000;
646 			self->monsterinfo.stand (self);
647 		}
648 		else if (strcmp (self->movetarget->classname, "path_corner") == 0)
649 		{
650 			VectorSubtract (self->goalentity->s.origin, self->s.origin, v);
651 			self->ideal_yaw = self->s.angles[YAW] = vectoyaw(v);
652 			self->monsterinfo.walk (self);
653 			self->target = NULL;
654 		}
655 		else
656 		{
657 			self->goalentity = self->movetarget = NULL;
658 			self->monsterinfo.pausetime = 100000000;
659 			self->monsterinfo.stand (self);
660 		}
661 	}
662 	else
663 	{
664 		self->monsterinfo.pausetime = 100000000;
665 		self->monsterinfo.stand (self);
666 	}
667 
668 	self->think = monster_think;
669 	self->nextthink = level.time + FRAMETIME;
670 }
671 
672 
walkmonster_start_go(edict_t * self)673 void walkmonster_start_go (edict_t *self)
674 {
675 	if (!(self->spawnflags & 2) && level.time < 1)
676 	{
677 		M_droptofloor (self);
678 
679 		if (self->groundentity)
680 			if (!M_walkmove (self, 0, 0))
681 				gi.dprintf ("%s in solid at %s\n", self->classname, vtos(self->s.origin));
682 	}
683 
684 	if (!self->yaw_speed)
685 		self->yaw_speed = 20;
686 	self->viewheight = 25;
687 
688 	monster_start_go (self);
689 
690 	if (self->spawnflags & 2)
691 		monster_triggered_start (self);
692 }
693 
walkmonster_start(edict_t * self)694 void walkmonster_start (edict_t *self)
695 {
696 	self->think = walkmonster_start_go;
697 	monster_start (self);
698 }
699 
700 
flymonster_start_go(edict_t * self)701 void flymonster_start_go (edict_t *self)
702 {
703 	if (!M_walkmove (self, 0, 0))
704 		gi.dprintf ("%s in solid at %s\n", self->classname, vtos(self->s.origin));
705 
706 	if (!self->yaw_speed)
707 		self->yaw_speed = 10;
708 	self->viewheight = 25;
709 
710 	monster_start_go (self);
711 
712 	if (self->spawnflags & 2)
713 		monster_triggered_start (self);
714 }
715 
716 
flymonster_start(edict_t * self)717 void flymonster_start (edict_t *self)
718 {
719 	self->flags |= FL_FLY;
720 	self->think = flymonster_start_go;
721 	monster_start (self);
722 }
723 
724 
swimmonster_start_go(edict_t * self)725 void swimmonster_start_go (edict_t *self)
726 {
727 	if (!self->yaw_speed)
728 		self->yaw_speed = 10;
729 	self->viewheight = 10;
730 
731 	monster_start_go (self);
732 
733 	if (self->spawnflags & 2)
734 		monster_triggered_start (self);
735 }
736 
swimmonster_start(edict_t * self)737 void swimmonster_start (edict_t *self)
738 {
739 	self->flags |= FL_SWIM;
740 	self->think = swimmonster_start_go;
741 	monster_start (self);
742 }
743