Subversion Repositories Games.Carmageddon

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #ifndef _NETWORK_H_
  2. #define _NETWORK_H_
  3.  
  4. #include "dr_types.h"
  5. extern tU32 gMess_max_flags;
  6. extern tU32 gMess_mid_flags;
  7. extern tU32 gMess_min_flags;
  8. extern tU32 gGuarantee_number;
  9. extern int gNet_service_disable;
  10. extern int gIn_net_service;
  11. extern int gPlayer_list_batch_number;
  12. extern int gOnly_receive_guarantee_replies;
  13. extern void* gMessage_to_free;
  14. extern tNet_message* gBroadcast_stack;
  15. extern tNet_message* gTo_host_stack;
  16. extern tU32 gLast_flush_message;
  17. extern int gRace_only_flags[33];
  18. extern int gJoin_list_mode;
  19. extern tNet_game_player_info gNew_net_players[6];
  20. extern tGuaranteed_message gGuarantee_list[100];
  21. extern tMid_message* gMid_messages;
  22. extern tU32 gLast_player_list_received;
  23. extern tMin_message* gMin_messages;
  24. extern void (*gAdd_proc)(tNet_game_details*);
  25. extern int gReceiving_batch_number;
  26. extern int gReceiving_new_players;
  27. extern tMax_message* gMax_messages;
  28. extern int gNext_guarantee;
  29. extern tU32 gAsk_time;
  30. extern int gNet_initialised;
  31. extern int gDont_allow_joiners;
  32. extern tNet_game_details* gCurrent_join_poll_game;
  33. extern int gMessage_header_size;
  34. extern int gJoin_poll_index;
  35. extern int gJoin_request_denied;
  36. extern int gHost_died;
  37. extern int gCar_was_taken;
  38. extern int gBastard_has_answered;
  39. extern int gTime_for_next_one;
  40. extern int gReceived_game_scores;
  41.  
  42. int NetInitialise(void);
  43.  
  44. int NetShutdown(void);
  45.  
  46. void ShutdownNetIfRequired(void);
  47.  
  48. void DisableNetService(void);
  49.  
  50. void ReenableNetService(void);
  51.  
  52. int PermitNetServiceReentrancy(void);
  53.  
  54. void HaltNetServiceReentrancy(void);
  55.  
  56. void NetSendHeadupToAllPlayers(char* pMessage);
  57.  
  58. void NetSendHeadupToEverybody(char* pMessage);
  59.  
  60. void NetSendHeadupToPlayer(char* pMessage, tPlayer_ID pPlayer);
  61.  
  62. void InitialisePlayerStati(void);
  63.  
  64. void LeaveTempGame(void);
  65.  
  66. void DisposeCurrentJoinPollGame(void);
  67.  
  68. void DoNextJoinPoll(void);
  69.  
  70. void NetStartProducingJoinList(void (*pAdd_proc)(tNet_game_details*));
  71.  
  72. void NetEndJoinList(void);
  73.  
  74. void NetDisposePIDGameInfo(tNet_game_details* pDetails);
  75.  
  76. void NetDisposeGameDetails(tNet_game_details* pDetails);
  77.  
  78. tNet_game_details* NetAllocatePIDGameDetails(void);
  79.  
  80. void NetLeaveGameLowLevel(tNet_game_details* pDetails);
  81.  
  82. void NetLeaveGame(tNet_game_details* pNet_game);
  83.  
  84. void NetSetPlayerSystemInfo(tNet_game_player_info* pPlayer, void* pSender_address);
  85.  
  86. void NetDisposePlayer(tNet_game_player_info* pPlayer);
  87.  
  88. void FillInThisPlayer(tNet_game_details* pGame, tNet_game_player_info* pPlayer, int pCar_index, int pHost);
  89.  
  90. void LoadCarN(int pIndex, tNet_game_player_info* pPlayer);
  91.  
  92. void DisposeCarN(int pIndex);
  93.  
  94. void PlayerHasLeft(int pIndex);
  95.  
  96. void NetPlayersChanged(int pNew_count, tNet_game_player_info* pNew_players);
  97.  
  98. tNet_game_details* NetHostGame(tNet_game_type pGame_type, tNet_game_options* pOptions, int pStart_rank, char* pHost_name, int pCar_index);
  99.  
  100. int NetInitClient(tNet_game_details* pDetails);
  101.  
  102. int NetJoinGameLowLevel(tNet_game_details* pDetails, char* pPlayer_name);
  103.  
  104. int NetJoinGame(tNet_game_details* pDetails, char* pPlayer_name, int pCar_index);
  105.  
  106. void NetObtainSystemUserName(char* pName, int pMax_length);
  107.  
  108. tU32 NetExtractGameID(tNet_game_details* pDetails);
  109.  
  110. tPlayer_ID NetExtractPlayerID(tNet_game_details* pDetails);
  111.  
  112. int NetSendMessageToAddress(tNet_game_details* pDetails, tNet_message* pMessage, void* pAddress);
  113.  
  114. int NetSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer);
  115.  
  116. int NetSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage);
  117.  
  118. int NetReplyToMessage(tNet_game_details* pDetails, tNet_message* pIncoming_message, tNet_message* pReply_message);
  119.  
  120. int NetSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage);
  121.  
  122. tU32 NetGetContentsSize(tNet_message_type pType, tS32 pSize_decider);
  123.  
  124. tU32 NetGetMessageSize(tNet_message_type pType, tS32 pSize_decider);
  125.  
  126. tS32 NetCalcSizeDecider(tNet_contents* pContents);
  127.  
  128. tNet_message* NetBuildMessage(tNet_message_type pType, tS32 pSize_decider);
  129.  
  130. tNet_contents* NetGetToHostContents(tNet_message_type pType, tS32 pSize_decider);
  131.  
  132. tNet_contents* NetGetBroadcastContents(tNet_message_type pType, tS32 pSize_decider);
  133.  
  134. void NetSendMessageStacks(void);
  135.  
  136. tNet_message* NetAllocateMessage(int pSize);
  137.  
  138. void NetFreeExcessMemory(void);
  139.  
  140. int NetDisposeMessage(tNet_game_details* pDetails, tNet_message* pMessage);
  141.  
  142. tNet_message* NetGetNextMessage(tNet_game_details* pDetails, void** pSender_address);
  143.  
  144. void ReceivedSendMeDetails(tNet_contents* pContents, void* pSender_address);
  145.  
  146. void ReceivedDetails(tNet_contents* pContents);
  147.  
  148. void SendOutPlayerList(void);
  149.  
  150. void ReceivedJoin(tNet_contents* pContents, void* pSender_address);
  151.  
  152. void KickPlayerOut(tPlayer_ID pID);
  153.  
  154. void ReceivedLeave(tNet_contents* pContents, tNet_message* pMessage);
  155.  
  156. void NetFullScreenMessage(int pStr_index, int pLeave_it_up_there);
  157.  
  158. void HostHasBittenTheDust(int pMessage_index);
  159.  
  160. void ReceivedHosticide(tNet_contents* pContents);
  161.  
  162. void ConfirmReceipt(void);
  163.  
  164. void ReceivedNewPlayerList(tNet_contents* pContents, tNet_message* pM);
  165.  
  166. void ReceivedRaceOver(tNet_contents* pContents);
  167.  
  168. void ReceivedStatusReport(tNet_contents* pContents, tNet_message* pMessage);
  169.  
  170. void ReceivedStartRace(tNet_contents* pContents);
  171.  
  172. void ReceivedGuaranteeReply(tNet_contents* pContents);
  173.  
  174. void ReceivedHeadup(tNet_contents* pContents);
  175.  
  176. void ReceivedHostQuery(tNet_contents* pContents, tNet_message* pMessage);
  177.  
  178. void ReceivedHostReply(tNet_contents* pContents);
  179.  
  180. void SendGuaranteeReply(tNet_message* pMessage, void* pSender_address);
  181.  
  182. int PlayerIsInList(tPlayer_ID pID);
  183.  
  184. void ReceivedTimeSync(tNet_contents* pContents, tNet_message* pMessage, tU32 pReceive_time);
  185.  
  186. void ReceivedConfirm(tNet_contents* pContents);
  187.  
  188. void ReceivedDisableCar(tNet_contents* pContents);
  189.  
  190. void ReceivedEnableCar(tNet_contents* pContents);
  191.  
  192. void ReceivedScores(tNet_contents* pContents);
  193.  
  194. void ReceivedWasted(tNet_contents* pContents);
  195.  
  196. void ReceivedCarDetailsReq(tNet_contents* pContents, void* pSender_address);
  197.  
  198. void ReceivedCarDetails(tNet_contents* pContents);
  199.  
  200. void ReceivedGameScores(tNet_contents* pContents);
  201.  
  202. void ReceivedMessage(tNet_message* pMessage, void* pSender_address, tU32 pReceive_time);
  203.  
  204. void NetReceiveAndProcessMessages(void);
  205.  
  206. void BroadcastStatus(void);
  207.  
  208. void CheckForDisappearees(void);
  209.  
  210. void CheckForPendingStartRace(void);
  211.  
  212. void NetService(int pIn_race);
  213.  
  214. void NetFinishRace(tNet_game_details* pDetails, tRace_over_reason pReason);
  215.  
  216. void NetPlayerStatusChanged(tPlayer_status pNew_status);
  217.  
  218. tPlayer_status NetGetPlayerStatus(void);
  219.  
  220. int NetGuaranteedSendMessageToAllPlayers(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*));
  221.  
  222. int NetGuaranteedSendMessageToEverybody(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*));
  223.  
  224. int NetGuaranteedSendMessageToHost(tNet_game_details* pDetails, tNet_message* pMessage, int (*pNotifyFail)(tU32, tNet_message*));
  225.  
  226. int NetGuaranteedSendMessageToPlayer(tNet_game_details* pDetails, tNet_message* pMessage, tPlayer_ID pPlayer, int (*pNotifyFail)(tU32, tNet_message*));
  227.  
  228. int NetGuaranteedSendMessageToAddress(tNet_game_details* pDetails, tNet_message* pMessage, void* pAddress, int (*pNotifyFail)(tU32, tNet_message*));
  229.  
  230. void ResendGuaranteedMessages(void);
  231.  
  232. int SampleFailNotifier(tU32 pAge, tNet_message* pMessage);
  233.  
  234. void NetWaitForGuaranteeReplies(void);
  235.  
  236. tNet_game_player_info* NetPlayerFromID(tPlayer_ID pPlayer);
  237.  
  238. tCar_spec* NetCarFromPlayerID(tPlayer_ID pPlayer);
  239.  
  240. tNet_game_player_info* NetPlayerFromCar(tCar_spec* pCar);
  241.  
  242. tU32 DoCheckSum(tNet_message* pMessage);
  243.  
  244. void GetCheckSum(tNet_message* pMessage);
  245.  
  246. void CheckCheckSum(tNet_message* pMessage);
  247.  
  248. #endif
  249.