src/bots.h

changeset 71
11f23fabf8a6
child 72
03e4d9db3fd9
equal deleted inserted replaced
70:fc257920ac00 71:11f23fabf8a6
1 //-----------------------------------------------------------------------------
2 //
3 // Skulltag Source
4 // Copyright (C) 2002 Brad Carney
5 // Copyright (C) 2007-2012 Skulltag Development Team
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are met:
10 //
11 // 1. Redistributions of source code must retain the above copyright notice,
12 // this list of conditions and the following disclaimer.
13 // 2. Redistributions in binary form must reproduce the above copyright notice,
14 // this list of conditions and the following disclaimer in the documentation
15 // and/or other materials provided with the distribution.
16 // 3. Neither the name of the Skulltag Development Team nor the names of its
17 // contributors may be used to endorse or promote products derived from this
18 // software without specific prior written permission.
19 // 4. Redistributions in any form must be accompanied by information on how to
20 // obtain complete source code for the software and any accompanying
21 // software that uses the software. The source code must either be included
22 // in the distribution or be available for no more than the cost of
23 // distribution plus a nominal fee, and must be freely redistributable
24 // under reasonable conditions. For an executable file, complete source
25 // code means the source code for all modules it contains. It does not
26 // include source code for modules or files that typically accompany the
27 // major components of the operating system on which the executable file
28 // runs.
29 //
30 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
34 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
37 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
38 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
39 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 // POSSIBILITY OF SUCH DAMAGE.
41 //
42 //
43 //
44 // Filename: bots.h
45 //
46 // Description: Contains bot structures and prototypes
47 // [Dusk] Cropped out the stuff botc doesn't need.
48 //
49 //-----------------------------------------------------------------------------
50
51 #ifndef __BOTS_H__
52 #define __BOTS_H__
53
54 //*****************************************************************************
55 // DEFINES
56
57 // Maximum number of variables on the bot evaluation stack.
58 #define BOTSCRIPT_STACK_SIZE 8
59
60 // Maximum number of botinto structures that can be defines.
61 #define MAX_BOTINFO 128
62
63 // Maximum number of states that can appear in a script.
64 #define MAX_NUM_STATES 256
65
66 // Maximum number of bot events that can be defined.
67 #define MAX_NUM_EVENTS 32
68
69 // Maximum number of global bot events that can be defined.
70 #define MAX_NUM_GLOBAL_EVENTS 32
71
72 // Maximum number of global variables that can be defined in a script.
73 #define MAX_SCRIPT_VARIABLES 128
74
75 // Maximum number of global arrays that can be defined in a script.
76 #define MAX_SCRIPT_ARRAYS 16
77
78 // Maximum number of global arrays that can be defined in a script.
79 #define MAX_SCRIPTARRAY_SIZE 65536
80
81 // Maxmimum number of state (local) variables that can appear in a script.
82 #define MAX_STATE_VARIABLES 16
83
84 // Maximum number of strings that can appear in a script stringlist.
85 #define MAX_LIST_STRINGS 128
86
87 // Maximum length of those strings in the stringlist.
88 #define MAX_STRING_LENGTH 256
89
90 // Maximum reaction time for a bot.
91 #define MAX_REACTION_TIME 52
92
93 // Maximum number of events the bots can store up that it's waiting to react to.
94 #define MAX_STORED_EVENTS 64
95
96 //*****************************************************************************
97 typedef enum
98 {
99 // Bot skill ratings.
100 BOTSKILL_VERYPOOR,
101 BOTSKILL_POOR,
102 BOTSKILL_LOW,
103 BOTSKILL_MEDIUM,
104 BOTSKILL_HIGH,
105 BOTSKILL_EXCELLENT,
106 BOTSKILL_SUPREME,
107 BOTSKILL_GODLIKE,
108 BOTSKILL_PERFECT,
109
110 NUM_BOT_SKILLS
111
112 } BOTSKILL_e;
113
114 //*****************************************************************************
115 // STRUCTURES
116 //
117
118 //*****************************************************************************
119 // These are the botscript data headers that it writes out.
120 typedef enum
121 {
122 DH_COMMAND,
123 DH_STATEIDX,
124 DH_STATENAME,
125 DH_ONENTER,
126 DH_MAINLOOP,
127 DH_ONEXIT,
128 DH_EVENT,
129 DH_ENDONENTER,
130 DH_ENDMAINLOOP,
131 DH_ENDONEXIT,
132 DH_ENDEVENT,
133 DH_IFGOTO,
134 DH_IFNOTGOTO,
135 DH_GOTO,
136 DH_ORLOGICAL,
137 DH_ANDLOGICAL,
138 DH_ORBITWISE,
139 DH_EORBITWISE,
140 DH_ANDBITWISE,
141 DH_EQUALS,
142 DH_NOTEQUALS,
143 DH_LESSTHAN,
144 DH_LESSTHANEQUALS,
145 DH_GREATERTHAN,
146 DH_GREATERTHANEQUALS,
147 DH_NEGATELOGICAL,
148 DH_LSHIFT,
149 DH_RSHIFT,
150 DH_ADD,
151 DH_SUBTRACT,
152 DH_UNARYMINUS,
153 DH_MULTIPLY,
154 DH_DIVIDE,
155 DH_MODULUS,
156 DH_PUSHNUMBER,
157 DH_PUSHSTRINGINDEX,
158 DH_PUSHGLOBALVAR,
159 DH_PUSHLOCALVAR,
160 DH_DROPSTACKPOSITION,
161 DH_SCRIPTVARLIST,
162 DH_STRINGLIST,
163 DH_INCGLOBALVAR,
164 DH_DECGLOBALVAR,
165 DH_ASSIGNGLOBALVAR,
166 DH_ADDGLOBALVAR,
167 DH_SUBGLOBALVAR,
168 DH_MULGLOBALVAR,
169 DH_DIVGLOBALVAR,
170 DH_MODGLOBALVAR,
171 DH_INCLOCALVAR,
172 DH_DECLOCALVAR,
173 DH_ASSIGNLOCALVAR,
174 DH_ADDLOCALVAR,
175 DH_SUBLOCALVAR,
176 DH_MULLOCALVAR,
177 DH_DIVLOCALVAR,
178 DH_MODLOCALVAR,
179 DH_CASEGOTO,
180 DH_DROP,
181 DH_INCGLOBALARRAY,
182 DH_DECGLOBALARRAY,
183 DH_ASSIGNGLOBALARRAY,
184 DH_ADDGLOBALARRAY,
185 DH_SUBGLOBALARRAY,
186 DH_MULGLOBALARRAY,
187 DH_DIVGLOBALARRAY,
188 DH_MODGLOBALARRAY,
189 DH_PUSHGLOBALARRAY,
190 DH_SWAP,
191 DH_DUP,
192 DH_ARRAYSET,
193
194 NUM_DATAHEADERS
195
196 } DATAHEADERS_e;
197
198 //*****************************************************************************
199 // These are the different bot events that can be posted to a bot's state.
200 typedef enum
201 {
202 BOTEVENT_KILLED_BYENEMY,
203 BOTEVENT_KILLED_BYPLAYER,
204 BOTEVENT_KILLED_BYSELF,
205 BOTEVENT_KILLED_BYENVIORNMENT,
206 BOTEVENT_REACHED_GOAL,
207 BOTEVENT_GOAL_REMOVED,
208 BOTEVENT_DAMAGEDBY_PLAYER,
209 BOTEVENT_PLAYER_SAY,
210 BOTEVENT_ENEMY_KILLED,
211 BOTEVENT_RESPAWNED,
212 BOTEVENT_INTERMISSION,
213 BOTEVENT_NEWMAP,
214 BOTEVENT_ENEMY_USEDFIST,
215 BOTEVENT_ENEMY_USEDCHAINSAW,
216 BOTEVENT_ENEMY_FIREDPISTOL,
217 BOTEVENT_ENEMY_FIREDSHOTGUN,
218 BOTEVENT_ENEMY_FIREDSSG,
219 BOTEVENT_ENEMY_FIREDCHAINGUN,
220 BOTEVENT_ENEMY_FIREDMINIGUN,
221 BOTEVENT_ENEMY_FIREDROCKET,
222 BOTEVENT_ENEMY_FIREDGRENADE,
223 BOTEVENT_ENEMY_FIREDRAILGUN,
224 BOTEVENT_ENEMY_FIREDPLASMA,
225 BOTEVENT_ENEMY_FIREDBFG,
226 BOTEVENT_ENEMY_FIREDBFG10K,
227 BOTEVENT_PLAYER_USEDFIST,
228 BOTEVENT_PLAYER_USEDCHAINSAW,
229 BOTEVENT_PLAYER_FIREDPISTOL,
230 BOTEVENT_PLAYER_FIREDSHOTGUN,
231 BOTEVENT_PLAYER_FIREDSSG,
232 BOTEVENT_PLAYER_FIREDCHAINGUN,
233 BOTEVENT_PLAYER_FIREDMINIGUN,
234 BOTEVENT_PLAYER_FIREDROCKET,
235 BOTEVENT_PLAYER_FIREDGRENADE,
236 BOTEVENT_PLAYER_FIREDRAILGUN,
237 BOTEVENT_PLAYER_FIREDPLASMA,
238 BOTEVENT_PLAYER_FIREDBFG,
239 BOTEVENT_PLAYER_FIREDBFG10K,
240 BOTEVENT_USEDFIST,
241 BOTEVENT_USEDCHAINSAW,
242 BOTEVENT_FIREDPISTOL,
243 BOTEVENT_FIREDSHOTGUN,
244 BOTEVENT_FIREDSSG,
245 BOTEVENT_FIREDCHAINGUN,
246 BOTEVENT_FIREDMINIGUN,
247 BOTEVENT_FIREDROCKET,
248 BOTEVENT_FIREDGRENADE,
249 BOTEVENT_FIREDRAILGUN,
250 BOTEVENT_FIREDPLASMA,
251 BOTEVENT_FIREDBFG,
252 BOTEVENT_FIREDBFG10K,
253 BOTEVENT_PLAYER_JOINEDGAME,
254 BOTEVENT_JOINEDGAME,
255 BOTEVENT_DUEL_STARTINGCOUNTDOWN,
256 BOTEVENT_DUEL_FIGHT,
257 BOTEVENT_DUEL_WINSEQUENCE,
258 BOTEVENT_SPECTATING,
259 BOTEVENT_LMS_STARTINGCOUNTDOWN,
260 BOTEVENT_LMS_FIGHT,
261 BOTEVENT_LMS_WINSEQUENCE,
262 BOTEVENT_WEAPONCHANGE,
263 BOTEVENT_ENEMY_BFGEXPLODE,
264 BOTEVENT_PLAYER_BFGEXPLODE,
265 BOTEVENT_BFGEXPLODE,
266 BOTEVENT_RECEIVEDMEDAL,
267
268 NUM_BOTEVENTS
269
270 } BOTEVENT_e;
271
272 #endif // __BOTS_H__

mercurial