mirror of
https://github.com/zeldaret/ss
synced 2026-08-20 14:14:40 -04:00
More d/lyt (#52)
* More Lyt (maybe some wrong type associations) * more meter * Rename * More splits and renames * Fix SizedString conversion operators * Renames * dLytBattery_c almost OK * d_lyt_battery OK * diff clean * Continue doing splits while I'm at it * two more splits
This commit is contained in:
+2
-2
@@ -31,10 +31,10 @@ void *loader_c::request(const char *path, u8 mountDirection, EGG::Heap *heap) {
|
||||
mpHeap = heap != nullptr ? heap : mDvd::getArchiveHeap();
|
||||
SizedString<128> buf;
|
||||
buf.sprintf("US%s", path);
|
||||
if (!mDvd::IsExistPath(&buf)) {
|
||||
if (!mDvd::IsExistPath(buf)) {
|
||||
buf.sprintf("%s", path);
|
||||
}
|
||||
mpCommand = mDvd_toMainRam_normal_c::create(&buf, mountDirection, heap);
|
||||
mpCommand = mDvd_toMainRam_normal_c::create(buf, mountDirection, heap);
|
||||
}
|
||||
if (mpCommand != nullptr && mpCommand->mStatus != 0) {
|
||||
mpBuffer = mpCommand->mDataPtr;
|
||||
|
||||
@@ -54,7 +54,7 @@ const char *dFontMng_c::getFontPath(u8 idx) {
|
||||
} else {
|
||||
TEMP_FONT_NAME.sprintf("/US/Font/%s/%s", getUsedLanguageString(), systemFonts[idx]);
|
||||
}
|
||||
return &TEMP_FONT_NAME;
|
||||
return TEMP_FONT_NAME;
|
||||
}
|
||||
|
||||
bool dFontMng_c::create() {
|
||||
|
||||
@@ -112,7 +112,7 @@ bool dRawArcEntry_c::loadArcFromDiskChecked(const char *fileName, const char *di
|
||||
SizedString<128> path;
|
||||
|
||||
if (checkArcExistsOnDiskInner(path, fileName, dirName)) {
|
||||
return loadArcFromDisk(fileName, &path, mountDirection, heap);
|
||||
return loadArcFromDisk(fileName, path, mountDirection, heap);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -133,9 +133,9 @@ BOOL dRawArcEntry_c::checkArcExistsOnDisk(const char *fileName, const char *dirN
|
||||
|
||||
BOOL dRawArcEntry_c::checkArcExistsOnDiskInner(SizedString<128> &path, const char *fileName, const char *dirName) {
|
||||
path.sprintf("/US/%s/%s.arc", dirName, fileName);
|
||||
if (!mDvd::IsExistPath(&path)) {
|
||||
if (!mDvd::IsExistPath(path)) {
|
||||
path.sprintf("/%s/%s.arc", dirName, fileName);
|
||||
if (!mDvd::IsExistPath(&path)) {
|
||||
if (!mDvd::IsExistPath(path)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -347,12 +347,10 @@ int dRawArcTable_c::ensureAllEntriesLoaded() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern "C" bool strequals(const char *, const char *);
|
||||
|
||||
dRawArcEntry_c *dRawArcTable_c::findEntry(const char *name) const {
|
||||
dRawArcEntry_c *entry = mpEntries;
|
||||
for (int i = 0; i < mCount; i++) {
|
||||
if (entry->isReferenced() && strequals(entry->name(), name)) {
|
||||
if (entry->isReferenced() && entry->name() == name) {
|
||||
return entry;
|
||||
}
|
||||
entry++;
|
||||
|
||||
+550
-15
@@ -9,6 +9,7 @@
|
||||
#include <nw4r/lyt/lyt_textBox.h>
|
||||
#include <nw4r/lyt/lyt_utils.h>
|
||||
#include <nw4r/lyt/lyt_window.h>
|
||||
#include <sized_string.h>
|
||||
|
||||
using namespace nw4r::lyt;
|
||||
|
||||
@@ -154,9 +155,17 @@ bool Layout_c::Build(const void *lytResBuf, ResourceAccessor *pResAcsr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
nw4r::lyt::AnimTransform *Layout_c::CreateAnimTransform(const void *animResBuf, nw4r::lyt::ResourceAccessor *pResAcsr) {
|
||||
nw4r::lyt::AnimTransform *transform = nw4r::lyt::Layout::CreateAnimTransform(animResBuf, pResAcsr);
|
||||
if (transform != nullptr) {
|
||||
mAnimTransList.Erase(transform);
|
||||
}
|
||||
return transform;
|
||||
}
|
||||
|
||||
Multi_c::Multi_c() : Base_c(0x80), mLayout(), mDrawInfo(), mpResAcc(nullptr), mFlags(0) {
|
||||
mDrawInfo.SetLocationAdjustScale(nw4r::math::VEC2((float)EGG::Screen::GetSizeXMax(EGG::Screen::TV_MODE_1) /
|
||||
(float)EGG::Screen::GetSizeXMax(EGG::Screen::TV_MODE_2),
|
||||
mDrawInfo.SetLocationAdjustScale(nw4r::math::VEC2((f32)EGG::Screen::GetSizeXMax(EGG::Screen::TV_MODE_1) /
|
||||
(f32)EGG::Screen::GetSizeXMax(EGG::Screen::TV_MODE_2),
|
||||
1.0f));
|
||||
mDrawInfo.SetLocationAdjust(true);
|
||||
}
|
||||
@@ -189,7 +198,29 @@ void Multi_c::calcAfter() {
|
||||
mLayout.CalculateMtx(mDrawInfo);
|
||||
}
|
||||
|
||||
void Multi_c::draw() {}
|
||||
extern "C" bool NeedsScreenAdjustment();
|
||||
|
||||
// Largerly copied from m2d::Simple_c::draw
|
||||
void Multi_c::draw() {
|
||||
nw4r::ut::Rect r = mLayout.GetLayoutRect();
|
||||
f32 near = 0.0f;
|
||||
f32 far = 500.0f;
|
||||
EGG::Screen s;
|
||||
bool needsAdjust = NeedsScreenAdjustment();
|
||||
f32 f1 = EGG::Screen::GetSizeXMax(EGG::Screen::TV_MODE_2);
|
||||
f32 f2 = EGG::Screen::GetSizeXMax(EGG::Screen::TV_MODE_1);
|
||||
|
||||
f32 left = needsAdjust ? f1 * r.left / f2 : r.left;
|
||||
f32 right = needsAdjust ? f1 * r.right / f2 : r.right;
|
||||
s.SetProjectionType(EGG::Frustum::PROJ_ORTHO);
|
||||
s.ResetOrthographic(r.top, r.bottom, left, right, near, far);
|
||||
if (needsAdjust) {
|
||||
s.SetScale(nw4r::math::VEC3(f2 / f1, 1.0f, 1.0f));
|
||||
}
|
||||
s.SetProjectionGX();
|
||||
mDrawInfo.SetMultipleViewMtxOnDraw(false);
|
||||
mLayout.Draw(mDrawInfo);
|
||||
}
|
||||
|
||||
bool Multi_c::build(const char *name, m2d::ResAccIf_c *acc) {
|
||||
if (mLayout.GetRootPane() != nullptr) {
|
||||
@@ -241,14 +272,518 @@ void Multi_c::unbindAnims() {
|
||||
|
||||
LytBase_c::LytBase_c() : mpMsbtInfo(nullptr) {}
|
||||
|
||||
extern "C" void libms__LMS_CloseMessage(void *);
|
||||
LytBase_c::~LytBase_c() {
|
||||
if (mpMsbtInfo != nullptr) {
|
||||
libms__LMS_CloseMessage(mpMsbtInfo);
|
||||
LMS_CloseMessage(mpMsbtInfo);
|
||||
}
|
||||
}
|
||||
|
||||
bool AnmGroup_c::init(const char *fileName, m2d::ResAccIf_c *resAcc, d2d::Layout_c *layout, const char *groupName) {
|
||||
extern "C" const char *getUsedLanguageString();
|
||||
extern "C" nw4r::ut::TagProcessorBase<wchar_t> *GLOBAL_TEXT_MANAGER;
|
||||
|
||||
bool LytBase_c::build(const char *name, m2d::ResAccIf_c *acc) {
|
||||
if (mLayout.GetRootPane() != nullptr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
mFlags |= 0x1;
|
||||
|
||||
if (acc == nullptr) {
|
||||
acc = mpResAcc;
|
||||
if (acc == nullptr) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void *resource = acc->getAccessor()->GetResource(0, name, nullptr);
|
||||
if (resource == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy the name, and once we reach a '.' append 'msbt'
|
||||
char fileName[0x32];
|
||||
int suffixIdx = 0;
|
||||
for (int i = 0; i < 0x32; i++) {
|
||||
if (suffixIdx == 0) {
|
||||
if (name[i] == '.') {
|
||||
suffixIdx = 1;
|
||||
}
|
||||
fileName[i] = name[i];
|
||||
} else if (suffixIdx == 1) {
|
||||
fileName[i] = 'm';
|
||||
suffixIdx = 2;
|
||||
} else if (suffixIdx == 2) {
|
||||
fileName[i] = 's';
|
||||
suffixIdx = 3;
|
||||
} else if (suffixIdx == 3) {
|
||||
fileName[i] = 'b';
|
||||
suffixIdx = 4;
|
||||
} else if (suffixIdx == 4) {
|
||||
fileName[i] = 't';
|
||||
suffixIdx = 5;
|
||||
} else {
|
||||
fileName[i] = '\0';
|
||||
suffixIdx = 6;
|
||||
}
|
||||
}
|
||||
|
||||
if (suffixIdx < 6) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SizedString<0x80> localizedName;
|
||||
localizedName.sprintf("%s_%s", getUsedLanguageString(), fileName);
|
||||
|
||||
void *data = acc->getAccessor()->GetResource(0, localizedName, nullptr);
|
||||
if (data == nullptr) {
|
||||
mpMsbtInfo = nullptr;
|
||||
} else {
|
||||
mpMsbtInfo = LMS_InitMessage(data);
|
||||
}
|
||||
|
||||
bool ok = mLayout.Build(resource, acc->getAccessor());
|
||||
if (ok) {
|
||||
mLayout.SetTagProcessor(GLOBAL_TEXT_MANAGER);
|
||||
calc();
|
||||
setPropertiesRecursive(mLayout.GetRootPane(), -9999.0f, -9999.0f, -9999.0f, -9999.0f, -9999.0f);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
dTextBox_c *LytBase_c::getTextBox(const char *name) {
|
||||
nw4r::lyt::Pane *pane = findPane(name);
|
||||
if (pane != nullptr) {
|
||||
nw4r::ut::DynamicCast<dTextBox_c *>(pane)->setLytBase(this);
|
||||
return nw4r::ut::DynamicCast<dTextBox_c *>(pane);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dWindow_c *LytBase_c::getWindow(const char *name) {
|
||||
nw4r::lyt::Pane *pane = findPane(name);
|
||||
if (pane != nullptr) {
|
||||
return nw4r::ut::DynamicCast<dWindow_c *>(pane);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dTextBox_c *LytBase_c::getSizeBoxInWindow(const char *windowName) {
|
||||
nw4r::lyt::Pane *pane = findPane(windowName);
|
||||
if (pane != nullptr) {
|
||||
dWindow_c *window = nw4r::ut::DynamicCast<dWindow_c *>(pane);
|
||||
return getTextBoxViaUserData(window, "size");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
dTextBox_c *LytBase_c::getTextBoxViaUserData(nw4r::lyt::Pane *pane, const char *name) {
|
||||
u16 num = pane->GetExtUserDataNum();
|
||||
const nw4r::lyt::res::ExtUserData *dat;
|
||||
dTextBox_c *textBox;
|
||||
if (num == 0) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dat = pane->FindExtUserDataByName(name);
|
||||
if (dat == nullptr) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (dat->GetType() != nw4r::lyt::res::TYPE_STRING) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
textBox = getTextBox(dat->GetString());
|
||||
if (textBox == nullptr) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
return textBox;
|
||||
|
||||
fail:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void LytBase_c::setPropertiesRecursive(nw4r::lyt::Pane *pane, f32 posX, f32 posY, f32 scale, f32 spaceX,
|
||||
f32 spaceY) {
|
||||
u16 num = pane->GetExtUserDataNum();
|
||||
if (num != 0) {
|
||||
const nw4r::lyt::res::ExtUserData *list = pane->GetExtUserData();
|
||||
for (int i = 0; i < num; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = list->GetName();
|
||||
if (userDatName == "c11n-posX-1" && list->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
posX = list->GetFloat();
|
||||
}
|
||||
if (userDatName == "c11n-posY-1" && list->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
posY = list->GetFloat();
|
||||
}
|
||||
if (userDatName == "c11n-scale-1" && list->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
scale = list->GetFloat();
|
||||
}
|
||||
if (userDatName == "c11n-spaceX-1" && list->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
spaceX = list->GetFloat();
|
||||
}
|
||||
if (userDatName == "c11n-spaceY-1" && list->GetType() == nw4r::lyt::res::TYPE_FLOAT) {
|
||||
spaceY = list->GetFloat();
|
||||
}
|
||||
|
||||
list++;
|
||||
}
|
||||
}
|
||||
|
||||
setProperties(pane, posX, posY, scale, spaceX, spaceY);
|
||||
for (nw4r::ut::LinkList<Pane, 4>::Iterator it = pane->GetChildList()->GetBeginIter();
|
||||
it != pane->GetChildList()->GetEndIter(); ++it) {
|
||||
setPropertiesRecursive(&*it, posX, posY, scale, spaceX, spaceY);
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" const char *fn_801B2600(const char *);
|
||||
extern "C" void fn_800AF930(dTextBox_c *, const char *);
|
||||
extern "C" void fn_800B0F40(dTextBox_c *);
|
||||
|
||||
// NOTE: This function uses `textBox->GetTranslateX1()` as a general placeholder to figure
|
||||
// out the details first. In reality these are all different functions!
|
||||
void LytBase_c::setProperties(nw4r::lyt::Pane *pane, f32 posX, f32 posY, f32 scale, f32 spaceX, f32 spaceY) {
|
||||
if (pane->GetName()[0] != 'T') {
|
||||
return;
|
||||
}
|
||||
|
||||
dTextBox_c *textBox = nw4r::ut::DynamicCast<dTextBox_c *>(pane);
|
||||
if (textBox == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
textBox->AllocStringBuffer(0x200);
|
||||
textBox->setLytBase(this);
|
||||
fn_800B0F40(textBox);
|
||||
|
||||
if (posX != -9999.0f || posY != -9999.0f) {
|
||||
if (posX == -9999.0f) {
|
||||
posX = 0.0f;
|
||||
}
|
||||
if (posY == -9999.0f) {
|
||||
posY = 0.0f;
|
||||
}
|
||||
nw4r::math::VEC3 t1 = textBox->GetTranslate();
|
||||
t1.x += posX;
|
||||
t1.y += posY;
|
||||
textBox->SetTranslate(t1);
|
||||
}
|
||||
|
||||
nw4r::math::VEC3 t2 = textBox->GetTranslate();
|
||||
t2.x += textBox->GetTranslateX1();
|
||||
t2.y += textBox->GetTranslateX1();
|
||||
textBox->SetTranslate(t2);
|
||||
|
||||
|
||||
if (scale != -9999.0f) {
|
||||
const nw4r::ut::Font *f = textBox->GetFont();
|
||||
if (f != nullptr) {
|
||||
// VEC2 internally copied via GPRs here, should be FPRs
|
||||
textBox->SetScale(scale * 0.01f);
|
||||
}
|
||||
} else {
|
||||
const nw4r::ut::Font *f = textBox->GetFont();
|
||||
if (f != nullptr) {
|
||||
// VEC2 internally copied via GPRs here, should be FPRs
|
||||
textBox->SetScale(textBox->GetTranslateX1());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
f32 f4 = 0.0f;
|
||||
f32 f6 = 0.0f;
|
||||
|
||||
if (spaceX != -9999.0f) {
|
||||
textBox->SetCharSpace(spaceX);
|
||||
} else {
|
||||
f6 = textBox->GetTranslateX1();
|
||||
}
|
||||
|
||||
if (spaceY != -9999.0f) {
|
||||
textBox->SetLineSpace(spaceY);
|
||||
} else {
|
||||
f4 = textBox->GetTranslateX1();
|
||||
}
|
||||
|
||||
textBox->SetCharSpace(f6 + textBox->GetCharSpace() + textBox->GetTranslateX1());
|
||||
textBox->SetLineSpace(f4 + textBox->GetLineSpace() + textBox->GetTranslateX1());
|
||||
fn_800AB930(textBox);
|
||||
}
|
||||
|
||||
|
||||
bool LytBase_c::fn_800AB930(dTextBox_c *box) {
|
||||
return fn_800AB9A0(box, -1);
|
||||
}
|
||||
|
||||
bool LytBase_c::fn_800AB940(const char *name, int arg) {
|
||||
dTextBox_c *box = getTextBox(name);
|
||||
if (box == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return fn_800AB9A0(box, arg);
|
||||
}
|
||||
|
||||
bool LytBase_c::fn_800AB9A0(dTextBox_c *textbox, int arg) {
|
||||
if (getMsbtInfo() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
u16 num = textbox->GetExtUserDataNum();
|
||||
if (num == 0) {
|
||||
return false;
|
||||
}
|
||||
u32 found = 0;
|
||||
s32 ty = 2;
|
||||
const nw4r::lyt::res::ExtUserData *list = textbox->GetExtUserData();
|
||||
for (int i = 0; i < num; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = list->GetName();
|
||||
if (userDatName == "embed" && list->GetType() == nw4r::lyt::res::TYPE_INT) {
|
||||
found = 1;
|
||||
ty = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (userDatName == "copy" && list->GetType() == nw4r::lyt::res::TYPE_STRING) {
|
||||
found = 1;
|
||||
ty = 1;
|
||||
break;
|
||||
}
|
||||
list++;
|
||||
}
|
||||
|
||||
if (found != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ty == 1) {
|
||||
dTextBox_c *otherBox = getTextBox(list->GetString());
|
||||
if (otherBox != nullptr) {
|
||||
return fn_800ABB80(textbox, otherBox, arg);
|
||||
}
|
||||
} else {
|
||||
return fn_800ABCE0(list, textbox, textbox, arg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LytBase_c::fn_800ABB80(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg) {
|
||||
u16 num = textbox2->GetExtUserDataNum();
|
||||
if (num == 0) {
|
||||
return false;
|
||||
}
|
||||
u32 found = 0;
|
||||
const nw4r::lyt::res::ExtUserData *list = textbox2->GetExtUserData();
|
||||
for (int i = 0; i < num; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = list->GetName();
|
||||
if (userDatName == "embed" && list->GetType() == nw4r::lyt::res::TYPE_INT) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
list++;
|
||||
}
|
||||
|
||||
if (found != 1) {
|
||||
return false;
|
||||
}
|
||||
return fn_800ABCE0(list, textbox1, textbox2, arg);
|
||||
}
|
||||
|
||||
bool LytBase_c::fn_800ABCE0(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2,
|
||||
int arg) {
|
||||
int userDatInt = userDatum->GetInt();
|
||||
SizedString<0x40> str1;
|
||||
SizedString<0x40> str2;
|
||||
|
||||
str1 = textbox2->GetName();
|
||||
if (userDatInt != 0) {
|
||||
userDatInt = 0;
|
||||
if (arg != -1) {
|
||||
userDatInt = arg;
|
||||
}
|
||||
str2.sprintf(":%02d", userDatInt);
|
||||
// TODO this operator is not behaving correctly here - there's
|
||||
// an additional null check, and the source string address is
|
||||
// computed twice via stack instead of once.
|
||||
str1 += str2;
|
||||
}
|
||||
|
||||
const char *text = LMS_GetTextByLabel(getMsbtInfo(), str1);
|
||||
if (text == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
fn_800AF930(textbox1, fn_801B2600(text));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Now largely the same functions again, but with an additional argument
|
||||
bool LytBase_c::fn_800ABE50(dTextBox_c *textbox, int arg, void *unk) {
|
||||
if (getMsbtInfo() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
u16 num = textbox->GetExtUserDataNum();
|
||||
if (num == 0) {
|
||||
return false;
|
||||
}
|
||||
u32 found = 0;
|
||||
s32 ty = 2;
|
||||
const nw4r::lyt::res::ExtUserData *list = textbox->GetExtUserData();
|
||||
for (int i = 0; i < num; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = list->GetName();
|
||||
if (userDatName == "embed" && list->GetType() == nw4r::lyt::res::TYPE_INT) {
|
||||
found = 1;
|
||||
ty = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (userDatName == "copy" && list->GetType() == nw4r::lyt::res::TYPE_STRING) {
|
||||
found = 1;
|
||||
ty = 1;
|
||||
break;
|
||||
}
|
||||
list++;
|
||||
}
|
||||
|
||||
if (found != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ty == 1) {
|
||||
dTextBox_c *otherBox = getTextBox(list->GetString());
|
||||
if (otherBox != nullptr) {
|
||||
return fn_800AC040(textbox, otherBox, arg, unk);
|
||||
}
|
||||
} else {
|
||||
return fn_800AC1AC(list, textbox, textbox, arg, unk);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LytBase_c::fn_800AC040(dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk) {
|
||||
u16 num = textbox2->GetExtUserDataNum();
|
||||
if (num == 0) {
|
||||
return false;
|
||||
}
|
||||
u32 found = 0;
|
||||
const nw4r::lyt::res::ExtUserData *list = textbox2->GetExtUserData();
|
||||
for (int i = 0; i < num; i++) {
|
||||
SizedString<0x40> userDatName;
|
||||
userDatName = list->GetName();
|
||||
if (userDatName == "embed" && list->GetType() == nw4r::lyt::res::TYPE_INT) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
list++;
|
||||
}
|
||||
|
||||
if (found != 1) {
|
||||
return false;
|
||||
}
|
||||
return fn_800AC1AC(list, textbox1, textbox2, arg, unk);
|
||||
}
|
||||
|
||||
extern "C" void fn_800AF840(dTextBox_c *textbox1, MsbtInfo *, const char *, int arg, void *unk);
|
||||
|
||||
bool LytBase_c::fn_800AC1AC(const nw4r::lyt::res::ExtUserData *userDatum, dTextBox_c *textbox1, dTextBox_c *textbox2, int arg, void *unk) {
|
||||
int userDatInt = userDatum->GetInt();
|
||||
SizedString<0x40> str1;
|
||||
SizedString<0x40> str2;
|
||||
|
||||
str1 = textbox2->GetName();
|
||||
if (userDatInt != 0) {
|
||||
str2.sprintf(":%02d", 0);
|
||||
// TODO this operator is not behaving correctly here - there's
|
||||
// an additional null check, and the source string address is
|
||||
// computed twice via stack instead of once.
|
||||
str1 += str2;
|
||||
}
|
||||
|
||||
fn_800AF840(textbox1, getMsbtInfo(), str1, arg, unk);
|
||||
return true;
|
||||
}
|
||||
|
||||
MsbtInfo *LytBase_c::getMsbtInfo() const {
|
||||
return mpMsbtInfo;
|
||||
}
|
||||
|
||||
nw4r::lyt::Group *LytBase_c::findGroupByName(const char *name) {
|
||||
nw4r::lyt::Group *ret = nullptr;
|
||||
if (mLayout.GetGroupContainer() != nullptr) {
|
||||
ret = mLayout.GetGroupContainer()->FindGroupByName(name);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool hasSameBaseName(const char *left, const char *right) {
|
||||
// A for loop turns this into a bdnz
|
||||
bool same = true;
|
||||
int i = 0;
|
||||
while (true) {
|
||||
if (i >= 0x1E) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
char a = *left;
|
||||
char b = *right;
|
||||
if (a == '\0' && b == '\0') {
|
||||
break;
|
||||
}
|
||||
if (a != b) {
|
||||
if (b != '.') {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
left++;
|
||||
right++;
|
||||
i++;
|
||||
}
|
||||
|
||||
return same;
|
||||
}
|
||||
|
||||
char *sRef = "ref";
|
||||
|
||||
|
||||
void LytBase_c::linkMeters(nw4r::lyt::Group *group, LytMeterGroup *meterGroup) {
|
||||
// single regswap
|
||||
nw4r::ut::LinkList<LytMeterListNode, 0>::Iterator beginIt = meterGroup->GetBeginIter();
|
||||
nw4r::ut::LinkList<LytMeterListNode, 0>::Iterator endIt = meterGroup->GetEndIter();
|
||||
|
||||
for (nw4r::lyt::PaneList::Iterator paneIt = group->GetPaneList()->GetBeginIter();
|
||||
paneIt != group->GetPaneList()->GetEndIter(); ++paneIt) {
|
||||
nw4r::lyt::Pane *pane = paneIt->mTarget;
|
||||
int num = pane->GetExtUserDataNum();
|
||||
if (num != 0) {
|
||||
const nw4r::lyt::res::ExtUserData *dat = pane->FindExtUserDataByName(sRef);
|
||||
if (dat != nullptr && dat->GetType() == nw4r::lyt::res::TYPE_STRING) {
|
||||
for (nw4r::ut::LinkList<LytMeterListNode, 0>::Iterator it = beginIt; it != endIt; ++it) {
|
||||
dLytMeterBase *meter = it->mpMeter;
|
||||
if (!meter->LytMeter0x24()) {
|
||||
if (hasSameBaseName(dat->GetString(), meter->getName())) {
|
||||
it->mpPane = pane;
|
||||
pane->AppendChild(meter->getPane());
|
||||
meter->LytMeter0x28(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool AnmGroupBase_c::init(const char *fileName, m2d::ResAccIf_c *resAcc, d2d::Layout_c *layout, const char *groupName) {
|
||||
if (layout->GetGroupContainer() == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@@ -261,7 +796,7 @@ bool AnmGroup_c::init(const char *fileName, m2d::ResAccIf_c *resAcc, d2d::Layout
|
||||
return init(transform, fileName, resAcc, group);
|
||||
}
|
||||
|
||||
bool AnmGroup_c::init(nw4r::lyt::AnimTransform *transform, const char *name, m2d::ResAccIf_c *acc,
|
||||
bool AnmGroupBase_c::init(nw4r::lyt::AnimTransform *transform, const char *name, m2d::ResAccIf_c *acc,
|
||||
nw4r::lyt::Group *group) {
|
||||
if (transform == nullptr) {
|
||||
return false;
|
||||
@@ -286,7 +821,7 @@ bool AnmGroup_c::init(nw4r::lyt::AnimTransform *transform, const char *name, m2d
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AnmGroup_c::fn_800AC6D0(bool b) {
|
||||
bool AnmGroupBase_c::fn_800AC6D0(bool b) {
|
||||
nw4r::lyt::AnimTransform *anmTransform = mpAnmTransform;
|
||||
if (anmTransform == nullptr) {
|
||||
return false;
|
||||
@@ -314,7 +849,7 @@ bool AnmGroup_c::fn_800AC6D0(bool b) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AnmGroup_c::fn_800AC7D0() {
|
||||
bool AnmGroupBase_c::fn_800AC7D0() {
|
||||
nw4r::lyt::AnimTransform *anmTransform = mpAnmTransform;
|
||||
if (anmTransform == nullptr) {
|
||||
return false;
|
||||
@@ -330,11 +865,11 @@ bool AnmGroup_c::fn_800AC7D0() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AnmGroup_c::fn_800AC860() {
|
||||
bool AnmGroupBase_c::fn_800AC860() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void AnmGroup_c::fn_800AC870(bool b) {
|
||||
void AnmGroupBase_c::setAnimEnable(bool b) {
|
||||
nw4r::lyt::Group *group = mpGroup;
|
||||
nw4r::lyt::AnimTransform *anmTransform = mpAnmTransform;
|
||||
nw4r::lyt::SetAnimationEnable(group, anmTransform, b, mAnmResource.IsDescendingBind());
|
||||
@@ -345,19 +880,19 @@ void AnmGroup_c::fn_800AC870(bool b) {
|
||||
}
|
||||
}
|
||||
|
||||
void AnmGroup_c::setAnmFrame(f32 arg) {
|
||||
void AnmGroupBase_c::setAnmFrame(f32 arg) {
|
||||
mpAnmTransform->SetFrame(arg);
|
||||
}
|
||||
|
||||
void AnmGroup_c::syncAnmFrame() {
|
||||
void AnmGroupBase_c::syncAnmFrame() {
|
||||
setAnmFrame(mpFrameCtrl->getFrame());
|
||||
}
|
||||
|
||||
void AnmGroup_c::setForward() {
|
||||
void AnmGroupBase_c::setForward() {
|
||||
mpFrameCtrl->setForward();
|
||||
}
|
||||
|
||||
void AnmGroup_c::setBackward() {
|
||||
void AnmGroupBase_c::setBackward() {
|
||||
mpFrameCtrl->setBackward();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
#include <d/lyt/d_lyt_battery.h>
|
||||
#include <egg/core/eggController.h>
|
||||
#include <m/m_pad.h>
|
||||
#include <toBeSorted/arc_managers/layout_arc_manager.h>
|
||||
|
||||
STATE_DEFINE(dLytBattery_c, Off);
|
||||
STATE_DEFINE(dLytBattery_c, In);
|
||||
STATE_DEFINE(dLytBattery_c, On);
|
||||
STATE_DEFINE(dLytBattery_c, None);
|
||||
STATE_DEFINE(dLytBattery_c, Out);
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "denchi_00_in.brlan", "G_inOut_00"},
|
||||
{"denchi_00_none.brlan", "G_inOut_00"},
|
||||
{"denchi_00_loop.brlan", "G_loop_00"},
|
||||
{ "denchi_00_out.brlan", "G_inOut_00"},
|
||||
};
|
||||
|
||||
#define LYT_BATTERY_ANIM_IN 0
|
||||
#define LYT_BATTERY_ANIM_NONE 1
|
||||
#define LYT_BATTERY_ANIM_LOOP 2
|
||||
#define LYT_BATTERY_ANIM_OUT 3
|
||||
|
||||
bool dLytBattery_c::create() {
|
||||
new dLytBattery_c();
|
||||
if (sInstance == nullptr) {
|
||||
return false;
|
||||
}
|
||||
sInstance->init();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytBattery_c::draw() {
|
||||
if (sInstance != nullptr) {
|
||||
sInstance->doDraw();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytBattery_c::init() {
|
||||
void *data = LayoutArcManager::sInstance->getLoadedData("System2D");
|
||||
mResAcc.attach(data, "");
|
||||
mLyt.setResAcc(&mResAcc);
|
||||
mLyt.build("denchi_00.brlyt", nullptr);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mAnmGroups[i].init(brlanMap[i].mFile, &mResAcc, mLyt.getLayout(), brlanMap[i].mName);
|
||||
mAnmGroups[i].fn_800AC6D0(false);
|
||||
mAnmGroups[i].setAnimEnable(false);
|
||||
}
|
||||
|
||||
mAnmGroups[LYT_BATTERY_ANIM_LOOP].setAnimEnable(true);
|
||||
mStateMgr.changeState(StateID_Off);
|
||||
mLyt.calc();
|
||||
mDismissManually = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" void fn_80016200();
|
||||
|
||||
bool dLytBattery_c::doDraw() {
|
||||
mStateMgr.executeState();
|
||||
if (*mStateMgr.getStateID() != StateID_Off) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (mAnmGroups[i].isFlag2()) {
|
||||
mAnmGroups[i].play();
|
||||
}
|
||||
}
|
||||
|
||||
mLyt.calc();
|
||||
fn_80016200();
|
||||
mLyt.draw();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytBattery_c::dismissManually() {
|
||||
if (*mStateMgr.getStateID() != StateID_On) {
|
||||
return false;
|
||||
}
|
||||
mDismissManually = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
extern "C" bool isLowBattery1();
|
||||
extern "C" bool isLowBattery2();
|
||||
|
||||
bool dLytBattery_c::hasEnoughBatteryCharge() {
|
||||
if (!mPad::g_currentCore->mFlag.offBit(0) && (isLowBattery2() || isLowBattery1())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void dLytBattery_c::initializeState_Off() {}
|
||||
void dLytBattery_c::executeState_Off() {
|
||||
if (!hasEnoughBatteryCharge()) {
|
||||
mAnmGroups[LYT_BATTERY_ANIM_IN].setAnimEnable(true);
|
||||
mAnmGroups[LYT_BATTERY_ANIM_IN].setFrame(0.0f);
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
void dLytBattery_c::finalizeState_Off() {}
|
||||
|
||||
void dLytBattery_c::initializeState_In() {}
|
||||
void dLytBattery_c::executeState_In() {
|
||||
if (mAnmGroups[LYT_BATTERY_ANIM_IN].isEndReached()) {
|
||||
mAnmGroups[LYT_BATTERY_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_On);
|
||||
}
|
||||
}
|
||||
void dLytBattery_c::finalizeState_In() {}
|
||||
|
||||
void dLytBattery_c::initializeState_On() {}
|
||||
void dLytBattery_c::executeState_On() {
|
||||
if (mDismissManually == true) {
|
||||
mDismissManually = false;
|
||||
mStateMgr.changeState(StateID_None);
|
||||
} else {
|
||||
if (hasEnoughBatteryCharge()) {
|
||||
mAnmGroups[LYT_BATTERY_ANIM_OUT].setAnimEnable(true);
|
||||
mAnmGroups[LYT_BATTERY_ANIM_OUT].setFrame(0.0f);
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytBattery_c::finalizeState_On() {}
|
||||
|
||||
void dLytBattery_c::initializeState_None() {
|
||||
d2d::AnmGroup_c &grp = mAnmGroups[LYT_BATTERY_ANIM_NONE];
|
||||
grp.setAnimEnable(true);
|
||||
grp.setFrame(0.0f);
|
||||
}
|
||||
void dLytBattery_c::executeState_None() {
|
||||
d2d::AnmGroup_c &grp = mAnmGroups[LYT_BATTERY_ANIM_NONE];
|
||||
if (grp.isEndReached()) {
|
||||
grp.setAnimEnable(false);
|
||||
}
|
||||
|
||||
if (hasEnoughBatteryCharge()) {
|
||||
mAnmGroups[LYT_BATTERY_ANIM_OUT].setAnimEnable(true);
|
||||
mAnmGroups[LYT_BATTERY_ANIM_OUT].setFrame(0.0f);
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
}
|
||||
}
|
||||
void dLytBattery_c::finalizeState_None() {}
|
||||
|
||||
void dLytBattery_c::initializeState_Out() {}
|
||||
void dLytBattery_c::executeState_Out() {
|
||||
if (mAnmGroups[LYT_BATTERY_ANIM_OUT].isEndReached()) {
|
||||
mAnmGroups[LYT_BATTERY_ANIM_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Off);
|
||||
}
|
||||
}
|
||||
void dLytBattery_c::finalizeState_Out() {}
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <d/lyt/common_arrow.h>
|
||||
#include <d/lyt/d_lyt_common_arrow.h>
|
||||
#include <toBeSorted/arc_managers/layout_arc_manager.h>
|
||||
|
||||
STATE_DEFINE(dLytCommonArrow_c, None);
|
||||
@@ -22,8 +22,6 @@ static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
|
||||
dLytCommonArrow_c::dLytCommonArrow_c() : mStateMgr(*this, sStateID::null) {}
|
||||
|
||||
extern "C" d2d::dLytStructD *lbl_80575260;
|
||||
|
||||
bool dLytCommonArrow_c::init() {
|
||||
void *data = LayoutArcManager::sInstance->getLoadedData("CommonArrow");
|
||||
mResAcc.attach(data, "");
|
||||
@@ -34,7 +32,7 @@ bool dLytCommonArrow_c::init() {
|
||||
field_0x440[i].init(brlanMap[i].mFile, &mResAcc, mLytBase.getLayout(), brlanMap[i].mName);
|
||||
}
|
||||
field_0x680.fn_80065E70(mLytBase.getLayout()->GetRootPane(), 1, 0, 0);
|
||||
lbl_80575260->append(&field_0x680);
|
||||
d2d::dLytStructDList::sInstance->appendToList2(&field_0x680);
|
||||
field_0x6A8 = mLytBase.findBounding("B_arrowL_00");
|
||||
field_0x6AC = mLytBase.findBounding("B_arrowR_00");
|
||||
mStateMgr.changeState(StateID_None);
|
||||
@@ -43,7 +41,7 @@ bool dLytCommonArrow_c::init() {
|
||||
}
|
||||
|
||||
bool dLytCommonArrow_c::fn_80168490() {
|
||||
lbl_80575260->detach(&field_0x680);
|
||||
d2d::dLytStructDList::sInstance->removeFromList2(&field_0x680);
|
||||
mLytBase.unbindAnims();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
field_0x440[i].fn_800AC860();
|
||||
@@ -54,8 +52,7 @@ bool dLytCommonArrow_c::fn_80168490() {
|
||||
bool dLytCommonArrow_c::fn_80168500() {
|
||||
mStateMgr.executeState();
|
||||
if (!mStateMgr.getStateID()->isEqual(StateID_None)) {
|
||||
field_0x440[1].mpFrameCtrl->play();
|
||||
field_0x440[1].syncAnmFrame();
|
||||
field_0x440[1].play();
|
||||
}
|
||||
mLytBase.calc();
|
||||
field_0x680.field_0x22 = 0;
|
||||
@@ -111,7 +108,7 @@ bool dLytCommonArrow_c::fn_80168760() {
|
||||
|
||||
void dLytCommonArrow_c::fn_80168790(s32 idx, f32 frame) {
|
||||
d2d::AnmGroup_c *s = &field_0x440[idx];
|
||||
s->setFrame(frame);
|
||||
s->setFrameAndControlThings(frame);
|
||||
}
|
||||
|
||||
void dLytCommonArrow_c::fn_80168800(s32 idx) {
|
||||
@@ -119,13 +116,12 @@ void dLytCommonArrow_c::fn_80168800(s32 idx) {
|
||||
}
|
||||
|
||||
void dLytCommonArrow_c::fn_80168810(d2d::AnmGroup_c *ctrl) {
|
||||
if (ctrl->mpFrameCtrl->getFrame()) {
|
||||
f32 newFrame = ctrl->mpFrameCtrl->getFrame() - 1.0f;
|
||||
if (ctrl->getFrame()) {
|
||||
f32 newFrame = ctrl->getFrame() - 1.0f;
|
||||
if (newFrame <= 0.0f) {
|
||||
newFrame = 0.0f;
|
||||
}
|
||||
ctrl->mpFrameCtrl->setFrame(newFrame);
|
||||
ctrl->syncAnmFrame();
|
||||
ctrl->setFrame(newFrame);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,16 +165,15 @@ void dLytCommonArrow_c::initializeState_In() {
|
||||
}
|
||||
void dLytCommonArrow_c::executeState_In() {
|
||||
switch (field_0x6C4) {
|
||||
case 0:
|
||||
case 0: {
|
||||
d2d::AnmGroup_c *s = &field_0x440[0];
|
||||
if (s->mpFrameCtrl->isEndReached() == 1) {
|
||||
if (s->isEndReached() == 1) {
|
||||
field_0x6C4 += 1;
|
||||
field_0x6CA = 1;
|
||||
} else {
|
||||
s->mpFrameCtrl->play();
|
||||
s->syncAnmFrame();
|
||||
s->play();
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case 1:
|
||||
field_0x6CA = 0;
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
@@ -219,14 +214,14 @@ void dLytCommonArrow_c::initializeState_Out() {
|
||||
}
|
||||
void dLytCommonArrow_c::executeState_Out() {
|
||||
switch (field_0x6C4) {
|
||||
case 0:
|
||||
case 0: {
|
||||
d2d::AnmGroup_c *s = &field_0x440[8];
|
||||
if (s->mpFrameCtrl->isEndReached() == 1) {
|
||||
if (s->isEndReached() == 1) {
|
||||
field_0x6C4 = 1;
|
||||
field_0x6CA = 1;
|
||||
}
|
||||
s->play();
|
||||
break;
|
||||
} break;
|
||||
case 1:
|
||||
mStateMgr.changeState(StateID_None);
|
||||
break;
|
||||
@@ -0,0 +1,177 @@
|
||||
#include <d/lyt/d_lyt_do_button.h>
|
||||
|
||||
struct DoButtonClass {
|
||||
DoButtonClass();
|
||||
virtual ~DoButtonClass();
|
||||
|
||||
u8 field_0x04;
|
||||
u8 field_0x05;
|
||||
u8 field_0x06;
|
||||
u8 field_0x07;
|
||||
f32 field_0x08;
|
||||
f32 field_0x0C;
|
||||
f32 field_0x10;
|
||||
u8 field_0x14;
|
||||
u8 field_0x15;
|
||||
u8 field_0x16;
|
||||
};
|
||||
|
||||
static DoButtonClass sDoButtonClass;
|
||||
|
||||
DoButtonClass::DoButtonClass() {
|
||||
field_0x04 = 0;
|
||||
field_0x05 = 0x29;
|
||||
field_0x06 = 0x5E;
|
||||
field_0x07 = 0;
|
||||
field_0x08 = 0.0f;
|
||||
field_0x0C = 0.0f;
|
||||
field_0x14 = 0xFF;
|
||||
field_0x10 = 76.0f;
|
||||
field_0x15 = 0;
|
||||
field_0x16 = 0;
|
||||
}
|
||||
DoButtonClass::~DoButtonClass() {}
|
||||
|
||||
STATE_DEFINE(dLytDobutton_c, InvisibleWait);
|
||||
STATE_DEFINE(dLytDobutton_c, InvisibleTimeCnt);
|
||||
STATE_DEFINE(dLytDobutton_c, In);
|
||||
STATE_DEFINE(dLytDobutton_c, Wait);
|
||||
STATE_DEFINE(dLytDobutton_c, Out);
|
||||
|
||||
#define DO_BUTTON_ANIM_IN 0
|
||||
#define DO_BUTTON_ANIM 1
|
||||
#define DO_BUTTON_ANIM_LOOP_BTN 2
|
||||
#define DO_BUTTON_ANIM_LOOP_BTN_Z 3
|
||||
#define DO_BUTTON_ANIM_LOOP_NUN 4
|
||||
#define DO_BUTTON_ANIM_LOOP_REMO_CON 5
|
||||
#define DO_BUTTON_ANIM_LOOP_RECOVER 6
|
||||
#define DO_BUTTON_ANIM_LOOP_ROTATE 7
|
||||
#define DO_BUTTON_ANIM_LOOP_MOVE_INFO 8
|
||||
#define DO_BUTTON_ANIM_MOVE_ALPHA 9
|
||||
#define DO_BUTTON_ANIM_MOVE_OUT 10
|
||||
#define DO_BUTTON_ANIM_LOOP_BG 11
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "basicInfo_00_in.brlan", "G_inOut_00"},
|
||||
{ "basicInfo_00_basicInfo.brlan", "G_basicInfo_00"},
|
||||
{ "basicInfo_00_loopBtn.brlan", "G_loopBtn_00"},
|
||||
{ "basicInfo_00_loopBtn.brlan", "G_loopBtnZ_00"},
|
||||
{ "basicInfo_00_loopNun.brlan", "G_loopNun_00"},
|
||||
{"basicInfo_00_loopRemoCon.brlan", "G_loopRemoCon_00"},
|
||||
{"basicInfo_00_loopRecover.brlan", "G_loopRecover_00"},
|
||||
{ "basicInfo_00_loopRotate.brlan", "G_loopRotate"},
|
||||
{ "basicInfo_00_moveInfo.brlan", "G_moveInfo_00"},
|
||||
{ "basicInfo_00_moveAlpha.brlan", "G_moveAlpha_00"},
|
||||
{ "basicInfo_00_out.brlan", "G_inOut_00"},
|
||||
{ "basicInfo_00_loopBg.brlan", "G_loopBg_00"},
|
||||
};
|
||||
|
||||
void dLytDobutton_c::initializeState_InvisibleWait() {}
|
||||
void dLytDobutton_c::executeState_InvisibleWait() {
|
||||
if (field_0x488 == field_0x474 && mNextDoActionToShow == mDoActionToShow) {
|
||||
return;
|
||||
}
|
||||
|
||||
field_0x478 = field_0x474;
|
||||
field_0x474 = field_0x488;
|
||||
mDoActionToShow = mNextDoActionToShow;
|
||||
if (field_0x488 == 0x29) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mNextDoActionToShow == 0x5E) {
|
||||
return;
|
||||
}
|
||||
mStateMgr.changeState(StateID_InvisibleTimeCnt);
|
||||
}
|
||||
void dLytDobutton_c::finalizeState_InvisibleWait() {}
|
||||
|
||||
void dLytDobutton_c::initializeState_InvisibleTimeCnt() {
|
||||
field_0x48C = 0;
|
||||
}
|
||||
|
||||
extern "C" void fn_8010DF00(dLytDobutton_c *);
|
||||
|
||||
void dLytDobutton_c::executeState_InvisibleTimeCnt() {
|
||||
if (field_0x488 != field_0x474 || mNextDoActionToShow != mDoActionToShow) {
|
||||
field_0x478 = field_0x474;
|
||||
field_0x474 = field_0x488;
|
||||
mDoActionToShow = mNextDoActionToShow;
|
||||
if (field_0x488 == 0x29 || mNextDoActionToShow == 0x5E) {
|
||||
mStateMgr.changeState(StateID_InvisibleWait);
|
||||
} else {
|
||||
field_0x48C = 0;
|
||||
}
|
||||
} else {
|
||||
if (field_0x48C < sDoButtonClass.field_0x15) {
|
||||
field_0x48C++;
|
||||
} else {
|
||||
fn_8010DF00(this);
|
||||
mStateMgr.changeState(StateID_In);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytDobutton_c::finalizeState_InvisibleTimeCnt() {}
|
||||
|
||||
void dLytDobutton_c::initializeState_In() {
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(true);
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setFrame(0.0f);
|
||||
mLyt.calc();
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(false);
|
||||
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(true);
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setFrame(0.0f);
|
||||
}
|
||||
void dLytDobutton_c::executeState_In() {
|
||||
if (field_0x488 == 0x29 || mNextDoActionToShow == 0x5E) {
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setFrame(0.0f);
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(true);
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setToEnd();
|
||||
mLyt.calc();
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(false);
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_InvisibleWait);
|
||||
} else if (mAnmGroups[DO_BUTTON_ANIM_IN].isEndReached()) {
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
}
|
||||
}
|
||||
void dLytDobutton_c::finalizeState_In() {}
|
||||
|
||||
void dLytDobutton_c::initializeState_Wait() {}
|
||||
void dLytDobutton_c::executeState_Wait() {
|
||||
if (field_0x488 != field_0x474 || mNextDoActionToShow != mDoActionToShow) {
|
||||
field_0x478 = field_0x474;
|
||||
field_0x474 = field_0x488;
|
||||
mDoActionToShow = mNextDoActionToShow;
|
||||
if (field_0x488 == 0x29 || mNextDoActionToShow == 0x5E) {
|
||||
mStateMgr.changeState(StateID_Out);
|
||||
field_0x48C = 0;
|
||||
} else {
|
||||
fn_8010DF00(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
void dLytDobutton_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytDobutton_c::initializeState_Out() {
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(true);
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setFrame(0.0f);
|
||||
mLyt.calc();
|
||||
mAnmGroups[DO_BUTTON_ANIM_IN].setAnimEnable(false);
|
||||
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(true);
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setFrame(0.0f);
|
||||
}
|
||||
void dLytDobutton_c::executeState_Out() {
|
||||
if (mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].isEndReached()) {
|
||||
mLyt.calc();
|
||||
mAnmGroups[DO_BUTTON_ANIM_MOVE_OUT].setAnimEnable(false);
|
||||
mStateMgr.changeState(StateID_InvisibleTimeCnt);
|
||||
}
|
||||
}
|
||||
void dLytDobutton_c::finalizeState_Out() {}
|
||||
|
||||
bool dLytDobutton_c::init(m2d::ResAccIf_c *resAcc) {
|
||||
return brlanMap[0].mFile[0] != '\0' && sDoButtonClass.field_0x04;
|
||||
}
|
||||
@@ -27,7 +27,7 @@ void dLytFader_c::setStatus(EStatus status) {
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
s->fn_800AC6D0(false);
|
||||
s->setToEnd();
|
||||
s->fn_800AC870(true);
|
||||
s->setAnimEnable(true);
|
||||
s->play();
|
||||
mLytBase.calc();
|
||||
fn_80175BC0(2);
|
||||
@@ -38,7 +38,7 @@ void dLytFader_c::setStatus(EStatus status) {
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
s->fn_800AC6D0(false);
|
||||
s->setToStart();
|
||||
s->fn_800AC870(true);
|
||||
s->setAnimEnable(true);
|
||||
mLytBase.calc();
|
||||
fn_80175BC0(2);
|
||||
mLytBase.getLayout()->GetRootPane()->SetVisible(false);
|
||||
@@ -113,16 +113,14 @@ void dLytFader_c::fn_801758F0() {
|
||||
mLytBase.unbindAnims();
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
s->fn_800AC6D0(false);
|
||||
s->mpFrameCtrl->setFrame(0.0f);
|
||||
s->syncAnmFrame();
|
||||
s->mpFrameCtrl->setRate(20.0f / (mFrame - 1));
|
||||
s->fn_800AC870(true);
|
||||
s->setFrame(0.0f);
|
||||
s->setRate(20.0f / (mFrame - 1));
|
||||
mLytBase.getLayout()->GetRootPane()->SetVisible(true);
|
||||
}
|
||||
|
||||
void dLytFader_c::fn_801759B0() {
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[0];
|
||||
if (s->mpFrameCtrl->isEndReached() == true) {
|
||||
if (s->isEndReached() == true) {
|
||||
fn_80175BC0(2);
|
||||
mStatus = FADED_OUT;
|
||||
}
|
||||
@@ -135,16 +133,14 @@ void dLytFader_c::fn_80175A50() {
|
||||
mLytBase.unbindAnims();
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[1];
|
||||
s->fn_800AC6D0(false);
|
||||
s->mpFrameCtrl->setFrame(0.0f);
|
||||
s->syncAnmFrame();
|
||||
s->mpFrameCtrl->setRate(20.0f / (mFrame - 1));
|
||||
s->fn_800AC870(true);
|
||||
s->setFrame(0.0f);
|
||||
s->setRate(20.0f / (mFrame - 1));
|
||||
mLytBase.getLayout()->GetRootPane()->SetVisible(true);
|
||||
}
|
||||
|
||||
void dLytFader_c::fn_80175B10() {
|
||||
d2d::AnmGroup_c *s = &mLytStructAs[1];
|
||||
if (s->mpFrameCtrl->isEndReached() == true) {
|
||||
if (s->isEndReached() == true) {
|
||||
fn_80175BC0(2);
|
||||
mStatus = FADED_IN;
|
||||
mLytBase.getLayout()->GetRootPane()->SetVisible(false);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <d/lyt/pause_disp_00.h>
|
||||
#include <d/lyt/d_lyt_pause_disp_00.h>
|
||||
#include <nw4r/lyt/lyt_group.h>
|
||||
|
||||
STATE_DEFINE(dLytPauseDisp00_c, None);
|
||||
@@ -16,9 +16,6 @@ extern const char *B_LIST[];
|
||||
|
||||
dLytPauseDisp00_c::dLytPauseDisp00_c() : mStateMgr(*this, sStateID::null) {}
|
||||
|
||||
extern "C" void fn_800AC3C0(nw4r::lyt::Group *, nw4r::ut::LinkList<d2d::dLytStructB, 0> *);
|
||||
extern "C" d2d::dLytStructD *lbl_80575260;
|
||||
|
||||
void dLytPauseDisp00_c::init() {
|
||||
mLytBase.build("pause_00.brlyt", nullptr);
|
||||
mLytBase.mPriority = 0x86;
|
||||
@@ -29,18 +26,18 @@ void dLytPauseDisp00_c::init() {
|
||||
|
||||
for (int i = 0; i < 0x18; i++) {
|
||||
field_0x2050[i].init(nullptr, lbl_804E8898[i]);
|
||||
mList.PushBack(&field_0x2050[i]);
|
||||
mLytMeterGroup.PushBack(&field_0xE11C[i]);
|
||||
}
|
||||
|
||||
if (mLytBase.getLayout()->GetGroupContainer() != nullptr) {
|
||||
nw4r::lyt::Group *group = mLytBase.getLayout()->GetGroupContainer()->FindGroupByName("G_ref_00");
|
||||
if (group != nullptr) {
|
||||
fn_800AC3C0(group, &mList);
|
||||
mLytBase.linkMeters(group, &mLytMeterGroup);
|
||||
}
|
||||
}
|
||||
|
||||
field_0xE29C.init(mLytBase.getLayout()->GetRootPane(), 1, 0, 0);
|
||||
lbl_80575260->append(&field_0xE29C);
|
||||
d2d::dLytStructDList::sInstance->appendToList2(&field_0xE29C);
|
||||
for (int i = 0; i < 0x25; i++) {
|
||||
if (i != 0x1F && i != 0x20) {
|
||||
nw4r::lyt::Bounding *b = mLytBase.findBounding(B_LIST[i]);
|
||||
@@ -51,7 +48,5 @@ void dLytPauseDisp00_c::init() {
|
||||
|
||||
void dLytPauseDisp00_c::displayElement(int i, float frame) {
|
||||
d2d::AnmGroup_c *s = &field_0x00D0[i];
|
||||
s->setFrame(frame);
|
||||
s->setFrameAndControlThings(frame);
|
||||
}
|
||||
|
||||
dLytPauseDisp00_c::~dLytPauseDisp00_c() {}
|
||||
@@ -0,0 +1,33 @@
|
||||
#include <d/lyt/d_structd.h>
|
||||
|
||||
namespace d2d
|
||||
{
|
||||
|
||||
dLytStructDList::dLytStructDList() {
|
||||
field_0x18 = true;
|
||||
sInstance = this;
|
||||
}
|
||||
|
||||
|
||||
dLytStructDList *dLytStructDList::create(EGG::Heap *heap) {
|
||||
return new(heap) dLytStructDList();
|
||||
}
|
||||
|
||||
|
||||
void dLytStructDList::appendToList1(dLytStructD *other) {
|
||||
mList1.insert(other);
|
||||
}
|
||||
|
||||
void dLytStructDList::removeFromList1(dLytStructD *other) {
|
||||
mList1.remove(other);
|
||||
}
|
||||
|
||||
void dLytStructDList::appendToList2(dLytStructD *other) {
|
||||
mList2.insert(other);
|
||||
}
|
||||
|
||||
void dLytStructDList::removeFromList2(dLytStructD *other) {
|
||||
mList2.remove(other);
|
||||
}
|
||||
|
||||
} // namespace d2d
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <d/lyt/meter/d_lyt_meter.h>
|
||||
|
||||
|
||||
dLytMeter_c::dLytMeter_c() {}
|
||||
|
||||
dLytMeterRemoconBg_c::dLytMeterRemoconBg_c() : mStateMgr(*this, sStateID::null) {}
|
||||
dLytMeterRemoconBg_c::~dLytMeterRemoconBg_c() {}
|
||||
@@ -0,0 +1,59 @@
|
||||
#include <d/lyt/meter/d_lyt_meter_remocon_bg.h>
|
||||
#include <toBeSorted/event_manager.h>
|
||||
|
||||
STATE_DEFINE(dLytMeterRemoconBg_c, Wait);
|
||||
STATE_DEFINE(dLytMeterRemoconBg_c, On);
|
||||
STATE_DEFINE(dLytMeterRemoconBg_c, Active);
|
||||
STATE_DEFINE(dLytMeterRemoconBg_c, Off);
|
||||
|
||||
void dLytMeterRemoconBg_c::initializeState_Wait() {}
|
||||
void dLytMeterRemoconBg_c::executeState_Wait() {}
|
||||
void dLytMeterRemoconBg_c::finalizeState_Wait() {}
|
||||
|
||||
void dLytMeterRemoconBg_c::initializeState_On() {}
|
||||
void dLytMeterRemoconBg_c::executeState_On() {}
|
||||
void dLytMeterRemoconBg_c::finalizeState_On() {}
|
||||
|
||||
void dLytMeterRemoconBg_c::initializeState_Active() {}
|
||||
void dLytMeterRemoconBg_c::executeState_Active() {}
|
||||
void dLytMeterRemoconBg_c::finalizeState_Active() {}
|
||||
|
||||
void dLytMeterRemoconBg_c::initializeState_Off() {}
|
||||
void dLytMeterRemoconBg_c::executeState_Off() {}
|
||||
void dLytMeterRemoconBg_c::finalizeState_Off() {}
|
||||
|
||||
static const char *n1 = "N_remoConBg_00";
|
||||
|
||||
bool dLytMeterRemoconBg_c::build(d2d::ResAccIf_c *resAcc) {
|
||||
mLyt.setResAcc(resAcc);
|
||||
mLyt.build("remoConBg_00.brlyt", nullptr);
|
||||
mpPane = mLyt.findPane(n1);
|
||||
field_0xE8 = 0x61;
|
||||
field_0xDC = 0x61;
|
||||
field_0xE0 = 0x61;
|
||||
field_0xEC = false;
|
||||
field_0xE4 = 1;
|
||||
mStateMgr.changeState(StateID_Wait);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMeterRemoconBg_c::LytMeter0x10() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool dLytMeterRemoconBg_c::LytMeter0x14() {
|
||||
// TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *dLytMeterRemoconBg_c::getName() const {
|
||||
return mLyt.getName();
|
||||
}
|
||||
|
||||
void *dLytMeterRemoconBg_c::LytMeter0x1C() {
|
||||
return &mLyt;
|
||||
}
|
||||
|
||||
nw4r::lyt::Pane *dLytMeterRemoconBg_c::getPane() {
|
||||
return mLyt.getLayout()->GetRootPane();
|
||||
}
|
||||
Reference in New Issue
Block a user