author | unc0rr |
Thu, 16 Apr 2015 23:31:13 +0300 | |
branch | qmlfrontend |
changeset 10896 | 5a74923120d5 |
parent 10892 | 83a99e2f8b00 |
child 10951 | 89a7f617e091 |
permissions | -rw-r--r-- |
10406 | 1 |
unit uFLGameConfig; |
2 |
interface |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
3 |
uses uFLTypes; |
10406 | 4 |
|
10430 | 5 |
procedure resetGameConfig; cdecl; |
6 |
procedure runQuickGame; cdecl; |
|
10448 | 7 |
procedure runLocalGame; cdecl; |
10430 | 8 |
procedure getPreview; cdecl; |
10406 | 9 |
|
10430 | 10 |
procedure registerGUIMessagesCallback(p: pointer; f: TGUICallback); cdecl; |
11 |
||
12 |
procedure setSeed(seed: PChar); cdecl; |
|
13 |
function getSeed: PChar; cdecl; |
|
10456 | 14 |
procedure setTheme(themeName: PChar); cdecl; |
10612 | 15 |
procedure setScript(scriptName: PChar); cdecl; |
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
16 |
procedure setScheme(schemeName: PChar); cdecl; |
10888 | 17 |
procedure setAmmo(ammoName: PChar); cdecl; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
18 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
19 |
procedure tryAddTeam(teamName: PChar); cdecl; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
20 |
procedure tryRemoveTeam(teamName: PChar); cdecl; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
21 |
procedure changeTeamColor(teamName: PChar; dir: LongInt); cdecl; |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
22 |
|
10406 | 23 |
implementation |
10888 | 24 |
uses uFLIPC, hwengine, uFLUtils, uFLTeams, uFLData, uFLSChemes, uFLAmmo; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
25 |
|
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
26 |
var guiCallbackPointer: pointer; |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
27 |
guiCallbackFunction: TGUICallback; |
10406 | 28 |
|
10426 | 29 |
const |
30 |
MAXCONFIGS = 5; |
|
31 |
MAXARGS = 32; |
|
32 |
||
33 |
type |
|
34 |
TGameConfig = record |
|
35 |
seed: shortstring; |
|
36 |
theme: shortstring; |
|
37 |
script: shortstring; |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
38 |
scheme: TScheme; |
10892 | 39 |
ammo: TAmmo; |
10432 | 40 |
mapgen: Longint; |
10426 | 41 |
gameType: TGameType; |
42 |
teams: array[0..7] of TTeam; |
|
43 |
arguments: array[0..Pred(MAXARGS)] of shortstring; |
|
44 |
argv: array[0..Pred(MAXARGS)] of PChar; |
|
45 |
argumentsNumber: Longword; |
|
46 |
end; |
|
47 |
PGameConfig = ^TGameConfig; |
|
48 |
||
10432 | 49 |
var |
50 |
currentConfig: TGameConfig; |
|
51 |
||
10430 | 52 |
|
10432 | 53 |
procedure sendConfig(config: PGameConfig); |
54 |
var i: Longword; |
|
55 |
begin |
|
56 |
with config^ do |
|
10430 | 57 |
begin |
10432 | 58 |
case gameType of |
59 |
gtPreview: begin |
|
10612 | 60 |
if script <> '' then |
61 |
ipcToEngine('escript ' + script); |
|
10432 | 62 |
ipcToEngine('eseed ' + seed); |
63 |
ipcToEngine('e$mapgen ' + intToStr(mapgen)); |
|
64 |
end; |
|
65 |
gtLocal: begin |
|
10612 | 66 |
if script <> '' then |
67 |
ipcToEngine('escript ' + script); |
|
10432 | 68 |
ipcToEngine('eseed ' + seed); |
69 |
ipcToEngine('e$mapgen ' + intToStr(mapgen)); |
|
10456 | 70 |
ipcToEngine('e$theme ' + theme); |
10612 | 71 |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
72 |
sendSchemeConfig(scheme); |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
73 |
|
10432 | 74 |
i:= 0; |
75 |
while (i < 8) and (teams[i].hogsNumber > 0) do |
|
76 |
begin |
|
10892 | 77 |
sendAmmoConfig(config^.ammo); |
10432 | 78 |
ipcToEngine('eammstore'); |
79 |
sendTeamConfig(teams[i]); |
|
80 |
inc(i) |
|
81 |
end; |
|
82 |
end; |
|
83 |
end; |
|
84 |
||
85 |
ipcToEngine('!'); |
|
86 |
end; |
|
87 |
end; |
|
10426 | 88 |
|
89 |
procedure queueExecution; |
|
90 |
var pConfig: PGameConfig; |
|
91 |
i: Longword; |
|
92 |
begin |
|
93 |
new(pConfig); |
|
94 |
pConfig^:= currentConfig; |
|
95 |
||
96 |
with pConfig^ do |
|
97 |
for i:= 0 to Pred(MAXARGS) do |
|
98 |
begin |
|
99 |
if arguments[i][0] = #255 then |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
100 |
arguments[i][255]:= #0 |
10426 | 101 |
else |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
102 |
arguments[i][byte(arguments[i][0]) + 1]:= #0; |
10426 | 103 |
argv[i]:= @arguments[i][1] |
104 |
end; |
|
105 |
||
106 |
RunEngine(pConfig^.argumentsNumber, @pConfig^.argv); |
|
10432 | 107 |
|
108 |
sendConfig(pConfig) |
|
10426 | 109 |
end; |
110 |
||
111 |
procedure resetGameConfig; cdecl; |
|
10450 | 112 |
var i: Longword; |
10406 | 113 |
begin |
10450 | 114 |
with currentConfig do |
115 |
begin |
|
116 |
for i:= 0 to 7 do |
|
117 |
teams[i].hogsNumber:= 0 |
|
118 |
end |
|
10406 | 119 |
end; |
120 |
||
10430 | 121 |
procedure setSeed(seed: PChar); cdecl; |
122 |
begin |
|
123 |
currentConfig.seed:= seed |
|
124 |
end; |
|
125 |
||
10448 | 126 |
|
10430 | 127 |
function getSeed: PChar; cdecl; |
128 |
begin |
|
129 |
getSeed:= str2PChar(currentConfig.seed) |
|
130 |
end; |
|
131 |
||
10450 | 132 |
function getUnusedColor: Longword; |
10448 | 133 |
var i, c: Longword; |
134 |
fColorMatched: boolean; |
|
135 |
begin |
|
136 |
c:= 0; |
|
137 |
i:= 0; |
|
138 |
repeat |
|
139 |
repeat |
|
10450 | 140 |
fColorMatched:= (currentConfig.teams[i].hogsNumber > 0) and (currentConfig.teams[i].color = c); |
10448 | 141 |
inc(i) |
142 |
until (i >= 8) or (currentConfig.teams[i].hogsNumber = 0) or fColorMatched; |
|
143 |
||
144 |
if fColorMatched then |
|
145 |
begin |
|
146 |
i:= 0; |
|
147 |
inc(c) |
|
148 |
end; |
|
149 |
until not fColorMatched; |
|
150 |
||
10450 | 151 |
getUnusedColor:= c |
10448 | 152 |
end; |
153 |
||
10430 | 154 |
procedure runQuickGame; cdecl; |
10426 | 155 |
begin |
10432 | 156 |
with currentConfig do |
157 |
begin |
|
158 |
gameType:= gtLocal; |
|
159 |
arguments[0]:= ''; |
|
160 |
arguments[1]:= '--internal'; |
|
10448 | 161 |
arguments[2]:= '--nomusic'; |
10432 | 162 |
argumentsNumber:= 3; |
10426 | 163 |
|
10432 | 164 |
teams[0]:= createRandomTeam; |
10450 | 165 |
teams[0].color:= 0; |
10432 | 166 |
teams[1]:= createRandomTeam; |
10450 | 167 |
teams[1].color:= 1; |
10432 | 168 |
teams[1].botLevel:= 1; |
169 |
||
170 |
queueExecution; |
|
171 |
end; |
|
10426 | 172 |
end; |
173 |
||
10448 | 174 |
|
10430 | 175 |
procedure getPreview; cdecl; |
10426 | 176 |
begin |
177 |
with currentConfig do |
|
178 |
begin |
|
179 |
gameType:= gtPreview; |
|
180 |
arguments[0]:= ''; |
|
181 |
arguments[1]:= '--internal'; |
|
182 |
arguments[2]:= '--landpreview'; |
|
183 |
argumentsNumber:= 3; |
|
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
184 |
|
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
185 |
queueExecution; |
10426 | 186 |
end; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
187 |
end; |
10426 | 188 |
|
10448 | 189 |
procedure runLocalGame; cdecl; |
190 |
begin |
|
191 |
with currentConfig do |
|
192 |
begin |
|
193 |
gameType:= gtLocal; |
|
194 |
arguments[0]:= ''; |
|
195 |
arguments[1]:= '--internal'; |
|
196 |
arguments[2]:= '--nomusic'; |
|
197 |
argumentsNumber:= 3; |
|
198 |
||
199 |
queueExecution; |
|
200 |
end; |
|
201 |
end; |
|
202 |
||
203 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
204 |
procedure engineMessageCallback(p: pointer; msg: PChar; len: Longword); |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
205 |
begin |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
206 |
if len = 128 * 256 then guiCallbackFunction(guiCallbackPointer, mtPreview, msg, len) |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
207 |
end; |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
208 |
|
10430 | 209 |
procedure registerGUIMessagesCallback(p: pointer; f: TGUICallback); cdecl; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
210 |
begin |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
211 |
guiCallbackPointer:= p; |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
212 |
guiCallbackFunction:= f; |
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
213 |
|
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10426
diff
changeset
|
214 |
registerIPCCallback(nil, @engineMessageCallback) |
10426 | 215 |
end; |
216 |
||
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
217 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
218 |
procedure tryAddTeam(teamName: PChar); cdecl; |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
219 |
var msg: ansistring; |
10446 | 220 |
i, hn, hedgehogsNumber: Longword; |
221 |
team: PTeam; |
|
10450 | 222 |
c: Longword; |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
223 |
begin |
10446 | 224 |
with currentConfig do |
225 |
begin |
|
226 |
hedgehogsNumber:= 0; |
|
227 |
i:= 0; |
|
228 |
||
229 |
while (i < 8) and (teams[i].hogsNumber > 0) do |
|
230 |
begin |
|
231 |
inc(i); |
|
232 |
inc(hedgehogsNumber, teams[i].hogsNumber) |
|
233 |
end; |
|
234 |
||
235 |
// no free space for a team or reached hogs number maximum |
|
236 |
if (i > 7) or (hedgehogsNumber >= 48) then exit; |
|
237 |
||
238 |
team:= teamByName(teamName); |
|
239 |
if team = nil then exit; |
|
240 |
||
10448 | 241 |
c:= getUnusedColor; |
242 |
||
10446 | 243 |
teams[i]:= team^; |
244 |
||
245 |
if i = 0 then hn:= 4 else hn:= teams[i - 1].hogsNumber; |
|
246 |
if hn > 48 - hedgehogsNumber then hn:= 48 - hedgehogsNumber; |
|
247 |
teams[i].hogsNumber:= hn; |
|
10448 | 248 |
|
249 |
teams[i].color:= c; |
|
10446 | 250 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
251 |
msg:= '0' + #10 + teamName; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
252 |
guiCallbackFunction(guiCallbackPointer, mtAddPlayingTeam, @msg[1], length(msg)); |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
253 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
254 |
msg:= teamName + #10 + colorsSet[teams[i].color]; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
255 |
guiCallbackFunction(guiCallbackPointer, mtTeamColor, @msg[1], length(msg)); |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
256 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
257 |
msg:= teamName; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
258 |
guiCallbackFunction(guiCallbackPointer, mtRemoveTeam, @msg[1], length(msg)) |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
259 |
end |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
260 |
end; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
261 |
|
10448 | 262 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
263 |
procedure tryRemoveTeam(teamName: PChar); cdecl; |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
264 |
var msg: ansistring; |
10448 | 265 |
i: Longword; |
266 |
tn: shortstring; |
|
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
267 |
begin |
10448 | 268 |
with currentConfig do |
269 |
begin |
|
270 |
i:= 0; |
|
271 |
tn:= teamName; |
|
272 |
while (i < 8) and (teams[i].teamName <> tn) do |
|
273 |
inc(i); |
|
274 |
||
275 |
// team not found??? |
|
276 |
if (i > 7) then exit; |
|
277 |
||
278 |
while (i < 7) and (teams[i + 1].hogsNumber > 0) do |
|
279 |
begin |
|
280 |
teams[i]:= teams[i + 1]; |
|
281 |
inc(i) |
|
282 |
end; |
|
283 |
||
284 |
teams[i].hogsNumber:= 0 |
|
285 |
end; |
|
286 |
||
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
287 |
msg:= teamName; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
288 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
289 |
guiCallbackFunction(guiCallbackPointer, mtRemovePlayingTeam, @msg[1], length(msg)); |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
290 |
guiCallbackFunction(guiCallbackPointer, mtAddTeam, @msg[1], length(msg)) |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
291 |
end; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10432
diff
changeset
|
292 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
293 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
294 |
procedure changeTeamColor(teamName: PChar; dir: LongInt); cdecl; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
295 |
var i, dc: Longword; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
296 |
tn: shortstring; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
297 |
msg: ansistring; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
298 |
begin |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
299 |
with currentConfig do |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
300 |
begin |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
301 |
i:= 0; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
302 |
tn:= teamName; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
303 |
while (i < 8) and (teams[i].teamName <> tn) do |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
304 |
inc(i); |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
305 |
// team not found??? |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
306 |
if (i > 7) then exit; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
307 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
308 |
if dir >= 0 then dc:= 1 else dc:= 8; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
309 |
teams[i].color:= (teams[i].color + dc) mod 9; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
310 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
311 |
msg:= tn + #10 + colorsSet[teams[i].color]; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
312 |
guiCallbackFunction(guiCallbackPointer, mtTeamColor, @msg[1], length(msg)) |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
313 |
end |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
314 |
end; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
315 |
|
10456 | 316 |
procedure setTheme(themeName: PChar); cdecl; |
317 |
begin |
|
318 |
currentConfig.theme:= themeName |
|
319 |
end; |
|
320 |
||
10612 | 321 |
procedure setScript(scriptName: PChar); cdecl; |
322 |
begin |
|
323 |
if scriptName <> 'Normal' then |
|
324 |
currentConfig.script:= '/Scripts/Multiplayer/' + scriptName + '.lua' |
|
325 |
else |
|
326 |
currentConfig.script:= '' |
|
327 |
end; |
|
328 |
||
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
329 |
procedure setScheme(schemeName: PChar); cdecl; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
330 |
var scheme: PScheme; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
331 |
begin |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
332 |
scheme:= schemeByName(schemeName); |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
333 |
|
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
334 |
if scheme <> nil then |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
335 |
currentConfig.scheme:= scheme^ |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
336 |
end; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10612
diff
changeset
|
337 |
|
10888 | 338 |
procedure setAmmo(ammoName: PChar); cdecl; |
339 |
var ammo: PAmmo; |
|
340 |
begin |
|
341 |
ammo:= ammoByName(ammoName); |
|
342 |
||
343 |
if ammo <> nil then |
|
10892 | 344 |
currentConfig.ammo:= ammo^ |
10888 | 345 |
end; |
346 |
||
10406 | 347 |
end. |