diff options
| author | Tal Hayon <talhayon1@gmail.com> | 2022-03-13 05:37:52 +0200 |
|---|---|---|
| committer | Tal Hayon <talhayon1@gmail.com> | 2022-03-13 05:37:52 +0200 |
| commit | 01fc98d161c47163817151fc27d85d18fb63dc59 (patch) | |
| tree | b3173e6d319938042e8e6d17194da8ccf591d69e /src/object/object37.c | |
| parent | e11d36d9acb8934de44623f4f1d774c7004ffd63 (diff) | |
Decompile object37
Diffstat (limited to 'src/object/object37.c')
| -rw-r--r-- | src/object/object37.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/object/object37.c b/src/object/object37.c new file mode 100644 index 00000000..99eca229 --- /dev/null +++ b/src/object/object37.c @@ -0,0 +1,51 @@ +#define NENT_DEPRECATED +#include "entity.h" +#include "functions.h" +#include "save.h" +#include "item.h" + +typedef struct { + Entity base; + u8 filler[0x8]; + u16 unk70; + u8 filler2[0x6]; + u16* unk78; +} Object37Entity; + +extern u32 sub_0806F798(Entity*); + +void Object37_Init(Object37Entity*); +void Object37_Action1(Object37Entity*); + +void Object37(Entity* this) { + static void (*const actionFuncs[])(Object37Entity*) = { + Object37_Init, + Object37_Action1, + }; + + actionFuncs[this->action]((Object37Entity*)this); +} + +void Object37_Init(Object37Entity* this) { + u16* puVar1; + + puVar1 = GetLayerByIndex(super->collisionLayer)->mapData + sub_0806F798(super); + this->unk78 = puVar1; + this->unk70 = *puVar1; + super->action = 1; +} + +void Object37_Action1(Object37Entity* this) { + Entity* item; + + if ((gSave.unk24E[0] != 0) && (this->unk70 != *this->unk78)) { + item = CreateGroundItem(super, ITEM_RUPEE100, 0); + if (item != 0) { + item->direction = gPlayerEntity.animationState << 2; + item->speed = 0x80; + item->zVelocity = 0x20000; + } + gSave.unk24E[0] = 1; + DeleteThisEntity(); + } +} |
