author | unc0rr |
Tue, 26 Dec 2017 01:36:58 +0100 | |
branch | qmlfrontend |
changeset 12866 | 488782d9aba9 |
parent 12865 | e33bcb9d5e9c |
permissions | -rw-r--r-- |
10406 | 1 |
unit uFLTypes; |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
2 |
interface |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
3 |
uses SDLh; |
10406 | 4 |
|
11439 | 5 |
const |
6 |
MAXARGS = 32; |
|
7 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10420
diff
changeset
|
8 |
type |
12866 | 9 |
TMessageType = (mtPreview, mtPreviewHogCount |
12865 | 10 |
, mtToNet, mtGameFinished); |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10420
diff
changeset
|
11 |
|
11465 | 12 |
TFLIBEvent = (flibGameFinished); |
11439 | 13 |
|
11454 | 14 |
TClientFlag = (cfReady, cfRegistered, cfInRoom, cfContributor, cfInGame, cfRoomAdmin, cfServerAdmin); |
15 |
||
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
16 |
PIPCMessage = ^TIPCMessage; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10420
diff
changeset
|
17 |
TIPCMessage = record |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
18 |
str: shortstring; |
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
19 |
len: Longword; |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
20 |
buf: Pointer; |
11457
78860824b5a5
Introduce barriers between messages to different engine instances
unc0rr
parents:
11456
diff
changeset
|
21 |
barrier: Longword; |
11455
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
22 |
next: PIPCMessage; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
23 |
end; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
24 |
PIPCQueue = ^TIPCQueue; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
25 |
TIPCQueue = record |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
26 |
msg: TIPCMessage; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
27 |
mut: PSDL_Mutex; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
28 |
cond: PSDL_Cond; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11454
diff
changeset
|
29 |
last: PIPCMessage; |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
30 |
end; |
10432 | 31 |
|
10420 | 32 |
TIPCCallback = procedure (p: pointer; msg: PChar; len: Longword); |
10951
89a7f617e091
- Move protocol handling events to main thread through qt's main loop
unc0rr
parents:
10892
diff
changeset
|
33 |
TUICallback = procedure (p: pointer; msgType: TMessageType; msg: PChar; len: Longword); cdecl; |
10406 | 34 |
|
11456 | 35 |
TGameType = (gtPreview, gtLocal, gtNet); |
10432 | 36 |
THedgehog = record |
37 |
name: shortstring; |
|
38 |
hat: shortstring; |
|
39 |
end; |
|
40 |
TTeam = record |
|
11447 | 41 |
teamName |
42 |
, flag |
|
43 |
, grave |
|
44 |
, fort |
|
45 |
, voice |
|
46 |
, owner: shortstring; |
|
10450 | 47 |
color: Longword; |
10432 | 48 |
extDriven: boolean; |
49 |
botLevel: Longword; |
|
50 |
hedgehogs: array[0..7] of THedgehog; |
|
51 |
hogsNumber: Longword; |
|
10440 | 52 |
end; |
53 |
PTeam = ^TTeam; |
|
10432 | 54 |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
55 |
TScheme = record |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
56 |
schemeName |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
57 |
, scriptparam : shortstring; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
58 |
fortsmode |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
59 |
, divteams |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
60 |
, solidland |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
61 |
, border |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
62 |
, lowgrav |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
63 |
, laser |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
64 |
, invulnerability |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
65 |
, mines |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
66 |
, vampiric |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
67 |
, karma |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
68 |
, artillery |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
69 |
, randomorder |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
70 |
, king |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
71 |
, placehog |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
72 |
, sharedammo |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
73 |
, disablegirders |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
74 |
, disablewind |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
75 |
, morewind |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
76 |
, tagteam |
11445 | 77 |
, resethealth |
78 |
, disablelandobjects |
|
79 |
, aisurvival |
|
80 |
, infattack |
|
81 |
, resetweps |
|
82 |
, perhogammo |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
83 |
, bottomborder: boolean; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
84 |
damagefactor |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
85 |
, turntime |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
86 |
, health |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
87 |
, suddendeath |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
88 |
, caseprobability |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
89 |
, minestime |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
90 |
, landadds |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
91 |
, minedudpct |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
92 |
, explosives |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
93 |
, minesnum |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
94 |
, healthprobability |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
95 |
, healthcaseamount |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
96 |
, waterrise |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
97 |
, healthdecrease |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
98 |
, ropepct |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
99 |
, getawaytime |
11445 | 100 |
, airmines |
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
101 |
, worldedge: LongInt |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
102 |
end; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
103 |
PScheme = ^TScheme; |
10888 | 104 |
TAmmo = record |
105 |
ammoName: shortstring; |
|
10892 | 106 |
a, b, c, d: shortstring; |
10888 | 107 |
end; |
108 |
PAmmo = ^TAmmo; |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
109 |
|
11439 | 110 |
PGameConfig = ^TGameConfig; |
111 |
TGameConfig = record |
|
112 |
seed: shortstring; |
|
113 |
theme: shortstring; |
|
114 |
script: shortstring; |
|
115 |
map: shortstring; |
|
11467 | 116 |
drawnData: array[word] of char; |
117 |
drawnDataSize: LongWord; |
|
11439 | 118 |
scheme: TScheme; |
119 |
ammo: TAmmo; |
|
120 |
mapgen: LongInt; |
|
121 |
featureSize: LongInt; |
|
122 |
mazesize: LongInt; |
|
123 |
template: LongInt; |
|
124 |
gameType: TGameType; |
|
125 |
teams: array[0..7] of TTeam; |
|
126 |
arguments: array[0..Pred(MAXARGS)] of shortstring; |
|
127 |
argv: array[0..Pred(MAXARGS)] of PChar; |
|
128 |
argumentsNumber: Longword; |
|
129 |
nextConfig: PGameConfig; |
|
130 |
end; |
|
131 |
||
10406 | 132 |
implementation |
133 |
||
134 |
end. |