From d1acad0dd8c597b567376d253284a335a5554bee Mon Sep 17 00:00:00 2001 From: Aetias Date: Mon, 26 May 2025 23:30:28 +0200 Subject: Delink `ActorRefill` --- src/14_Land/Actor/Player/ActorRefill.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/14_Land/Actor/Player/ActorRefill.cpp (limited to 'src') diff --git a/src/14_Land/Actor/Player/ActorRefill.cpp b/src/14_Land/Actor/Player/ActorRefill.cpp new file mode 100644 index 00000000..841c4910 --- /dev/null +++ b/src/14_Land/Actor/Player/ActorRefill.cpp @@ -0,0 +1,31 @@ +#include "Actor/Player/ActorRefill.hpp" + +ActorRefillBombs *ActorRefillBombs::Create() {} +ActorRefillBombchus *ActorRefillBombchus::Create() {} +ActorRefillArrows *ActorRefillArrows::Create() {} +ActorRefillTime *ActorRefillTime::Create() {} +ActorLSTM *ActorLSTM::Create() {} +ActorRefill::ActorRefill() {} +ActorRefill::~ActorRefill() {} +bool ActorRefill::vfunc_08() {} +void ActorRefill::vfunc_14(u32 param1) {} +bool ActorRefill::func_ov014_02135364(unk32 param1) {} +void ActorRefill::vfunc_20(bool param1) {} +void ActorRefill::func_ov014_02135474() {} +ActorRefillBombs::ActorRefillBombs() {} +ActorRefillBombs::~ActorRefillBombs() {} +unk32 ActorRefillBombs::vfunc_b4() {} +ActorRefillBombchus::ActorRefillBombchus() {} +ActorRefillBombchus::~ActorRefillBombchus() {} +unk32 ActorRefillBombchus::vfunc_b4() {} +ActorRefillArrows::ActorRefillArrows() {} +ActorRefillArrows::~ActorRefillArrows() {} +unk32 ActorRefillArrows::vfunc_b4() {} +ActorRefillTime::ActorRefillTime() {} +ActorRefillTime::~ActorRefillTime() {} +bool ActorRefillTime::vfunc_08() {} +unk32 ActorRefillTime::vfunc_b4() {} +ActorLSTM::ActorLSTM() {} +ActorLSTM::~ActorLSTM() {} +bool ActorLSTM::vfunc_08() {} +unk32 ActorLSTM::vfunc_b4() {} -- cgit v1.2.3 From 9f8ead4aebb81502160cceeccdd2259a84c82896 Mon Sep 17 00:00:00 2001 From: Aetias Date: Tue, 27 May 2025 19:00:31 +0200 Subject: Add symbols for `ActorRefill` --- src/14_Land/Actor/Player/ActorRefill.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/14_Land/Actor/Player/ActorRefill.cpp b/src/14_Land/Actor/Player/ActorRefill.cpp index 841c4910..bd8981a4 100644 --- a/src/14_Land/Actor/Player/ActorRefill.cpp +++ b/src/14_Land/Actor/Player/ActorRefill.cpp @@ -1,5 +1,11 @@ #include "Actor/Player/ActorRefill.hpp" +ActorType ActorRefillBombs::gType; +ActorType ActorRefillBombchus::gType; +ActorType ActorRefillArrows::gType; +ActorType ActorRefillTime::gType; +ActorType ActorLSTM::gType; + ActorRefillBombs *ActorRefillBombs::Create() {} ActorRefillBombchus *ActorRefillBombchus::Create() {} ActorRefillArrows *ActorRefillArrows::Create() {} -- cgit v1.2.3 From 0b6e5d042b88229a88e48d954eb0084c6f039369 Mon Sep 17 00:00:00 2001 From: Aetias Date: Tue, 27 May 2025 22:00:27 +0200 Subject: Decomp `ActorRefill` 94% --- src/00_Core/Item/ItemManager.cpp | 2 +- src/14_Land/Actor/Player/ActorRefill.cpp | 387 ++++++++++++++++++++++++++++--- 2 files changed, 353 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/00_Core/Item/ItemManager.cpp b/src/00_Core/Item/ItemManager.cpp index d85fc6ab..4b2e7b44 100644 --- a/src/00_Core/Item/ItemManager.cpp +++ b/src/00_Core/Item/ItemManager.cpp @@ -231,7 +231,7 @@ ARM u16 ItemManager::GetAmmo(ItemFlag equipId) const { return (*mAmmo)[equipId]; } -ARM void ItemManager::GiveAmmo(ItemFlag equipId, u16 amount) { +ARM void ItemManager::GiveAmmo(ItemFlag equipId, u32 amount) { (*mAmmo)[equipId] += amount; if ((*mAmmo)[equipId] <= this->GetMaxAmmo(equipId)) return; (*mAmmo)[equipId] = this->GetMaxAmmo(equipId); diff --git a/src/14_Land/Actor/Player/ActorRefill.cpp b/src/14_Land/Actor/Player/ActorRefill.cpp index bd8981a4..83ef57fd 100644 --- a/src/14_Land/Actor/Player/ActorRefill.cpp +++ b/src/14_Land/Actor/Player/ActorRefill.cpp @@ -1,37 +1,354 @@ #include "Actor/Player/ActorRefill.hpp" +#include "DTCM/UnkStruct_027e0d38.hpp" +#include "DTCM/UnkStruct_027e103c.hpp" +#include "Item/ItemManager.hpp" +#include "System/Random.hpp" -ActorType ActorRefillBombs::gType; -ActorType ActorRefillBombchus::gType; -ActorType ActorRefillArrows::gType; -ActorType ActorRefillTime::gType; -ActorType ActorLSTM::gType; - -ActorRefillBombs *ActorRefillBombs::Create() {} -ActorRefillBombchus *ActorRefillBombchus::Create() {} -ActorRefillArrows *ActorRefillArrows::Create() {} -ActorRefillTime *ActorRefillTime::Create() {} -ActorLSTM *ActorLSTM::Create() {} -ActorRefill::ActorRefill() {} -ActorRefill::~ActorRefill() {} -bool ActorRefill::vfunc_08() {} -void ActorRefill::vfunc_14(u32 param1) {} -bool ActorRefill::func_ov014_02135364(unk32 param1) {} -void ActorRefill::vfunc_20(bool param1) {} -void ActorRefill::func_ov014_02135474() {} -ActorRefillBombs::ActorRefillBombs() {} -ActorRefillBombs::~ActorRefillBombs() {} -unk32 ActorRefillBombs::vfunc_b4() {} -ActorRefillBombchus::ActorRefillBombchus() {} -ActorRefillBombchus::~ActorRefillBombchus() {} -unk32 ActorRefillBombchus::vfunc_b4() {} -ActorRefillArrows::ActorRefillArrows() {} -ActorRefillArrows::~ActorRefillArrows() {} -unk32 ActorRefillArrows::vfunc_b4() {} -ActorRefillTime::ActorRefillTime() {} -ActorRefillTime::~ActorRefillTime() {} -bool ActorRefillTime::vfunc_08() {} -unk32 ActorRefillTime::vfunc_b4() {} -ActorLSTM::ActorLSTM() {} -ActorLSTM::~ActorLSTM() {} -bool ActorLSTM::vfunc_08() {} -unk32 ActorLSTM::vfunc_b4() {} +static char *sShipTypes[8] = {"anc", "bow", "hul", "can", "dco", "pdl", "fnl", "brg"}; + +extern u32 **data_027e0fe0[]; +ARM ActorRefillBombs *ActorRefillBombs::Create() { + return new(*data_027e0fe0[0], 4) ActorRefillBombs(); +} +ActorType ActorRefillBombs::gType = ActorType(ActorTypeId_RefillBombs, (ActorCreateFunc) ActorRefillBombs::Create, NULL); + +ARM ActorRefillBombchus *ActorRefillBombchus::Create() { + return new(*data_027e0fe0[0], 4) ActorRefillBombchus(); +} +ActorType ActorRefillBombchus::gType = + ActorType(ActorTypeId_RefillBombchus, (ActorCreateFunc) ActorRefillBombchus::Create, NULL); + +ARM ActorRefillArrows *ActorRefillArrows::Create() { + return new(*data_027e0fe0[0], 4) ActorRefillArrows(); +} +ActorType ActorRefillArrows::gType = ActorType(ActorTypeId_RefillArrows, (ActorCreateFunc) ActorRefillArrows::Create, NULL); + +ARM ActorRefillTime *ActorRefillTime::Create() { + return new(*data_027e0fe0[0], 4) ActorRefillTime(); +} +ActorType ActorRefillTime::gType = ActorType(ActorTypeId_RefillTime, (ActorCreateFunc) ActorRefillTime::Create, NULL); + +ARM ActorLSTM *ActorLSTM::Create() { + return new(*data_027e0fe0[0], 4) ActorLSTM(); +} +ActorType ActorLSTM::gType = ActorType(ActorTypeId_LSTM, (ActorCreateFunc) ActorLSTM::Create, NULL); + +ARM ActorRefill::ActorRefill(unk32 param1) : + mUnk_158(0), + mUnk_15c(0x56), + mUnk_160(param1), + mUnk_164(0x1f) {} + +ARM ActorRefill::~ActorRefill() {} + +ARM bool ActorRefill::vfunc_08() { + ItemManager *itemManager; + + if (this->vfunc_b4() == ItemFlag_None) { + if (data_027e0d38->func_ov000_02078b40() != 3) { + return false; + } + } else { + ItemManager *itemManager = gItemManager; + ItemFlag item = this->vfunc_b4(); + if (!itemManager->HasItem(item)) { + return false; + } + } + mHitbox.pos.x = 0; + mHitbox.pos.y = FLOAT_TO_Q20(0.3); + mHitbox.pos.z = 0; + mHitbox.size = FLOAT_TO_Q20(0.3); + mUnk_08c.pos.x = mHitbox.pos.x; + mUnk_08c.pos.y = mHitbox.pos.y; + mUnk_08c.pos.z = mHitbox.pos.z; + mUnk_08c.size = mHitbox.size; + mUnk_0a4.mUnk_04.x = 0; + mUnk_0a4.mUnk_04.y = FLOAT_TO_Q20(0.3); + mUnk_0a4.mUnk_04.z = 0; + mUnk_0a4.mUnk_10 = FLOAT_TO_Q20(1.3); + mUnk_09c.mUnk_0 &= ~0xa4; + mUnk_09c.mUnk_3 = 1; + mMaxFall = mUnk_08c.size + -1; + this->func_ov014_02135364(0); + return true; +} + +extern unk32 data_ov000_020eec9c; +extern "C" void func_ov000_020d7ad4(unk32 *param1, unk32 param2); +ARM void ActorRefill::vfunc_14(u32 param1) { + s32 temp_r0_4; + s32 temp_r6; + s8 var_r0; + u32 temp_r0; + u32 temp_r0_3; + u32 temp_r1; + Vec3p *temp_r0_2; + + if (this->func_ov00_020c313c(param1) != 0) { + this->IncreaseActiveFrames(); + temp_r0 = mUnk_130; + switch (temp_r0) { + case 0: + this->ApplyGravity(); + temp_r0_2 = &mPos; + Vec3p_Add(temp_r0_2, &mVel, temp_r0_2); + this->func_01fffd04(0); + if (mUnk_110 || mUnk_112 || mUnk_113) { + mVel.x = 0; + mVel.z = 0; + } + if (mUnk_111) { + this->func_ov014_02135364(1); + } else if (this->func_ov00_020c2c0c()) { + this->func_ov014_02135364(4); + } else if (this->func_ov00_020c2d54()) { + this->func_ov014_02135364(5); + } + break; + case 1: + case 2: + case 4: + case 5: + if (this->CollidesWithPlayer(PlayerCollide_PickupFlags) != 0) { + if (this->vfunc_b4() == -1) { + data_027e103c->func_ov000_020cfbf0(mUnk_158 * 60, 1, 0); + } else { + ItemManager *itemManager = gItemManager; + itemManager->GiveAmmo(this->vfunc_b4(), mUnk_158); + } + func_ov000_020d7ad4(&data_ov000_020eec9c, 0x100); + this->func_ov014_02135364(3); + } else { + temp_r0_3 = mUnk_130; + switch (temp_r0_3) { + case 0: + case 3: break; + case 1: + if (this->func_ov00_020c2c0c()) { + this->func_ov014_02135364(4); + } else if (this->func_ov00_020c2d54()) { + this->func_ov014_02135364(5); + } else if (mActiveFrames >= 180) { + this->func_ov014_02135364(2); + } + break; + case 2: +#define ROTATE_RIGHT(x, n) ((x >> n) | (x << (32 - n))) + temp_r0_4 = mActiveFrames; + temp_r1 = (u32) temp_r0_4 >> 31; + + if ((temp_r1 + ROTATE_RIGHT((temp_r0_4 << 29) - temp_r1, 29)) < 4) { + var_r0 = 0; + } else { + var_r0 = 31; + } + mUnk_164 = var_r0; + if (this->func_ov00_020c2c0c()) { + this->func_ov014_02135364(4); + } else if (this->func_ov00_020c2d54()) { + this->func_ov014_02135364(5); + } else if (mActiveFrames >= 60) { + this->func_ov014_02135364(3); + } + break; + case 4: + if (!this->func_ov00_020c2c70()) { + this->func_ov014_02135364(1); + } + break; + case 5: + if (!this->func_ov00_020c2de4()) { + this->func_ov014_02135364(1); + } + break; + } + } + break; + } + this->KillInBounds(); + } + mUnk_0a4.func_ov000_0207a1c8(param1, &mPos); +} + +ARM bool ActorRefill::func_ov014_02135364(unk32 param1) { + mUnk_130 = param1; + mUnk_164 = 31; + mActiveFrames = 0; + switch (mUnk_130) { + case 0: + case 2: break; + case 1: + mVel.x = 0; + mVel.y = 0; + mVel.z = 0; + break; + case 3: this->Kill(); break; + } + return true; +} + +extern "C" void func_0202bc38(bool param1, Vec3p *pos, unk32 param2, Actor_UnkStruct_012 *param3, unk32 param4); +extern u32 data_ov000_020e9370[]; +extern "C" void func_ov005_02102c2c(u32 *param_1, int param_2, Vec3p *param_3, int param_4, int param_5, u32 param_6, + int param_7, char param_8, char param_9, char param_10); +ARM void ActorRefill::vfunc_20(bool param1) { + bool var_r0; + + if (param1) { + var_r0 = mUnk_0a4.mUnk_01; + } else { + var_r0 = mUnk_0a4.mUnk_00; + } + if (var_r0 && mUnk_164 != 0) { + Actor_UnkStruct_012 sp18; + sp18.mUnk_04 = 5; + sp18.mUnk_08 = 2; + sp18.mUnk_0c = 2; + sp18.mUnk_14 = 0x800; + sp18.mUnk_18 = 0x1000; + sp18.mUnk_02 = mUnk_164; + func_0202bc38(param1, &mPos, mUnk_15c, &sp18, 0); + func_ov005_02102c2c(&data_ov000_020e9370[0], 0, &mPos, 0x400, 0, mUnk_164, 0, 0, 1, 0); + } +} + +extern unk32 data_027e0e58; +extern "C" void func_ov000_0207c1b0(unk32 *param1, unk32 param2, Vec3p *param3, unk32 param4, unk32 param5, unk32 param6); +ARM void ActorRefill::func_ov014_02135474() { + s32 iVar1 = mUnk_130; + if (iVar1 != 4 && iVar1 != 5) { + func_ov000_0207c1b0(&data_027e0e58, 0x241, &mPos, 2, 0, 0); + func_ov000_0207c1b0(&data_027e0e58, 0x242, &mPos, 2, 0, 0); + mAlive = false; + } +} + +ARM ActorRefillBombs::ActorRefillBombs() : + ActorRefill(0) { + mUnk_158 = 3; + mUnk_15c = 0x2e; +} + +ARM ActorRefillBombs::~ActorRefillBombs() {} + +ARM ItemFlag ActorRefillBombs::vfunc_b4() { + return ItemFlag_BombBag; +} + +ARM ActorRefillBombchus::ActorRefillBombchus() : + ActorRefill(1) { + mUnk_158 = 3; + mUnk_15c = 0x2f; +} + +ARM ActorRefillBombchus::~ActorRefillBombchus() {} + +ARM ItemFlag ActorRefillBombchus::vfunc_b4() { + return ItemFlag_BombchuBag; +} + +ARM ActorRefillArrows::ActorRefillArrows() : + ActorRefill(2) { + mUnk_158 = 5; + mUnk_15c = 0x2d; +} + +ARM ActorRefillArrows::~ActorRefillArrows() {} + +ARM ItemFlag ActorRefillArrows::vfunc_b4() { + return ItemFlag_Bow; +} + +ARM ActorRefillTime::ActorRefillTime() : + ActorRefill(3) { + mUnk_158 = 5; + mUnk_15c = 0x44; +} + +ARM ActorRefillTime::~ActorRefillTime() {} + +ARM bool ActorRefillTime::vfunc_08() { + + if (!ActorRefill::vfunc_08()) { + return false; + } + switch (mUnk_020.mUnk_00[0]) { + case 2: mUnk_158 = 5; break; + case 4: mUnk_158 = 15; break; + case 5: mUnk_158 = 30; break; + default: + case 0: + case 1: + case 3: + s32 temp_ip = gRandom->Next(10); + if (temp_ip >= 9) { + mUnk_158 = 30; + } else if (temp_ip >= 6) { + mUnk_158 = 15; + } else { + mUnk_158 = 5; + } + break; + } + if (mUnk_158 != -0x1E) { + if (mUnk_158 == -0xF) { + mUnk_15c = 0x48; + } else { + mUnk_15c = 0x47; + } + } else { + mUnk_15c = 0x49; + } + return true; +} + +ARM ItemFlag ActorRefillTime::vfunc_b4() { + return ItemFlag_None; +} + +ARM ActorLSTM::ActorLSTM() : + ActorRefill(3) { + mUnk_158 = -5; + mUnk_15c = 0x47; +} + +ARM ActorLSTM::~ActorLSTM() {} + +ARM bool ActorLSTM::vfunc_08() { + if (!ActorRefill::vfunc_08()) { + return false; + } + switch (mUnk_020.mUnk_00[0]) { + case 2: mUnk_158 = -5; break; + case 4: mUnk_158 = -15; break; + case 5: mUnk_158 = -30; break; + default: + case 0: + case 1: + case 3: + s32 temp_ip = gRandom->Next(10); + if (temp_ip >= 9) { + mUnk_158 = -30; + } else if (temp_ip >= 6) { + mUnk_158 = -15; + } else { + mUnk_158 = -5; + } + break; + } + if (mUnk_158 != -0x1E) { + if (mUnk_158 == -0xF) { + mUnk_15c = 0x48; + } else { + mUnk_15c = 0x47; + } + } else { + mUnk_15c = 0x49; + } + return true; +} + +ARM ItemFlag ActorLSTM::vfunc_b4() { + return ItemFlag_None; +} -- cgit v1.2.3 From 2c27f6cb3d98b3a8fe94d631c47767dea4daeda8 Mon Sep 17 00:00:00 2001 From: Aetias Date: Thu, 29 May 2025 08:51:28 +0200 Subject: `ActorRefill` OK --- src/14_Land/Actor/ActorRupee.cpp | 11 ++++---- src/14_Land/Actor/Player/ActorRefill.cpp | 48 +++++++++++--------------------- 2 files changed, 22 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/14_Land/Actor/ActorRupee.cpp b/src/14_Land/Actor/ActorRupee.cpp index 80857246..32a95333 100644 --- a/src/14_Land/Actor/ActorRupee.cpp +++ b/src/14_Land/Actor/ActorRupee.cpp @@ -5,7 +5,6 @@ #include "System/Random.hpp" extern "C" { -void func_ov000_0207a1c8(bool *param_1, unk32 param_2, Vec3p *param_3); void func_0202bc38(unk32 param_1, Vec3p *param_2, u32 param_3, Actor_UnkStruct_012 *param_4, bool); void func_ov005_02102c2c(u32 *param_1, int param_2, Vec3p *param_3, int param_4, int param_5, u32 param_6, int param_7, char param_8, char param_9, char param_10); @@ -71,9 +70,9 @@ bool ActorRupee::vfunc_08() { func_ov14_0213b204(0); break; case 1: - q20 x = gRandom->Next(FLOAT_TO_Q20(0.1335)); - q20 y = gRandom->Next(FLOAT_TO_Q20(0.2)); - q20 z = gRandom->Next(FLOAT_TO_Q20(0.1335)); + q20 x = gRandom.Next(FLOAT_TO_Q20(0.1335)); + q20 y = gRandom.Next(FLOAT_TO_Q20(0.2)); + q20 z = gRandom.Next(FLOAT_TO_Q20(0.1335)); mVel.x = x - FLOAT_TO_Q20(0.0666); mVel.y = y + FLOAT_TO_Q20(0.3333); @@ -263,14 +262,14 @@ void ActorRupee::vfunc_14(u32 param1) { if (func_ov00_020c313c(param1)) { Update(false); } - func_ov000_0207a1c8(&mUnk_0a4.mUnk_00, param1, &mPos); + mUnk_0a4.func_ov000_0207a1c8(param1, &mPos); } void ActorRupee::vfunc_18(u32 param1) { if (func_ov00_020c313c(param1)) { Update(true); } - func_ov000_0207a1c8(&mUnk_0a4.mUnk_00, param1, &mPos); + mUnk_0a4.func_ov000_0207a1c8(param1, &mPos); } #define VFUNC20_COND (param1 ? mUnk_0a4.mUnk_01 : mUnk_0a4.mUnk_00) diff --git a/src/14_Land/Actor/Player/ActorRefill.cpp b/src/14_Land/Actor/Player/ActorRefill.cpp index 83ef57fd..0e6a9edf 100644 --- a/src/14_Land/Actor/Player/ActorRefill.cpp +++ b/src/14_Land/Actor/Player/ActorRefill.cpp @@ -134,16 +134,11 @@ ARM void ActorRefill::vfunc_14(u32 param1) { } break; case 2: -#define ROTATE_RIGHT(x, n) ((x >> n) | (x << (32 - n))) - temp_r0_4 = mActiveFrames; - temp_r1 = (u32) temp_r0_4 >> 31; - - if ((temp_r1 + ROTATE_RIGHT((temp_r0_4 << 29) - temp_r1, 29)) < 4) { - var_r0 = 0; + if (mActiveFrames % 8 < 4) { + mUnk_164 = 0; } else { - var_r0 = 31; + mUnk_164 = 31; } - mUnk_164 = var_r0; if (this->func_ov00_020c2c0c()) { this->func_ov014_02135364(4); } else if (this->func_ov00_020c2d54()) { @@ -209,17 +204,17 @@ ARM void ActorRefill::vfunc_20(bool param1) { sp18.mUnk_18 = 0x1000; sp18.mUnk_02 = mUnk_164; func_0202bc38(param1, &mPos, mUnk_15c, &sp18, 0); - func_ov005_02102c2c(&data_ov000_020e9370[0], 0, &mPos, 0x400, 0, mUnk_164, 0, 0, 1, 0); + func_ov005_02102c2c(&data_ov000_020e9370[0], 0, &mPos, 0x400, 0x400, 0, mUnk_164, 0, 0, 1); } } -extern unk32 data_027e0e58; +extern unk32 *data_027e0e58; extern "C" void func_ov000_0207c1b0(unk32 *param1, unk32 param2, Vec3p *param3, unk32 param4, unk32 param5, unk32 param6); ARM void ActorRefill::func_ov014_02135474() { s32 iVar1 = mUnk_130; if (iVar1 != 4 && iVar1 != 5) { - func_ov000_0207c1b0(&data_027e0e58, 0x241, &mPos, 2, 0, 0); - func_ov000_0207c1b0(&data_027e0e58, 0x242, &mPos, 2, 0, 0); + func_ov000_0207c1b0(data_027e0e58, 0x241, &mPos, 2, 0, 0); + func_ov000_0207c1b0(data_027e0e58, 0x242, &mPos, 2, 0, 0); mAlive = false; } } @@ -269,7 +264,6 @@ ARM ActorRefillTime::ActorRefillTime() : ARM ActorRefillTime::~ActorRefillTime() {} ARM bool ActorRefillTime::vfunc_08() { - if (!ActorRefill::vfunc_08()) { return false; } @@ -281,7 +275,7 @@ ARM bool ActorRefillTime::vfunc_08() { case 0: case 1: case 3: - s32 temp_ip = gRandom->Next(10); + s32 temp_ip = gRandom.Next(10); if (temp_ip >= 9) { mUnk_158 = 30; } else if (temp_ip >= 6) { @@ -291,14 +285,10 @@ ARM bool ActorRefillTime::vfunc_08() { } break; } - if (mUnk_158 != -0x1E) { - if (mUnk_158 == -0xF) { - mUnk_15c = 0x48; - } else { - mUnk_15c = 0x47; - } - } else { - mUnk_15c = 0x49; + switch (mUnk_158) { + case 15: mUnk_15c = 0x45; break; + case 30: mUnk_15c = 0x46; break; + default: mUnk_15c = 0x44; break; } return true; } @@ -327,7 +317,7 @@ ARM bool ActorLSTM::vfunc_08() { case 0: case 1: case 3: - s32 temp_ip = gRandom->Next(10); + s32 temp_ip = gRandom.Next(10); if (temp_ip >= 9) { mUnk_158 = -30; } else if (temp_ip >= 6) { @@ -337,14 +327,10 @@ ARM bool ActorLSTM::vfunc_08() { } break; } - if (mUnk_158 != -0x1E) { - if (mUnk_158 == -0xF) { - mUnk_15c = 0x48; - } else { - mUnk_15c = 0x47; - } - } else { - mUnk_15c = 0x49; + switch (mUnk_158) { + case -15: mUnk_15c = 0x48; break; + case -30: mUnk_15c = 0x49; break; + default: mUnk_15c = 0x47; break; } return true; } -- cgit v1.2.3