Finished CPlayer inheritance

This commit is contained in:
Amos 2023-01-18 12:39:18 +01:00
parent 75406ab7bc
commit b63765e1dc
9 changed files with 338 additions and 248 deletions

View File

@ -0,0 +1,130 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
//===========================================================================//
#ifndef BASEANIMATING_H
#define BASEANIMATING_H
#ifdef _WIN32
#pragma once
#endif
#include "public/baseentity.h"
#include "game/shared/animation.h"
#include "public/studio.h"
class CBaseAnimating : public CBaseEntity
{
char gap_b04[12];
bool m_markedForServerInterpolation;
bool m_animRemoveFromServerInterpolationNextFrame;
char gap_b12[2];
float m_flGroundSpeed;
float m_flLastEventCheck;
int m_nForceBone;
Vector3D m_vecForce;
int m_nSkin;
__int16 m_skinMod;
char gap_b32[2];
int m_nBody;
int m_camoIndex;
int m_decalIndex;
int m_nHitboxSet;
float m_flModelScale;
int m_nRagdollImpactFXTableId;
float m_flSkyScaleStartTime;
float m_flSkyScaleEndTime;
float m_flSkyScaleStartValue;
float m_flSkyScaleEndValue;
char gap_b5c[4];
char m_SequenceTransitioner[368];
float m_flIKGroundContactTime;
float m_flIKGroundMinHeight;
float m_flIKGroundMaxHeight;
float m_flEstIkFloor;
float m_flEstIkOffset;
char gap_ce4[4];
char m_pIk[8];
int m_ikPrevSequence;
bool m_bSequenceFinished;
bool m_bSequenceLooped;
bool m_bSequenceLoops;
bool m_continueAnimatingAfterRagdoll;
float m_lockedAnimDeltaYaw;
bool m_threadedBoneSetup;
bool m_settingUpBones;
char gap_cfe[2];
float m_flDissolveStartTime;
int m_baseAnimatingActivity;
float m_flPoseParameter[12];
bool m_poseParameterOverTimeActive;
char gap_d39[3];
float m_poseParameterGoalValue[12];
float m_poseParameterEndTime[12];
float m_lastTimeSetPoseParametersSameAs;
bool m_bClientSideAnimation;
bool m_bReallyClientSideAnimation;
char gap_da2[2];
int m_nNewSequenceParity;
int m_nResetEventsParity;
char gap_dac[4];
__int64 m_boneCacheHandle;
__int16 m_fBoneCacheFlags; // END CBASEANIMATING
char gap_dba[2];
int m_animNetworkFlags;
bool m_animActive;
bool m_animCollisionEnabled;
bool m_animPlantingEnabled;
bool m_animInitialCorrection;
bool m_animWaitingForCleanup;
char gap_dc5[3];
int m_animWaitingForCleanupTime;
char gap_dcc[4];
__int64 m_recordedAnim;
int m_recordedAnimIndex;
int m_recordedAnimCachedFrameIndex;
float m_recordedAnimPlaybackRate;
float m_recordedAnimPlaybackTime;
matrix3x4_t m_recordedAnimTransform;
int m_recordedAnimPlaybackEnt;
float m_recordedAnimBlendTime;
Vector3D m_recordedAnimBlendOffset;
Vector3D m_recordedAnimBlendAngles;
AnimRelativeData m_animRelativeData;
int m_syncingWithEntity;
char gap_ec4[4];
PredictedAnimEventData m_predictedAnimEventData;
int m_animRefEntityAttachmentIndex;
int m_fireAttachmentSmartAmmoIndex;
int m_fireAttachmentChestFocusIndex;
int m_fireAttachmentModelIndex;
char m_keyHitboxes[160];
CStudioHdr* m_pStudioHdr;
int m_animSequence;
float m_animCycle;
int m_animModelIndex;
float m_animStartTime;
float m_animStartCycle;
float m_animPlaybackRate;
bool m_animFrozen;
char gap_ff9[7];
__int64 m_createdProp[8];
int m_numCreatedProps;
char gap_1044[4];
__int64 m_currentFramePropEvents[16];
int m_numCurrentFramePropEvents;
char gap_10cc[4];
__int64 m_activeScriptAnimWindows[8];
int m_numActiveScriptAnimWindows;
char gap_1114[4];
__int64 m_currentFrameWindowEvents[16];
int m_numCurrentFrameWindowEvents;
char gap_119c[4];
__int64 m_AnimSyncScriptProps[8];
int m_numAnimSyncScriptProps;
char gap_11E4[12]; // TODO: this might belong to CBaseAnimatingOverlay!
};
#endif // BASEANIMATING_H

