aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/game/monsterinfo_t.java
blob: 4a9821302db8ee0173267907323fe7fec72ab13a (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
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 31.10.2003 by RST.
// $Id: monsterinfo_t.java,v 1.2 2004-08-20 21:29:58 salomo Exp $

package jake2.game;

import jake2.util.QuakeFile;

import java.io.IOException;
import java.io.RandomAccessFile;

public class monsterinfo_t {

	public mmove_t currentmove;
	public int aiflags;
	public int nextframe;
	public float scale;

	public EntThinkAdapter stand;
	public EntThinkAdapter idle;
	public EntThinkAdapter search;
	public EntThinkAdapter walk;
	public EntThinkAdapter run;

	public EntDodgeAdapter dodge;

	public EntThinkAdapter attack;
	public EntThinkAdapter melee;

	public EntInteractAdapter sight;

	public EntThinkAdapter checkattack;

	public float pausetime;
	public float attack_finished;

	public float[] saved_goal= { 0, 0, 0 };
	public float search_time;
	public float trail_time;
	public float[] last_sighting= { 0, 0, 0 };
	public int attack_state;
	public int lefty;
	public float idle_time;
	public int linkcount;

	public int power_armor_type;
	public int power_armor_power;

	/** Writes the monsterinfo to the file.*/
	public void write(QuakeFile f) throws IOException
	{
		f.writeBoolean(currentmove != null);
		if (currentmove != null)
			currentmove.write(f);
		f.writeInt(aiflags);
		f.writeInt(nextframe);
		f.writeFloat(scale);
		f.writeAdapter(stand);
		f.writeAdapter(idle);
		f.writeAdapter(search);
		f.writeAdapter(walk);
		f.writeAdapter(run);
		
		f.writeAdapter(dodge);
		
		f.writeAdapter(attack);
		f.writeAdapter(melee);
		
		f.writeAdapter(sight);
		
		f.writeAdapter(checkattack);
		
 		f.writeFloat(pausetime);
 		f.writeFloat(attack_finished);
 	
		f.writeVector(saved_goal);
		
		f.writeFloat(search_time);
		f.writeFloat(trail_time);
		
		f.writeVector(last_sighting);
 
		f.writeInt(attack_state);
		f.writeInt(lefty);
	
		f.writeFloat(idle_time);
		f.writeInt(linkcount);
		
		f.writeInt(power_armor_power);
		f.writeInt(power_armor_type);
	}

	/** Writes the monsterinfo to the file.*/
	public void read(QuakeFile f) throws IOException
	{
		if (f.readBoolean())
		{
			currentmove= new mmove_t();
			currentmove.read(f);
		}
		else
			currentmove= null; 
		aiflags = f.readInt();
		nextframe = f.readInt();
		scale = f.readFloat();
		stand = (EntThinkAdapter) f.readAdapter();
		idle = (EntThinkAdapter) f.readAdapter();
		search = (EntThinkAdapter) f.readAdapter();
		walk = (EntThinkAdapter) f.readAdapter();
		run = (EntThinkAdapter) f.readAdapter();
		
		dodge = (EntDodgeAdapter) f.readAdapter();
		
		attack = (EntThinkAdapter) f.readAdapter();
		melee = (EntThinkAdapter) f.readAdapter();
		
		sight = (EntInteractAdapter) f.readAdapter();
		
		checkattack = (EntThinkAdapter) f.readAdapter();
		
 		pausetime = f.readFloat();
 		attack_finished = f.readFloat();
 	
		saved_goal = f.readVector();
		
		search_time = f.readFloat();
		trail_time = f.readFloat();
		
		last_sighting = f.readVector();
 
		attack_state = f.readInt();
		lefty = f.readInt();
	
		idle_time = f.readFloat();
		linkcount = f.readInt();
		
		power_armor_power = f.readInt();
		power_armor_type = f.readInt();

	}


}