diff options
author | aap <aap@papnet.eu> | 2020-04-16 09:23:31 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-04-16 09:23:31 +0200 |
commit | 89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d (patch) | |
tree | cbecbce7d638d7175ea4ee5c8b402c00564c017e /src/render | |
parent | Merge branch 'master' of github.com:gtamodding/re3 (diff) | |
parent | Merge pull request #453 from Fire-Head/master (diff) | |
download | re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.gz re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.bz2 re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.lz re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.xz re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.zst re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.zip |
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/Hud.cpp | 6 | ||||
-rw-r--r-- | src/render/WeaponEffects.cpp | 106 | ||||
-rw-r--r-- | src/render/WeaponEffects.h | 27 |
3 files changed, 2 insertions, 137 deletions
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index f8b86bd2..9529c4c1 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -144,12 +144,10 @@ void CHud::Draw() float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); CRect rect; if (DrawCrossHairPC && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()) { -#ifndef ASPECT_RATIO_SCALE float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX; float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY; -#else - float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH; - float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f); +#ifdef ASPECT_RATIO_SCALE + f3rdY -= SCREEN_SCALE_Y(2.0f); #endif if (FindPlayerPed() && WeaponType == WEAPONTYPE_M16) { rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); diff --git a/src/render/WeaponEffects.cpp b/src/render/WeaponEffects.cpp deleted file mode 100644 index 2ed9e662..00000000 --- a/src/render/WeaponEffects.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "common.h" -#include "patcher.h" -#include "WeaponEffects.h" -#include "TxdStore.h" -#include "Sprite.h" - -RwTexture *gpCrossHairTex; -RwRaster *gpCrossHairRaster; - -CWeaponEffects gCrossHair; - -CWeaponEffects::CWeaponEffects() -{ - -} - -CWeaponEffects::~CWeaponEffects() -{ - -} - -void -CWeaponEffects::Init(void) -{ - gCrossHair.m_bActive = false; - gCrossHair.m_vecPos = CVector(0.0f, 0.0f, 0.0f); - gCrossHair.m_nRed = 0; - gCrossHair.m_nGreen = 0; - gCrossHair.m_nBlue = 0; - gCrossHair.m_nAlpha = 255; - gCrossHair.m_fSize = 1.0f; - gCrossHair.m_fRotation = 0.0f; - - - CTxdStore::PushCurrentTxd(); - int32 slot = CTxdStore::FindTxdSlot("particle"); - CTxdStore::SetCurrentTxd(slot); - - gpCrossHairTex = RwTextureRead("crosshair", nil); - gpCrossHairRaster = RwTextureGetRaster(gpCrossHairTex); - - CTxdStore::PopCurrentTxd(); -} - -void -CWeaponEffects::Shutdown(void) -{ - RwTextureDestroy(gpCrossHairTex); -} - -void -CWeaponEffects::MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size) -{ - gCrossHair.m_bActive = true; - gCrossHair.m_vecPos = pos; - gCrossHair.m_nRed = red; - gCrossHair.m_nGreen = green; - gCrossHair.m_nBlue = blue; - gCrossHair.m_nAlpha = alpha; - gCrossHair.m_fSize = size; -} - -void -CWeaponEffects::ClearCrossHair(void) -{ - gCrossHair.m_bActive = false; -} - -void -CWeaponEffects::Render(void) -{ - if ( gCrossHair.m_bActive ) - { - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void *)gpCrossHairRaster); - - RwV3d pos; - float w, h; - if ( CSprite::CalcScreenCoors(gCrossHair.m_vecPos, &pos, &w, &h, true) ) - { - float recipz = 1.0f / pos.z; - CSprite::RenderOneXLUSprite(pos.x, pos.y, pos.z, - gCrossHair.m_fSize * w, gCrossHair.m_fSize * h, - gCrossHair.m_nRed, gCrossHair.m_nGreen, gCrossHair.m_nBlue, 255, - recipz, 255); - } - - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)FALSE); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); - RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDSRCALPHA); - RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDINVSRCALPHA); - } -} - -STARTPATCHES - //InjectHook(0x564C40, CWeaponEffects::CWeaponEffects, PATCH_JUMP); - //InjectHook(0x564C50, CWeaponEffects::~CWeaponEffects, PATCH_JUMP); - InjectHook(0x564C60, CWeaponEffects::Init, PATCH_JUMP); - InjectHook(0x564CF0, CWeaponEffects::Shutdown, PATCH_JUMP); - InjectHook(0x564D00, CWeaponEffects::MarkTarget, PATCH_JUMP); - InjectHook(0x564D60, CWeaponEffects::ClearCrossHair, PATCH_JUMP); - InjectHook(0x564D70, CWeaponEffects::Render, PATCH_JUMP); -ENDPATCHES
\ No newline at end of file diff --git a/src/render/WeaponEffects.h b/src/render/WeaponEffects.h deleted file mode 100644 index 31c5a309..00000000 --- a/src/render/WeaponEffects.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -class CWeaponEffects -{ -public: - bool m_bActive; - char _pad[3]; - CVector m_vecPos; - uint8 m_nRed; - uint8 m_nGreen; - uint8 m_nBlue; - uint8 m_nAlpha; - float m_fSize; - float m_fRotation; - -public: - CWeaponEffects(); - ~CWeaponEffects(); - - static void Init(void); - static void Shutdown(void); - static void MarkTarget(CVector pos, uint8 red, uint8 green, uint8 blue, uint8 alpha, float size); - static void ClearCrossHair(void); - static void Render(void); -}; - -VALIDATE_SIZE(CWeaponEffects, 0x1C);
\ No newline at end of file |