-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBOT.DPR
240 lines (210 loc) · 7.1 KB
/
BOT.DPR
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
{
BOT.DLL for Need For Kill
(c) 3d[Power]
http://www.3dpower.org
unit: bot.dpr
purpose: system procedures.
warning: do not modify this unit.
}
library bot;
uses
SysUtils,
Classes,
Windows,
bot_defs in 'bot_defs.pas',
bot_ai in 'bot_ai.pas',
bot_console in 'bot_console.pas',
bot_register in 'bot_register.pas',
bot_util in 'bot_util.pas';
// ==========================================
// --------------------------------------------------------------
// DO NOT MODIFY.
procedure DLL_RegisterProc1(AProc : TCallProcWordWordFunc);
begin
SetAngle := AProc;
end;
procedure DLL_RegisterProc2(AProc : TCallTextProc; ProcID:byte);
begin
case ProcID of
1 : AddMessage := AProc;
2 : RegisterConsoleCommand := AProc;
end;
end;
// DO NOT MODIFY.
procedure DLL_RegisterProc3(AProc : TCallProcSTR; ProcID:byte);
begin
case ProcID of
1 : GetSystemVariable := AProc;
end;
end;
// DO NOT MODIFY.
procedure DLL_RegisterProc4(AProc : TCallProcCreatePlayer; ProcID:byte);
begin
sys_CreatePlayer := AProc;
end;
// DO NOT MODIFY.
procedure DLL_RegisterProc5(AProc : TCallProcWordByteFunc; ProcID:byte);
begin
case ProcID of
1 : SetKeys := AProc;
3 : SetWeapon := AProc;
4 : SetBalloon := AProc;
end;
end;
// DO NOT MODIFY.
procedure DLL_RegisterProc6(AProc : TCallProcWordWord_Bool; ProcID:byte);
begin
case ProcID of
1 : Test_Blocked := AProc;
end;
end;
// DO NOT MODIFY.
procedure DLL_RegisterProc7(AProc : TCallProcWordWordString; ProcID:byte);
begin
case ProcID of
1 : debug_textout := AProc;
2 : debug_textoutc := AProc;
end;
end;
// DO NOT MODIFY.
procedure DLL_RegisterProc8(AProc : TCallProcBrickStruct); begin GetBrickStruct := AProc; end;
procedure DLL_RegisterProc9(AProc : TCallProcObjectsStruct); begin GetObjStruct := AProc; end;
procedure DLL_RegisterProc10(AProc : TCallProcSpecailObjectsStruct); begin GetSpecObjStruct := AProc; end;
procedure DLL_RegisterProc11(AProc : TCallProcWord); begin RemoveBot := AProc; end;
procedure DLL_RegisterProc12(AProc : TCallProcChat); begin SendBotChat := AProc; end;
// ================================================
// MainLoop. NFK.EXE calls this procedure 50 times per second. (in game)
procedure DLL_MainLoop();
begin
MAIN_Loop;
end;
// NFK loads a map. and begin game. It should be warmup time for now..
procedure DLL_EVENT_BeginGame;
begin
CMD_Register;
EVENT_BeginGame;
end;
// Game Reborn. It happends at game start, or at map restart. (it also called after DLL_EVENT_BeginGame (once));
procedure DLL_EVENT_MapChanged;
begin
EVENT_MapChanged;
end;
// Map changed by "map" command, or by callvote
procedure DLL_EVENT_ResetGame;
begin
EVENT_ResetGame;
end;
// NFK.EXE query bot.dll version.
function DLL_QUERY_VERSION:shortstring;
begin
result := BotVersion;
end;
// DO NOT MODIFY
procedure DLL_SYSTEM_AddPlayer(Player : TPlayerEx);
var i : byte;
begin
for i := 0 to 7 do if players[i] = nil then // free cell
begin
players[i] := Tplayer.Create;
players[i].DXID := Player.DXID;
players[i].netname := player.netname;
players[i].bot := player.bot;
exit;
end;
end;
// DO NOT MODIFY
procedure DLL_SYSTEM_RemoveAllPlayers();
var i : byte;
begin
for i := 0 to high(Players) do if players[i] <> nil then // free cell
players[i] := nil;
end;
// DO NOT MODIFY
procedure DLL_SYSTEM_RemovePlayer(DXID:word);
begin
RemovePlayer(DXID);
end;
// DO NOT MODIFY
procedure DLL_DMGReceived(TargetDXID, AttackerDXID:Word; dmg : word);
begin
EVENT_DMGReceived(TargetDXID, AttackerDXID, dmg);
end;
procedure DLL_ChatReceived(DXID:Word; Text : shortstring);
begin
EVENT_ChatReceived(DXID, Text);
end;
procedure DLL_AddModel(s : shortstring);
begin
ModelList.Add(s);
end;
// DO NOT MODIFY
procedure DLL_SYSTEM_UpdatePlayer(Player : TPlayerEx);
var i : byte;
begin
// update all player info
for i := 0 to 7 do if players[i] <> nil then // free cell
if players[i].DXID = Player.DXID then
with players[i] do begin
dead := player.dead;
bot := player.bot;
refire := player.refire;
weapchg := player.weapchg;
weapon := player.weapon;
threadweapon := player.threadweapon;
dir := player.dir;
gantl_state := player.gantl_state;
air := player.air;
team := player.team;
health := player.health;
armor := player.armor;
frags := player.frags;
netname := player.netname;
nfkmodel := player.nfkmodel;
crouch := player.crouch;
balloon := player.balloon;
flagcarrier := player.flagcarrier;
Location := player.Location;
item_quad := player.item_quad;
item_regen := player.item_regen;
item_battle := player.item_battle;
item_flight := player.item_flight;
item_haste := player.item_haste;
item_invis := player.item_invis;
have_rl := player.have_rl;
have_gl := player.have_gl;
have_rg := player.have_rg;
have_bfg := player.have_bfg;
have_sg := player.have_sg;
have_sh := player.have_sh;
have_mg := player.have_mg;
have_pl := player.have_pl;
ammo_mg := player.ammo_mg;
ammo_sg := player.ammo_sg;
ammo_gl := player.ammo_gl;
ammo_rl := player.ammo_rl;
ammo_sh := player.ammo_sh;
ammo_rg := player.ammo_rg;
ammo_pl := player.ammo_pl;
ammo_bfg := player.ammo_bfg;
x := player.x;
y := player.y;
cx := player.cx;
cy := player.cy;
InertiaX := player.InertiaX;
InertiaY := player.InertiaY;
if not bot then fangle := player.fangle;
exit;
end;
end;
exports DLL_RegisterProc1,DLL_RegisterProc2, DLL_RegisterProc3,
DLL_RegisterProc4, DLL_RegisterProc5,DLL_RegisterProc6,
DLL_RegisterProc7, DLL_RegisterProc8,DLL_RegisterProc9,
DLL_RegisterProc10,DLL_RegisterProc11,DLL_RegisterProc12,
DLL_EVENT_BeginGame, DLL_EVENT_ResetGame, DLL_EVENT_MapChanged,
DLL_MainLoop, DLL_SYSTEM_UpdatePlayer, DLL_SYSTEM_AddPlayer,
DLL_SYSTEM_RemoveAllPlayers, DLL_SYSTEM_RemovePlayer, DLL_AddModel,
DLL_DMGReceived, DLL_ChatReceived, DLL_CMD, DLL_QUERY_VERSION;
begin
Randomize;
ModelList := TStringList.Create;
end.