summaryrefslogtreecommitdiff
path: root/libs/JSystem/J2DGraph/J2DPane.cpp
diff options
context:
space:
mode:
authorTakaRikka <38417346+TakaRikka@users.noreply.github.com>2022-08-30 14:22:17 -0700
committerGitHub <noreply@github.com>2022-08-30 15:22:17 -0600
commitf8979749e3ef8e8cacf2ea8f474c7f23fc5cb6b3 (patch)
tree69659df2105266e9b26a4d50b9a2d610b3e437a2 /libs/JSystem/J2DGraph/J2DPane.cpp
parentbc30d007e11458a198c5725626a10bb06a5da536 (diff)
j2d / map_path work, d_drawlist / d_attention cleanup (#208)
* work on fop actor / actor mng, daalink, d_a_obj_item * d_a_title mostly decompiled * daalink / d_event / JMessage / dmsg_out_font work * msg_scrn_base / msg_scrn_boss * some work on mDo machine, d_menu_save, d_tresure, and various * remove asm * progress * finish d_menu_save / d_pane_class_alpha / d_pane_class / rename some data * rename more data * remove asm / progress * match all of d_pane_class * fixes / some dKankyo doc * bunch of j2d work. d_drawlist / d_attention cleanup * progress / asm * cleanup wip * decompile JStage * setup some more JStudio structs * set up d_demo classes * some d_demo work * cleanup dolphin os stuff * some initial dEvent documentation * some At collision documentation * match JUTConsole::doDraw * dbgs work / split up some of d_a_alink into .inc files * d_a_alink_spinner work
Diffstat (limited to 'libs/JSystem/J2DGraph/J2DPane.cpp')
-rw-r--r--libs/JSystem/J2DGraph/J2DPane.cpp477
1 files changed, 260 insertions, 217 deletions
diff --git a/libs/JSystem/J2DGraph/J2DPane.cpp b/libs/JSystem/J2DGraph/J2DPane.cpp
index c0705539b3..caf72f13b4 100644
--- a/libs/JSystem/J2DGraph/J2DPane.cpp
+++ b/libs/JSystem/J2DGraph/J2DPane.cpp
@@ -12,14 +12,10 @@
#include "dol2asm.h"
#include "dolphin/types.h"
-//
-// Declarations:
-//
-
/* 802F5BF8-802F5CB8 2F0538 00C0+00 0/0 10/10 0/0 .text __ct__7J2DPaneFv */
J2DPane::J2DPane() : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) {
mTransform = NULL;
- id = 'PAN1';
+ mKind = 'PAN1';
mVisible = true;
mInfoTag = 0;
mUserInfoTag = 0;
@@ -31,15 +27,15 @@ J2DPane::J2DPane() : mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) {
/* 802F5CB8-802F5D40 2F05F8 0088+00 3/3 0/0 0/0 .text initiate__7J2DPaneFv */
void J2DPane::initiate() {
- _4 = -1;
+ field_0x4 = -1;
mRotateOffsetY = mRotateOffsetX = mRotateZ = mRotateY = mRotateX = 0;
mBasePosition = 0;
mRotAxis = ROTATE_Z;
mScaleY = mScaleX = 1;
mCullMode = GX_CULL_NONE;
- mAlpha = 0xFF;
+ mAlpha = 255;
mIsInfluencedAlpha = true;
- mColorAlpha = 0xFF;
+ mColorAlpha = 255;
mConnected = false;
calcMtx();
@@ -47,44 +43,45 @@ void J2DPane::initiate() {
/* 802F5D40-802F5DD0 2F0680 0090+00 0/0 1/1 0/0 .text
* __ct__7J2DPaneFP7J2DPanebUxRCQ29JGeometry8TBox2<f> */
-J2DPane::J2DPane(J2DPane* param_0, bool param_1, u64 tag, JGeometry::TBox2<f32> const& box)
+J2DPane::J2DPane(J2DPane* p_pane, bool visible, u64 tag, JGeometry::TBox2<f32> const& bounds)
: mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) {
mTransform = NULL;
- this->initialize(param_0, param_1, tag, box);
+ initialize(p_pane, visible, tag, bounds);
}
/* 802F5DD0-802F5E88 2F0710 00B8+00 1/1 0/0 0/0 .text
* initialize__7J2DPaneFP7J2DPanebUxRCQ29JGeometry8TBox2<f> */
-void J2DPane::initialize(J2DPane* pane, bool visible, u64 infoTag,
- JGeometry::TBox2<f32> const& box) {
- id = 'PAN1';
+void J2DPane::initialize(J2DPane* p_pane, bool visible, u64 infoTag,
+ JGeometry::TBox2<f32> const& bounds) {
+ mKind = 'PAN1';
mVisible = visible;
mInfoTag = infoTag;
mUserInfoTag = 0;
- mBounds.set(box);
- if (pane != NULL) {
- pane->mPaneTree.appendChild(&this->mPaneTree);
+ mBounds.set(bounds);
+ if (p_pane != NULL) {
+ p_pane->mPaneTree.appendChild(&mPaneTree);
}
- this->initiate();
- this->changeUseTrans(pane);
- this->calcMtx();
+
+ initiate();
+ changeUseTrans(p_pane);
+ calcMtx();
}
/* 802F5E88-802F5F08 2F07C8 0080+00 0/0 3/3 0/0 .text __ct__7J2DPaneFUxRCQ29JGeometry8TBox2<f> */
-J2DPane::J2DPane(u64 infoTag, JGeometry::TBox2<f32> const& box)
+J2DPane::J2DPane(u64 infoTag, JGeometry::TBox2<f32> const& bounds)
: mBounds(), mGlobalBounds(), mClipRect(), mPaneTree(this) {
mTransform = NULL;
- this->initialize(infoTag, box);
+ initialize(infoTag, bounds);
}
/* 802F5F08-802F5F9C 2F0848 0094+00 1/1 0/0 0/0 .text
* initialize__7J2DPaneFUxRCQ29JGeometry8TBox2<f> */
-void J2DPane::initialize(u64 tag, const JGeometry::TBox2<f32>& dim) {
- id = 'PAN1';
+void J2DPane::initialize(u64 tag, const JGeometry::TBox2<f32>& bounds) {
+ mKind = 'PAN1';
mVisible = true;
mInfoTag = tag;
mUserInfoTag = 0;
- mBounds.set(dim);
+ mBounds.set(bounds);
initiate();
changeUseTrans(NULL);
calcMtx();
@@ -92,83 +89,93 @@ void J2DPane::initialize(u64 tag, const JGeometry::TBox2<f32>& dim) {
/* 802F5F9C-802F60C4 2F08DC 0128+00 0/0 1/1 0/0 .text
* __ct__7J2DPaneFP7J2DPaneP20JSURandomInputStreamUc */
-J2DPane::J2DPane(J2DPane* pane, JSURandomInputStream* inputStream, u8 isEx) : mPaneTree(this) {
+J2DPane::J2DPane(J2DPane* p_pane, JSURandomInputStream* p_stream, u8 isEx) : mPaneTree(this) {
mTransform = NULL;
- if (isEx == 0) {
- s32 position = inputStream->getPosition();
- s32 buf[2];
- inputStream->read(&buf, sizeof(buf));
- id = buf[0];
- position += buf[1];
- this->makePaneStream(pane, inputStream);
- inputStream->seek(position, JSUStreamSeekFrom_SET);
+ if (!isEx) {
+ s32 position = p_stream->getPosition();
+
+ J2DPaneHeader header;
+ p_stream->read(&header, sizeof(header));
+ mKind = header.mKind;
+ position += header.mSize;
+ makePaneStream(p_pane, p_stream);
+ p_stream->seek(position, JSUStreamSeekFrom_SET);
} else {
- s32 position = inputStream->getPosition();
- s32 buf[2];
- inputStream->peek(&buf, sizeof(buf));
- id = buf[0];
- position += buf[1];
- this->makePaneExStream(pane, inputStream);
- inputStream->seek(position, JSUStreamSeekFrom_SET);
+ s32 position = p_stream->getPosition();
+
+ J2DPaneHeader header;
+ p_stream->peek(&header, sizeof(header));
+ mKind = header.mKind;
+ position += header.mSize;
+ makePaneExStream(p_pane, p_stream);
+ p_stream->seek(position, JSUStreamSeekFrom_SET);
}
}
/* 802F60C4-802F63F8 2F0A04 0334+00 1/1 3/3 0/0 .text
* makePaneStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream */
-void J2DPane::makePaneStream(J2DPane* pane, JSURandomInputStream* inputStream) {
+void J2DPane::makePaneStream(J2DPane* p_pane, JSURandomInputStream* p_stream) {
u8 unk;
- inputStream->read(&unk, 1);
- inputStream->read(&mVisible, 1);
- inputStream->skip(2);
- mInfoTag = inputStream->read32b();
- f32 x0 = inputStream->readS16();
- f32 y0 = inputStream->readS16();
- f32 x1 = x0 + inputStream->readS16();
- f32 y1 = y0 + inputStream->readS16();
+ p_stream->read(&unk, 1);
+ p_stream->read(&mVisible, 1);
+ p_stream->skip(2);
+
+ mInfoTag = p_stream->read32b();
+
+ f32 x0 = p_stream->readS16();
+ f32 y0 = p_stream->readS16();
+ f32 x1 = x0 + p_stream->readS16();
+ f32 y1 = y0 + p_stream->readS16();
mBounds.set(x0, y0, x1, y1);
+
unk -= 6;
mRotateX = 0;
mRotateY = 0;
mRotateZ = 0;
if (unk != 0) {
- mRotateZ = inputStream->readU16();
+ mRotateZ = p_stream->readU16();
unk--;
}
+
if (unk != 0) {
- mBasePosition = inputStream->readU8();
+ mBasePosition = p_stream->readU8();
unk--;
} else {
mBasePosition = 0;
}
mRotAxis = ROTATE_Z;
- mAlpha = 0xFF;
+
+ mAlpha = 255;
if (unk != 0) {
- mAlpha = inputStream->readU8();
+ mAlpha = p_stream->readU8();
unk--;
}
+
mIsInfluencedAlpha = true;
if (unk != 0) {
- mIsInfluencedAlpha = inputStream->readU8();
+ mIsInfluencedAlpha = p_stream->readU8();
unk--;
}
- inputStream->align(4);
- if (pane != NULL) {
- pane->mPaneTree.appendChild(&this->mPaneTree);
+
+ p_stream->align(4);
+ if (p_pane != NULL) {
+ p_pane->mPaneTree.appendChild(&mPaneTree);
}
+
mCullMode = GX_CULL_NONE;
- mColorAlpha = 0xFF;
+ mColorAlpha = 255;
mConnected = false;
- _4 = 0xFFFF;
+ field_0x4 = 0xFFFF;
mScaleX = 1;
mScaleY = 1;
mUserInfoTag = 0;
- this->changeUseTrans(pane);
- this->calcMtx();
+ changeUseTrans(p_pane);
+ calcMtx();
}
/* 802F63F8-802F658C 2F0D38 0194+00 4/4 0/0 0/0 .text changeUseTrans__7J2DPaneFP7J2DPane
*/
-void J2DPane::changeUseTrans(J2DPane* pane) {
+void J2DPane::changeUseTrans(J2DPane* p_pane) {
f32 xOffset = 0;
f32 yOffset = 0;
if (mBasePosition % 3 == 1) {
@@ -176,27 +183,34 @@ void J2DPane::changeUseTrans(J2DPane* pane) {
} else if (mBasePosition % 3 == 2) {
xOffset = mBounds.getWidth();
}
+
if (mBasePosition / 3 == 1) {
yOffset = mBounds.getHeight() / 2;
} else if (mBasePosition / 3 == 2) {
yOffset = mBounds.getHeight();
}
+
mTranslateX = mBounds.i.x + xOffset;
mTranslateY = mBounds.i.y + yOffset;
+
mRotateOffsetX = xOffset;
mRotateOffsetY = yOffset;
- f32 f1 = -mTranslateX;
- f32 f2 = -mTranslateY;
- mBounds.addPos(f1, f2);
- if (pane != NULL) {
- u8 otherBasePos = pane->mBasePosition;
- f32 width = pane->getWidth();
- f32 height = pane->getHeight();
+
+ f32 addX = -mTranslateX;
+ f32 addY = -mTranslateY;
+ mBounds.addPos(addX, addY);
+
+ if (p_pane != NULL) {
+ u8 otherBasePos = p_pane->mBasePosition;
+ f32 width = p_pane->getWidth();
+ f32 height = p_pane->getHeight();
+
if (otherBasePos % 3 == 1) {
mTranslateX -= width / 2;
} else if (otherBasePos % 3 == 2) {
mTranslateX -= width;
}
+
if (otherBasePos / 3 == 1) {
mTranslateY -= height / 2;
} else if (otherBasePos / 3 == 2) {
@@ -215,97 +229,107 @@ J2DPane::~J2DPane() {
}
/* 802F666C-802F6714 2F0FAC 00A8+00 0/0 2/2 0/0 .text appendChild__7J2DPaneFP7J2DPane */
-bool J2DPane::appendChild(J2DPane* pChild) {
- if (pChild == NULL)
+bool J2DPane::appendChild(J2DPane* p_child) {
+ if (p_child == NULL)
return false;
- const J2DPane* parent = pChild->getParentPane();
- bool result = mPaneTree.appendChild(&pChild->mPaneTree);
+ const J2DPane* parent = p_child->getParentPane();
+ bool result = mPaneTree.appendChild(&p_child->mPaneTree);
if (result && parent == NULL) {
- pChild->add(mBounds.i.x, mBounds.i.y);
- pChild->calcMtx();
+ p_child->add(mBounds.i.x, mBounds.i.y);
+ p_child->calcMtx();
}
return result;
}
/* 802F6714-802F67E0 2F1054 00CC+00 0/0 1/1 0/0 .text insertChild__7J2DPaneFP7J2DPaneP7J2DPane */
-bool J2DPane::insertChild(J2DPane* before, J2DPane* child) {
- if (child == NULL)
+bool J2DPane::insertChild(J2DPane* p_prev, J2DPane* p_child) {
+ if (p_child == NULL)
return false;
- const J2DPane* parent = child->getParentPane();
+ const J2DPane* parent = p_child->getParentPane();
bool result =
- mPaneTree.insertChild(before != NULL ? &before->mPaneTree : NULL, &child->mPaneTree);
+ mPaneTree.insertChild(p_prev != NULL ? &p_prev->mPaneTree : NULL, &p_child->mPaneTree);
if (result && parent == NULL) {
- child->add(mBounds.i.x, mBounds.i.y);
- child->calcMtx();
+ p_child->add(mBounds.i.x, mBounds.i.y);
+ p_child->calcMtx();
}
return result;
}
/* 802F67E0-802F6D18 2F1120 0538+00 0/0 1/1 0/0 .text draw__7J2DPaneFffPC14J2DGrafContextbb */
-void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* grafCtx, bool isOrthoGraf, bool param_4) {
+void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* p_grafCtx, bool isOrthoGraf, bool param_4) {
bool unkBool = param_4 && mVisible;
- if (grafCtx->getGrafType() != 1) {
+ if (p_grafCtx->getGrafType() != 1) {
isOrthoGraf = false;
}
+
JSUTree<J2DPane>* parentTree = mPaneTree.getParent();
J2DPane* parent = NULL;
if (parentTree != NULL) {
parent = parentTree->getObject();
}
+
if (mBounds.isValid()) {
mGlobalBounds = mBounds;
- f32 tX = mTranslateX;
- f32 tY = mTranslateY;
- mGlobalBounds.addPos(tX, tY);
+
+ f32 addX = mTranslateX;
+ f32 addY = mTranslateY;
+ mGlobalBounds.addPos(addX, addY);
+
if (unkBool) {
mClipRect = mBounds;
- this->rewriteAlpha();
+ rewriteAlpha();
}
+
if (parent != NULL) {
f32 width = parent->mGlobalBounds.i.x - parent->mBounds.i.x;
f32 height = parent->mGlobalBounds.i.y - parent->mBounds.i.y;
mGlobalBounds.addPos(width, height);
- PSMTXConcat(parent->mGlobalMtx, this->mPositionMtx, this->mGlobalMtx);
+ PSMTXConcat(parent->mGlobalMtx, mPositionMtx, mGlobalMtx);
+
if (unkBool) {
if (isOrthoGraf) {
mClipRect = mGlobalBounds;
mClipRect.intersect(parent->mClipRect);
}
+
mColorAlpha = mAlpha;
if (mIsInfluencedAlpha) {
- mColorAlpha = (mAlpha * parent->mColorAlpha) / 0xFF;
+ mColorAlpha = (mAlpha * parent->mColorAlpha) / 255;
}
}
} else {
mGlobalBounds.addPos(x, y);
- this->makeMatrix(mTranslateX + x, mTranslateY + y);
+ makeMatrix(mTranslateX + x, mTranslateY + y);
PSMTXCopy(mPositionMtx, mGlobalMtx);
mClipRect = mGlobalBounds;
mColorAlpha = mAlpha;
}
+
JGeometry::TBox2<f32> scissorBounds(0, 0, 0, 0);
if (unkBool && isOrthoGraf) {
- ((J2DOrthoGraph*)grafCtx)->scissorBounds(&scissorBounds, &mClipRect);
+ ((J2DOrthoGraph*)p_grafCtx)->scissorBounds(&scissorBounds, &mClipRect);
}
+
if (unkBool && (mClipRect.isValid() || !isOrthoGraf)) {
- J2DGrafContext tmpGraf(*grafCtx);
+ J2DGrafContext tmpGraf(*p_grafCtx);
if (isOrthoGraf) {
tmpGraf.scissor(scissorBounds);
tmpGraf.setScissor();
}
GXSetCullMode((GXCullMode)mCullMode);
- this->drawSelf(x, y, &tmpGraf.mPosMtx);
+ drawSelf(x, y, &tmpGraf.mPosMtx);
}
+
JSUTreeIterator<J2DPane> iter;
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
- iter.getObject()->draw(0, 0, grafCtx, isOrthoGraf, unkBool);
+ iter.getObject()->draw(0, 0, p_grafCtx, isOrthoGraf, unkBool);
}
}
}
@@ -313,6 +337,7 @@ void J2DPane::draw(f32 x, f32 y, J2DGrafContext const* grafCtx, bool isOrthoGraf
/* 802F6D18-802F6F60 2F1658 0248+00 2/2 4/4 0/0 .text place__7J2DPaneFRCQ29JGeometry8TBox2<f> */
void J2DPane::place(JGeometry::TBox2<f32> const& box) {
JGeometry::TBox2<f32> tmpBox;
+
if (mBounds.i.x == 0) {
tmpBox.i.x = 0;
tmpBox.f.x = box.getWidth();
@@ -326,6 +351,7 @@ void J2DPane::place(JGeometry::TBox2<f32> const& box) {
tmpBox.f.x = box.getWidth() / 2;
mTranslateX = (box.i.x + box.f.x) / 2;
}
+
if (mBounds.i.y == 0) {
tmpBox.i.y = 0;
tmpBox.f.y = box.getHeight();
@@ -339,23 +365,24 @@ void J2DPane::place(JGeometry::TBox2<f32> const& box) {
tmpBox.f.y = box.getHeight() / 2;
mTranslateY = (box.i.y + box.f.y) / 2;
}
+
f32 xOff = tmpBox.i.x - mBounds.i.x;
f32 yOff = tmpBox.i.y - mBounds.i.y;
- for (J2DPane* childPane = this->getFirstChildPane(); childPane != NULL;
- childPane = childPane->getNextChildPane()) {
- childPane->mTranslateX += xOff;
- childPane->mTranslateY += yOff;
+ for (J2DPane* child = getFirstChildPane(); child != NULL; child = child->getNextChildPane()) {
+ child->mTranslateX += xOff;
+ child->mTranslateY += yOff;
if (xOff != 0 || yOff != 0) {
- childPane->calcMtx();
+ child->calcMtx();
}
}
mBounds = tmpBox;
- J2DPane* parent = this->getParentPane();
+
+ J2DPane* parent = getParentPane();
if (parent != NULL) {
mTranslateX += parent->mBounds.i.x;
mTranslateY += parent->mBounds.i.y;
}
- this->calcMtx();
+ calcMtx();
}
/* 802F6F60-802F6FB4 2F18A0 0054+00 1/0 7/0 0/0 .text move__7J2DPaneFff */
@@ -438,8 +465,8 @@ void J2DPane::rotate(f32 angle) {
}
/* 802F7264-802F72E0 2F1BA4 007C+00 0/0 2/2 0/0 .text clip__7J2DPaneFRCQ29JGeometry8TBox2<f> */
-void J2DPane::clip(JGeometry::TBox2<f32> const& box) {
- JGeometry::TBox2<f32> boxA(box);
+void J2DPane::clip(JGeometry::TBox2<f32> const& bounds) {
+ JGeometry::TBox2<f32> boxA(bounds);
JGeometry::TBox2<f32> boxB(mGlobalBounds);
boxA.addPos(boxB.i);
mClipRect.intersect(boxA);
@@ -476,20 +503,20 @@ J2DPane* J2DPane::searchUserInfo(u64 tag) {
}
/* 802F7430-802F74B8 2F1D70 0088+00 1/0 7/7 0/0 .text isUsed__7J2DPaneFPC7ResTIMG */
-bool J2DPane::isUsed(const ResTIMG* timg) {
+bool J2DPane::isUsed(const ResTIMG* p_timg) {
JSUTreeIterator<J2DPane> iter;
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
- if (iter.getObject()->isUsed(timg))
+ if (iter.getObject()->isUsed(p_timg))
return true;
}
return false;
}
/* 802F74B8-802F7540 2F1DF8 0088+00 1/0 7/7 0/0 .text isUsed__7J2DPaneFPC7ResFONT */
-bool J2DPane::isUsed(const ResFONT* font) {
+bool J2DPane::isUsed(const ResFONT* p_font) {
JSUTreeIterator<J2DPane> iter;
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
- if (iter.getObject()->isUsed(font))
+ if (iter.getObject()->isUsed(p_font))
return true;
}
return false;
@@ -501,9 +528,9 @@ void J2DPane::makeMatrix(f32 param_0, f32 param_1, f32 param_2, f32 param_3) {
f32 tmpY = mRotateOffsetY - param_3;
Mtx rotX, rotY, rotZ, rotMtx, mtx, tmp;
PSMTXTrans(mtx, -tmpX, -tmpY, 0);
- PSMTXRotRad(rotX, 'x', 0.01745329238474369f * mRotateX);
- PSMTXRotRad(rotY, 'y', 0.01745329238474369f * mRotateY);
- PSMTXRotRad(rotZ, 'z', 0.01745329238474369f * -mRotateZ);
+ PSMTXRotRad(rotX, 'x', DEG_TO_RAD(mRotateX));
+ PSMTXRotRad(rotY, 'y', DEG_TO_RAD(mRotateY));
+ PSMTXRotRad(rotZ, 'z', DEG_TO_RAD(-mRotateZ));
PSMTXConcat(rotZ, rotX, tmp);
PSMTXConcat(rotY, tmp, rotMtx);
PSMTXScaleApply(mtx, mPositionMtx, mScaleX, mScaleY, 1);
@@ -513,7 +540,7 @@ void J2DPane::makeMatrix(f32 param_0, f32 param_1, f32 param_2, f32 param_3) {
/* 802F7680-802F76F8 2F1FC0 0078+00 1/0 7/3 0/0 .text setCullBack__7J2DPaneF11_GXCullMode
*/
-void J2DPane::setCullBack(_GXCullMode mode) {
+void J2DPane::setCullBack(GXCullMode mode) {
mCullMode = mode;
JSUTreeIterator<J2DPane> iter;
@@ -551,10 +578,11 @@ void J2DPane::setBasePosition(J2DBasePosition position) {
}
/* 802F77D0-802F79A8 2F2110 01D8+00 0/0 1/1 0/0 .text setInfluencedAlpha__7J2DPaneFbb */
-void J2DPane::setInfluencedAlpha(bool param_0, bool param_1) {
- if (param_1 && mIsInfluencedAlpha != param_0) {
- J2DPane* parent = this->getParentPane();
+void J2DPane::setInfluencedAlpha(bool influencedAlpha, bool param_1) {
+ if (param_1 && mIsInfluencedAlpha != influencedAlpha) {
+ J2DPane* parent = getParentPane();
u8 alpha = 255;
+
for (; parent != NULL; parent = parent->getParentPane()) {
if (parent->getAlpha() == 0) {
alpha = 0;
@@ -565,24 +593,27 @@ void J2DPane::setInfluencedAlpha(bool param_0, bool param_1) {
break;
}
}
- if (param_0) {
+
+ if (influencedAlpha) {
if (alpha == 0) {
- this->setAlpha(0);
+ setAlpha(0);
} else {
f32 fAlpha = ((f32)mAlpha) / alpha * 255;
+
u8 alpha;
if (fAlpha > 255) {
alpha = 255;
} else {
alpha = fAlpha;
}
- this->setAlpha(alpha);
+ setAlpha(alpha);
}
} else {
- this->setAlpha((f32)(alpha * mAlpha) / 255);
+ setAlpha((f32)(alpha * mAlpha) / 255);
}
}
- mIsInfluencedAlpha = param_0;
+
+ mIsInfluencedAlpha = influencedAlpha;
}
/* 802F79A8-802F7A8C 2F22E8 00E4+00 0/0 3/3 0/0 .text getGlbVtx__7J2DPaneCFUc */
@@ -600,11 +631,13 @@ JGeometry::TVec3<f32> J2DPane::getGlbVtx(u8 param_0) const {
} else {
x = mBounds.i.x;
}
+
if (param_0 & 2) {
y = mBounds.f.y;
} else {
y = mBounds.i.y;
}
+
out.x = x * mGlobalMtx[0][0] + y * mGlobalMtx[0][1] + mGlobalMtx[0][3];
out.y = x * mGlobalMtx[1][0] + y * mGlobalMtx[1][1] + mGlobalMtx[1][3];
out.z = x * mGlobalMtx[2][0] + y * mGlobalMtx[2][1] + mGlobalMtx[2][3];
@@ -636,70 +669,78 @@ J2DPane* J2DPane::getParentPane() {
return getPaneTree()->getParent()->getObject();
}
-struct J2DPaneInit { /* name unknown */
- u8 field_0x0[10];
- u16 field_0xa;
- u8 isVisible;
- u8 mBasePosition;
- // padding
- u64 mInfoTag;
- u64 mUserInfoTag;
- f32 rotationOffsetX;
- f32 rotationOffsetY;
- f32 scaleX;
- f32 scaleY;
- f32 rotXDegrees;
- f32 rotYDegrees;
- f32 rotZDegrees;
- f32 translateX;
- f32 translateY;
- u8 field_0x44[4];
-};
+/* name unknown */
+struct J2DPaneInfo {
+ /* 0x00 */ u32 mKind;
+ /* 0x04 */ u32 mSize;
+ /* 0x08 */ u16 field_0x8;
+ /* 0x0A */ u16 field_0xa;
+ /* 0x0B */ u8 mVisible;
+ /* 0x0C */ u8 mBasePosition;
+ /* 0x10 */ u64 mInfoTag;
+ /* 0x18 */ u64 mUserInfoTag;
+ /* 0x20 */ f32 mRotOffsetX;
+ /* 0x24 */ f32 mRotOffsetY;
+ /* 0x28 */ f32 mScaleX;
+ /* 0x2C */ f32 mScaleY;
+ /* 0x30 */ f32 mRotateX;
+ /* 0x34 */ f32 mRotateY;
+ /* 0x38 */ f32 mRotateZ;
+ /* 0x3C */ f32 mTranslateX;
+ /* 0x40 */ f32 mTranslateY;
+}; // Size: 0x48
/* 802F7B18-802F7D00 2F2458 01E8+00 1/1 6/6 0/0 .text
* makePaneExStream__7J2DPaneFP7J2DPaneP20JSURandomInputStream */
-void J2DPane::makePaneExStream(J2DPane* parent, JSURandomInputStream* stream) {
- stream->getPosition();
- J2DPaneInit data;
- stream->read(&data, sizeof(data));
- _4 = data.field_0xa;
- mVisible = !!data.isVisible;
+void J2DPane::makePaneExStream(J2DPane* p_parent, JSURandomInputStream* p_stream) {
+ p_stream->getPosition();
+
+ J2DPaneInfo data;
+ p_stream->read(&data, sizeof(data));
+ field_0x4 = data.field_0xa;
+ mVisible = !!data.mVisible;
mInfoTag = data.mInfoTag;
mUserInfoTag = data.mUserInfoTag;
- mScaleX = data.scaleX;
- mScaleY = data.scaleY;
- mRotateX = data.rotXDegrees;
- mRotateY = data.rotYDegrees;
- mRotateZ = data.rotZDegrees;
- mTranslateX = data.translateX;
- mTranslateY = data.translateY;
+ mScaleX = data.mScaleX;
+ mScaleY = data.mScaleY;
+ mRotateX = data.mRotateX;
+ mRotateY = data.mRotateY;
+ mRotateZ = data.mRotateZ;
+ mTranslateX = data.mTranslateX;
+ mTranslateY = data.mTranslateY;
mRotAxis = ROTATE_Z;
+
if (data.mBasePosition % 3 == 0) {
mRotateOffsetX = 0;
} else if (data.mBasePosition % 3 == 1) {
- mRotateOffsetX = data.rotationOffsetX / 2;
+ mRotateOffsetX = data.mRotOffsetX / 2;
} else {
- mRotateOffsetX = data.rotationOffsetX;
+ mRotateOffsetX = data.mRotOffsetX;
}
+
if (data.mBasePosition / 3 == 0) {
mRotateOffsetY = 0;
} else if (data.mBasePosition / 3 == 1) {
- mRotateOffsetY = data.rotationOffsetY / 2;
+ mRotateOffsetY = data.mRotOffsetY / 2;
} else {
- mRotateOffsetY = data.rotationOffsetY;
+ mRotateOffsetY = data.mRotOffsetY;
}
- mBounds.set(-mRotateOffsetX, -mRotateOffsetY, data.rotationOffsetX - mRotateOffsetX,
- data.rotationOffsetY - mRotateOffsetY);
+
+ mBounds.set(-mRotateOffsetX, -mRotateOffsetY, data.mRotOffsetX - mRotateOffsetX,
+ data.mRotOffsetY - mRotateOffsetY);
mBasePosition = data.mBasePosition;
+
mAlpha = 255;
mIsInfluencedAlpha = false;
- if (parent != NULL) {
- parent->mPaneTree.appendChild(&this->mPaneTree);
+
+ if (p_parent != NULL) {
+ p_parent->mPaneTree.appendChild(&mPaneTree);
}
+
mCullMode = GX_CULL_NONE;
mColorAlpha = 255;
mConnected = false;
- this->calcMtx();
+ calcMtx();
}
/* 802F7D00-802F7DB8 2F2640 00B8+00 0/0 1/1 0/0 .text J2DCast_F32_to_S16__7J2DPaneFfUc */
@@ -729,71 +770,73 @@ s16 J2DPane::J2DCast_F32_to_S16(f32 value, u8 arg2) {
/* 802F7DB8-802F7EF4 2F26F8 013C+00 0/0 3/3 0/0 .text
* getPointer__7J2DPaneFP20JSURandomInputStreamUlP10JKRArchive */
-void* J2DPane::getPointer(JSURandomInputStream* inputStream, u32 param_1, JKRArchive* archive) {
+void* J2DPane::getPointer(JSURandomInputStream* p_stream, u32 param_1, JKRArchive* p_archive) {
JUTResReference resRef;
- void* result;
- if (archive == NULL) {
+
+ void* pointer;
+ if (p_archive == NULL) {
if (J2DScreen::getDataManage() == NULL) {
- result = resRef.getResource(inputStream, param_1, NULL);
+ pointer = resRef.getResource(p_stream, param_1, NULL);
} else {
- s32 prevPos = inputStream->getPosition();
- result = resRef.getResource(inputStream, param_1, NULL);
- if (result == 0) {
- inputStream->seek(prevPos, JSUStreamSeekFrom_SET);
- result = J2DScreen::getDataManage()->get(inputStream);
+ s32 prevPos = p_stream->getPosition();
+ pointer = resRef.getResource(p_stream, param_1, NULL);
+ if (pointer == NULL) {
+ p_stream->seek(prevPos, JSUStreamSeekFrom_SET);
+ pointer = J2DScreen::getDataManage()->get(p_stream);
}
}
} else {
- s32 prevPos = inputStream->getPosition();
- result = resRef.getResource(inputStream, param_1, archive);
- if (result == NULL) {
- inputStream->seek(prevPos, JSUStreamSeekFrom_SET);
- result = resRef.getResource(inputStream, param_1, NULL);
+ s32 prevPos = p_stream->getPosition();
+ pointer = resRef.getResource(p_stream, param_1, p_archive);
+ if (pointer == NULL) {
+ p_stream->seek(prevPos, JSUStreamSeekFrom_SET);
+ pointer = resRef.getResource(p_stream, param_1, NULL);
}
- if (result == NULL) {
+
+ if (pointer == NULL) {
if (J2DScreen::getDataManage() != NULL) {
- inputStream->seek(prevPos, JSUStreamSeekFrom_SET);
- result = J2DScreen::getDataManage()->get(inputStream);
+ p_stream->seek(prevPos, JSUStreamSeekFrom_SET);
+ pointer = J2DScreen::getDataManage()->get(p_stream);
}
}
}
- return result;
+ return pointer;
}
/* 802F7EF4-802F7FC4 2F2834 00D0+00 2/0 7/4 0/0 .text setAnimation__7J2DPaneFP10J2DAnmBase */
-void J2DPane::setAnimation(J2DAnmBase* anm) {
- if (anm != NULL) {
- switch (anm->getKind()) {
+void J2DPane::setAnimation(J2DAnmBase* p_anm) {
+ if (p_anm != NULL) {
+ switch (p_anm->getKind()) {
default:
break;
- case 0:
- setAnimation(static_cast<J2DAnmTransform*>(anm));
+ case KIND_TRANSFORM:
+ setAnimation(static_cast<J2DAnmTransform*>(p_anm));
break;
- case 1:
- setAnimation(static_cast<J2DAnmColor*>(anm));
+ case KIND_COLOR:
+ setAnimation(static_cast<J2DAnmColor*>(p_anm));
break;
- case 7:
- setAnimation(static_cast<J2DAnmVtxColor*>(anm));
+ case KIND_VTX_COLOR:
+ setAnimation(static_cast<J2DAnmVtxColor*>(p_anm));
break;
- case 4:
- setAnimation(static_cast<J2DAnmTextureSRTKey*>(anm));
+ case KIND_TEXTURE_SRT:
+ setAnimation(static_cast<J2DAnmTextureSRTKey*>(p_anm));
break;
- case 2:
- setAnimation(static_cast<J2DAnmTexPattern*>(anm));
+ case KIND_TEX_PATTERN:
+ setAnimation(static_cast<J2DAnmTexPattern*>(p_anm));
break;
- case 6:
- setAnimation(static_cast<J2DAnmVisibilityFull*>(anm));
+ case KIND_VISIBILITY:
+ setAnimation(static_cast<J2DAnmVisibilityFull*>(p_anm));
break;
- case 5:
- setAnimation(static_cast<J2DAnmTevRegKey*>(anm));
+ case KIND_TEV_REG:
+ setAnimation(static_cast<J2DAnmTevRegKey*>(p_anm));
break;
}
}
}
/* 802F7FC4-802F7FCC -00001 0008+00 0/0 0/0 0/0 .text setAnimation__7J2DPaneFP15J2DAnmTransform */
-void J2DPane::setAnimation(J2DAnmTransform* anm) {
- mTransform = anm;
+void J2DPane::setAnimation(J2DAnmTransform* p_anm) {
+ mTransform = p_anm;
}
/* 802F7FCC-802F8004 2F290C 0038+00 0/0 57/57 0/0 .text animationTransform__7J2DPaneFv */
@@ -815,8 +858,8 @@ void J2DPane::clearAnmTransform() {
/* 802F8080-802F8118 2F29C0 0098+00 1/0 7/0 0/0 .text
* animationTransform__7J2DPaneFPC15J2DAnmTransform */
-const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* transform) {
- const J2DAnmTransform* p = transform;
+const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* p_transform) {
+ const J2DAnmTransform* p = p_transform;
if (mTransform != NULL)
p = mTransform;
@@ -831,30 +874,30 @@ const J2DAnmTransform* J2DPane::animationTransform(const J2DAnmTransform* transf
/* 802F8118-802F81A0 2F2A58 0088+00 1/0 8/1 0/0 .text
* setVisibileAnimation__7J2DPaneFP20J2DAnmVisibilityFull */
-void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* visibility) {
- setAnimationVF(visibility);
+void J2DPane::setVisibileAnimation(J2DAnmVisibilityFull* p_visibility) {
+ setAnimationVF(p_visibility);
JSUTreeIterator<J2DPane> iter;
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
- iter.getObject()->setVisibileAnimation(visibility);
+ iter.getObject()->setVisibileAnimation(p_visibility);
}
}
/* 802F81A0-802F8228 2F2AE0 0088+00 1/0 8/1 0/0 .text
* setVtxColorAnimation__7J2DPaneFP14J2DAnmVtxColor */
-void J2DPane::setVtxColorAnimation(J2DAnmVtxColor* vtx_color) {
- setAnimationVC(vtx_color);
+void J2DPane::setVtxColorAnimation(J2DAnmVtxColor* p_vtxColor) {
+ setAnimationVC(p_vtxColor);
JSUTreeIterator<J2DPane> iter;
for (iter = mPaneTree.getFirstChild(); iter != mPaneTree.getEndChild(); ++iter) {
- iter.getObject()->setVtxColorAnimation(vtx_color);
+ iter.getObject()->setVtxColorAnimation(p_vtxColor);
}
}
/* 802F8228-802F82C0 2F2B68 0098+00 1/0 7/3 0/0 .text animationPane__7J2DPaneFPC15J2DAnmTransform
*/
-const J2DAnmTransform* J2DPane::animationPane(const J2DAnmTransform* transform) {
- const J2DAnmTransform* p = transform;
+const J2DAnmTransform* J2DPane::animationPane(const J2DAnmTransform* p_transform) {
+ const J2DAnmTransform* p = p_transform;
if (mTransform != NULL)
p = mTransform;
@@ -869,10 +912,10 @@ const J2DAnmTransform* J2DPane::animationPane(const J2DAnmTransform* transform)
/* 802F82C0-802F83C8 2F2C00 0108+00 2/2 0/0 0/0 .text
* updateTransform__7J2DPaneFPC15J2DAnmTransform */
-void J2DPane::updateTransform(J2DAnmTransform const* anmTransform) {
- if (_4 != 0xFFFF && anmTransform != NULL) {
+void J2DPane::updateTransform(J2DAnmTransform const* p_anmTransform) {
+ if (field_0x4 != 0xFFFF && p_anmTransform != NULL) {
J3DTransformInfo info;
- anmTransform->getTransform(_4, &info);
+ p_anmTransform->getTransform(field_0x4, &info);
mScaleX = info.mScale.x;
mScaleY = info.mScale.z;
mRotateX = (u16)info.mRotation.x * 360.0f / 65535.0f;
@@ -880,12 +923,12 @@ void J2DPane::updateTransform(J2DAnmTransform const* anmTransform) {
mRotateZ = (u16)info.mRotation.y * 360.0f / 65535.0f;
mTranslateX = info.mTranslate.x;
mTranslateY = info.mTranslate.z;
- this->calcMtx();
+ calcMtx();
}
}
/* 802F83C8-802F83CC 2F2D08 0004+00 1/0 0/0 0/0 .text drawSelf__7J2DPaneFffPA3_A4_f */
-void J2DPane::drawSelf(f32 param_0, f32 param_1, f32 (*param_2)[3][4]) {
+void J2DPane::drawSelf(f32, f32, f32 (*)[3][4]) {
/* empty function */
}
@@ -896,14 +939,14 @@ void J2DPane::rewriteAlpha() {
/* 802F83D0-802F83FC 2F2D10 002C+00 1/0 6/0 0/0 .text
* setAnimationVF__7J2DPaneFP20J2DAnmVisibilityFull */
-void J2DPane::setAnimationVF(J2DAnmVisibilityFull* visibility) {
- setAnimation(visibility);
+void J2DPane::setAnimationVF(J2DAnmVisibilityFull* p_visibility) {
+ setAnimation(p_visibility);
}
/* 802F83FC-802F8428 2F2D3C 002C+00 1/0 6/0 0/0 .text setAnimationVC__7J2DPaneFP14J2DAnmVtxColor
*/
-void J2DPane::setAnimationVC(J2DAnmVtxColor* vtx_color) {
- setAnimation(vtx_color);
+void J2DPane::setAnimationVC(J2DAnmVtxColor* p_vtxColor) {
+ setAnimation(p_vtxColor);
}
/* 802F8428-802F8464 2F2D68 003C+00 1/0 4/0 0/0 .text setCullBack__7J2DPaneFb */
@@ -930,6 +973,6 @@ void J2DPane::update() {
}
/* 802F8478-802F847C 2F2DB8 0004+00 1/0 1/0 0/0 .text drawSelf__7J2DPaneFff */
-void J2DPane::drawSelf(f32 param_0, f32 param_1) {
+void J2DPane::drawSelf(f32, f32) {
/* empty function */
}