SpecialFX almost done

This commit is contained in:
Roman Masanin 2020-10-11 21:40:11 +03:00
parent 881db86895
commit 7a3e1ef19a
3 changed files with 296 additions and 96 deletions

View File

@ -393,8 +393,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->frames = CBulletTraces::aTraces[i].m_framesInUse;
bt->lifetime = CBulletTraces::aTraces[i].m_lifeTime; // bt->lifetime = CBulletTraces::aTraces[i].m_lifeTime;
bt->inf = CBulletTraces::aTraces[i].m_vecCurrentPos; bt->inf = CBulletTraces::aTraces[i].m_vecCurrentPos;
bt->sup = CBulletTraces::aTraces[i].m_vecTargetPos; bt->sup = CBulletTraces::aTraces[i].m_vecTargetPos;
Record.m_nOffset += sizeof(*bt); Record.m_nOffset += sizeof(*bt);
@ -1140,8 +1140,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_framesInUse = pb->frames;
CBulletTraces::aTraces[pb->index].m_lifeTime = pb->lifetime; // CBulletTraces::aTraces[pb->index].m_lifeTime = pb->lifetime;
CBulletTraces::aTraces[pb->index].m_vecCurrentPos = pb->inf; CBulletTraces::aTraces[pb->index].m_vecCurrentPos = pb->inf;
CBulletTraces::aTraces[pb->index].m_vecTargetPos = pb->sup; CBulletTraces::aTraces[pb->index].m_vecTargetPos = pb->sup;
buffer->m_nOffset += sizeof(tBulletTracePacket); buffer->m_nOffset += sizeof(tBulletTracePacket);

View File

