[Debug] Add simple overlays for debugging (#227)

This commit is contained in:
Edo 2022-06-13 18:08:44 +02:00 committed by GitHub
parent 9f7608b04f
commit 0593913244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 674 additions and 93 deletions

View File

@ -106,6 +106,7 @@ namespace Components
Loader::Register(new ClientCommand()); Loader::Register(new ClientCommand());
Loader::Register(new ScriptExtension()); Loader::Register(new ScriptExtension());
Loader::Register(new Branding()); Loader::Register(new Branding());
Loader::Register(new Debug());
Loader::Register(new RawMouse()); Loader::Register(new RawMouse());
Loader::Register(new Bullet()); Loader::Register(new Bullet());
Loader::Register(new MapRotation()); Loader::Register(new MapRotation());

View File

@ -137,6 +137,7 @@ namespace Components
#include "Modules/Gamepad.hpp" #include "Modules/Gamepad.hpp"
#include "Modules/ScriptExtension.hpp" #include "Modules/ScriptExtension.hpp"
#include "Modules/Branding.hpp" #include "Modules/Branding.hpp"
#include "Modules/Debug.hpp"
#include "Modules/RawMouse.hpp" #include "Modules/RawMouse.hpp"
#include "Modules/Bullet.hpp" #include "Modules/Bullet.hpp"
#include "Modules/MapRotation.hpp" #include "Modules/MapRotation.hpp"

View File

@ -0,0 +1,240 @@
#include <STDInclude.hpp>
namespace Components
{
Dvar::Var Debug::DebugOverlay;
Game::dvar_t** Debug::PlayerDebugHealth = reinterpret_cast<Game::dvar_t**>(0x7A9F7C);
const char* Debug::PMFlagsValues[] =
{
"PMF_PRONE",
"PMF_DUCKED",
"PMF_MANTLE",
"PMF_LADDER",
"PMF_SIGHT_AIMING",
"PMF_BACKWARDS_RUN",
"PMF_WALKING",
"PMF_TIME_HARDLANDING",
"PMF_TIME_KNOCKBACK",
"PMF_PRONEMOVE_OVERRIDDEN",
"PMF_RESPAWNED",
"PMF_FROZEN",
"PMF_LADDER_FALL",
"PMF_JUMPING",
"PMF_SPRINTING",
"PMF_SHELLSHOCKED",
"PMF_MELEE_CHARGE",
"PMF_NO_SPRINT",
"PMF_NO_JUMP",
"PMF_REMOTE_CONTROLLING",
"PMF_ANIM_SCRIPTED",
"PMF_UNK1",
"PMF_DIVING",
};
const char* Debug::POFlagsValues[] =
{
"POF_INVULNERABLE",
"POF_REMOTE_EYES",
"POF_LASER_ALTVIEW",
"POF_THERMAL_VISION",
"POF_THERMAL_VISION_OVERLAY_FOF",
"POF_REMOTE_CAMERA_SOUNDS",
"POF_ALT_SCENE_REAR_VIEW",
"POF_ALT_SCENE_TAG_VIEW",
"POF_SHIELD_ATTACHED_TO_WORLD_MODEL",
"POF_DONT_LERP_VIEWANGLES",
"POF_EMP_JAMMED",
"POF_FOLLOW",
"POF_PLAYER",
"POF_SPEC_ALLOW_CYCLE",
"POF_SPEC_ALLOW_FREELOOK",
"POF_AC130",
"POF_COMPASS_PING",
"POF_ADS_THIRD_PERSON_TOGGLE",
};
const char* Debug::PLFlagsValues[] =
{
"PLF_ANGLES_LOCKED",
"PLF_USES_OFFSET",
"PLF_WEAPONVIEW_ONLY",
};
const char* Debug::PEFlagsValues[] =
{
"EF_NONSOLID_BMODEL",
"EF_TELEPORT_BIT",
"EF_CROUCHING",
"EF_PRONE",
"EF_UNK1",
"EF_NODRAW",
"EF_TIMED_OBJECT",
"EF_VOTED",
"EF_TALK",
"EF_FIRING",
"EF_TURRET_ACTIVE_PRONE",
"EF_TURRET_ACTIVE_DUCK",
"EF_LOCK_LIGHT_VIS",
"EF_AIM_ASSIST",
"EF_LOOP_RUMBLE",
"EF_LASER_SIGHT",
"EF_MANTLE",
"EF_DEAD",
"EF_ADS",
"EF_NEW",
"EF_VEHICLE_ACTIVE",
"EF_JAMMING",
"EF_COMPASS_PING",
"EF_SOFT",
};
std::string Debug::BuildPMFlagsString(const Game::playerState_s* ps)
{
std::string result;
for (size_t i = 0; i < ARRAYSIZE(PMFlagsValues); ++i)
{
result.append(Utils::String::VA("^%c%s\n", ((ps->pm_flags & (1 << i)) == 0) ? '7' : '2', PMFlagsValues[i]));
}
return result;
}
std::string Debug::BuildPOFlagsString(const Game::playerState_s* ps)
{
std::string result;
for (size_t i = 0; i < ARRAYSIZE(POFlagsValues); ++i)
{
result.append(Utils::String::VA("^%c%s\n", ((ps->otherFlags & (1 << i)) == 0) ? '7' : '2', POFlagsValues[i]));
}
return result;
}
std::string Debug::BuildPLFlagsString(const Game::playerState_s* ps)
{
std::string result;
for (size_t i = 0; i < ARRAYSIZE(PLFlagsValues); ++i)
{
result.append(Utils::String::VA("^%c%s\n", ((ps->linkFlags & (1 << i)) == 0) ? '7' : '2', PLFlagsValues[i]));
}
return result;
}
std::string Debug::BuildPEFlagsString(const Game::playerState_s* ps)
{
std::string result;
for (size_t i = 0; i < ARRAYSIZE(PEFlagsValues); ++i)
{
result.append(Utils::String::VA("^%c%s\n", ((ps->eFlags & (1 << i)) == 0) ? '7' : '2', PEFlagsValues[i]));
}
return result;
}
void Debug::CG_Debug_DrawPSFlags(const int localClientNum)
{
const auto* cgameGlob = Game::cgArray;
auto* const scrPlace = Game::ScrPlace_GetActivePlacement(localClientNum);
constexpr auto maxChars = 4096;
constexpr float colorWhite[] = {1.0f, 1.0f, 1.0f, 1.0f};
auto* const font1 = Game::UI_GetFontHandle(scrPlace, 6, MY_SCALE_2);
auto* const font2 = Game::UI_GetFontHandle(scrPlace, 6, MY_SCALE2);
Game::UI_DrawText(scrPlace, "Client View of Flags", maxChars, font2, -60.0f, 0, 1, 1,
MY_SCALE2, colorWhite, 1);
const auto pmf = BuildPMFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, pmf.data(), maxChars, font1, 30.0f, 20.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
const auto pof = BuildPOFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, pof.data(), maxChars, font1, 350.0f, 20.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
const auto plf = BuildPLFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, plf.data(), maxChars, font1, 350.0f, 250.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
const auto pef = BuildPEFlagsString(&cgameGlob->predictedPlayerState);
Game::UI_DrawText(scrPlace, pef.data(), maxChars, font1, 525.0f, 20.0f, 1, 1, MY_SCALE_2, colorWhite, 3);
}
void Debug::CG_DrawDebugPlayerHealth(const int localClientNum)
{
float healtha;
constexpr float color1[] = {0.0f, 0.0f, 0.0f, 1.0f};
constexpr float color2[] = {0.0f, 1.0f, 0.0f, 1.0f};
assert((*PlayerDebugHealth)->current.enabled);
const auto* cgameGlob = Game::cgArray;
if (cgameGlob->predictedPlayerState.stats[0] && cgameGlob->predictedPlayerState.stats[2])
{
const auto health = static_cast<float>(cgameGlob->predictedPlayerState.stats[0]) / static_cast<float>(cgameGlob->predictedPlayerState.stats[2]);
const auto stats = ((health - 1.0f) < 0.0f)
? static_cast<float>(cgameGlob->predictedPlayerState.stats[0]) / static_cast<float>(cgameGlob->predictedPlayerState.stats[2])
: 1.0f;
healtha = ((0.0f - health) < 0.0f)
? stats
: 0.0f;
}
else
{
healtha = 0.0f;
}
auto* const scrPlace = Game::ScrPlace_GetActivePlacement(localClientNum);
Game::CL_DrawStretchPic(scrPlace, 10.0f, 10.0f, 100.0f, 10.0f, 1, 1, 0.0f, 0.0f, 1.0f, 1.0f, color1, *Game::whiteMaterial);
Game::CL_DrawStretchPic(scrPlace, 10.0f, 10.0f, 100.0f * healtha, 10.0f, 1, 1, 0.0f, 0.0f, healtha, 1.0f, color2, *Game::whiteMaterial);
}
void Debug::CG_DrawDebugOverlays_Hk(const int localClientNum)
{
switch (DebugOverlay.get<int>())
{
case 2:
CG_Debug_DrawPSFlags(localClientNum);
break;
default:
break;
}
if ((*PlayerDebugHealth)->current.enabled)
{
CG_DrawDebugPlayerHealth(localClientNum);
}
}
void Debug::CL_InitDebugDvars()
{
static const char* debugOverlayNames_0[] =
{
"Off",
"ViewmodelInfo",
"Playerstate Flags",
"Entity Counts",
"Controllers",
"FontTest",
nullptr,
};
DebugOverlay = Game::Dvar_RegisterEnum("debugOverlay", debugOverlayNames_0, 0,
Game::dvar_flag::DVAR_NONE, "Toggles the display of various debug info.");
}
Debug::Debug()
{
Scheduler::Once(CL_InitDebugDvars, Scheduler::Pipeline::MAIN);
// Hook end of CG_DrawDebugOverlays (This is to ensure some checks are done before our hook is executed).
Utils::Hook(0x49CB0A, CG_DrawDebugOverlays_Hk, HOOK_JUMP).install()->quick();
}
}

View File

@ -0,0 +1,36 @@
#pragma once
namespace Components
{
class Debug : public Component
{
public:
Debug();
private:
static Dvar::Var DebugOverlay;
// Game dvars
static Game::dvar_t** PlayerDebugHealth;
static const char* PMFlagsValues[];
static const char* POFlagsValues[];
static const char* PLFlagsValues[];
static const char* PEFlagsValues[];
static constexpr auto MY_SCALE2 = 0.5f;
static constexpr auto MY_SCALE_2 = 0.201f;
static std::string BuildPMFlagsString(const Game::playerState_s* ps);
static std::string BuildPOFlagsString(const Game::playerState_s* ps);
static std::string BuildPLFlagsString(const Game::playerState_s* ps);
static std::string BuildPEFlagsString(const Game::playerState_s* ps);
static void CG_Debug_DrawPSFlags(int localClientNum);
static void CG_DrawDebugPlayerHealth(int localClientNum);
static void CG_DrawDebugOverlays_Hk(int localClientNum);
static void CL_InitDebugDvars();
};
}

View File

@ -60,6 +60,7 @@ namespace Game
CL_HandleRelayPacket_t CL_HandleRelayPacket = CL_HandleRelayPacket_t(0x5A8C70); CL_HandleRelayPacket_t CL_HandleRelayPacket = CL_HandleRelayPacket_t(0x5A8C70);
CL_ResetViewport_t CL_ResetViewport = CL_ResetViewport_t(0x4A8830); CL_ResetViewport_t CL_ResetViewport = CL_ResetViewport_t(0x4A8830);
CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f = CL_SelectStringTableEntryInDvar_f_t(0x4A4560); CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f = CL_SelectStringTableEntryInDvar_f_t(0x4A4560);
CL_DrawStretchPic_t CL_DrawStretchPic = CL_DrawStretchPic_t(0x412490);
CL_ConsoleFixPosition_t CL_ConsoleFixPosition = CL_ConsoleFixPosition_t(0x44A430); CL_ConsoleFixPosition_t CL_ConsoleFixPosition = CL_ConsoleFixPosition_t(0x44A430);
Cmd_AddCommand_t Cmd_AddCommand = Cmd_AddCommand_t(0x470090); Cmd_AddCommand_t Cmd_AddCommand = Cmd_AddCommand_t(0x470090);
@ -325,6 +326,7 @@ namespace Game
SEH_StringEd_GetString_t SEH_StringEd_GetString = SEH_StringEd_GetString_t(0x44BB30); SEH_StringEd_GetString_t SEH_StringEd_GetString = SEH_StringEd_GetString_t(0x44BB30);
SEH_ReadCharFromString_t SEH_ReadCharFromString = SEH_ReadCharFromString_t(0x486560); SEH_ReadCharFromString_t SEH_ReadCharFromString = SEH_ReadCharFromString_t(0x486560);
SEH_GetCurrentLanguage_t SEH_GetCurrentLanguage = SEH_GetCurrentLanguage_t(0x4F6110);
Dvar_SetFromStringByName_t Dvar_SetFromStringByName = Dvar_SetFromStringByName_t(0x4F52E0); Dvar_SetFromStringByName_t Dvar_SetFromStringByName = Dvar_SetFromStringByName_t(0x4F52E0);
Dvar_SetFromStringByNameFromSource_t Dvar_SetFromStringByNameFromSource = Dvar_SetFromStringByNameFromSource_t(0x4FC770); Dvar_SetFromStringByNameFromSource_t Dvar_SetFromStringByNameFromSource = Dvar_SetFromStringByNameFromSource_t(0x4FC770);
@ -580,6 +582,8 @@ namespace Game
int* g_waitingForKey = reinterpret_cast<int*>(0x63A50FC); int* g_waitingForKey = reinterpret_cast<int*>(0x63A50FC);
Material** whiteMaterial = reinterpret_cast<Material**>(0x8EE4B8);
unsigned long* _tls_index = reinterpret_cast<unsigned long*>(0x66D94A8); unsigned long* _tls_index = reinterpret_cast<unsigned long*>(0x66D94A8);
int* cls_uiStarted = reinterpret_cast<int*>(0xA7FFA0); int* cls_uiStarted = reinterpret_cast<int*>(0xA7FFA0);
@ -1155,6 +1159,33 @@ namespace Game
return scrPlaceFullUnsafe; return scrPlaceFullUnsafe;
} }
void UI_FilterStringForButtonAnimation(char* str, unsigned int strMaxSize)
{
if (SEH_GetCurrentLanguage() == 8 || Sys_Milliseconds() % 1000 <= 800)
{
return;
}
size_t i = 0;
while (str[i] != '\0')
{
if (i >= strMaxSize)
break;
const auto value = str[i];
if (value == 16)
{
str[i] = -68;
}
else if (value == 17)
{
str[i] = -67;
}
++i;
}
}
#pragma optimize("", off) #pragma optimize("", off)
__declspec(naked) float UI_GetScoreboardLeft(void* /*a1*/) __declspec(naked) float UI_GetScoreboardLeft(void* /*a1*/)
{ {

View File

@ -121,6 +121,9 @@ namespace Game
typedef void(__cdecl * CL_SelectStringTableEntryInDvar_f_t)(); typedef void(__cdecl * CL_SelectStringTableEntryInDvar_f_t)();
extern CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f; extern CL_SelectStringTableEntryInDvar_f_t CL_SelectStringTableEntryInDvar_f;
typedef void(__cdecl * CL_DrawStretchPic_t)(const ScreenPlacement* scrPlace, float x, float y, float w, float h, int horzAlign, int vertAlign, float s1, float t1, float s2, float t2, const float* color, Material* material);
extern CL_DrawStretchPic_t CL_DrawStretchPic;
typedef void(__cdecl * CL_ConsoleFixPosition_t)(); typedef void(__cdecl * CL_ConsoleFixPosition_t)();
extern CL_ConsoleFixPosition_t CL_ConsoleFixPosition; extern CL_ConsoleFixPosition_t CL_ConsoleFixPosition;
@ -810,6 +813,9 @@ namespace Game
typedef unsigned int(__cdecl * SEH_ReadCharFromString_t)(const char** text, int* isTrailingPunctuation); typedef unsigned int(__cdecl * SEH_ReadCharFromString_t)(const char** text, int* isTrailingPunctuation);
extern SEH_ReadCharFromString_t SEH_ReadCharFromString; extern SEH_ReadCharFromString_t SEH_ReadCharFromString;
typedef int (__cdecl * SEH_GetCurrentLanguage_t)();
extern SEH_GetCurrentLanguage_t SEH_GetCurrentLanguage;
typedef const char*(__cdecl * SL_ConvertToString_t)(scr_string_t stringValue); typedef const char*(__cdecl * SL_ConvertToString_t)(scr_string_t stringValue);
extern SL_ConvertToString_t SL_ConvertToString; extern SL_ConvertToString_t SL_ConvertToString;
@ -1200,6 +1206,8 @@ namespace Game
extern int* g_waitingForKey; extern int* g_waitingForKey;
extern Material** whiteMaterial;
extern unsigned long* _tls_index; extern unsigned long* _tls_index;
extern int* cls_uiStarted; extern int* cls_uiStarted;
@ -1215,6 +1223,8 @@ namespace Game
ScreenPlacement* ScrPlace_GetUnsafeFullPlacement(); ScreenPlacement* ScrPlace_GetUnsafeFullPlacement();
void UI_FilterStringForButtonAnimation(char* str, unsigned int strMaxSize);
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize); XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
void Menu_FreeItemMemory(Game::itemDef_s* item); void Menu_FreeItemMemory(Game::itemDef_s* item);
void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1); void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1);

