diff --git a/r5dev/game/server/basecombatcharacter.h b/r5dev/game/server/basecombatcharacter.h index 162ea82a..ef93c12a 100644 --- a/r5dev/game/server/basecombatcharacter.h +++ b/r5dev/game/server/basecombatcharacter.h @@ -9,6 +9,34 @@ #define BASECOMBATCHARACTER_H #include "baseanimatingoverlay.h" +struct WeaponDropInfo +{ + Vector3D weaponPosition; + char prevDropFrameCounter; + char dropFrameCounter; + char gap_e[2]; + Vector3D weaponAngles; + float weaponPositionTime; +}; + +/* 1410 */ +struct WeaponInventory +{ + char gap_0[8]; + int weapons[9]; + int offhandWeapons[6]; + int activeWeapons[3]; +}; + +struct CTether +{ + char gap_0[8]; + Vector3D pos; + float health; + float nextSoundTime; + float creationTime; + int scriptID; +}; //----------------------------------------------------------------------------- // Purpose: This should contain all of the combat entry points / functionality diff --git a/r5dev/game/server/player.h b/r5dev/game/server/player.h index ec54e79f..292ece94 100644 --- a/r5dev/game/server/player.h +++ b/r5dev/game/server/player.h @@ -20,34 +20,6 @@ // TODO: Move to separate header file!! -struct WeaponDropInfo -{ - Vector3D weaponPosition; - char prevDropFrameCounter; - char dropFrameCounter; - char gap_e[2]; - Vector3D weaponAngles; - float weaponPositionTime; -}; - -/* 1410 */ -struct WeaponInventory -{ - char gap_0[8]; - int weapons[9]; - int offhandWeapons[6]; - int activeWeapons[3]; -}; -struct CTether -{ - char gap_0[8]; - Vector3D pos; - float health; - float nextSoundTime; - float creationTime; - int scriptID; -}; - struct ThirdPersonViewData { char gap_0[8]; diff --git a/r5dev/game/shared/ehandle.h b/r5dev/game/shared/ehandle.h new file mode 100644 index 00000000..2a557394 --- /dev/null +++ b/r5dev/game/shared/ehandle.h @@ -0,0 +1,196 @@ +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef EHANDLE_H +#define EHANDLE_H +#ifdef _WIN32 +#pragma once +#endif + +#if defined( _DEBUG ) && defined( GAME_DLL ) +#include "tier0/dbg.h" +#include "cbase.h" +#endif + + +#include "public/const.h" +#include "public/basehandle.h" +//#include "entitylist_base.h" + + +class IHandleEntity; + + +// -------------------------------------------------------------------------------------------------- // +// Game-code CBaseHandle implementation. +// -------------------------------------------------------------------------------------------------- // +/* +inline IHandleEntity* CBaseHandle::Get() const +{ + extern CBaseEntityList *g_pEntityList; + return g_pEntityList->LookupEntity( *this ); +} +*/ // !TODO: Obtain ptr. + +// -------------------------------------------------------------------------------------------------- // +// CHandle. +// +// Only safe to use in cases where you can statically verify that T* can safely be reinterpret-casted +// to IHandleEntity*; that is, that it's derived from IHandleEntity and IHandleEntity is the +// first base class. +// +// Unfortunately some classes are forward-declared and the compiler can't determine at compile time +// how to static_cast<> them to IHandleEntity. +// -------------------------------------------------------------------------------------------------- // +template< class T > +class CHandle : public CBaseHandle +{ +public: + + CHandle(); + CHandle( int iEntry, int iSerialNumber ); + /*implicit*/ CHandle( T *pVal ); + /*implicit*/ CHandle( INVALID_EHANDLE_tag ); + + // NOTE: The following two constructor functions are not type-safe, and can allow creating a + // CHandle that doesn't actually point to an object of type T. + // + // It is your responsibility to ensure that the target of the handle actually points to the + // correct type of object before calling these functions. + + static CHandle UnsafeFromBaseHandle( const CBaseHandle& handle ); + + // The index should have come from a call to CBaseHandle::ToInt(). If it hasn't, you're in trouble. + static CHandle UnsafeFromIndex( int index ); + + T* Get() const; + void Set( const T* pVal ); + + /*implicit*/ operator T*(); + /*implicit*/ operator T*() const; + + bool operator !() const; + bool operator==( T *val ) const; + bool operator!=( T *val ) const; + CHandle& operator=( const T *val ); + + T* operator->() const; +}; + +// ----------------------------------------------------------------------- // +// Inlines. +// ----------------------------------------------------------------------- // + +template +inline CHandle::CHandle() +{ +} + +template +inline CHandle::CHandle( INVALID_EHANDLE_tag ) + : CBaseHandle( INVALID_EHANDLE ) +{ +} + +template +inline CHandle::CHandle( int iEntry, int iSerialNumber ) +{ + Init( iEntry, iSerialNumber ); +} + +template +inline CHandle::CHandle( T *pObj ) + : CBaseHandle( INVALID_EHANDLE ) +{ + Set( pObj ); +} + +template +inline CHandle CHandle::UnsafeFromBaseHandle( const CBaseHandle &handle ) +{ + CHandle ret; + ret.m_Index = handle.m_Index; + return ret; +} + +template +inline CHandle CHandle::UnsafeFromIndex( int index ) +{ + CHandle ret; + ret.m_Index = index; + return ret; +} + +template +inline T* CHandle::Get() const +{ + return (T*)CBaseHandle::Get(); +} + + +template +inline CHandle::operator T *() +{ + return Get( ); +} + +template +inline CHandle::operator T *() const +{ + return Get( ); +} + + +template +inline bool CHandle::operator !() const +{ + return !Get(); +} + +template +inline bool CHandle::operator==( T *val ) const +{ + return Get() == val; +} + +template +inline bool CHandle::operator!=( T *val ) const +{ + return Get() != val; +} + +template +void CHandle::Set( const T* pVal ) +{ + // We can't even verify that the class can successfully reinterpret-cast to IHandleEntity* + // because that will cause this function to fail to compile in Debug in the case of forward-declared + // pointer types. + //Assert( reinterpret_cast< const IHandleEntity* >( pVal ) == static_cast< IHandleEntity* >( pVal ) ); + + const IHandleEntity* pValInterface = reinterpret_cast( pVal ); + CBaseHandle::Set( pValInterface ); +} + +template +inline CHandle& CHandle::operator=( const T *val ) +{ + Set( val ); + return *this; +} + +template +T* CHandle::operator -> () const +{ + return Get(); +} + +// specialization of EnsureValidValue for CHandle +template +FORCEINLINE void EnsureValidValue( CHandle &x ) { x = INVALID_EHANDLE; } + + +#endif // EHANDLE_H diff --git a/r5dev/game/shared/predictioncopy.h b/r5dev/game/shared/predictioncopy.h new file mode 100644 index 00000000..65dc7fe6 --- /dev/null +++ b/r5dev/game/shared/predictioncopy.h @@ -0,0 +1,26 @@ +//====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef PREDICTIONCOPY_H +#define PREDICTIONCOPY_H +#ifdef _WIN32 +#pragma once +#endif + +#include "ehandle.h" +#include "public/baseentity.h" + +#if defined( CLIENT_DLL ) +class C_BaseEntity; +typedef CHandle EHANDLE; + +#else +class CBaseEntity; +typedef CHandle EHANDLE; +#endif + +#endif // PREDICTIONCOPY_H \ No newline at end of file diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index 062c8dd3..cbe6b624 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -233,7 +233,9 @@ + + diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters index a8c34894..836ac559 100644 --- a/r5dev/vproj/clientsdk.vcxproj.filters +++ b/r5dev/vproj/clientsdk.vcxproj.filters @@ -1916,6 +1916,12 @@ sdk\game\shared + + sdk\game\shared + + + sdk\game\shared + diff --git a/r5dev/vproj/dedicated.vcxproj b/r5dev/vproj/dedicated.vcxproj index 8baa7c58..bcc4b663 100644 --- a/r5dev/vproj/dedicated.vcxproj +++ b/r5dev/vproj/dedicated.vcxproj @@ -190,7 +190,9 @@ + + diff --git a/r5dev/vproj/dedicated.vcxproj.filters b/r5dev/vproj/dedicated.vcxproj.filters index a67cf3f7..1648ec85 100644 --- a/r5dev/vproj/dedicated.vcxproj.filters +++ b/r5dev/vproj/dedicated.vcxproj.filters @@ -1350,6 +1350,12 @@ sdk\game\server + + sdk\game\shared + + + sdk\game\shared + diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj index d9e5831e..a36496f0 100644 --- a/r5dev/vproj/gamesdk.vcxproj +++ b/r5dev/vproj/gamesdk.vcxproj @@ -263,7 +263,9 @@ + + diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters index ebc4dff4..9704f794 100644 --- a/r5dev/vproj/gamesdk.vcxproj.filters +++ b/r5dev/vproj/gamesdk.vcxproj.filters @@ -2054,6 +2054,12 @@ sdk\game\server + + sdk\game\shared + + + sdk\game\shared +