@ -24,11 +24,15 @@
#include "ColStore.h" #include "ColStore.h"
#include "Coronas.h" #include "Coronas.h"
#include "Script.h" #include "Script.h"
#include "DMAudio.h"
RwIm3DVertex StreakVertices[4]; RwIm3DVertex StreakVertices[4];
RwImVertexIndex StreakIndexList[12]; RwImVertexIndex StreakIndexList[12];
RwIm3DVertex TraceVertices[10]; RwIm3DVertex TraceVertices[10];
static RwImVertexIndex TraceIndexList[48] = {0, 5, 7, 0, 7, 2, 0, 7, 5, 0, 2, 7, 0, 4, 9, 0,
9, 5, 0, 9, 4, 0, 5, 9, 0, 1, 6, 0, 6, 5, 0, 6,
1, 0, 5, 6, 0, 3, 8, 0, 8, 5, 0, 8, 3, 0, 5, 8 };
bool CSpecialFX::bVideoCam; bool CSpecialFX::bVideoCam;
bool CSpecialFX::bLiftCam; bool CSpecialFX::bLiftCam;
@ -95,6 +99,37 @@ CSpecialFX::Init(void)
CTxdStore::PopCurrentTxd(); CTxdStore::PopCurrentTxd();
} }
void
CSpecialFX::AddWeaponStreak(int type)
{
static CMatrix matrix;
CVector start;
CVector end;
if (FindPlayerPed() != nil && FindPlayerPed()->m_pWeaponModel != nil) {
switch (type) {
case WEAPONTYPE_BASEBALLBAT:
matrix = RwFrameGetLTM(RpAtomicGetFrame(FindPlayerPed()->m_pWeaponModel));
start = matrix * CVector(0.02f, 0.05f, 0.07f);
end = matrix * CVector(0.246f, 0.0325f, 0.796f);
break;
case WEAPONTYPE_GOLFCLUB:
matrix = RwFrameGetLTM(RpAtomicGetFrame(FindPlayerPed()->m_pWeaponModel));
start = matrix * CVector(0.02f, 0.05f, 0.07f);
end = matrix * CVector(-0.054f, 0.0325f, 0.796f);
break;
case WEAPONTYPE_KATANA:
matrix = RwFrameGetLTM(RpAtomicGetFrame(FindPlayerPed()->m_pWeaponModel));
start = matrix * CVector(0.02f, 0.05f, 0.07f);
end = matrix * CVector(0.096f, -0.0175f, 1.096f);
break;
default:
break;
}
CMotionBlurStreaks::RegisterStreak((uintptr)FindPlayerPed()->m_pWeaponModel, 100, 100, 100, start, end);
}
}
RwObject* RwObject*
LookForBatCB(RwObject *object, void *data) LookForBatCB(RwObject *object, void *data)
{ {
@ -279,6 +314,7 @@ void
CMotionBlurStreaks::RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2) CMotionBlurStreaks::RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2)
{ {
int i; int i;
for(i = 0; i < NUMMBLURSTREAKS; i++){ for(i = 0; i < NUMMBLURSTREAKS; i++){
if(aStreaks[i].m_id == id){ if(aStreaks[i].m_id == id){
// Found a streak from last frame, update // Found a streak from last frame, update
@ -291,10 +327,12 @@ CMotionBlurStreaks::RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVecto
return; return;
} }
} }
// Find free slot // Find free slot
for(i = 0; aStreaks[i].m_id; i++) for(i = 0; aStreaks[i].m_id != nil ; i++)
if(i == NUMMBLURSTREAKS-1) if(i == NUMMBLURSTREAKS-1)
return; return;
// Create a new streak // Create a new streak
aStreaks[i].m_id = id; aStreaks[i].m_id = id;
aStreaks[i].m_red = r; aStreaks[i].m_red = r;
@ -313,7 +351,7 @@ CMotionBlurStreaks::Render(void)
bool setRenderStates = false; bool setRenderStates = false;
int i; int i;
for(i = 0; i < NUMMBLURSTREAKS; i++) for(i = 0; i < NUMMBLURSTREAKS; i++)
if(aStreaks[i].m_id){ if(aStreaks[i].m_id != nil){
if(!setRenderStates){ if(!setRenderStates){
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
@ -343,61 +381,222 @@ void CBulletTraces::Init(void)
aTraces[i].m_bInUse = false; aTraces[i].m_bInUse = false;
} }
void CBulletTraces::AddTrace(CVector* vecStart, CVector* vecTarget) void CBulletTraces::AddTrace(CVector* start, CVector* end, float thicknes, uint32 lifeTime, uint8 visibility)
{ {
int index; int32 enabledCount;
for (index = 0; index < NUMBULLETTRACES; index++) { uint32 modifiedLifeTime;
if (!aTraces[index].m_bInUse) int32 nextSlot;
break;
enabledCount = 0;
for (int i = 0; i < NUMBULLETTRACES; i++)
if (aTraces[i].m_bInUse)
enabledCount++;
if (enabledCount >= 10)
modifiedLifeTime = lifeTime / 4;
else if (enabledCount >= 5)
modifiedLifeTime = lifeTime / 2;
else
modifiedLifeTime = lifeTime;
nextSlot = 0;
for (int i = 0; nextSlot < NUMBULLETTRACES && aTraces[i].m_bInUse; i++)
nextSlot++;
if (nextSlot < 16) {
aTraces[nextSlot].m_vecCurrentPos = *start;
aTraces[nextSlot].m_vecTargetPos = *end;
aTraces[nextSlot].m_bInUse = true;
aTraces[nextSlot].m_nCreationTime = CTimer::GetTimeInMilliseconds();
aTraces[nextSlot].m_fVisibility = visibility;
aTraces[nextSlot].m_fThicknes = thicknes;
aTraces[nextSlot].m_nLifeTime = modifiedLifeTime;
}
float upDotProd = DotProduct(TheCamera.GetUp(), *start - TheCamera.GetPosition());
float forwardDotProd = DotProduct(TheCamera.GetForward(), *start - TheCamera.GetPosition());
float upDotProdEnd = DotProduct(TheCamera.GetUp(), *end - TheCamera.GetPosition());
float forwardDotProdEnd = DotProduct(TheCamera.GetForward(), *end - TheCamera.GetPosition());
if (forwardDotProd*forwardDotProdEnd < 0.0f) {
float tmp = Abs(forwardDotProd) / (Abs(forwardDotProd) + Abs(forwardDotProdEnd));
float tmp2 = (upDotProdEnd - upDotProd) * tmp + upDotProd;
float dotProdEndRight = DotProduct(TheCamera.GetRight(), *end - TheCamera.GetPosition());
float dotProdRight = DotProduct(TheCamera.GetRight(), *start - TheCamera.GetPosition());
float tmp3 = (dotProdEndRight - dotProdRight) * tmp + dotProdRight;
float dist = Sqrt(SQR(tmp2) + SQR(tmp3));
if (dist < 2.0f) {
if(tmp3 < 0.0f)
DMAudio.PlayFrontEndSound(SOUND_BULLETTRACE_2, 127 * (1.0f - dist * 0.5f));
else
DMAudio.PlayFrontEndSound(SOUND_BULLETTRACE_1, 127 * (1.0f - dist * 0.5f));
}
}
}
void CBulletTraces::AddTrace(CVector* start, CVector* end, int32 weaponType, class CEntity* shooter)
{
CPhysical* player;
float speed;
int16 camMode;
if (shooter == (CEntity*)FindPlayerPed() || (FindPlayerVehicle() != nil && FindPlayerVehicle() == (CVehicle*)shooter)) {
camMode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (camMode == CCam::MODE_M16_1STPERSON
|| camMode == CCam::MODE_CAMERA
|| camMode == CCam::MODE_SNIPER
|| camMode == CCam::MODE_M16_1STPERSON_RUNABOUT
#ifdef MOBILE_IMPROVEMENTS
|| camMode == CCam::MODE_ROCKETLAUNCHER
|| camMode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT
#endif
|| camMode == CCam::MODE_SNIPER_RUNABOUT
|| camMode == CCam::MODE_HELICANNON_1STPERSON) {
player = FindPlayerVehicle() ? (CPhysical*)FindPlayerVehicle() : (CPhysical*)FindPlayerPed();
speed = player->m_vecMoveSpeed.Magnitude();
if (speed < 0.05f)
return;
}
}
switch (weaponType) {
case WEAPONTYPE_PYTHON:
case WEAPONTYPE_SHOTGUN:
case WEAPONTYPE_SPAS12_SHOTGUN:
case WEAPONTYPE_STUBBY_SHOTGUN:
CBulletTraces::AddTrace(start, end, 0.7f, 1000, 200);
break;
case WEAPONTYPE_M4:
case WEAPONTYPE_RUGER:
case WEAPONTYPE_SNIPERRIFLE:
case WEAPONTYPE_LASERSCOPE:
case WEAPONTYPE_M60:
case WEAPONTYPE_MINIGUN:
case WEAPONTYPE_HELICANNON:
CBulletTraces::AddTrace(start, end, 1.0f, 2000, 220);
break;
default:
CBulletTraces::AddTrace(start, end, 0.4f, 750, 150);
break;
} }
if (index == NUMBULLETTRACES)
return;
aTraces[index].m_vecCurrentPos = *vecStart;
aTraces[index].m_vecTargetPos = *vecTarget;
aTraces[index].m_bInUse = true;
aTraces[index].m_framesInUse = 0;
aTraces[index].m_lifeTime = 25 + CGeneral::GetRandomNumber() % 32;
} }
void CBulletTraces::Render(void) void CBulletTraces::Render(void)
{ {
// for (int i = 0; i < NUMBULLETTRACES; i++) { for (int i = 0; i < NUMBULLETTRACES; i++) {
// if (!aTraces[i].m_bInUse) if (!aTraces[i].m_bInUse)
// continue; continue;
// RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
//#ifdef FIX_BUGS RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
// // Raster has no transparent pixels so it relies on the raster format having alpha RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
// // to turn on blending. librw image conversion might get rid of it right now so let's RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpSmokeTrailTexture));
// // just force it on.
// RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE); float nTimeOfLiving = CTimer::GetTimeInMilliseconds() - aTraces[i].m_nCreationTime;
//#endif
// RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE); float traceThicknes = aTraces[i].m_fThicknes * nTimeOfLiving / aTraces[i].m_nLifeTime;
// RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); CVector vecOffset = aTraces[i].m_vecTargetPos - aTraces[i].m_vecCurrentPos;
// RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpShadowExplosionTex)); vecOffset.Normalise();
// CVector inf = aTraces[i].m_vecCurrentPos; vecOffset *= traceThicknes;
// CVector sup = aTraces[i].m_vecTargetPos; uint8 nAlphaValue = aTraces[i].m_fVisibility * (aTraces[i].m_nLifeTime - nTimeOfLiving) / aTraces[i].m_nLifeTime;
// CVector center = (inf + sup) / 2;
// CVector width = CrossProduct(TheCamera.GetForward(), (sup - inf)); CVector currentPos = aTraces[i].m_vecCurrentPos;
// width.Normalise(); CVector targetPos = aTraces[i].m_vecTargetPos;
// width /= 20; float dotProdCur = DotProduct(currentPos - TheCamera.GetPosition(), TheCamera.GetForward()) - 0.7f;
// uint8 intensity = aTraces[i].m_lifeTime; float dotProdTar = DotProduct(targetPos - TheCamera.GetPosition(), TheCamera.GetForward()) - 0.7f;
// for (int i = 0; i < ARRAY_SIZE(TraceVertices); i++) if (dotProdCur >= 0.0f || dotProdTar >= 0.0f) {
// RwIm3DVertexSetRGBA(&TraceVertices[i], intensity, intensity, intensity, 0xFF); if (dotProdCur < 0.0f) {
// RwIm3DVertexSetPos(&TraceVertices[0], inf.x + width.x, inf.y + width.y, inf.z + width.z); float absDotProdCur = Abs(dotProdCur);
// RwIm3DVertexSetPos(&TraceVertices[1], inf.x - width.x, inf.y - width.y, inf.z - width.z); float absDotProdTar = Abs(dotProdTar);
// RwIm3DVertexSetPos(&TraceVertices[2], center.x + width.x, center.y + width.y, center.z + width.z); currentPos = (absDotProdTar * currentPos + absDotProdCur * targetPos) / (absDotProdCur + absDotProdTar);
// RwIm3DVertexSetPos(&TraceVertices[3], center.x - width.x, center.y - width.y, center.z - width.z); } else if (dotProdTar < 0.0f){
// RwIm3DVertexSetPos(&TraceVertices[4], sup.x + width.x, sup.y + width.y, sup.z + width.z); float absDotProdCur = Abs(dotProdCur);
// RwIm3DVertexSetPos(&TraceVertices[5], sup.x - width.x, sup.y - width.y, sup.z - width.z); float absDotProdTar = Abs(dotProdTar);
// LittleTest(); targetPos = (absDotProdTar * currentPos + absDotProdCur * targetPos) / (absDotProdCur + absDotProdTar);
// if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) { }
// RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList)); RwIm3DVertexSetV(&TraceVertices[5], 10.0f);
// RwIm3DEnd(); RwIm3DVertexSetV(&TraceVertices[6], 10.0f);
// } RwIm3DVertexSetV(&TraceVertices[7], 10.0f);
// } RwIm3DVertexSetV(&TraceVertices[8], 10.0f);
// RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwIm3DVertexSetV(&TraceVertices[9], 10.0f);
// RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
// RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwIm3DVertexSetRGBA(&TraceVertices[0], 255, 255, 255, nAlphaValue);
RwIm3DVertexSetRGBA(&TraceVertices[1], 255, 255, 255, nAlphaValue);
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 targetPos2 = (7.0f * targetPos + currentPos) / 8;
RwIm3DVertexSetPos(&TraceVertices[0], currentPos2.x, currentPos2.y, currentPos2.z);
RwIm3DVertexSetPos(&TraceVertices[1], currentPos2.x, currentPos2.y, currentPos2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[2], currentPos2.x + vecOffset.y, currentPos2.y - vecOffset.x, currentPos2.z);
RwIm3DVertexSetPos(&TraceVertices[3], currentPos2.x, currentPos2.y, currentPos2.z - traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[4], currentPos2.x - vecOffset.y, currentPos2.y - vecOffset.y, currentPos2.z);
RwIm3DVertexSetPos(&TraceVertices[5], targetPos2.x, targetPos2.y, targetPos2.z);
RwIm3DVertexSetPos(&TraceVertices[6], targetPos2.x, targetPos2.y, targetPos2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[7], targetPos2.x + vecOffset.y, targetPos2.y - vecOffset.x, targetPos2.z);
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)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DEnd();
}
RwIm3DVertexSetV(&TraceVertices[5], 2.0f);
RwIm3DVertexSetV(&TraceVertices[6], 2.0f);
RwIm3DVertexSetV(&TraceVertices[7], 2.0f);
RwIm3DVertexSetV(&TraceVertices[8], 2.0f);
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);
RwIm3DVertexSetPos(&TraceVertices[0], currentPos.x, currentPos.y, currentPos.z);
RwIm3DVertexSetPos(&TraceVertices[1], currentPos.x, currentPos.y, currentPos.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[2], currentPos.x + vecOffset.y, currentPos.y - vecOffset.x, currentPos.z);
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);
RwIm3DVertexSetPos(&TraceVertices[6], currentPos2.x, currentPos2.y, currentPos2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[7], currentPos2.x + vecOffset.y, currentPos2.y - vecOffset.x, currentPos2.z);
RwIm3DVertexSetPos(&TraceVertices[8], currentPos2.x, currentPos2.y, currentPos2.z - traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[9], currentPos2.x - vecOffset.y, currentPos2.y - vecOffset.y, currentPos2.z);
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DEnd();
}
RwIm3DVertexSetPos(&TraceVertices[1], targetPos.x, targetPos.y, targetPos.z);
RwIm3DVertexSetPos(&TraceVertices[2], targetPos.x, targetPos.y, targetPos.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[3], targetPos.x + vecOffset.y, targetPos.y - vecOffset.x, targetPos.z);
RwIm3DVertexSetPos(&TraceVertices[4], targetPos.x, targetPos.y, targetPos.z - traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[5], targetPos.x - vecOffset.y, targetPos.y - vecOffset.y, targetPos.z);
RwIm3DVertexSetPos(&TraceVertices[5], targetPos2.x, targetPos2.y, targetPos2.z);
RwIm3DVertexSetPos(&TraceVertices[6], targetPos2.x, targetPos2.y, targetPos2.z + traceThicknes);
RwIm3DVertexSetPos(&TraceVertices[7], targetPos2.x + vecOffset.y, targetPos2.y - vecOffset.x, targetPos2.z);
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)) {
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
RwIm3DEnd();
}
}
}
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
} }
void CBulletTraces::Update(void) void CBulletTraces::Update(void)
@ -563,7 +762,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); CCoronas::TYPE_STAR, CCoronas::FLARE_NONE, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_ON, 0.0f, false, 1.5f);
} }
} }
NumActiveMarkers++; NumActiveMarkers++;

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
//done
class CSpecialFX class CSpecialFX
{ {
public: public:
@ -12,10 +13,11 @@ public:
static void Update(void); //done static void Update(void); //done
static void Init(void); //done static void Init(void); //done
static void Shutdown(void); //done static void Shutdown(void); //done
static void AddWeaponStreak(int type); static void AddWeaponStreak(int type); //done
static void Render2DFXs(); //done static void Render2DFXs(); //done
}; };
//done
class CRegisteredMotionBlurStreak class CRegisteredMotionBlurStreak
{ {
public: public:
@ -28,19 +30,21 @@ public:
bool m_isValid[3]; bool m_isValid[3];
void Update(void); //done void Update(void); //done
void Render(void); void Render(void); //done
}; };
//done
class CMotionBlurStreaks class CMotionBlurStreaks
{ {
static CRegisteredMotionBlurStreak aStreaks[NUMMBLURSTREAKS]; static CRegisteredMotionBlurStreak aStreaks[NUMMBLURSTREAKS];
public: public:
static void Init(void); static void Init(void); //done
static void Update(void); //done static void Update(void); //done
static void RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2); static void RegisterStreak(uintptr id, uint8 r, uint8 g, uint8 b, CVector p1, CVector p2); //done
static void Render(void); static void Render(void); //done
}; };
//done
struct CBulletTrace struct CBulletTrace
{ {
CVector m_vecCurrentPos; CVector m_vecCurrentPos;
@ -48,31 +52,23 @@ struct CBulletTrace
bool m_bInUse; bool m_bInUse;
uint32 m_nCreationTime; uint32 m_nCreationTime;
uint32 m_nLifeTime; uint32 m_nLifeTime;
uint32 field_24; float m_fThicknes;
uint8 field_28; uint8 m_fVisibility;
uint8 m_framesInUse;
uint8 m_lifeTime;
void Update(void); //done void Update(void); //done
}; };
//done
class CBulletTraces class CBulletTraces
{ {
public: public:
static CBulletTrace aTraces[NUMBULLETTRACES]; static CBulletTrace aTraces[NUMBULLETTRACES];
static void Init(void); static void Init(void); //done
static void AddTrace(CVector*, CVector*); static void Render(void); //done
static void Render(void);
static void Update(void); //done static void Update(void); //done
static void AddTrace(CVector* start, CVector* end, float thickness, uint32 lifeTime, uint8 visibility); //done
//TODO(MIAMI) static void AddTrace(CVector* start, CVector* end, int32 weaponType, class CEntity* shooter); //done
static void AddTrace(CVector *, CVector *, float, unsigned int, unsigned char) {}
static void AddTrace(CVector *a, CVector *b, int32 weapontype, class CEntity *shooter)
{
AddTrace(a, b); //TODO: temp
}
}; };
enum enum
@ -87,7 +83,7 @@ enum
MARKERTYPE_INVALID = 0x101 MARKERTYPE_INVALID = 0x101
}; };
//done
class C3dMarker class C3dMarker
{ {
public: public:
@ -108,20 +104,20 @@ public:
float m_fBrightness; float m_fBrightness;
float m_fCameraRange; float m_fCameraRange;
bool AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); bool AddMarker(uint32 identifier, uint16 type, float fSize, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); //done
void DeleteMarkerObject(); void DeleteMarkerObject(); //done
void Render(); void Render(); //done
}; };
class C3dMarkers class C3dMarkers
{ {
public: public:
static void Init(); static void Init(); //done
static void Shutdown(); static void Shutdown(); //done
static C3dMarker *PlaceMarker(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); static C3dMarker *PlaceMarker(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate);
static void PlaceMarkerSet(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); static void PlaceMarkerSet(uint32 id, uint16 type, CVector &pos, float size, uint8 r, uint8 g, uint8 b, uint8 a, uint16 pulsePeriod, float pulseFraction, int16 rotateRate); //done
static void Render(); static void Render(); //done
static void Update(); static void Update(); //done
static C3dMarker m_aMarkerArray[NUM3DMARKERS]; static C3dMarker m_aMarkerArray[NUM3DMARKERS];
static int32 NumActiveMarkers; static int32 NumActiveMarkers;
@ -153,6 +149,7 @@ enum
BRIGHTLIGHT_REAR = BRIGHTLIGHT_REAR_LONG, BRIGHTLIGHT_REAR = BRIGHTLIGHT_REAR_LONG,
}; };
//done
class CBrightLight class CBrightLight
{ {
public: public:
@ -172,11 +169,11 @@ class CBrightLights
static int NumBrightLights; static int NumBrightLights;
static CBrightLight aBrightLights[NUMBRIGHTLIGHTS]; static CBrightLight aBrightLights[NUMBRIGHTLIGHTS];
public: public:
static void Init(void); static void Init(void); //done
static void RegisterOne(CVector pos, CVector up, CVector side, CVector front, static void RegisterOne(CVector pos, CVector up, CVector side, CVector front,
uint8 type, uint8 red = 0, uint8 green = 0, uint8 blue = 0); uint8 type, uint8 red = 0, uint8 green = 0, uint8 blue = 0); //done
static void Render(void); static void Render(void); //looks similad but needs recheck
static void RenderOutGeometryBuffer(void); static void RenderOutGeometryBuffer(void); //done
}; };
@ -186,6 +183,7 @@ enum
SHINYTEXT_FLAT SHINYTEXT_FLAT
}; };
//done
class CShinyText class CShinyText
{ {
public: public:
@ -198,19 +196,21 @@ public:
uint8 m_blue; uint8 m_blue;
}; };
class CShinyTexts //done
class CShinyTexts
{ {
static int NumShinyTexts; static int NumShinyTexts;
static CShinyText aShinyTexts[NUMSHINYTEXTS]; static CShinyText aShinyTexts[NUMSHINYTEXTS];
public: public:
static void Init(void); static void Init(void); //done
static void RegisterOne(CVector p0, CVector p1, CVector p2, CVector p3, static void RegisterOne(CVector p0, CVector p1, CVector p2, CVector p3,
float u0, float v0, float u1, float v1, float u2, float v2, float u3, float v3, float u0, float v0, float u1, float v1, float u2, float v2, float u3, float v3,
uint8 type, uint8 red, uint8 green, uint8 blue, float maxDist); uint8 type, uint8 red, uint8 green, uint8 blue, float maxDist); //done, not used
static void Render(void); static void Render(void); //done
static void RenderOutGeometryBuffer(void); static void RenderOutGeometryBuffer(void); //done
}; };
//done
class CMoneyMessage class CMoneyMessage
{ {
friend class CMoneyMessages; friend class CMoneyMessages;
@ -225,13 +225,14 @@ public:
void Render(); //done void Render(); //done
}; };
//done
class CMoneyMessages class CMoneyMessages
{ {
static CMoneyMessage aMoneyMessages[NUMMONEYMESSAGES]; static CMoneyMessage aMoneyMessages[NUMMONEYMESSAGES];
public: public:
static void Init(); static void Init(); //done
static void Render(); //done static void Render(); //done
static void RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 bGreen, uint8 bBlue, float fSize, float fOpacity); static void RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 bGreen, uint8 bBlue, float fSize, float fOpacity); //done
}; };
class CSpecialParticleStuff class CSpecialParticleStuff