diff options
author | aap <aap@papnet.eu> | 2019-07-19 13:58:19 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-19 13:58:19 +0200 |
commit | 0ad39c020cfd4882b45bd1d26e521748e37b94a4 (patch) | |
tree | 736fde80727300b695e649c18e67be340b384985 /src | |
parent | 59145cea83da6d0ade8221dbe8c1469be8084ea0 (diff) |
implemented col line rendering
Diffstat (limited to 'src')
-rw-r--r-- | src/core/Collision.cpp | 241 | ||||
-rw-r--r-- | src/core/Pad.h | 2 | ||||
-rw-r--r-- | src/core/SurfaceTable.h | 2 | ||||
-rw-r--r-- | src/core/main.cpp | 2 | ||||
-rw-r--r-- | src/core/main.h | 2 | ||||
-rw-r--r-- | src/core/re3.cpp | 5 | ||||
-rw-r--r-- | src/render/Fluff.cpp | 3 | ||||
-rw-r--r-- | src/render/Lines.cpp | 74 | ||||
-rw-r--r-- | src/render/Lines.h | 7 | ||||
-rw-r--r-- | src/render/Renderer.cpp | 21 | ||||
-rw-r--r-- | src/render/Renderer.h | 4 | ||||
-rw-r--r-- | src/render/WaterLevel.cpp | 1 | ||||
-rw-r--r-- | src/vehicles/Automobile.cpp | 8 | ||||
-rw-r--r-- | src/vehicles/Automobile.h | 4 |
14 files changed, 354 insertions, 22 deletions
diff --git a/src/core/Collision.cpp b/src/core/Collision.cpp index 1ed08867..9a8adf46 100644 --- a/src/core/Collision.cpp +++ b/src/core/Collision.cpp @@ -18,6 +18,7 @@ #include "CutsceneMgr.h" #include "RenderBuffer.h" #include "SurfaceTable.h" +#include "Lines.h" #include "Collision.h" enum Direction @@ -1387,6 +1388,223 @@ CCollision::CalculateTrianglePlanes(CColModel *model) void CCollision::DrawColModel(const CMatrix &mat, const CColModel &colModel) { + int i; + CVector min, max; + CVector verts[8]; + CVector c; + float r; + + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); + + min = colModel.boundingBox.min; + max = colModel.boundingBox.max; + + verts[0] = mat * CVector(min.x, min.y, min.z); + verts[1] = mat * CVector(min.x, min.y, max.z); + verts[2] = mat * CVector(min.x, max.y, min.z); + verts[3] = mat * CVector(min.x, max.y, max.z); + verts[4] = mat * CVector(max.x, min.y, min.z); + verts[5] = mat * CVector(max.x, min.y, max.z); + verts[6] = mat * CVector(max.x, max.y, min.z); + verts[7] = mat * CVector(max.x, max.y, max.z); + + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[1].x, verts[1].y, verts[1].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[1].x, verts[1].y, verts[1].z, + verts[3].x, verts[3].y, verts[3].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[3].x, verts[3].y, verts[3].z, + verts[2].x, verts[2].y, verts[2].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[2].x, verts[2].y, verts[2].z, + verts[0].x, verts[0].y, verts[0].z, + 0xFF0000FF, 0xFF0000FF); + + CLines::RenderLineWithClipping( + verts[4].x, verts[4].y, verts[4].z, + verts[5].x, verts[5].y, verts[5].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[5].x, verts[5].y, verts[5].z, + verts[7].x, verts[7].y, verts[7].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[7].x, verts[7].y, verts[7].z, + verts[6].x, verts[6].y, verts[6].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[6].x, verts[6].y, verts[6].z, + verts[4].x, verts[4].y, verts[4].z, + 0xFF0000FF, 0xFF0000FF); + + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[4].x, verts[4].y, verts[4].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[1].x, verts[1].y, verts[1].z, + verts[5].x, verts[5].y, verts[5].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[2].x, verts[2].y, verts[2].z, + verts[6].x, verts[6].y, verts[6].z, + 0xFF0000FF, 0xFF0000FF); + CLines::RenderLineWithClipping( + verts[3].x, verts[3].y, verts[3].z, + verts[7].x, verts[7].y, verts[7].z, + 0xFF0000FF, 0xFF0000FF); + + for(i = 0; i < colModel.numSpheres; i++){ + c = mat * colModel.spheres[i].center; + r = colModel.spheres[i].radius; + + CLines::RenderLineWithClipping( + c.x, c.y, c.z-r, + c.x-r, c.y-r, c.z, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x, c.y, c.z-r, + c.x-r, c.y+r, c.z, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x, c.y, c.z-r, + c.x+r, c.y-r, c.z, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x, c.y, c.z-r, + c.x+r, c.y+r, c.z, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x-r, c.y-r, c.z, + c.x, c.y, c.z+r, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x-r, c.y+r, c.z, + c.x, c.y, c.z+r, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x+r, c.y-r, c.z, + c.x, c.y, c.z+r, + 0xFF00FFFF, 0xFF00FFFF); + CLines::RenderLineWithClipping( + c.x+r, c.y+r, c.z, + c.x, c.y, c.z+r, + 0xFF00FFFF, 0xFF00FFFF); + } + + for(i = 0; i < colModel.numLines; i++){ + verts[0] = colModel.lines[i].p0; + verts[1] = colModel.lines[i].p1; + + verts[0] = mat * verts[0]; + verts[1] = mat * verts[1]; + + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[1].x, verts[1].y, verts[1].z, + 0x00FFFFFF, 0x00FFFFFF); + } + + for(i = 0; i < colModel.numBoxes; i++){ + min = colModel.boxes[i].min; + max = colModel.boxes[i].max; + + verts[0] = mat * CVector(min.x, min.y, min.z); + verts[1] = mat * CVector(min.x, min.y, max.z); + verts[2] = mat * CVector(min.x, max.y, min.z); + verts[3] = mat * CVector(min.x, max.y, max.z); + verts[4] = mat * CVector(max.x, min.y, min.z); + verts[5] = mat * CVector(max.x, min.y, max.z); + verts[6] = mat * CVector(max.x, max.y, min.z); + verts[7] = mat * CVector(max.x, max.y, max.z); + + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[1].x, verts[1].y, verts[1].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[1].x, verts[1].y, verts[1].z, + verts[3].x, verts[3].y, verts[3].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[3].x, verts[3].y, verts[3].z, + verts[2].x, verts[2].y, verts[2].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[2].x, verts[2].y, verts[2].z, + verts[0].x, verts[0].y, verts[0].z, + 0xFFFFFFFF, 0xFFFFFFFF); + + CLines::RenderLineWithClipping( + verts[4].x, verts[4].y, verts[4].z, + verts[5].x, verts[5].y, verts[5].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[5].x, verts[5].y, verts[5].z, + verts[7].x, verts[7].y, verts[7].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[7].x, verts[7].y, verts[7].z, + verts[6].x, verts[6].y, verts[6].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[6].x, verts[6].y, verts[6].z, + verts[4].x, verts[4].y, verts[4].z, + 0xFFFFFFFF, 0xFFFFFFFF); + + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[4].x, verts[4].y, verts[4].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[1].x, verts[1].y, verts[1].z, + verts[5].x, verts[5].y, verts[5].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[2].x, verts[2].y, verts[2].z, + verts[6].x, verts[6].y, verts[6].z, + 0xFFFFFFFF, 0xFFFFFFFF); + CLines::RenderLineWithClipping( + verts[3].x, verts[3].y, verts[3].z, + verts[7].x, verts[7].y, verts[7].z, + 0xFFFFFFFF, 0xFFFFFFFF); + } + + for(i = 0; i < colModel.numTriangles; i++){ + colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a); + colModel.GetTrianglePoint(verts[1], colModel.triangles[i].b); + colModel.GetTrianglePoint(verts[2], colModel.triangles[i].c); + verts[0] = mat * verts[0]; + verts[1] = mat * verts[1]; + verts[2] = mat * verts[2]; + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[1].x, verts[1].y, verts[1].z, + 0x00FF00FF, 0x00FF00FF); + CLines::RenderLineWithClipping( + verts[0].x, verts[0].y, verts[0].z, + verts[2].x, verts[2].y, verts[2].z, + 0x00FF00FF, 0x00FF00FF); + CLines::RenderLineWithClipping( + verts[1].x, verts[1].y, verts[1].z, + verts[2].x, verts[2].y, verts[2].z, + 0x00FF00FF, 0x00FF00FF); + } + + RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); + RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); } void @@ -1407,7 +1625,6 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel, RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil); -extern int gDbgSurf; for(i = 0; i < colModel.numTriangles; i++){ colModel.GetTrianglePoint(verts[0], colModel.triangles[i].a); @@ -1417,7 +1634,7 @@ extern int gDbgSurf; verts[1] = mat * verts[1]; verts[2] = mat * verts[2]; - // TODO: surface + // game doesn't do this r = 255; g = 128; b = 0; @@ -1457,10 +1674,15 @@ extern int gDbgSurf; b *= f; } - // TODO: make some surface types flicker? -//if(s != gDbgSurf) continue; + if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE || + s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE) + if(CTimer::GetFrameCounter() & 1){ + r = 0; + g = 0; + b = 0; + } - if(s > SURFACE_32){ + if(s > SURFACE_GATE){ r = CGeneral::GetRandomNumber(); g = CGeneral::GetRandomNumber(); b = CGeneral::GetRandomNumber(); @@ -1533,8 +1755,13 @@ extern int gDbgSurf; b *= f; } - // TODO: make some surface types flicker? -//if(s != gDbgSurf) continue; + if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE || + s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE) + if(CTimer::GetFrameCounter() & 1){ + r = 0; + g = 0; + b = 0; + } RenderBuffer::StartStoring(36, 8, &iptr, &vptr); RwIm3DVertexSetRGBA(&vptr[0], r, g, b, 255); diff --git a/src/core/Pad.h b/src/core/Pad.h index f84ca742..e15399dd 100644 --- a/src/core/Pad.h +++ b/src/core/Pad.h @@ -381,5 +381,3 @@ extern CPad *Pads; //[2] #define IsButtonJustDown(pad, btn) \ (!(pad)->OldState.btn && (pad)->NewState.btn) - -void LittleTest(void); diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h index e1882e69..27f4ecca 100644 --- a/src/core/SurfaceTable.h +++ b/src/core/SurfaceTable.h @@ -77,6 +77,8 @@ enum eSurfaceType SURFACE_LOOSE30, SURFACE_BOLLARD, SURFACE_GATE, + + // These are illegal SURFACE_SAND33, SURFACE_ROAD34, }; diff --git a/src/core/main.cpp b/src/core/main.cpp index ffde80bb..1083adc3 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -295,6 +295,8 @@ void RenderDebugShit(void) { // CTheScripts::RenderTheScriptDebugLines() + if(gbShowCollisionLines) + CRenderer::RenderCollisionLines(); } void diff --git a/src/core/main.h b/src/core/main.h index dabc0f7b..c546d085 100644 --- a/src/core/main.h +++ b/src/core/main.h @@ -26,3 +26,5 @@ void LoadingIslandScreen(const char *levelName); CSprite2d *LoadSplash(const char *name); char *GetLevelSplashScreen(int level); char *GetRandomSplashScreen(void); + +void LittleTest(void); diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 2c44986f..67b9095e 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -58,8 +58,6 @@ mysrand(unsigned int seed) myrand_seed = seed; } -int gDbgSurf; - void (*DebugMenuProcess)(void); void (*DebugMenuRender)(void); static void stub(void) { } @@ -246,12 +244,13 @@ DebugMenuPopulate(void) DebugMenuAddVarBool8("Debug", "Show Ped Road Groups", (int8*)&gbShowPedRoadGroups, nil); DebugMenuAddVarBool8("Debug", "Show Car Road Groups", (int8*)&gbShowCarRoadGroups, nil); + DebugMenuAddVarBool8("Debug", "Show Collision Lines", (int8*)&gbShowCollisionLines, nil); DebugMenuAddVarBool8("Debug", "Show Collision Polys", (int8*)&gbShowCollisionPolys, nil); DebugMenuAddVarBool8("Debug", "Don't render Buildings", (int8*)&gbDontRenderBuildings, nil); DebugMenuAddVarBool8("Debug", "Don't render Big Buildings", (int8*)&gbDontRenderBigBuildings, nil); DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil); + DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil); DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil); - DebugMenuAddVar("Debug", "Dbg Surface", &gDbgSurf, nil, 1, 0, 34, nil); DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 678b9f43..7c35319f 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -1,4 +1,5 @@ #include "common.h" +#include "main.h" #include "patcher.h" #include "Fluff.h" #include "Camera.h" @@ -7,7 +8,6 @@ #include "General.h" #include "Timer.h" #include "Clock.h" -#include "Pad.h" #include "Weather.h" #include "Stats.h" #include "math/maths.h" @@ -705,7 +705,6 @@ void CTowerClock::Render() m_Position.z + Cos(angleHour) * 0.75f * m_fScale; ); - // Stupid thing that does absolutely nothing LittleTest(); // Draw lines diff --git a/src/render/Lines.cpp b/src/render/Lines.cpp new file mode 100644 index 00000000..ea433048 --- /dev/null +++ b/src/render/Lines.cpp @@ -0,0 +1,74 @@ +#include "common.h" +#include "patcher.h" +#include "main.h" +#include "Lines.h" + +// This is super inefficient, why split the line into segments at all? +void +CLines::RenderLineWithClipping(float x1, float y1, float z1, float x2, float y2, float z2, uint32 c1, uint32 c2) +{ + static RwIm3DVertex v[2]; +#ifdef THIS_IS_STUPID + int i; + float f1, f2; + float len = sqrt(sq(x1-x2) + sq(y1-y2) + sq(z1-z2)); + int numsegs = len/1.5f + 1.0f; + + RwRGBA col1; + col1.red = c1>>24; + col1.green = c1>>16; + col1.blue = c1>>8; + col1.alpha = c1; + RwRGBA col2; + col2.red = c2>>24; + col2.green = c2>>16; + col2.blue = c2>>8; + col2.alpha = c2; + + float dx = x2 - x1; + float dy = y2 - y1; + float dz = z2 - z1; + for(i = 0; i < numsegs; i++){ + f1 = (float)i/numsegs; + f2 = (float)(i+1)/numsegs; + + RwIm3DVertexSetRGBA(&v[0], (int)(col1.red + (col2.red-col1.red)*f1), + (int)(col1.green + (col2.green-col1.green)*f1), + (int)(col1.blue + (col2.blue-col1.blue)*f1), + (int)(col1.alpha + (col2.alpha-col1.alpha)*f1)); + RwIm3DVertexSetRGBA(&v[1], (int)(col1.red + (col2.red-col1.red)*f2), + (int)(col1.green + (col2.green-col1.green)*f2), + (int)(col1.blue + (col2.blue-col1.blue)*f2), + (int)(col1.alpha + (col2.alpha-col1.alpha)*f2)); + RwIm3DVertexSetPos(&v[0], x1 + dx*f1, y1 + dy*f1, z1 + dz*f1); + RwIm3DVertexSetPos(&v[1], x1 + dx*f2, y1 + dy*f2, z1 + dz*f2); + + LittleTest(); + if(RwIm3DTransform(v, 2, nil, 0)){ + RwIm3DRenderLine(0, 1); + RwIm3DEnd(); + } + } +#else + RwRGBA col1; + col1.red = c1>>24; + col1.green = c1>>16; + col1.blue = c1>>8; + col1.alpha = c1; + RwRGBA col2; + col2.red = c2>>24; + col2.green = c2>>16; + col2.blue = c2>>8; + col2.alpha = c2; + + RwIm3DVertexSetRGBA(&v[0], col1.red, col1.green, col1.blue, col1.alpha); + RwIm3DVertexSetRGBA(&v[1], col2.red, col2.green, col2.blue, col2.alpha); + RwIm3DVertexSetPos(&v[0], x1, y1, z1); + RwIm3DVertexSetPos(&v[1], x2, y2, z2); + LittleTest(); + if(RwIm3DTransform(v, 2, nil, 0)){ + RwIm3DRenderLine(0, 1); + RwIm3DEnd(); + } +#endif +} diff --git a/src/render/Lines.h b/src/render/Lines.h new file mode 100644 index 00000000..f2694fc0 --- /dev/null +++ b/src/render/Lines.h @@ -0,0 +1,7 @@ +#pragma once + +class CLines +{ +public: + static void RenderLineWithClipping(float x1, float y1, float z1, float x2, float y2, float z2, uint32 c1, uint32 c2); +}; diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 69df63ba..7bf4593f 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -23,11 +23,13 @@ bool gbShowPedRoadGroups; bool gbShowCarRoadGroups; bool gbShowCollisionPolys; +bool gbShowCollisionLines; bool gbDontRenderBuildings; bool gbDontRenderBigBuildings; bool gbDontRenderPeds; bool gbDontRenderObjects; +bool gbDontRenderVehicles; struct EntityInfo { @@ -132,6 +134,10 @@ CRenderer::RenderOneNonRoad(CEntity *e) else if(e->IsObject() || e->IsDummy()){ if(gbDontRenderObjects) return; + }else if(e->IsVehicle()){ + // re3 addition + if(gbDontRenderVehicles) + return; } #endif @@ -285,6 +291,21 @@ CRenderer::RenderFadingInEntities(void) CVisibilityPlugins::RenderFadingEntities(); } +void +CRenderer::RenderCollisionLines(void) +{ + int i; + + // game doesn't draw fading in entities + // this should probably be fixed + for(i = 0; i < ms_nNoOfVisibleEntities; i++){ + CEntity *e = ms_aVisibleEntityPtrs[i]; + if(Abs(e->GetPosition().x - ms_vecCameraPosition.x) < 100.0f && + Abs(e->GetPosition().y - ms_vecCameraPosition.y) < 100.0f) + CCollision::DrawColModel(e->GetMatrix(), *e->GetColModel()); + } +} + enum Visbility { VIS_INVISIBLE, diff --git a/src/render/Renderer.h b/src/render/Renderer.h index 5d3436c3..817cdaae 100644 --- a/src/render/Renderer.h +++ b/src/render/Renderer.h @@ -5,11 +5,13 @@ class CEntity; extern bool gbShowPedRoadGroups; extern bool gbShowCarRoadGroups; extern bool gbShowCollisionPolys; +extern bool gbShowCollisionLines; extern bool gbDontRenderBuildings; extern bool gbDontRenderBigBuildings; extern bool gbDontRenderPeds; extern bool gbDontRenderObjects; +extern bool gbDontRenderVehicles; class CVehicle; class CPtrList; @@ -41,6 +43,8 @@ public: static void RenderOneNonRoad(CEntity *); static void RenderFirstPersonVehicle(void); + static void RenderCollisionLines(void); + static int32 SetupEntityVisibility(CEntity *ent); static int32 SetupBigBuildingVisibility(CEntity *ent); diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index d5138b28..2f994132 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -1,4 +1,5 @@ #include "common.h" +#include "main.h" #include "FileMgr.h" #include "TxdStore.h" #include "Timer.h" diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 33f099b3..d6d05f5b 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -34,8 +34,6 @@ RwObject *GetCurrentAtomicObjectCB(RwObject *object, void *data); bool &CAutomobile::m_sAllTaxiLights = *(bool*)0x95CD21; -WRAPPER CAutomobile* CAutomobile::ctor(int, uint8) { EAXJMP(0x52C6B0); } - CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) : CVehicle(CreatedBy) { @@ -154,7 +152,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) m_bombType = CARBOMB_NONE; bHadDriver = false; - field_4DC = nil; + m_pBombRigger = nil; if(m_nDoorLock == CARLOCK_UNLOCKED && (id == MI_POLICE || id == MI_ENFORCER || id == MI_RHINO)) @@ -257,7 +255,7 @@ CAutomobile::ProcessControl(void) if(!bHadDriver && m_bombType == CARBOMB_ONIGNITIONACTIVE){ // If someone enters the car and there is a bomb, detonate m_nBombTimer = 1000; - m_pBlowUpEntity = field_4DC; + m_pBlowUpEntity = m_pBombRigger; if(m_pBlowUpEntity) m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity); DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f); @@ -1476,7 +1474,7 @@ CAutomobile::VehicleDamage(float impulse, uint16 damagedPiece) FindPlayerVehicle() && FindPlayerVehicle() == m_pDamageEntity && m_status != STATUS_ABANDONED && FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() >= m_vecMoveSpeed.Magnitude() && - FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.2f) + FindPlayerVehicle()->m_vecMoveSpeed.Magnitude() > 0.1f) FindPlayerPed()->SetWantedLevelNoDrop(1); if(m_status == STATUS_PLAYER && impulse > 50.0f){ diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 0182dd99..620c47a7 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -52,7 +52,7 @@ public: uint8 bNotDamagedUpsideDown : 1; uint8 bMoreResistantToDamage : 1; uint8 field_4DB; - CEntity *field_4DC; // blow up entity + CEntity *m_pBombRigger; int16 field_4E0; int16 field_4E2; uint32 m_nBusDoorTimerEnd; @@ -146,7 +146,5 @@ public: void ReduceHornCounter(void); static void SetAllTaxiLights(bool set); - - CAutomobile* ctor(int, uint8); }; static_assert(sizeof(CAutomobile) == 0x5A8, "CAutomobile: error"); |