mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-13 05:46:18 -04:00
313 lines
9.8 KiB
C++
313 lines
9.8 KiB
C++
//
|
|
// Generated by dtk
|
|
// Translation Unit: d_2dnumber.cpp
|
|
//
|
|
|
|
#include "d/d_2dnumber.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "JSystem/J2DGraph/J2DOrthoGraph.h"
|
|
#include "printf.h"
|
|
|
|
/* 800C8498-800C84B4 .text __ct__16dDlst_2DNumber_cFv */
|
|
dDlst_2DNumber_c::dDlst_2DNumber_c() {
|
|
}
|
|
|
|
/* 800C84B4-800C8510 .text __dt__16dDlst_2DNumber_cFv */
|
|
dDlst_2DNumber_c::~dDlst_2DNumber_c() {
|
|
}
|
|
|
|
/* 800C8510-800C8644 .text init__16dDlst_2DNumber_cFissssUc */
|
|
bool dDlst_2DNumber_c::init(int digitNum, s16 x, s16 y, s16 w, s16 h, u8 flag) { /* Nonmatching */
|
|
mDigitNum = digitNum;
|
|
mFlag = flag;
|
|
mWidth = w;
|
|
mHeight = h;
|
|
|
|
for (s32 i = 0; i < mDigitNum; i++) {
|
|
mNum[i] = new J2DPicture("rupy_num_00.bti");
|
|
if (mNum[i] == NULL)
|
|
return false;
|
|
|
|
mPos[i].x = x - w * i;
|
|
mPos[i].y = y;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/* 800C8644-800C874C .text draw__16dDlst_2DNumber_cFv */
|
|
void dDlst_2DNumber_c::draw() {
|
|
J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort();
|
|
s32 value = mValue;
|
|
|
|
graf->setPort();
|
|
if (mFlag & 2)
|
|
return;
|
|
|
|
for (s32 i = 0; i < mDigitNum; i++) {
|
|
if (i != 0 && value == 0 && !(mFlag & 1))
|
|
break;
|
|
|
|
s32 digit = value % 10;
|
|
value /= 10;
|
|
|
|
char buf[16];
|
|
sprintf(buf, "rupy_num_%02d.bti", digit);
|
|
mNum[i]->changeTexture(buf, 0);
|
|
mNum[i]->draw(mPos[i].x, mPos[i].y, mWidth, mHeight, false, false, false);
|
|
}
|
|
}
|
|
|
|
/* 800C874C-800C8944 .text init__18dDlst_2DMinigame_cFP7ResTIMGP7ResTIMG */
|
|
bool dDlst_2DMinigame_c::init(ResTIMG* title, ResTIMG* score) {
|
|
mTitle = new J2DPicture(title);
|
|
if (mTitle == NULL)
|
|
return false;
|
|
|
|
mScore = new J2DPicture(score);
|
|
if (mScore == NULL)
|
|
return false;
|
|
|
|
mScoreShadow = new J2DPicture(score);
|
|
if (mScoreShadow == NULL)
|
|
return false;
|
|
|
|
mTitleSize.x = title->width * 1.33f;
|
|
mTitleSize.y = title->height * 1.33f;
|
|
mScoreSize.x = score->width * 1.16f;
|
|
mScoreSize.y = score->height * 1.16f;
|
|
|
|
mScoreShadow->setCornerColor(0x000000FF);
|
|
return true;
|
|
}
|
|
|
|
/* 800C8944-800C8A00 .text draw__18dDlst_2DMinigame_cFv */
|
|
void dDlst_2DMinigame_c::draw() {
|
|
J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort();
|
|
graf->setPort();
|
|
|
|
mScoreShadow->draw(mScorePos.x + 4.0f, mScorePos.y + 4.0f, mScoreSize.x, mScoreSize.y, false, false, false);
|
|
mScore->draw(mScorePos.x, mScorePos.y, mScoreSize.x, mScoreSize.y, false, false, false);
|
|
mTitle->draw(mTitlePos.x, mTitlePos.y, mTitleSize.x, mTitleSize.y, false, false, false);
|
|
}
|
|
|
|
/* 800C8A00-800C8FAC .text init__17dDlst_2DBattery_cFP7ResTIMGP7ResTIMGP7ResTIMGP7ResTIMG */
|
|
bool dDlst_2DBattery_c::init(ResTIMG* rule, ResTIMG* battery, ResTIMG* batteryBase, ResTIMG* degree) {
|
|
mRule = new J2DPicture(rule);
|
|
if (mRule == NULL)
|
|
return false;
|
|
|
|
mRuleSize.x = rule->width;
|
|
mRuleSize.y = rule->height;
|
|
|
|
mBattery = new J2DPicture(battery);
|
|
if (mBattery == NULL)
|
|
return false;
|
|
|
|
mBatterySize.x = battery->width;
|
|
mBatterySize.y = battery->height;
|
|
|
|
mBatteryBase = new J2DPicture(batteryBase);
|
|
if (mBatteryBase == NULL)
|
|
return false;
|
|
|
|
mBatteryBaseSize.x = batteryBase->width;
|
|
mBatteryBaseSize.y = batteryBase->height;
|
|
|
|
for (s32 i = 0; i < 2; i++) {
|
|
mNum[0][i] = new J2DPicture(degree);
|
|
if (mNum[0][i] == NULL)
|
|
return false;
|
|
|
|
mNum[1][i] = new J2DPicture("rupy_num_00.bti");
|
|
if (mNum[1][i] == NULL)
|
|
return false;
|
|
|
|
mNum[2][i] = new J2DPicture("rupy_num_00.bti");
|
|
if (mNum[2][i] == NULL)
|
|
return false;
|
|
}
|
|
|
|
mBattery->setAlpha(200);
|
|
|
|
mNumSize.x = degree->width;
|
|
mNumSize.y = degree->height;
|
|
|
|
mPicturePos.x = mPicturePos.y = 0.0f;
|
|
mNumPos.x = 551.0f;
|
|
mNumPos.y = mBatteryBaseSize.y / 2.0f + 399.0f;
|
|
|
|
mRule->setAlpha(128);
|
|
mRule->setWhite(0xFFFFFFFF);
|
|
mRule->setBlack(0xFFFFFF00);
|
|
|
|
mNum[0][0]->setWhite(0xFFC800FF);
|
|
mNum[0][1]->setCornerColor(0x000000FF);
|
|
mNum[0][1]->setAlpha(80);
|
|
|
|
mNum[1][0]->setWhite(0xFFC800FF);
|
|
mNum[1][1]->setCornerColor(0x000000FF);
|
|
mNum[1][1]->setAlpha(80);
|
|
|
|
mNum[2][0]->setWhite(0xFFC800FF);
|
|
mNum[2][1]->setCornerColor(0x000000FF);
|
|
mNum[2][1]->setAlpha(80);
|
|
|
|
mRotation = 20.0f;
|
|
return true;
|
|
}
|
|
|
|
/* 800C8FAC-800C90F0 .text setRotate__17dDlst_2DBattery_cFf */
|
|
void dDlst_2DBattery_c::setRotate(f32 rot) {
|
|
/* Nonmatching */
|
|
|
|
// calculate the angle text
|
|
int angle = ((rot - 22.5f) / 22.5f) * 35.0f + 15.0f + 0.5f;
|
|
char buf[16];
|
|
sprintf(buf, "rupy_num_%02d.bti", angle / 10);
|
|
mNum[2][0]->changeTexture(buf, 0);
|
|
mNum[2][1]->changeTexture(buf, 0);
|
|
sprintf(buf, "rupy_num_%02d.bti", angle % 10);
|
|
mNum[1][0]->changeTexture(buf, 0);
|
|
mNum[1][1]->changeTexture(buf, 0);
|
|
|
|
// calculate the visual angle
|
|
f32 deg;
|
|
if (rot < 20.0f) {
|
|
deg = 345.0f;
|
|
} else if (rot > 45.0f) {
|
|
deg = 310.0f;
|
|
} else {
|
|
deg = 360.0f - ((rot - 20.0f) * 1.4f + 15.0f);
|
|
}
|
|
mRotation = deg;
|
|
}
|
|
|
|
/* 800C90F0-800C9348 .text draw__17dDlst_2DBattery_cFv */
|
|
void dDlst_2DBattery_c::draw() {
|
|
J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort();
|
|
graf->setPort();
|
|
|
|
mBattery->rotate(mBatterySize.x, mBatterySize.y / 2.0f, ROTATE_Z, mRotation);
|
|
|
|
mRule->draw(mPicturePos.x + 519.0f, mPicturePos.y + 367.0f, mRuleSize.x, mRuleSize.y, false, false, false);
|
|
mBattery->draw(mPicturePos.x + 498.0f, mPicturePos.y + 397.0f, mBatterySize.x, mBatterySize.y, false, false, false);
|
|
mBatteryBase->draw(mPicturePos.x + 551.0f, mPicturePos.y + 399.0f, mBatteryBaseSize.x, mBatteryBaseSize.y, false, false, false);
|
|
|
|
const float shadowOffs = 4.0f;
|
|
|
|
mNum[2][1]->draw(mNumPos.x + shadowOffs + 10.0f, mNumPos.y + shadowOffs, mNumSize.x, mNumSize.y, false, false, false);
|
|
mNum[1][1]->draw(mNumPos.x + mNumSize.x + shadowOffs + 5.0f, mNumPos.y + shadowOffs, mNumSize.x, mNumSize.y, false, false, false);
|
|
mNum[0][1]->draw(mNumPos.x + mNumSize.x * 2.0f + shadowOffs, mNumPos.y + shadowOffs, mNumSize.x, mNumSize.y, false, false, false);
|
|
|
|
mNum[2][0]->draw(mNumPos.x + 10.0f, mNumPos.y, mNumSize.x, mNumSize.y, false, false, false);
|
|
mNum[1][0]->draw(mNumPos.x + mNumSize.x + 5.0f, mNumPos.y, mNumSize.x, mNumSize.y, false, false, false);
|
|
mNum[0][0]->draw(mNumPos.x + mNumSize.x * 2.0f, mNumPos.y, mNumSize.x, mNumSize.y, false, false, false);
|
|
}
|
|
|
|
/* 800C9348-800C946C .text init__16dDlst_2DObject_cFP7ResTIMGP7ResTIMG */
|
|
bool dDlst_2DObject_c::init(ResTIMG* img1, ResTIMG* img2) {
|
|
mPicture[0] = new J2DPicture(img1);
|
|
if (mPicture[0] == NULL)
|
|
return false;
|
|
mSize[0].x = img1->width;
|
|
mSize[0].y = img1->height;
|
|
|
|
mPicture[1] = new J2DPicture(img2);
|
|
if (mPicture[1] == NULL)
|
|
return false;
|
|
mSize[1].x = img2->width;
|
|
mSize[1].y = img2->height;
|
|
mScale = 1.0f;
|
|
mCurrentNo = 0;
|
|
|
|
return true;
|
|
}
|
|
|
|
/* 800C946C-800C9520 .text draw__16dDlst_2DObject_cFv */
|
|
void dDlst_2DObject_c::draw() {
|
|
J2DOrthoGraph* graf = dComIfGp_getCurrentGrafPort();
|
|
graf->setPort();
|
|
|
|
if (mCurrentNo == 0) {
|
|
mPicture[0]->draw(mPos.x, mPos.y, mSize[0].x * mScale, mSize[0].y * mScale, false, false, false);
|
|
} else {
|
|
mPicture[1]->draw(mPos.x, mPos.y, mSize[1].x * mScale, mSize[1].y * mScale, false, false, false);
|
|
}
|
|
}
|
|
|
|
/* 800C9520-800C9690 .text initial__17dDlst_2DOutFont_cFv */
|
|
void dDlst_2DOutFont_c::initial() {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C9690-800C976C .text setPane__17dDlst_2DOutFont_cFP7JUTFontP18fopMsgM_pane_classP18fopMsgM_pane_classP18fopMsgM_pane_classP18fopMsgM_pane_class */
|
|
void dDlst_2DOutFont_c::setPane(JUTFont*, fopMsgM_pane_class*, fopMsgM_pane_class*, fopMsgM_pane_class*, fopMsgM_pane_class*) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C976C-800C9844 .text setPaneEx__17dDlst_2DOutFont_cFP7JUTFontP18fopMsgM_pane_classP18fopMsgM_pane_classP18fopMsgM_pane_classP18fopMsgM_pane_classPc */
|
|
void dDlst_2DOutFont_c::setPaneEx(JUTFont*, fopMsgM_pane_class*, fopMsgM_pane_class*, fopMsgM_pane_class*, fopMsgM_pane_class*, char*) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C9844-800C9854 .text setRuby__17dDlst_2DOutFont_cFP7JUTFontP18fopMsgM_pane_class */
|
|
void dDlst_2DOutFont_c::setRuby(JUTFont*, fopMsgM_pane_class*) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C9854-800C9864 .text setRubyEx__17dDlst_2DOutFont_cFP7JUTFontP18fopMsgM_pane_classPc */
|
|
void dDlst_2DOutFont_c::setRubyEx(JUTFont*, fopMsgM_pane_class*, char*) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C9864-800C9908 .text charWidth__17dDlst_2DOutFont_cFi */
|
|
void dDlst_2DOutFont_c::charWidth(int) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C9908-800C99C0 .text rubyCharWidth__17dDlst_2DOutFont_cFi */
|
|
void dDlst_2DOutFont_c::rubyCharWidth(int) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C99C0-800C9D5C .text iconset__17dDlst_2DOutFont_cFiPPc */
|
|
void dDlst_2DOutFont_c::iconset(int, char**) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800C9D5C-800CA8A8 .text messageSet__17dDlst_2DOutFont_cFUl */
|
|
void dDlst_2DOutFont_c::messageSet(u32) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800CA8A8-800CAB5C .text outFontStickAnime1__17dDlst_2DOutFont_cFUc */
|
|
void dDlst_2DOutFont_c::outFontStickAnime1(u8) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800CAB5C-800CADEC .text outFontStickAnime2__17dDlst_2DOutFont_cFUcUc */
|
|
void dDlst_2DOutFont_c::outFontStickAnime2(u8, u8) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800CADEC-800CB0C0 .text outFontStickAnime3__17dDlst_2DOutFont_cFUcUc */
|
|
void dDlst_2DOutFont_c::outFontStickAnime3(u8, u8) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800CB0C0-800CB2E0 .text outFontStickAnimePiece__17dDlst_2DOutFont_cFUcUc */
|
|
void dDlst_2DOutFont_c::outFontStickAnimePiece(u8, u8) {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800CB2E0-800CB474 .text move__17dDlst_2DOutFont_cFv */
|
|
void dDlst_2DOutFont_c::move() {
|
|
/* Nonmatching */
|
|
}
|
|
|
|
/* 800CB474-800CB4B0 .text setAlpha__17dDlst_2DOutFont_cFUc */
|
|
void dDlst_2DOutFont_c::setAlpha(u8) {
|
|
/* Nonmatching */
|
|
}
|