Sun, 15 Jul 2012 18:56:26 +0300
Mainloop and onenter definitions are now written into separate buffers first and only written to file after state ends. Why? Zandronum seems to demand that mainloop definitions MUST be written right after any onenter one. This way, mainloop and onenter definitions can be written without this restriction in the script. Also now I have a cool uchar-buffer class :)
0 | 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 | // Date created: 5/18/04 | |
43 | // | |
44 | // | |
45 | // Filename: botcommands.h | |
46 | // | |
47 | // Description: Contains bot structures and prototypes | |
48 | // [Dusk] Clipped stuff that botc doesn't need. | |
49 | // | |
50 | //----------------------------------------------------------------------------- | |
51 | ||
52 | #ifndef __BOTCOMMANDS_H__ | |
53 | #define __BOTCOMMANDS_H__ | |
54 | ||
55 | #include "bots.h" | |
56 | ||
57 | //***************************************************************************** | |
58 | // DEFINES | |
59 | ||
60 | #define SETENEMY_LASTSEEN 0 | |
61 | #define SETENEMY_LASTSHOTBY 1 | |
62 | ||
63 | // Different results for pathing commands. | |
64 | #define PATH_UNREACHABLE -1 | |
65 | #define PATH_INCOMPLETE 0 | |
66 | #define PATH_COMPLETE 1 | |
67 | #define PATH_REACHEDGOAL 2 | |
68 | ||
69 | // This is the size of the return string for the bot command functions. | |
70 | #define BOTCMD_RETURNSTRING_SIZE 256 | |
71 | ||
72 | //***************************************************************************** | |
73 | typedef enum | |
74 | { | |
75 | BOTCMD_CHANGESTATE, // Basic botcmd utility functions. | |
76 | BOTCMD_DELAY, | |
77 | BOTCMD_RAND, | |
78 | BOTCMD_STRINGSAREEQUAL, | |
79 | BOTCMD_LOOKFORPOWERUPS, // Search functions. | |
80 | BOTCMD_LOOKFORWEAPONS, | |
81 | BOTCMD_LOOKFORAMMO, | |
82 | BOTCMD_LOOKFORBASEHEALTH, | |
83 | BOTCMD_LOOKFORBASEARMOR, | |
84 | BOTCMD_LOOKFORSUPERHEALTH, | |
85 | BOTCMD_LOOKFORSUPERARMOR, /* 10 */ | |
86 | BOTCMD_LOOKFORPLAYERENEMIES, | |
87 | BOTCMD_GETCLOSESTPLAYERENEMY, | |
88 | BOTCMD_MOVELEFT, // Movement functions. | |
89 | BOTCMD_MOVERIGHT, | |
90 | BOTCMD_MOVEFORWARD, | |
91 | BOTCMD_MOVEBACKWARDS, | |
92 | BOTCMD_STOPMOVEMENT, | |
93 | BOTCMD_STOPFORWARDMOVEMENT, | |
94 | BOTCMD_STOPSIDEWAYSMOVEMENT, | |
95 | BOTCMD_CHECKTERRAIN, /* 20 */ | |
96 | BOTCMD_PATHTOGOAL, // Pathing functions. | |
97 | BOTCMD_PATHTOLASTKNOWNENEMYPOSITION, | |
98 | BOTCMD_PATHTOLASTHEARDSOUND, | |
99 | BOTCMD_ROAM, | |
100 | BOTCMD_GETPATHINGCOSTTOITEM, | |
101 | BOTCMD_GETDISTANCETOITEM, | |
102 | BOTCMD_GETITEMNAME, | |
103 | BOTCMD_ISITEMVISIBLE, | |
104 | BOTCMD_SETGOAL, | |
105 | BOTCMD_BEGINAIMINGATENEMY, /* 30 */ // Aiming functions. | |
106 | BOTCMD_STOPAIMINGATENEMY, | |
107 | BOTCMD_TURN, | |
108 | BOTCMD_GETCURRENTANGLE, | |
109 | BOTCMD_SETENEMY, // Enemy functions. | |
110 | BOTCMD_CLEARENEMY, | |
111 | BOTCMD_ISENEMYALIVE, | |
112 | BOTCMD_ISENEMYVISIBLE, | |
113 | BOTCMD_GETDISTANCETOENEMY, | |
114 | BOTCMD_GETPLAYERDAMAGEDBY, | |
115 | BOTCMD_GETENEMYINVULNERABILITYTICKS, /* 40 */ | |
116 | BOTCMD_FIREWEAPON, // Weapon functions. | |
117 | BOTCMD_BEGINFIRINGWEAPON, | |
118 | BOTCMD_STOPFIRINGWEAPON, | |
119 | BOTCMD_GETCURRENTWEAPON, | |
120 | BOTCMD_CHANGEWEAPON, | |
121 | BOTCMD_GETWEAPONFROMITEM, | |
122 | BOTCMD_ISWEAPONOWNED, | |
123 | BOTCMD_ISFAVORITEWEAPON, | |
124 | BOTCMD_SAY, // Chat functions. | |
125 | BOTCMD_SAYFROMFILE, /* 50 */ | |
126 | BOTCMD_SAYFROMCHATFILE, | |
127 | BOTCMD_BEGINCHATTING, | |
128 | BOTCMD_STOPCHATTING, | |
129 | BOTCMD_CHATSECTIONEXISTS, | |
130 | BOTCMD_CHATSECTIONEXISTSINFILE, | |
131 | BOTCMD_GETLASTCHATSTRING, | |
132 | BOTCMD_GETLASTCHATPLAYER, | |
133 | BOTCMD_GETCHATFREQUENCY, | |
134 | BOTCMD_JUMP, // Jumping functions. | |
135 | BOTCMD_BEGINJUMPING, /* 60 */ | |
136 | BOTCMD_STOPJUMPING, | |
137 | BOTCMD_TAUNT, // Other action functions. | |
138 | BOTCMD_RESPAWN, | |
139 | BOTCMD_TRYTOJOINGAME, | |
140 | BOTCMD_ISDEAD, // Information about self functions. | |
141 | BOTCMD_ISSPECTATING, | |
142 | BOTCMD_GETHEALTH, | |
143 | BOTCMD_GETARMOR, | |
144 | BOTCMD_GETBASEHEALTH, | |
145 | BOTCMD_GETBASEARMOR, /* 70 */ | |
146 | BOTCMD_GETBOTSKILL, // Botskill functions. | |
147 | BOTCMD_GETACCURACY, | |
148 | BOTCMD_GETINTELLECT, | |
149 | BOTCMD_GETANTICIPATION, | |
150 | BOTCMD_GETEVADE, | |
151 | BOTCMD_GETREACTIONTIME, | |
152 | BOTCMD_GETPERCEPTION, | |
153 | BOTCMD_SETSKILLINCREASE, // Botskill modifying functions functions. | |
154 | BOTCMD_ISSKILLINCREASED, | |
155 | BOTCMD_SETSKILLDECREASE, /* 80 */ | |
156 | BOTCMD_ISSKILLDECREASED, | |
157 | BOTCMD_GETGAMEMODE, // Other functions. | |
158 | BOTCMD_GETSPREAD, | |
159 | BOTCMD_GETLASTJOINEDPLAYER, | |
160 | BOTCMD_GETPLAYERNAME, | |
161 | BOTCMD_GETRECEIVEDMEDAL, | |
162 | BOTCMD_ACS_EXECUTE, | |
163 | BOTCMD_GETFAVORITEWEAPON, | |
164 | BOTCMD_SAYFROMLUMP, | |
165 | BOTCMD_SAYFROMCHATLUMP, /* 90 */ | |
166 | BOTCMD_CHATSECTIONEXISTSINLUMP, | |
167 | BOTCMD_CHATSECTIONEXISTSINCHATLUMP, | |
168 | ||
169 | NUM_BOTCMDS | |
170 | ||
171 | } BOTCMD_e; | |
172 | ||
173 | //***************************************************************************** | |
174 | typedef enum | |
175 | { | |
176 | RETURNVAL_VOID, | |
177 | RETURNVAL_INT, | |
178 | RETURNVAL_BOOLEAN, | |
179 | RETURNVAL_STRING, | |
180 | ||
181 | } RETURNVAL_e; | |
182 | ||
183 | #endif // __BOTCOMMANDS_H__ |