bullet traces fixes
This commit is contained in:
parent
65e8558794
commit
7d213a1f32
@ -280,7 +280,7 @@ void CReplay::RecordThisFrame(void)
|
|||||||
}
|
}
|
||||||
memory_required += sizeof(tPedUpdatePacket);
|
memory_required += sizeof(tPedUpdatePacket);
|
||||||
}
|
}
|
||||||
for (uint8 i = 0; i < CBulletTraces::NUM_BULLET_TRACES; i++) {
|
for (uint8 i = 0; i < NUMBULLETTRACES; i++) {
|
||||||
if (!CBulletTraces::aTraces[i].m_bInUse)
|
if (!CBulletTraces::aTraces[i].m_bInUse)
|
||||||
continue;
|
continue;
|
||||||
memory_required += sizeof(tBulletTracePacket);
|
memory_required += sizeof(tBulletTracePacket);
|
||||||
@ -340,7 +340,7 @@ void CReplay::RecordThisFrame(void)
|
|||||||
}
|
}
|
||||||
StorePedUpdate(p, i);
|
StorePedUpdate(p, i);
|
||||||
}
|
}
|
||||||
for (uint8 i = 0; i < CBulletTraces::NUM_BULLET_TRACES; i++){
|
for (uint8 i = 0; i < NUMBULLETTRACES; i++){
|
||||||
if (!CBulletTraces::aTraces[i].m_bInUse)
|
if (!CBulletTraces::aTraces[i].m_bInUse)
|
||||||
continue;
|
continue;
|
||||||
tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset];
|
tBulletTracePacket* bt = (tBulletTracePacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
|
@ -73,6 +73,7 @@ enum Config {
|
|||||||
NUM3DMARKERS = 32,
|
NUM3DMARKERS = 32,
|
||||||
NUMMONEYMESSAGES = 16,
|
NUMMONEYMESSAGES = 16,
|
||||||
NUMPICKUPMESSAGES = 16,
|
NUMPICKUPMESSAGES = 16,
|
||||||
|
NUMBULLETTRACES = 16,
|
||||||
|
|
||||||
NUMONSCREENTIMERENTRIES = 1,
|
NUMONSCREENTIMERENTRIES = 1,
|
||||||
NUMRADARBLIPS = 32,
|
NUMRADARBLIPS = 32,
|
||||||
|
@ -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); }
|
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;
|
RxObjSpace3DVertex (&TraceVertices)[6] = *(RxObjSpace3DVertex(*)[6])*(uintptr*)0x649884;
|
||||||
RwImVertexIndex (&TraceIndexList)[12] = *(RwImVertexIndex(*)[12])*(uintptr*)0x64986C;
|
RwImVertexIndex (&TraceIndexList)[12] = *(RwImVertexIndex(*)[12])*(uintptr*)0x64986C;
|
||||||
|
|
||||||
void CBulletTraces::Init(void)
|
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;
|
aTraces[i].m_bInUse = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBulletTraces::AddTrace(CVector* vecStart, CVector* vecTarget)
|
void CBulletTraces::AddTrace(CVector* vecStart, CVector* vecTarget)
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
for (index = 0; index < NUM_BULLET_TRACES; index++) {
|
for (index = 0; index < NUMBULLETTRACES; index++) {
|
||||||
if (!aTraces[index].m_bInUse)
|
if (!aTraces[index].m_bInUse)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (index == NUM_BULLET_TRACES)
|
if (index == NUMBULLETTRACES)
|
||||||
return;
|
return;
|
||||||
aTraces[index].m_vecCurrentPos = *vecStart;
|
aTraces[index].m_vecCurrentPos = *vecStart;
|
||||||
aTraces[index].m_vecTargetPos = *vecTarget;
|
aTraces[index].m_vecTargetPos = *vecTarget;
|
||||||
@ -51,7 +51,7 @@ void CBulletTraces::AddTrace(CVector* vecStart, CVector* vecTarget)
|
|||||||
|
|
||||||
void CBulletTraces::Render(void)
|
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)
|
if (!aTraces[i].m_bInUse)
|
||||||
continue;
|
continue;
|
||||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)0);
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)0);
|
||||||
@ -61,24 +61,18 @@ void CBulletTraces::Render(void)
|
|||||||
CVector inf = aTraces[i].m_vecCurrentPos;
|
CVector inf = aTraces[i].m_vecCurrentPos;
|
||||||
CVector sup = aTraces[i].m_vecTargetPos;
|
CVector sup = aTraces[i].m_vecTargetPos;
|
||||||
CVector center = (inf + sup) / 2;
|
CVector center = (inf + sup) / 2;
|
||||||
CVector screenPos = CrossProduct(TheCamera.GetForward(), (sup - inf));
|
CVector width = CrossProduct(TheCamera.GetForward(), (sup - inf));
|
||||||
screenPos.Normalise();
|
width.Normalise();
|
||||||
screenPos /= 20;
|
width /= 20;
|
||||||
uint8 intensity = aTraces[i].m_lifeTime;
|
uint8 intensity = aTraces[i].m_lifeTime;
|
||||||
uint32 color = 0xFF << 24 | intensity << 16 | intensity << 8 | intensity;
|
for (int i = 0; i < ARRAY_SIZE(TraceVertices); i++)
|
||||||
TraceVertices[0].color = color;
|
RwIm3DVertexSetRGBA(&TraceVertices[i], intensity, intensity, intensity, 0xFF);
|
||||||
TraceVertices[1].color = color;
|
RwIm3DVertexSetPos(&TraceVertices[0], inf.x + width.x, inf.y + width.y, inf.z + width.z);
|
||||||
TraceVertices[2].color = color;
|
RwIm3DVertexSetPos(&TraceVertices[1], inf.x - width.x, inf.y - width.y, inf.z - width.z);
|
||||||
TraceVertices[3].color = color;
|
RwIm3DVertexSetPos(&TraceVertices[2], center.x + width.x, center.y + width.y, center.z + width.z);
|
||||||
TraceVertices[4].color = color;
|
RwIm3DVertexSetPos(&TraceVertices[3], center.x - width.x, center.y - width.y, center.z - width.z);
|
||||||
TraceVertices[5].color = color;
|
RwIm3DVertexSetPos(&TraceVertices[4], sup.x + width.x, sup.y + width.y, sup.z + width.z);
|
||||||
// cast to satisfy compiler
|
RwIm3DVertexSetPos(&TraceVertices[5], sup.x - width.x, sup.y - width.y, sup.z - width.z);
|
||||||
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);
|
|
||||||
LittleTest();
|
LittleTest();
|
||||||
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) {
|
if (RwIm3DTransform(TraceVertices, ARRAY_SIZE(TraceVertices), nil, 1)) {
|
||||||
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
|
RwIm3DRenderIndexedPrimitive(rwPRIMTYPETRILIST, TraceIndexList, ARRAY_SIZE(TraceIndexList));
|
||||||
@ -92,7 +86,7 @@ void CBulletTraces::Render(void)
|
|||||||
|
|
||||||
void CBulletTraces::Update(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)
|
if (aTraces[i].m_bInUse)
|
||||||
aTraces[i].Update();
|
aTraces[i].Update();
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,7 @@ struct CBulletTrace
|
|||||||
class CBulletTraces
|
class CBulletTraces
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {
|
static CBulletTrace (&aTraces)[NUMBULLETTRACES];
|
||||||
NUM_BULLET_TRACES = 16
|
|
||||||
};
|
|
||||||
static CBulletTrace (&aTraces)[NUM_BULLET_TRACES];
|
|
||||||
|
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
static void AddTrace(CVector*, CVector*);
|
static void AddTrace(CVector*, CVector*);
|
||||||
|
Loading…
Reference in New Issue
Block a user