summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-06-01 20:32:24 +0200
committerGitHub <noreply@github.com>2020-06-01 20:32:24 +0200
commit21afcd8767791278bef5df9fa071af0427588a59 (patch)
treec080d424e33307c3237431da6e9c303645d23008 /src/render
parentMerge pull request #608 from Nick007J/miami (diff)
parentCAutomobile done (diff)
downloadre3-21afcd8767791278bef5df9fa071af0427588a59.tar
re3-21afcd8767791278bef5df9fa071af0427588a59.tar.gz
re3-21afcd8767791278bef5df9fa071af0427588a59.tar.bz2
re3-21afcd8767791278bef5df9fa071af0427588a59.tar.lz
re3-21afcd8767791278bef5df9fa071af0427588a59.tar.xz
re3-21afcd8767791278bef5df9fa071af0427588a59.tar.zst
re3-21afcd8767791278bef5df9fa071af0427588a59.zip
Diffstat (limited to '')
-rw-r--r--src/render/Glass.h4
-rw-r--r--src/render/Renderer.cpp6
-rw-r--r--src/render/Skidmarks.cpp54
-rw-r--r--src/render/Skidmarks.h27
-rw-r--r--src/render/WindModifiers.cpp5
-rw-r--r--src/render/WindModifiers.h1
6 files changed, 69 insertions, 28 deletions
diff --git a/src/render/Glass.h b/src/render/Glass.h
index 51c5aae9..736e5205 100644
--- a/src/render/Glass.h
+++ b/src/render/Glass.h
@@ -1,6 +1,7 @@
#pragma once
class CEntity;
+class CVehicle;
class CFallingGlassPane : public CMatrix
{
@@ -49,4 +50,7 @@ public:
static void WindowRespondsToSoftCollision(CEntity *entity, float amount);
static void WasGlassHitByBullet(CEntity *entity, CVector point);
static void WindowRespondsToExplosion(CEntity *entity, CVector point);
+
+//TODO(MIAMI)
+ static void CarWindscreenShatters(CVehicle *vehicle, bool unk) {}
}; \ No newline at end of file
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index f149c6fb..f2f55b92 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -269,10 +269,8 @@ CRenderer::RenderBoats(void)
for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head;
node = node->prev){
- // only boats in this list
CVehicle *v = (CVehicle*)node->item.ent;
- if(v->IsBoat())
- RenderOneNonRoad(v);
+ RenderOneNonRoad(v);
}
}
@@ -394,7 +392,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
}
return VIS_VISIBLE;
}
- if(ent->m_flagE10){
+ if(ent->bDontStream){
if(ent->m_rwObject == nil || !ent->bIsVisible)
return VIS_INVISIBLE;
if(!ent->GetIsOnScreen() || ent->IsEntityOccluded())
diff --git a/src/render/Skidmarks.cpp b/src/render/Skidmarks.cpp
index 961c38a6..efd88387 100644
--- a/src/render/Skidmarks.cpp
+++ b/src/render/Skidmarks.cpp
@@ -114,11 +114,12 @@ CSkidmarks::Render(void)
continue;
CRGBA color(0, 0, 0, 255);
- // TODO(MIAMI): we have a type field here actually (0-3)
- if(aSkidmarks[i].m_isBloody) // TODO: type 3
- color = CRGBA(132, 34, 11, 255);
- else if(aSkidmarks[i].m_isMuddy) // TODO: type 1
- color = CRGBA(90, 62, 9, 255);
+ switch(aSkidmarks[i].m_type){
+ case SKIDMARK_NORMAL: color = CRGBA(0, 0, 0, 255); break;
+ case SKIDMARK_MUDDY: color = CRGBA(90, 62, 9, 255); break;
+ case SKIDMARK_SANDY: color = CRGBA(108, 108, 96, 255); break;
+ case SKIDMARK_BLOODY: color = CRGBA(132, 34, 11, 255); break;
+ }
uint32 fade, alpha;
if(aSkidmarks[i].m_state == 1 || CTimer::GetTimeInMilliseconds() < aSkidmarks[i].m_fadeStart)
@@ -132,8 +133,12 @@ CSkidmarks::Render(void)
alpha = 0;
alpha = alpha*fade/256;
- CVector p1 = aSkidmarks[i].m_pos[j] + aSkidmarks[i].m_side[j];
- CVector p2 = aSkidmarks[i].m_pos[j] - aSkidmarks[i].m_side[j];
+ CVector p1 = aSkidmarks[i].m_pos[j];
+ p1.x += aSkidmarks[i].m_sideX[j];
+ p1.y += aSkidmarks[i].m_sideY[j];
+ CVector p2 = aSkidmarks[i].m_pos[j];
+ p2.x -= aSkidmarks[i].m_sideX[j];
+ p2.y -= aSkidmarks[i].m_sideY[j];
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+0], color.red, color.green, color.blue, alpha);
RwIm3DVertexSetPos(&SkidmarkVertices[j*2+0], p1.x, p1.y, p1.z+0.1f);
RwIm3DVertexSetRGBA(&SkidmarkVertices[j*2+1], color.red, color.green, color.blue, alpha);
@@ -153,7 +158,20 @@ CSkidmarks::Render(void)
}
void
-CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody)
+CSkidmarks::RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody)
+{
+ eSkidmarkType type;
+ if(*isBloody)
+ type = SKIDMARK_BLOODY;
+ else if(*isMuddy)
+ type = SKIDMARK_MUDDY;
+ else
+ type = SKIDMARK_NORMAL;
+ RegisterOne(id, pos, fwdX, fwdY, type, isBloody);
+}
+
+void
+CSkidmarks::RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, eSkidmarkType type, bool *isBloody)
{
int i;
CVector2D fwd(fwdX, fwdY);
@@ -169,7 +187,7 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
if(i < NUMSKIDMARKS){
// Continue this one
- if(aSkidmarks[i].m_isBloody != *isBloody){
+ if((aSkidmarks[i].m_type==SKIDMARK_BLOODY) != *isBloody){
// Blood-status changed, end this one
aSkidmarks[i].m_state = 2;
aSkidmarks[i].m_fadeStart = CTimer::GetTimeInMilliseconds() + 10000;
@@ -204,9 +222,12 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
CVector2D right(dist.y, -dist.x);
float turn = DotProduct2D(fwd, right);
turn = Abs(turn) + 1.0f;
- aSkidmarks[i].m_side[aSkidmarks[i].m_last] = CVector(right.x, right.y, 0.0f) * turn * 0.125f;
- if(aSkidmarks[i].m_last == 1)
- aSkidmarks[i].m_side[0] = aSkidmarks[i].m_side[1];
+ aSkidmarks[i].m_sideX[aSkidmarks[i].m_last] = right.x * turn * 0.125f;
+ aSkidmarks[i].m_sideY[aSkidmarks[i].m_last] = right.y * turn * 0.125f;
+ if(aSkidmarks[i].m_last == 1){
+ aSkidmarks[i].m_sideX[0] = aSkidmarks[i].m_sideX[1];
+ aSkidmarks[i].m_sideY[0] = aSkidmarks[i].m_sideY[1];
+ }
if(aSkidmarks[i].m_last > 8)
*isBloody = false; // stop blood marks after 8
@@ -222,12 +243,15 @@ CSkidmarks::RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *i
aSkidmarks[i].m_state = 1;
aSkidmarks[i].m_id = id;
aSkidmarks[i].m_pos[0] = pos;
- aSkidmarks[i].m_side[0] = CVector(0.0f, 0.0f, 0.0f);
+ aSkidmarks[i].m_sideX[0] = 0.0f;
+ aSkidmarks[i].m_sideY[0] = 0.0f;
aSkidmarks[i].m_wasUpdated = true;
aSkidmarks[i].m_last = 0;
aSkidmarks[i].m_lastUpdate = CTimer::GetTimeInMilliseconds() - 1000;
- aSkidmarks[i].m_isBloody = *isBloody;
- aSkidmarks[i].m_isMuddy = *isMuddy;
+ if(*isBloody)
+ aSkidmarks[i].m_type = SKIDMARK_BLOODY;
+ else
+ aSkidmarks[i].m_type = type;
}else
*isBloody = false; // stop blood marks if no space
}
diff --git a/src/render/Skidmarks.h b/src/render/Skidmarks.h
index 085b4c6d..28082f08 100644
--- a/src/render/Skidmarks.h
+++ b/src/render/Skidmarks.h
@@ -2,20 +2,28 @@
enum { SKIDMARK_LENGTH = 16 };
+enum eSkidmarkType
+{
+ SKIDMARK_NORMAL,
+ SKIDMARK_MUDDY,
+ SKIDMARK_SANDY,
+ SKIDMARK_BLOODY
+};
+
class CSkidmark
{
public:
- uint8 m_state;
- bool m_wasUpdated;
- bool m_isBloody;
- bool m_isMuddy;
+ CVector m_pos[SKIDMARK_LENGTH];
+ float m_sideX[SKIDMARK_LENGTH];
+ float m_sideY[SKIDMARK_LENGTH];
uintptr m_id;
- int16 m_last;
- uint32 m_lastUpdate;;
+ uint32 m_lastUpdate;
uint32 m_fadeStart;
uint32 m_fadeEnd;
- CVector m_pos[SKIDMARK_LENGTH];
- CVector m_side[SKIDMARK_LENGTH];
+ uint32 m_type;
+ int16 m_last;
+ uint8 m_state;
+ bool m_wasUpdated;
};
class CSkidmarks
@@ -28,5 +36,6 @@ public:
static void Clear(void);
static void Update(void);
static void Render(void);
- static void RegisterOne(uintptr id, CVector pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody);
+ static void RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, eSkidmarkType type, bool *isBloody);
+ static void RegisterOne(uintptr id, const CVector &pos, float fwdX, float fwdY, bool *isMuddy, bool *isBloody);
};
diff --git a/src/render/WindModifiers.cpp b/src/render/WindModifiers.cpp
index d7405c7a..49e7c96a 100644
--- a/src/render/WindModifiers.cpp
+++ b/src/render/WindModifiers.cpp
@@ -1,6 +1,11 @@
#include "common.h"
#include "WindModifiers.h"
+void
+CWindModifiers::RegisterOne(CVector pos, int32 unk)
+{
+}
+
int32
CWindModifiers::FindWindModifier(CVector pos, float *x, float *y)
{
diff --git a/src/render/WindModifiers.h b/src/render/WindModifiers.h
index b4024343..c42e185d 100644
--- a/src/render/WindModifiers.h
+++ b/src/render/WindModifiers.h
@@ -3,5 +3,6 @@
class CWindModifiers
{
public:
+ static void RegisterOne(CVector pos, int32 unk);
static int32 FindWindModifier(CVector pos, float *x, float *y);
};