diff --git a/include/JSystem/JGeometry.h b/include/JSystem/JGeometry.h index 3eb947076..dfba4f38a 100644 --- a/include/JSystem/JGeometry.h +++ b/include/JSystem/JGeometry.h @@ -273,19 +273,19 @@ struct TVec2 { this->y = y; } - void set(const TVec2& other) { + void set(const TVec2& other) { x = other.x; y = other.y; } - void setMin(const TVec2& min) { + void setMin(const TVec2& min) { if (x >= min.x) x = min.x; if (y >= min.y) y = min.y; } - void setMax(const TVec2& max) { + void setMax(const TVec2& max) { if (x <= max.x) x = max.x; if (y <= max.y) @@ -301,17 +301,17 @@ struct TVec2 { return (x >= other.x) && (y >= other.y) ? true : false; } - f32 dot(const TVec2& other) { + T dot(const TVec2& other) { return x * other.x + y * other.y; } - f32 squared() { + T squared() { return dot(*this); } - f32 length() { - f32 sqr = squared(); - return TUtil::sqrt(sqr); + T length() { + T sqr = squared(); + return TUtil::sqrt(sqr); } T x; diff --git a/src/JSystem/JParticle/JPADraw.cpp b/src/JSystem/JParticle/JPADraw.cpp index 03d300f06..ddae07461 100644 --- a/src/JSystem/JParticle/JPADraw.cpp +++ b/src/JSystem/JParticle/JPADraw.cpp @@ -809,7 +809,6 @@ void JPADraw::setChildClipBoard() { /* 8026B938-8026BC2C .text drawParticle__7JPADrawFv */ void JPADraw::drawParticle() { - /* Nonmatching - regalloc */ field_0xc2 &= ~0x02; setParticleClipBoard(); dc.mpActiveParticles = &dc.pbe->mActiveParticles; @@ -831,15 +830,15 @@ void JPADraw::drawParticle() { for (s32 i = 0; i < execEmtrPVisNum; i++) mpExecEmtrPVis[i]->exec(&dc); - JPABaseEmitter * emtr = dc.pbe; + JSUList * activeParticles = &dc.pbe->mActiveParticles; if (dc.pbsp->getListOrder() == 0) { - for (JSULink * link = emtr->mActiveParticles.getFirst(); link != NULL; link = link->getNext()) { + for (JSULink * link = activeParticles->getFirst(); link != NULL; link = link->getNext()) { JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execPtclVisNum; i++) mpExecPtclVis[i]->exec(&dc, ptcl); } } else { - for (JSULink * link = emtr->mActiveParticles.getLast(); link != NULL; link = link->getPrev()) { + for (JSULink * link = activeParticles->getLast(); link != NULL; link = link->getPrev()) { JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execPtclVisNum; i++) mpExecPtclVis[i]->exec(&dc, ptcl); @@ -851,7 +850,6 @@ void JPADraw::drawParticle() { /* 8026BC2C-8026BF88 .text drawChild__7JPADrawFv */ void JPADraw::drawChild() { - /* Nonmatching - regalloc */ field_0xc2 |= 0x02; setChildClipBoard(); dc.mpActiveParticles = &dc.pbe->mChildParticles; @@ -881,16 +879,16 @@ void JPADraw::drawChild() { for (s32 i = 0; i < execEmtrCVisNum; i++) mpExecEmtrCVis[i]->exec(&dc); - JPABaseEmitter * emtr = dc.pbe; + JSUList * childParticles = &dc.pbe->mChildParticles; if (dc.pbsp->getListOrder() == 0) { - for (JSULink * link = emtr->mChildParticles.getFirst(); link != NULL; link = link->getNext()) { - JPABaseParticle * ptcl = link->getObject(); + for (JSULink * link = childParticles->getFirst(); link != NULL; link = link->getNext()) { + JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execChldVisNum; i++) mpExecChldVis[i]->exec(&dc, ptcl); } } else { - for (JSULink * link = emtr->mChildParticles.getLast(); link != NULL; link = link->getPrev()) { - JPABaseParticle * ptcl = link->getObject(); + for (JSULink * link = childParticles->getLast(); link != NULL; link = link->getPrev()) { + JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execChldVisNum; i++) mpExecChldVis[i]->exec(&dc, ptcl); } @@ -911,7 +909,6 @@ void JPADraw::zDraw() { /* 8026C024-8026C24C .text zDrawParticle__7JPADrawFv */ void JPADraw::zDrawParticle() { - /* Nonmatching - regalloc */ field_0xc2 &= ~0x02; setParticleClipBoard(); dc.mpActiveParticles = &dc.pbe->mActiveParticles; @@ -933,15 +930,15 @@ void JPADraw::zDrawParticle() { for (s32 i = 0; i < execEmtrPVisNum; i++) mpExecEmtrPVis[i]->exec(&dc); - JPABaseEmitter * emtr = dc.pbe; + JSUList * activeParticles = &dc.pbe->mActiveParticles; if (dc.pbsp->getListOrder() == 0) { - for (JSULink * link = emtr->mActiveParticles.getFirst(); link != NULL; link = link->getNext()) { + for (JSULink * link = activeParticles->getFirst(); link != NULL; link = link->getNext()) { JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execPtclVisNum; i++) mpExecPtclVis[i]->exec(&dc, ptcl); } } else { - for (JSULink * link = emtr->mActiveParticles.getLast(); link != NULL; link = link->getPrev()) { + for (JSULink * link = activeParticles->getLast(); link != NULL; link = link->getPrev()) { JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execPtclVisNum; i++) mpExecPtclVis[i]->exec(&dc, ptcl); @@ -953,7 +950,6 @@ void JPADraw::zDrawParticle() { /* 8026C24C-8026C4DC .text zDrawChild__7JPADrawFv */ void JPADraw::zDrawChild() { - /* Nonmatching - regalloc */ field_0xc2 |= 0x02; setChildClipBoard(); dc.mpActiveParticles = &dc.pbe->mChildParticles; @@ -983,15 +979,15 @@ void JPADraw::zDrawChild() { for (s32 i = 0; i < execEmtrCVisNum; i++) mpExecEmtrCVis[i]->exec(&dc); - JPABaseEmitter * emtr = dc.pbe; + JSUList * childParticles = &dc.pbe->mChildParticles; if (dc.pbsp->getListOrder() == 0) { - for (JSULink * link = emtr->mChildParticles.getFirst(); link != NULL; link = link->getNext()) { + for (JSULink * link = childParticles->getFirst(); link != NULL; link = link->getNext()) { JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execChldVisNum; i++) mpExecChldVis[i]->exec(&dc, ptcl); } } else { - for (JSULink * link = emtr->mChildParticles.getLast(); link != NULL; link = link->getPrev()) { + for (JSULink * link = childParticles->getLast(); link != NULL; link = link->getPrev()) { JPABaseParticle * ptcl = (JPABaseParticle*)link->getObject(); for (s32 i = 0; i < execChldVisNum; i++) mpExecChldVis[i]->exec(&dc, ptcl); @@ -1003,8 +999,10 @@ void JPADraw::zDrawChild() { /* 8026C4DC-8026C640 .text loadYBBMtx__7JPADrawFPA4_f */ void JPADraw::loadYBBMtx(MtxP mtx) { - /* Nonmatching */ - JGeometry::TVec3 v(0.0f, mtx[1][1], mtx[2][1]); + JGeometry::TVec3 v; + v.x = 0.0f; + v.y = mtx[1][1]; + v.z = mtx[2][1]; JUT_ASSERT(0x596, !v.isZero()); v.normalize(); @@ -1018,7 +1016,7 @@ void JPADraw::loadYBBMtx(MtxP mtx) { cb.mDrawYBBMtx[1][2] = -v.z; cb.mDrawYBBMtx[1][3] = mtx[1][3]; - cb.mDrawYBBMtx[2][0] = 1.0f; + cb.mDrawYBBMtx[2][0] = 0.0f; cb.mDrawYBBMtx[2][1] = v.z; cb.mDrawYBBMtx[2][2] = v.y; cb.mDrawYBBMtx[2][3] = mtx[2][3];