Advertisement
Guest User

(PS3) kiwi_modz BO2 Engine Radar Rebuilt.

a guest
Sep 22nd, 2018
2,423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.30 KB | None | 0 0
  1. //Since my shit is getting leaked, and others are taking credit for it, it's come to this...
  2. //Enjoy.
  3.  
  4. #define compass_data ((compass_shit*)(*(int*)(0xE22F18) + 0x69B78))
  5. #define FLOAT_1_0 1.0f
  6. #define compass_max_range (*(float*)(0x01cc9d78))
  7. #define color_white color(255, 255, 255, 255)
  8. #define __mask_neg_float -1.0f
  9.  
  10. float _mm_xor_ps(float v15, float _mask__NegFloat_)
  11. {
  12.     return v15 * _mask__NegFloat_;
  13. }
  14.  
  15. struct rectDef_s
  16. {
  17.     float x;
  18.     float y;
  19.     float w;
  20.     float h;
  21.     int horzAlign;
  22.     int vertAlign;
  23. };
  24.  
  25. void __cdecl CG_CompassCalcDimensions(int compassType, cg_s *cgaa, rectDef_s *parentRect, rectDef_s *rect, float *x, float *y, float *w, float *h)
  26. {
  27.     Invoke<void>(0x2F810, compassType, cgaa, parentRect, rect, x, y, w, h);
  28. }
  29.  
  30. void __cdecl R_AddCmdDrawStretchPicRotateSTInternal(float x, float y, float w, float h, float centerS, float centerT, float radiusST, float scaleFinalS, float scaleFinalT, float angle, const float * color, void * material)
  31. {
  32.     Invoke<void>(0x76A55C, x, y, w, h, centerS, centerT, radiusST, scaleFinalS, scaleFinalT, angle, color, material);
  33. }
  34.  
  35. void __cdecl ScrPlace_ApplyRect(float *x, float *y, float *w, float *h, int horzAlign, int vertAlign)
  36. {
  37.     Invoke<void>(0x15FFE0, 0xFB9DE0, x, y, w, h, horzAlign, vertAlign);
  38. }
  39.  
  40. void __cdecl CL_DrawStretchPicRotatedSTInternal(float x, float y, float w, float h, int horzAlign, int vertAlign, float centerS, float centerT, float radiusST, float scaleFinalS, float scaleFinalT, float angle, color c, pvoid Material)
  41. {
  42.     ScrPlace_ApplyRect(&x, &y, &w, &h, horzAlign, vertAlign);
  43.     R_AddCmdDrawStretchPicRotateSTInternal(x, y, w, h, centerS, centerT, radiusST, scaleFinalS, scaleFinalT, angle, (float*)&c, Material);
  44. }
  45.  
  46. void CL_DrawStretchPicInternal(float x, float y, float w, float h, int horzAlign, int vertAlign, float centerS, float centerT, float radiusST, float scaleFinalS, color color, pvoid material) {
  47.     Invoke<void>(0x10B588, 0xFB9DE0, x, y, w, h, horzAlign, vertAlign, centerS, centerT, radiusST, scaleFinalS, (float*)&color, material);
  48. }
  49.  
  50. enum CompassType
  51. {
  52.     COMPASS_TYPE_PARTIAL = 0x0,
  53.     COMPASS_TYPE_FULL = 0x1,
  54. };
  55.  
  56. void __cdecl CG_CompassDrawPlayerMap(CompassType compassType)
  57. {
  58.     /// stack
  59.     rectDef_s parentRect, rect;
  60.     Vector2 east, south, mapCenter;
  61.     float delta, delta_4, texCenter, texCenter_4, texRadius, scaleFinalS, scaleFinalT, rotation, x, y, w, h;
  62.     /// radar_render #begin
  63.     float width = 213, hight = 163;
  64.  
  65.     parentRect.w = width;
  66.     parentRect.h = hight;
  67.  
  68.     rect.w = width;
  69.     rect.h = hight;
  70.     rect.x = -97;
  71.     rect.y = 31;
  72.  
  73.     w = width;
  74.     h = hight;
  75.  
  76.     mapCenter.x = cg->refdef.ViewOrigin.x;
  77.     mapCenter.y = cg->refdef.ViewOrigin.y;
  78.  
  79.     east.x = compass_data->compassNorth.y;
  80.     east.y = _mm_xor_ps(compass_data->compassNorth.x, __mask_neg_float);
  81.     south.x = _mm_xor_ps(compass_data->compassNorth.x, __mask_neg_float);
  82.     south.y = _mm_xor_ps(compass_data->compassNorth.y, __mask_neg_float);
  83.  
  84.     delta = mapCenter.x - compass_data->compassMapUpperLeft.x;
  85.     delta_4 = mapCenter.y - compass_data->compassMapUpperLeft.y;
  86.     texCenter = (float)((float)(delta * east.x) + (float)(delta_4 * east.y)) / compass_data->compassMapWorldSize.x;
  87.     texCenter_4 = (float)((float)(delta * south.x) + (float)(delta_4 * south.y)) / compass_data->compassMapWorldSize.y;
  88.     if (compass_data->compassMapWorldSize.x <= compass_data->compassMapWorldSize.y)
  89.     {
  90.         texRadius = (float)(0.5 * compass_max_range) / compass_data->compassMapWorldSize.y;
  91.         scaleFinalS = compass_data->compassMapWorldSize.y / compass_data->compassMapWorldSize.x;
  92.         scaleFinalT = FLOAT_1_0;
  93.     }
  94.     else
  95.     {
  96.         texRadius = (float)(0.5 * compass_max_range) / compass_data->compassMapWorldSize.x;
  97.         scaleFinalS = FLOAT_1_0;
  98.         scaleFinalT = compass_data->compassMapWorldSize.x / compass_data->compassMapWorldSize.y;
  99.     }
  100.  
  101.     rotation = _mm_xor_ps((cg->playerstate.viewAngles.y - compass_data->compassNorthYaw), __mask_neg_float);
  102.  
  103.     CG_CompassCalcDimensions(compassType, cg, &parentRect, &rect, &x, &y, &w, &h);
  104.     if (compassType != 1)
  105.     {
  106.         CL_DrawStretchPicRotatedSTInternal(x, y, w, h, rect.horzAlign, rect.vertAlign, texCenter, texCenter_4, texRadius, scaleFinalS, scaleFinalT, rotation, color_white, compass_data->compassMapMaterial);
  107.     }
  108.     else
  109.     {
  110.         CL_DrawStretchPicInternal(x, y, w, h, rect.horzAlign, rect.vertAlign, 0.0, 0.0, 1.0, 1.0, color_white, compass_data->compassMapMaterial);
  111.     }
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement