hedgewars/uFLTypes.pas
author unc0rr
Tue, 01 Dec 2015 23:37:10 +0300
branchqmlfrontend
changeset 11442 6e641b5453f9
parent 11439 23912c93935a
child 11445 330c14f4ba69
permissions -rw-r--r--
Accept ammo scheme from network
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
     1
unit uFLTypes;
10418
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10406
diff changeset
     2
interface
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
     3
11439
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
     4
const
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
     5
    MAXARGS = 32;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
     6
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10420
diff changeset
     7
type
11439
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
     8
    TMessageType = (mtRenderingPreview, mtPreview, mtAddPlayingTeam, mtRemovePlayingTeam, mtAddTeam, mtRemoveTeam
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
     9
                    , mtTeamColor, mtNetData, mtFlibEvent, mtConnected, mtDisconnected, mtAddLobbyClient
11429
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
    10
                    , mtRemoveLobbyClient, mtLobbyChatLine, mtAddRoomClient
86c13e5662f1 - Some refactoring
unc0rr
parents: 11428
diff changeset
    11
                    , mtRemoveRoomClient, mtRoomChatLine, mtAddRoom, mtUpdateRoom
11435
f88b3948adf3 UI knowns local player nickname
unc0rr
parents: 11429
diff changeset
    12
                    , mtRemoveRoom, mtError, mtWarning, mtMoveToLobby, mtMoveToRoom
11438
bca9afcc3a72 Handle some CFG parameters
unc0rr
parents: 11436
diff changeset
    13
                    , mtNickname, mtSeed, mtTheme, mtScript, mtFeatureSize, mtMapGen
11442
6e641b5453f9 Accept ammo scheme from network
unc0rr
parents: 11439
diff changeset
    14
                    , mtMap, mtMazeSize, mtTemplate, mtAmmo);
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10420
diff changeset
    15
11439
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    16
    TFLIBEvent = (flibGameFinished);
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    17
10428
7c25297720f1 More refactoring: move PoC preview getting code into flib
unc0rr
parents: 10420
diff changeset
    18
    TIPCMessage = record
10418
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10406
diff changeset
    19
                   str: shortstring;
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10406
diff changeset
    20
                   len: Longword;
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10406
diff changeset
    21
                   buf: Pointer
091d2c0216c3 Move away from passing shortstrings into C code, now IPC works
unc0rr
parents: 10406
diff changeset
    22
               end;
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    23
10420
unc0rr
parents: 10418
diff changeset
    24
    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
    25
    TUICallback = procedure (p: pointer; msgType: TMessageType; msg: PChar; len: Longword); cdecl;
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
    26
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    27
    TGameType = (gtPreview, gtLocal);
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    28
    THedgehog = record
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    29
            name: shortstring;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    30
            hat: shortstring;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    31
            end;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    32
    TTeam = record
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    33
            teamName: shortstring;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    34
            flag: shortstring;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    35
            graveName: shortstring;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    36
            fortName: shortstring;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    37
            owner: shortstring;
10450
bf9e30b4ef9b - Store index of color instead of its value
unc0rr
parents: 10444
diff changeset
    38
            color: Longword;
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    39
            extDriven: boolean;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    40
            botLevel: Longword;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    41
            hedgehogs: array[0..7] of THedgehog;
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    42
            hogsNumber: Longword;
10440
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10432
diff changeset
    43
        end;
b74a7bbe224e - Implement getTeamsList (not tested)
unc0rr
parents: 10432
diff changeset
    44
    PTeam = ^TTeam;
10432
b0abef0ee78c Quick Game PoC
unc0rr
parents: 10430
diff changeset
    45
10819
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    46
    TScheme = record
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    47
            schemeName
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    48
            , scriptparam : shortstring;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    49
            fortsmode
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    50
            , divteams
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    51
            , solidland
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    52
            , border
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    53
            , lowgrav
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    54
            , laser
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    55
            , invulnerability
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    56
            , mines
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    57
            , vampiric
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    58
            , karma
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    59
            , artillery
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    60
            , randomorder
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    61
            , king
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    62
            , placehog
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    63
            , sharedammo
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    64
            , disablegirders
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    65
            , disablewind
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    66
            , morewind
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    67
            , tagteam
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    68
            , bottomborder: boolean;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    69
            damagefactor
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    70
            , turntime
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    71
            , health
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    72
            , suddendeath
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    73
            , caseprobability
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    74
            , minestime
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    75
            , landadds
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    76
            , minedudpct
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    77
            , explosives
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    78
            , minesnum
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    79
            , healthprobability
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    80
            , healthcaseamount
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    81
            , waterrise
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    82
            , healthdecrease
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    83
            , ropepct
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    84
            , getawaytime
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    85
            , worldedge: LongInt
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    86
        end;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    87
    PScheme = ^TScheme;
10888
a04e04aaf599 Ammo schemes list, almost works
unc0rr
parents: 10819
diff changeset
    88
    TAmmo = record
a04e04aaf599 Ammo schemes list, almost works
unc0rr
parents: 10819
diff changeset
    89
            ammoName: shortstring;
10892
83a99e2f8b00 Make ammo scheme work
unc0rr
parents: 10888
diff changeset
    90
            a, b, c, d: shortstring;
10888
a04e04aaf599 Ammo schemes list, almost works
unc0rr
parents: 10819
diff changeset
    91
        end;
a04e04aaf599 Ammo schemes list, almost works
unc0rr
parents: 10819
diff changeset
    92
    PAmmo = ^TAmmo;
10819
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10452
diff changeset
    93
11439
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    94
    PGameConfig = ^TGameConfig;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    95
    TGameConfig = record
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    96
            seed: shortstring;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    97
            theme: shortstring;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    98
            script: shortstring;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
    99
            map: shortstring;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   100
            scheme: TScheme;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   101
            ammo: TAmmo;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   102
            mapgen: LongInt;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   103
            featureSize: LongInt;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   104
            mazesize: LongInt;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   105
            template: LongInt;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   106
            gameType: TGameType;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   107
            teams: array[0..7] of TTeam;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   108
            arguments: array[0..Pred(MAXARGS)] of shortstring;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   109
            argv: array[0..Pred(MAXARGS)] of PChar;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   110
            argumentsNumber: Longword;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   111
            nextConfig: PGameConfig;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   112
            end;
23912c93935a - Implement engine runs queue
unc0rr
parents: 11438
diff changeset
   113
10406
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
   114
implementation
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
   115
b5fd52ac760f Basic layout of frontlib, some more sdl bindings
unc0rr
parents:
diff changeset
   116
end.