diff options
| author | Aetias <144526980+AetiasHax@users.noreply.github.com> | 2026-05-12 20:50:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-12 20:50:44 +0200 |
| commit | 0bb7400136dd84c00abdaf96c5dbdb63c02f836f (patch) | |
| tree | 17421cfcfc42800ba7668e966234e2448ff226ed /src/31_Shop/Actor/ActorItemSeller.cpp | |
| parent | 1570b7d2d63aed0a77fc2077618b766eebaba56e (diff) | |
ActorItemSeller OK (#164)
Diffstat (limited to 'src/31_Shop/Actor/ActorItemSeller.cpp')
| -rw-r--r-- | src/31_Shop/Actor/ActorItemSeller.cpp | 155 |
1 files changed, 136 insertions, 19 deletions
diff --git a/src/31_Shop/Actor/ActorItemSeller.cpp b/src/31_Shop/Actor/ActorItemSeller.cpp index fd1f9a4d..16fc017c 100644 --- a/src/31_Shop/Actor/ActorItemSeller.cpp +++ b/src/31_Shop/Actor/ActorItemSeller.cpp @@ -1,21 +1,138 @@ #include "Actor/Character/ActorItemSeller.hpp" +#include "Actor/ActorType.hpp" +#include "Actor/ActorTypeId.hpp" +#include "Item/ItemManager.hpp" +#include "Message/BMG.hpp" +#include "Message/MsgProc.hpp" +#include "Save/AdventureFlags.hpp" +#include "Unknown/UnkStruct_ov000_020e8b08.hpp" -ActorItemSeller *ActorItemSeller1::Create() {} -ActorItemSeller *ActorItemSeller2::Create() {} -ActorItemSeller *ActorItemSeller3::Create() {} - -bool ActorItemSeller::Init() {} -unk32 ActorItemSeller::vfunc_114(unk32 param1) {} -void ActorItemSeller::vfunc_f4() {} -void ActorItemSeller::vfunc_f8() {} -void ActorItemSeller::vfunc_fc() {} -void ActorItemSeller::vfunc_100() {} -void ActorItemSeller::vfunc_104() {} -void ActorItemSeller::vfunc_118() {} - -unk32 ActorItemSeller::vfunc_d4() {} - -void ActorItemSeller::vfunc_108() {} -void ActorItemSeller::vfunc_10c() {} -void ActorItemSeller::vfunc_110() {} -ActorItemSeller::~ActorItemSeller() {} +extern u32 **data_027e0fe0[]; +ARM ActorItemSeller *ActorItemSeller1::Create() { + return new(*data_027e0fe0[0], 4) ActorItemSeller(); +} + +ARM ActorItemSeller *ActorItemSeller2::Create() { + return new(*data_027e0fe0[0], 4) ActorItemSeller(); +} + +ARM ActorItemSeller *ActorItemSeller3::Create() { + return new(*data_027e0fe0[0], 4) ActorItemSeller(); +} + +static const char *sShipTypes[8] = { + [7] = "brg", [6] = "fnl", [5] = "pdl", [4] = "dco", [3] = "can", [2] = "hul", [1] = "bow", [0] = "anc"}; + +ActorType ActorItemSeller1::gType = ActorType(ActorTypeId_ItemSeller1, (ActorCreateFunc) ActorItemSeller1::Create, NULL); +ActorType ActorItemSeller2::gType = ActorType(ActorTypeId_ItemSeller2, (ActorCreateFunc) ActorItemSeller2::Create, NULL); +ActorType ActorItemSeller3::gType = ActorType(ActorTypeId_ItemSeller3, (ActorCreateFunc) ActorItemSeller3::Create, NULL); + +ARM bool ActorItemSeller::Init() { + unk32 unk; + switch (mType) { + case ActorTypeId_ItemSeller2: + unk = 0x3d; + break; + case ActorTypeId_ItemSeller3: + unk = 0x3e; + break; + case ActorTypeId_ItemSeller1: + default: + unk = 0x3c; + break; + } + mUnk_1d8.func_ov014_02145a74(unk, 0x3f); + static const unk32 sUnk1[] = {0x800, 0x4cd, 0x14cd}; + static const ActorCharacter_1d8_230 sUnk2[] = {{"choice", 0}, {"bow", 1}}; + mUnk_1d8.mUnk_230 = sUnk2; + this->func_ov014_021451f0(sUnk1); + mUnk_470 = 2; + return ActorItemSellerBase::Init(); +} + +ARM unk32 ActorItemSeller::vfunc_114(unk32 param1) { + u16 uVar1; + int iVar2; + unk32 uVar3; + + uVar1 = mUnk_020.mUnk_00[0]; + switch (param1) { + case 0: + return uVar1 == 2 ? 0x4 : 0x2; + case 1: + return uVar1 == 0 ? 0xa : 0x3; + case 2: + return uVar1 == 2 ? 0x11 : 0xf; + case 3: + if (!gAdventureFlags->Get(AdventureFlag_Unk_105)) { + return 0xc; + } + if (!gAdventureFlags->Get(AdventureFlag_Unk_107)) { + return 0x7; + } + if (!gAdventureFlags->Get(AdventureFlag_Unk_108)) { + return 0x8; + } + if (!gAdventureFlags->Get(AdventureFlag_Unk_103)) { + return 0x5; + } + return uVar1 == 2 ? 0xa : 0x1; + case 4: + if (gItemManager->HasItem(ItemFlag_WoodenShield)) { + return 0x10; + } + return 0xe; + default: + return 0x1; + } +} + +ARM unk32 ActorItemSeller::GetPromptMessage() { + return BMG_ID(BMG_FILE_INDEX_FIELD, 0x41); +} + +ARM unk32 ActorItemSeller::GetPurchaseMessage() { + return BMG_ID(BMG_FILE_INDEX_FIELD, 0x50); +} + +ARM unk32 ActorItemSeller::GetNotEnoughMoneyMessage() { + return BMG_ID(BMG_FILE_INDEX_FIELD, 0x52); +} + +ARM unk32 ActorItemSeller::GetGoodbyeMessage() { + return BMG_ID(BMG_FILE_INDEX_FIELD, 0x51); +} + +ARM unk32 ActorItemSeller::GetInventoryFullMessage() { + return BMG_ID(BMG_FILE_INDEX_FIELD, 0x56); +} + +ARM bool ActorItemSeller::vfunc_118() { + return data_027e0e28.func_ov018_02160a54(2); +} + +ARM unk32 ActorItemSeller::vfunc_d4() { + return ActorItemSellerBase::vfunc_d4(); +} + +ARM void ActorItemSeller::vfunc_108() { + this->vfunc_ec(3); +} + +ARM void ActorItemSeller::vfunc_10c(bool param1) { + if (param1) { + mUnk_1d8.func_ov014_02145f0c(4); + return; + } + this->vfunc_ec(4); +} + +ARM void ActorItemSeller::vfunc_110() { + bool unk; + if (data_ov000_020e8b08 != NULL) { + unk = mRef.id == data_ov000_020e8b08->mUnk_20[data_ov000_020e8b08->mUnk_55].id; + } else { + unk = true; + } + this->vfunc_f0(unk, 0); +} |
