diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index 703b44e4..e0cb8ad1 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -430,6 +430,7 @@ d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp: .ctors start:0x804DB718 end:0x804DB71C .rodata start:0x804E69D8 end:0x804E6A58 .data start:0x80518F00 end:0x80519578 + .sdata start:0x805724F0 end:0x80572500 .sdata2 start:0x80579C78 end:0x80579CF8 .bss start:0x805AC750 end:0x805ACA90 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index da5e8bda..e562266a 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -6298,17 +6298,17 @@ finalizeState_Recovery__23dLytMeterGanbariGauge_cFv = .text:0x80103350; // type: initializeState_ToMax__23dLytMeterGanbariGauge_cFv = .text:0x80103360; // type:function size:0xAC executeState_ToMax__23dLytMeterGanbariGauge_cFv = .text:0x80103410; // type:function size:0x8C finalizeState_ToMax__23dLytMeterGanbariGauge_cFv = .text:0x801034A0; // type:function size:0x4 -fn_801034B0 = .text:0x801034B0; // type:function size:0x68 -fn_80103520 = .text:0x80103520; // type:function size:0x58 +isStaminaLow__23dLytMeterGanbariGauge_cFf = .text:0x801034B0; // type:function size:0x68 +isStaminaCritical__23dLytMeterGanbariGauge_cFf = .text:0x80103520; // type:function size:0x58 build__23dLytMeterGanbariGauge_cFPQ23d2d10ResAccIf_c = .text:0x80103580; // type:function size:0x250 remove__23dLytMeterGanbariGauge_cFv = .text:0x801037D0; // type:function size:0x50 execute__23dLytMeterGanbariGauge_cFv = .text:0x80103820; // type:function size:0xEF0 -fn_80104710 = .text:0x80104710; // type:function size:0x4C -fn_80104760 = .text:0x80104760; // type:function size:0x48 -fn_801047B0 = .text:0x801047B0; // type:function size:0x60 -fn_80104810 = .text:0x80104810; // type:function size:0x10 +fn_80104710__23dLytMeterGanbariGauge_cCFb = .text:0x80104710; // type:function size:0x4C +fn_80104760__23dLytMeterGanbariGauge_cCFv = .text:0x80104760; // type:function size:0x48 +fn_801047B0__23dLytMeterGanbariGauge_cCFv = .text:0x801047B0; // type:function size:0x60 +isCrawling__23dLytMeterGanbariGauge_cCFv = .text:0x80104810; // type:function size:0x10 swimmingRelated__23dLytMeterGanbariGauge_cFv = .text:0x80104820; // type:function size:0x38 -fn_80104860 = .text:0x80104860; // type:function size:0x58 +displayAirInsteadOfStamina__23dLytMeterGanbariGauge_cFv = .text:0x80104860; // type:function size:0x58 realizeAnimState__23dLytMeterGanbariGauge_cFv = .text:0x801048C0; // type:function size:0x190 getName__23dLytMeterGanbariGauge_cCFv = .text:0x80104A50; // type:function size:0x8 getLyt__23dLytMeterGanbariGauge_cFv = .text:0x80104A60; // type:function size:0x8 @@ -31702,34 +31702,34 @@ __vt__15dLytMeterRupy_c = .data:0x80518C00; // type:object size:0x34 __vt__30sFStateID_c<15dLytMeterRupy_c> = .data:0x80518E60; // type:object size:0x34 __vt__35sFStateID_c<20dLytMeterRupyBlink_c> = .data:0x80518E94; // type:object size:0x34 __vt__35sFStateID_c<20dLytMeterRupyStart_c> = .data:0x80518EC8; // type:object size:0x34 -lbl_80518F00 = .data:0x80518F00; // type:object size:0x14 -lbl_80518F14 = .data:0x80518F14; // type:object size:0xC +lbl_80518F00 = .data:0x80518F00; // type:object size:0x11 data:string +lbl_80518F14 = .data:0x80518F14; // type:object size:0xB data:string lbl_80518F20 = .data:0x80518F20; // type:object size:0x14 data:string -lbl_80518F34 = .data:0x80518F34; // type:object size:0xC +lbl_80518F34 = .data:0x80518F34; // type:object size:0xB data:string lbl_80518F40 = .data:0x80518F40; // type:object size:0x1C data:string -lbl_80518F5C = .data:0x80518F5C; // type:object size:0x10 -lbl_80518F6C = .data:0x80518F6C; // type:object size:0x10 -lbl_80518F7C = .data:0x80518F7C; // type:object size:0x1C -lbl_80518F98 = .data:0x80518F98; // type:object size:0x1C -lbl_80518FB4 = .data:0x80518FB4; // type:object size:0x14 +lbl_80518F5C = .data:0x80518F5C; // type:object size:0xD data:string +lbl_80518F6C = .data:0x80518F6C; // type:object size:0xD data:string +lbl_80518F7C = .data:0x80518F7C; // type:object size:0x19 data:string +lbl_80518F98 = .data:0x80518F98; // type:object size:0x1A data:string +lbl_80518FB4 = .data:0x80518FB4; // type:object size:0x11 data:string lbl_80518FC8 = .data:0x80518FC8; // type:object size:0x14 data:string -lbl_80518FDC = .data:0x80518FDC; // type:object size:0xC +lbl_80518FDC = .data:0x80518FDC; // type:object size:0xB data:string lbl_80518FE8 = .data:0x80518FE8; // type:object size:0x14 data:string -lbl_80518FFC = .data:0x80518FFC; // type:object size:0xC -lbl_80519008 = .data:0x80519008; // type:object size:0x18 -lbl_80519020 = .data:0x80519020; // type:object size:0x10 -lbl_80519030 = .data:0x80519030; // type:object size:0x18 -lbl_80519048 = .data:0x80519048; // type:object size:0x10 +lbl_80518FFC = .data:0x80518FFC; // type:object size:0xB data:string +lbl_80519008 = .data:0x80519008; // type:object size:0x17 data:string +lbl_80519020 = .data:0x80519020; // type:object size:0xE data:string +lbl_80519030 = .data:0x80519030; // type:object size:0x16 data:string +lbl_80519048 = .data:0x80519048; // type:object size:0xD data:string lbl_80519058 = .data:0x80519058; // type:object size:0x14 data:string lbl_8051906C = .data:0x8051906C; // type:object size:0xC data:string lbl_80519078 = .data:0x80519078; // type:object size:0x18 data:string lbl_80519090 = .data:0x80519090; // type:object size:0xC data:string lbl_8051909C = .data:0x8051909C; // type:object size:0x14 data:string lbl_805190B0 = .data:0x805190B0; // type:object size:0x14 data:string -lbl_805190C4 = .data:0x805190C4; // type:object size:0xC -lbl_805190D0 = .data:0x805190D0; // type:object size:0x18 +lbl_805190C4 = .data:0x805190C4; // type:object size:0xB data:string +lbl_805190D0 = .data:0x805190D0; // type:object size:0x12 data:string lbl_805190E8 = .data:0x805190E8; // type:object size:0x18 data:string -lbl_80519100 = .data:0x80519100; // type:object size:0x10 +lbl_80519100 = .data:0x80519100; // type:object size:0xE data:string __vt__23dLytMeterGanbariGauge_c = .data:0x80519110; // type:object size:0x34 __vt__38sFStateID_c<23dLytMeterGanbariGauge_c> = .data:0x80519540; // type:object size:0x34 lbl_80519578 = .data:0x80519578; // type:object size:0x14 @@ -38174,8 +38174,8 @@ lbl_805724D0 = .sdata:0x805724D0; // type:object size:0x7 data:string lbl_805724D8 = .sdata:0x805724D8; // type:object size:0x7 data:string lbl_805724E0 = .sdata:0x805724E0; // type:object size:0x7 data:string lbl_805724E8 = .sdata:0x805724E8; // type:object size:0x4 data:4byte -lbl_805724F0 = .sdata:0x805724F0; // type:object size:0x8 -lbl_805724F8 = .sdata:0x805724F8; // type:object size:0x8 +lbl_805724F0 = .sdata:0x805724F0; // type:object size:0x5 data:string +lbl_805724F8 = .sdata:0x805724F8; // type:object size:0x6 data:string lbl_80572500 = .sdata:0x80572500; // type:object size:0x8 data:4byte lbl_80572508 = .sdata:0x80572508; // type:object size:0x8 lbl_80572510 = .sdata:0x80572510; // type:object size:0x8 data:4byte @@ -48771,16 +48771,16 @@ LytMeterRupy__STATE_IN = .bss:0x805AC660; // type:object size:0x30 data:4byte LytMeterRupy__STATE_ACTIVE = .bss:0x805AC6A0; // type:object size:0x30 data:4byte LytMeterRupy__STATE_START = .bss:0x805AC6E0; // type:object size:0x30 data:4byte LytMeterRupy__STATE_OUT = .bss:0x805AC720; // type:object size:0x30 data:4byte -lbl_805AC750 = .bss:0x805AC750; // type:object size:0x10 -LytMeterGanbariGauge__STATE_INVISIBLE_WAIT = .bss:0x805AC760; // type:object size:0x80 data:4byte -LytMeterGanbariGauge__STATE_WAIT = .bss:0x805AC7E0; // type:object size:0x80 data:4byte -LytMeterGanbariGauge__STATE_OUT = .bss:0x805AC860; // type:object size:0x80 data:4byte -LytMeterGanbariGauge__STATE_FULL = .bss:0x805AC8E0; // type:object size:0x40 data:4byte -LytMeterGanbariGauge__STATE_FULL_GUTS_USE = .bss:0x805AC920; // type:object size:0x40 data:4byte -LytMeterGanbariGauge__STATE_NORMAL = .bss:0x805AC960; // type:object size:0x40 data:4byte -LytMeterGanbariGauge__STATE_CAUTION = .bss:0x805AC9A0; // type:object size:0x40 data:4byte -LytMeterGanbariGauge__STATE_TO_MIN = .bss:0x805AC9E0; // type:object size:0x40 data:4byte -lbl_805ACA20 = .bss:0x805ACA20; // type:object size:0x40 data:4byte +lbl_805AC750 = .bss:0x805AC750; // type:object size:0xC +LytMeterGanbariGauge__STATE_INVISIBLE_WAIT = .bss:0x805AC760; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_WAIT = .bss:0x805AC7E0; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_OUT = .bss:0x805AC860; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_FULL = .bss:0x805AC8E0; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_FULL_GUTS_USE = .bss:0x805AC920; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_NORMAL = .bss:0x805AC960; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_CAUTION = .bss:0x805AC9A0; // type:object size:0x30 data:4byte +LytMeterGanbariGauge__STATE_TO_MIN = .bss:0x805AC9E0; // type:object size:0x30 data:4byte +lbl_805ACA20 = .bss:0x805ACA20; // type:object size:0x30 data:4byte LytMeterGanbariGauge__STATE_TO_MAX = .bss:0x805ACA60; // type:object size:0x30 data:4byte lbl_805ACA90 = .bss:0x805ACA90; // type:object size:0x10 LytMeterEventSkip__STATE_INVISIBLE = .bss:0x805ACAA0; // type:object size:0x40 data:4byte diff --git a/configure.py b/configure.py index e3c58189..3f1e09d4 100644 --- a/configure.py +++ b/configure.py @@ -399,7 +399,7 @@ config.libs = [ Object(Matching, "d/lyt/meter/d_lyt_meter_cross_btn.cpp"), Object(Matching, "d/lyt/meter/d_lyt_meter_dowsing.cpp"), Object(Matching, "d/lyt/meter/d_lyt_meter_rupy.cpp"), - Object(NonMatching, "d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp"), + Object(Matching, "d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp"), Object(NonMatching, "d/lyt/meter/d_lyt_meter_event_skip.cpp"), Object(NonMatching, "d/lyt/meter/d_lyt_meter_timer.cpp"), Object(Matching, "d/lyt/meter/d_lyt_meter_heart.cpp"), diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 692bb763..b355121a 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -11,6 +11,7 @@ #include "m/m_mtx.h" #include "m/m_vec.h" #include "nw4r/g3d/res/g3d_resfile.h" +#include "toBeSorted/file_manager.h" class dAcPy_c : public dAcObjBase_c { // See Below for some info @@ -145,7 +146,7 @@ public: /* vt 0x1B4 */ virtual void isByte0x434eEqual7(); /* vt 0x1B8 */ virtual void canHandleGameOver(); /* vt 0x1BC */ virtual void vt_0x1BC(); - /* vt 0x1C0 */ virtual void vt_0x1C0(); + /* vt 0x1C0 */ virtual void *vt_0x1C0() const; /* vt 0x1C4 */ virtual void getActorInActorRef1(); /* vt 0x1C8 */ virtual void doesActorRef1Exist(); /* vt 0x1CC */ virtual void unlinkActorRef1(); @@ -297,6 +298,18 @@ public: return mRidingActorType; } + inline bool hasvt_0x1C0() const { + return vt_0x1C0() != nullptr; + } + + inline bool isAffectedByStaminaPotion() const { + return FileManager::GetInstance()->hasStaminaPotionNormal() && getRidingActorType() != 3; + } + + inline bool isAffectedByStaminaPotionPlus() const { + return FileManager::GetInstance()->hasStaminaPotionPlus() && getRidingActorType() != 3; + } + static nw4r::g3d::ResFile getItemResFile(const char *name, mAllocator_c &allocator); static const dAcPy_c *GetLink() { diff --git a/include/d/d_camera.h b/include/d/d_camera.h index 3f8b8e97..baf6246c 100644 --- a/include/d/d_camera.h +++ b/include/d/d_camera.h @@ -2,17 +2,29 @@ #define D_CAMERA_H #include "d/d_base.h" +#include "m/m_vec.h" -extern "C" bool fn_80081FE0(void*, const char *); +extern "C" bool fn_80081FE0(void *, const char *); class dCamera_c : public dBase_c { public: - /* 0x068 */ u8 _0x068[0xD98 - 0x068]; - /* 0xD98 */ void *field_0xD98; - bool isCurrentTrend(const char *name) const { return fn_80081FE0(field_0xD98, name); } + + void *getField_0xD98() const { + return field_0xD98; + } + + const mVec3_c &getPositionMaybe() const { + return mPositionMaybe; + } + +private: + /* 0x068 */ u8 _0x068[0x6C - 0x068]; + /* 0x06C */ mVec3_c mPositionMaybe; + /* 0x078 */ u8 _0x078[0xD98 - 0x078]; + /* 0xD98 */ void *field_0xD98; }; #endif diff --git a/include/d/lyt/meter/d_lyt_meter_ganbari_gauge.h b/include/d/lyt/meter/d_lyt_meter_ganbari_gauge.h index 702033e9..fb6da8a1 100644 --- a/include/d/lyt/meter/d_lyt_meter_ganbari_gauge.h +++ b/include/d/lyt/meter/d_lyt_meter_ganbari_gauge.h @@ -25,11 +25,17 @@ public: virtual ~dLytMeterGanbariGauge_c() {} + bool fn_80104760() const; + private: void realizeAnimState(); + static bool isStaminaLow(f32); + static bool isStaminaCritical(f32); + bool fn_80104710(bool) const; + bool isCrawling() const; static bool swimmingRelated(); - static bool fn_801034B0(f32); - static bool fn_80103520(f32); + bool fn_801047B0() const; + bool displayAirInsteadOfStamina(); STATE_FUNC_DECLARE(dLytMeterGanbariGauge_c, InvisibleWait); STATE_FUNC_DECLARE(dLytMeterGanbariGauge_c, In); @@ -57,18 +63,18 @@ private: /* 0x524 */ mVec3_c field_0x524; /* 0x530 */ u8 field_0x530; /* 0x534 */ s32 field_0x534; - /* 0x538 */ u32 field_0x538; + /* 0x538 */ s32 field_0x538; /* 0x53C */ s32 mOutWaitTimer; - /* 0x540 */ u32 field_0x540; - /* 0x544 */ u32 field_0x544; - /* 0x548 */ u32 field_0x548; + /* 0x540 */ s32 field_0x540; + /* 0x544 */ s32 field_0x544; + /* 0x548 */ s32 field_0x548; /* 0x54C */ f32 field_0x54C; /* 0x550 */ f32 field_0x550; /* 0x554 */ f32 field_0x554; u8 field_0x558; u8 field_0x559; - u8 field_0x55A; + bool field_0x55A; u8 field_0x55B; }; diff --git a/include/m/m_vec.h b/include/m/m_vec.h index 0ec12fd4..e538d058 100644 --- a/include/m/m_vec.h +++ b/include/m/m_vec.h @@ -262,6 +262,10 @@ public: mVec2_c(const mVec2_c &other) { set(other.x, other.y); } + + mVec2_c(f32 fx, f32 fy) { + set(fx, fy); + } }; #endif diff --git a/include/toBeSorted/file_manager.h b/include/toBeSorted/file_manager.h index 28750912..fee3b36a 100644 --- a/include/toBeSorted/file_manager.h +++ b/include/toBeSorted/file_manager.h @@ -293,6 +293,22 @@ public: return getGuardianPotionTimer() != 0; } + bool hasAirPotionPlus() const { + return getAirPotionPlusTimer() != 0; + } + + bool hasAirPotionNormal() const { + return getAirPotionTimer() != 0; + } + + bool hasStaminaPotionPlus() const { + return getStaminaPotionPlusTimer() != 0; + } + + bool hasStaminaPotionNormal() const { + return getStaminaPotionTimer() != 0; + } + private: static FileManager *sInstance; }; diff --git a/src/d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp b/src/d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp index 4fd6c49b..5672eb80 100644 --- a/src/d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp +++ b/src/d/lyt/meter/d_lyt_meter_ganbari_gauge.cpp @@ -2,7 +2,13 @@ #include "common.h" #include "d/a/d_a_player.h" +#include "d/d_camera.h" +#include "d/d_sc_game.h" #include "d/lyt/d_lyt_meter_configuration.h" +#include "m/m_vec.h" +#include "toBeSorted/d_d3d.h" +#include "toBeSorted/event_manager.h" +#include "toBeSorted/file_manager.h" STATE_DEFINE(dLytMeterGanbariGauge_c, InvisibleWait); STATE_DEFINE(dLytMeterGanbariGauge_c, In); @@ -168,10 +174,10 @@ void dLytMeterGanbariGauge_c::finalizeState_FullGutsUse() {} void dLytMeterGanbariGauge_c::initializeState_Normal() {} void dLytMeterGanbariGauge_c::executeState_Normal() { - if (fn_801034B0(field_0x518)) { + if (isStaminaLow(field_0x518)) { mAnm[GANBARI_ANIM_CAUTION].setRate(1.0f); mStateMgrWheel.changeState(StateID_Caution); - } else if (fn_80103520(field_0x518)) { + } else if (isStaminaCritical(field_0x518)) { mAnm[GANBARI_ANIM_CAUTION].setRate(3.0f); mStateMgrWheel.changeState(StateID_Caution); } else if (field_0x518 >= 0.9999f) { @@ -187,9 +193,9 @@ void dLytMeterGanbariGauge_c::initializeState_Caution() { void dLytMeterGanbariGauge_c::executeState_Caution() { if (field_0x518 <= 0.0001f) { mStateMgrWheel.changeState(StateID_ToMin); - } else if (fn_80103520(field_0x518)) { + } else if (isStaminaCritical(field_0x518)) { mAnm[GANBARI_ANIM_CAUTION].setRate(3.0f); - } else if (fn_801034B0(field_0x518)) { + } else if (isStaminaLow(field_0x518)) { mAnm[GANBARI_ANIM_CAUTION].setRate(1.0f); } else { mStateMgrWheel.changeState(StateID_Normal); @@ -285,6 +291,22 @@ void dLytMeterGanbariGauge_c::executeState_ToMax() { } void dLytMeterGanbariGauge_c::finalizeState_ToMax() {} +bool dLytMeterGanbariGauge_c::isStaminaLow(f32 arg) { + if (swimmingRelated()) { + return arg <= 0.125f; + } else { + return arg <= 0.3f; + } +} + +bool dLytMeterGanbariGauge_c::isStaminaCritical(f32 arg) { + if (swimmingRelated()) { + return false; + } else { + return arg <= 0.1f; + } +} + bool dLytMeterGanbariGauge_c::build(d2d::ResAccIf_c *resAcc) { mLyt.setResAcc(resAcc); mLyt.build("guts_00.brlyt", nullptr); @@ -365,19 +387,305 @@ bool dLytMeterGanbariGauge_c::execute() { } if (!mpPane->IsVisible()) { - if (!(*mStateMgrMain.getStateID() != StateID_InvisibleWait)) { - return true; + if (*mStateMgrMain.getStateID() != StateID_InvisibleWait) { + mStateMgrMain.changeState(StateID_InvisibleWait); } - mStateMgrMain.changeState(StateID_InvisibleWait); return true; } - // TODO I really don't like the look of the rest of this function. Depends on a bunch - // of player, camera and filemanager stuff with a ton of inlines... + if (fn_80104710(false) || (isCrawling() && !fn_801047B0())) { + field_0x534 = 1; + } else if (dLytMeterConfiguration_c::GetInstance()->field_0x13C) { + field_0x534 = 0; + } else { + field_0x534 = 1; + } + + bool b12 = false; + field_0x558 = 0; + f32 drinkFrame = 0.0f; + if (displayAirInsteadOfStamina()) { + if (FileManager::GetInstance()->hasAirPotionPlus() || FileManager::GetInstance()->hasAirPotionNormal()) { + b12 = true; + if ((FileManager::GetInstance()->hasAirPotionNormal() && + FileManager::GetInstance()->getAirPotionTimer() < 600) || + (FileManager::GetInstance()->hasAirPotionPlus() && + FileManager::GetInstance()->getAirPotionPlusTimer() < 600)) { + field_0x558 = 1; + } + if (FileManager::GetInstance()->hasAirPotionPlus()) { + drinkFrame = 3.0f; + } else if (FileManager::GetInstance()->hasAirPotionNormal()) { + drinkFrame = 1.0f; + } + } + } else { + if (dAcPy_c::GetLink()->isAffectedByStaminaPotionPlus() || dAcPy_c::GetLink()->isAffectedByStaminaPotion()) { + b12 = true; + if ((dAcPy_c::GetLink()->isAffectedByStaminaPotion() && + FileManager::GetInstance()->getStaminaPotionTimer() < 600) || + (dAcPy_c::GetLink()->isAffectedByStaminaPotionPlus() && + FileManager::GetInstance()->getStaminaPotionPlusTimer() < 600)) { + field_0x558 = 1; + } + if (dAcPy_c::GetLink()->isAffectedByStaminaPotionPlus()) { + drinkFrame = 2.0f; + } else if (dAcPy_c::GetLink()->isAffectedByStaminaPotion()) { + drinkFrame = 1.0f; + } + } + } + + mVec3_c diff = dAcPy_c::GetLink()->poscopy3 - dScGame_c::getCamera(0)->getPositionMaybe(); + f32 len = diff.mag(); + mVec3_c v; + d3d::fn_80016960(v, dAcPy_c::GetLink()->poscopy3); + if (!EventManager::isInEvent()) { + field_0x524 = v; + } + + s32 angle = 0; + mVec3_c v1(field_0x524); + mVec2_c v2(0.0f, 0.0f); + if (fn_80104710(true)) { + field_0x540 = 5; + } else if (field_0x540 > 0 && *mStateMgrMain.getStateID() == StateID_Wait) { + mStateMgrMain.changeState(StateID_CameraOut); + } + + f32 scale; + if (fn_80104710(false) || (isCrawling() && !fn_801047B0())) { + if (dAcPy_c::GetLink()->getRidingActorType() == 3) { + angle = 4; + v1.x = 232.0f; + v1.y = 145.0f; + scale = 1.12f; + } else if (displayAirInsteadOfStamina()) { + angle = 2; + scale = 1.45f; + v1.x = 232.0f; + v1.y = 145.0f; + } else { + angle = 2; + scale = 1.3f; + v1.x = 232.0f; + v1.y = 145.0f; + } + } else if (fn_801047B0()) { + v2.set(-32.0f, -40.0f); + scale = 0.8f; + } else if (field_0x55B) { + v2.x = -44.0f; + v2.y = -105.0f; + v2.y += 46.0f; + scale = 1.0f; + } else if (dAcPy_c::GetLink()->getRidingActorType() == 3) { + angle = 3; + v2.set(-95.0f, -50.0f); + scale = 0.9f; + } else if (field_0x559 && swimmingRelated()) { + angle = 1; + v2.set(-65.0f, 0.0f); + scale = 1.0f; + } else if (field_0x534 == 0) { + v2.set(-44.0f, -105.0f); + scale = 1.0f; + } else { + v1.x = 216.0f; + v1.y = -60.0f; + scale = 1.4f; + } + + v1.x = v1.x + v2.x; + v1.y = v1.y + v2.y; + v1.z = 0.0f; + mLyt.getLayout()->GetRootPane()->SetTranslate(v1); + mVec2_c scaleV(scale, scale); + mLyt.getLayout()->GetRootPane()->SetScale(scaleV); + + if (!field_0x534 && len <= dLytMeterConfiguration_c::GetInstance()->field_0x138 && !fn_80104710(false) && + !isCrawling()) { + field_0x530 = 1; + } else { + field_0x530 = 0; + } + + for (int i = 0; i < GANBARI_NUM_ANIMS; i++) { + if (i != GANBARI_ANIM_ANGLE && i != GANBARI_ANIM_UPDOWN_0 && i != GANBARI_ANIM_UPDOWN_1 && + i != GANBARI_ANIM_USE && i != GANBARI_ANIM_COLOR && i != GANBARI_ANIM_DRINK) { + if (mAnm[i].isEnabled()) { + mAnm[i].play(); + } + } + } + + mAnm[GANBARI_ANIM_UPDOWN_0].setFrame(field_0x518 * 100.0f); + mAnm[GANBARI_ANIM_ANGLE].setFrame(angle); + + mStateMgrWheel.executeState(); + + if (field_0x544 != 0) { + if (field_0x518 < field_0x550 && + field_0x518 < field_0x51C - dLytMeterConfiguration_c::GetInstance()->getField_0x1CC()) { + field_0x548 = dLytMeterConfiguration_c::GetInstance()->getField_0x1C8(); + field_0x54C = field_0x51C; + field_0x550 = field_0x518; + mAnm[GANBARI_ANIM_UPDOWN_1].setFrame(field_0x54C * 100.0f); + mAnm[GANBARI_ANIM_UPDOWN_1].setAnimEnable(true); + } else { + if (field_0x548 > 0) { + field_0x548--; + } + if (field_0x548 == 0) { + field_0x54C -= dLytMeterConfiguration_c::GetInstance()->getField_0x1D0(); + if (field_0x54C < field_0x518) { + field_0x544 = 0; + mAnm[GANBARI_ANIM_UPDOWN_1].setAnimEnable(true); + mAnm[GANBARI_ANIM_UPDOWN_1].setFrame(0.0f); + mLyt.calc(); + mAnm[GANBARI_ANIM_UPDOWN_1].setAnimEnable(false); + } else { + f32 frame = field_0x54C * 100.0f; + mAnm[GANBARI_ANIM_UPDOWN_1].setAnimEnable(true); + mAnm[GANBARI_ANIM_UPDOWN_1].setFrame(frame); + } + } + } + } else { + if (field_0x518 < field_0x51C - dLytMeterConfiguration_c::GetInstance()->getField_0x1C4()) { + field_0x544 = 1; + field_0x54C = field_0x51C; + field_0x550 = field_0x518; + field_0x548 = dLytMeterConfiguration_c::GetInstance()->getField_0x1C8(); + mAnm[GANBARI_ANIM_UPDOWN_1].setFrame(field_0x54C * 100.0f); + mAnm[GANBARI_ANIM_UPDOWN_1].setAnimEnable(true); + } else { + mAnm[GANBARI_ANIM_UPDOWN_1].setFrame(field_0x518 * 100.0f); + mAnm[GANBARI_ANIM_UPDOWN_1].setAnimEnable(true); + } + } + + if (b12) { + if (!mAnm[GANBARI_ANIM_M_LOOP].isEnabled()) { + mAnm[GANBARI_ANIM_M_LOOP].setFrame(0.0f); + mAnm[GANBARI_ANIM_M_LOOP].setAnimEnable(true); + } + } else if (mAnm[GANBARI_ANIM_M_LOOP].getFrame() < 1.0f) { + mAnm[GANBARI_ANIM_M_LOOP].setFrame(0.0f); + mAnm[GANBARI_ANIM_M_LOOP].setAnimEnable(false); + } + + if (b12 && field_0x558) { + if (!mAnm[GANBARI_ANIM_M_CAUTION].isEnabled()) { + mAnm[GANBARI_ANIM_M_CAUTION].setFrame(0.0f); + mAnm[GANBARI_ANIM_M_CAUTION].setAnimEnable(true); + } + } else if (mAnm[GANBARI_ANIM_M_CAUTION].getFrame() < 1.0f) { + mAnm[GANBARI_ANIM_M_CAUTION].setFrame(0.0f); + mAnm[GANBARI_ANIM_M_CAUTION].setAnimEnable(false); + } + + if (!b12 && field_0x518 < field_0x51C) { + if (!mAnm[GANBARI_ANIM_LOOP].isEnabled()) { + mAnm[GANBARI_ANIM_LOOP].setFrame(0.0f); + mAnm[GANBARI_ANIM_LOOP].setAnimEnable(true); + } + } else if (mAnm[GANBARI_ANIM_LOOP].getFrame() < 1.0f) { + mAnm[GANBARI_ANIM_LOOP].setFrame(0.0f); + mAnm[GANBARI_ANIM_LOOP].setAnimEnable(false); + } + + mAnm[GANBARI_ANIM_COLOR].setFrame(field_0x554); + mAnm[GANBARI_ANIM_COLOR].setAnimEnable(true); + + mAnm[GANBARI_ANIM_DRINK].setFrame(drinkFrame); + mAnm[GANBARI_ANIM_DRINK].setAnimEnable(true); + + if (!EventManager::isInEvent() && !dAcPy_c::GetLink()->hasvt_0x1C0() && + !dAcPy_c::GetLink()->checkActionFlagsCont(0x10) && + (d3d::fn_80016A90(dAcPy_c::GetLink()->poscopy3) || fn_80104710(false) || isCrawling()) && + *mStateMgrWheel.getStateID() != StateID_Full && *mStateMgrMain.getStateID() == StateID_InvisibleWait && + !field_0x530) { + mStateMgrMain.changeState(StateID_In); + } else if (!EventManager::isInEvent() && *mStateMgrWheel.getStateID() == StateID_Full && + *mStateMgrWheel.getOldStateID() != StateID_Full && *mStateMgrMain.getStateID() == StateID_Wait) { + mStateMgrMain.changeState(StateID_OutWait); + } else if ((EventManager::isInEvent() || dAcPy_c::GetLink()->hasvt_0x1C0() || + dAcPy_c::GetLink()->checkActionFlagsCont(0x10) || + (!d3d::fn_80016A90(dAcPy_c::GetLink()->poscopy3) && !fn_80104710(false) && !isCrawling())) && + *mStateMgrMain.getStateID() == StateID_Wait) { + mStateMgrMain.changeState(StateID_CameraOut); + } else if (field_0x530 && *mStateMgrMain.getStateID() == StateID_Wait) { + mStateMgrMain.changeState(StateID_CameraOut); + } + + if (field_0x540 > 0) { + field_0x540--; + } + + if (field_0x55A != swimmingRelated() && *mStateMgrMain.getStateID() == StateID_Wait) { + mStateMgrMain.changeState(StateID_Out); + field_0x55A = swimmingRelated(); + } + + mStateMgrMain.executeState(); + field_0x51C = field_0x518; return true; } +bool dLytMeterGanbariGauge_c::fn_80104710(bool arg) const { + if (dAcPy_c::GetLink() != nullptr && + dAcPy_c::GetLink()->checkActionFlagsCont(0x400 | 0x100 | 0x80 | 0x40 | 0x10 | 0x4 | 0x2 | 0x1) && + dAcPy_c::GetLink()->checkActionFlagsCont(0x40)) { + return true; + } + if (!arg && field_0x540 > 0) { + return true; + } + return false; +} + +bool dLytMeterGanbariGauge_c::fn_80104760() const { + const dAcPy_c *link = dAcPy_c::GetLink(); + if (link != nullptr && + (link->checkActionFlagsCont(0x2) || link->checkActionFlagsCont(0x80) || link->checkActionFlagsCont(0x4) || + link->checkActionFlagsCont(0x10) || link->checkActionFlagsCont(0x100))) { + return true; + } + return false; +} + +bool dLytMeterGanbariGauge_c::fn_801047B0() const { + if (fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") || + fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu2")) { + return true; + } + return false; +} + +bool dLytMeterGanbariGauge_c::isCrawling() const { + return dAcPy_c::GetLink()->checkActionFlags(dAcPy_c::FLG0_CRAWLING); +} + +bool dLytMeterGanbariGauge_c::swimmingRelated() { + if (!dAcPy_c::GetLink()->checkFlags0x340(0x100) || dAcPy_c::GetLink()->getCurrentAction() == 0x57 || + dAcPy_c::GetLink()->checkActionFlags(dAcPy_c::FLG0_IN_WATER)) { + return true; + } + return false; +} + +bool dLytMeterGanbariGauge_c::displayAirInsteadOfStamina() { + if (field_0x554 == 1.0f) { + return true; + } + if (field_0x554 == 2.0f && swimmingRelated()) { + return true; + } + return false; +} + void dLytMeterGanbariGauge_c::realizeAnimState() { mAnm[GANBARI_ANIM_TO_MIN].setToStart(); mAnm[GANBARI_ANIM_TO_MIN].setAnimEnable(true); diff --git a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp index ddcf7c04..72148cce 100644 --- a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp @@ -186,8 +186,7 @@ bool dLytMeterZBtn_c::execute() { return true; } field_0x1C4 = true; - dCamera_c *cam = dScGame_c::getCamera(0); - if ((!cam->isCurrentTrend("mogu") || AttentionManager::GetInstance()->checkLink2()) && + if ((!fn_80081FE0(dScGame_c::getCamera(0)->getField_0xD98(), "mogu") || AttentionManager::GetInstance()->checkLink2()) && LytDoButtonRelated::get(LytDoButtonRelated::DO_BUTTON_Z) == 0x67) { field_0x1C4 = false; LytDoButtonRelated::set(LytDoButtonRelated::DO_BUTTON_Z, LytDoButtonRelated::DO_NONE);