Add turnrates for controllers

This commit is contained in:
Jan
2021-08-23 22:45:22 +02:00
parent ac1ade1976
commit e49e17d6e6
5 changed files with 477 additions and 27 deletions

View File

@ -325,6 +325,7 @@ namespace Game
TeleportPlayer_t TeleportPlayer = TeleportPlayer_t(0x496850);
UI_AddMenuList_t UI_AddMenuList = UI_AddMenuList_t(0x4533C0);
UI_GetActiveMenu_t UI_GetActiveMenu = UI_GetActiveMenu_t(0x4BE790);
UI_CheckStringTranslation_t UI_CheckStringTranslation = UI_CheckStringTranslation_t(0x4FB010);
UI_LoadMenus_t UI_LoadMenus = UI_LoadMenus_t(0x641460);
UI_UpdateArenas_t UI_UpdateArenas = UI_UpdateArenas_t(0x4A95B0);
@ -341,6 +342,8 @@ namespace Game
unzClose_t unzClose = unzClose_t(0x41BF20);
AimAssist_ApplyAutoAim_t AimAssist_ApplyAutoAim = AimAssist_ApplyAutoAim_t(0x56A360);
XAssetHeader* DB_XAssetPool = reinterpret_cast<XAssetHeader*>(0x7998A8);
unsigned int* g_poolSize = reinterpret_cast<unsigned int*>(0x7995E8);
@ -434,6 +437,10 @@ namespace Game
GfxScene* scene = reinterpret_cast<GfxScene*>(0x6944914);
clientActive_t* clients = reinterpret_cast<clientActive_t*>(0xB2C698);
clientStatic_t* cls = reinterpret_cast<clientStatic_t*>(0xA7FE90);
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize)
{
int elSize = DB_GetXAssetSizeHandlers[type]();
@ -920,7 +927,25 @@ namespace Game
Game::R_AddDebugLine(color, v[3], v[7]);
}
float GraphGetValueFromFraction(const int knotCount, const float(*knots)[2], const float fraction)
{
for (auto knotIndex = 1; knotIndex < knotCount; ++knotIndex)
{
if (knots[knotIndex][0] >= fraction)
{
const auto adjustedFraction = (fraction - knots[knotIndex - 1][0]) / (knots[knotIndex][0] - knots[knotIndex - 1][0]);
return (knots[knotIndex][1] - knots[knotIndex - 1][1]) * adjustedFraction + knots[knotIndex - 1][1];
}
}
return -1.0f;
}
float GraphFloat_GetValue(const GraphFloat* graph, const float fraction)
{
return GraphGetValueFromFraction(graph->knotCount, graph->knots, fraction) * graph->scale;
}
#pragma optimize("", off)
__declspec(naked) float UI_GetScoreboardLeft(void* /*a1*/)
@ -1278,7 +1303,29 @@ namespace Game
retn
}
}
#pragma optimize("", on)
clientActive_t* clients = reinterpret_cast<clientActive_t*>(0xB2C698);
__declspec(naked) void AimAssist_UpdateTweakables(int /*localClientNum*/)
{
__asm
{
mov eax,[esp+0x4]
mov ebx,0x569950
call ebx
retn
}
}
__declspec(naked) void AimAssist_UpdateAdsLerp(const AimInput* /*aimInput*/)
{
__asm
{
mov eax, [esp + 0x4]
mov ebx, 0x569AA0
call ebx
retn
}
}
#pragma optimize("", on)
}

View File

@ -767,6 +767,9 @@ namespace Game
typedef void(__cdecl * UI_AddMenuList_t)(UiContext *dc, MenuList *menuList, int close);
extern UI_AddMenuList_t UI_AddMenuList;
typedef uiMenuCommand_t(__cdecl* UI_GetActiveMenu_t)(int localClientNum);
extern UI_GetActiveMenu_t UI_GetActiveMenu;
typedef char* (__cdecl * UI_CheckStringTranslation_t)(char*, char*);
extern UI_CheckStringTranslation_t UI_CheckStringTranslation;
@ -801,6 +804,9 @@ namespace Game
typedef void(__cdecl * unzClose_t)(void* handle);
extern unzClose_t unzClose;
typedef void(__cdecl* AimAssist_ApplyAutoAim_t)(const AimInput* input, AimOutput* output);
extern AimAssist_ApplyAutoAim_t AimAssist_ApplyAutoAim;
extern XAssetHeader* DB_XAssetPool;
extern unsigned int* g_poolSize;
@ -893,6 +899,10 @@ namespace Game
extern GfxScene* scene;
extern clientActive_t* clients;
extern clientStatic_t* cls;
XAssetHeader ReallocateAssetPool(XAssetType type, unsigned int newSize);
void Menu_FreeItemMemory(Game::itemDef_s* item);
void Menu_SetNextCursorItem(Game::UiContext* ctx, Game::menuDef_t* currentMenu, int unk = 1);
@ -955,7 +965,11 @@ namespace Game
void R_AddDebugBounds(float* color, Bounds* b);
void R_AddDebugBounds(float* color, Bounds* b, const float(*quat)[4]);
float GraphGetValueFromFraction(int knotCount, const float(*knots)[2], float fraction);
float GraphFloat_GetValue(const GraphFloat* graph, const float fraction);
Glyph* R_GetCharacterGlyph(Font_s* font, unsigned int letter);
extern clientActive_t* clients;
void AimAssist_UpdateTweakables(int localClientNum);
void AimAssist_UpdateAdsLerp(const AimInput* input);
}

