mirror of
https://github.com/zeldaret/ss
synced 2026-07-08 22:04:41 -04:00
_talk and _link with the same problems as _get and _sword
This commit is contained in:
@@ -180,15 +180,19 @@ void dLytMsgWindowGet_c::draw() {
|
||||
// The instruction patterns here are the same that EGG::StateGX::Scoped
|
||||
// generates, but there's no RAII to be found here. What's the missing
|
||||
// link that makes the compiler generate these?
|
||||
bool bVis0 = mpPanes[0]->IsVisible();
|
||||
bool bVis1 = mpPanes[1]->IsVisible();
|
||||
bool bVis2 = mpPanes[2]->IsVisible();
|
||||
bool bVis3 = mpPanes[3]->IsVisible();
|
||||
bool bVis4 = mpPanes[4]->IsVisible();
|
||||
// When you fix this, fix other instances of this problem
|
||||
// by searching for 91657b77
|
||||
bool bVis[5] = {
|
||||
mpPanes[0]->IsVisible(),
|
||||
mpPanes[1]->IsVisible(),
|
||||
mpPanes[2]->IsVisible(),
|
||||
mpPanes[3]->IsVisible(),
|
||||
mpPanes[4]->IsVisible(),
|
||||
};
|
||||
|
||||
mpPanes[0]->SetVisible(bVis0);
|
||||
mpPanes[1]->SetVisible(bVis1);
|
||||
mpPanes[2]->SetVisible(bVis2);
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
mpPanes[3]->SetVisible(false);
|
||||
mpPanes[4]->SetVisible(false);
|
||||
|
||||
@@ -198,16 +202,16 @@ void dLytMsgWindowGet_c::draw() {
|
||||
mpPanes[0]->SetVisible(false);
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpPanes[2]->SetVisible(false);
|
||||
mpPanes[3]->SetVisible(bVis3);
|
||||
mpPanes[4]->SetVisible(bVis4);
|
||||
mpPanes[3]->SetVisible(bVis[3]);
|
||||
mpPanes[4]->SetVisible(bVis[4]);
|
||||
|
||||
mLyt.draw();
|
||||
|
||||
mpPanes[0]->SetVisible(bVis0);
|
||||
mpPanes[1]->SetVisible(bVis1);
|
||||
mpPanes[2]->SetVisible(bVis2);
|
||||
mpPanes[3]->SetVisible(bVis3);
|
||||
mpPanes[4]->SetVisible(bVis4);
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
mpPanes[3]->SetVisible(bVis[3]);
|
||||
mpPanes[4]->SetVisible(bVis[4]);
|
||||
}
|
||||
|
||||
void dLytMsgWindowGet_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_link.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowLink_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "linkWindow_00_in.brlan", "G_inOut_00"},
|
||||
{ "linkWindow_00_out.brlan", "G_inOut_00"},
|
||||
{"linkWindow_00_position.brlan", "G_position_00"},
|
||||
{"linkWindow_00_loop.brlan", "G_loop_00"},
|
||||
};
|
||||
|
||||
#define LINK_ANIM_IN 0
|
||||
#define LINK_ANIM_OUT 1
|
||||
#define LINK_ANIM_POSITION 2
|
||||
#define LINK_ANIM_LOOP 3
|
||||
|
||||
#define LINK_NUM_ANIMS 4
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_window_00", "N_message_00", "N_aBtn_00", "N_inOut_00", "N_position_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowLink_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("linkWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < LINK_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[LINK_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
mSubpaneList.PushBack(&mNodes[i]);
|
||||
}
|
||||
|
||||
if (mLyt.getLayout()->GetGroupContainer() != nullptr) {
|
||||
nw4r::lyt::Group *g = mLyt.getLayout()->GetGroupContainer()->FindGroupByName(sGroupName);
|
||||
if (g != nullptr) {
|
||||
d2d::dSubPane::linkMeters(g, &mSubpaneList);
|
||||
}
|
||||
}
|
||||
|
||||
mText.build(resAcc, dLytTextLight::NORMAL);
|
||||
mBlurRelated.build();
|
||||
|
||||
mpPanes[3]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[3]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
mTranslationOrig.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationTo.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationFrom.copyFrom(mpPanes[4]->GetTranslate());
|
||||
|
||||
mParam = 0;
|
||||
|
||||
mOffset.x = mOffset.y = 0.0f;
|
||||
|
||||
field_0x05BC = 0;
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowLink_c::remove() {
|
||||
mText.remove();
|
||||
|
||||
for (d2d::SubPaneList::Iterator it = mSubpaneList.GetBeginIter(); it != mSubpaneList.GetEndIter(); ++it) {
|
||||
d2d::dSubPane *subPane = it->mpLytPane;
|
||||
if (subPane != nullptr) {
|
||||
nw4r::lyt::Pane *parent = subPane->getPane()->GetParent();
|
||||
parent->RemoveChild(subPane->getPane());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < LINK_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_In() {
|
||||
mAnm[LINK_ANIM_POSITION].setFrame(mParam);
|
||||
mAnm[LINK_ANIM_POSITION].setAnimEnable(true);
|
||||
mLyt.calc();
|
||||
mAnm[LINK_ANIM_POSITION].setAnimEnable(false);
|
||||
|
||||
mTranslationTo = mTranslationOrig;
|
||||
mTranslationTo.y = mpPanes[4]->GetTranslate().y;
|
||||
mTranslationFrom = mTranslationTo;
|
||||
|
||||
mAnm[LINK_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_IN].setFrame(0.0f);
|
||||
|
||||
mpPanes[4]->SetTranslate(mTranslationFrom);
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_In() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[LINK_ANIM_IN].isEndReached()) {
|
||||
v = mTranslationTo;
|
||||
} else {
|
||||
// TODO - when you fix this, fix other instances of this
|
||||
// by searching for de4663d6
|
||||
v = mpPanes[4]->GetTranslate();
|
||||
v += (mTranslationTo - v) / 2.0f;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[LINK_ANIM_IN].isEndReached()) {
|
||||
mAnm[LINK_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Wait() {
|
||||
field_0x05BC = UnkTextThing::getInstance()->getField_0x7AE();
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Wait() {
|
||||
if (--field_0x05BC > 0) {
|
||||
return;
|
||||
}
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Visible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize();
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffset.x = transform._03 - size.width / 2;
|
||||
mOffset.y = transform._13 + size.height / 2;
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowLink_c::initializeState_Out() {
|
||||
mTranslationFrom = mTranslationTo;
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[LINK_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowLink_c::executeState_Out() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[LINK_ANIM_OUT].isEndReached()) {
|
||||
v = mTranslationFrom;
|
||||
} else {
|
||||
f32 ratio = mAnm[LINK_ANIM_OUT].getRatio();
|
||||
if (ratio > 1.0f) {
|
||||
ratio = 1.0f;
|
||||
}
|
||||
v = mTranslationTo + (mTranslationFrom - mTranslationTo) * ratio;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[LINK_ANIM_OUT].isEndReached()) {
|
||||
mAnm[LINK_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowLink_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowLink_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < LINK_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::draw() {
|
||||
// NONMATCHING
|
||||
// The instruction patterns here are the same that EGG::StateGX::Scoped
|
||||
// generates, but there's no RAII to be found here. What's the missing
|
||||
// link that makes the compiler generate these?
|
||||
// When you fix this, fix other instances of this problem
|
||||
// by searching for 91657b77
|
||||
bool bVis[3] = {
|
||||
mpPanes[0]->IsVisible(),
|
||||
mpPanes[1]->IsVisible(),
|
||||
mpPanes[2]->IsVisible(),
|
||||
};
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpPanes[2]->SetVisible(false);
|
||||
|
||||
mLyt.draw();
|
||||
mBlurRelated.drawTextBlur(&mText, mOffset, mpPanes[5]->GetAlpha());
|
||||
|
||||
mpPanes[0]->SetVisible(false);
|
||||
mpPanes[3]->SetVisible(bVis[1]);
|
||||
mpPanes[4]->SetVisible(bVis[2]);
|
||||
|
||||
mLyt.draw();
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mpActor = obj;
|
||||
mParam = param;
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
// Curiously enough, this file is almost an exact copy of d_lyt_msg_window_talk,
|
||||
// but the behavior of these two functions (isDoneOpening/isDoneClosing) is swapped
|
||||
bool dLytMsgWindowLink_c::isDoneOpening() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_In);
|
||||
}
|
||||
|
||||
void dLytMsgWindowLink_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowLink_c::isDoneClosing() const {
|
||||
if (*mStateMgr.getStateID() == StateID_Out || *mStateMgr.getStateID() == StateID_Wait) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowLink_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
@@ -234,7 +234,8 @@ void dLytMsgWindowSword_c::executeState_Out() {
|
||||
if (mAnm[SWORD_ANIM_OUT].isEndReached()) {
|
||||
v = mTranslationFrom;
|
||||
} else {
|
||||
// TODO floats
|
||||
// TODO - when you fix this, fix other instances of this
|
||||
// by searching for de4663d6
|
||||
v = mpPanes[2]->GetTranslate();
|
||||
v += (mTranslationTo - v) / 2.0f;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,300 @@
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_talk.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_tag_processor.h"
|
||||
#include "d/d_textunk.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_textbox.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window_common.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "s/s_State.hpp"
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Invisible);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, In);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Wait);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Visible);
|
||||
STATE_DEFINE(dLytMsgWindowTalk_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "messageWindow_00_in.brlan", "G_inOut_00"},
|
||||
{ "messageWindow_00_out.brlan", "G_inOut_00"},
|
||||
{"messageWindow_00_position.brlan", "G_position_00"},
|
||||
{ "messageWindow_00_loop.brlan", "G_loop_00"},
|
||||
};
|
||||
|
||||
#define TALK_ANIM_IN 0
|
||||
#define TALK_ANIM_OUT 1
|
||||
#define TALK_ANIM_POSITION 2
|
||||
#define TALK_ANIM_LOOP 3
|
||||
|
||||
#define TALK_NUM_ANIMS 4
|
||||
|
||||
static const char *sPanes[] = {
|
||||
"N_window_00", "N_message_00", "N_aBtn_00", "N_inOut_00", "N_position_00",
|
||||
};
|
||||
|
||||
static const char *sTextBoxes[] = {
|
||||
"T_message_00",
|
||||
"T_messageS_00",
|
||||
};
|
||||
|
||||
static const char *sGroupName = "G_ref_00";
|
||||
|
||||
bool dLytMsgWindowTalk_c::build(d2d::ResAccIf_c *resAcc1, d2d::ResAccIf_c *resAcc, dTagProcessor_c *tagProcessor) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("messageWindow_00.brlyt", nullptr);
|
||||
mLyt.setPriority(0x8A);
|
||||
|
||||
for (int i = 0; i < TALK_NUM_ANIMS; i++) {
|
||||
mAnm[i].init(brlanMap[i].mFile, resAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnm[i].bind(false);
|
||||
mAnm[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnm[TALK_ANIM_LOOP].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(false);
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
mpPanes[i] = mLyt.findPane(sPanes[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
mpTextboxes[i] = mLyt.getTextBox(sTextBoxes[i]);
|
||||
mpTextboxes[i]->SetTextPositionH(0);
|
||||
mpTextboxes[i]->SetTextPositionV(0);
|
||||
}
|
||||
|
||||
mpTextboxes[1]->set0x1F6(1);
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane = &mBtn;
|
||||
mBtn.build(resAcc);
|
||||
mSubpaneList.PushBack(&mNodes[i]);
|
||||
}
|
||||
|
||||
if (mLyt.getLayout()->GetGroupContainer() != nullptr) {
|
||||
nw4r::lyt::Group *g = mLyt.getLayout()->GetGroupContainer()->FindGroupByName(sGroupName);
|
||||
if (g != nullptr) {
|
||||
d2d::dSubPane::linkMeters(g, &mSubpaneList);
|
||||
}
|
||||
}
|
||||
|
||||
mText.build(resAcc, dLytTextLight::NORMAL);
|
||||
mBlurRelated.build();
|
||||
|
||||
mpPanes[3]->SetVisible(true);
|
||||
mLyt.calc();
|
||||
mpPanes[3]->SetVisible(false);
|
||||
mpTagProcessor = tagProcessor;
|
||||
|
||||
mTranslationOrig.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationTo.copyFrom(mpPanes[4]->GetTranslate());
|
||||
mTranslationFrom.copyFrom(mpPanes[4]->GetTranslate());
|
||||
|
||||
mParam = 0;
|
||||
|
||||
mOffset.x = mOffset.y = 0.0f;
|
||||
|
||||
field_0x05BC = 0;
|
||||
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::remove() {
|
||||
mText.remove();
|
||||
|
||||
for (d2d::SubPaneList::Iterator it = mSubpaneList.GetBeginIter(); it != mSubpaneList.GetEndIter(); ++it) {
|
||||
d2d::dSubPane *subPane = it->mpLytPane;
|
||||
if (subPane != nullptr) {
|
||||
nw4r::lyt::Pane *parent = subPane->getPane()->GetParent();
|
||||
parent->RemoveChild(subPane->getPane());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->remove();
|
||||
}
|
||||
mBtn.remove();
|
||||
for (int i = 0; i < TALK_NUM_ANIMS; i++) {
|
||||
mAnm[i].remove();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Invisible() {
|
||||
mBtn.resetToInvisble();
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Invisible() {
|
||||
if (mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Invisible() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_In() {
|
||||
mAnm[TALK_ANIM_POSITION].setFrame(mParam);
|
||||
mAnm[TALK_ANIM_POSITION].setAnimEnable(true);
|
||||
mLyt.calc();
|
||||
mAnm[TALK_ANIM_POSITION].setAnimEnable(false);
|
||||
|
||||
mTranslationTo = mTranslationOrig;
|
||||
mTranslationTo.y = mpPanes[4]->GetTranslate().y;
|
||||
mTranslationFrom = mTranslationTo;
|
||||
|
||||
mAnm[TALK_ANIM_IN].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_IN].setFrame(0.0f);
|
||||
|
||||
mpPanes[4]->SetTranslate(mTranslationFrom);
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_In() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[TALK_ANIM_IN].isEndReached()) {
|
||||
v = mTranslationTo;
|
||||
} else {
|
||||
// TODO - when you fix this, fix other instances of this
|
||||
// by searching for de4663d6
|
||||
v = mpPanes[4]->GetTranslate();
|
||||
v += (mTranslationTo - v) / 2.0f;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[TALK_ANIM_IN].isEndReached()) {
|
||||
mAnm[TALK_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_In() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Wait() {
|
||||
field_0x05BC = UnkTextThing::getInstance()->getField_0x7AE();
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Wait() {
|
||||
if (--field_0x05BC > 0) {
|
||||
return;
|
||||
}
|
||||
mStateMgr.changeState(StateID_Visible);
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Visible() {
|
||||
nw4r::lyt::Size size = getTextBox()->GetSize();
|
||||
nw4r::lyt::Size fontSize = getTextBox()->GetFontSize();
|
||||
nw4r::math::MTX34 transform = getTextBox()->GetGlobalMtx();
|
||||
|
||||
mOffset.x = transform._03 - size.width / 2;
|
||||
mOffset.y = transform._13 + size.height / 2;
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Visible() {
|
||||
if (!mShouldBeOpen) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Visible() {}
|
||||
|
||||
void dLytMsgWindowTalk_c::initializeState_Out() {
|
||||
mTranslationFrom = mTranslationTo;
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(true);
|
||||
mAnm[TALK_ANIM_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytMsgWindowTalk_c::executeState_Out() {
|
||||
if (mTranslationFrom != mTranslationTo) {
|
||||
mVec3_c v;
|
||||
if (mAnm[TALK_ANIM_OUT].isEndReached()) {
|
||||
v = mTranslationFrom;
|
||||
} else {
|
||||
f32 ratio = mAnm[TALK_ANIM_OUT].getRatio();
|
||||
if (ratio > 1.0f) {
|
||||
ratio = 1.0f;
|
||||
}
|
||||
v = mTranslationTo + (mTranslationFrom - mTranslationTo) * ratio;
|
||||
}
|
||||
mpPanes[4]->SetTranslate(v);
|
||||
}
|
||||
|
||||
if (mAnm[TALK_ANIM_OUT].isEndReached()) {
|
||||
mAnm[TALK_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Invisible);
|
||||
}
|
||||
}
|
||||
void dLytMsgWindowTalk_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytMsgWindowTalk_c::execute() {
|
||||
mStateMgr.executeState();
|
||||
for (int i = 0; i < TALK_NUM_ANIMS; i++) {
|
||||
if (mAnm[i].isEnabled()) {
|
||||
mAnm[i].play();
|
||||
}
|
||||
}
|
||||
mLyt.calc();
|
||||
for (int i = 0; i < 1; i++) {
|
||||
mNodes[i].mpLytPane->execute();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::draw() {
|
||||
// NONMATCHING
|
||||
// The instruction patterns here are the same that EGG::StateGX::Scoped
|
||||
// generates, but there's no RAII to be found here. What's the missing
|
||||
// link that makes the compiler generate these?
|
||||
// When you fix this, fix other instances of this problem
|
||||
// by searching for 91657b77
|
||||
bool bVis[3] = {
|
||||
mpPanes[0]->IsVisible(),
|
||||
mpPanes[1]->IsVisible(),
|
||||
mpPanes[2]->IsVisible(),
|
||||
};
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(false);
|
||||
mpPanes[2]->SetVisible(false);
|
||||
|
||||
mLyt.draw();
|
||||
mBlurRelated.drawTextBlur(&mText, mOffset, mpPanes[5]->GetAlpha());
|
||||
|
||||
mpPanes[0]->SetVisible(false);
|
||||
mpPanes[3]->SetVisible(bVis[1]);
|
||||
mpPanes[4]->SetVisible(bVis[2]);
|
||||
|
||||
mLyt.draw();
|
||||
|
||||
mpPanes[0]->SetVisible(bVis[0]);
|
||||
mpPanes[1]->SetVisible(bVis[1]);
|
||||
mpPanes[2]->SetVisible(bVis[2]);
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::open(dAcObjBase_c *obj, u32 param) {
|
||||
mpActor = obj;
|
||||
mParam = param;
|
||||
mShouldBeOpen = true;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::isDoneOpening() const {
|
||||
if (*mStateMgr.getStateID() == StateID_In || *mStateMgr.getStateID() == StateID_Wait) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytMsgWindowTalk_c::close() {
|
||||
mShouldBeOpen = false;
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::isDoneClosing() const {
|
||||
return !(*mStateMgr.getStateID() == StateID_Out);
|
||||
}
|
||||
|
||||
bool dLytMsgWindowTalk_c::setText(const wchar_t *text) {
|
||||
mpTextboxes[0]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[1]->SetTagProcessor(mpTagProcessor);
|
||||
mpTextboxes[0]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
mpTextboxes[1]->setTextWithTextProcessor(text, mpTagProcessor, 0);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user