diff --git a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc index e92f532..b3f0122 100644 --- a/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc +++ b/reapi/extra/amxmodx/scripting/include/reapi_gamedll_const.inc @@ -6,7 +6,7 @@ // Returns 1, if round ended by expired time // NOTE: Use this for hookchain RG_RoundEnd with the parameter ScenarioEventEndRound:event -#define HadRoundExpired(event) (1< -T min(T a, T b) { return (a < b) ? a : b; } +const T& min(const T& a, const T& b) { return (a < b) ? a : b; } template -T max(T a, T b) { return (a > b) ? a : b; } +const T& max(const T& a, const T& b) { return (a > b) ? a : b; } template -T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; } +const T& clamp(const T& a, const T& min, const T& max) { return (a > max) ? max : (a < min) ? min : a; } #else // __cplusplus diff --git a/reapi/include/cssdk/dlls/basemonster.h b/reapi/include/cssdk/dlls/basemonster.h index ad23197..05cb5e3 100644 --- a/reapi/include/cssdk/dlls/basemonster.h +++ b/reapi/include/cssdk/dlls/basemonster.h @@ -88,7 +88,7 @@ public: Activity m_IdealActivity; // monster should switch to this activity int m_LastHitGroup; // the last body region that took damage int m_bitsDamageType; // what types of damage has monster (player) taken - BYTE m_rgbTimeBasedDamage[8]; + byte m_rgbTimeBasedDamage[8]; MONSTERSTATE m_MonsterState; // monster's current state MONSTERSTATE m_IdealMonsterState; // monster should change to this state diff --git a/reapi/include/cssdk/dlls/cbase.h b/reapi/include/cssdk/dlls/cbase.h index 1329520..4817034 100644 --- a/reapi/include/cssdk/dlls/cbase.h +++ b/reapi/include/cssdk/dlls/cbase.h @@ -282,10 +282,10 @@ public: locksound_t m_ls; // door lock sounds - BYTE m_bLockedSound; // ordinals from entity selection - BYTE m_bLockedSentence; - BYTE m_bUnlockedSound; - BYTE m_bUnlockedSentence; + byte m_bLockedSound; // ordinals from entity selection + byte m_bLockedSentence; + byte m_bUnlockedSound; + byte m_bUnlockedSentence; int m_sounds; }; diff --git a/reapi/include/cssdk/dlls/doors.h b/reapi/include/cssdk/dlls/doors.h index a4f6d68..92a97b4 100644 --- a/reapi/include/cssdk/dlls/doors.h +++ b/reapi/include/cssdk/dlls/doors.h @@ -56,17 +56,17 @@ public: virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; virtual void Blocked(CBaseEntity *pOther) = 0; public: - BYTE m_bHealthValue; // some doors are medi-kit doors, they give players health + byte m_bHealthValue; // some doors are medi-kit doors, they give players health - BYTE m_bMoveSnd; // sound a door makes while moving - BYTE m_bStopSnd; // sound a door makes when it stops + byte m_bMoveSnd; // sound a door makes while moving + byte m_bStopSnd; // sound a door makes when it stops locksound_t m_ls; // door lock sounds - BYTE m_bLockedSound; // ordinals from entity selection - BYTE m_bLockedSentence; - BYTE m_bUnlockedSound; - BYTE m_bUnlockedSentence; + byte m_bLockedSound; // ordinals from entity selection + byte m_bLockedSentence; + byte m_bUnlockedSound; + byte m_bUnlockedSentence; float m_lastBlockedTimestamp; }; @@ -88,5 +88,5 @@ public: virtual int ObjectCaps() = 0; virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0; public: - BYTE m_bMoveSnd; // sound a door makes while moving + byte m_bMoveSnd; // sound a door makes while moving }; diff --git a/reapi/include/cssdk/dlls/extdef.h b/reapi/include/cssdk/dlls/extdef.h index f18d58f..2135558 100644 --- a/reapi/include/cssdk/dlls/extdef.h +++ b/reapi/include/cssdk/dlls/extdef.h @@ -75,8 +75,8 @@ typedef struct locksounds int iUnlockedSentence; float flwaitSound; float flwaitSentence; - BYTE bEOFLocked; - BYTE bEOFUnlocked; + byte bEOFLocked; + byte bEOFUnlocked; } locksound_t; diff --git a/reapi/include/cssdk/dlls/platform.h b/reapi/include/cssdk/dlls/platform.h deleted file mode 100644 index fd9a304..0000000 --- a/reapi/include/cssdk/dlls/platform.h +++ /dev/null @@ -1,651 +0,0 @@ -//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== -// -// The copyright to the contents herein is the property of Valve, L.L.C. -// The contents may be used and/or copied only with the written permission of -// Valve, L.L.C., or in accordance with the terms and conditions stipulated in -// the agreement/contract under which the contents have been supplied. -// -// $Header: $ -// $NoKeywords: $ -// -// Extremely low-level platform-specific stuff -//============================================================================= - - -#ifndef PLATFORM_H -#define PLATFORM_H - -#ifdef _WIN32 -#pragma once -#endif - -#include "osconfig.h" - -// need this for _alloca -#include - -// need this for memset -#include - -// for when we care about how many bits we use -typedef signed char int8; -typedef signed short int16; - -#ifdef _WIN32 -#ifdef _MSC_VER -typedef signed __int64 int64; -#endif -#elif defined __linux__ -typedef long long int64; -#endif - -typedef unsigned char uint8; -typedef unsigned short uint16; -#ifdef _WIN32 -#ifdef _MSC_VER -typedef unsigned __int64 uint64; -#endif -#elif defined __linux__ -typedef unsigned long long uint64; -#endif - - -typedef float float32; -typedef double float64; - -// for when we don't care about how many bits we use -typedef unsigned int uint; - -// This can be used to ensure the size of pointers to members when declaring -// a pointer type for a class that has only been forward declared -#ifdef _MSC_VER -#define SINGLE_INHERITANCE __single_inheritance -#define MULTIPLE_INHERITANCE __multiple_inheritance -#else -#define SINGLE_INHERITANCE -#define MULTIPLE_INHERITANCE -#endif - -/* -FIXME: Enable this when we no longer fear change =) - -// need these for the limits -#include -#include - -// Maximum and minimum representable values -#define INT8_MAX SCHAR_MAX -#define INT16_MAX SHRT_MAX -#define INT32_MAX LONG_MAX -#define INT64_MAX (((int64)~0) >> 1) - -#define INT8_MIN SCHAR_MIN -#define INT16_MIN SHRT_MIN -#define INT32_MIN LONG_MIN -#define INT64_MIN (((int64)1) << 63) - -#define UINT8_MAX ((uint8)~0) -#define UINT16_MAX ((uint16)~0) -#define UINT32_MAX ((uint32_t)~0) -#define UINT64_MAX ((uint64)~0) - -#define UINT8_MIN 0 -#define UINT16_MIN 0 -#define UINT32_MIN 0 -#define UINT64_MIN 0 - -#ifndef UINT_MIN -#define UINT_MIN UINT32_MIN -#endif - -#define FLOAT32_MAX FLT_MAX -#define FLOAT64_MAX DBL_MAX - -#define FLOAT32_MIN FLT_MIN -#define FLOAT64_MIN DBL_MIN -*/ - -// portability / compiler settings -#if defined(_WIN32) && !defined(WINDED) - -#if defined(_M_IX86) -#define __i386__ 1 -#endif - -#elif __linux__ -typedef void * HINSTANCE; -#define _MAX_PATH PATH_MAX -#endif // defined(_WIN32) && !defined(WINDED) - - -// Defines MAX_PATH -#ifndef MAX_PATH -#define MAX_PATH 260 -#endif - -// Used to step into the debugger -#define DebuggerBreak() __asm { int 3 } - -// C functions for external declarations that call the appropriate C++ methods -#ifndef EXPORT -#ifdef _WIN32 -#define EXPORT _declspec( dllexport ) -#else -#define EXPORT /* */ -#endif -#endif - -#if defined __i386__ && !defined __linux__ -#define id386 1 -#else -#define id386 0 -#endif // __i386__ - -#ifdef _WIN32 -// Used for dll exporting and importing -#define DLL_EXPORT extern "C" __declspec( dllexport ) -#define DLL_IMPORT extern "C" __declspec( dllimport ) - -// Can't use extern "C" when DLL exporting a class -#define DLL_CLASS_EXPORT __declspec( dllexport ) -#define DLL_CLASS_IMPORT __declspec( dllimport ) - -// Can't use extern "C" when DLL exporting a global -#define DLL_GLOBAL_EXPORT extern __declspec( dllexport ) -#define DLL_GLOBAL_IMPORT extern __declspec( dllimport ) -#elif defined __linux__ - -// Used for dll exporting and importing -#define DLL_EXPORT extern "C" -#define DLL_IMPORT extern "C" - -// Can't use extern "C" when DLL exporting a class -#define DLL_CLASS_EXPORT -#define DLL_CLASS_IMPORT - -// Can't use extern "C" when DLL exporting a global -#define DLL_GLOBAL_EXPORT extern -#define DLL_GLOBAL_IMPORT extern - -#else -#error "Unsupported Platform." -#endif - -// Used for standard calling conventions -#ifdef _WIN32 -#define FASTCALL __fastcall -#define FORCEINLINE __forceinline -#else -#define FASTCALL -#define FORCEINLINE inline -#endif - -// Force a function call site -not- to inlined. (useful for profiling) -#define DONT_INLINE(a) (((int)(a)+1)?(a):(a)) - -// Pass hints to the compiler to prevent it from generating unnessecary / stupid code -// in certain situations. Several compilers other than MSVC also have an equivilent -// construct. -// -// Essentially the 'Hint' is that the condition specified is assumed to be true at -// that point in the compilation. If '0' is passed, then the compiler assumes that -// any subsequent code in the same 'basic block' is unreachable, and thus usually -// removed. -#ifdef _MSC_VER -#define HINT(THE_HINT) __assume((THE_HINT)) -#else -#define HINT(THE_HINT) 0 -#endif - -// Marks the codepath from here until the next branch entry point as unreachable, -// and asserts if any attempt is made to execute it. -#define UNREACHABLE() { Assert(0); HINT(0); } - -// In cases where no default is present or appropriate, this causes MSVC to generate -// as little code as possible, and throw an assertion in debug. -#define NO_DEFAULT default: UNREACHABLE(); - -#ifdef _WIN32 -// Alloca defined for this platform -#define stackalloc( _size ) _alloca( _size ) -#define stackfree( _p ) 0 -#elif __linux__ -// Alloca defined for this platform -#define stackalloc( _size ) alloca( _size ) -#define stackfree( _p ) 0 -#endif - -#ifdef _WIN32 -// Remove warnings from warning level 4. -#pragma warning(disable : 4514) // warning C4514: 'acosl' : unreferenced inline function has been removed -#pragma warning(disable : 4100) // warning C4100: 'hwnd' : unreferenced formal parameter -#pragma warning(disable : 4127) // warning C4127: conditional expression is constant -#pragma warning(disable : 4512) // warning C4512: 'InFileRIFF' : assignment operator could not be generated -#pragma warning(disable : 4611) // warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable -#pragma warning(disable : 4706) // warning C4706: assignment within conditional expression -#pragma warning(disable : 4710) // warning C4710: function 'x' not inlined -#pragma warning(disable : 4702) // warning C4702: unreachable code -#pragma warning(disable : 4505) // unreferenced local function has been removed -#pragma warning(disable : 4239) // nonstandard extension used : 'argument' ( conversion from class Vector to class Vector& ) -#pragma warning(disable : 4097) // typedef-name 'BaseClass' used as synonym for class-name 'CFlexCycler::CBaseFlex' -#pragma warning(disable : 4324) // Padding was added at the end of a structure -#pragma warning(disable : 4244) // type conversion warning. -#pragma warning(disable : 4305) // truncation from 'const double ' to 'float ' -#pragma warning(disable : 4786) // Disable warnings about long symbol names - -#if _MSC_VER >= 1300 -#pragma warning(disable : 4511) // Disable warnings about private copy constructors -#endif -#endif -//----------------------------------------------------------------------------- -// Purpose: Standard functions for handling endian-ness -//----------------------------------------------------------------------------- - -//------------------------------------- -// Basic swaps -//------------------------------------- - -template -inline T WordSwapC(T w) -{ - uint16 temp; - - temp = ((*((uint16 *)&w) & 0xff00) >> 8); - temp |= ((*((uint16 *)&w) & 0x00ff) << 8); - - return *((T*)&temp); -} - -template -inline T DWordSwapC(T dw) -{ - uint32_t temp; - - temp = *((uint32_t *)&dw) >> 24; - temp |= ((*((uint32_t *)&dw) & 0x00FF0000) >> 8); - temp |= ((*((uint32_t *)&dw) & 0x0000FF00) << 8); - temp |= ((*((uint32_t *)&dw) & 0x000000FF) << 24); - - return *((T*)&temp); -} - -//------------------------------------- -// Fast swaps -//------------------------------------- - -#ifdef _MSC_VER - -#define WordSwap WordSwapAsm -#define DWordSwap DWordSwapAsm - -#pragma warning(push) -#pragma warning (disable:4035) // no return value - -template -inline T WordSwapAsm(T w) -{ - __asm - { - mov ax, w - xchg al, ah - } -} - -template -inline T DWordSwapAsm(T dw) -{ - __asm - { - mov eax, dw - bswap eax - } -} - -#pragma warning(pop) - -// The assembly implementation is not compatible with floats -template <> -inline float DWordSwapAsm(float f) -{ - return DWordSwapC(f); -} - -#else - -#define WordSwap WordSwapC -#define DWordSwap DWordSwapC - -#endif - -//------------------------------------- -// The typically used methods. -//------------------------------------- - -#if defined(__i386__) -#define VALVE_LITTLE_ENDIAN 1 -#endif - -#ifdef _SGI_SOURCE -#define VALVE_BIG_ENDIAN 1 -#endif - -#if defined(VALVE_LITTLE_ENDIAN) - -#define Valve_BigShort( val ) WordSwap( val ) -#define Valve_BigWord( val ) WordSwap( val ) -#define Valve_BigLong( val ) DWordSwap( val ) -#define Valve_BigDWord( val ) DWordSwap( val ) -#define Valve_BigFloat( val ) DWordSwap( val ) -#define Valve_LittleShort( val ) ( val ) -#define Valve_LittleWord( val ) ( val ) -#define Valve_LittleLong( val ) ( val ) -#define Valve_LittleDWord( val ) ( val ) -#define Valve_LittleFloat( val ) ( val ) - -#elif defined(BIG_ENDIAN) - -#define Valve_BigShort( val ) ( val ) -#define Valve_BigWord( val ) ( val ) -#define Valve_BigLong( val ) ( val ) -#define Valve_BigDWord( val ) ( val ) -#define Valve_BigFloat( val ) ( val ) -#define Valve_LittleShort( val ) WordSwap( val ) -#define Valve_LittleWord( val ) WordSwap( val ) -#define Valve_LittleLong( val ) DWordSwap( val ) -#define Valve_LittleDWord( val ) DWordSwap( val ) -#define Valve_LittleFloat( val ) DWordSwap( val ) - -#else - -// @Note (toml 05-02-02): this technique expects the compiler to -// optimize the expression and eliminate the other path. On any new -// platform/compiler this should be tested. -inline short BigShort(short val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; } -inline uint16 BigWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; } -inline long BigLong(long val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } -inline uint32_t BigDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } -inline float BigFloat(float val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } -inline short LittleShort(short val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); } -inline uint16 LittleWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); } -inline long LittleLong(long val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } -inline uint32_t LittleDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } -inline float LittleFloat(float val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } - -#endif - - - -#ifdef TIER0_DLL_EXPORT -#define PLATFORM_INTERFACE DLL_EXPORT -#define PLATFORM_OVERLOAD DLL_GLOBAL_EXPORT -#else -#define PLATFORM_INTERFACE DLL_IMPORT -#define PLATFORM_OVERLOAD DLL_GLOBAL_IMPORT -#endif - -/* -PLATFORM_INTERFACE double Plat_FloatTime(); // Returns time in seconds since the module was loaded. -PLATFORM_INTERFACE unsigned long Plat_MSTime(); // Time in milliseconds. - -// b/w compatibility -#define Sys_FloatTime Plat_FloatTime -*/ - -// Processor Information: -struct CPUInformation -{ - int m_Size; // Size of this structure, for forward compatability. - - bool m_bRDTSC : 1, // Is RDTSC supported? - m_bCMOV : 1, // Is CMOV supported? - m_bFCMOV : 1, // Is FCMOV supported? - m_bSSE : 1, // Is SSE supported? - m_bSSE2 : 1, // Is SSE2 Supported? - m_b3DNow : 1, // Is 3DNow! Supported? - m_bMMX : 1, // Is MMX supported? - m_bHT : 1; // Is HyperThreading supported? - - unsigned char m_nLogicalProcessors, // Number op logical processors. - m_nPhysicalProcessors; // Number of physical processors - - int64 m_Speed; // In cycles per second. - - char* m_szProcessorID; // Processor vendor Identification. -}; - -PLATFORM_INTERFACE const CPUInformation& GetCPUInformation(); - - -//----------------------------------------------------------------------------- -// Thread related functions -//----------------------------------------------------------------------------- -// Registers the current thread with Tier0's thread management system. -// This should be called on every thread created in the game. -PLATFORM_INTERFACE unsigned long Plat_RegisterThread(const char *pName = "Source Thread"); - -// Registers the current thread as the primary thread. -PLATFORM_INTERFACE unsigned long Plat_RegisterPrimaryThread(); - -// VC-specific. Sets the thread's name so it has a friendly name in the debugger. -// This should generally only be handled by Plat_RegisterThread and Plat_RegisterPrimaryThread -PLATFORM_INTERFACE void Plat_SetThreadName(unsigned long dwThreadID, const char *pName); - -// These would be private if it were possible to export private variables from a .DLL. -// They need to be variables because they are checked by inline functions at performance -// critical places. -PLATFORM_INTERFACE unsigned long Plat_PrimaryThreadID; - -// Returns the ID of the currently executing thread. -PLATFORM_INTERFACE unsigned long Plat_GetCurrentThreadID(); - -// Returns the ID of the primary thread. -inline unsigned long Plat_GetPrimaryThreadID() -{ - return Plat_PrimaryThreadID; -} - -// Returns true if the current thread is the primary thread. -inline bool Plat_IsPrimaryThread() -{ - //return true; - return (Plat_GetPrimaryThreadID() == Plat_GetCurrentThreadID()); -} - -//----------------------------------------------------------------------------- -// Security related functions -//----------------------------------------------------------------------------- -// Ensure that the hardware key's drivers have been installed. -PLATFORM_INTERFACE bool Plat_VerifyHardwareKeyDriver(); - -// Ok, so this isn't a very secure way to verify the hardware key for now. It -// is primarially depending on the fact that all the binaries have been wrapped -// with the secure wrapper provided by the hardware keys vendor. -PLATFORM_INTERFACE bool Plat_VerifyHardwareKey(); - -// The same as above, but notifies user with a message box when the key isn't in -// and gives him an opportunity to correct the situation. -PLATFORM_INTERFACE bool Plat_VerifyHardwareKeyPrompt(); - -// Can be called in real time, doesn't perform the verify every frame. Mainly just -// here to allow the game to drop out quickly when the key is removed, rather than -// allowing the wrapper to pop up it's own blocking dialog, which the engine doesn't -// like much. -PLATFORM_INTERFACE bool Plat_FastVerifyHardwareKey(); - - - -//----------------------------------------------------------------------------- -// Include additional dependant header components. -//----------------------------------------------------------------------------- -//#include "tier0/fasttimer.h" - - -//----------------------------------------------------------------------------- -// Just logs file and line to simple.log -//----------------------------------------------------------------------------- -void* Plat_SimpleLog(const char* file, int line); - -//#define Plat_dynamic_cast Plat_SimpleLog(__FILE__,__LINE__),dynamic_cast - -//----------------------------------------------------------------------------- -// Methods to invoke the constructor, copy constructor, and destructor -//----------------------------------------------------------------------------- - -template -inline void Construct(T* pMemory) -{ - new(pMemory)T; -} - -template -inline void CopyConstruct(T* pMemory, T const& src) -{ - new(pMemory)T(src); -} - -template -inline void Destruct(T* pMemory) -{ - pMemory->~T(); - -#ifdef _DEBUG - memset(pMemory, 0xDD, sizeof(T)); -#endif -} - - -// -// GET_OUTER() -// -// A platform-independent way for a contained class to get a pointer to its -// owner. If you know a class is exclusively used in the context of some -// "outer" class, this is a much more space efficient way to get at the outer -// class than having the inner class store a pointer to it. -// -// class COuter -// { -// class CInner // Note: this does not need to be a nested class to work -// { -// void PrintAddressOfOuter() -// { -// printf( "Outer is at 0x%x\n", GET_OUTER( COuter, m_Inner ) ); -// } -// }; -// -// CInner m_Inner; -// friend class CInner; -// }; - -#define GET_OUTER( OuterType, OuterMember ) \ - ( ( OuterType * ) ( (char *)this - offsetof( OuterType, OuterMember ) ) ) - - -/* TEMPLATE_FUNCTION_TABLE() - -(Note added to platform.h so platforms that correctly support templated -functions can handle portions as templated functions rather than wrapped -functions) - -Helps automate the process of creating an array of function -templates that are all specialized by a single integer. -This sort of thing is often useful in optimization work. - -For example, using TEMPLATE_FUNCTION_TABLE, this: - -TEMPLATE_FUNCTION_TABLE(int, Function, ( int blah, int blah ), 10) -{ -return argument * argument; -} - -is equivilent to the following: - -(NOTE: the function has to be wrapped in a class due to code -generation bugs involved with directly specializing a function -based on a constant.) - -template -class FunctionWrapper -{ -public: -int Function( int blah, int blah ) -{ -return argument*argument; -} -} - -typedef int (*FunctionType)( int blah, int blah ); - -class FunctionName -{ -public: -enum { count = 10 }; -FunctionType functions[10]; -}; - -FunctionType FunctionName::functions[] = -{ -FunctionWrapper<0>::Function, -FunctionWrapper<1>::Function, -FunctionWrapper<2>::Function, -FunctionWrapper<3>::Function, -FunctionWrapper<4>::Function, -FunctionWrapper<5>::Function, -FunctionWrapper<6>::Function, -FunctionWrapper<7>::Function, -FunctionWrapper<8>::Function, -FunctionWrapper<9>::Function -}; -*/ - -bool vtune(bool resume); - - -#define TEMPLATE_FUNCTION_TABLE(RETURN_TYPE, NAME, ARGS, COUNT) \ - \ -typedef RETURN_TYPE (FASTCALL *__Type_##NAME) ARGS; \ - \ -template \ -struct __Function_##NAME \ -{ \ - static RETURN_TYPE FASTCALL Run ARGS; \ -}; \ - \ -template \ -struct __MetaLooper_##NAME : __MetaLooper_##NAME \ -{ \ - __Type_##NAME func; \ - inline __MetaLooper_##NAME() { func = __Function_##NAME::Run; } \ -}; \ - \ -template<> \ -struct __MetaLooper_##NAME<0> \ -{ \ - __Type_##NAME func; \ - inline __MetaLooper_##NAME() { func = __Function_##NAME<0>::Run; } \ -}; \ - \ -class NAME \ -{ \ -private: \ - static const __MetaLooper_##NAME m; \ -public: \ - enum { count = COUNT }; \ - static const __Type_##NAME* functions; \ -}; \ -const __MetaLooper_##NAME NAME::m; \ -const __Type_##NAME* NAME::functions = (__Type_##NAME*)&m; \ -template \ -RETURN_TYPE FASTCALL __Function_##NAME::Run ARGS - - -#define LOOP_INTERCHANGE(BOOLEAN, CODE)\ - if( (BOOLEAN) )\ - {\ - CODE;\ - } else\ - {\ - CODE;\ - } - - -#endif /* PLATFORM_H */ \ No newline at end of file diff --git a/reapi/include/cssdk/dlls/plats.h b/reapi/include/cssdk/dlls/plats.h index 8409525..ec67be3 100644 --- a/reapi/include/cssdk/dlls/plats.h +++ b/reapi/include/cssdk/dlls/plats.h @@ -52,8 +52,8 @@ public: // This is done to fix spawn flag collisions between this class and a derived class virtual BOOL IsTogglePlat() = 0; public: - BYTE m_bMoveSnd; - BYTE m_bStopSnd; + byte m_bMoveSnd; + byte m_bStopSnd; float m_volume; }; diff --git a/reapi/include/cssdk/dlls/util.h b/reapi/include/cssdk/dlls/util.h index f5482ee..e0d1d30 100644 --- a/reapi/include/cssdk/dlls/util.h +++ b/reapi/include/cssdk/dlls/util.h @@ -44,7 +44,7 @@ extern globalvars_t *gpGlobals; // Use this instead of ALLOC_STRING on constant strings #define STRING(offset) ((const char *)(gpGlobals->pStringBase + (unsigned int)(offset))) -#define MAKE_STRING(str) ((uint64_t)(str) - (uint64_t)(STRING(0))) +#define MAKE_STRING(str) ((uint64)(str) - (uint64)(STRING(0))) // Dot products for view cone checking #define VIEW_FIELD_FULL -1.0 // +-180 degrees diff --git a/reapi/include/cssdk/engine/eiface.h b/reapi/include/cssdk/engine/eiface.h index 641a4b9..e146133 100644 --- a/reapi/include/cssdk/engine/eiface.h +++ b/reapi/include/cssdk/engine/eiface.h @@ -94,7 +94,7 @@ typedef struct int fEnabled; int fPlayLooping; float cdvolume; - //BYTE remap[100]; + //byte remap[100]; int fCDRom; int fPlayTrack; } CDStatus; diff --git a/reapi/include/cssdk/game_shared/shared_util.h b/reapi/include/cssdk/game_shared/shared_util.h index f7670d6..c12156f 100644 --- a/reapi/include/cssdk/game_shared/shared_util.h +++ b/reapi/include/cssdk/game_shared/shared_util.h @@ -27,12 +27,10 @@ */ #pragma once -#include "common.h" - #ifndef _WIN32 #include #include -#endif // _WIN32 +#endif // Simple utility function to allocate memory and duplicate a string inline char *CloneString(const char *str) diff --git a/reapi/include/cssdk/public/asmlib.h b/reapi/include/cssdk/public/asmlib.h deleted file mode 100644 index c1bc9af..0000000 --- a/reapi/include/cssdk/public/asmlib.h +++ /dev/null @@ -1,123 +0,0 @@ -/*************************** asmlib.h *************************************** -* Author: Agner Fog -* Date created: 2003-12-12 -* Last modified: 2013-10-04 -* Project: asmlib.zip -* Source URL: www.agner.org/optimize -* -* Description: -* Header file for the asmlib function library. -* This library is available in many versions for different platforms. -* See asmlib-instructions.pdf for details. -* -* (c) Copyright 2003 - 2013 by Agner Fog. -* GNU General Public License http://www.gnu.org/licenses/gpl.html -*****************************************************************************/ - - -#ifndef ASMLIB_H -#define ASMLIB_H - - -/*********************************************************************** -Define compiler-specific types and directives -***********************************************************************/ - -// Define type size_t -#ifndef _SIZE_T_DEFINED -#include "stddef.h" -#endif - -// Define integer types with known size: int32_t, uint32_t, int64_t, uint64_t. -// If this doesn't work then insert compiler-specific definitions here: -#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1600) - // Compilers supporting C99 or C++0x have stdint.h defining these integer types - #include - #define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers -#elif defined(_MSC_VER) - // Older Microsoft compilers have their own definition - typedef signed __int16 int16_t; - typedef unsigned __int16 uint16_t; - typedef signed __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef signed __int64 int64_t; - typedef unsigned __int64 uint64_t; - #define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers -#else - // This works with most compilers - typedef signed short int int16_t; - typedef unsigned short int uint16_t; - typedef signed int int32_t; - typedef unsigned int uint32_t; - typedef long long int64_t; - typedef unsigned long long uint64_t; - #define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers -#endif - - -// Turn off name mangling -#ifdef __cplusplus -extern "C" { -#endif - -/*********************************************************************** -Function prototypes, memory and string functions -***********************************************************************/ -void * A_memcpy (void * dest, const void * src, size_t count); // Copy count bytes from src to dest -void * A_memmove(void * dest, const void * src, size_t count); // Same as memcpy, allows overlap between src and dest -void * A_memset (void * dest, int c, size_t count); // Set count bytes in dest to (char)c -int A_memcmp (const void * buf1, const void * buf2, size_t num); // Compares two blocks of memory -size_t GetMemcpyCacheLimit(void); // Data blocks bigger than this will be copied uncached by memcpy and memmove -void SetMemcpyCacheLimit(size_t); // Change limit in GetMemcpyCacheLimit -size_t GetMemsetCacheLimit(void); // Data blocks bigger than this will be stored uncached by memset -void SetMemsetCacheLimit(size_t); // Change limit in GetMemsetCacheLimit -char * A_strcat (char * dest, const char * src); // Concatenate strings dest and src. Store result in dest -char * A_strcpy (char * dest, const char * src); // Copy string src to dest -size_t A_strlen (const char * str); // Get length of zero-terminated string -int A_strcmp (const char * a, const char * b); // Compare strings. Case sensitive -int A_stricmp (const char *string1, const char *string2); // Compare strings. Case insensitive for A-Z only -char * A_strstr (char * haystack, const char * needle); // Search for substring in string -void A_strtolower(char * string); // Convert string to lower case for A-Z only -void A_strtoupper(char * string); // Convert string to upper case for a-z only -size_t A_substring(char * dest, const char * source, size_t pos, size_t len); // Copy a substring for source into dest -size_t A_strspn (const char * str, const char * set); // Find span of characters that belong to set -size_t A_strcspn(const char * str, const char * set); // Find span of characters that don't belong to set -size_t strCountInSet(const char * str, const char * set); // Count characters that belong to set -size_t strcount_UTF8(const char * str); // Counts the number of characters in a UTF-8 encoded string - - -/*********************************************************************** -Function prototypes, miscellaneous functions -***********************************************************************/ -uint32_t A_popcount(uint32_t x); // Count 1-bits in 32-bit integer -int RoundD (double x); // Round to nearest or even -int RoundF (float x); // Round to nearest or even -int InstructionSet(void); // Tell which instruction set is supported -char * ProcessorName(void); // ASCIIZ text describing microprocessor -void CpuType(int * vendor, int * family, int * model); // Get CPU vendor, family and model -size_t DataCacheSize(int level); // Get size of data cache -void A_DebugBreak(void); // Makes a debug breakpoint -#ifdef INT64_SUPPORTED - uint64_t ReadTSC(void); // Read microprocessor internal clock (64 bits) -#else - uint32_t ReadTSC(void); // Read microprocessor internal clock (only 32 bits supported by compiler) -#endif -void cpuid_ex (int abcd[4], int eax, int ecx); // call CPUID instruction -static inline void cpuid_abcd (int abcd[4], int eax) { - cpuid_ex(abcd, eax, 0);} - -#ifdef __cplusplus -} // end of extern "C" - -// Define overloaded versions if compiling as C++ - -static inline int Round (double x) { // Overload name Round - return RoundD(x);} -static inline int Round (float x) { // Overload name Round - return RoundF(x);} -static inline const char * A_strstr(const char * haystack, const char * needle) { - return A_strstr((char*)haystack, needle);} // Overload A_strstr with const char * version - -#endif // __cplusplus - -#endif // ASMLIB_H diff --git a/reapi/include/cssdk/public/basetypes.h b/reapi/include/cssdk/public/basetypes.h index 04df63b..a953ffe 100644 --- a/reapi/include/cssdk/public/basetypes.h +++ b/reapi/include/cssdk/public/basetypes.h @@ -17,7 +17,7 @@ // For backward compatibilty only... -//#include "tier0/platform.h" +#include "tier0/platform.h" // stdio.h #ifndef NULL @@ -44,30 +44,19 @@ #define PAD_NUMBER(number, boundary) \ ( ((number) + ((boundary)-1)) / (boundary) ) * (boundary) +#ifndef MATHLIB_H // In case this ever changes #define M_PI 3.14159265358979323846 -// #ifndef min -// #define min(a,b) (((a) < (b)) ? (a) : (b)) -// #endif - -// #ifndef max -// #define max(a,b) (((a) > (b)) ? (a) : (b)) -// #endif - -#ifdef __cplusplus -template -inline T clamp2(T const &val, T const &minVal, T const &maxVal) //renamed to clamp2 to avoid conflicts with clamp defined in mathlib -{ - if (val < minVal) - return minVal; - else if (val > maxVal) - return maxVal; - else - return val; -} +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) #endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#endif // MATHLIB_H + #ifndef FALSE #define FALSE 0 #define TRUE (!FALSE) @@ -81,8 +70,6 @@ typedef unsigned char BYTE; typedef unsigned char byte; typedef unsigned short word; -//#include "string_t.h" - typedef float vec_t; diff --git a/reapi/src/amxxmodule.h b/reapi/src/amxxmodule.h index 789ca15..f6a3370 100644 --- a/reapi/src/amxxmodule.h +++ b/reapi/src/amxxmodule.h @@ -28,8 +28,8 @@ struct amxx_module_info_s const char *name; const char *author; const char *version; - int reload; // reload on mapchange when nonzero - const char *logtag; // added in version 2 + int reload; // reload on mapchange when nonzero + const char *logtag; // added in version 2 const char *library; // added in version 4 const char *libclass; // added in version 4 }; @@ -38,7 +38,7 @@ struct amxx_module_info_s #define AMXX_OK 0 /* no error */ #define AMXX_IFVERS 1 /* interface version */ #define AMXX_PARAM 2 /* Invalid parameter */ -#define AMXX_FUNC_NOT_PRESENT 3 /* Function not present */ +#define AMXX_FUNC_NOT_PRESENT 3 /* Function not present */ #define AMXX_GAME_OK 0 /* This module can load on the current game mod. */ #define AMXX_GAME_BAD 1 /* This module can not load on the current game mod. */ @@ -75,28 +75,27 @@ struct amxx_module_info_s #define PAWN_CELL_SIZE 32 /* by default, use 32-bit cells */ #endif #if PAWN_CELL_SIZE==16 -typedef uint16_t ucell; -typedef int16_t cell; +typedef uint16 ucell; +typedef int16 cell; #elif PAWN_CELL_SIZE==32 -typedef uint32_t ucell; -typedef int32_t cell; +typedef uint32 ucell; +typedef int32 cell; #define REAL float #elif PAWN_CELL_SIZE==64 -typedef uint64_t ucell; -typedef int64_t cell; +typedef uint64 ucell; +typedef int64 cell; #define REAL double #else #error Unsupported cell size (PAWN_CELL_SIZE) #endif -#define UNPACKEDMAX ((1 << (sizeof(cell)-1)*8) - 1) -#define UNLIMITED (~1u >> 1) +#define UNPACKEDMAX ((1 << (sizeof(cell) - 1) * 8) - 1) +#define UNLIMITED (~1u >> 1) struct tagAMX; -typedef cell(AMX_NATIVE_CALL *AMX_NATIVE)( struct tagAMX *amx, cell *params ); -typedef int ( AMXAPI *AMX_CALLBACK )( struct tagAMX *amx, cell index, - cell *result, cell *params ); -typedef int ( AMXAPI *AMX_DEBUG )( struct tagAMX *amx ); +typedef cell(AMX_NATIVE_CALL *AMX_NATIVE)(struct tagAMX *amx, cell *params); +typedef int (AMXAPI *AMX_CALLBACK)(struct tagAMX *amx, cell index, cell *result, cell *params); +typedef int (AMXAPI *AMX_DEBUG)(struct tagAMX *amx); #if !defined _FAR #define _FAR #endif @@ -124,7 +123,6 @@ typedef int ( AMXAPI *AMX_DEBUG )( struct tagAMX *amx ); #endif #endif - /* Some compilers do not support the #pragma align, which should be fine. Some * compilers give a warning on unknown #pragmas, which is not so fine... */ @@ -133,21 +131,21 @@ typedef int ( AMXAPI *AMX_DEBUG )( struct tagAMX *amx ); #endif #if defined __GNUC__ -#define PACKED __attribute__((packed)) +#define PACKED __attribute__((packed)) #else #define PACKED #endif #if !defined AMX_NO_ALIGN #if defined LINUX || defined __FreeBSD__ || defined __APPLE__ -#pragma pack(1) /* structures must be packed (byte-aligned) */ +#pragma pack(1) /* structures must be packed (byte-aligned) */ #elif defined MACOS && defined __MWERKS__ #pragma options align=mac68k #else #pragma pack(push) -#pragma pack(1) /* structures must be packed (byte-aligned) */ +#pragma pack(1) /* structures must be packed (byte-aligned) */ #if defined __TURBOC__ -#pragma option -a- /* "pack" pragma for older Borland compilers */ +#pragma option -a- /* "pack" pragma for older Borland compilers */ #endif #endif #endif @@ -158,7 +156,7 @@ typedef struct AMX_NATIVE func PACKED; } AMX_NATIVE_INFO; -#define AMX_USERNUM 4 +#define AMX_USERNUM 4 /* The AMX structure is the internal structure for many functions. Not all * fields are valid at all times; many fields are cached in local variables. @@ -193,8 +191,8 @@ typedef struct tagAMX cell reset_hea PACKED; cell sysreq_d PACKED; /* relocated address/value for the SYSREQ.D opcode */ /* support variables for the JIT */ - int reloc_size PACKED; /* required temporary buffer for relocations */ - long code_size PACKED; /* estimated memory footprint of the native code */ + int reloc_size PACKED; /* required temporary buffer for relocations */ + long code_size PACKED; /* estimated memory footprint of the native code */ } PACKED AMX; /* The AMX_HEADER structure is both the memory format as the file format. The @@ -202,23 +200,23 @@ typedef struct tagAMX */ typedef struct tagAMX_HEADER { - int32_t size PACKED; /* size of the "file" */ - uint16_t magic PACKED; /* signature */ - char file_version; /* file format version */ - char amx_version; /* required version of the AMX */ - int16_t flags PACKED; - int16_t defsize PACKED; /* size of a definition record */ - int32_t cod PACKED; /* initial value of COD - code block */ - int32_t dat PACKED; /* initial value of DAT - data block */ - int32_t hea PACKED; /* initial value of HEA - start of the heap */ - int32_t stp PACKED; /* initial value of STP - stack top */ - int32_t cip PACKED; /* initial value of CIP - the instruction pointer */ - int32_t publics PACKED; /* offset to the "public functions" table */ - int32_t natives PACKED; /* offset to the "native functions" table */ - int32_t libraries PACKED; /* offset to the table of libraries */ - int32_t pubvars PACKED; /* the "public variables" table */ - int32_t tags PACKED; /* the "public tagnames" table */ - int32_t nametable PACKED; /* name table */ + int32 size PACKED; /* size of the "file" */ + uint16 magic PACKED; /* signature */ + char file_version; /* file format version */ + char amx_version; /* required version of the AMX */ + int16 flags PACKED; + int16 defsize PACKED; /* size of a definition record */ + int32 cod PACKED; /* initial value of COD - code block */ + int32 dat PACKED; /* initial value of DAT - data block */ + int32 hea PACKED; /* initial value of HEA - start of the heap */ + int32 stp PACKED; /* initial value of STP - stack top */ + int32 cip PACKED; /* initial value of CIP - the instruction pointer */ + int32 publics PACKED; /* offset to the "public functions" table */ + int32 natives PACKED; /* offset to the "native functions" table */ + int32 libraries PACKED; /* offset to the table of libraries */ + int32 pubvars PACKED; /* the "public variables" table */ + int32 tags PACKED; /* the "public tagnames" table */ + int32 nametable PACKED; /* name table */ } PACKED AMX_HEADER; enum @@ -254,14 +252,14 @@ enum #if !defined AMX_NO_ALIGN #if defined(__linux__) || defined(__APPLE__) -#pragma pack() /* reset default packing */ +#pragma pack() /* reset default packing */ #else #pragma pack(pop) /* reset previous packing */ #endif #endif // *** Types *** -typedef void* ( *PFN_REQ_FNPTR )( const char * /*name*/ ); +typedef void * (*PFN_REQ_FNPTR)(const char *name); // ***** Module funcs stuff ***** enum ForwardExecType @@ -312,99 +310,100 @@ enum LibType LibType_Class }; -#define STKMARGIN ((cell)(16*sizeof(cell))) +#define STKMARGIN ((cell)(16 * sizeof(cell))) #define MSGBLOCK_SET 0 #define MSGBLOCK_GET 1 -#define BLOCK_NOT 0 -#define BLOCK_ONCE 1 -#define BLOCK_SET 2 -typedef void(*AUTHORIZEFUNC)( int player, const char *authstring ); +#define BLOCK_NOT 0 +#define BLOCK_ONCE 1 +#define BLOCK_SET 2 -typedef int(*PFN_ADD_NATIVES) ( const AMX_NATIVE_INFO * /*list*/ ); -typedef int(*PFN_ADD_NEW_NATIVES) ( const AMX_NATIVE_INFO * /*list*/ ); -typedef char * ( *PFN_BUILD_PATHNAME ) ( const char * /*format*/, ... ); -typedef char * ( *PFN_BUILD_PATHNAME_R ) ( char * /*buffer*/, size_t /* maxlen */, const char * /* format */, ... ); -typedef cell * ( *PFN_GET_AMXADDR ) ( AMX * /*amx*/, cell /*offset*/ ); -typedef cell * ( *PFN_GET_AMXVECTOR_NULL ) ( AMX * /*amx*/, cell /*offset*/ ); -typedef void(*PFN_PRINT_SRVCONSOLE) ( const char * /*format*/, ... ); -typedef const char * ( *PFN_GET_MODNAME ) ( void ); -typedef const char * ( *PFN_GET_AMXSCRIPTNAME ) ( int /*id*/ ); -typedef AMX * ( *PFN_GET_AMXSCRIPT ) ( int /*id*/ ); -typedef int(*PFN_FIND_AMXSCRIPT_BYAMX) ( const AMX * /*amx*/ ); -typedef int(*PFN_FIND_AMXSCRIPT_BYNAME) ( const char * /*name*/ ); -typedef int(*PFN_SET_AMXSTRING) ( AMX * /*amx*/, cell /*amx_addr*/, const char * /* source */, int /* max */ ); -typedef int(*PFN_SET_AMXSTRING_UTF8_CHAR) ( AMX *amx, cell amx_addr, const char *source, size_t sourcelen, size_t maxlen ); -typedef int(*PFN_SET_AMXSTRING_UTF8_CELL) ( AMX *amx, cell amx_addr, const cell *source, size_t sourcelen, size_t maxlen ); -typedef char * ( *PFN_GET_AMXSTRING ) ( AMX * /*amx*/, cell /*amx_addr*/, int /*bufferId*/, int * /*pLen*/ ); -typedef char * ( *PFN_GET_AMXSTRING_NULL ) ( AMX * /*amx*/, cell /*amx_addr*/, int /*bufferId*/, int * /*pLen*/ ); -typedef int(*PFN_GET_AMXSTRINGLEN) ( const cell *ptr ); -typedef char * ( *PFN_FORMAT_AMXSTRING ) ( AMX * /*amx*/, cell * /*params*/, int /*startParam*/, int * /*pLen*/ ); -typedef void(*PFN_COPY_AMXMEMORY) ( cell * /*dest*/, const cell * /*src*/, int /*len*/ ); -typedef void(*PFN_LOG) ( const char * /*fmt*/, ... ); -typedef void(*PFN_LOG_ERROR) ( AMX * /*amx*/, int /*err*/, const char * /*fmt*/, ... ); -typedef int(*PFN_RAISE_AMXERROR) ( AMX * /*amx*/, int /*error*/ ); -typedef int(*PFN_REGISTER_FORWARD) ( const char * /*funcname*/, ForwardExecType /*exectype*/, ... /*paramtypes terminated by PF_DONE*/ ); -typedef int(*PFN_EXECUTE_FORWARD) ( int /*id*/, ... /*params*/ ); -typedef cell(*PFN_PREPARE_CELLARRAY) ( cell * /*ptr*/, unsigned int /*size*/ ); -typedef cell(*PFN_PREPARE_CHARARRAY) ( char * /*ptr*/, unsigned int /*size*/ ); -typedef cell(*PFN_PREPARE_CELLARRAY_A) ( cell * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/ ); -typedef cell(*PFN_PREPARE_CHARARRAY_A) ( char * /*ptr*/, unsigned int /*size*/, bool /*copyBack*/ ); -typedef int(*PFN_IS_PLAYER_VALID) ( int /*id*/ ); -typedef const char * ( *PFN_GET_PLAYER_NAME ) ( int /*id*/ ); -typedef const char * ( *PFN_GET_PLAYER_IP ) ( int /*id*/ ); -typedef int(*PFN_IS_PLAYER_INGAME) ( int /*id*/ ); -typedef int(*PFN_IS_PLAYER_BOT) ( int /*id*/ ); -typedef int(*PFN_IS_PLAYER_AUTHORIZED) ( int /*id*/ ); -typedef float(*PFN_GET_PLAYER_TIME) ( int /*id*/ ); -typedef float(*PFN_GET_PLAYER_PLAYTIME) ( int /*id*/ ); -typedef int(*PFN_GETPLAYERFLAGS) ( int /* id*/ ); -typedef int(*PFN_GET_PLAYER_CURWEAPON) ( int /*id*/ ); -typedef const char * ( *PFN_GET_PLAYER_TEAM ) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_TEAMID) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_DEATHS) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_MENU) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_KEYS) ( int /*id*/ ); -typedef int(*PFN_IS_PLAYER_ALIVE) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_FRAGS) ( int /*id*/ ); -typedef int(*PFN_IS_PLAYER_CONNECTING) ( int /*id*/ ); -typedef int(*PFN_IS_PLAYER_HLTV) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_ARMOR) ( int /*id*/ ); -typedef int(*PFN_GET_PLAYER_HEALTH) ( int /*id*/ ); +typedef void(*AUTHORIZEFUNC) (int player, const char *authstring); + +typedef int(*PFN_ADD_NATIVES) (const AMX_NATIVE_INFO *list); +typedef int(*PFN_ADD_NEW_NATIVES) (const AMX_NATIVE_INFO *list); +typedef char*(*PFN_BUILD_PATHNAME) (const char *format, ...); +typedef char*(*PFN_BUILD_PATHNAME_R) (char *buffer, size_t maxlen, const char *format, ...); +typedef cell*(*PFN_GET_AMXADDR) (AMX *amx, cell offset); +typedef cell*(*PFN_GET_AMXVECTOR_NULL) (AMX *amx, cell offset); +typedef void(*PFN_PRINT_SRVCONSOLE) (const char *format, ...); +typedef const char*(*PFN_GET_MODNAME) (void); +typedef const char*(*PFN_GET_AMXSCRIPTNAME) (int id); +typedef AMX*(*PFN_GET_AMXSCRIPT) (int id); +typedef int(*PFN_FIND_AMXSCRIPT_BYAMX) (const AMX *amx); +typedef int(*PFN_FIND_AMXSCRIPT_BYNAME) (const char *name); +typedef int(*PFN_SET_AMXSTRING) (AMX *amx, cell amx_addr, const char *source, int max); +typedef int(*PFN_SET_AMXSTRING_UTF8_CHAR) (AMX *amx, cell amx_addr, const char *source, size_t sourcelen, size_t maxlen); +typedef int(*PFN_SET_AMXSTRING_UTF8_CELL) (AMX *amx, cell amx_addr, const cell *source, size_t sourcelen, size_t maxlen); +typedef char*(*PFN_GET_AMXSTRING) (AMX *amx, cell amx_addr, int bufferId, int *pLen); +typedef char*(*PFN_GET_AMXSTRING_NULL) (AMX *amx, cell amx_addr, int bufferId, int *pLen); +typedef int(*PFN_GET_AMXSTRINGLEN) (const cell *ptr); +typedef char *(*PFN_FORMAT_AMXSTRING) (AMX *amx, cell *params, int startParam, int *pLen); +typedef void(*PFN_COPY_AMXMEMORY) (cell *dest, const cell *src, int len); +typedef void(*PFN_LOG) (const char *fmt, ...); +typedef void(*PFN_LOG_ERROR) (AMX *amx, int err, const char *fmt, ...); +typedef int(*PFN_RAISE_AMXERROR) (AMX *amx, int error); +typedef int(*PFN_REGISTER_FORWARD) (const char *funcname, ForwardExecType exectype, ... /*paramtypes terminated by PF_DONE*/); +typedef int(*PFN_EXECUTE_FORWARD) (int id, ... /*params*/); +typedef cell(*PFN_PREPARE_CELLARRAY) (cell *ptr, unsigned int size); +typedef cell(*PFN_PREPARE_CHARARRAY) (char *ptr, unsigned int size); +typedef cell(*PFN_PREPARE_CELLARRAY_A) (cell *ptr, unsigned int size, bool copyBack); +typedef cell(*PFN_PREPARE_CHARARRAY_A) (char *ptr, unsigned int size, bool copyBack); +typedef int(*PFN_IS_PLAYER_VALID) (int id); +typedef const char*(*PFN_GET_PLAYER_NAME) (int id); +typedef const char*(*PFN_GET_PLAYER_IP) (int id); +typedef int(*PFN_IS_PLAYER_INGAME) (int id); +typedef int(*PFN_IS_PLAYER_BOT) (int id); +typedef int(*PFN_IS_PLAYER_AUTHORIZED) (int id); +typedef float(*PFN_GET_PLAYER_TIME) (int id); +typedef float(*PFN_GET_PLAYER_PLAYTIME) (int id); +typedef int(*PFN_GETPLAYERFLAGS) (int id); +typedef int(*PFN_GET_PLAYER_CURWEAPON) (int id); +typedef const char*(*PFN_GET_PLAYER_TEAM) (int id); +typedef int(*PFN_GET_PLAYER_TEAMID) (int id); +typedef int(*PFN_GET_PLAYER_DEATHS) (int id); +typedef int(*PFN_GET_PLAYER_MENU) (int id); +typedef int(*PFN_GET_PLAYER_KEYS) (int id); +typedef int(*PFN_IS_PLAYER_ALIVE) (int id); +typedef int(*PFN_GET_PLAYER_FRAGS) (int id); +typedef int(*PFN_IS_PLAYER_CONNECTING) (int id); +typedef int(*PFN_IS_PLAYER_HLTV) (int id); +typedef int(*PFN_GET_PLAYER_ARMOR) (int id); +typedef int(*PFN_GET_PLAYER_HEALTH) (int id); #ifdef USE_METAMOD -typedef edict_t * ( *PFN_GET_PLAYER_EDICT ) ( int /*id*/ ); +typedef edict_t *(*PFN_GET_PLAYER_EDICT) (int id); #else -typedef void * ( *PFN_GET_PLAYER_EDICT ) ( int /*id*/ ); +typedef void *(*PFN_GET_PLAYER_EDICT) (int id); #endif -typedef void * ( *PFN_PLAYER_PROP_ADDR ) ( int /*id*/, int /*prop*/ ); -typedef int(*PFN_AMX_EXEC) ( AMX* /*amx*/, cell* /*return val*/, int /*index*/ ); -typedef int(*PFN_AMX_EXECV) ( AMX* /*amx*/, cell* /*return val*/, int /*index*/, int /*numparams*/, cell[] /*params*/ ); -typedef int(*PFN_AMX_ALLOT) ( AMX* /*amx*/, int /*length*/, cell* /*amx_addr*/, cell** /*phys_addr*/ ); -typedef int(*PFN_AMX_FINDPUBLIC) ( AMX* /*amx*/, const char* /*func name*/, int* /*index*/ ); -typedef int(*PFN_AMX_FINDNATIVE) ( AMX* /*amx*/, const char* /*func name*/, int* /*index*/ ); -typedef int(*PFN_LOAD_AMXSCRIPT) ( AMX* /*amx*/, void** /*code*/, const char* /*path*/, char[64] /*error info*/, int /* debug */ ); -typedef int(*PFN_UNLOAD_AMXSCRIPT) ( AMX* /*amx*/, void** /*code*/ ); -typedef cell(*PFN_REAL_TO_CELL) ( REAL /*x*/ ); -typedef REAL(*PFN_CELL_TO_REAL) ( cell /*x*/ ); -typedef int(*PFN_REGISTER_SPFORWARD) ( AMX * /*amx*/, int /*func*/, ... /*params*/ ); -typedef int(*PFN_REGISTER_SPFORWARD_BYNAME) ( AMX * /*amx*/, const char * /*funcName*/, ... /*params*/ ); -typedef void(*PFN_UNREGISTER_SPFORWARD) ( int /*id*/ ); -typedef void(*PFN_MERGEDEFINITION_FILE) ( const char * /*filename*/ ); -typedef const char * ( *PFN_FORMAT ) ( const char * /*fmt*/, ... /*params*/ ); -typedef void(*PFN_REGISTERFUNCTION) ( void * /*pfn*/, const char * /*desc*/ ); -typedef int(*PFN_AMX_PUSH) ( AMX * /*amx*/, cell /*value*/ ); -typedef int(*PFN_SET_TEAM_INFO) ( int /*player */, int /*teamid */, const char * /*name */ ); -typedef void(*PFN_REG_AUTH_FUNC) ( AUTHORIZEFUNC ); -typedef void(*PFN_UNREG_AUTH_FUNC) ( AUTHORIZEFUNC ); -typedef int(*PFN_FINDLIBRARY) ( const char * /*name*/, LibType /*type*/ ); -typedef size_t(*PFN_ADDLIBRARIES) ( const char * /*name*/, LibType /*type*/, void * /*parent*/ ); -typedef size_t(*PFN_REMOVELIBRARIES) ( void * /*parent*/ ); -typedef void(*PFN_OVERRIDENATIVES) ( AMX_NATIVE_INFO * /*natives*/, const char * /*myname*/ ); -typedef const char * ( *PFN_GETLOCALINFO ) ( const char * /*name*/, const char * /*def*/ ); -typedef int(*PFN_AMX_REREGISTER) ( AMX * /*amx*/, AMX_NATIVE_INFO * /*list*/, int /*list*/ ); -typedef void * ( *PFN_REGISTERFUNCTIONEX ) ( void * /*pfn*/, const char * /*desc*/ ); -typedef void(*PFN_MESSAGE_BLOCK) ( int /* mode */, int /* message */, int * /* opt */ ); +typedef void *(*PFN_PLAYER_PROP_ADDR) (int id, int prop); +typedef int(*PFN_AMX_EXEC) (AMX *amx, cell *returnValue, int index); +typedef int(*PFN_AMX_EXECV) (AMX *amx, cell *returnValue, int index, int numparams, cell params[]); +typedef int(*PFN_AMX_ALLOT) (AMX *amx, int length, cell *amx_addr, cell **phys_addr); +typedef int(*PFN_AMX_FINDPUBLIC) (AMX *amx, const char *funcName, int *index); +typedef int(*PFN_AMX_FINDNATIVE) (AMX *amx, const char *funcName, int *index); +typedef int(*PFN_LOAD_AMXSCRIPT) (AMX *amx, void **code, const char *path, char errorInfo[64], int debug); +typedef int(*PFN_UNLOAD_AMXSCRIPT) (AMX *amx, void **code); +typedef cell(*PFN_REAL_TO_CELL) (REAL x); +typedef REAL(*PFN_CELL_TO_REAL) (cell x); +typedef int(*PFN_REGISTER_SPFORWARD) (AMX *amx, int func, ... /*params*/); +typedef int(*PFN_REGISTER_SPFORWARD_BYNAME) (AMX *amx, const char *funcName, ... /*params*/); +typedef void(*PFN_UNREGISTER_SPFORWARD) (int id); +typedef void(*PFN_MERGEDEFINITION_FILE) (const char *filename); +typedef const char *(*PFN_FORMAT) (const char *fmt, ... /*params*/); +typedef void(*PFN_REGISTERFUNCTION) (void *pfn, const char *desc); +typedef int(*PFN_AMX_PUSH) (AMX *amx, cell value); +typedef int(*PFN_SET_TEAM_INFO) (int player, int teamid, const char *name); +typedef void(*PFN_REG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef void(*PFN_UNREG_AUTH_FUNC) (AUTHORIZEFUNC); +typedef int(*PFN_FINDLIBRARY) (const char *name, LibType type); +typedef size_t(*PFN_ADDLIBRARIES) (const char *name, LibType type, void *parent); +typedef size_t(*PFN_REMOVELIBRARIES) (void *parent); +typedef void(*PFN_OVERRIDENATIVES) (AMX_NATIVE_INFO *natives, const char *myname); +typedef const char *(*PFN_GETLOCALINFO) (const char *name, const char *def); +typedef int(*PFN_AMX_REREGISTER) (AMX *amx, AMX_NATIVE_INFO *list, int list2); +typedef void *(*PFN_REGISTERFUNCTIONEX) (void *pfn, const char *desc); +typedef void(*PFN_MESSAGE_BLOCK) (int mode, int message, int *opt); struct amxxapi_t { @@ -522,4 +521,4 @@ struct getAmxString char temp[1024]; }; -#endif // __AMXXMODULE_H__ \ No newline at end of file +#endif // __AMXXMODULE_H__ diff --git a/reapi/src/precompiled.h b/reapi/src/precompiled.h index ee6dd7d..a951d0f 100644 --- a/reapi/src/precompiled.h +++ b/reapi/src/precompiled.h @@ -8,10 +8,6 @@ #include // for strncpy(), etc #include // std::vector - -#include "basetypes.h" -#include "asmlib.h" - #include #include #include