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 | |
| parent | e11d36d9acb8934de44623f4f1d774c7004ffd63 (diff) | |
Decompile object37
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/bigIceBlock.c | 3 | ||||
| -rw-r--r-- | src/object/object37.c | 51 | ||||
| -rw-r--r-- | src/object/object68.c | 3 | ||||
| -rw-r--r-- | src/object/smallIceBlock.c | 5 |
4 files changed, 58 insertions, 4 deletions
diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index c7d7a2bd..09407bc4 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -10,6 +10,7 @@ #include "object.h" #include "functions.h" #include "hitbox.h" +#include "item.h" typedef struct { /*0x00*/ Entity base; @@ -91,7 +92,7 @@ void BigIceBlock_Action2(BigIceBlockEntity* this) { if (super->type != 2) { SetFlag(this->unk_86); } else { - CreateGroundItemWithFlags(super, 0x53, 0, this->unk_86); + CreateGroundItemWithFlags(super, ITEM_SMALL_KEY, 0, this->unk_86); } } super->action = 3; 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(); + } +} diff --git a/src/object/object68.c b/src/object/object68.c index e5265aa9..d26bb550 100644 --- a/src/object/object68.c +++ b/src/object/object68.c @@ -10,6 +10,7 @@ #include "global.h" #include "object.h" #include "functions.h" +#include "item.h" typedef struct { /*0x00*/ Entity base; @@ -66,7 +67,7 @@ void sub_08094774(Object68Entity* this) { } break; case 2: - child = CreateGroundItem(&gPlayerEntity, 0x60, 0); + child = CreateGroundItem(&gPlayerEntity, ITEM_FAIRY, 0); super->child = child; if (child != NULL) { child->actionDelay = 1; diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c index 9e2cf781..3ffedb89 100644 --- a/src/object/smallIceBlock.c +++ b/src/object/smallIceBlock.c @@ -10,6 +10,7 @@ #include "object.h" #include "functions.h" #include "hitbox.h" +#include "item.h" typedef struct { /*0x00*/ Entity base; @@ -138,10 +139,10 @@ void SmallIceBlock_Action3(SmallIceBlockEntity* this) { } sub_0805EC9C(super, 0x100, gUnk_08123748[super->actionDelay >> 5], 0); if (super->type == 1) { - CreateGroundItemWithFlags(super, 0x53, 0, this->unk_86); + CreateGroundItemWithFlags(super, ITEM_SMALL_KEY, 0, this->unk_86); SoundReq(SFX_SECRET); } else if (super->type == 2) { - CreateGroundItemWithFlags(super, 0x52, 0, this->unk_86); + CreateGroundItemWithFlags(super, ITEM_BIG_KEY, 0, this->unk_86); SoundReq(SFX_SECRET); } super->action = 4; |
