From daed13485ef47d9c8992e53e1a976fba237fca50 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 15 Apr 2020 08:03:53 +0300 Subject: CWeapon done, ps2 cheats fix --- src/render/Glass.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index 41d31985..46a12a6f 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -404,6 +404,7 @@ CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity) void CGlass::RenderEntityInGlass(CEntity *entity) { + ASSERT(entity!=NULL); CObject *object = (CObject *)entity; if ( object->bGlassBroken ) @@ -419,7 +420,7 @@ CGlass::RenderEntityInGlass(CEntity *entity) uint8 alpha = CalcAlphaWithNormal(&fwdNorm); CColModel *col = object->GetColModel(); - + ASSERT(col!=NULL); if ( col->numTriangles >= 2 ) { CVector a = object->GetMatrix() * col->vertices[0]; @@ -523,6 +524,8 @@ CGlass::RenderEntityInGlass(CEntity *entity) int32 CGlass::CalcAlphaWithNormal(CVector *normal) { + ASSERT(normal!=NULL); + float fwdDir = 2.0f * DotProduct(*normal, TheCamera.GetForward()); float fwdDot = DotProduct(TheCamera.GetForward()-fwdDir*(*normal), CVector(0.57f, 0.57f, -0.57f)); return int32(lerp(fwdDot*fwdDot*fwdDot*fwdDot*fwdDot*fwdDot, 20.0f, 255.0f)); @@ -597,6 +600,8 @@ CGlass::RenderReflectionPolys(void) void CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, CVector point, bool explosion) { + ASSERT(entity!=NULL); + CObject *object = (CObject *)entity; if ( object->bGlassBroken ) @@ -605,7 +610,8 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, object->bGlassCracked = true; CColModel *col = object->GetColModel(); - + ASSERT(col!=NULL); + CVector a = object->GetMatrix() * col->vertices[0]; CVector b = object->GetMatrix() * col->vertices[1]; CVector c = object->GetMatrix() * col->vertices[2]; @@ -647,6 +653,8 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, void CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) { + ASSERT(entity!=NULL); + CObject *object = (CObject *)entity; if ( amount > 50.0f && !object->bGlassCracked ) @@ -659,6 +667,8 @@ CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) void CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) { + ASSERT(entity!=NULL); + CObject *object = (CObject *)entity; if ( IsGlass(object->GetModelIndex()) ) @@ -679,6 +689,8 @@ CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) void CGlass::WindowRespondsToExplosion(CEntity *entity, CVector point) { + ASSERT(entity!=NULL); + CObject *object = (CObject *)entity; CVector distToGlass = object->GetPosition() - point; -- cgit v1.2.3 From 90be379bede299aa53bca5027ecc19c356e50f86 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 15 Apr 2020 14:05:24 +0200 Subject: implemented most of librw wrapper --- src/render/Console.cpp | 1 + src/render/Shadows.h | 1 - src/render/Weather.cpp | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/Console.cpp b/src/render/Console.cpp index d4940955..545122b0 100644 --- a/src/render/Console.cpp +++ b/src/render/Console.cpp @@ -1,4 +1,5 @@ #include "common.h" +#include #include "patcher.h" #include "Console.h" #include "Font.h" diff --git a/src/render/Shadows.h b/src/render/Shadows.h index fb41ebbc..ced9f11b 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -6,7 +6,6 @@ #define MAX_PERMAMENTSHADOWS 48 -struct RwTexture; class CEntity; enum eShadowType diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index b440e77c..7aa2778f 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -126,7 +126,7 @@ void CWeather::Update(void) if (ForcedWeatherType >= 0) NewWeatherType = ForcedWeatherType; else { - WeatherTypeInList = (WeatherTypeInList + 1) % ARRAYSIZE(WeatherTypesList); + WeatherTypeInList = (WeatherTypeInList + 1) % ARRAY_SIZE(WeatherTypesList); NewWeatherType = WeatherTypesList[WeatherTypeInList]; #ifdef FIX_BUGS } -- cgit v1.2.3 From d7eee5c1307d80b64771e15458e0b1fd70898706 Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 15 Apr 2020 15:26:55 +0200 Subject: fixed clouds and sprites --- src/render/Clouds.cpp | 2 +- src/render/Sprite.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/render') diff --git a/src/render/Clouds.cpp b/src/render/Clouds.cpp index 39866294..7debe3d3 100644 --- a/src/render/Clouds.cpp +++ b/src/render/Clouds.cpp @@ -233,7 +233,7 @@ CClouds::Render(void) szx*55.0f, szy*55.0f, tr, tg, tb, br, bg, bb, 0.0f, -1.0f, 1.0f/screenpos.z, - IndividualRotation/65336.0f * 2*3.14f + ms_cameraRoll, + (uint16)IndividualRotation/65336.0f * 6.28f + ms_cameraRoll, fluffyalpha); bCloudOnScreen[i] = true; }else diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp index 8ac2315f..82754121 100644 --- a/src/render/Sprite.cpp +++ b/src/render/Sprite.cpp @@ -137,8 +137,8 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r void CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a) { - float c = Cos(DEGTORAD(rotation)); - float s = Sin(DEGTORAD(rotation)); + float c = Cos(rotation); + float s = Sin(rotation); float xs[4]; float ys[4]; @@ -315,8 +315,8 @@ void CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, float h, uint8 r, uint8 g, uint8 b, int16 intens, float recipz, float rotation, uint8 a) { m_bFlushSpriteBufferSwitchZTest = 0; - float c = Cos(DEGTORAD(rotation)); - float s = Sin(DEGTORAD(rotation)); + float c = Cos(rotation); + float s = Sin(rotation); float xs[4]; float ys[4]; @@ -367,8 +367,8 @@ void CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, float w, float h, uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2, float cx, float cy, float recipz, float rotation, uint8 a) { m_bFlushSpriteBufferSwitchZTest = 0; - float c = Cos(DEGTORAD(rotation)); - float s = Sin(DEGTORAD(rotation)); + float c = Cos(rotation); + float s = Sin(rotation); float xs[4]; float ys[4]; @@ -398,11 +398,11 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f // Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2 cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; cf[0] = clamp(cf[0], 0.0f, 1.0f); - cf[1] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; + cf[1] = (cx*(-c+s) + cy*( c+s))*0.5f + 0.5f; cf[1] = clamp(cf[1], 0.0f, 1.0f); - cf[2] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; + cf[2] = (cx*( c+s) + cy*( c-s))*0.5f + 0.5f; cf[2] = clamp(cf[2], 0.0f, 1.0f); - cf[3] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; + cf[3] = (cx*( c-s) + cy*(-c-s))*0.5f + 0.5f; cf[3] = clamp(cf[3], 0.0f, 1.0f); float screenz = m_f2DNearScreenZ + -- cgit v1.2.3 From 4da1879975ef28cb7f406166d62d154d03ef47d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 15 Apr 2020 19:19:45 +0300 Subject: Many fixes and cleanup --- src/render/Renderer.cpp | 17 +++++++++-------- src/render/Renderer.h | 16 ++++++++-------- 2 files changed, 17 insertions(+), 16 deletions(-) (limited to 'src/render') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index d7834065..7b2f90e8 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -39,16 +39,17 @@ struct EntityInfo float sort; }; -CLinkList &gSortedVehiclesAndPeds = *(CLinkList*)0x629AC0; +CLinkList gSortedVehiclesAndPeds; -int32 &CRenderer::ms_nNoOfVisibleEntities = *(int32*)0x940730; -CEntity *(&CRenderer::ms_aVisibleEntityPtrs)[NUMVISIBLEENTITIES] = *(CEntity * (*)[NUMVISIBLEENTITIES]) * (uintptr*)0x6E9920; -CEntity *(&CRenderer::ms_aInVisibleEntityPtrs)[NUMINVISIBLEENTITIES] = *(CEntity * (*)[NUMINVISIBLEENTITIES]) * (uintptr*)0x880B50; -int32 &CRenderer::ms_nNoOfInVisibleEntities = *(int32*)0x8F1B78; +int32 CRenderer::ms_nNoOfVisibleEntities; +CEntity *CRenderer::ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES]; +CEntity *CRenderer::ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES]; +int32 CRenderer::ms_nNoOfInVisibleEntities; -CVector &CRenderer::ms_vecCameraPosition = *(CVector*)0x8E2C3C; -CVehicle *&CRenderer::m_pFirstPersonVehicle = *(CVehicle**)0x885B80; -bool &CRenderer::m_loadingPriority = *(bool*)0x95CD86; +CVector CRenderer::ms_vecCameraPosition; +CVehicle *CRenderer::m_pFirstPersonVehicle; +bool CRenderer::m_loadingPriority; +float CRenderer::ms_lodDistScale = 1.2f; void CRenderer::Init(void) diff --git a/src/render/Renderer.h b/src/render/Renderer.h index 42c154ec..362741e3 100644 --- a/src/render/Renderer.h +++ b/src/render/Renderer.h @@ -20,17 +20,17 @@ class CPtrList; class CRenderer { - static int32 &ms_nNoOfVisibleEntities; - static CEntity *(&ms_aVisibleEntityPtrs)[NUMVISIBLEENTITIES]; - static int32 &ms_nNoOfInVisibleEntities; - static CEntity *(&ms_aInVisibleEntityPtrs)[NUMINVISIBLEENTITIES]; + static int32 ms_nNoOfVisibleEntities; + static CEntity *ms_aVisibleEntityPtrs[NUMVISIBLEENTITIES]; + static int32 ms_nNoOfInVisibleEntities; + static CEntity *ms_aInVisibleEntityPtrs[NUMINVISIBLEENTITIES]; - static CVector &ms_vecCameraPosition; - static CVehicle *&m_pFirstPersonVehicle; + static CVector ms_vecCameraPosition; + static CVehicle *m_pFirstPersonVehicle; public: - static float ms_lodDistScale; // defined in Frontend.cpp - static bool &m_loadingPriority; + static float ms_lodDistScale; + static bool m_loadingPriority; static void Init(void); static void Shutdown(void); -- cgit v1.2.3 From cb4e1d68e77a7fd7f17563d0522eeb2f0c39e94d Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 15 Apr 2020 20:09:51 +0300 Subject: glass NULL->nil --- src/render/Glass.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/render') diff --git a/src/render/Glass.cpp b/src/render/Glass.cpp index 46a12a6f..ac6c1728 100644 --- a/src/render/Glass.cpp +++ b/src/render/Glass.cpp @@ -404,7 +404,7 @@ CGlass::AskForObjectToBeRenderedInGlass(CEntity *entity) void CGlass::RenderEntityInGlass(CEntity *entity) { - ASSERT(entity!=NULL); + ASSERT(entity!=nil); CObject *object = (CObject *)entity; if ( object->bGlassBroken ) @@ -420,7 +420,7 @@ CGlass::RenderEntityInGlass(CEntity *entity) uint8 alpha = CalcAlphaWithNormal(&fwdNorm); CColModel *col = object->GetColModel(); - ASSERT(col!=NULL); + ASSERT(col!=nil); if ( col->numTriangles >= 2 ) { CVector a = object->GetMatrix() * col->vertices[0]; @@ -524,7 +524,7 @@ CGlass::RenderEntityInGlass(CEntity *entity) int32 CGlass::CalcAlphaWithNormal(CVector *normal) { - ASSERT(normal!=NULL); + ASSERT(normal!=nil); float fwdDir = 2.0f * DotProduct(*normal, TheCamera.GetForward()); float fwdDot = DotProduct(TheCamera.GetForward()-fwdDir*(*normal), CVector(0.57f, 0.57f, -0.57f)); @@ -600,7 +600,7 @@ CGlass::RenderReflectionPolys(void) void CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, CVector point, bool explosion) { - ASSERT(entity!=NULL); + ASSERT(entity!=nil); CObject *object = (CObject *)entity; @@ -610,7 +610,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, object->bGlassCracked = true; CColModel *col = object->GetColModel(); - ASSERT(col!=NULL); + ASSERT(col!=nil); CVector a = object->GetMatrix() * col->vertices[0]; CVector b = object->GetMatrix() * col->vertices[1]; @@ -653,7 +653,7 @@ CGlass::WindowRespondsToCollision(CEntity *entity, float amount, CVector speed, void CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) { - ASSERT(entity!=NULL); + ASSERT(entity!=nil); CObject *object = (CObject *)entity; @@ -667,7 +667,7 @@ CGlass::WindowRespondsToSoftCollision(CEntity *entity, float amount) void CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) { - ASSERT(entity!=NULL); + ASSERT(entity!=nil); CObject *object = (CObject *)entity; @@ -689,7 +689,7 @@ CGlass::WasGlassHitByBullet(CEntity *entity, CVector point) void CGlass::WindowRespondsToExplosion(CEntity *entity, CVector point) { - ASSERT(entity!=NULL); + ASSERT(entity!=nil); CObject *object = (CObject *)entity; -- cgit v1.2.3 From b9a8ad94816ac27ce6a669807e0eb60c7e35f037 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 16 Apr 2020 01:44:02 +0300 Subject: Fix misplaced targeting --- src/render/Hud.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/render') 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); -- cgit v1.2.3 From f435455bdee2bbe6a55f12fb8854659260b7a559 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 16 Apr 2020 01:56:15 +0300 Subject: Removed refs from weapons/, WeaponEffects moved --- src/render/WeaponEffects.cpp | 106 ------------------------------------------- src/render/WeaponEffects.h | 27 ----------- 2 files changed, 133 deletions(-) delete mode 100644 src/render/WeaponEffects.cpp delete mode 100644 src/render/WeaponEffects.h (limited to 'src/render') 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 -- cgit v1.2.3 From 83cbe4e39ede4853e0d352e55aeddbd481b39948 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 16 Apr 2020 15:30:47 +0300 Subject: More refs removed --- src/render/Instance.cpp | 20 ++++++++++++++++++++ src/render/Instance.h | 14 ++++++++++++++ src/render/Sprite2d.cpp | 14 +++++++------- src/render/Sprite2d.h | 14 +++++++------- 4 files changed, 48 insertions(+), 14 deletions(-) create mode 100644 src/render/Instance.cpp create mode 100644 src/render/Instance.h (limited to 'src/render') diff --git a/src/render/Instance.cpp b/src/render/Instance.cpp new file mode 100644 index 00000000..775341be --- /dev/null +++ b/src/render/Instance.cpp @@ -0,0 +1,20 @@ +#include "common.h" +#include "patcher.h" +#include "Instance.h" + +void +CInstance::Shutdown() +{ + GetMatrix().Detach(); +} + +class CInstance_ : public CInstance +{ +public: + void dtor() { CInstance::~CInstance(); } +}; + +STARTPATCHES + InjectHook(0x50BE90, &CInstance_::dtor, PATCH_JUMP); + InjectHook(0x50B850, &CInstance::Shutdown, PATCH_JUMP); +ENDPATCHES diff --git a/src/render/Instance.h b/src/render/Instance.h new file mode 100644 index 00000000..01dfb6a2 --- /dev/null +++ b/src/render/Instance.h @@ -0,0 +1,14 @@ +#pragma once + +#include "Placeable.h" + +// unused + +class CInstance : public CPlaceable +{ +public: + int m_modelIndex; +public: + ~CInstance() = default; + void Shutdown(); +}; diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index 3f21516a..1fe70121 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -5,13 +5,13 @@ #include "Camera.h" #include "Sprite2d.h" -RwIm2DVertex *CSprite2d::maVertices = (RwIm2DVertex*)0x6E9168; -float &CSprite2d::RecipNearClip = *(float*)0x880DB4; -int32 &CSprite2d::mCurrentBank = *(int32*)0x8F1AF4; -RwTexture **CSprite2d::mpBankTextures = (RwTexture**)0x774DC0; -int32 *CSprite2d::mCurrentSprite = (int32*)0x6F4500; -int32 *CSprite2d::mBankStart = (int32*)0x774BE8; -RwIm2DVertex *CSprite2d::maBankVertices = (RwIm2DVertex*)0x8429F8; +RwIm2DVertex CSprite2d::maVertices[4]; +float CSprite2d::RecipNearClip; +int32 CSprite2d::mCurrentBank; +RwTexture *CSprite2d::mpBankTextures[10]; +int32 CSprite2d::mCurrentSprite[10]; +int32 CSprite2d::mBankStart[10]; +RwIm2DVertex CSprite2d::maBankVertices[500]; void CSprite2d::SetRecipNearClip(void) diff --git a/src/render/Sprite2d.h b/src/render/Sprite2d.h index 268c7d2b..0b073557 100644 --- a/src/render/Sprite2d.h +++ b/src/render/Sprite2d.h @@ -2,13 +2,13 @@ class CSprite2d { - static float &RecipNearClip; - static int32 &mCurrentBank; - static RwTexture **mpBankTextures; //[10]; - static int32 *mCurrentSprite; //[10]; - static int32 *mBankStart; //[10]; - static RwIm2DVertex *maBankVertices; //[500]; - static RwIm2DVertex *maVertices; //[4]; + static float RecipNearClip; + static int32 mCurrentBank; + static RwTexture *mpBankTextures[10]; + static int32 mCurrentSprite[10]; + static int32 mBankStart[10]; + static RwIm2DVertex maBankVertices[500]; + static RwIm2DVertex maVertices[4]; public: RwTexture *m_pTexture; -- cgit v1.2.3