View File

@ -0,0 +1,48 @@
//====== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. =======//
//
// Purpose:
//
// $NoKeywords: $
//
//=============================================================================//
// #include "BaseAnimating.h"
#ifndef BASE_ANIMATING_OVERLAY_H
#define BASE_ANIMATING_OVERLAY_H
#ifdef _WIN32
#pragma once
#endif
#include "baseanimating.h"
class CBaseAnimatingOverlay : public CBaseAnimating
{
int m_maxOverlays;
char gap_11f4[4];
CAnimationLayer m_AnimOverlay;
char gap_1228[384];
int m_AnimOverlayCount;
char m_overlayEventParity[9];
bool m_animOverlayIsActive[9];
char gap_13be[2];
int m_animOverlayModelIndex[9];
int m_animOverlaySequence[9];
float m_animOverlayCycle[9];
float m_animOverlayStartTime[9];
float m_animOverlayStartCycle[9];
float m_animOverlayPlaybackRate[9];
float m_animOverlayWeight[9];
int m_animOverlayOrder[9];
float m_animOverlayAnimTime[9];
float m_animOverlayFadeInDuration[9];
float m_animOverlayFadeOutDuration[9];
bool m_localAnimOverlayIsActive[4];
int m_localAnimOverlayModelIndex[4];
int m_localAnimOverlaySequence[4];
float m_localAnimOverlayStartTime[4];
float m_localAnimOverlayWeight[4];
float m_localAnimOverlayFadeInDuration[4];
float m_localAnimOverlayFadeOutDuration[4];
};
#endif // BASE_ANIMATING_OVERLAY_H

View File

