mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-25 15:05:06 -04:00
4dc0cd9d09
* Fix missing arg to JUT_ASSERT * Fix some MWCC version diff errors * Compile m_Do_ext, d_demo, actor_mng * Add VSCode task to quickly switch between versions * Unlink magLift for debug * Update the hash of the debug dol The old cbea5fa... hash here was for the dol generated by the alf2dol.py script, which produces incorrect alignment. The dol with the new hash can be obtained by using `dtk elf2dol` to convert the debug .alf file to a dol. The DOL now builds OK. * Fix all debug REL dtor splits All RELs now also build OK, meaning `ninja build/ShieldD/ok` now succeeds. * Add genMessage declarations to all HIO subclasses * Fixing more compilation errors * m_Do_mtx 100% on debug Cannot be linked due to weak function name mangling? * Improve various matches * Fix all remaining compilation errors * Fix new compilation errors from main * Fix retail regression * Link f_pc_profile_lst
287 lines
9.1 KiB
C++
287 lines
9.1 KiB
C++
#include "d/d_msg_scrn_light.h"
|
|
#include "JSystem/J2DGraph/J2DAnmLoader.h"
|
|
#include "JSystem/J2DGraph/J2DGrafContext.h"
|
|
#include "JSystem/J2DGraph/J2DScreen.h"
|
|
#include "d/d_com_inf_game.h"
|
|
#include "d/d_pane_class.h"
|
|
|
|
class dMsgScrnLight_HIO_c {
|
|
public:
|
|
/* 8024575C */ dMsgScrnLight_HIO_c();
|
|
/* 802457C4 */ void updateColor(u8);
|
|
/* 80246348 */ virtual ~dMsgScrnLight_HIO_c() {}
|
|
|
|
enum {
|
|
COLOR_DEFAULT_e,
|
|
COLOR_RED_e,
|
|
COLOR_GREEN_e,
|
|
COLOR_BLUE_e,
|
|
COLOR_YELLOW_e,
|
|
COLOR_LIGHT_BLUE_e,
|
|
COLOR_PURPLE_e,
|
|
COLOR_GREY_e,
|
|
COLOR_ORANGE_e,
|
|
COLOR_MAX_e,
|
|
};
|
|
|
|
/* 0x04 */ s8 field_0x04;
|
|
/* 0x05 */ bool mDebugON;
|
|
/* 0x06 */ u8 mBlackR[COLOR_MAX_e];
|
|
/* 0x0F */ u8 mWhiteR[COLOR_MAX_e];
|
|
/* 0x18 */ u8 mBlackG[COLOR_MAX_e];
|
|
/* 0x21 */ u8 mWhiteG[COLOR_MAX_e];
|
|
/* 0x2A */ u8 mBlackB[COLOR_MAX_e];
|
|
/* 0x33 */ u8 mWhiteB[COLOR_MAX_e];
|
|
/* 0x3C */ u8 mBlackA[COLOR_MAX_e];
|
|
/* 0x45 */ u8 mWhiteA[COLOR_MAX_e];
|
|
};
|
|
|
|
/* 8024575C-802457C4 24009C 0068+00 1/1 0/0 0/0 .text __ct__19dMsgScrnLight_HIO_cFv */
|
|
dMsgScrnLight_HIO_c::dMsgScrnLight_HIO_c() {
|
|
mDebugON = false;
|
|
|
|
for (int i = 0; i < COLOR_MAX_e; i++) {
|
|
mBlackR[i] = 160;
|
|
mBlackG[i] = 135;
|
|
mBlackB[i] = 20;
|
|
mBlackA[i] = 0;
|
|
|
|
mWhiteR[i] = 225;
|
|
mWhiteG[i] = 210;
|
|
mWhiteB[i] = 110;
|
|
mWhiteA[i] = 210;
|
|
}
|
|
}
|
|
|
|
/* 802457C4-80245934 240104 0170+00 1/1 0/0 0/0 .text updateColor__19dMsgScrnLight_HIO_cFUc */
|
|
void dMsgScrnLight_HIO_c::updateColor(u8 i_colorType) {
|
|
switch (i_colorType) {
|
|
case 0:
|
|
for (int i = 0; i < COLOR_MAX_e; i++) {
|
|
mBlackR[i] = 160;
|
|
mBlackG[i] = 135;
|
|
mBlackB[i] = 20;
|
|
mBlackA[i] = 0;
|
|
|
|
mWhiteR[i] = 225;
|
|
mWhiteG[i] = 210;
|
|
mWhiteB[i] = 110;
|
|
mWhiteA[i] = 160;
|
|
}
|
|
break;
|
|
case 2:
|
|
for (int i = 0; i < COLOR_MAX_e; i++) {
|
|
mBlackR[i] = 255;
|
|
mBlackG[i] = 250;
|
|
mBlackB[i] = 150;
|
|
mBlackA[i] = 0;
|
|
|
|
mWhiteR[i] = 255;
|
|
mWhiteG[i] = 255;
|
|
mWhiteB[i] = 110;
|
|
mWhiteA[i] = 210;
|
|
}
|
|
break;
|
|
case 1:
|
|
for (int i = 0; i < COLOR_MAX_e; i++) {
|
|
mBlackR[i] = 40;
|
|
mBlackG[i] = 110;
|
|
mBlackB[i] = 180;
|
|
mBlackA[i] = 0;
|
|
|
|
mWhiteR[i] = 40;
|
|
mWhiteG[i] = 110;
|
|
mWhiteB[i] = 180;
|
|
mWhiteA[i] = 120;
|
|
}
|
|
break;
|
|
case 4:
|
|
for (int i = 0; i < COLOR_MAX_e; i++) {
|
|
mBlackR[i] = 70;
|
|
mBlackG[i] = 150;
|
|
mBlackB[i] = 0;
|
|
mBlackA[i] = 0;
|
|
|
|
mWhiteR[i] = 70;
|
|
mWhiteG[i] = 150;
|
|
mWhiteB[i] = 0;
|
|
mWhiteA[i] = 150;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
/* 804306D4-80430728 05D3F4 0050+04 3/3 0/0 0/0 .bss g_MsgScrnLight_HIO_c */
|
|
static dMsgScrnLight_HIO_c g_MsgScrnLight_HIO_c;
|
|
|
|
static u8 l_lightCount;
|
|
|
|
/* 80245934-80245B00 240274 01CC+00 0/0 4/4 1/1 .text __ct__15dMsgScrnLight_cFUcUc */
|
|
dMsgScrnLight_c::dMsgScrnLight_c(u8 i_colorType, u8 param_1) {
|
|
mColorType = i_colorType;
|
|
field_0x21 = param_1;
|
|
|
|
if (l_lightCount == 0) {
|
|
g_MsgScrnLight_HIO_c.field_0x04 = -1;
|
|
}
|
|
l_lightCount++;
|
|
|
|
g_MsgScrnLight_HIO_c.updateColor(i_colorType);
|
|
|
|
mpScreen = new J2DScreen();
|
|
JUT_ASSERT(0, mpScreen != 0);
|
|
bool fg = mpScreen->setPriority("zelda_message_window_text_light.blo", 0x20000,
|
|
dComIfGp_getMain2DArchive());
|
|
JUT_ASSERT(0, fg != false);
|
|
dPaneClass_showNullPane(mpScreen);
|
|
|
|
OSInitFastCast();
|
|
mpBck = (J2DAnmTransform*)J2DAnmLoaderDataBase::load(
|
|
JKRGetNameResource("zelda_message_window_text_light.bck", dComIfGp_getMain2DArchive()));
|
|
mBckFrame = 0.0f;
|
|
|
|
mpBpk = (J2DAnmColorKey*)J2DAnmLoaderDataBase::load(
|
|
JKRGetNameResource("zelda_message_window_text_light.bpk", dComIfGp_getMain2DArchive()));
|
|
mpBpk->searchUpdateMaterialID(mpScreen);
|
|
mBpkFrame = 0.0f;
|
|
|
|
mpParent_c = new CPaneMgr(mpScreen, 'moya00', 0, NULL);
|
|
JUT_ASSERT(0, mpParent_c != 0);
|
|
|
|
mpParent_c->getPanePtr()->setAnimation(mpBck);
|
|
mpParent_c->getPanePtr()->setAnimation(mpBpk);
|
|
mPlayAnim = true;
|
|
mAlpha = 0.0f;
|
|
}
|
|
|
|
/* 80245B00-80245C04 240440 0104+00 1/0 0/0 0/0 .text __dt__15dMsgScrnLight_cFv */
|
|
dMsgScrnLight_c::~dMsgScrnLight_c() {
|
|
l_lightCount--;
|
|
|
|
delete mpScreen;
|
|
mpScreen = NULL;
|
|
|
|
delete mpBck;
|
|
mpBck = NULL;
|
|
|
|
delete mpBpk;
|
|
mpBpk = NULL;
|
|
|
|
delete mpParent_c;
|
|
mpParent_c = NULL;
|
|
}
|
|
|
|
/* 80245C04-80245F90 240544 038C+00 0/0 2/2 0/0 .text draw__15dMsgScrnLight_cFPffffffUc
|
|
*/
|
|
void dMsgScrnLight_c::draw(f32* i_anmFrame, f32 i_posX, f32 i_posY, f32 i_scaleX, f32 i_scaleY,
|
|
f32 i_alpha, u8 i_colorType) {
|
|
if (g_MsgScrnLight_HIO_c.mDebugON) {
|
|
if (i_colorType < dMsgScrnLight_HIO_c::COLOR_MAX_e) {
|
|
mpParent_c->setBlackWhite(JUtility::TColor(g_MsgScrnLight_HIO_c.mBlackR[i_colorType],
|
|
g_MsgScrnLight_HIO_c.mBlackG[i_colorType],
|
|
g_MsgScrnLight_HIO_c.mBlackB[i_colorType],
|
|
g_MsgScrnLight_HIO_c.mBlackA[i_colorType]),
|
|
JUtility::TColor(g_MsgScrnLight_HIO_c.mWhiteR[i_colorType],
|
|
g_MsgScrnLight_HIO_c.mWhiteG[i_colorType],
|
|
g_MsgScrnLight_HIO_c.mWhiteB[i_colorType],
|
|
g_MsgScrnLight_HIO_c.mWhiteA[i_colorType]));
|
|
} else {
|
|
mpParent_c->setBlackWhite(mpParent_c->getInitBlack(), mpParent_c->getInitWhite());
|
|
}
|
|
} else {
|
|
if (mColorType == 0) {
|
|
mpParent_c->setBlackWhite(JUtility::TColor(160, 135, 20, 0),
|
|
JUtility::TColor(225, 210, 110, 160));
|
|
} else if (mColorType == 2) {
|
|
mpParent_c->setBlackWhite(JUtility::TColor(255, 255, 150, 0),
|
|
JUtility::TColor(255, 255, 110, 210));
|
|
} else if (mColorType == 1) {
|
|
mpParent_c->setBlackWhite(JUtility::TColor(40, 110, 180, 0),
|
|
JUtility::TColor(40, 110, 180, 120));
|
|
} else if (mColorType == 4) {
|
|
mpParent_c->setBlackWhite(JUtility::TColor(70, 150, 0, 0),
|
|
JUtility::TColor(70, 150, 0, 150));
|
|
} else {
|
|
mpParent_c->setBlackWhite(mpParent_c->getInitBlack(), mpParent_c->getInitWhite());
|
|
}
|
|
}
|
|
|
|
if (mPlayAnim) {
|
|
*i_anmFrame += 1.0f;
|
|
if (*i_anmFrame >= mpBck->getFrameMax()) {
|
|
*i_anmFrame = 0.0f;
|
|
}
|
|
|
|
mBckFrame = *i_anmFrame;
|
|
mBpkFrame = *i_anmFrame;
|
|
}
|
|
|
|
drawCommon(i_posX, i_posY, i_scaleX, i_scaleY, i_alpha);
|
|
}
|
|
|
|
/* 80245F90-802460DC 2408D0 014C+00 0/0 1/1 1/1 .text
|
|
* draw__15dMsgScrnLight_cFPfffffffQ28JUtility6TColorQ28JUtility6TColor */
|
|
void dMsgScrnLight_c::draw(f32* i_anmFrame, f32 i_posX, f32 i_posY, f32 i_scaleX, f32 i_scaleY,
|
|
f32 i_alpha, f32 i_anmRate, JUtility::TColor i_black,
|
|
JUtility::TColor i_white) {
|
|
mpParent_c->setBlackWhite(i_black, i_white);
|
|
|
|
if (mPlayAnim) {
|
|
*i_anmFrame += i_anmRate;
|
|
|
|
if (*i_anmFrame >= mpBck->getFrameMax()) {
|
|
*i_anmFrame = 0.0f;
|
|
}
|
|
|
|
mBckFrame = *i_anmFrame;
|
|
mBpkFrame = *i_anmFrame;
|
|
}
|
|
|
|
drawCommon(i_posX, i_posY, i_scaleX, i_scaleY, i_alpha);
|
|
}
|
|
|
|
/* 802460DC-80246348 240A1C 026C+00 2/2 0/0 0/0 .text drawCommon__15dMsgScrnLight_cFfffff
|
|
*/
|
|
void dMsgScrnLight_c::drawCommon(f32 i_posX, f32 i_posY, f32 i_scaleX, f32 i_scaleY, f32 i_alpha) {
|
|
J2DGrafContext* graf_ctx = dComIfGp_getCurrentGrafPort();
|
|
graf_ctx->setup2D();
|
|
|
|
f32 alpha_rate = mpParent_c->getAlphaRate();
|
|
|
|
if (((field_0x21 == 3 || field_0x21 == 5) && i_alpha < mAlpha) ||
|
|
(field_0x21 != 3 && field_0x21 != 5 && i_alpha != 1.0f))
|
|
{
|
|
if (mPlayAnim) {
|
|
mpParent_c->getPanePtr()->setAnimation((J2DAnmTransform*)NULL);
|
|
mpParent_c->getPanePtr()->setAnimation((J2DAnmColorKey*)NULL);
|
|
mPlayAnim = false;
|
|
}
|
|
|
|
mpParent_c->setAlphaRate(alpha_rate * i_alpha);
|
|
} else if (!mPlayAnim) {
|
|
mpParent_c->getPanePtr()->setAnimation(mpBck);
|
|
mpParent_c->getPanePtr()->setAnimation(mpBpk);
|
|
mPlayAnim = true;
|
|
}
|
|
|
|
if (mPlayAnim) {
|
|
mpBck->setFrame(mBckFrame);
|
|
mpBpk->setFrame(mBpkFrame);
|
|
mpParent_c->getPanePtr()->animationTransform();
|
|
mpScreen->animation();
|
|
}
|
|
|
|
mpParent_c->translate(i_posX, i_posY);
|
|
|
|
f32 init_scale_x = mpParent_c->getInitScaleX();
|
|
f32 init_scale_y = mpParent_c->getInitScaleY();
|
|
mpParent_c->scale(init_scale_x * i_scaleX, init_scale_y * i_scaleY);
|
|
mpScreen->draw(0.0f, 0.0f, graf_ctx);
|
|
|
|
if (i_alpha != 1.0f) {
|
|
mpParent_c->setAlphaRate(alpha_rate);
|
|
}
|
|
|
|
mAlpha = i_alpha;
|
|
}
|