Post: GHOSTS/SPRX HudElements
08-03-2014, 12:48 AM #1
Swaqq
Professional Thanker
(adsbygoogle = window.adsbygoogle || []).push({}); Hello everyone,

today i'm releasing my ghosts huds Happy
so here they are Happy
I will probably add more stuff tomorrow :|
hope you enjoy


I have tested most things but not all.
Please test and make sure all is working Happy


NOTE THAT THE TEXT DOES WORK BUT YOU *MUST* ENABLE HUDS WITH ENABLE_HUDS() !
I HAVE NOT ADDED IT IN AS I AM STILL CONVERTING IT SO IF YOU WANT TO SPAWN TEXT JUST CONNECT TO AN RTE TOOL WITH ENABLE_HUDS()

First you will need:

    
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 * 0xbCool Man (aka Tustin);
*(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 * 0xBCool Man (aka Tustin);
WriteByte(elem, 0xBCool Man (aka Tustin);
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 * 0xBCool Man (aka Tustin);
*(short*)(offset + Hud::text) = G_LocalizedStringIndex(newText);
}

void changeMaterial(int elemIndex, int newMaterial)
{
uint offset = Hud::ELEM + (elemIndex * 0xBCool Man (aka Tustin);
*(int*)(offset + Hud::materialIndex) = newMaterial;
}

void setCheckerBoardShader(int elemIndex, int r, int g, int b, int a)
{
uint offset = Hud::ELEM + (elemIndex * 0xBCool Man (aka Tustin);
*(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 * 0xBCool Man (aka Tustin);
*(char*)(offset + Hud::color) = r;
*(char*)(offset + Hud::color + 1) = g;
*(char*)(offset + Hud::color + 2) = b;
*(char*)(offset + Hud::color + 3) = a;
}



Credits:
Me - Making Them
iTNDM - Offsets
milky4444 - Help
Ikea Monkey - Help
xPAQz - Help

Have Fun !
Last edited by Swaqq ; 08-03-2014 at 12:30 PM.

The following 7 users say thank you to Swaqq for this useful post:

codybenti, Ethan, Im Not Boobdidas, OLDSCHOOLMODZHD, SaberNGU, Laser, xPAQz
08-03-2014, 12:28 PM #11
Swaqq
Professional Thanker
gg "Ugly" lol i really didn't want to make it like tht :| i like my wayz xD but i didn't really take time to organize is so it is a little bit messy :3
Originally posted by Shark View Post
nice work and all but this code is seriously ugly and unnecessary you could just do this instead... it looks way better is much easier to port to other call of duties... don't take this post as me trying to offend you I'm just saying...

    
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;
}

The following user thanked Swaqq for this useful post:

cyberghosts
08-03-2014, 06:36 PM #12
nice work!
08-04-2014, 12:07 AM #13
xPAQz
Bounty hunter
nicd and thanks for credits Enzo
08-04-2014, 12:19 PM #14
Swaqq
Professional Thanker
np m8 thx for teh help Winky Winky
Originally posted by xPAQz View Post
nicd and thanks for credits Enzo

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo