1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-06-29 08:07:07 +00:00

fix bullet traces rener and some renaming

This commit is contained in:
Roman Masanin 2020-10-15 15:42:10 +03:00
parent 417646819c
commit 34b4efe242
3 changed files with 142 additions and 125 deletions

View file

@ -394,10 +394,8 @@ void CReplay::RecordThisFrame(void)
tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset]; tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset];
bt->type = REPLAYPACKET_BULLET_TRACES; bt->type = REPLAYPACKET_BULLET_TRACES;
bt->index = i; bt->index = i;
// bt->frames = CBulletTraces::aTraces[i].m_framesInUse; bt->inf = CBulletTraces::aTraces[i].m_vecStartPos;
// bt->lifetime = CBulletTraces::aTraces[i].m_lifeTime; bt->sup = CBulletTraces::aTraces[i].m_vecEndPos;
bt->inf = CBulletTraces::aTraces[i].m_vecCurrentPos;
bt->sup = CBulletTraces::aTraces[i].m_vecTargetPos;
Record.m_nOffset += sizeof(*bt); Record.m_nOffset += sizeof(*bt);
} }
tMiscPacket* misc = (tMiscPacket*)&Record.m_pBase[Record.m_nOffset]; tMiscPacket* misc = (tMiscPacket*)&Record.m_pBase[Record.m_nOffset];
@ -1141,10 +1139,8 @@ bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buffer, flo
{ {
tBulletTracePacket* pb = (tBulletTracePacket*)&ptr[offset]; tBulletTracePacket* pb = (tBulletTracePacket*)&ptr[offset];
CBulletTraces::aTraces[pb->index].m_bInUse = true; CBulletTraces::aTraces[pb->index].m_bInUse = true;
// CBulletTraces::aTraces[pb->index].m_framesInUse = pb->frames; CBulletTraces::aTraces[pb->index].m_vecStartPos = pb->inf;
// CBulletTraces::aTraces[pb->index].m_lifeTime = pb->lifetime; CBulletTraces::aTraces[pb->index].m_vecEndPos = pb->sup;
CBulletTraces::aTraces[pb->index].m_vecCurrentPos = pb->inf;
CBulletTraces::aTraces[pb->index].m_vecTargetPos = pb->sup;
buffer->m_nOffset += sizeof(tBulletTracePacket); buffer->m_nOffset += sizeof(tBulletTracePacket);
break; break;
} }

View file

@ -84,8 +84,8 @@ CSpecialFX::Init(void)
StreakIndexList[11] = 3; StreakIndexList[11] = 3;
CMotionBlurStreaks::Init(); CMotionBlurStreaks::Init();
CShinyTexts::Init();
CBrightLights::Init(); CBrightLights::Init();
CShinyTexts::Init();
CMoneyMessages::Init(); CMoneyMessages::Init();
C3dMarkers::Init(); C3dMarkers::Init();
CSpecialFX::bSnapShotActive = false; CSpecialFX::bSnapShotActive = false;
@ -124,7 +124,7 @@ CSpecialFX::AddWeaponStreak(int type)
end = matrix * CVector(0.096f, -0.0175f, 1.096f); end = matrix * CVector(0.096f, -0.0175f, 1.096f);
break; break;
default: default:
break; return;
} }
CMotionBlurStreaks::RegisterStreak((uintptr)FindPlayerPed()->m_pWeaponModel, 100, 100, 100, start, end); CMotionBlurStreaks::RegisterStreak((uintptr)FindPlayerPed()->m_pWeaponModel, 100, 100, 100, start, end);
} }
@ -235,7 +235,7 @@ CSpecialFX::Render2DFXs(void)
} else { } else {
CTimer::SetTimeScale(0.0f); //in andro it's 0.00001 CTimer::SetTimeScale(0.0f); //in andro it's 0.00001
if (CSpecialFX::SnapShotFrames < 10) { if (CSpecialFX::SnapShotFrames < 10) {
int32 tmp = (1 - CSpecialFX::SnapShotFrames / 10) * 255 * 0.65f; int32 tmp = (255 - 255 * CSpecialFX::SnapShotFrames / 10) * 0.65f;
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
CSprite2d::Draw2DPolygon(0.0f, 0.0f, SCREEN_WIDTH, 0.0f, 0.0f, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, CRGBA(tmp, tmp, tmp, tmp)); CSprite2d::Draw2DPolygon(0.0f, 0.0f, SCREEN_WIDTH, 0.0f, 0.0f, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT, CRGBA(tmp, tmp, tmp, tmp));
@ -329,7 +329,7 @@ CMotionBlurStreaks::RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVecto
} }
// Find free slot // Find free slot
for(i = 0; aStreaks[i].m_id != nil ; i++) for(i = 0; aStreaks[i].m_id != 0 ; i++)
if(i == NUMMBLURSTREAKS-1) if(i == NUMMBLURSTREAKS-1)
return; return;
@ -402,8 +402,8 @@ void CBulletTraces::AddTrace(CVector* start, CVector* end, float thicknes, uint3
for (int i = 0; nextSlot < NUMBULLETTRACES && aTraces[i].m_bInUse; i++) for (int i = 0; nextSlot < NUMBULLETTRACES && aTraces[i].m_bInUse; i++)
nextSlot++; nextSlot++;
if (nextSlot < 16) { if (nextSlot < 16) {
aTraces[nextSlot].m_vecCurrentPos = *start; aTraces[nextSlot].m_vecStartPos = *start;
aTraces[nextSlot].m_vecTargetPos = *end; aTraces[nextSlot].m_vecEndPos = *end;
aTraces[nextSlot].m_bInUse = true; aTraces[nextSlot].m_bInUse = true;
aTraces[nextSlot].m_nCreationTime = CTimer::GetTimeInMilliseconds(); aTraces[nextSlot].m_nCreationTime = CTimer::GetTimeInMilliseconds();
aTraces[nextSlot].m_fVisibility = visibility; aTraces[nextSlot].m_fVisibility = visibility;
@ -411,19 +411,22 @@ void CBulletTraces::AddTrace(CVector* start, CVector* end, float thicknes, uint3
aTraces[nextSlot].m_nLifeTime = modifiedLifeTime; aTraces[nextSlot].m_nLifeTime = modifiedLifeTime;
} }
float upDotProd = DotProduct(TheCamera.GetUp(), *start - TheCamera.GetPosition()); float startProjFwd = DotProduct(TheCamera.GetForward(), *start - TheCamera.GetPosition());
float forwardDotProd = DotProduct(TheCamera.GetForward(), *start - TheCamera.GetPosition()); float endProjFwd = DotProduct(TheCamera.GetForward(), *end - TheCamera.GetPosition());
float upDotProdEnd = DotProduct(TheCamera.GetUp(), *end - TheCamera.GetPosition()); if (startProjFwd * endProjFwd < 0.0f) { //if one of point behind us and second before us
float forwardDotProdEnd = DotProduct(TheCamera.GetForward(), *end - TheCamera.GetPosition()); float fStartDistFwd = Abs(startProjFwd) / (Abs(startProjFwd) + Abs(endProjFwd));
if (forwardDotProd*forwardDotProdEnd < 0.0f) {
float tmp = Abs(forwardDotProd) / (Abs(forwardDotProd) + Abs(forwardDotProdEnd)); float startProjUp = DotProduct(TheCamera.GetUp(), *start - TheCamera.GetPosition());
float tmp2 = (upDotProdEnd - upDotProd) * tmp + upDotProd; float endProjUp = DotProduct(TheCamera.GetUp(), *end - TheCamera.GetPosition());
float dotProdEndRight = DotProduct(TheCamera.GetRight(), *end - TheCamera.GetPosition()); float distUp = (endProjUp - startProjUp) * fStartDistFwd + startProjUp;
float dotProdRight = DotProduct(TheCamera.GetRight(), *start - TheCamera.GetPosition());
float tmp3 = (dotProdEndRight - dotProdRight) * tmp + dotProdRight; float startProjRight = DotProduct(TheCamera.GetRight(), *end - TheCamera.GetPosition());
float dist = Sqrt(SQR(tmp2) + SQR(tmp3)); float startProjRight = DotProduct(TheCamera.GetRight(), *start - TheCamera.GetPosition());
float distRight = (startProjRight - startProjRight) * fStartDistFwd + startProjRight;
float dist = Sqrt(SQR(distUp) + SQR(distRight));
if (dist < 2.0f) { if (dist < 2.0f) {
if(tmp3 < 0.0f) if(distRight < 0.0f)
DMAudio.PlayFrontEndSound(SOUND_BULLETTRACE_2, 127 * (1.0f - dist * 0.5f)); DMAudio.PlayFrontEndSound(SOUND_BULLETTRACE_2, 127 * (1.0f - dist * 0.5f));
else else
DMAudio.PlayFrontEndSound(SOUND_BULLETTRACE_1, 127 * (1.0f - dist * 0.5f)); DMAudio.PlayFrontEndSound(SOUND_BULLETTRACE_1, 127 * (1.0f - dist * 0.5f));
@ -443,10 +446,8 @@ void CBulletTraces::AddTrace(CVector* start, CVector* end, int32 weaponType, cla
|| camMode == CCam::MODE_CAMERA || camMode == CCam::MODE_CAMERA
|| camMode == CCam::MODE_SNIPER || camMode == CCam::MODE_SNIPER
|| camMode == CCam::MODE_M16_1STPERSON_RUNABOUT || camMode == CCam::MODE_M16_1STPERSON_RUNABOUT
#ifdef MOBILE_IMPROVEMENTS
|| camMode == CCam::MODE_ROCKETLAUNCHER || camMode == CCam::MODE_ROCKETLAUNCHER
|| camMode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT || camMode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT
#endif
|| camMode == CCam::MODE_SNIPER_RUNABOUT || camMode == CCam::MODE_SNIPER_RUNABOUT
|| camMode == CCam::MODE_HELICANNON_1STPERSON) { || camMode == CCam::MODE_HELICANNON_1STPERSON) {
@ -489,109 +490,130 @@ void CBulletTraces::Render(void)
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSmokeTrailTexture)); RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSmokeTrailTexture));
float nTimeOfLiving = CTimer::GetTimeInMilliseconds() - aTraces[i].m_nCreationTime; float timeAlive = CTimer::GetTimeInMilliseconds() - aTraces[i].m_nCreationTime;
float traceThicknes = aTraces[i].m_fThicknes * nTimeOfLiving / aTraces[i].m_nLifeTime;
CVector vecOffset = aTraces[i].m_vecTargetPos - aTraces[i].m_vecCurrentPos;
vecOffset.Normalise();
vecOffset *= traceThicknes;
uint8 nAlphaValue = aTraces[i].m_fVisibility * (aTraces[i].m_nLifeTime - nTimeOfLiving) / aTraces[i].m_nLifeTime;
CVector currentPos = aTraces[i].m_vecCurrentPos; float traceThicknes = aTraces[i].m_fThicknes * timeAlive / aTraces[i].m_nLifeTime;
CVector targetPos = aTraces[i].m_vecTargetPos; CVector horizontalOffset = aTraces[i].m_vecEndPos - aTraces[i].m_vecStartPos;
float dotProdCur = DotProduct(currentPos - TheCamera.GetPosition(), TheCamera.GetForward()) - 0.7f; horizontalOffset.Normalise();
float dotProdTar = DotProduct(targetPos - TheCamera.GetPosition(), TheCamera.GetForward()) - 0.7f; horizontalOffset *= traceThicknes;
if (dotProdCur >= 0.0f || dotProdTar >= 0.0f) {
if (dotProdCur < 0.0f) {
float absDotProdCur = Abs(dotProdCur);
float absDotProdTar = Abs(dotProdTar);
currentPos = (absDotProdTar * currentPos + absDotProdCur * targetPos) / (absDotProdCur + absDotProdTar);
} else if (dotProdTar < 0.0f){
float absDotProdCur = Abs(dotProdCur);
float absDotProdTar = Abs(dotProdTar);
targetPos = (absDotProdTar * currentPos + absDotProdCur * targetPos) / (absDotProdCur + absDotProdTar);
}
RwIm3DVertexSetV(&TraceVertices[5], 10.0f);
RwIm3DVertexSetV(&TraceVertices[6], 10.0f);
RwIm3DVertexSetV(&TraceVertices[7], 10.0f);
RwIm3DVertexSetV(&TraceVertices[8], 10.0f);
RwIm3DVertexSetV(&TraceVertices[9], 10.0f);
RwIm3DVertexSetRGBA(&TraceVertices[0], 255, 255, 255, nAlphaValue); //then closer trace to die then it more transparent
RwIm3DVertexSetRGBA(&TraceVertices[1], 255, 255, 255, nAlphaValue); uint8 nAlphaValue = aTraces[i].m_fVisibility * (aTraces[i].m_nLifeTime - timeAlive) / aTraces[i].m_nLifeTime;
RwIm3DVertexSetRGBA(&TraceVertices[2], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[3], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[4], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[5], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[6], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[7], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[8], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[9], 255, 255, 255, nAlphaValue);
CVector currentPos2 = (7.0f * currentPos + targetPos) / 8; CVector start = aTraces[i].m_vecStartPos;
CVector targetPos2 = (7.0f * targetPos + currentPos) / 8; CVector end = aTraces[i].m_vecEndPos;
RwIm3DVertexSetPos(&TraceVertices[0], currentPos2.x, currentPos2.y, currentPos2.z); float startProj = DotProduct(start - TheCamera.GetPosition(), TheCamera.GetForward()) - 0.7f;
RwIm3DVertexSetPos(&TraceVertices[1], currentPos2.x, currentPos2.y, currentPos2.z + traceThicknes); float endProj = DotProduct(end - TheCamera.GetPosition(), TheCamera.GetForward()) - 0.7f;
RwIm3DVertexSetPos(&TraceVertices[2], currentPos2.x + vecOffset.y, currentPos2.y - vecOffset.x, currentPos2.z); if (startProj < 0.0f && endProj < 0.0f) //we dont need render trace behind us
RwIm3DVertexSetPos(&TraceVertices[3], currentPos2.x, currentPos2.y, currentPos2.z - traceThicknes); continue;
RwIm3DVertexSetPos(&TraceVertices[4], currentPos2.x - vecOffset.y, currentPos2.y - vecOffset.y, currentPos2.z);
RwIm3DVertexSetPos(&TraceVertices[5], targetPos2.x, targetPos2.y, targetPos2.z); if (startProj < 0.0f) { //if strat behind us move it closer
RwIm3DVertexSetPos(&TraceVertices[6], targetPos2.x, targetPos2.y, targetPos2.z + traceThicknes); float absStartProj = Abs(startProj);
RwIm3DVertexSetPos(&TraceVertices[7], targetPos2.x + vecOffset.y, targetPos2.y - vecOffset.x, targetPos2.z); float absEndProj = Abs(endProj);
RwIm3DVertexSetPos(&TraceVertices[8], targetPos2.x, targetPos2.y, targetPos2.z - traceThicknes); start = (absEndProj * start + absStartProj * end) / (absStartProj + absEndProj);
RwIm3DVertexSetPos(&TraceVertices[9], targetPos2.x - vecOffset.y, targetPos2.y - vecOffset.y, targetPos2.z); } else if (endProj < 0.0f) {
float absStartProj = Abs(startProj);
float absEndProj = Abs(endProj);
end = (absEndProj * start + absStartProj * end) / (absStartProj + absEndProj);
}
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) { //we divide trace at three parts
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList)); CVector start2 = (7.0f * start + end) / 8;
RwIm3DEnd(); CVector end2 = (7.0f * end + start) / 8;
}
RwIm3DVertexSetV(&TraceVertices[5], 10.0f);
RwIm3DVertexSetV(&TraceVertices[6], 10.0f);
RwIm3DVertexSetV(&TraceVertices[7], 10.0f);
RwIm3DVertexSetV(&TraceVertices[8], 10.0f);
RwIm3DVertexSetV(&TraceVertices[9], 10.0f);
RwIm3DVertexSetV(&TraceVertices[5], 2.0f); RwIm3DVertexSetRGBA(&TraceVertices[0], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetV(&TraceVertices[6], 2.0f); RwIm3DVertexSetRGBA(&TraceVertices[1], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetV(&TraceVertices[7], 2.0f); RwIm3DVertexSetRGBA(&TraceVertices[2], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetV(&TraceVertices[8], 2.0f); RwIm3DVertexSetRGBA(&TraceVertices[3], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetV(&TraceVertices[9], 2.0f); RwIm3DVertexSetRGBA(&TraceVertices[4], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[0], 255, 255, 255, 0); RwIm3DVertexSetRGBA(&TraceVertices[5], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[1], 255, 255, 255, 0); RwIm3DVertexSetRGBA(&TraceVertices[6], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[2], 255, 255, 255, 0); RwIm3DVertexSetRGBA(&TraceVertices[7], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[3], 255, 255, 255, 0); RwIm3DVertexSetRGBA(&TraceVertices[8], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[4], 255, 255, 255, 0); RwIm3DVertexSetRGBA(&TraceVertices[9], 255, 255, 255, nAlphaValue);
//two points in center
RwIm3DVertexSetPos(&TraceVertices[0], start2.x, start2.y, start2.z);
RwIm3DVertexSetPos(&TraceVertices[5], end2.x, end2.y, end2.z);
//vetrical planes
RwIm3DVertexSetPos(&TraceVertices[1], start2.x, start2.y, start2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[3], start2.x, start2.y, start2.z - traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[6], end2.x, end2.y, end2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[8], end2.x, end2.y, end2.z - traceThicknes);
//horizontal planes
RwIm3DVertexSetPos(&TraceVertices[2], start2.x + horizontalOffset.y, start2.y - horizontalOffset.x, start2.z);
RwIm3DVertexSetPos(&TraceVertices[7], end2.x + horizontalOffset.y, end2.y - horizontalOffset.x, end2.z);
#ifdef FIX_BUGS //this point calcilated wrong for some reason
RwIm3DVertexSetPos(&TraceVertices[4], start2.x - horizontalOffset.y, start2.y + horizontalOffset.x, start2.z);
RwIm3DVertexSetPos(&TraceVertices[9], end2.x - horizontalOffset.y, end2.y + horizontalOffset.x, end2.z);
#else
RwIm3DVertexSetPos(&TraceVertices[4], start2.x - horizontalOffset.y, start2.y - horizontalOffset.y, start2.z);
RwIm3DVertexSetPos(&TraceVertices[9], end2.x - horizontalOffset.y, end2.y - horizontalOffset.y, end2.z);
#endif
RwIm3DVertexSetPos(&TraceVertices[0], currentPos.x, currentPos.y, currentPos.z); if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) {
RwIm3DVertexSetPos(&TraceVertices[1], currentPos.x, currentPos.y, currentPos.z + traceThicknes); RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DVertexSetPos(&TraceVertices[2], currentPos.x + vecOffset.y, currentPos.y - vecOffset.x, currentPos.z); RwIm3DEnd();
RwIm3DVertexSetPos(&TraceVertices[3], currentPos.x, currentPos.y, currentPos.z - traceThicknes); }
RwIm3DVertexSetPos(&TraceVertices[4], currentPos.x - vecOffset.y, currentPos.y - vecOffset.y, currentPos.z);
RwIm3DVertexSetPos(&TraceVertices[5], currentPos2.x, currentPos2.y, currentPos2.z); RwIm3DVertexSetV(&TraceVertices[5], 2.0f);
RwIm3DVertexSetPos(&TraceVertices[6], currentPos2.x, currentPos2.y, currentPos2.z + traceThicknes); RwIm3DVertexSetV(&TraceVertices[6], 2.0f);
RwIm3DVertexSetPos(&TraceVertices[7], currentPos2.x + vecOffset.y, currentPos2.y - vecOffset.x, currentPos2.z); RwIm3DVertexSetV(&TraceVertices[7], 2.0f);
RwIm3DVertexSetPos(&TraceVertices[8], currentPos2.x, currentPos2.y, currentPos2.z - traceThicknes); RwIm3DVertexSetV(&TraceVertices[8], 2.0f);
RwIm3DVertexSetPos(&TraceVertices[9], currentPos2.x - vecOffset.y, currentPos2.y - vecOffset.y, currentPos2.z); RwIm3DVertexSetV(&TraceVertices[9], 2.0f);
RwIm3DVertexSetRGBA(&TraceVertices[0], 255, 255, 255, 0);
RwIm3DVertexSetRGBA(&TraceVertices[1], 255, 255, 255, 0);
RwIm3DVertexSetRGBA(&TraceVertices[2], 255, 255, 255, 0);
RwIm3DVertexSetRGBA(&TraceVertices[3], 255, 255, 255, 0);
RwIm3DVertexSetRGBA(&TraceVertices[4], 255, 255, 255, 0);
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) { RwIm3DVertexSetPos(&TraceVertices[0], start.x, start.y, start.z);
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList)); RwIm3DVertexSetPos(&TraceVertices[1], start.x, start.y, start.z + traceThicknes);
RwIm3DEnd(); RwIm3DVertexSetPos(&TraceVertices[3], start.x, start.y, start.z - traceThicknes);
} RwIm3DVertexSetPos(&TraceVertices[2], start.x + horizontalOffset.y, start.y - horizontalOffset.x, start.z);
RwIm3DVertexSetPos(&TraceVertices[1], targetPos.x, targetPos.y, targetPos.z); RwIm3DVertexSetPos(&TraceVertices[5], start2.x, start2.y, start2.z);
RwIm3DVertexSetPos(&TraceVertices[2], targetPos.x, targetPos.y, targetPos.z + traceThicknes); RwIm3DVertexSetPos(&TraceVertices[6], start2.x, start2.y, start2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[3], targetPos.x + vecOffset.y, targetPos.y - vecOffset.x, targetPos.z); RwIm3DVertexSetPos(&TraceVertices[8], start2.x, start2.y, start2.z - traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[4], targetPos.x, targetPos.y, targetPos.z - traceThicknes); RwIm3DVertexSetPos(&TraceVertices[7], start2.x + horizontalOffset.y, start2.y - horizontalOffset.x, start2.z);
RwIm3DVertexSetPos(&TraceVertices[5], targetPos.x - vecOffset.y, targetPos.y - vecOffset.y, targetPos.z); #ifdef FIX_BUGS
RwIm3DVertexSetPos(&TraceVertices[4], start.x - horizontalOffset.y, start.y + horizontalOffset.x, start.z);
RwIm3DVertexSetPos(&TraceVertices[9], start2.x - horizontalOffset.y, start2.y + horizontalOffset.x, start2.z);
#else
RwIm3DVertexSetPos(&TraceVertices[4], start.x - horizontalOffset.y, start.y - horizontalOffset.y, start.z);
RwIm3DVertexSetPos(&TraceVertices[9], start2.x - horizontalOffset.y, start2.y - horizontalOffset.y, start2.z);
#endif
RwIm3DVertexSetPos(&TraceVertices[5], targetPos2.x, targetPos2.y, targetPos2.z); if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, rwIM3D_VERTEXUV)) {
RwIm3DVertexSetPos(&TraceVertices[6], targetPos2.x, targetPos2.y, targetPos2.z + traceThicknes); RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DVertexSetPos(&TraceVertices[7], targetPos2.x + vecOffset.y, targetPos2.y - vecOffset.x, targetPos2.z); RwIm3DEnd();
RwIm3DVertexSetPos(&TraceVertices[8], targetPos2.x, targetPos2.y, targetPos2.z - traceThicknes); }
RwIm3DVertexSetPos(&TraceVertices[9], targetPos2.x - vecOffset.y, targetPos2.y - vecOffset.y, targetPos2.z);
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) { RwIm3DVertexSetPos(&TraceVertices[1], end.x, end.y, end.z);
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList)); RwIm3DVertexSetPos(&TraceVertices[2], end.x, end.y, end.z + traceThicknes);
RwIm3DEnd(); RwIm3DVertexSetPos(&TraceVertices[4], end.x, end.y, end.z - traceThicknes);
} RwIm3DVertexSetPos(&TraceVertices[3], end.x + horizontalOffset.y, end.y - horizontalOffset.x, end.z);
RwIm3DVertexSetPos(&TraceVertices[5], end2.x, end2.y, end2.z);
RwIm3DVertexSetPos(&TraceVertices[6], end2.x, end2.y, end2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[8], end2.x, end2.y, end2.z - traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[7], end2.x + horizontalOffset.y, end2.y - horizontalOffset.x, end2.z);
#ifdef FIX_BUGS
RwIm3DVertexSetPos(&TraceVertices[5], end.x - horizontalOffset.y, end.y + horizontalOffset.x, end.z);
RwIm3DVertexSetPos(&TraceVertices[9], end2.x - horizontalOffset.y, end2.y + horizontalOffset.x, end2.z);
#else
RwIm3DVertexSetPos(&TraceVertices[5], end.x - horizontalOffset.y, end.y - horizontalOffset.y, end.z);
RwIm3DVertexSetPos(&TraceVertices[9], end2.x - horizontalOffset.y, end2.y - horizontalOffset.y, end2.z);
#endif
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, rwIM3D_VERTEXUV)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DEnd();
} }
} }
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
@ -762,7 +784,7 @@ C3dMarkers::Render()
CCoronas::RegisterCorona((uintptr)&m_aMarkerArray[i], CCoronas::RegisterCorona((uintptr)&m_aMarkerArray[i],
SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, 192, SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B, 192,
m_aMarkerArray[i].m_Matrix.GetPosition(), 1.2f * m_aMarkerArray[i].m_fSize, 50.0f * TheCamera.LODDistMultiplier, m_aMarkerArray[i].m_Matrix.GetPosition(), 1.2f * m_aMarkerArray[i].m_fSize, 50.0f * TheCamera.LODDistMultiplier,
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f, false, 1.5f); CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f, false);
} }
} }
NumActiveMarkers++; NumActiveMarkers++;
@ -1029,11 +1051,10 @@ CBrightLights::Render(void)
break; break;
default: default:
#ifdef FIX_BUGS //just to make sure that color never will be undefined #ifdef FIX_BUGS //just to make sure that color never will be undefined
r = 0; return;
g = 0; #else
b = 0;
#endif
break; break;
#endif
} }
if(aBrightLights[i].m_camDist < BRIGHTLIGHTS_FADE_DIST) if(aBrightLights[i].m_camDist < BRIGHTLIGHTS_FADE_DIST)

View file

@ -48,8 +48,8 @@ public:
struct CBulletTrace struct CBulletTrace
{ {
CVector m_vecCurrentPos; CVector m_vecStartPos;
CVector m_vecTargetPos; CVector m_vecEndPos;
bool m_bInUse; bool m_bInUse;
uint32 m_nCreationTime; uint32 m_nCreationTime;
uint32 m_nLifeTime; uint32 m_nLifeTime;