aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/game/MonsterAdapters.java
blob: 918ddc44be89fc047fe37665f67ba42fc0ea97df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/

// Created on 26.02.2004 by RST.
// $Id: MonsterAdapters.java,v 1.1 2004-07-08 15:58:44 hzi Exp $

package jake2.game;

import jake2.Defines;
import jake2.client.M;
import jake2.qcommon.Com;

public class MonsterAdapters {

	public static EntThinkAdapter monster_think = new EntThinkAdapter() {
		public boolean think(edict_t self) {
	
			M.M_MoveFrame(self);
			if (self.linkcount != self.monsterinfo.linkcount) {
				self.monsterinfo.linkcount = self.linkcount;
				M.M_CheckGround(self);
			}
			M.M_CatagorizePosition(self);
			M.M_WorldEffects(self);
			M.M_SetEffects(self);
			return true;
		}
	};
	public static EntThinkAdapter monster_triggered_spawn = new EntThinkAdapter() {
		public boolean think(edict_t self) {
	
			self.s.origin[2] += 1;
			GameUtil.KillBox(self);
	
			self.solid = Defines.SOLID_BBOX;
			self.movetype = Defines.MOVETYPE_STEP;
			self.svflags &= ~Defines.SVF_NOCLIENT;
			self.air_finished = GameBase.level.time + 12;
			GameBase.gi.linkentity(self);
	
			Monster.monster_start_go(self);
	
			if (self.enemy != null && 0 == (self.spawnflags & 1) && 0 == (self.enemy.flags & Defines.FL_NOTARGET)) {
				GameUtil.FoundTarget(self);
			}
			else {
				self.enemy = null;
			}
			return true;
		}
	};
	//	we have a one frame delay here so we don't telefrag the guy who activated us
	public static EntUseAdapter monster_triggered_spawn_use = new EntUseAdapter() {
	
		public void use(edict_t self, edict_t other, edict_t activator) {
			self.think = monster_triggered_spawn;
			self.nextthink = GameBase.level.time + Defines.FRAMETIME;
			if (activator.client != null)
				self.enemy = activator;
			self.use = GameUtilAdapters.monster_use;
		}
	};
	public static EntThinkAdapter monster_triggered_start = new EntThinkAdapter() {
		public boolean think(edict_t self) {
			if (self.index ==312)
				Com.p("monster_triggered_start");
			self.solid = Defines.SOLID_NOT;
			self.movetype = Defines.MOVETYPE_NONE;
			self.svflags |= Defines.SVF_NOCLIENT;
			self.nextthink = 0;
			self.use = monster_triggered_spawn_use;
			return true;
		}
	};
}