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 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