View File

@ -1255,28 +1255,51 @@ namespace Game
enum playerStateFlag enum playerStateFlag
{ {
PMF_PRONE = 0x1, PMF_PRONE = 1 << 0,
PMF_DUCKED = 0x2, PMF_DUCKED = 1 << 1,
PMF_MANTLE = 0x4, PMF_MANTLE = 1 << 2,
PMF_LADDER = 0x8, PMF_LADDER = 1 << 3,
PMF_SIGHT_AIMING = 0x10, PMF_SIGHT_AIMING = 1 << 4,
PMF_BACKWARDS_RUN = 0x20, PMF_BACKWARDS_RUN = 1 << 5,
PMF_WALKING = 0x40, PMF_WALKING = 1 << 6,
PMF_TIME_HARDLANDING = 0x80, PMF_TIME_HARDLANDING = 1 << 7,
PMF_TIME_KNOCKBACK = 0x100, PMF_TIME_KNOCKBACK = 1 << 8,
PMF_PRONEMOVE_OVERRIDDEN = 0x200, PMF_PRONEMOVE_OVERRIDDEN = 1 << 9,
PMF_RESPAWNED = 0x400, PMF_RESPAWNED = 1 << 10,
PMF_FROZEN = 0x800, PMF_FROZEN = 1 << 11,
PMF_LADDER_FALL = 0x1000, PMF_LADDER_FALL = 1 << 12,
PMF_JUMPING = 0x2000, PMF_JUMPING = 1 << 13,
PMF_SPRINTING = 0x4000, PMF_SPRINTING = 1 << 14,
PMF_SHELLSHOCKED = 0x8000, PMF_SHELLSHOCKED = 1 << 15,
PMF_MELEE_CHARGE = 0x10000, PMF_MELEE_CHARGE = 1 << 16,
PMF_NO_SPRINT = 0x20000, PMF_NO_SPRINT = 1 << 17,
PMF_NO_JUMP = 0x40000, PMF_NO_JUMP = 1 << 18,
PMF_REMOTE_CONTROLLING = 0x80000, PMF_REMOTE_CONTROLLING = 1 << 19,
PMF_ANIM_SCRIPTED = 0x100000, PMF_ANIM_SCRIPTED = 1 << 20,
PMF_DIVING = 0x400000 PMF_UNK1 = 1 << 21,
PMF_DIVING = 1 << 22,
};
enum playerStateOtherFlag
{
POF_INVULNERABLE = 1 << 0,
POF_REMOTE_EYES = 1 << 1,
POF_LASER_ALTVIEW = 1 << 2,
POF_THERMAL_VISION = 1 << 3,
POF_THERMAL_VISION_OVERLAY_FOF = 1 << 4,
POF_REMOTE_CAMERA_SOUNDS = 1 << 5,
POF_ALT_SCENE_REAR_VIEW = 1 << 6,
POF_ALT_SCENE_TAG_VIEW = 1 << 7,
POF_SHIELD_ATTACHED_TO_WORLD_MODEL = 1 << 8,
POF_DONT_LERP_VIEWANGLES = 1 << 9,
POF_EMP_JAMMED = 1 << 10,
POF_FOLLOW = 1 << 11,
POF_PLAYER = 1 << 12,
POF_SPEC_ALLOW_CYCLE = 1 << 13,
POF_SPEC_ALLOW_FREELOOK = 1 << 14,
POF_AC130 = 1 << 15,
POF_COMPASS_PING = 1 << 16,
POF_ADS_THIRD_PERSON_TOGGLE = 1 << 17,
}; };
enum pmtype_t enum pmtype_t
@ -1295,36 +1318,55 @@ namespace Game
enum playerEFlag enum playerEFlag
{ {
EF_NONSOLID_BMODEL = 0x1, EF_NONSOLID_BMODEL = 1 << 0,
EF_TELEPORT_BIT = 0x2, EF_TELEPORT_BIT = 1 << 1,
EF_CROUCHING = 0x4, EF_CROUCHING = 1 << 2,
EF_PRONE = 0x8, EF_PRONE = 1 << 3,
EF_NODRAW = 0x20, EF_UNK1 = 1 << 4,
EF_TIMED_OBJECT = 0x40, EF_NODRAW = 1 << 5,
EF_VOTED = 0x80, EF_TIMED_OBJECT = 1 << 6,
EF_TALK = 0x100, EF_VOTED = 1 << 7,
EF_FIRING = 0x200, EF_TALK = 1 << 8,
EF_TURRET_ACTIVE_PRONE = 0x400, EF_FIRING = 1 << 9,
EF_TURRET_ACTIVE_DUCK = 0x800, EF_TURRET_ACTIVE_PRONE = 1 << 10,
EF_LOCK_LIGHT_VIS = 0x1000, EF_TURRET_ACTIVE_DUCK = 1 << 11,
EF_AIM_ASSIST = 0x2000, EF_LOCK_LIGHT_VIS = 1 << 12,
EF_LOOP_RUMBLE = 0x4000, EF_AIM_ASSIST = 1 << 13,
EF_LASER_SIGHT = 0x8000, EF_LOOP_RUMBLE = 1 << 14,
EF_MANTLE = 0x10000, EF_LASER_SIGHT = 1 << 15,
EF_DEAD = 0x20000, EF_MANTLE = 1 << 16,
EF_ADS = 0x40000, EF_DEAD = 1 << 17,
EF_NEW = 0x80000, EF_ADS = 1 << 18,
EF_VEHICLE_ACTIVE = 0x100000, EF_NEW = 1 << 19,
EF_JAMMING = 0x200000, EF_VEHICLE_ACTIVE = 1 << 20,
EF_COMPASS_PING = 0x400000, EF_JAMMING = 1 << 21,
EF_SOFT = 0x800000 EF_COMPASS_PING = 1 << 22,
EF_SOFT = 1 << 23,
}; };
enum playerLinkFlag enum playerLinkFlag
{ {
PLF_ANGLES_LOCKED = 0x1, PLF_ANGLES_LOCKED = 1 << 0,
PLF_USES_OFFSET = 0x2, PLF_USES_OFFSET = 1 << 1,
PLF_WEAPONVIEW_ONLY = 0x4 PLF_WEAPONVIEW_ONLY = 1 << 2,
};
enum playerWeaponFlag
{
PWF_USE_RELOAD = 1 << 0,
PWF_USING_OFFHAND = 1 << 1,
PWF_HOLDING_BREATH = 1 << 2,
PWF_FRIENDLY_FIRE = 1 << 3,
PWF_ENEMY_FIRE = 1 << 4,
PWF_NO_ADS = 1 << 5,
PWF_USING_NIGHTVISION = 1 << 6,
PWF_DISABLE_WEAPONS = 1 << 7,
PWF_TRIGGER_LEFT_FIRE = 1 << 8,
PWF_TRIGGER_DOUBLE_FIRE = 1 << 9,
PWF_USING_RECOILSCALE = 1 << 10,
PWF_DISABLE_WEAPON_SWAPPING = 1 << 11,
PWF_DISABLE_OFFHAND_WEAPONS = 1 << 12,
PWF_SWITCHING_TO_RIOTSHIELD = 1 << 13,
}; };
struct playerState_s struct playerState_s
@ -1604,11 +1646,45 @@ namespace Game
}; };
#pragma pack(pop) #pragma pack(pop)
enum trType_t
{
TR_STATIONARY = 0x0,
TR_INTERPOLATE = 0x1,
TR_LINEAR = 0x2,
TR_LINEAR_STOP = 0x3,
TR_SINE = 0x4,
TR_GRAVITY = 0x5,
TR_LOW_GRAVITY = 0x6,
TR_ACCELERATE = 0x7,
TR_DECELERATE = 0x8,
TR_PHYSICS = 0x9,
TR_FIRST_RAGDOLL = 0xA,
TR_RAGDOLL = 0xA,
TR_RAGDOLL_GRAVITY = 0xB,
TR_RAGDOLL_INTERPOLATE = 0xC,
TR_LAST_RAGDOLL = 0xC,
NUM_TRTYPES = 0xD,
};
struct trajectory_t
{
trType_t trType;
int trTime;
int trDuration;
float trBase[3];
float trDelta[3];
};
struct LerpEntityState struct LerpEntityState
{ {
char pad[0x70]; int eFlags;
trajectory_t pos;
trajectory_t apos;
char pad0[0x24];
}; };
static_assert(sizeof(LerpEntityState) == 0x70);
struct clientLinkInfo_t struct clientLinkInfo_t
{ {
__int16 parentId; __int16 parentId;
@ -6862,10 +6938,230 @@ namespace Game
float scale; float scale;
}; };
struct XAnimParent
{
unsigned short flags;
unsigned short children;
};
struct XAnimEntry
{
unsigned short numAnims;
unsigned short parent;
union
{
XAnimParts* parts;
XAnimParent animParent;
};
};
struct XAnim_s
{
unsigned int size;
const char* debugName;
const char** debugAnimNames;
XAnimEntry entries[1];
};
struct __declspec(align(4)) XAnimTree_s
{
XAnim_s* anims;
int info_usage;
volatile int calcRefCount;
volatile int modifyRefCount;
unsigned __int16 children;
};
struct FxEffect
{
const FxEffectDef* def;
volatile int status;
unsigned __int16 firstElemHandle[3];
unsigned __int16 firstSortedElemHandle;
unsigned __int16 firstTrailHandle;
unsigned __int16 firstSparkFountainHandle;
unsigned __int16 pad16[1];
unsigned __int16 randomSeed;
unsigned __int16 owner;
unsigned __int8 lighting[3];
unsigned __int8 pad8[2];
unsigned __int8 markViewmodelClientIndex;
unsigned __int16 markEntnum;
unsigned __int16 flags;
unsigned __int8 bolt;
unsigned __int8 runnerSortOrder;
volatile int frameCount;
int msecBegin;
int msecLastUpdate;
FxSpatialFrame frameAtSpawn;
FxSpatialFrame frameNow;
FxSpatialFrame framePrev;
float distanceTravelled;
char pad2[4];
};
static_assert(sizeof(FxEffect) == 0x90);
struct CEntVehicleInfo
{
__int16 pitch;
__int16 yaw;
__int16 roll;
__int16 barrelPitch;
float barrelRoll;
__int16 steerYaw;
float time;
unsigned __int16 wheelFraction[6];
unsigned __int8 wheelBoneIndex[6];
unsigned __int8 wheelSurfaceType[6];
unsigned __int8 tag_body;
unsigned __int8 tag_turret;
unsigned __int8 tag_barrel;
};
static_assert(sizeof(CEntVehicleInfo) == 0x30);
struct CEntFx
{
int triggerTime;
FxEffect* effect;
};
struct CEntTurretAngles
{
float pitch;
float yaw;
};
union $062DBEF1E2477FBB6A8D36FDF573DC79
{
CEntTurretAngles angles;
const float* viewAngles;
};
struct CEntTurretInfo
{
$062DBEF1E2477FBB6A8D36FDF573DC79 ___u0;
float barrelPitch;
bool playerUsing;
unsigned __int8 tagIdx_aim;
unsigned __int8 tagIdx_aim_animated;
unsigned __int8 tagIdx_aim_pivot;
unsigned __int8 tagIdx_flash;
unsigned __int8 tagIdx_barrel;
float barrelRoll;
bool barrelRollSndLastRotating;
bool barrelRollSndNotified;
int barrelRollSndTime;
unsigned __int8 barrelRollSndIndex;
bool wasOverheat;
};
static_assert(sizeof(CEntTurretInfo) == 0x24);
struct clientControllers_t
{
float angles[4][3];
float tag_origin_angles[3];
float tag_origin_offset[3];
};
struct CEntPlayerInfo
{
clientControllers_t* control;
unsigned __int8 tag[4];
};
static_assert(sizeof(CEntPlayerInfo) == 0x8);
union $79C409BC84BCEABA56F6D25E37F2711D
{
CEntPlayerInfo player;
CEntTurretInfo turret;
CEntVehicleInfo vehicle;
CEntFx fx;
};
struct cpose_t
{
unsigned __int16 lightingHandle;
unsigned __int8 eType;
unsigned __int8 cullIn;
unsigned int usedInScene;
unsigned __int8 isRagdoll;
int ragdollHandle;
int killcamRagdollHandle;
int physObjId;
float origin[3];
float angles[3];
$79C409BC84BCEABA56F6D25E37F2711D ___u10;
};
static_assert(sizeof(cpose_t) == 0x60);
struct centity_s
{
cpose_t pose;
LerpEntityState prevState;
entityState_s nextState;
int flags;
unsigned __int8 tracerDrawRateCounter;
unsigned __int8 weaponVisTestCounter;
int previousEventSequence;
int pickupPredictionTime;
float lightingOrigin[3];
XAnimTree_s* tree;
centity_s* updateDelayedNext;
};
static_assert(sizeof(centity_s) == 0x1F4);
struct playerEntity_t
{
int bPositionToADS;
float fLastIdleFactor;
float baseMoveOrigin[3];
float baseMoveAngles[3];
};
static_assert(sizeof(playerEntity_t) == 0x20);
enum DemoType
{
DEMO_TYPE_NONE = 0x0,
DEMO_TYPE_CLIENT = 0x1,
DEMO_TYPE_SERVER = 0x2,
};
enum CubemapShot
{
CUBEMAPSHOT_NONE = 0x0,
CUBEMAPSHOT_RIGHT = 0x1,
CUBEMAPSHOT_LEFT = 0x2,
CUBEMAPSHOT_BACK = 0x3,
CUBEMAPSHOT_FRONT = 0x4,
CUBEMAPSHOT_UP = 0x5,
CUBEMAPSHOT_DOWN = 0x6,
CUBEMAPSHOT_COUNT = 0x7,
};
struct __declspec(align(8)) cg_s struct __declspec(align(8)) cg_s
{ {
playerState_s predictedPlayerState; playerState_s predictedPlayerState;
char _pad0[0x254]; centity_s predictedPlayerEntity;
playerEntity_t playerEntity;
int predictedErrorTime;
float predictedError[3];
int clientNum;
int localClientNum;
DemoType demoType;
CubemapShot cubemapShot;
int cubemapSize;
int renderScreen;
int latestSnapshotNum;
int latestSnapshotTime;
char pad0[16];
void* snap; void* snap;
void* nextSnap; void* nextSnap;
char _pad1[0x673DC]; char _pad1[0x673DC];
@ -7182,32 +7478,6 @@ namespace Game
} movement; } movement;
}; };
struct XAnimParent
{
unsigned short flags;
unsigned short children;
};
struct XAnimEntry
{
unsigned short numAnims;
unsigned short parent;
union
{
XAnimParts* parts;
XAnimParent animParent;
};
};
struct XAnim_s
{
unsigned int size;
const char* debugName;
const char** debugAnimNames;
XAnimEntry entries[1];
};
struct animation_s struct animation_s
{ {
char name[64]; char name[64];
@ -7234,22 +7504,6 @@ namespace Game
int oldFrameSnapshotTime; int oldFrameSnapshotTime;
}; };
struct clientControllers_t
{
float angles[4][3];
float tag_origin_angles[3];
float tag_origin_offset[3];
};
struct __declspec(align(4)) XAnimTree_s
{
XAnim_s* anims;
int info_usage;
volatile int calcRefCount;
volatile int modifyRefCount;
unsigned __int16 children;
};
enum PlayerDiveState enum PlayerDiveState
{ {
DIVE_NONE = 0x0, DIVE_NONE = 0x0,
@ -7580,6 +7834,14 @@ namespace Game
static_assert(sizeof(level_locals_t) == 0x2F78); static_assert(sizeof(level_locals_t) == 0x2F78);
enum ScreenPlacementMode
{
SCRMODE_FULL,
SCRMODE_DISPLAY,
SCRMODE_INVALID,
SCRMODE_COUNT,
};
struct WinMouseVars_t struct WinMouseVars_t
{ {
int oldButtonState; int oldButtonState;