@ -0,0 +1,122 @@
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: Base combat character with no AI
//
// $NoKeywords: $
//===========================================================================//
#ifndef BASECOMBATCHARACTER_H
#define BASECOMBATCHARACTER_H
#include "baseanimatingoverlay.h"
//-----------------------------------------------------------------------------
// Purpose: This should contain all of the combat entry points / functionality
// that are common between NPCs and players
//-----------------------------------------------------------------------------
class CBaseCombatCharacter : public CBaseAnimatingOverlay
{
bool m_bPreventWeaponPickup;
char gap_15b1[3];
float m_phaseShiftTimeStart;
float m_phaseShiftTimeEnd;
float m_flNextAttack;
float m_lastFiredTime;
int m_lastFiredWeapon;
float m_raiseFromMeleeEndTime;
float m_nextFlamethrowerStatusEffectUpdateTime;
int m_lastFlamethrowerStatusEffectInflictor;
int m_lastFlamethrowerStatusEffectAttacker;
int m_sharedEnergyCount;
int m_sharedEnergyTotal;
int m_sharedEnergyLockoutThreshold;
float m_lastSharedEnergyRegenTime;
float m_sharedEnergyRegenRate;
float m_sharedEnergyRegenDelay;
float m_lastSharedEnergyTakeTime;
int m_eHull;
float m_fieldOfViewCos;
Vector3D m_HackedGunPos;
float m_impactEnergyScale;
WeaponDropInfo m_weaponDropInfo;
float m_physicsMass;
float m_flDamageAccumulator;
int m_prevHealth;
float m_healthChangeRate;
float m_healthChangeAmount;
float m_healthChangeStartTime;
float m_lastHealthChangeTime;
int m_lastHitGroup;
Vector3D m_lastDamageDir;
Vector3D m_lastDamageForce;
int m_deathPackage;
Vector3D m_deathDirection2DInverse;
int m_CurrentWeaponProficiency;
float m_flEnemyAccurcyMultiplier;
int m_npcPriorityOverride;
int m_healthPerSegment;
char gap_1684[4];
WeaponInventory m_inventory;
char m_selectedWeapons[2];
char gap_16da[2];
int m_latestPrimaryWeapons[2];
int m_latestPrimaryWeaponsIndexZeroOrOne[2];
char m_latestNonOffhandWeapons[2];
char m_selectedOffhands[3];
char m_selectedOffhandsPendingHybridAction[3];
char m_lastCycleSlot;
char gap_16f5[3];
int m_weaponGettingSwitchedOut[2];
bool m_showActiveWeapon3p[2];
char gap_1702[2];
int m_weaponPermission;
float m_weaponDelayEnableTime;
char m_weaponDisabledFlags;
bool m_hudInfo_visibilityTestAlwaysPasses;
bool m_weaponDisabledInScript;
char gap_170f[1];
int m_removeWeaponOnSelectSwitch;
int m_latestMeleeWeapon;
bool m_doOffhandAnim;
bool m_wantInventoryChangedScriptCall;
bool m_doInventoryChangedScriptCall;
char gap_171b[1];
float m_cloakReactEndTime;
CTether m_tethers[2];
char gap_1768[8];
int m_titanSoul;
Vector3D m_lastFootstepDamagePos;
bool m_lastFoostepDamageOnGround;
char gap_1781[3];
int m_muzzleAttachment[2];
int m_weaponHandAttachment;
int m_weaponAltHandAttachment;
int m_prevNearestNode;
int m_nearestNode;
float m_nearestNodeCheckTime;
Vector3D m_nearestNodeCheckPos;
int m_nearestPolyRef[5];
Vector3D m_nearestPolyCheckPos[5];
int m_contextAction;
char m_weaponAnimEvents[16648];
char m_targetInfoIconName[64];
bool m_titanStepDamage;
char gap_5949[3];
int m_latest3pWeaponGettingEquipped[2];
char gap_5954[12];
char m_szNetname[256];
bool m_zoomViewdriftDebounceEnabled;
bool m_bZooming;
char gap_5a62[2];
float m_zoomToggleOnStartTime;
float m_zoomBaseFrac;
float m_zoomBaseTime;
float m_zoomFullStartTime;
int m_physicsSolidMask;
int m_rightHandAttachment;
int m_leftHandAttachment;
int m_headAttachment;
int m_chestAttachment;
};
#endif // BASECOMBATCHARACTER_H

View File

