author | unc0rr |
Tue, 17 May 2016 23:18:08 +0300 | |
branch | qmlfrontend |
changeset 11827 | 8c71c5a1172f |
parent 11462 | 33a0e3a14ddc |
child 11842 | 93e6c401cc3d |
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 |
11450
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
3 |
uses SDLh; |
10406 | 4 |
|
11434 | 5 |
const |
6 |
MAXARGS = 32; |
|
7 |
||
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10420
diff
changeset
|
8 |
type |
11827
8c71c5a1172f
- Add state to engine callback for it to know what engine is sending
unc0rr
parents:
11462
diff
changeset
|
9 |
TMessageType = (mtRenderingPreview, mtPreview, mtPreviewHogCount |
8c71c5a1172f
- Add state to engine callback for it to know what engine is sending
unc0rr
parents:
11462
diff
changeset
|
10 |
, mtAddPlayingTeam, mtRemovePlayingTeam |
8c71c5a1172f
- Add state to engine callback for it to know what engine is sending
unc0rr
parents:
11462
diff
changeset
|
11 |
, mtAddTeam, mtRemoveTeam, mtTeamColor, mtHedgehogsNumber |
8c71c5a1172f
- Add state to engine callback for it to know what engine is sending
unc0rr
parents:
11462
diff
changeset
|
12 |
, mtNetData |
11443 | 13 |
, mtFlibEvent, mtConnected, mtDisconnected, mtAddLobbyClient |
11424 | 14 |
, mtRemoveLobbyClient, mtLobbyChatLine, mtAddRoomClient |
15 |
, mtRemoveRoomClient, mtRoomChatLine, mtAddRoom, mtUpdateRoom |
|
11430 | 16 |
, mtRemoveRoom, mtError, mtWarning, mtMoveToLobby, mtMoveToRoom |
11433 | 17 |
, mtNickname, mtSeed, mtTheme, mtScript, mtFeatureSize, mtMapGen |
11440 | 18 |
, mtMap, mtMazeSize, mtTemplate, mtAmmo, mtScheme); |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10420
diff
changeset
|
19 |
|
11460 | 20 |
TFLIBEvent = (flibGameFinished); |
11434 | 21 |
|
11449 | 22 |
TClientFlag = (cfReady, cfRegistered, cfInRoom, cfContributor, cfInGame, cfRoomAdmin, cfServerAdmin); |
23 |
||
11450
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
24 |
PIPCMessage = ^TIPCMessage; |
10428
7c25297720f1
More refactoring: move PoC preview getting code into flib
unc0rr
parents:
10420
diff
changeset
|
25 |
TIPCMessage = record |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
26 |
str: shortstring; |
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
27 |
len: Longword; |
11450
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
28 |
buf: Pointer; |
11452
78860824b5a5
Introduce barriers between messages to different engine instances
unc0rr
parents:
11451
diff
changeset
|
29 |
barrier: Longword; |
11450
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
30 |
next: PIPCMessage; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
31 |
end; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
32 |
PIPCQueue = ^TIPCQueue; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
33 |
TIPCQueue = record |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
34 |
msg: TIPCMessage; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
35 |
mut: PSDL_Mutex; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
36 |
cond: PSDL_Cond; |
0c75fa9ce340
- Use queues instead of single buffer to communicate between threads
unc0rr
parents:
11449
diff
changeset
|
37 |
last: PIPCMessage; |
10418
091d2c0216c3
Move away from passing shortstrings into C code, now IPC works
unc0rr
parents:
10406
diff
changeset
|
38 |
end; |
10432 | 39 |
|
10420 | 40 |
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
|
41 |
TUICallback = procedure (p: pointer; msgType: TMessageType; msg: PChar; len: Longword); cdecl; |
10406 | 42 |
|
11451 | 43 |
TGameType = (gtPreview, gtLocal, gtNet); |
10432 | 44 |
THedgehog = record |
45 |
name: shortstring; |
|
46 |
hat: shortstring; |
|
47 |
end; |
|
48 |
TTeam = record |
|
11442 | 49 |
teamName |
50 |
, flag |
|
51 |
, grave |
|
52 |
, fort |
|
53 |
, voice |
|
54 |
, owner: shortstring; |
|
10450 | 55 |
color: Longword; |
10432 | 56 |
extDriven: boolean; |
57 |
botLevel: Longword; |
|
58 |
hedgehogs: array[0..7] of THedgehog; |
|
59 |
hogsNumber: Longword; |
|
10440 | 60 |
end; |
61 |
PTeam = ^TTeam; |
|
10432 | 62 |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
63 |
TScheme = record |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
64 |
schemeName |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
65 |
, scriptparam : shortstring; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
66 |
fortsmode |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
67 |
, divteams |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
68 |
, solidland |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
69 |
, border |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
70 |
, lowgrav |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
71 |
, laser |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
72 |
, invulnerability |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
73 |
, mines |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
74 |
, vampiric |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
75 |
, karma |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
76 |
, artillery |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
77 |
, randomorder |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
78 |
, king |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
79 |
, placehog |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
80 |
, sharedammo |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
81 |
, disablegirders |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
82 |
, disablewind |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
83 |
, morewind |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
84 |
, tagteam |
11440 | 85 |
, resethealth |
86 |
, disablelandobjects |
|
87 |
, aisurvival |
|
88 |
, infattack |
|
89 |
, resetweps |
|
90 |
, perhogammo |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
91 |
, bottomborder: boolean; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
92 |
damagefactor |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
93 |
, turntime |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
94 |
, health |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
95 |
, suddendeath |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
96 |
, caseprobability |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
97 |
, minestime |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
98 |
, landadds |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
99 |
, minedudpct |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
100 |
, explosives |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
101 |
, minesnum |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
102 |
, healthprobability |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
103 |
, healthcaseamount |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
104 |
, waterrise |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
105 |
, healthdecrease |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
106 |
, ropepct |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
107 |
, getawaytime |
11440 | 108 |
, airmines |
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
109 |
, worldedge: LongInt |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
110 |
end; |
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
111 |
PScheme = ^TScheme; |
10888 | 112 |
TAmmo = record |
113 |
ammoName: shortstring; |
|
10892 | 114 |
a, b, c, d: shortstring; |
10888 | 115 |
end; |
116 |
PAmmo = ^TAmmo; |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10452
diff
changeset
|
117 |
|
11434 | 118 |
PGameConfig = ^TGameConfig; |
119 |
TGameConfig = record |
|
120 |
seed: shortstring; |
|
121 |
theme: shortstring; |
|
122 |
script: shortstring; |
|
123 |
map: shortstring; |
|
11462 | 124 |
drawnData: array[word] of char; |
125 |
drawnDataSize: LongWord; |
|
11434 | 126 |
scheme: TScheme; |
127 |
ammo: TAmmo; |
|
128 |
mapgen: LongInt; |
|
129 |
featureSize: LongInt; |
|
130 |
mazesize: LongInt; |
|
131 |
template: LongInt; |
|
132 |
gameType: TGameType; |
|
133 |
teams: array[0..7] of TTeam; |
|
134 |
arguments: array[0..Pred(MAXARGS)] of shortstring; |
|
135 |
argv: array[0..Pred(MAXARGS)] of PChar; |
|
136 |
argumentsNumber: Longword; |
|
137 |
nextConfig: PGameConfig; |
|
138 |
end; |
|
139 |
||
10406 | 140 |
implementation |
141 |
||
142 |
end. |