| 1 | /* |
| 2 | * OpenTyrian: A modern cross-platform port of Tyrian |
| 3 | * Copyright (C) 2007-2009 The OpenTyrian Development Team |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License |
| 7 | * as published by the Free Software Foundation; either version 2 |
| 8 | * of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | #ifndef NETWORK_H |
| 20 | #define NETWORK_Hcxx . . $ `src/network.h:20:9`! |
| 21 | |
| 22 | #include "opentyr.h"cxx . . $ `<file>/src/opentyr.h`/ |
| 23 | |
| 24 | #include "SDL.h" |
| 25 | #ifdef WITH_NETWORKcxx . . $ `<built-in>:413:9`! |
| 26 | # include "SDL_net.h" |
| 27 | #endif |
| 28 | |
| 29 | #define PACKET_ACKNOWLEDGEcxx . . $ `src/network.h:29:9`! 0x00 // |
| 30 | #define PACKET_KEEP_ALIVEcxx . . $ `src/network.h:30:9`! 0x01 // |
| 31 | |
| 32 | #define PACKET_CONNECTcxx . . $ `src/network.h:32:9`! 0x10 // version, delay, episodes, player_number, name |
| 33 | #define PACKET_DETAILScxx . . $ `src/network.h:33:9`! 0x11 // episode, difficulty |
| 34 | |
| 35 | #define PACKET_QUITcxx . . $ `src/network.h:35:9`! 0x20 // |
| 36 | #define PACKET_WAITINGcxx . . $ `src/network.h:36:9`! 0x21 // |
| 37 | #define PACKET_BUSYcxx . . $ `src/network.h:37:9`! 0x22 // |
| 38 | |
| 39 | #define PACKET_GAME_QUITcxx . . $ `src/network.h:39:9`! 0x30 // |
| 40 | #define PACKET_GAME_PAUSEcxx . . $ `src/network.h:40:9`! 0x31 // |
| 41 | #define PACKET_GAME_MENUcxx . . $ `src/network.h:41:9`! 0x32 // |
| 42 | |
| 43 | #define PACKET_STATE_RESENDcxx . . $ `src/network.h:43:9`! 0x40 // state_id |
| 44 | #define PACKET_STATEcxx . . $ `src/network.h:44:9`! 0x41 // <state> (not acknowledged) |
| 45 | #define PACKET_STATE_XORcxx . . $ `src/network.h:45:9`! 0x42 // <xor state> (not acknowledged) |
| 46 | |
| 47 | extern boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! isNetworkGamecxx . . $ isNetworkGame.; |
| 48 | extern int network_delaycxx . . $ network_delay.; |
| 49 | |
| 50 | extern char *network_opponent_hostcxx . . $ network_opponent_host.; |
| 51 | extern Uint16cxx . . $ Uint16# network_player_portcxx . . $ network_player_port., network_opponent_portcxx . . $ network_opponent_port.; |
| 52 | extern char *network_player_namecxx . . $ network_player_name., *network_opponent_namecxx . . $ network_opponent_name.; |
| 53 | |
| 54 | #ifdef WITH_NETWORKcxx . . $ `<built-in>:413:9`! |
| 55 | extern UDPpacketcxx . . $ UDPpacket# *packet_out_tempcxx . . $ packet_out_temp.; |
| 56 | extern UDPpacketcxx . . $ UDPpacket# *packet_incxx . . $ packet_in.[], *packet_outcxx . . $ packet_out.[], |
| 57 | *packet_state_incxx . . $ packet_state_in.[], *packet_state_outcxx . . $ packet_state_out.[]; |
| 58 | #endif |
| 59 | |
| 60 | extern uintcxx . . $ uint# thisPlayerNumcxx . . $ thisPlayerNum.; |
| 61 | extern JE_booleancxx . . $ JE_boolean# haltGamecxx . . $ haltGame.; |
| 62 | extern JE_booleancxx . . $ JE_boolean# moveOkcxx . . $ moveOk.; |
| 63 | extern JE_booleancxx . . $ JE_boolean# pauseRequestcxx . . $ pauseRequest., skipLevelRequestcxx . . $ skipLevelRequest., helpRequestcxx . . $ helpRequest., nortShipRequestcxx . . $ nortShipRequest.; |
| 64 | extern JE_booleancxx . . $ JE_boolean# yourInGameMenuRequestcxx . . $ yourInGameMenuRequest., inGameMenuRequestcxx . . $ inGameMenuRequest.; |
| 65 | |
| 66 | #ifdef WITH_NETWORKcxx . . $ `<built-in>:413:9`! |
| 67 | void network_preparecxx . . $ network_prepare(ed53e3bbd3fa2f69).(Uint16cxx . . $ Uint16# type); |
| 68 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! network_sendcxx . . $ network_send(83c267b20bac841a).(int len); |
| 69 | |
| 70 | int network_checkcxx . . $ network_check(b126dc7c1de90089).(void); |
| 71 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! network_updatecxx . . $ network_update(c9857a73d68e59ba).(void); |
| 72 | |
| 73 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! network_is_synccxx . . $ network_is_sync(c9857a73d68e59ba).(void); |
| 74 | |
| 75 | void network_state_preparecxx . . $ network_state_prepare(49f6e7a06ebc5aa8).(void); |
| 76 | int network_state_sendcxx . . $ network_state_send(b126dc7c1de90089).(void); |
| 77 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! network_state_updatecxx . . $ network_state_update(c9857a73d68e59ba).(void); |
| 78 | boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! network_state_is_resetcxx . . $ network_state_is_reset(c9857a73d68e59ba).(void); |
| 79 | void network_state_resetcxx . . $ network_state_reset(49f6e7a06ebc5aa8).(void); |
| 80 | |
| 81 | int network_connectcxx . . $ network_connect(b126dc7c1de90089).(void); |
| 82 | void network_tyrian_haltcxx . . $ network_tyrian_halt(ee2069353d7cc01f).(unsigned int err, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! attempt_sync); |
| 83 | |
| 84 | int network_initcxx . . $ network_init(b126dc7c1de90089).(void); |
| 85 | |
| 86 | void JE_clearSpecialRequestscxx . . $ JE_clearSpecialRequests(49f6e7a06ebc5aa8).(void); |
| 87 | |
| 88 | #define NETWORK_KEEP_ALIVEcxx . . $ `src/network.h:88:9`!() \ |
| 89 | if (isNetworkGame) \ |
| 90 | network_check(); |
| 91 | #else |
| 92 | #define NETWORK_KEEP_ALIVE() |
| 93 | #endif |
| 94 | |
| 95 | #endif /* NETWORK_H */ |