1 /* 2 Copyright (C) 1994-1995 Apogee Software, Ltd. 3 4 This program is free software; you can redistribute it and/or 5 modify it under the terms of the GNU General Public License 6 as published by the Free Software Foundation; either version 2 7 of the License, or (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13 See the 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 20 #ifndef _rt_net_private 21 #define _rt_net_private 22 23 #define DEMOBUFFSIZE 50000 24 25 #define FASTSPEED (0xB000) 26 27 #define SETUPTIME 15 28 29 #define PlayerCommand(player,command) \ 30 (PlayerCmds[(player)]->Commands[(command)]) 31 32 #define ClientCommand(player,command) \ 33 (ClientCmds[(player)]->Commands[(command)]) 34 35 #define LocalCommand(command) \ 36 (LocalCmds->Commands[(command)]) 37 38 #define ServerCommand(command) \ 39 (ServerCmds->Commands[(command)]) 40 41 #define CommandAddress(time) \ 42 (((time)-controlupdatestartedtime) & (MAXCMDS-1)) 43 44 #define NextLocalCommand() \ 45 (LocalCommand(CommandAddress(controlupdatetime))) 46 47 #define NextServerCommand() \ 48 (ServerCommand(CommandAddress(serverupdatetime))) 49 50 #define ClientTimeCommand(which,whichtime) \ 51 (ClientCmds[(which)]->Commands[(CommandAddress((whichtime)))]) 52 53 #define ServerCommandStatus(whichtime) \ 54 (CommandState[0]->CommandStates[(CommandAddress((whichtime)))]) 55 56 #define ServerCommandNumberStatus(command) \ 57 (CommandState[0]->CommandStates[(command)]) 58 59 #define ClientCommandStatus(which, whichtime) \ 60 (CommandState[(which+1)]->CommandStates[(CommandAddress((whichtime)))]) 61 62 #define ClientCommandNumberStatus(which, command) \ 63 (CommandState[(which+1)]->CommandStates[(command)]) 64 65 /* 66 #define PacketAddress(time) \ 67 ((time) & (MAXCMDS-1)) 68 */ 69 70 #define PacketAddress(time) \ 71 (time) 72 73 74 #define NETWORKTIMEOUT (VBLCOUNTER/3) 75 #define MODEMTIMEOUT (VBLCOUNTER/2) 76 #define SERVERTIMEOUT (VBLCOUNTER<<3) 77 78 #define MAXPOLLTICS 3 79 80 81 typedef enum { 82 scfp_nodata, 83 scfp_gameready, 84 scfp_data, 85 scfp_done 86 } setupcheckforpacketstate; 87 88 typedef enum { 89 cs_ready, 90 cs_notarrived, 91 cs_fixing 92 } en_CommandStatus; 93 94 typedef enum { 95 player_ingame, 96 player_quitgame, 97 player_leftgame 98 } en_playerstatus; 99 100 void PreparePacket (MoveType * pkt); 101 int GetPacketSize (void * pkt); 102 void SendPacket (void * pkt, int dest); 103 void GetRemotePacket (int from, int delay); 104 void ResendLocalPackets (int time, int dest, int numpackets); 105 void ResendServerPackets (int time, int dest, int numpackets); 106 void ResendPacket (void * pkt, int dest); 107 void AddClientDelta (void * pkt, int src); 108 void FixupPacket (void * pkt, int src); 109 void ProcessPacket (void * pkt, int src); 110 void AddServerPacket(void * pkt, int src); 111 void AddClientPacket (void * pkt, int src); 112 void AddPacket (void * pkt, int src); 113 void RequestPacket (int time, int dest, int numpackets); 114 boolean AllPlayersReady ( void ); 115 boolean AreClientsReady ( void ); 116 boolean IsServerCommandReady ( int time ); 117 void UpdatePlayerObj ( int player ); 118 void AddServerSubPacket(COM_ServerHeaderType * serverpkt); 119 void AddSubPacket (void * pkt, int src); 120 121 122 #endif 123