Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

NetMgr.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  NetMgr.h                                                                            */
00003 /*                                                                                      */
00004 /*  Author: John Pollard                                                                */
00005 /*  Description:                                                                        */
00006 /*                                                                                      */
00007 /*  Copyright (c) 1997, 1999, Eclipse Entertainment; All rights reserved.               */
00008 /*                                                                                      */
00009 /*  See the accompanying file LICENSE.TXT for terms on the use of this library.         */
00010 /*  This library is distributed in the hope that it will be useful but WITHOUT          */
00011 /*  ANY WARRANTY OF ANY KIND and without any implied warranty of MERCHANTABILITY        */
00012 /*  or FITNESS FOR ANY PURPOSE.  Refer to LICENSE.TXT for more details.                 */
00013 /*                                                                                      */
00014 /****************************************************************************************/
00015 #ifndef NETMGR_H
00016 #define NETMGR_H
00017 
00018 #include <Windows.h>
00019 
00020 #include "Genesis.h"
00021 
00022 #include "Buffer.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 
00029 //===========================================================================
00030 //      Struct defs
00031 //===========================================================================
00032 typedef struct NetMgr                                           NetMgr;
00033 
00034 #define NETMGR_VERSION_MAJOR                            1       
00035 #define NETMGR_VERSION_MINOR                            0
00036 
00037 // Upper bounds for both client/server  (they must share the same number of players)
00038 #define NETMGR_MAX_CLIENTS                                      8
00039 
00040 #define NETMGR_MAX_PLAYERS                                      512
00041 
00042 #define NETMGR_MAX_IP_ADDRESS                           128
00043 
00044 #define NETMGR_SINGLE_PLAYER_NETID                      0xff            // For single player games
00045 #define NETMGR_SPECIAL_BOT_NETID                        -2                      // For bots
00046 
00047 #define NETMGR_LOCAL_MSG_BUFFER_SIZE            20000
00048 
00049 //===========================================================================
00050 //      NetState
00051 //===========================================================================
00052 typedef int32                                                           NetMgr_NetState;
00053 
00054 #define NetState_Disconnected                           0       // The client is currently not connected to a server
00055 #define NetState_Connecting                                     1       // The client is not yet fully connected...
00056 #define NetState_ConnectedIdle                          2       // The client is connected, but doing nothing
00057 #define NetState_WorldChange                            3       // The client is in the middle of a world change
00058 #define NetState_WorldActive                            4       // A world is running, and receiving data
00059 
00060 #define NETMGR_MAX_NET_STATES                           5
00061 
00062 //===========================================================================
00063 //      Message types
00064 //===========================================================================
00065 // Client to Server msg's
00066 #define NETMGR_MSG_CLIENT_MOVE                          1
00067 #define NETMGR_MSG_CLIENT_CONFIRM                       2
00068 
00069 // Server to Client msg's
00070 #define NETMGR_MSG_VERSION                                      3
00071 #define NETMGR_MSG_TIME                                         4
00072 #define NETMGR_MSG_PLAYER_DATA                          5
00073 #define NETMGR_MSG_NEW_WORLD_PLAYER_DATA        6
00074 #define NETMGR_MSG_VIEW_PLAYER                          7
00075 #define NETMGR_MSG_MESH_INDEX                           8
00076 #define NETMGR_MSG_ACTOR_INDEX                          9
00077 #define NETMGR_MSG_MOTION_INDEX                         10
00078 #define NETMGR_MSG_BONE_INDEX                           11
00079 #define NETMGR_MSG_TEXTURE_INDEX                        12
00080 #define NETMGR_MSG_SOUND_INDEX                          13
00081 #define NETMGR_MSG_SET_WORLD                            14
00082 #define NETMGR_MSG_CD_TRACK                                     15
00083 #define NETMGR_MSG_PLAY_SOUND_INDEX                     16
00084 #define NETMGR_MSG_EFFECT                                       17
00085 #define NETMGR_MSG_CLIENT_INDEX                         18
00086 #define NETMGR_MSG_CLIENT_ACTIVE                        19
00087 #define NETMGR_MSG_CLIENT_NAME                          20
00088 #define NETMGR_MSG_CLIENT_SCORE                         21
00089 #define NETMGR_MSG_CLIENT_HEALTH                        22
00090 #define NETMGR_MSG_CLIENT_INVENTORY                     23
00091 #define NETMGR_MSG_CLIENT_WEAPON                        24
00092 #define NETMGR_MSG_SPAWN_FX                                     25
00093 #define NETMGR_MSG_HEADER_PRINTF                        26
00094 #define NETMGR_MSG_CLIENT_PLAYER_INDEX          27
00095 #define NETMGR_MSG_NET_STATE_CHANGE                     28
00096 
00097 #define NETMGR_MSG_SHUTDOWN                                     128
00098 
00099 // Flags for what needs to be sent/read for player updates
00100 #define NETMGR_SEND_SPAWN_TIME                          (1<<0)                  // Must Send/Read Sapwn Time
00101 #define NETMGR_SEND_VIEW_FLAGS                          (1<<1)                  // Must Send/Read view flags
00102 #define NETMGR_SEND_VIEW_INDEX                          (1<<2)                  // Must Send/Read view index
00103 #define NETMGR_SEND_MOTION_INDEX                        (1<<3)                  // Must Send/Read motion index
00104 #define NETMGR_SEND_FX_FLAGS                            (1<<4)                  // Must Send/Read fx flags
00105 #define NETMGR_SEND_POS                                         (1<<5)                  // Must Send/Read Pos
00106 #define NETMGR_SEND_ANGLES                                      (1<<6)                  // Must Send/Read Angles
00107 #define NETMGR_SEND_FRAME_TIME                          (1<<7)                  // Must Send/Read FrameTime
00108 #define NETMGR_SEND_SCALE                                       (1<<8)                  // Must Send/Read scale
00109 #define NETMGR_SEND_VELOCITY                            (1<<9)                  // Must Send/Read Velocity in player
00110 #define NETMGR_SEND_STATE                                       (1<<10)                 // Must Send/Read State variable
00111 #define NETMGR_SEND_CONTROL_INDEX                       (1<<11)                 // Means of connecting functions accross net
00112 #define NETMGR_SEND_TRIGGER_INDEX                       (1<<12)                 // Means of connecting functions accross net
00113 #define NETMGR_SEND_MINS_MAXS                           (1<<13)                 // Must Send/Receive mins/maxs
00114 //===========================================================================
00115 //      Function prototypes
00116 //===========================================================================
00117 NetMgr                          *NetMgr_Create(geBoolean UseLocalBuffers);
00118 void                            NetMgr_Destroy(NetMgr *NMgr);
00119 void                            NetMgr_FreeAllObjects(NetMgr *NMgr);
00120 
00121 geBoolean                       NetMgr_StartSession(NetMgr *NMgr, const char *SessionName, const char *PlayerName);
00122 geBoolean                       NetMgr_JoinSession(NetMgr *NMgr, const char *IPAddress, const char *PlayerName);
00123 geCSNetMgr_NetID        NetMgr_GetOurID(NetMgr *NMgr);
00124 
00125 geBoolean                       NetMgr_IsValid(NetMgr *NMgr);
00126 
00127 geBoolean                       NetMgr_SendServerMessage(NetMgr *NMgr, Buffer_Data *Buffer, geBoolean G);
00128 geBoolean                       NetMgr_SendClientMessage(NetMgr *NMgr, geCSNetMgr_NetID NetID, Buffer_Data *Buffer, geBoolean G);
00129 geBoolean                       NetMgr_ReceiveServerMessage(NetMgr *NMgr, geCSNetMgr_NetMsgType *Type, Buffer_Data *Buffer);
00130 geBoolean                       NetMgr_ReceiveClientMessage(NetMgr *NMgr, geCSNetMgr_NetMsgType *MsgType, geCSNetMgr_NetID *ClientID, Buffer_Data *Buffer);
00131 
00132 void                            NetMgr_ResetClientBuffer(NetMgr *NMgr);
00133 void                            NetMgr_ResetServerBuffer(NetMgr *NMgr);
00134 
00135 #ifdef __cplusplus
00136 }
00137 #endif
00138 
00139 #endif

Generated on Tue Sep 30 12:36:02 2003 for GTestAndEngine by doxygen 1.3.2