mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Light cleanup and work for future
Moved some structures around and added ehandle headers.
This commit is contained in:
parent
b21fa6b665
commit
1cf03355a5
@ -9,6 +9,34 @@
|
|||||||
#define BASECOMBATCHARACTER_H
|
#define BASECOMBATCHARACTER_H
|
||||||
#include "baseanimatingoverlay.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
|
// Purpose: This should contain all of the combat entry points / functionality
|
||||||
|
@ -20,34 +20,6 @@
|
|||||||
|
|
||||||
|
|
||||||
// TODO: Move to separate header file!!
|
// 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
|
struct ThirdPersonViewData
|
||||||
{
|
{
|
||||||
char gap_0[8];
|
char gap_0[8];
|
||||||
|
196
r5dev/game/shared/ehandle.h
Normal file
196
r5dev/game/shared/ehandle.h
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
//========= Copyright <20> 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<T> 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<T> 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<T> 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<class T>
|
||||||
|
inline CHandle<T>::CHandle()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T>::CHandle( INVALID_EHANDLE_tag )
|
||||||
|
: CBaseHandle( INVALID_EHANDLE )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T>::CHandle( int iEntry, int iSerialNumber )
|
||||||
|
{
|
||||||
|
Init( iEntry, iSerialNumber );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T>::CHandle( T *pObj )
|
||||||
|
: CBaseHandle( INVALID_EHANDLE )
|
||||||
|
{
|
||||||
|
Set( pObj );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T> CHandle<T>::UnsafeFromBaseHandle( const CBaseHandle &handle )
|
||||||
|
{
|
||||||
|
CHandle<T> ret;
|
||||||
|
ret.m_Index = handle.m_Index;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T> CHandle<T>::UnsafeFromIndex( int index )
|
||||||
|
{
|
||||||
|
CHandle<T> ret;
|
||||||
|
ret.m_Index = index;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline T* CHandle<T>::Get() const
|
||||||
|
{
|
||||||
|
return (T*)CBaseHandle::Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T>::operator T *()
|
||||||
|
{
|
||||||
|
return Get( );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T>::operator T *() const
|
||||||
|
{
|
||||||
|
return Get( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline bool CHandle<T>::operator !() const
|
||||||
|
{
|
||||||
|
return !Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline bool CHandle<T>::operator==( T *val ) const
|
||||||
|
{
|
||||||
|
return Get() == val;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline bool CHandle<T>::operator!=( T *val ) const
|
||||||
|
{
|
||||||
|
return Get() != val;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
void CHandle<T>::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<const IHandleEntity*>( pVal );
|
||||||
|
CBaseHandle::Set( pValInterface );
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
inline CHandle<T>& CHandle<T>::operator=( const T *val )
|
||||||
|
{
|
||||||
|
Set( val );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
T* CHandle<T>::operator -> () const
|
||||||
|
{
|
||||||
|
return Get();
|
||||||
|
}
|
||||||
|
|
||||||
|
// specialization of EnsureValidValue for CHandle<T>
|
||||||
|
template<typename T>
|
||||||
|
FORCEINLINE void EnsureValidValue( CHandle<T> &x ) { x = INVALID_EHANDLE; }
|
||||||
|
|
||||||
|
|
||||||
|
#endif // EHANDLE_H
|
26
r5dev/game/shared/predictioncopy.h
Normal file
26
r5dev/game/shared/predictioncopy.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//====== Copyright <20> 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<C_BaseEntity> EHANDLE;
|
||||||
|
|
||||||
|
#else
|
||||||
|
class CBaseEntity;
|
||||||
|
typedef CHandle<CBaseEntity> EHANDLE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // PREDICTIONCOPY_H
|
@ -233,7 +233,9 @@
|
|||||||
<ClInclude Include="..\game\client\viewrender.h" />
|
<ClInclude Include="..\game\client\viewrender.h" />
|
||||||
<ClInclude Include="..\game\shared\animation.h" />
|
<ClInclude Include="..\game\shared\animation.h" />
|
||||||
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
||||||
|
<ClInclude Include="..\game\shared\ehandle.h" />
|
||||||
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
||||||
|
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
||||||
<ClInclude Include="..\game\shared\shared_classnames.h" />
|
<ClInclude Include="..\game\shared\shared_classnames.h" />
|
||||||
<ClInclude Include="..\game\shared\takedamageinfo.h" />
|
<ClInclude Include="..\game\shared\takedamageinfo.h" />
|
||||||
<ClInclude Include="..\inputsystem\ButtonCode.h" />
|
<ClInclude Include="..\inputsystem\ButtonCode.h" />
|
||||||
|
@ -1916,6 +1916,12 @@
|
|||||||
<ClInclude Include="..\game\shared\takedamageinfo.h">
|
<ClInclude Include="..\game\shared\takedamageinfo.h">
|
||||||
<Filter>sdk\game\shared</Filter>
|
<Filter>sdk\game\shared</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\predictioncopy.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\ehandle.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\shared\resource\lockedserver.png">
|
<Image Include="..\shared\resource\lockedserver.png">
|
||||||
|
@ -190,7 +190,9 @@
|
|||||||
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
<ClInclude Include="..\game\server\playerlocaldata.h" />
|
||||||
<ClInclude Include="..\game\shared\animation.h" />
|
<ClInclude Include="..\game\shared\animation.h" />
|
||||||
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
||||||
|
<ClInclude Include="..\game\shared\ehandle.h" />
|
||||||
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
||||||
|
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
||||||
<ClInclude Include="..\game\shared\shared_classnames.h" />
|
<ClInclude Include="..\game\shared\shared_classnames.h" />
|
||||||
<ClInclude Include="..\game\shared\takedamageinfo.h" />
|
<ClInclude Include="..\game\shared\takedamageinfo.h" />
|
||||||
<ClInclude Include="..\launcher\IApplication.h" />
|
<ClInclude Include="..\launcher\IApplication.h" />
|
||||||
|
@ -1350,6 +1350,12 @@
|
|||||||
<ClInclude Include="..\game\server\basecombatcharacter.h">
|
<ClInclude Include="..\game\server\basecombatcharacter.h">
|
||||||
<Filter>sdk\game\server</Filter>
|
<Filter>sdk\game\server</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\predictioncopy.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\ehandle.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\common\opcodes.cpp">
|
<ClCompile Include="..\common\opcodes.cpp">
|
||||||
|
@ -263,7 +263,9 @@
|
|||||||
<ClInclude Include="..\game\shared\ai_utility_shared.h" />
|
<ClInclude Include="..\game\shared\ai_utility_shared.h" />
|
||||||
<ClInclude Include="..\game\shared\animation.h" />
|
<ClInclude Include="..\game\shared\animation.h" />
|
||||||
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
<ClInclude Include="..\game\shared\collisionproperty.h" />
|
||||||
|
<ClInclude Include="..\game\shared\ehandle.h" />
|
||||||
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
<ClInclude Include="..\game\shared\playernet_vars.h" />
|
||||||
|
<ClInclude Include="..\game\shared\predictioncopy.h" />
|
||||||
<ClInclude Include="..\game\shared\shared_classnames.h" />
|
<ClInclude Include="..\game\shared\shared_classnames.h" />
|
||||||
<ClInclude Include="..\game\shared\takedamageinfo.h" />
|
<ClInclude Include="..\game\shared\takedamageinfo.h" />
|
||||||
<ClInclude Include="..\inputsystem\ButtonCode.h" />
|
<ClInclude Include="..\inputsystem\ButtonCode.h" />
|
||||||
|
@ -2054,6 +2054,12 @@
|
|||||||
<ClInclude Include="..\game\server\basecombatcharacter.h">
|
<ClInclude Include="..\game\server\basecombatcharacter.h">
|
||||||
<Filter>sdk\game\server</Filter>
|
<Filter>sdk\game\server</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\predictioncopy.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\game\shared\ehandle.h">
|
||||||
|
<Filter>sdk\game\shared</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Image Include="..\shared\resource\lockedserver.png">
|
<Image Include="..\shared\resource\lockedserver.png">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user