Apocalypse mirror
Sourceforge mirror |
News | Info | Characters | Arenas | Screenshots | Forums | Download | ||||
Developer: | Making of | Character-HOWTO | AI Design | Submit a Character | |||
Documentation: | Main Page | Modules | Class Hierarchy | Class List | File List |
00001 /*************************************************************************** 00002 MortalNetwork.h - description 00003 ------------------- 00004 begin : Sun Jan 25 2004 00005 copyright : (C) 2004 by upi 00006 email : upi@feel 00007 ***************************************************************************/ 00008 00009 00010 #ifndef MORTALNETWORK_H 00011 #define MORTALNETWORK_H 00012 00013 #include "FighterEnum.h" 00014 #include "SDL_types.h" 00015 00016 00069 class CMortalNetwork 00070 { 00071 public: 00072 struct SGameParams 00073 { 00074 Uint32 iGameTime; 00075 Uint32 iGameSpeed; 00076 Uint32 iHitPoints; 00077 Uint32 iBackgroundNumber; 00078 }; 00079 00080 public: 00081 00082 static void Create(); 00083 00084 // Connection's lifecycle 00085 00086 virtual bool Start( const char* a_pcServerName ) = 0; // Accept connection, or connect to given server 00087 virtual void Stop() = 0; // Disconnect 00088 virtual bool IsConnectionAlive() = 0; // Is the connection still good? 00089 virtual void Update() = 0; // Read network traffic. Might get disconnected... 00090 virtual const char* GetLastError() = 0; 00091 virtual bool IsMaster() = 0; // Am I Master or Slave? 00092 00093 // Msg related methods 00094 00095 virtual const char* GetRemoteUsername() = 0; // This is the name that is passed upon connection. 00096 virtual void SendMsg( const char* a_rsMsg ) = 0; // Prompt the user for a line of chat text 00097 virtual bool IsMsgAvailable() = 0; // Returns true is a chatline has arrived 00098 virtual const char* GetMsg() = 0; // The next chatline, or NULL if there are no more. 00099 00100 // Charater Selection methods 00101 00102 virtual bool IsRemoteFighterAvailable( FighterEnum a_enFighter ) = 0; // Does the other computer have fighter X installed? 00103 virtual FighterEnum GetRemoteFighter() = 0; // Returns the latest fighter chosen by the remote side. 00104 virtual bool IsRemoteSideReady() = 0; // The other player is finished choosing. 00105 00106 virtual void SendFighter( FighterEnum a_enFighter ) = 0; // Let the other side know that I switched to fighter X. 00107 virtual void SendReady() = 0; // Let the other side know that I am ready. 00108 virtual void SendGameParams( int a_iGameSpeed, int a_iGameTime, int a_iHitPoints, int a_iBackgroundNumber ) = 0; 00109 virtual SGameParams GetGameParams() = 0; 00110 00111 // Game methods 00112 00113 virtual bool SynchStartRound() = 0; 00114 virtual void SendGameData( const char* a_pcGameData ) = 0; 00115 virtual const char* GetLatestGameData() = 0; 00116 00117 virtual void SendKeystroke( int a_iTime, int a_iKey, bool a_bPressed ) = 0; 00118 virtual bool GetKeystroke( int& a_riOutTime, int& a_riOutKey, bool& a_rbPressed ) = 0; 00119 00120 virtual void SendGameTick( int a_iGameTick ) = 0; 00121 virtual int GetGameTick() = 0; 00122 00123 virtual void SendHurryup( int a_iHurryUpCode ) = 0; 00124 virtual int GetHurryup() = 0; 00125 00126 virtual void SendRoundOver( int a_iWhoWon, bool a_bGameOver ) = 0; 00127 virtual bool IsRoundOver() = 0; 00128 virtual bool IsGameOver() = 0; 00129 virtual int GetWhoWon() = 0; 00130 }; 00131 00132 00133 extern CMortalNetwork* g_poNetwork; 00134 00135 00136 #endif // MORTALNETWORK_H