aboutsummaryrefslogtreecommitdiff
path: root/src/parsec_server/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/parsec_server/include')
-rw-r--r--src/parsec_server/include/MasterServer.h32
-rw-r--r--src/parsec_server/include/MasterServerItem.h53
-rw-r--r--src/parsec_server/include/con_act_sv.h239
-rw-r--r--src/parsec_server/include/con_aux_sv.h59
-rw-r--r--src/parsec_server/include/con_com_sv.h71
-rw-r--r--src/parsec_server/include/con_ext_sv.h91
-rw-r--r--src/parsec_server/include/con_info_sv.h63
-rw-r--r--src/parsec_server/include/con_int_sv.h59
-rw-r--r--src/parsec_server/include/con_list_sv.h34
-rw-r--r--src/parsec_server/include/con_load_sv.h16
-rw-r--r--src/parsec_server/include/con_main_sv.h168
-rw-r--r--src/parsec_server/include/con_std_sv.h120
-rwxr-xr-xsrc/parsec_server/include/e_colldet.h75
-rwxr-xr-xsrc/parsec_server/include/e_connmanager.h247
-rw-r--r--src/parsec_server/include/e_defs.h45
-rwxr-xr-xsrc/parsec_server/include/e_gameserver.h204
-rwxr-xr-xsrc/parsec_server/include/e_global_sv.h97
-rwxr-xr-xsrc/parsec_server/include/e_packethandler.h147
-rwxr-xr-xsrc/parsec_server/include/e_simnetinput.h48
-rwxr-xr-xsrc/parsec_server/include/e_simnetoutput.h361
-rwxr-xr-xsrc/parsec_server/include/e_simplayerinfo.h67
-rwxr-xr-xsrc/parsec_server/include/e_simulator.h286
-rwxr-xr-xsrc/parsec_server/include/e_world.h295
-rwxr-xr-xsrc/parsec_server/include/e_world_trans.h33
-rwxr-xr-xsrc/parsec_server/include/g_main_sv.h275
-rwxr-xr-xsrc/parsec_server/include/g_player.h148
-rw-r--r--src/parsec_server/include/inp_defs_sv.h30
-rw-r--r--src/parsec_server/include/inp_keybmap_sv.h559
-rw-r--r--src/parsec_server/include/inp_main_sv.h12
-rw-r--r--src/parsec_server/include/net_game_sv.h30
-rwxr-xr-xsrc/parsec_server/include/net_packetdriver.h138
-rwxr-xr-xsrc/parsec_server/include/net_subh_sv.h128
-rwxr-xr-xsrc/parsec_server/include/net_udpdriver.h120
-rw-r--r--src/parsec_server/include/net_util_sv.h25
-rw-r--r--src/parsec_server/include/sl_util_sv.h9
-rw-r--r--src/parsec_server/include/sys_err_sv.h31
-rw-r--r--src/parsec_server/include/sys_msg_sv.h29
-rw-r--r--src/parsec_server/include/sys_refframe_sv.h29
-rwxr-xr-xsrc/parsec_server/include/sys_util_sv.h18
39 files changed, 4491 insertions, 0 deletions
diff --git a/src/parsec_server/include/MasterServer.h b/src/parsec_server/include/MasterServer.h
new file mode 100644
index 0000000..ed78b47
--- /dev/null
+++ b/src/parsec_server/include/MasterServer.h
@@ -0,0 +1,32 @@
+/*
+ * MasterServer.h
+ *
+ * Created on: Jan 2, 2013
+ * Author: jasonw
+ */
+
+#ifndef MASTERSERVER_H_
+#define MASTERSERVER_H_
+
+#include "e_gameserver.h"
+#include "MasterServerItem.h"
+
+// C++ STL vector for the resolution list
+#include <vector>
+
+/*
+ *
+ */
+class MasterServer: public E_GameServer {
+public:
+ MasterServer();
+ MasterServer(E_GameServer *);
+ virtual ~MasterServer();
+
+ int RemoveStaleEntries();
+
+
+ std::vector<MasterServerItem> ServerList;
+};
+
+#endif /* MASTERSERVER_H_ */
diff --git a/src/parsec_server/include/MasterServerItem.h b/src/parsec_server/include/MasterServerItem.h
new file mode 100644
index 0000000..de7419e
--- /dev/null
+++ b/src/parsec_server/include/MasterServerItem.h
@@ -0,0 +1,53 @@
+/*
+ * MasterServerList.h
+ *
+ * Created on: Jan 2, 2013
+ * Author: jasonw
+ */
+
+#ifndef MASTERSERVERLIST_H_
+#define MASTERSERVERLIST_H_
+
+
+/*
+ *
+ */
+class MasterServerItem {
+public:
+ MasterServerItem();
+ MasterServerItem(int SrvID, int CurrPlayers, int MaxPlayers, int PMajor, int PMinor, char ServerName[ MAX_SERVER_NAME + 1 ], char OS[MAX_OSNAME_LEN + 1 ], node_t *node);
+ MasterServerItem(const MasterServerItem& msi_copy);
+ virtual ~MasterServerItem();
+
+ bool update(int SrvID, int CurrPlayers, int MaxPlayers, int PMajor, int PMinor, char ServerName[ MAX_SERVER_NAME + 1 ], char OS[MAX_OSNAME_LEN + 1 ], node_t *node);
+ bool remove();
+
+ bool operator < (const MasterServerItem &msl) const;
+ bool operator == (const MasterServerItem &msl) const;
+ bool operator != (const MasterServerItem &msl) const;
+
+ bool isValid() const;
+
+ int GetSrvID();
+ int GetCurrPlayers();
+ int GetMaxPlayers();
+ int GetPMajor();
+ int GetPMinor();
+ int GetServerName(char *buffer, int buffer_sz);
+ int GetOS(char *buffer, int buffer_sz);
+ int GetNode(node_t *node);
+
+
+private:
+ int _SrvID;
+ int _CurrPlayers;
+ int _MaxPlayers;
+ int _PMajor;
+ int _PMinor;
+ char _ServerName[ MAX_SERVER_NAME + 1 ];
+ char _OS[MAX_OSNAME_LEN + 1 ];
+ node_t _Node;
+
+};
+
+#endif /* MASTERSERVERLIST_H_ */
diff --git a/src/parsec_server/include/con_act_sv.h b/src/parsec_server/include/con_act_sv.h
new file mode 100644
index 0000000..fb3a366
--- /dev/null
+++ b/src/parsec_server/include/con_act_sv.h
@@ -0,0 +1,239 @@
+/*
+ * PARSEC HEADER: con_act_sv.h
+ */
+
+#ifndef _CON_ACT_SV_H_
+#define _CON_ACT_SV_H_
+
+
+// action commands
+
+enum {
+
+ ACM_SIGNATURE,
+
+ ACM_IDLEWAIT,
+
+ ACM_PITCH,
+ ACM_YAW,
+ ACM_ROLL,
+ ACM_SLIDEX,
+ ACM_SLIDEY,
+ ACM_MOVE,
+
+ ACM_CAMROT1,
+ ACM_CAMROT2,
+ ACM_CAMROT3,
+ ACM_CAMORIGIN,
+
+ ACM_FIXROT1,
+ ACM_FIXROT2,
+ ACM_FIXROT3,
+
+ ACM_PACKET,
+
+ ACM_FADEOUT,
+ ACM_FADEIN,
+ ACM_WFADEOUT,
+ ACM_WFADEIN,
+ ACM_BLACK,
+ ACM_WHITE,
+ ACM_STDPALETTE,
+
+ ACM_SAVESCREEN,
+ ACM_SAVELIST,
+ ACM_SAVECAMERA,
+ ACM_SAVEFSTARS,
+ ACM_SAVEPSTARS,
+ ACM_SAVEREMOTE,
+
+ ACM_KILLPSTARS,
+ ACM_ADDPSTAR,
+
+ ACM_PREPRESTORE,
+
+ ACM_CREATEOBJECT,
+ ACM_CREATEEXTRA,
+ ACM_DESTROYLIST,
+
+ ACM_REMOTEPLAYER,
+ ACM_REMOTEMATRIX,
+ ACM_REMOTENAME,
+ ACM_REMOTEJOIN,
+ ACM_REMOTEUNJOIN,
+
+ ACM_CLEARDEMO,
+
+ ACM_OBJMATRXCOL1,
+ ACM_OBJMATRXCOL2,
+ ACM_OBJMATRXCOL3,
+ ACM_OBJMATRXCOL4,
+
+ ACM_LASER_SPEED,
+ ACM_LASER_DIRVEC,
+ ACM_LASER_OWNER,
+ ACM_MISSL_SPEED,
+ ACM_MISSL_DIRVEC,
+ ACM_MISSL_OWNER,
+ ACM_MISSL_TARGET,
+ ACM_MINE_OWNER,
+
+ ACM_ENERGYFIELD,
+ ACM_SPREADFIRE,
+ ACM_LIGHTNINGON,
+ ACM_LIGHTNINGOFF,
+
+ ACM_SETOBJECTID,
+ ACM_SETOBJECTHOSTID,
+
+ ACM_SIMULKEYPRESS,
+ ACM_SIMULKEYRELEASE,
+
+ ACM_MS_CURDAMAGE,
+ ACM_MS_MAXDAMAGE,
+ ACM_MS_CURENERGY,
+ ACM_MS_MAXENERGY,
+ ACM_MS_CURSPEED,
+ ACM_MS_MAXSPEED,
+ ACM_MS_NUMMISSLS,
+ ACM_MS_MAXNUMMISSLS,
+ ACM_MS_NUMHOMMISSLS,
+ ACM_MS_MAXNUMHOMMISSLS,
+ ACM_MS_NUMMINES,
+ ACM_MS_MAXNUMMINES,
+ ACM_MS_WEAPONS,
+ ACM_MS_SPECIALS,
+
+ ACM_GL_SELECTEDLASER,
+ ACM_GL_SELECTEDMISSILE,
+ ACM_GL_CURGUN,
+ ACM_GL_CURLAUNCHER,
+ ACM_GL_PANEL3CONTROL,
+ ACM_GL_PANEL4CONTROL,
+ ACM_GL_TARGETOBJNUMBER,
+
+ ACM_WRITESMALL,
+ ACM_WRITEBIG1,
+ ACM_WRITEBIG2,
+ ACM_WRITEBIG3,
+ ACM_CLEARTEXT,
+
+ ACM_PLAYSTREAM,
+ ACM_STOPSTREAM,
+ ACM_PLAYSOUND,
+
+ ACM_AUX,
+ ACM_ENTRYMODE,
+
+ ACM_SERVERMSG,
+
+ ACM_HELIXON,
+ ACM_HELIXOFF,
+
+ ACM_REMOTEMAXPLAYERS,
+
+ ACM_INCLUDEDEMO,
+
+ ACM_MS_WEAPONSACTIVE,
+ ACM_REMOTEWEAPONSACTIVE,
+
+ ACM_WRITECONSOLETEXT,
+ ACM_DISPLAYMESSAGE,
+
+ ACM_CD_OPEN,
+ ACM_CD_CLOSE,
+ ACM_CD_PLAY,
+ ACM_CD_PAUSE,
+ ACM_CD_RESUME,
+ ACM_CD_STOP,
+ ACM_CD_VOLUME,
+
+ ACM_EXECCOMMAND,
+
+ ACM_CLASSMAPID,
+ ACM_CLASSMAPNAME,
+
+ ACM_AUXDATA,
+ ACM_SYSREFFRAMES,
+
+ ACM_SCHEDULECOMMAND,
+
+ ACM_LIGHTAMBIENT,
+ ACM_LIGHTDIFFUSE,
+ ACM_LIGHTSPECULAR,
+
+ ACM_MS_NUMPARTMISSLS,
+ ACM_MS_MAXNUMPARTMISSLS,
+
+ ACM_PHOTONON,
+ ACM_PHOTONOFF,
+
+ ACM_EMPON,
+ ACM_EMPOFF,
+ ACM_EMP,
+
+ ACM_NUM_COMMANDS // must be last!!
+};
+
+
+// action commands flags
+
+#define ACF_NODIRECT 0x0000 // command not directly callable
+#define ACF_DIRECT 0x0001 // command directly callable
+#define ACF_NOCOMPILE 0x0000 // command not compilable
+#define ACF_COMPILE 0x0002 // command is compilable
+#define ACF_NOPARAMS 0x0000 // command has no parameters
+#define ACF_INTPARAMS 0x0010 // command has int parameters
+#define ACF_FLOATPARAMS 0x0020 // command has float parameters
+#define ACF_STRINGPARAM 0x0040 // command has a string parameter
+#define ACF_PACKETPARAM 0x0080 // command has a packet attached
+#define ACF_DEMOPARAM 0x0100 // command has an entire demo attached
+#define ACF_SCHEDPARAM 0x0200 // command has a command to schedule
+
+#define ACF_STRIP_SPACE 0x1000 // strip leading and trailing whitespace
+#define ACF_STRINGSTRIP ( ACF_STRINGPARAM | ACF_STRIP_SPACE )
+
+#define ACM_EAT_SPACE(c) ( ( action_commands[ c ].flags & ACF_STRIP_SPACE ) != 0 )
+#define ACF_EAT_SPACE(f) ( ( (f) & ACF_STRIP_SPACE ) != 0 )
+
+
+// action command description
+
+struct act_command_s {
+
+ const char *command; // command string
+ void (*func)(void); // function responsible for command execution
+ dword flags; // flag word
+ int numparameters; // number of parameters the command takes
+};
+
+extern act_command_s action_commands[];
+
+
+// macro to retrieve action command strings
+#define ACMSTR(x) (action_commands[x].command)
+
+// macro to retrieve string length of action commmands
+#define ACMLEN(x) strlen(action_commands[x].command)
+
+// macro to determine if action command is directly callable
+#define ACMCALLABLE(x) ((action_commands[x].flags&ACF_DIRECT)!=0)
+
+
+// external functions
+
+int ExecBinCommands( char* &data, int interactive );
+void ResetClassMapTable();
+void ResetScheduledActions();
+void SaveGameState();
+void ActionCommand( char *cstr );
+
+
+// external variables
+
+extern int con_audio_stream_started;
+
+
+#endif // _CON_ACT_SV_H_
+
+
diff --git a/src/parsec_server/include/con_aux_sv.h b/src/parsec_server/include/con_aux_sv.h
new file mode 100644
index 0000000..c3a2075
--- /dev/null
+++ b/src/parsec_server/include/con_aux_sv.h
@@ -0,0 +1,59 @@
+/*
+ * PARSEC HEADER: cons_aux.h
+ */
+
+#ifndef _CON_AUX_SV_H_
+#define _CON_AUX_SV_H_
+
+
+// size of SV array
+// size of aux arrays
+#define MAX_SV_ARRAY_SIZE 512
+
+#define SV_PACKAGE_SCRIPTS AuxEnabling[ 0 ]
+#define SV_CONSOLE_LEVEL_MESSAGES AuxEnabling[ 1 ]
+#define SV_PACKAGE_SCRIPT_LISTING AuxEnabling[ 2 ]
+#define SV_CLASS_MAP_TABLE_DISABLE_RESET AuxEnabling[ 3 ]
+//NOTE: AUX_* flags are common with client code
+#define AUX_NETCODE_FLAGS AuxEnabling[ 4 ]
+#define AUX_CHEAT_DISABLE_ENERGY_CHECKS AuxEnabling[ 5 ]
+#define SV_CHEAT_ENERGY_CHECKS AuxEnabling[ 5 ]
+#define AUX_ENABLE_OBJECT_OVERLOADING AuxEnabling[ 6 ]
+#define SV_OBJECTCLASSES_OVERLOADING AuxEnabling[ 6 ]
+#define SV_CHEAT_DEVICE_CHECKS AuxEnabling[ 7 ]
+#define AUX_CHEAT_DISABLE_DEVICE_CHECKS AuxEnabling[ 7 ]
+#define SV_GAME_EXTRAS_AUTOCREATE AuxEnabling[ 8 ]
+#define SV_MASTERSERVER_SENDHEARTBEAT AuxEnabling[ 9 ]
+#define SV_GAME_EXTRAS_TESTPLACE AuxEnabling[ 11 ]
+#define SV_GAME_KILLLIMIT AuxEnabling[ 12 ]
+#define SV_GAME_TIMELIMIT AuxEnabling[ 13 ]
+#define SV_GAME_RESTART_TIMEOUT AuxEnabling[ 14 ]
+#define SV_SERVERID AuxEnabling[ 15 ]
+#define SV_FEDID AuxEnabling[ 16 ]
+#define SV_NETCONF_PORT AuxEnabling[ 17 ]
+#define SV_DEBUG_NETSTREAM_DUMP AuxEnabling[ 18 ]
+#define AUX_DEBUG_NETSTREAM_DUMP AuxEnabling[ 18 ] // for compatibility in NET_STREAM
+#define AUX_ENABLE_CONSOLE_DEBUG_MESSAGES AuxEnabling[ 19 ]
+#define SV_DEBUG_CONSOLE_MESSAGES AuxEnabling[ 19 ]
+#define AUX_FORCE_WORKDIR_TO_CURRENT AuxEnabling[ 20 ]
+#define SV_GAME_WORKDIR_FORCE_CURRENT AuxEnabling[ 20 ]
+#define AUX_FORCE_FILEPATH_TO_CURRENT AuxEnabling[ 21 ]
+#define SV_GAME_FILEPATH_FORCE_CURRENT AuxEnabling[ 21 ]
+#define SV_GAME_EXTRAS_MAXNUM AuxEnabling[ 22 ]
+#define AUX_DISABLE_PACKAGE_DATA_FILES AuxEnabling[ 23 ]
+#define AUX_DISABLE_PACKAGE_SCRIPTS AuxEnabling[ 24 ]
+
+#define AUX_ARRAY_NUM_ENTRIES_USED 26 // UPDATE THIS!! <==
+
+#if ( AUX_ARRAY_NUM_ENTRIES_USED > MAX_SV_ARRAY_SIZE )
+ #error "MAX_AUX_ENABLING too small!"
+#endif
+
+
+// external functions ---------------------------------------------------------
+//
+void CON_AUX_SV_Register();
+
+#endif // _CON_AUX_SV_H_
+
+
diff --git a/src/parsec_server/include/con_com_sv.h b/src/parsec_server/include/con_com_sv.h
new file mode 100644
index 0000000..9d75eb7
--- /dev/null
+++ b/src/parsec_server/include/con_com_sv.h
@@ -0,0 +1,71 @@
+/*
+ * PARSEC HEADER: con_com_sv.h
+ */
+
+#ifndef _CON_COM_SV_H_
+#define _CON_COM_SV_H_
+
+
+// user commands table entry
+
+struct user_command_s {
+
+ const char* command; // command string
+ short commlen; // length of string
+ short numparams; // num of parameters (used by tab-completion)
+ int (*execute)(char*); // command function
+ char* (*statedump)(); // returns statedump string; (NULL==volatile)
+};
+
+
+// handle user commands not taking any parameters
+
+#define USERCOMMAND_NOPARAM(x) \
+{ \
+ char *whsp = (x); \
+ for ( ; *whsp; whsp++ ) \
+ if ( *whsp != ' ' ) \
+ break; \
+ if ( *whsp != 0 ) { \
+ if ( *(x) == ' ' ) { \
+ CON_AddLine( dont_use_params ); \
+ return TRUE; \
+ } else { \
+ return FALSE; \
+ } \
+ } \
+} \
+
+
+// macro to retrieve user command strings
+#define USRSTR(x) (user_commands[x].command)
+
+// macro to retrieve string length of user commmands
+#define USRLEN(x) (user_commands[x].commlen)
+
+// macro to determine number of arguments of user commmands
+#define USRARG(x) (user_commands[x].numparams)
+
+
+// external variables
+
+extern user_command_s* user_commands;
+extern int num_user_commands;
+extern char dont_use_params[];
+
+
+// external functions
+
+void CheckPlayerName( const char *name );
+
+int CheckCmdsNoParam( char *command );
+int CheckCmdsCustomString( char *command );
+int CheckCmdsUserDefined( char *command );
+
+int CON_RegisterUserCommand( user_command_s *regcom );
+int CON_ReplaceUserCommand( user_command_s* repcom );
+
+
+#endif // _CON_COM_SV_H_
+
+
diff --git a/src/parsec_server/include/con_ext_sv.h b/src/parsec_server/include/con_ext_sv.h
new file mode 100644
index 0000000..b557d7c
--- /dev/null
+++ b/src/parsec_server/include/con_ext_sv.h
@@ -0,0 +1,91 @@
+/*
+ * PARSEC HEADER: con_ext_sv.h
+ */
+
+#ifndef _CON_EXT_SV_H_
+#define _CON_EXT_SV_H_
+
+
+// types of external commands (relating to their directory)
+enum {
+
+ COMTYPE_PACKAGE, // 0
+ COMTYPE_ROOT, // 1
+ COMTYPE_REFERENCE, // 2
+ COMTYPE_STANDARD, // 3
+ COMTYPE_RECORDING, // 4
+ COMTYPE_MODIFICATION // 5
+};
+
+// maximum valid length of command (script) name (filesystem dependent)
+#define COMMAND_NAME_VALID_LEN 8
+
+// allocated memory for command (script) name (excluding zero term.)
+#define COMMAND_NAME_ALLOC_LEN 63
+
+// maximum number of external scripts that will be recognized
+#define MAX_EXTERNAL_COMMANDS 1024
+
+// maximum number of registered mods (more than one is useful for data only)
+#define MAX_REGISTERED_MODS 64
+
+
+// external variables
+
+extern int processing_batch;
+extern int idle_reclevel;
+extern int rec_depth;
+
+extern int preempt_action_commands;
+
+extern FILE * log_fp;
+extern int log_commands;
+extern char external_commands[][ COMMAND_NAME_ALLOC_LEN + 1 ];
+extern int external_command_types[];
+extern int num_external_commands;
+
+extern char packet_record_name[];
+extern char packet_replay_name[];
+
+extern char* mod_names[];
+extern int mod_numnames;
+extern int mod_override;
+
+
+// external functions
+
+int ProcessExternalLine( char *scan );
+void ExecConsoleFile( char *fname, int echo );
+int AddExternalCommands( char *path, int comtype );
+void BuildExternalCommandList();
+int CheckExternalCommand( char *com );
+int InsertCommandLog( char *command );
+int ExecExternalFile( char *command );
+int CompileDemoCut( FILE *fp, char *script );
+int ScriptReplayActive();
+int RestartExternalCommand( int echo );
+int OpenOutputBatch( char *cstr, int type );
+void CloseOutputBatch();
+int StartRecording( char *cstr, int savestate );
+void CloseRecording();
+void CallExternalCommand( int extcom, int echo );
+void ScriptStopReplay();
+
+int Cmd_CatExternalCommands( char *cstr );
+int Cmd_SetGameLoopBatchName( char *cstr );
+void Cmd_CloseOutputBatch();
+void Cmd_StopBatchReplay();
+void Cmd_QueryReplayInfo();
+void Cmd_RescanExternalCommands();
+
+
+// macro to retrieve external command strings
+#define ECMSTR(x) (external_commands[x])
+
+// macro to retrieve string length of external commmands
+#define ECMLEN(x) strlen(external_commands[x])
+
+
+#endif // _CON_EXT_SV_H_
+
+
diff --git a/src/parsec_server/include/con_info_sv.h b/src/parsec_server/include/con_info_sv.h
new file mode 100644
index 0000000..dec756d
--- /dev/null
+++ b/src/parsec_server/include/con_info_sv.h
@@ -0,0 +1,63 @@
+/*
+ * PARSEC HEADER: con_info_sv.h
+ */
+
+#ifndef _CON_INFO_SV_H_
+#define _CON_INFO_SV_H_
+
+
+// callback function type
+typedef int (*notify_callback_fpt)( GenObject *base );
+
+
+// access information for single object property (type/class field)
+
+struct proplist_s {
+
+ const char* propname; // name property can be accessed by
+ size_t propoffset; // offset of property in obj structure
+ int bmin; // minimum value of property
+ int bmax; // maximum value of property
+ int fieldtype; // field's data type
+ notify_callback_fpt notify_callback; // callback on field value changes
+};
+
+//NOTE:
+// bmin and bmax (value bounds) for all types other than
+// PROPTYPE_INT have to be specified in fixed-point!
+
+//NOTE:
+// for PROPTYPE_STRING and PROPTYPE_CHARPTR bmin and bmax specify
+// minimum and maximum number of chars (excluding the '\0').
+
+#define PROPTYPE_INT 0
+#define PROPTYPE_FLOAT 1
+#define PROPTYPE_GEOMV 2
+#define PROPTYPE_FIXED 3
+#define PROPTYPE_STRING 4
+#define PROPTYPE_CHARPTR 5
+
+
+// external functions
+
+void CON_RegisterCustomType( dword objtypeid, proplist_s *proplist );
+
+char* BuildTypeInfo( int typeindex );
+char* BuildClassInfo( int classindex );
+
+int CheckSetObjTypeProperty( const char *query, const char *scan );
+int CheckSetObjClassProperty( const char *query, const char *scan );
+int CheckSetObjInstanceProperty( const char *query, const char *scan );
+
+int CheckTypeInfo( const char *scan );
+int CheckClassInfo( const char *scan );
+int CheckInstanceInfo( const char *scan );
+
+int WritePropList( FILE* fp, dword objid );
+
+int Cmd_FaceInfo( const char *command );
+
+
+#endif // _CON_INFO_SV_H_
+
+
diff --git a/src/parsec_server/include/con_int_sv.h b/src/parsec_server/include/con_int_sv.h
new file mode 100644
index 0000000..e51f5d2
--- /dev/null
+++ b/src/parsec_server/include/con_int_sv.h
@@ -0,0 +1,59 @@
+/*
+ * PARSEC HEADER: con_int_sv.h
+ */
+
+#ifndef _CON_INT_SV_H_
+#define _CON_INT_SV_H_
+
+
+// integer commands table entry
+
+struct int_command_s {
+
+ int persistence; // persistent int commands are saved on exit
+ const char* command; // name of command
+ int bmin; // lower bound
+ int bmax; // upper bound
+ int* intref; // pointer to actual int var
+ void (*realize)(); // will be called after modification (optional)
+ int (*fetch)(); // will be called before reading (optional)
+ int default_val; // default value for int var
+};
+
+
+// integer commands list
+extern int_command_s * int_commands;
+
+// number of integer variable commands
+extern int num_int_commands;
+
+// integer input/output configuration
+extern const char * int_print_base;
+extern int int_calc_base;
+
+
+// macro to retrieve intvar command strings
+#define ICMSTR(x) (int_commands[x].command)
+
+// macro to retrieve string length of intvar commmands
+#define ICMLEN(x) strlen(int_commands[x].command)
+
+
+// position of console geometry variables in table
+enum {
+
+ CONINFOINDX_CONWINX = 0,
+ CONINFOINDX_CONWINY = 1,
+ CONINFOINDX_CONWIDTH = 2,
+ CONINFOINDX_CONHEIGHT = 3
+};
+
+
+// external functions
+
+void CON_RegisterIntCommand( int_command_s *regcom );
+
+
+#endif // _CON_INT_SV_H_
+
+
diff --git a/src/parsec_server/include/con_list_sv.h b/src/parsec_server/include/con_list_sv.h
new file mode 100644
index 0000000..c57ac20
--- /dev/null
+++ b/src/parsec_server/include/con_list_sv.h
@@ -0,0 +1,34 @@
+/*
+ * PARSEC HEADER: con_list_sv.h
+ */
+
+#ifndef _CON_LIST_SV_H_
+#define _CON_LIST_SV_H_
+
+
+// external functions
+
+void Cmd_ShipInfo();
+void Cmd_ListTypes();
+void Cmd_ListClasses();
+void Cmd_ListSayMacros();
+void Cmd_ListKeyBindings();
+void Cmd_ListKeyFunctions();
+void Cmd_ListVidModes();
+void Cmd_ListBinaryDemos();
+int Cmd_ListExternalCommands( char *command );
+int Cmd_ListDataTable( char *command );
+int Cmd_ListIntCommands( char *command );
+int Cmd_ListStdCommands( char *command );
+
+
+// external variables
+
+extern int await_keypress;
+extern void (*com_cont_func)();
+extern int cur_vis_conlines;
+
+
+#endif // _CON_LIST_SV_H_
+
+
diff --git a/src/parsec_server/include/con_load_sv.h b/src/parsec_server/include/con_load_sv.h
new file mode 100644
index 0000000..9870a3a
--- /dev/null
+++ b/src/parsec_server/include/con_load_sv.h
@@ -0,0 +1,16 @@
+/*
+ * PARSEC HEADER: con_load_sv.h
+ */
+
+#ifndef _CON_LOAD_SV_H_
+#define _CON_LOAD_SV_H_
+
+
+// external functions
+
+int Cmd_ExecLoadCommand( char *command );
+
+
+#endif // _CON_LOAD_SV_H_
+
+
diff --git a/src/parsec_server/include/con_main_sv.h b/src/parsec_server/include/con_main_sv.h
new file mode 100644
index 0000000..4482251
--- /dev/null
+++ b/src/parsec_server/include/con_main_sv.h
@@ -0,0 +1,168 @@
+/*
+ * PARSEC HEADER: con_main_sv.h
+ */
+
+#ifndef _CON_MAIN_SV_H_
+#define _CON_MAIN_SV_H_
+
+
+// if this is defined command parsing will be a lot slower
+//#define NO_UNNECESSARY_COMMAND_DOMAINS
+
+
+// maximum length of single console line
+#define MAX_CONSOLE_LINE_LENGTH 255
+
+// number of console lines (storage)
+#define NUM_CONSOLE_LINES 256
+#define NUM_CONSOLE_LINES_MASK ( NUM_CONSOLE_LINES - 1 )
+
+// number of history list lines
+#define NUM_HISTORY_LINES 128
+#define NUM_HISTORY_LINES_MASK ( NUM_HISTORY_LINES - 1 )
+
+// size of console prompt (in chars)
+#define PROMPT_SIZE 2
+
+
+
+// additional directories for console scripts
+#define REFCON_COMMANDS_DIR "refs/"
+#define STDCON_COMMANDS_DIR "cons/"
+#define RECORD_COMMANDS_DIR "recs/"
+
+
+// file extension of console scripts
+#define CON_FILE_EXTENSION ".con"
+
+
+// file extension of compiled console scripts
+#define CON_FILE_COMPILED_EXTENSION ".dem"
+
+
+// command domain restriction handling
+
+#ifdef NO_UNNECESSARY_COMMAND_DOMAINS
+
+ #define HANDLE_COMMAND_DOMAIN(x) \
+ if ( ( *(x) != ' ' ) && ( *(x) != 0 ) ) { \
+ return FALSE; \
+ } else { \
+ }
+
+ #define HANDLE_COMMAND_DOMAIN_SEP(x) HANDLE_COMMAND_DOMAIN(x)
+
+#else // NO_UNNECESSARY_COMMAND_DOMAINS
+
+ #define HANDLE_COMMAND_DOMAIN(x)
+
+ #define HANDLE_COMMAND_DOMAIN_SEP(x) \
+ if ( ( *(x) != ' ' ) && ( *(x) != 0 ) ) { \
+ CON_AddLine( unknown_command ); \
+ return TRUE; \
+ } else { \
+ }
+
+#endif // NO_UNNECESSARY_COMMAND_DOMAINS
+
+
+// external variables
+
+extern int compile_script;
+extern FILE * compile_fp;
+
+extern int con_back_view;
+extern int con_content;
+extern int con_bottom;
+extern int cursor_x;
+extern int press_space_curs_x;
+
+extern int con_in_talk_mode;
+extern int con_talk_line;
+extern char talk_escape_char;
+
+extern int con_non_interactive;
+
+extern int con_no_login_check;
+
+extern char con_prompt[];
+extern char ok_prompt[];
+extern char press_space[];
+extern char too_many_args[];
+extern char arg_missing[];
+extern char invalid_arg[];
+extern char range_error[];
+extern char unknown_command[];
+extern char line_separator[];
+
+extern char con_lines[][ MAX_CONSOLE_LINE_LENGTH + 1 ];
+
+
+// external functions
+
+/*
+void CheckConExtents();
+
+void EraseConLine( int line );
+
+void WritePersistentCommands();
+
+
+void FlushConsoleBuffer();
+
+int QuicksayConsole();
+void SetQuicksayConsole( int enable );
+
+void ConsoleControl();
+void ToggleConsole();
+
+void InitConsoleFileHandling();
+*/
+
+
+void ExecConsoleCommand( char *command, int echo );
+void ExecNonCompilableCommand( char *command );
+
+char* SubstCurWorkDir( char *path );
+void ClearConScreen();
+void CreateSeparatorLine( int line );
+
+void CON_AddMessage( const char *text );
+void CON_AddLine( const char *text );
+void CON_AddLineFeed();
+void CON_EnableLineFeed();
+void CON_DisableLineFeed();
+void CON_DelLine();
+char* CON_GetLine();
+void CON_ListCtdPrompt();
+void CON_ListEndPrompt();
+
+
+void ExecStartupScript( int echo );
+
+
+void CON_InitConsole();
+void CON_KillConsole();
+void CON_ConsoleMain();
+
+void CON_InitCurses();
+void CON_KillCurses();
+
+
+#ifdef USE_CURSES
+
+ #ifdef SYSTEM_WIN32_UNUSED
+ #include "libpdcurses/curses.h"
+ #else
+ #include <curses.h>
+ #endif
+
+ extern WINDOW* g_curses_in_win;
+ extern WINDOW* g_curses_out_win;
+
+#endif // USE_CURSES
+
+
+#endif // _CON_MAIN_SV_H_
+
+
diff --git a/src/parsec_server/include/con_std_sv.h b/src/parsec_server/include/con_std_sv.h
new file mode 100644
index 0000000..75d35a1
--- /dev/null
+++ b/src/parsec_server/include/con_std_sv.h
@@ -0,0 +1,120 @@
+/*
+ * PARSEC HEADER: con_std_sv.h
+ */
+
+#ifndef _CON_STD_SV_H_
+#define _CON_STD_SV_H_
+
+
+// standard commands table entry ----------------------------------------------
+//
+struct std_command_s {
+
+ const char* command; // command string
+ short commlen; // length of string
+ short numparams; // number of parameters (used by tab-completion)
+};
+
+
+// enumeration of standard commands -------------------------------------------
+//
+enum enum_std_commands {
+
+ CM_APPEND,
+ CM_BASE,
+ CM_BIND,
+ CM_BUILD,
+ CM_CAT,
+ CM_CLASSINFO,
+ CM_CLEAR,
+ CM_CLOSE,
+ CM_CLS,
+ CM_COLANIM,
+ CM_COMPILE,
+ CM_CONNECT,
+ CM_CREATE,
+ CM_DEC,
+ CM_DISABLE,
+ CM_NOMACROS,
+ CM_DISCONNECT,
+ CM_DISPLAY,
+ CM_ENABLE,
+ CM_ENABLEMACROS,
+ CM_EXIT,
+ CM_EXITGAME,
+ CM_FACEINFO,
+ CM_GAMELOOPBATCH,
+ CM_HEX,
+ CM_HIDE,
+ CM_KEY,
+ CM_LISTBINDINGS,
+ CM_LISTCLASSES,
+ CM_LISTSTDCOMMANDS,
+ CM_LISTDATA,
+ CM_LISTDEMOS,
+ CM_LISTGAMEFUNCKEYS,
+ CM_LISTINTCOMMANDS,
+ CM_LISTTEXTMACS,
+ CM_LISTTYPES,
+ CM_LOAD,
+ CM_LOGIN,
+ CM_LOGOUT,
+ CM_LISTEXTCOMMS,
+ CM_NAME,
+ CM_NET_SUBSYS,
+ CM_OBJECTCLEAR,
+ CM_OBJECTCOUNT,
+ CM_OBJECTINFO,
+ CM_OCT,
+ CM_OPEN,
+ CM_PATH_ANIM_INTRO,
+ CM_PATH_ASTREAM_INTRO,
+ CM_PATH_ASTREAM_MENU,
+ CM_PATH_ASTREAM,
+ CM_PLAYDEMO,
+ CM_PROP,
+ CM_PROPC,
+ CM_PROPO,
+ CM_QUIT,
+ CM_RECDEM,
+ CM_RECORD,
+ CM_REPINFO,
+ CM_REPSTOP,
+ CM_RESCAN,
+ CM_SAY,
+ CM_SET_MACRO,
+ CM_SETORIGIN,
+ CM_DEFSHADER,
+ CM_SETSHADER,
+ CM_SHIPS,
+ CM_SHOWPOSITION,
+ CM_TALKMODE,
+ CM_TYPEINFO,
+ CM_WORKINGDIRECTORY,
+ CM_WRITESTRING,
+
+ // must be last in list!!
+ NUM_STD_COMMAND_CONSTANTS
+};
+
+
+// command list and length array
+extern std_command_s std_commands[];
+
+// number of standard commands
+extern int num_std_commands;
+
+
+// macro to retrieve standard command strings
+#define CMSTR(x) (std_commands[x].command)
+
+// macro to retrieve string length of standard commmands
+#define CMLEN(x) (std_commands[x].commlen)
+
+// macro to determine number of arguments of standard commmands
+#define CMARG(x) (std_commands[x].numparams)
+
+
+#endif // _CON_STD_SV_H_
+
+
diff --git a/src/parsec_server/include/e_colldet.h b/src/parsec_server/include/e_colldet.h
new file mode 100755
index 0000000..9a9bf4e
--- /dev/null
+++ b/src/parsec_server/include/e_colldet.h
@@ -0,0 +1,75 @@
+/*
+* PARSEC HEADER: G_CollDet.h
+*/
+#include "g_emp.h"
+#ifndef _G_COLLDET_H_
+#define _G_COLLDET_H_
+
+// class handling the collision detection -------------------------------------
+//
+class G_CollDet
+{
+protected:
+
+ ShipObject* cur_ship;
+ Vertex3 obj_pos;
+ Vertex3 test_pos;
+ Vertex3 prev_pos;
+ geomv_t bd_sphere;
+ geomv_t bd_sphere2;
+ int test_shield;
+
+protected:
+
+ // collision detection helper function
+ int _CheckShipProjectileDisjoint();
+
+
+ // ship collided with laser
+ void _CollisionResponse_LaserShip( LaserObject *curlaser );
+
+ // check whether any ship is hit by laser beam
+ void _CheckShipLaserCollision();
+
+ // check if ship collected extra
+ void _CheckShipExtraCollision();
+
+ // check if ship hit by emp
+ void _CheckShipEmpCollision();
+
+ // ship collided with EMP
+ void _CollisionResponse_EmpShip( Emp *curemp );
+
+ //Ship collided with missile
+ void _CheckShipMissileCollision();
+ //response definitions
+ void _CollisionResponse_MissileShip( MissileObject *curmissile );
+ void _CollisionResponse_MineShip( Mine1Obj *curmine );
+ void OBJ_ShipHelixDamage( ShipObject *shippo, int owner );
+ void OBJ_ShipLightningDamage( ShipObject *shippo, int owner );
+ void OBJ_ShipPhotonDamage( ShipObject *shippo, int owner );
+
+ G_CollDet() {}
+ ~G_CollDet() {}
+
+public:
+ // SINGLETON pattern
+ static G_CollDet* GetGameCollDet()
+ {
+ static G_CollDet _TheGameCollDet;
+ return &_TheGameCollDet;
+ }
+
+ // perform collision detection tests
+ void OBJ_CheckCollisions();
+ void LinearParticleCollision( linear_pcluster_s *cluster, int pid );
+ void CheckEnergyField( pcluster_s *cluster );
+ void OBJ_ShipSwarmDamage( ShipObject *shippo, int owner );
+ int CheckLightningParticleShipCollision( Vertex3& particlepos, int owner );
+ //Particle Collisions
+ int PRT_ParticleInBoundingSphere( ShipObject *shippo, Vertex3& point );
+
+};
+
+#endif // _G_COLLDET_H_
+
diff --git a/src/parsec_server/include/e_connmanager.h b/src/parsec_server/include/e_connmanager.h
new file mode 100755
index 0000000..446a8ae
--- /dev/null
+++ b/src/parsec_server/include/e_connmanager.h
@@ -0,0 +1,247 @@
+/*
+* PARSEC HEADER: e_connmanager.h
+*/
+
+#ifndef _E_CONNMANAGER_H_
+#define _E_CONNMANAGER_H_
+
+// forward decls --------------------------------------------------------------
+//
+class E_GameServer;
+class E_PacketHandler;
+class E_SimPlayerInfo;
+
+
+// class holding the challenges sent to requesting clients --------------------
+//
+class E_ClientChallengeInfo
+{
+public:
+ int m_challenge;
+ node_t m_node;
+ refframe_t m_frame_generated;
+public:
+ E_ClientChallengeInfo() :
+ m_challenge( -1 ),
+ m_frame_generated( 0 )
+ {
+ memset( &m_node, 0, sizeof( node_t ) );
+ }
+};
+
+// class holding basic client information -------------------------------------
+//
+class E_BasicClientInfo
+{
+public:
+ int m_nVersionMajor;
+ int m_nVersionMinor;
+ char m_szName [ MAX_PLAYER_NAME + 1 ];
+ char m_szOSLine [ MAX_OSNAME_LEN + 1 ];
+ char m_szHostName[ MAX_HOSTNAME_LEN + 1 ];
+ node_t m_node;
+ int m_challenge;
+ int m_nRecvRate; // byte/sec. this client wants data
+ int m_nSendFreq; // packets/sec. this client sends data
+
+public:
+ E_BasicClientInfo ()
+ {
+ Reset();
+ }
+
+ void Reset()
+ {
+ m_nVersionMajor = -1;
+ m_nVersionMinor = -1;
+ memset( m_szName, 0, MAX_PLAYER_NAME + 1 );
+ memset( m_szOSLine, 0, MAX_OSNAME_LEN + 1 );
+ memset( m_szHostName, 0, MAX_HOSTNAME_LEN + 1 );
+ memset( &m_node, 0, sizeof( node_t ) );
+ m_challenge = -1;
+ m_nRecvRate = DEFAULT_CLIENT_RECV_RATE;
+ m_nSendFreq = DEFAULT_CLIENT_SEND_FREQUENCY;
+ }
+
+ // return the NET.SERVERRATE for this client
+ int GetRecvRate() { return m_nRecvRate; }
+
+ // return the NET.CLIENTRATE for this client
+ int GetSendFreq() { return m_nSendFreq; }
+};
+
+
+// class holding client information ( when connecting ) -----------------------
+//
+class E_ClientConnectInfo : public E_BasicClientInfo
+{
+public:
+ int m_selected_slot;
+public:
+ E_ClientConnectInfo() :
+ E_BasicClientInfo(),
+ m_selected_slot(-1)
+ {
+ }
+};
+
+
+// class holding client information ( when connected ) ------------------------
+//
+class E_ClientInfo : public E_BasicClientInfo
+{
+protected:
+ int m_slotfree;
+ int m_nAliveCounter;
+ E_SimPlayerInfo* m_pSimPlayerInfo;
+
+public:
+ E_ClientInfo() :
+ m_slotfree( TRUE ),
+ m_nAliveCounter( MAX_ALIVE_COUNTER ),
+ m_pSimPlayerInfo( NULL )
+ {
+ }
+
+ void CopyClientConnectInfo( E_ClientConnectInfo* pClientConnectInfo );
+
+ void Reset()
+ {
+ E_BasicClientInfo::Reset();
+
+ m_slotfree = TRUE;
+ m_nAliveCounter = MAX_ALIVE_COUNTER;
+ }
+
+ // mark the client alive
+ void MarkAlive();
+
+ // check whether the client is alive
+ int IsAlive();
+
+ // check whether the slot is free
+ int IsSlotFree() { return m_slotfree; }
+
+ // set the status of slot
+ void SetSlotFree( int slotfree ) { m_slotfree = slotfree; }
+};
+
+
+// connection manager class ---------------------------------------------------
+//
+class E_ConnManager
+{
+protected:
+
+ E_ClientChallengeInfo* m_ChallengInfos;
+ int m_nMaxNumChallengeInfos;
+ int m_nCurChallengeInfo;
+
+ E_ClientInfo* m_ClientInfos;
+ int m_nNumConnected;
+
+ int m_inDisconnectClient;
+
+ E_ConnManager();
+ ~E_ConnManager();
+
+public:
+
+ // SINGLETON pattern
+ static E_ConnManager* GetConnManager()
+ {
+ static E_ConnManager _TheConnManager;
+ return &_TheConnManager;
+ }
+
+ // request a challenge for a client
+ int RequestChallenge( node_t* clientnode );
+
+ enum ConnResults {
+ CONN_CHALLENGE_INVALID = 0,
+ CONN_CLIENT_INCOMAPTIBLE = 1,
+ CONN_CLIENT_BANNED = 2,
+ CONN_SERVER_FULL = 3,
+ CONN_NAME_TAKEN = 4,
+ CONN_OK = 5
+ };
+
+ enum DisconnResults {
+ DISC_NOT_CONNECTED = 0,
+ DISC_OK = 1
+ };
+
+ enum NameChangeResults {
+ NAMECHANGE_NOT_CONNECTED = 0,
+ NAMECHANGE_ALREADY_TAKEN = 1,
+ NAMECHANGE_OK = 2
+ };
+
+ // check whether the client connection is valid
+ int CheckClientConnect( E_ClientConnectInfo* pClientConnectInfo );
+
+ // check for a client disconnect
+ int CheckClientDisconnect( node_t* clientnode );
+
+ // check for a client namechange
+ int CheckNameChange( node_t* clientnode, char* newplayername );
+
+ // get the client information for a specific slot
+ E_ClientInfo* GetClientInfo( int nSlot );
+
+ // check the alive counter of all connected clients and disconnect any timed out clients
+ int CheckAliveStatus();
+
+ // check node of client with node used at connection
+ int CheckNodesMatch( int nClientID, node_t* node );
+
+ // return the # of connected clients
+ int GetNumConnected() { return m_nNumConnected; }
+
+ // set some client-info fields according to RE
+ void NET_ExecRmEvClientInfo( int nClientID, RE_ClientInfo* re_clientinfo );
+
+ // disconnect a client
+ int DisconnectClient( int nClientID );
+
+ // return the name of the client
+ char* GetClientName( int nClientID );
+
+protected:
+
+ // check if client version is compatible
+ int _IsClientCompatible( E_ClientConnectInfo* pClientConnectInfo );
+
+ // check if client is banned
+ int _IsClientBanned( E_ClientConnectInfo* pClientConnectInfo );
+
+ // check if challenge is correct
+ int _IsChallengeCorrect( E_ClientConnectInfo* pClientConnectInfo, E_ClientChallengeInfo** pChallengeInfo );
+
+ // ensure a client is not connected
+ int _EnsureClientIsDisconnected( E_ClientConnectInfo* pClientConnectInfo );
+
+ // connect a client
+ int _ConnectClient( E_ClientConnectInfo* pClientConnectInfo );
+
+ // change the name of a client
+ int _ChangeClientName( int nSlot, char* newplayername );
+
+ // send client connected notifications to the other clients
+ int _NotifyClientConnected( int nSlotConnected );
+
+ // send client disconnected notifications to the other clients
+ int _NotifyClientDisconnected( int nSlotDisconnected );
+
+ // send client namechange notifications to the other clients
+ int _NotifyClientNameChange( int nSlotNamechanged );
+
+ // find the assigned slot for a specific node
+ int _FindSlotWithNode( node_t* clientnode );
+
+ // find the slot of a connected client by its name
+ int _FindClientName( char* name );
+};
+
+
+#endif // _E_CONNMANAGER_H_
diff --git a/src/parsec_server/include/e_defs.h b/src/parsec_server/include/e_defs.h
new file mode 100644
index 0000000..e700c39
--- /dev/null
+++ b/src/parsec_server/include/e_defs.h
@@ -0,0 +1,45 @@
+/*
+ * PARSEC HEADER: e_defs.h
+ */
+
+#ifndef _E_DEFS_H_
+#define _E_DEFS_H_
+
+
+// ----------------------------------------------------------------------------
+// GAMESSERVER SUBSYSTEM (SVG) related definitions -
+// ----------------------------------------------------------------------------
+
+
+// default HTML file names ----------------------------------------------------
+//
+#define list_html_file "clients.html"
+#define header_html_file "g_header.html"
+#define footer_html_file "g_footer.html"
+
+// default log file names -----------------------------------------------------
+//
+#define log_file "gamesrv.log"
+#define cfg_file "server.cfg"
+
+
+// constants ------------------------------------------------------------------
+//
+
+// number of remote event lists
+#define NUM_RE_LISTS 5
+
+// size of masterserver queue
+#define MAX_MASTERS 3
+
+// maximum number of clients in the banlist
+#define MAX_BANNED_CLIENTS 128
+
+// number of players that have to be connected for a game to start
+#define MIN_PLAYERS_TO_START 2
+
+#include "net_ports.h"
+
+#endif // _E_DEFS_H_
+
+
diff --git a/src/parsec_server/include/e_gameserver.h b/src/parsec_server/include/e_gameserver.h
new file mode 100755
index 0000000..217e1a5
--- /dev/null
+++ b/src/parsec_server/include/e_gameserver.h
@@ -0,0 +1,204 @@
+/*
+* PARSEC HEADER: e_gameserver.h
+*/
+
+#ifndef _E_GAMESERVER_H_
+#define _E_GAMESERVER_H_
+
+// constants ------------------------------------------------------------------
+//
+#define MAX_MASTERSERVER_NAME MAX_HOSTNAME_LEN
+#define MAX_NUM_CLIENTS TheServer->GetMaxNumClients()
+
+#include <string.h>
+
+// class holding the server configuration -------------------------------------
+//
+class ServerConfig
+{
+private:
+ int m_SimFrequency; // frequency to run the sim
+protected:
+
+ // data that can be modified via commandline/cfg file
+ //char m_szSelectedInterfaceIP[ MAX_STRLEN_IPADDR ]; // string containing the selected interface IP ( NULL if default )
+ word m_nInterface; // zero based interface index
+ int m_MaintainFrequency; // frequency to run maintainance
+ int m_nPacketAverageSecs; // time to sample the average packetsize for optimal client update rate
+
+ int m_nMaxNumClients; // current max. # of players
+ char m_szServername[ MAX_SERVER_NAME + 1 ];// the servername
+
+ refframe_t m_ClientUpdateHeartbeat;
+
+ int m_ServerIsMaster;
+
+/* char location[ MAX_CFG_LINE + 1 ] = "not specified";
+ char admin_name[ MAX_CFG_LINE + 1 ] = "not specified";
+ char admin_email[ MAX_CFG_LINE + 1 ] = "not specified";
+ char server_info[ MAX_CFG_LINE + 1 ] = "";
+ char server_url[ MAX_CFG_LINE + 1 ] = "";
+ char messageline1[ MAX_CFG_LINE + 1 ] = "";
+ char messageline2[ MAX_CFG_LINE + 1 ] = "";
+ char messageline3[ MAX_CFG_LINE + 1 ] = "";
+ char messageline4[ MAX_CFG_LINE + 1 ] = "";
+
+ int time_limit = 0;
+ int time_startrefframes = 0;
+ int time_counter = GAME_NOTSTARTEDYET;
+ int counter_active = FALSE;
+ int wait_startrefframes = 0;
+
+ int kill_limit = 0;
+
+ char *banlist[ MAX_BANNED_CLIENTS ];
+ int num_banned = 0;
+*/
+
+public:
+ // standard ctor
+ ServerConfig();
+
+ // return the refframes to wait between client update heartbeats
+ refframe_t GetClientUpdateHeartbeat() { return m_ClientUpdateHeartbeat; }
+
+ // functions to set/get whether this server instance is a master server.
+ void SetServerIsMaster(bool isMaster);
+ bool GetServerIsMaster();
+
+ // set the servername
+ void SetServername( const char* pName )
+ {
+ strncpy( m_szServername, pName, MAX_SERVER_NAME );
+ m_szServername[ MAX_SERVER_NAME ] = 0;
+ }
+
+ // get the server name
+ const char* GetServerName() { return m_szServername; }
+
+ // set the # of max players
+ bool_t SetMaxNumClients( int nMaxNumClients );
+
+ // return the max # of players
+ int GetMaxNumClients();
+
+ // set the simulation frequency
+ bool_t SetSimFrequency( int nSimFrequency );
+
+ // return the simulation frequency
+ int GetSimFrequency();
+};
+
+// class for holding a server link --------------------------------------------
+//
+class E_ServerLinkInfo
+{
+public:
+ int m_serverid;
+ Vector3 m_pos;
+ Vector3 m_dir;
+
+ E_ServerLinkInfo()
+ {
+ Reset();
+ }
+
+ void Reset()
+ {
+ m_serverid = 0;
+ memset( &m_pos, 0, sizeof( Vector3 ) );
+ memset( &m_dir, 0, sizeof( Vector3 ) );
+ }
+};
+
+
+
+// main gameserver class ------------------------------------------------------
+//
+class E_GameServer : public ServerConfig
+{
+protected: // data
+
+ // internal data
+ refframe_t m_Maintain_FrameTime;
+ refframe_t m_SimTick_FrameTime; // duration in refframes of one simulation tick
+ int m_Select_Timeout; // timout for select (microseconds)
+ int m_ServerIdleTime_msec; // idle time ( select timeout ) of server
+
+ int m_nServerFrame; // the current server frame
+
+ refframe_t m_MaintainFrameBase;
+ refframe_t m_MasterServerFrameBase;
+ refframe_t m_PacketFrameBase;
+ refframe_t m_CurPacketRefFrames;
+
+ refframe_t m_CurServerRefFrame;
+ refframe_t m_LastServerRefFrame;
+
+ refframe_t m_MasterServer_FrameTime; // frametime for master server maintenance
+ char m_MasterServer_Hostname[ MAX_MASTERSERVER_NAME + 1];
+ int m_MasterServer_Challenge;
+ bool_t m_bMasterServer_NodeValid;
+ node_t m_MasterServer_Node;
+
+ E_ServerLinkInfo m_ServerLinks[ MAX_NUM_LINKS ];
+ int m_nNumServerLinks;
+
+ bool_t m_bQuit;
+protected: // methods
+
+ // init pre/post running of console script
+ int _InitPostConsoleScript();
+ int _InitPreConsoleScript();
+
+ // ------------------------------------------------------------------------
+ // main methods called in the server frame
+ // ------------------------------------------------------------------------
+ void _MaintainSimulation(); // maintain the simulation
+ int _MaintainHousekeeping(); // maintain clients ( client timeouts etc. )
+ int _MaintainMasterServer(); // maintain communication to master server
+
+ E_GameServer(); // standard ctor
+ ~E_GameServer(); // standard dtor
+
+public: // methods
+
+ // SINGLETON pattern
+ static E_GameServer* GetGameServer()
+ {
+ static E_GameServer _TheGameServer;
+ return &_TheGameServer;
+ }
+
+ int Init(); // init the server components
+ int Kill(); // kill the server components
+
+ int ParseCommandLine( int argc, char** argv ); // parse the command line
+
+ int PrintCopyRight(); // print copyright
+ int PrintUsage(); // print program usage
+
+ int MainLoop(); // server mainloop
+ refframe_t ServerFrame(); // server Frame
+
+ // set the new masterserver info
+ void SetMasterServerInfo( char* pName, refframe_t _MasterServer_FrameTime );
+
+ // check whether the supplied node matches the stored masterserver node
+ int IsMasterServerNode( node_t* node );
+
+ // set a new masterserver challenge
+ void SetMasterServerChallenge( int nMASVChallenge );
+
+ // add a serverlink
+ int AddServerLink( int serverid, Vector3* pos_spec, Vector3* dir_spec );
+
+ // accessor methods
+ refframe_t GetSimTickFrameTime() { return m_SimTick_FrameTime; }
+ int GetPacketAverageSecs() { return m_nPacketAverageSecs; }
+ refframe_t GetMasterServerFrameTime() { return m_MasterServer_FrameTime; }
+
+ void SetQuitFlag() { m_bQuit = TRUE; }
+};
+
+#endif // _E_GAMESERVER_H_
diff --git a/src/parsec_server/include/e_global_sv.h b/src/parsec_server/include/e_global_sv.h
new file mode 100755
index 0000000..4c313ca
--- /dev/null
+++ b/src/parsec_server/include/e_global_sv.h
@@ -0,0 +1,97 @@
+/*
+ * PARSEC HEADER: e_global_sv.h
+ */
+
+#ifndef _E_GLOBAL_SV_H_
+#define _E_GLOBAL_SV_H_
+
+
+// include data info tables -------------------------------
+
+#include "gd_tabs.h"
+
+// global externals (ENGINE CORE) -------------------------
+
+extern int NumLoadedObjects;
+
+extern objectinfo_s ObjectInfo[];
+
+extern char CurWorkDir[];
+
+
+extern char* sys_ProgramName;
+
+extern colrgba_s LightColorAmbient;
+extern colrgba_s LightColorDiffuse;
+extern colrgba_s LightColorSpecular;
+
+extern Vector3 GlobalDirLight;
+
+extern char* sys_ProgramName;
+
+#define VISFRAME_NEVER 0xFFFFFFFF
+
+extern int RecordingActive;
+extern FILE* RecordingFp;
+extern int RecordRemotePackets;
+extern int RemoteRecSessionId;
+extern int RemoteRecPacketId;
+
+extern int ConsoleSliding;
+extern int ConsoleHeight;
+
+extern GenObject* VObjList;
+extern GenObject* ObjClasses[];
+extern int NumObjClasses;
+
+extern dword NextObjNumber;
+
+extern int AuxEnabling[];
+extern int AuxData[];
+
+extern refframe_t RefFrameFrequency;
+
+
+
+// forward decls --------------------------------------------------------------
+//
+class G_CollDet;
+class G_ExtraManager;
+class G_Input;
+class G_Main;
+class NET_PacketDriver;
+class NET_UDPDriver;
+class E_DistManager;
+class E_SimNetInput;
+class E_SimNetOutput;
+class E_Simulator;
+class E_World;
+class E_ConnManager;
+class E_GameServer;
+class MasterServer;
+class E_PacketHandler;
+
+
+// global variables, these are set in SV_MAIN::main() and in E_GameServer::Init()
+//
+extern G_CollDet* TheGameCollDet;
+extern G_ExtraManager* TheGameExtraManager;
+extern G_Input* TheGameInput;
+extern G_Main* TheGame;
+extern NET_PacketDriver* ThePacketDriver;
+extern NET_UDPDriver* TheUDPDriver;
+extern E_DistManager* TheDistManager;
+extern E_World* TheWorld;
+extern E_SimNetInput* TheSimNetInput;
+extern E_SimNetOutput* TheSimNetOutput;
+extern E_Simulator* TheSimulator;
+extern E_ConnManager* TheConnManager;
+extern E_GameServer* TheServer;
+extern MasterServer* TheMaster;
+extern E_PacketHandler* ThePacketHandler;
+
+
+
+#endif // _E_GLOBAL_SV_H_
+
+
diff --git a/src/parsec_server/include/e_packethandler.h b/src/parsec_server/include/e_packethandler.h
new file mode 100755
index 0000000..bd283a1
--- /dev/null
+++ b/src/parsec_server/include/e_packethandler.h
@@ -0,0 +1,147 @@
+/*
+* PARSEC HEADER: e_packethandler.h
+*/
+
+#ifndef _E_PACKETHANDLER_H_
+#define _E_PACKETHANDLER_H_
+
+
+// forward decls --------------------------------------------------------------
+//
+struct PacketChainBlock;
+class NET_PacketDriver;
+class E_ClientChallengeInfo;
+class E_ClientConnectInfo;
+class E_REList;
+
+// needed includes ------------------------------------------------------------
+//
+#include "e_connmanager.h"
+#include "MasterServerItem.h"
+
+#ifndef _NET_GAME_H_
+ //FIXME: we MUST not depend on client module NET_GAME
+ //#include "net_game_sv.h"
+#endif // _NET_GAME_H_
+
+
+// Server packet handler class ------------------------------------------------
+//
+class E_PacketHandler
+{
+protected:
+
+ E_PacketHandler()
+ {
+ }
+
+public:
+
+ // SINGLETON pattern
+ static E_PacketHandler* GetPacketHandler()
+ {
+ static E_PacketHandler _ThePacketHandler;
+ return &_ThePacketHandler;
+ }
+
+ // main packet handling function
+ void HandlePacket( PacketChainBlock* block );
+
+ // send a challenge response back to a client
+ void SendChallengeResponse( E_ClientChallengeInfo* pChallengeInfo, node_t* clientnode );
+
+ // send a connect response back to a client
+ int SendConnectResponse( E_ConnManager::ConnResults rc, E_ClientConnectInfo* pClientConnectInfo );
+
+ // send a disconnect response back to a client
+ int SendDisconnectResponse( E_ConnManager::DisconnResults rc, node_t* clientnode, int nClientID );
+
+ // send a namechange response back to the client
+ int SendNameChangeRepsponse( E_ConnManager::NameChangeResults rc, node_t* clientnode, int nClientID );
+
+ // send a PING response back to the client
+ int SendPingResponse( refframe_t client_ping_send_frame, node_t* clientnode, int nClientID );
+
+ // send a INFO response back to the client
+ int SendInfoResponse( refframe_t client_ping_send_frame, node_t* clientnode, int nClientID );
+
+ // send IPV4 info to the client after a master server list command
+ int SendIPV4Response( node_t* clientnode, int nClientID, int serverid );
+
+ // notify a client that another client is connected
+ void SendNotifyConnected( int nDestSlot, int nClientSlot );
+
+ // notify a client that another client is disconnected
+ void SendNotifyDisconnected( int nDestSlot, int nClientSlot );
+
+ // notify a client that another client's name changed
+ void SendNotifyNameChange( int nDestSlot, int nClientSlot );
+
+
+ // send a STREAM packet to a client
+ size_t Send_STREAM( int nClientID, E_REList* pReliable, E_REList* pUnreliable );
+
+ // send a server command to a node
+ int Send_COMMAND( char* clientcommand, node_t* node, int nClientID, int reliable );
+
+ // send a datagram to a node
+ int Send_STREAM_Datagram( E_REList* relist, node_t* node, int nClientID );
+
+ // send a datagram command to a specific client node
+ int Send_COMMAND_Datagram( const char* clientcommand, node_t* node, int nClientID );
+
+ // multicast a packet to all connected clients
+ //void Multicast_Packet( NetPacket_GMSV* gamepacket, int nSenderClientID );
+
+protected:
+
+ // handle a command packet
+ void _Handle_COMMAND( NetPacket_GMSV* gamepacket, int bufid );
+
+ // handle a packet containing a command from the masterserver
+ void _Handle_COMMAND_MASV( NetPacket_GMSV* gamepacket, int bufid );
+
+ // handle a packet containing a command FOR the master server.
+ void _Handle_COMMAND_MASTER( NetPacket_GMSV* gamepacket, int bufid );
+
+ // handle a stream packet
+ void _Handle_STREAM( NetPacket_GMSV* gamepacket );
+
+ // handle a stream packet for the master server
+ void _Handle_STREAM_MASTER( NetPacket_GMSV* gamepacket, int bufid );
+
+ void _Send_STREAM();
+
+ // do safe parsing of challenge request
+ int _ParseChallengeRequest( char* recvline );
+
+ // do safe parsing of connect request
+ int _ParseConnectRequest( char* recvline, E_ClientConnectInfo* pClientConnectInfo );
+
+ // do safe parsing of disconnect request
+ int _ParseDisconnectRequest( char* recvline );
+
+ // do safe parsing of namechange request
+ int _ParseNameChangeRequest( char* recvline, char* playername );
+
+ // do safe parsing of PING request
+ int _ParsePingRequest( char* recvline, refframe_t* client_ping_send_frame );
+
+ // do safe parsing of INFO request
+ int _ParseInfoRequest( char* recvline, refframe_t* client_ping_send_frame );
+
+ // do safe parsing of LIST requests for Master Server Mode.
+ int _ParseListRequest_MASTER( char* recvline, int *serverid);
+
+ // do safe parsing of heartbeat packets for the Master Server.
+ int _ParseHBPacket_MASTER(char* recvline);
+
+ // check whether the sender node matches the node for the senderid
+ int _IsLegitSender( NetPacket_GMSV* gamepacket, int bufid );
+
+ // do safe parsing of new challenge from MASV
+ int _ParseMASVChallenge( char* recvline, int* pChallenge );
+};
+
+
+#endif // _E_PACKETHANDLER_H_
diff --git a/src/parsec_server/include/e_simnetinput.h b/src/parsec_server/include/e_simnetinput.h
new file mode 100755
index 0000000..889bcf8
--- /dev/null
+++ b/src/parsec_server/include/e_simnetinput.h
@@ -0,0 +1,48 @@
+#ifndef E_SIMNETINPUT_H_
+#define E_SIMNETINPUT_H_
+
+// forward decls --------------------------------------------------------------
+//
+class E_REList;
+//struct RE_Header;
+//struct ShipRemInfo;
+
+
+// class for handling the network input from the simulation -------------------
+//
+class E_SimNetInput {
+protected:
+ E_REList* m_pInputREList;
+
+protected:
+ // default ctor/dtor
+ E_SimNetInput();
+ ~E_SimNetInput();
+
+public:
+ // SINGLETON access
+ static E_SimNetInput* GetSimNetInput()
+ {
+ static E_SimNetInput _TheSimNetInput;
+ return &_TheSimNetInput;
+ }
+
+ // reset all data
+ void Reset();
+
+ // get the input remote event list
+ //E_REList* GetInputREList() { return m_pInputREList; }
+
+ // walk the input RE queue and apply events/states to simulation
+ void ProcessInputREList();
+
+ // handle the network input from a client
+ int HandleOneClient( int nClientID, RE_Header* relist );
+
+protected:
+ // check absolute movement bounds
+ int _CheckAbsoluteMovementBounds( RE_PlayerAndShipStatus* pPAS );
+};
+
+#endif // !E_SIMNETINPUT_H_
+
diff --git a/src/parsec_server/include/e_simnetoutput.h b/src/parsec_server/include/e_simnetoutput.h
new file mode 100755
index 0000000..db2441b
--- /dev/null
+++ b/src/parsec_server/include/e_simnetoutput.h
@@ -0,0 +1,361 @@
+#ifndef E_SIMNETOUTPUT_H_
+#define E_SIMNETOUTPUT_H_
+
+
+// update todos ---------------------------------------------------------------
+//
+#define UPDATE_TODO_NOTHING 0x0000
+#define UPDATE_TODO_SEND 0x0001
+#define UPDATE_TODO_MASK 0x0001
+
+// update mode ---------------------------------------------------------------
+//
+#define UPDATEMODE_SENDMODE_UNRELIABLE 0x0000
+#define UPDATEMODE_SENDMODE_RELIABLE 0x0010
+#define UPDATEMODE_SENDMODE_MASK 0x0010
+
+#define UPDATEMODE_SENDWHAT_STATE 0x0000
+#define UPDATEMODE_SENDWHAT_REMOVE 0x0020
+#define UPDATEMODE_SENDWHAT_MASK 0x0020
+
+#define UPDATEMODE_FLAGS_SEND_TO_OWNER 0x0100
+#define UPDATEMODE_FLAGS_MASK 0xFF00
+
+
+enum {
+
+ RMEVSTATE_NEBULAID,
+ RMEVSTATE_PROBEXTRA,
+ RMEVSTATE_PROBHELIX,
+ RMEVSTATE_PROBLIGHTNING,
+ RMEVSTATE_PROBPHOTON,
+ RMEVSTATE_PROBMINE,
+ RMEVSTATE_PROBREPAIR,
+ RMEVSTATE_PROBAFTERBURNER,
+ RMEVSTATE_PROBHOLODECOY,
+ RMEVSTATE_PROBINVISIBILITY,
+ RMEVSTATE_PROBINVULNERABILITY,
+ RMEVSTATE_PROBENERGYFIELD,
+ RMEVSTATE_PROBLASERUPGRADE,
+ RMEVSTATE_PROBLASERUPGRADE1,
+ RMEVSTATE_PROBLASERUPGRADE2,
+ RMEVSTATE_PROBMISSPACK,
+ RMEVSTATE_PROBDUMBPACK,
+ RMEVSTATE_PROBGUIDEPACK,
+ RMEVSTATE_PROBSWARMPACK,
+ RMEVSTATE_PROBEMPUPGRADE1,
+ RMEVSTATE_PROBEMPUPGRADE2,
+ RMEVSTATE_AMAZING,
+ RMEVSTATE_BRILLIANT,
+ RMEVSTATE_KILLLIMIT,
+ RMEVSTATE_ENERGYBOOST,
+ RMEVSTATE_REPAIRBOOST,
+ RMEVSTATE_DUMBPACK,
+ RMEVSTATE_HOMPACK,
+ RMEVSTATE_SWARMPACK,
+ RMEVSTATE_PROXPACK,
+
+ RMEVSTATE_NUMSTATES
+};
+
+// info about a E_Distributable -------------------------------------------------
+//
+class E_Distributable
+{
+protected:
+ dword m_objectid;
+ int m_listno;
+ int m_update_mode;
+ byte* m_update_to_client;
+public:
+ E_Distributable( dword objectid, int listno, int reliable, int send_to_owner ) :
+ m_objectid( objectid ),
+ m_listno( listno ),
+ m_update_mode( UPDATE_TODO_NOTHING ),
+ m_update_to_client( NULL )
+ {
+ // translate to internal format
+ if ( reliable ) {
+ m_update_mode |= UPDATEMODE_SENDMODE_RELIABLE;
+ }
+ if ( send_to_owner ) {
+ m_update_mode |= UPDATEMODE_FLAGS_SEND_TO_OWNER;
+ }
+
+ ResetUpdateInfo();
+ }
+
+ ~E_Distributable()
+ {
+ delete []m_update_to_client;
+ }
+
+ // reset the update info
+ void ResetUpdateInfo();
+
+ // get the object id
+ dword GetObjectID() { return m_objectid; }
+
+ // return the list # the object belongs to
+ int GetListNo() { return m_listno; }
+
+ // set updatemode for all clients to STATE
+ void UpdateMode_STATE();
+
+ // set updatemode for all clients to REMOVE
+ void UpdateMode_REMOVE();
+
+ // check whether this E_Distributable is marked as REMOVE
+ int IsInRemoving()
+ {
+ return ( ( m_update_mode & UPDATEMODE_SENDWHAT_MASK ) == UPDATEMODE_SENDWHAT_REMOVE );
+ }
+
+ // return whether the E_Distributable will be sent to the owner
+ int WillBeSentToOwner()
+ {
+ return ( ( m_update_mode & UPDATEMODE_FLAGS_SEND_TO_OWNER ) != 0 );
+ }
+
+ // check whether the E_Distributable is a ZOMBIE ( client has received the REMOVE update )
+ int IsZombie( int nClientID );
+
+ // check whethe the E_Distributable has an update for a specific client
+ int HasUpdate( int nClientID );
+
+ // mark, that we sent an update to a client
+ void MarkUpdateSent( int nClientID );
+
+ // mark, that we need to send an update to a client
+ void MarkForUpdate( int nClientID );
+
+ // check whether the E_Distributable should be sent reliable
+ int NeedsReliable()
+ {
+ return ( ( m_update_mode & UPDATEMODE_SENDMODE_MASK ) == UPDATEMODE_SENDMODE_RELIABLE );
+ }
+
+ // write a corresponding RE to the REList
+ void DistributeToREList( E_REList* relist );
+
+ // determine the size this E_Distributable is
+ size_t DetermineSizeInPacket();
+};
+
+
+
+
+
+// send modi for client updates -----------------------------------------------
+//
+#define SEND_MODE_NONE 0
+#define SEND_MODE_UNRELIABLE 1
+#define SEND_MODE_RELIABLE 2
+
+#define MAX_NUM_DISTRIBUTABLES_TO_SEND_PER_PACKET 256
+
+// information about packets sent out ( time and size ) -----------------------
+//
+struct sent_packet_info_s {
+
+ sent_packet_info_s()
+ {
+ Reset();
+ }
+
+ void Reset()
+ {
+ m_size = 0;
+ m_sendtime = 0;
+ }
+
+ size_t m_size;
+ refframe_t m_sendtime;
+};
+
+
+// class handling the network output for a client -----------------------------
+// class with all necessary information on what to send to the destination client
+class E_SimClientNetOutput
+{
+protected:
+
+ int m_nDestClientID;
+
+ E_REList* m_pReliableBuffer;
+ E_REList* m_pUnreliableBuffer;
+
+ sent_packet_info_s* m_SentPacketInfo;
+ unsigned int m_nPacket;
+
+ refframe_t m_LastSendFrame;
+ refframe_t m_Send_FrameTime;
+
+ refframe_t m_Heartbeat_Timeout_Frame;
+
+ int m_nNumPacketSlots;
+ int m_nAveragePacketSize;
+
+ // list of all distributables for the client
+ UTL_List<E_Distributable*>* m_AllDistributables;
+
+protected:
+
+ // list of client ids the client is to be updated in the next packet
+ int* m_ClientIDList;
+ bool_t* m_SendReliable;
+ int m_nNumClients;
+
+ // inidicate that we should send a the state of the client itself to the destination client ( energy, damage, shields )
+ bool_t m_bIncludeDestClientState;
+
+ // indicate whether to send the gamestate to the client
+ bool_t m_bIncludeGameState;
+
+ // indicate whether to send the killstats to the client
+ bool_t m_bIncludeKillStats;
+
+ //Indicate whether to send state variables to client
+ bool_t m_bIncludeStateSync;
+
+ // array of distributables for next packet
+ E_Distributable* m_DistsForNextPacket[ MAX_NUM_DISTRIBUTABLES_TO_SEND_PER_PACKET ];
+ int m_nNumDistsForNextPacket;
+
+ // # of byte available for the update
+ int m_nSizeAvail;
+
+public:
+
+ // default ctor/dtor
+ E_SimClientNetOutput();
+ ~E_SimClientNetOutput();
+
+ // connect a client
+ void Connect( int nClientID );
+
+ // disconnect a client
+ void Disconnect();
+
+ // sent udpate information to a client if bandwidth available
+ int SendUpdateToClient();
+
+ // the NET.SERVERRATE for this client has changed - recalc frame-time
+ void RateChanged();
+
+ // (re)calculate the average packet size
+ void CalculateAveragePacketSize();
+
+ // schedule a E_Distributable to be sent to the client
+ void ScheduleDistributable( E_Distributable* pDist, int check_unique = FALSE );
+
+ // buffer an RE for output
+ void BufferRE( RE_Header* re, int reliable );
+
+protected:
+
+ // reset all data members
+ void _Reset();
+
+ // clear the list of things to update
+ void _ClearUpdates();
+
+ // check whether there are any updates to send to the client
+ int _HasUpdates();
+
+ // add a E_Distributable to be sent out with the next packet
+ void _AddDistForOutput( E_Distributable* pDist );
+
+ // include the information about a client in the next update ( reliable or unreliable )
+ void _FlagIncludeClient( int nClientID, bool_t bReliable );
+
+ // check whether we can reserve size for output, and do so if space avail.
+ bool_t _ReserveForOutput( int size );
+
+ // fill the RE lists to be sent to the client
+ int _FillPacketForClient( E_REList* pReliable, E_REList* pUnreliable );
+
+ // getters/setters
+ size_t _GetSizeAvail() { return m_nSizeAvail; }
+
+ // check whether we should send a packet to this client
+ int _CanSendPacket();
+
+ // create buffer E_RELists for pass-through multicasts
+ void _CreateBuffers();
+
+ // terminate the multicast data in the E_REList buffers
+ void _TerminateBufferMulticast();
+
+ // determine which states must be updated for this client
+ int _PrepareClientUpdateInfo();
+
+ // check whether to send a heartbeat to the client
+ int _ShouldSendHeartbeat();
+
+ // set the new heartbeat timeout value
+ void _DoHeartbeat();
+};
+
+
+
+// class for handling the network output from the simulation ------------------
+//
+class E_SimNetOutput {
+protected:
+ E_SimClientNetOutput* m_SimClientNetOutput;
+ UTL_List<E_Distributable*>* m_Distributables;
+
+protected:
+ E_SimNetOutput();
+ ~E_SimNetOutput();
+
+public:
+ // SINGLETON access
+ static E_SimNetOutput* GetSimNetOutput()
+ {
+ static E_SimNetOutput _TheSimNetOutput;
+ return &_TheSimNetOutput;
+ }
+
+ // reset all data
+ void Reset();
+
+ // connect the player in a specific slot
+ int ConnectPlayer( int nClientID );
+
+ // disconnect the player in a specific slot
+ int DisconnectPlayer( int nClientID );
+
+ // update all clients
+ void DoClientUpdates();
+
+ // buffer a RE for sending to all clients minus sender
+ void BufferForMulticastRE( RE_Header* relist, int nSenderClientID, int reliable );
+
+ // buffer a RE for sending to a specific client
+ void BufferForDirectRE( RE_Header* relist, int nClientID, int reliable );
+
+ // update NET.SERVERRATE dependent stuff of E_SimClientNetOutput
+ void RateChangedForClient( int nClientID );
+
+ // recalculate the average packet sizes for all connected clients
+ void RecalcAveragePacketSizes();
+
+ // create a new E_Distributable for all connected clients
+ E_Distributable* CreateDistributable( GenObject* object, int reliable = FALSE, int send_to_owner = FALSE );
+
+ // release a E_Distributable
+ void ReleaseDistributable( E_Distributable* pDist );
+
+ // cleanup all distributables, that are complete zombies
+ void CleanupZombieDistributables();
+
+protected:
+ // destroy m_Distributables
+ void _DestroyDistributables();
+
+};
+
+
+#endif // !E_SIMNETOUTPUT_H_
diff --git a/src/parsec_server/include/e_simplayerinfo.h b/src/parsec_server/include/e_simplayerinfo.h
new file mode 100755
index 0000000..19e5afa
--- /dev/null
+++ b/src/parsec_server/include/e_simplayerinfo.h
@@ -0,0 +1,67 @@
+#ifndef E_SIMPLAYERINFO_H_
+#define E_SIMPLAYERINFO_H_
+
+
+// class holding all simulation specific player information -------------------
+//
+class E_SimPlayerInfo
+{
+protected:
+ int m_Status; // status of the player (inactive,connected,joined)
+ int m_objclass; // the objectclass selected as ship when joined
+
+ ShipObject* m_pShip;
+ int m_nShipID;
+ int m_nClientID;
+
+ int m_IgnoreJoinUntilUnjoinFromClient;
+public:
+ E_SimPlayerInfo()
+ {
+ Reset();
+ }
+
+ // reset all player fields to defaults ( not connected )
+ void Reset();
+
+ // check whether a player is disconnected
+ bool_t IsPlayerDisconnected() { return ( m_Status == PLAYER_INACTIVE ); }
+
+ // check whether a player is connected
+ bool_t IsPlayerConnected() { return ( m_Status == PLAYER_CONNECTED ); }
+
+ // check whether a player is joined in the game
+ bool_t IsPlayerJoined() { return ( m_Status == PLAYER_JOINED ); }
+
+ // set the desired player status ( inactive/joined/unjoined )
+ void SetDesiredPlayerStatus( RE_PlayerStatus* playerstatus );
+
+ // update tables and create ship for newly joined player
+ void PerformJoin( RE_PlayerStatus* pas_status );
+
+ // update tables and delete ship of player who unjoined
+ void PerformUnjoin( RE_PlayerStatus* playerstatus );
+
+ // set the player status to connected
+ void Connect( int nClientID );
+
+ // set the player status to disconnected
+ void Disconnect();
+
+ // set flag to ignore all joins until we get an unjoin from the client
+ void IgnoreJoinUntilUnjoinFromClient()
+ {
+ m_IgnoreJoinUntilUnjoinFromClient = TRUE;
+ }
+
+ // get a pointer to the ship object
+ ShipObject* GetShipObject() { return m_pShip; }
+
+ // get the object class of the ship
+ int GetShipObjectClass() { return m_objclass; }
+
+ // return the status of the player
+ int GetStatus() { return m_Status; }
+};
+
+#endif // E_SIMPLAYERINFO_H_
diff --git a/src/parsec_server/include/e_simulator.h b/src/parsec_server/include/e_simulator.h
new file mode 100755
index 0000000..c339cf4
--- /dev/null
+++ b/src/parsec_server/include/e_simulator.h
@@ -0,0 +1,286 @@
+/*
+* PARSEC HEADER: e_simulator.h
+*/
+
+#ifndef _E_SIMULATOR_H_
+#define _E_SIMULATOR_H_
+
+#include "net_util.h"
+#include "utl_math.h" // for playerlerp_s
+
+// forward decls --------------------------------------------------------------
+//
+class E_Distributable;
+class E_SimClientNetOutput;
+class E_ClientInfo;
+class E_GameServer;
+class E_REList;
+template <class T> class UTL_List;
+
+
+//FIXME:
+// gamecode stuff is skipped for now
+#define GAMECODE( x ) {}
+
+// gamecode2 is executed
+#define GAMECODE2( x ) x
+
+
+// class holding a ship state -------------------------------------------------
+//
+class E_SimShipState
+{
+protected:
+
+ Xmatrx m_ObjPosition;
+ fixed_t m_CurSpeed;
+ bams_t m_CurYaw;
+ bams_t m_CurPitch;
+ bams_t m_CurRoll;
+ geomv_t m_CurSlideHorz;
+ geomv_t m_CurSlideVert;
+
+public:
+ // standard ctor
+ E_SimShipState()
+ {
+ Reset();
+ }
+
+ // reset al data members
+ void Reset();
+
+ E_SimShipState& operator= ( E_SimShipState& _other )
+ {
+ ASSERT( FALSE );
+ return _other;//remove the warning without it
+ }
+
+ // copy from other
+ E_SimShipState& CopyFrom( E_SimShipState& _other )
+ {
+ memcpy( &m_ObjPosition, &_other.m_ObjPosition, sizeof( Xmatrx ) );
+ m_CurSpeed = _other.m_CurSpeed;
+ m_CurYaw = _other.m_CurYaw;
+ m_CurPitch = _other.m_CurPitch;
+ m_CurRoll = _other.m_CurRoll;
+ m_CurSlideHorz = _other.m_CurSlideHorz;
+ m_CurSlideVert = _other.m_CurSlideVert;
+
+ return *this;
+ }
+
+ // copy information from ShipRemInfo struct
+ void CopyFromPlayerAndShipStatus( RE_PlayerAndShipStatus& _other )
+ {
+ memcpy( &m_ObjPosition, &_other.ObjPosition, sizeof( Xmatrx ) );
+ m_CurSpeed = _other.CurSpeed;
+ m_CurYaw = _other.CurYaw;
+ m_CurPitch = _other.CurPitch;
+ m_CurRoll = _other.CurRoll;
+ m_CurSlideHorz = _other.CurSlideHorz;
+ m_CurSlideVert = _other.CurSlideVert;
+ }
+
+ // various get/set functions
+ pXmatrx GetObjPosition() { return m_ObjPosition; }
+
+ //FIXME: get rid of friend classes
+ friend class E_SimClientState;
+ friend class E_REList;
+};
+
+
+// class handling the network input for a client -----------------------------
+//
+class E_SimClientState {
+protected:
+ E_SimShipState* m_States;
+ int m_nNumStateSlots;
+
+ E_SimShipState m_InputState;
+ dword m_nInputStateMessageID;
+ dword m_nLastInputStateMessageId;
+
+ refframe_t m_LastSwitchToSimRefFrame;
+
+ int m_nClientID;
+
+ enum ClientMovementMode_t { CMM_SIMULATING, CMM_SMOOTHING };
+ ClientMovementMode_t m_ClientMovementMode;
+ playerlerp_s m_playerlerp;
+
+ bool_t m_ResyncClient;
+ bool_t m_ClientHasStateSync;
+
+public:
+ E_SimClientState()
+ {
+ m_States = NULL;
+ m_nNumStateSlots = -1;
+ m_nInputStateMessageID = 0;
+ m_nLastInputStateMessageId = 0;
+ m_ClientMovementMode = CMM_SIMULATING;
+ m_ResyncClient = FALSE;
+ m_LastSwitchToSimRefFrame = -1;
+ m_ClientHasStateSync = FALSE;
+ }
+
+ ~E_SimClientState()
+ {
+ Reset();
+ }
+
+ // reset all data-members
+ void Reset()
+ {
+ if ( m_States != NULL ) {
+ delete []m_States;
+ m_States = NULL;
+ }
+ m_nNumStateSlots = -1;
+ m_nInputStateMessageID = 0;
+ m_nLastInputStateMessageId = 0;
+ m_InputState.Reset();
+ m_ClientMovementMode = CMM_SIMULATING;
+ m_ResyncClient = FALSE;
+ m_LastSwitchToSimRefFrame = -1;
+ m_ClientHasStateSync = FALSE;
+ }
+
+ // connect a client
+ void Connect( int nClientID );
+
+ // disconnect a client
+ void Disconnect()
+ {
+ Reset();
+ }
+
+ // check the movement bounds between the last received state
+ int CheckMovementBounds( dword MessageID, RE_PlayerAndShipStatus* pPAS );
+
+ // store the received state as the newest
+ void StoreNewState( dword MessageID, RE_PlayerAndShipStatus* pPAS );
+
+ // reset the sim state
+ void ForceNewState( E_SimShipState* pSimShipState );
+
+ // either apply simulation or smoothing to get newest client-state
+ void CalcNewState( refframe_t CurSimRefFrames );
+
+ // dump some SimClientState for debugging purposes
+ void Dump();
+
+ // return the current/last simulation-state-slot
+ E_SimShipState* GetCurSimFrameStateSlot();
+ E_SimShipState* GetPrevSimFrameStateSlot();
+
+ // set the client resync flag ( RE_PLAYERANDSHIPSTATUS for this client sent from server to client )
+ void SetClientResync() { m_ResyncClient = TRUE; }
+
+ // clear the client resync flag
+ void ClearClientResync() { m_ResyncClient = FALSE; }
+
+ // check whether we must resync this client
+ int NeedsResync() { return m_ResyncClient; }
+
+ // Check whether state variables (nebula id, ammo pack sizes) have been sent
+ int HasState() { return m_ClientHasStateSync; }
+
+ void SetState() { m_ClientHasStateSync = TRUE; }
+
+protected:
+ // calculate the newest smooothing target
+ void _CalcNewSmoothingTarget();
+
+ // check whether the change from the last to the current state involved a movement
+ int _CheckForMovement( dword MessageID, RE_PlayerAndShipStatus* pPAS );
+
+ // update the message ids the lateste state comes from ( dead reckoning )
+ void _UpdateStateMessageID( dword MessageID );
+};
+
+
+// class for handling the overall simulation as well as all the states --------
+//
+class E_Simulator {
+protected:
+
+ refframe_t m_CurRefFrame; // the current RefFrame
+ refframe_t m_CurSimRefFrames; // refframes to advance in current sim step
+ refframe_t m_LastSimRefFrame; // last sim refframe
+
+ E_SimPlayerInfo* m_SimPlayerInfos;
+ E_SimClientState* m_SimClientState;
+
+ int m_nSimFrame;
+
+ // ctor/dtor
+ E_Simulator();
+ ~E_Simulator();
+
+public:
+ // SINGLETON access
+ static E_Simulator* GetSimulator()
+ {
+ static E_Simulator _TheSimulator;
+ return &_TheSimulator;
+ }
+
+ // main simulation method
+ int DoSim( refframe_t CurSimRefFrame );
+
+ // get the PlayerInfo for a client
+ E_SimPlayerInfo* GetSimPlayerInfo( int nClientID );
+
+ // return the current simulation refframe
+ refframe_t GetCurSimRefFrame() { return m_CurRefFrame; }
+
+ // return the refframes the simulation runs in this sim-frame
+ refframe_t GetThisFrameRefFrames() { return m_CurSimRefFrames; }
+
+ // get the SimClientState for a specific client
+ E_SimClientState* GetSimClientState( int nClientID );
+
+ // get the latest valid player
+ E_SimShipState* GetLatestSimShipState( int nClientID );
+
+ // reset all data
+ void Reset();
+
+ // connect the player in a specific slot
+ int ConnectPlayer( int nClientID );
+
+ // disconnect the player in a specific slot
+ int DisconnectPlayer( int nClientID );
+
+ // check whether a player in a slot is joined
+ int IsPlayerJoined( int nClientID );
+
+ // check whether a player in a slot is connected
+ int IsPlayerDisconnected( int nClientID );
+
+ // return the current simulation frame
+ int GetSimFrame() { return m_nSimFrame; }
+
+protected:
+
+ // update the shipstate ( according to the current sim refframes )
+ void _UpdateShipState( int nClientID );
+
+ // simulate ship movements
+ void _SimulateShips();
+
+ // calculate the refframes we want to apply to this simulation step
+ int _CalcSimRefFrames();
+
+ // apply the current sim-state to the engine state ( E_SimShipState -> ShipObject )
+ void _ApplySimToEngineState();
+
+ // apply the current engine state to the sim-state ( ShipObject -> E_SimShipState )
+ void _ApplyEngineToSimState();
+};
+
+
+#endif // _E_SIMULATOR_H_
diff --git a/src/parsec_server/include/e_world.h b/src/parsec_server/include/e_world.h
new file mode 100755
index 0000000..d69fa69
--- /dev/null
+++ b/src/parsec_server/include/e_world.h
@@ -0,0 +1,295 @@
+/*
+* PARSEC HEADER: E_WORLD.H
+*/
+
+#ifndef _E_WORLD_H_
+#define _E_WORLD_H_
+#include "parttype.h"
+
+// flags ----------------------------------------------------------------------
+//
+//#define _SERVER_HAS_PARTICLE_CODE
+
+// size of generic particle cluster
+#define DEFAULT_CLUSTER_SIZE 256
+
+// size of customdraw particle cluster
+#define DEFAULT_CUSTOMDRAW_CLUSTER_SIZE 32
+
+// size of genobject particle cluster
+#define DEFAULT_GENOBJECT_CLUSTER_SIZE 128
+
+// particle sphere rotation velocities
+#define SPHERE_ROT_PITCH 0x0015 //0x01a0
+#define SPHERE_ROT_YAW -0x0022 //-0x02a0
+#define SPHERE_ROT_ROLL 0x000d //0x0100
+
+// properties of pulsating sphere
+#define SPHERE_PULSE_AMPLITUDE FLOAT_TO_GEOMV( 12.0f )
+#define SPHERE_PULSE_FREQUENCY 90
+
+// properties of stochastic motion sphere
+#define SPHERE_STOCHASTIC_MOTION_SPEED 100
+
+// maximum number of registered particle definitions
+#define MAX_PARTICLE_DEFS 256
+
+#define PRTSB_ENERGYFIELD PRT_NO_SIZEBOUND
+// properties of energy field
+#define ENERGY_FIELD_INITIAL_RADIUS FLOAT_TO_GEOMV( 0.0625f )
+#define ENERGY_FIELD_LIFETIME 10000
+#define SPHERE_PARTICLE_COLOR 255
+
+// swarm behaviour constants --------------------------------------------------
+//
+#define NUM_PARTICLES 15 // number of particles in swarm
+#define TIME_POSITIONS 3 // number of time positions recorded
+#define PARTICLE_ACCEL FLOAT_TO_GEOMV( 0.8f ) // acceleration of particles
+#define PARTICLE_VELOCITY FLOAT_TO_GEOMV( 2.0f ) // maximum particle velocity
+#define PARTICLE_REFZ 300.0f // particle refz
+#define PARTICLE_LIFETIME 3000 // average lifetime of particles
+#define LIFETIME_VARIANCE 400 // a small variance to avoid that all particles
+// vanish at the same time
+#define ANIM_TIMESLICE 6 // animate as if CurScreenRefFrames == 6
+#define LIFETIME_AFTEREXPL 1200 // lifetime of particles after ship destruction
+
+
+// swarm state structure ------------------------------------------------------
+//
+struct swarm_state_s {
+
+ int num; // number of particles
+ Point3h_f* pos; // current particle positions
+
+ geomv_t* x; // particle position x[ time ][ partnum ]
+ geomv_t* y; // particle position y[ time ][ partnum ]
+ geomv_t* z; // particle position z[ time ][ partnum ]
+
+ geomv_t* xv; // particle velocities xv[ partnum ]
+ geomv_t* yv; // particle velocities xv[ partnum ]
+ geomv_t* zv; // particle velocities xv[ partnum ]
+
+ geomv_t tx[ 3 ]; // target positions x
+ geomv_t ty[ 3 ]; // target positions y
+ geomv_t tz[ 3 ]; // target positions z
+
+ ShipObject* targetpo; // the target object
+ refframe_t timerest; // excess time from last animation frame
+ GenObject dummyobj; // just for sound position tracking
+};
+
+// photon properties
+#define MIN_PHOTON_ENERGY 10
+#define PHOTON_ENERGY_CONSUMPTION 0x6000 // 0x10000 = 1.0
+
+#define PHOTON_ROT_PITCH 0x0015 //0x01a0
+#define PHOTON_ROT_YAW -0x0022 //-0x02a0
+#define PHOTON_ROT_ROLL 0x000d //0x0100
+
+#define PHOTON_SPHERE_PARTICLES 256
+#define PHOTON_COLOR 123
+#define PHOTON_REF_Z 75.0
+#define PHOTON_CONTRACTION_TIME 50
+#define PHOTON_CONTRACTION_SPEED FIXED_TO_GEOMV( 0xA000 )
+#define PHOTON_MAX_LOADING_TIME 1800
+#define PHOTON_NUMLOADS 32
+
+// helper macros --------------------------------------------------------------
+//
+#define X( t, b ) ( swarm->x[ ( t ) * swarm->num + ( b ) ] )
+#define Y( t, b ) ( swarm->y[ ( t ) * swarm->num + ( b ) ] )
+#define Z( t, b ) ( swarm->z[ ( t ) * swarm->num + ( b ) ] )
+#define balance_rand( v ) ( ( SWARM_rand() % v ) - ( ( v ) / 2 ) )
+
+#define LIGHTNING_SIZZLE_SPEED 10
+
+static unsigned long int nextrand = 1;
+
+int SWARM_rand();
+void SWARM_srand( unsigned int seed );
+void SWARM_TimedAnimate( callback_pcluster_s* cluster );
+
+// class representing the PARSEC game world -----------------------------------
+//
+class E_World
+{
+public:
+
+ // singly-linked lists for specific kinds of geometric objects ------------
+ //
+ ShipObject* m_PShipObjects; // list of existing spacecraft objects
+ LaserObject* m_LaserObjects; // list of existing laser objects
+ MissileObject* m_MisslObjects; // list of existing missile objects
+ ExtraObject* m_ExtraObjects; // list of existing extras (power-ups)
+ CustomObject* m_CustmObjects; // list of existing custom objects
+
+ int m_last_summoned_objectid; // object id of last object summoned
+
+ // client -> e_global.h
+ // current and maximum number of extras
+ int m_nCurrentNumExtras;
+ int m_nCurrentNumPrtExtras;
+
+ // next object number available
+ dword NextObjNumber; // 0 is free for special purposes
+
+ // table of object classes (from which objects can be instantiated) -----------
+ //
+ GenObject* ObjClasses[ MAX_DISTINCT_OBJCLASSES ];
+
+ // counters for concurrently displayed laser objects ---------------------
+ int MaxNumShots;
+ int NumShots;
+
+protected:
+ int _CountGenObjects( GenObject* walklist );
+
+ // free memory occupied by an object
+ void _FreeObjectMem( GenObject* objectpo );
+
+ // invoke constructor of custom object
+ void _InvokeCustomConstructor( GenObject* objectpo );
+
+ // invoke destructor of custom object
+ void _InvokeCustomDestructor( GenObject* objectpo );
+
+ // kill all instances of passed in object class (search only one list)
+ //
+ int _KillClassInstancesFromList( int objclass, GenObject *listpo );
+
+ // init object maintenance structures
+ void _InitObjCtrl();
+
+ //Cluster behaviour
+ void AnimateClusterBehavior( pcluster_s *cluster );
+ void CalcConstantVelocityAnimation( linear_pcluster_s *cluster );
+ void CalcSphereParticlePosition( Vertex3& position, geomv_t radius, int spheretype );
+ void CalcSphereParticleExplosion( Vertex3& position, geomv_t speed );
+ void CalcSpherePulse( Vertex3& position, Vertex3& pulsebase, geomv_t pulseval );
+ int CalcSphereContraction( Vertex3& position, geomv_t speed );
+ void CalcSphereParticleRotation( Vertex3& position, bams_t pitch, bams_t yaw, bams_t roll );
+ void CalcSphereObjectAnimation( sphereobj_pcluster_s *cluster );
+ void CalcCallbackTrajectoryAnimation( callback_pcluster_s *cluster );
+ void CalcLightningAnimation( lightning_pcluster_s *cluster );
+ void SetLightningParticlePosition( lightning_pcluster_s *cluster, particle_s particles[], Vertex3& current, Xmatrx tmatrx );
+ //Particle disable/delete
+ void DisableParticle( pcluster_s *cluster, int pid );
+ void PRT_DeleteCluster (pcluster_s* cluster);
+ void PRT_RemoveClusterFromAttachedList (objectbase_pcluster_s* cluster);
+
+
+ // standard ctor
+ E_World();
+
+public:
+
+ // SINGLETON access
+ static E_World* GetWorld()
+ {
+ static E_World _TheWorld;
+ return &_TheWorld;
+ }
+
+ // correct pointers that have moved after object was instantiated
+ void OBJ_CorrectObjectInstance( GenObject *dstobj, GenObject *srcobj );
+
+ CustomObject *CreateVirtualObject( dword objtypeid, dword dwOwner );
+
+ // create object of class at position with orientation
+ GenObject* CreateObject( int objclass, const Xmatrx startmatrx, dword dwOwner );
+
+ // kill object contained in specific object list (search only one list)
+ int KillSpecificObject( dword objno, GenObject *listpo );
+
+ // kill a specific ship object from a list
+ int KillSpecificShipObject( dword objno );
+
+ // object counting
+ int GetNumShipObjects() { return _CountGenObjects( m_PShipObjects ); }
+ int GetNumLaserObjects() { return _CountGenObjects( m_LaserObjects ); }
+ int GetNumMisslObjects() { return _CountGenObjects( m_MisslObjects ); }
+ int GetNumExtraObjects() { return _CountGenObjects( m_ExtraObjects ); }
+ int GetNumCustmObjects() { return _CountGenObjects( m_CustmObjects ); }
+
+ // return the object id of the last object that was summoned
+ int GetLastSummonedObjectID() { return m_last_summoned_objectid; }
+
+ // return pointer to first "real" ship in ship-objects list
+ ShipObject* FetchFirstShip();
+
+ // return pointer to first laser in laser-objects list
+ LaserObject* FetchFirstLaser() { return (LaserObject*) m_LaserObjects->NextObj; }
+
+ // return pointer to first missile in missile-objects list
+ MissileObject* FetchFirstMissile() { return (MissileObject*) m_MisslObjects->NextObj; }
+
+ // return pointer to first extra in extra-objects list
+ ExtraObject* FetchFirstExtra() { return (ExtraObject *) m_ExtraObjects->NextObj; }
+
+ // return pointer to first custom object in custom-objects list
+ CustomObject* FetchFirstCustom() { return (CustomObject *) m_CustmObjects->NextObj; }
+
+ // fetch object contained in specific object list
+ GenObject* FetchSpecificObject( dword objno, GenObject* listpo );
+
+ // fetch object via object id (search in all object lists)
+ GenObject* FetchObject( dword objno );
+ GenObject* SWARM_Init( int owner, Vertex3 *origin, ShipObject *targetpo, int randseed );
+
+ // free memory occupied by an object
+ void FreeObjectMem( GenObject *objectpo );
+
+ // free all object memory blocks contained in specific list
+ int FreeObjList( GenObject* listpo );
+
+ // free all object memory blocks
+ int FreeObjects();
+
+ // free all objects and particles
+ void KillAllObjects();
+
+ // kill all instances of passed in object class (search in all object lists)
+ int KillClassInstances( int objclass );
+
+ //FIXME: here ?
+ void IncreaseShotCounter();
+
+ //FIXME: here ?
+ void DecreaseShotCounter();
+
+ //Energy Field
+ void SFX_CreateEnergyField( Vertex3& origin );
+
+ //particle man
+ void InitParticleSystem();
+ void PRT_InitParticle (particle_s& particle,int color,int sizebound,float refz,Vertex3* position,Vector3* velocity, int lifetime,int owner,pextinfo_s* extinfo);
+ void PRT_InitClusterParticle (pcluster_s* cluster,int pid,int bitmap,int color, int sizebound,float refz,Vertex3* position,Vector3* velocity,int lifetime,int owner,pextinfo_s* extinfo);
+ void PRT_AttachClusterToObject( GenObject* genobjpo, objectbase_pcluster_s* cluster );
+ int PRT_DeleteAttachedClustersOfType( const GenObject * genobjpo, int animtype );
+ void PRT_DeleteCluster_NoListRemoval( pcluster_s* cluster );
+
+ // allocate new particle cluster and insert into list -------------------------
+ //
+ pcluster_s* PRT_NewCluster (dword type, int numelements, size_t auxstorage);
+
+ particle_s* PRT_CreateLinearParticle (particle_s& particle);
+ sphereobj_pcluster_s* PRT_CreateParticleSphereObject (Vertex3& origin,geomv_t radius,int animtype,int clustersiz,int lifetime,pdrwinfo_s* pdinfo,int owner);
+
+ pdef_s* PRT_AcquireParticleDefinitionById(int pdefid );
+ pdef_s* PRT_AcquireParticleDefinition(const char* pdefname,int* retpdefid);
+ objectbase_pcluster_s* PRT_ObjectHasAttachedClustersOfType( GenObject* genobjpo, int animtype );
+
+ //Particle Animation call
+ void PAN_AnimateParticles();
+ int SWARM_Animate( callback_pcluster_s* cluster );
+
+ //Lightning particles
+ lightning_pcluster_s* CreateLightningParticles( ShipObject *shippo, int owner );
+
+ //Photon
+ photon_sphere_pcluster_s* CreatePhotonSphere( ShipObject *shippo );
+ void CalcPhotonSphereAnimation( photon_sphere_pcluster_s *cluster );
+};
+
+#endif // _E_WORLD_H_
+
diff --git a/src/parsec_server/include/e_world_trans.h b/src/parsec_server/include/e_world_trans.h
new file mode 100755
index 0000000..57b85e0
--- /dev/null
+++ b/src/parsec_server/include/e_world_trans.h
@@ -0,0 +1,33 @@
+/*
+* PARSEC HEADER: e_world_trans.h
+*/
+
+#ifndef _E_WORLD_TRANS_H_
+#define _E_WORLD_TRANS_H_
+
+#ifdef PARSEC_SERVER
+
+ // macros for migration purposes ------------------------------------------
+ //
+ #define PShipObjects TheWorld->m_PShipObjects
+ #define LaserObjects TheWorld->m_LaserObjects
+ #define MisslObjects TheWorld->m_MisslObjects
+ #define ExtraObjects TheWorld->m_ExtraObjects
+ #define CustmObjects TheWorld->m_CustmObjects
+
+ #define CreateObject TheWorld->CreateObject
+ #define FreeObjList TheWorld->FreeObjList
+ #define KillAllObjects TheWorld->KillAllObjects
+ #define FetchObject TheWorld->FetchObject
+ #define FetchFirstShip TheWorld->FetchFirstShip
+ #define FetchFirstLaser TheWorld->FetchFirstLaser
+ #define FetchFirstMissile TheWorld->FetchFirstMissile
+ #define FetchFirstExtra TheWorld->FetchFirstExtra
+ #define FetchFirstCustom TheWorld->FetchFirstCustom
+ #define KillClassInstances TheWorld->KillClassInstances
+
+ #define ObjClasses TheWorld->ObjClasses
+
+#endif // PARSEC_SERVER
+
+#endif // _E_WORLD_TRANS_H_
diff --git a/src/parsec_server/include/g_main_sv.h b/src/parsec_server/include/g_main_sv.h
new file mode 100755
index 0000000..2215e9a
--- /dev/null
+++ b/src/parsec_server/include/g_main_sv.h
@@ -0,0 +1,275 @@
+/** PARSEC HEADER: g_main_sv.h
+*/
+
+#ifndef _G_MAIN_H_
+#define _G_MAIN_H_
+
+
+// join position control ------------------------------------------------------
+//
+#define JP_M_S_D 500 // minimum join position distance
+#define JP_RANGE 1000 // maximum join position range
+#define JP_OFS (JP_RANGE/2)
+
+
+// afterburner constants ------------------------------------------------------
+//
+#define AFTERBURNER_SPEED 150000
+#define AFTERBURNER_ENERGY 2400
+
+
+// forward decls --------------------------------------------------------------
+//
+template <class T> class UTL_List;
+class G_Player;
+class E_SimShipState;
+
+// default gametime limits ----------------------------------------------------
+//
+#define DEFAULT_GAME_TIMELIMIT_SEC 600
+#define DEFAULT_RESTART_TIMELIMIT_SEC 15
+#define DEFAULT_KILL_LIMIT 10
+
+// class handling the gametime management -------------------------------------
+//
+class G_TimeManagement
+{
+protected:
+
+ int GameIsEndless;
+ refframe_t m_GameEndRefFrames; // refframes for timelimit
+ refframe_t m_GameRefFrames; // refframes of current game
+ refframe_t m_RestartRefFrames; // refframes of current restart timeout
+
+ refframe_t m_RefFrameBase;
+
+ int m_nSecGameTimeLimit; // timelimit for the game in sec.
+ int m_nSecRestartTimeLimit; // time to wait between restarts in sec.
+public:
+ G_TimeManagement();
+
+ // realize console variables
+ void RealizeVariables();
+
+ // reset the game time management
+ void Reset();
+
+ // start a game
+ void StartGame();
+
+ // stop the game ( time limit hit )
+ void StopGame_TimeLimit();
+
+ // stop the game ( kill limit hit )
+ void StopGame_KillLimit();
+
+ // return whether the game is not yet started
+ int IsNotYetStarted();
+
+ // return whether currently a game is running
+ int IsGameRunning();
+
+ // return whether the game is finished
+ int IsGameFinished();
+
+ // check whether the game time limit is hit
+ int IsGameTimeLimitHit();
+
+ // check whether the restart timeout is over
+ int IsRestartTimeoutOver();
+
+ // return the current gametime in secs or special gametime codes
+ int GetCurGameTime();
+};
+
+
+// class holding the parsec game code -----------------------------------------
+//
+class G_Main
+{
+public:
+
+ int EnergyExtraBoost;
+ int RepairExtraBoost;
+ int DumbPackNumMissls;
+ int HomPackNumMissls;
+ int SwarmPackNumMissls;
+ int ProxPackNumMines;
+
+ int MegaShieldStrength;
+
+ int m_NebulaID;
+
+ G_Player* m_Players;
+ UTL_List<G_Player*>* m_CurConnectedPlayerList; // linked list of all currently connected players
+ UTL_List<G_Player*>* m_CurJoinedPlayerList; // linked list of all currently joined players
+
+ G_TimeManagement m_TimeManager;
+ int m_nKillLimit;
+
+protected:
+ // default ctor/dtor
+ G_Main();
+ ~G_Main();
+
+ // walk list of extra objects and advance them ( also handle timeout )
+ void _WalkExtraObjects();
+
+ void _WalkCustomObjects();
+
+ // walk list of laser objects and advance them ( also handle timeout )
+ void _WalkLaserObjects();
+
+ //walk list of missile objects and advance them
+ void _WalkMissileObjects();
+
+ //Do particle weapon maintenence
+ void MaintainDurationWeapons( int playerid );
+
+public:
+
+ // SINGLETON pattern
+ static G_Main* GetGame()
+ {
+ static G_Main _TheGame;
+ return &_TheGame;
+ }
+
+ void Init();
+
+ // connect a player
+ void ConnectPlayer( int nClientID );
+
+ // disconnect a player
+ void DisconnectPlayer( int nClientID );
+
+ // join a player ( init join position )
+ void JoinPlayer( int nClientID, E_SimShipState* pSimShipState );
+
+ // unjoin a player
+ void UnjoinPlayer( int nClientID );
+
+ // return the # of joined players
+ int GetNumJoined();
+
+ // retrieve the # of kills by this player
+ int GetPlayerKills( int nClientID );
+
+ // retrieve the last unjoin flag of the player
+ int GetPlayerLastUnjoinFlag( int nClientID );
+
+ // retrieve the last killer of the player
+ int GetPlayerLastKiller( int nClientID );
+
+ // record a kill of another client
+ void RecordKill( int nClientID );
+
+ // record a death of the client
+ void RecordDeath( int nClientID, int nClientID_Killer );
+
+ // reset the death info of the client
+ void ResetDeathInfo( int nClientID );
+
+ // get the playerinfo ( GAME )
+ G_Player* GetPlayer( int nClientID );
+
+ // return a list of currently connected players
+ UTL_List<G_Player*>* GetCurConnectedPlayerList() { return m_CurConnectedPlayerList; }
+
+ // return a list of currently joined players
+ UTL_List<G_Player*>* GetCurJoinedPlayerList() { return m_CurJoinedPlayerList; }
+
+ // maintain weapon firing delays
+ void MaintainWeaponDelays();
+
+ // maintain the game
+ void MaintainGame();
+
+ // animate projectile objects (lasers and missiles)
+ void OBJ_AnimateProjectiles();
+
+ // animate non-projectile objects (extras, mines)
+ void OBJ_AnimateNonProjectiles();
+
+ // for maintaining countes on special powerups for players
+ void MaintainSpecialsCounters( );
+
+ //Duration weapons
+ void FireDurationWeapons();
+
+ // create actual laser object
+ LaserObject* OBJ_CreateLaserObject( ShipObject *shippo, int curlevel, int barrel, int nClientID );
+
+ // create actual dumb missile object
+ MissileObject* OBJ_CreateMissileObject( ShipObject *pShip, int barrel, int nClientID );
+
+ // create actual homing missile object
+ MissileObject* OBJ_CreateHomingMissileObject( ShipObject *pShip, int barrel, int nClientID, dword targetid );
+
+ // create actual mine object
+ MineObject* OBJ_CreateMineObject( ShipObject *pShip, int nClientID );
+
+ // create actual swarm object
+ GenObject* OBJ_CreateSwarm( ShipObject *pShip, int nClientID, dword targetid );
+
+
+ // check availability of specified device
+ int OBJ_DeviceAvailable( ShipObject* pShip, int mask );
+
+ // return the current gametime in secs or special gametime codes
+ int GetCurGameTime() { return m_TimeManager.GetCurGameTime(); }
+
+ // return whether a game
+ int IsGameRunning() { return m_TimeManager.IsGameRunning(); }
+
+ // realize game vars from console vars
+ void RealizeVariables();
+
+ // create a stargate for a specific server at a position, with a direction
+ void CreateStargate( int serverid, Vector3* pos_spec, Vector3* dir_spec );
+
+protected:
+
+ // reset all player game vars
+ void _ResetPlayerVars();
+};
+
+// class for handling game input ----------------------------------------------
+//
+class G_Input
+{
+protected:
+ G_Input() {}
+ ~G_Input() {}
+
+public:
+ // SINGLETON pattern
+ static G_Input* GetGameInput()
+ {
+ static G_Input _TheGameInput;
+ return &_TheGameInput;
+ }
+
+ // activate the selected gun for a client
+ void ActivateGun( int nClientID, int SelectedGun );
+
+ // deactivate the selected gun for a client
+ void DeactivateGun( int nClientID, int SelectedGun );
+
+ // launch a dumb or homing missle
+ void LaunchMissile( int nClientID, dword targetid, int missileclass );
+
+ // launch a mine
+ void LaunchMine( int nClientID );
+
+ //Swarms
+ void LaunchSwarm(int nClientID, dword targetid);
+
+ // EMP
+ void CreateEMP(int nClientID, byte UpgradeLevel);
+
+};
+
+
+#endif // _G_MAIN_H_
+
diff --git a/src/parsec_server/include/g_player.h b/src/parsec_server/include/g_player.h
new file mode 100755
index 0000000..870ce80
--- /dev/null
+++ b/src/parsec_server/include/g_player.h
@@ -0,0 +1,148 @@
+// class holding all GAME specific player information -------------------------
+//
+// helix energy properties
+#define HELIX_LIFETIME 1500
+#define HELIX_SPEED 0x10000
+#define MIN_HELIX_ENERGY 10
+#define HELIX_ENERGY_CONSUMPTION 2
+// properties of spreadfire particles Also move this someday
+#define SPREADFIRE_PARTICLE_COLOR 174
+#define SPREADFIRE_BM_INDX BM_FIREBALL1
+#define SPREADFIRE_REF_Z 20.0f //400.0f
+// lightning energy properties
+#define MIN_LIGHTNING_ENERGY 10
+#define LIGHTNING_ENERGY_CONSUMPTION 7000 // 65536 = 1.0
+
+class G_Player
+{
+ //NOTE: this class mirrors all information/actions of a single client ( in the client code )
+
+protected:
+
+ int m_nKills; // # of ships this player killed
+ int m_nDeaths; // # of deaths for this player
+ int m_nPoints; // # of points for this player
+ int m_nLastUnjoinFlag; // the last unjoin flag
+ int m_nLastKiller; // the playerid of last killer
+
+ refframe_t m_FireDisableFrames; // refframes gun-fire is disabled ( = G_GLOBAL::FireDisable in old CLIENT code )
+ refframe_t m_MissileDisableFrames; // refframes missile-fire is disabled ( = G_GLOBAL::MissileDisable in old CLIENT code )
+ refframe_t helix_refframes_delta;
+ int m_CurGun; // currently selected gun outlet
+ int m_CurLauncher; // currently selected missile outlet
+
+ int m_nClientID;
+
+ E_SimPlayerInfo* m_pSimPlayerInfo;
+protected:
+
+ // create laser originating from player ship
+ void _OBJ_ShootLaser();
+
+ //Activate Helix Cannon
+ void _WFX_ActivateHelix();
+
+ //Activate lightning gun
+ void _WFX_ActivateLightning();
+
+ //Activate Photon cannon
+ void _WFX_ActivatePhoton();
+
+ // create a dumb missle originating from player ship
+ void _OBJ_LaunchMissile();
+
+ // create a homing missle originating from player ship
+ void _OBJ_LaunchHomingMissile( dword launcher, dword targetid );
+
+ void _OBJ_LaunchMine();
+
+ void _OBJ_LaunchSwarm( dword targetid );
+
+
+public:
+ G_Player()
+ {
+ Reset();
+ }
+
+ // reset all fields to defaults ( not connected )
+ void Reset();
+
+ // set the player status to connected
+ void Connect( int nClientID );
+
+ // set the player status to disconnected
+ void Disconnect();
+
+ // user fired laser
+ void FireLaser();
+
+ // user fired Helix cannon
+ void FireHelix();
+ int _WFX_MaintainHelix( ShipObject *shippo, int playerid );
+
+ //Deactivate Helix Cannon
+ void _WFX_DeactivateHelix();
+
+ // user fired Lightning cannon
+ void FireLightning();
+ void WFX_MaintainLightning( ShipObject *shippo);
+
+ //Deactivate lightning gun
+ void _WFX_DeactivateLightning();
+
+ // user fired Photon cannon
+ void FirePhoton();
+
+ //Deactivate Photon Cannon
+ void _WFX_DeactivatePhoton();
+
+ // user launched a dumb missle
+ void LaunchMissile();
+
+ // user launched a homping missle
+ void LaunchHomingMissile(dword launcher, dword targetid);
+
+ // user launched a mine
+ void LaunchMine();
+
+ // user launched a swarm
+ void LaunchSwarm(dword targetid);
+
+ // user fired emp
+ void FireEMP(byte Upgradelevel);
+
+ // record a kill
+ void RecordKill();
+
+ // record a death
+ void RecordDeath( int nClientID_Killer );
+
+ // reset any death info
+ void ResetDeathInfo();
+
+ // reset all game variables
+ void ResetGameVars();
+
+ // maintain weapon firing delays
+ void MaintainWeaponDelays();
+
+ // return the ship object assigned to the player
+ ShipObject* GetShipObject();
+
+ // return # of kills for the player
+ int GetKills() { return m_nKills; }
+
+ // return the last unjoin flag
+ int GetLastUnjoinFlag() { return m_nLastUnjoinFlag; }
+
+ // return the player id that last killed this player
+ int GetLastKiller() { return m_nLastKiller; }
+
+ //weapons cleanup
+ void WFX_EnsurePhotonInactive( ShipObject *shippo );
+ void WFX_EnsureHelixInactive( ShipObject *shippo );
+ void WFX_EnsureLightningInactive( ShipObject *shippo );
+ void WFX_EnsureParticleWeaponsInactive( ShipObject *shippo );
+};
+
diff --git a/src/parsec_server/include/inp_defs_sv.h b/src/parsec_server/include/inp_defs_sv.h
new file mode 100644
index 0000000..7aed354
--- /dev/null
+++ b/src/parsec_server/include/inp_defs_sv.h
@@ -0,0 +1,30 @@
+/*
+ * PARSEC HEADER: inps_defs.h
+ */
+
+#ifndef _INPS_DEFS_H_
+#define _INPS_DEFS_H_
+
+
+// ----------------------------------------------------------------------------
+// INPUT SUBSYSTEM (INP) related definitions -
+// ----------------------------------------------------------------------------
+
+// header of keyboard buffer
+struct keybbuffer_s {
+
+ dword ReadPos;
+ dword WritePos;
+ dword Data;
+};
+
+#define KEYB_BUFF_SIZ 16
+
+
+// global pointer to the keyboard buffer ( for console input ) ----------------
+//
+extern keybbuffer_s* KeybBuffer;
+
+#endif // _INPS_DEFS_H_
+
+
diff --git a/src/parsec_server/include/inp_keybmap_sv.h b/src/parsec_server/include/inp_keybmap_sv.h
new file mode 100644
index 0000000..0032fe2
--- /dev/null
+++ b/src/parsec_server/include/inp_keybmap_sv.h
@@ -0,0 +1,559 @@
+#ifndef _INPS_KEYBMAP_H_
+#define _INPS_KEYBMAP_H_
+
+#ifndef _KEYCODES_H_
+ #include "keycodes.h"
+#endif // _KEYCODES_H_
+
+dword INP_KeybMap[ 547 ] = {
+ CKC_NIL , // 0 , NO KEY NAME
+ CKC_NIL , // 1 , NO KEY NAME
+ CKC_NIL , // 2 , NO KEY NAME
+ CKC_NIL , // 3 , NO KEY NAME
+ CKC_NIL , // 4 , NO KEY NAME
+ CKC_NIL , // 5 , NO KEY NAME
+ CKC_NIL , // 6 , NO KEY NAME
+ CKC_NIL , // 7 , NO KEY NAME
+ CKC_BACKSPACE , // 8 , NO KEY NAME
+ CKC_TAB , // 9 , NO KEY NAME
+ CKC_ENTER , // a , NO KEY NAME
+ CKC_NIL , // b , NO KEY NAME
+ CKC_NIL , // c , NO KEY NAME
+ CKC_NIL , // d , NO KEY NAME
+ CKC_NIL , // e , NO KEY NAME
+ CKC_NIL , // f , NO KEY NAME
+ CKC_NIL , // 10 , NO KEY NAME
+ CKC_NIL , // 11 , NO KEY NAME
+ CKC_NIL , // 12 , NO KEY NAME
+ CKC_NIL , // 13 , NO KEY NAME
+ CKC_NIL , // 14 , NO KEY NAME
+ CKC_NIL , // 15 , NO KEY NAME
+ CKC_NIL , // 16 , NO KEY NAME
+ CKC_NIL , // 17 , NO KEY NAME
+ CKC_NIL , // 18 , NO KEY NAME
+ CKC_NIL , // 19 , NO KEY NAME
+ CKC_NIL , // 1a , NO KEY NAME
+ CKC_ESCAPE , // 1b , NO KEY NAME
+ CKC_NIL , // 1c , NO KEY NAME
+ CKC_NIL , // 1d , NO KEY NAME
+ CKC_NIL , // 1e , NO KEY NAME
+ CKC_NIL , // 1f , NO KEY NAME
+ CKC_SPACE , // 20 , NO KEY NAME
+ '!' , // 21 , NO KEY NAME
+ '"' , // 22 , NO KEY NAME
+ '#' , // 23 , NO KEY NAME
+ '$' , // 24 , NO KEY NAME
+ '%' , // 25 , NO KEY NAME
+ '&' , // 26 , NO KEY NAME
+ '\\' , // 27 , NO KEY NAME
+ '(' , // 28 , NO KEY NAME
+ ')' , // 29 , NO KEY NAME
+ '*' , // 2a , NO KEY NAME
+ '+' , // 2b , NO KEY NAME
+ ',' , // 2c , NO KEY NAME
+ '-' , // 2d , NO KEY NAME
+ '.' , // 2e , NO KEY NAME
+ '/' , // 2f , NO KEY NAME
+ '0' , // 30 , NO KEY NAME
+ '1' , // 31 , NO KEY NAME
+ '2' , // 32 , NO KEY NAME
+ '3' , // 33 , NO KEY NAME
+ '4' , // 34 , NO KEY NAME
+ '5' , // 35 , NO KEY NAME
+ '6' , // 36 , NO KEY NAME
+ '7' , // 37 , NO KEY NAME
+ '8' , // 38 , NO KEY NAME
+ '9' , // 39 , NO KEY NAME
+ ':' , // 3a , NO KEY NAME
+ ';' , // 3b , NO KEY NAME
+ '<' , // 3c , NO KEY NAME
+ '=' , // 3d , NO KEY NAME
+ '>' , // 3e , NO KEY NAME
+ '?' , // 3f , NO KEY NAME
+ '@' , // 40 , NO KEY NAME
+ 'A' , // 41 , NO KEY NAME
+ 'B' , // 42 , NO KEY NAME
+ 'C' , // 43 , NO KEY NAME
+ 'D' , // 44 , NO KEY NAME
+ 'E' , // 45 , NO KEY NAME
+ 'F' , // 46 , NO KEY NAME
+ 'G' , // 47 , NO KEY NAME
+ 'H' , // 48 , NO KEY NAME
+ 'I' , // 49 , NO KEY NAME
+ 'J' , // 4a , NO KEY NAME
+ 'K' , // 4b , NO KEY NAME
+ 'L' , // 4c , NO KEY NAME
+ 'M' , // 4d , NO KEY NAME
+ 'N' , // 4e , NO KEY NAME
+ 'O' , // 4f , NO KEY NAME
+ 'P' , // 50 , NO KEY NAME
+ 'Q' , // 51 , NO KEY NAME
+ 'R' , // 52 , NO KEY NAME
+ 'S' , // 53 , NO KEY NAME
+ 'T' , // 54 , NO KEY NAME
+ 'U' , // 55 , NO KEY NAME
+ 'V' , // 56 , NO KEY NAME
+ 'W' , // 57 , NO KEY NAME
+ 'X' , // 58 , NO KEY NAME
+ 'Y' , // 59 , NO KEY NAME
+ 'Z' , // 5a , NO KEY NAME
+ '[' , // 5b , NO KEY NAME
+ '\\' , // 5c , NO KEY NAME
+ ']' , // 5d , NO KEY NAME
+ '^' , // 5e , NO KEY NAME
+ '_' , // 5f , NO KEY NAME
+ '`' , // 60 , NO KEY NAME
+ 'a' , // 61 , NO KEY NAME
+ 'b' , // 62 , NO KEY NAME
+ 'c' , // 63 , NO KEY NAME
+ 'd' , // 64 , NO KEY NAME
+ 'e' , // 65 , NO KEY NAME
+ 'f' , // 66 , NO KEY NAME
+ 'g' , // 67 , NO KEY NAME
+ 'h' , // 68 , NO KEY NAME
+ 'i' , // 69 , NO KEY NAME
+ 'j' , // 6a , NO KEY NAME
+ 'k' , // 6b , NO KEY NAME
+ 'l' , // 6c , NO KEY NAME
+ 'm' , // 6d , NO KEY NAME
+ 'n' , // 6e , NO KEY NAME
+ 'o' , // 6f , NO KEY NAME
+ 'p' , // 70 , NO KEY NAME
+ 'q' , // 71 , NO KEY NAME
+ 'r' , // 72 , NO KEY NAME
+ 's' , // 73 , NO KEY NAME
+ 't' , // 74 , NO KEY NAME
+ 'u' , // 75 , NO KEY NAME
+ 'v' , // 76 , NO KEY NAME
+ 'w' , // 77 , NO KEY NAME
+ 'x' , // 78 , NO KEY NAME
+ 'y' , // 79 , NO KEY NAME
+ 'z' , // 7a , NO KEY NAME
+ '{' , // 7b , NO KEY NAME
+ '|' , // 7c , NO KEY NAME
+ '}' , // 7d , NO KEY NAME
+ CKC_NIL , // 7e , NO KEY NAME
+ CKC_NIL , // 7f , NO KEY NAME
+ CKC_NIL , // 80 , NO KEY NAME
+ CKC_NIL , // 81 , NO KEY NAME
+ CKC_NIL , // 82 , NO KEY NAME
+ CKC_NIL , // 83 , NO KEY NAME
+ CKC_NIL , // 84 , NO KEY NAME
+ CKC_NIL , // 85 , NO KEY NAME
+ CKC_NIL , // 86 , NO KEY NAME
+ CKC_NIL , // 87 , NO KEY NAME
+ CKC_NIL , // 88 , NO KEY NAME
+ CKC_NIL , // 89 , NO KEY NAME
+ CKC_NIL , // 8a , NO KEY NAME
+ CKC_NIL , // 8b , NO KEY NAME
+ CKC_NIL , // 8c , NO KEY NAME
+ CKC_NIL , // 8d , NO KEY NAME
+ CKC_NIL , // 8e , NO KEY NAME
+ CKC_NIL , // 8f , NO KEY NAME
+ CKC_NIL , // 90 , NO KEY NAME
+ CKC_NIL , // 91 , NO KEY NAME
+ CKC_NIL , // 92 , NO KEY NAME
+ CKC_NIL , // 93 , NO KEY NAME
+ CKC_NIL , // 94 , NO KEY NAME
+ CKC_NIL , // 95 , NO KEY NAME
+ CKC_NIL , // 96 , NO KEY NAME
+ CKC_NIL , // 97 , NO KEY NAME
+ CKC_NIL , // 98 , NO KEY NAME
+ CKC_NIL , // 99 , NO KEY NAME
+ CKC_NIL , // 9a , NO KEY NAME
+ CKC_NIL , // 9b , NO KEY NAME
+ CKC_NIL , // 9c , NO KEY NAME
+ CKC_NIL , // 9d , NO KEY NAME
+ CKC_NIL , // 9e , NO KEY NAME
+ CKC_NIL , // 9f , NO KEY NAME
+ CKC_NIL , // a0 , NO KEY NAME
+ CKC_NIL , // a1 , NO KEY NAME
+ CKC_NIL , // a2 , NO KEY NAME
+ CKC_NIL , // a3 , NO KEY NAME
+ CKC_NIL , // a4 , NO KEY NAME
+ CKC_NIL , // a5 , NO KEY NAME
+ CKC_NIL , // a6 , NO KEY NAME
+ CKC_NIL , // a7 , NO KEY NAME
+ CKC_NIL , // a8 , NO KEY NAME
+ CKC_NIL , // a9 , NO KEY NAME
+ CKC_NIL , // aa , NO KEY NAME
+ CKC_NIL , // ab , NO KEY NAME
+ CKC_NIL , // ac , NO KEY NAME
+ CKC_NIL , // ad , NO KEY NAME
+ CKC_NIL , // ae , NO KEY NAME
+ CKC_NIL , // af , NO KEY NAME
+ CKC_NIL , // b0 , NO KEY NAME
+ CKC_NIL , // b1 , NO KEY NAME
+ CKC_NIL , // b2 , NO KEY NAME
+ CKC_NIL , // b3 , NO KEY NAME
+ CKC_NIL , // b4 , NO KEY NAME
+ CKC_NIL , // b5 , NO KEY NAME
+ CKC_NIL , // b6 , NO KEY NAME
+ CKC_NIL , // b7 , NO KEY NAME
+ CKC_NIL , // b8 , NO KEY NAME
+ CKC_NIL , // b9 , NO KEY NAME
+ CKC_NIL , // ba , NO KEY NAME
+ CKC_NIL , // bb , NO KEY NAME
+ CKC_NIL , // bc , NO KEY NAME
+ CKC_NIL , // bd , NO KEY NAME
+ CKC_NIL , // be , NO KEY NAME
+ CKC_NIL , // bf , NO KEY NAME
+ CKC_NIL , // c0 , NO KEY NAME
+ CKC_NIL , // c1 , NO KEY NAME
+ CKC_NIL , // c2 , NO KEY NAME
+ CKC_NIL , // c3 , NO KEY NAME
+ CKC_NIL , // c4 , NO KEY NAME
+ CKC_NIL , // c5 , NO KEY NAME
+ CKC_NIL , // c6 , NO KEY NAME
+ CKC_NIL , // c7 , NO KEY NAME
+ CKC_NIL , // c8 , NO KEY NAME
+ CKC_NIL , // c9 , NO KEY NAME
+ CKC_NIL , // ca , NO KEY NAME
+ CKC_NIL , // cb , NO KEY NAME
+ CKC_NIL , // cc , NO KEY NAME
+ CKC_NIL , // cd , NO KEY NAME
+ CKC_NIL , // ce , NO KEY NAME
+ CKC_NIL , // cf , NO KEY NAME
+ CKC_NIL , // d0 , NO KEY NAME
+ CKC_NIL , // d1 , NO KEY NAME
+ CKC_NIL , // d2 , NO KEY NAME
+ CKC_NIL , // d3 , NO KEY NAME
+ CKC_NIL , // d4 , NO KEY NAME
+ CKC_NIL , // d5 , NO KEY NAME
+ CKC_NIL , // d6 , NO KEY NAME
+ CKC_NIL , // d7 , NO KEY NAME
+ CKC_NIL , // d8 , NO KEY NAME
+ CKC_NIL , // d9 , NO KEY NAME
+ CKC_NIL , // da , NO KEY NAME
+ CKC_NIL , // db , NO KEY NAME
+ CKC_NIL , // dc , NO KEY NAME
+ CKC_NIL , // dd , NO KEY NAME
+ CKC_NIL , // de , NO KEY NAME
+ CKC_NIL , // df , NO KEY NAME
+ CKC_NIL , // e0 , NO KEY NAME
+ CKC_NIL , // e1 , NO KEY NAME
+ CKC_NIL , // e2 , NO KEY NAME
+ CKC_NIL , // e3 , NO KEY NAME
+ CKC_NIL , // e4 , NO KEY NAME
+ CKC_NIL , // e5 , NO KEY NAME
+ CKC_NIL , // e6 , NO KEY NAME
+ CKC_NIL , // e7 , NO KEY NAME
+ CKC_NIL , // e8 , NO KEY NAME
+ CKC_NIL , // e9 , NO KEY NAME
+ CKC_NIL , // ea , NO KEY NAME
+ CKC_NIL , // eb , NO KEY NAME
+ CKC_NIL , // ec , NO KEY NAME
+ CKC_NIL , // ed , NO KEY NAME
+ CKC_NIL , // ee , NO KEY NAME
+ CKC_NIL , // ef , NO KEY NAME
+ CKC_NIL , // f0 , NO KEY NAME
+ CKC_NIL , // f1 , NO KEY NAME
+ CKC_NIL , // f2 , NO KEY NAME
+ CKC_NIL , // f3 , NO KEY NAME
+ CKC_NIL , // f4 , NO KEY NAME
+ CKC_NIL , // f5 , NO KEY NAME
+ CKC_NIL , // f6 , NO KEY NAME
+ CKC_NIL , // f7 , NO KEY NAME
+ CKC_NIL , // f8 , NO KEY NAME
+ CKC_NIL , // f9 , NO KEY NAME
+ CKC_NIL , // fa , NO KEY NAME
+ CKC_NIL , // fb , NO KEY NAME
+ CKC_NIL , // fc , NO KEY NAME
+ CKC_NIL , // fd , NO KEY NAME
+ CKC_NIL , // fe , NO KEY NAME
+ CKC_NIL , // ff , NO KEY NAME
+ CKC_NIL , // 100 , NO KEY NAME
+ CKC_NIL , // 101 , KEY_BREAK
+ CKC_CURSORDOWN , // 102 , KEY_DOWN
+ CKC_CURSORUP , // 103 , KEY_UP
+ CKC_CURSORLEFT , // 104 , KEY_LEFT
+ CKC_CURSORRIGHT , // 105 , KEY_RIGHT
+ CKC_HOME , // 106 , KEY_HOME
+ CKC_NIL , // 107 , KEY_BACKSPACE
+ CKC_NIL , // 108 , KEY_F0
+ CKC_NIL , // 109 , KEY_F(1)
+ CKC_NIL , // 10a , KEY_F(2)
+ CKC_NIL , // 10b , KEY_F(3)
+ CKC_NIL , // 10c , KEY_F(4)
+ CKC_NIL , // 10d , KEY_F(5)
+ CKC_NIL , // 10e , KEY_F(6)
+ CKC_NIL , // 10f , KEY_F(7)
+ CKC_NIL , // 110 , KEY_F(8)
+ CKC_NIL , // 111 , KEY_F(9)
+ CKC_NIL , // 112 , KEY_F(10)
+ CKC_NIL , // 113 , KEY_F(11)
+ CKC_NIL , // 114 , KEY_F(12)
+ CKC_NIL , // 115 , KEY_F(13)
+ CKC_NIL , // 116 , KEY_F(14)
+ CKC_NIL , // 117 , KEY_F(15)
+ CKC_NIL , // 118 , KEY_F(16)
+ CKC_NIL , // 119 , KEY_F(17)
+ CKC_NIL , // 11a , KEY_F(18)
+ CKC_NIL , // 11b , KEY_F(19)
+ CKC_NIL , // 11c , KEY_F(20)
+ CKC_NIL , // 11d , KEY_F(21)
+ CKC_NIL , // 11e , KEY_F(22)
+ CKC_NIL , // 11f , KEY_F(23)
+ CKC_NIL , // 120 , KEY_F(24)
+ CKC_NIL , // 121 , KEY_F(25)
+ CKC_NIL , // 122 , KEY_F(26)
+ CKC_NIL , // 123 , KEY_F(27)
+ CKC_NIL , // 124 , KEY_F(28)
+ CKC_NIL , // 125 , KEY_F(29)
+ CKC_NIL , // 126 , KEY_F(30)
+ CKC_NIL , // 127 , KEY_F(31)
+ CKC_NIL , // 128 , KEY_F(32)
+ CKC_NIL , // 129 , KEY_F(33)
+ CKC_NIL , // 12a , KEY_F(34)
+ CKC_NIL , // 12b , KEY_F(35)
+ CKC_NIL , // 12c , KEY_F(36)
+ CKC_NIL , // 12d , KEY_F(37)
+ CKC_NIL , // 12e , KEY_F(38)
+ CKC_NIL , // 12f , KEY_F(39)
+ CKC_NIL , // 130 , KEY_F(40)
+ CKC_NIL , // 131 , KEY_F(41)
+ CKC_NIL , // 132 , KEY_F(42)
+ CKC_NIL , // 133 , KEY_F(43)
+ CKC_NIL , // 134 , KEY_F(44)
+ CKC_NIL , // 135 , KEY_F(45)
+ CKC_NIL , // 136 , KEY_F(46)
+ CKC_NIL , // 137 , KEY_F(47)
+ CKC_NIL , // 138 , KEY_F(48)
+ CKC_NIL , // 139 , KEY_F(49)
+ CKC_NIL , // 13a , KEY_F(50)
+ CKC_NIL , // 13b , KEY_F(51)
+ CKC_NIL , // 13c , KEY_F(52)
+ CKC_NIL , // 13d , KEY_F(53)
+ CKC_NIL , // 13e , KEY_F(54)
+ CKC_NIL , // 13f , KEY_F(55)
+ CKC_NIL , // 140 , KEY_F(56)
+ CKC_NIL , // 141 , KEY_F(57)
+ CKC_NIL , // 142 , KEY_F(58)
+ CKC_NIL , // 143 , KEY_F(59)
+ CKC_NIL , // 144 , KEY_F(60)
+ CKC_NIL , // 145 , KEY_F(61)
+ CKC_NIL , // 146 , KEY_F(62)
+ CKC_NIL , // 147 , KEY_F(63)
+ CKC_NIL , // 148 , KEY_DL
+ CKC_NIL , // 149 , KEY_IL
+ CKC_DELETE , // 14a , KEY_DC
+ CKC_INSERT , // 14b , KEY_IC
+ CKC_NIL , // 14c , KEY_EIC
+ CKC_NIL , // 14d , KEY_CLEAR
+ CKC_NIL , // 14e , KEY_EOS
+ CKC_NIL , // 14f , KEY_EOL
+ CKC_NIL , // 150 , KEY_SF
+ CKC_NIL , // 151 , KEY_SR
+ CKC_PAGEDOWN , // 152 , KEY_NPAGE
+ CKC_PAGEUP , // 153 , KEY_PPAGE
+ CKC_NIL , // 154 , KEY_STAB
+ CKC_NIL , // 155 , KEY_CTAB
+ CKC_NIL , // 156 , KEY_CATAB
+ CKC_NIL , // 157 , KEY_ENTER
+ CKC_NIL , // 158 , KEY_SRESET
+ CKC_NIL , // 159 , KEY_RESET
+ CKC_NIL , // 15a , KEY_PRINT
+ CKC_NIL , // 15b , KEY_LL
+ CKC_NIL , // 15c , KEY_ABORT
+ CKC_NIL , // 15d , KEY_SHELP
+ CKC_NIL , // 15e , KEY_LHELP
+ CKC_NIL , // 15f , KEY_BTAB
+ CKC_NIL , // 160 , KEY_BEG
+ CKC_NIL , // 161 , KEY_CANCEL
+ CKC_NIL , // 162 , KEY_CLOSE
+ CKC_NIL , // 163 , KEY_COMMAND
+ CKC_NIL , // 164 , KEY_COPY
+ CKC_NIL , // 165 , KEY_CREATE
+ CKC_END , // 166 , KEY_END
+ CKC_NIL , // 167 , KEY_EXIT
+ CKC_NIL , // 168 , KEY_FIND
+ CKC_NIL , // 169 , KEY_HELP
+ CKC_NIL , // 16a , KEY_MARK
+ CKC_NIL , // 16b , KEY_MESSAGE
+ CKC_NIL , // 16c , KEY_MOVE
+ CKC_NIL , // 16d , KEY_NEXT
+ CKC_NIL , // 16e , KEY_OPEN
+ CKC_NIL , // 16f , KEY_OPTIONS
+ CKC_NIL , // 170 , KEY_PREVIOUS
+ CKC_NIL , // 171 , KEY_REDO
+ CKC_NIL , // 172 , KEY_REFERENCE
+ CKC_NIL , // 173 , KEY_REFRESH
+ CKC_NIL , // 174 , KEY_REPLACE
+ CKC_NIL , // 175 , KEY_RESTART
+ CKC_NIL , // 176 , KEY_RESUME
+ CKC_NIL , // 177 , KEY_SAVE
+ CKC_NIL , // 178 , KEY_SBEG
+ CKC_NIL , // 179 , KEY_SCANCEL
+ CKC_NIL , // 17a , KEY_SCOMMAND
+ CKC_NIL , // 17b , KEY_SCOPY
+ CKC_NIL , // 17c , KEY_SCREATE
+ CKC_NIL , // 17d , KEY_SDC
+ CKC_NIL , // 17e , KEY_SDL
+ CKC_NIL , // 17f , KEY_SELECT
+ CKC_NIL , // 180 , KEY_SEND
+ CKC_NIL , // 181 , KEY_SEOL
+ CKC_NIL , // 182 , KEY_SEXIT
+ CKC_NIL , // 183 , KEY_SFIND
+ CKC_NIL , // 184 , KEY_SHOME
+ CKC_NIL , // 185 , KEY_SIC
+ CKC_NIL , // 186 , NO KEY NAME
+ CKC_CURSORLEFT_SHIFTED,// 187 , KEY_SLEFT
+ CKC_NIL , // 188 , KEY_SMESSAGE
+ CKC_NIL , // 189 , KEY_SMOVE
+ CKC_NIL , // 18a , KEY_SNEXT
+ CKC_NIL , // 18b , KEY_SOPTIONS
+ CKC_NIL , // 18c , KEY_SPREVIOUS
+ CKC_NIL , // 18d , KEY_SPRINT
+ CKC_NIL , // 18e , KEY_SREDO
+ CKC_NIL , // 18f , KEY_SREPLACE
+ CKC_CURSORRIGHT_SHIFTED,// 190 , KEY_SRIGHT
+ CKC_NIL , // 191 , KEY_SRSUME
+ CKC_NIL , // 192 , KEY_SSAVE
+ CKC_NIL , // 193 , KEY_SSUSPEND
+ CKC_NIL , // 194 , KEY_SUNDO
+ CKC_NIL , // 195 , KEY_SUSPEND
+ CKC_NIL , // 196 , KEY_UNDO
+ CKC_NIL , // 197 , ALT_0
+ CKC_NIL , // 198 , ALT_1
+ CKC_NIL , // 199 , ALT_2
+ CKC_NIL , // 19a , ALT_3
+ CKC_NIL , // 19b , ALT_4
+ CKC_NIL , // 19c , ALT_5
+ CKC_NIL , // 19d , ALT_6
+ CKC_NIL , // 19e , ALT_7
+ CKC_NIL , // 19f , ALT_8
+ CKC_NIL , // 1a0 , ALT_9
+ CKC_NIL , // 1a1 , ALT_A
+ CKC_NIL , // 1a2 , ALT_B
+ CKC_NIL , // 1a3 , ALT_C
+ CKC_NIL , // 1a4 , ALT_D
+ CKC_NIL , // 1a5 , ALT_E
+ CKC_NIL , // 1a6 , ALT_F
+ CKC_NIL , // 1a7 , ALT_G
+ CKC_NIL , // 1a8 , ALT_H
+ CKC_NIL , // 1a9 , ALT_I
+ CKC_NIL , // 1aa , ALT_J
+ CKC_NIL , // 1ab , ALT_K
+ CKC_NIL , // 1ac , ALT_L
+ CKC_NIL , // 1ad , ALT_M
+ CKC_NIL , // 1ae , ALT_N
+ CKC_NIL , // 1af , ALT_O
+ CKC_NIL , // 1b0 , ALT_P
+ CKC_NIL , // 1b1 , ALT_Q
+ CKC_NIL , // 1b2 , ALT_R
+ CKC_NIL , // 1b3 , ALT_S
+ CKC_NIL , // 1b4 , ALT_T
+ CKC_NIL , // 1b5 , ALT_U
+ CKC_NIL , // 1b6 , ALT_V
+ CKC_NIL , // 1b7 , ALT_W
+ CKC_NIL , // 1b8 , ALT_X
+ CKC_NIL , // 1b9 , ALT_Y
+ CKC_NIL , // 1ba , ALT_Z
+ CKC_NIL , // 1bb , CTL_LEFT
+ CKC_NIL , // 1bc , CTL_RIGHT
+ CKC_NIL , // 1bd , CTL_PGUP
+ CKC_NIL , // 1be , CTL_PGDN
+ CKC_NIL , // 1bf , CTL_HOME
+ CKC_NIL , // 1c0 , CTL_END
+ CKC_NIL , // 1c1 , KEY_A1
+ CKC_NIL , // 1c2 , KEY_A2
+ CKC_NIL , // 1c3 , KEY_A3
+ CKC_NIL , // 1c4 , KEY_B1
+ CKC_NIL , // 1c5 , KEY_B2
+ CKC_NIL , // 1c6 , KEY_B3
+ CKC_NIL , // 1c7 , KEY_C1
+ CKC_NIL , // 1c8 , KEY_C2
+ CKC_NIL , // 1c9 , KEY_C3
+ CKC_NIL , // 1ca , PADSLASH
+ CKC_NIL , // 1cb , PADENTER
+ CKC_NIL , // 1cc , CTL_PADENTER
+ CKC_NIL , // 1cd , ALT_PADENTER
+ CKC_NIL , // 1ce , PADSTOP
+ CKC_NIL , // 1cf , PADSTAR
+ CKC_NIL , // 1d0 , PADMINUS
+ CKC_NIL , // 1d1 , PADPLUS
+ CKC_NIL , // 1d2 , CTL_PADSTOP
+ CKC_NIL , // 1d3 , CTL_PADCENTER
+ CKC_NIL , // 1d4 , CTL_PADPLUS
+ CKC_NIL , // 1d5 , CTL_PADMINUS
+ CKC_NIL , // 1d6 , CTL_PADSLASH
+ CKC_NIL , // 1d7 , CTL_PADSTAR
+ CKC_NIL , // 1d8 , ALT_PADPLUS
+ CKC_NIL , // 1d9 , ALT_PADMINUS
+ CKC_NIL , // 1da , ALT_PADSLASH
+ CKC_NIL , // 1db , ALT_PADSTAR
+ CKC_NIL , // 1dc , ALT_PADSTOP
+ CKC_NIL , // 1dd , CTL_INS
+ CKC_NIL , // 1de , ALT_DEL
+ CKC_NIL , // 1df , ALT_INS
+ CKC_NIL , // 1e0 , CTL_UP
+ CKC_NIL , // 1e1 , CTL_DOWN
+ CKC_NIL , // 1e2 , CTL_TAB
+ CKC_NIL , // 1e3 , ALT_TAB
+ CKC_NIL , // 1e4 , ALT_MINUS
+ CKC_NIL , // 1e5 , ALT_EQUAL
+ CKC_NIL , // 1e6 , ALT_HOME
+ CKC_NIL , // 1e7 , ALT_PGUP
+ CKC_NIL , // 1e8 , ALT_PGDN
+ CKC_NIL , // 1e9 , ALT_END
+ CKC_NIL , // 1ea , ALT_UP
+ CKC_NIL , // 1eb , ALT_DOWN
+ CKC_NIL , // 1ec , ALT_RIGHT
+ CKC_NIL , // 1ed , ALT_LEFT
+ CKC_NIL , // 1ee , ALT_ENTER
+ CKC_NIL , // 1ef , ALT_ESC
+ CKC_NIL , // 1f0 , ALT_BQUOTE
+ CKC_NIL , // 1f1 , ALT_LBRACKET
+ CKC_NIL , // 1f2 , ALT_RBRACKET
+ CKC_NIL , // 1f3 , ALT_SEMICOLON
+ CKC_NIL , // 1f4 , ALT_FQUOTE
+ CKC_NIL , // 1f5 , ALT_COMMA
+ CKC_NIL , // 1f6 , ALT_STOP
+ CKC_NIL , // 1f7 , ALT_FSLASH
+ CKC_NIL , // 1f8 , ALT_BKSP
+ CKC_NIL , // 1f9 , CTL_BKSP
+ CKC_NIL , // 1fa , PAD0
+ CKC_NIL , // 1fb , CTL_PAD0
+ CKC_NIL , // 1fc , CTL_PAD1
+ CKC_NIL , // 1fd , CTL_PAD2
+ CKC_NIL , // 1fe , CTL_PAD3
+ CKC_NIL , // 1ff , CTL_PAD4
+ CKC_NIL , // 200 , CTL_PAD5
+ CKC_NIL , // 201 , CTL_PAD6
+ CKC_NIL , // 202 , CTL_PAD7
+ CKC_NIL , // 203 , CTL_PAD8
+ CKC_NIL , // 204 , CTL_PAD9
+ CKC_NIL , // 205 , ALT_PAD0
+ CKC_NIL , // 206 , ALT_PAD1
+ CKC_NIL , // 207 , ALT_PAD2
+ CKC_NIL , // 208 , ALT_PAD3
+ CKC_NIL , // 209 , ALT_PAD4
+ CKC_NIL , // 20a , ALT_PAD5
+ CKC_NIL , // 20b , ALT_PAD6
+ CKC_NIL , // 20c , ALT_PAD7
+ CKC_NIL , // 20d , ALT_PAD8
+ CKC_NIL , // 20e , ALT_PAD9
+ CKC_NIL , // 20f , CTL_DEL
+ CKC_NIL , // 210 , ALT_BSLASH
+ CKC_NIL , // 211 , CTL_ENTER
+ CKC_NIL , // 212 , SHF_PADENTER
+ CKC_NIL , // 213 , SHF_PADSLASH
+ CKC_NIL , // 214 , SHF_PADSTAR
+ CKC_NIL , // 215 , SHF_PADPLUS
+ CKC_NIL , // 216 , SHF_PADMINUS
+ CKC_CURSORUP_SHIFTED, // 217 , SHF_UP
+ CKC_CURSORDOWN_SHIFTED,// 218 , SHF_DOWN
+ CKC_NIL , // 219 , SHF_IC
+ CKC_NIL , // 21a , SHF_DC
+ CKC_NIL , // 21b , KEY_MOUSE
+ CKC_NIL , // 21c , KEY_SHIFT_L
+ CKC_NIL , // 21d , KEY_SHIFT_R
+ CKC_NIL , // 21e , KEY_CONTROL_L
+ CKC_NIL , // 21f , KEY_CONTROL_R
+ CKC_NIL , // 220 , KEY_ALT_L
+ CKC_NIL , // 221 , KEY_ALT_R
+ CKC_NIL , // 222 , KEY_RESIZE
+};
+
+
+#endif // _INPS_KEYBMAP_H_
diff --git a/src/parsec_server/include/inp_main_sv.h b/src/parsec_server/include/inp_main_sv.h
new file mode 100644
index 0000000..7d12722
--- /dev/null
+++ b/src/parsec_server/include/inp_main_sv.h
@@ -0,0 +1,12 @@
+/*
+* PARSEC HEADER: inp_main_sv.h
+*/
+
+#ifndef _INP_MAIN_SV_H_
+#define _INP_MAIN_SV_H_
+
+void INP_Init();
+void INP_Kill();
+void INP_HandleInput();
+
+#endif // _INP_MAIN_SV_H_
diff --git a/src/parsec_server/include/net_game_sv.h b/src/parsec_server/include/net_game_sv.h
new file mode 100644
index 0000000..81d5376
--- /dev/null
+++ b/src/parsec_server/include/net_game_sv.h
@@ -0,0 +1,30 @@
+/*
+ * PARSEC HEADER: net_game_sv.h
+ */
+
+#ifndef _NET_GAME_SV_H_
+#define _NET_GAME_SV_H_
+
+
+// value alive counter is set to immediately
+// after a packet has been received (default 20s)
+#define MAX_ALIVE_COUNTER 60 * 600
+
+// bufferno for virtual buffer
+#define VIRTUAL_BUFFER_ID -1 // packet is virtual (packet replay)
+
+// ping packet type
+//#define PING_REQUEST 1 // request packet
+//#define PING_REPLY 0 // reply packet
+
+// special player ids
+//#define PLAYERID_SERVER -1 // packet destination is the server
+//#define PLAYERID_ANONYMOUS -2 // packet sender is not connected
+
+// special ship ids
+#define SHIPID_NOSHIP -1 // there is no ship (player not joined)
+
+
+#endif // _NET_GAME_SV_H_
+
+
diff --git a/src/parsec_server/include/net_packetdriver.h b/src/parsec_server/include/net_packetdriver.h
new file mode 100755
index 0000000..f4b1f1d
--- /dev/null
+++ b/src/parsec_server/include/net_packetdriver.h
@@ -0,0 +1,138 @@
+/*
+* PARSEC HEADER: NET_PacketDriver.h
+*/
+
+#ifndef _NET_PACKETDRIVER_H_
+#define _NET_PACKETDRIVER_H_
+
+// forward decls --------------------------------------------------------------
+//
+struct NetPacket_GMSV;
+class NET_UDPDriver;
+class NET_Stream;
+class E_GameServer;
+class E_PacketHandler;
+
+
+// number of listen buffers in listen buffers array ---------------------------
+//
+#define NUM_LISTEN_BUFFERS ( MAX_NET_ALLOC_SLOTS * 2 )
+
+// high level packet chain (preprocessed to meet ordering requirements) -------
+//
+struct PacketChainBlock {
+
+ int bufferno;
+ NetPacket_GMSV* gamepacket;
+ int messageid;
+ PacketChainBlock* nextblock;
+};
+
+struct PacketChainHead : PacketChainBlock {
+ int chainlength;
+};
+
+
+// general packet handling function -------------------------------------------
+//
+class NET_PacketDriver
+{
+protected:
+
+ NetPacketExternal_GMSV* SendNetPacketExternal;
+ NetPacketExternal_GMSV* RecvNetPacketExternal;
+ int ListenStatus [ NUM_LISTEN_BUFFERS ];
+ sockaddr_in ListenAddress [ NUM_LISTEN_BUFFERS ];
+ node_t ListenSenderStorage [ NUM_LISTEN_BUFFERS ];
+ NetPacket_GMSV* NetPacketsInternal [ NUM_LISTEN_BUFFERS ];
+
+ PacketChainHead* ReceivedPacketsChain;
+
+ NET_Stream* m_Streams; // add one player for PLAYERID_ANONYMOUS
+
+protected:
+ // retrieve next packet from received packets chain
+ PacketChainBlock* _FetchPacketFromChain();
+
+ // allocate received packets chain (head node)
+ int _AllocPacketsChain();
+
+ // free all blocks in received packets chain
+ void _FreePacketsChain();
+
+ // release block containing pointer and info of packet
+ void _ReleasePacketFromChain( PacketChainBlock* block );
+
+ // pre-process received packets
+ void _BuildReceivedPacketsChain();
+
+ // insert received packet into chain
+ int _ChainPacket( NetPacket_GMSV* gamepacket, int bufid );
+
+ // check regular player packets for duplicates
+ int _FilterPacketDuplicate( int senderid, int messageid );
+
+ // process packet before inserting it into packet chain
+ void _PreprocessInPacket( NetPacket_GMSV* gamepacket );
+
+ // log packet loss statistics
+ void _LogPacketLossStats( int numpackets, int packetok, int incoming );
+
+ // fetch a packet into a listen buffer
+ int _UDP_FetchPacket( int bufid );
+
+ // determine if packet should be artificially dropped
+ int _CheckForcePacketDrop();
+
+ // record a packet
+ void _RecordPacket( int bufid );
+
+ NET_PacketDriver();
+ virtual ~NET_PacketDriver();
+
+public:
+
+ // SINGLETON pattern
+ static NET_PacketDriver* GetPacketDriver()
+ {
+ static NET_PacketDriver _ThePacketDriver;
+ return &_ThePacketDriver;
+ }
+
+ // invoke processing function for all packets currently in chain
+ void NET_ProcessPacketChain();
+
+ // retrieve sender's node address from listen header
+ node_t* GetPktSender( int bufid );
+
+ // send a packet to a node
+ int SendPacket( NetPacket_GMSV* gamepacket, node_t* node, int nClientID, E_REList* pReliable, E_REList* pUnreliable );
+
+ // send a datagram ( unreliable, unnumbered packet ) to a node
+ int SendDatagram( NetPacket_GMSV* gamepacket, node_t* node, int nClientID, E_REList* pUnreliable );
+
+ // fill standard fields in gamepacket header
+ void FillStdGameHeader( byte command, NetPacket_GMSV* gamepacket );
+
+ // reset all data members
+ void Reset();
+
+ // reset the stream of a specific client
+ void ResetStream( int nClientID );
+
+ // connect the stream of a client
+ void ConnectStream( int nClientID );
+
+ // flush the reliable backbuffer of a stream
+ void FlushReliableBuffer( int nClientID );
+
+ // return the message id used in the next packet that is sent
+ int GetNextOutMessageId( int nClientID );
+
+ // get the stream message status
+ NET_Stream* GetStream( int nClientID );
+
+ friend class E_GameServer;
+};
+
+#endif // _NET_PACKETDRIVER_H_
diff --git a/src/parsec_server/include/net_subh_sv.h b/src/parsec_server/include/net_subh_sv.h
new file mode 100755
index 0000000..e177b11
--- /dev/null
+++ b/src/parsec_server/include/net_subh_sv.h
@@ -0,0 +1,128 @@
+/*
+ * PARSEC HEADER: net_subh_sv.h
+ */
+
+#ifndef _NET_SUBH_SV_H_
+#define _NET_SUBH_SV_H_
+
+
+// ----------------------------------------------------------------------------
+// NETWORKING SUBSYSTEM (NET) system-dependent function declarations -
+// ----------------------------------------------------------------------------
+//#define NULL 0
+#include "e_relist.h"
+
+//// remote event functions (RMEV)
+//
+#define NET_RmEvAllowed TheSimulator->GetInputREList()->RmEvAllowed
+#define NET_RmEvGetSize E_REList::RmEvGetSize
+#define NETs_RmEvList_GetMaxSize E_REList::GetMaxSizeInPacket
+//int NET_RmEvPlayerName( char *name );
+//int NET_RmEvSendText( const char *text );
+//int NET_RmEvObject( const GenObject *objpo );
+//int NET_RmEvLaser( const LaserObject *laserpo );
+//int NET_RmEvMissile( const MissileObject *missilepo, dword targetobjid );
+//int NET_RmEvExtra( const ExtraObject *extrapo );
+//int NET_RmEvParticleObject( int type, const Vertex3& origin );
+//int NET_RmEvKillObject( dword objid, byte listno );
+//int NET_RmEvWeaponState( dword weapon, byte state, int energy, dword specials );
+#define NET_RmEvStateSync TheSimulator->GetInputREList()->RmEvStateSync
+//int NET_RmEvCreateSwarm( Vector3 *origin, dword targetobjid, dword seed );
+//int NET_RmEvCreateEmp( int upgradelevel );
+//RE_PlayerAndShipStatus* NET_RmEvShipStatus( byte last_unjoin_flag );
+//
+//
+//void NET_ExecRmEvCreateObject ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvCreateLaser ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvCreateMissile ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvParticleObject ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvCreateExtra ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvKillObject ( RE_Header *rmev );
+//void NET_ExecRmEvSendText ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvPlayerName ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvWeaponState ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvStateSync ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvCreateSwarm ( RE_Header *rmev, int senderid );
+//void NET_ExecRmEvCreateEmp ( RE_Header *rmev, int senderid );
+//
+//void NET_ExecRmEvGameState ( RE_GameState* gamestate );
+//void NET_ExecRmEvKillStats ( RE_KillStats* killstats );
+//void NET_ExecRmEvCommandInfo ( RE_CommandInfo* commandinfo );
+//
+//// utility functions (UTIL)
+//
+//int NET_ProtocolPEER();
+//int NET_ProtocolGMSV();
+//
+//int NET_ConnectedPEER();
+//int NET_ConnectedGMSV();
+//
+//char* NET_FetchPlayerName( int playerid );
+//int NET_SetPlayerName( char *name );
+//ShipObject* NET_FetchOwnersShip( int ownerid );
+//void NET_SetPlayerKillStat( int playerid, int amount );
+//
+//int NET_KillStatLimitReached( int limit );
+//void NET_KillStatForceIdleZero();
+//
+//void NET_DrawEntryModeText();
+//
+//
+//// protocol api functions
+//
+//int NETs_Connect();
+//int NETs_Disconnect();
+//int NETs_Join();
+//int NETs_Unjoin( byte flag );
+//
+//int NETs_UpdateName();
+//
+//void NETs_MaintainNet();
+//
+//// protocol api - game functions
+//
+//size_t NETs_RmEvList_GetMaxSize();
+//void NETs_UpdateKillStats( RE_KillStats* killstats );
+//
+// protocol api - packet handling functions
+
+size_t NETs_HandleOutPacket ( const NetPacket* int_gamepacket, NetPacketExternal* ext_gamepacket );
+//size_t NETs_HandleOutPacket_DEMO ( const NetPacket* int_gamepacket, NetPacketExternal* ext_gamepacket );
+int NETs_HandleInPacket ( const NetPacketExternal* ext_gamepacket, const int ext_pktsize, NetPacket* int_gamepacket );
+//int NETs_HandleInPacket_DEMO ( const NetPacketExternal* ext_gamepacket, NetPacket* int_gamepacket, size_t* psize_external );
+//size_t NETs_NetPacketExternal_DEMO_GetSize( NetPacketExternal* ext_gamepacket );
+//void NETs_StdGameHeader( byte command, NetPacket* gamepacket );
+//void NETs_WritePacketInfo( FILE *fp, NetPacketExternal* ext_gamepacket );
+//
+//// packet api functions
+//
+//int NETs_CompareNodes( node_t *node1, node_t *node2 );
+//int NETs_VirtualNode( node_t *node );
+//void NETs_SetVirtualAddress( node_t *node );
+//void NETs_SetBroadcastAddress( node_t *node );
+//
+//void NETs_ResolveNode( node_t* node_dst, node_t* node_src );
+//void NETs_MakeNodeRaw( node_t* node_dst, node_t* node_src );
+//node_t* NETs_GetSender( int bufid );
+//void NETs_ResolveSender( node_t *node, int bufid );
+//
+//void NETs_PrintNode( node_t *node );
+//
+//void NETs_FlushListenBuffers();
+//
+//int NETs_InsertVirtualPacket( NetPacket* gamepacket );
+//int NETs_DeterminePacketLoss( char **info, int *isiz, int incoming );
+//
+//void NETs_SendPacket ( NetPacket* gamepacket, node_t* node );
+//void NETs_AuxSendPacket ( NetPacket* gamepacket, node_t* node );
+//
+//void NETs_ProcessPacketChain ( void (*procfunc)(NetPacket* gamepacket,int bufid) );
+//
+//int NETs_ResetAPI();
+//int NETs_InitAPI();
+//int NETs_KillAPI();
+
+
+#endif // _NET_SUBH_SV_H_
+
+
diff --git a/src/parsec_server/include/net_udpdriver.h b/src/parsec_server/include/net_udpdriver.h
new file mode 100755
index 0000000..fd2dcc5
--- /dev/null
+++ b/src/parsec_server/include/net_udpdriver.h
@@ -0,0 +1,120 @@
+/*
+* PARSEC HEADER: NET_UDPDriver.h
+*/
+
+#ifndef _NET_UDPDRIVER_H_
+#define _NET_UDPDRIVER_H_
+
+// NOTE:
+//
+// platform dependent implementations are in e.g. NW_UDPDRIVER.CPP
+//
+#include <stdio.h>
+#include <stdlib.h>
+//#include <string.h>
+//#include <stdarg.h>
+#include <ctype.h>
+#include <vector>
+
+#ifndef PARSEC_SERVER
+ //FIXME: we should do a e_glob_svm.h just like e_glob_sv.h
+ #define TheUDPDriver (NET_UDPDriver::GetUDPDriver())
+#endif // !PARSEC_SERVER
+
+
+/* Following shortens all the type casts of pointer arguments */
+#define SA struct sockaddr
+
+
+// class defining a UDP driver ------------------------------------------------
+//
+class NET_UDPDriver
+{
+protected:
+ int m_socket;
+ int m_selected_port;
+ char m_szInterface[ MAX_IPADDR_LEN + 1 ];
+ char m_szIP [ MAX_IPADDR_LEN + 1 ];
+ node_t m_Node; // node containing the IP adress
+ std::vector<node_t > NetworkInterfaces;
+ int m_PreferredInterface;
+ bool m_DriverRunning;
+protected:
+ // init the OS API
+ int _InitOSAPI();
+
+ // kill the OS API
+ int _KillOSAPI();
+
+ // open and initialize the UDP socket
+ int _OpenSocket();
+
+ // close the UDP socket
+ int _CloseSocket();
+
+ // get the local IP
+ int _RetrieveLocalIP();
+
+ // setup the interface
+ void _SetupInterface(node_t *p_Node);
+
+ NET_UDPDriver();
+ ~NET_UDPDriver();
+
+public:
+
+ // SINGLETON pattern
+ static NET_UDPDriver* GetUDPDriver()
+ {
+ static NET_UDPDriver _TheUDPDriver;
+ return &_TheUDPDriver;
+ }
+
+ // init the UDP driver
+ int InitDriver( char* szInterface, int selected_port );
+
+ // kill the UDP driver
+ int KillDriver();
+
+ // fetch a UDP packet from the socket
+ int FetchPacket( char* buf, int maxlen, SA* saddr );
+
+ // send a UDP packet on the socket
+ int SendPacket( char* buf, int pktsize, SA* saddr );
+
+ // sleep until we have a network input or a timeout occurs
+ int SleepUntilNetInput( int timeout_msec )
+ {
+ fd_set rset;
+ struct timeval select_timeout;
+
+ // initialize socket set
+ FD_ZERO( &rset );
+ FD_SET( m_socket, &rset );
+
+ select_timeout.tv_sec = 0;
+ select_timeout.tv_usec = timeout_msec * 1000;
+
+ // select for readable socket
+ int rc = select( m_socket + 1, &rset, NULL, NULL, &select_timeout );
+ return rc;
+ }
+
+ // resolve a hostname using the DNS service
+ int ResolveHostName( char *hostname, node_t* node );
+
+
+ // ------------------------------------------------------------------------
+ // accessor methods
+ // ------------------------------------------------------------------------
+ int GetSocket() { return m_socket; }
+ node_t* GetNode() { return &m_Node; }
+ int GetPreferredInterface() { return m_PreferredInterface; }
+ void SetPreferredInterface(int p_Interface) { m_PreferredInterface = p_Interface; }
+ int IsRunning() { return m_DriverRunning; }
+};
+
+
+
+#endif // _NET_UDPDRIVER_H_
+
diff --git a/src/parsec_server/include/net_util_sv.h b/src/parsec_server/include/net_util_sv.h
new file mode 100644
index 0000000..1463a65
--- /dev/null
+++ b/src/parsec_server/include/net_util_sv.h
@@ -0,0 +1,25 @@
+/*
+ * PARSEC HEADER: net_util_sv.h
+ */
+
+#ifndef _NET_UTIL_SV_H_
+#define _NET_UTIL_SV_H_
+
+// net_util_sv.c implements the following functions
+// ------------------------------------------------
+
+// external functions ---------------------------------------------------------
+//
+void NODE_Copy( node_t* dst, node_t* src );
+void NODE_StorePort( node_t *node, word port );
+word NODE_GetPort( node_t *node );
+int NODE_Compare( node_t *node1, node_t *node2 );
+int NODE_AreSame( node_t *node1, node_t *node2 );
+char* NODE_Print( node_t* node );
+
+// external variables ---------------------------------------------------------
+//
+
+#endif // _NET_UTIL_SV_H_
+
+
diff --git a/src/parsec_server/include/sl_util_sv.h b/src/parsec_server/include/sl_util_sv.h
new file mode 100644
index 0000000..219b480
--- /dev/null
+++ b/src/parsec_server/include/sl_util_sv.h
@@ -0,0 +1,9 @@
+/*
+ * PARSEC HEADER: sl_util_sv.h
+ */
+
+#ifndef _SL_UTIL_SV_H_
+#define _SL_UTIL_SV_H_
+
+
+#endif // _SL_UTIL_SV_H_
diff --git a/src/parsec_server/include/sys_err_sv.h b/src/parsec_server/include/sys_err_sv.h
new file mode 100644
index 0000000..359dfe1
--- /dev/null
+++ b/src/parsec_server/include/sys_err_sv.h
@@ -0,0 +1,31 @@
+/*
+ * PARSEC HEADER: sys_err_sv.h
+ */
+
+#ifndef _SYS_ERR_SV_H_
+#define _SYS_ERR_SV_H_
+
+
+#include "debug.h"
+
+
+// ----------------------------------------------------------------------------
+// SERVER SYSTEM SUBSYSTEM (SYS) ERROR HANDLING -
+// ----------------------------------------------------------------------------
+
+void SYSs_CriticalCleanUp();
+FUNCTION_NORETURN(void SYSs_PanicFunction( const char *msg, const char *file, unsigned line ));
+FUNCTION_NORETURN(void SYSs_OutOfMemFunction( const char *msg, const char *file, unsigned line ));
+
+FUNCTION_NORETURN(void SYSs_PError( const char *msg, ... ));
+
+// wrappers
+
+#define PANIC(x) SYSs_PanicFunction( (x), __FILE__, __LINE__ )
+#define OUTOFMEM(x) SYSs_OutOfMemFunction( (x), __FILE__, __LINE__ )
+#define PERROR SYSs_PError
+#define FERROR SYSs_PError //FIXME: //SYSs_FError
+
+
+#endif // _SYS_ERR_SV_H_
+
diff --git a/src/parsec_server/include/sys_msg_sv.h b/src/parsec_server/include/sys_msg_sv.h
new file mode 100644
index 0000000..9a7affa
--- /dev/null
+++ b/src/parsec_server/include/sys_msg_sv.h
@@ -0,0 +1,29 @@
+/*
+ * PARSEC HEADER: sys_msg_sv.h
+ */
+
+#ifndef _SYS_MSG_SV_H_
+#define _SYS_MSG_SV_H_
+
+// ----------------------------------------------------------------------------
+// SYSTEM SUBSYSTEM (SYS) MESSAGE OUTPUT -
+// ----------------------------------------------------------------------------
+
+int SYSs_MsgOut ( const char *format, ... );
+int SYSs_MsgPut ( const char *format, ... );
+int SYS_WriteLogFileMessage ( const char *format, ... );
+
+// wrappers
+
+#define MSGOUT SYSs_MsgOut
+#define MSGPUT SYSs_MsgPut
+
+#define DBGOUT SYSs_MsgOut
+#define DMSGOUT SYSs_MsgOut
+
+#undef LOGOUT
+#define LOGOUT(x) SYS_WriteLogFileMessage x
+
+#endif // _SYS_MSG_SV_H_
+
+
diff --git a/src/parsec_server/include/sys_refframe_sv.h b/src/parsec_server/include/sys_refframe_sv.h
new file mode 100644
index 0000000..6a323e3
--- /dev/null
+++ b/src/parsec_server/include/sys_refframe_sv.h
@@ -0,0 +1,29 @@
+/*
+ * PARSEC HEADER: SYSS_REFFRAME.H
+ */
+
+#ifndef _SYSS_REFFRAME_H_
+#define _SYSS_REFFRAME_H_
+
+
+// init reference frame counting
+void SYSs_InitRefFrameCount();
+
+// get current reference frame count
+refframe_t SYSs_GetRefFrameCount();
+
+// wait for specified number of reference frames
+void SYSs_Wait( refframe_t refframes );
+
+// called once per frame to pass control to a platform-specific handler
+int SYSs_Yield();
+
+#include "e_global_sv.h"
+#include "sl_timer.h"
+
+// helper macros --------------------------------------------------------------
+//
+#define REFFRAMES_TO_USEC( x ) ( ( x ) * 1000000 ) / FRAME_MEASURE_TIMEBASE;
+
+#endif // !_SYSS_REFFRAME_H_
+
diff --git a/src/parsec_server/include/sys_util_sv.h b/src/parsec_server/include/sys_util_sv.h
new file mode 100755
index 0000000..6ef4d40
--- /dev/null
+++ b/src/parsec_server/include/sys_util_sv.h
@@ -0,0 +1,18 @@
+/*
+* PARSEC HEADER: sys_util_sv.h
+*/
+
+#ifndef _SYS_UTIL_SV_H_
+#define _SYS_UTIL_SV_H_
+
+// ----------------------------------------------------------------------------
+// SERVER SYSTEM SUBSYSTEM (SYS) UTILITY FUNCTIONS
+// ----------------------------------------------------------------------------
+
+void SYSs_InstallSignalHandlers();
+void SYSs_CleanUp();
+
+void SYS_HexDump( char* data, int len );
+
+#endif //_SYS_UTIL_SV_H_
+