1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
|
#pragma once
#include <array>
#include "util.hpp"
#include "IClientEntityList.hpp"
#include "netvars.hpp"
#include "pattern.hpp"
#include "c_base_weapon.hpp"
#include "CUtlVector.hpp"
#include "IPhysicsSurfaceProps.hpp"
#include "settings.hpp"
#include "IPhysicsSurfaceProps.hpp"
enum PlayerState_t {
FL_ONGROUND = 1 << 0,
FL_DUCKING = 1 << 1,
FL_WATERJUMP = 1 << 2,
FL_ONTRAIN = 1 << 3,
FL_INRAIN = 1 << 4,
FL_FROZEN = 1 << 5,
FL_ATCONTROLS = 1 << 6,
FL_CLIENT = 1 << 7,
FL_FAKECLIENT = 1 << 8,
FL_INWATER = 1 << 9,
};
enum PlayerHitboxes_t {
HITBOX_HEAD,
HITBOX_NECK,
HITBOX_PELVIS,
HITBOX_BODY,
HITBOX_THORAX,
HITBOX_CHEST,
HITBOX_UPPER_CHEST,
HITBOX_RIGHT_THIGH,
HITBOX_LEFT_THIGH,
HITBOX_RIGHT_CALF,
HITBOX_LEFT_CALF,
HITBOX_RIGHT_FOOT,
HITBOX_LEFT_FOOT,
HITBOX_RIGHT_HAND,
HITBOX_LEFT_HAND,
HITBOX_RIGHT_UPPER_ARM,
HITBOX_RIGHT_FOREARM,
HITBOX_LEFT_UPPER_ARM,
HITBOX_LEFT_FOREARM,
HITBOX_MAX,
};
enum MoveType_t {
MOVETYPE_NONE = 0, // never moves
MOVETYPE_ISOMETRIC, // For players -- in TF2 commander view, etc.
MOVETYPE_WALK, // Player only - moving on the ground
MOVETYPE_STEP, // gravity, special edge handling -- monsters use this
MOVETYPE_FLY, // No gravity, but still collides with stuff
MOVETYPE_FLYGRAVITY, // flies through the air + is affected by gravity
MOVETYPE_VPHYSICS, // uses VPHYSICS for simulation
MOVETYPE_PUSH, // no clip to world, push and crush
MOVETYPE_NOCLIP, // No gravity, no collisions, still do velocity/avelocity
MOVETYPE_LADDER, // Used by players only when going onto a ladder
MOVETYPE_OBSERVER, // Observer movement, depends on player's observer mode
MOVETYPE_CUSTOM, // Allows the entity to describe its own physics
MOVETYPE_LAST = MOVETYPE_CUSTOM, // should always be defined as the last item in the list
MOVETYPE_MAX_BITS = 4,
};
enum LifeState_t {
LIFE_ALIVE = 0, // alive
LIFE_DYING, // playing death animation or still falling off of a ledge waiting to hit ground
LIFE_DEAD, // dead. lying still.
LIFE_RESPAWNABLE,
LIFE_DISCARDBODY,
};
enum PoseParam_t {
STRAFE_YAW,
STAND,
LEAN_YAW,
SPEED,
LADDER_YAW,
LADDER_SPEED,
JUMP_FALL,
MOVE_YAW,
MOVE_BLEND_CROUCH,
MOVE_BLEND_WALK,
MOVE_BLEND_RUN,
BODY_YAW,
BODY_PITCH,
AIM_BLEND_STAND_IDLE,
AIM_BLEND_STAND_WALK,
AIM_BLEND_STAND_RUN,
AIM_BLEND_COURCH_IDLE,
AIM_BLEND_CROUCH_WALK,
DEATH_YAW
};
class IKContext {
public:
void Init( void* hdr, vec3_t& angles, vec3_t& origin, float curtime, int framecount, int boneMask );
void UpdateTargets( vec3_t* pos, void* q, matrix3x4* bone_array, char* computed );
void SolveDependencies( vec3_t* pos, void* q, matrix3x4* bone_array, char* computed );
//THANK YOU IDA
void ClearTargets( ) {
int max = *( int* )( ( uintptr_t )this + 4080 );
int count = 0;
if( max > 0 ) {
uintptr_t v60 = ( uintptr_t )( ( uintptr_t )this + 208 );
do {
*( int* )( v60 ) = -9999;
v60 += 340;
++count;
} while( count < max );
}
}
};
class C_AnimationLayer {
private:
char pad_0x8_[ 0x8 ];
public:
uint32_t m_unk1;
uint32_t m_unk2;
uint32_t m_unk3;
uint32_t m_nOrder; //0x0014
uint32_t m_nSequence; //0x0018
float m_flPrevCycle; //0x001C
float m_flWeight; //0x0020
float m_flWeightDeltaRate; //0x0024
float m_flPlaybackRate; //0x0028
float m_flCycle; //0x2C
c_base_player* m_player; //0x30
char pad_0x8[ 0x4 ]; //0x34
}; //Size: 0x0038
struct clientanimating_t {
void* m_pAnimating;
unsigned int m_fFlags;
clientanimating_t( void* _pAnim, unsigned int _flags ) : m_pAnimating( _pAnim ), m_fFlags( _flags ) {}
};
struct CCSGOPlayerAnimState
{
void update( float yaw, float pitch );
void update_ex( float yaw, float pitch );
void setup_velocity( float );
void setup_aim_matrix( );
void setup_weapon_action( );
void setup_movement( );
void setup_alive_loop( );
void setup_whole_body_action( );
void setup_flashed_reaction( );
void setup_flinch( );
bool cache_sequences( );
void reset( );
char pad[ 4 ];
char bUnknown; //0x4
char pad2[ 91 ];
void* pBaseEntity; //0x60
void* pActiveWeapon; //0x64
void* pLastActiveWeapon; //0x68
float m_flLastClientSideAnimationUpdateTime; //0x6C
int m_iLastClientSideAnimationUpdateFramecount; //0x70
float m_flLastUpdateDelta; //0x74 //b8
float m_flEyeYaw; //0x78 //c0
float m_flPitch; //0x7C //b8
float m_flGoalFeetYaw; //0x80 //c0
float m_flCurrentFeetYaw; //0x84 //c8
float m_flCurrentTorsoYaw; //0x88 //d0
float m_flUnknownVelocityLean; //0x8C //changes when moving/jumping/hitting ground //d8
float m_flLeanAmount; //0x90 //e0
char pad4[ 4 ]; //NaN //e8
float m_flFeetCycle; //0x98 0 to 1 //100 //f0
float m_flFeetYawRate; //0x9C 0 to 1 //108 //f8
char pad11[ 4 ];
float m_fDuckAmount; //0xA4 //118 //108
float m_fLandingDuckAdditiveSomething; //0xA8 //110
float m_fUnknown3; //0xAC //118
vec3_t m_vOrigin; //0xB0, 0xB4, 0xB8 //120
vec3_t m_vLastOrigin; //0xBC, 0xC0, 0xC4
vec3_t m_vecVelocity;
float m_flUnknownFloat1; //0xD4 Affected by movement and direction
char pad6[ 8 ];
float m_flUnknownFloat2; //0xE0 //from -1 to 1 when moving and affected by direction
float m_flUnknownFloat3; //0xE4 //from -1 to 1 when moving and affected by direction
float m_unknown; //0xE8
float m_velocity; //0xEC
float flUpVelocity; //0xF0
float m_flSpeedNormalized; //0xF4 //from 0 to 1
float m_flFeetSpeedForwardsOrSideWays; //0xF8 //from 0 to 2. something is 1 when walking, 2.something when running, 0.653 when crouch walking
float m_flFeetSpeedUnknownForwardOrSideways; //0xFC //from 0 to 3. something
float m_flTimeSinceStartedMoving; //0x100
float m_flTimeSinceStoppedMoving; //0x104
unsigned char m_bOnGround; //0x108
unsigned char m_bInHitGroundAnimation; //0x109
char pad7[ 10 ];
float m_flLastOriginZ; //0x114
float m_flHeadHeightOrOffsetFromHittingGroundAnimation; //0x118 from 0 to 1, is 1 when standing
float m_flStopToFullRunningFraction; //0x11C from 0 to 1, doesnt change when walking or crouching, only running
char pad8[ 4 ]; //NaN
float m_flUnknownFraction; //0x124 affected while jumping and running, or when just jumping, 0 to 1
char pad9[ 4 ]; //NaN
float m_flUnknown3;
char pad10[ 0x210 ];
};
class VarMapEntry_t {
public:
unsigned short type;
unsigned short m_bNeedsToInterpolate; // Set to false when this var doesn't
// need Interpolate() called on it anymore.
void* data;
void* watcher;
};
struct VarMapping_t {
CUtlVector< VarMapEntry_t > m_Entries;
int m_nInterpolatedEntries; // +0x14
float m_lastInterpolationTime; // +0x18
};
struct ent_animdata_t {
std::array< C_AnimationLayer, 13 > m_animlayers;
std::array< C_AnimationLayer, 13 > m_last_layers;
std::array< float, 24 > m_poseparams;
matrix3x4 m_bones[ 128 ];
int m_activity;
float m_simtime;
float m_last_simtime;
vec3_t m_last_interp_origin;
float m_fraction;
vec3_t m_interp_origin;
vec3_t m_last_origin;
vec3_t m_last_velocity;
vec3_t m_anim_velocity;
bool m_valid{ };
float m_last_duck;
int m_prev_flags;
int m_anim_flags;
float m_adjust_rate;
float m_adjust_cycle;
bool m_is_stopping;
};
class c_base_player {
private:
static ent_animdata_t sm_animdata[ 65 ];
public:
//NETVAR( m_YourFunctionName, "Name", "Table", extra, type )
NETVAR( m_nMoveType, "m_nRenderMode", "DT_BaseEntity", 1, MoveType_t );
NETVAR( m_iAccount, "m_iAccount", "DT_CSPlayer", 0, int );
NETVAR( m_iHealth, "m_iHealth", "DT_BasePlayer", 0, int );
NETVAR( m_lifeState, "m_lifeState", "DT_BasePlayer", 0, uint8_t );
NETVAR( m_nTickBase, "m_nTickBase", "DT_BasePlayer", 0, int );
NETVAR( m_fFlags, "m_fFlags", "DT_BasePlayer", 0, int );
NETVAR( m_vecVelocity, "m_vecVelocity[0]", "DT_BasePlayer", 0, vec3_t );
NETVAR( m_nHitboxSet, "m_nHitboxSet", "DT_BaseAnimating", 0, int );
NETVAR( m_vecOrigin, "m_vecOrigin", "DT_BaseEntity", 0, vec3_t );
NETVAR( m_vecViewOffset, "m_vecViewOffset[0]", "DT_BasePlayer", 0, vec3_t );
NETVAR( m_hActiveWeapon, "m_hActiveWeapon", "DT_BaseCombatCharacter", 0, ulong_t );
NETVAR( m_iTeamNum, "m_iTeamNum", "DT_BaseEntity", 0, int );
NETVAR( m_bHasHelmet, "m_bHasHelmet", "DT_CSPlayer", 0, bool );
NETVAR( m_bHasDefuser, "m_bHasDefuser", "DT_CSPlayer", 0, bool );
NETVAR( m_ArmorValue, "m_ArmorValue", "DT_CSPlayer", 0, int );
NETVAR( m_flNextAttack, "m_flNextAttack", "DT_BaseCombatCharacter", 0, float );
NETVAR( m_flLowerBodyYawTarget, "m_flLowerBodyYawTarget", "DT_CSPlayer", 0, float );
NETVAR( m_angEyeAngles, "m_angEyeAngles[0]", "DT_CSPlayer", 0, vec3_t );
NETVAR( m_AnimOverlay, "m_hLightingOrigin", "DT_BaseAnimating", 0x3c, CUtlVector< C_AnimationLayer > );
NETVAR( m_flSimulationTime, "m_flSimulationTime", "DT_BaseEntity", 0, float );
NETVAR( m_flCycle, "m_flCycle", "DT_BaseAnimating", 0, float );
NETVAR( m_nSequence, "m_nSequence", "DT_BaseAnimating", 0, int );
PNETVAR( m_flPoseParameter, "m_flPoseParameter", "DT_BaseAnimating", 0, float );
NETVAR( m_bClientSideAnimation, "m_bClientSideAnimation", "DT_BaseAnimating", 0, bool );
NETVAR( m_flLastBoneSetupTime, "m_hLightingOrigin", "DT_BaseAnimating", -0x20, float );
NETVAR( m_iMostRecentModelBoneCounter, "m_nForceBone", "DT_BaseAnimating", 0x4, int );
NETVAR( m_nWriteableBones, "m_nForceBone", "DT_BaseAnimating", 0x20, int );
NETVAR( m_vecThirdpersonAngles, "deadflag", "DT_BasePlayer", 0x4, vec3_t );
NETVAR( m_hObserverTarget, "m_hObserverTarget", "DT_BasePlayer", 0, uint32_t );
NETVAR( m_iObserverMode, "m_iObserverMode", "DT_BasePlayer", 0, int );
NETVAR( m_flOldSimulationTime, "m_flSimulationTime", "DT_BaseEntity", 0x4, float );
NETVAR( m_CoordinateFrame, "m_CollisionGroup", "DT_BaseEntity", -0x30, matrix3x4 );
NETVAR( m_vecMins, "m_vecMins", "DT_BaseEntity", 0, vec3_t );
NETVAR( m_vecMaxs, "m_vecMaxs", "DT_BaseEntity", 0, vec3_t );
NETVAR( m_bIsScoped, "m_bIsScoped", "DT_CSPlayer", 0, bool );
NETVAR( m_viewPunchAngle, "m_viewPunchAngle", "DT_BasePlayer", 0, vec3_t );
NETVAR( m_flMaxFlashAlpha, "m_flFlashMaxAlpha", "DT_CSPlayer", 0, float );
NETVAR( m_flFlashDuration, "m_flFlashDuration", "DT_CSPlayer", 0, float );
NETVAR( m_flFlashTime, "m_flFlashMaxAlpha", "DT_CSPlayer", -0x10, float );
NETVAR( m_bGunGameImmunity, "m_bGunGameImmunity", "DT_CSPlayer", 0, bool );
NETVAR( m_hViewModel, "m_hViewModel[0]", "DT_BasePlayer", 0, uint32_t );
NETVAR( m_bSpotted, "m_bSpotted", "DT_CSPlayer", 0, bool );
NETVAR( m_pSurfaceData, "m_flLaggedMovementValue", "DT_CSPlayer", 0x18, surfacedata_t* );
NETVAR( m_vecBaseVelocity, "m_vecBaseVelocity", "DT_CSPlayer", 0, vec3_t );
NETVAR( m_vecAbsVelocity, "m_vecVelocity", "DT_CSPlayer", 0x12, vec3_t );
NETVAR( m_flGravity, "m_iTeamNum", "DT_CSPlayer", -0x14, float );
NETVAR( m_surfaceFriction, "m_vecLadderNormal", "DT_CSPlayer", -0x4, float );
NETVAR( m_flDuckAmount, "m_flDuckAmount", "DT_CSPlayer", 0, float );
NETVAR( m_flDuckSpeed, "m_flDuckSpeed", "DT_CSPlayer", 0, float );
PNETVAR( m_hMyWearables, "m_hMyWearables", "DT_BaseCombatCharacter", 0, uint32_t );
PNETVAR( m_hMyWeapons, "m_hMyWeapons", "DT_BaseCombatCharacter", 0, uint32_t );
NETVAR( m_hGroundEntity, "m_hGroundEntity", "DT_CSPlayer", 0, uint32_t );
NETVAR( m_flConstraintRadius, "m_flConstraintRadius", "DT_CSPlayer", 0, float );
OFFSET( m_CachedBoneData, 0x28FC + sizeof( void* ), CUtlVector< matrix3x4 > );
OFFSET( m_flSpawnTime, 0xA2C0, float );
OFFSET( m_IKContext, 0x265c, IKContext* );
public:
static uintptr_t get_player_resource( );
static uintptr_t get_game_rules( );
static bool& s_bInvalidateBoneCache( );
static int& g_iModelBoneCounter( );
/*makes it much more organized: functions from IClientEntity
dont interfere with our defined functions*/
__forceinline IClientEntity* ce( ) {
return reinterpret_cast< IClientEntity* >( this );
}
__forceinline operator IClientEntity*( ) {
return reinterpret_cast< IClientEntity* >( this );
}
template < typename t >
__forceinline t& get( std::ptrdiff_t offset ) {
return *reinterpret_cast< t* >( uintptr_t( this ) + offset );
}
__forceinline auto& get_animdata( ) {
return sm_animdata[ ce( )->GetIndex( ) ];
}
__forceinline bool is_alive( ) {
return m_iHealth( ) > 0 && m_lifeState( ) == LIFE_ALIVE;
}
__forceinline void update_ik_locks( float curtime ) {
return util::get_vfunc< 186, void >( this, curtime );
}
__forceinline void calculate_ik_locks( float curtime ) {
return util::get_vfunc< 187, void >( this, curtime );
}
__forceinline void standard_blending_rules( void* hdr, vec3_t* pos, void* q, float curtime, int bone_mask ) {
return util::get_vfunc< 200, void >( this, hdr, pos, q, curtime, bone_mask );
}
__forceinline void build_transformations( void* hdr, vec3_t* pos, void* q, const matrix3x4& transform, int bone_mask, char* computed ) {
return util::get_vfunc< 184, void >( this, hdr, pos, q, transform, bone_mask, computed );
}
__forceinline bool has_valid_anim( ) {
if( m_bClientSideAnimation( ) )
return true;
return sm_animdata[ ce( )->GetIndex( ) ].m_valid;
}
bool is_flashed( );
bool is_reloading( );
int get_ping( );
__forceinline auto& m_aimPunchAngle( bool real = false ) {
static vec3_t backup_var{ };
static auto offset = g_netvars.get_netvar( fnv( "DT_BasePlayer" ), fnv( "m_aimPunchAngle" ) );
if( g_settings.misc.no_recoil( ) && !real ) {
backup_var = { 0.f, 0.f, 0.f };
return backup_var;
}
return get< vec3_t >( offset );
}
void set_local_view_angles( vec3_t *angle );
bool run_physics_think( int n );
void pre_think( );
void think( );
__forceinline vec3_t get_anim_velocity( ) {
auto index = ce( )->GetIndex( );
return sm_animdata[ index ].m_anim_velocity;
}
__forceinline CCSGOPlayerAnimState* get_animstate( ) {
static std::ptrdiff_t offset = g_netvars.get_netvar( fnv( "DT_CSPlayer" ),
fnv( "m_bIsScoped" ) );
if( !offset ) {
return nullptr;
}
return *reinterpret_cast< CCSGOPlayerAnimState** >( uintptr_t( this ) + offset - 0xa );
}
__forceinline void update_clientside_animation( ) {
bool backup = m_bClientSideAnimation( );
m_bClientSideAnimation( ) = true;
util::get_vfunc< 218, void >( this );
m_bClientSideAnimation( ) = backup;
}
void invalidate_bone_cache( );
__forceinline vec3_t get_eye_pos( ) {
vec3_t yes;
//fuck references Lol
util::get_vfunc< void( __thiscall* )( void*, vec3_t& ) >( this, 277 )( this, yes );
//thanks senator!! !11
return yes;
}
__forceinline bool is_player( ) {
if( !this )
return false;
ClientClass* client_class = ce( )->GetClientClass( );
return client_class && client_class->m_class_id == CCSPlayer;
}
__forceinline bool is_valid( ) {
return !!this && is_player( ) && !ce( )->IsDormant( ) && is_alive( );
}
bool is_fakewalking( );
player_info_t get_info( );
void get_name_safe( char* buf );
c_base_weapon* get_weapon( );
vec3_t get_hitbox_pos( int hitbox );
vec3_t get_hitbox_mins( int hitbox );
vec3_t get_hitbox_maxs( int hitbox );
bool is_visible( int hitbox );
bool can_attack( bool ignore_rapid = false );
int get_choked_ticks( );
float get_hitbox_radius( int hitbox );
void set_abs_origin( vec3_t origin );
void set_abs_angles( vec3_t angles );
void set_abs_velocity( vec3_t velocity );
void calc_abs_velocity( );
void set_needs_interpolate( bool interp );
void do_ent_interpolation( bool reset );
void invalidate_physics_recursive( int flags );
void create_animstate( CCSGOPlayerAnimState* state );
void setup_bones_ex( matrix3x4* matrix_out, int bone_mask, float curtime );
int get_seq_activity( int sequence );
void fix_animations( bool reset = false, bool resolver_change = false );
void validate_animation_layers( );
void compute_move_cycle( bool reset, bool moving );
void calculate_duckamount( bool reset );
void cache_anim_data( bool layers = true );
void restore_anim_data( bool layers = false );
void handle_taser_animation( );
void calc_anim_velocity( bool reset );
void fix_jump_fall( bool reset );
bool is_breaking_lc( );
};
|