Decompile object37

This commit is contained in:
Tal Hayon
2022-03-13 05:37:52 +02:00
parent e11d36d9ac
commit 01fc98d161
7 changed files with 60 additions and 103 deletions
+2 -1
View File
@@ -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;
+51
View File
@@ -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();
}
}
+2 -1
View File
@@ -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;
+3 -2
View File
@@ -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;