diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-08-24 11:16:07 +0200 |
| commit | c068f22329d5cc722622a2183bbb22eef2093df7 (patch) | |
| tree | 12d56c1aede67988a55e241364606bfbb4dba933 /src/libparsec/include | |
| download | openparsec-main.tar.xz openparsec-main.zip | |
Diffstat (limited to 'src/libparsec/include')
86 files changed, 10663 insertions, 0 deletions
diff --git a/src/libparsec/include/con_arg.h b/src/libparsec/include/con_arg.h new file mode 100644 index 0000000..24de1bb --- /dev/null +++ b/src/libparsec/include/con_arg.h @@ -0,0 +1,68 @@ +/* + * PARSEC HEADER: con_arg.h + */ + +#ifndef _CON_ARG_H_ +#define _CON_ARG_H_ + + +// structure for key/value pairs + +struct key_value_s { + + const char* key; + char* value; + + dword flags; + dword _padto_16; +}; + +#define KEYVALFLAG_NONE 0x0000 +#define KEYVALFLAG_DISALLOW 0x0001 +#define KEYVALFLAG_IGNORE 0x0002 +#define KEYVALFLAG_MANDATORY 0x0004 +#define KEYVALFLAG_PARENTHESIZE 0x0008 + + +// structure for flag mapping spec + +struct flag_map_s { + + const char* name; + dword value; + int group; + dword _pad16; +}; + + +// external functions + +int ScanKeyValuePairs( key_value_s *table, char *kvstr ); +int ScanKeyValueInt( key_value_s *keyval, int *ival ); +int ScanKeyValueIntList( key_value_s *keyval, int *ilist, int minlen, int maxlen ); +int ScanKeyValueIntListBounded( key_value_s *keyval, int *ilist, int minlen, int maxlen, int minval, int maxval ); +int ScanKeyValueFloat( key_value_s *keyval, float *fval ); +int ScanKeyValueFloatList( key_value_s *keyval, float *flist, int minlen, int maxlen ); +int ScanKeyValueFloatListBounded( key_value_s *keyval, float *flist, int minlen, int maxlen, float minval, float maxval ); +int ScanKeyValueFlagList( key_value_s *keyval, dword *flagword, flag_map_s *flagmap ); +dword ScanKeyValueObjClass( key_value_s *keyval, int keyclass, int keyid ); + +char* GetParenthesizedName( char *name ); +int GetIntBehindCommand( char *cstr, int32 *iarg, int base, int paramoptional ); +const char* GetStringBehindCommand( char *scan, int paramoptional ); +int SetSingleStringCommand( char *cstr, char *dst, int dstmaxlen ); + +char* QueryIntArgument( const char *query, int *arg ); +char* QueryFltArgument( const char *query, float *arg ); +char* QueryIntArgumentEx( char *params, const char *query, int *arg ); +char* QueryFltArgumentEx( char *params, const char *query, float *arg ); +int CheckSetIntArgument( const char *query, const char *scan, const char *command, int *arg ); +int CheckSetFltArgument( const char *query, const char *scan, const char *command, float *arg ); +int CheckSetIntArgBounded( const char *query, const char *scan, char *command, int *arg, int bmin, int bmax, void (*func)() ); +int CheckSetIntArray( const char *query, char *scan, char *comstub, int *array, int numelements ); +int CheckSetStrArgument( int query, char *scan, char *command, char *string, int maxlen ); + + +#endif // _CON_ARG_H_ + + diff --git a/src/libparsec/include/con_tab.h b/src/libparsec/include/con_tab.h new file mode 100644 index 0000000..6cd0821 --- /dev/null +++ b/src/libparsec/include/con_tab.h @@ -0,0 +1,16 @@ +/* + * PARSEC HEADER: con_tab.h + */ + +#ifndef _CON_TAB_H_ +#define _CON_TAB_H_ + + +// external functions + +void CompleteCommand(); + + +#endif + + diff --git a/src/libparsec/include/con_vald.h b/src/libparsec/include/con_vald.h new file mode 100644 index 0000000..5fc9dc8 --- /dev/null +++ b/src/libparsec/include/con_vald.h @@ -0,0 +1,20 @@ +/* + * PARSEC HEADER: con_vald.h + */ + +#ifndef _CON_VALD_H_ +#define _CON_VALD_H_ + + +#define CON_ASCII_TABLE_LEN 128 +#define CON_ASCII_MASK 0x7f + + +// external variables + +extern int ConsoleASCIIValid[]; + + +#endif + + diff --git a/src/libparsec/include/config.h b/src/libparsec/include/config.h new file mode 100644 index 0000000..c3685c6 --- /dev/null +++ b/src/libparsec/include/config.h @@ -0,0 +1,170 @@ +/* + * PARSEC HEADER: config.h + */ + +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + + +//----------------------------------------------------------------------------- +// PROJECT GLOBAL FLAGS FOR CONDITIONAL COMPILATION - +//----------------------------------------------------------------------------- + +#include "platform.h" + + +// determine if fractional depth buffer values should be used (depth_t) ------- +// +#define FRACTIONAL_DEPTH_VALUES + + +// determine if screen space coordinates should be subpixel accurate ---------- +// +#define SCREENVERTEX_SUBPIXEL_ACCURACY + + +// determine whether the refframe frequency can be changed from the console --- +// +#define VARIABLE_REFFRAME_FREQUENCY + + +// determine whether cheats are allowed --------------------------------------- +// +#define ENABLE_CHEAT_COMMANDS + + +// determine whether to enable the LOGOUT command ----------------------------- +// +//#define ENABLE_LOGOUT_COMMAND + + +// determine whether to build the self running demo --------------------------- +// +//#define CLIENT_BUILD_SELF_RUNNING_DEMO + +// determine whether to build the lan-only version ---------------------------- +// +//#define CLIENT_BUILD_LAN_ONLY_VERSION + +// define these at the project level for the corresponding builds ------------- +// +//#define PARSEC_CLIENT // client build +//#define PARSEC_SERVER // gameserver build +//#define PARSEC_MASTER // masterserver build + + +// define current build number ------------------------------------------------ +// +#define CLIENT_BUILD_NUMBER "0200 (ver. 0.2)" +#define SERVER_BUILD_NUMBER "0200" +#define MASTER_BUILD_NUMBER "0200" + + +// determine that this is an internal only ( testing ) version ---------------- +// +#define INTERNAL_VERSION + + +// enable/disable dynamic function binding ------------------------------------ +// +//#define NO_DBIND + +#if !defined( NO_DBIND ) && !defined( PARSEC_SERVER ) + #define DBIND_PROTOCOL +#endif // NO_DBIND + +// define this to use the CURSES library for the server ----------------------- +// +#define USE_CURSES + +// miscellaneous conditions --------------------------------------------------- +// +//#define SHOW_COMPILER // used only in this file + + +// automatic host cpu selection if not already set ---------------------------- +// TODO: fixme? +// +#if !( defined( SYSTEM_CPU_INTEL ) || defined( SYSTEM_CPU_POWERPC ) ) + #define SYSTEM_CPU_INTEL +#endif + + +// define endianness constants according to host cpu -------------------------- +// +#if defined( SYSTEM_CPU_INTEL ) + #define SYSTEM_LITTLE_ENDIAN +#elif defined( SYSTEM_CPU_POWERPC ) + #define SYSTEM_BIG_ENDIAN +#else + #error "endianness not defined!" +#endif + + +// legacy defines ------------------------------------------------------------- +// +#ifdef SERVER_GAMESERVER + #error "replace SERVER_GAMESERVER with PARSEC_SERVER" +#endif // SERVER_GAMESERVER + +#ifdef SERVER_MASTERSERVER + #error "replace SERVER_MASTERSERVER with PARSEC_MASTER" +#endif // SERVER_MASTERSERVER + + +// check for correct project level defines ------------------------------------ +// +#if !( defined( PARSEC_CLIENT ) || defined( PARSEC_SERVER ) || defined( PARSEC_MASTER ) ) + #error "missing project level define PARSEC_CLIENT, PARSEC_SERVER or PARSEC_MASTER" +#endif + +// conditional code generation macros +// +#if defined ( PARSEC_CLIENT ) + #define CLIENT_ONLY( x ) { x } + #define SERVER_ONLY( x ) { } + #define MASTER_ONLY( x ) { } +#elif defined ( PARSEC_SERVER ) + #define CLIENT_ONLY( x ) { } + #define SERVER_ONLY( x ) { x } + #define MASTER_ONLY( x ) { } +#elif defined ( PARSEC_MASTER ) + #define CLIENT_ONLY( x ) { } + #define SERVER_ONLY( x ) { } + #define MASTER_ONLY( x ) { x } +#endif + + +// compiler-specific definitions ---------------------------------------------- +// +#ifdef SHOW_COMPILER + #if defined( SYSTEM_COMPILER_MSVC ) + #pragma message( "Compiling with Visual C++" ) + #elif defined( SYSTEM_COMPILER_CLANG ) + #pragma message( "Compiling with Clang" ) + #elif defined( SYSTEM_COMPILER_LLVM_GCC ) + #pragma message( "Compiling with LLVM-GCC" ) + #elif defined( SYSTEM_COMPILER_GCC ) + #pragma message( "Compiling with GCC" ) + #endif +#endif // SHOW_COMPILER + +#ifdef SYSTEM_COMPILER_MSVC + #pragma warning ( disable : 4305 ) + #define PATH_MAX _MAX_PATH +// #define vsnprintf _vsnprintf + #define snprintf _snprintf +#endif // SYSTEM_COMPILER_MSVC + +#if defined(SYSTEM_COMPILER_GCC) || defined(SYSTEM_COMPILER_CLANG) || defined(SYSTEM_COMPILER_LLVM_GCC) + +#ifndef PATH_MAX + #define PATH_MAX 255 // not always defined +#endif + +#endif //defined(SYSTEM_COMPILER_GCC) || defined(SYSTEM_COMPILER_CLANG) || defined(SYSTEM_COMPILER_LLVM_GCC) + + +#endif // _CONFIG_H_ + + diff --git a/src/libparsec/include/debug.h b/src/libparsec/include/debug.h new file mode 100644 index 0000000..43a0967 --- /dev/null +++ b/src/libparsec/include/debug.h @@ -0,0 +1,227 @@ +/* + * PARSEC HEADER + * Debugging Support V1.20 + * + * Copyright (c) Markus Hadwiger 1996-1999 + * All Rights Reserved. + */ + +#ifndef _DEBUG_H_ +#define _DEBUG_H_ + + +// debug control -------------------------------------------------------------- +// +#define PARSEC_DEBUG + + +// memory allocation control (also used in non-debug mode) -------------------- +// +#define USE_ALIGNED_MEMBLOCKS + + +// verbose assertions include the actual text of the evaluated expression ----- +// +//#define VERBOSE_ASSERTIONS + + +// debug control -------------------------------------------------------------- + +//NOTE: +// the following flags determine what checks are performed in debug mode. + +//#define LOG_MEMORY_BLOCKS +//#define EXTENSIVE_MEMORY_CHECKS +//#define CHECK_MEM_INTEGRITY_ON_FREE + + +// ---------------------------------------------------------------------------- + + + +#ifdef PARSEC_DEBUG + + // debug only statement encapsulation (pass through) + #define DBG(x) x + + // don't inline in debug build + #define INLINE + + // put private functions into global namespace + #define PRIVATE + #define PUBLIC + +#else // PARSEC_DEBUG + + // debug only statement encapsulation (eliminate) + #define DBG(x) + + // do inlining in release build + #define INLINE inline + + // declare private functions as static + #define PRIVATE static + #define PUBLIC + + // print warning message, when compiling RELEASE version + #ifdef ENABLE_CHEAT_COMMANDS + #ifdef SYSTEM_COMPILER_MSVC + #pragma message ( "WARNING: ENABLE_CHEAT_COMMANDS is defined in RELEASE build !" ) + #endif // SYSTEM_COMPILER_MSVC + #endif // ENABLE_CHEAT_COMMANDS + +#endif // PARSEC_DEBUG + + + +// define heap functions to use + +#define HEAP_ALLOC malloc // C runtime library malloc() +#define HEAP_FREE free // C runtime library free() + + +// used in function declarations to tell the compiler that the function won't return +#ifdef SYSTEM_COMPILER_MSVC + #define FUNCTION_NORETURN(x) __declspec(noreturn) x +#else + #define FUNCTION_NORETURN(x) x __attribute__((__noreturn__)) +#endif + + +// external functions + +void* _AlignedMalloc( size_t ); +void _AlignedFree( void* ); + +void _SysAssert( const char*, unsigned ); +void* _LogAllocMem( size_t ); +void _LogFreeMem( void* ); +void _CheckHeapBaseRef( void* ); +void _CheckHeapRef( void* ); +void _CheckMemIntegrity(); + + +// define function wrappers --------------------------------------------------- + +#ifdef PARSEC_DEBUG + + #include <assert.h> + #define ASSERT( f ) assert( f ) + + #ifdef LOG_MEMORY_BLOCKS + + #define ALLOCMEM( s ) _LogAllocMem( s ) + #define FREEMEM( m ) _LogFreeMem( m ) + + #else // LOG_MEMORY_BLOCKS + + #ifdef USE_ALIGNED_MEMBLOCKS + + #define ALLOCMEM( s ) _AlignedMalloc( s ) + #define FREEMEM( m ) _AlignedFree( m ) + + #else // USE_ALIGNED_MEMBLOCKS + + #define ALLOCMEM( s ) HEAP_ALLOC( s ) + #define FREEMEM( m ) HEAP_FREE( m ) + + #endif // USE_ALIGNED_MEMBLOCKS + + #endif // LOG_MEMORY_BLOCKS + + #ifdef EXTENSIVE_MEMORY_CHECKS + + #define CHECKHEAPBASEREF( r ) _CheckHeapBaseRef( r ) + #define CHECKHEAPREF( r ) _CheckHeapRef( r ) + #define CHECKMEMINTEGRITY() _CheckMemIntegrity() + + #else // EXTENSIVE_MEMORY_CHECKS + + #define CHECKHEAPBASEREF( r ) {} + #define CHECKHEAPREF( r ) {} + #define CHECKMEMINTEGRITY() {} + + #endif // EXTENSIVE_MEMORY_CHECKS + +#else // PARSEC_DEBUG + + #ifdef USE_ALIGNED_MEMBLOCKS + + #define ALLOCMEM( s ) _AlignedMalloc( s ) + #define FREEMEM( m ) _AlignedFree( m ) + + #else // USE_ALIGNED_MEMBLOCKS + + #define ALLOCMEM( s ) HEAP_ALLOC( s ) + #define FREEMEM( m ) HEAP_FREE( m ) + + #endif // USE_ALIGNED_MEMBLOCKS + + #define ASSERT( f ) {} + #define CHECKHEAPBASEREF( r ) {} + #define CHECKHEAPREF( r ) {} + #define CHECKMEMINTEGRITY() {} + +#endif // PARSEC_DEBUG + + + + + + +// message control ------------------------------------------------------------ +// + +//NOTE: the following flags determine, what messages get printed out by the +// various DBGTXT, UPDTXT, UPDTXT2, UPDTXT3, RMEVTXT, ADXTXT macros +// these flags were moved from NET_CONF.H as they prove generally useful + +#define DEBUG_TEXTS +#define SHOW_UPDATE_TEXT +#define RMEV_MESSAGES +#define PRINT_ADDRESSES + +#ifdef DEBUG_TEXTS + #define DBGTXT(x) { if ( AUX_ENABLE_CONSOLE_DEBUG_MESSAGES ) { x } else {} } +#else // !DEBUG_TEXTS + #define DBGTXT(x) +#endif // !DEBUG_TEXTS + +#ifdef SHOW_UPDATE_TEXT + #define UPDTXT(x) DBGTXT(x) +#else // !SHOW_UPDATE_TEXT + #define UPDTXT(x) +#endif // !SHOW_UPDATE_TEXT + +#ifdef SHOW_UPDATE_TEXT2 + #define UPDTXT2(x) DBGTXT(x) +#else // !SHOW_UPDATE_TEXT2 + #define UPDTXT2(x) +#endif // !SHOW_UPDATE_TEXT2 + +#ifdef SHOW_UPDATE_TEXT3 + #define UPDTXT3(x) DBGTXT(x) +#else // !SHOW_UPDATE_TEXT3 + #define UPDTXT3(x) +#endif // !SHOW_UPDATE_TEXT3 + +#ifdef RMEV_MESSAGES + #define RMEVTXT(x) DBGTXT(x) +#else // !RMEV_MESSAGES + #define RMEVTXT(x) +#endif // !RMEV_MESSAGES + +#ifdef PRINT_ADDRESSES + #define ADXTXT(x) DBGTXT(x) +#else // !PRINT_ADDRESSES + #define ADXTXT(x) +#endif // !PRINT_ADDRESSES + +#ifdef DMALLOC +#include "dmalloc.h" +#endif + + +#endif // _DEBUG_H_ + + diff --git a/src/libparsec/include/debugsys.h b/src/libparsec/include/debugsys.h new file mode 100644 index 0000000..a9e9a26 --- /dev/null +++ b/src/libparsec/include/debugsys.h @@ -0,0 +1,57 @@ +/* + * PARSEC HEADER + * System Debugging Functions V1.15 + * + * Copyright (c) Markus Hadwiger 1998-2000 + * All Rights Reserved. + */ + +#ifndef _DEBUGSYS_H_ +#define _DEBUGSYS_H_ + + + +// _SysAssert() calls this prior to aborting ---------------------------------- +// +void SysAssertCallback( const char *file, unsigned line ) +{ + +#if defined( SYSTEM_MACOSX_UNUSED ) + + #ifdef PARSEC_CLIENT + static char str[ 256 ]; + sprintf( str, "Assertion failed: %s, line %u\n", file, line ); + + extern void SX_ReportErrorString( char *msg ); + SX_ReportErrorString( str ); + #endif // PARSEC_CLIENT + +#elif defined( SYSTEM_WIN32_UNUSED ) && defined( PARSEC_CLIENT ) + + const char *msg = ( *file == '"' ) ? "%s, line %u" : "file %s, line %u"; + + extern void SW_WinError( const char *caption, const char *content, ... ); + SW_WinError( "Assertion failed", msg, file, line ); + +#else + + // nothing here ( + +#endif + +} + + +// ascertain a function's caller ---------------------------------------------- +// +// not able to determine caller +#define GETCALLER(c) c=_SysGetCaller(); +void *_SysGetCaller() +{ + return NULL; +} + + +#endif // _DEBUGSYS_H_ + + diff --git a/src/libparsec/include/def_draw.h b/src/libparsec/include/def_draw.h new file mode 100644 index 0000000..82f2ddc --- /dev/null +++ b/src/libparsec/include/def_draw.h @@ -0,0 +1,4 @@ +/* + * PARSEC HEADER: def_draw.h + */ + diff --git a/src/libparsec/include/def_papi.h b/src/libparsec/include/def_papi.h new file mode 100644 index 0000000..9bc922a --- /dev/null +++ b/src/libparsec/include/def_papi.h @@ -0,0 +1,4 @@ +/* + * PARSEC HEADER: def_papi.h + */ + diff --git a/src/libparsec/include/def_prot.h b/src/libparsec/include/def_prot.h new file mode 100644 index 0000000..9ca7d93 --- /dev/null +++ b/src/libparsec/include/def_prot.h @@ -0,0 +1,26 @@ +/* + * PARSEC HEADER: def_prot.h + */ + +int PFX( Connect, () ); +int PFX( Disconnect, () ); +int PFX( Join, () ); +int PFX( Unjoin, ( byte flag ) ); +int PFX( UpdateName, () ); +void PFX( MaintainNet, () ); + +// protocol api - game functions + +size_t PFX( RmEvList_GetMaxSize, () ); +void PFX( UpdateKillStats, ( RE_KillStats* killstats ) ); + +// protocol api - packet handling functions + +size_t PFX( HandleOutPacket, ( const NetPacket* gamepacket, NetPacketExternal* ext_gamepacket ) ); +size_t PFX( HandleOutPacket_DEMO, ( const NetPacket* gamepacket, NetPacketExternal* ext_gamepacket ) ); +int PFX( HandleInPacket, ( const NetPacketExternal* ext_gamepacket, const int ext_pktlen, NetPacket* gamepacket ) ); +int PFX( HandleInPacket_DEMO, ( const NetPacketExternal* ext_gamepacket, NetPacket* gamepacket, size_t* psize_external ) ); +size_t PFX( NetPacketExternal_DEMO_GetSize,( const NetPacketExternal* ext_gamepacket ) ); +void PFX( StdGameHeader, ( byte command, NetPacket* pIntPkt ) ); +void PFX( WritePacketInfo, ( FILE *fp, NetPacketExternal* ext_gamepacket ) ); + diff --git a/src/libparsec/include/def_rend.h b/src/libparsec/include/def_rend.h new file mode 100644 index 0000000..e131d02 --- /dev/null +++ b/src/libparsec/include/def_rend.h @@ -0,0 +1,4 @@ +/* + * PARSEC HEADER: def_rend.h + */ + diff --git a/src/libparsec/include/def_vid.h b/src/libparsec/include/def_vid.h new file mode 100644 index 0000000..28fe7de --- /dev/null +++ b/src/libparsec/include/def_vid.h @@ -0,0 +1,4 @@ +/* + * PARSEC HEADER: def_vid.h + */ + diff --git a/src/libparsec/include/e_modulemanager.h b/src/libparsec/include/e_modulemanager.h new file mode 100644 index 0000000..40b1dbb --- /dev/null +++ b/src/libparsec/include/e_modulemanager.h @@ -0,0 +1,87 @@ +#ifndef E_MODULEMANAGER_H_ +#define E_MODULEMANAGER_H_ + +// ---------------------------------------------------------------------------- +// +#define TheModuleManager (E_ModuleManager::GetModuleManager()) + +// forward decls -------------------------------------------------------------- +// +class E_Module; + +// ---------------------------------------------------------------------------- +// +typedef UTL_listentry_s<E_Module*> LE_Module; + +// ---------------------------------------------------------------------------- +// +class E_ModuleManager { +protected: + UTL_List<E_Module*> m_Modules; + +protected: + // register the console commands for managing modules + void _RegisterConsoleCommand() const; + + E_ModuleManager() + { + _RegisterConsoleCommand(); + }; + ~E_ModuleManager() + { + KillAllModules(); + m_Modules.RemoveAll(); + }; + +public: + // SINGLETON access + static E_ModuleManager* GetModuleManager() + { + static E_ModuleManager _TheModuleManager; + return &_TheModuleManager; + } + + // register a module + void RegisterModule( E_Module* pModule ); + + // unregister a module + void UnregisterModule( E_Module* pModule ); + + // init all registered modules ( constructor ) + void InitAllModules(); + + // kill all registered modules ( destructor ) + void KillAllModules(); + + // list all loaded modules in the console + void ListAll() const; +}; + +// ---------------------------------------------------------------------------- +// +class E_Module +{ +protected: + char m_szName[ 256 ]; +public: + E_Module( const char* pszName ); + virtual void Init() = 0; + virtual void Kill() = 0; + const char* GetName() const { return m_szName; } +}; + +// module registration macros (automatic module-init/deinit on startup) ------- +// +#define REGISTER_MODULE( f ) class E_Module_##f : public E_Module \ + { public: E_Module_##f( const char* pszName ) : E_Module( pszName ) {}; void Init(); void Kill() {}; } \ + inst_##f( #f ); \ + void E_Module_##f::Init() + +#define REGISTER_MODULE_INIT( f ) class E_Module_##f : public E_Module \ + { public: E_Module_##f( const char* pszName ) : E_Module( pszName ) {}; void Init(); void Kill(); } \ + inst_##f( #f ); \ + void E_Module_##f::Init() + +#define REGISTER_MODULE_KILL(f) void E_Module_##f::Kill() + +#endif // E_MODULEMANAGER_H_ diff --git a/src/libparsec/include/e_relist.h b/src/libparsec/include/e_relist.h new file mode 100644 index 0000000..6f39e54 --- /dev/null +++ b/src/libparsec/include/e_relist.h @@ -0,0 +1,328 @@ +/* +* PARSEC HEADER: e_relist.h +*/ + +#ifndef _E_RELIST_H_ +#define _E_RELIST_H_ + +// forward decls -------------------------------------------------------------- +// +class E_SimShipState; +class E_SimPlayerInfo; + + +//FIXME: this should be merged with DEBUG.C + +// easy access to the singleton ----------------------------------------------- +// +#define TheMemoryManager UTL_MemoryManager::GetMemoryManager() + +// set these wisely +#define MEMMAN_HASH_TABLE_SIZE 1001 +#define HASH_POINTER_ADDRESS(x) ( ((size_t)(x)) % MEMMAN_HASH_TABLE_SIZE ) + +// struct defining a entry in the memory manager ------------------------------ +// +class UTL_MemEntry +{ +protected: + UTL_MemEntry* m_pNext; + void* m_p; + const char* m_descr1; + const char* m_descr2; +public: + UTL_MemEntry( void* p = NULL, const char* descr1 = NULL, const char* descr2 = NULL ) : + m_pNext( NULL ), + m_p( p ), + m_descr1( descr1 ), + m_descr2( descr2 ) + { + } + + friend class UTL_MemoryManager; +}; + +// memory manager ------------------------------------------------------------- +// +class UTL_MemoryManager +{ +protected: + + UTL_MemEntry* m_HashTable[ MEMMAN_HASH_TABLE_SIZE ]; + + UTL_MemoryManager() + { + for( int nEntry = 0; nEntry < MEMMAN_HASH_TABLE_SIZE; nEntry++ ) { + m_HashTable[ nEntry ] = NULL; + } + } + ~UTL_MemoryManager() + { + CheckLeaks(); + } +public: + // SINGLETON pattern + static UTL_MemoryManager* GetMemoryManager() + { + static UTL_MemoryManager _TheMemoryManager; + return &_TheMemoryManager; + } + + // add a pointer for tracking + int AddTracking( void* p, const char* descr1, const char* descr2 ) + { + //MSGOUT( "UTL_MemoryManager::AddTracking(): %x, %s, %s", p, descr1, descr2 ); + + // get hash key + size_t htid = HASH_POINTER_ADDRESS( p ); + + // search hash table for already existing entry + for ( UTL_MemEntry* scan = m_HashTable[ htid ]; scan != NULL; scan = scan->m_pNext ) { + if ( scan->m_p == p ) { + // issue warning + MSGOUT( "UTL_MemManager::AddTracking(): duplicate call for pointer %x (%s, %s).", p, descr1, descr2 ); + return FALSE; + } + } + + // create new entry & prepend to list + UTL_MemEntry* newentry = new UTL_MemEntry( p, descr1, descr2 ); + newentry->m_pNext = m_HashTable[ htid ]; + m_HashTable[ htid ] = newentry; + + return TRUE; + } + + // remove a pointer from tracking + int RemoveTracking( void* p ) + { + // get hash key + size_t htid = HASH_POINTER_ADDRESS( p ); + + UTL_MemEntry* scan = m_HashTable[ htid ]; + if ( scan != NULL ) { + // check for head removal + if ( scan->m_p == p ) { + m_HashTable[ htid ] = scan->m_pNext; + //MSGOUT( "UTL_MemoryManager::RemoveTracking(): %x, %s, %s", scan->m_p, scan->m_descr1, scan->m_descr2 ); + delete scan; + return TRUE; + } + + // setup iteration + UTL_MemEntry* prev = scan; + scan = scan->m_pNext; + + for ( ; scan != NULL; scan = scan->m_pNext ) { + + if ( scan->m_p == p ) { + + // unlink from list + prev->m_pNext = scan->m_pNext; + //MSGOUT( "UTL_MemoryManager::RemoveTracking(): %x, %s, %s", scan->m_p, scan->m_descr1, scan->m_descr2 ); + delete scan; + return TRUE; + } + } + } + + // issue warning + MSGOUT( "UTL_MemManager::RemoveTracking(): tracking entry for pointer %x not found.", p ); + return FALSE; + } + + // dump all pointers we still track + void CheckLeaks() + { + for( int nEntry = 0; nEntry < MEMMAN_HASH_TABLE_SIZE; nEntry++ ) { + + for( UTL_MemEntry* scan = m_HashTable[ nEntry ]; scan != NULL; scan = scan->m_pNext ) { + MSGOUT( "UTL_MemManager::CheckLeaks(): leaked pointer %x (%s, %s)", scan->m_p, scan->m_descr1, scan->m_descr2 ); + } + } + } +}; + +// class holding a remote event list ------------------------------------------ +// +class E_REList +{ +protected: + char* m_data; + char* m_CurPos; + size_t m_Avail; + size_t m_nMaxSize; + + // reference counting stuff + int m_nRefCount; + ~E_REList(); + E_REList(); + E_REList( size_t size ); +public: + + // reference counting stuff + static E_REList* CreateAndAddRef( size_t size ) + { + E_REList* relist = new E_REList; + relist->AddRef(); +#ifdef PARSEC_DEBUG + TheMemoryManager->AddTracking( (void*)relist, __FILE__, "E_REList::CreateAndAddRef()" ); +#endif // PARSEC_DEBUG + relist->Init( size ); + return relist; + } + + void AddRef() { m_nRefCount++; } + void Release() + { + m_nRefCount--; + if ( m_nRefCount == 0 ) { +#ifdef PARSEC_DEBUG + TheMemoryManager->RemoveTracking( (void*)this ); +#endif // PARSEC_DEBUG + delete this; + } + } + + // init the remote event list + void Init( size_t size ); + + // return the internal data of the remote event list + RE_Header* GetData() { return (RE_Header*)m_data; } + + // return the size of the RE list + size_t GetSize() { return (size_t)( m_CurPos - m_data ); } + + // clear remote event list + int Clear(); + + // append a remote event list + int AppendList( RE_Header* relist ); + + // append a E_REList + int AppendList( E_REList* relist ); + + // append a remote event + size_t AppendEvent( RE_Header* re, size_t size ); + + // check whether we have any remote events in the list + int HasEvents() + { + return ( ( (RE_Header*) m_data)->RE_Type != RE_EMPTY ); + } + + // write to an external remote event list + size_t WriteTo( RE_Header* dst, size_t maxsize, int allow_truncate ); + + // check if enough space in RE_List for specified remote event + int RmEvAllowed( int re_type ); + + // dump contents of RE list + void Dump(); + + // allocate space for a specific RE + RE_Header* NET_Allocate( int retype ); + + // insert state sync remote event + int RmEvStateSync( byte statekey, byte stateval ); + + // append a RE_OwnerSection event + int NET_Append_RE_OwnerSection( int ownerid ); + + // insert command info into remote event list + int NET_Append_RE_CommandInfo( const char* commandstring ); + + // append a RE_PlayerAndShipStatus event + //FIXME: GAMECODE + //FIXME: consolidate naming with RmEv<remote-event-name> + int NET_Append_RE_PlayerAndShipStatus( int nClientID, E_SimPlayerInfo* pSimPlayerInfo, E_SimShipState* pSimShipState, refframe_t CurRefFrame, bool_t bUpdatePropsOnly ); + + // append a RE_GameState + //FIXME: GAMECODE + int NET_Append_RE_GameState(); + + // append a RE_KillStats event + //FIXME: GAMECODE + int NET_Append_RE_KillStats(); + + // append a RE_CreateLaser event + //FIXME: GAMECODE + int NET_Append_RE_CreateLaser( const LaserObject* laserpo ); + + // append a RE_CreateMissile event + //FIXME: GAMECODE + int NET_Append_RE_CreateMissile( const MissileObject *missilepo, dword targetobjid ); + + // Append a RE_CreateExtra event + int NET_Append_RE_CreateExtra( const ExtraObject *extrapo ); + + // append a RE_KillOjbect event + //FIXME: GAMECODE + int NET_Append_RE_KillObject( dword objectid, byte listno ); + + // append a RE_CreateExtra2 event + //FIXME: GAMECODE + int NET_Append_RE_CreateExtra2( const ExtraObject *extrapo ); + + // append a RE_IPv4ServerInfo event + int NET_Append_RE_IPv4ServerInfo( node_t* node, word nServerID, int xpos, int ypos, word flags ); + + // append a RE_ServerLinkInfo event + int NET_Append_RE_ServerLinkInfo( word nServerID_1, word nServerID_2, word flags ); + + // append a RE_MapObject + int NET_Append_RE_MapObject( int map_objectid, char* name, int xpos, int ypos, int w, int h, char* texname ); + + //Append a Particle RE (energy fields, megashield...etc) + int NET_Append_RE_ParticleObject( int type, const Vertex3& origin ); + + // determine the size of a remote-event list + static size_t DetermineListSize( RE_Header* relist ) + { + ASSERT( relist != NULL ); + + size_t lsize = 0; + + // process remote event list + while ( relist->RE_Type != RE_EMPTY ) { + + // sum up size of all remote events + size_t resize = RmEvGetSize( relist ); + lsize += resize; + + // advance to next event + ASSERT( ( relist->RE_BlockSize == RE_BLOCKSIZE_INVALID ) || + ( relist->RE_BlockSize == resize ) ); + relist = (RE_Header *) ( (char *) relist + resize ); + } + + // include size of RE list termination + lsize += sizeof( dword ); + + return lsize; + } + + // determine size of remote event + static size_t RmEvGetSize( RE_Header *relist ); + + // determine size of remote event from type + static size_t RmEvGetSizeFromType( byte retype ); + + // check whether the remote event list is well formed + static int IsWellFormed( RE_Header *relist ); + + // return the max. size of the RE list that can fit in one external packet + static size_t GetMaxSizeInPacket(); + + // validate the RE according to all bounds + static int ValidateRE( RE_Header* relist, size_t size ); + +protected: +}; + + +#define NET_RmEvList_GetSize E_REList::DetermineListSize +#define NET_RmEvList_IsWellFormed E_REList::IsWellFormed + + +#endif // _E_RELIST_H_ diff --git a/src/libparsec/include/g_emp.h b/src/libparsec/include/g_emp.h new file mode 100644 index 0000000..e0879a9 --- /dev/null +++ b/src/libparsec/include/g_emp.h @@ -0,0 +1,249 @@ +/* + * PARSEC HEADER: s_emp.h + */ + +#ifndef _S_EMP_H_ +#define _S_EMP_H_ + + + + +// use emp as duration weapon +#define EMP_FIRE_CONTINUOUSLY + + + + + +#define EMP_MAX_TEX_NAME 128 +// emp custom type structure -------------------------------------------------- +// +struct Emp : CustomObject { + + int upgradelevel; + Xmatrx WorldXmatrx; // object- to worldspace matrix + Vertex3* ObjVtxs; + Vertex3* WorldVtxs; // vertices in worldspace + TextureMap* texmap; + char texname[ EMP_MAX_TEX_NAME + 1 ]; + dword OwnerHostObjno; // needed for animation calculation + GenObject* ownerpo; + int Owner; + int vtxsnr; + int lod; + bams_t lat; + bams_t rot; + long alive; + int delay; + int red; + int green; + int blue; + int alpha; + dword damage; // hitpoints fractional per refframe +}; + +// number of upgrade levels --------------------------------------------------- +// +#define EMP_UPGRADES 3 + + +// preset emp type property values -------------------------------------------- +// +#define EMP_MAX_LIFETIME 6000 +#define EMP_MIN_LIFETIME 60 +#define EMP_MAX_WAVES 100 +#define EMP_MIN_WAVES 1 +#define EMP_MAX_DELAY 2400 +#define EMP_MIN_DELAY 0 + +// emp standard property values +#define EMP_TEXNAME "in01_00a.3df" +#define EMP_LOD 16 +#define EMP_MAX_WIDTH 200.0f +#define EMP_LAT 0x2000 // 45 deg +#define EMP_RED 220 +#define EMP_GREEN 220 +#define EMP_BLUE 220 +#define EMP_ALPHA 255 +#define EMP_LIFETIME 400 +#define EMP_FADEOUT 400 +#define EMP_LAMBDA 0.2 +#define EMP_ROT 32 +#define EMP_DELAY 200 +#define EMP_WAVES 1 +#define EMP_ENERGY 0 +#define EMP_DAMAGE 2000 + +// emp upgrade level 1 property values +#define EMP_UP1_TEXNAME "in01_00a.3df" +#define EMP_UP1_LOD 16 +#define EMP_UP1_MAX_WIDTH 200.0f +#define EMP_UP1_LAT 0x2000 // 45 deg +#define EMP_UP1_RED 220 +#define EMP_UP1_GREEN 220 +#define EMP_UP1_BLUE 220 +#define EMP_UP1_ALPHA 180 +#define EMP_UP1_LIFETIME 200 +#define EMP_UP1_FADEOUT 200 +#define EMP_UP1_LAMBDA 2.0 +#define EMP_UP1_ROT ( BAMS_DEG45 / 16 ) +#define EMP_UP1_DELAY 40 +#define EMP_UP1_WAVES 6 +#define EMP_UP1_ENERGY 6 +#define EMP_UP1_DAMAGE 1000 + +// emp upgrade level 2 property values +#define EMP_UP2_TEXNAME "in01_00a.3df" +#define EMP_UP2_LOD 16 +#define EMP_UP2_MAX_WIDTH 200.0f +#define EMP_UP2_LAT 0x2000 // 45 deg +#define EMP_UP2_RED 220 +#define EMP_UP2_GREEN 200 +#define EMP_UP2_BLUE 0 +#define EMP_UP2_ALPHA 90 +#define EMP_UP2_LIFETIME 800 +#define EMP_UP2_FADEOUT 800 +#define EMP_UP2_LAMBDA 4.0 +#define EMP_UP2_ROT 16 +#define EMP_UP2_DELAY 80 +#define EMP_UP2_WAVES 6 +#define EMP_UP2_ENERGY 40 +#define EMP_UP2_DAMAGE 2000 + + + +#define OFS_TEXNAME offsetof( Emp, texname ) +#define OFS_LOD offsetof( Emp, lod ) +#define OFS_LAT offsetof( Emp, lat ) +#define OFS_ROT offsetof( Emp, rot ) +#define OFS_RED offsetof( Emp, red ) +#define OFS_GREEN offsetof( Emp, green ) +#define OFS_BLUE offsetof( Emp, blue ) +#define OFS_ALPHA offsetof( Emp, alpha ) +#define OFS_DAMAGE offsetof( Emp, damage ) + + +// assigned type id for emp type ---------------------------------------------- +// +extern dword emp_type_id[ EMP_UPGRADES ]; + + +// full table for emp expansion ----------------------------------------------- +// +static float *emp_expansion_tab[ EMP_UPGRADES ] = { + NULL, NULL, NULL, +}; + + +// emp behaviour properties --------------------------------------------------- +// +static int emp_lifetime[ EMP_UPGRADES ] = { + EMP_LIFETIME, + EMP_UP1_LIFETIME, + EMP_UP2_LIFETIME, +}; +static geomv_t emp_max_width[ EMP_UPGRADES ] = { + FLOAT_TO_GEOMV( EMP_MAX_WIDTH ), + FLOAT_TO_GEOMV( EMP_UP1_MAX_WIDTH ), + FLOAT_TO_GEOMV( EMP_UP2_MAX_WIDTH ), +}; + +static float emp_lambda[ EMP_UPGRADES ] = { + EMP_LAMBDA, + EMP_UP1_LAMBDA, + EMP_UP2_LAMBDA, +}; + +static int emp_fadeout[ EMP_UPGRADES ] = { + EMP_FADEOUT, + EMP_UP1_FADEOUT, + EMP_UP2_FADEOUT, +}; + +static int emp_waves[ EMP_UPGRADES ] = { + EMP_WAVES, + EMP_UP1_WAVES, + EMP_UP2_WAVES, +}; + +static int emp_delay[ EMP_UPGRADES ] = { + EMP_DELAY, + EMP_UP1_DELAY, + EMP_UP2_DELAY, +}; + +static int emp_energy[ EMP_UPGRADES ] = { + EMP_ENERGY, + EMP_UP1_ENERGY, + EMP_UP2_ENERGY, +}; + + +// macro to set the properties of a itervertex -------------------------------- +// +#define SET_ITER_VTX( itvtx, vtx, u, v, r, g, b, a ) \ + (itvtx)->X = (vtx)->X; \ + (itvtx)->Y = (vtx)->Y; \ + (itvtx)->Z = (vtx)->Z; \ + (itvtx)->W = GEOMV_1; \ + (itvtx)->U = (u); \ + (itvtx)->V = (v); \ + (itvtx)->R = (r); \ + (itvtx)->G = (g); \ + (itvtx)->B = (b); \ + (itvtx)->A = (a); + + +// color combination macro ---------------------------------------------------- +// +#define COLOR_MUL(t,a,b) { \ + int tmp; \ + tmp = ( (int)(a) * (int)(b) ) / 255; \ + if ( tmp > 255 ) \ + tmp = 255; \ + (t) = tmp; \ +} + +#ifdef PARSEC_SERVER + +// mathematics header +#include "utl_math.h" + +// local module header +#include "e_gameserver.h" + +// proprietary module headers +#include "con_arg.h" +#include "con_aux_sv.h" +#include "con_com_sv.h" +#include "con_main_sv.h" +#include "e_colldet.h" +#include "g_extra.h" + +#include "obj_clas.h" +//#include "e_stats.h" +#include "g_main_sv.h" +#include "e_simulator.h" +#include "sys_refframe_sv.h" +#include "sys_util_sv.h" +#endif + +void CreateEmp( GenObject *ownerpo, int delay, int alive, int upgradelevel, int nClientID=0 ); +// external functions +#ifndef PARSEC_SERVER +void WFX_EmpBlast( ShipObject *shippo ); +void WFX_RemoteEmpBlast( ShipObject *shippo, int curupgrade ); +void WFX_CreateEmpWaves( ShipObject *shippo ); +int WFX_ActivateEmp( ShipObject *shippo ); +void WFX_DeactivateEmp( ShipObject *shippo ); +void WFX_RemoteActivateEmp( int playerid ); +void WFX_RemoteDeactivateEmp( int playerid ); +#else + +int EmpShipCollision( Emp *emp, ShipObject* shippo ); +int EmpAnimate( CustomObject *base ); +#endif + +#endif // _S_EMP_H_ + + diff --git a/src/libparsec/include/g_extra.h b/src/libparsec/include/g_extra.h new file mode 100644 index 0000000..e58be44 --- /dev/null +++ b/src/libparsec/include/g_extra.h @@ -0,0 +1,142 @@ +/* +* PARSEC HEADER: G_extra.h +*/ + +#ifndef _G_EXTRA_H_ +#define _G_EXTRA_H_ + +#ifdef PARSEC_CLIENT + //FIXME: move this into E_GLOBAL.H for the client + #define TheGameExtraManager (G_ExtraManager::GetExtraManager()) +#endif //PARSEC_CLIENT + +// class maintaining all EXTRA related stuff ---------------------------------- +// +class G_ExtraManager +{ +public: + + int ExtraProbability; + int MaxExtraArea; + int MinExtraDist; + int ProbHelixCannon; + int ProbLightningDevice; + int ProbPhotonCannon; + int ProbProximityMine; + int ProbMissilePack; + int ProbDumbMissPack; + int ProbHomMissPack; + int ProbSwarmMissPack; + int ProbRepairExtra; + int ProbAfterburner; + int ProbHoloDecoy; + int ProbInvisibility; + int ProbInvulnerability; + int ProbEnergyField; + int ProbLaserUpgrade; + int ProbLaserUpgrade1; + int ProbLaserUpgrade2; + int ProbEmpUpgrade1; + int ProbEmpUpgrade2; + +protected: + + G_ExtraManager(); + + // place extras after ship was shot down + void _PlaceShipExtras( int num, int objclass, ShipObject *shippo ); + + + // boost extra collected: energy boost + char* _CollectBoostEnergy( ShipObject* cur_ship, Extra1Obj* extra1po ); + + // boost extra collected: repair damage + char* _CollectBoostRepair( ShipObject* cur_ship, Extra1Obj* extra1po ); + + // package extra collected: dumb missiles + char* _CollectPackDumb( ShipObject* cur_ship, Extra2Obj* extra2po ); + + // package extra collected: guided missiles + char* _CollectPackGuide( ShipObject* cur_ship, Extra2Obj* extra2po ); + + // device extra collected: swarm missiles + char* _CollectPackSwarm( ShipObject* cur_ship, Extra2Obj* extra2po ); + + // package extra collected: proximity mines + char* _CollectPackMine( ShipObject* cur_ship, Extra2Obj* extra2po ); + + // device extra collected: helix cannon + char* _CollectDeviceHelix( ShipObject* cur_ship ); + + // device extra collected: lightning device + char* _CollectDeviceLightning( ShipObject* cur_ship ); + + // device extra collected: photon cannon + char* _CollectDevicePhoton( ShipObject* cur_ship ); + + // device extra collected: afterburner + char* _CollectDeviceAfterburner( ShipObject* cur_ship ); + + // device extra collected: invisibility + char* _CollectDeviceInvisibility( ShipObject* cur_ship ); + + // device extra collected: invulnerability + char* _CollectDeviceInvulnerability( ShipObject* cur_ship ); + + // device extra collected: decoy + char* _CollectDeviceDecoy( ShipObject* cur_ship ); + + // device extra collected: laser upgrade 1 + char* _CollectDeviceLaserUpgrade1( ShipObject* cur_ship ); + + // device extra collected: laser upgrade 2 + char* _CollectDeviceLaserUpgrade2( ShipObject* cur_ship ); + + // device extra collected: emp upgrade 1 + char* _CollectDeviceEmpUpgrade1( ShipObject* cur_ship ); + + // device extra collected: emp upgrade 2 + char* _CollectDeviceEmpUpgrade2( ShipObject* cur_ship ); + + // helper function when collecting devices + char* _CollectDevice( int nDevice, ShipObject* cur_ship ); + + // helper function when collecting specials + char* _CollectSpecial( int nSpecial, ShipObject* cur_ship ); + + // function when colliding with a mine + char* _CollisionProximityMine( Mine1Obj *minepo ); + +public: + + // SINGLETON pattern + static G_ExtraManager* GetExtraManager() + { + static G_ExtraManager _TheGameExtraManager; + return &_TheGameExtraManager; + } + + // place extras in vicinity of local ship object + void OBJ_DoExtraPlacement(); + + // create extras after ship was shot down + void OBJ_CreateShipExtras( ShipObject *shippo ); + + // fill member variables of extras + void OBJ_FillExtraMemberVars( ExtraObject* extrapo ); + + // kill extra that immediately follows passed node in list + void OBJ_KillExtra( ExtraObject* precnode, int collected ); + + // animate an extra + void OBJ_AnimateExtra( ExtraObject* extrapo ); + + + // perform action according to extra type and determine message to show + char* CollectExtra( ShipObject* cur_ship, ExtraObject* curextra ); + char* _CollectBoostEnergyField( ShipObject* cur_ship, int boost ); +}; + + + +#endif // _G_EXTRA_H_ diff --git a/src/libparsec/include/g_shipobject.h b/src/libparsec/include/g_shipobject.h new file mode 100644 index 0000000..f312914 --- /dev/null +++ b/src/libparsec/include/g_shipobject.h @@ -0,0 +1,214 @@ + + +class G_ShipObject : public ShipObject +{ +protected: +public: + + int BoostEnergy( int nEnergy ) + { + if ( CurEnergy == MaxEnergy ) { + return FALSE; + } else { + CurEnergy += nEnergy; + if ( CurEnergy > MaxEnergy ) { + CurEnergy = MaxEnergy; + } + return TRUE; + } + } + + int BoostRepair( int nRepair ) + { + if ( CurDamage == 0 ) { + return FALSE; + } else { + CurDamage -= nRepair; + if ( CurDamage < 0 ) { + CurDamage = 0; + } + return TRUE; + } + } + + int BoostMissiles( int nNumMissiles ) + { + if ( NumMissls == MaxNumMissls ) { + return FALSE; + } else { + NumMissls += nNumMissiles; + if ( NumMissls > MaxNumMissls ) { + NumMissls = MaxNumMissls; + } + return TRUE; + } + } + + int BoostHomMissiles( int nNumMissiles ) + { + if ( NumHomMissls == MaxNumHomMissls ) { + return FALSE; + } else { + NumHomMissls += nNumMissiles; + if ( NumHomMissls > MaxNumHomMissls ) { + NumHomMissls = MaxNumHomMissls; + } + return TRUE; + } + } + + int BoostPartMissiles( int nNumMissiles ) + { + if ( NumPartMissls == MaxNumPartMissls ) { + return FALSE; + } else { + NumPartMissls += nNumMissiles; + if ( NumPartMissls > MaxNumPartMissls ) { + NumPartMissls = MaxNumPartMissls; + } + return TRUE; + } + } + + int BoostMines( int nMines ) + { + if ( NumMines == MaxNumMines ) { + return FALSE; + } else { + NumMines += nMines; + if ( NumMines > MaxNumMines ) { + NumMines = MaxNumMines; + } + return TRUE; + } + } + + int CollectDevice( int mask ) + { + if ( ( Weapons & mask ) == 0 ) { + Weapons |= mask; + return TRUE; + } else { + return FALSE; + } + } + + // enable afterburner function ------------------------------------------------ + // + void EnableAfterBurner() + { + // set active flag + Specials |= SPMASK_AFTERBURNER; + afterburner_energy = AFTERBURNER_ENERGY; + } + + // enable invisibility function ----------------------------------------------- + // + void EnableInvisibility() + { + // set active flag + Specials |= SPMASK_INVISIBILITY; + + //TODO: + // well, nobody got around to implementing this :) + } + + + // enable invulnerability function -------------------------------------------- + // + void EnableInvulnerability() + { +#ifdef PARSEC_CLIENT + // create particle cluster visualizing invulnerability shield + if ( SFX_EnableInvulnerabilityShield( (ShipObject*)this ) ) { + + // set active flag + Specials |= SPMASK_INVULNERABILITY; + + // set shield strength + MegaShieldAbsorption = MegaShieldStrength; + } +#elif defined ( PARSEC_SERVER ) + + // set active flag + Specials |= SPMASK_INVULNERABILITY; + + // set shield strength + MegaShieldAbsorption = TheGame->MegaShieldStrength; +#endif + } + + // enable decoy device -------------------------------------------------------- + // + void EnableDecoy() + { + // set active flag + Specials |= SPMASK_DECOY; + } + + + // enable laser upgrade 1 ---------------------------------------------------- + // + void EnableLaserUpgrade1() + { + // set active flag + Specials |= SPMASK_LASER_UPGRADE_1; + } + + + // enable laser upgrade 2 ---------------------------------------------------- + // + void EnableLaserUpgrade2() + { + // set active flag + Specials |= SPMASK_LASER_UPGRADE_2; + } + + + // enable emp upgrade 1 ------------------------------------------------------ + // + void EnableEmpUpgrade1() + { + // set active flag + Specials |= SPMASK_EMP_UPGRADE_1; + } + + + // enable emp upgrade 2 ------------------------------------------------------ + // + void EnableEmpUpgrade2() + { + // set active flag + Specials |= SPMASK_EMP_UPGRADE_2; + } + + + int CollectSpecial( int mask ) + { + switch( mask ) { + case SPMASK_AFTERBURNER: + EnableAfterBurner(); + break; + case SPMASK_INVISIBILITY: + EnableInvisibility(); + break; + case SPMASK_INVULNERABILITY: + EnableInvulnerability(); + break; + case SPMASK_DECOY: + EnableDecoy(); + break; + default: + //NOTE: all other specials must be handled by directly calling the Enable* function + ASSERT( FALSE ); + break; + } + + if ( ( Specials & mask ) == 0 ) { + return TRUE; + } else { + return FALSE; + } + } +}; + diff --git a/src/libparsec/include/g_stgate.h b/src/libparsec/include/g_stgate.h new file mode 100644 index 0000000..2f838b2 --- /dev/null +++ b/src/libparsec/include/g_stgate.h @@ -0,0 +1,69 @@ +/* + * PARSEC HEADER: s_stgate.h + */ + +#ifndef _S_STGATE_H_ +#define _S_STGATE_H_ + + +// forward declaration +struct genobject_pcluster_s; + + +// stargate limits ------------------------------------------------------------ +// +#define STARGATE_MAX_DEST_IP 255 + + +// stargate custom type structure --------------------------------------------- +// +struct Stargate : CustomObject { + + // properties + bams_t rotspeed; + float radius; + geomv_t actdistance; + int dormant; + int active; + int autoactivate; + int numpartactive; + int actcyllen; + float partvel; + bams_t modulspeed; + float modulrad1; + float modulrad2; + float modulfade; + int acttime; + char flare_name [ MAX_TEXNAME + 1 ]; + char interior_name[ MAX_TEXNAME + 1 ]; + + // internal data + word serverid; + char destination_name[ MAX_SERVER_NAME + 1 ]; + //char destination_ip[ STARGATE_MAX_DEST_IP + 1 ]; + //word destination_port; + node_t destination_node; + bams_t modulate_bams; + int curactcyllen; + int activating; + int manually_activated; + float actring; + genobject_pcluster_s* pcluster; + Vertex3* interior_vtxlist; // vtxs in object space + Vertex3* interior_viewvtxs; // vtxs in view space + geomv_t* interior_u; // u texture coordinates + geomv_t* interior_v; // v texture coordinates + TextureMap* interior_texmap; + int ping; + refframe_t lastpinged; +}; + + +// external functions --------------------------------------------------------- +// +// (none) + + +#endif // _S_STGATE_H_ + + diff --git a/src/libparsec/include/gd_bmap.h b/src/libparsec/include/gd_bmap.h new file mode 100644 index 0000000..d48ead0 --- /dev/null +++ b/src/libparsec/include/gd_bmap.h @@ -0,0 +1,147 @@ +/* + * PARSEC HEADER: gd_bmap.h + */ + +#ifndef _GD_BMAP_H_ +#define _GD_BMAP_H_ + + +// ---------------------------------------------------------------------------- +// BITMAP INDEXES - +// ---------------------------------------------------------------------------- + + +// indexes of bitmaps in global bitmap table ---------------------------------- +// +#define BM_CROSSHAIR 0 +#define BM_RADAR 1 +#define BM_MSTAR1 2 +#define BM_MSTAR2 3 +#define BM_MSTAR3 4 +#define BM_MSTAR4 5 +#define BM_BIGPLANET1 6 +#define BM_SCLSTR1 7 +#define BM_SCLSTR2 8 +#define BM_MEDPLANET1 9 +#define BM_MINPLANET1 10 +#define BM_TARGET 11 + +#define BM_EXPLANIMBASE 12 // first frame of explosion animation +#define BM_NUMEXPLFRAMES 12 // number of frames for explosion + +#define BM_NEBULA 24 +#define BM_LOGO1 25 +#define BM_LOGO2 26 +#define BM_SHIP1_BLUEPRINT 27 +#define BM_SHIP2_BLUEPRINT 28 +#define BM_ROCKET1 29 +#define BM_ROCKET2 30 +#define BM_CROSSHAIR2 31 +#define BM_CROSSHAIR3 32 +#define BM_MINE 33 +#define BM_GUN1 34 +#define BM_GUN2 35 +#define BM_GUN3 36 +#define BM_OBJSLOGO 37 +#define BM_VIEWLOGO 38 +#define BM_LEFTARROW 39 +#define BM_RIGHTARROW 40 +#define BM_SELECT 41 +#define BM_SUN 42 +#define BM_LIGHTNING2 43 +#define BM_LIGHTNING1 44 +#define BM_FIREBALL1 45 +#define BM_FIREBALL2 46 +#define BM_SHIELD1 47 +#define BM_SHIELD2 48 +#define BM_PROPFUMES1 49 +#define BM_PROPFUMES2 50 +#define BM_PROPFUMES3 51 +#define BM_FIREBALL3 52 +#define BM_LENSFLARE1 53 +#define BM_LENSFLARE2 54 +#define BM_LENSFLARE3 55 +#define BM_LENSFLARE4 56 + +#define BM_CONTROLFILE_NUMBER 57 // number of bitmaps in control file + + +// names of default (control file-loaded) bitmaps ----------------------------- +// +#define BM_NAME_CROSSHAIR "crosshair" +#define BM_NAME_RADAR "radar" +#define BM_NAME_MSTAR1 "mstar1" +#define BM_NAME_MSTAR2 "mstar2" +#define BM_NAME_MSTAR3 "mstar3" +#define BM_NAME_MSTAR4 "mstar4" +#define BM_NAME_BIGPLANET1 "bigplanet1" +#define BM_NAME_SCLSTR1 "sclstr1" +#define BM_NAME_SCLSTR2 "sclstr2" +#define BM_NAME_MEDPLANET1 "medplanet1" +#define BM_NAME_MINPLANET1 "minplanet1" +#define BM_NAME_TARGET "target" +#define BM_NAME_EXPLANIM01 "explanim01" +#define BM_NAME_EXPLANIM02 "explanim02" +#define BM_NAME_EXPLANIM03 "explanim03" +#define BM_NAME_EXPLANIM04 "explanim04" +#define BM_NAME_EXPLANIM05 "explanim05" +#define BM_NAME_EXPLANIM06 "explanim06" +#define BM_NAME_EXPLANIM07 "explanim07" +#define BM_NAME_EXPLANIM08 "explanim08" +#define BM_NAME_EXPLANIM09 "explanim09" +#define BM_NAME_EXPLANIM10 "explanim10" +#define BM_NAME_EXPLANIM11 "explanim11" +#define BM_NAME_EXPLANIM12 "explanim12" +#define BM_NAME_NEBULA "nebula" +#define BM_NAME_LOGO1 "logo1" +#define BM_NAME_LOGO2 "logo2" +#define BM_NAME_SHIP1_BLUEPRINT "ship1_blueprint" +#define BM_NAME_SHIP2_BLUEPRINT "ship2_blueprint" +#define BM_NAME_ROCKET1 "rocket1" +#define BM_NAME_ROCKET2 "rocket2" +#define BM_NAME_CROSSHAIR2 "crosshair2" +#define BM_NAME_CROSSHAIR3 "crosshair3" +#define BM_NAME_MINE "mine" +#define BM_NAME_GUN1 "gun1" +#define BM_NAME_GUN2 "gun2" +#define BM_NAME_GUN3 "gun3" +#define BM_NAME_OBJSLOGO "objslogo" +#define BM_NAME_VIEWLOGO "viewlogo" +#define BM_NAME_LEFTARROW "leftarrow" +#define BM_NAME_RIGHTARRORW "rightarrow" +#define BM_NAME_SELECT "select" +#define BM_NAME_SUN "sun" +#define BM_NAME_LIGHTNING2 "lightning2" +#define BM_NAME_LIGHTNING1 "lightning1" +#define BM_NAME_FIREBALL1 "fireball1" +#define BM_NAME_FIREBALL2 "fireball2" +#define BM_NAME_SHIELD1 "shield1" +#define BM_NAME_SHIELD2 "shield2" +#define BM_NAME_PROPFUMES1 "propfumes1" +#define BM_NAME_PROPFUMES2 "propfumes2" +#define BM_NAME_PROPFUMES3 "propfumes3" +#define BM_NAME_FIREBALL3 "fireball3" +#define BM_NAME_LENSFLARE1 "lensflare1" +#define BM_NAME_LENSFLARE2 "lensflare2" +#define BM_NAME_LENSFLARE3 "lensflare3" +#define BM_NAME_LENSFLARE4 "lensflare4" + + +// names of non-default bitmaps (which have no predefined id) ----------------- +// +#define BM_NAME_RADAR2 "radar2" + + +// explosion animation definitions -------------------------------------------- +// +#define BM_EXPLVANISHFRAME 5 // the target vanishes in this frame +#define BM_EXPLNOTARGFRAME 3 // the target is lost in this frame +#define BM_EXPLPARTCLFRAME 3 // particle explosion starts in this frame + +#define EXPL_REF_SPEED 64 +#define MAX_EXPLOSION_COUNT ( BM_NUMEXPLFRAMES * EXPL_REF_SPEED - 1 ) + + +#endif // _GD_BMAP_H_ + + diff --git a/src/libparsec/include/gd_color.h b/src/libparsec/include/gd_color.h new file mode 100644 index 0000000..8ac73a6 --- /dev/null +++ b/src/libparsec/include/gd_color.h @@ -0,0 +1,57 @@ +/* + * PARSEC HEADER: gd_color.h + */ + +#ifndef _GD_COLOR_H_ +#define _GD_COLOR_H_ + + +// ---------------------------------------------------------------------------- +// COLOR TYPES - +// ---------------------------------------------------------------------------- + + +// RGB color triplet (mainly used for vga compatible palette entries) --------- +// +struct colrgb_s { + union { + struct { + byte R; + byte G; + byte B; + }; + byte index[3]; + }; +}; + + +// RGBA color specification with alpha component (standard color type) -------- +// +struct colrgba_s { + union { + struct { + byte R; + byte G; + byte B; + byte A; + }; + byte index[4]; + }; +}; + + +// color type for the currently active framebuffer color format --------------- +// +typedef dword visual_t; + + +// helper macros -------------------------------------------------------------- +// +#define SETRGBA( x, r,g,b,a ) { (x)->R = r; (x)->G = g; (x)->B = b; (x)->A = a; } +#define SETRGB ( x, r,g,b ) { (x)->R = r; (x)->G = g; (x)->B = b; } + + + +#endif // _GD_COLOR_H_ + + diff --git a/src/libparsec/include/gd_const.h b/src/libparsec/include/gd_const.h new file mode 100644 index 0000000..749c1be --- /dev/null +++ b/src/libparsec/include/gd_const.h @@ -0,0 +1,63 @@ +/* + * PARSEC HEADER: gd_const.h + */ + +#ifndef _GD_CONST_H_ +#define _GD_CONST_H_ + + +// ---------------------------------------------------------------------------- +// GLOBAL CONSTANTS - +// ---------------------------------------------------------------------------- + + +// frequency in hertz for ref-frames (number of ref-frames per second) -------- +// +#define DEFAULT_REFFRAME_FREQUENCY 600 + +#ifdef VARIABLE_REFFRAME_FREQUENCY + #define FRAME_MEASURE_TIMEBASE RefFrameFrequency +#else + #define FRAME_MEASURE_TIMEBASE DEFAULT_REFFRAME_FREQUENCY +#endif + + +// size of padding area appended to render segment ---------------------------- +// +#define RSEG_PADDING_SIZE (640*20) + + +// packet recv rates (bytes/sec) ---------------------------------------------- +// +#define CLIENT_RECV_RATE_MAX 100000 //FIXME: reasonable ? +#define CLIENT_RECV_RATE_1 8000 +#define CLIENT_RECV_RATE_2 4000 +#define CLIENT_RECV_RATE_3 2000 +#define CLIENT_RECV_RATE_MIN 10 //FIXME: reasonable ? + +// default rate (bytes/sec) for S->C traffic ---------------------------------- +// +#define DEFAULT_CLIENT_RECV_RATE CLIENT_RECV_RATE_1 + +// packet send frequencies ---------------------------------------------------- +// +#define CLIENT_SEND_FREQUENCY_MAX 100 //FIXME: reasonable ? +#define CLIENT_SEND_FREQUENCY_1 20 +#define CLIENT_SEND_FREQUENCY_2 15 +#define CLIENT_SEND_FREQUENCY_3 10 +#define CLIENT_SEND_FREQUENCY_MIN 1 + +// default frequency (packets/sec) for C->S traffic --------------------------- +// +#define DEFAULT_CLIENT_SEND_FREQUENCY CLIENT_SEND_FREQUENCY_1 + +// detail codes --------------------------------------------------------------- +// +#define DETAIL_LOW 0 +#define DETAIL_MEDIUM 1 +#define DETAIL_HIGH 2 + + +#endif // _GD_CONST_H_ + + diff --git a/src/libparsec/include/gd_font.h b/src/libparsec/include/gd_font.h new file mode 100644 index 0000000..3b11edf --- /dev/null +++ b/src/libparsec/include/gd_font.h @@ -0,0 +1,25 @@ +/* + * PARSEC HEADER: gd_font.h + */ + +#ifndef _GD_FONT_H_ +#define _GD_FONT_H_ + + +// ---------------------------------------------------------------------------- +// FONT INDEXES - +// ---------------------------------------------------------------------------- + + +// indexes of fonts in global charset table ----------------------------------- +// +#define MSG_CHARSETNO 0 // 16x16 font for four line message area +#define MIN_CHARSETNO 1 // 4x9 extremely small font; barely legible +#define HUD_CHARSETNO 2 // 8x8 font for console and most hud output +#define TGO_CHARSETNO 3 +#define GLD_CHARSETNO 4 // proportional font for 8bit menu + + +#endif // _GD_FONT_H_ + + diff --git a/src/libparsec/include/gd_heads.h b/src/libparsec/include/gd_heads.h new file mode 100644 index 0000000..b958294 --- /dev/null +++ b/src/libparsec/include/gd_heads.h @@ -0,0 +1,132 @@ +/* + * PARSEC HEADER: gd_heads.h + */ + +#ifndef _GD_HEADS_H_ +#define _GD_HEADS_H_ + + +// ---------------------------------------------------------------------------- +// DATA FILE HEADER DEFINITIONS - +// ---------------------------------------------------------------------------- + + +// filepack: structure of file package header --------------------------------- +// +struct packageheader_s { + + char signature[ 16 ]; + dword numitems; + dword headersize; + dword datasize; + dword packsize; +}; + + +// filepack: structure of single entry in info list in memory ----------------- +// +struct pfileinfo_s { + + char *file; + dword foffset; + dword flength; + FILE *fp; + dword fcurpos; +}; + + +// filepack: structure of single entry in info list on storage device --------- +// +struct pfileinfodisk_s { + + char file[ 16 ]; + dword foffset; + dword flength; + dword fp; // dword instead of FILE* because packed .dat file requires it to be 32 bits + dword fcurpos; +}; + + +// parpfg format (parsec font info files) ------------------------------------- +// +struct PfgHeader { + + char signature[7]; + byte version; + int srcwidth; + short width; + short height; +}; + +#define PFG_SIGNATURE "PARPFG" +#define REQUIRED_PFG_VERSION 0x01 + + +// parfnt format (parsec font files) ------------------------------------------ +// +struct FntHeader { + + char signature[7]; + byte version; + int width; + int height; +}; + +#define FNT_SIGNATURE "PARFNT" +#define REQUIRED_FNT_VERSION 0x01 +#define FONT_EXTENSION "fnt" + + +// partex format (parsec texture data files) ---------------------------------- +// +struct TexHeader { + + char signature[7]; + byte version; + int width; + int height; +}; + +#define TEX_SIGNATURE "PARTEX" +#define REQUIRED_TEX_VERSION 0x01 + + +// parbdt format (parsec bitmap data files) ----------------------------------- +// +struct BdtHeader { + + char signature[7]; + byte version; + int width; + int height; +}; + +#define BDT_SIGNATURE "PARBDT" +#define REQUIRED_BDT_VERSION 0x01 + + +// pardem format (parsec demo data files) -------------------------------------- +// +struct DemHeader { + + char signature[7]; + byte version; + dword headersize; +}; + +#define DEM_SIGNATURE "PARDEM" +#define REQUIRED_DEM_VERSION 0x01 + +enum { + + DEMO_KEY_TITLE = 0x01, + DEMO_KEY_DESCRIPTION = 0x02, + DEMO_KEY_AUTHOR = 0x03, + + NUM_DEMO_KEYS // must be last in list +}; + + +#endif // _GD_HEADS_H_ + + diff --git a/src/libparsec/include/gd_help.h b/src/libparsec/include/gd_help.h new file mode 100644 index 0000000..4185804 --- /dev/null +++ b/src/libparsec/include/gd_help.h @@ -0,0 +1,77 @@ +/* + * PARSEC HEADER: gd_help.h + */ + +#ifndef _GD_HELP_H_ +#define _GD_HELP_H_ + + +// ---------------------------------------------------------------------------- +// MISCELLANEOUS HELPER MACROS - +// ---------------------------------------------------------------------------- + + +// module registration macros (automatic module-init/deinit on startup) ------- +// +//#define REGISTER_MODULE(f) struct reg_##f {reg_##f();} inst_##f; reg_##f::reg_##f() +//#define REGISTER_MODULE_INIT(f) struct reg_##f {reg_##f(); ~reg_##f();} inst_##f; reg_##f::reg_##f() +//#define REGISTER_MODULE_KILL(f) reg_##f::~reg_##f() + +// for C++ min/max functions -------------------------------------------------- +// +#include <algorithm> + +// new module handling -------------------------------------------------------- +// +#include "e_modulemanager.h" + +// automatically calculate the number of entries of an arbitrary array -------- +// +#define CALC_NUM_ARRAY_ENTRIES(a) (sizeof(a)/sizeof((a)[0])) + + +// conversion macros for 5, 4, 3, and 2 digit values -------------------------- +// +#define DIG5_TO_STR( s, a ) (s)[0]=(((a)/10000)%10)+'0';\ + (s)[1]=(((a)/1000)%10)+'0';\ + (s)[2]=(((a)/100)%10)+'0';\ + (s)[3]=(((a)/10)%10)+'0';\ + (s)[4]=((a)%10)+'0';\ + (s)[5]='\0'; + +#define DIG4_TO_STR( s, a ) (s)[0]=(((a)/1000)%10)+'0';\ + (s)[1]=(((a)/100)%10)+'0';\ + (s)[2]=(((a)/10)%10)+'0';\ + (s)[3]=((a)%10)+'0';\ + (s)[4]='\0'; + +#define DIG3_TO_STR( s, a ) (s)[0]=(((a)/100)%10)+'0';\ + (s)[1]=(((a)/10)%10)+'0';\ + (s)[2]=((a)%10)+'0';\ + (s)[3]='\0'; + +#define DIG2_TO_STR( s, a ) (s)[0]=(((a)/10)%10)+'0';\ + (s)[1]=((a)%10)+'0';\ + (s)[2]='\0'; + + +// define wrapper around pseudo random number generator ----------------------- +// +#define RAND() rand() + + +// min/max functions ---------------------------------------------------------- +// +using std::min; +using std::max; + + +// safe string duplication ---------------------------------------------------- +// +#define SAFE_STR_DUPLICATE( dst, src, len ) char dst[ len + 1 ]; \ + strncpy( dst, src, len ); \ + dst[ len ] = 0; + +#endif // _GD_HELP_H_ + + diff --git a/src/libparsec/include/gd_host.h b/src/libparsec/include/gd_host.h new file mode 100644 index 0000000..96115bd --- /dev/null +++ b/src/libparsec/include/gd_host.h @@ -0,0 +1,79 @@ +/* + * PARSEC HEADER: gd_host.h + */ + +#ifndef _GD_HOST_H_ +#define _GD_HOST_H_ + + +// ---------------------------------------------------------------------------- +// HOST BYTE ORDER/WORD SIZE RELATED MACROS - +// ---------------------------------------------------------------------------- + + +// endianness conversion functions -------------------------------------------- +// +#define FORCESWAP_16(s) ( ((word)(s) >> 8) | ((word)(s) << 8) ) +#define FORCESWAP_32(l) ( ( ((dword)(l) ) << 24 ) | \ + ( ((dword)(l) ) >> 24 ) | \ + ( ((dword)(l) & 0x0000ff00) << 8 ) | \ + ( ((dword)(l) & 0x00ff0000) >> 8 ) ) + +#ifdef SYSTEM_BIG_ENDIAN + + // little endian to host (and vice versa) + #define SWAP_16(s) FORCESWAP_16(s) + #define SWAP_32(l) FORCESWAP_32(l) + + // big endian to host (and vice versa) + #define SWAP_16_BIG(s) (s) + #define SWAP_32_BIG(l) (l) + +#else + + // little endian to host (and vice versa) + #define SWAP_16(s) (s) + #define SWAP_32(l) (l) + + // big endian to host (and vice versa) + #define SWAP_16_BIG(s) FORCESWAP_16(s) + #define SWAP_32_BIG(l) FORCESWAP_32(l) + +#endif // SYSTEM_BIG_ENDIAN + + +// conversion from seg:ofs address to linear address (DOS32 only) ------------- +// +#define MK_LINEAR(seg,ofs) ((void*)((seg<<4)+ofs)) + + +// lo and hi byte and word functions (intentionally not named like in win32) -- +// +#ifndef LO_BYTE + #define LO_BYTE(w) ((byte)(w)) +#endif + +#ifndef HI_BYTE + #define HI_BYTE(w) ((byte)((w)>>8)) +#endif + +#ifndef LO_WORD + #define LO_WORD(l) ((word)(l)) +#endif + +#ifndef HI_WORD + #define HI_WORD(l) ((word)((l)>>16)) +#endif + +#ifndef MAKE_WORD + #define MAKE_WORD(l,h) (((byte)(l))|(((word)(byte)(h))<<8)) +#endif + +#ifndef MAKE_DWORD + #define MAKE_DWORD(l,h) (((word)(l))|(((dword)(word)(h))<<16)) +#endif + + +#endif // _GD_HOST_H_ + + diff --git a/src/libparsec/include/gd_limit.h b/src/libparsec/include/gd_limit.h new file mode 100644 index 0000000..0656032 --- /dev/null +++ b/src/libparsec/include/gd_limit.h @@ -0,0 +1,72 @@ +/* + * PARSEC HEADER: gd_limit.h + */ + +#ifndef _GD_LIMIT_H_ +#define _GD_LIMIT_H_ + + +// ---------------------------------------------------------------------------- +// ARBITRARY LIMITATIONS - +// ---------------------------------------------------------------------------- + + +// maximum numbers of object-types and object-classes ------------------------- +// +#define MAX_DISTINCT_OBJTYPES 32 +#define MAX_DISTINCT_OBJCLASSES 128 + + +// maximum numbers of data items ---------------------------------------------- +// +#define MAX_TEXTURES 1024 +#define MAX_TEXFONTS 16 +#define MAX_BITMAPS 128 +#define MAX_CHARSETS 16 +#define MAX_SAMPLES 96 +#define MAX_SONGS 16 + + +// maximum numbers of pseudo-stars and fixed-stars ---------------------------- +// +#define MAX_PSEUDO_STARS 512 +#define MAX_FIXED_STARS 120 + + +// maximum number of vertices of an iterpoly n-gon ---------------------------- +// +#define MAX_ITERPOLY_VERTICES 31 + + +// maximum number of vertices of an iterline line-strip ----------------------- +// +#define MAX_ITERLINE_VERTICES 128 + + +// message area limits -------------------------------------------------------- +// +#define MAX_MESSAGELEN 127 +#define MAX_SCREENMESSAGES 16 + + +// texfont message limits ----------------------------------------------------- +// +#define MAX_TEXFONT_MESSAGES 16 + + +// maximum name string lengths (excluding terminating zero) ------------------- +// +#define MAX_TEXNAME 31 +#define MAX_OBJNAME 31 +#define MAX_SAMNAME 31 +#define MAX_SNGNAME 31 + + +// maximum length of player name (network game) ------------------------------- +// +#define MAX_PLAYER_NAME 31 + + +#endif // _GD_LIMIT_H_ + + diff --git a/src/libparsec/include/gd_tabs.h b/src/libparsec/include/gd_tabs.h new file mode 100644 index 0000000..a405f21 --- /dev/null +++ b/src/libparsec/include/gd_tabs.h @@ -0,0 +1,134 @@ +/* + * PARSEC HEADER: gd_tabs.h + */ + +#ifndef _GD_TABS_H_ +#define _GD_TABS_H_ + + +// ---------------------------------------------------------------------------- +// GLOBAL DATA INFO TABLES - +// ---------------------------------------------------------------------------- + + +// object lod info ------------------------------------------------------------ +// +struct lodinfo_s { + + int numlods; + char** filetab; + geomv_t* lodmags; + geomv_t* lodmins; +}; + + +// object info table ---------------------------------------------------------- +// +struct objectinfo_s { + + dword type; // object type code + char* name; // object name (must be unique!) + char* file; // file object has been read from + lodinfo_s* lodinfo; // optional lod specification +}; + + +// texture info table --------------------------------------------------------- +// +struct textureinfo_s { + + TextureMap* texpointer; // pointer to actual texture struct + dword flags; // flagword + int width; // width in texels + int height; // height in texels + char* name; // texture name (must be unique!) + char* file; // file texture has been read from + char* standardbitmap; // texture bitmap in TEXFMT_STANDARD + char* loaderparams; // optional loading parameters +}; + +enum { + + TEXINFOFLAG_NONE = 0x00000000, + TEXINFOFLAG_USERPALETTE = 0x00000001, // don't touch texture palette + TEXINFOFLAG_PACKWASDISABLED = 0x00000100 // data was not read from pack +}; + + +// texfont info table --------------------------------------------------------- +// +struct texfontinfo_s { + + texfont_s* texfont; // pointer to actual texfont structure + dword flags; + int width; // width of single char in texels + int height; // height of single char in texels + char* name; // texfont name (must be unique!) + char* file; // file font has been read from + char* srcimage; // originally read data + int _mksiz32; +}; + + +// bitmap info table ---------------------------------------------------------- +// +struct bitmapinfo_s { + + char* bitmappointer; // pointer to current bitmap data + char* loadeddata; // pointer to original bitmap data + int width; // bitmap width + int height; // bitmap height + char* file; // file bitmap has been read from + char* name; // bitmap name (must be unique!) + int _mksiz32[2]; +}; + + +// charset info table --------------------------------------------------------- +// +struct charsetinfo_s { + + char* charsetpointer; // pointer to current font data + char* loadeddata; // pointer to original font data + dword* geompointer; // pointer to geometry table + int datasize; // size of actual font data in bytes + int width; // char width + int height; // char height + int srcwidth; // font bitmap width + dword flags; // flagword + char* file; // file font has been read from + TextureMap* fonttexture; // font converted to texture + int _mksiz64[6]; +}; + + +// sample info table ---------------------------------------------------------- +// +struct sampleinfo_s { + + char* name; + char* file; + char* samplepointer; + size_t size; + word flags; + short stereolevel; + int volume; + float samplefreq; + float stdfreq; +}; + + +// song info table ------------------------------------------------------------ +// +struct songinfo_s { + + char* songpointer; + char* name; + char* file; + int _mksiz16; +}; + + +#endif // _GD_TABS_H_ + + diff --git a/src/libparsec/include/gd_type.h b/src/libparsec/include/gd_type.h new file mode 100644 index 0000000..3ca42f4 --- /dev/null +++ b/src/libparsec/include/gd_type.h @@ -0,0 +1,60 @@ +/* + * PARSEC HEADER: gd_type.h + */ + +#ifndef _GD_TYPE_H_ +#define _GD_TYPE_H_ + +#include <stdint.h> + + +// ---------------------------------------------------------------------------- +// BASIC TYPE DEFINITIONS - +// ---------------------------------------------------------------------------- + + +// ---------------------------------------------------------------------------- +// +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef int64_t int64; + + +// asm-style types ------------------------------------------------------------ +// +typedef uint8_t byte; +typedef uint16_t word; +typedef uint32_t dword; +typedef uint64_t qword; + + +// new types ------------------------------------------------------------------ +// +typedef bool bool_t; + + +// custom types --------------------------------------------------------------- +// +typedef int32 refframe_t; +#define REFFRAME_INVALID -1 + + +// boolean values ------------------------------------------------------------- +// +#ifndef TRUE + #define TRUE 1 +#endif +#ifndef FALSE + #define FALSE 0 +#endif + + +#endif // _GD_TYPE_H_ + + diff --git a/src/libparsec/include/general.h b/src/libparsec/include/general.h new file mode 100644 index 0000000..33e5853 --- /dev/null +++ b/src/libparsec/include/general.h @@ -0,0 +1,75 @@ +/* + * PARSEC HEADER: general.h + */ + +#ifndef _GENERAL_H_ +#define _GENERAL_H_ + + +// include type definitions --------------------------------------------------- +// +#include "gd_type.h" +#include "gd_color.h" + + +// include limits ------------------------------------------------------------- +// +#include "gd_limit.h" + + +// include global constants --------------------------------------------------- +// +#include "gd_const.h" +#ifdef PARSEC_CLIENT + #include "gd_bmap.h" + #include "gd_font.h" +#endif // PARSEC_CLIENT + + +// include host byte order macros --------------------------------------------- +// +#include "gd_host.h" + +// include general utility functions/classes ---------------------------------- +// +#include "utl_list.h" + + +// include helper functions --------------------------------------------------- +// +#include "gd_help.h" + + +// include message output functions ------------------------------------------- +// +#ifdef PARSEC_CLIENT + #include "sys_msg.h" +#elif defined ( PARSEC_SERVER ) // !PARSEC_CLIENT + #include "sys_msg_sv.h" +#endif // !PARSEC_CLIENT + + + +// include error functions and define exit function macros -------------------- +// +#ifdef PARSEC_CLIENT + #include "sys_err.h" +#elif defined ( PARSEC_SERVER ) // !PARSEC_CLIENT + #include "sys_err_sv.h" +#endif // !PARSEC_CLIENT + +#ifndef SYSTEM_TARGET_WINDOWS + // implemented in SL_MAIN.C + int stricmp( const char *s1, const char *s2 ); + int strnicmp( const char *s1, const char *s2, int len ); + char *strlwr( char *str ); + char *strupr( char *str ); +#elif !defined(__MINGW32__) +#include <BaseTsd.h> +#define ssize_t SSIZE_T +#define strtok_r strtok_s +#endif + +#endif // _GENERAL_H_ + + diff --git a/src/libparsec/include/globals.h b/src/libparsec/include/globals.h new file mode 100644 index 0000000..b818b06 --- /dev/null +++ b/src/libparsec/include/globals.h @@ -0,0 +1,53 @@ +/* + * PARSEC HEADER: globals.h + */ + +#ifndef _GLOBALS_H_ +#define _GLOBALS_H_ + +#ifdef PARSEC_SERVER + + // include subsystems globals ---------------------------- + + //#include "aud_glob.h" // AUDIO + //#include "inp_glob.h" // INPUT + //#include "net_glob.h" // NETWORKING + //#include "sys_glob.h" // SYSTEM + //#include "vid_glob.h" // VIDEO + + // include engine core globals --------------------------- + + #include "e_global_sv.h" // ENGINE CORE ( SERVER ) + + // include game code globals ----------------------------- + + #include "e_world.h" + +#else + + // include subsystems globals ---------------------------- + + #include "aud_glob.h" // AUDIO + #include "inp_glob.h" // INPUT + #include "net_glob.h" // NETWORKING + #include "sys_glob.h" // SYSTEM + #include "vid_glob.h" // VIDEO + + #include "d_glob.h" // DRAWING + #include "r_glob.h" // RENDERING + + // include engine core globals --------------------------- + + #include "e_global.h" // ENGINE CORE + + + // include game code globals ----------------------------- + + #include "g_global.h" // GAME CODE + #include "h_global.h" // GAME CODE/HUD + +#endif // PARSEC_SERVER + +#endif // _GLOBALS_H_ + + diff --git a/src/libparsec/include/keycodes.h b/src/libparsec/include/keycodes.h new file mode 100644 index 0000000..40442a4 --- /dev/null +++ b/src/libparsec/include/keycodes.h @@ -0,0 +1,28 @@ +/* + * PARSEC HEADER: keycodes.h + */ + +#ifndef _KEYCODES_H_ +#define _KEYCODES_H_ + + +//NOTE: +// this header is now just a wrapper for the +// file corresponding to the actual system + +//NOTE: +// only on the mac the actual keycodes are adapted to the system. +// all other systems (e.g., Linux, IRIX) map native key codes to +// parsec key codes in their keyboard handlers. that is, from +// there on, the same key codes as on a pc are used. + +#ifdef PARSEC_SERVER +#include "keys_server.h" +#else +#include "keys_sdl.h" +#endif + + +#endif // _KEYCODES_H_ + + diff --git a/src/libparsec/include/keys_sdl.h b/src/libparsec/include/keys_sdl.h new file mode 100755 index 0000000..399db1f --- /dev/null +++ b/src/libparsec/include/keys_sdl.h @@ -0,0 +1,449 @@ +/* + * keys_sdl.h + * + * Created on: Nov 3, 2012 + * Author: jasonw + */ + +#ifndef KEYS_SDL_H_ +#define KEYS_SDL_H_ + +#ifdef SYSTEM_TARGET_LINUX +#include <SDL/SDL.h> +#else +#include <SDL.h> +#endif + +// ---------------------------------------------------------------------------- +// SDL KEYBOARD KEYS - +// ---------------------------------------------------------------------------- + + + +// make codes for general keyboard handling ----------------------------------- +// +enum { + + MKC_MAKE_CODE = 0x00, +#if !SDL_VERSION_ATLEAST(2,0,0) + MKC_BREAK_CODE = SDLK_BREAK, +#endif + MKC_BASE_MASK = 0x00, + + MKC_EXT_MDIFR = 0x00, + MKC_PAUSE_MDIFR = SDLK_PAUSE, + + MKC_EXT_FLAG = 0x00, + MKC_SHIFT_FLAG = 0x10000, + + MKC_NIL = 0x00, + + MKC_ESCAPE = SDLK_ESCAPE, + MKC_SPACE = SDLK_SPACE, + MKC_ENTER = SDLK_RETURN, + MKC_CURSORUP = SDLK_UP, + MKC_CURSORDOWN = SDLK_DOWN, + MKC_CURSORLEFT = SDLK_LEFT, + MKC_CURSORRIGHT = SDLK_RIGHT, + MKC_BACKSPACE = SDLK_BACKSPACE, + MKC_INSERT = SDLK_INSERT, + MKC_DELETE = SDLK_DELETE, + MKC_HOME = SDLK_HOME, + MKC_END = SDLK_END, + MKC_PAGEUP = SDLK_PAGEUP, + MKC_PAGEDOWN = SDLK_PAGEDOWN, + MKC_CAPSLOCK = SDLK_CAPSLOCK, + MKC_TILDE = SDLK_BACKQUOTE, // U.S.: `~ german: ^ø + + MKC_MINUS = SDLK_MINUS, // U.S.: -_ german: á?bsl + MKC_EQUALS = SDLK_EQUALS, // U.S.: =+ german: ï` + MKC_TAB = SDLK_TAB, + MKC_LBRACKET = SDLK_LEFTBRACKET, // U.S.: [{ german: �š + MKC_RBRACKET = SDLK_RIGHTBRACKET, // U.S.: ]} german: +*~ + MKC_SEMICOLON = SDLK_SEMICOLON, // U.S.: ;: german: �™ + MKC_APOSTROPHE = SDLK_QUOTE, // U.S.: '" german: „Ž + MKC_GRAVE = SDLK_BACKQUOTE, // U.S.: `~ german: ^ø + + MKC_LSHIFT = SDLK_LSHIFT, + MKC_RSHIFT = SDLK_RSHIFT, + MKC_LCONTROL = SDLK_LCTRL, + MKC_RCONTROL = SDLK_RCTRL, + MKC_LALT = SDLK_LALT, + MKC_RALT = SDLK_RALT, + + MKC_COMMA = SDLK_COMMA, // U.S.: ,< german: ,; + MKC_PERIOD = SDLK_PERIOD, // U.S.: .> german: .: + MKC_SLASH = SDLK_PERIOD, // U.S.: /? german: -_ + + MKC_BACKSLASH = SDLK_BACKSLASH, // U.S.: bsl| german: #' + MKC_GERARROWS = 0x00, // german: <>| + + MKC_NUMPADSLASH = SDLK_KP_DIVIDE, // gray divide + MKC_NUMPADSTAR = SDLK_KP_MULTIPLY, // gray multiply + MKC_NUMPADMINUS = SDLK_KP_MINUS, // gray subtract + MKC_NUMPADPLUS = SDLK_KP_PLUS, // gray add + MKC_NUMPADPERIOD= SDLK_KP_PERIOD, // gray decimal (period/comma) + +#if SDL_VERSION_ATLEAST(2,0,0) + + MKC_NUMLOCK = SDLK_NUMLOCKCLEAR, + MKC_SCROLL = SDLK_SCROLLLOCK, + + MKC_NUMPAD0 = SDLK_KP_0, + MKC_NUMPAD1 = SDLK_KP_1, + MKC_NUMPAD2 = SDLK_KP_2, + MKC_NUMPAD3 = SDLK_KP_3, + MKC_NUMPAD4 = SDLK_KP_4, + MKC_NUMPAD5 = SDLK_KP_5, + MKC_NUMPAD6 = SDLK_KP_6, + MKC_NUMPAD7 = SDLK_KP_7, + MKC_NUMPAD8 = SDLK_KP_8, + MKC_NUMPAD9 = SDLK_KP_9, + + MKC_LWIN = SDLK_LGUI, // left windows/cmd key + MKC_RWIN = SDLK_RGUI, // right windows/cmd key + +#else // SDL_VERSION_ATLEAST(2,0,0) + + MKC_NUMLOCK = SDLK_NUMLOCK, + MKC_SCROLL = SDLK_SCROLLOCK, + + MKC_NUMPAD0 = SDLK_KP0, + MKC_NUMPAD1 = SDLK_KP1, + MKC_NUMPAD2 = SDLK_KP2, + MKC_NUMPAD3 = SDLK_KP3, + MKC_NUMPAD4 = SDLK_KP4, + MKC_NUMPAD5 = SDLK_KP5, + MKC_NUMPAD6 = SDLK_KP6, + MKC_NUMPAD7 = SDLK_KP7, + MKC_NUMPAD8 = SDLK_KP8, + MKC_NUMPAD9 = SDLK_KP9, + + MKC_LWIN = SDLK_LSUPER, // left windows key + MKC_RWIN = SDLK_RSUPER, // right windows key + +#endif // SDL_VERSION_ATLEAST(2,0,0) + + MKC_APPS = SDLK_MODE, // windows apps window key + + MKC_ENTER_GRAY = MKC_ENTER | MKC_EXT_FLAG, + MKC_CURSORUP_GRAY = MKC_CURSORUP | MKC_EXT_FLAG, + MKC_CURSORDOWN_GRAY = MKC_CURSORDOWN | MKC_EXT_FLAG, + MKC_CURSORLEFT_GRAY = MKC_CURSORLEFT | MKC_EXT_FLAG, + MKC_CURSORRIGHT_GRAY= MKC_CURSORRIGHT | MKC_EXT_FLAG, + MKC_BACKSPACE_GRAY = MKC_BACKSPACE | MKC_EXT_FLAG, + MKC_INSERT_GRAY = MKC_INSERT | MKC_EXT_FLAG, + MKC_DELETE_GRAY = MKC_DELETE | MKC_EXT_FLAG, + MKC_HOME_GRAY = MKC_HOME | MKC_EXT_FLAG, + MKC_END_GRAY = MKC_END | MKC_EXT_FLAG, + MKC_PAGEUP_GRAY = MKC_PAGEUP | MKC_EXT_FLAG, + MKC_PAGEDOWN_GRAY = MKC_PAGEDOWN | MKC_EXT_FLAG, + + MKC_A = SDLK_a, + MKC_B = SDLK_b, + MKC_C = SDLK_c, + MKC_D = SDLK_d, + MKC_E = SDLK_e, + MKC_F = SDLK_f, + MKC_G = SDLK_g, + MKC_H = SDLK_h, + MKC_I = SDLK_i, + MKC_J = SDLK_j, + MKC_K = SDLK_k, + MKC_L = SDLK_l, + MKC_M = SDLK_m, + MKC_N = SDLK_n, + MKC_O = SDLK_o, + MKC_P = SDLK_p, + MKC_Q = SDLK_q, + MKC_R = SDLK_r, + MKC_S = SDLK_s, + MKC_T = SDLK_t, + MKC_U = SDLK_u, + MKC_V = SDLK_v, + MKC_W = SDLK_w, + MKC_X = SDLK_x, + MKC_Y = SDLK_y, + MKC_Z = SDLK_z, + + MKC_0 = SDLK_0, + MKC_1 = SDLK_1, + MKC_2 = SDLK_2, + MKC_3 = SDLK_3, + MKC_4 = SDLK_4, + MKC_5 = SDLK_5, + MKC_6 = SDLK_6, + MKC_7 = SDLK_7, + MKC_8 = SDLK_8, + MKC_9 = SDLK_9, + + MKC_F1 = SDLK_F1, + MKC_F2 = SDLK_F2, + MKC_F3 = SDLK_F3, + MKC_F4 = SDLK_F4, + MKC_F5 = SDLK_F5, + MKC_F6 = SDLK_F6, + MKC_F7 = SDLK_F7, + MKC_F8 = SDLK_F8, + MKC_F9 = SDLK_F9, + MKC_F10 = SDLK_F10, + MKC_F11 = SDLK_F11, + MKC_F12 = SDLK_F12 +}; + + + +// key codes for console's keyboard buffer (only special codes/control keys) -- +// +enum { + + CKC_NIL = 0x000000, + CKC_ESCAPE = SDLK_ESCAPE, + CKC_SPACE = SDLK_SPACE, + CKC_ENTER = SDLK_RETURN, + CKC_CURSORUP = SDLK_UP, + CKC_CURSORDOWN = SDLK_DOWN, + CKC_CURSORLEFT = SDLK_LEFT, + CKC_CURSORRIGHT = SDLK_RIGHT, + CKC_BACKSPACE = SDLK_BACKSPACE, + CKC_INSERT = SDLK_INSERT, + CKC_DELETE = SDLK_DELETE, + CKC_HOME = SDLK_HOME, + CKC_END = SDLK_END, + CKC_PAGEUP = SDLK_PAGEUP, + CKC_PAGEDOWN = SDLK_PAGEDOWN, + CKC_TAB = SDLK_TAB, + CKC_CURSORUP_SHIFTED = SDLK_UP, + CKC_CURSORDOWN_SHIFTED = SDLK_DOWN, + CKC_CURSORLEFT_SHIFTED = SDLK_LEFT, + CKC_CURSORRIGHT_SHIFTED = SDLK_RIGHT, + + CKC_CTRL_MASK = 0x800000 +}; + + + +// key codes for flexible keyboard configuration (assignable keys) ------------ +// +enum { + + AKC_EXT_FLAG = 0x00000080, + AKC_JOY_FLAG = 0x10000000, // joystick buttons, no actual keyboard keys + AKC_SHIFT_FLAG = 0x00000000, + + AKC_ESCAPE = SDLK_ESCAPE, + AKC_SPACE = SDLK_SPACE, + AKC_ENTER = SDLK_RETURN, + AKC_CURSORUP = SDLK_UP, + AKC_CURSORDOWN = SDLK_DOWN, + AKC_CURSORLEFT = SDLK_LEFT, + AKC_CURSORRIGHT = SDLK_RIGHT, + AKC_BACKSPACE = SDLK_BACKSPACE, + AKC_INSERT = SDLK_INSERT, + AKC_DELETE = SDLK_DELETE, + AKC_HOME = SDLK_HOME, + AKC_END = SDLK_END, + AKC_PAGEUP = SDLK_PAGEUP, + AKC_PAGEDOWN = SDLK_PAGEDOWN, + AKC_CAPSLOCK = SDLK_CAPSLOCK, + AKC_TILDE = SDLK_BACKQUOTE, + + AKC_MINUS = SDLK_MINUS, + AKC_EQUALS = SDLK_EQUALS, + AKC_TAB = SDLK_TAB, + AKC_LBRACKET = SDLK_LEFTBRACKET, + AKC_RBRACKET = SDLK_RIGHTBRACKET, + AKC_SEMICOLON = SDLK_SEMICOLON, + AKC_APOSTROPHE = SDLK_QUOTE, + AKC_GRAVE = SDLK_BACKQUOTE, + + AKC_LSHIFT = SDLK_LSHIFT, + AKC_RSHIFT = SDLK_RSHIFT, + AKC_LCONTROL = SDLK_LCTRL, + AKC_RCONTROL = SDLK_RCTRL, + AKC_LALT = SDLK_LALT, + AKC_RALT = SDLK_RALT, + + AKC_COMMA = SDLK_COMMA, + AKC_PERIOD = SDLK_PERIOD, + AKC_SLASH = SDLK_SLASH, + + AKC_BACKSLASH = SDLK_BACKSLASH, + AKC_GERARROWS = 0X000000, + + AKC_NUMPADSLASH = SDLK_KP_DIVIDE, + AKC_NUMPADSTAR = SDLK_KP_MULTIPLY, + AKC_NUMPADMINUS = SDLK_KP_MINUS, + AKC_NUMPADPLUS = SDLK_KP_PLUS, + AKC_NUMPADPERIOD= SDLK_KP_PERIOD, + +#if SDL_VERSION_ATLEAST(2,0,0) + + AKC_NUMLOCK = SDLK_NUMLOCKCLEAR, + AKC_SCROLL = SDLK_SCROLLLOCK, + + AKC_NUMPAD0 = SDLK_KP_0, + AKC_NUMPAD1 = SDLK_KP_1, + AKC_NUMPAD2 = SDLK_KP_2, + AKC_NUMPAD3 = SDLK_KP_3, + AKC_NUMPAD4 = SDLK_KP_4, + AKC_NUMPAD5 = SDLK_KP_5, + AKC_NUMPAD6 = SDLK_KP_6, + AKC_NUMPAD7 = SDLK_KP_7, + AKC_NUMPAD8 = SDLK_KP_8, + AKC_NUMPAD9 = SDLK_KP_9, + + AKC_LWIN = SDLK_LGUI, // left windows/cmd key + AKC_RWIN = SDLK_RGUI, // right windows/cmd key + +#else // SDL_VERSION_ATLEAST(2,0,0) + + AKC_NUMLOCK = SDLK_NUMLOCK, + AKC_SCROLL = SDLK_SCROLLOCK, + + AKC_NUMPAD0 = SDLK_KP0, + AKC_NUMPAD1 = SDLK_KP1, + AKC_NUMPAD2 = SDLK_KP2, + AKC_NUMPAD3 = SDLK_KP3, + AKC_NUMPAD4 = SDLK_KP4, + AKC_NUMPAD5 = SDLK_KP5, + AKC_NUMPAD6 = SDLK_KP6, + AKC_NUMPAD7 = SDLK_KP7, + AKC_NUMPAD8 = SDLK_KP8, + AKC_NUMPAD9 = SDLK_KP9, + + AKC_LWIN = SDLK_LSUPER, + AKC_RWIN = SDLK_RSUPER, + +#endif // SDL_VERSION_ATLEAST(2,0,0) + + AKC_APPS = SDLK_MODE, + + AKC_ENTER_GRAY = AKC_ENTER | AKC_EXT_FLAG, + AKC_CURSORUP_GRAY = AKC_CURSORUP | AKC_EXT_FLAG, + AKC_CURSORDOWN_GRAY = AKC_CURSORDOWN | AKC_EXT_FLAG, + AKC_CURSORLEFT_GRAY = AKC_CURSORLEFT | AKC_EXT_FLAG, + AKC_CURSORRIGHT_GRAY= AKC_CURSORRIGHT | AKC_EXT_FLAG, + AKC_BACKSPACE_GRAY = AKC_BACKSPACE | AKC_EXT_FLAG, + AKC_INSERT_GRAY = AKC_INSERT | AKC_EXT_FLAG, + AKC_DELETE_GRAY = AKC_DELETE | AKC_EXT_FLAG, + AKC_HOME_GRAY = AKC_HOME | AKC_EXT_FLAG, + AKC_END_GRAY = AKC_END | AKC_EXT_FLAG, + AKC_PAGEUP_GRAY = AKC_PAGEUP | AKC_EXT_FLAG, + AKC_PAGEDOWN_GRAY = AKC_PAGEDOWN | AKC_EXT_FLAG, + + AKC_A = SDLK_a, + AKC_B = SDLK_b, + AKC_C = SDLK_c, + AKC_D = SDLK_d, + AKC_E = SDLK_e, + AKC_F = SDLK_f, + AKC_G = SDLK_g, + AKC_H = SDLK_h, + AKC_I = SDLK_i, + AKC_J = SDLK_j, + AKC_K = SDLK_k, + AKC_L = SDLK_l, + AKC_M = SDLK_m, + AKC_N = SDLK_n, + AKC_O = SDLK_o, + AKC_P = SDLK_p, + AKC_Q = SDLK_q, + AKC_R = SDLK_r, + AKC_S = SDLK_s, + AKC_T = SDLK_t, + AKC_U = SDLK_u, + AKC_V = SDLK_v, + AKC_W = SDLK_w, + AKC_X = SDLK_x, + AKC_Y = SDLK_y, + AKC_Z = SDLK_z, + + AKC_A_SHIFTED = AKC_A | AKC_SHIFT_FLAG, + AKC_B_SHIFTED = AKC_B | AKC_SHIFT_FLAG, + AKC_C_SHIFTED = AKC_C | AKC_SHIFT_FLAG, + AKC_D_SHIFTED = AKC_D | AKC_SHIFT_FLAG, + AKC_E_SHIFTED = AKC_E | AKC_SHIFT_FLAG, + AKC_F_SHIFTED = AKC_F | AKC_SHIFT_FLAG, + AKC_G_SHIFTED = AKC_G | AKC_SHIFT_FLAG, + AKC_H_SHIFTED = AKC_H | AKC_SHIFT_FLAG, + AKC_I_SHIFTED = AKC_I | AKC_SHIFT_FLAG, + AKC_J_SHIFTED = AKC_J | AKC_SHIFT_FLAG, + AKC_K_SHIFTED = AKC_K | AKC_SHIFT_FLAG, + AKC_L_SHIFTED = AKC_L | AKC_SHIFT_FLAG, + AKC_M_SHIFTED = AKC_M | AKC_SHIFT_FLAG, + AKC_N_SHIFTED = AKC_N | AKC_SHIFT_FLAG, + AKC_O_SHIFTED = AKC_O | AKC_SHIFT_FLAG, + AKC_P_SHIFTED = AKC_P | AKC_SHIFT_FLAG, + AKC_Q_SHIFTED = AKC_Q | AKC_SHIFT_FLAG, + AKC_R_SHIFTED = AKC_R | AKC_SHIFT_FLAG, + AKC_S_SHIFTED = AKC_S | AKC_SHIFT_FLAG, + AKC_T_SHIFTED = AKC_T | AKC_SHIFT_FLAG, + AKC_U_SHIFTED = AKC_U | AKC_SHIFT_FLAG, + AKC_V_SHIFTED = AKC_V | AKC_SHIFT_FLAG, + AKC_W_SHIFTED = AKC_W | AKC_SHIFT_FLAG, + AKC_X_SHIFTED = AKC_X | AKC_SHIFT_FLAG, + AKC_Y_SHIFTED = AKC_Y | AKC_SHIFT_FLAG, + AKC_Z_SHIFTED = AKC_Z | AKC_SHIFT_FLAG, + + AKC_0 = SDLK_0, + AKC_1 = SDLK_1, + AKC_2 = SDLK_2, + AKC_3 = SDLK_3, + AKC_4 = SDLK_4, + AKC_5 = SDLK_5, + AKC_6 = SDLK_6, + AKC_7 = SDLK_7, + AKC_8 = SDLK_8, + AKC_9 = SDLK_9, + + AKC_0_SHIFTED = SDLK_0 | MKC_SHIFT_FLAG, + AKC_1_SHIFTED = SDLK_1 | MKC_SHIFT_FLAG, + AKC_2_SHIFTED = SDLK_2 | MKC_SHIFT_FLAG, + AKC_3_SHIFTED = SDLK_3 | MKC_SHIFT_FLAG, + AKC_4_SHIFTED = SDLK_4 | MKC_SHIFT_FLAG, + AKC_5_SHIFTED = SDLK_5 | MKC_SHIFT_FLAG, + AKC_6_SHIFTED = SDLK_6 | MKC_SHIFT_FLAG, + AKC_7_SHIFTED = SDLK_7 | MKC_SHIFT_FLAG, + AKC_8_SHIFTED = SDLK_8 | MKC_SHIFT_FLAG, + AKC_9_SHIFTED = SDLK_9 | MKC_SHIFT_FLAG, + + AKC_F1 = SDLK_F1, + AKC_F2 = SDLK_F2, + AKC_F3 = SDLK_F3, + AKC_F4 = SDLK_F4, + AKC_F5 = SDLK_F5, + AKC_F6 = SDLK_F6, + AKC_F7 = SDLK_F7, + AKC_F8 = SDLK_F8, + AKC_F9 = SDLK_F9, + AKC_F10 = SDLK_F10, + AKC_F11 = SDLK_F11, + AKC_F12 = SDLK_F12, + + AKC_F1_SHIFTED = AKC_F1 | AKC_SHIFT_FLAG, + AKC_F2_SHIFTED = AKC_F2 | AKC_SHIFT_FLAG, + AKC_F3_SHIFTED = AKC_F3 | AKC_SHIFT_FLAG, + AKC_F4_SHIFTED = AKC_F4 | AKC_SHIFT_FLAG, + AKC_F5_SHIFTED = AKC_F5 | AKC_SHIFT_FLAG, + AKC_F6_SHIFTED = AKC_F6 | AKC_SHIFT_FLAG, + AKC_F7_SHIFTED = AKC_F7 | AKC_SHIFT_FLAG, + AKC_F8_SHIFTED = AKC_F8 | AKC_SHIFT_FLAG, + AKC_F9_SHIFTED = AKC_F9 | AKC_SHIFT_FLAG, + AKC_F10_SHIFTED = AKC_F10 | AKC_SHIFT_FLAG, + AKC_F11_SHIFTED = AKC_F11 | AKC_SHIFT_FLAG, + AKC_F12_SHIFTED = AKC_F12 | AKC_SHIFT_FLAG, + + // joystick buttons, no actual keyboard keys + AKC_JOY_BUTTON1 = 0x00000000 | AKC_JOY_FLAG, + AKC_JOY_BUTTON2 = 0x00000001 | AKC_JOY_FLAG, + AKC_JOY_BUTTON3 = 0x00000002 | AKC_JOY_FLAG, + AKC_JOY_BUTTON4 = 0x00000003 | AKC_JOY_FLAG, + AKC_JOY_BUTTON5 = 0x00000004 | AKC_JOY_FLAG, + AKC_JOY_BUTTON6 = 0x00000005 | AKC_JOY_FLAG, + AKC_JOY_BUTTON7 = 0x00000006 | AKC_JOY_FLAG, + AKC_JOY_BUTTON8 = 0x00000007 | AKC_JOY_FLAG +}; + + +#endif /* KEYS_SDL_H_ */ diff --git a/src/libparsec/include/keys_server.h b/src/libparsec/include/keys_server.h new file mode 100644 index 0000000..b74f033 --- /dev/null +++ b/src/libparsec/include/keys_server.h @@ -0,0 +1,392 @@ +/* + * PARSEC HEADER: keys_pc.h + */ + +#ifndef _KEYS_PC_H_ +#define _KEYS_PC_H_ + + + +// ---------------------------------------------------------------------------- +// INTEL PC KEYBOARD CODES - +// ---------------------------------------------------------------------------- + + + +// make codes for general keyboard handling ----------------------------------- +// +enum { + + MKC_MAKE_CODE = 0x00, + MKC_BREAK_CODE = 0x80, + MKC_BASE_MASK = 0x7f, + + MKC_EXT_MDIFR = 0xe0, + MKC_PAUSE_MDIFR = 0xe1, + + MKC_EXT_FLAG = 0x80, + MKC_SHIFT_FLAG = 0x80, + + MKC_NIL = 0x00, + + MKC_ESCAPE = 0x01, + MKC_SPACE = 0x39, + MKC_ENTER = 0x1c, + MKC_CURSORUP = 0x48, + MKC_CURSORDOWN = 0x50, + MKC_CURSORLEFT = 0x4b, + MKC_CURSORRIGHT = 0x4d, + MKC_BACKSPACE = 0x0e, + MKC_INSERT = 0x52, + MKC_DELETE = 0x53, + MKC_HOME = 0x47, + MKC_END = 0x4f, + MKC_PAGEUP = 0x49, + MKC_PAGEDOWN = 0x51, + MKC_CAPSLOCK = 0x3a, + MKC_TILDE = 0x29, // U.S.: `~ german: ^ø + + MKC_MINUS = 0x0c, // U.S.: -_ german: á?bsl + MKC_EQUALS = 0x0d, // U.S.: =+ german: ï` + MKC_TAB = 0x0f, + MKC_LBRACKET = 0x1a, // U.S.: [{ german: š + MKC_RBRACKET = 0x1b, // U.S.: ]} german: +*~ + MKC_SEMICOLON = 0x27, // U.S.: ;: german: ”™ + MKC_APOSTROPHE = 0x28, // U.S.: '" german: „Ž + MKC_GRAVE = 0x29, // U.S.: `~ german: ^ø + + MKC_LSHIFT = 0x2a, + MKC_RSHIFT = 0x36, + MKC_LCONTROL = 0x1d, + MKC_RCONTROL = 0x1d | MKC_EXT_FLAG, + MKC_LALT = 0x38, + MKC_RALT = 0x38 | MKC_EXT_FLAG, + + MKC_COMMA = 0x33, // U.S.: ,< german: ,; + MKC_PERIOD = 0x34, // U.S.: .> german: .: + MKC_SLASH = 0x35, // U.S.: /? german: -_ + + MKC_BACKSLASH = 0x2b, // U.S.: bsl| german: #' + MKC_GERARROWS = 0x56, // german: <>| + + MKC_NUMPADSLASH = 0x35 | MKC_EXT_FLAG, // gray divide + MKC_NUMPADSTAR = 0x37, // gray multiply + MKC_NUMPADMINUS = 0x4a, // gray subtract + MKC_NUMPADPLUS = 0x4e, // gray add + MKC_NUMPADPERIOD= MKC_DELETE, // gray decimal (period/comma) + MKC_NUMLOCK = 0x45, + MKC_SCROLL = 0x46, + + MKC_NUMPAD0 = MKC_INSERT, + MKC_NUMPAD1 = MKC_END, + MKC_NUMPAD2 = MKC_CURSORDOWN, + MKC_NUMPAD3 = MKC_PAGEDOWN, + MKC_NUMPAD4 = MKC_CURSORLEFT, + MKC_NUMPAD5 = 0x4c, + MKC_NUMPAD6 = MKC_CURSORRIGHT, + MKC_NUMPAD7 = MKC_HOME, + MKC_NUMPAD8 = MKC_CURSORUP, + MKC_NUMPAD9 = MKC_PAGEUP, + + MKC_LWIN = 0x5b | MKC_EXT_FLAG, // left windows key + MKC_RWIN = 0x5c | MKC_EXT_FLAG, // right windows key + MKC_APPS = 0x5d | MKC_EXT_FLAG, // windows apps window key + + MKC_ENTER_GRAY = MKC_ENTER | MKC_EXT_FLAG, + MKC_CURSORUP_GRAY = MKC_CURSORUP | MKC_EXT_FLAG, + MKC_CURSORDOWN_GRAY = MKC_CURSORDOWN | MKC_EXT_FLAG, + MKC_CURSORLEFT_GRAY = MKC_CURSORLEFT | MKC_EXT_FLAG, + MKC_CURSORRIGHT_GRAY= MKC_CURSORRIGHT | MKC_EXT_FLAG, + MKC_BACKSPACE_GRAY = MKC_BACKSPACE | MKC_EXT_FLAG, + MKC_INSERT_GRAY = MKC_INSERT | MKC_EXT_FLAG, + MKC_DELETE_GRAY = MKC_DELETE | MKC_EXT_FLAG, + MKC_HOME_GRAY = MKC_HOME | MKC_EXT_FLAG, + MKC_END_GRAY = MKC_END | MKC_EXT_FLAG, + MKC_PAGEUP_GRAY = MKC_PAGEUP | MKC_EXT_FLAG, + MKC_PAGEDOWN_GRAY = MKC_PAGEDOWN | MKC_EXT_FLAG, + + MKC_A = 0x1e, + MKC_B = 0x30, + MKC_C = 0x2e, + MKC_D = 0x20, + MKC_E = 0x12, + MKC_F = 0x21, + MKC_G = 0x22, + MKC_H = 0x23, + MKC_I = 0x17, + MKC_J = 0x24, + MKC_K = 0x25, + MKC_L = 0x26, + MKC_M = 0x32, + MKC_N = 0x31, + MKC_O = 0x18, + MKC_P = 0x19, + MKC_Q = 0x10, + MKC_R = 0x13, + MKC_S = 0x1f, + MKC_T = 0x14, + MKC_U = 0x16, + MKC_V = 0x2f, + MKC_W = 0x11, + MKC_X = 0x2d, + MKC_Y = 0x15, + MKC_Z = 0x2c, + + MKC_0 = 0x0b, + MKC_1 = 0x02, + MKC_2 = 0x03, + MKC_3 = 0x04, + MKC_4 = 0x05, + MKC_5 = 0x06, + MKC_6 = 0x07, + MKC_7 = 0x08, + MKC_8 = 0x09, + MKC_9 = 0x0a, + + MKC_F1 = 0x3b, + MKC_F2 = 0x3c, + MKC_F3 = 0x3d, + MKC_F4 = 0x3e, + MKC_F5 = 0x3f, + MKC_F6 = 0x40, + MKC_F7 = 0x41, + MKC_F8 = 0x42, + MKC_F9 = 0x43, + MKC_F10 = 0x44, + MKC_F11 = 0x57, + MKC_F12 = 0x58 +}; + + + +// key codes for console's keyboard buffer (only special codes/control keys) -- +// +enum { + + CKC_NIL = 0x800000, + CKC_ESCAPE = 0x800001, + CKC_SPACE = 0x000020, + CKC_ENTER = 0x800003, + CKC_CURSORUP = 0x800004, + CKC_CURSORDOWN = 0x800005, + CKC_CURSORLEFT = 0x800006, + CKC_CURSORRIGHT = 0x800007, + CKC_BACKSPACE = 0x800008, + CKC_INSERT = 0x800009, + CKC_DELETE = 0x80000A, + CKC_HOME = 0x80000B, + CKC_END = 0x80000C, + CKC_PAGEUP = 0x80000D, + CKC_PAGEDOWN = 0x80000E, + CKC_TAB = 0x80000F, + CKC_CURSORUP_SHIFTED = 0x800010, + CKC_CURSORDOWN_SHIFTED = 0x800011, + CKC_CURSORLEFT_SHIFTED = 0x800012, + CKC_CURSORRIGHT_SHIFTED = 0x800013, + + CKC_CTRL_MASK = 0x800000 +}; + + + +// key codes for flexible keyboard configuration (assignable keys) ------------ +// +enum { + + AKC_EXT_FLAG = 0x000080, + AKC_JOY_FLAG = 0x000100, // joystick buttons, no actual keyboard keys + AKC_SHIFT_FLAG = 0x010000, + + AKC_ESCAPE = 0x000001, + AKC_SPACE = 0x000039, + AKC_ENTER = 0x00001c, + AKC_CURSORUP = 0x000048, + AKC_CURSORDOWN = 0x000050, + AKC_CURSORLEFT = 0x00004b, + AKC_CURSORRIGHT = 0x00004d, + AKC_BACKSPACE = 0x00000e, + AKC_INSERT = 0x000052, + AKC_DELETE = 0x000053, + AKC_HOME = 0x000047, + AKC_END = 0x00004f, + AKC_PAGEUP = 0x000049, + AKC_PAGEDOWN = 0x000051, + AKC_CAPSLOCK = 0x00003a, + AKC_TILDE = 0x000029, + + AKC_MINUS = 0x00000c, + AKC_EQUALS = 0x00000d, + AKC_TAB = 0x00000f, + AKC_LBRACKET = 0x00001a, + AKC_RBRACKET = 0x00001b, + AKC_SEMICOLON = 0x000027, + AKC_APOSTROPHE = 0x000028, + AKC_GRAVE = 0x000029, + + AKC_LSHIFT = 0x00002a, + AKC_RSHIFT = 0x000036, + AKC_LCONTROL = 0x00001d, + AKC_RCONTROL = 0x00009d, + AKC_LALT = 0x000038 | AKC_EXT_FLAG, + AKC_RALT = 0x000038 | AKC_EXT_FLAG, + + AKC_COMMA = 0x000033, + AKC_PERIOD = 0x000034, + AKC_SLASH = 0x000035, + + AKC_BACKSLASH = 0x00002b, + AKC_GERARROWS = 0x000056, + + AKC_NUMPADSLASH = 0x000035 | AKC_EXT_FLAG, + AKC_NUMPADSTAR = 0x000037, + AKC_NUMPADMINUS = 0x00004a, + AKC_NUMPADPLUS = 0x00004e, + AKC_NUMPADPERIOD= AKC_DELETE, + AKC_NUMLOCK = 0x000045, + AKC_SCROLL = 0x000046, + + AKC_NUMPAD0 = AKC_INSERT, + AKC_NUMPAD1 = AKC_END, + AKC_NUMPAD2 = AKC_CURSORDOWN, + AKC_NUMPAD3 = AKC_PAGEDOWN, + AKC_NUMPAD4 = AKC_CURSORLEFT, + AKC_NUMPAD5 = 0x00004c, + AKC_NUMPAD6 = AKC_CURSORRIGHT, + AKC_NUMPAD7 = AKC_HOME, + AKC_NUMPAD8 = AKC_CURSORUP, + AKC_NUMPAD9 = AKC_PAGEUP, + + AKC_LWIN = 0x00005b | AKC_EXT_FLAG, + AKC_RWIN = 0x00005c | AKC_EXT_FLAG, + AKC_APPS = 0x00005d | AKC_EXT_FLAG, + + AKC_ENTER_GRAY = AKC_ENTER | AKC_EXT_FLAG, + AKC_CURSORUP_GRAY = AKC_CURSORUP | AKC_EXT_FLAG, + AKC_CURSORDOWN_GRAY = AKC_CURSORDOWN | AKC_EXT_FLAG, + AKC_CURSORLEFT_GRAY = AKC_CURSORLEFT | AKC_EXT_FLAG, + AKC_CURSORRIGHT_GRAY= AKC_CURSORRIGHT | AKC_EXT_FLAG, + AKC_BACKSPACE_GRAY = AKC_BACKSPACE | AKC_EXT_FLAG, + AKC_INSERT_GRAY = AKC_INSERT | AKC_EXT_FLAG, + AKC_DELETE_GRAY = AKC_DELETE | AKC_EXT_FLAG, + AKC_HOME_GRAY = AKC_HOME | AKC_EXT_FLAG, + AKC_END_GRAY = AKC_END | AKC_EXT_FLAG, + AKC_PAGEUP_GRAY = AKC_PAGEUP | AKC_EXT_FLAG, + AKC_PAGEDOWN_GRAY = AKC_PAGEDOWN | AKC_EXT_FLAG, + + AKC_A = 0x00001e, + AKC_B = 0x000030, + AKC_C = 0x00002e, + AKC_D = 0x000020, + AKC_E = 0x000012, + AKC_F = 0x000021, + AKC_G = 0x000022, + AKC_H = 0x000023, + AKC_I = 0x000017, + AKC_J = 0x000024, + AKC_K = 0x000025, + AKC_L = 0x000026, + AKC_M = 0x000032, + AKC_N = 0x000031, + AKC_O = 0x000018, + AKC_P = 0x000019, + AKC_Q = 0x000010, + AKC_R = 0x000013, + AKC_S = 0x00001f, + AKC_T = 0x000014, + AKC_U = 0x000016, + AKC_V = 0x00002f, + AKC_W = 0x000011, + AKC_X = 0x00002d, + AKC_Y = 0x000015, + AKC_Z = 0x00002c, + + AKC_A_SHIFTED = AKC_A | AKC_SHIFT_FLAG, + AKC_B_SHIFTED = AKC_B | AKC_SHIFT_FLAG, + AKC_C_SHIFTED = AKC_C | AKC_SHIFT_FLAG, + AKC_D_SHIFTED = AKC_D | AKC_SHIFT_FLAG, + AKC_E_SHIFTED = AKC_E | AKC_SHIFT_FLAG, + AKC_F_SHIFTED = AKC_F | AKC_SHIFT_FLAG, + AKC_G_SHIFTED = AKC_G | AKC_SHIFT_FLAG, + AKC_H_SHIFTED = AKC_H | AKC_SHIFT_FLAG, + AKC_I_SHIFTED = AKC_I | AKC_SHIFT_FLAG, + AKC_J_SHIFTED = AKC_J | AKC_SHIFT_FLAG, + AKC_K_SHIFTED = AKC_K | AKC_SHIFT_FLAG, + AKC_L_SHIFTED = AKC_L | AKC_SHIFT_FLAG, + AKC_M_SHIFTED = AKC_M | AKC_SHIFT_FLAG, + AKC_N_SHIFTED = AKC_N | AKC_SHIFT_FLAG, + AKC_O_SHIFTED = AKC_O | AKC_SHIFT_FLAG, + AKC_P_SHIFTED = AKC_P | AKC_SHIFT_FLAG, + AKC_Q_SHIFTED = AKC_Q | AKC_SHIFT_FLAG, + AKC_R_SHIFTED = AKC_R | AKC_SHIFT_FLAG, + AKC_S_SHIFTED = AKC_S | AKC_SHIFT_FLAG, + AKC_T_SHIFTED = AKC_T | AKC_SHIFT_FLAG, + AKC_U_SHIFTED = AKC_U | AKC_SHIFT_FLAG, + AKC_V_SHIFTED = AKC_V | AKC_SHIFT_FLAG, + AKC_W_SHIFTED = AKC_W | AKC_SHIFT_FLAG, + AKC_X_SHIFTED = AKC_X | AKC_SHIFT_FLAG, + AKC_Y_SHIFTED = AKC_Y | AKC_SHIFT_FLAG, + AKC_Z_SHIFTED = AKC_Z | AKC_SHIFT_FLAG, + + AKC_0 = 0x00000b, + AKC_1 = 0x000002, + AKC_2 = 0x000003, + AKC_3 = 0x000004, + AKC_4 = 0x000005, + AKC_5 = 0x000006, + AKC_6 = 0x000007, + AKC_7 = 0x000008, + AKC_8 = 0x000009, + AKC_9 = 0x00000a, + + AKC_0_SHIFTED = AKC_0 | AKC_SHIFT_FLAG, + AKC_1_SHIFTED = AKC_1 | AKC_SHIFT_FLAG, + AKC_2_SHIFTED = AKC_2 | AKC_SHIFT_FLAG, + AKC_3_SHIFTED = AKC_3 | AKC_SHIFT_FLAG, + AKC_4_SHIFTED = AKC_4 | AKC_SHIFT_FLAG, + AKC_5_SHIFTED = AKC_5 | AKC_SHIFT_FLAG, + AKC_6_SHIFTED = AKC_6 | AKC_SHIFT_FLAG, + AKC_7_SHIFTED = AKC_7 | AKC_SHIFT_FLAG, + AKC_8_SHIFTED = AKC_8 | AKC_SHIFT_FLAG, + AKC_9_SHIFTED = AKC_9 | AKC_SHIFT_FLAG, + + AKC_F1 = 0x00003b, + AKC_F2 = 0x00003c, + AKC_F3 = 0x00003d, + AKC_F4 = 0x00003e, + AKC_F5 = 0x00003f, + AKC_F6 = 0x000040, + AKC_F7 = 0x000041, + AKC_F8 = 0x000042, + AKC_F9 = 0x000043, + AKC_F10 = 0x000044, + AKC_F11 = 0x000057, + AKC_F12 = 0x000058, + + AKC_F1_SHIFTED = AKC_F1 | AKC_SHIFT_FLAG, + AKC_F2_SHIFTED = AKC_F2 | AKC_SHIFT_FLAG, + AKC_F3_SHIFTED = AKC_F3 | AKC_SHIFT_FLAG, + AKC_F4_SHIFTED = AKC_F4 | AKC_SHIFT_FLAG, + AKC_F5_SHIFTED = AKC_F5 | AKC_SHIFT_FLAG, + AKC_F6_SHIFTED = AKC_F6 | AKC_SHIFT_FLAG, + AKC_F7_SHIFTED = AKC_F7 | AKC_SHIFT_FLAG, + AKC_F8_SHIFTED = AKC_F8 | AKC_SHIFT_FLAG, + AKC_F9_SHIFTED = AKC_F9 | AKC_SHIFT_FLAG, + AKC_F10_SHIFTED = AKC_F10 | AKC_SHIFT_FLAG, + AKC_F11_SHIFTED = AKC_F11 | AKC_SHIFT_FLAG, + AKC_F12_SHIFTED = AKC_F12 | AKC_SHIFT_FLAG, + + // joystick buttons, no actual keyboard keys + AKC_JOY_BUTTON1 = 0x000000 | AKC_JOY_FLAG, + AKC_JOY_BUTTON2 = 0x000001 | AKC_JOY_FLAG, + AKC_JOY_BUTTON3 = 0x000002 | AKC_JOY_FLAG, + AKC_JOY_BUTTON4 = 0x000003 | AKC_JOY_FLAG, + AKC_JOY_BUTTON5 = 0x000004 | AKC_JOY_FLAG, + AKC_JOY_BUTTON6 = 0x000005 | AKC_JOY_FLAG, + AKC_JOY_BUTTON7 = 0x000006 | AKC_JOY_FLAG, + AKC_JOY_BUTTON8 = 0x000007 | AKC_JOY_FLAG +}; + + +#endif // _KEYS_PC_H_ + + diff --git a/src/libparsec/include/linkinfo.h b/src/libparsec/include/linkinfo.h new file mode 100644 index 0000000..205bd66 --- /dev/null +++ b/src/libparsec/include/linkinfo.h @@ -0,0 +1,33 @@ +/* + * PARSEC HEADER: linkinfo.h + */ + +#ifndef _LINKINFO_H_ +#define _LINKINFO_H_ + +// default bindings + +///* +#define BT_PROTOCOL_DEFAULT BT_PROTOCOL_GAMESERVER +//*/ + +/* +#define BT_PROTOCOL_DEFAULT BT_PROTOCOL_PEERTOPEER +*/ + + +// NULL NETWORKING subsystem linked (PROTOCOL) + +//#define NET_NULL + + +// linked PROTOCOL subsystems + +#define LINKED_PROTOCOL_PEERTOPEER +#define LINKED_PROTOCOL_GAMESERVER +//#define LINKED_PROTOCOL_DEMONULL + + +#endif // _LINKINFO_H_ + + diff --git a/src/libparsec/include/net_conf.h b/src/libparsec/include/net_conf.h new file mode 100644 index 0000000..1bdb37b --- /dev/null +++ b/src/libparsec/include/net_conf.h @@ -0,0 +1,48 @@ +/* + * PARSEC HEADER: net_conf.h + */ + +#ifndef _NET_CONF_H_ +#define _NET_CONF_H_ + +#ifdef PARSEC_SERVER + + // flags + #define INTERPOLATE_PLAYER_ACTIONS + #define SEND_KILL_MESSAGES + //#define NO_PROJECTILE_KILL_MESSAGES + //#define DONT_SEND_EXTRA_CREATES + #define ENABLE_PACKET_RECORDING + #define ENABLE_PACKET_SWAPPING + //#define ENABLE_PACKETDROP_TESTING + //#define ENCRYPT_PACKETS + + #ifdef DONT_SEND_EXTRA_CREATES + #define DSEXC(x) x + #else + #define DSEXC(x) + #endif + +#else // !PARSEC_SERVER + + // flags + #define INTERPOLATE_PLAYER_ACTIONS + #define SEND_KILL_MESSAGES + #define NO_PROJECTILE_KILL_MESSAGES + //#define DONT_SEND_EXTRA_CREATES + #define ENABLE_PACKET_RECORDING + #define ENABLE_PACKET_SWAPPING + #define ENABLE_PACKETDROP_TESTING + //#define ENCRYPT_PACKETS + + #ifdef DONT_SEND_EXTRA_CREATES + #define DSEXC(x) x + #else + #define DSEXC(x) + #endif + +#endif // !PARSEC_SERVER + +#endif // _NET_CONF_H_ + + diff --git a/src/libparsec/include/net_csdf.h b/src/libparsec/include/net_csdf.h new file mode 100644 index 0000000..b264643 --- /dev/null +++ b/src/libparsec/include/net_csdf.h @@ -0,0 +1,143 @@ +/* + * PARSEC HEADER: net_csdf.h + */ + +#ifndef _NET_CSDF_H_ +#define _NET_CSDF_H_ + + +// parsec client/server protocol version number ------------------------------- +// +#define CLSV_PROTOCOL_MAJOR 0 +#define CLSV_PROTOCOL_MINOR 20 + +#ifdef PARSEC_CLIENT + #include "net_udpdf.h" +#endif // PARSEC_CLIENT + +// client -> gameserver +//FIXME: use const char here and get rid of vars defined in sv_glob.h +#define GIVECHALLSTRING1 "givechallenge" +//#define CONNSTRING1 "connreq %d.%d n %s os %s" +#define CONNSTRING2 "c2 %02d.%02d ch %d n %s cr %d sr %d os %s" +#define RMVSTRING1 "rmvreq" +#define NAMESTRING1 "namereq %s" +#define PINGSTRING1 "p %d" +#define INFOSTRING1 "reqinfo %d" + +//FIXME: define these and use in RE_CommandInfo::code +/*#define PROT_GIVECHALLENGE_CODE 0 +#define PROT_CONNECTREQUEST_CODE 0 +#define PROT_GIVECHALLENGE_CODE 0 +#define PROT_GIVECHALLENGE_CODE 0 +#define PROT_GIVECHALLENGE_CODE 0 +*/ + +// gameserver -> client +#define RECVSTR_CHALLENGE "chall %d" +#define RECVSTR_ACCEPTED "acchost %s:%d slot %d max %d svid %d srv %s" +#define RECVSTR_SERVER_FULL "srvfull" +#define RECVSTR_REQUEST_INVALID "reqinval" +#define RECVSTR_REMOVE_OK "rmvok" +#define RECVSTR_NOT_CONNECTED "nconn" +#define RECVSTR_SERVER_INCOMP "srvincomp" +#define RECVSTR_CLIENT_BANNED "banned" +#define RECVSTR_NAME_OK "nameok" +#define RECVSTR_NAME_INVALID "nameinval" +#define RECVSTR_LINK_SERVER "linkserv %s:%d %d %d %d" +#define RECVSTR_CHALL_INVALID "challinv" +#define RECVSTR_PING_REPLY "p s %d r %d p %d/%d" +#define RECVSTR_INFO_REPLY "info s %d r %d p %d/%d v %d.%d n %s" +#define LISTSTR_ADDED_IN_SLOT "addslot %d nick %s" +#define LISTSTR_REMOVED_FROM_SLOT "rmvslot %d" +#define LISTSTR_NAME_UPDATED "updslot %d nick %s" + + +// gameserver -> masterserver +#define MASV_CHALLSTRING "c2 %02d.%02d ch %d n %s p %d/%d s %d os %s pt %d" + +// masterserver -> gameserver +#define MASV_RESPONSE_NEW_CHALL RECVSTR_CHALLENGE + +// client -> masterserver +#define MASV_LIST "list" +#define MASV_INFO "info %d" + + +// ---------------------------------------------------------------------------- +// +struct ipport_s { + + char ip[ MAX_IPADDR_LEN + 1 ]; // ip address + byte portlo; // low 8 bits of port + byte porthi; // high 8 bits of port + word _pad; +}; + + +// ---------------------------------------------------------------------------- +// +struct client_s { + + // data + int slot_free; + char client_name[ MAX_PLAYER_NAME + 1 ]; // the nickname of the player + + // methods + void Reset() + { + slot_free = TRUE; + memset( client_name, 0, ( MAX_PLAYER_NAME + 1 ) * sizeof( char ) ); + } +}; + + +// ---------------------------------------------------------------------------- +// +struct server_s { + + // data + char slot_free; + node_t node; + char server_name[ MAX_SERVER_NAME + 1 ]; // the name of the server + char server_os[ MAX_OSNAME_LEN + 1 ]; // the server's operating system + int number_of_players; // Number of clients joined at server + int max_players; // how many players the server can handle + char server_url[ MAX_CFG_LINE + 1 ]; + int xpos; // x position of server in starmap + int ypos; // y position of server in starmap + int serverid; // global universe id of server + int major_version; + int minor_version; + int ping_in_ms; // ping in ms +}; + + +// struct defining a link between 2 servers ----------------------------------- +// +struct link_s { + + // data + int serverid1; + int serverid2; + int flags; // see SERVERLINKINFO_BOTH etc. +}; + + +// struct defining a map object in the starmap -------------------------------- +// +struct mapobj_s { + + char name[ MAX_MAP_OBJ_NAME + 1 ]; + int xpos; + int ypos; + int w; + int h; + char* texname; + TextureMap* texmap; +}; + + +#endif // _NET_CSDF_H_ + + diff --git a/src/libparsec/include/net_defs.h b/src/libparsec/include/net_defs.h new file mode 100644 index 0000000..a2dbb4e --- /dev/null +++ b/src/libparsec/include/net_defs.h @@ -0,0 +1,1000 @@ +/* + * PARSEC HEADER: net_defs.h + */ + +#ifndef _NET_DEFS_H_ +#define _NET_DEFS_H_ + + +// ---------------------------------------------------------------------------- +// NETWORKING SUBSYSTEM (NET) related definitions - +// ---------------------------------------------------------------------------- + + +// possible values and masks of global NetworkGame ---------------------------- +// +#define NETWORK_GAME_OFF 0x00 +#define NETWORK_GAME_ON 0x01 +#define NETWORK_GAME_SIMULATED 0x02 + + +// game management constants (special values of global CurGameTime) ----------- +// +#define GAME_NOTSTARTEDYET -1 +#define GAME_FINISHED_TIME -2 +#define GAME_FINISHED_KILLS -3 +#define GAME_TERMINATED -4 +#define GAME_PEERTOPEER -5 + +#define GAME_RUNNING() ( CurGameTime >= 0 ) +#define GAME_OVER() ( ( CurGameTime == GAME_FINISHED_TIME ) || ( CurGameTime == GAME_FINISHED_KILLS ) ) +#define GAME_NO_SERVER() ( CurGameTime == GAME_PEERTOPEER ) + + +// identification of killer --------------------------------------------------- +// +#define KILLERID_UNKNOWN 0 // playerid of killer not known +#define KILLERID_BIAS 1 // playerid bias (additive) + +// number of allocated network slots (absolute maximum number of players) ----- +// +#define MAX_NET_ALLOC_SLOTS 16 + +// special player ids --------------------------------------------------------- +// +#define PLAYERID_SERVER 128 // packet destination is the server +#define PLAYERID_ANONYMOUS -2 // packet sender is not connected +#define PLAYERID_MASTERSERVER -3 // packet sender is masterserver +#define PLAYERID_INVALID -4 // invalid sender + +// maximum number of simultaneous network players in game-server mode --------- +// +#define MAX_NET_GMSV_PLAYERS MAX_NET_ALLOC_SLOTS + +// maximum number of simultaneous network players in peer-to-peer mode -------- +// +#define MAX_NET_UDP_PEER_PLAYERS 8 +#define MAX_NET_IPX_PEER_PLAYERS 4 + + +// current maximum number of network players, depending on active protocol ---- +// +#define MAX_NET_PROTO_PLAYERS CurMaxPlayers // declared in NET_GLOB.H + + +// node address compare results ----------------------------------------------- +// +#define NODECMP_LESSTHAN -1 +#define NODECMP_EQUAL 0 +#define NODECMP_GREATERTHAN 1 + + +// message id for connectionless datagrams ------------------------------------ +// +#define MSGID_DATAGRAM 0xFFFFFFFF + +// size of packet signature --------------------------------------------------- +// +#define PACKET_SIGNATURE_SIZE 8 + + +// maximum packet payload for ipx --------------------------------------------- +// +#define NET_IPX_DATA_LENGTH 546 + + +// maximum packet payload for udp --------------------------------------------- +// +#define NET_UDP_DATA_LENGTH 1400 + + +// current maximum packet payload --------------------------------------------- +// +#ifdef PARSEC_CLIENT + #define NET_MAX_DATA_LENGTH CurMaxDataLength +#else // !PARSEC_CLIENT + #define NET_MAX_DATA_LENGTH NET_UDP_DATA_LENGTH +#endif // !PARSEC_CLIENT + + +// max. length of internal packets -------------------------------------------- +// +#define NET_MAX_NETPACKET_INTERNAL_LEN 2 * NET_UDP_DATA_LENGTH + + +// size of statically allocated packets --------------------------------------- +// +#define NET_ALLOC_DATA_LENGTH NET_UDP_DATA_LENGTH + + +// size of remote packet stored into file (by recording it) ------------------- +// +#define RECORD_PACKET_SIZE NET_ALLOC_DATA_LENGTH + + +// maximum number of pending slot requests ------------------------------------ +// +#define MAX_SLOT_REQUESTS 8 + + +// maximum number of bytes in a remote address -------------------------------- +// (regardless of protocol; accommodates IPv6) +#define MAX_NODE_ADDRESS_BYTES 16 + + +// maximum number of specified masterservers ---------------------------------- +// +#define MAX_MASTERSERVERS 3 + + +// maximum number of servers (for serverlist and starmap) --------------------- +// +#define MAX_SERVERS 256 + + +// maximum # of links from one server ----------------------------------------- +// +#define MAX_NUM_LINKS 16 + + +// maximum # of map objects --------------------------------------------------- +// +#define MAX_MAP_OBJECTS 128 + +// max. length of map object names -------------------------------------------- +// +#define MAX_MAP_OBJ_NAME 31 + + +// various size constants ----------------------------------------------------- +// +#include "net_limits.h" + + +// encapsulate node address in portable manner -------------------------------- +// +struct node_t { + byte address[ MAX_NODE_ADDRESS_BYTES ]; +}; + + +// status of local ship that is transmitted to remote players ----------------- +// +struct ShipRemInfo { + + Xmatrx ObjPosition; // 12 * 4 = 48 + word CurDamage; // 2 + word CurShield; // 2 + fixed_t CurSpeed; // 4 + bams_t CurYaw; // 4 + bams_t CurPitch; // 4 + bams_t CurRoll; // 4 + geomv_t CurSlideHorz; // 4 + geomv_t CurSlideVert; // 4 + int NumMissls; // 4 + int NumHomMissls; // 4 + int NumMines; // 4 + int NumPartMissls; // 4 +}; + + + +// info about ship that should be created on remote host ---------------------- +// +struct ShipCreateInfo { + + dword ShipIndex; + Xmatrx ObjPosition; +}; + + +// server properties that are returned in ping packets ------------------------ +// +struct ServerInfo { + + char name[ 32 ]; + byte portlo; + byte porthi; + byte _padding[ 42 ]; +}; + +//NOTE: +// sizeof( ServerInfo ) must be <= sizeof( ShipRemInfo ) + + + +// ---------------------------------------------------------------------------- +// PEER protocol revisions: +// ---------------------------------------------------------------------------- +// +// 0.1 build 0190 NetGameData +// 0.2 build 0196 ( maxplayers set to 8 ) OldNetGameData = NetGameData from 0190 +// 0.3 build 0198 complete new packet handling ( NetPacket{External} ) +// 0.4 build 0198 CRC stored in packets + +// parsec peer-to-peer protocol version number -------------------------------- +// +#define P2P_PROTOCOL_MAJOR 0 +#define P2P_PROTOCOL_MINOR 4 + + +//NOTE: internal NetPackets are those that are used by all network/game functions +// except the ones actually sending and receiving packets over the wire + + +//NOTE: As we want to have only some fields in the structure inherited, we +// can not use standard C++ inheritance here. Instead we define the +// structures such, that they are compatible in the (shared) sections. +// The main reason for this is the variable sized remote event list + +//NOTE: if you change anything in the "shared" sections of NetPacket, be sure +// to do the same in NetPacket_GMSV and NetPacket_PEER + +// common base structure for internal ( in-memory ) packet structure ( protocol independent ) +// +struct NetPacket { + + //------------------------------------------------------------------------ + // header ( shared ) // = 128 + //------------------------------------------------------------------------ + int SendPlayerId; // 4 + dword MessageId; // 4 + + int Command; // 4 + int params[ 29 ]; // 116 + + //------------------------------------------------------------------------ + // payload ( differs ) // = 128 + //------------------------------------------------------------------------ + + byte payload_pad[ 128 ]; // 128 + + //------------------------------------------------------------------------ + // remote event list ( shared ) /// NET_MAX_DATA_LENGTH ( 1400 or 546 ) - 256 = 1144 or 290 + //------------------------------------------------------------------------ + //size_t RE_ListSize; // 4 + //dword RE_List; // 4 ( RE_Header + 2 ) + size_t test1; + dword test2; +}; + +// interal ( in-memory ) packet structure when using the gameserver protocol -- +// +struct NetPacket_GMSV { + + //------------------------------------------------------------------------ + // header ( shared ) // = 128 + //------------------------------------------------------------------------ + int SendPlayerId; // 4 + dword MessageId; // 4 + + int Command; // 4 +// int removeme_params[ 29 ]; // 116 //FIXME: not needed in GMSV protocol + + //------------------------------------------------------------------------ + // payload ( differs ) // = 128 + //------------------------------------------------------------------------ + dword ReliableMessageId; // 4 + dword AckMessageId; // 4 + dword AckReliableMessageId; // 4 + +// byte payload_pad[ 128 - 3 * sizeof( dword ) ]; // 112 //FIXME: get rid of this + + //------------------------------------------------------------------------ + // remote event list ( shared ) + //------------------------------------------------------------------------ + size_t RE_ListSize; // 4 + dword RE_List; // 4 ( RE_Header + 2 ) +}; + + +// interal ( in-memory ) packet structure when using the peer-to-peer protocol +// +struct NetPacket_PEER { + + //------------------------------------------------------------------------ + // header ( shared ) // = 128 + //------------------------------------------------------------------------ + int SendPlayerId; // 4 + dword MessageId; // 4 + + int Command; // 4 + int params[ 29 ]; // 116 + + //------------------------------------------------------------------------ + // payload ( differs ) // = 128 + //------------------------------------------------------------------------ + int DestPlayerId; // 4 + + byte Universe; // 1 + byte NumPlayers; // 1 + byte _padding1[ 2 ]; // 2 + byte PlayerKills[ MAX_NET_ALLOC_SLOTS ]; // 16 + + ShipRemInfo ShipInfo; // 76 + + int GameTime; // 4 + + byte payload_pad[ 128 - 104 ]; // 24 + + //------------------------------------------------------------------------ + // remote event list ( shared ) /// NET_MAX_DATA_LENGTH ( 1400 or 546 ) - 256 = 1144 or 290 + //------------------------------------------------------------------------ + size_t RE_ListSize; // 4 + dword RE_List; // 4 ( RE_Header + 2 ) +}; + +//NOTE: external NetPackets are those that are actually sent over the wire or +// stored in recorded demos + +// common base structure for external network packets ------------------------- +// +struct NetPacketExternal { + + // header ------------------------- + char Signature[ 1 ]; + +}; + +// external packet format for gameserver protocol ----------------------------- +// +struct NetPacketExternal_GMSV : NetPacketExternal { + + // header ------------------------- + char Signature2[ 3 ]; + word Protocol; + byte MajorVersion; + byte MinorVersion; + + dword crc32; + //FIXME: padding ????? + + // payload ------------------------ + int SendPlayerId; + + dword MessageId; + dword ReliableMessageId; + dword AckMessageId; + dword AckReliableMessageId; + + byte Command; +// signed char removeme_param1; // do we need these in gameserver protocol?? +// signed char removeme_param2; +// signed char removeme_param3; +// int removeme_param4; + + dword RE_List; +}; + + +// external DEMO packet format for gameserver protocol ------------------------ +// +typedef struct NetPacketExternal_GMSV NetPacketExternal_DEMO_GMSV; + + +// external packet format for peer-to-peer protocol --------------------------- +// +struct NetPacketExternal_PEER : NetPacketExternal { + + // header ------------------------- + char Signature2[ 3 ]; + word Protocol; + byte MajorVersion; + byte MinorVersion; + + dword crc32; + //FIXME: padding ????? + + // payload ------------------------ + dword MessageId; + + byte Command; + signed char param1; + signed char param2; + signed char param3; + int param4; + + byte Universe; + byte NumPlayers; + signed char SendPlayerId; + signed char DestPlayerId; + + byte PlayerKills[ MAX_NET_ALLOC_SLOTS ]; + + ShipRemInfo ShipInfo; + + int GameTime; + + dword RE_List; +}; + +// external DEMO packet format for peer-to-peer protocol ---------------------- +// +struct NetPacketExternal_DEMO_PEER : NetPacketExternal { + + // header ------------------------- + char Signature2[ 3 ]; + word Protocol; + byte MajorVersion; + byte MinorVersion; + + // additional header for DEMO ----- + size_t pktsize; + + dword crc32; // CRC over the whole packet + dword crc_header; // CRC over the header ( not including this field ) + + // payload ------------------------ + dword MessageId; + + byte Command; + signed char param1; + signed char param2; + signed char param3; + int param4; + + byte Universe; + byte NumPlayers; + signed char SendPlayerId; + signed char DestPlayerId; + + byte PlayerKills[ MAX_NET_ALLOC_SLOTS ]; + + ShipRemInfo ShipInfo; + + int GameTime; + + dword RE_List; +}; + +// external packet format for legacy recorded demos ( stored in demos <= 0190 ) ------- +// +struct NetPacketExternal_DEMO_PEER_0190 : NetPacketExternal { + + // header ------------------------- + char Signature2[ PACKET_SIGNATURE_SIZE - 1 ]; + + // payload ------------------------ + dword MessageId; + + byte Command; + signed char param1; + signed char param2; + signed char param3; + int param4; + + byte Universe; + byte NumPlayers; + signed char SendPlayerId; + signed char DestPlayerId; + + byte PlayerKills[ MAX_NET_IPX_PEER_PLAYERS ]; + + ShipRemInfo ShipInfo; + + int GameTime; + + dword RE_List; +}; + +//#define NETGAMEDATA_SIZE NET_MAX_DATA_LENGTH + +/* +#ifndef _NEW_NETPACKET + +// game data for network transfer --------------------------------------------- +// +struct NetGameData { + + char Signature[ PACKET_SIGNATURE_SIZE ]; + + dword MessageId; + + byte Command; + signed char param1; + signed char param2; + signed char param3; + int param4; + + byte Universe; + byte NumPlayers; + signed char SendPlayerId; + signed char DestPlayerId; + + byte PlayerKills[ MAX_NET_ALLOC_SLOTS ]; + + ShipRemInfo ShipInfo; + + int GameTime; + + dword RE_List; +}; + +// OLD game data for network transfer ----------------------------------------- +// +struct OldNetGameData { + + char Signature[ PACKET_SIGNATURE_SIZE ]; + + dword MessageId; + + byte Command; + signed char param1; + signed char param2; + signed char param3; + int param4; + + byte Universe; + byte NumPlayers; + signed char SendPlayerId; + signed char DestPlayerId; + + byte PlayerKills[ MAX_NET_IPX_PEER_PLAYERS ]; + + ShipRemInfo ShipInfo; + + int GameTime; + + dword RE_List; +}; + +#endif // !_NEW_NETPACKET +*/ + + +// maximum available space for remote event-list ------------------------------ +// +#define RE_LIST_MAXAVAIL ( NETs_RmEvList_GetMaxSize() ) +#define RE_LIST_ALLOC_SIZE ( NET_ALLOC_DATA_LENGTH + sizeof( RE_Header ) ) + + +// packet types (commands) ---------------------------------------------------- +// +#define PKTP_CONNECT 0x00 // initial request for connection (peer-to-peer only) +#define PKTP_CONNECT_REPLY 0x01 // reply to connect request (peer-to-peer only) +#define PKTP_DISCONNECT 0x02 // disconnect entirely (peer-to-peer only) +#define PKTP_SLOT_REQUEST 0x03 // slave requests slot (peer-to-peer only) +#define PKTP_SUBDUE_SLAVE 0x04 // make sure slave subjects himself (peer-to-peer only) + +#define PKTP_JOIN 0x05 // join game (connection already up) (peer-to-peer only) +#define PKTP_UNJOIN 0x06 // unjoin game (exit to entry-mode) (peer-to-peer only) +#define PKTP_GAME_STATE 0x07 // current game state update ( joined ) (peer-to-peer only) +#define PKTP_NODE_ALIVE 0x08 // prevent being kicked out ( unjoined ) (peer-to-peer only) +//#define PKTP_PING 0x09 // ping packet (peer-to-peer only) + +#define PKTP_COMMAND 0x20 // client/server command ( C <-> S ) +#define PKTP_STREAM 0x21 // client/server stream ( C <-> S ) + + +// object list identifiers ---------------------------------------------------- +// +#define SHIP_LIST 0x00 +#define LASER_LIST 0x01 +#define MISSL_LIST 0x02 +#define EXTRA_LIST 0x03 +#define CUSTM_LIST 0x04 + + +// particle object types ------------------------------------------------------ +// +#define POBJ_ENERGYFIELD 0x01 +#define POBJ_MEGASHIELD 0x02 +#define POBJ_SPREADFIRE 0x03 + + +// weapon status flags -------------------------------------------------------- +// +#define WPSTATE_OFF 0x00 +#define WPSTATE_ON 0x01 + + +// player connect/join status ------------------------------------------------- +// +#define PLAYER_INACTIVE 0x00 +#define PLAYER_CONNECTED 0x01 +#define PLAYER_JOINED 0x03 + + +// cause of return to entry-mode ---------------------------------------------- +// +#define USER_EXIT 0x00 +#define SHIP_DOWNED 0x01 + + +// remote event control blocks ------------------------------------------------ +// +enum re_events { + + RE_EMPTY, // 0x00 + RE_DELETED, // 0x01 + RE_CREATEOBJECT, // 0x02 + RE_CREATELASER, // 0x03 + RE_CREATEMISSILE, // 0x04 + RE_CREATEEXTRA, // 0x05 + RE_KILLOBJECT, // 0x06 + RE_SENDTEXT, // 0x07 + RE_PLAYERNAME, // 0x08 + RE_PARTICLEOBJECT, // 0x09 + RE_PLAYERLIST, // 0x0a + RE_CONNECTQUEUE, // 0x0b + RE_WEAPONSTATE, // 0x0c + RE_STATESYNC, // 0x0d + RE_CREATESWARM, // 0x0e + RE_CREATEEMP, // 0x0f + RE_OWNERSECTION, // 0x10 // 16 + RE_PLAYERSTATUS, // 0x11 // 17 + RE_PLAYERANDSHIPSTATUS, // 0x12 // 18 + RE_KILLSTATS, // 0x13 // 19 + RE_GAMESTATE, // 0x14 // 20 + RE_COMMANDINFO, // 0x15 // 21 + RE_CLIENTINFO, // 0x16 // 22 + RE_CREATEEXTRA2, // 0x17 // 23 + RE_IPV4SERVERINFO, // 0x18 // 24 + RE_SERVERLINKINFO, // 0x19 // 25 + RE_MAPOBJECT, // 0x1a // 26 + RE_STARGATE, // 0x1b // 27 + RE_CREATEMINE, + RE_NUMEVENTS +}; + +// used if remote event size > 255 +#define RE_BLOCKSIZE_INVALID 0x00 + +// header every block starts with +struct RE_Header { + + byte RE_Type; //1 + byte RE_BlockSize; //1 +}; //Size: 2 + +// generic object creation +struct RE_CreateObject : RE_Header { //2 + + word ObjectClass; //2 + dword HostObjId; //4 + Xmatrx ObjPosition; //48 + dword Flags; //4 +}; //Size: 60 + +// laser object creation +struct RE_CreateLaser : RE_Header { //2 + + word ObjectClass; //2 + dword HostObjId; //4 + Xmatrx ObjPosition; //48 + Vertex3 DirectionVec; //16 +}; //72 + +// missile object creation +struct RE_CreateMissile : RE_Header { //2 + + word ObjectClass; //2 + dword HostObjId; //4 + Xmatrx ObjPosition; //48 + Vertex3 DirectionVec; //16 + dword TargetHostObjId; //4 +}; //76 + +// extra object creation +struct RE_CreateExtra : RE_Header { //2 + + word ExtraIndex; //2 + dword HostObjId; //4 + Xmatrx ObjPosition; //28 +}; //36 + +// extra object creation +struct RE_CreateExtra2 : RE_Header { //2 + + word ExtraIndex; //2 + dword HostObjId; //4 + Xmatrx ObjPosition; //48 + Vector3 DriftVec; //16 + int DriftTimeout; //4 +}; //76 + +// Mine object creation +struct RE_CreateMine : RE_Header { //2 + word ExtraIndex; //2 + dword HostObjId; //4 + Xmatrx ObjPosition; //48 +}; //56 + +// object destruction +struct RE_KillObject : RE_Header { //2 + + byte ListId; //1 + byte Flags; //1 + dword HostObjId; //4 +}; //8 + +// arbitrary text +struct RE_SendText : RE_Header { //2 + + char TextStart[1]; +}; //3 - 257 + +// player name +struct RE_PlayerName : RE_Header { //2 + + char PlayerName[ MAX_PLAYER_NAME + 1 ]; //32 +}; //34 + +// particle object creation +struct RE_ParticleObject : RE_Header { //2 + + word ObjectType; //2 + Vertex3 Origin; //16 +}; //20 + +// list of all remote players +struct RE_PlayerList : RE_Header { //2 + + byte SyncValKillLimit; + byte SyncValNebulaId; + byte Status[ MAX_NET_IPX_PEER_PLAYERS ]; + node_t AddressTable[ MAX_NET_IPX_PEER_PLAYERS ]; + char NameTable[ MAX_NET_IPX_PEER_PLAYERS ][ MAX_PLAYER_NAME + 1 ]; + ShipCreateInfo ShipInfoTable[ MAX_NET_IPX_PEER_PLAYERS ]; +}; + +// list of remote players trying to connect +struct RE_ConnectQueue : RE_Header { + + short NumRequests; + node_t AddressTable[ MAX_SLOT_REQUESTS ]; + char NameTable[ MAX_SLOT_REQUESTS ][ MAX_PLAYER_NAME + 1 ]; +}; + +// weapon firing +struct RE_WeaponState : RE_Header { //2 + + byte State; //1 + byte _dummy; //1 + dword WeaponMask; //4 +// dword Specials; // would break demos + int CurEnergy; //4 + int SenderId; //4 +}; //16 + +// state synchroniziation +struct RE_StateSync : RE_Header { //2 + + byte StateKey; //1 + byte StateValue; //1 +}; //4 (was 8) + +// swarm missile creation +struct RE_CreateSwarm : RE_Header { //2 + Vertex3 Origin; //16 + dword TargetHostObjId; //4 + dword RandSeed; //4 + byte SenderId; //4 +}; //30 + +// emp creation +struct RE_CreateEmp : RE_Header { //2 + byte Upgradelevel; //1 + int SenderId; // 4 +}; //7 + +// owner section +struct RE_OwnerSection : RE_Header { //2 + + byte owner; //1 +}; //3 + +// playerstate +struct RE_PlayerStatus : RE_Header { //2 + + word player_status; //2 + signed char params[ 4 ]; //4 + int objectindex; //4 + byte senderid; //1 + refframe_t RefFrame; //4 + + // sizeof( RE_PlayerStatus ) = (2) + 2 + 4 + 4 + 4 = 17 +}; + + +#define UF_PROPERTIES 0x0001 +#define UF_SPEEDS 0x0002 +#define UF_RESYNCPOS 0x0004 +#define UF_STATUS 0x0008 +#define UF_ALL 0xFFFF + +// full ship & player state +struct RE_PlayerAndShipStatus : RE_PlayerStatus //20 +{ + Xmatrx ObjPosition; // 48 + word CurDamage; // 2 + word CurShield; // 2 + fixed_t CurSpeed; // 4 + bams_t CurYaw; // 4 + bams_t CurPitch; // 4 + bams_t CurRoll; // 4 + geomv_t CurSlideHorz; // 4 + geomv_t CurSlideVert; // 4 + int CurEnergy; // 4 + byte NumMissls; // 1 + byte NumHomMissls; // 1 + byte NumMines; // 1 + byte NumPartMissls; // 1 + byte UpdateFlags; // 1 + + // sizeof( RE_PlayerAndShipStatus ) = (17) + 85 = 102 +}; + + +// killstats +struct RE_KillStats : RE_Header { //2 + byte PlayerKills[ MAX_NET_ALLOC_SLOTS ]; //16 + // 18 +}; + +// gamestate +struct RE_GameState : RE_Header { //2 + int GameTime; //4 + // 6 +}; + +// max. length of a command --------------------------------------------------- +#define MAX_RE_COMMANDINFO_COMMAND_LEN 254 - 1 - 2 /*header*/ - 1 /*code*/ + +// command ( GMSV mode only ) +struct RE_CommandInfo : RE_Header { //2 + byte code; //1 + //char command[ MAX_RE_COMMANDINFO_COMMAND_LEN + 1 ]; + char command[1]; //? +}; //4 to 250 + +#define PACK_SERVERRATE( r ) ( (byte)(r / 100) ) +#define UNPACK_SERVERRATE( r ) ( (r) * 100 ) + +// clientinfo ( GMSV mode only ) +struct RE_ClientInfo : RE_Header { + byte client_sendfreq; // packets per sec. + byte server_sendrate; // bytes per sec. + // 4 +}; + + +// serverinfo about a IP4 server +struct RE_IPv4ServerInfo : RE_Header { + byte node[ 6 ]; + word flags; + word serverid; + int xpos; + int ypos; + + // sizeof( RE_IPv4ServerInfo ) = (2) + 6 + 2 + 2 + 4 + 4 = 20 +}; + +// serverlink info flags ------------------------------------------------------ +// +#define SERVERLINKINFO_1_TO_2 0x01 // link is 1 --> 2 +#define SERVERLINKINFO_2_TO_1 0x02 // link is 1 <-- 2 +#define SERVERLINKINFO_BOTH 0x03 // link is 1 <-> 2 + +// linkinfo between 2 servers ------------------------------------------------- +// +struct RE_ServerLinkInfo : RE_Header { + word flags; + word serverid1; + word serverid2; + + // sizeof( RE_ServerLinkInfo ) = (2) + 2 + 2 + 2 = 8 +}; + + +// map object ----------------------------------------------------------------- +// +struct RE_MapObject : RE_Header { + word map_objectid; + char name[ MAX_MAP_OBJ_NAME + 1 ]; + int xpos; + int ypos; + int w; + int h; + char texname[ MAX_TEXNAME + 1 ]; + + // sizeof( RE_MapObject ) = (2) + 2 + 32 + 4 + 4 + 4 + 4 + 32 = 84 +}; + +// stargate properties -------------------------------------------------------- +// +struct RE_Stargate : RE_Header { + word serverid; // 2 + float pos[ 3 ]; // 12 + float dir[ 3 ]; // 12 + bams_t rotspeed; // 4 + float radius; // 4 + float actdistance; // 4 + float partvel; // 4 + float modulrad1; // 4 + float modulrad2; // 4 + char flare_name [ MAX_TEXNAME + 1 ]; // 32 + char interior_name [ MAX_TEXNAME + 1 ]; // 32 + word numpartactive; // 2 + word actcyllen; // 2 + word modulspeed; // 2 + byte acttime; // 1 + byte autoactivate; // 1 + byte dormant; // 1 + byte active; // 1 + byte _mksz128[ 2 ]; // 2 + + // sizeof( RE_Stargate ) = 128 +}; + + +//NOTE: +// new remote event structures must ensure proper alignment +// after the two leading header bytes, which usually means +// using two single bytes or a word as first field. + + +// make object id unique in network game by appending local player's id ------- +// +#ifndef PARSEC_MASTER + + #ifdef PARSEC_SERVER + + inline dword CreateGlobalObjId( dword localobjid, dword dwOwner ) + { + ASSERT( ( ( dwOwner >= 0 ) && ( dwOwner < MAX_NET_ALLOC_SLOTS ) ) || ( dwOwner == PLAYERID_SERVER ) ); + return ( ( dwOwner << 16 ) | ( localobjid & 0xffff ) ); + } + + #else + + inline dword CreateGlobalObjId( dword localobjid ) + { + ASSERT( !NetConnected || ( ( LocalPlayerId >= 0 ) && ( LocalPlayerId < MAX_NET_ALLOC_SLOTS ) ) ); + return ( ( LocalPlayerId << 16 ) | ( localobjid & 0xffff ) ); + } + + #endif // PARSEC_SERVER + +#endif // PARSEC_MASTER + + +// calc host object-id for ship of remote player (ship object id is 0) -------- +// +//#define ShipHostObjId( playerid ) ( playerid << 16 ) +inline dword ShipHostObjId( dword playerid ) +{ + return ( playerid << 16 ); +} + + +// retrieve owner from HostOjbNumber ------------------------------------------ +// +inline dword GetOwnerFromHostOjbNumber( dword _HostObjNumber ) +{ + return _HostObjNumber >> 16; +} + +// determine owner of object (remote player id) ------------------------------- +// +inline dword GetObjectOwner( const GenObject *obj ) +{ + return GetOwnerFromHostOjbNumber( obj->HostObjNumber ); +} + +#ifdef PARSEC_CLIENT + + // include system-specific subsystem prototypes + #include "net_subh.h" + +#else // !PARSEC_CLIENT + + // include system-specific subsystem prototypes + #include "net_subh_sv.h" + +#endif // !PARSEC_CLIENT + + +#endif // _NET_DEFS_H_ + + diff --git a/src/libparsec/include/net_limits.h b/src/libparsec/include/net_limits.h new file mode 100644 index 0000000..503f599 --- /dev/null +++ b/src/libparsec/include/net_limits.h @@ -0,0 +1,20 @@ +/* + * PARSEC HEADER: net_limits.h + */ + +#ifndef _NET_LIMITS_H_ +#define _NET_LIMITS_H_ + +// various size constants ----------------------------------------------------- +// +#define MAX_IPADDR_LEN 15 // xxx.xxx.xxx.xxx = 15 +#define MAX_HOSTNAME_LEN 1024 +#define MAX_OSNAME_LEN 31 +#define MAX_FILENAME_LEN 255 +#define MAX_SERVER_NAME 31 +#define MAX_CFG_LINE 127 +#define IP_ADR_LENGTH 4 // four octet ip address +#define NODE_ADR_LENGTH 6 // ip address plus port number +#define MAX_STRLEN_IPADDR MAX_IPADDR_LEN + +#endif // _NET_LIMITS_H_ diff --git a/src/libparsec/include/net_pckt.h b/src/libparsec/include/net_pckt.h new file mode 100644 index 0000000..ec2efff --- /dev/null +++ b/src/libparsec/include/net_pckt.h @@ -0,0 +1,38 @@ +/* + * PARSEC HEADER: net_pckt.h + */ + +#ifndef _NET_PCKT_H_ +#define _NET_PCKT_H_ + +// net_pckt.c implements the following functions +// --------------------------------------------- + + +// external functions --------------------------------------------------------- +// + + +// protocol type -------------------------------------------------------------- +// +#define PROTOCOL_PEER2PEER 0x0100 +#define PROTOCOL_GAMESERVER 0x0200 +#define PROTOCOL_ENCRYPTED 0xF000 + +// protocol type signature ---------------------------------------------------- +// +extern const char net_game_signature[]; +extern const char net_cryp_signature[]; +extern const char net_packet_signature_gameserver[]; +extern const char net_packet_signature_peer2peer[]; + +// signature lengths ---------------------------------------------------------- +// +#define SIGNATRUE_LEN_OLD PACKET_SIGNATURE_SIZE +#define SIGNATURE_LEN_GAMESERVER 3 +#define SIGNATURE_LEN_PEER2PEER 3 + + +#endif // _NET_PCKT_H_ + + diff --git a/src/libparsec/include/net_pckt_gmsv.h b/src/libparsec/include/net_pckt_gmsv.h new file mode 100644 index 0000000..103c0b1 --- /dev/null +++ b/src/libparsec/include/net_pckt_gmsv.h @@ -0,0 +1,23 @@ +/* + * PARSEC HEADER: net_pckt_gmsv.h + */ + +#ifndef _NET_PCKT_GMSV_H_ +#define _NET_PCKT_GMSV_H_ + +// net_pckt_gmsv.c implements the following 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_pktlen, NetPacket* int_gamepacket ) +// int NETs_HandleInPacket_DEMO ( const NetPacketExternal* ext_gamepacket, NetPacket* int_gamepacket, size_t& psize ); +// size_t NETs_NetPacketExternal_DEMO_GetSize ( const NetPacketExternal* ext_gamepacket ); +// void NETs_StdGameHeader ( byte command, NetPacket* gamepacket ); +// void NETs_WritePacketInfo ( FILE *fp, NetPacketExternal* ext_gamepacket ); + +// external functions + + +#endif // _NET_PCKT_GMSV_H_ + + diff --git a/src/libparsec/include/net_ports.h b/src/libparsec/include/net_ports.h new file mode 100644 index 0000000..7d99943 --- /dev/null +++ b/src/libparsec/include/net_ports.h @@ -0,0 +1,18 @@ +#ifndef _NET_PORTS_H_ +#define _NET_PORTS_H_ + +// port numbers --------------------------------------------------------------- +// +#define DEFAULT_MASTERSERVER_TCP_PORT 6580 +#define DEFAULT_MASTERSERVER_UDP_PORT 6580 +#define DEFAULT_PEERTOPEER_UDP_PORT 6581 +#define DEFAULT_GAMESERVER_UDP_PORT 6582 + +// /etc/services template ----------------------------------------------------- +// +// parsec-master 6580/tcp # Parsec Masterserver +// parsec-master 6580/udp # Parsec Masterserver +// parsec-peer 6581/udp # Parsec Peer-to-Peer +// parsec-game 6582/udp # Parsec Gameserver + +#endif // _NET_PORTS_H_ diff --git a/src/libparsec/include/net_stream.h b/src/libparsec/include/net_stream.h new file mode 100644 index 0000000..3b5bd3e --- /dev/null +++ b/src/libparsec/include/net_stream.h @@ -0,0 +1,148 @@ +/* + * PARSEC HEADER: net_stream.h + */ + +#ifndef _NET_STREAM_H_ +#define _NET_STREAM_H_ + +// forward decls -------------------------------------------------------------- +// +class E_REList; + +// history buffer for received message ids to filter out duplicates ----------- +// +#define MSGID_HISTORY_SIZE 64 + +// packet loss meter ---------------------------------------------------------- +// +#define PACKET_LOSS_METER_LENGTH 100 // horizontal size + +// flag to indicate that the packet does NOT include a reliable payload ------- +// +#define NO_RELIABLE 0 + +// max. # of reliable RE lists to buffer -------------------------------------- +// +#define MAX_NUM_RELIABLE_BACKLOG 256 + +// sructure of FIFO entries --------------------------------------------------- +// +struct StreamFIFOEntry_s { + E_REList* m_pREList; + refframe_t m_Timeout; + int m_nRetransmitCount; + + StreamFIFOEntry_s() : + m_pREList( NULL ) + { + Reset(); + } + + void Reset(); + void InitEntry( E_REList* pREList ); +}; + +// maintaining of message-ids ------------------------------------------------- +// +class NET_Stream { +protected: + + dword Out_MessageId; // next out message + dword Out_ReliableMessageId; // next reliable out message + + dword I_ACK_MessageId; // message I ACK from YOU + dword I_ACK_ReliableMessageId; // reliable message I ACK from YOU + + dword YOU_ACK_MessageId; // message YOU ACK from ME + dword YOU_ACK_ReliableMessageId; // reliable message YOU ACK from ME + + dword m_MessageId_ReliableWasSent; + + bool_t m_EnableReliable; + int m_nPeerID; + int m_nSenderID; + + bool_t m_bIsConnected; + + // FIXME: STATS + char packet_graph_recv[ PACKET_LOSS_METER_LENGTH ]; + char packet_graph_send[ PACKET_LOSS_METER_LENGTH ]; + + int message_id_history[ MSGID_HISTORY_SIZE ]; + + int m_nFIFO_WritePos; + int m_nFIFO_ReadPos; + StreamFIFOEntry_s m_FIFOEntries[ MAX_NUM_RELIABLE_BACKLOG ]; + + refframe_t m_ReliableRetransmit_Frames; // timeout to retransmit reliable packets ( based on RTT ( see Stevens ) ) + +protected: + int _FIFO_GetNextWritePos() { return ( m_nFIFO_WritePos + 1 ) % MAX_NUM_RELIABLE_BACKLOG; } + int _FIFO_GetNextReadPos() { return ( m_nFIFO_ReadPos + 1 ) % MAX_NUM_RELIABLE_BACKLOG; } + + // update the timeout for a specific FIFO entry + void _FIFO_UpdateTimeOut( StreamFIFOEntry_s* pEntry ); + +public: + + // default ctor + NET_Stream(); + + // set the peer ID this stream is connected to + void SetPeerID( int nPeerID ) { m_nPeerID = nPeerID; } + + // set the sender ID of this stream + void SetSenderID( int nSenderID ) { m_nSenderID = nSenderID; } + + // reset the stream to defaults + void Reset(); + + // set the stream to connected mode ( accepts non datagrams ) + void SetConnected(); + + // set whether we enable reliable for this stream + void SetEnableReliable( bool_t enable ) { m_EnableReliable = enable; } + + // check whether a reliable message was already ACK + bool_t IsReliableACK( dword dwMessage ) { return YOU_ACK_ReliableMessageId >= dwMessage; } + + // check whether a message was already ACK + bool_t IsACK( dword dwMessage ) { return YOU_ACK_MessageId >= dwMessage; } + + // return the last message id we got an ACK for + dword GetLastACKMessageId() { return YOU_ACK_MessageId; } + + // return the message# of the last packet received + dword GetLastInPacket() { return I_ACK_MessageId; } + + // check input packet for rejection and maintain ACKs correctly + int InPacket( NetPacket_GMSV* gamepacket_GMSV ); + + // fill in fields in outgoing packet + void OutPacket( NetPacket_GMSV* gamepacket_GMSV, int reliable = FALSE ); + + // check whether to filter out a duplicate packet + int FilterPacketDuplicate( int messageid ); + + // log packet loss statistics + void LogPacketLossStats( int numpackets, int packetok, int incoming ); + + // append a RE list to the FIFO + int AppendToReliableFIFO( E_REList* pREList ); + + // retrieve the next reliable RE list from FIFO to send + E_REList* GetNextReliableToSend(); + + // reset all reliable handling + void FlushReliableBuffer(); + + // return the next outgoing message id + dword GetNextOutMessageId() { return Out_MessageId; } + + friend class NET_PacketDriver; +}; + + +#endif // _NET_STREAM_H_ + + diff --git a/src/libparsec/include/net_swap.h b/src/libparsec/include/net_swap.h new file mode 100644 index 0000000..7a434b7 --- /dev/null +++ b/src/libparsec/include/net_swap.h @@ -0,0 +1,21 @@ +/* + * PARSEC HEADER: net_swap.h + */ + +#ifndef _NET_SWAP_H_ +#define _NET_SWAP_H_ + + +// external functions --------------------------------------------------------- +// +void NET_RmEvList_Swap( RE_Header* relist, int incoming ); +void SWAP_ShipRemInfo_in( ShipRemInfo *reminfo ); +void SWAP_ShipRemInfo_out( ShipRemInfo *reminfo ); + +// define low-level network byte-order swapping functions +#define NET_SWAP_16 SWAP_16 +#define NET_SWAP_32 SWAP_32 + +#endif + + diff --git a/src/libparsec/include/net_util.h b/src/libparsec/include/net_util.h new file mode 100644 index 0000000..5839192 --- /dev/null +++ b/src/libparsec/include/net_util.h @@ -0,0 +1,40 @@ +/* + * PARSEC HEADER: net_util.h + */ + +#ifndef _NET_UTIL_H_ +#define _NET_UTIL_H_ + + +// net_util.c implements the following functions +// --------------------------------------------- + + +// flag whether to include packet info writing code +#define PACKETINFO_WRITING_AVAILABLE + + +// external functions --------------------------------------------------------- +// +#ifdef PACKETINFO_WRITING_AVAILABLE + int NET_PacketInfo( const char *bstr, ... ); + void NET_RmEvList_WriteInfo( FILE* fp, RE_Header* relist ); +#endif // PACKETINFO_WRITING_AVAILABLE + +dword NET_CalcCRC( void* buf, size_t len ); +void NET_EncryptData( void* packet, size_t psize ); +void NET_DecryptData( void* packet, size_t psize ); + + +// include proper server/client specific header ------------------------------- +// +#ifdef PARSEC_CLIENT + #include "net_util_cl.h" +#else // !PARSEC_CLIENT + #include "net_util_sv.h" +#endif // !PARSEC_CLIENT + + +#endif // _NET_UTIL_H_ + + diff --git a/src/libparsec/include/net_wrap.h b/src/libparsec/include/net_wrap.h new file mode 100644 index 0000000..0861404 --- /dev/null +++ b/src/libparsec/include/net_wrap.h @@ -0,0 +1,114 @@ +/* + * PARSEC HEADER: net_wrap.h + */ + +#ifndef _NET_UNP_H_ +#define _NET_UNP_H_ + +#if defined( SYSTEM_TARGET_WINDOWS ) && ( _WIN32_WINNT >= _WIN32_WINNT_VISTA ) + #include <winsock2.h> + #include <ws2tcpip.h> + #include <io.h> +#else + #include <sys/types.h> + #include <sys/socket.h> + #include <sys/time.h> + #include <time.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <errno.h> + #include <fcntl.h> + #include <netdb.h> + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <sys/stat.h> + #include <sys/uio.h> + #include <unistd.h> + #include <sys/wait.h> + #include <net/if.h> + #include <sys/un.h> + #include <sys/ioctl.h> +#endif +/* +#elif defined( SYSTEM_MACOSX_UNUSED ) + #include <sys/types.h> + #include <sys/socket.h> + #include <sys/time.h> + #include <time.h> + #include <netinet/in.h> + #include <arpa/inet.h> + #include <errno.h> + #include <fcntl.h> + #include <netdb.h> + #include <signal.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> + #include <sys/stat.h> + #include <sys/uio.h> + #include <unistd.h> + #include <sys/wait.h> + #include <net/if.h> + #include <sys/un.h> + #include <sys/sockio.h> + #include <sys/ioctl.h> + + #define socklen_t int +#endif +*/ + +// constants and macros used by the network code ------------------------------ +// +#define MAXLINE 4096 + +#define SA struct sockaddr + + +// windows uses closesocket, osx/linux use close +#ifdef SYSTEM_TARGET_WINDOWS +#define CLOSESOCKET closesocket +#else +#define CLOSESOCKET close +#endif + + +// define some macros to make error handling more readable -------------------- +// +#ifdef SYSTEM_TARGET_WINDOWS + #define ERRNO wsaerr + #define FETCH_ERRNO() int wsaerr = WSAGetLastError() + #define ERRNO_EWOULDBLOCK ( wsaerr == WSAEWOULDBLOCK ) + #define ERRNO_ECONNREFUSED ( wsaerr == WSAECONNREFUSED ) + #define ERRNO_ENETDOWN ( wsaerr == WSAENETDOWN ) + #define ERRNO_ECONNRESET ( wsaerr == WSAECONNRESET ) + //#define ERRNO_WSAEMSGSIZE ( wsaerr == WSAEMSGSIZE ) + + // UNP legacy stuff + #define ioctl( fd, request, arg ) ioctlsocket(fd, request, (unsigned long *) arg) + #define bzero(ptr,n) memset(ptr, 0, n) + + int inet_aton(const char *cp, struct in_addr *ap); + const char* hstrerror(int); +#if ( _WIN32_WINNT < _WIN32_WINNT_VISTA ) + const char* inet_ntop( int family, const void* addrptr, char* strptr, size_t len); +#endif +#else + #define ERRNO errno + #define FETCH_ERRNO() {} + #define ERRNO_EWOULDBLOCK ( errno == EWOULDBLOCK ) + #define ERRNO_ECONNREFUSED ( errno == ECONNREFUSED ) + #define ERRNO_ECONNRESET ( errno == ECONNRESET ) + #define ERRNO_ENETDOWN ( FALSE ) +#endif + + +#ifndef MAXHOSTNAMELEN + #define MAXHOSTNAMELEN 1024 +#endif + + +#endif // _NET_UNP_H_ + + diff --git a/src/libparsec/include/obj_clas.h b/src/libparsec/include/obj_clas.h new file mode 100644 index 0000000..735fd72 --- /dev/null +++ b/src/libparsec/include/obj_clas.h @@ -0,0 +1,20 @@ +/* + * PARSEC HEADER: obj_clas.h + */ + +#ifndef _OBJ_CLAS_H_ +#define _OBJ_CLAS_H_ + + +// external functions + +GenObject* OBJ_FetchObjectClass( const char *classname ); +dword OBJ_FetchObjectClassId( const char *classname ); +GenObject* OBJ_ReacquireObjectClass( dword *classid, const char *classname ); + +void OBJ_InitClass( dword classid ); + + +#endif // _OBJ_CLAS_H_ + + diff --git a/src/libparsec/include/obj_creg.h b/src/libparsec/include/obj_creg.h new file mode 100644 index 0000000..bada64d --- /dev/null +++ b/src/libparsec/include/obj_creg.h @@ -0,0 +1,46 @@ +/* + * PARSEC HEADER: obj_creg.h + */ + +#ifndef _OBJ_CREG_H_ +#define _OBJ_CREG_H_ + + +// maximum number of ship classes +#define MAX_SHIP_CLASSES 16 + +// maximum number of extra classes +#define MAX_EXTRA_CLASSES 64 + +// class is not a ship +#define SHIPINDEX_NO_SHIP -1 + +// class is not an extra +#define EXTRAINDEX_NO_EXTRA -1 + + +// function pointer type for class registration callback +typedef void (*classreg_fpt)( int numparams, int *params ); + + +// external variables + +extern int NumShipClasses; +extern dword ShipClasses[]; +extern int ObjClassShipIndex[]; + +extern int NumExtraClasses; +extern dword ExtraClasses[]; +extern int ObjClassExtraIndex[]; + + +// external functions + +int OBJ_RegisterClassRegistration( classreg_fpt regfunc ); +int OBJ_RegisterShipClass( dword classid ); +int OBJ_RegisterExtraClass( dword classid ); + + +#endif // _OBJ_CREG_H_ + + diff --git a/src/libparsec/include/obj_cust.h b/src/libparsec/include/obj_cust.h new file mode 100644 index 0000000..81fdf40 --- /dev/null +++ b/src/libparsec/include/obj_cust.h @@ -0,0 +1,77 @@ +/* + * PARSEC HEADER: obj_cust.h + */ + +#ifndef _OBJ_CUST_H_ +#define _OBJ_CUST_H_ + + +// maximum number of custom (additional) types -------------------------------- +// +#define MAX_NUM_CUSTOM_TYPES 64 + + +// custom type flags ---------------------------------------------------------- +// +#define CUSTOM_TYPE_DEFAULT 0x0000 +#define CUSTOM_TYPE_SUMMONABLE 0x0001 +#define CUSTOM_TYPE_NOT_PERSISTANT 0x0002 + + +// custom object notify events ------------------------------------------------ +// +enum { + + CUSTOM_NOTIFY_GENOBJECT_DELETE = 0 // GenObject will be deleted +}; + + +// structure for registration/maintenance of custom types --------------------- +// +struct custom_type_info_s { + + const char* type_name; + dword type_id; + size_t type_size; + CustomObject* type_template; + int type_flags; + + void (*callback_init)( CustomObject *base ); + + void (*callback_instant)( CustomObject *base ); + void (*callback_destroy)( CustomObject *base ); + + int (*callback_animate)( CustomObject *base ); + int (*callback_collide)( CustomObject *base ); + + void (*callback_notify)( CustomObject *base, GenObject *genobj, int event ); + int (*callback_persist)( CustomObject* base, int ToStream, void* relist ); + + dword _mksiz64[ 4 ]; +}; + + +// external functions + +dword OBJ_FetchCustomTypeId( const char *name ); +const char* OBJ_FetchCustomTypeName( dword objtypeid ); +size_t OBJ_FetchCustomTypeSize( dword objtypeid ); +CustomObject* OBJ_FetchCustomTypeTemplate( dword objtypeid ); +int OBJ_InitFromCustomTypeTemplate( CustomObject *obj, CustomObject *templ ); +void OBJ_InitCustomType( GenObject *classpo ); +dword OBJ_RegisterCustomType( custom_type_info_s *info ); +int OBJ_GetCustomTypeFlags( dword objtypeid ); +void OBJ_RegisterNotifyCustomObject( GenObject *genobj, CustomObject *customobj ); +int OBJ_UnregisterNotifyCustomObject( GenObject *genobj, CustomObject *customobj ); +void OBJ_NotifyCustomObjectsList( GenObject *genobj, int event ); + + +// external variables + +extern int num_custom_types; +extern custom_type_info_s custom_type_info[]; + + +#endif // _OBJ_CUST_H_ + + diff --git a/src/libparsec/include/obj_name.h b/src/libparsec/include/obj_name.h new file mode 100644 index 0000000..75abb01 --- /dev/null +++ b/src/libparsec/include/obj_name.h @@ -0,0 +1,53 @@ +/* + * PARSEC HEADER: obj_name.h + */ + +#ifndef _OBJ_NAME_H_ +#define _OBJ_NAME_H_ + + +// known object class names + +#define OBJCLASSNAME_SHIP_FIREBIRD "firebird" +#define OBJCLASSNAME_SHIP_BLUESPIRE "bluespire" +#define OBJCLASSNAME_SHIP_CORMORAN "cormoran" +#define OBJCLASSNAME_SHIP_STINGRAY "stingray" +#define OBJCLASSNAME_SHIP_CLAYMORE "claymore" +#define OBJCLASSNAME_SHIP_HURRICANE "hurricane" +#define OBJCLASSNAME_SHIP_NEEDLE "needle" + +#define OBJCLASSNAME_GUN_LEVEL0_A "laser_1a" +#define OBJCLASSNAME_GUN_LEVEL0_B "laser_1b" +#define OBJCLASSNAME_GUN_LEVEL1_DAZZLE "laser_2" +#define OBJCLASSNAME_GUN_LEVEL2_THIEF "laser_3" + +#define OBJCLASSNAME_MISSILE_DUMB "miss_dumb" +#define OBJCLASSNAME_MISSILE_GUIDE "miss_guide" + +#define OBJCLASSNAME_MISSILE_MINE "mine_proxy" + +#define OBJCLASSNAME_EXTRA_ENERGY "ex_energy" +#define OBJCLASSNAME_EXTRA_REPAIR "ex_repair" + +#define OBJCLASSNAME_EXTRA_GUN_HELIX "ex_helix" +#define OBJCLASSNAME_EXTRA_GUN_LIGHTNING "ex_light" +#define OBJCLASSNAME_EXTRA_GUN_PHOTON "ex_x2" +#define OBJCLASSNAME_EXTRA_GUN_UPGRADE_A "ex_laser2" +#define OBJCLASSNAME_EXTRA_GUN_UPGRADE_B "ex_laser3" + +#define OBJCLASSNAME_EXTRA_PACK_DUMB "ex_dumb" +#define OBJCLASSNAME_EXTRA_PACK_GUIDE "ex_guide" +#define OBJCLASSNAME_EXTRA_PACK_SWARM "ex_flare" +#define OBJCLASSNAME_EXTRA_PACK_MINES "ex_mine" + +#define OBJCLASSNAME_DEVICE_INVULNERABILITY "ex_invul" +#define OBJCLASSNAME_DEVICE_INVISIBILITY "ex_invis" +#define OBJCLASSNAME_DEVICE_AFTERBURNER "ex_aburn" +#define OBJCLASSNAME_DEVICE_DECOY "ex_x3" +#define OBJCLASSNAME_DEVICE_EMP_UPGRADE_1 "ex_emp" +#define OBJCLASSNAME_DEVICE_EMP_UPGRADE_2 "ex_emp2" + + +#endif // _OBJ_NAME_H_ + + diff --git a/src/libparsec/include/obj_odt.h b/src/libparsec/include/obj_odt.h new file mode 100644 index 0000000..3392b68 --- /dev/null +++ b/src/libparsec/include/obj_odt.h @@ -0,0 +1,65 @@ +/* + * PARSEC HEADER: obj_odt.h + */ + +#ifndef _OBJ_ODT_H_ +#define _OBJ_ODT_H_ + + + +// object class loading flags + +enum { + + OBJLOAD_NONE = 0x0000, // no additional info + OBJLOAD_DEFAULT = 0x8000, // use appropriate default settings + + OBJLOAD_WEDGENORMALS = 0x4001, // calculate WedgeNormals + OBJLOAD_WEDGECOLORS = 0x4002, // reserve storage for WedgeColors + OBJLOAD_WEDGETEXCOORDS = 0x4004, // store explicit WedgeTexCoords + OBJLOAD_WEDGELIGHTED = 0x4008, // reserve storage for WedgeLighted + OBJLOAD_WEDGESPECULAR = 0x4010, // reserve storage for WedgeSpecular + OBJLOAD_WEDGEFOGGED = 0x4020, // reserve storage for WedgeFogged + + OBJLOAD_WEDGE_INFO = 0x4000, // WedgeVertIndxs mandatory + + OBJLOAD_FACEANIMS = 0x0040, // FaceExtInfo and FaceAnimStates + OBJLOAD_VTXANIMS = 0x0080, // VtxAnimStates + + OBJLOAD_POLYCORNERCOLORS = 0x0100, // reserve corner colors in polys + OBJLOAD_POLYWEDGEINDEXES = 0x0200 // reserve wedge indexes in polys +}; + + +// maximum number of lods in an object + +#define MAX_OBJECT_LODS 16 + + +// additional configurable parameters for object loading + +struct odt_loading_params_s { + + int max_face_anim_states; + int max_vtx_anim_states; + geomv_t merge_normals_threshold; +}; + + +// forward declaration +struct shader_s; + + +// external functions + +int OBJ_LoadODT( dword classid, dword flags, shader_s *shader ); + + +// external variables + +extern odt_loading_params_s odt_loading_params; + + +#endif // _OBJ_ODT_H_ + + diff --git a/src/libparsec/include/obj_type.h b/src/libparsec/include/obj_type.h new file mode 100644 index 0000000..712acc9 --- /dev/null +++ b/src/libparsec/include/obj_type.h @@ -0,0 +1,24 @@ +/* + * PARSEC HEADER: obj_type.h + */ + +#ifndef _OBJ_TYPE_H_ +#define _OBJ_TYPE_H_ + + +// external variables + +extern const char* objtype_name[]; +extern dword objtype_id[]; + + +// external functions + +dword OBJ_FetchTypeIdFromName( const char *typestr ); +size_t OBJ_FetchTypeSize( dword objtypeid ); +void OBJ_InitDefaultTypeFields( GenObject *classpo ); + + +#endif // _OBJ_TYPE_H_ + + diff --git a/src/libparsec/include/objstruc.h b/src/libparsec/include/objstruc.h new file mode 100644 index 0000000..d556d0e --- /dev/null +++ b/src/libparsec/include/objstruc.h @@ -0,0 +1,47 @@ +/* + * PARSEC HEADER + * Object Structures and 3-D Datatypes V1.68 + * + * Copyright (c) Markus Hadwiger 1995-1998 + * All Rights Reserved. + */ + +#ifndef _OBJSTRUC_H_ +#define _OBJSTRUC_H_ + + +// include geometric type definitions +#include "od_geomv.h" + + +// include texture format specifications +#include "od_texdf.h" + + +// include ship weapons/specials masks +#include "od_masks.h" + + +// include transformation types +#include "od_trafo.h" + + +// include primitive types +#include "od_prim.h" + + +// include rasterization types +#include "od_rast.h" + + +// include generic object structures +#include "od_struc.h" + + +// include object type definitions +#include "od_types.h" + + +#endif // _OBJSTRUC_H_ + + diff --git a/src/libparsec/include/od_class.h b/src/libparsec/include/od_class.h new file mode 100644 index 0000000..ef5b0f3 --- /dev/null +++ b/src/libparsec/include/od_class.h @@ -0,0 +1,106 @@ +/* + * PARSEC HEADER (OBJECT) + * Class Codes V1.20 + * + * Copyright (c) Markus Hadwiger 1996-2000 + * All Rights Reserved. + */ + +#ifndef _OD_CLASS_H_ +#define _OD_CLASS_H_ + + +//NOTE: +// +// this lists the class ids of all object classes available. +// (actually: indexes into ObjClasses[] to retrieve class of certain id.) +// +// this *MUST* be consistent with the following information in other places: +// +// - list in control file (#objects); to ensure correct data<->class relation. +// - list in CON_INFO.C (ClassProperties[]); this provides textual class info. +// - version of remote player; class ids are part of some remote messages! +// + +enum enum_class_ids { + + SHIP_CLASS_1, // 0 + LASER0_CLASS_1, // 1 + LASER0_CLASS_2, // 2 + DUMB_CLASS_1, // 3 + GUIDE_CLASS_1, // 4 + SWARM_CLASS_1, // 5 + ENERGY_EXTRA_CLASS, // 6 + DUMB_PACK_CLASS, // 7 + SHIP_CLASS_2, // 8 + SHIP_CLASS_3, // 9 + GUIDE_PACK_CLASS, // 10 + HELIX_DEVICE_CLASS, // 11 + LIGHTNING_DEVICE_CLASS, // 12 + MINE_PACK_CLASS, // 13 + MINE_CLASS_1, // 14 + LASER1_CLASS_1, // 15 + LASER2_CLASS_1, // 16 + REPAIR_EXTRA_CLASS, // 17 + AFTERBURNER_DEVICE_CLASS, // 18 + SWARM_PACK_CLASS, // 19 + INVISIBILITY_CLASS, // 20 + PHOTON_DEVICE_CLASS, // 21 + DECOY_DEVICE_CLASS, // 22 + LASERUPGRADE1_CLASS, // 23 + LASERUPGRADE2_CLASS, // 24 + INVULNERABILITY_CLASS, // 25 +// EMPUPGRADE1_CLASS, // 26 +// EMPUPGRADE2_CLASS, // 27 + + NUM_ALTERABLE_CLASSES // must be last in list!! +}; + + +// indexes into OBJ_CREG::ExtraClasses[] for extras --------------------------- +// +enum { + + EXTRAINDX_ENERGY_EXTRA, // extra classindex 00: energy boost + EXTRAINDX_DUMB_PACK, // extra classindex 01: missile pack (dumb missiles) + EXTRAINDX_GUIDE_PACK, // extra classindex 02: missile pack (guided missiles) + EXTRAINDX_HELIX_DEVICE, // extra classindex 03: dazzling laser/helix cannon + EXTRAINDX_LIGHTNING_DEVICE, // extra classindex 04: thief laser/lightning device + EXTRAINDX_MINE_PACK, // extra classindex 05: mine pack (proximity mines) + EXTRAINDX_REPAIR_EXTRA, // extra classindex 06: repair damage + EXTRAINDX_AFTERBURNER_DEVICE, // extra classindex 07: afterburner + EXTRAINDX_SWARM_PACK, // extra classindex 08: missile pack (swarm missiles) + EXTRAINDX_INVISIBILITY, // extra classindex 09: invisibility (not used yet) + EXTRAINDX_PHOTON_DEVICE, // extra classindex 10: photon cannon + EXTRAINDX_DECOY_DEVICE, // extra classindex 11: decoy device + EXTRAINDX_LASERUPGRADE1, // extra classindex 12: laser upgrade 1 + EXTRAINDX_LASERUPGRADE2, // extra classindex 13: laser upgrade 2 + EXTRAINDX_INVULNERABILITY, // extra classindex 14: invulnerability + EXTRAINDX_MINE, // extra classindex 15: invulnerability + EXTRAINDX_EMPUPGRADE1, // extra classindex 16: emp upgrade 1 + EXTRAINDX_EMPUPGRADE2 // extra classindex 17: emp upgrade 2 +}; + + +// identifiers of collectable devices ----------------------------------------- +// +enum { + + UNKNOWN_DEVICE, // 0 + HELIX_DEVICE, // 1 + LIGHTNING_DEVICE, // 2 + AFTERBURNER_DEVICE, // 3 + INVISIBILITY_DEVICE, // 4 + PHOTON_DEVICE, // 5 + DECOY_DEVICE, // 6 + INVULNERABILITY_DEVICE, // 7 + LASER_UPGRADE_1_DEVICE, // 8 + LASER_UPGRADE_2_DEVICE, // 9 + EMP_UPGRADE_1_DEVICE, // 10 + EMP_UPGRADE_2_DEVICE // 11 +}; + + +#endif // _OD_CLASS_H_ + + diff --git a/src/libparsec/include/od_geomv.h b/src/libparsec/include/od_geomv.h new file mode 100644 index 0000000..9ccac5e --- /dev/null +++ b/src/libparsec/include/od_geomv.h @@ -0,0 +1,218 @@ +/* + * PARSEC HEADER (OBJECT) + * Types and Conversions for Geometry and Rasterization V1.22 + * + * Copyright (c) Markus Hadwiger 1997-1999 + * All Rights Reserved. + */ + +#ifndef _OD_GEOMV_H_ +#define _OD_GEOMV_H_ + + +//NOTE: +// basically, there are two important abstract types: +// *) GEOMV_T: for geometric calculations (view-space) +// *) RASTV_T: for rasterization calculations (screen-space) +// rastv_t should be identical to the primitive data type +// used by the underlying rasterization API. +// otherwise, time-consuming conversions will take place +// rather often. + + +// fixed and floating point types +typedef int32_t fixed_t; +typedef float psc_float_t; +typedef double hprec_t; + + +// type for binary angle measurement +typedef int32_t bams_t; + + +// fixed-point <-> floating-point conversions +#define FIXED_TO_FLOAT(x) ( (psc_float_t)( (fixed_t)(x) / 65536.0 ) ) +#define FLOAT_TO_FIXED(x) ( (fixed_t)( (hprec_t)(x) * 65536.0 ) ) + + +// define internal conversion macros +#define FIXED2FLOAT(x) ( (psc_float_t)( (fixed_t)(x) / 65536.0 ) ) +#define FLOAT2FIXED(x) ( (fixed_t)( (psc_float_t)(x) * 65536.0 ) ) +#define FIXED2INT(x) ( ( (fixed_t)(x) + 0x8000 ) >> 16 ) +#define INT2FIXED(x) ( (fixed_t)(x) << 16 ) +#define FLOAT2INT(x) ( (int)(psc_float_t)(x) ) +#define INT2FLOAT(x) ( (psc_float_t)(x) ) + + +// define coordinate conversion macros +#ifdef SCREENVERTEX_SUBPIXEL_ACCURACY + #define FLOAT2COORD(x) ( (psc_float_t)( (psc_float_t)(x) * D_Value ) ) + #define COORD2FLOAT(x) ((psc_float_t)(x)) // this doesn't account for D. +#else + #define FLOAT2COORD(x) ( (long)( (psc_float_t)(x) * D_Value ) ) + #define COORD2FLOAT(x) INT2FLOAT(x) // this doesn't account for D. +#endif + + +// pi and multiples +#define HPREC_PI ((hprec_t)3.14159265359) +#define HPREC_TWO_PI ((hprec_t)(2.0 * HPREC_PI)) +#define HPREC_HALF_PI ((hprec_t)(0.5 * HPREC_PI)) + +// some special angle values in bams +#define BAMS_DEG0 0x00000000 +#define BAMS_DEG45 0x00002000 +#define BAMS_DEG90 0x00004000 +#define BAMS_DEG180 0x00008000 +#define BAMS_DEG360 0x00010000 +#define BAMS_DEG720 0x00020000 + +// conversions between angle in degrees and angle in bams +#define DEG_TO_BAMS(x) ((bams_t)((65536.0/360.0) * (x))) +#define BAMS_TO_DEG(x) ((hprec_t)((360.0/65536.0) * (x))) + +// conversions between angle in radians and angle in bams +#define RAD_TO_BAMS(x) ((bams_t)((65536.0/HPREC_TWO_PI) * (x))) +#define BAMS_TO_RAD(x) ((hprec_t)((HPREC_TWO_PI/65536.0) * (x))) + +// conversions between angle in radians and angle in degrees +#define RAD_TO_DEG(x) ((hprec_t)((360.0/HPREC_TWO_PI) * (x))) +#define DEG_TO_RAD(x) ((hprec_t)((HPREC_TWO_PI/360.0) * (x))) + + +// access 32-bit quantity as dword +#define DW32(x) (*(dword*)&(x)) + + +// swap 32-bit quantity without intermediate temporary +#define SWAP_VALUES_32(a,b) { DW32(a)^=DW32(b); DW32(b)^=DW32(a); DW32(a)^=DW32(b); } + +// swap two geomv_t vars (works regardless of actual geomv_t) +#define SWAP_GEOMV(a,b) SWAP_VALUES_32((a),(b)) + + +// abs() macro for 32-bit quantity (only for lvalue!) +#define ABS32(x) { if ((x)<0) (x)=-(x); } + + +// abs() macros for fixed_t and float_t vars (only for lvalues!) +#define ABS_FIXED(x) ABS32(x) +#define ABS_FLOAT(x) { DW32(x)&=0x7fffffff; } + + +// comparison functions with zero for geomv_t that +// work for both fixed_t and float_t (only for lvalues!) + +// determine if geomv_t is zero +#define GEOMV_ZERO(x) (DW32(x) == 0) + +// determine if geomv_t is non-zero +#define GEOMV_NONZERO(x) (!GEOMV_ZERO(x)) + +// determine if geomv_t is negative +#define GEOMV_NEGATIVE(x) ( (DW32(x) & 0x80000000) != 0 ) +#define GEOMV_LTZERO(x) GEOMV_NEGATIVE(x) + +// determine if geomv_t is less than or equal zero +#define GEOMV_LEZERO(x) (GEOMV_ZERO(x) || GEOMV_NEGATIVE(x)) + +// determine if geomv_t is positive (in this context: non-negative) +#define GEOMV_POSITIVE(x) (!GEOMV_NEGATIVE(x)) +#define GEOMV_GEZERO(x) GEOMV_POSITIVE(x) + +// determine if geomv_t is greater than zero +#define GEOMV_GTZERO(x) (GEOMV_NONZERO(x) && GEOMV_POSITIVE(x)) + + + +// --------------------------------------------------------- +// define conversion macros depending on +// actual geomv_t and rastv_t types +// --------------------------------------------------------- + +// abs() macro for geomv_t +#define ABS_GEOMV(x) ABS_FLOAT(x) + + +// types for geometric values and rasterization values +typedef psc_float_t geomv_t; +typedef psc_float_t rastv_t; + + +// special values for geometric value type +#define GEOMV_0 ((geomv_t)0.0) +#define GEOMV_0_5 ((geomv_t)0.5) +#define GEOMV_1 ((geomv_t)1.0) +#define GEOMV_VANISHING ((geomv_t)1e-7) + + +// special values for rasterization value type +#define RASTV_0 ((rastv_t)0.0) +#define RASTV_1 ((rastv_t)1.0) +#define RASTV_VANISHING ((rastv_t)1e-7) + + +// geometric value conversion macros +#define GEOMV_TO_FIXED(x) FLOAT2FIXED (x) +#define FIXED_TO_GEOMV(x) FIXED2FLOAT (x) +#define GEOMV_TO_FLOAT(x) ((psc_float_t) (x)) +#define FLOAT_TO_GEOMV(x) ((geomv_t) (x)) +#define GEOMV_TO_COORD(x) FLOAT2COORD (x) +#define COORD_TO_GEOMV(x) COORD2FLOAT (x) +#define GEOMV_TO_INT(x) FLOAT2INT (x) +#define INT_TO_GEOMV(x) INT2FLOAT (x) +#define GEOMV_TO_RASTV(x) ((rastv_t) (x)) + + +// rasterization value conversion macros +#define RASTV_TO_FIXED(x) FLOAT2FIXED (x) +#define FIXED_TO_RASTV(x) FIXED2FLOAT (x) +#define RASTV_TO_FLOAT(x) ((psc_float_t) (x)) +#define FLOAT_TO_RASTV(x) ((rastv_t) (x)) +#define RASTV_TO_COORD(x) FLOAT2COORD (x) +#define COORD_TO_RASTV(x) COORD2FLOAT (x) +#define RASTV_TO_INT(x) FLOAT2INT (x) +#define INT_TO_RASTV(x) INT2FLOAT (x) +#define RASTV_TO_GEOMV(x) ((geomv_t) (x)) + + + +// ------------------------------------------------------ +// select type for depth values (integer or fractional) +// ------------------------------------------------------ + +#ifdef FRACTIONAL_DEPTH_VALUES + +typedef geomv_t depth_t; +#define DEPTH_TO_INTEGER(x) ((int32_t)GEOMV_TO_FIXED(x)) +#define DEPTH_TO_GEOMV(x) ((depth_t)(x)) +#define DEPTH_TO_RASTV(x) GEOMV_TO_RASTV(x) +#define DEPTH_TO_FLOAT(x) GEOMV_TO_FLOAT(x) +#define FIXED_TO_DEPTH(x) FIXED_TO_GEOMV(x) +#define FLOAT_TO_DEPTH(x) FLOAT_TO_GEOMV(x) + +#else + +typedef int32_t depth_t; +#define DEPTH_TO_INTEGER(x) ((depth_t)(x)) +#define DEPTH_TO_GEOMV(x) INT_TO_GEOMV(x) +#define DEPTH_TO_RASTV(x) INT_TO_RASTV(x) +#define DEPTH_TO_FLOAT(x) INT2FLOAT(x) +#define FIXED_TO_DEPTH(x) ((depth_t)(x)) +#define FLOAT_TO_DEPTH(x) FLOAT2FIXED(x) + +#endif + +//NOTE: +// there are TWO major differences between fractional and integer +// depth values: +// 1. trivially, integer depth values contain no fractional +// part whereas fractional depth values do. (regardless of +// whether they are of type float_t or fixed_t.) +// 2. the range of integer depth values is from 0 to 65535, +// whereas the range of fractional depth values is from 0.0 to 1.0. + + +#endif // _OD_GEOMV_H_ + + diff --git a/src/libparsec/include/od_masks.h b/src/libparsec/include/od_masks.h new file mode 100644 index 0000000..103342b --- /dev/null +++ b/src/libparsec/include/od_masks.h @@ -0,0 +1,64 @@ +/* + * PARSEC HEADER (OBJECT) + * Ship Weapons/Specials Masks V1.28 + * + * Copyright (c) Markus Hadwiger 1996-2000 + * All Rights Reserved. + */ + +#ifndef _OD_MASKS_H_ +#define _OD_MASKS_H_ + + +// masks for ShipObject::Weapons + +#define WPMASK_CANNON_LASER 0x00000001 +#define WPMASK_CANNON_HELIX 0x00000002 +#define WPMASK_CANNON_LIGHTNING 0x00000004 +#define WPMASK_CANNON_PHOTON 0x00000008 +#define WPMASK_LASER_BEAM 0x00000010 +#define WPMASK_LASER_AUX_6 0x00000020 +#define WPMASK_LASER_AUX_7 0x00000040 +#define WPMASK_LASER_AUX_8 0x00000080 +#define WPMASK_DEVICE_EMP 0x00000100 +#define WPMASK_DEVICE_AUX_2 0x00000200 +#define WPMASK_DEVICE_AUX_3 0x00000400 +#define WPMASK_DEVICE_AUX_4 0x00000800 +#define WPMASK_DEVICE_AUX_5 0x00001000 +#define WPMASK_DEVICE_AUX_6 0x00002000 +#define WPMASK_DEVICE_AUX_7 0x00004000 +#define WPMASK_DEVICE_AUX_8 0x00008000 +#define WPMASK_WEAPON_AUX_1 0x00010000 +#define WPMASK_WEAPON_AUX_2 0x00020000 +#define WPMASK_WEAPON_AUX_3 0x00040000 +#define WPMASK_WEAPON_AUX_4 0x00080000 +#define WPMASK_WEAPON_AUX_5 0x00100000 +#define WPMASK_WEAPON_AUX_6 0x00200000 +#define WPMASK_WEAPON_AUX_7 0x00400000 +#define WPMASK_WEAPON_AUX_8 0x00800000 + + +// mask aliases + +#define WPMASK_ALIAS_SPREADFIRE WPMASK_CANNON_HELIX + + +// masks for ShipObject::Specials + +#define SPMASK_INVISIBILITY 0x00000001 +#define SPMASK_INVULNERABILITY 0x00000002 +#define SPMASK_AUTOTARGETING 0x00000004 +#define SPMASK_AFTERBURNER 0x00000008 +#define SPMASK_LASER_UPGRADE_1 0x00001000 +#define SPMASK_LASER_UPGRADE_2 0x00002000 +#define SPMASK_DECOY 0x00004000 +#define SPMASK_FLARE_UPGRADE 0x00008000 +#define SPMASK_EMP_UPGRADE_1 0x00010000 +#define SPMASK_EMP_UPGRADE_2 0x00020000 +#define SPMASK_CAPABILITY_AUX_7 0x00040000 +#define SPMASK_CAPABILITY_AUX_8 0x00080000 + + +#endif // _OD_MASKS_H_ + + diff --git a/src/libparsec/include/od_odt.h b/src/libparsec/include/od_odt.h new file mode 100644 index 0000000..e8e5cf1 --- /dev/null +++ b/src/libparsec/include/od_odt.h @@ -0,0 +1,359 @@ +/* + * PARSEC HEADER (OBJECT) + * ODT/ODT2 Object File Format V1.70 + * + * Copyright (c) Markus Hadwiger 1995-1999 + * All Rights Reserved. + */ + +#ifndef _OD_ODT_H_ +#define _OD_ODT_H_ + + + +//----------------------------------------------------------------------------- +// ODT1 FORMAT (ODT) - +//----------------------------------------------------------------------------- + + +// generic transformation matrix +typedef fixed_t ODT_Xmatrx[ 3 ][ 4 ]; // [0 0 0 1] (line 4) omitted! + + +// 3-D vertex coordinates +struct ODT_Vertex3 { + + fixed_t X; + fixed_t Y; + fixed_t Z; + dword Flags; // padding to 16 bytes and flags +}; + + +// 2-D point in unsigned integer coordinates (always >= 0) +struct ODT_UPoint { + + dword X; // unsigned! + dword Y; // unsigned! +}; + + +// 2-D coordinates after projection; not yet converted to screen coordinates +struct ODT_ProjPoint { + + fixed_t X; + fixed_t Y; // 8 bytes +}; + + +// 2-D point in screen coordinates (used in vertex list for the edge tracer) +struct ODT_SPoint { + + long X; // signed! + long Y; // signed! +}; + + +// types for shading of faces +enum ODT_shadingtype_t { + + ODT_no_shad, // lighting independent ambient color (no shading!) + ODT_flat_shad, // flat shading + ODT_gouraud_shad, // gouraud shading + ODT_afftex_shad, // affine texture mapping + ODT_ipol1tex_shad, // first order interpolated texture mapping (lin) + ODT_ipol2tex_shad, // second order interpolated texture mapping (quad) + ODT_persptex_shad, // perspective correct texmapping w/o interpolation + ODT_material_shad, // shade using material specification + ODT_texmat_shad // composite texture and material specification +}; + + +// defines a single object-face (size is 128 bytes) +struct ODT_Face { + + char* TexMap; // pointer to texture name + ODT_UPoint* TexEqui; // (u,v) correspondences (texture placement) + dword ColorRGB; // RGB color for direct color display + dword ColorIndx; // colorindex for palette mapped display + dword FaceNormalIndx; // index of vertex which is the surface normal + ODT_Xmatrx TexXmatrx; // matrix for texture placement + dword _mtxscratch1; // scratchpad for matrix code + ODT_Xmatrx CurTexXmatrx; // current transformation screen -> texture + dword Shading; // shading type to apply to this face + dword _padto_128; +}; + + +// defines a single object-polygon (size is 16 bytes) +struct ODT_Poly { + + dword NumVerts; // number of vertices (no surface normal!) + dword FaceIndx; // index of face this polygon belongs to + dword* VertIndxs; // list of vertexindexes comprising the polygon + dword _padto_16; +}; + + +// list of indexes of currently visible polygons ( DetermineObjVisibility() ) +struct ODT_VisPolys { + + dword NumVisPolys; // number of polygon indexes in list + dword PolyIndxs[ 1 ]; // first element of polygon index list (array) +}; + + +// node structure for bsp tree nodes (size is 16 bytes) +struct ODT_BSPNode { + + dword Polygon; // index of polygon contained in this node + dword Contained; // index of first node in the same plane (list) + dword FrontTree; // index of root-node of front-subtree + dword BackTree; // index of root-node of back-subtree +}; + + +// structure of graphical object contained in ODT file ------------------------ +// +struct ODT_GenObject { + + ODT_GenObject* NextObj; // pointers to next and previous obj in + ODT_GenObject* PrevObj; // doubly linked objectinstance list + ODT_GenObject* NextVisObj; // pointer to next obj in visible list + dword ObjectNumber; // unique number of this objectinstance + dword HostObjNumber; // number this object has on its host + dword ObjectType; // type this object belongs to + dword ObjectClass; // class this object belongs to + dword InstanceSize; // size of instance of this object class + dword NumVerts; // number of vertices w/ normals + dword NumPolyVerts; // number of vertices w/o normals + dword NumNormals; // number of face normals + ODT_Vertex3* VertexList; // list of all vertices in object space + ODT_Vertex3* X_VertexList; // vertices transformed into view space + ODT_ProjPoint* P_VertexList; // vtxs projected onto view plane + ODT_SPoint* S_VertexList; // vtxs converted to screen coordinates + dword NumPolys; // number of polygons in this object + ODT_Poly* PolyList; // list of polygons in this object + dword NumFaces; // number of faces in this object + ODT_Face* FaceList; // list of all faces + ODT_VisPolys* VisPolyList; // indexes of currently visible polys + fixed_t FarthestZ; // currently farthest z of all vertices + fixed_t NearestZ; // currently nearest z of all vertices + fixed_t BoundingSphere; // radius of bounding sphere + fixed_t BoundingSphere2; // radius squared of bounding sphere + ODT_Vertex3 BoundingBox[8]; // vertices of bounding box in objectspace ??? + ODT_BSPNode* BSPTree; // pointer to root of bsp tree + ODT_Vertex3 LocalCameraLoc; // location of camera in object space + ODT_Vertex3 PyrNormals[4]; // normals of view pyramid in obj space + dword _mtxscratch1; // scratchpad for matrix code + ODT_Xmatrx ObjPosition; // location and orientation in worldsp. + dword _mtxscratch2; // scratchpad for matrix code + ODT_Xmatrx CurrentXmatrx; // current objspace -> viewspace xform + +}; + + + +//----------------------------------------------------------------------------- +// ODT2 FORMAT (OD2) - +//----------------------------------------------------------------------------- + + +// generic transformation matrix +typedef float OD2_Xmatrx[ 3 ][ 4 ]; // [0 0 0 1] (line 4) omitted! + + +// 3-D vertex coordinates +struct OD2_Vertex3 { + + float X; + float Y; + float Z; + dword Flags; // padding to 16 bytes and flags +}; + + +// types for shading of faces +enum OD2_shadingtype_t { + + OD2_shad_ambient = 0x1000, // fixed color (lighting independent ambient color) + OD2_shad_flat = 0x1001, // flat shading + OD2_shad_gouraud = 0x1002, // gouraud shading + OD2_shad_afftex = 0x2003, // affine texture mapping + OD2_shad_ipol1tex = 0x2004, // first order interpolated texture mapping (lin) + OD2_shad_ipol2tex = 0x2005, // second order interpolated texture mapping (quad) + OD2_shad_persptex = 0x2006, // perspective correct mapping without any interpolation + OD2_shad_material = 0x1007, // use material specification + OD2_shad_texmat = 0x3008, // textures modulated by material specification + + OD2_num_shadingtypes = 9, // MUST SET THIS MANUALLY!! + + OD2_shadmask_base = 0x00ff, // mask for basic shading type + OD2_shadmask_color = 0x1000, // mask to denote faces with attached color + OD2_shadmask_texmap = 0x2000 // mask to denote texture mapped faces +}; + + +// types for color specification +enum OD2_colormodel_t { + + OD2_col_none, // shading type has no associated color + OD2_col_indexed, // indexed color (color look up table index) + OD2_col_rgb, // color specified via separate R,G,B channels + OD2_col_rgba, // color specified via separate R,G,B,A channels + OD2_col_material, // use material specification + + OD2_num_colormodels +}; + + +// defines a single object-face +struct OD2_Face { + + char* TexMap; // pointer to texture name + dword ColorRGB; // RGB color for direct color display + dword ColorIndx; // colorindex for palette mapped display + dword FaceNormalIndx; // index of vertex which is the surface normal + OD2_Xmatrx TexXmatrx; // matrix for texture placement + dword Shading; // shading type to apply to this face + dword ColorModel; // type of color specification +}; + + +// defines a single object-polygon +struct OD2_Poly { + + dword NumVerts; // number of vertices (no surface normal!) + dword FaceIndx; // index of face this polygon belongs to + dword* VertIndxs; // list of vertexindexes comprising the polygon +}; + + +// 3-D plane +struct OD2_Plane { + + float X; // normal[0] + float Y; // normal[1] + float Z; // normal[2] + float D; // distance along normal +}; + + +// axial bounding box +struct OD2_CullBox { + + float mins[ 3 ]; // bounding box min-point + float maxs[ 3 ]; // bounding box max-point +}; + + +// node structure for bsp tree nodes +struct OD2_BSPNode { + + dword flags; // node/leaf/separator + + short frontpoly; // index of first front polygon + short numfront; // number of front polygons + + short backpoly; // index of first back polygon + short numback; // number of back polygons + + short fronttree; // front-subtree + short backtree; // back-subtree + + OD2_Plane plane; // separator plane + OD2_CullBox box; // tree bounding box +}; + + +// object node (part of node list attached to root or child in tree) ---------- +// +struct OD2_Node { + + dword NodeType; // node type + OD2_Node* NextNode; // next node in list + + dword flags; + dword flags2; + + dword InstanceSize; // size of instance of this object class +}; + + +// object node containing bsp tree -------------------------------------------- +// +struct OD2_Node_BSP : OD2_Node { + + dword NumVerts; // number of vertices w/ normals + dword NumPolyVerts; // number of vertices w/o normals + dword NumNormals; // number of face normals + OD2_Vertex3* VertexList; // list of all vertices in object space + + dword NumPolys; // number of polygons in this object + OD2_Poly* PolyList; // list of polygons in this object + + dword NumFaces; // number of faces in this object + OD2_Face* FaceList; // list of all faces + + OD2_BSPNode* BSPTree; // pointer to root of bsp tree + + OD2_Vertex3 BoundingCenter; // center of bounding sphere + float BoundingSphere; // radius of bounding sphere + OD2_CullBox BoundingBox; // axial bounding box +}; + + +// child (non-root) node in ODT2 object graph --------------------------------- +// +struct OD2_Child { + + dword childflags; + dword childflags2; + + OD2_Node* NodeList; // first node in attached list + OD2_Child* Children[ 2 ]; // child nodes in object graph + + ODT_Xmatrx NodeTrafo; // object-space transformation (relative) +}; + + +// ODT2 object's root node (includes file header) ----------------------------- +// +struct OD2_Root { + + char odt2[ 6 ]; // signature ("ODT2") + byte major; // major revision + byte minor; // minor revision + + dword rootflags; + dword rootflags2; + + OD2_Node* NodeList; // first node in attached list + OD2_Child* Children[ 2 ]; // child nodes in object graph + + dword ObjectType; // type this object belongs to + dword ObjectClass; // class this object belongs to + dword InstanceSize; // size of instance of this object class + + dword NumVerts; // number of vertices w/ normals + dword NumPolyVerts; // number of vertices w/o normals + dword NumNormals; // number of face normals + OD2_Vertex3* VertexList; // list of all vertices in object space + + dword NumPolys; // number of polygons in this object + OD2_Poly* PolyList; // list of polygons in this object + + dword NumFaces; // number of faces in this object + OD2_Face* FaceList; // list of all faces + + dword NumTextures; // number of textures + + OD2_Vertex3 BoundingCenter; // center of bounding sphere + float BoundingSphere; // radius of bounding sphere + OD2_CullBox BoundingBox; // axial bounding box +}; + + +#endif // _OD_ODT_H_ + + diff --git a/src/libparsec/include/od_prim.h b/src/libparsec/include/od_prim.h new file mode 100644 index 0000000..3bfbb98 --- /dev/null +++ b/src/libparsec/include/od_prim.h @@ -0,0 +1,676 @@ +/* + * PARSEC HEADER (OBJECT) + * Primitive Types V1.80 + * + * Copyright (c) Markus Hadwiger 1995-2001 + * All Rights Reserved. + */ + +#ifndef _OD_PRIM_H_ +#define _OD_PRIM_H_ + + +// homogeneous floating-point coordinates of point in 2-space ----------------- +// +struct Point2h_f { + + float X; + float Y; + float W; +}; + + +// homogeneous fixed-point coordinates of point in 2-space -------------------- +// +struct Point2h_x { + + fixed_t X; + fixed_t Y; + fixed_t W; +}; + + +// homogeneous floating-point coordinates of point in 3-space ----------------- +// +struct Point3h_f { + + float X; + float Y; + float Z; + float W; +}; + + +// homogeneous fixed-point coordinates of point in 3-space -------------------- +// +struct Point3h_x { + + fixed_t X; + fixed_t Y; + fixed_t Z; + fixed_t W; +}; + + +// general quaternion --------------------------------------------------------- +// +struct Quaternion { + + geomv_t W; // q = w + xi + yj + zk + geomv_t X; // q = ( w, (x,y,z) ) + geomv_t Y; // q = ( cos(theta/2), sin(theta/2)*(x,y,z) ) + geomv_t Z; +}; + + +// general quaternion with floating-point components -------------------------- +// +struct Quaternion_f { + + float W; // q = w + xi + yj + zk + float X; // q = ( w, (x,y,z) ) + float Y; // q = ( cos(theta/2), sin(theta/2)*(x,y,z) ) + float Z; +}; + + +// 2-D texture coordinates ---------------------------------------------------- +// +struct TexCoord2 { + + geomv_t U; + geomv_t V; +}; + + +// 3-D vertex coordinates (used by object structures) ------------------------- +// +struct Vertex3 { + + geomv_t X; + geomv_t Y; + geomv_t Z; + dword VisibleFrame; // ==CurVisibleFrame if vertex touched this frame +}; + + +// 3-D vector ----------------------------------------------------------------- +// +typedef Vertex3 Vector3; + + +// 2-D rectangle -------------------------------------------------------------- +// +struct Rectangle2 { + + rastv_t left; + rastv_t right; + rastv_t top; + rastv_t bottom; +}; + + +// 3-D plane ------------------------------------------------------------------ +// +struct Plane3 { + + geomv_t X; // normal[0] + geomv_t Y; // normal[1] + geomv_t Z; // normal[2] + geomv_t D; // distance along normal +}; +#if 0 +#define PLANE_NORMAL(p) ((p)->D, (Vector3*)(p)) // crude type check which will give an error if it fails and a warning otherwise.. +#else +#define PLANE_NORMAL(p) ((Vector3*)(p)) +#endif +#define PLANE_OFFSET(p) ((p)->D) +#define PLANE_AXIAL(p) (DW32((p)->X)==0xf800ff00) // signaling NaN +#define PLANE_CMPAXIS(p) (DW32((p)->Y)&0x03) // select coordinate +#define PLANE_AXISCOMP(p) ((p)->Z) // single component +#define PLANE_MAKEAXIAL(p,c,i) {DW32((p)->X)=0xf800ff00; DW32((p)->Y)=(i)&0x03; (p)->Z=(c);} + + +// 3-D sphere ----------------------------------------------------------------- +// +struct Sphere3 { + + geomv_t X; // origin[0] + geomv_t Y; // origin[1] + geomv_t Z; // origin[2] + geomv_t R; // radius or radius squared, depending on application +}; + + +// 2-D bounding rectangle ----------------------------------------------------- +// +struct CullBox2 { + + geomv_t minmax[ 4 ]; // [0 1]=[minx miny] [3 4]=[maxx maxy] +}; + + +// 3-D bounding box ----------------------------------------------------------- +// +struct CullBox3 { + + geomv_t minmax[ 6 ]; // [0 1 2]=[minx miny minz] [3 4 5]=[maxx maxy maxz] +}; + + +// 3-D test points for trivial reject and accept of a bounding box ------------ +// +struct ReAcPointBox3 { + + Vector3 reject; // in negative halfspace -> trivial reject + Vector3 accept; // in positive halfspace -> trivial accept +}; + + +// same as ReAcPointsBox3 but with coordinate indexes for a CullBox3 ---------- +// +struct ReAcIndexBox3 { + + int reject[ 3 ]; // reject coordinate indexes + int accept[ 3 ]; // accept coordinate indexes +}; + + +// 3-D cull plane (plane together with corresponding reject/accept indexes) --- +// +struct CullPlane3 { + + Plane3 plane; // the indexes of reject/accept points are an + ReAcIndexBox3 reacx; // invariant property of each plane! +}; + + +// bsp node including culling info -------------------------------------------- +// +struct CullBSPNode { + + short polygons[ 2 ]; // index of first front/back polygon + short numpolys[ 2 ]; // number of front/back polygons + + Plane3 plane; // separator plane + geomv_t minmax[ 6 ]; // tree bounding box + + dword flags; // node/leaf/separator + dword visframe; // visibility status (frame in which last visible) + dword subtrees[ 2 ]; // front- and back-subtree +}; + +#define NODE_FRONTPOLYGON(n) ((n)->polygons[1]) +#define NODE_BACKPOLYGON(n) ((n)->polygons[0]) +#define NODE_FRONTNUM(n) ((n)->numpolys[1]) +#define NODE_BACKNUM(n) ((n)->numpolys[0]) +#define NODE_FRONTSUBTREE(n) ((n)->subtrees[1]) +#define NODE_BACKSUBTREE(n) ((n)->subtrees[0]) +#define NODE_LEAF(n) ((n)->flags & 0x01) +#define NODE_SEPARATOR(n) ((n)->flags & 0x02) + + +// flags for iter vertices ---------------------------------------------------- +// +enum { + + ITERVTXFLAG_NONE = 0x00000000, // default + + ITERVTXFLAG_LAYERS_BASE = 0x00000000, + ITERVTXFLAG_LAYERS_1 = 0x00000002, // ITERVTXFLAG_LAYERS_xx specifies + ITERVTXFLAG_LAYERS_2 = 0x00000003, // the number of layers (stored in + ITERVTXFLAG_LAYERS_3 = 0x00000004, // IterLayer) apart from the base + ITERVTXFLAG_LAYERS_4 = 0x00000005, // layer (IterVertex). e.g., 2 + ITERVTXFLAG_LAYERS_5 = 0x00000006, // means there is one fully used + ITERVTXFLAG_LAYERS_6 = 0x00000007, // IterLayer, 1 that there is one + ITERVTXFLAG_LAYERS_7 = 0x00000008, // half used IterLayer + ITERVTXFLAG_LAYERS_8 = 0x00000009, // lowest bit is number of + ITERVTXFLAG_LAYERS_SLM = 0x00000001, // sublayers in last IterLayer - 1 + ITERVTXFLAG_LAYERS_MASK = 0x0000000f, + + ITERVTXFLAG_RESTART = 0x00000100 // restart strip (line/triangle) +}; + + +// 2-D vertex with iterative attributes --------------------------------------- +// +struct IterVertex2 { + + rastv_t X; // screenspace x + rastv_t Y; // screenspace y + rastv_t Z; // depth-buffer value + + geomv_t W; // homogeneous component + geomv_t U; // texture u + geomv_t V; // texture v + + byte R; // red component + byte G; // green component + byte B; // blue component + byte A; // alpha component + + dword flags; // ITERVTXFLAG_xx +}; + + +// 3-D vertex with iterative attributes --------------------------------------- +// +struct IterVertex3 { + + geomv_t X; // viewspace x + geomv_t Y; // viewspace y + geomv_t Z; // viewspace z + + geomv_t W; // homogeneous component + geomv_t U; // texture u + geomv_t V; // texture v + + byte R; // red component + byte G; // green component + byte B; // blue component + byte A; // alpha component + + dword flags; // ITERVTXFLAG_xx +}; + + +// 2-D vertex overlay with additional texture coordinates --------------------- +// +struct IterLayer2 { + + geomv_t U0; // texture u (layer 0) + geomv_t V0; // texture v (layer 0) + geomv_t W0; // homogeneous component + word mode0; // + word flags0; // + + geomv_t U1; // texture u (layer 1) + geomv_t V1; // texture v (layer 1) + geomv_t W1; // homogeneous component + word mode1; // + word flags1; // +}; + + +// 3-D vertex overlay with additional texture coordinates --------------------- +// +struct IterLayer3 { + + geomv_t U0; // texture u (layer 0) + geomv_t V0; // texture v (layer 0) + geomv_t W0; // homogeneous component + word mode0; // + word flags0; // + + geomv_t U1; // texture u (layer 1) + geomv_t V1; // texture v (layer 1) + geomv_t W1; // homogeneous component + word mode1; // + word flags1; // +}; + + +// type for specification of iteration/use of vertex attributes --------------- +// +enum itertype_t { + + iter_constrgb = 0x0000, // constant [rgb] attributes + iter_constrgba = 0x0001, // constant [rgba] attributes + iter_rgb = 0x0002, // iterated (rgb) attributes + iter_rgba = 0x0003, // iterated (rgba) attributes + iter_texonly = 0x0004, // apply texture without shading + iter_texconsta = 0x0005, // modulate texture with constant [a] + iter_texconstrgb = 0x0006, // modulate texture with constant [rgb] + iter_texconstrgba = 0x0007, // modulate texture with constant [rgba] + iter_texa = 0x0008, // modulate texture with iterated (a) + iter_texrgb = 0x0009, // modulate texture with iterated (rgb) + iter_texrgba = 0x000a, // modulate texture with iterated (rgba) + iter_constrgbtexa = 0x000b, // constant [rgb] with alpha-texture + iter_constrgbatexa = 0x000c, // constant [rgba] with alpha-texture + iter_rgbtexa = 0x000d, // iterated (rgb) with alpha-texture + iter_rgbatexa = 0x000e, // iterated (rgba) with alpha-texture + iter_texblendrgba = 0x000f, // blend texture with iterated (rgba) + iter_texspeca = 0x0010, // add (a) to texture (specular) + iter_texspecrgb = 0x0011, // add (rgb) to texture (specular) + iter_texconstaspecrgb = 0x0012, // add (rgb) to faded texture + iter_texconstrgbspeca = 0x0013, // add (a) to flat-shaded texture + iter_texaspecrgb = 0x0014, // add (rgb) to texture, modulate (a) + iter_texrgbspeca = 0x0015, // add (a) to texture, modulate (rgb) + iter_base_mask = 0x00ff, + + iter_overwrite = 0x0000, // overwrite destination + iter_alphablend = 0x0100, // alpha blend with destination + iter_modulate = 0x0200, // modulate destination (multiply) + iter_specularadd = 0x0300, // add to destination (emissive/specular) + iter_premulblend = 0x0400, // blend with premultiplied alpha + iter_additiveblend = 0x0500, // additively blend with destination + iter_compose_mask = 0xff00, + iter_compose_shift = 8 +}; + + +// type for specification of desired rasterizer state ------------------------- +// +enum raststate_t { + + rast_nozcompare = 0x0000, // no depth compare + rast_zcompare = 0x0001, // do depth compare + rast_mask_zcompare = 0x0001, // don't change depth compare + + rast_nozwrite = 0x0000, // no depth-buffer write + rast_zwrite = 0x0002, // do depth-buffer write + rast_mask_zwrite = 0x0002, // don't change depth-buffer write + + rast_nozbuffer = 0x0000, // no standard depth-buffering + rast_zbuffer = 0x0003, // do standard depth-buffering + rast_mask_zbuffer = 0x0003, // don't change depth-buffering + + rast_texwrap = 0x0000, // no texture coordinate clamping + rast_texclamp = 0x0004, // do texture coordinate clamping + rast_mask_texclamp = 0x0004, // don't change coordinate clamp/wrap mode + rast_mask_texwrap = 0x0004, // don't change coordinate clamp/wrap mode + + rast_chromakeyoff = 0x0000, // no chroma key compare + rast_chromakeyon = 0x0008, // do chroma key compare + rast_mask_chromakey = 0x0008, // don't change chroma keying + + rast_mask_mipmap = 0x0010, // don't change mip-mapping + rast_mask_texfilter = 0x0020, // don't change texture filtering + + rast_default = 0x0000, // nozbuffer/texwrap/chromakeyoff + rast_nomask = 0x0000, // don't mask anything + rast_maskall = 0xffff // mask everything +}; + + +// type for specification of texture combine function ------------------------- +// +enum texcombstate_t { + + texcomb_decal = 0x0000, // decal mapping (single texture) + texcomb_trifilter = 0x0001, // trilinearly filtered mip mapping + texcomb_modulate = 0x0002, // modulate texture with another texture + texcomb_specularadd = 0x0003, // add texture to another texture + texcomb_detail = 0x0004 // blend textures of two detail levels +}; + + +// flags for iter primitives -------------------------------------------------- +// +enum { + + ITERFLAG_NONE = 0x0000, // don't touch anything (draw as is) + ITERFLAG_BACKFACES = 0x0001, // draw backfaces instead of frontfaces + ITERFLAG_ONESIDED = 0x0002, // single-sided primitive + ITERFLAG_PLANESTRIP = 0x0004, // only one plane for entire strip + ITERFLAG_VERTEXREFS = 0x0008, // vertex pointers, no embedded vertices + + ITERFLAG_Z_DIV_XYZ = 0x0010, // divide xyz by z before rasterizing + ITERFLAG_Z_DIV_UVW = 0x0020, // divide uvw by z before rasterizing + ITERFLAG_Z_TO_DEPTH = 0x0040, // create depth buffer z (lerp-depth) + ITERFLAG_W_NOT_ONE = 0x0080, // w is not one (projective mapping) + + ITERFLAG_NONDESTRUCTIVE = 0x0100, // don't alter original vertex data + + ITERFLAG_PS_DEFAULT = 0x0000, // point style: default + ITERFLAG_PS_ANTIALIASED = 0x1000, // point style: antialiased + + ITERFLAG_LS_DEFAULT = 0x0000, // line style: default + ITERFLAG_LS_ANTIALIASED = 0x1000, // line style: antialiased + ITERFLAG_LS_THICK = 0x2000, // line style: thick + ITERFLAG_LS_STIPPLED = 0x4000, // line style: stippled + ITERFLAG_LS_CLOSE_STRIP = 0x8000 // line style: line-loop +}; + + +// forward declarations +struct TextureMap; +struct texfont_s; + + +// 2-D point (point-set) with iterative vertex attributes --------------------- +// +struct IterPoint2 { + + word flags; + short NumVerts; // number of points + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + float pointsize; // size in pixels + IterVertex2 Vtxs[ 1 ]; // alloc( (size_t)&((IterPoint2*)0)->Vtxs[ n ] ) +}; + + +// 3-D point (point-set) with iterative vertex attributes --------------------- +// +struct IterPoint3 { + + word flags; + short NumVerts; // number of points + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + float pointsize; // size in pixels + IterVertex3 Vtxs[ 1 ]; // alloc( (size_t)&((IterPoint3*)0)->Vtxs[ n ] ) +}; + + +// 2-D line (line-strip) with iterative vertex attributes --------------------- +// +struct IterLine2 { + + word flags; + short NumVerts; // number of lines + 1 + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex2 Vtxs[ 2 ]; // alloc( (size_t)&((IterLine2*)0)->Vtxs[ n ] ) +}; + + +// 3-D line (line-strip) with iterative vertex attributes --------------------- +// +struct IterLine3 { + + word flags; + short NumVerts; // number of lines + 1 + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex3 Vtxs[ 2 ]; // alloc( (size_t)&((IterLine3*)0)->Vtxs[ n ] ) +}; + + +// 2-D triangle with iterative vertex attributes ------------------------------ +// +struct IterTriangle2 { + + word flags; + short NumVerts; // need not be valid (implicitly 3) + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex2 Vtxs[ 3 ]; +}; + + +// 3-D triangle with iterative vertex attributes ------------------------------ +// +struct IterTriangle3 { + + word flags; + short NumVerts; // need not be valid (implicitly 3) + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex3 Vtxs[ 3 ]; +}; + + +// 2-D rectangle with iterative vertex attributes ----------------------------- +// +struct IterRectangle2 { + + word flags; + short NumVerts; // need not be valid (implicitly 4) + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex2 Vtxs[ 4 ]; +}; + + +// 3-D rectangle with iterative vertex attributes ----------------------------- +// +struct IterRectangle3 { + + word flags; + short NumVerts; // need not be valid (implicitly 4) + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex3 Vtxs[ 4 ]; +}; + + +// 2-D polygon (n-gon) with iterative vertex attributes ----------------------- +// +struct IterPolygon2 { + + word flags; + short NumVerts; + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex2 Vtxs[ 1 ]; // alloc( (size_t)&((IterPolygon2*)0)->Vtxs[ n ] ) +}; + + +// 3-D polygon (n-gon) with iterative vertex attributes ----------------------- +// +struct IterPolygon3 { + + word flags; + short NumVerts; + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex3 Vtxs[ 1 ]; // alloc( (size_t)&((IterPolygon3*)0)->Vtxs[ n ] ) +}; + + +// 2-D triangle strip with iterative vertex attributes ------------------------ +// +struct IterTriStrip2 { + + word flags; + short NumVerts; // number of triangles + 2 + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // array; need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex2 Vtxs[ 1 ]; // alloc( (size_t)&((IterTriStrip2*)0)->Vtxs[ n ] ) +}; + + +// 3-D triangle strip with iterative vertex attributes ------------------------ +// +struct IterTriStrip3 { + + word flags; + short NumVerts; // number of triangles + 2 + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + Plane3* plane; // array; need only be valid if ITERFLAG_ONESIDED + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex3 Vtxs[ 1 ]; // alloc( (size_t)&((IterTriStrip3*)0)->Vtxs[ n ] ) +}; + + +// flags for contents of iterated arrays -------------------------------------- +// +enum { + + ITERARRAY_USE_COLOR = 0x0001, + ITERARRAY_USE_TEXTURE = 0x0002, + ITERARRAY_GLOBAL_TEXTURE = 0x0100 +}; + + +// primitive types for iterated array drawing --------------------------------- +// +enum { + + ITERARRAY_MODE_TRIANGLES = 0x0000, + ITERARRAY_MODE_TRISTRIP = 0x0001, + ITERARRAY_MODE_TRIFAN = 0x0002, + ITERARRAY_MODE_QUADS = 0x0003, + ITERARRAY_MODE_QUADSTRIP = 0x0004, + + ITERARRAY_MODE_NUM_MODES // last! +}; + + +// 2-D vertex array with iterative vertex attributes -------------------------- +// +struct IterArray2 { + + word flags; + short NumVerts; // array size + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + dword arrayinfo; // flags for array content (ITERARRAY_xx) + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex2 Vtxs[ 1 ]; // alloc( (size_t)&((IterArray2*)0)->Vtxs[ n ] ) +}; + + +// 3-D vertex array with iterative vertex attributes -------------------------- +// +struct IterArray3 { + + word flags; + short NumVerts; // array size + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + dword arrayinfo; // flags for array content (ITERARRAY_xx) + TextureMap* texmap; // need only be valid if itertype >= iter_texonly + IterVertex3 Vtxs[ 1 ]; // alloc( (size_t)&((IterArray3*)0)->Vtxs[ n ] ) +}; + + +// descriptor for rendering with a texfont ------------------------------------ +// +struct IterTexfont { + + dword flags; + dword itertype; // itertype_t + word raststate; // raststate_t (state) + word rastmask; // raststate_t (mask) + texfont_s* texfont; // texfont (contains no rendering or color info) + IterVertex2 Vtxs[ 4 ]; // output location, color, and scale factors +}; + + +#endif // _OD_PRIM_H_ + + diff --git a/src/libparsec/include/od_props.h b/src/libparsec/include/od_props.h new file mode 100644 index 0000000..c5548e4 --- /dev/null +++ b/src/libparsec/include/od_props.h @@ -0,0 +1,248 @@ +/* + * PARSEC HEADER (OBJECT) + * Default Object Properties V1.35 + * + * Copyright (c) Markus Hadwiger 1996-2000 + * All Rights Reserved. + */ + +#ifndef _OD_PROPS_H_ +#define _OD_PROPS_H_ + + +// game control data ------------------------------------------------ +// +#define ENERGY_EXTRA_BOOST 50 +#define DUMB_PACK_NUMMISSLS 5 +#define HOM_PACK_NUMMISSLS 8 +#define PROX_PACK_NUMMINES 3 +#define SWARM_PACK_NUMMISSLS 2 + +#define MAX_EXTRA_AREA 700 +#define MIN_EXTRA_DIST 150 +#define EXTRA_PROBABILITY 4 + +#define PROB_DAZZLE_LASER 4 // remainder to 100% is prob of energy extras! +#define PROB_THIEF_LASER 4 +#define PROB_PROXIMITY_MINE 6 +#define PROB_MISSILE_PACK 22 + +#define PROB_DUMB_MISS_PACK 45 +#define PROB_HOM_MISS_PACK 55 + +#define MEGASHIELD_STRENGTH 20 + +#define LASER2_INTENSITY 20 + +#define FLASHTIME_LASER_STANDARD 2 +#define FLASHTIME_LASER_THIEF 8 +#define FLASHTIME_MISSILE 4 + + +// ship steering speeds and delays ---------------------------------- +// +#define SHIP_SPEED_INC_PER_REFFRAME ( 0x01200 / 8 /23) +#define SHIP_SPEED_DEC_PER_REFFRAME ( 0x01200 / 8 /23) +#define SHIP_YAW_PER_REFFRAME ( 0x068 / 8 ) +#define SHIP_PITCH_PER_REFFRAME ( 0x068 / 8 ) +#define SHIP_ROLL_PER_REFFRAME ( 0x05A / 3 ) +#define SHIP_SLIDE_PER_REFFRAME FIXED_TO_GEOMV( 0xb000 / 8 ) +#define SHIP_FIRE_REPEAT_DELAY ( 24 * 8 ) +#define SHIP_FIRE_DISABLE_DELAY ( 12 * 8 ) +#define SHIP_MISSILE_DISABLE_DELAY ( 36 * 8 ) + + +// object member variables init values ------------------------------ +// +#define PROP_FUME_FREQUENCY 220 +#define PROP_FUME_LIFETIME 11000 +#define PROP_FUME_SPEED -0x0080 + +#define PROP_FUME_START_X1 FIXED_TO_GEOMV( -0x35000 ) +#define PROP_FUME_START_X2 FIXED_TO_GEOMV( -0x35000 ) +#define PROP_FUME_START_X3 FIXED_TO_GEOMV( 0x35000 ) +#define PROP_FUME_START_X4 FIXED_TO_GEOMV( 0x35000 ) +#define PROP_FUME_START_Y FIXED_TO_GEOMV( 0x00000 ) +#define PROP_FUME_START_Z FIXED_TO_GEOMV( -0x125000 ) + +#define _2_PROP_FUME_START_X1 FIXED_TO_GEOMV( -0x35000 ) +#define _2_PROP_FUME_START_X2 FIXED_TO_GEOMV( -0x35000 ) +#define _2_PROP_FUME_START_X3 FIXED_TO_GEOMV( 0x35000 ) +#define _2_PROP_FUME_START_X4 FIXED_TO_GEOMV( 0x35000 ) +#define _2_PROP_FUME_START_Y FIXED_TO_GEOMV( 0x00000 ) +#define _2_PROP_FUME_START_Z FIXED_TO_GEOMV( -0x125000 ) + +#define SPREADFIRE_LIFETIME 1500 +#define SPREADFIRE_SPEED 0x10000 + +#define HELIX_LIFETIME 1500 +#define HELIX_SPEED 0x10000 + +#define PHOTON_LIFETIME 1500 +#define PHOTON_SPEED 0x80000 + +#define SHIP1_MAXDAMAGE 20 +#define SHIP1_MAXSHIELD 10 +#define SHIP1_NUM_MISSLS 05 +#define SHIP1_NUM_HOMMISSLS 10 +#define SHIP1_NUM_SWARMMISSLS 0 +#define SHIP1_NUM_MINES 3 +#define SHIP1_MAX_SPEED 0xbb80 +#define SHIP1_MAX_ENERGY 400 +#define SHIP1_MAX_FUEL 300 +#define SHIP1_WEAPONS 0x00070101 + +#define SHIP2_MAXDAMAGE 20 +#define SHIP2_MAXSHIELD 10 +#define SHIP2_NUM_MISSLS 10 +#define SHIP2_NUM_HOMMISSLS 15 +#define SHIP2_NUM_SWARMMISSLS 0 +#define SHIP2_NUM_MINES 5 +#define SHIP2_MAX_SPEED 0x9600 +#define SHIP2_MAX_ENERGY 800 +#define SHIP2_MAX_FUEL 950 +#define SHIP2_WEAPONS 0x00070101 + +#define ENERGYEXTRA_LIFETIME 10000 +#define MISSILEEXTRA_LIFETIME 20000 +#define DEVICEEXTRA_LIFETIME 25000 + +#define ENERGYEXTRA_SELFROTX 0x0025 +#define ENERGYEXTRA_SELFROTY 0x0055 +#define ENERGYEXTRA_SELFROTZ 0x0080 +#define MISSILEEXTRA_SELFROTX 0x0065 +#define MISSILEEXTRA_SELFROTY 0x0040 +#define MISSILEEXTRA_SELFROTZ 0x0015 +#define DEVICEEXTRA_SELFROTX 0x0025 +#define DEVICEEXTRA_SELFROTY 0x0055 +#define DEVICEEXTRA_SELFROTZ 0x0080 + +#define MINE1_HITPOINTS 15 +#define MINE1_LIFETIME 60000 +#define MINE1_SELFROTX 0x0065 +#define MINE1_SELFROTY 0x0040 +#define MINE1_SELFROTZ 0x0015 + +#define LASER1_LIFETIME 1680 +#define LASER1_SPEED 0x25000 +#define LASER1_HITPOINTS 1 +#define LASER1_ENERGY 5 + +#define LASER2_LIFETIME 1680 +#define LASER2_SPEED 0x25000 +#define LASER2_INTENSITY 20 +#define LASER2_ENERGY 2 + +#define LASER3_LIFETIME 1680 +#define LASER3_SPEED 0x25000 +#define LASER3_THEFTDAMAGE 50 +#define LASER3_ENERGY 10 + +#define MISSILE1_LIFETIME 3600 +#define MISSILE1_SPEED 0x1a000 +#define MISSILE1_HITPOINTS 10 + +#define HOMMISS1_LIFETIME 4800 +#define HOMMISS1_SPEED 0x20000 +#define HOMMISS1_HITPOINTS 5 + +#define HOMMISS1_LATENCY 60 +#define HOMMISS1_MAX_ROT 0x0100 + +#define LASER1_START_X_1 FIXED_TO_GEOMV( -0x0c000 ) +#define LASER1_START_X_2 FIXED_TO_GEOMV( -0x07000 ) +#define LASER1_START_X_3 FIXED_TO_GEOMV( 0x07000 ) +#define LASER1_START_X_4 FIXED_TO_GEOMV( 0x0c000 ) +#define LASER1_START_Y FIXED_TO_GEOMV( 0x19000 ) +#define LASER1_START_Z FIXED_TO_GEOMV( 0x3e0000 ) + +#define _2_LASER1_START_X_1 FIXED_TO_GEOMV( -0x74000 ) +#define _2_LASER1_START_X_2 FIXED_TO_GEOMV( -0x66000 ) +#define _2_LASER1_START_X_3 FIXED_TO_GEOMV( 0x66000 ) +#define _2_LASER1_START_X_4 FIXED_TO_GEOMV( 0x74000 ) +#define _2_LASER1_START_Y FIXED_TO_GEOMV( 0x22000 ) +#define _2_LASER1_START_Z FIXED_TO_GEOMV( 0x370000 ) + +#define MISSILE1_START_X_1 FIXED_TO_GEOMV( -0x090000 ) +#define MISSILE1_START_X_2 FIXED_TO_GEOMV( -0x050000 ) +#define MISSILE1_START_X_3 FIXED_TO_GEOMV( 0x050000 ) +#define MISSILE1_START_X_4 FIXED_TO_GEOMV( 0x090000 ) +#define MISSILE1_START_Y FIXED_TO_GEOMV( 0x030000 ) +#define MISSILE1_START_Z FIXED_TO_GEOMV( 0x120000 ) + +#define _2_MISSILE1_START_X_1 FIXED_TO_GEOMV( -0xc5000 ) +#define _2_MISSILE1_START_X_2 FIXED_TO_GEOMV( -0x63000 ) +#define _2_MISSILE1_START_X_3 FIXED_TO_GEOMV( 0x63000 ) +#define _2_MISSILE1_START_X_4 FIXED_TO_GEOMV( 0xc5000 ) +#define _2_MISSILE1_START_Y FIXED_TO_GEOMV( 0x6c000 ) +#define _2_MISSILE1_START_Z FIXED_TO_GEOMV( -0x17000 ) + +#define MINE1_START_X FIXED_TO_GEOMV( 0x00000 ) +#define MINE1_START_Y FIXED_TO_GEOMV( 0x00000 ) +#define MINE1_START_Z FIXED_TO_GEOMV( -0x330000 ) + +#define _2_MINE1_START_X FIXED_TO_GEOMV( 0x00000 ) +#define _2_MINE1_START_Y FIXED_TO_GEOMV( 0x00000 ) +#define _2_MINE1_START_Z FIXED_TO_GEOMV( -0x360000 ) + +#define HOMMISS1_START_X_1 FIXED_TO_GEOMV( -0x060000 ) +#define HOMMISS1_START_X_2 FIXED_TO_GEOMV( -0x020000 ) +#define HOMMISS1_START_X_3 FIXED_TO_GEOMV( 0x020000 ) +#define HOMMISS1_START_X_4 FIXED_TO_GEOMV( 0x060000 ) +#define HOMMISS1_START_Y FIXED_TO_GEOMV( -0x010000 ) +#define HOMMISS1_START_Z FIXED_TO_GEOMV( 0x1f0000 ) + +#define SPREAD_START_X_1 FIXED_TO_GEOMV( -(0x0c000+0x45000) ) +#define SPREAD_START_X_2 FIXED_TO_GEOMV( -0x07000 ) +#define SPREAD_START_X_3 FIXED_TO_GEOMV( 0x07000 ) +#define SPREAD_START_X_4 FIXED_TO_GEOMV( (0x0c000+0x45000) ) +#define SPREAD_START_Y FIXED_TO_GEOMV( 0x19000 ) +#define SPREAD_START_Z FIXED_TO_GEOMV( (0x3e0000 - 0x450000) ) + +#define _2_SPREAD_START_X_1 FIXED_TO_GEOMV( -(0x0c000+0x45000) ) +#define _2_SPREAD_START_X_2 FIXED_TO_GEOMV( -0x07000 ) +#define _2_SPREAD_START_X_3 FIXED_TO_GEOMV( 0x07000 ) +#define _2_SPREAD_START_X_4 FIXED_TO_GEOMV( (0x0c000+0x45000) ) +#define _2_SPREAD_START_Y FIXED_TO_GEOMV( 0x19000 ) +#define _2_SPREAD_START_Z FIXED_TO_GEOMV( (0x3e0000 - 0x450000) ) + +#define HELIX_START_X FIXED_TO_GEOMV( -(0x0c000+0x45000) ) +#define HELIX_START_Y FIXED_TO_GEOMV( 0x19000 ) +#define HELIX_START_Z FIXED_TO_GEOMV( (0x3e0000 - 0x450000) ) + +#define _2_HELIX_START_X FIXED_TO_GEOMV( -(0x0c000+0x45000) ) +#define _2_HELIX_START_Y FIXED_TO_GEOMV( 0x19000 ) +#define _2_HELIX_START_Z FIXED_TO_GEOMV( (0x3e0000 - 0x450000) ) + +#define BEAM_START_X_1 FIXED_TO_GEOMV( -0x51000 ) +#define BEAM_START_X_2 FIXED_TO_GEOMV( -0x4a000 ) +#define BEAM_START_X_3 FIXED_TO_GEOMV( 0x4a000 ) +#define BEAM_START_X_4 FIXED_TO_GEOMV( 0x51000 ) +#define BEAM_START_Y FIXED_TO_GEOMV( 0x19000 ) +#define BEAM_START_Z FIXED_TO_GEOMV( 0x40000 ) + +#define _2_BEAM_START_X_1 FIXED_TO_GEOMV( -500000 ) +#define _2_BEAM_START_X_2 0 +#define _2_BEAM_START_X_3 0 +#define _2_BEAM_START_X_4 FIXED_TO_GEOMV( 400000 ) +#define _2_BEAM_START_Y 0 +#define _2_BEAM_START_Z FIXED_TO_GEOMV( -180000 ) + +#define SHIP1_OBJCAM_STARTPITCH ((bams_t) 0x0d00) +#define SHIP1_OBJCAM_STARTYAW ((bams_t)-0x0f00) +#define SHIP1_OBJCAM_STARTROLL ((bams_t) 0x0000) +#define SHIP1_OBJCAM_STARTDIST FIXED_TO_GEOMV( 0x600000 ) +#define SHIP1_OBJCAM_MINDISTANCE FIXED_TO_GEOMV( 0x300000 ) +#define SHIP1_OBJCAM_MAXDISTANCE FIXED_TO_GEOMV( 0xd00000 ) + +#define SHIP2_OBJCAM_STARTPITCH ((bams_t) 0x1000) +#define SHIP2_OBJCAM_STARTYAW ((bams_t)-0x1000) +#define SHIP2_OBJCAM_STARTROLL ((bams_t)-0x0500) +#define SHIP2_OBJCAM_STARTDIST FIXED_TO_GEOMV( 0x5c0000 ) +#define SHIP2_OBJCAM_MINDISTANCE FIXED_TO_GEOMV( 0x300000 ) +#define SHIP2_OBJCAM_MAXDISTANCE FIXED_TO_GEOMV( 0xc00000 ) + + +#endif // _OD_PROPS_H_ + + diff --git a/src/libparsec/include/od_rast.h b/src/libparsec/include/od_rast.h new file mode 100644 index 0000000..2d5e91b --- /dev/null +++ b/src/libparsec/include/od_rast.h @@ -0,0 +1,124 @@ +/* + * PARSEC HEADER (OBJECT) + * Rasterization Types V1.70 + * + * Copyright (c) Markus Hadwiger 1995-1999 + * All Rights Reserved. + */ + +#ifndef _OD_RAST_H_ +#define _OD_RAST_H_ + + +// coordinate on actual screen (integral component on the integer lattice) ---- +// +typedef dword ugrid_t; // unsigned! +typedef int32_t sgrid_t; // signed! +typedef rastv_t fgrid_t; + + +// 2-D point in unsigned integer coordinates (always >= 0) -------------------- +// +struct UPoint { + + ugrid_t X; // unsigned! + ugrid_t Y; // unsigned! +}; + + +// 2-D point in screen coordinates (used in vertex list for the edge tracer) -- +// +struct SPoint { + + sgrid_t X; // signed! + sgrid_t Y; // signed! +}; + + +// extended version of SPoint structure; contains z and color info ------------ +// +struct SPointEx { + + sgrid_t X; // signed! + sgrid_t Y; // signed! + depth_t View_Z; // Z coordinate in view space (for buffer fill) + dword RGBA; // RGBA color (8-bit channels) +}; + + +// 2-D point in screen coordinates with fractional part ----------------------- +// +struct FPoint { + + fgrid_t X; // 8 bytes + fgrid_t Y; +}; + + +// defines a polygon that should by rendered and drawn to the screen; --------- +// created after projection of 3-D polygon; scaled to screen coordinates; +// used only by edge tracer (must be filled from the object structure) +// +struct SVertexList { + + dword VCount; // number of vertices in list + SPoint Vertices[ 1 ]; // first element of vertex list (array) +}; + + +// list of extended SPoints --------------------------------------------------- +// +struct SVertexExList { + + dword VCount; // number of vertices in list + SPointEx Vertices[ 1 ]; // first element of vertex list (array) +}; + + +// defines single horizontal span; used for horizontal span list structure ---- +// the span starts at XLeft and ends at XRight (inclusively) +// +struct HSpan { + + ugrid_t XLeft; // size is 8 bytes + ugrid_t XRight; +}; + + +// extended version of HSpan structure; contains z and lighting info ---------- +// +struct HSpanEx { + + ugrid_t XLeft; // size is 16 bytes + ugrid_t XRight; + word ZLeft; + word ILeft; + word ZRight; + word IRight; +}; + + +// stores list of horizontal spans; created by polygon edge-tracer; ----------- +// used by low level polygon drawing/rendering functions +// +struct HSpanList { + + dword Height; // length of list (height of bounding rectangle) + ugrid_t TopY; // lowest y coordinate of polygon vertices + HSpan HSpans[ 1 ]; // first element of horizontal span list (array) +}; + + +// list of extended HSpans ---------------------------------------------------- +// +struct HSpanExList { + + dword Height; // length of list (height of bounding rectangle) + ugrid_t TopY; // lowest y coordinate of polygon vertices + HSpanEx HSpans[ 1 ]; // first element of horizontal span list (array) +}; + + +#endif // _OD_RAST_H_ + + diff --git a/src/libparsec/include/od_struc.h b/src/libparsec/include/od_struc.h new file mode 100644 index 0000000..397fd39 --- /dev/null +++ b/src/libparsec/include/od_struc.h @@ -0,0 +1,430 @@ +/* + * PARSEC HEADER (OBJECT) + * Generic Object Structures V1.80 + * + * Copyright (c) Markus Hadwiger 1995-2001 + * All Rights Reserved. + */ + +#ifndef _OD_STRUC_H_ +#define _OD_STRUC_H_ + +#ifdef PARSEC_SERVER + +// forward decls -------------------------------------------------------------- +// +class E_Distributable; + +#endif // PARSEC_SERVER + + +// defines a texture map (size is 32 bytes) ----------------------------------- +// +struct TextureMap { + + dword Geometry; // code for geometry of texture + word Width; // log2( width in pixels ) + word Height; // log2( height in pixels ) + word Flags; // flag word + byte LOD_small; // smallest LOD level (power of two) + byte LOD_large; // largest LOD level (power of two) + dword CompFormat; // impl.-dependent compressed format spec + char* BitMap; // pointer to bitmap (8 bit per texel) + word* TexPalette; // pointer to color look up table for texture + const char* TexMapName; // pointer to texture name + dword TexelFormat; // texel format +}; + + +// single texfont char (size is 8 bytes) -------------------------------------- +// +struct texchar_s { + + short tex_u; // u coordinate in texture + short tex_v; // v coordinate in texture + short tex_id; // id of texture (relative to texfont) + signed char tex_ulead; // u offset to first real column + signed char tex_ustep; // u advance after drawing this char +}; + + +// entire texfont descriptor (size is 16 bytes) ------------------------------- +// +struct texfont_s { + + dword flags; + byte height; // height of chars (must be equal for all) + byte numtextures; // may have been split up into several textures + short numtexchars; // number of chars in this font + texchar_s* texchars; // table of chars + TextureMap* texmap; // corresponding font textures (array) +}; + + +// single entry (frame) in table of textures ---------------------------------- +// +struct texfrm_s { + + int deltatime; // delta time to next entry (frame) + TextureMap* texmap; // texture map for this frame +}; + + +// single entry (frame) in table of 2-D (image) transformations --------------- +// +struct xfofrm_s { + + int deltatime; // delta time to next entry (frame) + imgtrafo_s* imgtrafo; // image transformation for this frame +}; + + +// texture animation descriptor (size is 32 bytes) ---------------------------- +// +struct texanim_s { + + texfrm_s* tex_table; // table of textures + dword tex_end; // end index + dword tex_start; // start index + dword tex_rep; // repeat index + + xfofrm_s* xfo_table; // table of 2-D (image) transformations + dword xfo_end; // end index + dword xfo_start; // start index + dword xfo_rep; // repeat index +}; + + +// single entry (frame) in color animation table (size is 8 bytes) ------------ +// +struct colfrm_s { + + int deltatime; // delta time to next entry (frame) + colrgba_s color; // color for this frame +}; + + +// how to combine the color sources in color animations ----------------------- +// +enum { + + COLANIM_SOURCENOCOMBINE = 0x0000, // no source color combination + COLANIM_SOURCEADD = 0x0001, // add source colors + COLANIM_SOURCEMUL = 0x0002, // multiply source colors + COLANIM_SOURCE_MASK = 0x0003 +}; + + +// color animation descriptor (size is 16 bytes) ------------------------------ +// +struct colanim_s { + + colfrm_s* col_table0; // color source 0 + colfrm_s* col_table1; // color source 1 + + word col_end0; // table 0 end index (length-1) + word col_end1; // table 1 end index (length-1) + + dword col_flags; // COLANIM_xx +}; + + +// how to combine the source color with the face color ------------------------ +// +enum { + + FACE_ANIM_BASEIGNORE = 0x0000, // ignore base (face) color + FACE_ANIM_BASEADD = 0x0001, // add anim to base color + FACE_ANIM_BASEMUL = 0x0002, // multiply base color by anim + FACE_ANIM_BASE_MASK = 0x0003 +}; + + +// instance data for current state of face animation (size is 32 bytes) ------- +// +struct FaceAnimState { + +// base info + + texanim_s* TexAnim; // texture animation + colanim_s* ColAnim; // color animation + dword ColFlags; // FACE_ANIM_xx + colrgba_s ColOutput; // animated output color + +// state info + + word tex_pos; // current position in texture table + short tex_time; // time left until next advance in table + word xfo_pos; // current position in trafo table + short xfo_time; // time left until next advance in table + + word col_pos0; // current position in color source 0 + short col_time0; // time left until next advance in table + word col_pos1; // current position in color source 1 + short col_time1; // time left until next advance in table +}; + + +// extended face info flags --------------------------------------------------- +// +enum { + + FACE_EXT_NONE = 0x0000, // no animations at all + FACE_EXT_ANIMATETEXTURES = 0x0001, // enable texture animation + FACE_EXT_TRANSFORMTEXTURES = 0x0002, // enable texture xfo animation + FACE_EXT_ANIMATECOLORS = 0x0004, // enable color animation + FACE_EXT_ONESHOT = 0x0010, // one-shot animation + FACE_EXT_ONESHOTRESTORE = 0x0020, // restore previous shader + FACE_EXT_DISABLED = 0x8000 // temporarily disabled +}; + + +// optional extended face information (size is 8 bytes) ----------------------- +// +struct FaceExtInfo { + + dword Flags; // FACE_EXT_xx + dword StateId; // index into GenObject::FaceAnimStates[] +}; + + +// face shading flags --------------------------------------------------------- +// +enum { + + FACE_SHADING_DEFAULT = 0x0000, + + FACE_SHADING_FACECOLOR = 0x0001, // use face color (direct/indexed) + FACE_SHADING_USECOLORINDEX = 0x0002, // indexed instead of direct color + FACE_SHADING_TEXIPOLATE = 0x0004, // texture may be interpolated + + FACE_SHADING_ENABLETEXTURE = 0x0010, // shader uses texture + FACE_SHADING_CONSTANTCOLOR = 0x0020, // shade with constant color + FACE_SHADING_NOVERTEXALPHA = 0x0040, // shader must ignore vertex alpha + + FACE_SHADING_NODEPTHCMP = 0x0100, // disable depth compare + FACE_SHADING_NODEPTHWRITE = 0x0200, // disable depth write + + FACE_SHADING_DRAW_SORTED = 0x0400, // draw in depth order + FACE_SHADING_DRAW_LAST = 0x0800, // draw last (overlay) + + FACE_SHADING_NOBACKCULLING = 0x1000, // turn off backface culling + FACE_SHADING_BACK_FIRST = 0x2000 // draw backfaces, then frontfaces +}; + + +// defines a single object-face (size is 128 bytes) --------------------------- +// +struct Face { + + TextureMap* TexMap; // pointer to texture description + FaceExtInfo* ExtInfo; // optional extended face info + dword ColorRGB; // RGB color for direct color display + dword ColorIndx; // colorindex for palette mapped display + dword FaceNormalIndx; // index of vertex which is the surface normal + Xmatrx TexXmatrx; // matrix for texture placement + dword _mtxscratch1; // scratchpad for matrix code + Xmatrx CurTexXmatrx; // current transformation screen -> texture + word ShadingIter; // shader to use for this face (iter_xx) + word ShadingFlags; // shading flags (FACE_SHADING_xx) + dword VisibleFrame; // ==CurVisibleFrame if face touched this frame +}; + + +// polygon flags -------------------------------------------------------------- +// +enum { + + POLYFLAG_DEFAULT = 0x0000, // vertex indexes only + POLYFLAG_CORNERCOLORS = 0x0001, // RGBA color array follows + POLYFLAG_WEDGEINDEXES = 0x0002 // wedge index array follows +}; + + +// defines a single object-polygon (size is 16 bytes) ------------------------- +// +struct Poly { + + dword NumVerts; // number of vertices (no surface normal!) + dword FaceIndx; // index of face this polygon belongs to + dword* VertIndxs; // list of vertexindexes comprising the polygon + dword Flags; // POLYFLAG_xx +}; + + +// node structure for bsp tree nodes (size is 16 bytes) ----------------------- +// +struct BSPNode { + + dword Polygon; // index of polygon contained in this node + dword Contained; // index of first node in the same plane (list) + dword FrontTree; // index of root-node of front-subtree + dword BackTree; // index of root-node of back-subtree +}; + + +// vertex animation callback function type ------------------------------------ +// +struct GenObject; +typedef int (*vtxanim_fpt)( GenObject *gobj, dword animid ); + + +// instance data for current state of vertex animation (size is 128 bytes) ---- +// +struct VtxAnimState { + +// base info + + dword NumVerts; // number of vertices with normals + dword NumPolyVerts; // number of vertices without normals + dword NumNormals; // number of face normals + dword VertexBase; // base index for vertex subarray + dword NumPolys; // number of polygons + dword PolyBase; // base index for polygon subarray + dword NumFaces; // number of faces + dword FaceBase; // base index for face subarray + dword NumWedges; // number of wedges + dword WedgeBase; // base index for wedge subarray + + vtxanim_fpt AnimCallback; // callback function + +// state info + + Xmatrx CurrentXmatrx; // current transformation matrix + dword StateInfo[ 9 ]; // custom animation state info +}; + + +// allow pointer to particle cluster to be declared --------------------------- +// +struct objectbase_pcluster_s; +typedef objectbase_pcluster_s ObjPartCluster; + + +// forward declaration -------------------------------------------------------- +// +struct CustomObject; + + +// wedge data flags ----------------------------------------------------------- +// +enum { + + WEDGEFLAG_ENABLE_TEXCOORDS = 0x0001 +}; + + +// structure of generic graphical object for specific lod --------------------- +// +struct GenLodObject { + + dword NumVerts; // number of vertices with normals + dword NumPolyVerts; // number of vertices without normals + dword NumNormals; // number of face normals + Vertex3* VertexList; // list of all vertices in object space + Vertex3* X_VertexList; // vertices transformed into view space + SPoint* S_VertexList; // vtxs converted to screen coordinates + dword NumPolys; // number of polygons in this object + Poly* PolyList; // list of polygons in this object + dword NumFaces; // number of faces in this object + Face* FaceList; // list of all faces + dword* VisPolyList; // indexes of currently visible polys + dword* SortedPolyList; // poly indexes sorted on attributes + void* AuxList; // ... + BSPNode* BSPTree; // pointer to root of bsp tree + CullBSPNode* AuxBSPTree; // auxiliary bsp tree + void* AuxObject; // object for api-optimized rendering + dword NumWedges; // wedges==subvertices on attributes + word NumLayers; // number of texcoordinates per wedge + word WedgeFlags; // WEDGEFLAG_xx + dword* WedgeVertIndxs; // vertices corresponding to wedges + Vector3* WedgeNormals; // vertex/wedge normals + colrgba_s* WedgeColors; // vertex/wedge colors + TexCoord2* WedgeTexCoords; // vertex/wedge texture coordinates + colrgba_s* WedgeLighted; // temp storage for lighted wedges + colrgba_s* WedgeSpecular; // temp storage for specular colors + colrgba_s* WedgeFogged; // temp storage for fogged wedges + word ActiveFaceAnims; // active face anim state subrange + word ActiveVtxAnims; // active vertex anim state subrange +}; + + +// object lod descriptor (size is 16 bytes) ----------------------------------- +// +struct GenLodInfo { + + dword Flags; + geomv_t MagTreshold; // switching thresholds with hysteresis + geomv_t MinTreshold; // (small->large, large->small) + GenLodObject* LodObject; // actual geometry for this lod +}; + + +// structure of generic graphical object -------------------------------------- +// +struct GenObject { + + GenObject* NextObj; // next object in list; _if_ the list + GenObject* PrevObj; // is doubly linked: previous object + GenObject* NextVisObj; // pointer to next obj in visible list + dword ObjectNumber; // unique number of this objectinstance + dword HostObjNumber; // number this object has on its host + dword ObjectType; // type this object belongs to + dword ObjectClass; // class this object belongs to + size_t InstanceSize; // size of instance of this object class + dword NumVerts; // number of vertices with normals + dword NumPolyVerts; // number of vertices without normals + dword NumNormals; // number of face normals + Vertex3* VertexList; // list of all vertices in object space + Vertex3* X_VertexList; // vertices transformed into view space + SPoint* S_VertexList; // vtxs converted to screen coordinates + dword NumPolys; // number of polygons in this object + Poly* PolyList; // list of polygons in this object + dword NumFaces; // number of faces in this object + Face* FaceList; // list of all faces + dword NumVisPolys; // number of polygon indexes in vislist + dword* VisPolyList; // indexes of currently visible polys + dword* SortedPolyList; // poly indexes sorted on attributes + void* AuxList; // ... + geomv_t BoundingSphere; // radius of bounding sphere + geomv_t BoundingSphere2; // radius squared of bounding sphere + Vertex3 BoundingBox[ 2 ]; // min-max vertices of bounding box + BSPNode* BSPTree; // pointer to root of bsp tree + ObjPartCluster* AttachedPClusters; // list of attached particle clusters + CustomObject* NotifyCustmObjects; // customobj list for callback_notify() + dword VisibleFrame; // ==CurVisibleFrame if object visible + CullBSPNode* AuxBSPTree; // auxiliary bsp tree + dword CullMask; // last cull mask set by culling code + void* AuxObject; // object for api-optimized rendering + dword NumWedges; // wedges==subvertices on attributes + word NumLayers; // number of texcoordinates per wedge + word WedgeFlags; // WEDGEFLAG_xx + dword* WedgeVertIndxs; // vertices corresponding to wedges + Vector3* WedgeNormals; // vertex/wedge normals + colrgba_s* WedgeColors; // vertex/wedge colors + TexCoord2* WedgeTexCoords; // vertex/wedge texture coordinates + colrgba_s* WedgeLighted; // temp storage for lighted wedges + colrgba_s* WedgeSpecular; // temp storage for specular colors + colrgba_s* WedgeFogged; // temp storage for fogged wedges + word CurrentLod; // currently active detail level + word NumLodObjects; // number of available detail levels + GenLodInfo* LodObjects; // detail level descriptors + word NumFaceAnims; // number of face anim states (maximum) + word ActiveFaceAnims; // active state subrange (from start) + FaceAnimState* FaceAnimStates; // face anim states (must be instanced!) + word NumVtxAnims; // number of vtx anim states (maximum) + word ActiveVtxAnims; // active state subrange (from start) + VtxAnimState* VtxAnimStates; // vtx anim states (must be instanced!) + dword _mtxscratch1; // scratchpad for matrix code + Xmatrx ObjPosition; // location and orientation in worldsp. + dword _mtxscratch2; // scratchpad for matrix code + Xmatrx CurrentXmatrx; // current objspace -> viewspace xform +#ifdef PARSEC_SERVER + E_Distributable* pDist; // pointer to the E_Distributable attached to this engine object +#endif // PARSEC_SERVER +}; + + +#endif // _OD_STRUC_H_ + + diff --git a/src/libparsec/include/od_texdf.h b/src/libparsec/include/od_texdf.h new file mode 100644 index 0000000..467d61e --- /dev/null +++ b/src/libparsec/include/od_texdf.h @@ -0,0 +1,146 @@ +/* + * PARSEC HEADER (OBJECT) + * Texture Format Specifications V1.15 + * + * Copyright (c) Markus Hadwiger 1998-2000 + * All Rights Reserved. + */ + +#ifndef _OD_TEXDF_H_ +#define _OD_TEXDF_H_ + + +// texture flags + +#define TEXFLG_NONE 0x0000 // no special flags +#define TEXFLG_EXT_GEOMETRY 0x0001 // extended geometry specification +#define TEXFLG_LODRANGE_VALID 0x0002 // lod range (small to large) valid +#define TEXFLG_GLIDE_TEXTURE 0x0004 // directly usable as glide texture +#define TEXFLG_IS_COMPRESSED 0x0010 // texture data is compressed +#define TEXFLG_DO_COMPRESSION 0x0020 // texture data should be compressed +#define TEXFLG_CACHE_MAY_FREE 0x0100 // cache may free texture data + + +// texture map formats + +#define TEXFMT_FORMATMASK 0x0000ffff // mask to extract actual format +#define TEXFMT_FLAGSMASK 0xffff0000 // mask to extract additional flags +#define TEXFMT_PALETTEDTEXTURE 0x00010000 // format needs texture palette +#define TEXFMT_GLIDEFORMAT 0x00020000 // format spec identical to glide + +#define TEXFMT_STANDARD 0x0000 // 8-bit indexes into global palette +#define TEXFMT_RGB_565 0x0001 // 16-bit direct color +#define TEXFMT_RGBA_1555 0x0002 // 16-bit direct color with alpha +#define TEXFMT_RGB_888 0x0003 // 24-bit direct color +#define TEXFMT_RGBA_8888 0x0004 // 32-bit direct color with alpha +#define TEXFMT_ALPHA_8 0x0005 // 8-bit alpha only +#define TEXFMT_INTENSITY_8 0x0006 // 8-bit intensity only +#define TEXFMT_LUMINANCE_8 0x0007 // 8-bit luminance only + +#define TEXFMT_GR_8BIT ( 0x0000 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_RGB_332 TEXFMT_GR_8BIT +#define TEXFMT_GR_YIQ_422 ( 0x0001 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_ALPHA_8 ( 0x0002 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_INTENSITY_8 ( 0x0003 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_ALPHA_INTENSITY_44 ( 0x0004 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_P_8 ( 0x0005 | TEXFMT_GLIDEFORMAT | TEXFMT_PALETTEDTEXTURE ) +#define TEXFMT_GR_RSVD0 ( 0x0006 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_RSVD1 ( 0x0007 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_16BIT ( 0x0008 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_ARGB_8332 TEXFMT_GR_16BIT +#define TEXFMT_GR_AYIQ_8422 ( 0x0009 | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_RGB_565 ( 0x000a | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_ARGB_1555 ( 0x000b | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_ARGB_4444 ( 0x000c | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_ALPHA_INTENSITY_88 ( 0x000d | TEXFMT_GLIDEFORMAT ) +#define TEXFMT_GR_AP_88 ( 0x000e | TEXFMT_GLIDEFORMAT | TEXFMT_PALETTEDTEXTURE ) +#define TEXFMT_GR_RSVD2 ( 0x000f | TEXFMT_GLIDEFORMAT ) + + +// texture lod specification + +#define TEXLOD_1 0x0000 // lowest level: 1x1 +#define TEXLOD_2 0x0001 +#define TEXLOD_4 0x0002 +#define TEXLOD_8 0x0003 +#define TEXLOD_16 0x0004 +#define TEXLOD_32 0x0005 +#define TEXLOD_64 0x0006 +#define TEXLOD_128 0x0007 +#define TEXLOD_256 0x0008 +#define TEXLOD_512 0x0009 +#define TEXLOD_1024 0x000a +#define TEXLOD_2048 0x000b // highest level: 2048x2048 + + +// texture geometry codes (legacy geometry spec) + +#define TEXGEO_CODE_32x32 0x00000000 +#define TEXGEO_CODE_64x32 0x00000001 +#define TEXGEO_CODE_64x64 0x00000002 +#define TEXGEO_CODE_128x64 0x00000003 +#define TEXGEO_CODE_128x128 0x00000004 +#define TEXGEO_CODE_256x128 0x00000005 +#define TEXGEO_CODE_256x256 0x00000006 // currently not supported! + + +// texture extended geometry codes (scale, aspect ratio, flags) + +#define TEXGEO_NOTSPECIFIED 0x00000000 + +#define TEXGEO_GLIDEASPECT 0x00000100 // aspect ratio spec for glide +#define TEXGEO_EXTASPECT 0x00000200 // non-standard aspect ratio spec +#define TEXGEO_INVERSESCALE 0x00000400 // inverse scale factor stored +#define TEXGEO_ASPECTMASK 0x000000ff // mask to extract aspect ratio +#define TEXGEO_SCALEMASK 0x0fff0000 // mask to extract coordinate scale +#define TEXGEO_SCALESHIFT 16 // shift to get actual scale value +#define TEXGEO_SCALE2MASK 0xf0000000 // mask to extract log2 scale +#define TEXGEO_SCALE2SHIFT 28 // shift to get actual log2 scale +#define TEXGEO_FLAGSMASK 0x0000ff00 // mask to extract additional flags + +#define TEXGEO_SCALE_1 0x00010000 // scale factors by which texture +#define TEXGEO_SCALE_2 0x10020000 // coordinates need to be scaled +#define TEXGEO_SCALE_4 0x20040000 // up before they can be used for +#define TEXGEO_SCALE_8 0x30080000 // actual rendering (| their log2). +#define TEXGEO_SCALE_16 0x40100000 // this facility is used if texture +#define TEXGEO_SCALE_32 0x50200000 // coordinates have to be normalized +#define TEXGEO_SCALE_64 0x60400000 // to a reference texture size +#define TEXGEO_SCALE_128 0x70800000 // instead of the actual size of +#define TEXGEO_SCALE_256 0x81000000 // the texture. +#define TEXGEO_SCALE_512 0x92000000 +#define TEXGEO_SCALE_1024 0xa4000000 + +#define TEXGEO_ASPECT_1x1 0x00 // supported everywhere +#define TEXGEO_ASPECT_2x1 0x01 // supported everywhere +#define TEXGEO_ASPECT_4x1 ( 0x02 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_8x1 ( 0x03 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_16x1 ( 0x04 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_32x1 ( 0x05 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_64x1 ( 0x06 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_128x1 ( 0x07 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_256x1 ( 0x08 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_512x1 ( 0x09 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1024x1 ( 0x0a | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x2 ( 0x0b | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x4 ( 0x0c | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x8 ( 0x0d | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x16 ( 0x0e | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x32 ( 0x0f | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x64 ( 0x10 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x128 ( 0x11 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x256 ( 0x12 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x512 ( 0x13 | TEXGEO_EXTASPECT ) +#define TEXGEO_ASPECT_1x1024 ( 0x14 | TEXGEO_EXTASPECT ) + +#define TEXGEO_ASPECT_GR_8x1 ( 0x00 | TEXGEO_GLIDEASPECT ) +#define TEXGEO_ASPECT_GR_4x1 ( 0x01 | TEXGEO_GLIDEASPECT ) +#define TEXGEO_ASPECT_GR_2x1 ( 0x02 | TEXGEO_GLIDEASPECT ) +#define TEXGEO_ASPECT_GR_1x1 ( 0x03 | TEXGEO_GLIDEASPECT ) +#define TEXGEO_ASPECT_GR_1x2 ( 0x04 | TEXGEO_GLIDEASPECT ) +#define TEXGEO_ASPECT_GR_1x4 ( 0x05 | TEXGEO_GLIDEASPECT ) +#define TEXGEO_ASPECT_GR_1x8 ( 0x06 | TEXGEO_GLIDEASPECT ) + + +#endif // _OD_TEXDF_H_ + + diff --git a/src/libparsec/include/od_trafo.h b/src/libparsec/include/od_trafo.h new file mode 100644 index 0000000..044000d --- /dev/null +++ b/src/libparsec/include/od_trafo.h @@ -0,0 +1,62 @@ +/* + * PARSEC HEADER (OBJECT) + * Transformation Types V1.68 + * + * Copyright (c) Markus Hadwiger 1995-1998 + * All Rights Reserved. + */ + +#ifndef _OD_TRAFO_H_ +#define _OD_TRAFO_H_ + + +// generic transformation matrices -------------------------------------------- +// +typedef geomv_t Xmatrx[ 3 ][ 4 ]; // [0 0 0 1] (line 4) omitted! +typedef geomv_t dXmatrx[ 16 ]; // can be used as destination (ofs+4!!) +typedef geomv_t (*pXmatrx)[ 4 ]; // pointer to Xmatrx type +typedef geomv_t Camera[ 3 ][ 4 ]; // position and orientation of camera +typedef geomv_t (*pCamera)[ 4 ]; // pointer to Camera type + +typedef float fMatrx2h[ 3 ][ 3 ]; // float matrix for 2-D (homogeneous) +typedef float fMatrx3h[ 4 ][ 4 ]; // float matrix for 3-D (homogeneous) + + +// easily allocate destination matrix ----------------------------------------- +// +#define ALLOC_DESTXMATRX(x) \ + dXmatrx _##x; pXmatrx x = (pXmatrx) ( (char*)_##x + 4 ) + +//NOTE: +// must not be used like if (.) ALLOC_DESTXMATRX(x). this would make no sense +// and also doesn't work because the macro is not a single statement. + + +// image transformation ------------------------------------------------------- +// +struct imgtrafo_s { + + geomv_t A; + geomv_t B; + geomv_t C; + geomv_t D; + geomv_t E; + geomv_t F; + geomv_t G; + geomv_t H; + geomv_t I; +}; + + +// structure containing both the sine and cosine of a given angle ------------- +// +struct sincosval_s { + + geomv_t sinval; + geomv_t cosval; +}; + + +#endif // _OD_TRAFO_H_ + + diff --git a/src/libparsec/include/od_types.h b/src/libparsec/include/od_types.h new file mode 100644 index 0000000..a44891b --- /dev/null +++ b/src/libparsec/include/od_types.h @@ -0,0 +1,430 @@ +/* + * PARSEC HEADER (OBJECT) + * Object Type Definitions V1.72 + * + * Copyright (c) Markus Hadwiger 1996-2000 + * All Rights Reserved. + */ + +#ifndef _OD_TYPES_H_ +#define _OD_TYPES_H_ + + +//NOTE: +// different object type means different data structure and handling. +// there may be many objects of the same type. these are distinguished +// by their object class. there may also be many objects of the same +// class (object class instances). + + +// numbers of available object types (predefined) ----------------------------- +// +#define NUM_SHIP_TYPES 2 + +#define NUM_LASER_TYPES 3 +#define NUM_MISSILE_TYPES 5 + +#define NUM_PROJECTILE_TYPES (NUM_LASER_TYPES+NUM_MISSILE_TYPES) +#define NUM_TARGETMISSILE_TYPES 2 + +#define NUM_EXTRA_TYPES 4 +#define NUM_MINE_TYPES 1 + +#define NUM_DISTINCT_OBJTYPES (NUM_SHIP_TYPES+NUM_PROJECTILE_TYPES+NUM_EXTRA_TYPES) + + +// object type ids ------------------------------------------------------------ +// +#define SHIP1TYPE 0x00000000 +#define SHIP2TYPE 0x00000001 +#define LASER1TYPE 0x80008102 +#define LASER2TYPE 0x80008103 +#define LASER3TYPE 0x80008104 +#define MISSILE1TYPE 0x00000205 +#define MISSILE2TYPE 0x00000206 +#define MISSILE3TYPE 0x00000207 +#define MISSILE4TYPE 0x00010208 +#define MISSILE5TYPE 0x00020209 +#define EXTRA1TYPE 0x0000030A +#define EXTRA2TYPE 0x0000030B +#define EXTRA3TYPE 0x0000030C +#define MINE1TYPE 0x0000030D + +#define TYPENUMBERMASK 0x000000ff +#define TYPELISTMASK 0x00000f00 +#define TYPEFLAGSMASK 0x0000f000 +#define TYPECONTROLMASK 0x000f0000 + +#define TYPE_ID_INVALID 0xffffffff +#define CLASS_ID_INVALID 0xffffffff + +#define PSHIP_LIST_NO 0x00000000 +#define LASER_LIST_NO 0x00000100 +#define MISSL_LIST_NO 0x00000200 +#define EXTRA_LIST_NO 0x00000300 +#define CUSTM_LIST_NO 0x00000400 + +#define TYPEBACKFACEMASK 0x80008000 // no backfaceculling at all +#define TYPETWOSIDEDMASK 0x40004000 // some faces are two sided +#define TYPETRANSPARENTMASK 0x20002000 // some faces are transparent + +#define TYPEMISSILEISSTANDARD 0x00000000 +#define TYPEMISSILEISHOMING 0x00010000 +#define TYPEMISSILEISSWARM 0x00020000 + + +// type determination macros -------------------------------------------------- +// +#define TYPEID_TYPE_SHIP(i) ( ( (i) & TYPELISTMASK ) == PSHIP_LIST_NO ) +#define TYPEID_TYPE_LASER(i) ( ( (i) & TYPELISTMASK ) == LASER_LIST_NO ) +#define TYPEID_TYPE_MISSILE(i) ( ( (i) & TYPELISTMASK ) == MISSL_LIST_NO ) +#define TYPEID_TYPE_EXTRA(i) ( ( (i) & TYPELISTMASK ) == EXTRA_LIST_NO ) +#define TYPEID_TYPE_CUSTOM(i) ( ( (i) & TYPELISTMASK ) == CUSTM_LIST_NO ) + +#define OBJECT_TYPE_SHIP(o) ( ( (o)->ObjectType & TYPELISTMASK ) == PSHIP_LIST_NO ) +#define OBJECT_TYPE_LASER(o) ( ( (o)->ObjectType & TYPELISTMASK ) == LASER_LIST_NO ) +#define OBJECT_TYPE_MISSILE(o) ( ( (o)->ObjectType & TYPELISTMASK ) == MISSL_LIST_NO ) +#define OBJECT_TYPE_EXTRA(o) ( ( (o)->ObjectType & TYPELISTMASK ) == EXTRA_LIST_NO ) +#define OBJECT_TYPE_CUSTOM(o) ( ( (o)->ObjectType & TYPELISTMASK ) == CUSTM_LIST_NO ) + + +// owner id for local player -------------------------------------------------- +// +#define OWNER_LOCAL_PLAYER -1 + + +// special target identifiers ------------------------------------------------- +// +#define TARGETID_NO_TARGET ((dword)-1) + + +// generic ship object -------------------------------------------------------- +// +struct ShipObject : GenObject { + + int CurDamage; + int MaxDamage; + + // fractional part: 65536 == 1.0 + dword CurDamageFrac; + + int CurShield; + int MaxShield; + + int CurEnergy; + int MaxEnergy; + + // fractional part: 65536 == 1.0 + dword CurEnergyFrac; + + int CurFuel; + int MaxFuel; + + fixed_t CurSpeed; + fixed_t MaxSpeed; + + //NOTE: + // speeds are always fixed_t since they are too + // often used as such to become geomv_t now. + + Vertex3 DirectionVec; + + int BounceCount; + Vertex3 BounceVec; + + // counter for animation of explosion + int ExplosionCount; + + // used by particle system to start explosion + int DelayExplosion; + + // weapons availability state + dword Weapons; + + // weapons active state (same masks as Weapons) + dword WeaponsActive; + + // special device states (invulnerability, etc.) + dword Specials; + + // absorption factor of mega shield + int MegaShieldAbsorption; + + // downcounter for invisibility duration + int InvisibilityCount; + + int NumMissls; + int MaxNumMissls; + + int NumHomMissls; + int MaxNumHomMissls; + + int NumPartMissls; + int MaxNumPartMissls; + + int NumMines; + int MaxNumMines; + + // ship steering + bams_t YawPerRefFrame; + bams_t PitchPerRefFrame; + bams_t RollPerRefFrame; + + geomv_t XSlidePerRefFrame; + geomv_t YSlidePerRefFrame; + + int SpeedIncPerRefFrame; + int SpeedDecPerRefFrame; + + // firing control + int FireRepeatDelay; + int FireDisableDelay; + int MissileDisableDelay; + + // object camera control + geomv_t ObjCamMinDistance; + geomv_t ObjCamMaxDistance; + geomv_t ObjCamStartDist; + bams_t ObjCamStartPitch; + bams_t ObjCamStartYaw; + bams_t ObjCamStartRoll; + + // weapon info + dword Laser1_Class[ 4 ][ 4 ]; + geomv_t Laser1_X[ 4 ][ 4 ]; + geomv_t Laser1_Y[ 4 ][ 4 ]; + geomv_t Laser1_Z[ 4 ][ 4 ]; + + dword Missile1_Class[ 4 ]; + geomv_t Missile1_X[ 4 ]; + geomv_t Missile1_Y[ 4 ]; + geomv_t Missile1_Z[ 4 ]; + + dword Missile2_Class[ 4 ]; + geomv_t Missile2_X[ 4 ]; + geomv_t Missile2_Y[ 4 ]; + geomv_t Missile2_Z[ 4 ]; + + geomv_t Mine1_X; + geomv_t Mine1_Y; + geomv_t Mine1_Z; + + fixed_t SpreadSpeed; + int SpreadLifeTime; + + geomv_t Spread_X[ 4 ]; + geomv_t Spread_Y; + geomv_t Spread_Z; + + fixed_t HelixSpeed; + int HelixLifeTime; + bams_t HelixCurBams; + refframe_t helix_refframes_delta; + + geomv_t Helix_X; + geomv_t Helix_Y; + geomv_t Helix_Z; + + fixed_t PhotonSpeed; + int PhotonLifeTime; + + refframe_t EmpRefframesDelta; + + geomv_t Beam_X[ 4 ]; + geomv_t Beam_Y; + geomv_t Beam_Z; + + int FumeFreq; + fixed_t FumeSpeed; + int FumeLifeTime; + int FumeCount; + + geomv_t Fume_X[ 4 ]; + geomv_t Fume_Y; + geomv_t Fume_Z; + + GenObject* Orbit; + + // afterburner info per ship + int afterburner_previous_speed; + int afterburner_active; + refframe_t afterburner_energy; +}; + +// object type "Ship_1" (Objecttype #00) +struct Ship1Obj : ShipObject { + +}; + +// object type "Ship_2" (Objecttype #01) +struct Ship2Obj : ShipObject { + +}; + + +// generic projectile object -------------------------------------------------- +// +struct ProjectileObject : GenObject { + + int LifeTime; + int LifeTimeCount; + Vertex3 DirectionVec; + fixed_t Speed; + dword HitPoints; + int Owner; // OWNER_LOCAL_PLAYER means local player is owner + Vertex3 PrevPosition; + +}; + + +// generic laser object ------------------------------------------------------- +// +struct LaserObject : ProjectileObject { + + int EnergyNeeded; + +}; + +// object type "Laser_1" (Objecttype #02) +struct Laser1Obj : LaserObject { + +}; + +// object type "Laser_2" (Objecttype #03) +struct Laser2Obj : LaserObject { + +}; + +// object type "Laser_3" (Objecttype #04) +struct Laser3Obj : LaserObject { + +}; + + +// generic missile object ----------------------------------------------------- +// +struct MissileObject : ProjectileObject { + +}; + + +// object type "Missile_1" (Objecttype #05) +struct Missile1Obj : MissileObject { + +}; + +// object type "Missile_2" (Objecttype #06) +struct Missile2Obj : MissileObject { + +}; + +// object type "Missile_3" (Objecttype #07) +struct Missile3Obj : MissileObject { + +}; + + +// generic missile object with targeting -------------------------------------- +// +struct TargetMissileObject : MissileObject { + + dword TargetObjNumber; + GenObject* TargetObjPointer; + dword Latency; + bams_t MaxRotation; + +}; + +// object type "Missile_4" (Objecttype #08) +struct Missile4Obj : TargetMissileObject { + +}; + +// object type "Missile_5" (Objecttype #09) +struct Missile5Obj : TargetMissileObject { + +}; + + +// generic extra object ------------------------------------------------------- +// +struct ExtraObject : GenObject { + + int LifeTime; + int LifeTimeCount; + bams_t SelfRotX; + bams_t SelfRotY; + bams_t SelfRotZ; + int DriftTimeout; + Vector3 DriftVec; + refframe_t VisibleFrame_Reset_Frames; + +}; + +// object type "Extra_1" (Objecttype #0A) +struct Extra1Obj : ExtraObject { + + int EnergyBoost; + +}; + +// object type "Extra_2" (Objecttype #0B) +struct Extra2Obj : ExtraObject { + + int MissileType; + int NumMissiles; + +}; + +// object type "Extra_3" (Objecttype #0C) +struct Extra3Obj : ExtraObject { + + int DeviceType; + int DeviceSpecials1; + int DeviceSpecials2; + int DeviceSpecials3; + int DeviceSpecials4; + +}; + + +// generic mine object -------------------------------------------------------- +// +struct MineObject : ExtraObject { + + int HitPoints; + int Owner; // OWNER_LOCAL_PLAYER means local player is owner + +}; + +// object type "Mine_1" (Objecttype #0D) [counts as extra object!] +struct Mine1Obj : MineObject { + +}; + + +// custom (application specific object) --------------------------------------- +// +struct CustomObject : GenObject { + + void (*callback_instant)( CustomObject *base ); + void (*callback_destroy)( CustomObject *base ); + + int (*callback_animate)( CustomObject *base ); + int (*callback_collide)( CustomObject *base ); + + void (*callback_notify)( CustomObject *base, GenObject *genobj, int event ); + int (*callback_persist)( CustomObject* base, int ToStream, void* relist ); +}; + + +// planet object -------------------------------------------------------------- +// +struct PlanetObject : CustomObject { + +}; + + +#endif // _OD_TYPES_H_ + + diff --git a/src/libparsec/include/parttype.h b/src/libparsec/include/parttype.h new file mode 100644 index 0000000..c3d7c41 --- /dev/null +++ b/src/libparsec/include/parttype.h @@ -0,0 +1,432 @@ +/* + * PARSEC HEADER + * Particle System Types and Definitions V1.46 + * + * Copyright (c) Markus Hadwiger 1997-1999 + * All Rights Reserved. + */ + +#ifndef _PARTTYPE_H_ +#define _PARTTYPE_H_ + + +// lifetime for objects that don't destroy themselves +#define INFINITE_LIFETIME 2000000000 + +// number of lightning particles in beam +#define LIGHTNING_LENGTH 256 + + +// properties of generic sphere particles +#define SPHERE_BM_INDX BM_LIGHTNING1 +#define SPHERE_REF_Z 10.0f //9.0f // 30.0f // 150.0f +#define SPHERE_PARTICLE_COLOR 255 +#define SPHERE_PARTICLES 250 //512 //200 + +#define SPHERE_EXPLOSION_DURATION 250 //400 +#define SPHERE_EXPLOSION_SPEED FIXED_TO_GEOMV( 0x2800 ) //0x07000 + +#define SPHERE_EXPLOSION_BM_INDX BM_FIREBALL3 +#define SPHERE_EXPLOSION_COLOR 168 +#define SPHERE_EXPLOSION_REF_Z 20.0f + +#define SPHERE_EXPL_PARTICLES 150 + +// properties of contracting sphere +#define SPHERE_CONTRACT_SPEED FIXED_TO_GEOMV( 0x0c00 ) +#define CONTRACTING_SPHERE_LIFETIME 8000 +#define CONTRACTING_SPHERE_EXPANSION_TIME 800 + + +// sphere animation type identifiers +#define SAT_NO_ANIMATION 0x00000600 +#define SAT_ROTATING 0x00000601 +#define SAT_EXPLODING 0x00000402 +#define SAT_PULSATING 0x00000503 +#define SAT_CONTRACTING 0x00000404 +#define SAT_STOCHASTIC_MOTION 0x00000605 + +// anim type for lightning (no "real" sphere animtype) +#define SAT_LIGHTNING 0x00000006 + +// anim type for geometry particles (no "real" sphere animtype) +#define SAT_GENOBJECT 0x00000007 + +// anim type for photon particles (no "real" sphere animtype) +#define SAT_PHOTON 0x00000008 + +// types for differently shaped spheres +#define SAT_SPHERETYPE_NORMAL 0x00000000 +#define SAT_SPHERETYPE_DISC 0x00010000 +#define SAT_SPHERETYPE_DISCWITHCORE 0x00020000 + +// special sphere flags +#define SAT_RESET_MEGASHIELD_FLAG 0x00100000 +#define SAT_DECREMENT_EXTRA_COUNTER 0x00200000 +#define SAT_AUTO_DEPLETE_PARTICLES 0x00400000 + +// special sphere anim types (combined) +#define SAT_MEGASHIELD_SPHERE ( SAT_ROTATING | SAT_RESET_MEGASHIELD_FLAG | SAT_AUTO_DEPLETE_PARTICLES ) +#define SAT_ENERGYFIELD_SPHERE ( SAT_CONTRACTING | SAT_DECREMENT_EXTRA_COUNTER ) + +// sphere animation type identifier masks +#define SAT_NEEDS_REFCOORDS_MASK 0x00000100 +#define SAT_VALID_FOR_OBJECTCENTERED_SPHERE 0x00000200 +#define SAT_VALID_FOR_PSPHERE_OBJECT 0x00000400 +#define SAT_BASIC_ANIM_MASK 0x0000ffff +#define SAT_SPHERE_TYPE_MASK 0x000f0000 +#define SAT_SPECIAL_FLAGS_MASK 0xfff00000 + + +// cluster type identifiers (pcluster_s::type) +#define CT_CONSTANT_VELOCITY 0x00000000 +#define CT_LIGHTNING 0x00001201 +#define CT_OBJECTCENTERED_SPHERE 0x00000602 +#define CT_PARTICLE_SPHERE 0x00000103 +#define CT_CALLBACK_TRAJECTORY 0x00000004 +#define CT_CUSTOMDRAW 0x00000805 +#define CT_GENOBJECT_PARTICLES 0x00000606 +#define CT_PHOTON_SPHERE 0x00000207 + +// cluster type identifier flags/masks (pcluster_s::type) +#define CT_PARTICLE_OBJ_MASK 0x00000100 +#define CT_GENOBJECTRELATIVE_OBJ_MASK 0x00000200 +#define CT_DONT_DRAW_IN_COCKPIT_MASK 0x00000400 +#define CT_DONT_DRAW_AUTOMATICALLY 0x00000800 +#define CT_DONT_DRAW_IF_BASE_VISNEVER 0x00001000 +#define CT_EXTINFO_STORAGE 0x00010000 +#define CT_DONT_CULL_WITH_GENOBJECT 0x00020000 +#define CT_CLUSTER_GLOBAL_EXTINFO 0x00040000 +#define CT_HINT_PARTICLES_IDENTICAL 0x00100000 +#define CT_HINT_PARTICLES_HAVE_EXTINFO 0x00200000 +#define CT_HINT_NO_APPEARANCE_ANIMATION 0x00400000 +#define CT_HINT_NO_POSITIONAL_ANIMATION 0x00800000 +#define CT_HINT_CULL_APPEARANCE_ANIMATION 0x01000000 +#define CT_HINT_CULL_POSITIONAL_ANIMATION 0x02000000 +#define CT_TYPEMASK 0x0000ffff +#define CT_TYPEENUMERATIONMASK 0x000000ff + + +// particle flags (field particle_s::flags) +#define PARTICLE_ACTIVE 0x00000001 +#define PARTICLE_COLLISION 0x00000002 + +// linear particle distinguishing flags/masks +#define PARTICLE_IS_HELIX 0x00010000 +#define PARTICLE_IS_PHOTON 0x00020000 +#define PARTICLE_IS_MASK 0xffff0000 + + +// single texture anim registration info -------------------------------------- +// +struct ptexreg_s { + + int deltatime; // delta time to next entry (frame) + char* texname; // name of frame texture +}; + + +// single texture trafo registration info (currently same as ptrafo_s) -------- +// +struct pxforeg_s { + + int deltatime; // delta time to next entry (frame) + imgtrafo_s* imgtrafo; // image transformation for this frame +}; + + +// registration info for particle definition ---------------------------------- +// +struct pdefreg_s { + + ptexreg_s* texinfo; // info for texture table + dword textabsize; // number of texture table entries + dword texstart; // start index + dword texrep; // repeat index + dword texend; // end index + + pxforeg_s* xfoinfo; // info for trafo table + dword xfotabsize; // number of trafo table entries + dword xfostart; // start index + dword xfoend; // end index + dword xforep; // repeat index +}; + + +// particle definition (texture animation) ------------------------------------ +// +typedef texanim_s pdef_s; + + +// registered pdef as used by PART_API::ParticleDefinitions[] ----------------- +// +struct pdefref_s { + + char* defname; // unique name for particle definition + pdef_s* def; // actual definition +}; + + +// extended definition/state info (to fields in particle_s) ------------------- +// +struct pextinfo_s { + +// extended definition + + pdef_s* partdef; // particle definition (until particle dies) + pdef_s* partdef_dest; // particle definition (during destruction) + +// extended state info + + word tex_pos; // current position in texture table + short tex_time; // time left until next advance in table + word xfo_pos; // current position in trafo table + short xfo_time; // time left until next advance in table +}; + + +// generic particle structure (size is 64 bytes) ------------------------------ +// +struct particle_s { + + int owner; // particle's owner (used for identification in netgame) + dword flags; // miscellaneous flags + int lifetime; // lifetime after which automatic destruction commences + pextinfo_s* extinfo; // extended definition/state info (may be NULL) + int bitmap; // negative means single pixel; bitmapindex otherwise + int color; // color for pixel particle + int sizebound; // LOD threshold for switch between bitmap and pixel + float ref_z; // reference z (distance for original-size bitmap) + Vertex3 position; // current position in 3-space + Vector3 velocity; // velocity vector (or current tangent to trajectory) +}; + +//NOTE: +// if ( extinfo != NULL ) field particle_s::bitmap has +// nothing to do with a bitmap anymore, but rather contains +// the iteration-type (iter_xx) with which the particle +// should be rendered in the loword and additional rendering +// flags in the hiword. + +#define PART_REND_MASK_ITER 0x0000ffff +#define PART_REND_MASK_FLAGS 0xffff0000 + +#define PART_REND_NONE 0x00000000 +#define PART_REND_NODEPTHCMP 0x00010000 // disable depth compare +#define PART_REND_NODEPTHSCALE 0x00020000 // no scale with depth coordinate +#define PART_REND_POINTVIS 0x00040000 // check point visibility + +// flag to turn sizebound off (always use texture) +#define PRT_NO_SIZEBOUND -1 + + +// header for auxiliary memblock in cluster (normally accessed via userinfo) -- +// +struct pusrinfo_s { + + int infovalid; // flag if actually valid + size_t blocksize; // size of block in bytes +}; + + +// basic particle cluster (animation/culling/memory allocation efficiency) ---- +// +struct pcluster_s { + + pcluster_s* next; // [ THE SEQUENCE OF THE FIRST THREE FIELDS ] + pcluster_s* prec; // [ *MUST NOT* BE CHANGED!! ] + particle_s* rep; // particle storage + dword type; // type of cluster (CT_xx: anim/struct-type/flags) + int numel; // current number of contained particles + int maxnumel; // maximum number of contained particles + geomv_t bdsphere; // radius of bounding sphere (0 means none) + pusrinfo_s* userinfo; // arbitrary user-defined info pertaining to cluster +}; + + +// particle cluster for linear particles -------------------------------------- +// +struct linear_pcluster_s; +typedef void (*linear_pcluster_fpt)( linear_pcluster_s*, int ); +struct linear_pcluster_s : pcluster_s { + + linear_pcluster_fpt callback; +}; + + +// particle cluster with generic callback function for animation -------------- +// +struct callback_pcluster_s; +typedef void (*callback_pcluster_fpt)( callback_pcluster_s* ); +struct callback_pcluster_s : pcluster_s { + + callback_pcluster_fpt callback; +}; + + +// particle cluster for customdraw animation ---------------------------------- +// +struct customdraw_pcluster_s; +typedef void (*customdraw_pcluster_fpt)( customdraw_pcluster_s* ); +struct customdraw_pcluster_s : pcluster_s { + + const GenObject* baseobject; // owner object + customdraw_pcluster_fpt callback; +}; + + +// particle cluster containing genobject relative particles ------------------- +// +struct objectbase_pcluster_s : pcluster_s { + + GenObject* baseobject; // pointer to object that owns cluster + objectbase_pcluster_s* attachlist; // pointer to next attached cluster + int animtype; // animation type (SAT_xx) +}; + + +// particle cluster containing position-relative particles -------------------- +// +struct particleobj_pcluster_s : pcluster_s { + + Vertex3 origin; // origin of cluster as a whole + int animtype; // animation type (SAT_xx) +}; + + +// cluster of particles comprising a sphere around a genobject ---------------- +// +struct basesphere_pcluster_s : objectbase_pcluster_s { + + int lifetime; // current lifetime of entire sphere + int max_life; // initial lifetime of entire sphere + + union { + + struct { // SAT_ROTATING + bams_t pitch; + bams_t yaw; + bams_t roll; + } rot; + + struct { // SAT_STOCHASTIC_MOTION + geomv_t radius; + int speed; + int fcount; + } rand; + }; +}; + + +// particle cluster containing genobject relative photon particles ------------ +// +struct photon_sphere_pcluster_s : objectbase_pcluster_s { + + geomv_t contraction_speed; + int contraction_time; + int cur_contraction_time; + int max_loading_time; + int firing; + int numloads; + Vertex3 center; + int alive; // current lifetime of entire sphere + bams_t pitch; + bams_t yaw; + bams_t roll; +}; + + +// cluster of particles comprising a sphere at a specific position ------------ +// +struct sphereobj_pcluster_s : particleobj_pcluster_s { + + int lifetime; // current lifetime of entire sphere + int max_life; // initial lifetime of entire sphere + + union { + + struct { // SAT_ROTATING + bams_t pitch; + bams_t yaw; + bams_t roll; + } rot; + + struct { // SAT_EXPLODING + geomv_t speed; + } expl; + + struct { // SAT_PULSATING + geomv_t amplitude; + geomv_t midradius; + bams_t frequency; // actually: angle/timeunit (omega) + bams_t current_t; // actually: current angle (omega*t) + bams_t pitch; + bams_t yaw; + bams_t roll; + } puls; + + struct { // SAT_CONTRACTING + geomv_t speed; + int expandtime; + bams_t pitch; + bams_t yaw; + bams_t roll; + } cont; + }; +}; + + +// cluster of lightning particles --------------------------------------------- +// +struct lightning_pcluster_s : objectbase_pcluster_s { + + int sizzlespeed; + int framecount; + Vertex3 beamstart1; + Vertex3 beamstart2; +}; + + +// cluster of particles that are part of an object's geometry ----------------- +// +struct genobject_pcluster_s; +typedef void (*genobject_pcluster_fpt)( genobject_pcluster_s* ); +struct genobject_pcluster_s : objectbase_pcluster_s { + + genobject_pcluster_fpt callback; +}; + + +// info how a particle should be drawn ---------------------------------------- +// +struct pdrwinfo_s { + + int bmindx; // index of particle's bitmap + int pcolor; // particle's color if not drawn as bitmap + float ref_z; // reference z (scaling info) + int sizebnd; // LOD threshold for switch between bitmap and pixel + pextinfo_s* extinfo; // extended definition/state info (may be NULL) +}; + +//NOTE: +// this structure is used as argument to functions that create a whole cluster +// of particles instead of just a single particle. at the moment these are +// PRT_CreateObjectCenteredSphere() and PRT_CreateParticleSphereObject(). +// (functions creating a single particle take a particle_s directly.) + + +// list of particle clusters -------------------------------------------------- +// +extern pcluster_s *Particles; +extern pcluster_s *CurLinearCluster; +extern pcluster_s *CustomDrawCluster; + + +// typical lower boundary of particle bitmap size ----------------------------- +// +extern int partbitmap_size_bound; + + +#endif // _PARTTYPE_H_ + + diff --git a/src/libparsec/include/platform.h b/src/libparsec/include/platform.h new file mode 100644 index 0000000..309eb72 --- /dev/null +++ b/src/libparsec/include/platform.h @@ -0,0 +1,79 @@ +#ifndef _PLATFORM_H +#define _PLATFORM_H +// platform.h - platform dependent include selection should go here. + + +/* Sick of this junk, hard coding some stuff because there's no reason for the mass + system dependent code anymore */ + +#undef SYSTEM_WIN32_UNUSED +#undef SYSTEM_LINUX_UNUSED +#undef SYSTEM_MACOSX_UNUSED + +#define SYSTEM_SDL + + +// New defines for different systems + +#if defined(_WIN32) +# define SYSTEM_TARGET_WINDOWS +// support XP, for some reason... +#define _WIN32_WINNT _WIN32_WINNT_WS03 + +#elif defined(__APPLE__) // TODO: check for iOS using TargetConditionals.h +# define SYSTEM_TARGET_OSX +#elif defined(linux) || defined(__linux) +# define SYSTEM_TARGET_LINUX +#endif + + +// compiler specification (parsec constants) ---------------------------------- +// +#if defined(_MSC_VER) +# define SYSTEM_COMPILER_MSVC +#elif defined(__clang__) +# define SYSTEM_COMPILER_CLANG +#elif defined(__GNUC__) +# if defined(__llvm__) +# define SYSTEM_COMPILER_LLVM_GCC +# else +# define SYSTEM_COMPILER_GCC +# endif +#endif + +#include "platform_sdl.h" + +//PARSEC_SERVER Needs this: +#define CPU_VENDOR_OS "i386-pc-win32" + +#if ! defined ( PARSEC_CLIENT ) && ! defined ( PARSEC_SERVER ) +#error "Error: Building libparsec must be called from the client or server make files... for now..." +#endif + +// target system specification +// These should be defined by the compiler or by the +// building IDE +/* +#if defined ( __WIN32__ ) || defined (WIN32) || defined( __linux__) || defined(__CYGWIN__) || defined(__APPLE__) +// #define SYSTEM_WIN32_UNUSED +// #undef SYSTEM_LINUX_UNUSED +// #undef SYSTEM_MACOSX_UNUSED +// #define CPU_VENDOR_OS "i386-pc-win32" +//#elif defined( __linux__ ) + #undef SYSTEM_WIN32_UNUSED + #define SYSTEM_LINUX_UNUSED + #undef SYSTEM_MACOSX_UNUSED +#ifndef __CYGWIN__ + #define __CYGWIN__ // temporary, for SDL testing. +#endif + #define CPU_VENDOR_OS "i386-pc-linux-gnu" +#elif defined( __APPLE__ ) + #undef SYSTEM_WIN32_UNUSED + #define SYSTEM_LINUX_UNUSED + #undef SYSTEM_MACOSX_UNUSED + #define CPU_VENDOR_OS "i386-pc-linux-gnu" +#endif + + */ + +#endif //_PLATFORM_H diff --git a/src/libparsec/include/platform_sdl.h b/src/libparsec/include/platform_sdl.h new file mode 100755 index 0000000..8b3b29e --- /dev/null +++ b/src/libparsec/include/platform_sdl.h @@ -0,0 +1,21 @@ +#ifndef PLATFORM_SDL_H_ +#define PLATFORM_SDL_H_ + + +// host cpu specification (parsec constants) ---------------------------------- +// +#define SYSTEM_CPU_INTEL +//#define SYSTEM_CPU_POWERPC + +#ifdef SYSTEM_TARGET_WINDOWS +#define SIGIOT SIGABRT +#endif + +#ifdef SYSTEM_SDL +//#define DISABLE_JOYSTICK_CODE // No Joystick support in Cygwin port yet. +#endif + + +#endif // !PLATFORM_SDL_H_ + + diff --git a/src/libparsec/include/sl_path.h b/src/libparsec/include/sl_path.h new file mode 100644 index 0000000..604d605 --- /dev/null +++ b/src/libparsec/include/sl_path.h @@ -0,0 +1,20 @@ +/* + * PARSEC HEADER: sl_path.h + */ + +#ifndef _SL_PATH_H_ +#define _SL_PATH_H_ + + +// sl_path.c implements the following functions +// ------------------------------------------- +// char* SYSs_ProcessPathString( char *path ); +// char* SYSs_ScanToExtension( char *fname ); +// char* SYSs_StripPath( char *fname ); +// int SYSs_AcquireScriptPath( char *path, int comtype, char *prefix ); +// int SYSs_AcquireDemoPath( char *path, char *prefix ); + + +#endif // _SL_PATH_H_ + + diff --git a/src/libparsec/include/sl_timer.h b/src/libparsec/include/sl_timer.h new file mode 100644 index 0000000..1e738ad --- /dev/null +++ b/src/libparsec/include/sl_timer.h @@ -0,0 +1,30 @@ +/* + * PARSEC HEADER: sl_timer.h + */ + +#ifndef _SL_TIMER_H_ +#define _SL_TIMER_H_ + + +// sl_timer.c implements the following functions +// --------------------------------------------- +// void SYSs_InitRefFrameCount(); +// refframe_t SYSs_GetRefFrameCount(); +// void SYSs_PauseRefFrameCount(); +// void SYSs_ResumeRefFrameCount(); +// void SYSs_Wait( refframe_t refframes ); +// int SYSs_InitFrameTimer(); +// int SYSs_KillFrameTimer(); +// int SYSs_Yield(); + +// sl_timer.c implements the following variables +// --------------------------------------------- +// extern dword FrameRate; +// extern dword FrameCounter; +// extern dword RefTimeCount; +// extern dword RefFrameCount; + + +#endif // _SL_TIMER_H_ + + diff --git a/src/libparsec/include/sw_path.h b/src/libparsec/include/sw_path.h new file mode 100644 index 0000000..60095ff --- /dev/null +++ b/src/libparsec/include/sw_path.h @@ -0,0 +1,20 @@ +/* + * PARSEC HEADER: sw_path.h + */ + +#ifndef _SW_PATH_H_ +#define _SW_PATH_H_ + + +// sw_path.c implements the following functions +// ------------------------------------------- +// char* SYSs_ProcessPathString( char *path ); +// char* SYSs_ScanToExtension( char *fname ); +// char* SYSs_StripPath( char *fname ); +// int SYSs_AcquireScriptPath( char *path, int comtype, char *prefix ); +// int SYSs_AcquireDemoPath( char *path, char *prefix ); + + +#endif // _SW_PATH_H_ + + diff --git a/src/libparsec/include/sw_timer.h b/src/libparsec/include/sw_timer.h new file mode 100755 index 0000000..d1a21db --- /dev/null +++ b/src/libparsec/include/sw_timer.h @@ -0,0 +1,30 @@ +/* + * PARSEC HEADER: sw_timer.h + */ + +#ifndef _SW_TIMER_H_ +#define _SW_TIMER_H_ + + +// sw_timer.cpp implements the following functions +// --------------------------------------------- +// void SYSs_InitRefFrameCount(); +// refframe_t SYSs_GetRefFrameCount(); +// void SYSs_PauseRefFrameCount(); +// void SYSs_ResumeRefFrameCount(); +// void SYSs_Wait( refframe_t refframes ); +// int SYSs_InitFrameTimer(); +// int SYSs_KillFrameTimer(); +// int SYSs_Yield(); + +// sw_timer.cpp implements the following variables +// --------------------------------------------- +// dword FrameRate; +// dword FrameCounter; +// dword RefTimeCount; +// dword RefFrameCount; + + +#endif // _SW_TIMER_H_ + + diff --git a/src/libparsec/include/sys_date.h b/src/libparsec/include/sys_date.h new file mode 100644 index 0000000..e29d5e0 --- /dev/null +++ b/src/libparsec/include/sys_date.h @@ -0,0 +1,27 @@ +/* + * PARSEC HEADER: sys_date.h + */ + +#ifndef _SYS_DATE_H_ +#define _SYS_DATE_H_ + + +// external variables + +extern const char build_text[]; +extern const char build_date[]; +extern const char build_time[]; + +extern const char build_comp[]; +extern const char build_bind[]; +extern const char build_endn[]; + + +// external functions + +char * SYS_SystemTime(); + + +#endif // _SYS_DATE_H_ + + diff --git a/src/libparsec/include/sys_defs.h b/src/libparsec/include/sys_defs.h new file mode 100644 index 0000000..23c7959 --- /dev/null +++ b/src/libparsec/include/sys_defs.h @@ -0,0 +1,38 @@ +/* + * PARSEC HEADER: sys_defs.h + */ + +#ifndef _SYS_DEFS_H_ +#define _SYS_DEFS_H_ + + +// ---------------------------------------------------------------------------- +// SYSTEM SUBSYSTEM (SYS) related definitions - +// ---------------------------------------------------------------------------- + +#ifdef PARSEC_CLIENT + + // external variables + + extern volatile int FrameRate; + extern volatile int FrameCounter; + extern volatile int RefTimeCount; + extern volatile int RefFrameCount; + + + // include system-specific subsystem prototypes --------------------------- + // + #include "sys_subh.h" + +#else // !PARSEC_CLIENT + + #include "sys_refframe_sv.h" + #include "sys_util_sv.h" + //#include "sys_msg_sv.h" + +#endif // !PARSEC_CLIENT + + +#endif // _SYS_DEFS_H_ + + diff --git a/src/libparsec/include/sys_file.h b/src/libparsec/include/sys_file.h new file mode 100644 index 0000000..647f4cb --- /dev/null +++ b/src/libparsec/include/sys_file.h @@ -0,0 +1,44 @@ +/* + * PARSEC HEADER: sys_file.h + */ + +#ifndef _SYS_FILE_H_ +#define _SYS_FILE_H_ + + +// external variables + +extern int num_data_packages; +extern char* package_filename[]; + +#define PSCDATA_VERSION "011" // version to match in the embedded file to verify we are good to go. + + +// external functions + +int SYS_OverridePackage( const char* oldpackname, const char* newpackname ); +int SYS_RegisterPackage( const char *packname, size_t baseofs, char *prefix ); +int SYS_AcquirePackageScripts( int comtype ); +int SYS_AcquirePackageDemos(); +int SYS_CheckDataVersion(); + +// signature compatible system file function replacements + +long int SYS_GetFileLength( const char *filename ); +FILE* SYS_fopen( const char *filename, const char *mode ); +int SYS_fclose( FILE *fp ); +size_t SYS_fread( void *buf, size_t elsize, size_t nelem, FILE *fp ); +int SYS_fseek( FILE *fp, long int offset, int whence ); +long int SYS_ftell( FILE *fp ); +int SYS_feof( FILE *fp ); +char* SYS_fgets( char *string, int n, FILE *fp ); + +int SYS_open( const char *path, int access ); +int SYS_close( int handle ); +int SYS_read( int handle, char *buffer, int len ); +long SYS_filelength( int handle ); + + +#endif // _SYS_FILE_H_ + + diff --git a/src/libparsec/include/sys_io.h b/src/libparsec/include/sys_io.h new file mode 100644 index 0000000..0d066ee --- /dev/null +++ b/src/libparsec/include/sys_io.h @@ -0,0 +1,37 @@ +/* + * PARSEC HEADER: sys_io.h + */ + +#ifndef _SYS_IO_H_ +#define _SYS_IO_H_ + + +// include header containing I/O system calls --------------------------------- + +#if defined(SYSTEM_COMPILER_GCC) || defined(SYSTEM_COMPILER_CLANG) || defined(SYSTEM_COMPILER_LLVM_GCC) + + //NOTE: + // io.h need not be included (doesn't exist and + // prototypes are declared elsewhere). + + //NOTE: + // filelength() doesn't exist; + // SYS_FILE::SYS_filelength() must not be used. + + #define filelength(x) (PANIC(0),0) + +#else // SYSTEM_COMPILER_GCC + + // simply include correct header + #include <io.h> + + #ifndef SYSTEM_COMPILER_MSVC + #include <direct.h> + #endif + +#endif // SYSTEM_COMPILER_GCC + + +#endif // _SYS_IO_H_ + + diff --git a/src/libparsec/include/sys_path.h b/src/libparsec/include/sys_path.h new file mode 100644 index 0000000..b15eef3 --- /dev/null +++ b/src/libparsec/include/sys_path.h @@ -0,0 +1,22 @@ +/* + * PARSEC HEADER: sys_path.h + */ + +#ifndef _SYS_PATH_H_ +#define _SYS_PATH_H_ + + +// ---------------------------------------------------------------------------- +// SYSTEM SUBSYSTEM (SYS) PATH PROCESSING - +// ---------------------------------------------------------------------------- + +char* SYSs_ProcessPathString( char *path ); +char* SYSs_ScanToExtension( char *fname ); +char* SYSs_StripPath( char *fname ); +int SYSs_AcquireScriptPath( char *path, int comtype, char *prefix ); +int SYSs_AcquireDemoPath( char *path, char *prefix ); + + +#endif // _SYS_PATH_H_ + + diff --git a/src/libparsec/include/sys_swap.h b/src/libparsec/include/sys_swap.h new file mode 100644 index 0000000..9cd98e0 --- /dev/null +++ b/src/libparsec/include/sys_swap.h @@ -0,0 +1,26 @@ +/* + * PARSEC HEADER: sys_swap.h + */ + +#ifndef _SYS_SWAP_H_ +#define _SYS_SWAP_H_ + + +// external functions + +void SYS_SwapPackageHeader( packageheader_s *p ); +void SYS_SwapPFileInfo( pfileinfodisk_s *p ); + +void SYS_SwapBdtHeader( BdtHeader *b ); +void SYS_SwapFntHeader( FntHeader *f ); +void SYS_SwapTexHeader( TexHeader *t ); +void SYS_SwapDemHeader( DemHeader *d ); +void SYS_SwapPfgHeader( PfgHeader *p ); +void SYS_SwapPfgTable( int fixsize, dword *geomtab, size_t tabsize ); + +void SYS_SwapGenObject( GenObject *g ); + + +#endif // _SYS_SWAP_H_ + + diff --git a/src/libparsec/include/utl_bsp.h b/src/libparsec/include/utl_bsp.h new file mode 100644 index 0000000..8ef0611 --- /dev/null +++ b/src/libparsec/include/utl_bsp.h @@ -0,0 +1,16 @@ +/* + * PARSEC HEADER: xac_bsp.h + */ + +#ifndef _XAC_BSP_H_ +#define _XAC_BSP_H_ + + +// xac_bsp.c implements the following functions +// -------------------------------------------- +// int BSP_FindColliderLine( CullBSPNode *tree, Vertex3 *v0, Vertex3 *v1, dword *colnode, geomv_t *colt ); + + +#endif + + diff --git a/src/libparsec/include/utl_clip.h b/src/libparsec/include/utl_clip.h new file mode 100644 index 0000000..9065935 --- /dev/null +++ b/src/libparsec/include/utl_clip.h @@ -0,0 +1,35 @@ +/* + * PARSEC HEADER: xac_clip.h + */ + +#ifndef _XAC_CLIP_H_ +#define _XAC_CLIP_H_ + + +// xac_clip.c implements the following functions +// --------------------------------------------- +// IterPolygon3 *CLIP_VolumeIterTriangle3( IterTriangle3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterTriangle3_UVW( IterTriangle3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterTriangle3_RGBA( IterTriangle3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterRectangle3( IterRectangle3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterRectangle3_UVW( IterRectangle3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterRectangle3_RGBA( IterRectangle3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterPolygon3( IterPolygon3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterPolygon3_UVW( IterPolygon3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_VolumeIterPolygon3_RGBA( IterPolygon3 *poly, Plane3 *volume, dword cullmask ); +// IterPolygon3 *CLIP_PlaneIterTriangle3( IterTriangle3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterTriangle3_UVW( IterTriangle3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterTriangle3_RGBA( IterTriangle3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterRectangle3( IterRectangle3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterRectangle3_UVW( IterRectangle3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterRectangle3_RGBA( IterRectangle3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterPolygon3( IterPolygon3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterPolygon3_UVW( IterPolygon3 *poly, Plane3 *plane ); +// IterPolygon3 *CLIP_PlaneIterPolygon3_RGBA( IterPolygon3 *poly, Plane3 *plane ); +// IterLine2 *CLIP_RectangleIterLine2( IterLine2 *line, Rectangle2 *rect ); +// IterLine3 *CLIP_PlaneIterLine3( IterLine3 *line, Plane3 *plane ); + + +#endif // _XAC_CLIP_H_ + + diff --git a/src/libparsec/include/utl_clpo.h b/src/libparsec/include/utl_clpo.h new file mode 100644 index 0000000..5a8fdc9 --- /dev/null +++ b/src/libparsec/include/utl_clpo.h @@ -0,0 +1,17 @@ +/* + * PARSEC HEADER: xac_clpo.h + */ + +#ifndef _XAC_CLPO_H_ +#define _XAC_CLPO_H_ + + +// xac_clpo.c implements the following functions +// --------------------------------------------- +// GenObject *CLIP_VolumeGenObject( GenObject *clipobj, Plane3 *volume, dword cullmask ); +// GenObject *CLIP_PlaneGenObject( GenObject *clipobj, Plane3 *plane ); + + +#endif + + diff --git a/src/libparsec/include/utl_cull.h b/src/libparsec/include/utl_cull.h new file mode 100644 index 0000000..e888f8c --- /dev/null +++ b/src/libparsec/include/utl_cull.h @@ -0,0 +1,21 @@ +/* + * PARSEC HEADER: xac_cull.h + */ + +#ifndef _XAC_CULL_H_ +#define _XAC_CULL_H_ + + +// xac_cull.c implements the following functions +// --------------------------------------------- +// void CULL_ReAcPointBox3( ReAcPointBox3 *reac, CullBox3 *cullbox, Plane3 *plane ); +// void CULL_ReAcIndexBox3( ReAcIndexBox3 *reac, Plane3 *plane ); +// void CULL_MakeVolumeCullVolume( Plane3 *volume, CullPlane3 *cullvolume, dword cullmask ); +// int CULL_BoxAgainstCullVolume( CullBox3 *cullbox, CullPlane3 *volume, dword *cullmask ); +// int CULL_BoxAgainstVolume( CullBox3 *cullbox, Plane3 *volume, dword *cullmask ); +// int CULL_SphereAgainstVolume( Sphere3 *sphere, Plane3 *volume, dword *cullmask ); + + +#endif + + diff --git a/src/libparsec/include/utl_fcos.h b/src/libparsec/include/utl_fcos.h new file mode 100644 index 0000000..b671cbb --- /dev/null +++ b/src/libparsec/include/utl_fcos.h @@ -0,0 +1,261 @@ + + { + 1.0000000000,0.9999988235,0.9999952938,0.9999894111,0.9999811753,0.9999705864,0.9999576446,0.9999423497,0.9999247018,0.9999047011,0.9998823475,0.9998576410,0.9998305818,0.9998011699,0.9997694054,0.9997352883, + 0.9996988187,0.9996599967,0.9996188225,0.9995752960,0.9995294175,0.9994811870,0.9994306046,0.9993776704,0.9993223846,0.9992647473,0.9992047586,0.9991424187,0.9990777278,0.9990106859,0.9989412932,0.9988695499, + 0.9987954562,0.9987190122,0.9986402182,0.9985590742,0.9984755806,0.9983897374,0.9983015449,0.9982110034,0.9981181129,0.9980228738,0.9979252862,0.9978253504,0.9977230666,0.9976184351,0.9975114561,0.9974021299, + 0.9972904567,0.9971764367,0.9970600703,0.9969413578,0.9968202993,0.9966968952,0.9965711458,0.9964430514,0.9963126122,0.9961798286,0.9960447009,0.9959072294,0.9957674145,0.9956252564,0.9954807555,0.9953339121, + 0.9951847267,0.9950331994,0.9948793308,0.9947231211,0.9945645707,0.9944036801,0.9942404495,0.9940748793,0.9939069700,0.9937367219,0.9935641355,0.9933892111,0.9932119492,0.9930323502,0.9928504145,0.9926661424, + 0.9924795346,0.9922905913,0.9920993131,0.9919057004,0.9917097537,0.9915114733,0.9913108598,0.9911079137,0.9909026354,0.9906950254,0.9904850843,0.9902728124,0.9900582103,0.9898412785,0.9896220175,0.9894004278, + 0.9891765100,0.9889502645,0.9887216920,0.9884907929,0.9882575677,0.9880220171,0.9877841416,0.9875439418,0.9873014182,0.9870565713,0.9868094018,0.9865599103,0.9863080972,0.9860539633,0.9857975092,0.9855387353, + 0.9852776424,0.9850142310,0.9847485018,0.9844804554,0.9842100924,0.9839374134,0.9836624192,0.9833851103,0.9831054874,0.9828235512,0.9825393023,0.9822527414,0.9819638691,0.9816726862,0.9813791933,0.9810833912, + 0.9807852804,0.9804848618,0.9801821360,0.9798771037,0.9795697657,0.9792601226,0.9789481753,0.9786339244,0.9783173707,0.9779985149,0.9776773578,0.9773539001,0.9770281427,0.9767000861,0.9763697313,0.9760370790, + 0.9757021300,0.9753648851,0.9750253451,0.9746835107,0.9743393828,0.9739929622,0.9736442497,0.9732932461,0.9729399522,0.9725843689,0.9722264971,0.9718663375,0.9715038910,0.9711391584,0.9707721407,0.9704028387, + 0.9700312532,0.9696573851,0.9692812354,0.9689028048,0.9685220943,0.9681391047,0.9677538371,0.9673662922,0.9669764710,0.9665843745,0.9661900034,0.9657933589,0.9653944417,0.9649932529,0.9645897933,0.9641840640, + 0.9637760658,0.9633657998,0.9629532669,0.9625384680,0.9621214043,0.9617020765,0.9612804858,0.9608566331,0.9604305194,0.9600021457,0.9595715131,0.9591386225,0.9587034749,0.9582660714,0.9578264130,0.9573845008, + 0.9569403357,0.9564939189,0.9560452513,0.9555943341,0.9551411683,0.9546857549,0.9542280951,0.9537681899,0.9533060404,0.9528416476,0.9523750127,0.9519061368,0.9514350210,0.9509616663,0.9504860739,0.9500082450, + 0.9495281806,0.9490458819,0.9485613499,0.9480745859,0.9475855910,0.9470943664,0.9466009131,0.9461052324,0.9456073254,0.9451071933,0.9446048373,0.9441002585,0.9435934582,0.9430844375,0.9425731976,0.9420597398, + 0.9415440652,0.9410261751,0.9405060706,0.9399837530,0.9394592236,0.9389324835,0.9384035341,0.9378723764,0.9373390119,0.9368034417,0.9362656672,0.9357256895,0.9351835099,0.9346391298,0.9340925504,0.9335437730, + 0.9329927988,0.9324396293,0.9318842656,0.9313267091,0.9307669611,0.9302050229,0.9296408958,0.9290745813,0.9285060805,0.9279353948,0.9273625257,0.9267874743,0.9262102421,0.9256308305,0.9250492408,0.9244654743, + 0.9238795325,0.9232914167,0.9227011283,0.9221086687,0.9215140393,0.9209172415,0.9203182767,0.9197171463,0.9191138517,0.9185083943,0.9179007756,0.9172909970,0.9166790599,0.9160649658,0.9154487161,0.9148303122, + 0.9142097557,0.9135870479,0.9129621904,0.9123351846,0.9117060320,0.9110747341,0.9104412923,0.9098057081,0.9091679831,0.9085281187,0.9078861165,0.9072419779,0.9065957045,0.9059472978,0.9052967593,0.9046440906, + 0.9039892931,0.9033323685,0.9026733182,0.9020121439,0.9013488470,0.9006834292,0.9000158920,0.8993462370,0.8986744657,0.8980005797,0.8973245807,0.8966464702,0.8959662498,0.8952839210,0.8945994856,0.8939129451, + 0.8932243012,0.8925335554,0.8918407094,0.8911457648,0.8904487232,0.8897495864,0.8890483559,0.8883450333,0.8876396204,0.8869321188,0.8862225301,0.8855108561,0.8847970984,0.8840812587,0.8833633387,0.8826433400, + 0.8819212643,0.8811971135,0.8804708891,0.8797425928,0.8790122264,0.8782797917,0.8775452902,0.8768087238,0.8760700942,0.8753294031,0.8745866523,0.8738418435,0.8730949784,0.8723460589,0.8715950867,0.8708420635, + 0.8700869911,0.8693298713,0.8685707060,0.8678094968,0.8670462455,0.8662809540,0.8655136241,0.8647442575,0.8639728561,0.8631994217,0.8624239561,0.8616464611,0.8608669386,0.8600853904,0.8593018184,0.8585162243, + 0.8577286100,0.8569389774,0.8561473284,0.8553536647,0.8545579884,0.8537603011,0.8529606049,0.8521589016,0.8513551931,0.8505494813,0.8497417680,0.8489320552,0.8481203448,0.8473066387,0.8464909388,0.8456732470, + 0.8448535652,0.8440318955,0.8432082396,0.8423825996,0.8415549774,0.8407253750,0.8398937942,0.8390602371,0.8382247056,0.8373872016,0.8365477272,0.8357062844,0.8348628750,0.8340175011,0.8331701647,0.8323208678, + 0.8314696123,0.8306164003,0.8297612338,0.8289041148,0.8280450453,0.8271840273,0.8263210628,0.8254561540,0.8245893028,0.8237205112,0.8228497814,0.8219771153,0.8211025150,0.8202259826,0.8193475201,0.8184671296, + 0.8175848132,0.8167005729,0.8158144108,0.8149263291,0.8140363297,0.8131444148,0.8122505866,0.8113548470,0.8104571983,0.8095576424,0.8086561816,0.8077528179,0.8068475535,0.8059403906,0.8050313311,0.8041203774, + 0.8032075315,0.8022927955,0.8013761717,0.8004576622,0.7995372691,0.7986149946,0.7976908409,0.7967648102,0.7958369046,0.7949071263,0.7939754776,0.7930419605,0.7921065773,0.7911693302,0.7902302214,0.7892892532, + 0.7883464276,0.7874017470,0.7864552136,0.7855068296,0.7845565972,0.7836045186,0.7826505962,0.7816948321,0.7807372286,0.7797777879,0.7788165124,0.7778534042,0.7768884657,0.7759216990,0.7749531066,0.7739826906, + 0.7730104534,0.7720363972,0.7710605243,0.7700828370,0.7691033376,0.7681220285,0.7671389119,0.7661539902,0.7651672656,0.7641787405,0.7631884173,0.7621962981,0.7612023855,0.7602066817,0.7592091890,0.7582099098, + 0.7572088465,0.7562060014,0.7552013769,0.7541949753,0.7531867990,0.7521768504,0.7511651319,0.7501516458,0.7491363945,0.7481193805,0.7471006060,0.7460800735,0.7450577854,0.7440337442,0.7430079521,0.7419804117, + 0.7409511254,0.7399200955,0.7388873245,0.7378528148,0.7368165689,0.7357785892,0.7347388781,0.7336974381,0.7326542717,0.7316093812,0.7305627692,0.7295144381,0.7284643904,0.7274126286,0.7263591551,0.7253039724, + 0.7242470830,0.7231884893,0.7221281939,0.7210661993,0.7200025080,0.7189371224,0.7178700451,0.7168012785,0.7157308253,0.7146586879,0.7135848688,0.7125093706,0.7114321957,0.7103533469,0.7092728264,0.7081906370, + 0.7071067812,0.7060212614,0.7049340804,0.7038452405,0.7027547445,0.7016625947,0.7005687939,0.6994733446,0.6983762494,0.6972775108,0.6961771315,0.6950751140,0.6939714609,0.6928661748,0.6917592584,0.6906507141, + 0.6895405447,0.6884287528,0.6873153409,0.6862003117,0.6850836678,0.6839654118,0.6828455464,0.6817240742,0.6806009978,0.6794763199,0.6783500431,0.6772221701,0.6760927036,0.6749616461,0.6738290004,0.6726947691, + 0.6715589548,0.6704215604,0.6692825883,0.6681420414,0.6669999223,0.6658562337,0.6647109782,0.6635641586,0.6624157776,0.6612658378,0.6601143421,0.6589612930,0.6578066933,0.6566505457,0.6554928530,0.6543336178, + 0.6531728430,0.6520105311,0.6508466850,0.6496813074,0.6485144010,0.6473459686,0.6461760130,0.6450045368,0.6438315429,0.6426570340,0.6414810128,0.6403034822,0.6391244449,0.6379439036,0.6367618612,0.6355783205, + 0.6343932842,0.6332067551,0.6320187359,0.6308292296,0.6296382389,0.6284457666,0.6272518155,0.6260563884,0.6248594881,0.6236611175,0.6224612794,0.6212599765,0.6200572118,0.6188529880,0.6176473079,0.6164401745, + 0.6152315906,0.6140215589,0.6128100824,0.6115971639,0.6103828063,0.6091670123,0.6079497850,0.6067311270,0.6055110414,0.6042895309,0.6030665985,0.6018422471,0.6006164794,0.5993892984,0.5981607070,0.5969307081, + 0.5956993045,0.5944664992,0.5932322950,0.5919966950,0.5907597019,0.5895213186,0.5882815482,0.5870403935,0.5857978575,0.5845539430,0.5833086529,0.5820619903,0.5808139581,0.5795645591,0.5783137964,0.5770616729, + 0.5758081914,0.5745533550,0.5732971667,0.5720396293,0.5707807459,0.5695205193,0.5682589527,0.5669960488,0.5657318108,0.5644662415,0.5631993440,0.5619311212,0.5606615762,0.5593907119,0.5581185312,0.5568450373, + 0.5555702330,0.5542941215,0.5530167056,0.5517379884,0.5504579729,0.5491766622,0.5478940592,0.5466101669,0.5453249884,0.5440385267,0.5427507849,0.5414617659,0.5401714727,0.5388799085,0.5375870763,0.5362929791, + 0.5349976199,0.5337010018,0.5324031279,0.5311040012,0.5298036247,0.5285020015,0.5271991348,0.5258950275,0.5245896827,0.5232831035,0.5219752929,0.5206662541,0.5193559902,0.5180445041,0.5167317990,0.5154178780, + 0.5141027442,0.5127864006,0.5114688504,0.5101500967,0.5088301425,0.5075089911,0.5061866453,0.5048631085,0.5035383837,0.5022124740,0.5008853826,0.4995571125,0.4982276670,0.4968970490,0.4955652618,0.4942323085, + 0.4928981922,0.4915629161,0.4902264833,0.4888888969,0.4875501601,0.4862102761,0.4848692480,0.4835270789,0.4821837721,0.4808393306,0.4794937577,0.4781470564,0.4767992301,0.4754502817,0.4741002147,0.4727490320, + 0.4713967368,0.4700433325,0.4686888220,0.4673332087,0.4659764958,0.4646186863,0.4632597836,0.4618997907,0.4605387110,0.4591765475,0.4578133036,0.4564489824,0.4550835871,0.4537171210,0.4523495872,0.4509809890, + 0.4496113297,0.4482406123,0.4468688402,0.4454960165,0.4441221446,0.4427472276,0.4413712687,0.4399942713,0.4386162385,0.4372371737,0.4358570799,0.4344759606,0.4330938189,0.4317106580,0.4303264813,0.4289412921, + 0.4275550934,0.4261678887,0.4247796812,0.4233904741,0.4220002708,0.4206090744,0.4192168884,0.4178237158,0.4164295601,0.4150344245,0.4136383122,0.4122412267,0.4108431711,0.4094441487,0.4080441629,0.4066432169, + 0.4052413140,0.4038384576,0.4024346509,0.4010298972,0.3996241998,0.3982175622,0.3968099874,0.3954014789,0.3939920401,0.3925816741,0.3911703843,0.3897581741,0.3883450467,0.3869310055,0.3855160538,0.3841001950, + 0.3826834324,0.3812657692,0.3798472089,0.3784277548,0.3770074102,0.3755861785,0.3741640630,0.3727410670,0.3713171940,0.3698924471,0.3684668300,0.3670403457,0.3656129978,0.3641847896,0.3627557244,0.3613258056, + 0.3598950365,0.3584634206,0.3570309612,0.3555976617,0.3541635254,0.3527285558,0.3512927561,0.3498561298,0.3484186802,0.3469804108,0.3455413250,0.3441014260,0.3426607173,0.3412192023,0.3397768844,0.3383337670, + 0.3368898534,0.3354451471,0.3339996514,0.3325533699,0.3311063058,0.3296584625,0.3282098436,0.3267604523,0.3253102922,0.3238593665,0.3224076788,0.3209552324,0.3195020308,0.3180480774,0.3165933756,0.3151379288, + 0.3136817404,0.3122248139,0.3107671527,0.3093087603,0.3078496400,0.3063897954,0.3049292297,0.3034679466,0.3020059493,0.3005432414,0.2990798263,0.2976157074,0.2961508882,0.2946853722,0.2932191627,0.2917522632, + 0.2902846773,0.2888164082,0.2873474595,0.2858778347,0.2844075372,0.2829365705,0.2814649379,0.2799926431,0.2785196894,0.2770460803,0.2755718193,0.2740969099,0.2726213554,0.2711451595,0.2696683256,0.2681908571, + 0.2667127575,0.2652340303,0.2637546790,0.2622747070,0.2607941179,0.2593129151,0.2578311022,0.2563486825,0.2548656596,0.2533820370,0.2518978182,0.2504130066,0.2489276057,0.2474416192,0.2459550503,0.2444679027, + 0.2429801799,0.2414918853,0.2400030224,0.2385135948,0.2370236060,0.2355330594,0.2340419586,0.2325503070,0.2310581083,0.2295653658,0.2280720832,0.2265782638,0.2250839114,0.2235890292,0.2220936210,0.2205976901, + 0.2191012402,0.2176042746,0.2161067971,0.2146088110,0.2131103199,0.2116113274,0.2101118369,0.2086118520,0.2071113762,0.2056104131,0.2041089661,0.2026070388,0.2011046348,0.1996017576,0.1980984107,0.1965945977, + 0.1950903220,0.1935855873,0.1920803970,0.1905747548,0.1890686641,0.1875621286,0.1860551517,0.1845477369,0.1830398880,0.1815316083,0.1800229014,0.1785137709,0.1770042204,0.1754942534,0.1739838734,0.1724730840, + 0.1709618888,0.1694502912,0.1679382950,0.1664259035,0.1649131205,0.1633999494,0.1618863938,0.1603724572,0.1588581433,0.1573434556,0.1558283977,0.1543129730,0.1527971853,0.1512810380,0.1497645347,0.1482476790, + 0.1467304745,0.1452129247,0.1436950332,0.1421768035,0.1406582393,0.1391393442,0.1376201216,0.1361005752,0.1345807085,0.1330605252,0.1315400287,0.1300192227,0.1284981108,0.1269766965,0.1254549834,0.1239329751, + 0.1224106752,0.1208880872,0.1193652148,0.1178420615,0.1163186309,0.1147949266,0.1132709522,0.1117467112,0.1102222073,0.1086974440,0.1071724250,0.1056471537,0.1041216339,0.1025958690,0.1010698628,0.0995436187, + 0.0980171403,0.0964904314,0.0949634953,0.0934363358,0.0919089565,0.0903813609,0.0888535526,0.0873255352,0.0857973123,0.0842688876,0.0827402645,0.0812114468,0.0796824380,0.0781532416,0.0766238614,0.0750943008, + 0.0735645636,0.0720346532,0.0705045734,0.0689743276,0.0674439196,0.0659133528,0.0643826309,0.0628517576,0.0613207363,0.0597895707,0.0582582645,0.0567268212,0.0551952443,0.0536635377,0.0521317047,0.0505997490, + 0.0490676743,0.0475354842,0.0460031821,0.0444707719,0.0429382569,0.0414056410,0.0398729276,0.0383401204,0.0368072229,0.0352742389,0.0337411719,0.0322080254,0.0306748032,0.0291415088,0.0276081458,0.0260747178, + 0.0245412285,0.0230076815,0.0214740803,0.0199404286,0.0184067299,0.0168729879,0.0153392063,0.0138053885,0.0122715383,0.0107376592,0.0092037548,0.0076698287,0.0061358846,0.0046019261,0.0030679568,0.0015339802, + 0.0000000000,-0.0015339802,-0.0030679568,-0.0046019261,-0.0061358846,-0.0076698287,-0.0092037548,-0.0107376592,-0.0122715383,-0.0138053885,-0.0153392063,-0.0168729879,-0.0184067299,-0.0199404286,-0.0214740803,-0.0230076815, + -0.0245412285,-0.0260747178,-0.0276081458,-0.0291415088,-0.0306748032,-0.0322080254,-0.0337411719,-0.0352742389,-0.0368072229,-0.0383401204,-0.0398729276,-0.0414056410,-0.0429382569,-0.0444707719,-0.0460031821,-0.0475354842, + -0.0490676743,-0.0505997490,-0.0521317047,-0.0536635377,-0.0551952443,-0.0567268212,-0.0582582645,-0.0597895707,-0.0613207363,-0.0628517576,-0.0643826309,-0.0659133528,-0.0674439196,-0.0689743276,-0.0705045734,-0.0720346532, + -0.0735645636,-0.0750943008,-0.0766238614,-0.0781532416,-0.0796824380,-0.0812114468,-0.0827402645,-0.0842688876,-0.0857973123,-0.0873255352,-0.0888535526,-0.0903813609,-0.0919089565,-0.0934363358,-0.0949634953,-0.0964904314, + -0.0980171403,-0.0995436187,-0.1010698628,-0.1025958690,-0.1041216339,-0.1056471537,-0.1071724250,-0.1086974440,-0.1102222073,-0.1117467112,-0.1132709522,-0.1147949266,-0.1163186309,-0.1178420615,-0.1193652148,-0.1208880872, + -0.1224106752,-0.1239329751,-0.1254549834,-0.1269766965,-0.1284981108,-0.1300192227,-0.1315400287,-0.1330605252,-0.1345807085,-0.1361005752,-0.1376201216,-0.1391393442,-0.1406582393,-0.1421768035,-0.1436950332,-0.1452129247, + -0.1467304745,-0.1482476790,-0.1497645347,-0.1512810380,-0.1527971853,-0.1543129730,-0.1558283977,-0.1573434556,-0.1588581433,-0.1603724572,-0.1618863938,-0.1633999494,-0.1649131205,-0.1664259035,-0.1679382950,-0.1694502912, + -0.1709618888,-0.1724730840,-0.1739838734,-0.1754942534,-0.1770042204,-0.1785137709,-0.1800229014,-0.1815316083,-0.1830398880,-0.1845477369,-0.1860551517,-0.1875621286,-0.1890686641,-0.1905747548,-0.1920803970,-0.1935855873, + -0.1950903220,-0.1965945977,-0.1980984107,-0.1996017576,-0.2011046348,-0.2026070388,-0.2041089661,-0.2056104131,-0.2071113762,-0.2086118520,-0.2101118369,-0.2116113274,-0.2131103199,-0.2146088110,-0.2161067971,-0.2176042746, + -0.2191012402,-0.2205976901,-0.2220936210,-0.2235890292,-0.2250839114,-0.2265782638,-0.2280720832,-0.2295653658,-0.2310581083,-0.2325503070,-0.2340419586,-0.2355330594,-0.2370236060,-0.2385135948,-0.2400030224,-0.2414918853, + -0.2429801799,-0.2444679027,-0.2459550503,-0.2474416192,-0.2489276057,-0.2504130066,-0.2518978182,-0.2533820370,-0.2548656596,-0.2563486825,-0.2578311022,-0.2593129151,-0.2607941179,-0.2622747070,-0.2637546790,-0.2652340303, + -0.2667127575,-0.2681908571,-0.2696683256,-0.2711451595,-0.2726213554,-0.2740969099,-0.2755718193,-0.2770460803,-0.2785196894,-0.2799926431,-0.2814649379,-0.2829365705,-0.2844075372,-0.2858778347,-0.2873474595,-0.2888164082, + -0.2902846773,-0.2917522632,-0.2932191627,-0.2946853722,-0.2961508882,-0.2976157074,-0.2990798263,-0.3005432414,-0.3020059493,-0.3034679466,-0.3049292297,-0.3063897954,-0.3078496400,-0.3093087603,-0.3107671527,-0.3122248139, + -0.3136817404,-0.3151379288,-0.3165933756,-0.3180480774,-0.3195020308,-0.3209552324,-0.3224076788,-0.3238593665,-0.3253102922,-0.3267604523,-0.3282098436,-0.3296584625,-0.3311063058,-0.3325533699,-0.3339996514,-0.3354451471, + -0.3368898534,-0.3383337670,-0.3397768844,-0.3412192023,-0.3426607173,-0.3441014260,-0.3455413250,-0.3469804108,-0.3484186802,-0.3498561298,-0.3512927561,-0.3527285558,-0.3541635254,-0.3555976617,-0.3570309612,-0.3584634206, + -0.3598950365,-0.3613258056,-0.3627557244,-0.3641847896,-0.3656129978,-0.3670403457,-0.3684668300,-0.3698924471,-0.3713171940,-0.3727410670,-0.3741640630,-0.3755861785,-0.3770074102,-0.3784277548,-0.3798472089,-0.3812657692, + -0.3826834324,-0.3841001950,-0.3855160538,-0.3869310055,-0.3883450467,-0.3897581741,-0.3911703843,-0.3925816741,-0.3939920401,-0.3954014789,-0.3968099874,-0.3982175622,-0.3996241998,-0.4010298972,-0.4024346509,-0.4038384576, + -0.4052413140,-0.4066432169,-0.4080441629,-0.4094441487,-0.4108431711,-0.4122412267,-0.4136383122,-0.4150344245,-0.4164295601,-0.4178237158,-0.4192168884,-0.4206090744,-0.4220002708,-0.4233904741,-0.4247796812,-0.4261678887, + -0.4275550934,-0.4289412921,-0.4303264813,-0.4317106580,-0.4330938189,-0.4344759606,-0.4358570799,-0.4372371737,-0.4386162385,-0.4399942713,-0.4413712687,-0.4427472276,-0.4441221446,-0.4454960165,-0.4468688402,-0.4482406123, + -0.4496113297,-0.4509809890,-0.4523495872,-0.4537171210,-0.4550835871,-0.4564489824,-0.4578133036,-0.4591765475,-0.4605387110,-0.4618997907,-0.4632597836,-0.4646186863,-0.4659764958,-0.4673332087,-0.4686888220,-0.4700433325, + -0.4713967368,-0.4727490320,-0.4741002147,-0.4754502817,-0.4767992301,-0.4781470564,-0.4794937577,-0.4808393306,-0.4821837721,-0.4835270789,-0.4848692480,-0.4862102761,-0.4875501601,-0.4888888969,-0.4902264833,-0.4915629161, + -0.4928981922,-0.4942323085,-0.4955652618,-0.4968970490,-0.4982276670,-0.4995571125,-0.5008853826,-0.5022124740,-0.5035383837,-0.5048631085,-0.5061866453,-0.5075089911,-0.5088301425,-0.5101500967,-0.5114688504,-0.5127864006, + -0.5141027442,-0.5154178780,-0.5167317990,-0.5180445041,-0.5193559902,-0.5206662541,-0.5219752929,-0.5232831035,-0.5245896827,-0.5258950275,-0.5271991348,-0.5285020015,-0.5298036247,-0.5311040012,-0.5324031279,-0.5337010018, + -0.5349976199,-0.5362929791,-0.5375870763,-0.5388799085,-0.5401714727,-0.5414617659,-0.5427507849,-0.5440385267,-0.5453249884,-0.5466101669,-0.5478940592,-0.5491766622,-0.5504579729,-0.5517379884,-0.5530167056,-0.5542941215, + -0.5555702330,-0.5568450373,-0.5581185312,-0.5593907119,-0.5606615762,-0.5619311212,-0.5631993440,-0.5644662415,-0.5657318108,-0.5669960488,-0.5682589527,-0.5695205193,-0.5707807459,-0.5720396293,-0.5732971667,-0.5745533550, + -0.5758081914,-0.5770616729,-0.5783137964,-0.5795645591,-0.5808139581,-0.5820619903,-0.5833086529,-0.5845539430,-0.5857978575,-0.5870403935,-0.5882815482,-0.5895213186,-0.5907597019,-0.5919966950,-0.5932322950,-0.5944664992, + -0.5956993045,-0.5969307081,-0.5981607070,-0.5993892984,-0.6006164794,-0.6018422471,-0.6030665985,-0.6042895309,-0.6055110414,-0.6067311270,-0.6079497850,-0.6091670123,-0.6103828063,-0.6115971639,-0.6128100824,-0.6140215589, + -0.6152315906,-0.6164401745,-0.6176473079,-0.6188529880,-0.6200572118,-0.6212599765,-0.6224612794,-0.6236611175,-0.6248594881,-0.6260563884,-0.6272518155,-0.6284457666,-0.6296382389,-0.6308292296,-0.6320187359,-0.6332067551, + -0.6343932842,-0.6355783205,-0.6367618612,-0.6379439036,-0.6391244449,-0.6403034822,-0.6414810128,-0.6426570340,-0.6438315429,-0.6450045368,-0.6461760130,-0.6473459686,-0.6485144010,-0.6496813074,-0.6508466850,-0.6520105311, + -0.6531728430,-0.6543336178,-0.6554928530,-0.6566505457,-0.6578066933,-0.6589612930,-0.6601143421,-0.6612658378,-0.6624157776,-0.6635641586,-0.6647109782,-0.6658562337,-0.6669999223,-0.6681420414,-0.6692825883,-0.6704215604, + -0.6715589548,-0.6726947691,-0.6738290004,-0.6749616461,-0.6760927036,-0.6772221701,-0.6783500431,-0.6794763199,-0.6806009978,-0.6817240742,-0.6828455464,-0.6839654118,-0.6850836678,-0.6862003117,-0.6873153409,-0.6884287528, + -0.6895405447,-0.6906507141,-0.6917592584,-0.6928661748,-0.6939714609,-0.6950751140,-0.6961771315,-0.6972775108,-0.6983762494,-0.6994733446,-0.7005687939,-0.7016625947,-0.7027547445,-0.7038452405,-0.7049340804,-0.7060212614, + -0.7071067812,-0.7081906370,-0.7092728264,-0.7103533469,-0.7114321957,-0.7125093706,-0.7135848688,-0.7146586879,-0.7157308253,-0.7168012785,-0.7178700451,-0.7189371224,-0.7200025080,-0.7210661993,-0.7221281939,-0.7231884893, + -0.7242470830,-0.7253039724,-0.7263591551,-0.7274126286,-0.7284643904,-0.7295144381,-0.7305627692,-0.7316093812,-0.7326542717,-0.7336974381,-0.7347388781,-0.7357785892,-0.7368165689,-0.7378528148,-0.7388873245,-0.7399200955, + -0.7409511254,-0.7419804117,-0.7430079521,-0.7440337442,-0.7450577854,-0.7460800735,-0.7471006060,-0.7481193805,-0.7491363945,-0.7501516458,-0.7511651319,-0.7521768504,-0.7531867990,-0.7541949753,-0.7552013769,-0.7562060014, + -0.7572088465,-0.7582099098,-0.7592091890,-0.7602066817,-0.7612023855,-0.7621962981,-0.7631884173,-0.7641787405,-0.7651672656,-0.7661539902,-0.7671389119,-0.7681220285,-0.7691033376,-0.7700828370,-0.7710605243,-0.7720363972, + -0.7730104534,-0.7739826906,-0.7749531066,-0.7759216990,-0.7768884657,-0.7778534042,-0.7788165124,-0.7797777879,-0.7807372286,-0.7816948321,-0.7826505962,-0.7836045186,-0.7845565972,-0.7855068296,-0.7864552136,-0.7874017470, + -0.7883464276,-0.7892892532,-0.7902302214,-0.7911693302,-0.7921065773,-0.7930419605,-0.7939754776,-0.7949071263,-0.7958369046,-0.7967648102,-0.7976908409,-0.7986149946,-0.7995372691,-0.8004576622,-0.8013761717,-0.8022927955, + -0.8032075315,-0.8041203774,-0.8050313311,-0.8059403906,-0.8068475535,-0.8077528179,-0.8086561816,-0.8095576424,-0.8104571983,-0.8113548470,-0.8122505866,-0.8131444148,-0.8140363297,-0.8149263291,-0.8158144108,-0.8167005729, + -0.8175848132,-0.8184671296,-0.8193475201,-0.8202259826,-0.8211025150,-0.8219771153,-0.8228497814,-0.8237205112,-0.8245893028,-0.8254561540,-0.8263210628,-0.8271840273,-0.8280450453,-0.8289041148,-0.8297612338,-0.8306164003, + -0.8314696123,-0.8323208678,-0.8331701647,-0.8340175011,-0.8348628750,-0.8357062844,-0.8365477272,-0.8373872016,-0.8382247056,-0.8390602371,-0.8398937942,-0.8407253750,-0.8415549774,-0.8423825996,-0.8432082396,-0.8440318955, + -0.8448535652,-0.8456732470,-0.8464909388,-0.8473066387,-0.8481203448,-0.8489320552,-0.8497417680,-0.8505494813,-0.8513551931,-0.8521589016,-0.8529606049,-0.8537603011,-0.8545579884,-0.8553536647,-0.8561473284,-0.8569389774, + -0.8577286100,-0.8585162243,-0.8593018184,-0.8600853904,-0.8608669386,-0.8616464611,-0.8624239561,-0.8631994217,-0.8639728561,-0.8647442575,-0.8655136241,-0.8662809540,-0.8670462455,-0.8678094968,-0.8685707060,-0.8693298713, + -0.8700869911,-0.8708420635,-0.8715950867,-0.8723460589,-0.8730949784,-0.8738418435,-0.8745866523,-0.8753294031,-0.8760700942,-0.8768087238,-0.8775452902,-0.8782797917,-0.8790122264,-0.8797425928,-0.8804708891,-0.8811971135, + -0.8819212643,-0.8826433400,-0.8833633387,-0.8840812587,-0.8847970984,-0.8855108561,-0.8862225301,-0.8869321188,-0.8876396204,-0.8883450333,-0.8890483559,-0.8897495864,-0.8904487232,-0.8911457648,-0.8918407094,-0.8925335554, + -0.8932243012,-0.8939129451,-0.8945994856,-0.8952839210,-0.8959662498,-0.8966464702,-0.8973245807,-0.8980005797,-0.8986744657,-0.8993462370,-0.9000158920,-0.9006834292,-0.9013488470,-0.9020121439,-0.9026733182,-0.9033323685, + -0.9039892931,-0.9046440906,-0.9052967593,-0.9059472978,-0.9065957045,-0.9072419779,-0.9078861165,-0.9085281187,-0.9091679831,-0.9098057081,-0.9104412923,-0.9110747341,-0.9117060320,-0.9123351846,-0.9129621904,-0.9135870479, + -0.9142097557,-0.9148303122,-0.9154487161,-0.9160649658,-0.9166790599,-0.9172909970,-0.9179007756,-0.9185083943,-0.9191138517,-0.9197171463,-0.9203182767,-0.9209172415,-0.9215140393,-0.9221086687,-0.9227011283,-0.9232914167, + -0.9238795325,-0.9244654743,-0.9250492408,-0.9256308305,-0.9262102421,-0.9267874743,-0.9273625257,-0.9279353948,-0.9285060805,-0.9290745813,-0.9296408958,-0.9302050229,-0.9307669611,-0.9313267091,-0.9318842656,-0.9324396293, + -0.9329927988,-0.9335437730,-0.9340925504,-0.9346391298,-0.9351835099,-0.9357256895,-0.9362656672,-0.9368034417,-0.9373390119,-0.9378723764,-0.9384035341,-0.9389324835,-0.9394592236,-0.9399837530,-0.9405060706,-0.9410261751, + -0.9415440652,-0.9420597398,-0.9425731976,-0.9430844375,-0.9435934582,-0.9441002585,-0.9446048373,-0.9451071933,-0.9456073254,-0.9461052324,-0.9466009131,-0.9470943664,-0.9475855910,-0.9480745859,-0.9485613499,-0.9490458819, + -0.9495281806,-0.9500082450,-0.9504860739,-0.9509616663,-0.9514350210,-0.9519061368,-0.9523750127,-0.9528416476,-0.9533060404,-0.9537681899,-0.9542280951,-0.9546857549,-0.9551411683,-0.9555943341,-0.9560452514,-0.9564939189, + -0.9569403357,-0.9573845008,-0.9578264130,-0.9582660714,-0.9587034749,-0.9591386225,-0.9595715131,-0.9600021457,-0.9604305194,-0.9608566331,-0.9612804858,-0.9617020765,-0.9621214043,-0.9625384680,-0.9629532669,-0.9633657998, + -0.9637760658,-0.9641840640,-0.9645897933,-0.9649932529,-0.9653944417,-0.9657933589,-0.9661900034,-0.9665843745,-0.9669764710,-0.9673662922,-0.9677538371,-0.9681391047,-0.9685220943,-0.9689028048,-0.9692812354,-0.9696573851, + -0.9700312532,-0.9704028387,-0.9707721407,-0.9711391584,-0.9715038910,-0.9718663375,-0.9722264971,-0.9725843689,-0.9729399522,-0.9732932461,-0.9736442497,-0.9739929622,-0.9743393828,-0.9746835107,-0.9750253451,-0.9753648851, + -0.9757021300,-0.9760370790,-0.9763697313,-0.9767000861,-0.9770281427,-0.9773539001,-0.9776773578,-0.9779985149,-0.9783173707,-0.9786339244,-0.9789481753,-0.9792601226,-0.9795697657,-0.9798771037,-0.9801821360,-0.9804848618, + -0.9807852804,-0.9810833912,-0.9813791933,-0.9816726862,-0.9819638691,-0.9822527414,-0.9825393023,-0.9828235512,-0.9831054874,-0.9833851103,-0.9836624192,-0.9839374134,-0.9842100924,-0.9844804554,-0.9847485018,-0.9850142310, + -0.9852776424,-0.9855387353,-0.9857975092,-0.9860539633,-0.9863080972,-0.9865599103,-0.9868094018,-0.9870565713,-0.9873014182,-0.9875439418,-0.9877841416,-0.9880220171,-0.9882575677,-0.9884907929,-0.9887216920,-0.9889502645, + -0.9891765100,-0.9894004278,-0.9896220175,-0.9898412785,-0.9900582103,-0.9902728124,-0.9904850843,-0.9906950254,-0.9909026354,-0.9911079137,-0.9913108598,-0.9915114733,-0.9917097537,-0.9919057004,-0.9920993131,-0.9922905913, + -0.9924795346,-0.9926661424,-0.9928504145,-0.9930323502,-0.9932119492,-0.9933892111,-0.9935641355,-0.9937367219,-0.9939069700,-0.9940748793,-0.9942404495,-0.9944036801,-0.9945645707,-0.9947231211,-0.9948793308,-0.9950331994, + -0.9951847267,-0.9953339121,-0.9954807555,-0.9956252564,-0.9957674145,-0.9959072294,-0.9960447009,-0.9961798286,-0.9963126122,-0.9964430514,-0.9965711458,-0.9966968952,-0.9968202993,-0.9969413578,-0.9970600703,-0.9971764367, + -0.9972904567,-0.9974021299,-0.9975114561,-0.9976184351,-0.9977230666,-0.9978253504,-0.9979252862,-0.9980228738,-0.9981181129,-0.9982110034,-0.9983015449,-0.9983897374,-0.9984755806,-0.9985590742,-0.9986402182,-0.9987190122, + -0.9987954562,-0.9988695499,-0.9989412932,-0.9990106859,-0.9990777278,-0.9991424187,-0.9992047586,-0.9992647473,-0.9993223846,-0.9993776704,-0.9994306046,-0.9994811870,-0.9995294175,-0.9995752960,-0.9996188225,-0.9996599967, + -0.9996988187,-0.9997352883,-0.9997694054,-0.9998011699,-0.9998305818,-0.9998576410,-0.9998823475,-0.9999047011,-0.9999247018,-0.9999423497,-0.9999576446,-0.9999705864,-0.9999811753,-0.9999894111,-0.9999952938,-0.9999988235, + -1.0000000000,-0.9999988235,-0.9999952938,-0.9999894111,-0.9999811753,-0.9999705864,-0.9999576446,-0.9999423497,-0.9999247018,-0.9999047011,-0.9998823475,-0.9998576410,-0.9998305818,-0.9998011699,-0.9997694054,-0.9997352883, + -0.9996988187,-0.9996599967,-0.9996188225,-0.9995752960,-0.9995294175,-0.9994811870,-0.9994306046,-0.9993776704,-0.9993223846,-0.9992647473,-0.9992047586,-0.9991424187,-0.9990777278,-0.9990106859,-0.9989412932,-0.9988695499, + -0.9987954562,-0.9987190122,-0.9986402182,-0.9985590742,-0.9984755806,-0.9983897374,-0.9983015449,-0.9982110034,-0.9981181129,-0.9980228738,-0.9979252862,-0.9978253504,-0.9977230666,-0.9976184351,-0.9975114561,-0.9974021299, + -0.9972904567,-0.9971764367,-0.9970600703,-0.9969413578,-0.9968202993,-0.9966968952,-0.9965711458,-0.9964430514,-0.9963126122,-0.9961798286,-0.9960447009,-0.9959072294,-0.9957674145,-0.9956252564,-0.9954807555,-0.9953339121, + -0.9951847267,-0.9950331994,-0.9948793308,-0.9947231211,-0.9945645707,-0.9944036801,-0.9942404495,-0.9940748793,-0.9939069700,-0.9937367219,-0.9935641355,-0.9933892111,-0.9932119492,-0.9930323502,-0.9928504145,-0.9926661424, + -0.9924795346,-0.9922905913,-0.9920993131,-0.9919057004,-0.9917097537,-0.9915114733,-0.9913108598,-0.9911079137,-0.9909026354,-0.9906950254,-0.9904850843,-0.9902728124,-0.9900582103,-0.9898412785,-0.9896220175,-0.9894004278, + -0.9891765100,-0.9889502645,-0.9887216920,-0.9884907929,-0.9882575677,-0.9880220171,-0.9877841416,-0.9875439418,-0.9873014182,-0.9870565713,-0.9868094018,-0.9865599103,-0.9863080972,-0.9860539633,-0.9857975092,-0.9855387353, + -0.9852776424,-0.9850142310,-0.9847485018,-0.9844804554,-0.9842100924,-0.9839374134,-0.9836624192,-0.9833851103,-0.9831054874,-0.9828235512,-0.9825393023,-0.9822527414,-0.9819638691,-0.9816726862,-0.9813791933,-0.9810833912, + -0.9807852804,-0.9804848618,-0.9801821360,-0.9798771037,-0.9795697657,-0.9792601226,-0.9789481753,-0.9786339244,-0.9783173707,-0.9779985149,-0.9776773578,-0.9773539001,-0.9770281427,-0.9767000861,-0.9763697313,-0.9760370790, + -0.9757021300,-0.9753648851,-0.9750253451,-0.9746835107,-0.9743393828,-0.9739929622,-0.9736442497,-0.9732932461,-0.9729399522,-0.9725843689,-0.9722264971,-0.9718663375,-0.9715038910,-0.9711391584,-0.9707721407,-0.9704028387, + -0.9700312532,-0.9696573851,-0.9692812354,-0.9689028048,-0.9685220943,-0.9681391047,-0.9677538371,-0.9673662922,-0.9669764710,-0.9665843745,-0.9661900034,-0.9657933589,-0.9653944417,-0.9649932529,-0.9645897933,-0.9641840640, + -0.9637760658,-0.9633657998,-0.9629532669,-0.9625384680,-0.9621214043,-0.9617020765,-0.9612804858,-0.9608566331,-0.9604305194,-0.9600021457,-0.9595715131,-0.9591386225,-0.9587034749,-0.9582660714,-0.9578264130,-0.9573845008, + -0.9569403357,-0.9564939189,-0.9560452513,-0.9555943341,-0.9551411683,-0.9546857549,-0.9542280951,-0.9537681899,-0.9533060404,-0.9528416476,-0.9523750127,-0.9519061368,-0.9514350210,-0.9509616663,-0.9504860739,-0.9500082450, + -0.9495281806,-0.9490458819,-0.9485613499,-0.9480745859,-0.9475855910,-0.9470943664,-0.9466009131,-0.9461052324,-0.9456073254,-0.9451071933,-0.9446048373,-0.9441002585,-0.9435934582,-0.9430844375,-0.9425731976,-0.9420597398, + -0.9415440652,-0.9410261751,-0.9405060706,-0.9399837530,-0.9394592236,-0.9389324835,-0.9384035341,-0.9378723764,-0.9373390119,-0.9368034417,-0.9362656672,-0.9357256895,-0.9351835099,-0.9346391298,-0.9340925504,-0.9335437730, + -0.9329927988,-0.9324396293,-0.9318842656,-0.9313267091,-0.9307669611,-0.9302050229,-0.9296408958,-0.9290745813,-0.9285060805,-0.9279353948,-0.9273625257,-0.9267874743,-0.9262102421,-0.9256308305,-0.9250492408,-0.9244654743, + -0.9238795325,-0.9232914167,-0.9227011283,-0.9221086687,-0.9215140393,-0.9209172415,-0.9203182767,-0.9197171463,-0.9191138517,-0.9185083943,-0.9179007756,-0.9172909970,-0.9166790599,-0.9160649658,-0.9154487161,-0.9148303122, + -0.9142097557,-0.9135870479,-0.9129621904,-0.9123351846,-0.9117060320,-0.9110747341,-0.9104412923,-0.9098057081,-0.9091679831,-0.9085281187,-0.9078861165,-0.9072419779,-0.9065957045,-0.9059472978,-0.9052967593,-0.9046440906, + -0.9039892931,-0.9033323685,-0.9026733182,-0.9020121439,-0.9013488470,-0.9006834292,-0.9000158920,-0.8993462370,-0.8986744657,-0.8980005797,-0.8973245807,-0.8966464702,-0.8959662498,-0.8952839210,-0.8945994856,-0.8939129451, + -0.8932243012,-0.8925335554,-0.8918407094,-0.8911457648,-0.8904487232,-0.8897495864,-0.8890483559,-0.8883450333,-0.8876396204,-0.8869321188,-0.8862225301,-0.8855108561,-0.8847970984,-0.8840812587,-0.8833633387,-0.8826433400, + -0.8819212643,-0.8811971135,-0.8804708891,-0.8797425928,-0.8790122264,-0.8782797917,-0.8775452902,-0.8768087238,-0.8760700942,-0.8753294031,-0.8745866523,-0.8738418435,-0.8730949784,-0.8723460589,-0.8715950867,-0.8708420635, + -0.8700869911,-0.8693298713,-0.8685707060,-0.8678094968,-0.8670462455,-0.8662809540,-0.8655136241,-0.8647442575,-0.8639728561,-0.8631994217,-0.8624239561,-0.8616464611,-0.8608669386,-0.8600853904,-0.8593018184,-0.8585162243, + -0.8577286100,-0.8569389774,-0.8561473284,-0.8553536647,-0.8545579884,-0.8537603011,-0.8529606049,-0.8521589016,-0.8513551931,-0.8505494813,-0.8497417680,-0.8489320552,-0.8481203448,-0.8473066387,-0.8464909388,-0.8456732470, + -0.8448535652,-0.8440318955,-0.8432082396,-0.8423825996,-0.8415549774,-0.8407253750,-0.8398937942,-0.8390602371,-0.8382247056,-0.8373872016,-0.8365477272,-0.8357062844,-0.8348628750,-0.8340175011,-0.8331701647,-0.8323208678, + -0.8314696123,-0.8306164003,-0.8297612338,-0.8289041148,-0.8280450453,-0.8271840273,-0.8263210628,-0.8254561540,-0.8245893028,-0.8237205112,-0.8228497814,-0.8219771153,-0.8211025150,-0.8202259826,-0.8193475201,-0.8184671296, + -0.8175848132,-0.8167005729,-0.8158144108,-0.8149263291,-0.8140363297,-0.8131444148,-0.8122505866,-0.8113548470,-0.8104571983,-0.8095576424,-0.8086561816,-0.8077528179,-0.8068475535,-0.8059403906,-0.8050313311,-0.8041203774, + -0.8032075315,-0.8022927955,-0.8013761717,-0.8004576622,-0.7995372691,-0.7986149946,-0.7976908409,-0.7967648102,-0.7958369046,-0.7949071263,-0.7939754776,-0.7930419605,-0.7921065773,-0.7911693302,-0.7902302214,-0.7892892532, + -0.7883464276,-0.7874017470,-0.7864552136,-0.7855068296,-0.7845565972,-0.7836045186,-0.7826505962,-0.7816948321,-0.7807372286,-0.7797777879,-0.7788165124,-0.7778534042,-0.7768884657,-0.7759216990,-0.7749531066,-0.7739826906, + -0.7730104534,-0.7720363972,-0.7710605243,-0.7700828370,-0.7691033376,-0.7681220285,-0.7671389119,-0.7661539902,-0.7651672656,-0.7641787405,-0.7631884173,-0.7621962981,-0.7612023855,-0.7602066817,-0.7592091890,-0.7582099098, + -0.7572088465,-0.7562060014,-0.7552013769,-0.7541949753,-0.7531867990,-0.7521768504,-0.7511651319,-0.7501516458,-0.7491363945,-0.7481193805,-0.7471006060,-0.7460800735,-0.7450577854,-0.7440337442,-0.7430079521,-0.7419804117, + -0.7409511254,-0.7399200955,-0.7388873245,-0.7378528148,-0.7368165689,-0.7357785892,-0.7347388781,-0.7336974381,-0.7326542717,-0.7316093812,-0.7305627692,-0.7295144381,-0.7284643904,-0.7274126286,-0.7263591551,-0.7253039724, + -0.7242470830,-0.7231884893,-0.7221281939,-0.7210661993,-0.7200025080,-0.7189371224,-0.7178700451,-0.7168012785,-0.7157308253,-0.7146586879,-0.7135848688,-0.7125093706,-0.7114321957,-0.7103533469,-0.7092728264,-0.7081906370, + -0.7071067812,-0.7060212614,-0.7049340804,-0.7038452405,-0.7027547445,-0.7016625947,-0.7005687939,-0.6994733446,-0.6983762494,-0.6972775108,-0.6961771315,-0.6950751140,-0.6939714609,-0.6928661748,-0.6917592584,-0.6906507141, + -0.6895405447,-0.6884287528,-0.6873153409,-0.6862003117,-0.6850836678,-0.6839654118,-0.6828455464,-0.6817240742,-0.6806009978,-0.6794763199,-0.6783500431,-0.6772221701,-0.6760927036,-0.6749616461,-0.6738290004,-0.6726947691, + -0.6715589548,-0.6704215604,-0.6692825883,-0.6681420414,-0.6669999223,-0.6658562337,-0.6647109782,-0.6635641586,-0.6624157776,-0.6612658378,-0.6601143421,-0.6589612930,-0.6578066933,-0.6566505457,-0.6554928530,-0.6543336178, + -0.6531728430,-0.6520105311,-0.6508466850,-0.6496813074,-0.6485144010,-0.6473459686,-0.6461760130,-0.6450045368,-0.6438315429,-0.6426570340,-0.6414810128,-0.6403034822,-0.6391244449,-0.6379439036,-0.6367618612,-0.6355783205, + -0.6343932842,-0.6332067550,-0.6320187359,-0.6308292296,-0.6296382389,-0.6284457666,-0.6272518155,-0.6260563884,-0.6248594881,-0.6236611175,-0.6224612794,-0.6212599765,-0.6200572118,-0.6188529880,-0.6176473079,-0.6164401745, + -0.6152315906,-0.6140215589,-0.6128100824,-0.6115971639,-0.6103828063,-0.6091670123,-0.6079497850,-0.6067311270,-0.6055110414,-0.6042895309,-0.6030665985,-0.6018422471,-0.6006164794,-0.5993892984,-0.5981607070,-0.5969307081, + -0.5956993045,-0.5944664992,-0.5932322950,-0.5919966950,-0.5907597019,-0.5895213186,-0.5882815482,-0.5870403935,-0.5857978575,-0.5845539430,-0.5833086529,-0.5820619903,-0.5808139581,-0.5795645591,-0.5783137964,-0.5770616729, + -0.5758081914,-0.5745533550,-0.5732971667,-0.5720396293,-0.5707807459,-0.5695205193,-0.5682589527,-0.5669960488,-0.5657318108,-0.5644662415,-0.5631993440,-0.5619311212,-0.5606615762,-0.5593907119,-0.5581185312,-0.5568450373, + -0.5555702330,-0.5542941215,-0.5530167056,-0.5517379884,-0.5504579729,-0.5491766622,-0.5478940592,-0.5466101669,-0.5453249884,-0.5440385267,-0.5427507849,-0.5414617659,-0.5401714727,-0.5388799085,-0.5375870763,-0.5362929791, + -0.5349976199,-0.5337010018,-0.5324031279,-0.5311040012,-0.5298036247,-0.5285020015,-0.5271991348,-0.5258950275,-0.5245896827,-0.5232831035,-0.5219752929,-0.5206662541,-0.5193559902,-0.5180445041,-0.5167317990,-0.5154178780, + -0.5141027442,-0.5127864006,-0.5114688504,-0.5101500967,-0.5088301425,-0.5075089911,-0.5061866453,-0.5048631085,-0.5035383837,-0.5022124740,-0.5008853826,-0.4995571125,-0.4982276670,-0.4968970490,-0.4955652618,-0.4942323085, + -0.4928981922,-0.4915629161,-0.4902264833,-0.4888888969,-0.4875501601,-0.4862102761,-0.4848692480,-0.4835270789,-0.4821837721,-0.4808393306,-0.4794937577,-0.4781470564,-0.4767992301,-0.4754502817,-0.4741002147,-0.4727490320, + -0.4713967368,-0.4700433325,-0.4686888220,-0.4673332087,-0.4659764958,-0.4646186863,-0.4632597836,-0.4618997907,-0.4605387110,-0.4591765475,-0.4578133036,-0.4564489824,-0.4550835871,-0.4537171210,-0.4523495872,-0.4509809890, + -0.4496113297,-0.4482406123,-0.4468688402,-0.4454960165,-0.4441221446,-0.4427472276,-0.4413712687,-0.4399942713,-0.4386162385,-0.4372371737,-0.4358570799,-0.4344759606,-0.4330938189,-0.4317106580,-0.4303264813,-0.4289412921, + -0.4275550934,-0.4261678887,-0.4247796812,-0.4233904741,-0.4220002708,-0.4206090744,-0.4192168884,-0.4178237158,-0.4164295601,-0.4150344245,-0.4136383122,-0.4122412267,-0.4108431711,-0.4094441487,-0.4080441629,-0.4066432169, + -0.4052413140,-0.4038384576,-0.4024346509,-0.4010298972,-0.3996241998,-0.3982175622,-0.3968099874,-0.3954014789,-0.3939920401,-0.3925816741,-0.3911703843,-0.3897581741,-0.3883450467,-0.3869310055,-0.3855160538,-0.3841001950, + -0.3826834324,-0.3812657692,-0.3798472089,-0.3784277548,-0.3770074102,-0.3755861785,-0.3741640630,-0.3727410670,-0.3713171940,-0.3698924471,-0.3684668300,-0.3670403457,-0.3656129978,-0.3641847896,-0.3627557244,-0.3613258056, + -0.3598950365,-0.3584634206,-0.3570309612,-0.3555976617,-0.3541635254,-0.3527285558,-0.3512927561,-0.3498561298,-0.3484186802,-0.3469804108,-0.3455413250,-0.3441014260,-0.3426607173,-0.3412192023,-0.3397768844,-0.3383337670, + -0.3368898534,-0.3354451471,-0.3339996514,-0.3325533699,-0.3311063058,-0.3296584625,-0.3282098436,-0.3267604523,-0.3253102922,-0.3238593665,-0.3224076788,-0.3209552324,-0.3195020308,-0.3180480774,-0.3165933756,-0.3151379288, + -0.3136817404,-0.3122248139,-0.3107671527,-0.3093087603,-0.3078496400,-0.3063897954,-0.3049292297,-0.3034679466,-0.3020059493,-0.3005432414,-0.2990798263,-0.2976157074,-0.2961508882,-0.2946853722,-0.2932191627,-0.2917522632, + -0.2902846773,-0.2888164082,-0.2873474595,-0.2858778347,-0.2844075372,-0.2829365705,-0.2814649379,-0.2799926431,-0.2785196894,-0.2770460803,-0.2755718193,-0.2740969099,-0.2726213554,-0.2711451595,-0.2696683256,-0.2681908571, + -0.2667127575,-0.2652340303,-0.2637546790,-0.2622747070,-0.2607941179,-0.2593129151,-0.2578311022,-0.2563486825,-0.2548656596,-0.2533820370,-0.2518978182,-0.2504130066,-0.2489276057,-0.2474416192,-0.2459550503,-0.2444679027, + -0.2429801799,-0.2414918853,-0.2400030224,-0.2385135948,-0.2370236060,-0.2355330594,-0.2340419586,-0.2325503070,-0.2310581083,-0.2295653658,-0.2280720832,-0.2265782638,-0.2250839114,-0.2235890292,-0.2220936210,-0.2205976901, + -0.2191012402,-0.2176042746,-0.2161067971,-0.2146088110,-0.2131103199,-0.2116113274,-0.2101118369,-0.2086118520,-0.2071113762,-0.2056104131,-0.2041089661,-0.2026070388,-0.2011046348,-0.1996017576,-0.1980984107,-0.1965945977, + -0.1950903220,-0.1935855873,-0.1920803970,-0.1905747548,-0.1890686641,-0.1875621286,-0.1860551517,-0.1845477369,-0.1830398880,-0.1815316083,-0.1800229014,-0.1785137709,-0.1770042204,-0.1754942534,-0.1739838734,-0.1724730840, + -0.1709618888,-0.1694502912,-0.1679382950,-0.1664259035,-0.1649131205,-0.1633999494,-0.1618863938,-0.1603724572,-0.1588581433,-0.1573434556,-0.1558283977,-0.1543129730,-0.1527971853,-0.1512810380,-0.1497645347,-0.1482476790, + -0.1467304745,-0.1452129247,-0.1436950332,-0.1421768035,-0.1406582393,-0.1391393442,-0.1376201216,-0.1361005752,-0.1345807085,-0.1330605252,-0.1315400287,-0.1300192227,-0.1284981108,-0.1269766965,-0.1254549834,-0.1239329751, + -0.1224106752,-0.1208880872,-0.1193652148,-0.1178420615,-0.1163186309,-0.1147949266,-0.1132709522,-0.1117467112,-0.1102222073,-0.1086974440,-0.1071724250,-0.1056471537,-0.1041216339,-0.1025958690,-0.1010698628,-0.0995436187, + -0.0980171403,-0.0964904314,-0.0949634953,-0.0934363358,-0.0919089565,-0.0903813609,-0.0888535526,-0.0873255352,-0.0857973123,-0.0842688876,-0.0827402645,-0.0812114468,-0.0796824380,-0.0781532416,-0.0766238614,-0.0750943008, + -0.0735645636,-0.0720346532,-0.0705045734,-0.0689743276,-0.0674439196,-0.0659133528,-0.0643826309,-0.0628517576,-0.0613207363,-0.0597895707,-0.0582582645,-0.0567268212,-0.0551952443,-0.0536635377,-0.0521317047,-0.0505997490, + -0.0490676743,-0.0475354842,-0.0460031821,-0.0444707719,-0.0429382569,-0.0414056410,-0.0398729276,-0.0383401204,-0.0368072229,-0.0352742389,-0.0337411719,-0.0322080254,-0.0306748032,-0.0291415088,-0.0276081458,-0.0260747178, + -0.0245412285,-0.0230076815,-0.0214740803,-0.0199404286,-0.0184067299,-0.0168729879,-0.0153392063,-0.0138053885,-0.0122715383,-0.0107376592,-0.0092037548,-0.0076698287,-0.0061358846,-0.0046019261,-0.0030679568,-0.0015339802, + 0.0000000000,0.0015339802,0.0030679568,0.0046019261,0.0061358846,0.0076698287,0.0092037548,0.0107376592,0.0122715383,0.0138053885,0.0153392063,0.0168729879,0.0184067299,0.0199404286,0.0214740803,0.0230076815, + 0.0245412285,0.0260747178,0.0276081458,0.0291415088,0.0306748032,0.0322080254,0.0337411719,0.0352742389,0.0368072229,0.0383401204,0.0398729276,0.0414056410,0.0429382569,0.0444707719,0.0460031821,0.0475354842, + 0.0490676743,0.0505997490,0.0521317047,0.0536635377,0.0551952443,0.0567268212,0.0582582645,0.0597895707,0.0613207363,0.0628517576,0.0643826309,0.0659133528,0.0674439196,0.0689743276,0.0705045734,0.0720346532, + 0.0735645636,0.0750943008,0.0766238614,0.0781532416,0.0796824380,0.0812114468,0.0827402645,0.0842688876,0.0857973123,0.0873255352,0.0888535526,0.0903813609,0.0919089565,0.0934363358,0.0949634953,0.0964904314, + 0.0980171403,0.0995436187,0.1010698628,0.1025958690,0.1041216339,0.1056471537,0.1071724250,0.1086974440,0.1102222073,0.1117467112,0.1132709522,0.1147949266,0.1163186309,0.1178420615,0.1193652148,0.1208880872, + 0.1224106752,0.1239329751,0.1254549834,0.1269766965,0.1284981108,0.1300192227,0.1315400287,0.1330605252,0.1345807085,0.1361005752,0.1376201216,0.1391393442,0.1406582393,0.1421768035,0.1436950332,0.1452129247, + 0.1467304745,0.1482476790,0.1497645347,0.1512810380,0.1527971853,0.1543129730,0.1558283977,0.1573434556,0.1588581433,0.1603724572,0.1618863938,0.1633999494,0.1649131205,0.1664259035,0.1679382950,0.1694502912, + 0.1709618888,0.1724730840,0.1739838734,0.1754942534,0.1770042204,0.1785137709,0.1800229014,0.1815316083,0.1830398880,0.1845477369,0.1860551517,0.1875621286,0.1890686642,0.1905747548,0.1920803971,0.1935855873, + 0.1950903220,0.1965945977,0.1980984107,0.1996017576,0.2011046348,0.2026070388,0.2041089661,0.2056104131,0.2071113762,0.2086118520,0.2101118369,0.2116113274,0.2131103199,0.2146088110,0.2161067971,0.2176042746, + 0.2191012402,0.2205976901,0.2220936210,0.2235890292,0.2250839114,0.2265782638,0.2280720832,0.2295653658,0.2310581083,0.2325503070,0.2340419586,0.2355330594,0.2370236060,0.2385135948,0.2400030224,0.2414918853, + 0.2429801799,0.2444679027,0.2459550503,0.2474416192,0.2489276057,0.2504130066,0.2518978182,0.2533820370,0.2548656596,0.2563486825,0.2578311022,0.2593129151,0.2607941179,0.2622747070,0.2637546790,0.2652340303, + 0.2667127575,0.2681908571,0.2696683256,0.2711451595,0.2726213555,0.2740969099,0.2755718193,0.2770460803,0.2785196894,0.2799926431,0.2814649379,0.2829365705,0.2844075372,0.2858778347,0.2873474595,0.2888164082, + 0.2902846773,0.2917522632,0.2932191627,0.2946853722,0.2961508882,0.2976157074,0.2990798263,0.3005432414,0.3020059493,0.3034679466,0.3049292297,0.3063897954,0.3078496400,0.3093087603,0.3107671527,0.3122248139, + 0.3136817404,0.3151379288,0.3165933756,0.3180480774,0.3195020308,0.3209552324,0.3224076788,0.3238593665,0.3253102922,0.3267604523,0.3282098436,0.3296584625,0.3311063058,0.3325533699,0.3339996514,0.3354451471, + 0.3368898534,0.3383337670,0.3397768844,0.3412192023,0.3426607173,0.3441014260,0.3455413250,0.3469804108,0.3484186802,0.3498561298,0.3512927561,0.3527285558,0.3541635254,0.3555976617,0.3570309612,0.3584634206, + 0.3598950365,0.3613258056,0.3627557244,0.3641847896,0.3656129978,0.3670403457,0.3684668300,0.3698924471,0.3713171940,0.3727410670,0.3741640630,0.3755861785,0.3770074102,0.3784277548,0.3798472089,0.3812657692, + 0.3826834324,0.3841001950,0.3855160538,0.3869310055,0.3883450467,0.3897581741,0.3911703843,0.3925816741,0.3939920401,0.3954014789,0.3968099874,0.3982175622,0.3996241998,0.4010298972,0.4024346509,0.4038384576, + 0.4052413140,0.4066432169,0.4080441629,0.4094441487,0.4108431711,0.4122412267,0.4136383122,0.4150344245,0.4164295601,0.4178237158,0.4192168884,0.4206090744,0.4220002708,0.4233904741,0.4247796812,0.4261678887, + 0.4275550934,0.4289412921,0.4303264813,0.4317106580,0.4330938189,0.4344759606,0.4358570799,0.4372371737,0.4386162385,0.4399942713,0.4413712687,0.4427472276,0.4441221446,0.4454960165,0.4468688402,0.4482406123, + 0.4496113297,0.4509809890,0.4523495872,0.4537171210,0.4550835871,0.4564489824,0.4578133036,0.4591765475,0.4605387110,0.4618997907,0.4632597836,0.4646186863,0.4659764958,0.4673332087,0.4686888220,0.4700433325, + 0.4713967368,0.4727490320,0.4741002147,0.4754502817,0.4767992301,0.4781470564,0.4794937577,0.4808393306,0.4821837721,0.4835270789,0.4848692480,0.4862102761,0.4875501601,0.4888888969,0.4902264833,0.4915629161, + 0.4928981922,0.4942323085,0.4955652618,0.4968970490,0.4982276670,0.4995571125,0.5008853826,0.5022124740,0.5035383837,0.5048631085,0.5061866453,0.5075089911,0.5088301425,0.5101500967,0.5114688504,0.5127864006, + 0.5141027442,0.5154178780,0.5167317990,0.5180445041,0.5193559902,0.5206662541,0.5219752929,0.5232831035,0.5245896827,0.5258950275,0.5271991348,0.5285020015,0.5298036247,0.5311040012,0.5324031279,0.5337010018, + 0.5349976199,0.5362929791,0.5375870763,0.5388799085,0.5401714727,0.5414617659,0.5427507849,0.5440385267,0.5453249884,0.5466101669,0.5478940592,0.5491766622,0.5504579729,0.5517379884,0.5530167056,0.5542941215, + 0.5555702330,0.5568450373,0.5581185312,0.5593907119,0.5606615762,0.5619311212,0.5631993440,0.5644662415,0.5657318108,0.5669960488,0.5682589527,0.5695205193,0.5707807459,0.5720396293,0.5732971667,0.5745533550, + 0.5758081914,0.5770616729,0.5783137964,0.5795645591,0.5808139581,0.5820619903,0.5833086529,0.5845539430,0.5857978575,0.5870403935,0.5882815482,0.5895213186,0.5907597019,0.5919966950,0.5932322950,0.5944664992, + 0.5956993045,0.5969307081,0.5981607070,0.5993892984,0.6006164794,0.6018422471,0.6030665985,0.6042895309,0.6055110414,0.6067311270,0.6079497850,0.6091670123,0.6103828063,0.6115971639,0.6128100824,0.6140215589, + 0.6152315906,0.6164401745,0.6176473079,0.6188529880,0.6200572118,0.6212599765,0.6224612794,0.6236611175,0.6248594881,0.6260563884,0.6272518155,0.6284457666,0.6296382389,0.6308292296,0.6320187359,0.6332067551, + 0.6343932842,0.6355783205,0.6367618612,0.6379439036,0.6391244449,0.6403034822,0.6414810128,0.6426570340,0.6438315429,0.6450045368,0.6461760130,0.6473459686,0.6485144010,0.6496813074,0.6508466850,0.6520105311, + 0.6531728430,0.6543336178,0.6554928530,0.6566505457,0.6578066933,0.6589612930,0.6601143421,0.6612658378,0.6624157776,0.6635641586,0.6647109782,0.6658562337,0.6669999223,0.6681420414,0.6692825883,0.6704215604, + 0.6715589548,0.6726947691,0.6738290004,0.6749616461,0.6760927036,0.6772221701,0.6783500431,0.6794763199,0.6806009978,0.6817240742,0.6828455464,0.6839654118,0.6850836678,0.6862003117,0.6873153409,0.6884287528, + 0.6895405447,0.6906507141,0.6917592584,0.6928661748,0.6939714609,0.6950751140,0.6961771315,0.6972775108,0.6983762494,0.6994733446,0.7005687939,0.7016625947,0.7027547445,0.7038452405,0.7049340804,0.7060212614, + 0.7071067812,0.7081906370,0.7092728264,0.7103533469,0.7114321957,0.7125093706,0.7135848688,0.7146586879,0.7157308253,0.7168012785,0.7178700451,0.7189371224,0.7200025080,0.7210661993,0.7221281939,0.7231884893, + 0.7242470830,0.7253039724,0.7263591551,0.7274126286,0.7284643904,0.7295144381,0.7305627692,0.7316093812,0.7326542717,0.7336974381,0.7347388781,0.7357785892,0.7368165689,0.7378528148,0.7388873245,0.7399200955, + 0.7409511254,0.7419804117,0.7430079521,0.7440337442,0.7450577854,0.7460800735,0.7471006060,0.7481193805,0.7491363945,0.7501516458,0.7511651319,0.7521768504,0.7531867990,0.7541949753,0.7552013769,0.7562060014, + 0.7572088465,0.7582099098,0.7592091890,0.7602066817,0.7612023855,0.7621962981,0.7631884173,0.7641787405,0.7651672656,0.7661539902,0.7671389119,0.7681220285,0.7691033376,0.7700828370,0.7710605243,0.7720363972, + 0.7730104534,0.7739826906,0.7749531066,0.7759216990,0.7768884657,0.7778534042,0.7788165124,0.7797777879,0.7807372286,0.7816948321,0.7826505962,0.7836045186,0.7845565972,0.7855068296,0.7864552136,0.7874017470, + 0.7883464276,0.7892892532,0.7902302214,0.7911693302,0.7921065773,0.7930419605,0.7939754776,0.7949071263,0.7958369046,0.7967648102,0.7976908409,0.7986149946,0.7995372691,0.8004576622,0.8013761717,0.8022927955, + 0.8032075315,0.8041203774,0.8050313311,0.8059403906,0.8068475535,0.8077528179,0.8086561816,0.8095576424,0.8104571983,0.8113548470,0.8122505866,0.8131444148,0.8140363297,0.8149263291,0.8158144108,0.8167005729, + 0.8175848132,0.8184671296,0.8193475201,0.8202259826,0.8211025150,0.8219771153,0.8228497814,0.8237205112,0.8245893028,0.8254561540,0.8263210628,0.8271840273,0.8280450453,0.8289041148,0.8297612338,0.8306164003, + 0.8314696123,0.8323208678,0.8331701647,0.8340175011,0.8348628750,0.8357062844,0.8365477272,0.8373872016,0.8382247056,0.8390602371,0.8398937942,0.8407253750,0.8415549774,0.8423825996,0.8432082396,0.8440318955, + 0.8448535652,0.8456732470,0.8464909388,0.8473066387,0.8481203448,0.8489320552,0.8497417680,0.8505494813,0.8513551931,0.8521589016,0.8529606049,0.8537603011,0.8545579884,0.8553536647,0.8561473284,0.8569389774, + 0.8577286100,0.8585162243,0.8593018184,0.8600853904,0.8608669386,0.8616464611,0.8624239561,0.8631994217,0.8639728561,0.8647442575,0.8655136241,0.8662809540,0.8670462455,0.8678094968,0.8685707060,0.8693298713, + 0.8700869911,0.8708420635,0.8715950867,0.8723460589,0.8730949784,0.8738418435,0.8745866523,0.8753294031,0.8760700942,0.8768087238,0.8775452902,0.8782797917,0.8790122264,0.8797425928,0.8804708891,0.8811971135, + 0.8819212643,0.8826433400,0.8833633387,0.8840812587,0.8847970984,0.8855108561,0.8862225301,0.8869321188,0.8876396204,0.8883450333,0.8890483559,0.8897495864,0.8904487232,0.8911457648,0.8918407094,0.8925335554, + 0.8932243012,0.8939129451,0.8945994856,0.8952839210,0.8959662498,0.8966464702,0.8973245807,0.8980005797,0.8986744657,0.8993462370,0.9000158920,0.9006834292,0.9013488470,0.9020121439,0.9026733182,0.9033323685, + 0.9039892931,0.9046440906,0.9052967593,0.9059472978,0.9065957045,0.9072419779,0.9078861165,0.9085281187,0.9091679831,0.9098057081,0.9104412923,0.9110747341,0.9117060320,0.9123351846,0.9129621904,0.9135870479, + 0.9142097557,0.9148303122,0.9154487161,0.9160649658,0.9166790599,0.9172909970,0.9179007756,0.9185083943,0.9191138517,0.9197171463,0.9203182767,0.9209172415,0.9215140393,0.9221086687,0.9227011283,0.9232914167, + 0.9238795325,0.9244654743,0.9250492408,0.9256308305,0.9262102421,0.9267874743,0.9273625257,0.9279353948,0.9285060805,0.9290745813,0.9296408958,0.9302050229,0.9307669611,0.9313267091,0.9318842656,0.9324396293, + 0.9329927988,0.9335437730,0.9340925504,0.9346391298,0.9351835099,0.9357256895,0.9362656672,0.9368034417,0.9373390119,0.9378723764,0.9384035341,0.9389324835,0.9394592236,0.9399837530,0.9405060706,0.9410261751, + 0.9415440652,0.9420597398,0.9425731976,0.9430844375,0.9435934582,0.9441002585,0.9446048373,0.9451071933,0.9456073254,0.9461052324,0.9466009131,0.9470943664,0.9475855910,0.9480745859,0.9485613499,0.9490458819, + 0.9495281806,0.9500082450,0.9504860739,0.9509616663,0.9514350210,0.9519061368,0.9523750127,0.9528416476,0.9533060404,0.9537681899,0.9542280951,0.9546857549,0.9551411683,0.9555943341,0.9560452514,0.9564939189, + 0.9569403357,0.9573845008,0.9578264130,0.9582660714,0.9587034749,0.9591386225,0.9595715131,0.9600021457,0.9604305194,0.9608566331,0.9612804858,0.9617020765,0.9621214043,0.9625384680,0.9629532669,0.9633657998, + 0.9637760658,0.9641840640,0.9645897933,0.9649932529,0.9653944417,0.9657933589,0.9661900034,0.9665843745,0.9669764710,0.9673662922,0.9677538371,0.9681391047,0.9685220943,0.9689028048,0.9692812354,0.9696573851, + 0.9700312532,0.9704028387,0.9707721407,0.9711391584,0.9715038910,0.9718663375,0.9722264971,0.9725843689,0.9729399522,0.9732932461,0.9736442497,0.9739929622,0.9743393828,0.9746835107,0.9750253451,0.9753648851, + 0.9757021300,0.9760370790,0.9763697313,0.9767000861,0.9770281427,0.9773539001,0.9776773578,0.9779985149,0.9783173707,0.9786339244,0.9789481753,0.9792601226,0.9795697657,0.9798771037,0.9801821360,0.9804848618, + 0.9807852804,0.9810833912,0.9813791933,0.9816726862,0.9819638691,0.9822527414,0.9825393023,0.9828235512,0.9831054874,0.9833851103,0.9836624192,0.9839374134,0.9842100924,0.9844804554,0.9847485018,0.9850142310, + 0.9852776424,0.9855387353,0.9857975092,0.9860539633,0.9863080972,0.9865599103,0.9868094018,0.9870565713,0.9873014182,0.9875439418,0.9877841416,0.9880220171,0.9882575677,0.9884907929,0.9887216920,0.9889502645, + 0.9891765100,0.9894004278,0.9896220175,0.9898412785,0.9900582103,0.9902728124,0.9904850843,0.9906950254,0.9909026354,0.9911079137,0.9913108598,0.9915114733,0.9917097537,0.9919057004,0.9920993131,0.9922905913, + 0.9924795346,0.9926661424,0.9928504145,0.9930323502,0.9932119492,0.9933892111,0.9935641355,0.9937367219,0.9939069700,0.9940748793,0.9942404495,0.9944036801,0.9945645707,0.9947231211,0.9948793308,0.9950331994, + 0.9951847267,0.9953339121,0.9954807555,0.9956252564,0.9957674145,0.9959072294,0.9960447009,0.9961798286,0.9963126122,0.9964430514,0.9965711458,0.9966968952,0.9968202993,0.9969413578,0.9970600703,0.9971764367, + 0.9972904567,0.9974021299,0.9975114561,0.9976184351,0.9977230666,0.9978253504,0.9979252862,0.9980228738,0.9981181129,0.9982110034,0.9983015449,0.9983897374,0.9984755806,0.9985590742,0.9986402182,0.9987190122, + 0.9987954562,0.9988695499,0.9989412932,0.9990106859,0.9990777278,0.9991424187,0.9992047586,0.9992647473,0.9993223846,0.9993776704,0.9994306046,0.9994811870,0.9995294175,0.9995752960,0.9996188225,0.9996599967, + 0.9996988187,0.9997352883,0.9997694054,0.9998011699,0.9998305818,0.9998576410,0.9998823475,0.9999047011,0.9999247018,0.9999423497,0.9999576446,0.9999705864,0.9999811753,0.9999894111,0.9999952938,0.9999988235, + }; + + diff --git a/src/libparsec/include/utl_fsin.h b/src/libparsec/include/utl_fsin.h new file mode 100644 index 0000000..d907eb2 --- /dev/null +++ b/src/libparsec/include/utl_fsin.h @@ -0,0 +1,261 @@ + + { + 0.0000000000,0.0015339802,0.0030679568,0.0046019261,0.0061358846,0.0076698287,0.0092037548,0.0107376592,0.0122715383,0.0138053885,0.0153392063,0.0168729879,0.0184067299,0.0199404286,0.0214740803,0.0230076815, + 0.0245412285,0.0260747178,0.0276081458,0.0291415088,0.0306748032,0.0322080254,0.0337411719,0.0352742389,0.0368072229,0.0383401204,0.0398729276,0.0414056410,0.0429382569,0.0444707719,0.0460031821,0.0475354842, + 0.0490676743,0.0505997490,0.0521317047,0.0536635377,0.0551952443,0.0567268212,0.0582582645,0.0597895707,0.0613207363,0.0628517576,0.0643826309,0.0659133528,0.0674439196,0.0689743276,0.0705045734,0.0720346532, + 0.0735645636,0.0750943008,0.0766238614,0.0781532416,0.0796824380,0.0812114468,0.0827402645,0.0842688876,0.0857973123,0.0873255352,0.0888535526,0.0903813609,0.0919089565,0.0934363358,0.0949634953,0.0964904314, + 0.0980171403,0.0995436187,0.1010698628,0.1025958690,0.1041216339,0.1056471537,0.1071724250,0.1086974440,0.1102222073,0.1117467112,0.1132709522,0.1147949266,0.1163186309,0.1178420615,0.1193652148,0.1208880872, + 0.1224106752,0.1239329751,0.1254549834,0.1269766965,0.1284981108,0.1300192227,0.1315400287,0.1330605252,0.1345807085,0.1361005752,0.1376201216,0.1391393442,0.1406582393,0.1421768035,0.1436950332,0.1452129247, + 0.1467304745,0.1482476790,0.1497645347,0.1512810380,0.1527971853,0.1543129730,0.1558283977,0.1573434556,0.1588581433,0.1603724572,0.1618863938,0.1633999494,0.1649131205,0.1664259035,0.1679382950,0.1694502912, + 0.1709618888,0.1724730840,0.1739838734,0.1754942534,0.1770042204,0.1785137709,0.1800229014,0.1815316083,0.1830398880,0.1845477369,0.1860551517,0.1875621286,0.1890686641,0.1905747548,0.1920803970,0.1935855873, + 0.1950903220,0.1965945977,0.1980984107,0.1996017576,0.2011046348,0.2026070388,0.2041089661,0.2056104131,0.2071113762,0.2086118520,0.2101118369,0.2116113274,0.2131103199,0.2146088110,0.2161067971,0.2176042746, + 0.2191012402,0.2205976901,0.2220936210,0.2235890292,0.2250839114,0.2265782638,0.2280720832,0.2295653658,0.2310581083,0.2325503070,0.2340419586,0.2355330594,0.2370236060,0.2385135948,0.2400030224,0.2414918853, + 0.2429801799,0.2444679027,0.2459550503,0.2474416192,0.2489276057,0.2504130066,0.2518978182,0.2533820370,0.2548656596,0.2563486825,0.2578311022,0.2593129151,0.2607941179,0.2622747070,0.2637546790,0.2652340303, + 0.2667127575,0.2681908571,0.2696683256,0.2711451595,0.2726213554,0.2740969099,0.2755718193,0.2770460803,0.2785196894,0.2799926431,0.2814649379,0.2829365705,0.2844075372,0.2858778347,0.2873474595,0.2888164082, + 0.2902846773,0.2917522632,0.2932191627,0.2946853722,0.2961508882,0.2976157074,0.2990798263,0.3005432414,0.3020059493,0.3034679466,0.3049292297,0.3063897954,0.3078496400,0.3093087603,0.3107671527,0.3122248139, + 0.3136817404,0.3151379288,0.3165933756,0.3180480774,0.3195020308,0.3209552324,0.3224076788,0.3238593665,0.3253102922,0.3267604523,0.3282098436,0.3296584625,0.3311063058,0.3325533699,0.3339996514,0.3354451471, + 0.3368898534,0.3383337670,0.3397768844,0.3412192023,0.3426607173,0.3441014260,0.3455413250,0.3469804108,0.3484186802,0.3498561298,0.3512927561,0.3527285558,0.3541635254,0.3555976617,0.3570309612,0.3584634206, + 0.3598950365,0.3613258056,0.3627557244,0.3641847896,0.3656129978,0.3670403457,0.3684668300,0.3698924471,0.3713171940,0.3727410670,0.3741640630,0.3755861785,0.3770074102,0.3784277548,0.3798472089,0.3812657692, + 0.3826834324,0.3841001950,0.3855160538,0.3869310055,0.3883450467,0.3897581741,0.3911703843,0.3925816741,0.3939920401,0.3954014789,0.3968099874,0.3982175622,0.3996241998,0.4010298972,0.4024346509,0.4038384576, + 0.4052413140,0.4066432169,0.4080441629,0.4094441487,0.4108431711,0.4122412267,0.4136383122,0.4150344245,0.4164295601,0.4178237158,0.4192168884,0.4206090744,0.4220002708,0.4233904741,0.4247796812,0.4261678887, + 0.4275550934,0.4289412921,0.4303264813,0.4317106580,0.4330938189,0.4344759606,0.4358570799,0.4372371737,0.4386162385,0.4399942713,0.4413712687,0.4427472276,0.4441221446,0.4454960165,0.4468688402,0.4482406123, + 0.4496113297,0.4509809890,0.4523495872,0.4537171210,0.4550835871,0.4564489824,0.4578133036,0.4591765475,0.4605387110,0.4618997907,0.4632597836,0.4646186863,0.4659764958,0.4673332087,0.4686888220,0.4700433325, + 0.4713967368,0.4727490320,0.4741002147,0.4754502817,0.4767992301,0.4781470564,0.4794937577,0.4808393306,0.4821837721,0.4835270789,0.4848692480,0.4862102761,0.4875501601,0.4888888969,0.4902264833,0.4915629161, + 0.4928981922,0.4942323085,0.4955652618,0.4968970490,0.4982276670,0.4995571125,0.5008853826,0.5022124740,0.5035383837,0.5048631085,0.5061866453,0.5075089911,0.5088301425,0.5101500967,0.5114688504,0.5127864006, + 0.5141027442,0.5154178780,0.5167317990,0.5180445041,0.5193559902,0.5206662541,0.5219752929,0.5232831035,0.5245896827,0.5258950275,0.5271991348,0.5285020015,0.5298036247,0.5311040012,0.5324031279,0.5337010018, + 0.5349976199,0.5362929791,0.5375870763,0.5388799085,0.5401714727,0.5414617659,0.5427507849,0.5440385267,0.5453249884,0.5466101669,0.5478940592,0.5491766622,0.5504579729,0.5517379884,0.5530167056,0.5542941215, + 0.5555702330,0.5568450373,0.5581185312,0.5593907119,0.5606615762,0.5619311212,0.5631993440,0.5644662415,0.5657318108,0.5669960488,0.5682589527,0.5695205193,0.5707807459,0.5720396293,0.5732971667,0.5745533550, + 0.5758081914,0.5770616729,0.5783137964,0.5795645591,0.5808139581,0.5820619903,0.5833086529,0.5845539430,0.5857978575,0.5870403935,0.5882815482,0.5895213186,0.5907597019,0.5919966950,0.5932322950,0.5944664992, + 0.5956993045,0.5969307081,0.5981607070,0.5993892984,0.6006164794,0.6018422471,0.6030665985,0.6042895309,0.6055110414,0.6067311270,0.6079497850,0.6091670123,0.6103828063,0.6115971639,0.6128100824,0.6140215589, + 0.6152315906,0.6164401745,0.6176473079,0.6188529880,0.6200572118,0.6212599765,0.6224612794,0.6236611175,0.6248594881,0.6260563884,0.6272518155,0.6284457666,0.6296382389,0.6308292296,0.6320187359,0.6332067551, + 0.6343932842,0.6355783205,0.6367618612,0.6379439036,0.6391244449,0.6403034822,0.6414810128,0.6426570340,0.6438315429,0.6450045368,0.6461760130,0.6473459686,0.6485144010,0.6496813074,0.6508466850,0.6520105311, + 0.6531728430,0.6543336178,0.6554928530,0.6566505457,0.6578066933,0.6589612930,0.6601143421,0.6612658378,0.6624157776,0.6635641586,0.6647109782,0.6658562337,0.6669999223,0.6681420414,0.6692825883,0.6704215604, + 0.6715589548,0.6726947691,0.6738290004,0.6749616461,0.6760927036,0.6772221701,0.6783500431,0.6794763199,0.6806009978,0.6817240742,0.6828455464,0.6839654118,0.6850836678,0.6862003117,0.6873153409,0.6884287528, + 0.6895405447,0.6906507141,0.6917592584,0.6928661748,0.6939714609,0.6950751140,0.6961771315,0.6972775108,0.6983762494,0.6994733446,0.7005687939,0.7016625947,0.7027547445,0.7038452405,0.7049340804,0.7060212614, + 0.7071067812,0.7081906370,0.7092728264,0.7103533469,0.7114321957,0.7125093706,0.7135848688,0.7146586879,0.7157308253,0.7168012785,0.7178700451,0.7189371224,0.7200025080,0.7210661993,0.7221281939,0.7231884893, + 0.7242470830,0.7253039724,0.7263591551,0.7274126286,0.7284643904,0.7295144381,0.7305627692,0.7316093812,0.7326542717,0.7336974381,0.7347388781,0.7357785892,0.7368165689,0.7378528148,0.7388873245,0.7399200955, + 0.7409511254,0.7419804117,0.7430079521,0.7440337442,0.7450577854,0.7460800735,0.7471006060,0.7481193805,0.7491363945,0.7501516458,0.7511651319,0.7521768504,0.7531867990,0.7541949753,0.7552013769,0.7562060014, + 0.7572088465,0.7582099098,0.7592091890,0.7602066817,0.7612023855,0.7621962981,0.7631884173,0.7641787405,0.7651672656,0.7661539902,0.7671389119,0.7681220285,0.7691033376,0.7700828370,0.7710605243,0.7720363972, + 0.7730104534,0.7739826906,0.7749531066,0.7759216990,0.7768884657,0.7778534042,0.7788165124,0.7797777879,0.7807372286,0.7816948321,0.7826505962,0.7836045186,0.7845565972,0.7855068296,0.7864552136,0.7874017470, + 0.7883464276,0.7892892532,0.7902302214,0.7911693302,0.7921065773,0.7930419605,0.7939754776,0.7949071263,0.7958369046,0.7967648102,0.7976908409,0.7986149946,0.7995372691,0.8004576622,0.8013761717,0.8022927955, + 0.8032075315,0.8041203774,0.8050313311,0.8059403906,0.8068475535,0.8077528179,0.8086561816,0.8095576424,0.8104571983,0.8113548470,0.8122505866,0.8131444148,0.8140363297,0.8149263291,0.8158144108,0.8167005729, + 0.8175848132,0.8184671296,0.8193475201,0.8202259826,0.8211025150,0.8219771153,0.8228497814,0.8237205112,0.8245893028,0.8254561540,0.8263210628,0.8271840273,0.8280450453,0.8289041148,0.8297612338,0.8306164003, + 0.8314696123,0.8323208678,0.8331701647,0.8340175011,0.8348628750,0.8357062844,0.8365477272,0.8373872016,0.8382247056,0.8390602371,0.8398937942,0.8407253750,0.8415549774,0.8423825996,0.8432082396,0.8440318955, + 0.8448535652,0.8456732470,0.8464909388,0.8473066387,0.8481203448,0.8489320552,0.8497417680,0.8505494813,0.8513551931,0.8521589016,0.8529606049,0.8537603011,0.8545579884,0.8553536647,0.8561473284,0.8569389774, + 0.8577286100,0.8585162243,0.8593018184,0.8600853904,0.8608669386,0.8616464611,0.8624239561,0.8631994217,0.8639728561,0.8647442575,0.8655136241,0.8662809540,0.8670462455,0.8678094968,0.8685707060,0.8693298713, + 0.8700869911,0.8708420635,0.8715950867,0.8723460589,0.8730949784,0.8738418435,0.8745866523,0.8753294031,0.8760700942,0.8768087238,0.8775452902,0.8782797917,0.8790122264,0.8797425928,0.8804708891,0.8811971135, + 0.8819212643,0.8826433400,0.8833633387,0.8840812587,0.8847970984,0.8855108561,0.8862225301,0.8869321188,0.8876396204,0.8883450333,0.8890483559,0.8897495864,0.8904487232,0.8911457648,0.8918407094,0.8925335554, + 0.8932243012,0.8939129451,0.8945994856,0.8952839210,0.8959662498,0.8966464702,0.8973245807,0.8980005797,0.8986744657,0.8993462370,0.9000158920,0.9006834292,0.9013488470,0.9020121439,0.9026733182,0.9033323685, + 0.9039892931,0.9046440906,0.9052967593,0.9059472978,0.9065957045,0.9072419779,0.9078861165,0.9085281187,0.9091679831,0.9098057081,0.9104412923,0.9110747341,0.9117060320,0.9123351846,0.9129621904,0.9135870479, + 0.9142097557,0.9148303122,0.9154487161,0.9160649658,0.9166790599,0.9172909970,0.9179007756,0.9185083943,0.9191138517,0.9197171463,0.9203182767,0.9209172415,0.9215140393,0.9221086687,0.9227011283,0.9232914167, + 0.9238795325,0.9244654743,0.9250492408,0.9256308305,0.9262102421,0.9267874743,0.9273625257,0.9279353948,0.9285060805,0.9290745813,0.9296408958,0.9302050229,0.9307669611,0.9313267091,0.9318842656,0.9324396293, + 0.9329927988,0.9335437730,0.9340925504,0.9346391298,0.9351835099,0.9357256895,0.9362656672,0.9368034417,0.9373390119,0.9378723764,0.9384035341,0.9389324835,0.9394592236,0.9399837530,0.9405060706,0.9410261751, + 0.9415440652,0.9420597398,0.9425731976,0.9430844375,0.9435934582,0.9441002585,0.9446048373,0.9451071933,0.9456073254,0.9461052324,0.9466009131,0.9470943664,0.9475855910,0.9480745859,0.9485613499,0.9490458819, + 0.9495281806,0.9500082450,0.9504860739,0.9509616663,0.9514350210,0.9519061368,0.9523750127,0.9528416476,0.9533060404,0.9537681899,0.9542280951,0.9546857549,0.9551411683,0.9555943341,0.9560452513,0.9564939189, + 0.9569403357,0.9573845008,0.9578264130,0.9582660714,0.9587034749,0.9591386225,0.9595715131,0.9600021457,0.9604305194,0.9608566331,0.9612804858,0.9617020765,0.9621214043,0.9625384680,0.9629532669,0.9633657998, + 0.9637760658,0.9641840640,0.9645897933,0.9649932529,0.9653944417,0.9657933589,0.9661900034,0.9665843745,0.9669764710,0.9673662922,0.9677538371,0.9681391047,0.9685220943,0.9689028048,0.9692812354,0.9696573851, + 0.9700312532,0.9704028387,0.9707721407,0.9711391584,0.9715038910,0.9718663375,0.9722264971,0.9725843689,0.9729399522,0.9732932461,0.9736442497,0.9739929622,0.9743393828,0.9746835107,0.9750253451,0.9753648851, + 0.9757021300,0.9760370790,0.9763697313,0.9767000861,0.9770281427,0.9773539001,0.9776773578,0.9779985149,0.9783173707,0.9786339244,0.9789481753,0.9792601226,0.9795697657,0.9798771037,0.9801821360,0.9804848618, + 0.9807852804,0.9810833912,0.9813791933,0.9816726862,0.9819638691,0.9822527414,0.9825393023,0.9828235512,0.9831054874,0.9833851103,0.9836624192,0.9839374134,0.9842100924,0.9844804554,0.9847485018,0.9850142310, + 0.9852776424,0.9855387353,0.9857975092,0.9860539633,0.9863080972,0.9865599103,0.9868094018,0.9870565713,0.9873014182,0.9875439418,0.9877841416,0.9880220171,0.9882575677,0.9884907929,0.9887216920,0.9889502645, + 0.9891765100,0.9894004278,0.9896220175,0.9898412785,0.9900582103,0.9902728124,0.9904850843,0.9906950254,0.9909026354,0.9911079137,0.9913108598,0.9915114733,0.9917097537,0.9919057004,0.9920993131,0.9922905913, + 0.9924795346,0.9926661424,0.9928504145,0.9930323502,0.9932119492,0.9933892111,0.9935641355,0.9937367219,0.9939069700,0.9940748793,0.9942404495,0.9944036801,0.9945645707,0.9947231211,0.9948793308,0.9950331994, + 0.9951847267,0.9953339121,0.9954807555,0.9956252564,0.9957674145,0.9959072294,0.9960447009,0.9961798286,0.9963126122,0.9964430514,0.9965711458,0.9966968952,0.9968202993,0.9969413578,0.9970600703,0.9971764367, + 0.9972904567,0.9974021299,0.9975114561,0.9976184351,0.9977230666,0.9978253504,0.9979252862,0.9980228738,0.9981181129,0.9982110034,0.9983015449,0.9983897374,0.9984755806,0.9985590742,0.9986402182,0.9987190122, + 0.9987954562,0.9988695499,0.9989412932,0.9990106859,0.9990777278,0.9991424187,0.9992047586,0.9992647473,0.9993223846,0.9993776704,0.9994306046,0.9994811870,0.9995294175,0.9995752960,0.9996188225,0.9996599967, + 0.9996988187,0.9997352883,0.9997694054,0.9998011699,0.9998305818,0.9998576410,0.9998823475,0.9999047011,0.9999247018,0.9999423497,0.9999576446,0.9999705864,0.9999811753,0.9999894111,0.9999952938,0.9999988235, + 1.0000000000,0.9999988235,0.9999952938,0.9999894111,0.9999811753,0.9999705864,0.9999576446,0.9999423497,0.9999247018,0.9999047011,0.9998823475,0.9998576410,0.9998305818,0.9998011699,0.9997694054,0.9997352883, + 0.9996988187,0.9996599967,0.9996188225,0.9995752960,0.9995294175,0.9994811870,0.9994306046,0.9993776704,0.9993223846,0.9992647473,0.9992047586,0.9991424187,0.9990777278,0.9990106859,0.9989412932,0.9988695499, + 0.9987954562,0.9987190122,0.9986402182,0.9985590742,0.9984755806,0.9983897374,0.9983015449,0.9982110034,0.9981181129,0.9980228738,0.9979252862,0.9978253504,0.9977230666,0.9976184351,0.9975114561,0.9974021299, + 0.9972904567,0.9971764367,0.9970600703,0.9969413578,0.9968202993,0.9966968952,0.9965711458,0.9964430514,0.9963126122,0.9961798286,0.9960447009,0.9959072294,0.9957674145,0.9956252564,0.9954807555,0.9953339121, + 0.9951847267,0.9950331994,0.9948793308,0.9947231211,0.9945645707,0.9944036801,0.9942404495,0.9940748793,0.9939069700,0.9937367219,0.9935641355,0.9933892111,0.9932119492,0.9930323502,0.9928504145,0.9926661424, + 0.9924795346,0.9922905913,0.9920993131,0.9919057004,0.9917097537,0.9915114733,0.9913108598,0.9911079137,0.9909026354,0.9906950254,0.9904850843,0.9902728124,0.9900582103,0.9898412785,0.9896220175,0.9894004278, + 0.9891765100,0.9889502645,0.9887216920,0.9884907929,0.9882575677,0.9880220171,0.9877841416,0.9875439418,0.9873014182,0.9870565713,0.9868094018,0.9865599103,0.9863080972,0.9860539633,0.9857975092,0.9855387353, + 0.9852776424,0.9850142310,0.9847485018,0.9844804554,0.9842100924,0.9839374134,0.9836624192,0.9833851103,0.9831054874,0.9828235512,0.9825393023,0.9822527414,0.9819638691,0.9816726862,0.9813791933,0.9810833912, + 0.9807852804,0.9804848618,0.9801821360,0.9798771037,0.9795697657,0.9792601226,0.9789481753,0.9786339244,0.9783173707,0.9779985149,0.9776773578,0.9773539001,0.9770281427,0.9767000861,0.9763697313,0.9760370790, + 0.9757021300,0.9753648851,0.9750253451,0.9746835107,0.9743393828,0.9739929622,0.9736442497,0.9732932461,0.9729399522,0.9725843689,0.9722264971,0.9718663375,0.9715038910,0.9711391584,0.9707721407,0.9704028387, + 0.9700312532,0.9696573851,0.9692812354,0.9689028048,0.9685220943,0.9681391047,0.9677538371,0.9673662922,0.9669764710,0.9665843745,0.9661900034,0.9657933589,0.9653944417,0.9649932529,0.9645897933,0.9641840640, + 0.9637760658,0.9633657998,0.9629532669,0.9625384680,0.9621214043,0.9617020765,0.9612804858,0.9608566331,0.9604305194,0.9600021457,0.9595715131,0.9591386225,0.9587034749,0.9582660714,0.9578264130,0.9573845008, + 0.9569403357,0.9564939189,0.9560452514,0.9555943341,0.9551411683,0.9546857549,0.9542280951,0.9537681899,0.9533060404,0.9528416476,0.9523750127,0.9519061368,0.9514350210,0.9509616663,0.9504860739,0.9500082450, + 0.9495281806,0.9490458819,0.9485613499,0.9480745859,0.9475855910,0.9470943664,0.9466009131,0.9461052324,0.9456073254,0.9451071933,0.9446048373,0.9441002585,0.9435934582,0.9430844375,0.9425731976,0.9420597398, + 0.9415440652,0.9410261751,0.9405060706,0.9399837530,0.9394592236,0.9389324835,0.9384035341,0.9378723764,0.9373390119,0.9368034417,0.9362656672,0.9357256895,0.9351835099,0.9346391298,0.9340925504,0.9335437730, + 0.9329927988,0.9324396293,0.9318842656,0.9313267091,0.9307669611,0.9302050229,0.9296408958,0.9290745813,0.9285060805,0.9279353948,0.9273625257,0.9267874743,0.9262102421,0.9256308305,0.9250492408,0.9244654743, + 0.9238795325,0.9232914167,0.9227011283,0.9221086687,0.9215140393,0.9209172415,0.9203182767,0.9197171463,0.9191138517,0.9185083943,0.9179007756,0.9172909970,0.9166790599,0.9160649658,0.9154487161,0.9148303122, + 0.9142097557,0.9135870479,0.9129621904,0.9123351846,0.9117060320,0.9110747341,0.9104412923,0.9098057081,0.9091679831,0.9085281187,0.9078861165,0.9072419779,0.9065957045,0.9059472978,0.9052967593,0.9046440906, + 0.9039892931,0.9033323685,0.9026733182,0.9020121439,0.9013488470,0.9006834292,0.9000158920,0.8993462370,0.8986744657,0.8980005797,0.8973245807,0.8966464702,0.8959662498,0.8952839210,0.8945994856,0.8939129451, + 0.8932243012,0.8925335554,0.8918407094,0.8911457648,0.8904487232,0.8897495864,0.8890483559,0.8883450333,0.8876396204,0.8869321188,0.8862225301,0.8855108561,0.8847970984,0.8840812587,0.8833633387,0.8826433400, + 0.8819212643,0.8811971135,0.8804708891,0.8797425928,0.8790122264,0.8782797917,0.8775452902,0.8768087238,0.8760700942,0.8753294031,0.8745866523,0.8738418435,0.8730949784,0.8723460589,0.8715950867,0.8708420635, + 0.8700869911,0.8693298713,0.8685707060,0.8678094968,0.8670462455,0.8662809540,0.8655136241,0.8647442575,0.8639728561,0.8631994217,0.8624239561,0.8616464611,0.8608669386,0.8600853904,0.8593018184,0.8585162243, + 0.8577286100,0.8569389774,0.8561473284,0.8553536647,0.8545579884,0.8537603011,0.8529606049,0.8521589016,0.8513551931,0.8505494813,0.8497417680,0.8489320552,0.8481203448,0.8473066387,0.8464909388,0.8456732470, + 0.8448535652,0.8440318955,0.8432082396,0.8423825996,0.8415549774,0.8407253750,0.8398937942,0.8390602371,0.8382247056,0.8373872016,0.8365477272,0.8357062844,0.8348628750,0.8340175011,0.8331701647,0.8323208678, + 0.8314696123,0.8306164003,0.8297612338,0.8289041148,0.8280450453,0.8271840273,0.8263210628,0.8254561540,0.8245893028,0.8237205112,0.8228497814,0.8219771153,0.8211025150,0.8202259826,0.8193475201,0.8184671296, + 0.8175848132,0.8167005729,0.8158144108,0.8149263291,0.8140363297,0.8131444148,0.8122505866,0.8113548470,0.8104571983,0.8095576424,0.8086561816,0.8077528179,0.8068475535,0.8059403906,0.8050313311,0.8041203774, + 0.8032075315,0.8022927955,0.8013761717,0.8004576622,0.7995372691,0.7986149946,0.7976908409,0.7967648102,0.7958369046,0.7949071263,0.7939754776,0.7930419605,0.7921065773,0.7911693302,0.7902302214,0.7892892532, + 0.7883464276,0.7874017470,0.7864552136,0.7855068296,0.7845565972,0.7836045186,0.7826505962,0.7816948321,0.7807372286,0.7797777879,0.7788165124,0.7778534042,0.7768884657,0.7759216990,0.7749531066,0.7739826906, + 0.7730104534,0.7720363972,0.7710605243,0.7700828370,0.7691033376,0.7681220285,0.7671389119,0.7661539902,0.7651672656,0.7641787405,0.7631884173,0.7621962981,0.7612023855,0.7602066817,0.7592091890,0.7582099098, + 0.7572088465,0.7562060014,0.7552013769,0.7541949753,0.7531867990,0.7521768504,0.7511651319,0.7501516458,0.7491363945,0.7481193805,0.7471006060,0.7460800735,0.7450577854,0.7440337442,0.7430079521,0.7419804117, + 0.7409511254,0.7399200955,0.7388873245,0.7378528148,0.7368165689,0.7357785892,0.7347388781,0.7336974381,0.7326542717,0.7316093812,0.7305627692,0.7295144381,0.7284643904,0.7274126286,0.7263591551,0.7253039724, + 0.7242470830,0.7231884893,0.7221281939,0.7210661993,0.7200025080,0.7189371224,0.7178700451,0.7168012785,0.7157308253,0.7146586879,0.7135848688,0.7125093706,0.7114321957,0.7103533469,0.7092728264,0.7081906370, + 0.7071067812,0.7060212614,0.7049340804,0.7038452405,0.7027547445,0.7016625947,0.7005687939,0.6994733446,0.6983762494,0.6972775108,0.6961771315,0.6950751140,0.6939714609,0.6928661748,0.6917592584,0.6906507141, + 0.6895405447,0.6884287528,0.6873153409,0.6862003117,0.6850836678,0.6839654118,0.6828455464,0.6817240742,0.6806009978,0.6794763199,0.6783500431,0.6772221701,0.6760927036,0.6749616461,0.6738290004,0.6726947691, + 0.6715589548,0.6704215604,0.6692825883,0.6681420414,0.6669999223,0.6658562337,0.6647109782,0.6635641586,0.6624157776,0.6612658378,0.6601143421,0.6589612930,0.6578066933,0.6566505457,0.6554928530,0.6543336178, + 0.6531728430,0.6520105311,0.6508466850,0.6496813074,0.6485144010,0.6473459686,0.6461760130,0.6450045368,0.6438315429,0.6426570340,0.6414810128,0.6403034822,0.6391244449,0.6379439036,0.6367618612,0.6355783205, + 0.6343932842,0.6332067551,0.6320187359,0.6308292296,0.6296382389,0.6284457666,0.6272518155,0.6260563884,0.6248594881,0.6236611175,0.6224612794,0.6212599765,0.6200572118,0.6188529880,0.6176473079,0.6164401745, + 0.6152315906,0.6140215589,0.6128100824,0.6115971639,0.6103828063,0.6091670123,0.6079497850,0.6067311270,0.6055110414,0.6042895309,0.6030665985,0.6018422471,0.6006164794,0.5993892984,0.5981607070,0.5969307081, + 0.5956993045,0.5944664992,0.5932322950,0.5919966950,0.5907597019,0.5895213186,0.5882815482,0.5870403935,0.5857978575,0.5845539430,0.5833086529,0.5820619903,0.5808139581,0.5795645591,0.5783137964,0.5770616729, + 0.5758081914,0.5745533550,0.5732971667,0.5720396293,0.5707807459,0.5695205193,0.5682589527,0.5669960488,0.5657318108,0.5644662415,0.5631993440,0.5619311212,0.5606615762,0.5593907119,0.5581185312,0.5568450373, + 0.5555702330,0.5542941215,0.5530167056,0.5517379884,0.5504579729,0.5491766622,0.5478940592,0.5466101669,0.5453249884,0.5440385267,0.5427507849,0.5414617659,0.5401714727,0.5388799085,0.5375870763,0.5362929791, + 0.5349976199,0.5337010018,0.5324031279,0.5311040012,0.5298036247,0.5285020015,0.5271991348,0.5258950275,0.5245896827,0.5232831035,0.5219752929,0.5206662541,0.5193559902,0.5180445041,0.5167317990,0.5154178780, + 0.5141027442,0.5127864006,0.5114688504,0.5101500967,0.5088301425,0.5075089911,0.5061866453,0.5048631085,0.5035383837,0.5022124740,0.5008853826,0.4995571125,0.4982276670,0.4968970490,0.4955652618,0.4942323085, + 0.4928981922,0.4915629161,0.4902264833,0.4888888969,0.4875501601,0.4862102761,0.4848692480,0.4835270789,0.4821837721,0.4808393306,0.4794937577,0.4781470564,0.4767992301,0.4754502817,0.4741002147,0.4727490320, + 0.4713967368,0.4700433325,0.4686888220,0.4673332087,0.4659764958,0.4646186863,0.4632597836,0.4618997907,0.4605387110,0.4591765475,0.4578133036,0.4564489824,0.4550835871,0.4537171210,0.4523495872,0.4509809890, + 0.4496113297,0.4482406123,0.4468688402,0.4454960165,0.4441221446,0.4427472276,0.4413712687,0.4399942713,0.4386162385,0.4372371737,0.4358570799,0.4344759606,0.4330938189,0.4317106580,0.4303264813,0.4289412921, + 0.4275550934,0.4261678887,0.4247796812,0.4233904741,0.4220002708,0.4206090744,0.4192168884,0.4178237158,0.4164295601,0.4150344245,0.4136383122,0.4122412267,0.4108431711,0.4094441487,0.4080441629,0.4066432169, + 0.4052413140,0.4038384576,0.4024346509,0.4010298972,0.3996241998,0.3982175622,0.3968099874,0.3954014789,0.3939920401,0.3925816741,0.3911703843,0.3897581741,0.3883450467,0.3869310055,0.3855160538,0.3841001950, + 0.3826834324,0.3812657692,0.3798472089,0.3784277548,0.3770074102,0.3755861785,0.3741640630,0.3727410670,0.3713171940,0.3698924471,0.3684668300,0.3670403457,0.3656129978,0.3641847896,0.3627557244,0.3613258056, + 0.3598950365,0.3584634206,0.3570309612,0.3555976617,0.3541635254,0.3527285558,0.3512927561,0.3498561298,0.3484186802,0.3469804108,0.3455413250,0.3441014260,0.3426607173,0.3412192023,0.3397768844,0.3383337670, + 0.3368898534,0.3354451471,0.3339996514,0.3325533699,0.3311063058,0.3296584625,0.3282098436,0.3267604523,0.3253102922,0.3238593665,0.3224076788,0.3209552324,0.3195020308,0.3180480774,0.3165933756,0.3151379288, + 0.3136817404,0.3122248139,0.3107671527,0.3093087603,0.3078496400,0.3063897954,0.3049292297,0.3034679466,0.3020059493,0.3005432414,0.2990798263,0.2976157074,0.2961508882,0.2946853722,0.2932191627,0.2917522632, + 0.2902846773,0.2888164082,0.2873474595,0.2858778347,0.2844075372,0.2829365705,0.2814649379,0.2799926431,0.2785196894,0.2770460803,0.2755718193,0.2740969099,0.2726213554,0.2711451595,0.2696683256,0.2681908571, + 0.2667127575,0.2652340303,0.2637546790,0.2622747070,0.2607941179,0.2593129151,0.2578311022,0.2563486825,0.2548656596,0.2533820370,0.2518978182,0.2504130066,0.2489276057,0.2474416192,0.2459550503,0.2444679027, + 0.2429801799,0.2414918853,0.2400030224,0.2385135948,0.2370236060,0.2355330594,0.2340419586,0.2325503070,0.2310581083,0.2295653658,0.2280720832,0.2265782638,0.2250839114,0.2235890292,0.2220936210,0.2205976901, + 0.2191012402,0.2176042746,0.2161067971,0.2146088110,0.2131103199,0.2116113274,0.2101118369,0.2086118520,0.2071113762,0.2056104131,0.2041089661,0.2026070388,0.2011046348,0.1996017576,0.1980984107,0.1965945977, + 0.1950903220,0.1935855873,0.1920803970,0.1905747548,0.1890686641,0.1875621286,0.1860551517,0.1845477369,0.1830398880,0.1815316083,0.1800229014,0.1785137709,0.1770042204,0.1754942534,0.1739838734,0.1724730840, + 0.1709618888,0.1694502912,0.1679382950,0.1664259035,0.1649131205,0.1633999494,0.1618863938,0.1603724572,0.1588581433,0.1573434556,0.1558283977,0.1543129730,0.1527971853,0.1512810380,0.1497645347,0.1482476790, + 0.1467304745,0.1452129247,0.1436950332,0.1421768035,0.1406582393,0.1391393442,0.1376201216,0.1361005752,0.1345807085,0.1330605252,0.1315400287,0.1300192227,0.1284981108,0.1269766965,0.1254549834,0.1239329751, + 0.1224106752,0.1208880872,0.1193652148,0.1178420615,0.1163186309,0.1147949266,0.1132709522,0.1117467112,0.1102222073,0.1086974440,0.1071724250,0.1056471537,0.1041216339,0.1025958690,0.1010698628,0.0995436187, + 0.0980171403,0.0964904314,0.0949634953,0.0934363358,0.0919089565,0.0903813609,0.0888535526,0.0873255352,0.0857973123,0.0842688876,0.0827402645,0.0812114468,0.0796824380,0.0781532416,0.0766238614,0.0750943008, + 0.0735645636,0.0720346532,0.0705045734,0.0689743276,0.0674439196,0.0659133528,0.0643826309,0.0628517576,0.0613207363,0.0597895707,0.0582582645,0.0567268212,0.0551952443,0.0536635377,0.0521317047,0.0505997490, + 0.0490676743,0.0475354842,0.0460031821,0.0444707719,0.0429382569,0.0414056410,0.0398729276,0.0383401204,0.0368072229,0.0352742389,0.0337411719,0.0322080254,0.0306748032,0.0291415088,0.0276081458,0.0260747178, + 0.0245412285,0.0230076815,0.0214740803,0.0199404286,0.0184067299,0.0168729879,0.0153392063,0.0138053885,0.0122715383,0.0107376592,0.0092037548,0.0076698287,0.0061358846,0.0046019261,0.0030679568,0.0015339802, + 0.0000000000,-0.0015339802,-0.0030679568,-0.0046019261,-0.0061358846,-0.0076698287,-0.0092037548,-0.0107376592,-0.0122715383,-0.0138053885,-0.0153392063,-0.0168729879,-0.0184067299,-0.0199404286,-0.0214740803,-0.0230076815, + -0.0245412285,-0.0260747178,-0.0276081458,-0.0291415088,-0.0306748032,-0.0322080254,-0.0337411719,-0.0352742389,-0.0368072229,-0.0383401204,-0.0398729276,-0.0414056410,-0.0429382569,-0.0444707719,-0.0460031821,-0.0475354842, + -0.0490676743,-0.0505997490,-0.0521317047,-0.0536635377,-0.0551952443,-0.0567268212,-0.0582582645,-0.0597895707,-0.0613207363,-0.0628517576,-0.0643826309,-0.0659133528,-0.0674439196,-0.0689743276,-0.0705045734,-0.0720346532, + -0.0735645636,-0.0750943008,-0.0766238614,-0.0781532416,-0.0796824380,-0.0812114468,-0.0827402645,-0.0842688876,-0.0857973123,-0.0873255352,-0.0888535526,-0.0903813609,-0.0919089565,-0.0934363358,-0.0949634953,-0.0964904314, + -0.0980171403,-0.0995436187,-0.1010698628,-0.1025958690,-0.1041216339,-0.1056471537,-0.1071724250,-0.1086974440,-0.1102222073,-0.1117467112,-0.1132709522,-0.1147949266,-0.1163186309,-0.1178420615,-0.1193652148,-0.1208880872, + -0.1224106752,-0.1239329751,-0.1254549834,-0.1269766965,-0.1284981108,-0.1300192227,-0.1315400287,-0.1330605252,-0.1345807085,-0.1361005752,-0.1376201216,-0.1391393442,-0.1406582393,-0.1421768035,-0.1436950332,-0.1452129247, + -0.1467304745,-0.1482476790,-0.1497645347,-0.1512810380,-0.1527971853,-0.1543129730,-0.1558283977,-0.1573434556,-0.1588581433,-0.1603724572,-0.1618863938,-0.1633999494,-0.1649131205,-0.1664259035,-0.1679382950,-0.1694502912, + -0.1709618888,-0.1724730840,-0.1739838734,-0.1754942534,-0.1770042204,-0.1785137709,-0.1800229014,-0.1815316083,-0.1830398880,-0.1845477369,-0.1860551517,-0.1875621286,-0.1890686641,-0.1905747548,-0.1920803971,-0.1935855873, + -0.1950903220,-0.1965945977,-0.1980984107,-0.1996017576,-0.2011046348,-0.2026070388,-0.2041089661,-0.2056104131,-0.2071113762,-0.2086118520,-0.2101118369,-0.2116113274,-0.2131103199,-0.2146088110,-0.2161067971,-0.2176042746, + -0.2191012402,-0.2205976901,-0.2220936210,-0.2235890292,-0.2250839114,-0.2265782638,-0.2280720832,-0.2295653658,-0.2310581083,-0.2325503070,-0.2340419586,-0.2355330594,-0.2370236060,-0.2385135948,-0.2400030224,-0.2414918853, + -0.2429801799,-0.2444679027,-0.2459550503,-0.2474416192,-0.2489276057,-0.2504130066,-0.2518978182,-0.2533820370,-0.2548656596,-0.2563486825,-0.2578311022,-0.2593129151,-0.2607941179,-0.2622747070,-0.2637546790,-0.2652340303, + -0.2667127575,-0.2681908571,-0.2696683256,-0.2711451595,-0.2726213555,-0.2740969099,-0.2755718193,-0.2770460803,-0.2785196894,-0.2799926431,-0.2814649379,-0.2829365705,-0.2844075372,-0.2858778347,-0.2873474595,-0.2888164082, + -0.2902846773,-0.2917522632,-0.2932191627,-0.2946853722,-0.2961508882,-0.2976157074,-0.2990798263,-0.3005432414,-0.3020059493,-0.3034679466,-0.3049292297,-0.3063897954,-0.3078496400,-0.3093087603,-0.3107671527,-0.3122248139, + -0.3136817404,-0.3151379288,-0.3165933756,-0.3180480774,-0.3195020308,-0.3209552324,-0.3224076788,-0.3238593665,-0.3253102922,-0.3267604523,-0.3282098436,-0.3296584625,-0.3311063058,-0.3325533699,-0.3339996514,-0.3354451471, + -0.3368898534,-0.3383337670,-0.3397768844,-0.3412192023,-0.3426607173,-0.3441014260,-0.3455413250,-0.3469804108,-0.3484186802,-0.3498561298,-0.3512927561,-0.3527285558,-0.3541635254,-0.3555976617,-0.3570309612,-0.3584634206, + -0.3598950365,-0.3613258056,-0.3627557244,-0.3641847896,-0.3656129978,-0.3670403457,-0.3684668300,-0.3698924471,-0.3713171940,-0.3727410670,-0.3741640630,-0.3755861785,-0.3770074102,-0.3784277548,-0.3798472089,-0.3812657692, + -0.3826834324,-0.3841001950,-0.3855160538,-0.3869310055,-0.3883450467,-0.3897581741,-0.3911703843,-0.3925816741,-0.3939920401,-0.3954014789,-0.3968099874,-0.3982175622,-0.3996241998,-0.4010298972,-0.4024346509,-0.4038384576, + -0.4052413140,-0.4066432169,-0.4080441629,-0.4094441487,-0.4108431711,-0.4122412267,-0.4136383122,-0.4150344245,-0.4164295601,-0.4178237158,-0.4192168884,-0.4206090744,-0.4220002708,-0.4233904741,-0.4247796812,-0.4261678887, + -0.4275550934,-0.4289412921,-0.4303264813,-0.4317106580,-0.4330938189,-0.4344759606,-0.4358570799,-0.4372371737,-0.4386162385,-0.4399942713,-0.4413712687,-0.4427472276,-0.4441221446,-0.4454960165,-0.4468688402,-0.4482406123, + -0.4496113297,-0.4509809890,-0.4523495872,-0.4537171210,-0.4550835871,-0.4564489824,-0.4578133036,-0.4591765475,-0.4605387110,-0.4618997907,-0.4632597836,-0.4646186863,-0.4659764958,-0.4673332087,-0.4686888220,-0.4700433325, + -0.4713967368,-0.4727490320,-0.4741002147,-0.4754502817,-0.4767992301,-0.4781470564,-0.4794937577,-0.4808393306,-0.4821837721,-0.4835270789,-0.4848692480,-0.4862102761,-0.4875501601,-0.4888888969,-0.4902264833,-0.4915629161, + -0.4928981922,-0.4942323085,-0.4955652618,-0.4968970490,-0.4982276670,-0.4995571125,-0.5008853826,-0.5022124740,-0.5035383837,-0.5048631085,-0.5061866453,-0.5075089911,-0.5088301425,-0.5101500967,-0.5114688504,-0.5127864006, + -0.5141027442,-0.5154178780,-0.5167317990,-0.5180445041,-0.5193559902,-0.5206662541,-0.5219752929,-0.5232831035,-0.5245896827,-0.5258950275,-0.5271991348,-0.5285020015,-0.5298036247,-0.5311040012,-0.5324031279,-0.5337010018, + -0.5349976199,-0.5362929791,-0.5375870763,-0.5388799085,-0.5401714727,-0.5414617659,-0.5427507849,-0.5440385267,-0.5453249884,-0.5466101669,-0.5478940592,-0.5491766622,-0.5504579729,-0.5517379884,-0.5530167056,-0.5542941215, + -0.5555702330,-0.5568450373,-0.5581185312,-0.5593907119,-0.5606615762,-0.5619311212,-0.5631993440,-0.5644662415,-0.5657318108,-0.5669960488,-0.5682589527,-0.5695205193,-0.5707807459,-0.5720396293,-0.5732971667,-0.5745533550, + -0.5758081914,-0.5770616729,-0.5783137964,-0.5795645591,-0.5808139581,-0.5820619903,-0.5833086529,-0.5845539430,-0.5857978575,-0.5870403935,-0.5882815482,-0.5895213186,-0.5907597019,-0.5919966950,-0.5932322950,-0.5944664992, + -0.5956993045,-0.5969307081,-0.5981607070,-0.5993892984,-0.6006164794,-0.6018422471,-0.6030665985,-0.6042895309,-0.6055110414,-0.6067311270,-0.6079497850,-0.6091670123,-0.6103828063,-0.6115971639,-0.6128100824,-0.6140215589, + -0.6152315906,-0.6164401745,-0.6176473079,-0.6188529880,-0.6200572118,-0.6212599765,-0.6224612794,-0.6236611175,-0.6248594881,-0.6260563884,-0.6272518155,-0.6284457666,-0.6296382389,-0.6308292296,-0.6320187359,-0.6332067551, + -0.6343932842,-0.6355783205,-0.6367618612,-0.6379439036,-0.6391244449,-0.6403034822,-0.6414810128,-0.6426570340,-0.6438315429,-0.6450045368,-0.6461760130,-0.6473459686,-0.6485144010,-0.6496813074,-0.6508466850,-0.6520105311, + -0.6531728430,-0.6543336178,-0.6554928530,-0.6566505457,-0.6578066933,-0.6589612930,-0.6601143421,-0.6612658378,-0.6624157776,-0.6635641586,-0.6647109782,-0.6658562337,-0.6669999223,-0.6681420414,-0.6692825883,-0.6704215604, + -0.6715589548,-0.6726947691,-0.6738290004,-0.6749616461,-0.6760927036,-0.6772221701,-0.6783500431,-0.6794763199,-0.6806009978,-0.6817240742,-0.6828455464,-0.6839654118,-0.6850836678,-0.6862003117,-0.6873153409,-0.6884287528, + -0.6895405447,-0.6906507141,-0.6917592584,-0.6928661748,-0.6939714609,-0.6950751140,-0.6961771315,-0.6972775108,-0.6983762494,-0.6994733446,-0.7005687939,-0.7016625947,-0.7027547445,-0.7038452405,-0.7049340804,-0.7060212614, + -0.7071067812,-0.7081906370,-0.7092728264,-0.7103533469,-0.7114321957,-0.7125093706,-0.7135848688,-0.7146586879,-0.7157308253,-0.7168012785,-0.7178700451,-0.7189371224,-0.7200025080,-0.7210661993,-0.7221281939,-0.7231884893, + -0.7242470830,-0.7253039724,-0.7263591551,-0.7274126286,-0.7284643904,-0.7295144381,-0.7305627692,-0.7316093812,-0.7326542717,-0.7336974381,-0.7347388781,-0.7357785892,-0.7368165689,-0.7378528148,-0.7388873245,-0.7399200955, + -0.7409511254,-0.7419804117,-0.7430079521,-0.7440337442,-0.7450577854,-0.7460800735,-0.7471006060,-0.7481193805,-0.7491363945,-0.7501516458,-0.7511651319,-0.7521768504,-0.7531867990,-0.7541949753,-0.7552013769,-0.7562060014, + -0.7572088465,-0.7582099098,-0.7592091890,-0.7602066817,-0.7612023855,-0.7621962981,-0.7631884173,-0.7641787405,-0.7651672656,-0.7661539902,-0.7671389119,-0.7681220285,-0.7691033376,-0.7700828370,-0.7710605243,-0.7720363972, + -0.7730104534,-0.7739826906,-0.7749531066,-0.7759216990,-0.7768884657,-0.7778534042,-0.7788165124,-0.7797777879,-0.7807372286,-0.7816948321,-0.7826505962,-0.7836045186,-0.7845565972,-0.7855068296,-0.7864552136,-0.7874017470, + -0.7883464276,-0.7892892532,-0.7902302214,-0.7911693302,-0.7921065773,-0.7930419605,-0.7939754776,-0.7949071263,-0.7958369046,-0.7967648102,-0.7976908409,-0.7986149946,-0.7995372691,-0.8004576622,-0.8013761717,-0.8022927955, + -0.8032075315,-0.8041203774,-0.8050313311,-0.8059403906,-0.8068475535,-0.8077528179,-0.8086561816,-0.8095576424,-0.8104571983,-0.8113548470,-0.8122505866,-0.8131444148,-0.8140363297,-0.8149263291,-0.8158144108,-0.8167005729, + -0.8175848132,-0.8184671296,-0.8193475201,-0.8202259826,-0.8211025150,-0.8219771153,-0.8228497814,-0.8237205112,-0.8245893028,-0.8254561540,-0.8263210628,-0.8271840273,-0.8280450453,-0.8289041148,-0.8297612338,-0.8306164003, + -0.8314696123,-0.8323208678,-0.8331701647,-0.8340175011,-0.8348628750,-0.8357062844,-0.8365477272,-0.8373872016,-0.8382247056,-0.8390602371,-0.8398937942,-0.8407253750,-0.8415549774,-0.8423825996,-0.8432082396,-0.8440318955, + -0.8448535652,-0.8456732470,-0.8464909388,-0.8473066387,-0.8481203448,-0.8489320552,-0.8497417680,-0.8505494813,-0.8513551931,-0.8521589016,-0.8529606049,-0.8537603011,-0.8545579884,-0.8553536647,-0.8561473284,-0.8569389774, + -0.8577286100,-0.8585162243,-0.8593018184,-0.8600853904,-0.8608669386,-0.8616464611,-0.8624239561,-0.8631994217,-0.8639728561,-0.8647442575,-0.8655136241,-0.8662809540,-0.8670462455,-0.8678094968,-0.8685707060,-0.8693298713, + -0.8700869911,-0.8708420635,-0.8715950867,-0.8723460589,-0.8730949784,-0.8738418435,-0.8745866523,-0.8753294031,-0.8760700942,-0.8768087238,-0.8775452902,-0.8782797917,-0.8790122264,-0.8797425928,-0.8804708891,-0.8811971135, + -0.8819212643,-0.8826433400,-0.8833633387,-0.8840812587,-0.8847970984,-0.8855108561,-0.8862225301,-0.8869321188,-0.8876396204,-0.8883450333,-0.8890483559,-0.8897495864,-0.8904487232,-0.8911457648,-0.8918407094,-0.8925335554, + -0.8932243012,-0.8939129451,-0.8945994856,-0.8952839210,-0.8959662498,-0.8966464702,-0.8973245807,-0.8980005797,-0.8986744657,-0.8993462370,-0.9000158920,-0.9006834292,-0.9013488470,-0.9020121439,-0.9026733182,-0.9033323685, + -0.9039892931,-0.9046440906,-0.9052967593,-0.9059472978,-0.9065957045,-0.9072419779,-0.9078861165,-0.9085281187,-0.9091679831,-0.9098057081,-0.9104412923,-0.9110747341,-0.9117060320,-0.9123351846,-0.9129621904,-0.9135870479, + -0.9142097557,-0.9148303122,-0.9154487161,-0.9160649658,-0.9166790599,-0.9172909970,-0.9179007756,-0.9185083943,-0.9191138517,-0.9197171463,-0.9203182767,-0.9209172415,-0.9215140393,-0.9221086687,-0.9227011283,-0.9232914167, + -0.9238795325,-0.9244654743,-0.9250492408,-0.9256308305,-0.9262102421,-0.9267874743,-0.9273625257,-0.9279353948,-0.9285060805,-0.9290745813,-0.9296408958,-0.9302050229,-0.9307669611,-0.9313267091,-0.9318842656,-0.9324396293, + -0.9329927988,-0.9335437730,-0.9340925504,-0.9346391298,-0.9351835099,-0.9357256895,-0.9362656672,-0.9368034417,-0.9373390119,-0.9378723764,-0.9384035341,-0.9389324835,-0.9394592236,-0.9399837530,-0.9405060706,-0.9410261751, + -0.9415440652,-0.9420597398,-0.9425731976,-0.9430844375,-0.9435934582,-0.9441002585,-0.9446048373,-0.9451071933,-0.9456073254,-0.9461052324,-0.9466009131,-0.9470943664,-0.9475855910,-0.9480745859,-0.9485613499,-0.9490458819, + -0.9495281806,-0.9500082450,-0.9504860739,-0.9509616663,-0.9514350210,-0.9519061368,-0.9523750127,-0.9528416476,-0.9533060404,-0.9537681899,-0.9542280951,-0.9546857549,-0.9551411683,-0.9555943341,-0.9560452514,-0.9564939189, + -0.9569403357,-0.9573845008,-0.9578264130,-0.9582660714,-0.9587034749,-0.9591386225,-0.9595715131,-0.9600021457,-0.9604305194,-0.9608566331,-0.9612804858,-0.9617020765,-0.9621214043,-0.9625384680,-0.9629532669,-0.9633657998, + -0.9637760658,-0.9641840640,-0.9645897933,-0.9649932529,-0.9653944417,-0.9657933589,-0.9661900034,-0.9665843745,-0.9669764710,-0.9673662922,-0.9677538371,-0.9681391047,-0.9685220943,-0.9689028048,-0.9692812354,-0.9696573851, + -0.9700312532,-0.9704028387,-0.9707721407,-0.9711391584,-0.9715038910,-0.9718663375,-0.9722264971,-0.9725843689,-0.9729399522,-0.9732932461,-0.9736442497,-0.9739929622,-0.9743393828,-0.9746835107,-0.9750253451,-0.9753648851, + -0.9757021300,-0.9760370790,-0.9763697313,-0.9767000861,-0.9770281427,-0.9773539001,-0.9776773578,-0.9779985149,-0.9783173707,-0.9786339244,-0.9789481753,-0.9792601226,-0.9795697657,-0.9798771037,-0.9801821360,-0.9804848618, + -0.9807852804,-0.9810833912,-0.9813791933,-0.9816726862,-0.9819638691,-0.9822527414,-0.9825393023,-0.9828235512,-0.9831054874,-0.9833851103,-0.9836624192,-0.9839374134,-0.9842100924,-0.9844804554,-0.9847485018,-0.9850142310, + -0.9852776424,-0.9855387353,-0.9857975092,-0.9860539633,-0.9863080972,-0.9865599103,-0.9868094018,-0.9870565713,-0.9873014182,-0.9875439418,-0.9877841416,-0.9880220171,-0.9882575677,-0.9884907929,-0.9887216920,-0.9889502645, + -0.9891765100,-0.9894004278,-0.9896220175,-0.9898412785,-0.9900582103,-0.9902728124,-0.9904850843,-0.9906950254,-0.9909026354,-0.9911079137,-0.9913108598,-0.9915114733,-0.9917097537,-0.9919057004,-0.9920993131,-0.9922905913, + -0.9924795346,-0.9926661424,-0.9928504145,-0.9930323502,-0.9932119492,-0.9933892111,-0.9935641355,-0.9937367219,-0.9939069700,-0.9940748793,-0.9942404495,-0.9944036801,-0.9945645707,-0.9947231211,-0.9948793308,-0.9950331994, + -0.9951847267,-0.9953339121,-0.9954807555,-0.9956252564,-0.9957674145,-0.9959072294,-0.9960447009,-0.9961798286,-0.9963126122,-0.9964430514,-0.9965711458,-0.9966968952,-0.9968202993,-0.9969413578,-0.9970600703,-0.9971764367, + -0.9972904567,-0.9974021299,-0.9975114561,-0.9976184351,-0.9977230666,-0.9978253504,-0.9979252862,-0.9980228738,-0.9981181129,-0.9982110034,-0.9983015449,-0.9983897374,-0.9984755806,-0.9985590742,-0.9986402182,-0.9987190122, + -0.9987954562,-0.9988695499,-0.9989412932,-0.9990106859,-0.9990777278,-0.9991424187,-0.9992047586,-0.9992647473,-0.9993223846,-0.9993776704,-0.9994306046,-0.9994811870,-0.9995294175,-0.9995752960,-0.9996188225,-0.9996599967, + -0.9996988187,-0.9997352883,-0.9997694054,-0.9998011699,-0.9998305818,-0.9998576410,-0.9998823475,-0.9999047011,-0.9999247018,-0.9999423497,-0.9999576446,-0.9999705864,-0.9999811753,-0.9999894111,-0.9999952938,-0.9999988235, + -1.0000000000,-0.9999988235,-0.9999952938,-0.9999894111,-0.9999811753,-0.9999705864,-0.9999576446,-0.9999423497,-0.9999247018,-0.9999047011,-0.9998823475,-0.9998576410,-0.9998305818,-0.9998011699,-0.9997694054,-0.9997352883, + -0.9996988187,-0.9996599967,-0.9996188225,-0.9995752960,-0.9995294175,-0.9994811870,-0.9994306046,-0.9993776704,-0.9993223846,-0.9992647473,-0.9992047586,-0.9991424187,-0.9990777278,-0.9990106859,-0.9989412932,-0.9988695499, + -0.9987954562,-0.9987190122,-0.9986402182,-0.9985590742,-0.9984755806,-0.9983897374,-0.9983015449,-0.9982110034,-0.9981181129,-0.9980228738,-0.9979252862,-0.9978253504,-0.9977230666,-0.9976184351,-0.9975114561,-0.9974021299, + -0.9972904567,-0.9971764367,-0.9970600703,-0.9969413578,-0.9968202993,-0.9966968952,-0.9965711458,-0.9964430514,-0.9963126122,-0.9961798286,-0.9960447009,-0.9959072294,-0.9957674145,-0.9956252564,-0.9954807555,-0.9953339121, + -0.9951847267,-0.9950331994,-0.9948793308,-0.9947231211,-0.9945645707,-0.9944036801,-0.9942404495,-0.9940748793,-0.9939069700,-0.9937367219,-0.9935641355,-0.9933892111,-0.9932119492,-0.9930323502,-0.9928504145,-0.9926661424, + -0.9924795346,-0.9922905913,-0.9920993131,-0.9919057004,-0.9917097537,-0.9915114733,-0.9913108598,-0.9911079137,-0.9909026354,-0.9906950254,-0.9904850843,-0.9902728124,-0.9900582103,-0.9898412785,-0.9896220175,-0.9894004278, + -0.9891765100,-0.9889502645,-0.9887216920,-0.9884907929,-0.9882575677,-0.9880220171,-0.9877841416,-0.9875439418,-0.9873014182,-0.9870565713,-0.9868094018,-0.9865599103,-0.9863080972,-0.9860539633,-0.9857975092,-0.9855387353, + -0.9852776424,-0.9850142310,-0.9847485018,-0.9844804554,-0.9842100924,-0.9839374134,-0.9836624192,-0.9833851103,-0.9831054874,-0.9828235512,-0.9825393023,-0.9822527414,-0.9819638691,-0.9816726862,-0.9813791933,-0.9810833912, + -0.9807852804,-0.9804848618,-0.9801821360,-0.9798771037,-0.9795697657,-0.9792601226,-0.9789481753,-0.9786339244,-0.9783173707,-0.9779985149,-0.9776773578,-0.9773539001,-0.9770281427,-0.9767000861,-0.9763697313,-0.9760370790, + -0.9757021300,-0.9753648851,-0.9750253451,-0.9746835107,-0.9743393828,-0.9739929622,-0.9736442497,-0.9732932461,-0.9729399522,-0.9725843689,-0.9722264971,-0.9718663375,-0.9715038910,-0.9711391584,-0.9707721407,-0.9704028387, + -0.9700312532,-0.9696573851,-0.9692812354,-0.9689028048,-0.9685220943,-0.9681391047,-0.9677538371,-0.9673662922,-0.9669764710,-0.9665843745,-0.9661900034,-0.9657933589,-0.9653944417,-0.9649932529,-0.9645897933,-0.9641840640, + -0.9637760658,-0.9633657998,-0.9629532669,-0.9625384680,-0.9621214043,-0.9617020765,-0.9612804858,-0.9608566331,-0.9604305194,-0.9600021457,-0.9595715131,-0.9591386225,-0.9587034749,-0.9582660714,-0.9578264130,-0.9573845008, + -0.9569403357,-0.9564939189,-0.9560452513,-0.9555943341,-0.9551411683,-0.9546857549,-0.9542280951,-0.9537681899,-0.9533060404,-0.9528416476,-0.9523750127,-0.9519061368,-0.9514350210,-0.9509616663,-0.9504860739,-0.9500082450, + -0.9495281806,-0.9490458819,-0.9485613499,-0.9480745859,-0.9475855910,-0.9470943664,-0.9466009131,-0.9461052324,-0.9456073254,-0.9451071933,-0.9446048373,-0.9441002585,-0.9435934582,-0.9430844375,-0.9425731976,-0.9420597398, + -0.9415440652,-0.9410261751,-0.9405060706,-0.9399837530,-0.9394592236,-0.9389324835,-0.9384035341,-0.9378723764,-0.9373390119,-0.9368034417,-0.9362656672,-0.9357256895,-0.9351835099,-0.9346391298,-0.9340925504,-0.9335437730, + -0.9329927988,-0.9324396293,-0.9318842656,-0.9313267091,-0.9307669611,-0.9302050229,-0.9296408958,-0.9290745813,-0.9285060805,-0.9279353948,-0.9273625257,-0.9267874743,-0.9262102421,-0.9256308305,-0.9250492408,-0.9244654743, + -0.9238795325,-0.9232914167,-0.9227011283,-0.9221086687,-0.9215140393,-0.9209172415,-0.9203182767,-0.9197171463,-0.9191138517,-0.9185083943,-0.9179007756,-0.9172909970,-0.9166790599,-0.9160649658,-0.9154487161,-0.9148303122, + -0.9142097557,-0.9135870479,-0.9129621904,-0.9123351846,-0.9117060320,-0.9110747341,-0.9104412923,-0.9098057081,-0.9091679831,-0.9085281187,-0.9078861165,-0.9072419779,-0.9065957045,-0.9059472978,-0.9052967593,-0.9046440906, + -0.9039892931,-0.9033323685,-0.9026733182,-0.9020121439,-0.9013488470,-0.9006834292,-0.9000158920,-0.8993462370,-0.8986744657,-0.8980005797,-0.8973245807,-0.8966464702,-0.8959662498,-0.8952839210,-0.8945994856,-0.8939129451, + -0.8932243012,-0.8925335554,-0.8918407094,-0.8911457648,-0.8904487232,-0.8897495864,-0.8890483559,-0.8883450333,-0.8876396204,-0.8869321188,-0.8862225301,-0.8855108561,-0.8847970984,-0.8840812587,-0.8833633387,-0.8826433400, + -0.8819212643,-0.8811971135,-0.8804708891,-0.8797425928,-0.8790122264,-0.8782797917,-0.8775452902,-0.8768087238,-0.8760700942,-0.8753294031,-0.8745866523,-0.8738418435,-0.8730949784,-0.8723460589,-0.8715950867,-0.8708420635, + -0.8700869911,-0.8693298713,-0.8685707060,-0.8678094968,-0.8670462455,-0.8662809540,-0.8655136241,-0.8647442575,-0.8639728561,-0.8631994217,-0.8624239561,-0.8616464611,-0.8608669386,-0.8600853904,-0.8593018184,-0.8585162243, + -0.8577286100,-0.8569389774,-0.8561473284,-0.8553536647,-0.8545579884,-0.8537603011,-0.8529606049,-0.8521589016,-0.8513551931,-0.8505494813,-0.8497417680,-0.8489320552,-0.8481203448,-0.8473066387,-0.8464909388,-0.8456732470, + -0.8448535652,-0.8440318955,-0.8432082396,-0.8423825996,-0.8415549774,-0.8407253750,-0.8398937942,-0.8390602371,-0.8382247056,-0.8373872016,-0.8365477272,-0.8357062844,-0.8348628750,-0.8340175011,-0.8331701647,-0.8323208678, + -0.8314696123,-0.8306164003,-0.8297612338,-0.8289041148,-0.8280450453,-0.8271840273,-0.8263210628,-0.8254561540,-0.8245893028,-0.8237205112,-0.8228497814,-0.8219771153,-0.8211025150,-0.8202259826,-0.8193475201,-0.8184671296, + -0.8175848132,-0.8167005729,-0.8158144108,-0.8149263291,-0.8140363297,-0.8131444148,-0.8122505866,-0.8113548470,-0.8104571983,-0.8095576424,-0.8086561816,-0.8077528179,-0.8068475535,-0.8059403906,-0.8050313311,-0.8041203774, + -0.8032075315,-0.8022927955,-0.8013761717,-0.8004576622,-0.7995372691,-0.7986149946,-0.7976908409,-0.7967648102,-0.7958369046,-0.7949071263,-0.7939754776,-0.7930419605,-0.7921065773,-0.7911693302,-0.7902302214,-0.7892892532, + -0.7883464276,-0.7874017470,-0.7864552136,-0.7855068296,-0.7845565972,-0.7836045186,-0.7826505962,-0.7816948321,-0.7807372286,-0.7797777879,-0.7788165124,-0.7778534042,-0.7768884657,-0.7759216990,-0.7749531066,-0.7739826906, + -0.7730104534,-0.7720363972,-0.7710605243,-0.7700828370,-0.7691033376,-0.7681220285,-0.7671389119,-0.7661539902,-0.7651672656,-0.7641787405,-0.7631884173,-0.7621962981,-0.7612023855,-0.7602066817,-0.7592091890,-0.7582099098, + -0.7572088465,-0.7562060014,-0.7552013769,-0.7541949753,-0.7531867990,-0.7521768504,-0.7511651319,-0.7501516458,-0.7491363945,-0.7481193805,-0.7471006060,-0.7460800735,-0.7450577854,-0.7440337442,-0.7430079521,-0.7419804117, + -0.7409511254,-0.7399200955,-0.7388873245,-0.7378528148,-0.7368165689,-0.7357785892,-0.7347388781,-0.7336974381,-0.7326542717,-0.7316093812,-0.7305627692,-0.7295144381,-0.7284643904,-0.7274126286,-0.7263591551,-0.7253039724, + -0.7242470830,-0.7231884893,-0.7221281939,-0.7210661993,-0.7200025080,-0.7189371224,-0.7178700451,-0.7168012785,-0.7157308253,-0.7146586879,-0.7135848688,-0.7125093706,-0.7114321957,-0.7103533469,-0.7092728264,-0.7081906370, + -0.7071067812,-0.7060212614,-0.7049340804,-0.7038452405,-0.7027547445,-0.7016625947,-0.7005687939,-0.6994733446,-0.6983762494,-0.6972775108,-0.6961771315,-0.6950751140,-0.6939714609,-0.6928661748,-0.6917592584,-0.6906507141, + -0.6895405447,-0.6884287528,-0.6873153409,-0.6862003117,-0.6850836678,-0.6839654118,-0.6828455464,-0.6817240742,-0.6806009978,-0.6794763199,-0.6783500431,-0.6772221701,-0.6760927036,-0.6749616461,-0.6738290004,-0.6726947691, + -0.6715589548,-0.6704215604,-0.6692825883,-0.6681420414,-0.6669999223,-0.6658562337,-0.6647109782,-0.6635641586,-0.6624157776,-0.6612658378,-0.6601143421,-0.6589612930,-0.6578066933,-0.6566505457,-0.6554928530,-0.6543336178, + -0.6531728430,-0.6520105311,-0.6508466850,-0.6496813074,-0.6485144010,-0.6473459686,-0.6461760130,-0.6450045368,-0.6438315429,-0.6426570340,-0.6414810128,-0.6403034822,-0.6391244449,-0.6379439036,-0.6367618612,-0.6355783205, + -0.6343932842,-0.6332067550,-0.6320187359,-0.6308292296,-0.6296382389,-0.6284457666,-0.6272518155,-0.6260563884,-0.6248594881,-0.6236611175,-0.6224612794,-0.6212599765,-0.6200572118,-0.6188529880,-0.6176473079,-0.6164401745, + -0.6152315906,-0.6140215589,-0.6128100824,-0.6115971639,-0.6103828063,-0.6091670123,-0.6079497850,-0.6067311270,-0.6055110414,-0.6042895309,-0.6030665985,-0.6018422471,-0.6006164794,-0.5993892984,-0.5981607070,-0.5969307081, + -0.5956993045,-0.5944664992,-0.5932322950,-0.5919966950,-0.5907597019,-0.5895213186,-0.5882815482,-0.5870403935,-0.5857978575,-0.5845539430,-0.5833086529,-0.5820619903,-0.5808139581,-0.5795645591,-0.5783137964,-0.5770616729, + -0.5758081914,-0.5745533550,-0.5732971667,-0.5720396293,-0.5707807459,-0.5695205193,-0.5682589527,-0.5669960488,-0.5657318108,-0.5644662415,-0.5631993440,-0.5619311212,-0.5606615762,-0.5593907119,-0.5581185312,-0.5568450373, + -0.5555702330,-0.5542941215,-0.5530167056,-0.5517379884,-0.5504579729,-0.5491766622,-0.5478940592,-0.5466101669,-0.5453249884,-0.5440385267,-0.5427507849,-0.5414617659,-0.5401714727,-0.5388799085,-0.5375870763,-0.5362929791, + -0.5349976199,-0.5337010018,-0.5324031279,-0.5311040012,-0.5298036247,-0.5285020015,-0.5271991348,-0.5258950275,-0.5245896827,-0.5232831035,-0.5219752929,-0.5206662541,-0.5193559902,-0.5180445041,-0.5167317990,-0.5154178780, + -0.5141027442,-0.5127864006,-0.5114688504,-0.5101500967,-0.5088301425,-0.5075089911,-0.5061866453,-0.5048631085,-0.5035383837,-0.5022124740,-0.5008853826,-0.4995571125,-0.4982276670,-0.4968970490,-0.4955652618,-0.4942323085, + -0.4928981922,-0.4915629161,-0.4902264833,-0.4888888969,-0.4875501601,-0.4862102761,-0.4848692480,-0.4835270789,-0.4821837721,-0.4808393306,-0.4794937577,-0.4781470564,-0.4767992301,-0.4754502817,-0.4741002147,-0.4727490320, + -0.4713967368,-0.4700433325,-0.4686888220,-0.4673332087,-0.4659764958,-0.4646186863,-0.4632597836,-0.4618997907,-0.4605387110,-0.4591765475,-0.4578133036,-0.4564489824,-0.4550835871,-0.4537171210,-0.4523495872,-0.4509809890, + -0.4496113297,-0.4482406123,-0.4468688402,-0.4454960165,-0.4441221446,-0.4427472276,-0.4413712687,-0.4399942713,-0.4386162385,-0.4372371737,-0.4358570799,-0.4344759606,-0.4330938189,-0.4317106580,-0.4303264813,-0.4289412921, + -0.4275550934,-0.4261678887,-0.4247796812,-0.4233904741,-0.4220002708,-0.4206090744,-0.4192168884,-0.4178237158,-0.4164295601,-0.4150344245,-0.4136383122,-0.4122412267,-0.4108431711,-0.4094441487,-0.4080441629,-0.4066432169, + -0.4052413140,-0.4038384576,-0.4024346509,-0.4010298972,-0.3996241998,-0.3982175622,-0.3968099874,-0.3954014789,-0.3939920401,-0.3925816741,-0.3911703843,-0.3897581741,-0.3883450467,-0.3869310055,-0.3855160538,-0.3841001950, + -0.3826834324,-0.3812657692,-0.3798472089,-0.3784277548,-0.3770074102,-0.3755861785,-0.3741640630,-0.3727410670,-0.3713171940,-0.3698924471,-0.3684668300,-0.3670403457,-0.3656129978,-0.3641847896,-0.3627557244,-0.3613258056, + -0.3598950365,-0.3584634206,-0.3570309612,-0.3555976617,-0.3541635254,-0.3527285558,-0.3512927561,-0.3498561298,-0.3484186802,-0.3469804108,-0.3455413250,-0.3441014260,-0.3426607173,-0.3412192023,-0.3397768844,-0.3383337670, + -0.3368898534,-0.3354451471,-0.3339996514,-0.3325533699,-0.3311063058,-0.3296584625,-0.3282098436,-0.3267604523,-0.3253102922,-0.3238593665,-0.3224076788,-0.3209552324,-0.3195020308,-0.3180480774,-0.3165933756,-0.3151379288, + -0.3136817404,-0.3122248139,-0.3107671527,-0.3093087603,-0.3078496400,-0.3063897954,-0.3049292297,-0.3034679466,-0.3020059493,-0.3005432414,-0.2990798263,-0.2976157074,-0.2961508882,-0.2946853722,-0.2932191627,-0.2917522632, + -0.2902846773,-0.2888164082,-0.2873474595,-0.2858778347,-0.2844075372,-0.2829365705,-0.2814649379,-0.2799926431,-0.2785196894,-0.2770460803,-0.2755718193,-0.2740969099,-0.2726213554,-0.2711451595,-0.2696683256,-0.2681908571, + -0.2667127575,-0.2652340303,-0.2637546790,-0.2622747070,-0.2607941179,-0.2593129151,-0.2578311022,-0.2563486825,-0.2548656596,-0.2533820370,-0.2518978182,-0.2504130066,-0.2489276057,-0.2474416192,-0.2459550503,-0.2444679027, + -0.2429801799,-0.2414918853,-0.2400030224,-0.2385135948,-0.2370236060,-0.2355330594,-0.2340419586,-0.2325503070,-0.2310581083,-0.2295653658,-0.2280720832,-0.2265782638,-0.2250839114,-0.2235890292,-0.2220936210,-0.2205976901, + -0.2191012402,-0.2176042746,-0.2161067971,-0.2146088110,-0.2131103199,-0.2116113274,-0.2101118369,-0.2086118520,-0.2071113762,-0.2056104131,-0.2041089661,-0.2026070388,-0.2011046348,-0.1996017576,-0.1980984107,-0.1965945977, + -0.1950903220,-0.1935855873,-0.1920803970,-0.1905747548,-0.1890686641,-0.1875621286,-0.1860551517,-0.1845477369,-0.1830398880,-0.1815316083,-0.1800229014,-0.1785137709,-0.1770042204,-0.1754942534,-0.1739838734,-0.1724730840, + -0.1709618888,-0.1694502912,-0.1679382950,-0.1664259035,-0.1649131205,-0.1633999494,-0.1618863938,-0.1603724572,-0.1588581433,-0.1573434556,-0.1558283977,-0.1543129730,-0.1527971853,-0.1512810380,-0.1497645347,-0.1482476790, + -0.1467304745,-0.1452129247,-0.1436950331,-0.1421768035,-0.1406582393,-0.1391393442,-0.1376201216,-0.1361005752,-0.1345807085,-0.1330605252,-0.1315400287,-0.1300192227,-0.1284981108,-0.1269766965,-0.1254549834,-0.1239329751, + -0.1224106752,-0.1208880872,-0.1193652148,-0.1178420615,-0.1163186309,-0.1147949266,-0.1132709522,-0.1117467112,-0.1102222073,-0.1086974440,-0.1071724250,-0.1056471537,-0.1041216339,-0.1025958690,-0.1010698628,-0.0995436187, + -0.0980171403,-0.0964904314,-0.0949634953,-0.0934363358,-0.0919089565,-0.0903813609,-0.0888535526,-0.0873255352,-0.0857973123,-0.0842688876,-0.0827402645,-0.0812114468,-0.0796824380,-0.0781532416,-0.0766238614,-0.0750943008, + -0.0735645636,-0.0720346532,-0.0705045734,-0.0689743276,-0.0674439196,-0.0659133528,-0.0643826309,-0.0628517576,-0.0613207363,-0.0597895707,-0.0582582645,-0.0567268212,-0.0551952443,-0.0536635377,-0.0521317047,-0.0505997490, + -0.0490676743,-0.0475354842,-0.0460031821,-0.0444707719,-0.0429382569,-0.0414056410,-0.0398729276,-0.0383401204,-0.0368072229,-0.0352742389,-0.0337411719,-0.0322080254,-0.0306748032,-0.0291415088,-0.0276081458,-0.0260747178, + -0.0245412285,-0.0230076815,-0.0214740803,-0.0199404286,-0.0184067299,-0.0168729879,-0.0153392063,-0.0138053885,-0.0122715383,-0.0107376592,-0.0092037548,-0.0076698287,-0.0061358846,-0.0046019261,-0.0030679568,-0.0015339802, + }; + + diff --git a/src/libparsec/include/utl_list.h b/src/libparsec/include/utl_list.h new file mode 100644 index 0000000..7bbb3a0 --- /dev/null +++ b/src/libparsec/include/utl_list.h @@ -0,0 +1,254 @@ +/* +* PARSEC HEADER: UTL_List.h +*/ + +#ifndef _UTL_LIST_H_ +#define _UTL_LIST_H_ + +#include <stdio.h> + + +// type for data in the list -------------------------------------------------- +// +typedef void* UTL_listdata; + +// struct defining one entry in the UTL_List ---------------------------------- +// +template <class T> +class UTL_listentry_s +{ +public: + T m_data; + UTL_listentry_s* m_pPrev; + UTL_listentry_s* m_pNext; +}; + +// class for holding a single linked list ------------------------------------- +// +template <class T> +class UTL_List { +protected: + UTL_listentry_s<T>* m_pHead; + UTL_listentry_s<T>* m_pTail; + int m_nNumEntries; + + // unlinkg an entry from the list + void _Unlink( UTL_listentry_s<T>* node ) + { + ASSERT( node != NULL ); + + // unlink from list + if ( node->m_pNext != NULL ) { + node->m_pNext->m_pPrev = node->m_pPrev; + } + if ( node->m_pPrev != NULL ) { + node->m_pPrev->m_pNext = node->m_pNext; + } + + // correct head/tail pointers + if ( node->m_pPrev == NULL ) { + ASSERT( node == m_pHead ); + m_pHead = node->m_pNext; + } + if ( node->m_pNext == NULL ) { + ASSERT( node == m_pTail ); + m_pTail = node->m_pPrev; + } + + m_nNumEntries--; + } + +public: + UTL_List() + { + m_pHead = NULL; + m_pTail = NULL; + m_nNumEntries = 0; + } + + ~UTL_List() + { + Clear(); + } + + // clear all entries in the list + void Clear() + { + UTL_listentry_s<T>* next; + for( UTL_listentry_s<T>* node = m_pHead; node != NULL; ) { + next = node->m_pNext; + delete node; + node = next; + } + m_nNumEntries = 0; + m_pHead = NULL; + m_pTail = NULL; + } + void RemoveAll() { Clear(); } + + // append an entry at the tail of the list + UTL_listentry_s<T>* AppendTail( T _data ) + { + UTL_listentry_s<T>* newentry = new UTL_listentry_s<T>; + newentry->m_data = _data; + newentry->m_pPrev = m_pTail; + newentry->m_pNext = NULL; + if ( m_pTail != NULL ) { + m_pTail->m_pNext = newentry; + m_pTail = newentry; + } else { + ASSERT( m_pHead == NULL ); + m_pHead = newentry; + m_pTail = newentry; + } + + m_nNumEntries++; + + return newentry; + } + + // append an entry at the head of the list + UTL_listentry_s<T>* AppendHead( T _data ) + { + UTL_listentry_s<T>* newentry = new UTL_listentry_s<T>; + newentry->m_data = _data; + newentry->m_pPrev = NULL; + newentry->m_pNext = m_pHead; + if ( m_pHead != NULL ) { + m_pHead->m_pPrev = newentry; + m_pHead = newentry; + } else { + ASSERT( m_pTail == NULL ); + m_pHead = newentry; + m_pTail = newentry; + } + + m_nNumEntries++; + + return newentry; + } + + // return the head entry of the list + UTL_listentry_s<T>* GetHead() const { return m_pHead; } + + // return the tail entry of the list + UTL_listentry_s<T>* GetTail() const { return m_pTail; } + + // find an entry with a specific data + UTL_listentry_s<T>* Find( T& data ) const + { + for( UTL_listentry_s<T>* node = m_pHead; node != NULL; ) { + if ( node->m_data == data ) { + return node; + } + node = node->m_pNext; + } + return NULL; + } + + + + // remove an entry specified by its data + //FIXME: evt. introduce key into UTL_listentry_s<T> + bool_t Remove( T& _data ) + { + UTL_listentry_s<T>* node = Find( _data ); + if ( node != NULL ) { + _Unlink( node ); + delete node; + return true; + } + + return false; + } + + // dump contents + void Dump() const + { + int nEntry = 0; + printf( "# of entries: %d", m_nNumEntries ); + for( UTL_listentry_s<T>* node = m_pHead; node != NULL; ) { + printf( "%03d: adress: %8x, data: %8x prev: %8x next: %8x\n", nEntry, (int)node, (int)node->m_data, (int)node->m_pPrev, (int)node->m_pNext ); + node = node->m_pNext; + nEntry++; + } + } + + // return the # of entries + int GetNumEntries() const + { + return m_nNumEntries; + } + + // return the entry at a specified index + UTL_listentry_s<T>* GetEntryAtIndex( int nIndex ) const + { + // TODO: MINGW32 fails on this for some reason... might have to look into why... + //ASSERT( ( nIndex >= 0 ) && ( nIndex < m_nNumEntries ) ); + int nEntry = 0; + for( UTL_listentry_s<T>* node = m_pHead; node != NULL; ) { + + if ( nEntry == nIndex ) { + return node; + } + + node = node->m_pNext; + nEntry++; + } + + return NULL; + } + + // remove entry from list, returns data in entry + T RemoveHead() + { + ASSERT( GetHead() != NULL ); + return RemoveEntry( GetHead() ); + } + + // remove tail entry from list, returns data in entry + T RemoveTail() + { + ASSERT( GetTail() != NULL ); + return RemoveEntry( GetTail() ); + } + + // remove entry from list, returns data in entry + T RemoveEntry( UTL_listentry_s<T>* entry ) + { + ASSERT( entry != NULL ); + _Unlink( entry ); + T data = entry->m_data; + delete entry; + return data; + } + + // call a function for each entry in the list, stop iteration upon fuction failing + void ForEach( int (*procfunc)( UTL_listentry_s<T>* node, void* param ), void* param ) + { + for( UTL_listentry_s<T>* node = m_pHead; node != NULL; ) { + + // call the processing function + if ( (*procfunc) (node, param ) == FALSE ) { + break; + } + + node = node->m_pNext; + } + } +}; + +/* +template <class T> +class UTL_ListWalker +{ +protected: + void* m_pData; +public: + UTL_ListWalker( ) + virtual void Callback( UTL_listentry_s<T>* entry ) = 0; +}; + +*/ +#endif // _UTL_LIST_H_ + diff --git a/src/libparsec/include/utl_logfile.h b/src/libparsec/include/utl_logfile.h new file mode 100644 index 0000000..ffd44cb --- /dev/null +++ b/src/libparsec/include/utl_logfile.h @@ -0,0 +1,53 @@ +/* + * PARSEC HEADER: utl_logfile.h + */ + +#ifndef _UTL_LOGFILE_H_ +#define _UTL_LOGFILE_H_ + +// max. length of temporary buffer -------------------------------------------- +// +#define MAX_LOG_BUFFER_LEN 4096 + +// class for logging information ---------------------------------------------- +// +class UTL_LogFile +{ +protected: + char m_szBuffer[ MAX_LOG_BUFFER_LEN + 1 ]; + size_t m_nBufferLen; + FILE* m_pFile; + refframe_t m_LastFlushRefframe; + +protected: + + // add an entry to the logfile + void _AddEntry( const char* szEntry, size_t len2 ); + +public: + + // standard ctor + UTL_LogFile( const char* szFilename = NULL ); + + // standard dtor + ~UTL_LogFile(); + + // open the logfile + int Open( const char* szFilename ); + + // printf like adding to the logfile + int printf( const char *format, ... ); + + // flush the buffer to the disk file + void Flush(); +}; + + +// external functions --------------------------------------------------------- +// + +// flush all registerd logfiles +void UTL_FlushRegisteredLogfiles(); + + +#endif // !_UTL_LOGFILE_H_ diff --git a/src/libparsec/include/utl_math.h b/src/libparsec/include/utl_math.h new file mode 100644 index 0000000..9fb5f93 --- /dev/null +++ b/src/libparsec/include/utl_math.h @@ -0,0 +1,438 @@ +/* + * PARSEC HEADER: x_math.h + */ + +#ifndef _X_MATH_H_ +#define _X_MATH_H_ + + +// ---------------------------------------------------------------------------- +// MATHEMATICS SUBSYSTEM - +// ---------------------------------------------------------------------------- + + +// thou shalt choose wise +#define USE_DOTPRODUCT_MACRO + + + +// matrix that can be used as destination (MAT2) +extern pXmatrx DestXmatrx; + +// interpolation info for remote player --------------------------------------- +// +struct playerlerp_s { + + fixed_t curspeed; + bams_t curyaw; + bams_t curpitch; + bams_t curroll; + geomv_t curslidehorz; + geomv_t curslidevert; + + Xmatrx dstposition; + geomv_t transvec_x; // delta vec during + geomv_t transvec_y; // transition + geomv_t transvec_z; + int transition; // time countdown + + Quaternion srcquat; // start of slerp + Quaternion dstquat; // end of slerp + float curalpha; // current slerp alpha + float incalpha; // delta for slerp alpha +}; + +// hermite arclen interpolation data ------------------------------------------ +// +struct Hermite_ArcLen +{ + int num_steps; + float* table_u; + float* table_s; + Vector3* table_Vecs; + float total_arc_len; +}; + +// external functions (MATH) + +void AdjointMtx( const Xmatrx smatrx, Xmatrx dmatrx ); + +void MtxMtxMUL( const Xmatrx matrxb, const Xmatrx matrxa, Xmatrx dmatrx ); +void MtxMtxMULt( const Xmatrx matrxb, const Xmatrx matrxa, Xmatrx dmatrx ); +void MtxVctMUL( const Xmatrx matrx, const Vector3 *svect, Vector3 *dvect ); +void MtxVctMULt( const Xmatrx matrx, const Vector3 *svect, Vector3 *dvect ); +void DirVctMUL( const Xmatrx matrx, geomv_t scalar, Vector3 *dvect ); +void RightVctMUL( const Xmatrx matrx, geomv_t scalar, Vector3 *dvect ); +void UpVctMUL( const Xmatrx matrx, geomv_t scalar, Vector3 *dvect ); +void VctReflect( const Vector3 *ivec, const Vector3 *normal, Vector3 *destvec ); +void CalcMovement( Vector3* move_offset, const Xmatrx frame, fixed_t forward, geomv_t horiz, geomv_t vert, refframe_t refframes ); + +void GetSinCos( dword angle, sincosval_s *resultp ); + +void ObjRotX( Xmatrx matrix, bams_t pitch ); +void ObjRotY( Xmatrx matrix, bams_t yaw ); +void ObjRotZ( Xmatrx matrix, bams_t roll ); +void CamRotX( Xmatrx matrix, bams_t pitch ); +void CamRotY( Xmatrx matrix, bams_t yaw ); +void CamRotZ( Xmatrx matrix, bams_t roll ); + +geomv_t DotProduct( const Vector3 *vect1, const Vector3 *vect2 ); +void CrossProduct( const Vector3 *vect1, const Vector3 *vect2, Vector3 *cproduct ); +void CrossProduct2( const geomv_t *vect1, const geomv_t *vect2, geomv_t *cproduct ); + +void ReOrthoMtx( Xmatrx matrix ); + +void ProcessObject( GenObject *object ); + + +// external functions (MAT2) + +geomv_t VctLen( Vector3 *vec ); +geomv_t VctLenX( Vector3 *vec ); +void NormVct( Vector3 *vec ); +void NormVctX( Vector3 *vec ); +void NormMtx( Xmatrx matrix ); +void ReOrthoNormMtx( Xmatrx matrix ); +void MakeIdMatrx( Xmatrx matrx ); +void MakeNonTranslationMatrx( const Xmatrx matrx, Xmatrx dmatrx ); +void CalcOrthoInverse( const Xmatrx matrx, Xmatrx dmatrx ); +void CalcObjSpaceCamera( const GenObject *objectp, Vector3 *cameravec ); +void TransformVolume( const Xmatrx matrx, Plane3 *vol_in, Plane3 *vol_out, dword cullmask ); +void BackTransformVolume( const Xmatrx matrx, Plane3 *vol_in, Plane3 *vol_out, dword cullmask ); + +int QuaternionIsUnit( const Quaternion *quat ); +int QuaternionIsUnit_f( const Quaternion_f *quat ); +void QuaternionMakeUnit( Quaternion *quat ); +void QuaternionMakeUnit_f( Quaternion_f *quat ); +void QuaternionInvertUnit( Quaternion *quat ); +void QuaternionInvertUnit_f( Quaternion_f *quat ); +void QuaternionInvertGeneral( Quaternion *quat ); +void QuaternionInvertGeneral_f( Quaternion_f *quat ); +void QuaternionFromMatrx( Quaternion *quat, const Xmatrx matrix ); +void QuaternionFromMatrx_f( Quaternion_f *quat, const Xmatrx matrix ); +void MatrxFromQuaternion( Xmatrx matrix, const Quaternion *quat ); +void MatrxFromQuaternion_f( Xmatrx matrix, const Quaternion_f *quat ); +void MatrxFromAngularDisplacement( Xmatrx matrix, bams_t angle, Vertex3 *axis ); +void QuaternionMUL( Quaternion *qd, const Quaternion *qb, const Quaternion *qa ); +void QuaternionMUL_f( Quaternion_f *qd, const Quaternion_f *qb, const Quaternion_f *qa ); +void QuaternionSlerp( Quaternion *qd, const Quaternion *qa, const Quaternion *qb, float alpha ); +void QuaternionSlerp_f( Quaternion_f *qd, const Quaternion_f *qa, const Quaternion_f *qb, float alpha ); +void QuaternionSlerpFrames( Xmatrx slerp_frame, Xmatrx start_frame, Xmatrx end_frame, float t ); +void CalcSlerpedMatrix( Xmatrx matrix, const playerlerp_s *playerlerp ); + +void Hermite_Interpolate( Vector3* dest, float t, const Vector3* start, const Vector3* end, const Vector3* start_tan, const Vector3* end_tan ); +Hermite_ArcLen* Hermite_ArcLen_InitData( int num_steps, const Vector3* start, const Vector3* end, const Vector3* start_tan, const Vector3* end_tan ); +void Hermite_ArcLen_KillData( Hermite_ArcLen* hermite_data ); +void Hermite_ArcLen_Interpolate( const Hermite_ArcLen* hermite_data, float s, Vector3* interp ); + +void DumpMatrix( Xmatrx mat ); + + +// geometric value MUL instruction -------------------------------------------- +// +#define GEOMV_MUL(a,b) ((a)*(b)) + + +// geometric value DIV instruction -------------------------------------------- +// +#define GEOMV_DIV(a,b) ((a)/(b)) + + +// dot product macro/function encapsulation ----------------------------------- +// +#ifdef USE_DOTPRODUCT_MACRO + #define DOT_PRODUCT(u,v) \ + (GEOMV_MUL((u)->X,(v)->X)+GEOMV_MUL((u)->Y,(v)->Y)+GEOMV_MUL((u)->Z,(v)->Z)) +#else + #define DOT_PRODUCT(u,v) DotProduct((u),(v)) +#endif + + +// make vector identity (NULL vector) ----------------------------------------- +// +inline +void MakeIdVector( Vector3& vec ) +{ + vec.X = vec.Y = vec.Z = GEOMV_0; +} + + +// fetch x vector of matrix --------------------------------------------------- +// +inline +void FetchXVector( const Xmatrx matrx, Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + vec->X = matrx[ 0 ][ 0 ]; + vec->Y = matrx[ 1 ][ 0 ]; + vec->Z = matrx[ 2 ][ 0 ]; +} + + +// fetch y vector of matrix --------------------------------------------------- +// +inline +void FetchYVector( const Xmatrx matrx, Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + vec->X = matrx[ 0 ][ 1 ]; + vec->Y = matrx[ 1 ][ 1 ]; + vec->Z = matrx[ 2 ][ 1 ]; +} + + +// fetch z vector of matrix --------------------------------------------------- +// +inline +void FetchZVector( const Xmatrx matrx, Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + vec->X = matrx[ 0 ][ 2 ]; + vec->Y = matrx[ 1 ][ 2 ]; + vec->Z = matrx[ 2 ][ 2 ]; +} + + +// fetch t vector of matrix (translation part) -------------------------------- +// +inline +void FetchTVector( const Xmatrx matrx, Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + vec->X = matrx[ 0 ][ 3 ]; + vec->Y = matrx[ 1 ][ 3 ]; + vec->Z = matrx[ 2 ][ 3 ]; +} + + +// store x vector of matrix --------------------------------------------------- +// +inline +void StoreXVector( Xmatrx matrx, const Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + matrx[ 0 ][ 0 ] = vec->X; + matrx[ 1 ][ 0 ] = vec->Y; + matrx[ 2 ][ 0 ] = vec->Z; +} + + +// store y vector of matrix --------------------------------------------------- +// +inline +void StoreYVector( Xmatrx matrx, const Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + matrx[ 0 ][ 1 ] = vec->X; + matrx[ 1 ][ 1 ] = vec->Y; + matrx[ 2 ][ 1 ] = vec->Z; +} + + +// store z vector of matrix --------------------------------------------------- +// +inline +void StoreZVector( Xmatrx matrx, const Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + matrx[ 0 ][ 2 ] = vec->X; + matrx[ 1 ][ 2 ] = vec->Y; + matrx[ 2 ][ 2 ] = vec->Z; +} + + +// store t vector of matrix (translation part) -------------------------------- +// +inline +void StoreTVector( Xmatrx matrx, const Vector3 *vec ) +{ + ASSERT( matrx != NULL ); + ASSERT( vec != NULL ); + + matrx[ 0 ][ 3 ] = vec->X; + matrx[ 1 ][ 3 ] = vec->Y; + matrx[ 2 ][ 3 ] = vec->Z; +} + + +// primitive vector arithmetics ----------------------------------------------- +// +#define VECADD(c,a,b) { \ + (c)->X = (a)->X+(b)->X; \ + (c)->Y = (a)->Y+(b)->Y; \ + (c)->Z = (a)->Z+(b)->Z; \ +} + +#define VECADD_UVW(c,a,b) { \ + (c)->X = (a)->X+(b)->X; \ + (c)->Y = (a)->Y+(b)->Y; \ + (c)->Z = (a)->Z+(b)->Z; \ + (c)->W = (a)->W+(b)->W; \ + (c)->U = (a)->U+(b)->U; \ + (c)->V = (a)->V+(b)->V; \ +} + +#define VECADD_RGBA(c,a,b) { \ + (c)->X = (a)->X+(b)->X; \ + (c)->Y = (a)->Y+(b)->Y; \ + (c)->Z = (a)->Z+(b)->Z; \ + (c)->R = (a)->R+(b)->R; \ + (c)->G = (a)->G+(b)->G; \ + (c)->B = (a)->B+(b)->B; \ + (c)->A = (a)->A+(b)->A; \ +} + +#define VECADD_UVW_RGBA(c,a,b) { \ + (c)->X = (a)->X+(b)->X; \ + (c)->Y = (a)->Y+(b)->Y; \ + (c)->Z = (a)->Z+(b)->Z; \ + (c)->W = (a)->W+(b)->W; \ + (c)->U = (a)->U+(b)->U; \ + (c)->V = (a)->V+(b)->V; \ + (c)->R = (a)->R+(b)->R; \ + (c)->G = (a)->G+(b)->G; \ + (c)->B = (a)->B+(b)->B; \ + (c)->A = (a)->A+(b)->A; \ +} + +#define VECSUB(c,a,b) { \ + (c)->X = (a)->X-(b)->X; \ + (c)->Y = (a)->Y-(b)->Y; \ + (c)->Z = (a)->Z-(b)->Z; \ +} + +#define VECSUB_UVW(c,a,b) { \ + (c)->X = (a)->X-(b)->X; \ + (c)->Y = (a)->Y-(b)->Y; \ + (c)->Z = (a)->Z-(b)->Z; \ + (c)->W = (a)->W-(b)->W; \ + (c)->U = (a)->U-(b)->U; \ + (c)->V = (a)->V-(b)->V; \ +} + +#define VECSUB_RGBA(c,a,b) { \ + (c)->X = (a)->X-(b)->X; \ + (c)->Y = (a)->Y-(b)->Y; \ + (c)->Z = (a)->Z-(b)->Z; \ + (c)->R = (a)->R-(b)->R; \ + (c)->G = (a)->G-(b)->G; \ + (c)->B = (a)->B-(b)->B; \ + (c)->A = (a)->A-(b)->A; \ +} + +#define VECSUB_UVW_RGBA(c,a,b) { \ + (c)->X = (a)->X-(b)->X; \ + (c)->Y = (a)->Y-(b)->Y; \ + (c)->Z = (a)->Z-(b)->Z; \ + (c)->W = (a)->W-(b)->W; \ + (c)->U = (a)->U-(b)->U; \ + (c)->V = (a)->V-(b)->V; \ + (c)->R = (a)->R-(b)->R; \ + (c)->G = (a)->G-(b)->G; \ + (c)->B = (a)->B-(b)->B; \ + (c)->A = (a)->A-(b)->A; \ +} + +// multiply vector with scalar ------------------------------------------------ +// +#define VECMULS(c,a,b) { \ + (c)->X = (b) * (a)->X; \ + (c)->Y = (b) * (a)->Y; \ + (c)->Z = (b) * (a)->Z; \ +} + + +// saxpy vector arithmetics --------------------------------------------------- +// + +// y = a*x+y (a is scalar) +#define SAXPY(a,x,y) { \ + (y)->X = GEOMV_MUL((a),(x)->X)+(y)->X; \ + (y)->Y = GEOMV_MUL((a),(x)->Y)+(y)->Y; \ + (y)->Z = GEOMV_MUL((a),(x)->Z)+(y)->Z; \ +} + +// c = a*x+y (a is scalar) +#define CSAXPY(c,a,x,y) { \ + (c)->X = GEOMV_MUL((a),(x)->X)+(y)->X; \ + (c)->Y = GEOMV_MUL((a),(x)->Y)+(y)->Y; \ + (c)->Z = GEOMV_MUL((a),(x)->Z)+(y)->Z; \ +} + +// c = a*x+y (a is scalar) +// also calculates [uvw] +#define CSAXPY_UVW(c,a,x,y) { \ + (c)->X = GEOMV_MUL((a),(x)->X)+(y)->X; \ + (c)->Y = GEOMV_MUL((a),(x)->Y)+(y)->Y; \ + (c)->Z = GEOMV_MUL((a),(x)->Z)+(y)->Z; \ + (c)->W = GEOMV_MUL((a),(x)->W)+(y)->W; \ + (c)->U = GEOMV_MUL((a),(x)->U)+(y)->U; \ + (c)->V = GEOMV_MUL((a),(x)->V)+(y)->V; \ +} + + +// accelerated dot product with plane normal (struct Plane3) ------------------ +// +#define PLANE_DOT(p,x) ( PLANE_AXIAL(p) ? \ + ( PLANE_AXISCOMP(p) * ((geomv_t*)x)[ PLANE_CMPAXIS(p) ] ) : \ + DOT_PRODUCT(PLANE_NORMAL(p),(x)) ) + + +// reject/accept point tests for a cull plane --------------------------------- +// +#define PLANEDIST_REJECTPOINT(p,b) ( \ + GEOMV_MUL( (b)->minmax[ (p)->reacx.reject[ 0 ] ], (p)->plane.X ) + \ + GEOMV_MUL( (b)->minmax[ (p)->reacx.reject[ 1 ] ], (p)->plane.Y ) + \ + GEOMV_MUL( (b)->minmax[ (p)->reacx.reject[ 2 ] ], (p)->plane.Z ) - \ + (p)->plane.D ) + +#define PLANEDIST_ACCEPTPOINT(p,b) ( \ + GEOMV_MUL( (b)->minmax[ (p)->reacx.accept[ 0 ] ], (p)->plane.X ) + \ + GEOMV_MUL( (b)->minmax[ (p)->reacx.accept[ 1 ] ], (p)->plane.Y ) + \ + GEOMV_MUL( (b)->minmax[ (p)->reacx.accept[ 2 ] ], (p)->plane.Z ) - \ + (p)->plane.D ) + + +// project 3-D vertex onto screen --------------------------------------------- +// +#define PROJECT_TO_SCREEN(v,s) { \ + (s).X = GEOMV_TO_COORD( GEOMV_DIV( (v).X, (v).Z ) ) + Screen_XOfs; \ + (s).Y = GEOMV_TO_COORD( GEOMV_DIV( (v).Y, (v).Z ) ) + Screen_YOfs; \ +} + + +// elementary transformations into screen space ------------------------------- +// +#define SCREENSPACE_XOZ(v,z) ( GEOMV_TO_COORD( GEOMV_MUL( (v).X, (z) ) ) + Screen_XOfs ) +#define SCREENSPACE_YOZ(v,z) ( GEOMV_TO_COORD( GEOMV_MUL( (v).Y, (z) ) ) + Screen_YOfs ) +#define SCREENSPACE_OOZ(v) ( GEOMV_DIV( GEOMV_1, (v).Z ) ) + + +// depth value calculation ---------------------------------------------------- +// +#ifdef FRACTIONAL_DEPTH_VALUES + #define DEPTHBUFF_VALUE(z) ( (depth_t) (z) ) + #define DEPTHBUFF_OOZ(z) ( (depth_t) GEOMV_DIV( GEOMV_1, (z) ) ) +#else + #define DEPTHBUFF_VALUE(z) ( (word)GEOMV_TO_FIXED(z) ) + #define DEPTHBUFF_OOZ(z) ( (word)GEOMV_TO_FIXED( GEOMV_DIV(GEOMV_1,(z)) ) ) +#endif + + +#endif // _X_MATH_H_ + + diff --git a/src/libparsec/include/utl_math2.h b/src/libparsec/include/utl_math2.h new file mode 100644 index 0000000..ab2a0fd --- /dev/null +++ b/src/libparsec/include/utl_math2.h @@ -0,0 +1,49 @@ +/* + * PARSEC HEADER: xac_mat2.h + */ + +#ifndef _XAC_MAT2_H_ +#define _XAC_MAT2_H_ + + +// xac_mat2.c implements the following functions +// --------------------------------------------- +// geomv_t VctLen( Vector3 *vec ); +// geomv_t VctLenX( Vector3 *vec ); +// void NormVct( Vertex3 *vec ); +// void NormVctX( Vertex3 *vec ); +// void NormMtx( Xmatrx matrix ); +// void MakeIdMatrx( Xmatrx matrx ); +// void MakeNonTranslationMatrx( const Xmatrx matrx, Xmatrx dmatrx ); +// void CalcOrthoInverse( const Xmatrx matrx, Xmatrx dmatrx ); +// void CalcObjSpaceCamera( const GenObject *objectp, Vertex3 *cameravec ); +// void TransformVolume( const Xmatrx matrx, Plane3 *vol_in, Plane3 *vol_out, dword cullmask ); +// void BackTransformVolume( const Xmatrx matrx, Plane3 *vol_in, Plane3 *vol_out, dword cullmask ); +// int QuaternionIsUnit( const Quaternion *quat ); +// int QuaternionIsUnit_f( const Quaternion_f *quat ); +// void QuaternionMakeUnit( Quaternion *quat ); +// void QuaternionMakeUnit_f( Quaternion_f *quat ); +// void QuaternionInvertUnit( Quaternion *quat ); +// void QuaternionInvertUnit_f( Quaternion_f *quat ); +// void QuaternionInvertGeneral( Quaternion *quat ); +// void QuaternionInvertGeneral_f( Quaternion_f *quat ); +// void QuaternionFromMatrx( Quaternion *quat, const Xmatrx matrix ); +// void QuaternionFromMatrx_f( Quaternion_f *quat, const Xmatrx matrix ); +// void MatrxFromQuaternion( Xmatrx matrix, const Quaternion *quat ); +// void MatrxFromQuaternion_f( Xmatrx matrix, const Quaternion_f *quat ); +// void MatrxFromAngularDisplacement( Xmatrx matrix, bams_t angle, Vertex3 *axis ); +// void QuaternionMUL( Quaternion *qd, const Quaternion *qb, const Quaternion *qa ); +// void QuaternionMUL_f( Quaternion_f *qd, const Quaternion_f *qb, const Quaternion_f *qa ); +// void QuaternionSlerp( Quaternion *qd, const Quaternion *qa, const Quaternion *qb, float alpha ); +// void QuaternionSlerp_f( Quaternion_f *qd, const Quaternion_f *qa, const Quaternion_f *qb, float alpha ); +// void Hermite_Interpolate( Vector3* dest, float t, const Vector3* start, const Vector3* end, const Vector3* start_tan, const Vector3* end_tan, float start_tan_scale, float end_tan_scale ); +// void DumpMatrix( Xmatrx mat ); + +// xac_mat2.c implements the following variables +// --------------------------------------------- +// extern pXmatrx DestXmatrx; + + +#endif // _XAC_MAT2_H_ + + diff --git a/src/libparsec/include/utl_model.h b/src/libparsec/include/utl_model.h new file mode 100644 index 0000000..030df4f --- /dev/null +++ b/src/libparsec/include/utl_model.h @@ -0,0 +1,59 @@ +/* + * PARSEC HEADER: x_model.h + */ + +#ifndef _X_MODEL_H_ +#define _X_MODEL_H_ + + +// ---------------------------------------------------------------------------- +// MODEL GEOMETRY SUBSYSTEM - +// ---------------------------------------------------------------------------- + + +// BSP group + +int BSP_FindColliderLine( CullBSPNode *tree, Vertex3 *v0, Vertex3 *v1, dword *colnode, geomv_t *colt ); + + +// CULL group + +void CULL_ReAcIndexBox3( ReAcIndexBox3 *reac, Plane3 *plane ); +void CULL_ReAcPointBox3( ReAcPointBox3 *reac, CullBox3 *cullbox, Plane3 *plane ); +void CULL_MakeVolumeCullVolume( Plane3 *volume, CullPlane3 *cullvolume, dword cullmask ); +int CULL_BoxAgainstCullVolume( CullBox3 *cullbox, CullPlane3 *volume, dword *cullmask ); +int CULL_BoxAgainstVolume( CullBox3 *cullbox, Plane3 *volume, dword *cullmask ); +int CULL_SphereAgainstVolume( Sphere3 *sphere, Plane3 *volume, dword *cullmask ); + + +// CLIP group + +IterPolygon3* CLIP_VolumeIterTriangle3( IterTriangle3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterTriangle3_UVW( IterTriangle3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterTriangle3_RGBA( IterTriangle3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterRectangle3( IterRectangle3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterRectangle3_UVW( IterRectangle3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterRectangle3_RGBA( IterRectangle3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterPolygon3( IterPolygon3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterPolygon3_UVW( IterPolygon3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_VolumeIterPolygon3_RGBA( IterPolygon3 *poly, Plane3 *volume, dword cullmask ); +IterPolygon3* CLIP_PlaneIterTriangle3( IterTriangle3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterTriangle3_UVW( IterTriangle3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterTriangle3_RGBA( IterTriangle3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterRectangle3( IterRectangle3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterRectangle3_UVW( IterRectangle3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterRectangle3_RGBA( IterRectangle3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterPolygon3( IterPolygon3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterPolygon3_UVW( IterPolygon3 *poly, Plane3 *plane ); +IterPolygon3* CLIP_PlaneIterPolygon3_RGBA( IterPolygon3 *poly, Plane3 *plane ); + +IterLine2* CLIP_RectangleIterLine2( IterLine2 *line, Rectangle2 *rect ); +IterLine3* CLIP_PlaneIterLine3( IterLine3 *line, Plane3 *plane ); + +GenObject* CLIP_VolumeGenObject( GenObject *clipobj, Plane3 *volume, dword cullmask ); +GenObject* CLIP_PlaneGenObject( GenObject *clipobj, Plane3 *plane ); + + +#endif // _X_MODEL_H_ + + |