@ -15,22 +15,11 @@
#include "game/shared/animation.h"
#include "game/shared/takedamageinfo.h"
#include "playerlocaldata.h"
#include "basecombatcharacter.h"
#include <mathlib/vector4d.h>
// TODO: Move to separate header file!!
struct __declspec(align(8)) PredictedAnimEventData
{
char gap_0[8];
float m_predictedAnimEventTimes[8];
int m_predictedAnimEventIndices[8];
int m_predictedAnimEventCount;
int m_predictedAnimEventTarget;
int m_predictedAnimEventSequence;
int m_predictedAnimEventModel;
float m_predictedAnimEventsReadyToFireTime;
};
struct WeaponDropInfo
{
Vector3D weaponPosition;
@ -268,243 +257,8 @@ struct SpeedChangeHistoryEntry
};
class CPlayer : public CBaseEntity // !TODO: proper inheritance; separate into classes according to RTTI.
class CPlayer : public CBaseCombatCharacter
{
char gap_b04[12];
bool m_markedForServerInterpolation;
bool m_animRemoveFromServerInterpolationNextFrame;
char gap_b12[2];
float m_flGroundSpeed;
float m_flLastEventCheck;
int m_nForceBone;
Vector3D m_vecForce;
int m_nSkin;
__int16 m_skinMod;
char gap_b32[2];
int m_nBody;
int m_camoIndex;
int m_decalIndex;
int m_nHitboxSet;
float m_flModelScale;
int m_nRagdollImpactFXTableId;
float m_flSkyScaleStartTime;
float m_flSkyScaleEndTime;
float m_flSkyScaleStartValue;
float m_flSkyScaleEndValue;
char gap_b5c[4];
char m_SequenceTransitioner[368];
float m_flIKGroundContactTime;
float m_flIKGroundMinHeight;
float m_flIKGroundMaxHeight;
float m_flEstIkFloor;
float m_flEstIkOffset;
char gap_ce4[4];
char m_pIk[8];
int m_ikPrevSequence;
bool m_bSequenceFinished;
bool m_bSequenceLooped;
bool m_bSequenceLoops;
bool m_continueAnimatingAfterRagdoll;
float m_lockedAnimDeltaYaw;
bool m_threadedBoneSetup;
bool m_settingUpBones;
char gap_cfe[2];
float m_flDissolveStartTime;
int m_baseAnimatingActivity;
float m_flPoseParameter[12];
bool m_poseParameterOverTimeActive;
char gap_d39[3];
float m_poseParameterGoalValue[12];
float m_poseParameterEndTime[12];
float m_lastTimeSetPoseParametersSameAs;
bool m_bClientSideAnimation;
bool m_bReallyClientSideAnimation;
char gap_da2[2];
int m_nNewSequenceParity;
int m_nResetEventsParity;
char gap_dac[4];
__int64 m_boneCacheHandle;
__int16 m_fBoneCacheFlags;
char gap_dba[2];
int m_animNetworkFlags;
bool m_animActive;
bool m_animCollisionEnabled;
bool m_animPlantingEnabled;
bool m_animInitialCorrection;
bool m_animWaitingForCleanup;
char gap_dc5[3];
int m_animWaitingForCleanupTime;
char gap_dcc[4];
__int64 m_recordedAnim;
int m_recordedAnimIndex;
int m_recordedAnimCachedFrameIndex;
float m_recordedAnimPlaybackRate;
float m_recordedAnimPlaybackTime;
matrix3x4_t m_recordedAnimTransform;
int m_recordedAnimPlaybackEnt;
float m_recordedAnimBlendTime;
Vector3D m_recordedAnimBlendOffset;
Vector3D m_recordedAnimBlendAngles;
AnimRelativeData m_animRelativeData;
int m_syncingWithEntity;
char gap_ec4[4];
PredictedAnimEventData m_predictedAnimEventData;
int m_animRefEntityAttachmentIndex;
int m_fireAttachmentSmartAmmoIndex;
int m_fireAttachmentChestFocusIndex;
int m_fireAttachmentModelIndex;
char m_keyHitboxes[160];
CStudioHdr* m_pStudioHdr;
int m_animSequence;
float m_animCycle;
int m_animModelIndex;
float m_animStartTime;
float m_animStartCycle;
float m_animPlaybackRate;
bool m_animFrozen;
char gap_ff9[7];
__int64 m_createdProp[8];
int m_numCreatedProps;
char gap_1044[4];
__int64 m_currentFramePropEvents[16];
int m_numCurrentFramePropEvents;
char gap_10cc[4];
__int64 m_activeScriptAnimWindows[8];
int m_numActiveScriptAnimWindows;
char gap_1114[4];
__int64 m_currentFrameWindowEvents[16];
int m_numCurrentFrameWindowEvents;
char gap_119c[4];
__int64 m_AnimSyncScriptProps[8];
int m_numAnimSyncScriptProps;
char gap_11E4[12];
int m_maxOverlays;
char gap_11f4[4];
CAnimationLayer m_AnimOverlay;
char gap_1228[384];
int m_AnimOverlayCount;
char m_overlayEventParity[9];
bool m_animOverlayIsActive[9];
char gap_13be[2];
int m_animOverlayModelIndex[9];
int m_animOverlaySequence[9];
float m_animOverlayCycle[9];
float m_animOverlayStartTime[9];
float m_animOverlayStartCycle[9];
float m_animOverlayPlaybackRate[9];
float m_animOverlayWeight[9];
int m_animOverlayOrder[9];
float m_animOverlayAnimTime[9];
float m_animOverlayFadeInDuration[9];
float m_animOverlayFadeOutDuration[9];
bool m_localAnimOverlayIsActive[4];
int m_localAnimOverlayModelIndex[4];
int m_localAnimOverlaySequence[4];
float m_localAnimOverlayStartTime[4];
float m_localAnimOverlayWeight[4];
float m_localAnimOverlayFadeInDuration[4];
float m_localAnimOverlayFadeOutDuration[4];
bool m_bPreventWeaponPickup;
char gap_15b1[3];
float m_phaseShiftTimeStart;
float m_phaseShiftTimeEnd;
float m_flNextAttack;
float m_lastFiredTime;
int m_lastFiredWeapon;
float m_raiseFromMeleeEndTime;
float m_nextFlamethrowerStatusEffectUpdateTime;
int m_lastFlamethrowerStatusEffectInflictor;
int m_lastFlamethrowerStatusEffectAttacker;
int m_sharedEnergyCount;
int m_sharedEnergyTotal;
int m_sharedEnergyLockoutThreshold;
float m_lastSharedEnergyRegenTime;
float m_sharedEnergyRegenRate;
float m_sharedEnergyRegenDelay;
float m_lastSharedEnergyTakeTime;
int m_eHull;
float m_fieldOfViewCos;
Vector3D m_HackedGunPos;
float m_impactEnergyScale;
WeaponDropInfo m_weaponDropInfo;
float m_physicsMass;
float m_flDamageAccumulator;
int m_prevHealth;
float m_healthChangeRate;
float m_healthChangeAmount;
float m_healthChangeStartTime;
float m_lastHealthChangeTime;
int m_lastHitGroup;
Vector3D m_lastDamageDir;
Vector3D m_lastDamageForce;
int m_deathPackage;
Vector3D m_deathDirection2DInverse;
int m_CurrentWeaponProficiency;
float m_flEnemyAccurcyMultiplier;
int m_npcPriorityOverride;
int m_healthPerSegment;
char gap_1684[4];
WeaponInventory m_inventory;
char m_selectedWeapons[2];
char gap_16da[2];
int m_latestPrimaryWeapons[2];
int m_latestPrimaryWeaponsIndexZeroOrOne[2];
char m_latestNonOffhandWeapons[2];
char m_selectedOffhands[3];
char m_selectedOffhandsPendingHybridAction[3];
char m_lastCycleSlot;
char gap_16f5[3];
int m_weaponGettingSwitchedOut[2];
bool m_showActiveWeapon3p[2];
char gap_1702[2];
int m_weaponPermission;
float m_weaponDelayEnableTime;
char m_weaponDisabledFlags;
bool m_hudInfo_visibilityTestAlwaysPasses;
bool m_weaponDisabledInScript;
char gap_170f[1];
int m_removeWeaponOnSelectSwitch;
int m_latestMeleeWeapon;
bool m_doOffhandAnim;
bool m_wantInventoryChangedScriptCall;
bool m_doInventoryChangedScriptCall;
char gap_171b[1];
float m_cloakReactEndTime;
CTether m_tethers[2];
char gap_1768[8];
int m_titanSoul;
Vector3D m_lastFootstepDamagePos;
bool m_lastFoostepDamageOnGround;
char gap_1781[3];
int m_muzzleAttachment[2];
int m_weaponHandAttachment;
int m_weaponAltHandAttachment;
int m_prevNearestNode;
int m_nearestNode;
float m_nearestNodeCheckTime;
Vector3D m_nearestNodeCheckPos;
int m_nearestPolyRef[5];
Vector3D m_nearestPolyCheckPos[5];
int m_contextAction;
char m_weaponAnimEvents[16648];
char m_targetInfoIconName[64];
bool m_titanStepDamage;
char gap_5949[3];
int m_latest3pWeaponGettingEquipped[2];
char gap_5954[12];
char m_szNetname[256];
bool m_zoomViewdriftDebounceEnabled;
bool m_bZooming;
char gap_5a62[2];
float m_zoomToggleOnStartTime;
float m_zoomBaseFrac;
float m_zoomBaseTime;
float m_zoomFullStartTime;
int m_physicsSolidMask;
int m_rightHandAttachment;
int m_leftHandAttachment;
int m_headAttachment;
int m_chestAttachment;
int m_StuckLast;
char gap_5a8c[4];
CPlayerLocalData m_Local;

View File

@ -18,6 +18,18 @@ class CAnimationLayer
void* m_animationLayerOwner;
};
struct __declspec(align(8)) PredictedAnimEventData
{
char gap_0[8];
float m_predictedAnimEventTimes[8];
int m_predictedAnimEventIndices[8];
int m_predictedAnimEventCount;
int m_predictedAnimEventTarget;
int m_predictedAnimEventSequence;
int m_predictedAnimEventModel;
float m_predictedAnimEventsReadyToFireTime;
};
struct __declspec(align(8)) AnimRelativeData
{
char gap_0[8];

View File

@ -179,6 +179,9 @@
<ClInclude Include="..\game\server\ai_networkmanager.h" />
<ClInclude Include="..\game\server\ai_node.h" />
<ClInclude Include="..\game\server\ai_utility.h" />
<ClInclude Include="..\game\server\baseanimatingoverlay.h" />
<ClInclude Include="..\game\server\baseanimating.h" />
<ClInclude Include="..\game\server\basecombatcharacter.h" />
<ClInclude Include="..\game\server\detour_impl.h" />
<ClInclude Include="..\game\server\fairfight_impl.h" />
<ClInclude Include="..\game\server\gameinterface.h" />

View File

@ -1341,6 +1341,15 @@
<ClInclude Include="..\game\shared\takedamageinfo.h">
<Filter>sdk\game\shared</Filter>
</ClInclude>
<ClInclude Include="..\game\server\baseanimating.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
<ClInclude Include="..\game\server\baseanimatingoverlay.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
<ClInclude Include="..\game\server\basecombatcharacter.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\common\opcodes.cpp">

View File

@ -251,6 +251,9 @@
<ClInclude Include="..\game\server\ai_networkmanager.h" />
<ClInclude Include="..\game\server\ai_node.h" />
<ClInclude Include="..\game\server\ai_utility.h" />
<ClInclude Include="..\game\server\baseanimatingoverlay.h" />
<ClInclude Include="..\game\server\baseanimating.h" />
<ClInclude Include="..\game\server\basecombatcharacter.h" />
<ClInclude Include="..\game\server\detour_impl.h" />
<ClInclude Include="..\game\server\fairfight_impl.h" />
<ClInclude Include="..\game\server\gameinterface.h" />

View File

@ -2045,6 +2045,15 @@
<ClInclude Include="..\game\shared\takedamageinfo.h">
<Filter>sdk\game\shared</Filter>
</ClInclude>
<ClInclude Include="..\game\server\baseanimating.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
<ClInclude Include="..\game\server\baseanimatingoverlay.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
<ClInclude Include="..\game\server\basecombatcharacter.h">
<Filter>sdk\game\server</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="..\shared\resource\lockedserver.png">