// // Generated by dtk // Translation Unit: J2DPicture.cpp // #include "JSystem/J2DGraph/J2DPicture.h" #include "JSystem/JKernel/JKRFileLoader.h" #include "JSystem/JSupport/JSURandomInputStream.h" #include "JSystem/JUtility/JUTResource.h" #include "JSystem/JUtility/JUTPalette.h" #include "JSystem/JUtility/JUTTexture.h" #include "dolphin/types.h" /* 802D2D94-802D2E1C .text __ct__10J2DPictureFv */ J2DPicture::J2DPicture() { mpTexture[0] = NULL; mNumTexture = 0; mpPalette = NULL; initinfo(); } /* 802D2E1C-802D326C .text __ct__10J2DPictureFP7J2DPaneP20JSURandomInputStream */ J2DPicture::J2DPicture(J2DPane* parent, JSURandomInputStream* stream) : mpPalette(NULL) { J2DPaneHeader header; s32 pos = stream->getPosition(); stream->read(&header, sizeof(J2DPaneHeader)); mMagic = header.mMagic; pos += header.mSize; makePaneStream(parent, stream); JUTResReference ref; ResTIMG* timg; ResTLUT* tlut; u8 num = stream->readU8(); timg = (ResTIMG*)ref.getResource(stream, 'TIMG', NULL); tlut = (ResTLUT*)ref.getResource(stream, 'TLUT', NULL); mBinding = stream->read8b(); num -= 3; if (num) { mFlag = stream->read8b(); num--; } else { mFlag = 0; } if (num) { stream->read8b(); num--; } mColorBlack = JUtility::TColor(0); mColorWhite = JUtility::TColor(-1); if (num) { mColorBlack = JUtility::TColor(stream->readU32()); num--; } if (num) { mColorWhite = JUtility::TColor(stream->readU32()); num--; } setCornerColor(JUtility::TColor(-1), JUtility::TColor(-1), JUtility::TColor(-1), JUtility::TColor(-1)); for (int i = 0; num > 0 && i < 4; i++) { mCornerColor[i] = JUtility::TColor(stream->readU32()); num--; } stream->seek(pos, JSUStreamSeekFrom_SET); mpTexture[0] = NULL; mNumTexture = 0; mValidTexture = 1; if (timg) { mpTexture[0] = new JUTTexture(timg, 0); mNumTexture++; } if (tlut) { mpPalette = new JUTPalette(GX_TLUT0, tlut); mpTexture[0]->attachPalette(mpPalette); } setBlendRatio(1.0f, 1.0f, 1.0f, 1.0f); } /* 802D326C-802D3320 .text __ct__10J2DPictureFPC7ResTIMG */ J2DPicture::J2DPicture(const ResTIMG* pTimg) { mpTexture[0] = NULL; mNumTexture = 0; if (pTimg) { append(pTimg, 1.0f); } mpPalette = NULL; initinfo(); } /* 802D3320-802D33D4 .text __ct__10J2DPictureFPCc */ J2DPicture::J2DPicture(const char* name) { mpTexture[0] = NULL; mNumTexture = 0; if (name) { append(name, 1.0f); } mpPalette = NULL; initinfo(); } /* 802D33D4-802D3474 .text __ct__10J2DPictureFUlRCQ29JGeometry8TBox2PC7ResTIMGPC7ResTLUT */ J2DPicture::J2DPicture(u32 param_1, const JGeometry::TBox2& bounds, const ResTIMG* pTimg, const ResTLUT* pTlut) : J2DPane(param_1, bounds), mpPalette(NULL) { private_initiate(pTimg, pTlut); initinfo(); } /* 802D3474-802D3530 .text initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT */ void J2DPicture::initiate(const ResTIMG* pTimg, const ResTLUT* pTlut) { private_initiate(pTimg, pTlut); if (!mpTexture[0]) { return; } mBounds = JGeometry::TBox2(0.0f, 0.0f, mpTexture[0]->getWidth(), mpTexture[0]->getHeight()); calcMtx(); } /* 802D3530-802D35FC .text private_initiate__10J2DPictureFPC7ResTIMGPC7ResTLUT */ void J2DPicture::private_initiate(const ResTIMG* pTimg, const ResTLUT* pTlut) { mpTexture[0] = NULL; mValidTexture = 1; mNumTexture = 0; if (pTimg) { mpTexture[0] = new JUTTexture(pTimg, 0); mNumTexture++; } mpPalette = NULL; if (pTlut) { mpPalette = new JUTPalette(GX_TLUT0, (ResTLUT*)pTlut); mpTexture[0]->attachPalette(mpPalette); } } /* 802D35FC-802D3774 .text initinfo__10J2DPictureFv */ void J2DPicture::initinfo() { mMagic = 'PIC1'; setBinding(J2DBinding(J2DBind_Bottom | J2DBind_Top | J2DBind_Right | J2DBind_Left)); mFlag &= 4; mFlag &= 3; setBlendRatio(1.0f, 1.0f, 1.0f, 1.0f); mColorBlack = JUtility::TColor(0); mColorWhite = JUtility::TColor(-1); setCornerColor(JUtility::TColor(-1), JUtility::TColor(-1), JUtility::TColor(-1), JUtility::TColor(-1)); } /* 802D3774-802D3824 .text __dt__10J2DPictureFv */ J2DPicture::~J2DPicture() { for (int i = 0; i < mNumTexture; i++) { if (mValidTexture & 1 << i) { delete mpTexture[i]; } } delete mpPalette; } /* 802D3824-802D3A08 .text insert__10J2DPictureFPC7ResTIMGUcf */ bool J2DPicture::insert(const ResTIMG* pTimg, u8 idx, f32 param_3) { if (!pTimg || mNumTexture >= 4 || idx >= 4 || idx > mNumTexture) { return false; } JUTTexture* texture = new JUTTexture(pTimg, 0); for (u8 i = 3; idx < i; i--) { mpTexture[i] = mpTexture[i - 1]; mBlendKonstColorF[i] = mBlendKonstColorF[i - 1]; mBlendKonstAlphaF[i] = mBlendKonstAlphaF[i - 1]; } mValidTexture = (mValidTexture & ((1 << idx) - 1)) | ((mValidTexture & ~((1 << idx) - 1)) << 1); mpTexture[idx] = texture; mValidTexture |= (1 << idx); mBlendKonstColorF[idx] = param_3; mBlendKonstAlphaF[idx] = param_3; if (mNumTexture == 0 && mpTexture[0]) { mBounds = JGeometry::TBox2(0.0f, 0.0f, mpTexture[0]->getWidth(), mpTexture[0]->getHeight()); calcMtx(); } mNumTexture++; setBlendKonstColor(); setBlendKonstAlpha(); return true; } /* 802D3A08-802D3A68 .text insert__10J2DPictureFPCcUcf */ bool J2DPicture::insert(const char* name, u8 idx, f32 param_3) { return insert((ResTIMG*)JKRGetNameResource(name, NULL), idx, param_3); } /* 802D3A68-802D3B78 .text remove__10J2DPictureFUc */ bool J2DPicture::remove(u8 idx) { if (mNumTexture <= idx || mNumTexture == 1) { return false; } if (mValidTexture & 1 << idx) { delete mpTexture[idx]; } for (u8 i = idx; i < mNumTexture - 1; i++) { mpTexture[i] = mpTexture[i + 1]; mBlendKonstColorF[i] = mBlendKonstColorF[i + 1]; mBlendKonstAlphaF[i] = mBlendKonstAlphaF[i + 1]; } mValidTexture = mValidTexture & (1 << idx) - 1 | ((mValidTexture & ~((1 << (idx + 1)) - 1)) >> 1); mNumTexture--; setBlendKonstColor(); setBlendKonstAlpha(); return true; } /* 802D3B78-802D3C34 .text changeTexture__10J2DPictureFPC7ResTIMGUc */ const ResTIMG * J2DPicture::changeTexture(const ResTIMG* timg, u8 idx) { if (idx >= mNumTexture) return NULL; if (getTexture(idx) == NULL || timg == NULL) return NULL; const ResTIMG * oldImg = getTexture(idx)->getTexInfo(); getTexture(idx)->storeTIMG(timg, (u8)0); return oldImg; } /* 802D3C34-802D3C84 .text changeTexture__10J2DPictureFPCcUc */ const ResTIMG * J2DPicture::changeTexture(const char* name, u8 param_2) { return changeTexture((ResTIMG*)JKRGetNameResource(name, NULL), param_2); } /* 802D3C84-802D3CEC .text drawSelf__10J2DPictureFff */ void J2DPicture::drawSelf(f32 x, f32 y) { Mtx mtx; MTXIdentity(mtx); drawSelf(x, y, &mtx); } /* 802D3CEC-802D3D54 .text drawSelf__10J2DPictureFffPA3_A4_f */ void J2DPicture::drawSelf(f32 x, f32 y, Mtx* mtx) { if (!mpTexture[0]) { return; } drawFullSet(mScreenBounds.i.x + x, mScreenBounds.i.y + y, mBounds.getWidth(), mBounds.getHeight(), J2DBinding(mBinding), getMirror(), isTumble(), mtx); } /* 802D3D54-802D4074 .text drawFullSet__10J2DPictureFffff10J2DBinding9J2DMirrorbPA3_A4_f */ void J2DPicture::drawFullSet(f32 x, f32 y, f32 width, f32 height, J2DBinding binding, J2DMirror mirror, bool rotate90, Mtx* mtx) { bool bindLeft; bool bindRight; bool bindTop; bool bindBottom; if (!rotate90) { if (mirror & J2DMirror_X) bindLeft = binding & J2DBind_Right; else bindLeft = binding & J2DBind_Left; if (mirror & J2DMirror_X) bindRight = binding & J2DBind_Left; else bindRight = binding & J2DBind_Right; if (mirror & J2DMirror_Y) bindTop = binding & J2DBind_Bottom; else bindTop = binding & J2DBind_Top; if (mirror & J2DMirror_Y) bindBottom = binding & J2DBind_Top; else bindBottom = binding & J2DBind_Bottom; } else { if (mirror & J2DMirror_X) bindLeft = binding & J2DBind_Bottom; else bindLeft = binding & J2DBind_Top; if (mirror & J2DMirror_X) bindRight = binding & J2DBind_Top; else bindRight = binding & J2DBind_Bottom; if (mirror & J2DMirror_Y) bindTop = binding & J2DBind_Left; else bindTop = binding & J2DBind_Right; if (mirror & J2DMirror_Y) bindBottom = binding & J2DBind_Right; else bindBottom = binding & J2DBind_Left; } f32 rectWidth; f32 rectHeight; f32 texWidth = mpTexture[0]->getWidth(); f32 texHeight = mpTexture[0]->getHeight(); rectWidth = !rotate90 ? width : height; rectHeight = !rotate90 ? height : width; f32 s0, t0, s1, t1; if (bindLeft) { s0 = 0.0f; s1 = bindRight ? 1.0f : (rectWidth / texWidth); } else if (bindRight) { s0 = 1.0f - (rectWidth / texWidth); s1 = 1.0f; } else { s0 = 0.5f - (rectWidth / texWidth) / 2.0f; s1 = 0.5f + (rectWidth / texWidth) / 2.0f; } if (bindTop) { t0 = 0.0f; t1 = bindBottom ? 1.0f : (rectHeight / texHeight); } else if (bindBottom) { t0 = 1.0f - (rectHeight / texHeight); t1 = 1.0f; } else { t0 = 0.5f - (rectHeight / texHeight) / 2.0f; t1 = 0.5f + (rectHeight / texHeight) / 2.0f; } if (mirror & J2DMirror_X) { swap(s0, s1); } if (mirror & J2DMirror_Y) { swap(t0, t1); } if (!rotate90) { drawTexCoord(0.0f, 0.0f, width, height, s0, t0, s1, t0, s0, t1, s1, t1, mtx); } else { drawTexCoord(0.0f, 0.0f, width, height, s0, t1, s0, t0, s1, t1, s1, t0, mtx); } } /* 802D4074-802D4490 .text draw__10J2DPictureFffffbbb */ void J2DPicture::draw(f32 x, f32 y, f32 width, f32 height, bool mirrorX, bool mirrorY, bool rotate90) { if (!mVisible) { return; } for (u8 i = 0; i < mNumTexture; i++) { if (i < mNumTexture) { load(i); } } GXSetNumTexGens(mNumTexture); mDrawAlpha = mAlpha; JUtility::TColor color[4]; getNewColor(color); setTevMode(); makeMatrix(x, y); GXLoadPosMtxImm(mMtx, GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); GXPosition3f32(0.0f, 0.0f, 0.0f); GXColor1u32(color[0]); if (!rotate90) { GXTexCoord2s16(mirrorX ? 0x8000 : 0, mirrorY ? 0x8000 : 0); } else { GXTexCoord2s16(mirrorX ? 0x8000 : 0, mirrorY ? 0 : 0x8000); } GXPosition3f32(width, 0.0f, 0.0f); GXColor1u32(color[1]); if (!rotate90) { GXTexCoord2s16(mirrorX ? 0 : 0x8000, mirrorY ? 0x8000 : 0); } else { GXTexCoord2s16(mirrorX ? 0x8000 : 0, mirrorY ? 0x8000 : 0); } GXPosition3f32(width, height, 0.0f); GXColor1u32(color[3]); if (!rotate90) { GXTexCoord2s16(mirrorX ? 0 : 0x8000, mirrorY ? 0 : 0x8000); } else { GXTexCoord2s16(mirrorX ? 0 : 0x8000, mirrorY ? 0x8000 : 0); } GXPosition3f32(0.0f, height, 0.0f); GXColor1u32(color[2]); if (!rotate90) { GXTexCoord2s16(mirrorX ? 0x8000 : 0, mirrorY ? 0 : 0x8000); } else { GXTexCoord2s16(mirrorX ? 0 : 0x8000, mirrorY ? 0 : 0x8000); } GXEnd(); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_U16, 0x0f); GXSetNumTexGens(0); GXSetNumTevStages(1); GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); Mtx m; MTXIdentity(m); GXLoadPosMtxImm(m, GX_PNMTX0); GXSetVtxDesc(GX_VA_TEX0, GX_NONE); } /* 802D4490-802D4874 .text drawOut__10J2DPictureFRCQ29JGeometry8TBox2RCQ29JGeometry8TBox2 */ void J2DPicture::drawOut(const JGeometry::TBox2& posBox, const JGeometry::TBox2& texRect) { if (!mVisible) { return; } for (u8 i = 0; i < mNumTexture; i++) { if (i < mNumTexture) { load(i); } } GXSetNumTexGens(mNumTexture); f32 s0 = (posBox.i.x - texRect.i.x) / texRect.getWidth(); f32 s1 = (posBox.f.x - texRect.f.x) / texRect.getWidth() + 1.0f; f32 t0 = (posBox.i.y - texRect.i.y) / texRect.getHeight(); f32 t1 = (posBox.f.y - texRect.f.y) / texRect.getHeight() + 1.0f; mDrawAlpha = mAlpha; JUtility::TColor color[4]; getNewColor(color); setTevMode(); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); GXPosition3f32((s16)posBox.i.x, (s16)posBox.i.y, 0.0f); GXColor1u32(color[0]); GXTexCoord2f32(s0, t0); GXPosition3f32((s16)posBox.f.x, (s16)posBox.i.y, 0.0f); GXColor1u32(color[1]); GXTexCoord2f32(s1, t0); GXPosition3f32((s16)posBox.f.x, (s16)posBox.f.y, 0.0f); GXColor1u32(color[3]); GXTexCoord2f32(s1, t1); GXPosition3f32((s16)posBox.i.x, (s16)posBox.f.y, 0.0f); GXColor1u32(color[2]); GXTexCoord2f32(s0, t1); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U16, 15); GXSetNumTexGens(0); GXSetNumTevStages(1); GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); GXSetVtxDesc(GX_VA_TEX0, GX_NONE); } /* 802D4874-802D4B3C .text drawTexCoord__10J2DPictureFffffffffffffPA3_A4_f */ void J2DPicture::drawTexCoord(f32 x, f32 y, f32 width, f32 height, f32 s0, f32 t0, f32 s1, f32 t1, f32 s2, f32 t2, f32 s3, f32 t3, Mtx* mtx) { for (u8 i = 0; i < mNumTexture; i++) { if (i < mNumTexture) { load(i); } } f32 x2 = x + width; f32 y2 = y + height; GXSetNumTexGens(mNumTexture); JUtility::TColor colors[4]; getNewColor(colors); setTevMode(); Mtx stack_108; MTXConcat(*mtx, mDrawMtx, stack_108); GXLoadPosMtxImm(stack_108, GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT); GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); GXPosition3f32(x, y, 0.0f); GXColor1u32(colors[0]); GXTexCoord2f32(s0, t0); GXPosition3f32(x2, y, 0.0f); GXColor1u32(colors[1]); GXTexCoord2f32(s1, t1); GXPosition3f32(x2, y2, 0.0f); GXColor1u32(colors[3]); GXTexCoord2f32(s3, t3); GXPosition3f32(x, y2, 0.0f); GXColor1u32(colors[2]); GXTexCoord2f32(s2, t2); GXEnd(); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_U16, 0xf); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); } /* 802D4B3C-802D4F44 .text setTevMode__10J2DPictureFv */ void J2DPicture::setTevMode() { u8 i; for (i = 0; i < mNumTexture; i++) { GXSetTevOrder(GXTevStageID(i), GXTexCoordID(i), GXTexMapID(i), GX_COLOR_NULL); } GXSetTevColor(GX_TEVREG2, JUtility::TColor()); GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_TEXC, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO); if (mpTexture[0]->getTransparency()) { GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_TEXA, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); } else { GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO); } GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevKColor(GX_KCOLOR0, mBlendKonstColor); GXSetTevKColor(GX_KCOLOR2, mBlendKonstAlpha); for (i = 1; i < mNumTexture; i++) { GXSetTevKColorSel(GXTevStageID(i), GXTevKColorSel(0x20 - i * 4)); GXSetTevKAlphaSel(GXTevStageID(i), GXTevKAlphaSel(0x22 - i * 4)); GXSetTevColorIn(GXTevStageID(i), GX_CC_CPREV, GX_CC_TEXC, GX_CC_KONST, GX_CC_ZERO); if (mpTexture[i]->getTransparency()) { GXSetTevAlphaIn(GXTevStageID(i), GX_CA_APREV, GX_CA_TEXA, GX_CA_KONST, GX_CA_ZERO); } else { GXSetTevAlphaIn(GXTevStageID(i), GX_CA_APREV, GX_CA_A2, GX_CA_KONST, GX_CA_ZERO); } GXSetTevColorOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevAlphaOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); } if (mColorBlack != 0 || mColorWhite != 0xffffffff) { GXSetTevOrder(GXTevStageID(i), GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR_NULL); GXSetTevColor(GX_TEVREG0, mColorBlack); GXSetTevColor(GX_TEVREG1, mColorWhite); GXSetTevColorIn(GXTevStageID(i), GX_CC_C0, GX_CC_C1, GX_CC_CPREV, GX_CC_ZERO); GXSetTevAlphaIn(GXTevStageID(i), GX_CA_A0, GX_CA_A1, GX_CA_APREV, GX_CA_ZERO); GXSetTevColorOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevAlphaOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); i++; } if (mDrawAlpha != 0xff || mCornerColor[0] != 0xffffffff || mCornerColor[1] != 0xffffffff || mCornerColor[2] != 0xffffffff || mCornerColor[3] != 0xffffffff) { GXSetTevOrder(GXTevStageID(i), GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0); GXSetTevColorIn(GXTevStageID(i), GX_CC_ZERO, GX_CC_CPREV, GX_CC_RASC, GX_CC_ZERO); GXSetTevAlphaIn(GXTevStageID(i), GX_CA_ZERO, GX_CA_APREV, GX_CA_RASA, GX_CA_ZERO); GXSetTevColorOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetTevAlphaOp(GXTevStageID(i), GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); i++; } GXSetNumTevStages(u8(i)); GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); for (i = 0; i < mNumTexture; i++) { GXSetTexCoordGen(GXTexCoordID(i), GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); } GXSetNumChans(1); } /* 802D4F44-802D4F58 .text swap__10J2DPictureFRfRf */ void J2DPicture::swap(f32& f1, f32& f2) { f32 tmp = f1; f1 = f2; f2 = tmp; } /* 802D4F58-802D5028 .text setBlendKonstColor__10J2DPictureFv */ void J2DPicture::setBlendKonstColor() { int var3 = 0; for (u8 i = 1; i < mNumTexture; i++) { f32 tmp = 0.0f; for (u8 j = 0; j < i; j++) { tmp += mBlendKonstColorF[j]; } f32 tmp2 = tmp + mBlendKonstColorF[i]; if (tmp2 != 0.0f) { var3 |= (u8)(255.0f * (1.0f - tmp / tmp2)) << (i - 1) * 8; } } mBlendKonstColor = var3; } /* 802D5028-802D50F8 .text setBlendKonstAlpha__10J2DPictureFv */ void J2DPicture::setBlendKonstAlpha() { int var3 = 0; for (u8 i = 1; i < mNumTexture; i++) { f32 tmp = 0.0f; for (u8 j = 0; j < i; j++) { tmp += mBlendKonstAlphaF[j]; } f32 tmp2 = tmp + mBlendKonstAlphaF[i]; if (tmp2 != 0.0f) { var3 |= (u8)(255.0f * (1.0f - tmp / tmp2)) << (i - 1) * 8; } } mBlendKonstAlpha = var3; } /* 802D50F8-802D51D8 .text getNewColor__10J2DPictureFPQ28JUtility6TColor */ void J2DPicture::getNewColor(JUtility::TColor* param_1) { param_1[0] = mCornerColor[0]; param_1[1] = mCornerColor[1]; param_1[2] = mCornerColor[2]; param_1[3] = mCornerColor[3]; if (mDrawAlpha == 0xff) { return; } param_1[0].a = (param_1[0].a * mDrawAlpha) / 0xff; param_1[1].a = (param_1[1].a * mDrawAlpha) / 0xff; param_1[2].a = (param_1[2].a * mDrawAlpha) / 0xff; param_1[3].a = (param_1[3].a * mDrawAlpha) / 0xff; }