diff options
author | aap <aap@papnet.eu> | 2020-05-31 17:05:49 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2020-05-31 17:05:59 +0200 |
commit | 21ce0a4b28a1842dad91433362d250089ec491b8 (patch) | |
tree | 8c661c49f994d95de6997e0bf4f71cb0ab41dd05 /src/render | |
parent | some more CAutomobile (diff) | |
download | re3-21ce0a4b28a1842dad91433362d250089ec491b8.tar re3-21ce0a4b28a1842dad91433362d250089ec491b8.tar.gz re3-21ce0a4b28a1842dad91433362d250089ec491b8.tar.bz2 re3-21ce0a4b28a1842dad91433362d250089ec491b8.tar.lz re3-21ce0a4b28a1842dad91433362d250089ec491b8.tar.xz re3-21ce0a4b28a1842dad91433362d250089ec491b8.tar.zst re3-21ce0a4b28a1842dad91433362d250089ec491b8.zip |
Diffstat (limited to '')
-rw-r--r-- | src/render/Skidmarks.cpp | 54 | ||||
-rw-r--r-- | src/render/Skidmarks.h | 27 | ||||
-rw-r--r-- | src/render/WindModifiers.cpp | 5 | ||||
-rw-r--r-- | src/render/WindModifiers.h | 1 |
4 files changed, 63 insertions, 24 deletions
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); }; |