summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Fluff.cpp3
-rw-r--r--src/render/Lines.cpp74
-rw-r--r--src/render/Lines.h7
-rw-r--r--src/render/Renderer.cpp21
-rw-r--r--src/render/Renderer.h4
-rw-r--r--src/render/WaterLevel.cpp1
6 files changed, 108 insertions, 2 deletions
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"