mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-25 19:25:41 +00:00
CPlaneTrails and CPlaneBanners done
This commit is contained in:
parent
e74b569115
commit
2612c9f12c
8 changed files with 321 additions and 27 deletions
|
@ -4031,7 +4031,7 @@ bool
|
||||||
CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
||||||
{
|
{
|
||||||
RwV3d c;
|
RwV3d c;
|
||||||
c = *(RwV3d*)¢er;
|
c = center;
|
||||||
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
||||||
if(c.y < CDraw::GetNearClipZ()) return false;
|
if(c.y < CDraw::GetNearClipZ()) return false;
|
||||||
if(c.y > CDraw::GetFarClipZ()) return false;
|
if(c.y > CDraw::GetFarClipZ()) return false;
|
||||||
|
@ -4046,7 +4046,7 @@ bool
|
||||||
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
||||||
{
|
{
|
||||||
RwV3d c;
|
RwV3d c;
|
||||||
c = *(RwV3d*)¢er;
|
c = center;
|
||||||
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
||||||
if(c.y + radius < CDraw::GetNearClipZ()) return false;
|
if(c.y + radius < CDraw::GetNearClipZ()) return false;
|
||||||
if(c.y - radius > CDraw::GetFarClipZ()) return false;
|
if(c.y - radius > CDraw::GetFarClipZ()) return false;
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
#include "RenderBuffer.h"
|
||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "Sprite.h"
|
#include "Sprite.h"
|
||||||
#include "Coronas.h"
|
#include "Coronas.h"
|
||||||
|
#include "Rubbish.h"
|
||||||
|
#include "Timecycle.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "Clock.h"
|
#include "Clock.h"
|
||||||
|
@ -18,17 +21,276 @@
|
||||||
#include "Bones.h"
|
#include "Bones.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
CPlaneTrail CPlaneTrails::aArray[6];
|
||||||
|
RwImVertexIndex TrailIndices[32] = {
|
||||||
|
0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9,
|
||||||
|
10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneTrail::Init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < ARRAY_SIZE(m_time); i++)
|
||||||
|
m_time[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneTrail::Render(float visibility)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int numVerts = 0;
|
||||||
|
if(!TheCamera.IsSphereVisible(m_pos[0], 1000.0f))
|
||||||
|
return;
|
||||||
|
|
||||||
|
int alpha = visibility*110.0f;
|
||||||
|
if(alpha == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(i = 0; i < ARRAY_SIZE(m_pos); i++){
|
||||||
|
int32 time = CTimer::GetTimeInMilliseconds() - m_time[i];
|
||||||
|
if(time > 30000)
|
||||||
|
m_time[i] = 0;
|
||||||
|
if(m_time[i] != 0){
|
||||||
|
float fade = (30000.0f - time) / 10000.0f;
|
||||||
|
fade = Min(fade, 1.0f);
|
||||||
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[numVerts], 255, 255, 255, (int)(alpha*fade));
|
||||||
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[numVerts], m_pos[i].x, m_pos[i].y, m_pos[i].z);
|
||||||
|
numVerts++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(numVerts > 1){
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
||||||
|
|
||||||
|
if(RwIm3DTransform(TempBufferRenderVertices, numVerts, nil, rwIM3D_VERTEXXYZ|rwIM3D_VERTEXUV)){
|
||||||
|
RwIm3DRenderIndexedPrimitive(rwPRIMTYPELINELIST, TrailIndices, (numVerts-1)*2);
|
||||||
|
RwIm3DEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneTrail::RegisterPoint(CVector pos)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
bool bNewPoint = false;
|
||||||
|
if(m_time[0] != 0 && CTimer::GetTimeInMilliseconds() - m_time[0] > 2000){
|
||||||
|
bNewPoint = true;
|
||||||
|
for(i = ARRAY_SIZE(m_pos)-1; i > 0; i--){
|
||||||
|
m_pos[i] = m_pos[i-1];
|
||||||
|
m_time[i] = m_time[i-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_pos[0] = pos;
|
||||||
|
if(bNewPoint || m_time[0] == 0)
|
||||||
|
m_time[0] = CTimer::GetTimeInMilliseconds();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneTrails::Init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < ARRAY_SIZE(aArray); i++)
|
||||||
|
aArray[i].Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneTrails::Update(void)
|
||||||
|
{
|
||||||
|
CVector planePos;
|
||||||
|
|
||||||
|
planePos.x = 1590.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
|
||||||
|
planePos.y = 1200.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
|
||||||
|
planePos.z = 550.0f;
|
||||||
|
RegisterPoint(planePos, 3);
|
||||||
|
if(CClock::GetHours() > 22 || CClock::GetHours() < 7){
|
||||||
|
if(CTimer::GetTimeInMilliseconds() & 0x200)
|
||||||
|
CCoronas::RegisterCorona(101, 255, 0, 0, 255, planePos, 5.0f, 2000.0f,
|
||||||
|
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF,
|
||||||
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
|
else
|
||||||
|
CCoronas::UpdateCoronaCoors(101, planePos, 2000.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
planePos.x = 1000.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
|
||||||
|
planePos.y = -1600.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
|
||||||
|
planePos.z = 500.0f;
|
||||||
|
RegisterPoint(planePos, 4);
|
||||||
|
if(CClock::GetHours() > 22 || CClock::GetHours() < 7){
|
||||||
|
if(CTimer::GetTimeInMilliseconds() & 0x200)
|
||||||
|
CCoronas::RegisterCorona(102, 255, 0, 0, 255, planePos, 5.0f, 2000.0f,
|
||||||
|
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF,
|
||||||
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
|
else
|
||||||
|
CCoronas::UpdateCoronaCoors(102, planePos, 2000.0f, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
planePos.x = 1100.0f * Cos((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
|
||||||
|
planePos.y = 700.0f * Sin((float)(CTimer::GetTimeInMilliseconds() & 0x1FFFF)/0x20000 * TWOPI);
|
||||||
|
planePos.z = 600.0f;
|
||||||
|
RegisterPoint(planePos, 5);
|
||||||
|
if(CClock::GetHours() > 22 || CClock::GetHours() < 7){
|
||||||
|
if(CTimer::GetTimeInMilliseconds() & 0x200)
|
||||||
|
CCoronas::RegisterCorona(103, 255, 0, 0, 255, planePos, 5.0f, 2000.0f,
|
||||||
|
CCoronas::TYPE_NORMAL, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF,
|
||||||
|
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
|
||||||
|
else
|
||||||
|
CCoronas::UpdateCoronaCoors(103, planePos, 2000.0f, 0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneTrails::Render(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
float visibility = Min(1.0f-CWeather::Foggyness, 1.0f-CWeather::CloudCoverage);
|
||||||
|
visibility = Min(visibility, 1.0f-CWeather::Rain);
|
||||||
|
visibility = Min(Max(Max(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen()), CTimeCycle::GetSkyTopBlue())/256.0f, visibility);
|
||||||
|
if(visibility > 0.0001f)
|
||||||
|
for(i = 0; i < ARRAY_SIZE(aArray); i++)
|
||||||
|
aArray[i].Render(visibility);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CPlaneTrails::RegisterPoint(CVector pos, uint32 id)
|
CPlaneTrails::RegisterPoint(CVector pos, uint32 id)
|
||||||
{
|
{
|
||||||
// TODO
|
aArray[id].RegisterPoint(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CPlaneBanner CPlaneBanners::aArray[5];
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanner::Init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < ARRAY_SIZE(m_pos); i++){
|
||||||
|
m_pos[i].x = i;
|
||||||
|
m_pos[i].y = 0.0f;
|
||||||
|
m_pos[i].z = -60.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanner::Update(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if(m_pos[0].z > -50.0f){
|
||||||
|
m_pos[0].z -= 0.05f*CTimer::GetTimeStep();
|
||||||
|
m_pos[0].z = Max(m_pos[0].z, -100.0f);
|
||||||
|
for(i = 1; i < ARRAY_SIZE(m_pos); i++){
|
||||||
|
CVector dist = m_pos[i] - m_pos[i-1];
|
||||||
|
float len = dist.Magnitude();
|
||||||
|
if(len > 8.0f)
|
||||||
|
m_pos[i] = m_pos[i-1] + dist/len*8.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanner::Render(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if(m_pos[0].z > -50.0f){
|
||||||
|
float camDist = (TheCamera.GetPosition() - m_pos[0]).Magnitude();
|
||||||
|
if(TheCamera.IsSphereVisible(m_pos[4], 32.0f) && camDist < 300.0f){
|
||||||
|
TempBufferVerticesStored = 0;
|
||||||
|
TempBufferIndicesStored = 0;
|
||||||
|
int alpha = camDist < 250.0f ? 160 : (300.0f-camDist)/(300.0f-250.0f)*160;
|
||||||
|
|
||||||
|
TempBufferVerticesStored += 2;
|
||||||
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], 255, 255, 255, alpha);
|
||||||
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], 255, 255, 255, alpha);
|
||||||
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[0], m_pos[2].x, m_pos[2].y, m_pos[2].z);
|
||||||
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[1], m_pos[2].x, m_pos[2].y, m_pos[2].z - 4.0f);
|
||||||
|
RwIm3DVertexSetU(&TempBufferRenderVertices[0], 0.0f);
|
||||||
|
RwIm3DVertexSetV(&TempBufferRenderVertices[0], 0.0f);
|
||||||
|
RwIm3DVertexSetU(&TempBufferRenderVertices[1], 0.0f);
|
||||||
|
RwIm3DVertexSetV(&TempBufferRenderVertices[1], 1.0f);
|
||||||
|
for(i = 2; i < 8; i++){
|
||||||
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+0], 255, 255, 255, alpha);
|
||||||
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[TempBufferVerticesStored+1], 255, 255, 255, alpha);
|
||||||
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+0], m_pos[i].x, m_pos[i].y, m_pos[i].z);
|
||||||
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[TempBufferVerticesStored+1], m_pos[i].x, m_pos[i].y, m_pos[i].z - 4.0f);
|
||||||
|
RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+0], (i-2)/5.0f);
|
||||||
|
RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+0], 0.0f);
|
||||||
|
RwIm3DVertexSetU(&TempBufferRenderVertices[TempBufferVerticesStored+1], (i-2)/5.0f);
|
||||||
|
RwIm3DVertexSetV(&TempBufferRenderVertices[TempBufferVerticesStored+1], 1.0f);
|
||||||
|
TempBufferRenderIndexList[TempBufferIndicesStored+0] = TempBufferVerticesStored-2;
|
||||||
|
TempBufferRenderIndexList[TempBufferIndicesStored+1] = TempBufferVerticesStored-1;
|
||||||
|
TempBufferRenderIndexList[TempBufferIndicesStored+2] = TempBufferVerticesStored+1;
|
||||||
|
TempBufferRenderIndexList[TempBufferIndicesStored+3] = TempBufferVerticesStored-2;
|
||||||
|
TempBufferRenderIndexList[TempBufferIndicesStored+4] = TempBufferVerticesStored+1;
|
||||||
|
TempBufferRenderIndexList[TempBufferIndicesStored+5] = TempBufferVerticesStored;
|
||||||
|
TempBufferVerticesStored += 2;
|
||||||
|
TempBufferIndicesStored += 6;
|
||||||
|
}
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpRubbishTexture[2]));
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, rwIM3D_VERTEXXYZ|rwIM3D_VERTEXUV)){
|
||||||
|
#else
|
||||||
|
if(RwIm3DTransform(TempBufferRenderVertices, TempBufferVerticesStored, nil, 0)){
|
||||||
|
#endif
|
||||||
|
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempBufferRenderIndexList, TempBufferIndicesStored);
|
||||||
|
RwIm3DEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||||
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||||
|
|
||||||
|
TempBufferVerticesStored = 0;
|
||||||
|
TempBufferIndicesStored = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanner::RegisterPoint(CVector pos)
|
||||||
|
{
|
||||||
|
m_pos[0] = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanners::Init(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < ARRAY_SIZE(aArray); i++)
|
||||||
|
aArray[i].Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanners::Update(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < ARRAY_SIZE(aArray); i++)
|
||||||
|
aArray[i].Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CPlaneBanners::Render(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < ARRAY_SIZE(aArray); i++)
|
||||||
|
aArray[i].Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CPlaneBanners::RegisterPoint(CVector pos, uint32 id)
|
CPlaneBanners::RegisterPoint(CVector pos, uint32 id)
|
||||||
{
|
{
|
||||||
// TODO
|
aArray[id].RegisterPoint(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSmokeTrails::CigOn = false;
|
bool CSmokeTrails::CigOn = false;
|
||||||
|
@ -125,7 +387,9 @@ CMovingThing CMovingThings::aMovingThings[NUMMOVINGTHINGS];
|
||||||
|
|
||||||
void CMovingThings::Init()
|
void CMovingThings::Init()
|
||||||
{
|
{
|
||||||
|
CPlaneTrails::Init();
|
||||||
CSmokeTrails::Init();
|
CSmokeTrails::Init();
|
||||||
|
CPlaneBanners::Init();
|
||||||
|
|
||||||
StartCloseList.m_pNext = &CMovingThings::EndCloseList;
|
StartCloseList.m_pNext = &CMovingThings::EndCloseList;
|
||||||
StartCloseList.m_pPrev = nil;
|
StartCloseList.m_pPrev = nil;
|
||||||
|
@ -174,14 +438,19 @@ void CMovingThings::Shutdown()
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
|
for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
|
||||||
aScrollBars[i].SetVisibility(false);
|
aScrollBars[i].SetVisibility(false);
|
||||||
|
/*
|
||||||
for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
|
for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
|
||||||
aTowerClocks[i].SetVisibility(false);
|
aTowerClocks[i].SetVisibility(false);
|
||||||
for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
|
for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
|
||||||
aDigitalClocks[i].SetVisibility(false);
|
aDigitalClocks[i].SetVisibility(false);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMovingThings::Update()
|
void CMovingThings::Update()
|
||||||
{
|
{
|
||||||
|
CPlaneBanners::Update();
|
||||||
|
CPlaneTrails::Update();
|
||||||
|
|
||||||
const int TIME_SPAN = 64; // frames to process all aMovingThings
|
const int TIME_SPAN = 64; // frames to process all aMovingThings
|
||||||
|
|
||||||
int16 i;
|
int16 i;
|
||||||
|
@ -226,6 +495,7 @@ void CMovingThings::Render()
|
||||||
if (aScrollBars[i].IsVisible())
|
if (aScrollBars[i].IsVisible())
|
||||||
aScrollBars[i].Render();
|
aScrollBars[i].Render();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
|
for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
|
||||||
{
|
{
|
||||||
if (aTowerClocks[i].IsVisible())
|
if (aTowerClocks[i].IsVisible())
|
||||||
|
@ -236,8 +506,11 @@ void CMovingThings::Render()
|
||||||
if (aDigitalClocks[i].IsVisible())
|
if (aDigitalClocks[i].IsVisible())
|
||||||
aDigitalClocks[i].Render();
|
aDigitalClocks[i].Render();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
CPlaneTrails::Render();
|
||||||
CSmokeTrails::Render();
|
CSmokeTrails::Render();
|
||||||
|
CPlaneBanners::Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- CMovingThing ----------
|
// ---------- CMovingThing ----------
|
||||||
|
@ -946,7 +1219,6 @@ CSmokeTrails::Render(void) {
|
||||||
void
|
void
|
||||||
CSmokeTrail::Render(void) {
|
CSmokeTrail::Render(void) {
|
||||||
int numVerts = 0;
|
int numVerts = 0;
|
||||||
RwIm3DVertex TempVertexBuffer[16];
|
|
||||||
|
|
||||||
if (TheCamera.IsSphereVisible(m_pos[0], 10.0f)) {
|
if (TheCamera.IsSphereVisible(m_pos[0], 10.0f)) {
|
||||||
for (int32 i = 0; i < 16; i++) {
|
for (int32 i = 0; i < 16; i++) {
|
||||||
|
@ -961,8 +1233,8 @@ CSmokeTrail::Render(void) {
|
||||||
float posX = (m_pos[i].x + timeSinceSpawned * RandomSmoke[(i - m_seed) & 0xF] * 0.00001f) - offset;
|
float posX = (m_pos[i].x + timeSinceSpawned * RandomSmoke[(i - m_seed) & 0xF] * 0.00001f) - offset;
|
||||||
float posY = (m_pos[i].y + timeSinceSpawned * RandomSmoke[(i - m_seed + 5) & 0xF] * 0.00001f) - offset;
|
float posY = (m_pos[i].y + timeSinceSpawned * RandomSmoke[(i - m_seed + 5) & 0xF] * 0.00001f) - offset;
|
||||||
float posZ = m_pos[i].z + timeSinceSpawned * 0.0004f;
|
float posZ = m_pos[i].z + timeSinceSpawned * 0.0004f;
|
||||||
RwIm3DVertexSetRGBA(&TempVertexBuffer[i], 200, 200, 200, alpha);
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[i], 200, 200, 200, alpha);
|
||||||
RwIm3DVertexSetPos(&TempVertexBuffer[i], posX, posY, posZ);
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[i], posX, posY, posZ);
|
||||||
numVerts++;
|
numVerts++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -974,7 +1246,7 @@ CSmokeTrail::Render(void) {
|
||||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
||||||
|
|
||||||
if (RwIm3DTransform(TempVertexBuffer, numVerts, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
|
if (RwIm3DTransform(TempBufferRenderVertices, numVerts, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
|
||||||
RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2 * (numVerts - 1));
|
RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2 * (numVerts - 1));
|
||||||
RwIm3DEnd();
|
RwIm3DEnd();
|
||||||
}
|
}
|
||||||
|
@ -1006,13 +1278,12 @@ CSmokeTrails::Update(void) {
|
||||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
||||||
|
|
||||||
RwIm3DVertex TempVertexBuffer[2];
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[0], 255, 255, 255, 255);
|
||||||
RwIm3DVertexSetRGBA(&TempVertexBuffer[0], 255, 255, 255, 255);
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[0], startPos.x, startPos.y, startPos.z);
|
||||||
RwIm3DVertexSetPos(&TempVertexBuffer[0], startPos.x, startPos.y, startPos.z);
|
RwIm3DVertexSetRGBA(&TempBufferRenderVertices[1], 255, 255, 255, 255);
|
||||||
RwIm3DVertexSetRGBA(&TempVertexBuffer[1], 255, 255, 255, 255);
|
RwIm3DVertexSetPos(&TempBufferRenderVertices[1], endPos.x, endPos.y, endPos.z);
|
||||||
RwIm3DVertexSetPos(&TempVertexBuffer[1], endPos.x, endPos.y, endPos.z);
|
|
||||||
|
|
||||||
if (RwIm3DTransform(TempVertexBuffer, 2, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
|
if (RwIm3DTransform(TempBufferRenderVertices, 2, nil, rwIM3D_VERTEXXYZ | rwIM3D_VERTEXRGBA)) {
|
||||||
RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2);
|
RwIm3DRenderIndexedPrimitive(rwPRIMTYPEPOLYLINE, SmokeTrailIndices, 2);
|
||||||
RwIm3DEnd();
|
RwIm3DEnd();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,29 +14,43 @@ class CScriptPaths
|
||||||
public:
|
public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO
|
|
||||||
class CPlaneTrail
|
class CPlaneTrail
|
||||||
{
|
{
|
||||||
|
CVector m_pos[16];
|
||||||
|
int32 m_time[16];
|
||||||
public:
|
public:
|
||||||
|
void Init(void);
|
||||||
|
void Render(float visibility);
|
||||||
|
void RegisterPoint(CVector pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO
|
|
||||||
class CPlaneTrails
|
class CPlaneTrails
|
||||||
{
|
{
|
||||||
|
static CPlaneTrail aArray[6]; // NB: 3 CPlanes and 3 hardcoded far away ones
|
||||||
public:
|
public:
|
||||||
|
static void Init(void);
|
||||||
|
static void Update(void);
|
||||||
|
static void Render(void);
|
||||||
static void RegisterPoint(CVector pos, uint32 id);
|
static void RegisterPoint(CVector pos, uint32 id);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO
|
|
||||||
class CPlaneBanner
|
class CPlaneBanner
|
||||||
{
|
{
|
||||||
|
CVector m_pos[8];
|
||||||
public:
|
public:
|
||||||
|
void Init(void);
|
||||||
|
void Update(void);
|
||||||
|
void Render(void);
|
||||||
|
void RegisterPoint(CVector pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO
|
|
||||||
class CPlaneBanners
|
class CPlaneBanners
|
||||||
{
|
{
|
||||||
|
static CPlaneBanner aArray[5];
|
||||||
public:
|
public:
|
||||||
|
static void Init(void);
|
||||||
|
static void Update(void);
|
||||||
|
static void Render(void);
|
||||||
static void RegisterPoint(CVector pos, uint32 id);
|
static void RegisterPoint(CVector pos, uint32 id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,7 @@
|
||||||
int32 TempBufferVerticesStored;
|
int32 TempBufferVerticesStored;
|
||||||
int32 TempBufferIndicesStored;
|
int32 TempBufferIndicesStored;
|
||||||
|
|
||||||
RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
|
VertexBufferUnion TempVertexBuffer;
|
||||||
RwIm2DVertex *TempVertexBuffer = (RwIm2DVertex*)TempBufferRenderVertices;
|
|
||||||
RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
|
RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
|
||||||
|
|
||||||
int RenderBuffer::VerticesToBeStored;
|
int RenderBuffer::VerticesToBeStored;
|
||||||
|
|
|
@ -12,8 +12,14 @@ public:
|
||||||
#define TEMPBUFFERVERTSIZE 512
|
#define TEMPBUFFERVERTSIZE 512
|
||||||
#define TEMPBUFFERINDEXSIZE 1024
|
#define TEMPBUFFERINDEXSIZE 1024
|
||||||
|
|
||||||
|
struct VertexBufferUnion
|
||||||
|
{
|
||||||
|
RwIm2DVertex im2d[TEMPBUFFERVERTSIZE];
|
||||||
|
RwIm3DVertex im3d[TEMPBUFFERVERTSIZE];
|
||||||
|
};
|
||||||
|
|
||||||
extern int32 TempBufferVerticesStored;
|
extern int32 TempBufferVerticesStored;
|
||||||
extern int32 TempBufferIndicesStored;
|
extern int32 TempBufferIndicesStored;
|
||||||
extern RwIm2DVertex *TempVertexBuffer;
|
extern VertexBufferUnion TempVertexBuffer;
|
||||||
extern RwIm3DVertex TempBufferRenderVertices[TEMPBUFFERVERTSIZE];
|
#define TempBufferRenderVertices (TempVertexBuffer.im3d)
|
||||||
extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
|
extern RwImVertexIndex TempBufferRenderIndexList[TEMPBUFFERINDEXSIZE];
|
|
@ -49,3 +49,5 @@ public:
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
static void Shutdown(void);
|
static void Shutdown(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern RwTexture *gpRubbishTexture[4];
|
||||||
|
|
|
@ -432,7 +432,7 @@ void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3,
|
||||||
void
|
void
|
||||||
CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2)
|
CSprite2d::AddToBuffer(const CRect &r, const CRGBA &c, float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2)
|
||||||
{
|
{
|
||||||
SetVertices(&TempVertexBuffer[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2);
|
SetVertices(&TempVertexBuffer.im2d[nextBufferVertex], r, c, c, c, c, u0, v0, u1, v1, u3, v3, u2, v2);
|
||||||
RwImVertexIndex *pIndexList = &TempBufferRenderIndexList[nextBufferIndex];
|
RwImVertexIndex *pIndexList = &TempBufferRenderIndexList[nextBufferIndex];
|
||||||
pIndexList[0] = nextBufferVertex;
|
pIndexList[0] = nextBufferVertex;
|
||||||
pIndexList[1] = nextBufferVertex + 1;
|
pIndexList[1] = nextBufferVertex + 1;
|
||||||
|
@ -457,7 +457,7 @@ CSprite2d::RenderVertexBuffer()
|
||||||
{
|
{
|
||||||
if (nextBufferVertex > 0) {
|
if (nextBufferVertex > 0) {
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
||||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempVertexBuffer, nextBufferVertex, TempBufferRenderIndexList, nextBufferIndex);
|
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TempVertexBuffer.im2d, nextBufferVertex, TempBufferRenderIndexList, nextBufferIndex);
|
||||||
nextBufferVertex = 0;
|
nextBufferVertex = 0;
|
||||||
nextBufferIndex = 0;
|
nextBufferIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,9 +126,10 @@ CPlane::ProcessControl(void)
|
||||||
if(CReplay::IsPlayingBack())
|
if(CReplay::IsPlayingBack())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(GetModelIndex() == MI_AIRTRAIN)
|
if(GetModelIndex() == MI_AIRTRAIN){
|
||||||
CPlaneTrails::RegisterPoint(GetPosition(), m_nPlaneId);
|
if(GetPosition().z > 100.0f)
|
||||||
else if(GetModelIndex() == MI_DEADDODO)
|
CPlaneTrails::RegisterPoint(GetPosition(), m_nPlaneId);
|
||||||
|
}else if(GetModelIndex() == MI_DEADDODO)
|
||||||
CPlaneBanners::RegisterPoint(GetPosition(), m_nPlaneId);
|
CPlaneBanners::RegisterPoint(GetPosition(), m_nPlaneId);
|
||||||
|
|
||||||
// Explosion
|
// Explosion
|
||||||
|
@ -742,6 +743,7 @@ CPlane::InitPlanes(void)
|
||||||
CStreaming::RequestModel(MI_AIRTRAIN, 0);
|
CStreaming::RequestModel(MI_AIRTRAIN, 0);
|
||||||
CStreaming::LoadAllRequestedModels(false);
|
CStreaming::LoadAllRequestedModels(false);
|
||||||
|
|
||||||
|
// NB: 3 hardcoded also in CPlaneTrails
|
||||||
for(i = 0; i < 3; i++){
|
for(i = 0; i < 3; i++){
|
||||||
CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE);
|
CPlane *plane = new CPlane(MI_AIRTRAIN, PERMANENT_VEHICLE);
|
||||||
plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
|
plane->GetMatrix().SetTranslate(0.0f, 0.0f, 0.0f);
|
||||||
|
|
Loading…
Reference in a new issue