diff options
Diffstat (limited to '')
-rw-r--r-- | src/render/Coronas.cpp | 3 | ||||
-rw-r--r-- | src/render/Hud.cpp | 42 | ||||
-rw-r--r-- | src/render/Rubbish.cpp | 1 | ||||
-rw-r--r-- | src/render/Rubbish.h | 1 | ||||
-rw-r--r-- | src/render/Skidmarks.cpp | 1 | ||||
-rw-r--r-- | src/render/Skidmarks.h | 1 | ||||
-rw-r--r-- | src/render/SpecialFX.cpp | 1 | ||||
-rw-r--r-- | src/render/SpecialFX.h | 1 | ||||
-rw-r--r-- | src/render/WeaponEffects.cpp | 113 | ||||
-rw-r--r-- | src/render/WeaponEffects.h | 30 |
10 files changed, 111 insertions, 83 deletions
diff --git a/src/render/Coronas.cpp b/src/render/Coronas.cpp index b0868d0a..c934540b 100644 --- a/src/render/Coronas.cpp +++ b/src/render/Coronas.cpp @@ -59,9 +59,6 @@ int &CCoronas::bChangeBrightnessImmediately = *(int*)0x8E2C30; CRegisteredCorona *CCoronas::aCoronas = (CRegisteredCorona*)0x72E518; -//WRAPPER void CCoronas::Render(void) { EAXJMP(0x4F8FB0); } -//WRAPPER void CCoronas::RenderReflections(void) { EAXJMP(0x4F9B40); } - const char aCoronaSpriteNames[][32] = { "coronastar", "corona", diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp index 51aa390f..2f523e17 100644 --- a/src/render/Hud.cpp +++ b/src/render/Hud.cpp @@ -103,9 +103,6 @@ struct RwTexture *&gpSniperSightTex = *(RwTexture**)0x8F5834; RwTexture *&gpRocketSightTex = *(RwTexture**)0x8E2C20; -#if 0 -WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); } -#else void CHud::Draw() { // disable hud via second controller @@ -1004,12 +1001,7 @@ void CHud::Draw() } } } -#endif - -#if 0 -WRAPPER void CHud::DrawAfterFade(void) { EAXJMP(0x509030); } -#else void CHud::DrawAfterFade() { if (CTimer::GetIsUserPaused() || CReplay::IsPlayingBack()) @@ -1261,11 +1253,7 @@ void CHud::DrawAfterFade() BigMessageInUse[1] = 0.0f; } } -#endif -#if 0 -WRAPPER void CHud::GetRidOfAllHudMessages(void) { EAXJMP(0x504F90); } -#else void CHud::GetRidOfAllHudMessages() { m_ZoneState = 0; @@ -1301,7 +1289,6 @@ void CHud::GetRidOfAllHudMessages() m_BigMessage[i][j] = 0; } } -#endif void CHud::Initialise() { @@ -1343,9 +1330,6 @@ void CHud::Initialise() CTxdStore::PopCurrentTxd(); } -#if 0 -WRAPPER void CHud::ReInitialise(void) { EAXJMP(0x504CC0); } -#else void CHud::ReInitialise() { m_Wants_To_Draw_Hud = true; m_Wants_To_Draw_3dMarkers = true; @@ -1367,12 +1351,9 @@ void CHud::ReInitialise() { PagerSoundPlayed = 0; PagerXOffset = 150.0f; } -#endif wchar LastBigMessage[6][128]; -#if 0 -WRAPPER void CHud::SetBigMessage(wchar *message, int16 style) { EAXJMP(0x50A250); } -#else + void CHud::SetBigMessage(wchar *message, int16 style) { int i = 0; @@ -1400,11 +1381,7 @@ void CHud::SetBigMessage(wchar *message, int16 style) LastBigMessage[style][i] = 0; m_BigMessage[style][i] = 0; } -#endif -#if 0 -WRAPPER void CHud::SetHelpMessage(wchar *message, bool quick) { EAXJMP(0x5051E0); } -#else void CHud::SetHelpMessage(wchar *message, bool quick) { if (!CReplay::IsPlayingBack()) { @@ -1419,11 +1396,7 @@ void CHud::SetHelpMessage(wchar *message, bool quick) m_HelpMessageQuick = quick; } } -#endif -#if 0 -WRAPPER void CHud::SetMessage(wchar *message) { EAXJMP(0x50A210); } -#else void CHud::SetMessage(wchar *message) { int i = 0; @@ -1435,11 +1408,7 @@ void CHud::SetMessage(wchar *message) } m_Message[i] = 0; } -#endif -#if 0 -WRAPPER void CHud::SetPagerMessage(wchar *message) { EAXJMP(0x50A320); } -#else void CHud::SetPagerMessage(wchar *message) { int i = 0; @@ -1451,25 +1420,16 @@ void CHud::SetPagerMessage(wchar *message) } m_PagerMessage[i] = 0; } -#endif -#if 0 -WRAPPER void CHud::SetVehicleName(wchar *name) { EAXJMP(0x505290); } -#else void CHud::SetVehicleName(wchar *name) { m_VehicleName = name; } -#endif -#if 0 -WRAPPER void CHud::SetZoneName(wchar *name) { EAXJMP(0x5051D0); } -#else void CHud::SetZoneName(wchar *name) { m_pZoneName = name; } -#endif void CHud::Shutdown() { diff --git a/src/render/Rubbish.cpp b/src/render/Rubbish.cpp index c336eb47..a52e59a0 100644 --- a/src/render/Rubbish.cpp +++ b/src/render/Rubbish.cpp @@ -7,3 +7,4 @@ WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); } WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); } WRAPPER void CRubbish::SetVisibility(bool) { EAXJMP(0x512AA0); } WRAPPER void CRubbish::Init(void) { EAXJMP(0x511940); } +WRAPPER void CRubbish::Shutdown(void) { EAXJMP(0x511B50); } diff --git a/src/render/Rubbish.h b/src/render/Rubbish.h index c94ff303..17323694 100644 --- a/src/render/Rubbish.h +++ b/src/render/Rubbish.h @@ -10,4 +10,5 @@ public: static void Update(void); static void SetVisibility(bool); static void Init(void); + static void Shutdown(void); }; diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp index deb5a648..c2725ed6 100644 --- a/src/render/Skidmarks.cpp +++ b/src/render/Skidmarks.cpp @@ -9,3 +9,4 @@ WRAPPER void CSkidmarks::Render(void) { EAXJMP(0x5182E0); } WRAPPER void CSkidmarks::RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy) { EAXJMP(0x5185C0); } WRAPPER void CSkidmarks::Init(void) { EAXJMP(0x517D70); } +WRAPPER void CSkidmarks::Shutdown(void) { EAXJMP(0x518100); } diff --git a/src/render/Skidmarks.h b/src/render/Skidmarks.h index 2f669575..bf2da7e4 100644 --- a/src/render/Skidmarks.h +++ b/src/render/Skidmarks.h @@ -8,4 +8,5 @@ public: static void Render(void); static void RegisterOne(uint32 id, CVector pos, float fwdx, float fwdY, bool *isMuddy, bool *isBloddy); static void Init(void); + static void Shutdown(void); }; diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index 8ec2d9a1..301ae265 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -20,6 +20,7 @@ WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); } WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); } WRAPPER void CSpecialFX::Init(void) { EAXJMP(0x5189E0); } +WRAPPER void CSpecialFX::Shutdown(void) { EAXJMP(0x518BE0); } WRAPPER void CMotionBlurStreaks::RegisterStreak(int32 id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2) { EAXJMP(0x519460); } diff --git a/src/render/SpecialFX.h b/src/render/SpecialFX.h index 701b89a0..fc155a53 100644 --- a/src/render/SpecialFX.h +++ b/src/render/SpecialFX.h @@ -6,6 +6,7 @@ public: static void Render(void); static void Update(void); static void Init(void); + static void Shutdown(void); }; class CMotionBlurStreaks diff --git a/src/render/WeaponEffects.cpp b/src/render/WeaponEffects.cpp index 932c661e..2ed9e662 100644 --- a/src/render/WeaponEffects.cpp +++ b/src/render/WeaponEffects.cpp @@ -1,45 +1,106 @@ #include "common.h" #include "patcher.h" #include "WeaponEffects.h" - #include "TxdStore.h" +#include "Sprite.h" -WRAPPER void CWeaponEffects::Render(void) { EAXJMP(0x564D70); } +RwTexture *gpCrossHairTex; +RwRaster *gpCrossHairRaster; -CWeaponEffects &gCrossHair = *(CWeaponEffects*)0x6503BC; +CWeaponEffects gCrossHair; + +CWeaponEffects::CWeaponEffects() +{ + +} + +CWeaponEffects::~CWeaponEffects() +{ + +} void -CWeaponEffects::ClearCrossHair() +CWeaponEffects::Init(void) { - gCrossHair.m_bCrosshair = false; + 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_bCrosshair = true; - gCrossHair.m_vecPos = pos; - gCrossHair.m_red = red; - gCrossHair.m_green = green; - gCrossHair.m_blue = blue; - gCrossHair.m_alpha = alpha; - gCrossHair.m_size = 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::Init() +CWeaponEffects::Render(void) { - gCrossHair.m_bCrosshair = false; - gCrossHair.m_vecPos = CVector(0.0f, 0.0f, 0.0f); - gCrossHair.m_red = 0; - gCrossHair.m_green = 0; - gCrossHair.m_blue = 0; - gCrossHair.m_alpha = 255; - gCrossHair.m_size = 1.0f; - gCrossHair.field_24 = 0; - CTxdStore::PushCurrentTxd(); - CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("particle")); - gCrossHair.m_pTexture = RwTextureRead("crosshair", nil); - gCrossHair.m_pRaster = gCrossHair.m_pTexture->raster; - CTxdStore::PopCurrentTxd(); + 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 index e4d0461a..31c5a309 100644 --- a/src/render/WeaponEffects.h +++ b/src/render/WeaponEffects.h @@ -3,21 +3,25 @@ class CWeaponEffects { public: - bool m_bCrosshair; - int8 gap_1[3]; + bool m_bActive; + char _pad[3]; CVector m_vecPos; - uint8 m_red; - uint8 m_green; - uint8 m_blue; - uint8 m_alpha; - float m_size; - int32 field_24; - RwTexture *m_pTexture; - RwRaster *m_pRaster; + uint8 m_nRed; + uint8 m_nGreen; + uint8 m_nBlue; + uint8 m_nAlpha; + float m_fSize; + float m_fRotation; public: - static void Render(void); - static void ClearCrossHair(); - static void MarkTarget(CVector, uint8, uint8, uint8, uint8, float); + 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 |