struct opd_s
{
uint32_t sub;
uint32_t toc;
};
#define uint unsigned int
namespace Hud
{
uint ELEM = 0xD87D88;
uint FPS = 0x36D410;
uint FIX_ELEM = 0x3447F;
uint G_LocalizedStringIndex = 0x34438;
uint
type = 0x00,
xOffset = 0x04,
yOffset = 0x08,
zOffset = 0x0C,
targetEntNum = 0x10,
fontScale = 0x14,
fromFontScale = 0x18,
fontScaleStartTime = 0x1C,
fontScaleTime = 0x20,
font = 0x24,
alignOrg = 0x28,
alignScreen = 0x2C,
color = 0x30,
fromColor = 0x34,
fadeStartTime = 0x38,
fadeTime = 0x3C,
label = 0x40,
text = 0x42,
width = 0x44,
height = 0x48,
materialIndex = 0x4C,
fromWidth = 0x50,
fromHeight = 0x54,
scaleStartTime = 0x58,
scaleTime = 0x5C,
fromX = 0x60,
fromY = 0x64,
fromAlignOrg = 0x68,
fromAlignScreen = 0x6C,
moveStartTime = 0x70,
moveTime = 0x74,
time = 0x78,
duration = 0x7C,
value = 0x80,
sort = 0x88,
glowColor = 0x8C,
fxBirthTime = 0x90,
fxLetterTime = 0x94,
fxDecayStartTime = 0x98,
fxDecayDuration = 0x9C,
soundID = 0xA0,
flags = 0xA4,
clientOffset = 0xA8;
};
void StoreIcon(int elemIndex, int client, int shader, int width, int height, float x, float y, int align, float sort, int r, int g, int b, int a)
{
uint offset = Hud::ELEM + (elemIndex * 0xb;
*(int*)offset = 0xb8;
*(int*)offset = 0x4;
*(int*)(offset + Hud::materialIndex) = shader;
*(int*)(offset + Hud::clientOffset) = (int)client;
*(int*)(offset + Hud::width) = width;
*(int*)(offset + Hud::height) = height;
*(int*)(offset + Hud::alignScreen) = 0;
*(int*)(offset + Hud::alignOrg) = 0;
*(float*)(offset + Hud::xOffset) = x;
*(float*)(offset + Hud::yOffset) = y;
*(char*)(offset + Hud::color) = r;
*(char*)(offset + Hud::color + 1) = g;
*(char*)(offset + Hud::color + 2) = b;
*(char*)(offset + Hud::color + 3) = a;
}
int G_LocalizedStringIndex(const char* Text)
{
opd_s Localized = { 0x34438, 0xA7F3F8 };
int(*LocalizedStringIndex)(const char* Text) = (int(*)(const char*))&Localized;
return LocalizedStringIndex(Text);
}
void WriteBytes(int address, char* input, int length)
{
for (int i = 0; i < length; i++)
{
*(char*)(address + (i)) = input[i];
}
}
void StoreTextElem(int elemIndex, int client, const char* Text, short font, double fontScale, float x, float y, uint align, float sort, int r, int g, int b, int a)
{
uint elem = Hud::ELEM + (elemIndex * 0xB;
WriteByte(elem, 0xB;
char elem1[] = { 0x00, 0x00, 0x00, 0x01 };
WriteBytes(elem, elem1, 4);
*(short*)(elem + Hud::text) = G_LocalizedStringIndex(Text);
*(int*)(elem + Hud::font) = font;
*(int*)(elem + Hud::clientOffset) = client;
*(float*)(elem + Hud::fontScale) = fontScale;
*(float*)(elem + Hud::xOffset) = x;
*(float*)(elem + Hud::yOffset) = y;
*(char*)(elem + Hud::color) = r;
*(char*)(elem + Hud::color + 1) = g;
*(char*)(elem + Hud::color + 2) = b;
*(char*)(elem + Hud::color + 3) = a;
}
void ChangeText(int elemIndex, const char* newText)
{
uint offset = Hud::ELEM + (elemIndex * 0xB;
*(short*)(offset + Hud::text) = G_LocalizedStringIndex(newText);
}
void changeMaterial(int elemIndex, int newMaterial)
{
uint offset = Hud::ELEM + (elemIndex * 0xB;
*(int*)(offset + Hud::materialIndex) = newMaterial;
}
void setCheckerBoardShader(int elemIndex, int r, int g, int b, int a)
{
uint offset = Hud::ELEM + (elemIndex * 0xB;
*(int*)(offset + Hud::materialIndex) = 9;
*(char*)(offset + Hud::color) = r;
*(char*)(offset + Hud::color + 1) = g;
*(char*)(offset + Hud::color + 2) = b;
*(char*)(offset + Hud::color + 3) = a;
}
void ChangeAlpha(int elemIndex, int r, int g, int b, int a)
{
uint offset = Hud::ELEM + (elemIndex * 0xB;
*(char*)(offset + Hud::color) = r;
*(char*)(offset + Hud::color + 1) = g;
*(char*)(offset + Hud::color + 2) = b;
*(char*)(offset + Hud::color + 3) = a;
}
typedef struct
{
int type;
float xyz[3];
int targNum;
float fontScale;
float fromFontScale;
int fontScaleStartTime;
int fontScaleTime;
int font;
int alignOrg;
int alignScreen;
unsigned char color[4];
unsigned char fromColor[4];
int fadeStartTime;
int fadeTime;
short label;
short text;
int width;
int height;
int material;
int fromWidth;
int fromHeight;
int scaleStartTime;
int scaleTime;
float fromX;
float fromY;
int fromAlignOrg;
int fromAlignScreen;
int moveStartTime;
int moveTime;
int time;
int duration;
double value;
float sort;
unsigned char glowColor[4];
int fxBirthTime;
int fxLetterTime;
int fxDecayStartTime;
int fxDecayDuration;
int soundID;
int flags;
}hudelem_s;
typedef struct
{
hudelem_s elem;
int clientNum;
int teamNum;
int archived;
int unknown;
}game_hudelem_s;
struct
{
int EA, TOC;
}call_t;
call_t alloc = { 0x34438, 0xA7F3F8 };
game_hudelem_s*(*HudElem_Alloc)(int clientNum, int teamNum) = (game_hudelem_s*(__cdecl*)(int,int))&alloc;
//example
game_hudelem_s* createFontString(char*str, int font, float fontSize, int clientNum = 0x7FF)
{
game_hudelem_s*text = HudElem_Alloc(clientNum, (client > 0xC ? 0 : getTeamNum));
text->elem.text = G_LocalizeStringIndex(str);
text->elem.font = font;
text->elem.fontSize = fontSize;
text->elem.clientNum = clientNum;
return text;
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.