Advertisement
John

[PS4] WW2 1.11 Huds

May 1st, 2019
773
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.30 KB | None | 0 0
  1. // all found by me, John - with some help from https://wiki.orbismodding.com/index.php?title=Hud_Elements
  2.  
  3. #pragma pack(push, 1)
  4. struct HudElement {
  5.     char padding_0[0x04]; // 0x0
  6.     uint32_t font; // 0x4
  7.     uint32_t alignOrg; // 0x8
  8.     uint32_t alignScreen; // 0xc
  9.     float x; // 10
  10.     float y; // 14
  11.     float z; // 18
  12.     uint32_t type; // 0x1c
  13.     float fontScale; // 0x20
  14.     char padding_1[0x0C]; // 0x24
  15.     union {
  16.         uint32_t argb;
  17.         struct { uint8_t a, r, g, b; };
  18.     } argb; // 0x30
  19.     char padding_2[0x10]; // 0x34
  20.     uint32_t width; // 0x44
  21.     uint32_t height; // 0x48
  22.     uint32_t material; // 0x4c
  23.     char padding_3[0x10]; // 0x50
  24.     uint32_t fromWidth; // 0x60
  25.     uint32_t fromHeight; // 0x64
  26.     uint32_t scaleStartTime; // 0x68
  27.     uint32_t scaleTime; // 0x6c
  28.     float fromX; // 0x70
  29.     float fromY; // 0x74
  30.     uint32_t fromAlignOrg; // 0x78
  31.     uint32_t fromAlignScreen; // 0x7c
  32.     uint32_t moveStartTime; // 0x80
  33.     uint32_t moveTime; // 0x84
  34.     uint32_t time; // 0x88
  35.     uint32_t duration; // 0x8c
  36.     float value; // 0x90
  37.     uint32_t localizeStringIndex; // 0x94
  38.     char padding_5[0x24]; // 0x98
  39.     uint32_t index; // 0xbc
  40.     char padding_6[0x01]; // 0xc0
  41.     char visibility; // 0xc1
  42.     char padding_7[0x0E]; // 0xc2
  43. };
  44. #pragma pack(pop)
  45.  
  46. HudElement* HudElemAlloc(uint32_t client, uint32_t team) {
  47.     return ((HudElement * (*)(uint32_t, uint32_t, uint32_t))0xD6DF30)(client, team, 0);
  48. }
  49.  
  50. uint32_t G_FindConfigstringIndex(const char *p0, uint64_t p1, uint32_t p2, int32_t p3, const char *p4) {
  51.     return ((uint32_t(*)(const char *, uint64_t, uint32_t, int32_t, const char *))0x917430)(p0, p1, p2, p3, p4);
  52. }
  53.  
  54. uint32_t G_LocalizedStringIndex(const char* text) {
  55.     return G_FindConfigstringIndex(text, 570, 0x28A, 1, "localized string");
  56. };
  57.  
  58. uint32_t G_MaterialIndex(const char* material) {
  59.     return G_FindConfigstringIndex(material, 4472, 0x1FF, *(int32_t *)0xC472750, "material");
  60. }
  61.  
  62. HudElement* spawnHudElem(uint32_t client, float x, float y, uint32_t rgba) {
  63.     HudElement* hud = HudElemAlloc(client, 0);
  64.  
  65.     hud->alignOrg = 0x04;
  66.     hud->alignScreen = 0x98;
  67.     hud->x = x;
  68.     hud->y = y;
  69.     hud->argb.argb = __builtin_bswap32(rgba);
  70.     hud->visibility = 0x01;
  71.  
  72.     return hud;
  73. }
  74.  
  75. HudElement *spawnText(uint32_t client, float x, float y, uint32_t rgba, const char *text, uint32_t font, float fontScale) {
  76.     HudElement* hud = spawnHudElem(client, x, y, rgba);
  77.  
  78.     hud->type = 0x01;
  79.     hud->font = font;
  80.     hud->fontScale = fontScale;
  81.     hud->localizeStringIndex = G_LocalizedStringIndex(text);
  82.  
  83.     return hud;
  84. }
  85.  
  86. HudElement *spawnShader(uint32_t client, float x, float y, uint32_t rgba, const char *material, uint16_t width, uint16_t height) {
  87.     HudElement* hud = spawnHudElem(client, x, y, rgba);
  88.  
  89.     hud->type = 0x04;
  90.     hud->width = width;
  91.     hud->height = height;
  92.     hud->material = G_MaterialIndex(material);
  93.  
  94.     return hud;
  95. }
  96.  
  97. uint32_t getLevelTime() {
  98.     return *(uint32_t *)(0xC472D60 + 0x04);
  99. }
  100.  
  101. void scaleOverTime(HudElement* hud, char useconds, uint16_t width, uint16_t height) {
  102.     hud->fromHeight = hud->height;
  103.     hud->fromWidth = hud->width;
  104.     hud->scaleStartTime = getLevelTime();
  105.     hud->scaleTime = useconds;
  106.     hud->height = height;
  107.     hud->width = width;
  108. }
  109. void moveOverTime(HudElement* hud, char useconds, float x, float y) {
  110.     hud->fromX = hud->x;
  111.     hud->fromY = hud->y;
  112.     hud->moveStartTime = getLevelTime();
  113.     hud->moveTime = useconds;
  114.     hud->x = x;
  115.     hud->y = y;
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement