diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-03-22 11:20:36 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-03-22 11:20:36 +0100 |
commit | 7d213a1f32c4e8cd45d22f73c637bff0edf731fb (patch) | |
tree | adf53b3a4d266bef6b0e0c2c280c758027fee09a /src/render | |
parent | Merge remote-tracking branch 'upstream/master' (diff) | |
download | re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.tar re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.tar.gz re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.tar.bz2 re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.tar.lz re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.tar.xz re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.tar.zst re3-7d213a1f32c4e8cd45d22f73c637bff0edf731fb.zip |
Diffstat (limited to 'src/render')
-rw-r--r-- | src/render/SpecialFX.cpp | 40 | ||||
-rw-r--r-- | src/render/SpecialFX.h | 5 |
2 files changed, 18 insertions, 27 deletions
diff --git a/src/render/SpecialFX.cpp b/src/render/SpecialFX.cpp index a14da60c..e0b3313f 100644 --- a/src/render/SpecialFX.cpp +++ b/src/render/SpecialFX.cpp @@ -23,24 +23,24 @@ WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); } WRAPPER void CMotionBlurStreaks::RegisterStreak(int32 id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2) { EAXJMP(0x519460); } -CBulletTrace (&CBulletTraces::aTraces)[NUM_BULLET_TRACES] = *(CBulletTrace(*)[NUM_BULLET_TRACES])*(uintptr*)0x72B1B8; +CBulletTrace (&CBulletTraces::aTraces)[NUMBULLETTRACES] = *(CBulletTrace(*)[NUMBULLETTRACES])*(uintptr*)0x72B1B8; RxObjSpace3DVertex (&TraceVertices)[6] = *(RxObjSpace3DVertex(*)[6])*(uintptr*)0x649884;
RwImVertexIndex (&TraceIndexList)[12] = *(RwImVertexIndex(*)[12])*(uintptr*)0x64986C; void CBulletTraces::Init(void) { - for (int i = 0; i < NUM_BULLET_TRACES; i++) + for (int i = 0; i < NUMBULLETTRACES; i++) aTraces[i].m_bInUse = false; } void CBulletTraces::AddTrace(CVector* vecStart, CVector* vecTarget) { int index; - for (index = 0; index < NUM_BULLET_TRACES; index++) { + for (index = 0; index < NUMBULLETTRACES; index++) { if (!aTraces[index].m_bInUse) break; } - if (index == NUM_BULLET_TRACES) + if (index == NUMBULLETTRACES) return; aTraces[index].m_vecCurrentPos = *vecStart; aTraces[index].m_vecTargetPos = *vecTarget; @@ -51,7 +51,7 @@ void CBulletTraces::AddTrace(CVector* vecStart, CVector* vecTarget) void CBulletTraces::Render(void) { - for (int i = 0; i < NUM_BULLET_TRACES; i++) { + for (int i = 0; i < NUMBULLETTRACES; i++) { if (!aTraces[i].m_bInUse) continue; RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)0); @@ -61,24 +61,18 @@ void CBulletTraces::Render(void) CVector inf = aTraces[i].m_vecCurrentPos; CVector sup = aTraces[i].m_vecTargetPos; CVector center = (inf + sup) / 2; - CVector screenPos = CrossProduct(TheCamera.GetForward(), (sup - inf)); - screenPos.Normalise(); - screenPos /= 20; + CVector width = CrossProduct(TheCamera.GetForward(), (sup - inf)); + width.Normalise(); + width /= 20; uint8 intensity = aTraces[i].m_lifeTime; - uint32 color = 0xFF << 24 | intensity << 16 | intensity << 8 | intensity; - TraceVertices[0].color = color; - TraceVertices[1].color = color; - TraceVertices[2].color = color; - TraceVertices[3].color = color; - TraceVertices[4].color = color; - TraceVertices[5].color = color; - // cast to satisfy compiler - TraceVertices[0].objVertex = (const CVector&)(inf + screenPos); - TraceVertices[1].objVertex = (const CVector&)(inf - screenPos); - TraceVertices[2].objVertex = (const CVector&)(center + screenPos); - TraceVertices[3].objVertex = (const CVector&)(center - screenPos); - TraceVertices[4].objVertex = (const CVector&)(sup + screenPos); - TraceVertices[5].objVertex = (const CVector&)(sup - screenPos); + for (int i = 0; i < ARRAY_SIZE(TraceVertices); i++) + RwIm3DVertexSetRGBA(&TraceVertices[i], intensity, intensity, intensity, 0xFF); + RwIm3DVertexSetPos(&TraceVertices[0], inf.x + width.x, inf.y + width.y, inf.z + width.z); + RwIm3DVertexSetPos(&TraceVertices[1], inf.x - width.x, inf.y - width.y, inf.z - width.z); + RwIm3DVertexSetPos(&TraceVertices[2], center.x + width.x, center.y + width.y, center.z + width.z); + RwIm3DVertexSetPos(&TraceVertices[3], center.x - width.x, center.y - width.y, center.z - width.z); + RwIm3DVertexSetPos(&TraceVertices[4], sup.x + width.x, sup.y + width.y, sup.z + width.z); + RwIm3DVertexSetPos(&TraceVertices[5], sup.x - width.x, sup.y - width.y, sup.z - width.z); LittleTest(); if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) { RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList)); @@ -92,7 +86,7 @@ void CBulletTraces::Render(void) void CBulletTraces::Update(void) { - for (int i = 0; i < NUM_BULLET_TRACES; i++) { + for (int i = 0; i < NUMBULLETTRACES; i++) { if (aTraces[i].m_bInUse) aTraces[i].Update(); } diff --git a/src/render/SpecialFX.h b/src/render/SpecialFX.h index 2d758fdd..ecd3ad87 100644 --- a/src/render/SpecialFX.h +++ b/src/render/SpecialFX.h @@ -27,10 +27,7 @@ struct CBulletTrace class CBulletTraces { public: - enum { - NUM_BULLET_TRACES = 16 - }; - static CBulletTrace (&aTraces)[NUM_BULLET_TRACES]; + static CBulletTrace (&aTraces)[NUMBULLETTRACES]; static void Init(void); static void AddTrace(CVector*, CVector*); |