dLytMeter_c::execute OK

This commit is contained in:
robojumper
2025-04-19 12:38:35 +02:00
parent 4874cda264
commit 8e5c06ea13
11 changed files with 266 additions and 29 deletions
+4 -4
View File
@@ -4740,7 +4740,7 @@ __dt__16dLytMeterTimer_cFv = .text:0x800D4DE0; // type:function size:0xB4
__dt__14dLytSkyGauge_cFv = .text:0x800D4EA0; // type:function size:0x164
__dt__15dLytBirdGauge_cFv = .text:0x800D5010; // type:function size:0x164
__dt__15dLytBossGauge_cFv = .text:0x800D5180; // type:function size:0x108
fn_800D5290 = .text:0x800D5290; // type:function size:0xB4
fn_800D5290__11dLytMeter_cFv = .text:0x800D5290; // type:function size:0xB4
fn_800D5350 = .text:0x800D5350; // type:function size:0x30
fn_800D5380__11dLytMeter_cFUc = .text:0x800D5380; // type:function size:0x44
fn_800D53D0 = .text:0x800D53D0; // type:function size:0x50
@@ -4751,9 +4751,9 @@ fn_800D5630 = .text:0x800D5630; // type:function size:0x18
fn_800D5650__11dLytMeter_cFv = .text:0x800D5650; // type:function size:0x24
fn_800D5680__11dLytMeter_cFv = .text:0x800D5680; // type:function size:0x28
fn_800D56B0 = .text:0x800D56B0; // type:function size:0xFC
fn_800D57B0 = .text:0x800D57B0; // type:function size:0x1A58
fn_800D57B0__11dLytMeter_cFv = .text:0x800D57B0; // type:function size:0x1A58
execute__11dLytMeter_cFv = .text:0x800D7210; // type:function size:0x92C
fn_800D7B40 = .text:0x800D7B40; // type:function size:0xC
fn_800D7B40__15dLytMsgWindow_cFv = .text:0x800D7B40; // type:function size:0xC
draw__11dLytMeter_cFv = .text:0x800D7B50; // type:function size:0x128
getLyt__20LytMeterTimerPart1_cFv = .text:0x800D7C80; // type:function size:0x8
getLyt__20LytMeterTimerPart2_cFv = .text:0x800D7C90; // type:function size:0x8
@@ -8724,7 +8724,7 @@ fn_80158530 = .text:0x80158530; // type:function size:0x4
fn_80158540 = .text:0x80158540; // type:function size:0x80
fn_801585C0 = .text:0x801585C0; // type:function size:0x4
build__15dLytBossGauge_cFv = .text:0x801585D0; // type:function size:0x188
fn_80158760 = .text:0x80158760; // type:function size:0x100
execute__15dLytBossGauge_cFv = .text:0x80158760; // type:function size:0x100
draw__15dLytBossGauge_cFv = .text:0x80158860; // type:function size:0x68
remove__15dLytBossGauge_cFv = .text:0x801588D0; // type:function size:0x5C
fn_80158930 = .text:0x80158930; // type:function size:0x10
+1
View File
@@ -12,6 +12,7 @@ public:
bool build();
bool remove();
bool execute();
bool draw();
private:
+8
View File
@@ -54,6 +54,14 @@ public:
}
}
static void reset(DoButton_e button, Action_e value) {
LytDoButtonRelated *b = sInstance;
if (b != nullptr) {
b->field_0x04[button] = value;
b->field_0x34[button] = false;
}
}
static Action_e get(DoButton_e button) {
if (sInstance != nullptr) {
return sInstance->field_0x04[button];
+12 -6
View File
@@ -71,9 +71,11 @@ public:
bool fn_800CA040();
bool fn_800D5380(u8);
bool fn_800D5290();
bool fn_800D5650();
bool fn_800D5680();
bool fn_800D56B0();
bool fn_800D57B0();
bool execute();
bool isSilentRealm();
@@ -145,12 +147,12 @@ public:
/* 0x1374C */ s32 field_0x1374C;
/* 0x13750 */ s32 field_0x13750;
/* 0x13754 */ s32 field_0x13754;
/* 0x13758 */ s32 field_0x13758;
/* 0x1375C */ s32 field_0x1375C;
/* 0x13760 */ s32 field_0x13760;
/* 0x13764 */ s32 field_0x13764;
/* 0x13768 */ s32 field_0x13768;
/* 0x1376C */ s32 field_0x1376C;
/* 0x13758 */ s32 mShieldPosIndex;
/* 0x1375C */ s32 mRupyPosIndex;
/* 0x13760 */ s32 mRupyPosInterpFrame;
/* 0x13764 */ s32 mShieldPosInterpFrame;
/* 0x13768 */ s32 mOldShieldPosIndex;
/* 0x1376C */ s32 mOldRupyPosIndex;
/* 0x13770 */ u8 field_0x13770;
/* 0x13771 */ u8 field_0x13771;
/* 0x13772 */ u8 field_0x13772;
@@ -252,6 +254,10 @@ public:
mFlags = mFlags & ~mask;
}
void resetFlags() {
mFlags = 0xFFFFFFFF;
}
static s32 getCrossBtn0x7BF8() {
if (sInstance != nullptr) {
return sInstance->mMeter.mCrossBtn.getField_0x620();
+2 -1
View File
@@ -26,9 +26,10 @@ public:
return field_0x78C;
}
u8 getCurrentHealthCapacity() const;
private:
u8 getCurrentHealth() const;
u8 getCurrentHealthCapacity() const;
void realizeHeartsState();
void executeInternal();
s32 getNumDisplayedHearts() const;
+5 -1
View File
@@ -99,6 +99,10 @@ public:
mpAnm2 = outAnm;
}
void setShouldBeVisible(bool val) {
mShouldBeVisible = val;
}
private:
STATE_FUNC_DECLARE(dLytMeterParts_c, Invisible);
STATE_FUNC_DECLARE(dLytMeterParts_c, In);
@@ -109,7 +113,7 @@ private:
/* 0x3C */ d2d::AnmGroup_c *mpAnm1;
/* 0x40 */ d2d::AnmGroup_c *mpAnm2;
/* 0x44 */ s32 mIndex;
/* 0x48 */ u8 mShouldBeVisible;
/* 0x48 */ bool mShouldBeVisible;
};
#endif
+4
View File
@@ -93,6 +93,10 @@ public:
field_0x8A9 = val;
}
u8 getField_0x8A9() const {
return field_0x8A9;
}
void setField_0x8AA(u8 val) {
field_0x8AA = val;
}
@@ -31,6 +31,14 @@ public:
mpOwnerPane = pane;
}
f32 getGaugePercentMaybe() const {
return field_0x2E0;
}
void setfield_0x318(s32 v) {
field_0x318 = v;
}
private:
s32 getLytFrameForShield(s32) const;
void setLevel(f32 level);
@@ -50,6 +50,14 @@ public:
const char *fn_80117390(bool) const;
// This function appears to be related to a compiler quirk.
// 0x800D7B40 is in d_lyt_meter, but calling a static method
// on an instance via dLytMsgWindow_c::getInstance()->fn_800D7B40()
// causes the method to be emitted there.
static u16 fn_800D7B40() {
return sInstance->mEntryPointToTrigger;
}
private:
bool setTextToDisplay(const wchar_t *text);
void createSubMsgManager(u8 type);
+208 -8
View File
@@ -1,4 +1,5 @@
// clang-format off
#include "c/c_lib.h"
#include "common.h"
#include "d/a/d_a_player.h"
#include "d/d_message.h"
@@ -9,8 +10,10 @@
#include "d/lyt/d_lyt_area_caption.h"
#include "d/lyt/d_lyt_control_game.h"
#include "d/lyt/d_lyt_meter_configuration.h"
#include "d/lyt/d_lyt_unknowns.h"
#include "d/lyt/d_window.h"
#include "d/lyt/meter/d_lyt_meter.h"
#include "d/lyt/msg_window/d_lyt_msg_window.h"
#include "m/m_vec.h"
#include "nw4r/lyt/lyt_group.h"
#include "toBeSorted/arc_managers/layout_arc_manager.h"
@@ -644,10 +647,10 @@ bool dLytMeter_c::build(d2d::ResAccIf_c *resAcc) {
mShieldPositions[0].copyFrom(mLyt.findPane("N_shield_00")->GetTranslate());
mShieldPositions[1].copyFrom(mLyt.findPane("N_shield_01")->GetTranslate());
field_0x13758 = 0;
field_0x13768 = 0;
field_0x13764 = 0;
mShieldPos = mShieldPositions[field_0x13764];
mShieldPosIndex = 0;
mOldShieldPosIndex = 0;
mShieldPosInterpFrame = 0;
mShieldPos = mShieldPositions[mShieldPosIndex];
mLyt.findPane("N_rupyAll_00")->SetVisible(true);
mAnmGroups[METER_ANIM_RUPY_POSITION].setAnimEnable(true);
@@ -662,10 +665,10 @@ bool dLytMeter_c::build(d2d::ResAccIf_c *resAcc) {
mAnmGroups[METER_ANIM_RUPY_POSITION].setAnimEnable(false);
mLyt.findPane("N_rupyAll_00")->SetVisible(false);
field_0x1375C = 0;
field_0x1376C = 0;
field_0x13760 = 0;
mRupyPos = mRupyPositions[field_0x13760];
mRupyPosIndex = 0;
mOldRupyPosIndex = 0;
mRupyPosInterpFrame = 0;
mRupyPos = mRupyPositions[mRupyPosIndex];
mPos3.x = mPos3.y = mPos3.z = 0.0f;
field_0x137C0 = 0x3C;
@@ -946,6 +949,203 @@ bool dLytMeter_c::remove() {
return true;
}
bool dLytMeter_c::execute() {
dLytMeterContainer_c *container = dLytMeterContainer_c::GetInstance();
if (field_0x13775 && !EventManager::isInEvent()) {
field_0x13775 = 0;
}
if (isSilentRealm()) {
container->clearFlags(0x40);
container->clearFlags(0xF);
}
if (dStageMgr_c::GetInstance()->isInLastBoss()) {
container->clearFlags(0x20);
}
if (field_0x13750 != 0 && field_0x13748 == 1) {
fn_800D5290();
}
fn_800D57B0();
s32 heartsHeight;
s32 rupeePos;
s32 kakeraKeyPos;
s32 bossKeyPos;
s32 smallKeyPos;
if (mHeart.getCurrentHealthCapacity() / 4 <= 10) {
heartsHeight = 0;
if (mShield.getGaugePercentMaybe() > 0.0f &&
(mLyt.findPane("N_shieldAll_00")->IsVisible() || isNotSilentRealmOrLoftwing())) {
rupeePos = 0;
kakeraKeyPos = 1;
bossKeyPos = 1;
smallKeyPos = 1;
} else {
rupeePos = 2;
kakeraKeyPos = 0;
bossKeyPos = 0;
smallKeyPos = 0;
}
} else {
heartsHeight = 1;
if (mShield.getGaugePercentMaybe() > 0.0f &&
(mLyt.findPane("N_shieldAll_00")->IsVisible() || isNotSilentRealmOrLoftwing())) {
rupeePos = 1;
kakeraKeyPos = 1;
bossKeyPos = 3;
smallKeyPos = 3;
} else {
rupeePos = 4;
kakeraKeyPos = 0;
bossKeyPos = 2;
smallKeyPos = 2;
}
}
if (dMessage_c::getInstance()->getField_0x2FC() != 0) {
rupeePos = 3;
if (dLytMsgWindow_c::getInstance() != nullptr && (dLytMsgWindow_c::getInstance()->fn_800D7B40() == 0x9E02 ||
dLytMsgWindow_c::getInstance()->fn_800D7B40() == 0x768C)) {
s32 off = -(mHeart.getCurrentHealthCapacity() / 4 <= 10);
rupeePos = 6 + off;
}
}
if (mShieldPosIndex != heartsHeight) {
mOldShieldPosIndex = mShieldPosIndex;
mShieldPosIndex = heartsHeight;
mShieldPosInterpFrame = 0;
}
if (mRupyPosIndex != rupeePos) {
mOldRupyPosIndex = mRupyPosIndex;
mRupyPosIndex = rupeePos;
mRupyPosInterpFrame = 0;
}
if (mpKakeraKey != nullptr) {
mpKakeraKey->setPosition(kakeraKeyPos);
}
if (mpBossKey != nullptr) {
mpBossKey->setPosition(bossKeyPos);
}
if (mpSmallKey != nullptr) {
mpSmallKey->setPosition(smallKeyPos);
}
if (mShieldPos != mShieldPositions[mShieldPosIndex]) {
if (mShieldPosInterpFrame < 5) {
mVec3_c diff = mShieldPositions[mShieldPosIndex] - mShieldPositions[mOldShieldPosIndex];
mShieldPos =
diff * cLib::easeOut(++mShieldPosInterpFrame / 5.0f, 3.0f) + mShieldPositions[mOldShieldPosIndex];
} else {
mShieldPosInterpFrame = 0;
mShieldPos = mShieldPositions[mShieldPosIndex];
}
mNodes[METER_SHIELD].mpPane->SetTranslate(mShieldPos);
}
if (field_0x13748 != field_0x1374C) {
field_0x1374C = field_0x13748;
mAnmGroups[METER_ANIM_POSITION].setFrame(field_0x13748);
mAnmGroups[METER_ANIM_POSITION].setAnimEnable(true);
}
for (int i = 0; i < METER_NUM_PANES; i++) {
bool visible = true;
if (!field_0x137A2[i]) {
bool b = field_0x13782[i] && field_0x13792[i];
if (!b) {
visible = false;
}
}
mParts[i].setShouldBeVisible(visible);
mParts[i].execute();
}
if (mRupyPos != mRupyPositions[mRupyPosIndex]) {
mShield.setfield_0x318(2);
if (mRupy.getField_0x8A9() == 1) {
mRupyPosInterpFrame = 5;
}
if (mRupyPosInterpFrame < 5) {
mVec3_c diff = mRupyPositions[mRupyPosIndex] - mRupyPositions[mOldRupyPosIndex];
mRupyPos = diff * cLib::easeOut(++mRupyPosInterpFrame / 5.0f, 3.0f) + mRupyPositions[mOldRupyPosIndex];
} else {
mRupyPosInterpFrame = 0;
mRupyPos = mRupyPositions[mRupyPosIndex];
}
mNodes[METER_RUPY].mpPane->SetTranslate(mRupyPos);
}
for (int i = 0; i < METER_NUM_PANES; i++) {
if (mNodes[i].mpLytPane != nullptr) {
mNodes[i].mpLytPane->execute();
}
}
mLyt.calc();
mItemSelect.fn_800EF580();
if (mAnmGroups[METER_ANIM_POSITION].isEnabled()) {
mAnmGroups[METER_ANIM_POSITION].setAnimEnable(false);
}
container->resetFlags();
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_A, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_B, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::fn_8010EC10(LytDoButtonRelated::DO_NONE, true);
LytDoButtonRelated::fn_8010ED50(LytDoButtonRelated::DO_NONE, true);
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_L, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_CROSS_R, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::reset(LytDoButtonRelated::DO_BUTTON_C, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::reset(LytDoButtonRelated::DO_BUTTON_NUN_STK, LytDoButtonRelated::DO_NONE);
LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_NUN_BG, LytDoButtonRelated::DO_NONE);
if (mpTimer != nullptr) {
mpTimer->execute();
}
if (mpTimerPart1 != nullptr) {
mpTimerPart1->execute();
}
if (mpTimerPart2 != nullptr) {
mpTimerPart2->execute();
}
if (mpSkyGauge != nullptr) {
mpSkyGauge->execute();
}
if (mpBirdGauge != nullptr) {
mpBirdGauge->execute();
}
if (mpBossGauge != nullptr) {
mpBossGauge->execute();
}
if (mpKakeraKey != nullptr) {
mpKakeraKey->execute();
}
if (mpBossKey != nullptr) {
mpBossKey->execute();
}
if (mpSmallKey != nullptr) {
mpSmallKey->execute();
}
if (mpDrink != nullptr) {
mpDrink->execute();
}
return true;
}
bool dLytMeter_c::draw() {
mLyt.addToDrawList();
if (mpTimerPart1 != nullptr) {
+6 -9
View File
@@ -173,9 +173,8 @@ bool dLytMeterKakeraKey_c::execute() {
mStateMgr.executeState();
if (mPosition != mPanePositions[mPosititionIndex]) {
if (mMovementFrame < 5) {
mPosition = (mPanePositions[mPosititionIndex] - mPanePositions[mOldPosititionIndex]) *
cLib::easeOut(++mMovementFrame / 5.0f, 3.0f) +
mPanePositions[mOldPosititionIndex];
mVec3_c diff = mPanePositions[mPosititionIndex] - mPanePositions[mOldPosititionIndex];
mPosition = diff * cLib::easeOut(++mMovementFrame / 5.0f, 3.0f) + mPanePositions[mOldPosititionIndex];
} else {
mMovementFrame = 0;
mPosition = mPanePositions[mPosititionIndex];
@@ -337,9 +336,8 @@ bool dLytMeterBossKey_c::execute() {
if (mPosition != mPanePositions[mPosititionIndex]) {
if (mMovementFrame < 5) {
mPosition = (mPanePositions[mPosititionIndex] - mPanePositions[mOldPosititionIndex]) *
cLib::easeOut(++mMovementFrame / 5.0f, 3.0f) +
mPanePositions[mOldPosititionIndex];
mVec3_c diff = mPanePositions[mPosititionIndex] - mPanePositions[mOldPosititionIndex];
mPosition = diff * cLib::easeOut(++mMovementFrame / 5.0f, 3.0f) + mPanePositions[mOldPosititionIndex];
} else {
mMovementFrame = 0;
mPosition = mPanePositions[mPosititionIndex];
@@ -494,9 +492,8 @@ bool dLytMeterSmallKey_c::execute() {
if (mPosition != mPanePositions[mPosititionIndex]) {
if (mMovementFrame < 5) {
mPosition = (mPanePositions[mPosititionIndex] - mPanePositions[mOldPosititionIndex]) *
cLib::easeOut(++mMovementFrame / 5.0f, 3.0f) +
mPanePositions[mOldPosititionIndex];
mVec3_c diff = mPanePositions[mPosititionIndex] - mPanePositions[mOldPosititionIndex];
mPosition = diff * cLib::easeOut(++mMovementFrame / 5.0f, 3.0f) + mPanePositions[mOldPosititionIndex];
} else {
mMovementFrame = 0;
mPosition = mPanePositions[mPosititionIndex];