View File

@ -208,6 +208,7 @@ namespace Game
enum KeyCatch_t
{
KEYCATCH_MASK_ANY = -1,
KEYCATCH_CONSOLE = 0x1,
KEYCATCH_UNKNOWN2 = 0x2,
KEYCATCH_UNKNOWN4 = 0x4,
@ -357,6 +358,22 @@ namespace Game
K_LAST_KEY = 0xDF,
};
enum uiMenuCommand_t
{
UIMENU_NONE = 0x0,
UIMENU_MAIN = 0x1,
UIMENU_INGAME = 0x2,
UIMENU_PREGAME = 0x3,
UIMENU_POSTGAME = 0x4,
UIMENU_SCRIPT_POPUP = 0x5,
UIMENU_SCOREBOARD = 0x6,
UIMENU_PARTY = 0x7,
UIMENU_GAMELOBBY = 0x8,
UIMENU_PRIVATELOBBY = 0x9,
UIMENU_ENDOFGAME = 0xA,
UIMENU_MIGRATION = 0xB,
};
struct __declspec(align(4)) PhysPreset
{
const char *name;
@ -1020,6 +1037,20 @@ namespace Game
hudelem_s archival[31];
};
enum pmtype_t
{
PM_NORMAL = 0x0,
PM_NORMAL_LINKED = 0x1,
PM_NOCLIP = 0x2,
PM_UFO = 0x3,
PM_MPVIEWER = 0x4,
PM_SPECTATOR = 0x5,
PM_INTERMISSION = 0x6,
PM_LASTSTAND = 0x7,
PM_DEAD = 0x8,
PM_DEAD_LINKED = 0x9,
};
struct playerState_s
{
int commandTime;
@ -5962,6 +5993,154 @@ namespace Game
int allowAddDObj;
};
struct AimInput
{
float deltaTime;
float deltaTimeScaled;
float pitch;
float pitchAxis;
float pitchMax;
float yaw;
float yawAxis;
float yawMax;
float forwardAxis;
float rightAxis;
int buttons;
int localClientNum;
};
struct AimOutput
{
float pitch;
float yaw;
float meleeChargeYaw;
char meleeChargeDist;
};
struct clientLogo_t
{
int startTime;
int duration;
int fadein;
int fadeout;
Material* material[2];
};
struct vidConfig_t
{
unsigned int sceneWidth;
unsigned int sceneHeight;
unsigned int displayWidth;
unsigned int displayHeight;
unsigned int displayFrequency;
int isFullscreen;
float aspectRatioWindow;
float aspectRatioScenePixel;
float aspectRatioDisplayPixel;
unsigned int maxTextureSize;
unsigned int maxTextureMaps;
bool deviceSupportsGamma;
};
struct trDebugLine_t
{
float start[3];
float end[3];
float color[4];
int depthTest;
};
struct trDebugString_t
{
float xyz[3];
float color[4];
float scale;
char text[96];
};
struct clientDebugStringInfo_t
{
int max;
int num;
trDebugString_t* strings;
int* durations;
};
struct clientDebugLineInfo_t
{
int max;
int num;
trDebugLine_t* lines;
int* durations;
};
struct clientDebug_t
{
int prevFromServer;
int fromServer;
clientDebugStringInfo_t clStrings;
clientDebugStringInfo_t svStringsBuffer;
clientDebugStringInfo_t svStrings;
clientDebugLineInfo_t clLines;
clientDebugLineInfo_t svLinesBuffer;
clientDebugLineInfo_t svLines;
};
struct ClientMatchData
{
char def[64];
char data[1024];
};
struct clientStatic_t
{
int quit;
int hunkUsersStarted;
char servername[256];
int rendererStarted;
int soundStarted;
int uiStarted;
int frametime;
float frametime_base;
int realtime;
bool gpuSyncedPrevFrame;
bool inputUpdatedPrevFrame;
clientLogo_t logo;
float mapCenter[3];
int lastServerPinged;
int pingedServerCount;
int totalServersParsed;
int pingUpdateSource;
Material* whiteMaterial;
Material* consoleMaterial;
Font_s* consoleFont;
vidConfig_t vidConfig;
clientDebug_t debug;
int doVidRestart;
ClientMatchData matchData;
XNADDR xnaddrs[18];
float debugRenderPos[3];
int skelValid;
int skelTimeStamp;
volatile int skelMemPos;
char skelMemory[262144];
char* skelMemoryStart;
bool allowedAllocSkel;
int serverId;
gameState_t gameState;
clSnapshot_t noDeltaSnapshot;
int nextNoDeltaEntity;
entityState_s noDeltaEntities[1024];
};
struct GraphFloat
{
char name[64];
float knots[32][2];
unsigned __int16 knotCount;
float scale;
};
#pragma endregion
#ifndef IDA