Merge branch 'master' into tilemap-docs

This commit is contained in:
octorock
2023-12-28 14:59:23 +01:00
495 changed files with 14619 additions and 16191 deletions
+20 -25
View File
@@ -4,6 +4,7 @@
*
* @brief Ambient Clouds object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
@@ -27,8 +28,6 @@ void AmbientClouds(Entity* this) {
}
void AmbientClouds_Init(Entity* this) {
Entity* pEVar2;
#ifndef EU
if ((this->flags & ENT_DID_INIT) != 0) {
#endif
@@ -44,10 +43,10 @@ void AmbientClouds_Init(Entity* this) {
this->parent = NULL;
CreateObjectWithParent(this, AMBIENT_CLOUDS, 0, 0xff);
for (; this->type != 0; --this->type) {
pEVar2 = CreateObjectWithParent(this, AMBIENT_CLOUDS, 0, this->type);
this->child = pEVar2;
if (pEVar2 != NULL) {
pEVar2->parent = this->parent;
Entity* entity = CreateObjectWithParent(this, AMBIENT_CLOUDS, 0, this->type);
this->child = entity;
if (entity != NULL) {
entity->parent = this->parent;
if (this->parent != NULL) {
this->parent->child = this->child;
}
@@ -77,9 +76,6 @@ void AmbientClouds_Init(Entity* this) {
}
void AmbientClouds_Action1(Entity* this) {
int iVar1;
Entity* pEVar2;
if (this->type2 == 0xff) {
this->spritePriority.b0 = 7;
this->spriteRendering.b3 = 3;
@@ -92,8 +88,7 @@ void AmbientClouds_Action1(Entity* this) {
else
this->timer = 0;
this->y.HALF.HI += (this->type2 - 1) * -0x24;
iVar1 = EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf);
if ((iVar1 != 0) && (this->timer != 0)) {
if (EntityInRectRadius(this, &gPlayerEntity, 15, 15) && (this->timer != 0)) {
this->action = 2;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 3;
@@ -105,21 +100,21 @@ void AmbientClouds_Action1(Entity* this) {
gPlayerEntity.z.HALF.HI += 0x24;
sub_0807AA80(&gPlayerEntity);
if (this->subtimer == 0) {
pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (pEVar2 != NULL) {
pEVar2->x.HALF.HI += 8;
Entity* fx = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 8;
}
pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (pEVar2 != NULL) {
pEVar2->x.HALF.HI -= 8;
fx = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 8;
}
pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (pEVar2 != NULL) {
pEVar2->y.HALF.HI += 8;
fx = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (fx != NULL) {
fx->y.HALF.HI += 8;
}
pEVar2 = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (pEVar2 != NULL) {
pEVar2->y.HALF.HI -= 8;
fx = CreateFx(&gPlayerEntity, FX_DEATH, 0);
if (fx != NULL) {
fx->y.HALF.HI -= 8;
}
}
}
@@ -131,7 +126,7 @@ void AmbientClouds_Action1(Entity* this) {
void AmbientClouds_Action2(Entity* this) {
this->y.HALF.HI += this->type2 * -0x24;
if (EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf)) {
if (EntityInRectRadius(this, &gPlayerEntity, 15, 15)) {
gPlayerState.field_0x14 = 1;
gPlayerState.flags |= PL_FLAGS2;
} else {
@@ -144,7 +139,7 @@ void AmbientClouds_Action2(Entity* this) {
}
void AmbientClouds_Action3(Entity* this) {
if (EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf)) {
if (EntityInRectRadius(this, &gPlayerEntity, 15, 15)) {
gPlayerState.field_0x14 = 1;
}
}
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Angry Statue object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "hitbox.h"
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Archway object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "game.h"
+46 -38
View File
@@ -4,66 +4,74 @@
*
* @brief BackgroundCloud object
*/
#define NENT_DEPRECATED
#include "object.h"
void BackgroundCloud_Init(Entity*);
void BackgroundCloud_Action1(Entity*);
void BackgroundCloud_Action2(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[16];
/*0x78*/ s16 unk_78;
/*0x7a*/ s16 unk_7a;
} BackgroundCloudEntity;
void BackgroundCloud(Entity* this) {
static void (*const BackgroundCloud_Actions[])(Entity*) = {
void BackgroundCloud_Init(BackgroundCloudEntity* this);
void BackgroundCloud_Action1(BackgroundCloudEntity* this);
void BackgroundCloud_Action2(BackgroundCloudEntity* this);
void BackgroundCloud(BackgroundCloudEntity* this) {
static void (*const BackgroundCloud_Actions[])(BackgroundCloudEntity*) = {
BackgroundCloud_Init,
BackgroundCloud_Action1,
BackgroundCloud_Action2,
};
BackgroundCloud_Actions[this->action](this);
BackgroundCloud_Actions[super->action](this);
}
void BackgroundCloud_Init(Entity* this) {
void BackgroundCloud_Init(BackgroundCloudEntity* this) {
static const u8 gUnk_08121EB0[] = { 0x30, 0x28, 0x20 };
this->action = 1;
this->spriteSettings.draw = 1;
this->spriteOrientation.flipY = 3;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = this->type;
this->frameIndex = this->type;
this->direction = 8;
this->speed = gUnk_08121EB0[this->type];
this->field_0x78.HWORD = gRoomControls.origin_x - 0x60;
this->field_0x7a.HWORD = gRoomControls.origin_x + gRoomControls.width + 0x60;
this->animationState = 0;
this->x.HALF.HI += (Random() & 0xf) << 4;
this->timer = 0;
this->subAction = 0;
super->action = 1;
super->spriteSettings.draw = 1;
super->spriteOrientation.flipY = 3;
super->spriteRendering.b3 = 3;
super->spritePriority.b0 = super->type;
super->frameIndex = super->type;
super->direction = 8;
super->speed = gUnk_08121EB0[super->type];
this->unk_78 = gRoomControls.origin_x - 0x60;
this->unk_7a = gRoomControls.origin_x + gRoomControls.width + 0x60;
super->animationState = 0;
super->x.HALF.HI += (Random() & 0xf) << 4;
super->timer = 0;
super->subAction = 0;
}
void BackgroundCloud_Action1(Entity* this) {
LinearMoveUpdate(this);
void BackgroundCloud_Action1(BackgroundCloudEntity* this) {
LinearMoveUpdate(super);
if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD || (s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD)
this->action = 2;
if (super->x.HALF.HI < this->unk_78 || super->x.HALF.HI > this->unk_7a)
super->action = 2;
}
void BackgroundCloud_Action2(Entity* this) {
void BackgroundCloud_Action2(BackgroundCloudEntity* this) {
static const u8 gUnk_08121EB3[] = { 0x8, 0x28, 0x48, 0x98, 0 };
if (this->subAction == 0) {
this->subAction = 1;
this->timer = ((Random() & 7) << 3) + 31;
if (super->subAction == 0) {
super->subAction = 1;
super->timer = ((Random() & 7) << 3) + 31;
if ((this->direction & 0x10)) {
this->x.HALF.HI = this->field_0x7a.HWORD;
if ((super->direction & 0x10)) {
super->x.HALF.HI = this->unk_7a;
} else {
this->x.HALF.HI = this->field_0x78.HWORD;
super->x.HALF.HI = this->unk_78;
}
if (this->type == 2)
this->y.HALF.HI = gUnk_08121EB3[this->type2 * 2 + (Random() & 1)];
if (super->type == 2)
super->y.HALF.HI = gUnk_08121EB3[super->type2 * 2 + (Random() & 1)];
}
if (this->subAction == 1) {
if (--this->timer == 0) {
this->action = 1;
this->subAction = 0;
if (super->subAction == 1) {
if (--super->timer == 0) {
super->action = 1;
super->subAction = 0;
}
}
}
+65 -58
View File
@@ -4,75 +4,82 @@
*
* @brief Baker Oven object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
#include "tiles.h"
extern void SoundReqClipped(Entity*, u32);
void sub_0809CDF0(Entity*);
void BakerOven_Init(Entity*);
void BakerOven_Action1(Entity*);
void BakerOven_Action2(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[24];
/*0x80*/ u16 unk_80;
} BakerOvenEntity;
void BakerOven(Entity* this) {
static void (*const BakerOven_Actions[])(Entity*) = {
extern void SoundReqClipped(Entity*, u32);
void sub_0809CDF0(BakerOvenEntity* this);
void BakerOven_Init(BakerOvenEntity* this);
void BakerOven_Action1(BakerOvenEntity* this);
void BakerOven_Action2(BakerOvenEntity* this);
void BakerOven(BakerOvenEntity* this) {
static void (*const BakerOven_Actions[])(BakerOvenEntity*) = {
BakerOven_Init,
BakerOven_Action1,
BakerOven_Action2,
};
BakerOven_Actions[this->action](this);
BakerOven_Actions[super->action](this);
}
void BakerOven_Init(Entity* this) {
void BakerOven_Init(BakerOvenEntity* this) {
u32 i;
Entity* ent;
Entity* entity;
this->action = 1;
UpdateSpriteForCollisionLayer(this);
super->action = 1;
UpdateSpriteForCollisionLayer(super);
if (this->type == 0) {
this->spritePriority.b0 = 5;
if (super->type == 0) {
super->spritePriority.b0 = 5;
/* Create steam clouds */
for (i = 0; i < 3; i++) {
ent = CreateObject(BAKER_OVEN, 1, i);
if (ent != NULL) {
ent->parent = this;
PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0));
entity = CreateObject(BAKER_OVEN, 1, i);
if (entity != NULL) {
entity->parent = super;
PositionRelative(super, entity, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0));
}
}
sub_0809CDF0(this);
} else {
if (this->type2 & 1) {
this->spriteSettings.draw = 1;
this->timer = 20;
if (super->type2 & 1) {
super->spriteSettings.draw = 1;
super->timer = 20;
} else {
this->action = 2;
this->timer = (this->type2 & 2) ? 20 : 18;
super->action = 2;
super->timer = (super->type2 & 2) ? 20 : 18;
}
InitializeAnimation(this, 0);
InitializeAnimation(super, 0);
}
}
void BakerOven_Action1(Entity* this) {
u8* frames;
void BakerOven_Action1(BakerOvenEntity* this) {
u8* frame;
if (this->type) {
GetNextFrame(this);
frames = &this->frame;
if (this->frame & 1) {
this->frame &= ~1;
this->y.HALF.HI++;
if (super->type) {
GetNextFrame(super);
frame = &super->frame;
if (super->frame & 1) {
super->frame &= ~1;
super->y.HALF.HI++;
}
if ((*frames & ANIM_DONE) && this->frameDuration == 1) {
this->action = 2;
this->spriteSettings.draw = 0;
if ((*frame & ANIM_DONE) && super->frameDuration == 1) {
super->action = 2;
super->spriteSettings.draw = 0;
}
/* Damage minish link if he touches a steam cloud */
if (this->subtimer == 0 && gPlayerEntity.iframes == 0 && this->frameIndex &&
sub_0806FC80(this, &gPlayerEntity, 4)) {
this->subtimer++;
if (super->subtimer == 0 && gPlayerEntity.iframes == 0 && super->frameIndex &&
sub_0806FC80(super, &gPlayerEntity, 4)) {
super->subtimer++;
ModHealth(-2);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
gPlayerEntity.iframes = 16;
@@ -83,31 +90,31 @@ void BakerOven_Action1(Entity* this) {
}
}
void BakerOven_Action2(Entity* this) {
void BakerOven_Action2(BakerOvenEntity* this) {
/* Reset cloud position and start animation. */
if (--this->timer == 0) {
this->action = 1;
this->timer = 30;
this->subtimer = 0;
this->spriteSettings.draw = 1;
this->y.HALF.HI = this->parent->y.HALF.HI - 0xe;
InitializeAnimation(this, 0);
if (--super->timer == 0) {
super->action = 1;
super->timer = 30;
super->subtimer = 0;
super->spriteSettings.draw = 1;
super->y.HALF.HI = super->parent->y.HALF.HI - 0xe;
InitializeAnimation(super, 0);
}
}
void sub_0809CDF0(Entity* this) {
void sub_0809CDF0(BakerOvenEntity* this) {
u32 metaTilePos;
this->field_0x80.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) |
(((this->y.HALF.HI - gRoomControls.origin_y) >> 4 & 0x3f) << 6);
this->unk_80 = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) |
(((super->y.HALF.HI - gRoomControls.origin_y) >> 4 & 0x3f) << 6);
metaTilePos = this->field_0x80.HWORD;
SetMetaTile(SPECIAL_META_TILE_46, metaTilePos + TILE_POS(-1, 0), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(0, 0), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(1, 0), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -1), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -1), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_36, metaTilePos + TILE_POS(1, -1), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -2), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -2), this->collisionLayer);
metaTilePos = this->unk_80;
SetMetaTile(SPECIAL_META_TILE_46, metaTilePos + TILE_POS(-1, 0), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(0, 0), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, metaTilePos + TILE_POS(1, 0), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -1), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -1), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_36, metaTilePos + TILE_POS(1, -1), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(-1, -2), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_38, metaTilePos + TILE_POS(0, -2), super->collisionLayer);
}
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Barrel Inside object
*/
#define NENT_DEPRECATED
#include "entity.h"
typedef struct {
+67 -73
View File
@@ -4,149 +4,143 @@
*
* @brief Barrel Spiderweb object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
} BarrelSpiderwebEntity;
void BarrelSpiderweb_Init(Entity*);
void BarrelSpiderweb_Action1(Entity*);
void BarrelSpiderweb_Action2(Entity*);
void sub_0808BDB0(Entity*);
void sub_0808BBE0(Entity*);
void sub_0808BD00(Entity*);
void BarrelSpiderweb_Init(BarrelSpiderwebEntity*);
void BarrelSpiderweb_Action1(BarrelSpiderwebEntity*);
void BarrelSpiderweb_Action2(BarrelSpiderwebEntity*);
void sub_0808BDB0(BarrelSpiderwebEntity*);
void sub_0808BBE0(BarrelSpiderwebEntity*);
void sub_0808BD00(BarrelSpiderwebEntity*);
void BarrelSpiderweb(BarrelSpiderwebEntity* this) {
static void (*const BarrelSpiderweb_Actions[])(BarrelSpiderwebEntity*) = {
void BarrelSpiderweb(Entity* this) {
static void (*const BarrelSpiderweb_Actions[])(Entity*) = {
BarrelSpiderweb_Init,
BarrelSpiderweb_Action1,
BarrelSpiderweb_Action2,
};
BarrelSpiderweb_Actions[super->action](this);
BarrelSpiderweb_Actions[this->action](this);
}
void BarrelSpiderweb_Init(BarrelSpiderwebEntity* this) {
void BarrelSpiderweb_Init(Entity* this) {
if (CheckGlobalFlag(LV1TARU_OPEN)) {
LoadGfxGroup(0x4a);
DeleteThisEntity();
} else {
super->action = 1;
super->flags |= ENT_COLLIDE;
super->timer = 120;
super->subtimer = 0;
super->spriteRendering.b3 = 3;
super->spritePriority.b0 = 4;
super->spriteOrientation.flipY = 2;
super->speed = 0x300;
super->hitType = 1;
super->collisionFlags = 7;
super->hurtType = 0x48;
super->flags2 = 4;
super->hitbox = (Hitbox*)&gHitbox_0;
super->frameIndex = 2;
super->collisionLayer = gPlayerEntity.collisionLayer;
this->action = 1;
this->flags |= ENT_COLLIDE;
this->timer = 120;
this->subtimer = 0;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 4;
this->spriteOrientation.flipY = 2;
this->speed = 0x300;
this->hitType = 1;
this->collisionFlags = 7;
this->hurtType = 0x48;
this->flags2 = 4;
this->hitbox = (Hitbox*)&gHitbox_0;
this->frameIndex = 2;
this->collisionLayer = gPlayerEntity.collisionLayer;
sub_0808BDB0(this);
super->y.HALF.HI = 0x170 - (super->parent)->zVelocity;
this->y.HALF.HI = 0x170 - (this->parent)->zVelocity;
sub_0808BBE0(this);
}
}
void sub_0808BBE0(BarrelSpiderwebEntity* this) {
void sub_0808BBE0(Entity* this) {
static const u16 gUnk_0812144C[] = { 192, 256, 208, 240, 224, 224, 240, 208, 256, 192,
256, 192, 240, 208, 224, 224, 208, 240, 192, 256 };
static const u8 gUnk_08121474[] = {
248, 250, 252, 254, 0, 0, 2, 4, 6, 8, 0, 0,
};
const u16* ptr;
s32 diff = super->y.HALF.HI - gRoomControls.scroll_y;
s32 diff = this->y.HALF.HI - gRoomControls.scroll_y;
if ((u32)diff < 0xa0) {
diff /= 0x10;
super->spriteOffsetY = gUnk_08121474[diff];
this->spriteOffsetY = gUnk_08121474[diff];
ptr = &gUnk_0812144C[diff * 2];
SetAffineInfo(super, ptr[0], ptr[1], 0);
SetAffineInfo(this, ptr[0], ptr[1], 0);
} else {
super->contactFlags &= ~0x80;
this->contactFlags &= ~0x80;
}
}
void BarrelSpiderweb_Action1(BarrelSpiderwebEntity* this) {
void BarrelSpiderweb_Action1(Entity* this) {
s32 tmp;
super->x.HALF.HI = gRoomControls.origin_x + 0x78;
this->x.HALF.HI = gRoomControls.origin_x + 0x78;
tmp = -0x170;
super->y.HALF.HI = gRoomControls.origin_y - ((super->parent)->zVelocity + tmp);
this->y.HALF.HI = gRoomControls.origin_y - ((this->parent)->zVelocity + tmp);
sub_0808BBE0(this);
if (super->contactFlags == 0x93) {
super->timer--;
super->spriteSettings.draw = 1;
if (super->timer == 0) {
if (this->contactFlags == 0x93) {
this->timer--;
this->spriteSettings.draw = 1;
if (this->timer == 0) {
SetGlobalFlag(LV1TARU_OPEN);
super->action = 2;
super->subtimer = 128;
super->spriteOffsetY = 0;
this->action = 2;
this->subtimer = 128;
this->spriteOffsetY = 0;
} else {
if ((super->timer & 1) != 0) {
super->x.HALF.HI += ((Random() & 3) - 2);
super->y.HALF.HI += ((Random() & 3) - 1);
if ((this->timer & 1) != 0) {
this->x.HALF.HI += ((Random() & 3) - 2);
this->y.HALF.HI += ((Random() & 3) - 1);
}
if (super->subtimer != 1) {
super->subtimer = 1;
if (this->subtimer != 1) {
this->subtimer = 1;
LoadGfxGroup(0x4a);
}
}
} else {
super->timer = 120;
super->spriteSettings.draw = 0;
if (super->subtimer != 0) {
super->subtimer = 0;
this->timer = 120;
this->spriteSettings.draw = 0;
if (this->subtimer != 0) {
this->subtimer = 0;
LoadGfxGroup(0x49);
}
}
}
void sub_0808BD00(BarrelSpiderwebEntity* this) {
void sub_0808BD00(Entity* this) {
SetGlobalFlag(LV1TARU_OPEN);
SoundReq(SFX_SECRET);
DeleteThisEntity();
}
void BarrelSpiderweb_Action2(BarrelSpiderwebEntity* this) {
void BarrelSpiderweb_Action2(Entity* this) {
if (super->subtimer != 0) {
super->subtimer -= 8;
SetAffineInfo(super, 0x200 - super->subtimer, 0x200 - super->subtimer, 0);
if (this->subtimer != 0) {
this->subtimer -= 8;
SetAffineInfo(this, 0x200 - this->subtimer, 0x200 - this->subtimer, 0);
}
if (super->contactFlags == 0x93) {
super->direction = GetFacingDirection(super, &gPlayerEntity);
LinearMoveUpdate(super);
if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 6, 0x1c)) {
if (this->contactFlags == 0x93) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
LinearMoveUpdate(this);
if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 6, 0x1c)) {
sub_0808BD00(this);
}
} else {
if ((super->flags & ENT_COLLIDE) != 0) {
super->flags &= ~ENT_COLLIDE;
super->timer = 30;
if ((this->flags & ENT_COLLIDE) != 0) {
this->flags &= ~ENT_COLLIDE;
this->timer = 30;
} else {
super->spriteSettings.draw ^= 1;
if (--super->timer == 0) {
this->spriteSettings.draw ^= 1;
if (--this->timer == 0) {
sub_0808BD00(this);
}
}
}
}
void sub_0808BDB0(BarrelSpiderwebEntity* this) {
void sub_0808BDB0(Entity* this) {
LinkedList* list = &gEntityLists[6];
Entity* it = list->first;
super->parent = NULL;
this->parent = NULL;
for (; it != (Entity*)list; it = it->next) {
if (it->kind == 0x9 && it->id == 0xc) {
super->parent = it;
this->parent = it;
return;
}
}
-2
View File
@@ -4,10 +4,8 @@
*
* @brief Bed Cover object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {
+14 -13
View File
@@ -4,28 +4,29 @@
*
* @brief Bell object
*/
#define NENT_DEPRECATED
#include "object.h"
void Bell_Init(Entity*);
void Bell_Action1(Entity*);
void Bell_Init(Entity* this);
void Bell_Action1(Entity* this);
void Bell(Entity* ent) {
void Bell(Entity* this) {
static void (*const Bell_Actions[])(Entity*) = {
Bell_Init,
Bell_Action1,
};
Bell_Actions[ent->action](ent);
Bell_Actions[this->action](this);
}
void Bell_Init(Entity* ent) {
ent->action = 1;
ent->spriteSettings.draw = 1;
ent->collisionLayer = 1;
ent->spritePriority.b0 = 0;
UpdateSpriteForCollisionLayer(ent);
InitAnimationForceUpdate(ent, 0);
void Bell_Init(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->collisionLayer = 1;
this->spritePriority.b0 = 0;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0);
}
void Bell_Action1(Entity* ent) {
UpdateAnimationSingleFrame(ent);
void Bell_Action1(Entity* this) {
UpdateAnimationSingleFrame(this);
}
+2 -2
View File
@@ -17,8 +17,8 @@ typedef struct {
u16 tilePos;
} BenchEntity;
void Bench_Init(BenchEntity*);
void Bench_Action1(BenchEntity*);
void Bench_Init(BenchEntity* this);
void Bench_Action1(BenchEntity* this);
void Bench(Entity* this) {
static void (*const Bench_Actions[])(BenchEntity*) = {
+32 -32
View File
@@ -18,17 +18,17 @@
typedef struct {
Entity base;
const u8* unk68;
const u8* unk_68;
} BigBarrelEntity;
void sub_08088A68(BigBarrelEntity*);
void sub_08088C9C(BigBarrelEntity*);
void sub_08088DB4(BigBarrelEntity*);
void sub_08088E74(BigBarrelEntity*);
void sub_08088F20(BigBarrelEntity*);
void sub_08088BE0(BigBarrelEntity*);
void sub_08089094(BigBarrelEntity*);
void sub_080890EC(BigBarrelEntity*, const s16*, s32);
void BigBarrel_Type0(BigBarrelEntity* this);
void BigBarrel_Type1(BigBarrelEntity* this);
void BigBarrel_Type2(BigBarrelEntity* this);
void BigBarrel_Type3(BigBarrelEntity* this);
void BigBarrel_Type4(BigBarrelEntity* this);
void sub_08088BE0(BigBarrelEntity* this);
void sub_08089094(BigBarrelEntity* this);
void sub_080890EC(BigBarrelEntity* this, const s16*, s32);
Entity* sub_08088C78(BigBarrelEntity*, u32, u32, u32);
@@ -40,13 +40,13 @@ const s8 gUnk_08120C25[] = { 5, 0, 4, 0, 4, 0, 2, 0, -1 };
const s8 gUnk_08120C2E[] = { 3, 0, -1, 0, 0, 0 };
void BigBarrel(Entity* this) {
static void (*const typeFuncs[])(BigBarrelEntity*) = {
sub_08088A68, sub_08088C9C, sub_08088DB4, sub_08088E74, sub_08088F20,
static void (*const BigBarrel_Types[])(BigBarrelEntity*) = {
BigBarrel_Type0, BigBarrel_Type1, BigBarrel_Type2, BigBarrel_Type3, BigBarrel_Type4,
};
typeFuncs[this->type]((BigBarrelEntity*)this);
BigBarrel_Types[this->type]((BigBarrelEntity*)this);
}
void sub_08088A68(BigBarrelEntity* this) {
void BigBarrel_Type0(BigBarrelEntity* this) {
u32 uVar3;
const u8* pcVar3;
@@ -55,9 +55,9 @@ void sub_08088A68(BigBarrelEntity* this) {
super->spriteSettings.draw = 3;
super->updatePriority = 3;
if (CheckGlobalFlag(LV1TARU_OPEN)) {
super->frameIndex = gSave.unk7 + 1;
super->frameIndex = gSave.dws_barrel_state + 1;
} else {
super->frameIndex = gSave.unk7;
super->frameIndex = gSave.dws_barrel_state;
}
sub_08088BE0(this);
if (CheckPlayerInRegion(super->x.HALF.HI - gRoomControls.origin_x, super->y.HALF.HI - gRoomControls.origin_y,
@@ -68,30 +68,30 @@ void sub_08088A68(BigBarrelEntity* this) {
if (gRoomVars.animFlags & 1) {
gRoomVars.animFlags &= ~1;
super->timer = 1;
this->unk68 = gUnk_08120C1C;
this->unk_68 = gUnk_08120C1C;
SoundReq(SFX_BARREL_ENTER);
}
if (gRoomVars.animFlags & 2) {
gRoomVars.animFlags &= ~2;
super->timer = 1;
this->unk68 = gUnk_08120C25;
this->unk_68 = gUnk_08120C25;
SoundReq(SFX_BARREL_RELEASE);
}
if (gRoomVars.animFlags & 4) {
gRoomVars.animFlags &= ~4;
super->timer = 1;
this->unk68 = gUnk_08120C2E;
this->unk_68 = gUnk_08120C2E;
SoundReq(SFX_BARREL_ENTER);
}
if (super->timer) {
if (super->timer-- == 1) {
pcVar3 = this->unk68;
pcVar3 = this->unk_68;
uVar3 = pcVar3[0];
*(u8*)&super->spriteOffsetY = uVar3;
pcVar3++;
if (*pcVar3 != 0xff) {
super->timer = 8;
this->unk68 = pcVar3;
this->unk_68 = pcVar3;
} else {
super->spriteOffsetY = 0;
}
@@ -143,7 +143,7 @@ Entity* sub_08088C78(BigBarrelEntity* this, u32 type, u32 type2, u32 xOffset) {
return pEVar1;
}
void sub_08088C9C(BigBarrelEntity* this) {
void BigBarrel_Type1(BigBarrelEntity* this) {
static const u8 gUnk_08120C48[] = { 2, 3, 4, 5, 6, 7, 7, 7 };
static const s8 gUnk_08120C50[] = { 8, -8 };
u32 localFlag;
@@ -203,7 +203,7 @@ void sub_08088C9C(BigBarrelEntity* this) {
}
}
void sub_08088DB4(BigBarrelEntity* this) {
void BigBarrel_Type2(BigBarrelEntity* this) {
switch (super->action) {
case 0:
super->action = 1;
@@ -242,7 +242,7 @@ void sub_08088DB4(BigBarrelEntity* this) {
}
}
void sub_08088E74(BigBarrelEntity* this) {
void BigBarrel_Type3(BigBarrelEntity* this) {
static const s8 gUnk_08120C52[] = { -2, 0, 2, 0 };
Entity* ent;
@@ -268,8 +268,8 @@ void sub_08088E74(BigBarrelEntity* this) {
}
}
void sub_08088F20(BigBarrelEntity* this) {
Entity* pEVar3;
void BigBarrel_Type4(BigBarrelEntity* this) {
Entity* flame;
switch (super->action) {
case 0:
@@ -287,13 +287,13 @@ void sub_08088F20(BigBarrelEntity* this) {
super->action = 2;
super->timer = 30;
RequestPriorityDuration(super, 270);
pEVar3 = CreateObject(FLAME, 1, 0);
if (pEVar3 != NULL) {
pEVar3->updatePriority = 3;
pEVar3->x.HALF.HI = super->x.HALF.HI;
pEVar3->y.HALF.HI = super->y.HALF.HI;
pEVar3->collisionLayer = 2;
pEVar3->spritePriority.b0 = 2;
flame = CreateObject(FLAME, 1, 0);
if (flame != NULL) {
flame->updatePriority = 3;
flame->x.HALF.HI = super->x.HALF.HI;
flame->y.HALF.HI = super->y.HALF.HI;
flame->collisionLayer = 2;
flame->spritePriority.b0 = 2;
}
SetMetaTileType(META_TILE_TYPE_118, COORD_TO_TILE(super), LAYER_TOP);
break;
-1
View File
@@ -4,7 +4,6 @@
*
* @brief Big Ice Block object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "hitbox.h"
-1
View File
@@ -4,7 +4,6 @@
*
* @brief Big Pushable Lever object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
+51 -45
View File
@@ -4,92 +4,98 @@
*
* @brief Big Vortex object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[30];
/*0x86*/ u16 unk_86;
} BigVortexEntity;
void sub_08098E3C(Entity*);
void sub_08098E88(Entity*);
void BigVortex_Init(Entity*);
void BigVortex_Action1(Entity*);
void BigVortex_Action2(Entity*);
void BigVortex_Action3(Entity*);
void BigVortex_Action4(Entity*);
void BigVortex_Init(BigVortexEntity* this);
void BigVortex_Action1(BigVortexEntity* this);
void BigVortex_Action2(BigVortexEntity* this);
void BigVortex_Action3(BigVortexEntity* this);
void BigVortex_Action4(BigVortexEntity* this);
void BigVortex(Entity* this) {
static void (*const BigVortex_Actions[])(Entity*) = {
void BigVortex(BigVortexEntity* this) {
static void (*const BigVortex_Actions[])(BigVortexEntity*) = {
BigVortex_Init, BigVortex_Action1, BigVortex_Action2, BigVortex_Action3, BigVortex_Action4,
};
if (this->type == 0) {
BigVortex_Actions[this->action](this);
if (super->type == 0) {
BigVortex_Actions[super->action](this);
} else {
sub_08098E3C(this);
sub_08098E3C(super);
}
}
void BigVortex_Init(Entity* this) {
void BigVortex_Init(BigVortexEntity* this) {
u32 temp;
this->action = 1;
this->z.HALF.HI = -0x10;
super->action = 1;
super->z.HALF.HI = -0x10;
temp = this->field_0x86.HWORD;
temp = this->unk_86;
if ((temp != 0) && !CheckFlags(temp)) {
this->action = 1;
super->action = 1;
} else {
this->action = 3;
this->spriteSettings.draw = TRUE;
sub_08098E88(this);
super->action = 3;
super->spriteSettings.draw = TRUE;
sub_08098E88(super);
}
SetDefaultPriority(this, PRIO_PLAYER_EVENT);
InitAnimationForceUpdate(this, 0);
SetDefaultPriority(super, PRIO_PLAYER_EVENT);
InitAnimationForceUpdate(super, 0);
}
void BigVortex_Action1(Entity* this) {
Entity* ent;
void BigVortex_Action1(BigVortexEntity* this) {
Entity* fx;
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->timer = 45;
ent = CreateFx(this, FX_BIG_EXPLOSION2, 0);
if (ent != NULL) {
ent->y.HALF.HI += 8;
if (CheckFlags(this->unk_86)) {
super->action = 2;
super->timer = 45;
fx = CreateFx(super, FX_BIG_EXPLOSION2, 0);
if (fx != NULL) {
fx->y.HALF.HI += 8;
}
}
}
void BigVortex_Action2(Entity* this) {
if (--this->timer == 0) {
this->action = 3;
this->spriteSettings.draw = TRUE;
sub_08098E88(this);
void BigVortex_Action2(BigVortexEntity* this) {
if (--super->timer == 0) {
super->action = 3;
super->spriteSettings.draw = TRUE;
sub_08098E88(super);
}
}
void BigVortex_Action3(Entity* this) {
void BigVortex_Action3(BigVortexEntity* this) {
if (sub_0800419C(this, &gPlayerEntity, 8, 8) != 0) {
CopyPosition(this, &gPlayerEntity);
sub_08004542(this);
if (sub_0800419C(super, &gPlayerEntity, 8, 8) != 0) {
CopyPosition(super, &gPlayerEntity);
sub_08004542(super);
sub_08004542(&gPlayerEntity);
gPlayerEntity.collisionLayer = 1;
SortEntityAbove(this, &gPlayerEntity);
SortEntityAbove(super, &gPlayerEntity);
gPlayerState.queued_action = PLAYER_PARACHUTE;
gPlayerState.field_0x38 = 1;
gPlayerState.field_0x39 = this->type2;
this->action = 4;
if (this->type2 == 1) {
gPlayerState.field_0x39 = super->type2;
super->action = 4;
if (super->type2 == 1) {
SetGlobalFlag(TATSUMAKI);
}
PutAwayItems();
}
UpdateAnimationSingleFrame(this);
UpdateAnimationSingleFrame(super);
}
void BigVortex_Action4(Entity* this) {
UpdateAnimationSingleFrame(this);
void BigVortex_Action4(BigVortexEntity* this) {
UpdateAnimationSingleFrame(super);
}
void sub_08098E3C(Entity* this) {
+197 -192
View File
@@ -4,234 +4,241 @@
*
* @brief Bird object
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "functions.h"
#include "game.h"
#include "item.h"
#include "message.h"
#include "object.h"
#include "object/cutsceneOrchestrator.h"
#include "save.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ s16 gravity;
} BirdEntity;
extern u16 script_EzloTalkOcarina[];
void Bird_Type0(Entity*);
void Bird_Type1(Entity*);
void Bird_Type2(Entity*);
void Bird_Type3(Entity*);
void Bird_Type8(Entity*);
void Bird_Type9(Entity*);
void Bird_Type10(Entity*);
void Bird_Type0_Init(Entity*);
void Bird_Type0_Action1(Entity*);
void Bird_Type1_Init(Entity*);
void Bird_Type1_Action1(Entity*);
void Bird_Type1_Action1_Subaction0(Entity*);
void Bird_Type1_Action1_Subaction1(Entity*);
void Bird_Type2_Init(Entity*);
void Bird_Type2_Action1(Entity*);
void Bird_Type0(BirdEntity* this);
void Bird_Type1(BirdEntity* this);
void Bird_Type2(BirdEntity* this);
void Bird_Type3(BirdEntity* this);
void Bird_Type8(BirdEntity* this);
void Bird_Type9(BirdEntity* this);
void Bird_Type10(BirdEntity* this);
void Bird_Type0_Init(BirdEntity* this);
void Bird_Type0_Action1(BirdEntity* this);
void Bird_Type1_Init(BirdEntity* this);
void Bird_Type1_Action1(BirdEntity* this);
void Bird_Type1_Action1_Subaction0(BirdEntity* this);
void Bird_Type1_Action1_Subaction1(BirdEntity* this);
void Bird_Type2_Init(BirdEntity* this);
void Bird_Type2_Action1(BirdEntity* this);
void Bird(Entity* this) {
static void (*const typeFuncs[])(Entity*) = {
void Bird(BirdEntity* this) {
static void (*const typeFuncs[])(BirdEntity*) = {
Bird_Type0, Bird_Type1, Bird_Type2, Bird_Type3, Bird_Type3, Bird_Type3,
Bird_Type3, Bird_Type3, Bird_Type8, Bird_Type9, Bird_Type10,
};
typeFuncs[this->type](this);
typeFuncs[super->type](this);
}
void Bird_Type0(Entity* this) {
static void (*const Bird_Type0_Actions[])(Entity*) = {
void Bird_Type0(BirdEntity* this) {
static void (*const Bird_Type0_Actions[])(BirdEntity*) = {
Bird_Type0_Init,
Bird_Type0_Action1,
};
Bird_Type0_Actions[this->action](this);
Bird_Type0_Actions[super->action](this);
}
void Bird_Type0_Init(Entity* this) {
void Bird_Type0_Init(BirdEntity* this) {
Entity* target;
this->action++;
this->spriteSettings.draw = TRUE;
this->timer = 49;
this->subtimer = 1;
this->zVelocity = Q_16_16(-1.5);
this->z.WORD = Q_16_16(-56.75);
this->field_0x68.HWORD = Q_8_8(-8.0);
this->speed = 0x280;
this->direction = 8;
this->collisionLayer = 2;
this->x.HALF.HI = gRoomControls.scroll_x;
super->action++;
super->spriteSettings.draw = TRUE;
super->timer = 49;
super->subtimer = 1;
super->zVelocity = Q_16_16(-1.5);
super->z.WORD = Q_16_16(-56.75);
this->gravity = Q_8_8(-8.0);
super->speed = 0x280;
super->direction = 8;
super->collisionLayer = 2;
super->x.HALF.HI = gRoomControls.scroll_x;
SoundReq(SFX_123);
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0);
UpdateSpriteForCollisionLayer(super);
InitAnimationForceUpdate(super, 0);
target = CreateObject(BIRD, 1, 0);
if (target != NULL) {
target->parent = this;
PositionRelative(this, target, 0, Q_16_16(8.0));
SortEntityAbove(this, target);
target->parent = super;
PositionRelative(super, target, 0, Q_16_16(8.0));
SortEntityAbove(super, target);
}
}
void Bird_Type0_Action1(Entity* this) {
LinearMoveUpdate(this);
GravityUpdate(this, *(s16*)&this->field_0x68.HWORD);
if (this->timer != 0) {
if (--this->timer == 0) {
this->subtimer = 0;
void Bird_Type0_Action1(BirdEntity* this) {
LinearMoveUpdate(super);
GravityUpdate(super, this->gravity);
if (super->timer != 0) {
if (--super->timer == 0) {
super->subtimer = 0;
}
} else if (CheckOnScreen(this) == 0) {
} else if (CheckOnScreen(super) == 0) {
DeleteThisEntity();
}
UpdateAnimationSingleFrame(this);
UpdateAnimationSingleFrame(super);
}
void Bird_Type1(Entity* this) {
static void (*const Bird_Type1_Actions[])(Entity*) = {
void Bird_Type1(BirdEntity* this) {
static void (*const Bird_Type1_Actions[])(BirdEntity*) = {
Bird_Type1_Init,
Bird_Type1_Action1,
};
Bird_Type1_Actions[this->action](this);
Bird_Type1_Actions[super->action](this);
}
void Bird_Type1_Init(Entity* this) {
this->action++;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0x17);
void Bird_Type1_Init(BirdEntity* this) {
super->action++;
super->collisionLayer = 1;
UpdateSpriteForCollisionLayer(super);
InitAnimationForceUpdate(super, 0x17);
}
void Bird_Type1_Action1(Entity* this) {
static void (*const Bird_Type1_Action1_Subactions[])(Entity*) = {
void Bird_Type1_Action1(BirdEntity* this) {
static void (*const Bird_Type1_Action1_Subactions[])(BirdEntity*) = {
Bird_Type1_Action1_Subaction0,
Bird_Type1_Action1_Subaction1,
};
Bird_Type1_Action1_Subactions[this->subAction](this);
Bird_Type1_Action1_Subactions[super->subAction](this);
}
void Bird_Type1_Action1_Subaction0(Entity* this) {
void Bird_Type1_Action1_Subaction0(BirdEntity* this) {
u32 temp;
if (this->parent != NULL) {
temp = this->parent->subtimer;
if (super->parent != NULL) {
temp = super->parent->subtimer;
if (temp != 0) {
PositionRelative(this->parent, this, 0, Q_16_16(8.0));
PositionRelative(super->parent, super, 0, Q_16_16(8.0));
} else {
this->subAction++;
this->zVelocity = temp;
super->subAction++;
super->zVelocity = temp;
}
}
}
void Bird_Type1_Action1_Subaction1(Entity* this) {
void Bird_Type1_Action1_Subaction1(BirdEntity* this) {
Entity* fx;
if (sub_080044EC(this, 0x1800) < 2) {
this->type = 2;
this->action = 1;
this->z.WORD = 0;
this->collisionLayer = 1;
if (sub_080044EC(super, 0x1800) < 2) {
super->type = 2;
super->action = 1;
super->z.WORD = 0;
super->collisionLayer = 1;
SetLocalFlag(LV3_OCARINA_FALL);
SoundReq(SFX_SECRET);
fx = CreateFx(this, FX_DASH, 0);
fx = CreateFx(super, FX_DASH, 0);
if (fx != NULL) {
SortEntityBelow(this, fx);
SortEntityBelow(super, fx);
}
}
}
void Bird_Type2(Entity* this) {
static void (*const Bird_Type2_Actions[])(Entity*) = {
void Bird_Type2(BirdEntity* this) {
static void (*const Bird_Type2_Actions[])(BirdEntity*) = {
Bird_Type2_Init,
Bird_Type2_Action1,
};
Bird_Type2_Actions[this->action](this);
Bird_Type2_Actions[super->action](this);
}
void Bird_Type2_Init(Entity* this) {
this->action++;
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0x17);
void Bird_Type2_Init(BirdEntity* this) {
super->action++;
super->collisionLayer = 1;
UpdateSpriteForCollisionLayer(super);
InitAnimationForceUpdate(super, 0x17);
}
void Bird_Type2_Action1(Entity* this) {
void Bird_Type2_Action1(BirdEntity* this) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
sub_0800445C(this);
} else if (IsCollidingPlayer(this) != 0) {
sub_0800445C(super);
} else if (IsCollidingPlayer(super) != 0) {
CreateItemEntity(ITEM_OCARINA, 0, 0);
gSave.windcrests |= 0x10000000;
DeleteThisEntity();
}
}
void Bird_Type3(Entity* this) {
void Bird_Type3(BirdEntity* this) {
if (this->action == 0) {
this->action++;
this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this);
this->frame = 0x80;
if (super->action == 0) {
super->action++;
super->collisionLayer = 2;
UpdateSpriteForCollisionLayer(super);
super->frame = 0x80;
}
if ((this->frame & ANIM_DONE) != 0) {
InitializeAnimation(this, Random() & 3);
this->frameDuration = (Random() & 0xf) + 0x10;
this->spriteSettings.flipX = FALSE;
if ((super->frame & ANIM_DONE) != 0) {
InitializeAnimation(super, Random() & 3);
super->frameDuration = (Random() & 0xf) + 0x10;
super->spriteSettings.flipX = FALSE;
if ((Random() & 1) != 0) {
this->spriteSettings.flipX = TRUE;
super->spriteSettings.flipX = TRUE;
}
} else {
GetNextFrame(this);
GetNextFrame(super);
}
}
void Bird_Type8(Entity* this) {
void Bird_Type8(BirdEntity* this) {
Entity* pEVar5;
switch (this->action) {
switch (super->action) {
case 0:
if (this->timer != 0) {
this->frameIndex = 0xff;
this->timer--;
if (super->timer != 0) {
super->frameIndex = 0xff;
super->timer--;
return;
}
this->action = 1;
this->zVelocity = 0;
this->z.WORD = Q_16_16(-20.0);
this->speed = 0x180;
this->direction = 8;
this->collisionLayer = 1;
this->spritePriority.b0 = 0;
this->spriteRendering.b3 = 0;
this->spriteOrientation.flipY = 1;
this->x.HALF.HI = gRoomControls.scroll_x;
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
this->child = NULL;
SetDefaultPriority(this, 6);
InitAnimationForceUpdate(this, 0);
super->action = 1;
super->zVelocity = 0;
super->z.WORD = Q_16_16(-20.0);
super->speed = 0x180;
super->direction = 8;
super->collisionLayer = 1;
super->spritePriority.b0 = 0;
super->spriteRendering.b3 = 0;
super->spriteOrientation.flipY = 1;
super->x.HALF.HI = gRoomControls.scroll_x;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI;
super->child = NULL;
SetDefaultPriority(super, 6);
InitAnimationForceUpdate(super, 0);
SoundReq(0x123);
break;
case 1:
this->collisionLayer = gPlayerEntity.collisionLayer;
this->speed += 8;
if (this->speed > 0x300) {
this->speed = 0x300;
super->collisionLayer = gPlayerEntity.collisionLayer;
super->speed += 8;
if (super->speed > 0x300) {
super->speed = 0x300;
}
if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 &&
gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE &&
gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB &&
gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE &&
PlayerCanBeMoved() && (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) {
s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8;
PlayerCanBeMoved() && (EntityInRectRadius(super, &gPlayerEntity, 0xe, 0xe))) {
s32 z = gPlayerEntity.z.HALF.HI - super->z.HALF.HI - 8;
if ((u16)z < 0x20 && gPlayerEntity.health != 0) {
pEVar5 = CreateObject(BIRD, 10, 0);
if (pEVar5 != NULL) {
this->child = pEVar5;
this->action = 2;
this->timer = 8;
this->speed = 0x300;
this->field_0x68.HWORD = Q_8_8(-32.0);
super->child = pEVar5;
super->action = 2;
super->timer = 8;
super->speed = 0x300;
this->gravity = Q_8_8(-32.0);
PlayerDropHeldObject();
sub_08078B48();
ResetPlayerAnimationAndAction();
@@ -251,33 +258,33 @@ void Bird_Type8(Entity* this) {
gPlayerEntity.spriteSettings.draw = 0;
break;
}
LinearMoveUpdate(this);
GravityUpdate(this, (s16)this->field_0x68.HWORD);
UpdateAnimationSingleFrame(this);
pEVar5 = this->child;
LinearMoveUpdate(super);
GravityUpdate(super, (s16)this->gravity);
UpdateAnimationSingleFrame(super);
pEVar5 = super->child;
if (pEVar5 != NULL) {
if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI - 8) {
this->timer = 0;
if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI - 8) {
super->timer = 0;
}
if (this->timer == 0) {
PositionRelative(this, pEVar5, 0xfff80000, 0);
if (super->timer == 0) {
PositionRelative(super, pEVar5, 0xfff80000, 0);
pEVar5->z.HALF.HI += 0x18;
pEVar5->spritePriority.b0 = this->spritePriority.b0;
pEVar5->spriteRendering.b3 = this->spriteRendering.b3;
pEVar5->spriteOrientation.flipY = this->spriteOrientation.flipY;
pEVar5->spritePriority.b0 = super->spritePriority.b0;
pEVar5->spriteRendering.b3 = super->spriteRendering.b3;
pEVar5->spriteOrientation.flipY = super->spriteOrientation.flipY;
} else {
this->timer--;
super->timer--;
CopyPosition(&gPlayerEntity, pEVar5);
}
}
if (CheckOnScreen(this) == 0) {
if (this->action == 2) {
if (CheckOnScreen(super) == 0) {
if (super->action == 2) {
gSave.windcrests |= 0x10000000;
MenuFadeIn(9, 0);
}
pEVar5 = this->child;
pEVar5 = super->child;
if (pEVar5 != NULL) {
DeleteEntityAny(pEVar5);
}
@@ -285,43 +292,42 @@ void Bird_Type8(Entity* this) {
}
}
void Bird_Type9(Entity* this) {
Entity* pEVar1;
void Bird_Type9(BirdEntity* this) {
Entity* child;
if (this->action == 0) {
this->action = 1;
this->spriteSettings.draw = 1;
this->zVelocity = Q_16_16(-2.5);
this->z.WORD = Q_16_16(-75.25);
this->field_0x68.HWORD = Q_8_8(-16.0);
this->speed = 0x300;
this->direction = 8;
this->collisionLayer = 1;
this->spritePriority.b0 = 0;
this->spriteRendering.b3 = 0;
this->spriteOrientation.flipY = 1;
SetDefaultPriority(this, 6);
this->x.HALF.HI = gRoomControls.scroll_x;
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
if (super->action == 0) {
super->action = 1;
super->spriteSettings.draw = 1;
super->zVelocity = Q_16_16(-2.5);
super->z.WORD = Q_16_16(-75.25);
this->gravity = Q_8_8(-16.0);
super->speed = 0x300;
super->direction = 8;
super->collisionLayer = 1;
super->spritePriority.b0 = 0;
super->spriteRendering.b3 = 0;
super->spriteOrientation.flipY = 1;
SetDefaultPriority(super, 6);
super->x.HALF.HI = gRoomControls.scroll_x;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI;
SoundReq(SFX_123);
this->spritePriority.b1 = 2;
InitAnimationForceUpdate(this, 0);
super->spritePriority.b1 = 2;
InitAnimationForceUpdate(super, 0);
sub_08078B48();
} else if (this->action == 1) {
} else if (super->action == 1) {
gPlayerEntity.spriteSettings.draw = 0;
child = this->child;
child = super->child;
if (child != NULL) {
PositionRelative(this, child, Q_16_16(-8), 0);
PositionRelative(super, child, Q_16_16(-8), 0);
child->z.HALF.HI += 0x18;
child->spritePriority.b0 = this->spritePriority.b0;
child->spriteRendering.b3 = this->spriteRendering.b3;
child->spriteOrientation.flipY = this->spriteOrientation.flipY;
child->spritePriority.b0 = super->spritePriority.b0;
child->spriteRendering.b3 = super->spriteRendering.b3;
child->spriteOrientation.flipY = super->spriteOrientation.flipY;
}
sub_08078B48();
if (gRoomControls.scroll_x + 0x78 < this->x.HALF.HI) {
this->action++;
this->spritePriority.b1 = 1;
if (gRoomControls.scroll_x + 0x78 < super->x.HALF.HI) {
super->action++;
super->spritePriority.b1 = 1;
if (child != NULL) {
child->action++;
}
@@ -331,39 +337,40 @@ void Bird_Type9(Entity* this) {
ResetPlayerEventPriority();
gPauseMenuOptions.disabled = 0;
if (!CheckGlobalFlag(WARP_1ST)) {
pEVar1 = CreateObject(CUTSCENE_ORCHESTRATOR, 0, 0);
if (pEVar1 != NULL) {
*(ScriptExecutionContext**)&pEVar1->cutsceneBeh = StartCutscene(pEVar1, script_EzloTalkOcarina);
CutsceneOrchestratorEntity* orchestrator =
(CutsceneOrchestratorEntity*)CreateObject(CUTSCENE_ORCHESTRATOR, 0, 0);
if (orchestrator != NULL) {
orchestrator->context = StartCutscene(&orchestrator->base, script_EzloTalkOcarina);
SetGlobalFlag(WARP_1ST);
}
}
}
}
LinearMoveUpdate(this);
GravityUpdate(this, (short)this->field_0x68.HWORD);
UpdateAnimationSingleFrame(this);
if (!CheckOnScreen(this)) {
LinearMoveUpdate(super);
GravityUpdate(super, (short)this->gravity);
UpdateAnimationSingleFrame(super);
if (!CheckOnScreen(super)) {
DeleteThisEntity();
}
}
void Bird_Type10(Entity* this) {
this->palette.b.b0 = gPlayerEntity.palette.b.b0;
switch (this->action) {
void Bird_Type10(BirdEntity* this) {
super->palette.b.b0 = gPlayerEntity.palette.b.b0;
switch (super->action) {
case 0:
this->action = 1;
this->spriteSettings.draw = 1;
this->collisionLayer = 1;
this->spritePriority.b0 = 0;
this->spriteRendering.b3 = 0;
this->spriteOrientation.flipY = 1;
SetDefaultPriority(this, 6);
InitAnimationForceUpdate(this, 0xe0);
super->action = 1;
super->spriteSettings.draw = 1;
super->collisionLayer = 1;
super->spritePriority.b0 = 0;
super->spriteRendering.b3 = 0;
super->spriteOrientation.flipY = 1;
SetDefaultPriority(super, 6);
InitAnimationForceUpdate(super, 0xe0);
case 1:
UpdateAnimationSingleFrame(this);
UpdateAnimationSingleFrame(super);
break;
case 2:
this->action = 3;
super->action = 3;
break;
case 3:
DeleteThisEntity();
@@ -372,8 +379,6 @@ void Bird_Type10(Entity* this) {
}
void CreateBird(Entity* this) {
Entity* birdEnt;
// EU only allows warp from the overworld. This prevents warping from the rooftop of the Wind Tribe's tower.
#ifndef EU
if (AreaAllowsWarp()) {
@@ -381,9 +386,9 @@ void CreateBird(Entity* this) {
if (AreaIsOverworld()) {
#endif
if (!FindEntity(OBJECT, BIRD, 6, 8, 0)) {
birdEnt = CreateObject(BIRD, 8, 0);
if (birdEnt != NULL) {
birdEnt->timer = 0;
Entity* bird = CreateObject(BIRD, 8, 0);
if (bird != NULL) {
bird->timer = 0;
}
}
}
-1
View File
@@ -4,7 +4,6 @@
*
* @brief Block Pushed object
*/
#define NENT_DEPRECATED
#include "area.h"
#include "functions.h"
+84 -75
View File
@@ -4,6 +4,7 @@
*
* @brief Book object
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "functions.h"
#include "item.h"
@@ -11,19 +12,27 @@
#include "npc.h"
#include "object.h"
extern void (*const Book_Actions[])(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[24];
/*0x80*/ u8 unk_80;
/*0x81*/ u8 unused2[5];
/*0x86*/ u16 unk_86;
} BookEntity;
extern void (*const Book_Actions[])(BookEntity*);
extern s8 const gUnk_08123D94[];
u32 sub_0809B688(Entity*);
void sub_0809B6B0(Entity*, Entity*);
void Book(Entity* this) {
Book_Actions[this->action](this);
void Book(BookEntity* this) {
Book_Actions[super->action](this);
}
void Book_Init(Entity* this) {
u32 obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1);
if (this->type2 != 3) {
void Book_Init(BookEntity* this) {
u32 obtained = GetInventoryValue(super->type + ITEM_QST_BOOK1);
if (super->type2 != 3) {
if (obtained != 0) {
DeleteThisEntity();
}
@@ -33,70 +42,70 @@ void Book_Init(Entity* this) {
}
if (obtained != 2) {
this->spriteSettings.draw = 0;
super->spriteSettings.draw = 0;
}
}
this->spriteOffsetY = 3;
if (CheckFlags(this->field_0x86.HWORD)) {
if (this->type2 == 0) {
this->y.HALF.HI += 48;
super->spriteOffsetY = 3;
if (CheckFlags(this->unk_86)) {
if (super->type2 == 0) {
super->y.HALF.HI += 48;
}
this->type2 = 2;
super->type2 = 2;
}
UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, this->type + ITEM_QST_BOOK1);
UpdateSpriteForCollisionLayer(super);
InitAnimationForceUpdate(super, super->type + ITEM_QST_BOOK1);
switch (this->type2) {
switch (super->type2) {
case 0:
this->action = 1;
this->timer = 22;
this->subtimer = 2;
this->field_0x80.HALF.LO = 0;
this->spritePriority.b0 = 3;
super->action = 1;
super->timer = 22;
super->subtimer = 2;
this->unk_80 = 0;
super->spritePriority.b0 = 3;
break;
case 1: {
u32 scroll;
u32 height;
this->action = 3;
super->action = 3;
scroll = (u16)gRoomControls.scroll_y - 0x10;
height = (u16)this->y.HALF.HI - scroll;
this->z.HALF.HI -= height;
height = (u16)super->y.HALF.HI - scroll;
super->z.HALF.HI -= height;
break;
}
case 2:
this->action = 4;
super->action = 4;
break;
case 3:
this->action = 5;
this->subAction = 0;
this->spritePriority.b0 = 3;
super->action = 5;
super->subAction = 0;
super->spritePriority.b0 = 3;
break;
default:
break;
}
}
void Book_Action1(Entity* this) {
sub_0800445C(this);
void Book_Action1(BookEntity* this) {
sub_0800445C(super);
if (this->field_0x80.HALF.LO != 0) {
this->field_0x80.HALF.LO--;
if (this->unk_80 != 0) {
this->unk_80--;
return;
}
if (sub_0809B688(this)) {
if (--this->timer) {
if (sub_0809B688(super)) {
if (--super->timer) {
return;
}
this->action = 2;
this->timer = 30;
this->speed = 0x40;
this->direction = 0x10;
super->action = 2;
super->timer = 30;
super->speed = 0x40;
super->direction = 0x10;
gPlayerState.pushedObject = TREE_THORNS;
gPlayerState.queued_action = PLAYER_PUSH;
@@ -107,79 +116,79 @@ void Book_Action1(Entity* this) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
EnqueueSFX(SFX_10F);
} else {
this->timer = 22;
super->timer = 22;
}
}
void Book_Action2(Entity* this) {
if (--this->timer == 0) {
if (--this->subtimer == 0) {
this->action = 3;
this->y.HALF.HI += 0x20;
this->z.HALF.HI -= 0x20;
void Book_Action2(BookEntity* this) {
if (--super->timer == 0) {
if (--super->subtimer == 0) {
super->action = 3;
super->y.HALF.HI += 0x20;
super->z.HALF.HI -= 0x20;
} else {
this->action = 1;
this->timer = 22;
this->field_0x80.HALF.LO = 0x18;
super->action = 1;
super->timer = 22;
this->unk_80 = 0x18;
}
}
LinearMoveUpdate(this);
LinearMoveUpdate(super);
}
void Book_Action3(Entity* this) {
void Book_Action3(BookEntity* this) {
Entity* fx;
if (sub_080044EC(this, 0x2800) != 1) {
if (sub_080044EC(super, 0x2800) != 1) {
return;
}
this->action = 4;
this->spritePriority.b0 = 4;
super->action = 4;
super->spritePriority.b0 = 4;
SetFlag(this->field_0x86.HWORD);
SetFlag(this->unk_86);
fx = CreateFx(this, FX_DEATH, 0);
fx = CreateFx(super, FX_DEATH, 0);
if (fx != NULL) {
SortEntityAbove(this, fx);
SortEntityAbove(super, fx);
}
}
void Book_Action4(Entity* this) {
void Book_Action4(BookEntity* this) {
if (gPlayerState.flags & PL_MINISH) {
sub_0800445C(this);
} else if (IsCollidingPlayer(this)) {
CreateItemEntity(this->type + ITEM_QST_BOOK1, 0, 0);
sub_0800445C(super);
} else if (IsCollidingPlayer(super)) {
CreateItemEntity(super->type + ITEM_QST_BOOK1, 0, 0);
DeleteThisEntity();
}
}
void Book_Action5(Entity* this) {
if (this->spriteSettings.draw == 1) {
switch (this->subAction) {
void Book_Action5(BookEntity* this) {
if (super->spriteSettings.draw == 1) {
switch (super->subAction) {
case 0: {
Entity* parent = FindEntityByID(NPC, STURGEON, 7);
if (parent == NULL) {
return;
}
if (parent->x.HALF.HI < this->x.HALF.HI) {
if (parent->x.HALF.HI < super->x.HALF.HI) {
return;
}
if (parent->animationState != 4) {
return;
}
this->parent = parent;
this->subAction = 1;
sub_0809B6B0(this->parent, this);
super->parent = parent;
super->subAction = 1;
sub_0809B6B0(super->parent, super);
break;
}
case 1: {
if ((this->parent == NULL) || (this->parent->next == NULL)) {
if ((super->parent == NULL) || (super->parent->next == NULL)) {
DeleteThisEntity();
return;
}
sub_0809B6B0(this->parent, this);
sub_0809B6B0(super->parent, super);
break;
}
default:
@@ -187,22 +196,22 @@ void Book_Action5(Entity* this) {
}
} else {
switch (this->subAction) {
switch (super->subAction) {
default: {
DeleteThisEntity();
break;
}
case 0: {
if (GetInventoryValue(this->type + ITEM_QST_BOOK1) == 2) {
this->subAction = 1;
if (GetInventoryValue(super->type + ITEM_QST_BOOK1) == 2) {
super->subAction = 1;
}
break;
}
case 1: {
u8 doTextBox = gMessage.doTextBox & 0x7f;
if (!doTextBox) {
this->spriteSettings.draw = 1;
this->subAction = doTextBox;
super->spriteSettings.draw = 1;
super->subAction = doTextBox;
}
break;
}
@@ -213,7 +222,7 @@ void Book_Action5(Entity* this) {
u32 sub_0809B688(Entity* this) {
u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
if (ret == 1 && gPlayerState.direction != 16) {
if (ret == 1 && gPlayerState.direction != DirectionSouth) {
ret = 0;
}
@@ -229,7 +238,7 @@ void sub_0809B6B0(Entity* parent, Entity* this) {
this->spritePriority.b0 = 3 - this->type;
}
void (*const Book_Actions[])(Entity*) = {
void (*const Book_Actions[])(BookEntity*) = {
Book_Init, Book_Action1, Book_Action2, Book_Action3, Book_Action4, Book_Action5,
};
+1 -2
View File
@@ -4,7 +4,6 @@
*
* @brief Boss Door object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "hitbox.h"
@@ -85,7 +84,7 @@ void BossDoor_Init(BossDoorEntity* this) {
}
void BossDoor_Action1(BossDoorEntity* this) {
if (super->interactType != 0) {
if (super->interactType != INTERACTION_NONE) {
super->action = 2;
RemoveInteractableObject(super);
SetFlag(this->unk_86);
+114 -102
View File
@@ -4,177 +4,189 @@
*
* @brief Button object
*/
#include "object.h"
#define NENT_DEPRECATED
#include "functions.h"
#include "tiles.h"
#include "object.h"
void Button_Init(Entity*);
void Button_Action1(Entity*);
void Button_Action2(Entity*);
void Button_Action3(Entity*);
void Button_Action4(Entity*);
void Button_Action5(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
/*0x74*/ u16 metaTilePos;
/*0x76*/ u8 unused2[14];
/*0x84*/ u16 unk_84;
/*0x86*/ u16 unk_86;
} ButtonEntity;
void Button(Entity* this) {
static void (*const Button_Actions[])(Entity*) = {
void Button_Init(ButtonEntity* this);
void Button_Action1(ButtonEntity* this);
void Button_Action2(ButtonEntity* this);
void Button_Action3(ButtonEntity* this);
void Button_Action4(ButtonEntity* this);
void Button_Action5(ButtonEntity* this);
void Button(ButtonEntity* this) {
static void (*const Button_Actions[])(ButtonEntity*) = {
Button_Init, Button_Action1, Button_Action2, Button_Action3, Button_Action4, Button_Action5,
};
Button_Actions[this->action](this);
Button_Actions[super->action](this);
}
extern u32 sub_08081E3C(Entity*);
extern u32 sub_08081E3C(ButtonEntity*);
void Button_Init(Entity* this) {
COLLISION_OFF(this);
this->updatePriority = PRIO_NO_BLOCK;
this->y.HALF.HI++;
if (this->cutsceneBeh.HWORD != 0) {
this->collisionLayer = this->cutsceneBeh.HWORD;
void Button_Init(ButtonEntity* this) {
COLLISION_OFF(super);
super->updatePriority = PRIO_NO_BLOCK;
super->y.HALF.HI++;
if (this->unk_84 != 0) {
super->collisionLayer = this->unk_84;
}
this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6);
this->field_0x70.HALF.HI = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer);
if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) {
this->action = 5;
SetMetaTileType(META_TILE_TYPE_122, this->field_0x74.HWORD, this->collisionLayer);
this->metaTilePos = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
((((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6);
this->unk_72 = GetMetaTileType(this->metaTilePos, super->collisionLayer);
if (super->type == 0 && CheckFlags(this->unk_86)) {
super->action = 5;
SetMetaTileType(META_TILE_TYPE_122, this->metaTilePos, super->collisionLayer);
} else {
if (sub_08081E3C(this)) {
this->action = 2;
super->action = 2;
} else {
this->action = 1;
super->action = 1;
}
}
}
void Button_Action1(Entity* this) {
void Button_Action1(ButtonEntity* this) {
if (sub_08081E3C(this)) {
this->action = 2;
this->field_0x70.HALF.HI = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer);
super->action = 2;
this->unk_72 = GetMetaTileType(this->metaTilePos, super->collisionLayer);
}
}
u32 sub_08081CB0(Entity*);
u32 sub_08081CB0(ButtonEntity*);
void sub_08081FF8(Entity*);
void Button_Action2(Entity* this) {
void Button_Action2(ButtonEntity* this) {
if (sub_08081CB0(this)) {
this->subAction = 0;
this->timer = 10;
RequestPriorityDuration(this, 10);
sub_08081FF8(this);
if (this->type == 1) {
this->action = 3;
super->subAction = 0;
super->timer = 10;
RequestPriorityDuration(super, 10);
sub_08081FF8(super);
if (super->type == 1) {
super->action = 3;
} else {
this->action = 5;
super->action = 5;
}
}
}
u32 sub_08081F7C(Entity*, u32 metaTileType);
u32 sub_08081D28(Entity*);
void sub_08081E6C(Entity*);
u32 sub_08081F7C(ButtonEntity*, u32 metaTileType);
u32 sub_08081D28(ButtonEntity*);
void sub_08081E6C(ButtonEntity*);
void Button_Action3(Entity* this) {
void Button_Action3(ButtonEntity* this) {
if (!sub_08081F7C(this, META_TILE_TYPE_120))
return;
if (!sub_08081D28(this)) {
this->action = 4;
this->subtimer = 1;
super->action = 4;
super->subtimer = 1;
if ((gPlayerState.heldObject == 2) || (!(gPlayerState.field_0x35 & 0x80))) {
this->timer = 24;
super->timer = 24;
} else {
this->timer = 8;
super->timer = 8;
}
} else {
sub_08081E6C(this);
}
}
void Button_Action4(Entity* this) {
if (this->timer != 0) {
this->timer--;
if (this->subtimer != 0) {
this->subtimer = 0;
SetMetaTile(SPECIAL_META_TILE_53, this->field_0x74.HWORD, this->collisionLayer);
void Button_Action4(ButtonEntity* this) {
if (super->timer != 0) {
super->timer--;
if (super->subtimer != 0) {
super->subtimer = 0;
SetMetaTile(SPECIAL_META_TILE_53, this->metaTilePos, super->collisionLayer);
}
if (sub_08081CB0(this)) {
this->action = 3;
this->timer = 0;
super->action = 3;
super->timer = 0;
}
} else {
this->action = 2;
ClearFlag(this->field_0x86.HWORD);
SetMetaTileType(META_TILE_TYPE_119, this->field_0x74.HWORD, this->collisionLayer);
super->action = 2;
ClearFlag(this->unk_86);
SetMetaTileType(META_TILE_TYPE_119, this->metaTilePos, super->collisionLayer);
SoundReq(SFX_BUTTON_PRESS);
}
}
void Button_Action5(Entity* this) {
void Button_Action5(ButtonEntity* this) {
if (sub_08081F7C(this, META_TILE_TYPE_122)) {
sub_08081E6C(this);
}
}
Entity* sub_08081D74(Entity*);
Entity* sub_08081D74(ButtonEntity*);
u32 sub_08081CB0(Entity* this) {
bool32 sub_08081CB0(ButtonEntity* this) {
u16 tileType;
if (sub_08081D74(this)) {
this->field_0x70.HALF.LO = -1;
if (GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer) == SPECIAL_META_TILE_53) {
sub_0807B7D8(0x78, this->field_0x74.HWORD, this->collisionLayer);
this->unk_70 = -1;
if (GetMetaTileType(this->metaTilePos, super->collisionLayer) == SPECIAL_META_TILE_53) {
sub_0807B7D8(0x78, this->metaTilePos, super->collisionLayer);
}
return 1;
return TRUE;
} else {
tileType = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer);
tileType = GetMetaTileType(this->metaTilePos, super->collisionLayer);
if (tileType != 0x77 && tileType != 0x79 && tileType != SPECIAL_META_TILE_53) {
this->field_0x70.HALF.LO = GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer);
return 1;
this->unk_70 = GetMetaTileIndex(this->metaTilePos, super->collisionLayer);
return TRUE;
}
}
return 0;
return FALSE;
}
u32 sub_08081D28(Entity* this) {
bool32 sub_08081D28(ButtonEntity* this) {
if (sub_08081D74(this)) {
this->field_0x70.HALF_U.LO = 0xFFFF;
return 1;
this->unk_70 = 0xFFFF;
return TRUE;
} else {
if (this->field_0x70.HALF_U.LO == 0xFFFF) {
return 0;
if (this->unk_70 == 0xFFFF) {
return FALSE;
}
if (GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) {
return 0;
if (GetMetaTileIndex(this->metaTilePos, super->collisionLayer) != this->unk_70) {
return FALSE;
}
}
return 1;
return TRUE;
}
extern Entity* gPlayerClones[3];
u32 sub_08081E0C(Entity*);
Entity* sub_08081D74(Entity* this) {
Entity* sub_08081D74(ButtonEntity* this) {
Entity* ent;
if (GetCollisionDataAtMetaTilePos(this->field_0x74.HWORD, this->collisionLayer) == COLLISION_DATA_15) {
if (GetCollisionDataAtMetaTilePos(this->metaTilePos, super->collisionLayer) == COLLISION_DATA_15) {
return NULL;
}
ent = 0;
if (sub_08081E0C(this)) {
if (sub_08081E0C(super)) {
if ((gPlayerState.flags & PL_CAPTURED) == 0 && (gPlayerState.flags & PL_MINISH) == 0) {
ent = &gPlayerEntity;
}
} else {
if (gPlayerState.flags & PL_CLONING) {
if (EntityInRectRadius(this, gPlayerClones[0], 5, 6)) {
if (EntityInRectRadius(super, gPlayerClones[0], 5, 6)) {
ent = gPlayerClones[0];
} else if (EntityInRectRadius(this, gPlayerClones[1], 5, 6)) {
} else if (EntityInRectRadius(super, gPlayerClones[1], 5, 6)) {
ent = gPlayerClones[1];
} else if (EntityInRectRadius(this, gPlayerClones[2], 5, 6)) {
} else if (EntityInRectRadius(super, gPlayerClones[2], 5, 6)) {
ent = gPlayerClones[2];
}
}
}
this->child = ent;
super->child = ent;
return ent;
}
@@ -187,13 +199,13 @@ u32 sub_08081E0C(Entity* this) {
}
}
u32 sub_08081E3C(Entity* this) {
u32 sub_08081E3C(ButtonEntity* this) {
static const u16 gUnk_0811EE50[] = {
0x77, 0x78, 0x79, 0x7a, 0, 0,
};
const u16* tmp1;
s32 tmp2;
tmp2 = GetMetaTileType(this->field_0x74.HWORD, this->collisionLayer);
tmp2 = GetMetaTileType(this->metaTilePos, super->collisionLayer);
tmp1 = gUnk_0811EE50;
do {
if (*tmp1 == tmp2)
@@ -208,20 +220,20 @@ extern u16 gMapDataTopSpecial[0x2000];
extern u16 gMapDataBottomSpecial[];
void sub_08081E6C(Entity* this) {
void sub_08081E6C(ButtonEntity* this) {
u32 metaTileType;
MapLayer* mapLayer;
u16* tmp2;
u16* tmp;
u16* tmp3;
u32 metaTilePos = this->field_0x74.HWORD;
u32 layer = this->collisionLayer;
u32 metaTilePos = this->metaTilePos;
u32 layer = super->collisionLayer;
u32 specialMetaTile = GetMetaTileType(metaTilePos, layer);
if (specialMetaTile < 0x4000)
return;
mapLayer = GetLayerByIndex(layer);
metaTileType = (this->type == 0 ? META_TILE_TYPE_122 : META_TILE_TYPE_120);
metaTileType = (super->type == 0 ? META_TILE_TYPE_122 : META_TILE_TYPE_120);
tmp = mapLayer->metatiles;
tmp = tmp + (mapLayer->unkData2[metaTileType] << 2);
tmp2 = (layer == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial);
@@ -256,25 +268,25 @@ void sub_08081F24(Entity* this) {
}
}
u32 sub_08081F7C(Entity* this, u32 metaTileType) {
bool32 sub_08081F7C(ButtonEntity* this, u32 metaTileType) {
u16 tmp;
if (this->timer == 0)
return 1;
if (--this->timer > 6) {
if (this->child != NULL)
this->child->spriteOffsetY = -4;
if (super->timer == 0)
return TRUE;
if (--super->timer > 6) {
if (super->child != NULL)
super->child->spriteOffsetY = -4;
} else {
if (this->timer == 6) {
SetFlag(this->field_0x86.HWORD);
SetMetaTileType(metaTileType, this->field_0x74.HWORD, this->collisionLayer);
sub_08081F24(this);
if (super->timer == 6) {
SetFlag(this->unk_86);
SetMetaTileType(metaTileType, this->metaTilePos, super->collisionLayer);
sub_08081F24(super);
SoundReq(SFX_BUTTON_PRESS);
if (this->field_0x70.HALF_U.LO != 0xFFFF)
SetMetaTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer);
return 0;
if (this->unk_70 != 0xFFFF)
SetMetaTile(this->unk_70, this->metaTilePos, super->collisionLayer);
return FALSE;
}
}
return 1;
return TRUE;
}
void sub_08081FF8(Entity* this) {
+4 -4
View File
@@ -49,10 +49,10 @@ void CameraTarget(Entity* this) {
u32 uVar2 = gPlayerState.field_0x27[0] > 0;
switch (gFuseInfo._0) {
case 0:
case 1:
case 2:
switch (gFuseInfo.fusionState) {
case FUSION_STATE_0:
case FUSION_STATE_1:
case FUSION_STATE_2:
if ((gMessage.doTextBox & 0x7f) == 0) {
break;
}
+10 -9
View File
@@ -4,7 +4,6 @@
*
* @brief Chest Spawner object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "item.h"
@@ -150,7 +149,7 @@ void ChestSpawner_Type2Action2(ChestSpawnerEntity* this) {
void ChestSpawner_Type2Action3(ChestSpawnerEntity* this) {
sub_0800445C(super);
if (super->interactType != 0) {
if (super->interactType != INTERACTION_NONE) {
super->action = 4;
super->subtimer = 30;
RemoveInteractableObject(super);
@@ -177,12 +176,12 @@ void ChestSpawner_Type2Action4(ChestSpawnerEntity* this) {
}
}
void sub_08084074(u32 param_1) {
u8* arr = (u8*)GetCurrentRoomProperty(3);
if (arr != NULL) {
for (; arr[0] != 0; arr += 8) {
if ((arr[0] == 3) && (param_1 == arr[1])) {
CreateItemEntity(arr[2], arr[3], 0);
void sub_08084074(u32 flag) {
TileEntity* tileEntity = (TileEntity*)GetCurrentRoomProperty(3);
if (tileEntity != NULL) {
for (; tileEntity->type != 0; tileEntity++) {
if ((tileEntity->type == BIG_CHEST) && (flag == tileEntity->localFlag)) {
CreateItemEntity(tileEntity->_2, tileEntity->_3, 0);
return;
}
}
@@ -190,7 +189,9 @@ void sub_08084074(u32 param_1) {
}
void sub_080840A8(s32 x, s32 y) {
static const u8 gUnk_0811F838[] = { 84, 84, 84, 84, 85, 85, 85, 86 };
static const u8 gUnk_0811F838[] = {
ITEM_RUPEE1, ITEM_RUPEE1, ITEM_RUPEE1, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE5, ITEM_RUPEE5, ITEM_RUPEE20,
};
static const s32 zVelocities[] = { 0x60000, 0x70000, 0x80000, 0x90000 };
static const s8 xOffsets[] = { -6, 0, 0, 6 };
Entity* obj = CreateObject(GROUND_ITEM, gUnk_0811F838[Random() & 7], 0);
+65 -71
View File
@@ -4,114 +4,108 @@
*
* @brief Chuchu Boss Cutscene object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "menu.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
} ChuchuBossCutsceneEntity;
void ChuchuBossCutscene_Init(Entity*);
void ChuchuBossCutscene_Action1(Entity*);
void ChuchuBossCutscene_Action2(Entity*);
void ChuchuBossCutscene_Action3(Entity*);
void ChuchuBossCutscene_Action4(Entity*);
void ChuchuBossCutscene_Action5(Entity*);
void ChuchuBossCutscene_Action6(Entity*);
void ChuchuBossCutscene_Action7(Entity*);
void ChuchuBossCutscene_Init(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action1(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action2(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action3(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action4(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action5(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action6(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene_Action7(ChuchuBossCutsceneEntity*);
void ChuchuBossCutscene(ChuchuBossCutsceneEntity* this) {
static void (*const ChuchuBossCutscene_Actions[])(ChuchuBossCutsceneEntity*) = {
void ChuchuBossCutscene(Entity* this) {
static void (*const ChuchuBossCutscene_Actions[])(Entity*) = {
ChuchuBossCutscene_Init, ChuchuBossCutscene_Action1, ChuchuBossCutscene_Action2, ChuchuBossCutscene_Action3,
ChuchuBossCutscene_Action4, ChuchuBossCutscene_Action5, ChuchuBossCutscene_Action6, ChuchuBossCutscene_Action7,
};
ChuchuBossCutscene_Actions[super->action](this);
ChuchuBossCutscene_Actions[this->action](this);
}
void ChuchuBossCutscene_Init(ChuchuBossCutsceneEntity* this) {
super->action = 1;
super->timer = 60;
InitializeAnimation(super, 0);
void ChuchuBossCutscene_Init(Entity* this) {
this->action = 1;
this->timer = 60;
InitializeAnimation(this, 0);
}
void ChuchuBossCutscene_Action1(ChuchuBossCutsceneEntity* this) {
if (--super->timer == 0) {
super->timer = 120;
super->action++;
super->spriteSettings.draw = 1;
void ChuchuBossCutscene_Action1(Entity* this) {
if (--this->timer == 0) {
this->timer = 120;
this->action++;
this->spriteSettings.draw = 1;
}
}
void ChuchuBossCutscene_Action2(ChuchuBossCutsceneEntity* this) {
GetNextFrame(super);
if ((super->frame & ANIM_DONE) != 0) {
super->action++;
super->spritePriority.b1 = 3;
InitializeAnimation(super, 2);
void ChuchuBossCutscene_Action2(Entity* this) {
GetNextFrame(this);
if ((this->frame & ANIM_DONE) != 0) {
this->action++;
this->spritePriority.b1 = 3;
InitializeAnimation(this, 2);
}
}
void ChuchuBossCutscene_Action3(ChuchuBossCutsceneEntity* this) {
GetNextFrame(super);
if (--super->timer == 0) {
super->action++;
super->direction = 0;
super->speed = 0x100;
super->zVelocity = Q_16_16(2.0);
super->spriteOrientation.flipY = 0;
super->timer = 0;
InitializeAnimation(super, 3);
void ChuchuBossCutscene_Action3(Entity* this) {
GetNextFrame(this);
if (--this->timer == 0) {
this->action++;
this->direction = DirectionNorth;
this->speed = 0x100;
this->zVelocity = Q_16_16(2.0);
this->spriteOrientation.flipY = 0;
this->timer = 0;
InitializeAnimation(this, 3);
SoundReq(SFX_12B);
}
}
void ChuchuBossCutscene_Action4(ChuchuBossCutsceneEntity* this) {
if ((super->frame & 0x10) != 0) {
LinearMoveUpdate(super);
if (GravityUpdate(super, Q_8_8(32.0)) == 0) {
GetNextFrame(super);
void ChuchuBossCutscene_Action4(Entity* this) {
if ((this->frame & 0x10) != 0) {
LinearMoveUpdate(this);
if (GravityUpdate(this, Q_8_8(32.0)) == 0) {
GetNextFrame(this);
}
} else {
GetNextFrame(super);
GetNextFrame(this);
}
if ((super->y.HALF.HI - gRoomControls.origin_y) < 0x231) {
super->y.HALF.HI = gRoomControls.origin_y + 0x230;
if ((super->frame & ANIM_DONE) != 0) {
super->action++;
super->timer = 120;
InitializeAnimation(super, 2);
if ((this->y.HALF.HI - gRoomControls.origin_y) < 0x231) {
this->y.HALF.HI = gRoomControls.origin_y + 0x230;
if ((this->frame & ANIM_DONE) != 0) {
this->action++;
this->timer = 120;
InitializeAnimation(this, 2);
}
} else if ((super->frame & ANIM_DONE) != 0) {
super->zVelocity = Q_16_16(2.0);
InitializeAnimation(super, 3);
} else if ((this->frame & ANIM_DONE) != 0) {
this->zVelocity = Q_16_16(2.0);
InitializeAnimation(this, 3);
SoundReq(SFX_12B);
}
}
void ChuchuBossCutscene_Action5(ChuchuBossCutsceneEntity* this) {
GetNextFrame(super);
if (--super->timer == 0) {
super->action++;
InitializeAnimation(super, 5);
void ChuchuBossCutscene_Action5(Entity* this) {
GetNextFrame(this);
if (--this->timer == 0) {
this->action++;
InitializeAnimation(this, 5);
}
}
void ChuchuBossCutscene_Action6(ChuchuBossCutsceneEntity* this) {
GetNextFrame(super);
if ((super->frame & ANIM_DONE) != 0) {
super->action++;
super->timer = 60;
InitializeAnimation(super, 1);
void ChuchuBossCutscene_Action6(Entity* this) {
GetNextFrame(this);
if ((this->frame & ANIM_DONE) != 0) {
this->action++;
this->timer = 60;
InitializeAnimation(this, 1);
}
}
void ChuchuBossCutscene_Action7(ChuchuBossCutsceneEntity* this) {
GetNextFrame(super);
if (--super->timer == 0) {
void ChuchuBossCutscene_Action7(Entity* this) {
GetNextFrame(this);
if (--this->timer == 0) {
gMenu.overlayType++;
DeleteThisEntity();
}
+1 -1
View File
@@ -1,10 +1,10 @@
#define NENT_DEPRECATED
/**
* @file chuchuBossParticle.c
* @ingroup Objects
*
* @brief Chuchu Boss Particle object
*/
#define NENT_DEPRECATED
#include "entity.h"
void ChuchuBossParticle_Init(Entity*);
+182 -165
View File
@@ -4,247 +4,264 @@
*
* @brief Chuchu Boss Start Particle object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
static void sub_0808F2B0(Entity*);
void sub_0808F14C(Entity*);
void sub_0808F244(Entity*);
void sub_0808F0B8(Entity*);
void sub_0808F1E0(Entity*);
void sub_0808F2C0(Entity*);
void sub_0808F370(Entity*);
void sub_0808F3DC(Entity*);
void sub_0808F498(Entity*);
void sub_0808F554(Entity*);
void sub_0808F0D0(Entity*);
void sub_0808F170(Entity*);
void sub_0808F1A4(Entity*);
void sub_0808F244(Entity*);
void sub_0808F1F8(Entity*);
void sub_0808F5EC(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[5];
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unused2[2];
/*0x70*/ u32 unk_70;
/*0x74*/ u32 unk_74;
/*0x78*/ u32 unk_78;
/*0x7c*/ u8 unused3[3];
/*0x7f*/ u8 unk_7f;
/*0x80*/ u8 unused4[4];
/*0x84*/ u32 unk_84;
} ChuchuBossStartParticleEntity;
void ChuchuBossStartParticle(Entity* this) {
static void (*const typeFuncs[])(Entity*) = {
sub_0808F0B8, sub_0808F1E0, sub_0808F2C0, sub_0808F370, sub_0808F0B8, sub_0808F3DC,
sub_0808F3DC, sub_0808F3DC, sub_0808F3DC, sub_0808F498, sub_0808F554,
static void sub_0808F2B0(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type0_Action1(ChuchuBossStartParticleEntity* this);
void sub_0808F244(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type0(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type1(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type2(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type3(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type5(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type9(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type10(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type0_Init(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type0_Action2(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle_Type0_Action3(ChuchuBossStartParticleEntity* this);
void sub_0808F244(ChuchuBossStartParticleEntity* this);
void sub_0808F1F8(ChuchuBossStartParticleEntity* this);
void sub_0808F5EC(ChuchuBossStartParticleEntity* this);
void ChuchuBossStartParticle(ChuchuBossStartParticleEntity* this) {
static void (*const ChuchuBossStartParticle_Types[])(ChuchuBossStartParticleEntity*) = {
ChuchuBossStartParticle_Type0, ChuchuBossStartParticle_Type1, ChuchuBossStartParticle_Type2,
ChuchuBossStartParticle_Type3, ChuchuBossStartParticle_Type0, ChuchuBossStartParticle_Type5,
ChuchuBossStartParticle_Type5, ChuchuBossStartParticle_Type5, ChuchuBossStartParticle_Type5,
ChuchuBossStartParticle_Type9, ChuchuBossStartParticle_Type10,
};
typeFuncs[this->type](this);
ChuchuBossStartParticle_Types[super->type](this);
}
void sub_0808F0B8(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
sub_0808F0D0,
sub_0808F14C,
sub_0808F170,
sub_0808F1A4,
void ChuchuBossStartParticle_Type0(ChuchuBossStartParticleEntity* this) {
static void (*const ChuchuBossStartParticle_Type0_Actions[])(ChuchuBossStartParticleEntity*) = {
ChuchuBossStartParticle_Type0_Init,
ChuchuBossStartParticle_Type0_Action1,
ChuchuBossStartParticle_Type0_Action2,
ChuchuBossStartParticle_Type0_Action3,
};
actionFuncs[this->action](this);
ChuchuBossStartParticle_Type0_Actions[super->action](this);
}
void sub_0808F0D0(Entity* this) {
void ChuchuBossStartParticle_Type0_Init(ChuchuBossStartParticleEntity* this) {
u32 offsetX;
u32 offsetY;
Entity* ent;
u32 uVar3;
ent = CreateObjectWithParent(this, CHUCHU_BOSS_START_PARTICLE, 2, 0);
this->child = ent;
ent = CreateObjectWithParent(super, CHUCHU_BOSS_START_PARTICLE, 2, 0);
super->child = ent;
if (ent == NULL) {
DeleteThisEntity();
}
this->action = 1;
this->z.HALF.HI = -0xc0;
super->action = 1;
super->z.HALF.HI = -0xc0;
offsetX = Random() % 64;
if ((Random() & 1) != 0) {
offsetX = -offsetX;
}
this->x.HALF.HI = this->parent->x.HALF.HI + offsetX;
super->x.HALF.HI = super->parent->x.HALF.HI + offsetX;
offsetY = Random() % 32;
if ((Random() & 1) != 0) {
offsetY = -offsetY;
}
this->y.HALF.HI = this->parent->y.HALF.HI + offsetY;
*(u32*)&this->field_0x74 = 0x240;
*(u32*)&this->field_0x78 = 0x140;
InitializeAnimation(this, 3);
sub_0808F14C(this);
super->y.HALF.HI = super->parent->y.HALF.HI + offsetY;
this->unk_74 = 0x240;
this->unk_78 = 0x140;
InitializeAnimation(super, 3);
ChuchuBossStartParticle_Type0_Action1(this);
}
void sub_0808F14C(Entity* this) {
void ChuchuBossStartParticle_Type0_Action1(ChuchuBossStartParticleEntity* this) {
sub_0808F2B0(this);
if (GravityUpdate(this, Q_8_8(32.0)) == 0) {
this->action++;
if (GravityUpdate(super, Q_8_8(32.0)) == 0) {
super->action++;
SoundReq(SFX_WATER_SPLASH);
}
}
void sub_0808F170(Entity* this) {
*(u32*)&this->field_0x74 -= 0x20;
*(u32*)&this->field_0x78 += 0x20;
sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2);
if (*(u32*)&this->field_0x78 > 0x1ff) {
this->action++;
void ChuchuBossStartParticle_Type0_Action2(ChuchuBossStartParticleEntity* this) {
this->unk_74 -= 0x20;
this->unk_78 += 0x20;
sub_0806FCF4(super, this->unk_78, 8, 2);
if (this->unk_78 > 0x1ff) {
super->action++;
}
sub_0808F2B0(this);
}
void sub_0808F1A4(Entity* this) {
*(u32*)&this->field_0x78 += 0x10;
*(u32*)&this->field_0x74 += 0x10;
sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2);
if (*(u32*)&this->field_0x78 > 0x3ff) {
this->child->action = 0xff;
void ChuchuBossStartParticle_Type0_Action3(ChuchuBossStartParticleEntity* this) {
this->unk_78 += 0x10;
this->unk_74 += 0x10;
sub_0806FCF4(super, this->unk_78, 8, 2);
if (this->unk_78 > 0x3ff) {
super->child->action = 0xff;
DeleteThisEntity();
} else {
sub_0808F2B0(this);
}
}
void sub_0808F1E0(Entity* this) {
static void (*const actionFuncs[])(Entity*) = {
void ChuchuBossStartParticle_Type1(ChuchuBossStartParticleEntity* this) {
static void (*const actionFuncs[])(ChuchuBossStartParticleEntity*) = {
sub_0808F1F8,
sub_0808F244,
};
actionFuncs[this->action](this);
actionFuncs[super->action](this);
}
void sub_0808F1F8(Entity* this) {
void sub_0808F1F8(ChuchuBossStartParticleEntity* this) {
u8 bVar1;
this->spriteRendering.b0 = 3;
this->action++;
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->spritePriority.b0 = 7;
InitializeAnimation(this, 1);
super->spriteRendering.b0 = 3;
super->action++;
super->spriteRendering.b3 = super->parent->spriteRendering.b3;
super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY;
super->spritePriority.b0 = 7;
InitializeAnimation(super, 1);
sub_0808F244(this);
}
void sub_0808F244(Entity* this) {
void sub_0808F244(ChuchuBossStartParticleEntity* this) {
this->spriteSettings.draw = this->parent->spriteSettings.draw;
this->y.HALF.HI = this->parent->y.HALF.HI + 3;
this->x.HALF.HI = (*(s8*)&this->child->spriteOffsetX + this->child->x.HALF.HI);
this->z.WORD = 0;
*(u32*)&this->field_0x74 = 0x80 - this->parent->z.HALF.HI;
*(u32*)&this->field_0x78 = 0x100 - this->parent->z.HALF.HI;
*(u32*)&this->field_0x70.WORD = *((u8*)&this->parent->field_0x7c + 3);
super->spriteSettings.draw = super->parent->spriteSettings.draw;
super->y.HALF.HI = super->parent->y.HALF.HI + 3;
super->x.HALF.HI = (*(s8*)&super->child->spriteOffsetX + super->child->x.HALF.HI);
super->z.WORD = 0;
this->unk_74 = 0x80 - super->parent->z.HALF.HI;
this->unk_78 = 0x100 - super->parent->z.HALF.HI;
this->unk_70 = ((ChuchuBossStartParticleEntity*)super->parent)->unk_7f;
sub_0808F2B0(this);
if ((this->parent->field_0x6c.HALF.HI & 2) != 0) {
if ((((ChuchuBossStartParticleEntity*)super->parent)->unk_6d & 2) != 0) {
DeleteThisEntity();
}
}
static void sub_0808F2B0(Entity* this) {
SetAffineInfo(this, *(u32*)&this->field_0x74, *(u32*)&this->field_0x78, this->field_0x70.WORD);
static void sub_0808F2B0(ChuchuBossStartParticleEntity* this) {
SetAffineInfo(super, this->unk_74, this->unk_78, this->unk_70);
}
void sub_0808F2C0(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->spriteSettings.draw = 1;
this->spritePriority.b0 = 7;
this->z.WORD = 0;
void ChuchuBossStartParticle_Type2(ChuchuBossStartParticleEntity* this) {
if (super->action == 0) {
super->action++;
super->spriteRendering.b3 = super->parent->spriteRendering.b3;
super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY;
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 7;
super->z.WORD = 0;
this->y.HALF.HI = this->parent->y.HALF.HI + 3;
this->x.HALF.HI = this->parent->x.HALF.HI;
InitializeAnimation(this, 3);
super->y.HALF.HI = super->parent->y.HALF.HI + 3;
super->x.HALF.HI = super->parent->x.HALF.HI;
InitializeAnimation(super, 3);
}
if (this->parent->z.HALF.HI == 0) {
*(u32*)&this->field_0x74 = *(u32*)&this->parent->field_0x74;
*(u32*)&this->field_0x78 = *(u32*)&this->parent->field_0x78;
if (super->parent->z.HALF.HI == 0) {
this->unk_74 = ((ChuchuBossStartParticleEntity*)super->parent)->unk_74;
this->unk_78 = ((ChuchuBossStartParticleEntity*)super->parent)->unk_78;
} else {
*(u32*)&this->field_0x74 = 0x200 - this->parent->z.HALF.HI;
*(u32*)&this->field_0x78 = this->parent->z.HALF.HI * -2 + 0x300;
this->unk_74 = 0x200 - super->parent->z.HALF.HI;
this->unk_78 = super->parent->z.HALF.HI * -2 + 0x300;
}
*(u32*)&this->field_0x70 = 0;
this->unk_70 = 0;
sub_0808F2B0(this);
sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2);
if (this->action == 0xff) {
sub_0806FCF4(super, this->unk_78, 8, 2);
if (super->action == 0xff) {
DeleteThisEntity();
}
}
void sub_0808F370(Entity* this) {
void ChuchuBossStartParticle_Type3(ChuchuBossStartParticleEntity* this) {
static const u16 gUnk_08121EA0[] = { 0x1a4, 0x12c };
if (this->action == 0) {
if (this->parent->subAction == 1) {
this->action = 1;
this->field_0x70.WORD = 0;
if (super->action == 0) {
if (super->parent->subAction == 1) {
super->action = 1;
this->unk_70 = 0;
sub_0808F5EC(this);
}
} else {
u8 flag = this->parent->subAction - 1;
u8 flag = super->parent->subAction - 1;
if (flag < 5) {
if (this->field_0x70.WORD == 0) {
if (--(*(u32*)&this->field_0x74) == -1) {
this->field_0x70.WORD = gUnk_08121EA0[Random() & 1];
if (this->unk_70 == 0) {
if (--(this->unk_74) == -1) {
this->unk_70 = gUnk_08121EA0[Random() & 1];
}
} else {
if (--this->field_0x70.WORD == 0) {
if (--this->unk_70 == 0) {
sub_0808F5EC(this);
}
}
} else {
this->action = 0;
*(u32*)&this->field_0x74 = 0;
super->action = 0;
this->unk_74 = 0;
}
}
}
void sub_0808F3DC(Entity* this) {
if (this->action == 0) {
this->spriteSettings.draw = 1;
this->action = 1;
this->timer = 120;
InitializeAnimation(this, this->type + 1);
void ChuchuBossStartParticle_Type5(ChuchuBossStartParticleEntity* this) {
if (super->action == 0) {
super->spriteSettings.draw = 1;
super->action = 1;
super->timer = 120;
InitializeAnimation(super, super->type + 1);
// TODO: This block of code might supposed to be a switch statement.
if (this->type != 8) {
if (this->type == 7) {
SortEntityBelow(this->child, this);
if (super->type != 8) {
if (super->type == 7) {
SortEntityBelow(super->child, super);
return;
}
} else {
this->hitType = this->child->hitType;
this->child->hitType = 0x7E;
super->hitType = super->child->hitType;
super->child->hitType = 0x7E;
}
SortEntityAbove(this->child, this);
SortEntityAbove(super->child, super);
} else {
if (*(u32*)&this->parent->field_0x74 == 0) {
if (this->type == 8) {
this->child->hitType = this->hitType;
if (((ChuchuBossStartParticleEntity*)super->parent)->unk_74 == 0) {
if (super->type == 8) {
super->child->hitType = super->hitType;
}
DeleteThisEntity();
}
if (this->type == 5 && (this->frame & 1)) {
Entity* entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 8, 0);
if (super->type == 5 && (super->frame & 1)) {
Entity* entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 8, 0);
if (entity != NULL) {
entity->parent = this->parent;
entity->child = this->parent->parent;
entity->parent = super->parent;
entity->child = super->parent->parent;
}
}
GetNextFrame(this);
CopyPositionAndSpriteOffset(this->child, this);
GetNextFrame(super);
CopyPositionAndSpriteOffset(super->child, super);
}
}
void sub_0808F498(Entity* this) {
void ChuchuBossStartParticle_Type9(ChuchuBossStartParticleEntity* this) {
u32 var0;
if (this->action != 0) {
if (sub_0806F3E4(this)) {
if (super->action != 0) {
if (sub_0806F3E4(super)) {
if (gRoomTransition.frameCount % 16 == 0) {
SoundReq(SFX_EF);
}
DeleteThisEntity();
}
if (this->timer-- == 0) {
if (super->timer-- == 0) {
DeleteThisEntity();
}
@@ -252,59 +269,59 @@ void sub_0808F498(Entity* this) {
DeleteThisEntity();
}
} else {
this->action = 1;
this->timer = 64;
var0 = this->type2 != 0 ? 44 : 43;
this->x.HALF.HI -= this->parent->hitbox->width;
this->x.HALF.HI += (s32)Random() % (this->parent->hitbox->width * 2);
this->y.HALF.HI -= this->parent->hitbox->height;
this->y.HALF.HI += (s32)Random() % (this->parent->hitbox->height * 2);
ChangeObjPalette(this, var0);
InitializeAnimation(this, 4);
super->action = 1;
super->timer = 64;
var0 = super->type2 != 0 ? 44 : 43;
super->x.HALF.HI -= super->parent->hitbox->width;
super->x.HALF.HI += (s32)Random() % (super->parent->hitbox->width * 2);
super->y.HALF.HI -= super->parent->hitbox->height;
super->y.HALF.HI += (s32)Random() % (super->parent->hitbox->height * 2);
ChangeObjPalette(super, var0);
InitializeAnimation(super, 4);
}
}
void sub_0808F554(Entity* this) {
CopyPositionAndSpriteOffset(this->parent, this);
this->spriteOffsetY -= 24;
if ((s8)this->parent->spriteOffsetX != 0) {
this->spriteOffsetX += (s8)this->parent->spriteOffsetX / 2;
void ChuchuBossStartParticle_Type10(ChuchuBossStartParticleEntity* this) {
CopyPositionAndSpriteOffset(super->parent, super);
super->spriteOffsetY -= 24;
if ((s8)super->parent->spriteOffsetX != 0) {
super->spriteOffsetX += (s8)super->parent->spriteOffsetX / 2;
}
if (this->action != 0) {
if (*(u32*)&this->cutsceneBeh) {
if (--(*(u32*)&this->cutsceneBeh) == 0) {
if (super->action != 0) {
if (this->unk_84) {
if (--(this->unk_84) == 0) {
DeleteThisEntity();
}
}
GetNextFrame(this);
GetNextFrame(super);
} else {
this->action = 1;
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->spritePriority.b0 = 0;
InitializeAnimation(this, 3);
super->action = 1;
super->spriteRendering.b3 = super->parent->spriteRendering.b3;
super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY;
super->spritePriority.b0 = 0;
InitializeAnimation(super, 3);
}
}
void sub_0808F5EC(Entity* this) {
Entity* entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 5, 0);
void sub_0808F5EC(ChuchuBossStartParticleEntity* this) {
Entity* entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 5, 0);
if (entity != NULL) {
entity->parent = this;
entity->child = this->child;
entity->parent = super;
entity->child = super->child;
}
entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 6, 0);
entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 6, 0);
if (entity != NULL) {
entity->parent = this;
entity->child = this->child;
entity->parent = super;
entity->child = super->child;
}
entity = CreateObjectWithParent(this->child, CHUCHU_BOSS_START_PARTICLE, 7, 0);
entity = CreateObjectWithParent(super->child, CHUCHU_BOSS_START_PARTICLE, 7, 0);
if (entity != NULL) {
entity->parent = this;
entity->child = this->child;
entity->parent = super;
entity->child = super->child;
}
*(u32*)&this->field_0x74 = 600;
this->unk_74 = 600;
}
+79 -73
View File
@@ -4,69 +4,75 @@
*
* @brief Cloud object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
#include "structures.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68;
} CloudEntity;
void sub_0809F814(u32 r0);
void sub_0809F7BC(Entity*);
void sub_0809F7F4(Entity*);
void Cloud_Type0(Entity*);
void Cloud_Type1(Entity*);
void sub_0809F514(Entity*);
void sub_0809F548(Entity*);
void sub_0809F5B0(Entity*);
void sub_0809F6CC(Entity*);
void sub_0809F69C(Entity*);
void sub_0809F61C(Entity*);
void sub_0809F5F0(Entity*);
void sub_0809F5DC(Entity*);
void sub_0809F7BC(CloudEntity* this);
void sub_0809F7F4(CloudEntity* this);
void Cloud_Type0(CloudEntity* this);
void Cloud_Type1(CloudEntity* this);
void sub_0809F514(CloudEntity* this);
void sub_0809F548(CloudEntity* this);
void sub_0809F5B0(CloudEntity* this);
void sub_0809F6CC(CloudEntity* this);
void sub_0809F69C(CloudEntity* this);
void sub_0809F61C(CloudEntity* this);
void sub_0809F5F0(CloudEntity* this);
void sub_0809F5DC(CloudEntity* this);
extern void* gUnk_080DD750;
void Cloud(Entity* this) {
static void (*const Cloud_Types[])(Entity*) = {
void Cloud(CloudEntity* this) {
static void (*const Cloud_Types[])(CloudEntity*) = {
Cloud_Type0,
Cloud_Type1,
};
Cloud_Types[this->type](this);
Cloud_Types[super->type](this);
}
void Cloud_Type0(Entity* this) {
static void (*const gUnk_081247A0[])(Entity*) = {
void Cloud_Type0(CloudEntity* this) {
static void (*const gUnk_081247A0[])(CloudEntity*) = {
sub_0809F514,
sub_0809F548,
sub_0809F5B0,
};
static void (*const gUnk_081247AC[])(Entity*) = {
static void (*const gUnk_081247AC[])(CloudEntity*) = {
sub_0809F5DC, sub_0809F5F0, sub_0809F61C, sub_0809F69C, sub_0809F6CC,
};
if (this->type2 == 0) {
gUnk_081247A0[this->action](this);
if (super->type2 == 0) {
gUnk_081247A0[super->action](this);
} else {
gUnk_081247AC[this->action](this);
gUnk_081247AC[super->action](this);
}
}
void sub_0809F514(Entity* this) {
this->action = 1;
this->timer = 120;
this->spriteSettings.draw = 0;
this->field_0x68.HALF.LO = 12;
gRoomControls.camera_target = this;
void sub_0809F514(CloudEntity* this) {
super->action = 1;
super->timer = 120;
super->spriteSettings.draw = 0;
this->unk_68 = 12;
gRoomControls.camera_target = super;
gPauseMenuOptions.disabled = 255;
sub_0809F7BC(this);
}
void sub_0809F548(Entity* this) {
void sub_0809F548(CloudEntity* this) {
if (--this->timer == 0) {
this->action = 2;
this->timer = 90;
if (--super->timer == 0) {
super->action = 2;
super->timer = 90;
SoundReq(SFX_11D);
sub_0809F814((((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6);
sub_0809F814((((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) |
(((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6);
} else {
if ((gRoomTransition.frameCount & 7) == 0) {
sub_0809F7BC(this);
@@ -75,8 +81,8 @@ void sub_0809F548(Entity* this) {
}
}
void sub_0809F5B0(Entity* this) {
if (--this->timer == 0) {
void sub_0809F5B0(CloudEntity* this) {
if (--super->timer == 0) {
SoundReq(SFX_SECRET_BIG);
SetGlobalFlag(KUMOTATSUMAKI);
LoadRoomEntityList((EntityData*)&gUnk_080DD750);
@@ -84,37 +90,37 @@ void sub_0809F5B0(Entity* this) {
}
}
void sub_0809F5DC(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 0;
this->field_0x68.HALF.LO = 12;
void sub_0809F5DC(CloudEntity* this) {
super->action = 1;
super->spriteSettings.draw = 0;
this->unk_68 = 12;
}
void sub_0809F5F0(Entity* this) {
void sub_0809F5F0(CloudEntity* this) {
u32 iVar1;
iVar1 = CheckRoomFlag(this->timer);
iVar1 = CheckRoomFlag(super->timer);
if (iVar1 != 0) {
this->action = 2;
this->timer = 120;
super->action = 2;
super->timer = 120;
SetPlayerControl(3);
sub_08078B48();
gRoomControls.camera_target = this;
gRoomControls.camera_target = super;
}
}
void sub_0809F61C(Entity* this) {
void sub_0809F61C(CloudEntity* this) {
if ((gRoomControls.scroll_flags & 4) == 0) {
if (this->timer == 30) {
SetLocalFlag(this->type2);
if (super->timer == 30) {
SetLocalFlag(super->type2);
}
if (--this->timer == 0) {
this->action = 3;
this->timer = 120;
if (--super->timer == 0) {
super->action = 3;
super->timer = 120;
SoundReq(SFX_11D);
sub_0809F814((((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6);
sub_0809F814((((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) |
(((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6);
} else {
if ((gRoomTransition.frameCount & 7) == 0) {
sub_0809F7BC(this);
@@ -124,54 +130,54 @@ void sub_0809F61C(Entity* this) {
}
}
void sub_0809F69C(Entity* this) {
void sub_0809F69C(CloudEntity* this) {
if (--this->timer == 0) {
this->timer = 30;
this->action = 4;
if (--super->timer == 0) {
super->timer = 30;
super->action = 4;
gRoomControls.camera_target = &gPlayerEntity;
SoundReq(SFX_SECRET_BIG);
}
}
void sub_0809F6CC(Entity* this) {
void sub_0809F6CC(CloudEntity* this) {
if (((gRoomControls.scroll_flags & 4) == 0) && (--this->timer == 0)) {
if (((gRoomControls.scroll_flags & 4) == 0) && (--super->timer == 0)) {
gPlayerState.controlMode = CONTROL_1;
DeleteThisEntity();
}
}
void Cloud_Type1(Entity* this) {
void Cloud_Type1(CloudEntity* this) {
static const s8 gUnk_081247C0[] = {
-1, 1, 2, -2, 0, 1, 0, -1,
};
u8 bVar1;
u32 uVar2;
if (this->action == 0) {
this->action = 1;
this->timer = (Random() & 30) + 8;
this->flags = this->flags | 12;
if (super->action == 0) {
super->action = 1;
super->timer = (Random() & 30) + 8;
super->flags = super->flags | 12;
}
if ((gRoomTransition.frameCount & 3) == 0) {
uVar2 = Random();
this->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
super->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
super->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
}
LinearMoveUpdate(this);
if (--this->timer == 0) {
LinearMoveUpdate(super);
if (--super->timer == 0) {
DeleteThisEntity();
}
}
Entity* sub_0809F770(Entity* this) {
Entity* sub_0809F770(CloudEntity* this) {
Entity* cloud;
int uVar1;
cloud = CreateObject(CLOUD, 1, 0);
if (cloud) {
PositionEntityOnTop(this, cloud);
PositionEntityOnTop(super, cloud);
uVar1 = Random();
cloud->x.HALF.HI += ((uVar1 >> 0) & 31) - 16;
cloud->y.HALF.HI += ((uVar1 >> 8) & 31) - 16;
@@ -181,7 +187,7 @@ Entity* sub_0809F770(Entity* this) {
return cloud;
}
void sub_0809F7BC(Entity* this) {
void sub_0809F7BC(CloudEntity* this) {
static const u16 gUnk_081247C8[] = { 0x100, 0x180, 0x200, 0x280 };
Entity* cloud;
u32 uVar1;
@@ -197,9 +203,9 @@ void sub_0809F7BC(Entity* this) {
}
}
void sub_0809F7F4(Entity* this) {
if (--this->field_0x68.HALF.LO == 0) {
this->field_0x68.HALF.LO = 12;
void sub_0809F7F4(CloudEntity* this) {
if (--this->unk_68 == 0) {
this->unk_68 = 12;
SoundReq(SFX_184);
}
}
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
void CrackingGround(Entity* this) {
+2 -3
View File
@@ -4,7 +4,6 @@
*
* @brief Crenel Bean Sprout object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "functions.h"
@@ -139,7 +138,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
if (super->parent->action == 2) {
switch (super->parent->subAction) {
case 1:
if ((gPlayerState.direction & 0x80) != 0) {
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) {
InitializeAnimation(super, 4);
} else {
GetNextFrame(super);
@@ -162,7 +161,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
} else {
gPlayerState.mobility |= 0x80;
gPlayerState.heldObject = 5;
if ((gPlayerState.direction & 0x80) != 0) {
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) {
InitializeAnimation(super, (super->type >> 1) + 3);
} else {
GetNextFrame(super);
+40 -36
View File
@@ -109,60 +109,65 @@ void CuccoMinigame(CuccoMinigameEntity* this) {
sub_0807DD64(super);
sub_0806EC20(super);
}
sub_0807DD94(super, 0);
ExecuteScriptAndHandleAnimation(super, NULL);
}
NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMinigameEntity* this)) {
s32 iVar1;
int iVar2;
s32 iVar4;
s32 sVar6;
int iVar7;
s8* ptr;
s32 val;
void sub_080A1270(CuccoMinigameEntity* this) {
s32 numReturnedCuccos;
FORCE_REGISTER(int index, r10);
s8* returnedArray;
Entity* pEnt;
Entity** entArray;
u16 cageX, cageY;
s32 castedCageX, castedCageY;
s32 one;
FORCE_REGISTER(s16 minusOne, r5);
numReturnedCuccos = 0;
sVar6 = 0;
entArray = ((Entity**)super->myHeap);
ptr = this->returnedCuccoTypes;
iVar1 = (gRoomControls.origin_x + 0x360);
iVar4 = (gRoomControls.origin_y + 0x350);
iVar1 = (iVar1 << 16) >> 16;
iVar4 = (iVar4 << 16) >> 16;
val = -1;
returnedArray = this->returnedCuccoTypes;
for (iVar7 = 0; iVar7 < 9; iVar7++) {
pEnt = entArray[iVar7];
if (((s8*)ptr)[iVar7] == 0) {
cageX = (gRoomControls.origin_x + 0x360);
cageY = (gRoomControls.origin_y + 0x350);
castedCageX = (s16)cageX;
castedCageY = (s16)cageY;
index = 9;
one = 1;
minusOne = -one;
do {
pEnt = *entArray;
if (*returnedArray == 0) { // this cucco not saved
if (pEnt->next != NULL && pEnt != NULL) {
if ((iVar1 <= pEnt->x.HALF.HI) && (iVar4 <= pEnt->y.HALF.HI)) {
ptr[iVar7] = pEnt->type + 1;
if ((castedCageX <= pEnt->x.HALF.HI) && (castedCageY <= pEnt->y.HALF.HI)) {
returnedArray[0] = pEnt->type + one;
pEnt->type2 = 1;
sVar6++;
numReturnedCuccos++;
SoundReq(CuccoMinigame_Sounds[pEnt->type]);
}
} else {
((s8*)ptr)[iVar7] = val;
*returnedArray = minusOne;
}
} else if (0 < (s8)ptr[iVar7]) {
sVar6++;
} else if (*returnedArray > 0) { // this cucco saved
numReturnedCuccos++;
if (pEnt->next != NULL && pEnt != NULL) {
iVar2 = iVar1 + 4;
if (iVar2 > pEnt->x.HALF.HI) {
pEnt->x.HALF.HI = iVar2;
if (castedCageX + 4 > pEnt->x.HALF.HI) {
pEnt->x.HALF.HI = castedCageX + 4;
}
iVar2 = iVar4 + 4;
if (iVar2 > pEnt->y.HALF.HI) {
pEnt->y.HALF.HI = iVar2;
if (castedCageY + 4 > pEnt->y.HALF.HI) {
pEnt->y.HALF.HI = castedCageY + 4;
}
} else {
((s8*)ptr)[iVar7] = val;
*returnedArray = minusOne;
}
}
}
index--, returnedArray++, entArray++;
} while (index >= 0);
this->currentCuccos = sVar6;
this->currentCuccos = numReturnedCuccos;
gPlayerState.field_0x27[0] = 0xff;
if (--this->timer < 1) {
SoundReq(SFX_CUCCO_MINIGAME_BELL);
@@ -171,7 +176,6 @@ NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMi
gActiveScriptInfo.commandSize = 0;
}
}
END_NONMATCH
void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) {
Entity** puVar1;
@@ -211,7 +215,7 @@ void CuccoMinigame_WinItem(CuccoMinigameEntity* this) {
}
break;
case ITEM_KINSTONE:
if (gSave.didAllFusions) {
if (gSave.kinstones.didAllFusions) {
skipItem = 1;
}
break;
+96 -102
View File
@@ -68,49 +68,41 @@ typedef struct {
typedef void(CutsceneMiscObjectTypeAction)(CutsceneMiscObjectEntity*);
CutsceneMiscObjectTypeAction sub_08094A5C;
CutsceneMiscObjectTypeAction sub_08094A90;
CutsceneMiscObjectTypeAction sub_08094C30;
CutsceneMiscObjectTypeAction sub_08094C88;
CutsceneMiscObjectTypeAction sub_08094D94;
CutsceneMiscObjectTypeAction sub_08094E30;
CutsceneMiscObjectTypeAction sub_08094FA8;
CutsceneMiscObjectTypeAction sub_08095088;
CutsceneMiscObjectTypeAction sub_08095120;
CutsceneMiscObjectTypeAction sub_08095188;
CutsceneMiscObjectTypeAction sub_080951C4;
CutsceneMiscObjectTypeAction sub_08095288;
CutsceneMiscObjectTypeAction sub_080953A4;
CutsceneMiscObjectTypeAction sub_080953A4;
CutsceneMiscObjectTypeAction sub_080954DC;
CutsceneMiscObjectTypeAction sub_080956B4;
CutsceneMiscObjectTypeAction sub_0809577C;
CutsceneMiscObjectTypeAction sub_080957DC;
CutsceneMiscObjectTypeAction sub_0809584C;
CutsceneMiscObjectTypeAction sub_080958D8;
CutsceneMiscObjectTypeAction sub_08095918;
CutsceneMiscObjectTypeAction sub_08094C88;
CutsceneMiscObjectTypeAction sub_080959CC;
CutsceneMiscObjectTypeAction sub_08095A8C;
CutsceneMiscObjectTypeAction sub_08095B48;
CutsceneMiscObjectTypeAction sub_08095C00;
CutsceneMiscObjectTypeAction sub_080953A4;
CutsceneMiscObjectTypeAction sub_08095C68;
CutsceneMiscObjectTypeAction sub_08095CE0;
CutsceneMiscObjectTypeAction sub_08095CE0;
CutsceneMiscObjectTypeAction sub_08095DBC;
CutsceneMiscObjectTypeAction sub_08095F38;
CutsceneMiscObjectTypeAction sub_08096058;
CutsceneMiscObjectTypeAction sub_08096058;
CutsceneMiscObjectTypeAction sub_08094A90;
CutsceneMiscObjectTypeAction sub_08096084;
CutsceneMiscObjectTypeAction sub_08096084;
CutsceneMiscObjectTypeAction sub_08096168;
CutsceneMiscObjectTypeAction sub_080961F4;
CutsceneMiscObjectTypeAction sub_080961F4;
CutsceneMiscObjectTypeAction sub_080961F4;
CutsceneMiscObjectTypeAction sub_08096284;
CutsceneMiscObjectTypeAction sub_08096290;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type0;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type1;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type2;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type3;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type4;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type5;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type6;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type7;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type8;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type9;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type10;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type11;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type12;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type14;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type15;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type16;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type17;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type18;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type19;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type20;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type22;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type23;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type24;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type25;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type27;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type28;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type30;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type31;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type32;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type35;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type35;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type37;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type38;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type41;
CutsceneMiscObjectTypeAction CutsceneMiscObject_Type42;
void sub_08095754(CutsceneMiscObjectEntity*);
void sub_080957B4(CutsceneMiscObjectEntity*);
@@ -120,18 +112,23 @@ void sub_08095D30(CutsceneMiscObjectEntity*, u32);
static void sub_0809629C(CutsceneMiscObjectEntity*, u32);
void CutsceneMiscObject(Entity* this) {
static CutsceneMiscObjectTypeAction* const sTypeTable[] = {
sub_08094A5C, sub_08094A90, sub_08094C30, sub_08094C88, sub_08094D94, sub_08094E30, sub_08094FA8, sub_08095088,
sub_08095120, sub_08095188, sub_080951C4, sub_08095288, sub_080953A4, sub_080953A4, sub_080954DC, sub_080956B4,
sub_0809577C, sub_080957DC, sub_0809584C, sub_080958D8, sub_08095918, sub_08094C88, sub_080959CC, sub_08095A8C,
sub_08095B48, sub_08095C00, sub_080953A4, sub_08095C68, sub_08095CE0, sub_08095CE0, sub_08095DBC, sub_08095F38,
sub_08096058, sub_08096058, sub_08094A90, sub_08096084, sub_08096084, sub_08096168, sub_080961F4, sub_080961F4,
sub_080961F4, sub_08096284, sub_08096290,
static CutsceneMiscObjectTypeAction* const CutsceneMiscObject_Types[] = {
CutsceneMiscObject_Type0, CutsceneMiscObject_Type1, CutsceneMiscObject_Type2, CutsceneMiscObject_Type3,
CutsceneMiscObject_Type4, CutsceneMiscObject_Type5, CutsceneMiscObject_Type6, CutsceneMiscObject_Type7,
CutsceneMiscObject_Type8, CutsceneMiscObject_Type9, CutsceneMiscObject_Type10, CutsceneMiscObject_Type11,
CutsceneMiscObject_Type12, CutsceneMiscObject_Type12, CutsceneMiscObject_Type14, CutsceneMiscObject_Type15,
CutsceneMiscObject_Type16, CutsceneMiscObject_Type17, CutsceneMiscObject_Type18, CutsceneMiscObject_Type19,
CutsceneMiscObject_Type20, CutsceneMiscObject_Type3, CutsceneMiscObject_Type22, CutsceneMiscObject_Type23,
CutsceneMiscObject_Type24, CutsceneMiscObject_Type25, CutsceneMiscObject_Type12, CutsceneMiscObject_Type27,
CutsceneMiscObject_Type28, CutsceneMiscObject_Type28, CutsceneMiscObject_Type30, CutsceneMiscObject_Type31,
CutsceneMiscObject_Type32, CutsceneMiscObject_Type32, CutsceneMiscObject_Type1, CutsceneMiscObject_Type35,
CutsceneMiscObject_Type35, CutsceneMiscObject_Type37, CutsceneMiscObject_Type38, CutsceneMiscObject_Type38,
CutsceneMiscObject_Type38, CutsceneMiscObject_Type41, CutsceneMiscObject_Type42,
};
sTypeTable[this->type]((CutsceneMiscObjectEntity*)this);
CutsceneMiscObject_Types[this->type]((CutsceneMiscObjectEntity*)this);
}
void sub_08094A5C(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type0(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
sub_0807DD64(super);
@@ -142,7 +139,7 @@ void sub_08094A5C(CutsceneMiscObjectEntity* this) {
GetNextFrame(super);
}
void sub_08094A90(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type1(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
super->collisionLayer = 2;
@@ -210,7 +207,7 @@ void sub_08094BE0(Entity* this) {
}
}
void sub_08094C30(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type2(CutsceneMiscObjectEntity* this) {
Entity* p = super->parent;
if (p == NULL || p->next == NULL)
DeleteThisEntity();
@@ -224,7 +221,7 @@ void sub_08094C30(CutsceneMiscObjectEntity* this) {
UpdateAnimationSingleFrame(super);
}
void sub_08094C88(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type3(CutsceneMiscObjectEntity* this) {
u32 tmp;
if (super->action != 0) {
@@ -283,7 +280,7 @@ void sub_08094D70(CutsceneMiscObjectEntity* this) {
}
}
void sub_08094D94(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type4(CutsceneMiscObjectEntity* this) {
u32 tmp;
if (super->action != 0) {
@@ -316,7 +313,7 @@ void sub_08094E0C(CutsceneMiscObjectEntity* this) {
}
}
void sub_08094E30(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type5(CutsceneMiscObjectEntity* this) {
if (super->type2 == 0) {
if ((gRoomTransition.frameCount % 32) == 0) {
Entity* e = CreateObject(0x6A, 5, 1);
@@ -390,7 +387,7 @@ void sub_08094F98(CutsceneMiscObjectEntity* this) {
CreateObject(CUTSCENE_MISC_OBJECT, 5, 0);
}
void sub_08094FA8(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type6(CutsceneMiscObjectEntity* this) {
switch (super->action) {
case 0:
super->action = 1;
@@ -399,8 +396,8 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) {
AddInteractableCheckableObject(super);
break;
case 1:
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
super->action = 2;
RemoveInteractableObject(super);
gPlayerState.queued_action = PLAYER_EMPTYBOTTLE;
@@ -441,7 +438,7 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095088(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) {
u32 tmp;
switch (super->action) {
@@ -453,8 +450,8 @@ void sub_08095088(CutsceneMiscObjectEntity* this) {
AddInteractableCheckableObject(super);
break;
case 1:
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
super->action = 2;
RemoveInteractableObject(super);
CreateEzloHint(TEXT_INDEX(TEXT_BELARI, 0x1F), 0);
@@ -473,7 +470,7 @@ void sub_08095088(CutsceneMiscObjectEntity* this) {
super->type = tmp;
}
void sub_08095120(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type8(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority(super, PRIO_NO_BLOCK);
@@ -493,7 +490,7 @@ void sub_08095164(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095188(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type9(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority(super, PRIO_NO_BLOCK);
@@ -505,7 +502,7 @@ void sub_08095188(CutsceneMiscObjectEntity* this) {
HandleEntity0x82Actions(super);
}
void sub_080951C4(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type10(CutsceneMiscObjectEntity* this) {
Entity* p;
if (super->action == 0) {
@@ -545,7 +542,7 @@ void sub_08095244(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095288(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) {
Entity* p;
if (super->action == 0) {
@@ -607,7 +604,7 @@ void sub_08095364(CutsceneMiscObjectEntity* this) {
}
}
void sub_080953A4(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type12(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
super->z.HALF.HI = -16;
@@ -659,7 +656,7 @@ void sub_080954AC(CutsceneMiscObjectEntity* this, u32 arg2) {
}
}
void sub_080954DC(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type14(CutsceneMiscObjectEntity* this) {
switch (super->action) {
case 0:
if (super->timer != 0) {
@@ -719,28 +716,25 @@ void sub_0809567C(CutsceneMiscObjectEntity* this) {
CalculateDirectionFromOffsets(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16));
}
void sub_080956B4(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type15(CutsceneMiscObjectEntity* this) {
Entity* p;
u16* p1;
u16* p2;
Type15Vars* tmp;
u16* tmp;
if (super->action == 0) {
s32 i;
u16* p;
u32 x;
u32 y;
super->action++;
InitializeAnimation(super, 0);
// p = this->v.arr;
asm("mov r4, r5");
asm("add r4, #0x68");
tmp = ((CutsceneMiscObjectEntityType15*)this)->vars.arr;
x = super->x.HALF_U.HI;
y = super->y.HALF_U.HI;
for (i = 0; i < 8; i++) {
*p++ = x;
*p++ = y;
*tmp++ = x;
*tmp++ = y;
}
}
GetNextFrame(super);
@@ -755,13 +749,13 @@ void sub_080956B4(CutsceneMiscObjectEntity* this) {
} else {
DeleteThisEntity();
}
tmp = &((CutsceneMiscObjectEntityType15*)this)->vars;
MemCopy(&tmp->arr[2], &tmp->arr[0], 0x1C);
super->x.HALF.HI = tmp->my_x;
super->y.HALF.HI = tmp->my_y;
tmp = ((CutsceneMiscObjectEntityType15*)this)->vars.arr;
MemCopy(&tmp[2], &tmp[0], 0x1C);
super->x.HALF.HI = tmp[10];
super->y.HALF.HI = tmp[11];
super->z.HALF.HI = p->z.HALF.HI;
tmp->parent_x = p->x.HALF.HI;
tmp->parent_y = p->y.HALF.HI;
tmp[14] = p->x.HALF.HI;
tmp[15] = p->y.HALF.HI;
}
void sub_08095754(CutsceneMiscObjectEntity* this) {
@@ -773,7 +767,7 @@ void sub_08095754(CutsceneMiscObjectEntity* this) {
}
}
void sub_0809577C(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type16(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
super->z.HALF.HI = -16;
@@ -793,7 +787,7 @@ void sub_080957B4(CutsceneMiscObjectEntity* this) {
}
}
void sub_080957DC(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type17(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
sub_0807DD64(super);
@@ -814,7 +808,7 @@ void sub_08095810(CutsceneMiscObjectEntity* this) {
}
}
void sub_0809584C(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type18(CutsceneMiscObjectEntity* this) {
u32 tmp, idx;
idx = super->health;
@@ -837,7 +831,7 @@ void sub_0809584C(CutsceneMiscObjectEntity* this) {
super->type = tmp;
}
void sub_080958D8(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type19(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
sub_0807DD64(super);
@@ -849,7 +843,7 @@ void sub_080958D8(CutsceneMiscObjectEntity* this) {
sub_08095954(this);
}
void sub_08095918(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type20(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
SetDefaultPriority(super, PRIO_PLAYER_EVENT);
@@ -883,7 +877,7 @@ void sub_08095954(CutsceneMiscObjectEntity* this) {
}
}
void sub_080959CC(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type22(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
super->spriteSettings.draw = 0;
@@ -914,7 +908,7 @@ void sub_08095A68(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095A8C(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type23(CutsceneMiscObjectEntity* this) {
switch (super->action) {
case 0:
super->action++;
@@ -947,7 +941,7 @@ void sub_08095A8C(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095B48(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type24(CutsceneMiscObjectEntity* this) {
Entity* p;
u32 tmp;
@@ -987,7 +981,7 @@ void sub_08095BE0(CutsceneMiscObjectEntity* this, u32 val) {
}
}
void sub_08095C00(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type25(CutsceneMiscObjectEntity* this) {
if (super->action & 0x80) {
DeleteThisEntity();
} else {
@@ -1011,7 +1005,7 @@ void sub_08095C48(Entity* this) {
}
}
void sub_08095C68(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type27(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
sub_080042D0(super, super->frameIndex, (u16)super->spriteIndex);
@@ -1039,7 +1033,7 @@ void sub_08095CB0(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095CE0(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type28(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
super->spriteSettings.draw = 0;
@@ -1074,7 +1068,7 @@ void sub_08095D8C(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) {
}
}
void sub_08095DBC(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type30(CutsceneMiscObjectEntity* this) {
if (gActiveScriptInfo.syncFlags & 0x10)
DeleteThisEntity();
if (super->type2 == 0) {
@@ -1141,7 +1135,7 @@ void sub_08095EAC(Entity* this, ScriptExecutionContext* ctx) {
}
#define local ((Type1F*)this)
void sub_08095F38(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type31(CutsceneMiscObjectEntity* this) {
u32 tmp;
if (super->action == 0) {
@@ -1195,7 +1189,7 @@ void sub_08096028(CutsceneMiscObjectEntity* this) {
CreateObject(CUTSCENE_MISC_OBJECT, 0x1F, type2);
}
void sub_08096058(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type32(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
sub_0807DD64(super);
@@ -1205,7 +1199,7 @@ void sub_08096058(CutsceneMiscObjectEntity* this) {
GetNextFrame(super);
}
void sub_08096084(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type35(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
sub_0807DD64(super);
@@ -1239,7 +1233,7 @@ void sub_080960C4(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) {
}
}
void sub_08096168(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type37(CutsceneMiscObjectEntity* this) {
if (super->action == 0) {
super->action++;
super->spriteSettings.draw = 1;
@@ -1263,7 +1257,7 @@ void sub_080961B0(CutsceneMiscObjectEntity* this) {
}
}
void sub_080961F4(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type38(CutsceneMiscObjectEntity* this) {
super->spriteSettings.draw = 1;
super->frameIndex = 0;
}
@@ -1290,11 +1284,11 @@ void sub_08096260(CutsceneMiscObjectEntity* this) {
}
}
void sub_08096284(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type41(CutsceneMiscObjectEntity* this) {
sub_0809629C(this, 0xd);
}
void sub_08096290(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type42(CutsceneMiscObjectEntity* this) {
sub_0809629C(this, 0xe);
}
+4 -3
View File
@@ -2,8 +2,9 @@
* @file cutsceneOrchestrator.c
* @ingroup Objects
*
* @brief CutsceneO rchestrator object
* @brief Cutscene Orchestrator object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "hitbox.h"
@@ -13,9 +14,9 @@ void CutsceneOrchestrator(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->hitbox = (Hitbox*)&gHitbox_2;
sub_0807DD50(this);
InitScriptForNPC(this);
} else {
sub_0807DD94(this, NULL);
ExecuteScriptAndHandleAnimation(this, NULL);
}
} else {
this->action = 1;
+1 -1
View File
@@ -5,11 +5,11 @@
* @brief Death Fx object
*/
#define NENT_DEPRECATED
#include "object/deathFx.h"
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "global.h"
#include "object/deathFx.h"
#include "sound.h"
void sub_08081790(DeathFxObject* this);
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {
-2
View File
@@ -4,10 +4,8 @@
*
* @brief Enemy Item object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {
+214
View File
@@ -0,0 +1,214 @@
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "flags.h"
#include "object.h"
typedef struct {
Entity base;
u8 filler[0xe];
u16 unk76;
u16 unk78;
u16 unk7a;
u16 unk7c;
u8 filler2;
u8 unk7f;
s32 x;
s32 y;
} EvilSpiritEntity;
void EvilSpirit_Init(EvilSpiritEntity*);
void EvilSpirit_Action1(EvilSpiritEntity*);
void EvilSpirit_Action2(EvilSpiritEntity*);
void EvilSpirit_Action3(EvilSpiritEntity*);
void EvilSpirit(Entity* this) {
static void (*const EvilSpirit_Actions[])(EvilSpiritEntity*) = {
EvilSpirit_Init,
EvilSpirit_Action1,
EvilSpirit_Action2,
EvilSpirit_Action3,
};
EvilSpirit_Actions[this->action]((EvilSpiritEntity*)this);
this->contactFlags = 0;
SetAffineInfo(this, ((EvilSpiritEntity*)this)->unk76, ((EvilSpiritEntity*)this)->unk7a, 0);
}
void EvilSpirit_Init(EvilSpiritEntity* this) {
static const u16 gUnk_08120678[] = { 0x100, 0x110, 0x150, 0x1c0, 0x200 };
u32 uVar1;
Entity* evilSpiritEnt;
u32 index;
if (CheckLocalFlag(SORA_ELDER_RECOVER)) {
DeleteThisEntity();
}
super->action = 1;
uVar1 = gUnk_08120678[super->type];
this->unk7c = uVar1;
this->unk76 = uVar1;
this->unk7a = this->unk7c;
if (super->type == 0) {
this->x = super->x.WORD;
this->y = super->y.WORD;
super->spriteRendering.b3 = 0;
super->parent = super;
COLLISION_ON(super);
super->collisionFlags = 7;
super->hitType = 1;
super->flags2 = 4;
for (index = 0; index < 4; index++) {
evilSpiritEnt = CreateObjectWithParent(super, EVIL_SPIRIT, index + 1, 0);
super->child = evilSpiritEnt;
if (evilSpiritEnt != NULL) {
evilSpiritEnt->parent = super->parent;
super->child->child = super;
super->parent = super->child;
}
}
} else {
super->spriteRendering.b3 = 1;
}
InitializeAnimation(super, super->type);
EvilSpirit_Action1(this);
}
void EvilSpirit_Action1(EvilSpiritEntity* this) {
s32 sVar3;
u32 dir;
s16 iVar5;
if (super->type != 0) {
if (((EvilSpiritEntity*)super->child)->unk7f == 0) {
this->unk76 = this->unk7c;
this->unk7a = this->unk7c;
super->speed = 0x300;
super->direction =
CalculateDirectionFromOffsets(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80;
} else {
super->speed = 0x600;
dir = CalculateDirectionFromOffsets(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) ^ 0x80;
if (dir != super->direction) {
if ((u8)(dir - super->direction) > 0x80) {
super->direction += 3;
} else {
super->direction -= 3;
}
}
if ((gPlayerEntity.animationState & 2) == 0) {
this->unk76 = this->unk7c + 0x40;
} else {
this->unk76 = this->unk7c - 0x20;
this->unk7a = this->unk7c + 0x50;
;
}
}
super->x = super->parent->x;
super->y = super->parent->y;
LinearMoveAngle(super, (int)super->speed, super->direction);
return;
}
if ((super->contactFlags & 0x7f) == 0x13) {
super->direction++;
super->gustJarTolerance--;
this->unk7f = 1;
if ((gPlayerEntity.animationState & 2) == 0) {
this->unk76 = this->unk7c + 0x10;
} else {
this->unk76 = this->unk7c - 0x20;
this->unk7a = this->unk7c + 0x30;
}
} else {
super->direction = super->direction + 2;
super->gustJarTolerance = 0xf0;
this->unk7f = 0;
this->unk76 = this->unk7c;
this->unk7a = this->unk7c;
}
if (super->gustJarTolerance == 0) {
super->action = 2;
this->unk7f = 0;
return;
}
if ((super->direction + 0x40) * 0x1000000 >= 0) {
sVar3 = this->unk76;
if ((short)this->unk76 >= 1) {
this->unk76 = -sVar3;
}
} else {
sVar3 = this->unk76;
if (-1 >= (short)this->unk76) {
this->unk76 = -sVar3;
}
}
sVar3 = FixedMul(gSineTable[super->direction], 0x2000);
iVar5 = FixedDiv(sVar3, 0x100);
super->x.WORD = this->x + (iVar5 << 8);
sVar3 = FixedMul(gSineTable[super->direction + 0x40], 0x1000);
iVar5 = FixedDiv(sVar3, 0x100);
super->y.WORD = this->y - (iVar5 << 8);
}
void EvilSpirit_Action2(EvilSpiritEntity* this) {
u32 index;
if ((super->contactFlags & 0x7f) != 0x13) {
super->action = 3;
} else {
if (sub_0806F3E4(super)) {
SetLocalFlag(SORA_ELDER_RECOVER);
SetRoomFlag(0);
for (index = 0; index < 4; index++) {
Entity* ent = super->child;
super->child = ent->parent;
DeleteEntity(ent);
}
DeleteThisEntity();
}
}
}
void EvilSpirit_Action3(EvilSpiritEntity* this) {
short sVar2;
short iVar4;
int iVar6;
super->direction = CalculateDirectionFromOffsets(this->x - super->x.WORD, this->y - super->y.WORD);
if ((super->contactFlags & 0x7f) == 0x13) {
super->speed = 0x100;
super->gustJarTolerance--;
this->unk7f = 1;
if ((gPlayerEntity.animationState & 2) == 0) {
this->unk76 = this->unk7c + 0x10;
} else {
this->unk76 = this->unk7c - 0x20;
this->unk7a = this->unk7c + 0x30;
}
} else {
super->speed = 0x200;
super->gustJarTolerance = 0xf0;
this->unk7f = 0;
this->unk76 = this->unk7c;
this->unk7a = this->unk7c;
}
if (super->gustJarTolerance == 0) {
super->action = 2;
this->unk7f = 0;
} else {
LinearMoveAngle(super, super->speed, super->direction);
super->direction ^= 0x80;
sVar2 = FixedMul(gSineTable[super->direction], 0x2000);
iVar6 = this->x + (FixedDiv(sVar2, 0x100) << 8);
sVar2 = FixedMul(gSineTable[super->direction + 0x40], 0x1000);
if (EntityWithinDistance(super, iVar6, this->y - (FixedDiv(sVar2, 0x100) << 8), 2)) {
super->action = 1;
}
}
}
+13 -13
View File
@@ -19,20 +19,20 @@ typedef struct {
u16 eyeSwitchFlags2;
} EyeSwitchEntity;
void sub_080886A4(EyeSwitchEntity* this);
void sub_08088718(EyeSwitchEntity* this);
void sub_08088760(EyeSwitchEntity* this);
void sub_08088790(EyeSwitchEntity* this);
void sub_080887D8(EyeSwitchEntity* this);
void EyeSwitch_Init(EyeSwitchEntity* this);
void EyeSwitch_Action1(EyeSwitchEntity* this);
void EyeSwitch_Action2(EyeSwitchEntity* this);
void EyeSwitch_Action3(EyeSwitchEntity* this);
void EyeSwitch_Action4(EyeSwitchEntity* this);
void EyeSwitch(Entity* this) {
static void (*const actionFuncs[])(EyeSwitchEntity*) = {
sub_080886A4, sub_08088718, sub_08088760, sub_08088790, sub_080887D8,
static void (*const EyeSwitch_Actions[])(EyeSwitchEntity*) = {
EyeSwitch_Init, EyeSwitch_Action1, EyeSwitch_Action2, EyeSwitch_Action3, EyeSwitch_Action4,
};
actionFuncs[this->action]((EyeSwitchEntity*)this);
EyeSwitch_Actions[this->action]((EyeSwitchEntity*)this);
}
void sub_080886A4(EyeSwitchEntity* this) {
void EyeSwitch_Init(EyeSwitchEntity* this) {
super->animationState = super->type & 3;
super->spritePriority.b0 = 6;
super->collisionFlags = 7;
@@ -50,7 +50,7 @@ void sub_080886A4(EyeSwitchEntity* this) {
}
}
void sub_08088718(EyeSwitchEntity* this) {
void EyeSwitch_Action1(EyeSwitchEntity* this) {
if ((super->contactFlags == 0x95 || super->contactFlags == 0x8e) &&
(DirectionRoundUp(super->contactedEntity->direction) >> 3 == (super->animationState & 3))) {
super->action = 2;
@@ -60,7 +60,7 @@ void sub_08088718(EyeSwitchEntity* this) {
}
}
void sub_08088760(EyeSwitchEntity* this) {
void EyeSwitch_Action2(EyeSwitchEntity* this) {
GetNextFrame(super);
if ((super->frame & ANIM_DONE) != 0) {
super->action = 3;
@@ -69,7 +69,7 @@ void sub_08088760(EyeSwitchEntity* this) {
}
}
void sub_08088790(EyeSwitchEntity* this) {
void EyeSwitch_Action3(EyeSwitchEntity* this) {
if (super->timer != 0) {
if ((this->eyeSwitchFlags2 != this->eyeSwitchFlags) && (CheckFlags(this->eyeSwitchFlags))) {
super->timer = 0;
@@ -82,7 +82,7 @@ void sub_08088790(EyeSwitchEntity* this) {
}
}
void sub_080887D8(EyeSwitchEntity* this) {
void EyeSwitch_Action4(EyeSwitchEntity* this) {
GetNextFrame(super);
if ((super->frame & ANIM_DONE) != 0) {
super->action = 1;
-2
View File
@@ -4,10 +4,8 @@
*
* @brief Ezlo Cap object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "message.h"
#include "object.h"
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "new_player.h"
#include "object.h"
+2 -2
View File
@@ -4,11 +4,9 @@
*
* @brief Fairy object
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "item.h"
#include "object.h"
@@ -36,6 +34,8 @@ void Fairy_SubAction0(FairyEntity*);
void Fairy_SubAction1(FairyEntity*);
void Fairy_SubAction2(FairyEntity*);
extern void sub_08081404(Entity*, u32);
void Fairy(FairyEntity* this) {
static void (*const Fairy_Actions[])(FairyEntity*) = {
Fairy_Init, Fairy_Action1, Fairy_Action2, Fairy_Action3, Fairy_Action4,
-1
View File
@@ -9,7 +9,6 @@
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "object.h"
#include "player.h"
#include "sound.h"
+1 -1
View File
@@ -4,10 +4,10 @@
*
* @brief Fan Wind object
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "functions.h"
#include "global.h"
void FanWind(Entity* this) {
u8* collisionData;
+232 -227
View File
@@ -4,7 +4,6 @@
*
* @brief Figurine Device object
*/
#define NENT_DEPRECATED
#include "figurineMenu.h"
#include "fileselect.h"
@@ -33,13 +32,13 @@ typedef struct {
/*0x7e*/ u8 unk_7e[2];
/*0x80*/ u8 unk_80;
#endif
/*0x81*/ u8 unk_81;
/*0x81*/ u8 shells;
#ifdef EU
/*0x82*/ u8 unk_82;
/*0x83*/ u8 unk_83;
/*0x82*/ u8 prevChance;
/*0x83*/ u8 chance;
#else
/*0x82*/ s8 unk_82;
/*0x83*/ s8 unk_83;
/*0x82*/ s8 prevChance;
/*0x83*/ s8 chance;
#endif
} FigurineDeviceEntity;
@@ -48,14 +47,14 @@ extern u8 gUnk_020227F0;
void sub_0808804C(FigurineDeviceEntity*);
void sub_08087F58(FigurineDeviceEntity*);
void sub_08088328(FigurineDeviceEntity*);
void FigurineDevice_Draw(FigurineDeviceEntity*);
void sub_0808826C(FigurineDeviceEntity*);
void sub_080882A8(FigurineDeviceEntity*);
void sub_080880D8(FigurineDeviceEntity*);
void sub_08087F94(FigurineDeviceEntity*, s32);
void sub_08088034(FigurineDeviceEntity*);
void FigurineDevice_ChangeShellAmount(FigurineDeviceEntity*, s32);
void FigurineDevice_PlayErrorSound(FigurineDeviceEntity*);
bool32 sub_08088160(FigurineDeviceEntity*, s32);
void sub_08088424(FigurineDeviceEntity*);
void FigurineDevice_GetChanceBasedOffFigurineCount(FigurineDeviceEntity*);
void FigurineDevice_Init(FigurineDeviceEntity*);
void FigurineDevice_Action1(FigurineDeviceEntity*);
void FigurineDevice_Action2(FigurineDeviceEntity*);
@@ -110,7 +109,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) {
case 3:
super->timer = 30;
super->subtimer = 0;
this->unk_81 = 1;
this->shells = 1;
this->unk_7a = 0;
this->unk_7b = 0;
this->unk_80 = 0;
@@ -127,8 +126,8 @@ void FigurineDevice_Action1(FigurineDeviceEntity* this) {
AddInteractableCheckableObject(super);
break;
case 1:
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
ResetPlayerAnimationAndAction();
if (CheckLocalFlag(SHOP07_TANA)) {
this->unk_7a = 2;
@@ -167,7 +166,7 @@ void FigurineDevice_Action2(FigurineDeviceEntity* this) {
SetLocalFlag(SHOP07_TANA);
case 1:
this->unk_7a = 0;
sub_08088328((FigurineDeviceEntity*)super->child);
FigurineDevice_Draw((FigurineDeviceEntity*)super->child);
ClearRoomFlag(0);
entity = CreateObject(FIGURINE_DEVICE, 2, 0);
if (entity != NULL) {
@@ -235,7 +234,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
return;
}
this->unk_7a = 1;
this->unk_81 = 1;
this->shells = 1;
ClearRoomFlag(1);
sub_0808826C(this);
sub_080882A8(this);
@@ -247,16 +246,16 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
if (super->timer != 0) {
super->timer--;
}
if ((gInput.newKeys & 1) != 0) {
if ((gInput.newKeys & A_BUTTON) != 0) {
SoundReq(SFX_TEXTBOX_SELECT);
this->unk_7a = 2;
super->timer = 60;
sub_08050384();
return;
}
old_81 = this->unk_81;
old_81 = this->shells;
#ifndef EU
if ((gInput.heldKeys & 0x100) != 0) {
if ((gInput.heldKeys & R_BUTTON) != 0) {
tmp = 10;
} else {
tmp = 1;
@@ -266,26 +265,26 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
#else
switch (gInput.unk4 & 0xfffffeff) {
#endif
case 0x40:
sub_08087F94(this, tmp);
case DPAD_UP:
FigurineDevice_ChangeShellAmount(this, tmp);
break;
case 0x80:
sub_08087F94(this, -tmp);
case DPAD_DOWN:
FigurineDevice_ChangeShellAmount(this, -tmp);
break;
}
if (old_81 != this->unk_81) {
if (old_81 != this->shells) {
sub_080882A8(this);
}
#else
switch (gInput.unk4) {
case 0x40:
sub_08087F94(this, 1);
case DPAD_UP:
FigurineDevice_ChangeShellAmount(this, 1);
break;
case 0x80:
sub_08087F94(this, -1);
case DPAD_DOWN:
FigurineDevice_ChangeShellAmount(this, -1);
break;
}
if (old_81 != this->unk_81) {
if (old_81 != this->shells) {
sub_080882A8(this);
}
#endif
@@ -299,7 +298,7 @@ void FigurineDevice_Action4(FigurineDeviceEntity* this) {
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
#endif
gMessage.rupees = this->unk_81;
gMessage.rupees = this->shells;
break;
}
}
@@ -315,124 +314,124 @@ void sub_08087F58(FigurineDeviceEntity* this) {
}
}
void sub_08087F94(FigurineDeviceEntity* this, s32 param_2) {
void FigurineDevice_ChangeShellAmount(FigurineDeviceEntity* this, s32 shellDifference) {
#ifdef EU
u32 uVar8;
u32 iVar9;
u32 newAmount;
u32 newChance;
iVar9 = this->unk_83 + param_2;
newChance = this->chance + shellDifference;
if (CheckLocalFlag(SHOP07_COMPLETE)) {
sub_08088034(this);
FigurineDevice_PlayErrorSound(this);
return;
}
if (param_2 < 0) {
if (iVar9 < this->unk_82) {
if (this->unk_83 != this->unk_82) {
this->unk_83 = this->unk_82;
this->unk_81 = 1;
if (shellDifference < 0) {
if (newChance < this->prevChance) {
if (this->chance != this->prevChance) {
this->chance = this->prevChance;
this->shells = 1;
SoundReq(SFX_TEXTBOX_CHOICE);
} else {
sub_08088034(this);
FigurineDevice_PlayErrorSound(this);
}
} else {
this->unk_83 = iVar9;
this->unk_81 += param_2;
this->chance = newChance;
this->shells += shellDifference;
SoundReq(SFX_TEXTBOX_CHOICE);
}
return;
}
uVar8 = this->unk_81 + param_2;
if (uVar8 > (s32)gSave.stats.shells) {
if (gSave.stats.shells != this->unk_81) {
uVar8 = gSave.stats.shells;
param_2 = (gSave.stats.shells - this->unk_81);
iVar9 = this->unk_83 + param_2;
newAmount = this->shells + shellDifference;
if (newAmount > gSave.stats.shells) {
if (gSave.stats.shells != this->shells) {
newAmount = gSave.stats.shells;
shellDifference = (gSave.stats.shells - this->shells);
newChance = this->chance + shellDifference;
} else {
sub_08088034(this);
FigurineDevice_PlayErrorSound(this);
return;
}
} else if (iVar9 > 100) {
if (this->unk_83 == 100) {
sub_08088034(this);
} else if (newChance > 100) {
if (this->chance == 100) {
FigurineDevice_PlayErrorSound(this);
return;
} else {
iVar9 = 100;
param_2 = (iVar9 - this->unk_83);
uVar8 = this->unk_81 + param_2;
newChance = 100;
shellDifference = (newChance - this->chance);
newAmount = this->shells + shellDifference;
}
}
#else
s32 uVar8;
s32 iVar9;
s32 t1, t2;
s32 newAmount;
s32 newChance;
s32 prevChance, prevShells;
if (CheckLocalFlag(SHOP07_COMPLETE)) {
sub_08088034(this);
FigurineDevice_PlayErrorSound(this);
return;
}
// This could probably be done without t1 and t2
t1 = this->unk_83;
iVar9 = t1 + param_2;
if (param_2 < 0) {
if (iVar9 < this->unk_82) {
if (this->unk_83 != this->unk_82) {
this->unk_83 = this->unk_82;
this->unk_81 = 1;
// This could probably be done without prevChance and prevShells
prevChance = this->chance;
newChance = prevChance + shellDifference;
if (shellDifference < 0) {
if (newChance < this->prevChance) {
if (this->chance != this->prevChance) {
this->chance = this->prevChance;
this->shells = 1;
SoundReq(SFX_TEXTBOX_CHOICE);
} else {
sub_08088034(this);
FigurineDevice_PlayErrorSound(this);
}
} else {
this->unk_83 = iVar9;
this->unk_81 += param_2;
this->chance = newChance;
this->shells += shellDifference;
SoundReq(SFX_TEXTBOX_CHOICE);
}
return;
}
t2 = this->unk_81;
uVar8 = t2 + param_2;
if (uVar8 > gSave.stats.shells) {
if (gSave.stats.shells != this->unk_81) {
uVar8 = gSave.stats.shells;
param_2 = (gSave.stats.shells - this->unk_81);
iVar9 = t1 + param_2;
prevShells = this->shells;
newAmount = prevShells + shellDifference;
if (newAmount > gSave.stats.shells) {
if (gSave.stats.shells != this->shells) {
newAmount = gSave.stats.shells;
shellDifference = (gSave.stats.shells - this->shells);
newChance = prevChance + shellDifference;
#ifdef JP
if (iVar9 > 100) {
iVar9 = 100;
param_2 = (iVar9 - t1);
uVar8 = t2 + param_2;
if (newChance > 100) {
newChance = 100;
shellDifference = (newChance - prevChance);
newAmount = prevShells + shellDifference;
}
#endif
} else {
sub_08088034(this);
FigurineDevice_PlayErrorSound(this);
return;
}
}
#ifdef JP
else if (iVar9 > 100) {
else if (newChance > 100) {
#else
if (iVar9 > 100) {
if (newChance > 100) {
#endif
if (this->unk_83 == 100) {
sub_08088034(this);
if (this->chance == 100) {
FigurineDevice_PlayErrorSound(this);
return;
} else {
iVar9 = 100;
param_2 = (iVar9 - t1);
uVar8 = t2 + param_2;
newChance = 100;
shellDifference = (newChance - prevChance);
newAmount = prevShells + shellDifference;
}
}
#endif
this->unk_83 = iVar9;
this->unk_81 = uVar8;
this->chance = newChance;
this->shells = newAmount;
SoundReq(SFX_TEXTBOX_CHOICE);
}
void sub_08088034(FigurineDeviceEntity* this) {
void FigurineDevice_PlayErrorSound(FigurineDeviceEntity* this) {
if (super->timer == 0) {
super->timer = 20;
SoundReq(SFX_MENU_ERROR);
@@ -475,26 +474,24 @@ void sub_080880D8(FigurineDeviceEntity* this) {
it++;
}
if (++this->unk_7b == 4) {
if (gSave.field_0x9[0] != this->unk_80) {
if (gSave.field_0x9[0] != 0) {
if (gSave.available_figurines != this->unk_80) {
if (gSave.available_figurines != 0) {
SetRoomFlag(6);
}
gSave.field_0x9[0] = this->unk_80;
gSave.available_figurines = this->unk_80;
}
if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.filler[0])) {
if (CheckLocalFlag(SHOP07_COMPLETE) && (this->unk_80 != gSave.stats.figurineCount)) {
ClearLocalFlag(SHOP07_COMPLETE);
}
}
}
NONMATCH("asm/non_matching/figurineDevice/sub_08088160.inc",
bool32 sub_08088160(FigurineDeviceEntity* this, s32 param_2)) {
u8 bVar1;
bool32 condition;
u32 uVar3;
bool32 sub_08088160(FigurineDeviceEntity* this, s32 param_2) {
bool32 result;
const struct_080FC3E4* ptr;
u32 tmp;
#if !defined(JP) && !defined(EU)
u8 kinstoneId;
#endif
ptr = &gUnk_080FC3E4[param_2];
result = FALSE;
@@ -504,74 +501,81 @@ NONMATCH("asm/non_matching/figurineDevice/sub_08088160.inc",
switch (ptr->unk_6) {
case 0x8:
case 0x40:
if (CheckLocalFlagByBank(ptr->bank, ptr->flag)) {
if (CheckLocalFlagByBank(ptr->bank, ptr->flag))
result = TRUE;
}
return result;
break;
case 0x10:
if (CheckKinstoneFused(gUnk_080FC3E4[param_2].flag)) {
if (CheckKinstoneFused(ptr->flag))
result = TRUE;
}
return result;
break;
default:
return result;
break;
case 0x20:
switch (gUnk_080FC3E4[param_2].flag) {
switch (ptr->flag) {
#if defined(JP) || defined(EU)
case 0:
if (CheckKinstoneFused(KINSTONE_20) || CheckKinstoneFused(KINSTONE_10) ||
CheckKinstoneFused(KINSTONE_19)) {
CheckKinstoneFused(KINSTONE_19))
result = TRUE;
}
break;
case 1:
if ((u8)this->unk_7c >= 5 && CheckKinstoneFused(KINSTONE_28)) {
if (this->unk_7c >= 5 && CheckKinstoneFused(KINSTONE_28))
result = TRUE;
}
break;
#else
case 0:
if (CheckKinstoneFused(KINSTONE_20) || CheckKinstoneFused(KINSTONE_10)) {
result = TRUE;
break;
}
kinstoneId = KINSTONE_19;
backward_tail_merge:
if (CheckKinstoneFused(kinstoneId))
result = TRUE;
break;
case 1:
if (this->unk_7c >= 5) {
kinstoneId = KINSTONE_28;
goto backward_tail_merge;
}
break;
#endif
case 2:
if (CheckKinstoneFused(KINSTONE_54) || CheckKinstoneFused(KINSTONE_56) ||
CheckKinstoneFused(KINSTONE_3D)) {
CheckKinstoneFused(KINSTONE_3D))
result = TRUE;
}
break;
case 3:
if (CheckKinstoneFused(KINSTONE_3B) || CheckKinstoneFused(KINSTONE_4A) ||
CheckKinstoneFused(KINSTONE_D)) {
CheckKinstoneFused(KINSTONE_D))
result = TRUE;
}
break;
case 4:
if (CheckKinstoneFused(KINSTONE_49) || CheckKinstoneFused(KINSTONE_55) ||
CheckKinstoneFused(KINSTONE_3C)) {
CheckKinstoneFused(KINSTONE_3C))
result = TRUE;
}
break;
#if !defined(JP) && !defined(EU)
case 5:
if (this->unk_7c >= 2 && CheckGlobalFlag(MACHI_MACHIHOKORI)) {
if (this->unk_7c >= 2 && CheckGlobalFlag(MACHI_MACHIHOKORI))
result = TRUE;
}
default:
return result;
break;
#endif
}
break;
}
}
return result;
}
END_NONMATCH
void sub_0808826C(FigurineDeviceEntity* this) {
s32 tmp = 0x64;
tmp *= ((this->unk_80 - gSave.stats.filler[0]));
tmp = tmp / this->unk_80;
s32 tmp = 100;
tmp *= this->unk_80 - gSave.stats.figurineCount;
tmp /= this->unk_80;
if (tmp == 0 && !CheckLocalFlag(SHOP07_COMPLETE)) {
tmp = 1;
}
this->unk_83 = tmp;
this->unk_82 = this->unk_83;
this->chance = tmp;
this->prevChance = this->chance;
}
void sub_080882A8(FigurineDeviceEntity* this) {
@@ -593,8 +597,8 @@ void sub_080882A8(FigurineDeviceEntity* this) {
static const u16 gUnk_08120AE4[] = { TEXT_INDEX(TEXT_CARLOV, 0x18), TEXT_INDEX(TEXT_CARLOV, 0x19) };
u8* ptr;
sub_08050384();
sub_08057044(this->unk_81, gUnk_020227E8, 0x202020);
sub_08057044(this->unk_83, &gUnk_020227E8[1], 0x202020);
sub_08057044(this->shells, gUnk_020227E8, 0x202020);
sub_08057044(this->chance, &gUnk_020227E8[1], 0x202020);
ptr = (u8*)0x02000000;
if (ptr[7] == 0) {
ShowTextBox(gUnk_08120AE4[super->type2], (Font*)&gUnk_08120AB4); // TODO convert data
@@ -604,114 +608,114 @@ void sub_080882A8(FigurineDeviceEntity* this) {
gScreen.bg0.updated = 1;
}
void sub_08088328(FigurineDeviceEntity* this) {
u32 uVar2;
u32 uVar3;
u32 uVar5;
u32 uVar6;
void FigurineDevice_Draw(FigurineDeviceEntity* this) {
u32 isLucky;
u32 rand;
u32 prevFigurineIndex;
u32 figurineIndex;
do {
uVar2 = Random();
uVar2 &= 0x7f;
} while (uVar2 >= 100);
ModShells(-this->unk_81);
uVar3 = Random();
uVar6 = (uVar3 & 0x7f) + 1;
uVar5 = uVar6;
sub_08088424(this);
if (uVar2 < this->unk_83) {
uVar2 = FALSE;
isLucky = Random();
isLucky &= 0x7f;
} while (isLucky >= 100);
ModShells(-this->shells);
rand = Random();
figurineIndex = (rand & 0x7f) + 1;
prevFigurineIndex = figurineIndex;
FigurineDevice_GetChanceBasedOffFigurineCount(this);
if (isLucky < this->chance) {
isLucky = FALSE;
do {
if (uVar2)
if (isLucky)
break;
if (uVar6 > 0x88) {
uVar6 = 1;
if (figurineIndex > 136) {
figurineIndex = 1;
}
if (sub_08088160(this, uVar6) && ReadBit(&gSave.stats.filler4[4], uVar6) == 0) {
uVar2 = TRUE;
if (sub_08088160(this, figurineIndex) && ReadBit(gSave.figurines, figurineIndex) == 0) {
isLucky = TRUE;
} else {
uVar6++;
figurineIndex++;
}
} while (uVar5 != uVar6);
} while (prevFigurineIndex != figurineIndex);
} else {
uVar2 = TRUE;
isLucky = TRUE;
do {
if (!uVar2)
if (!isLucky)
break;
if (uVar6 > 0x88) {
uVar6 = 1;
if (figurineIndex > 136) {
figurineIndex = 1;
}
if (sub_08088160(this, uVar6) && ReadBit(&gSave.stats.filler4[4], uVar6) != 0) {
uVar2 = FALSE;
if (sub_08088160(this, figurineIndex) && ReadBit(gSave.figurines, figurineIndex) != 0) {
isLucky = FALSE;
} else {
uVar6++;
figurineIndex++;
}
} while (uVar5 != uVar6);
} while (prevFigurineIndex != figurineIndex);
}
if (uVar2) {
gSave.stats.filler[0]++;
if (gSave.stats.filler[0] != this->unk_80) {
if (isLucky) {
gSave.stats.figurineCount++;
if (gSave.stats.figurineCount != this->unk_80) {
SetRoomFlag(7);
} else {
SetLocalFlag(SHOP07_COMPLETE);
SetRoomFlag(8);
}
}
this->unk_7d = uVar6;
((FigurineDeviceEntity*)super->parent)->unk_7d = uVar6;
this->unk_7d = figurineIndex;
((FigurineDeviceEntity*)super->parent)->unk_7d = figurineIndex;
}
void sub_08088424(FigurineDeviceEntity* this) {
if (gSave.stats.filler[0] < 0x32) {
if (this->unk_83 < 0x0f) {
this->unk_83 = 0x0f;
void FigurineDevice_GetChanceBasedOffFigurineCount(FigurineDeviceEntity* this) {
if (gSave.stats.figurineCount < 50) {
if (this->chance < 15) {
this->chance = 15;
}
} else if (gSave.stats.filler[0] < 0x50) {
if (this->unk_83 < 0xc) {
this->unk_83 = 0xc;
} else if (gSave.stats.figurineCount < 80) {
if (this->chance < 12) {
this->chance = 12;
}
} else if (gSave.stats.filler[0] < 0x6e) {
if (this->unk_83 < 9) {
this->unk_83 = 9;
} else if (gSave.stats.figurineCount < 110) {
if (this->chance < 9) {
this->chance = 9;
}
} else {
if (this->unk_83 < 6) {
this->unk_83 = 6;
if (this->chance < 6) {
this->chance = 6;
}
}
}
void sub_08088478(void) {
void FigurineDevice_NoFigurinesLeftMessage(void) {
u32 messageIndex;
bool32 set0x10 = FALSE;
bool32 isUnlucky = FALSE;
if (!CheckRoomFlag(8)) {
if (!CheckRoomFlag(7)) {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x22);
set0x10 = TRUE;
messageIndex = TEXT_INDEX(TEXT_CARLOV, 34); // Oh! Looks like you've already got that...
isUnlucky = TRUE;
} else {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x25);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 37); // Congratulations! I'll keep the figurine...
}
} else {
switch (gSave.stats.filler[0]) {
case 0x88:
gSave.stats.filler[1] = 0xff;
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x29);
switch (gSave.stats.figurineCount) {
case 136:
gSave.stats._hasAllFigurines = 0xff;
messageIndex = TEXT_INDEX(TEXT_CARLOV, 41); // No way! Congratulations! You've collected every...
break;
case 0x82:
case 130:
if (gSave.saw_staffroll) {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x27);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 39); // ...just gotten the last ... I'll make some more...
} else {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x28);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 40); // ...You've now collected all of the figurines...
}
break;
default:
messageIndex = TEXT_INDEX(TEXT_CARLOV, 0x27);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 39); // ...you've just gotten the last figurine...
}
}
MessageFromTarget(messageIndex);
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
if (set0x10) {
gMessage.textWindowPosY = 12;
if (isUnlucky) {
gMessage.rupees = 5;
}
#ifndef EU
@@ -719,65 +723,65 @@ void sub_08088478(void) {
#endif
}
void sub_08088504(void) {
u32 index;
switch (gSave.stats.filler[0]) {
case 0x88:
index = TEXT_INDEX(TEXT_CARLOV, 0x2f);
void FigurineDevice_NothingNewToDrawMessage(void) {
u32 messageIndex;
switch (gSave.stats.figurineCount) {
case 136:
messageIndex = TEXT_INDEX(TEXT_CARLOV, 47); // How do you like that Carlov Medal...
break;
case 0x82:
index = TEXT_INDEX(TEXT_CARLOV, 0x14);
case 130:
messageIndex = TEXT_INDEX(TEXT_CARLOV, 20); // ...won all the figurines I made so far. ... draw anyway?
break;
default:
index = TEXT_INDEX(TEXT_CARLOV, 0x11);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 17); // ...don't have any new figurines yet ... draw anyway?
break;
}
MessageFromTarget(index);
MessageFromTarget(messageIndex);
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
gMessage.textWindowPosY = 12;
}
void sub_08088544(void) {
u32 index;
if (gSave.stats.filler[0] != 0x82) {
index = TEXT_INDEX(TEXT_CARLOV, 0xe);
void FigurineDevice_NewFigurinesMessage(void) {
u32 messageIndex;
if (gSave.stats.figurineCount != 130) {
messageIndex = TEXT_INDEX(TEXT_CARLOV, 14); // ...I made a new figurine...
} else {
index = TEXT_INDEX(TEXT_CARLOV, 0x15);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 21); // ...I've got something new ... final series...
}
MessageFromTarget(index);
MessageFromTarget(messageIndex);
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
gMessage.textWindowPosY = 12;
}
void sub_08088574(void) {
u32 index;
void FigurineDevice_TryAgainMessage(void) {
u32 messageIndex;
#ifdef EU
if (CheckRoomFlag(0xa)) {
if (CheckRoomFlag(10)) {
#else
if (CheckRoomFlag(9)) {
#endif
if (CheckLocalFlag(SHOP07_COMPLETE)) {
index = TEXT_INDEX(TEXT_CARLOV, 0x13);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 19); // ...already have all ... still want to have a try?
} else {
index = TEXT_INDEX(TEXT_CARLOV, 0x0c);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 12); // Want to try another drawing?
}
} else {
index = TEXT_INDEX(TEXT_CARLOV, 0x0b);
messageIndex = TEXT_INDEX(TEXT_CARLOV, 11); // ...Do you want to try for another one?
}
MessageFromTarget(index);
MessageFromTarget(messageIndex);
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
gMessage.textWindowPosY = 12;
}
void sub_080885B0(void) {
void FigurineDevice_LostOrFinishedMessage(void) {
if (!CheckRoomFlag(8)) {
if (!CheckRoomFlag(7)) {
ModRupees(5);
MessageFromTarget(TEXT_INDEX(TEXT_CARLOV, 0x26));
MessageFromTarget(TEXT_INDEX(TEXT_CARLOV, 38)); // I hope you keep collecting ... come back again!
gMessage.textWindowPosX = 1;
gMessage.textWindowPosY = 0xc;
gMessage.textWindowPosY = 12;
}
} else if (gSave.stats.filler[1] != 0) {
} else if (gSave.stats._hasAllFigurines != 0) {
// GOT ALL THEM FIGURINES (:
gSave.stats.hasAllFigurines = 1;
CreateItemEntity(ITEM_QST_CARLOV_MEDAL, 0, 0);
@@ -789,7 +793,8 @@ void sub_080885B0(void) {
#ifndef EU
void sub_0808861C(FigurineDeviceEntity* this, ScriptExecutionContext* context) {
context->condition = CheckPlayerInRegion(0xa8, 0x54, 0xc, 8);
// If I understand this correctly then it checks if the player is at the lever
context->condition = CheckPlayerInRegion(168, 84, 12, 8);
#ifdef JP
if ((gPlayerEntity.animationState != 0)) {
#else
@@ -802,7 +807,7 @@ void sub_0808861C(FigurineDeviceEntity* this, ScriptExecutionContext* context) {
#if !defined(JP)
void sub_08088658(FigurineDeviceEntity* this, ScriptExecutionContext* context) {
context->condition = CheckPlayerInRegion(0x78, 0x78, 0x10, 8);
context->condition = CheckPlayerInRegion(120, 120, 16, 8); // And this is if the player is at the door
if (gPlayerEntity.z.HALF.HI != 0) {
context->condition = 0;
}
+206 -193
View File
@@ -4,6 +4,7 @@
*
* @brief File Screen Objects object
*/
#define NENT_DEPRECATED
#include "fileselect.h"
#include "functions.h"
#include "main.h"
@@ -11,30 +12,39 @@
#include "object.h"
#include "player.h"
extern u32 sub_080041EC(int, int);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u16 unk_68;
/*0x6a*/ u16 unk_6a;
/*0x6c*/ u16 unk_6c;
/*0x6e*/ u8 unused1[2];
/*0x70*/ u8 unk_70;
} FileScreenObjectsEntity;
extern u32 sub_080041EC(s32, s32);
static bool32 sub_0808E950(void);
static void sub_0808EABC(Entity*);
static Entity* sub_0808EC80(int);
static u32 sub_0808EF6C(Entity*);
static void sub_0808EFF0(Entity*);
static void sub_0808EA28(Entity*);
static void sub_0808E7D8(Entity*);
static void sub_0808E988(Entity*);
static void sub_0808E9F4(Entity*);
static void sub_0808EBB8(Entity*);
static void sub_0808ECBC(Entity*);
static void sub_0808ED64(Entity*);
static void sub_0808E9F4(Entity*);
static void sub_0808ED98(Entity*);
static void sub_0808EE00(Entity*);
static void nullsub_522(Entity*);
static void sub_0808EB74(Entity*);
static void sub_0808EE98(Entity*);
static void sub_0808EED8(Entity*);
static void sub_0808EF24(Entity*);
static void sub_0808E818(Entity*);
static void sub_0808E7F0(Entity*);
static void sub_0808EABC(FileScreenObjectsEntity*);
static Entity* sub_0808EC80(s32);
static u32 sub_0808EF6C(FileScreenObjectsEntity*);
static void sub_0808EFF0(FileScreenObjectsEntity*);
static void FileScreenObjects_Type0(FileScreenObjectsEntity*);
static void FileScreenObjects_Type23(FileScreenObjectsEntity*);
static void FileScreenObjects_Type24(FileScreenObjectsEntity*);
static void FileScreenObjects_Type25(FileScreenObjectsEntity*);
static void FileScreenObjects_Type16(FileScreenObjectsEntity*);
static void FileScreenObjects_Type4(FileScreenObjectsEntity*);
static void FileScreenObjects_Type8(FileScreenObjectsEntity*);
static void FileScreenObjects_Type25(FileScreenObjectsEntity*);
static void FileScreenObjects_Type9(FileScreenObjectsEntity*);
static void FileScreenObjects_Type10(FileScreenObjectsEntity*);
static void FileScreenObjects_Type17(FileScreenObjectsEntity*);
static void FileScreenObjects_Type15(FileScreenObjectsEntity*);
static void FileScreenObjects_Type18(FileScreenObjectsEntity*);
static void FileScreenObjects_Type19(FileScreenObjectsEntity*);
static void FileScreenObjects_Type21(FileScreenObjectsEntity*);
static void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity*);
static void FileScreenObjects_Type23_Init(FileScreenObjectsEntity*);
typedef struct {
u8 unk0;
@@ -52,58 +62,61 @@ typedef struct {
u8 unk7;
} struct_08121D54;
extern const int gUnk_08133368[];
extern const s32 gUnk_08133368[];
void FileScreenObjects(Entity* this) {
static void (*const gUnk_08121C64[])(Entity*) = {
sub_0808EA28, sub_0808EA28, sub_0808EA28, sub_0808EA28, sub_0808ECBC, sub_0808ECBC, sub_0808ECBC,
sub_0808ECBC, sub_0808ED64, sub_0808ED98, sub_0808EE00, sub_0808EE00, sub_0808EE00, sub_0808EE00,
sub_0808EE00, sub_0808EB74, sub_0808EBB8, nullsub_522, sub_0808EE98, sub_0808EED8, sub_0808EED8,
sub_0808EF24, sub_0808EF24, sub_0808E7D8, sub_0808E988, sub_0808E9F4,
void FileScreenObjects(FileScreenObjectsEntity* this) {
static void (*const FileScreenObjects_Types[])(FileScreenObjectsEntity*) = {
FileScreenObjects_Type0, FileScreenObjects_Type0, FileScreenObjects_Type0, FileScreenObjects_Type0,
FileScreenObjects_Type4, FileScreenObjects_Type4, FileScreenObjects_Type4, FileScreenObjects_Type4,
FileScreenObjects_Type8, FileScreenObjects_Type9, FileScreenObjects_Type10, FileScreenObjects_Type10,
FileScreenObjects_Type10, FileScreenObjects_Type10, FileScreenObjects_Type10, FileScreenObjects_Type15,
FileScreenObjects_Type16, FileScreenObjects_Type17, FileScreenObjects_Type18, FileScreenObjects_Type19,
FileScreenObjects_Type19, FileScreenObjects_Type21, FileScreenObjects_Type21, FileScreenObjects_Type23,
FileScreenObjects_Type24, FileScreenObjects_Type25,
};
if (this->health == 0) {
if (super->health == 0) {
sub_0808EFF0(this);
}
gUnk_08121C64[this->type](this);
if (this->animIndex < 64) {
UpdateAnimationSingleFrame(this);
FileScreenObjects_Types[super->type](this);
if (super->animIndex < 64) {
UpdateAnimationSingleFrame(super);
}
}
void sub_0808E7D8(Entity* this) {
static void (*const gUnk_08121CCC[])(Entity*) = {
sub_0808E7F0,
sub_0808E818,
void FileScreenObjects_Type23(FileScreenObjectsEntity* this) {
static void (*const FileScreenObjects_Type23_Actions[])(FileScreenObjectsEntity*) = {
FileScreenObjects_Type23_Init,
FileScreenObjects_Type23_LinkPreview,
};
gUnk_08121CCC[this->action](this);
FileScreenObjects_Type23_Actions[super->action](this);
}
void sub_0808E7F0(Entity* this) {
LoadSwapGFX(this, 1, 2);
this->palette.b.b0 = 0xF;
this->spriteSettings.draw = 0;
this->type2 = 0xFF;
this->action = 1;
void FileScreenObjects_Type23_Init(FileScreenObjectsEntity* this) {
LoadSwapGFX(super, 1, 2);
super->palette.b.b0 = 0xF;
super->spriteSettings.draw = 0;
super->type2 = 0xFF;
super->action = 1;
}
void sub_0808E818(Entity* this) {
void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity* this) {
u32 var0;
u32 offset;
if (!sub_0808E950()) {
int var2 = -1;
this->type2 = var2;
this->field_0x68.HWORD = var2;
this->field_0x6a.HWORD = var2;
this->spriteSettings.draw = 0;
s32 var2 = -1;
super->type2 = var2;
this->unk_68 = var2;
this->unk_6a = var2;
super->spriteSettings.draw = 0;
return;
}
if (this->type2 != gMapDataBottomSpecial.unk6) {
this->type2 = gMapDataBottomSpecial.unk6;
this->field_0x68.HWORD = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100;
this->field_0x70.BYTES.byte0 = 4;
this->animationState = 2;
if (super->type2 != gMapDataBottomSpecial.unk6) {
super->type2 = gMapDataBottomSpecial.unk6;
this->unk_68 = CheckGlobalFlag(EZERO_1ST) == 0 ? ANIM_DEFAULT_NOCAP : ANIM_DEFAULT;
this->unk_70 = 4;
super->animationState = PAS_SOUTH;
offset = gUnk_08133368[GetPlayerPalette(TRUE) - 22] & 0xFFFFFF;
LoadPalettes(&gGlobalGfxAndPalettes[offset], 31, 1);
}
@@ -112,33 +125,33 @@ void sub_0808E818(Entity* this) {
if (gInput.heldKeys & L_BUTTON) {
switch (gInput.newKeys) {
case DPAD_UP:
this->animationState = 0;
super->animationState = PAS_NORTH;
break;
case DPAD_RIGHT:
this->animationState = 1;
super->animationState = PAS_EAST;
break;
case DPAD_DOWN:
this->animationState = 2;
super->animationState = PAS_SOUTH;
break;
case DPAD_LEFT:
this->animationState = 3;
super->animationState = PAS_WEST;
break;
case B_BUTTON:
this->field_0x70.BYTES.byte0 = this->field_0x70.BYTES.byte0 ? 0 : 4;
this->unk_70 = this->unk_70 ? 0 : 4;
break;
}
}
}
this->spriteSettings.flipX = this->animationState == 3;
var0 = this->field_0x68.HWORD + this->field_0x70.BYTES.byte0 + this->animationState;
if (this->field_0x6a.HWORD != var0) {
this->field_0x6a.HWORD = var0;
this->spriteIndex = var0 >> 8;
InitAnimationForceUpdate(this, (u8)var0);
super->spriteSettings.flipX = super->animationState == 3;
var0 = this->unk_68 + this->unk_70 + super->animationState;
if (this->unk_6a != var0) {
this->unk_6a = var0;
super->spriteIndex = var0 >> 8;
InitAnimationForceUpdate(super, (u8)var0);
}
this->spriteSettings.draw = 2;
super->spriteSettings.draw = 2;
}
static bool32 sub_0808E950(void) {
@@ -155,20 +168,20 @@ static bool32 sub_0808E950(void) {
return result;
}
void sub_0808E988(Entity* this) {
if (this->action == 0) {
this->action = 1;
void FileScreenObjects_Type24(FileScreenObjectsEntity* this) {
if (super->action == 0) {
super->action = 1;
#ifdef EU
this->spriteIndex = 0x141;
super->spriteIndex = 0x141;
#else
this->spriteIndex = 0x142;
super->spriteIndex = 0x142;
#endif
this->type2 = 0xFF;
LoadSwapGFX(this, 1, 3);
super->type2 = 0xFF;
LoadSwapGFX(super, 1, 3);
}
if (sub_0808E950()) {
int i;
s32 i;
for (i = 6; i != 0; i--) {
if (GetInventoryValue(i)) {
break;
@@ -176,42 +189,42 @@ void sub_0808E988(Entity* this) {
}
if (i != 0) {
if (this->type2 != i) {
InitAnimationForceUpdate(this, i);
if (super->type2 != i) {
InitAnimationForceUpdate(super, i);
}
this->spriteSettings.draw = 2;
super->spriteSettings.draw = 2;
return;
}
}
this->spriteSettings.draw = 0;
super->spriteSettings.draw = 0;
}
void sub_0808E9F4(Entity* this) {
void FileScreenObjects_Type25(FileScreenObjectsEntity* this) {
if (sub_0808E950() && gSave.saw_staffroll) {
this->spriteSettings.draw = 2;
super->spriteSettings.draw = 2;
} else {
this->spriteSettings.draw = 0;
super->spriteSettings.draw = 0;
}
}
void sub_0808EA28(Entity* this) {
void FileScreenObjects_Type0(FileScreenObjectsEntity* this) {
u32 var0;
u32 var1;
if (this->type == 3) {
if (super->type == 3) {
if (gSaveHeader->language > LANGUAGE_EN) {
this->spriteSettings.draw = 2;
super->spriteSettings.draw = 2;
} else {
this->spriteSettings.draw = 0;
super->spriteSettings.draw = 0;
}
}
if (this->type == gMapDataBottomSpecial.unk6) {
if (super->type == gMapDataBottomSpecial.unk6) {
var0 = 12;
var1 = 1;
} else {
if (gUI.lastState == 5 && this->type == gMapDataBottomSpecial.unk7) {
if (gUI.lastState == 5 && super->type == gMapDataBottomSpecial.unk7) {
var0 = 13;
var1 = 2;
} else {
@@ -220,16 +233,16 @@ void sub_0808EA28(Entity* this) {
}
}
this->palette.b.b0 = var0;
this->spriteRendering.b3 = var1;
super->palette.b.b0 = var0;
super->spriteRendering.b3 = var1;
sub_0808EABC(this);
gMapDataBottomSpecial.isTransitioning |= sub_0808EF6C(this);
}
void sub_0808EABC(Entity* this) {
int var0 = -72;
int var1 = this->type * 32 + 40;
int var2 = gMapDataBottomSpecial.unk6 == this->type;
void sub_0808EABC(FileScreenObjectsEntity* this) {
s32 var0 = -72;
s32 var1 = super->type * 32 + 40;
s32 var2 = gMapDataBottomSpecial.unk6 == super->type;
switch (gUI.lastState) {
case 0:
var0 = 24;
@@ -244,7 +257,7 @@ void sub_0808EABC(Entity* this) {
}
break;
case 5:
switch (gGenericMenu.unk10.a[this->type]) {
switch (gGenericMenu.unk10.a[super->type]) {
case 0:
var0 = 42;
var1 = 40;
@@ -253,7 +266,7 @@ void sub_0808EABC(Entity* this) {
case 2:
var0 = 20;
var1 = 144;
var1 -= (gGenericMenu.unk16 - gGenericMenu.unk10.a[this->type]) * 32;
var1 -= (gGenericMenu.unk16 - gGenericMenu.unk10.a[super->type]) * 32;
break;
}
break;
@@ -271,24 +284,24 @@ void sub_0808EABC(Entity* this) {
break;
}
this->field_0x68.HWORD = var0;
this->field_0x6a.HWORD = var1;
this->unk_68 = var0;
this->unk_6a = var1;
}
void sub_0808EB74(Entity* this) {
void FileScreenObjects_Type15(FileScreenObjectsEntity* this) {
Entity* entity = sub_0808EC80(gMapDataBottomSpecial.unk6);
if (entity != NULL) {
this->x.WORD = entity->x.WORD;
this->y.WORD = entity->y.WORD;
this->spriteRendering.b3 = entity->spriteRendering.b3;
SortEntityBelow(entity, this);
super->x.WORD = entity->x.WORD;
super->y.WORD = entity->y.WORD;
super->spriteRendering.b3 = entity->spriteRendering.b3;
SortEntityBelow(entity, super);
} else {
this->x.HALF.HI = 0xF000;
this->y.HALF.HI = 0xF000;
super->x.HALF.HI = 0xF000;
super->y.HALF.HI = 0xF000;
}
}
void sub_0808EBB8(Entity* this) {
void FileScreenObjects_Type16(FileScreenObjectsEntity* this) {
u32 var0;
u32 x, y;
Entity* entity;
@@ -331,19 +344,19 @@ void sub_0808EBB8(Entity* this) {
default:
entity = sub_0808EC80(var0);
if (entity != NULL) {
SortEntityBelow(entity, this);
this->spriteRendering.b3 = entity->spriteRendering.b3;
SortEntityBelow(entity, super);
super->spriteRendering.b3 = entity->spriteRendering.b3;
x = entity->x.HALF.HI;
y = entity->y.HALF.HI;
}
break;
}
this->x.HALF.HI = x;
this->y.HALF.HI = y;
super->x.HALF.HI = x;
super->y.HALF.HI = y;
}
static Entity* sub_0808EC80(int form) {
static Entity* sub_0808EC80(s32 form) {
Entity* entityA = (Entity*)&gEntityLists[6];
Entity* entityB = entityA->next;
while (entityB != entityA) {
@@ -355,7 +368,7 @@ static Entity* sub_0808EC80(int form) {
return NULL;
}
void sub_0808ECBC(Entity* this) {
void FileScreenObjects_Type4(FileScreenObjectsEntity* this) {
static const struct_08121CD4 gUnk_08121CD4[][4] = {
{ { 0x9, 0x18, 0xb0 }, { 0x9, 0x60, 0xb0 }, { 0x9, 0xa8, 0xb0 }, { 0x9, 0x40, 0xb0 } },
{ { 0x0, 0x18, 0x90 }, { 0x1, 0x60, 0x90 }, { 0x2, 0xa8, 0x90 }, { 0x9, 0x40, 0xb0 } },
@@ -363,9 +376,9 @@ void sub_0808ECBC(Entity* this) {
{ { 0x9, 0x18, 0xb0 }, { 0x9, 0x60, 0xb0 }, { 0x1, 0x88, 0x90 }, { 0x0, 0x40, 0x90 } },
{ { 0x0, 0x18, 0x90 }, { 0x9, 0x60, 0xb0 }, { 0x9, 0xa8, 0xb0 }, { 0x9, 0x40, 0xb0 } }
};
int var0;
int var1;
int var2;
s32 var0;
s32 var1;
s32 var2;
const struct_08121CD4* var3;
var0 = gMenu.column_idx;
@@ -388,66 +401,66 @@ void sub_0808ECBC(Entity* this) {
break;
}
var2 = this->type - 4;
var2 = super->type - 4;
var3 = &gUnk_08121CD4[var1][var2];
this->field_0x68.HWORD = var3->unk1;
this->field_0x6a.HWORD = var3->unk2;
this->unk_68 = var3->unk1;
this->unk_6a = var3->unk2;
if (var3->unk0 == var0) {
this->palette.b.b0 = 13;
super->palette.b.b0 = 13;
} else {
this->palette.b.b0 = 14;
super->palette.b.b0 = 14;
}
gMapDataBottomSpecial.isTransitioning |= sub_0808EF6C(this);
}
void sub_0808ED64(Entity* this) {
int y = 255;
void FileScreenObjects_Type8(FileScreenObjectsEntity* this) {
s32 y = 255;
if (gUI.lastState == 1 && gGenericMenu.unk10.a[1] != 5) {
this->x.HALF.HI = gGenericMenu.unk10.a[0] * 16 + 28;
super->x.HALF.HI = gGenericMenu.unk10.a[0] * 16 + 28;
y = gGenericMenu.unk10.a[1] * 16 + 58;
}
this->y.HALF.HI = y;
super->y.HALF.HI = y;
}
void sub_0808ED98(Entity* this) {
void FileScreenObjects_Type9(FileScreenObjectsEntity* this) {
static const s8 gUnk_08121D10[] = {
0, -1, -3, -2, -2, -1, 0, 0,
};
int y;
s32 y;
if (gUI.lastState != 1) {
this->field_0x68.HWORD = 27;
this->unk_68 = 27;
y = -10;
} else {
u32 var0 = gGenericMenu.unk10.a[3];
if (var0 > 5) {
var0 = 5;
}
this->field_0x68.HWORD = var0 * 8 + 27;
this->unk_68 = var0 * 8 + 27;
y = 24;
}
this->y.HALF.HI = y;
this->field_0x6a.HWORD = y;
this->subtimer++;
this->spriteOffsetY = gUnk_08121D10[(this->subtimer / 4) & 0x7];
super->y.HALF.HI = y;
this->unk_6a = y;
super->subtimer++;
super->spriteOffsetY = gUnk_08121D10[(super->subtimer / 4) & 0x7];
sub_0808EF6C(this);
}
void sub_0808EE00(Entity* this) {
void FileScreenObjects_Type10(FileScreenObjectsEntity* this) {
static const u16 gUnk_08121D18[][8] = { { 0x2c, 0x54, 0x7c, 0xa4, 0xcc, 0x0, 0x0, 0x0 },
{ 0xfff, 0x2e, 0x62, 0x96, 0xca, 0x0, 0x0, 0x0 } };
static const u8 gUnk_08121D38[][8] = {
{ 12, 13, 14, 16, 17, 0, 0, 0 },
{ -1, 14, 15, 16, 17, 0, 0, 0 },
};
int var0, var1, var2;
s32 var0, var1, var2;
var0 = ((SaveHeader*)0x2000000)->language != 0;
var1 = this->type - 10;
this->frameIndex = gUnk_08121D38[var0][var1];
this->x.HALF.HI = gUnk_08121D18[var0][var1];
this->field_0x68.HWORD = gUnk_08121D18[var0][var1];
var1 = super->type - 10;
super->frameIndex = gUnk_08121D38[var0][var1];
super->x.HALF.HI = gUnk_08121D18[var0][var1];
this->unk_68 = gUnk_08121D18[var0][var1];
var1 -= var0;
if (gUI.lastState != 1) {
var1 = 128;
@@ -456,81 +469,81 @@ void sub_0808EE00(Entity* this) {
var2 = 140;
}
this->field_0x6a.HWORD = var2;
this->palette.b.b0 = gGenericMenu.unk10.a[1] == 5 && var1 == gGenericMenu.unk10.a[2] ? 11 : 9;
this->unk_6a = var2;
super->palette.b.b0 = gGenericMenu.unk10.a[1] == 5 && var1 == gGenericMenu.unk10.a[2] ? 11 : 9;
gMapDataBottomSpecial.isTransitioning |= sub_0808EF6C(this);
}
void nullsub_522(Entity* this) {
void FileScreenObjects_Type17(FileScreenObjectsEntity* this) {
}
void sub_0808EE98(Entity* this) {
void FileScreenObjects_Type18(FileScreenObjectsEntity* this) {
static const u8 gUnk_08121D48[] = { 0x28, 0x27, 0x28, 0x28, 0x28, 0x2a, 0x29, 0x28, 0xff, 0x0, 0x0, 0x0 };
this->timer = gUI.lastState;
this->frameIndex = gUnk_08121D48[this->timer];
if (this->timer != 2) {
this->field_0x68.HWORD = 96;
super->timer = gUI.lastState;
super->frameIndex = gUnk_08121D48[super->timer];
if (super->timer != 2) {
this->unk_68 = 96;
} else {
this->field_0x68.HWORD = -96;
this->unk_68 = -96;
}
sub_0808EF6C(this);
}
void sub_0808EED8(Entity* this) {
int var0;
void FileScreenObjects_Type19(FileScreenObjectsEntity* this) {
s32 var0;
if (gUI.lastState != 3) {
this->spriteSettings.draw = 0;
super->spriteSettings.draw = 0;
} else {
this->spriteSettings.draw = 2;
var0 = this->type - 19;
this->palette.b.b0 = gMenu.column_idx == var0 ? 4 : 3;
super->spriteSettings.draw = 2;
var0 = super->type - 19;
super->palette.b.b0 = gMenu.column_idx == var0 ? 4 : 3;
}
}
void sub_0808EF24(Entity* this) {
int var0;
void FileScreenObjects_Type21(FileScreenObjectsEntity* this) {
s32 var0;
if (gUI.lastState != 3) {
this->spriteSettings.draw = 0;
super->spriteSettings.draw = 0;
} else {
this->spriteSettings.draw = 2;
if (this->type == 21) {
super->spriteSettings.draw = 2;
if (super->type == 21) {
var0 = ((SaveHeader*)0x2000000)->msg_speed;
} else {
var0 = ((SaveHeader*)0x2000000)->brightness;
}
this->frameIndex = this->lastFrameIndex + var0;
super->frameIndex = super->lastFrameIndex + var0;
}
}
static u32 sub_0808EF6C(Entity* this) {
int var0;
static u32 sub_0808EF6C(FileScreenObjectsEntity* this) {
s32 var0;
u32 var1;
int var2;
s32 var2;
u32 var3;
int var4;
s32 var4;
s16 var5;
s16 var6;
int var7;
s32 var7;
var6 = this->field_0x68.HWORD;
var0 = var6 - this->x.HALF.HI;
var6 = this->unk_68;
var0 = var6 - super->x.HALF.HI;
var1 = var0;
if (var0 < 0) {
var1 = -var0;
}
if (var1 < 2) {
this->x.WORD = var6 << 16;
super->x.WORD = var6 << 16;
var0 = 0;
}
var5 = this->field_0x6a.HWORD;
var2 = var5 - this->y.HALF.HI;
var5 = this->unk_6a;
var2 = var5 - super->y.HALF.HI;
var3 = var2;
if (var2 < 0) {
var3 = -var2;
}
if (var3 < 2) {
this->y.WORD = var5 << 16;
super->y.WORD = var5 << 16;
var2 = 0;
}
@@ -541,16 +554,16 @@ static u32 sub_0808EF6C(Entity* this) {
var4 = var7 = sub_080041EC(var0, var2);
var4 += 128;
var7 = var4 + var7 * 16;
if (this->field_0x6c.HWORD < var7) {
var7 = this->field_0x6c.HWORD;
if (this->unk_6c < var7) {
var7 = this->unk_6c;
}
this->speed = var7;
this->direction = CalculateDirectionFromOffsets(var0, var2) >> 3;
LinearMoveUpdate(this);
super->speed = var7;
super->direction = CalculateDirectionFromOffsets(var0, var2) >> 3;
LinearMoveUpdate(super);
return 1;
}
static void sub_0808EFF0(Entity* this) {
static void sub_0808EFF0(FileScreenObjectsEntity* this) {
static const struct_08121D54 gUnk_08121D54[] = {
{ 0x800, -0x40, 0x28, 2, 4, 1, 0x80 }, { 0x800, -0x40, 0x48, 2, 4, 1, 0x81 },
{ 0x800, -0x40, 0x68, 2, 4, 1, 0x82 }, { 0x800, -0x40, 0x88, 2, 4, 1, 0x83 },
@@ -569,26 +582,26 @@ static void sub_0808EFF0(Entity* this) {
const struct_08121D54* var0;
u8 var1;
this->spriteSettings.draw = 2;
this->speed = 0x400;
this->health = 1;
this->frameIndex = 0xFF;
this->animIndex = 0xFF;
var0 = &gUnk_08121D54[this->type];
this->x.HALF.HI = var0->unk2;
this->field_0x68.HWORD = var0->unk2;
this->y.HALF.HI = var0->unk4;
this->field_0x6a.HWORD = var0->unk4;
this->spriteRendering.b3 = var0->unk6_0;
this->spritePriority.b0 = var0->unk6_3;
this->spriteOrientation.flipY = var0->unk6_6;
this->field_0x6c.HWORD = var0->unk0;
super->spriteSettings.draw = 2;
super->speed = 0x400;
super->health = 1;
super->frameIndex = 0xFF;
super->animIndex = 0xFF;
var0 = &gUnk_08121D54[super->type];
super->x.HALF.HI = var0->unk2;
this->unk_68 = var0->unk2;
super->y.HALF.HI = var0->unk4;
this->unk_6a = var0->unk4;
super->spriteRendering.b3 = var0->unk6_0;
super->spritePriority.b0 = var0->unk6_3;
super->spriteOrientation.flipY = var0->unk6_6;
this->unk_6c = var0->unk0;
var1 = var0->unk7;
if (var1 & 0x80) {
var1 &= ~(0x80);
this->frameIndex = var1;
this->lastFrameIndex = var1;
super->frameIndex = var1;
super->lastFrameIndex = var1;
} else {
InitAnimationForceUpdate(this, var1);
InitAnimationForceUpdate(super, var1);
}
}
+4 -4
View File
@@ -11,7 +11,7 @@
#include "projectile.h"
#include "projectile/winder.h"
void FireballChain(Entity* thisx) {
void FireballChain(Entity* this) {
WinderEntity* newSegment;
Entity* parent;
Entity* child;
@@ -33,11 +33,11 @@ void FireballChain(Entity* thisx) {
newSegment->base.type = i;
newSegment->base.parent = parent;
newSegment->base.child = child;
CopyPosition(thisx, &newSegment->base);
CopyPosition(this, &newSegment->base);
for (j = 0, tmp = newSegment->positions; j < WINDER_NUM_SEGMENTS; j++) {
*tmp++ = thisx->x.HALF.HI;
*tmp++ = thisx->y.HALF.HI;
*tmp++ = this->x.HALF.HI;
*tmp++ = this->y.HALF.HI;
}
child = &newSegment->base;
+30 -23
View File
@@ -4,54 +4,61 @@
*
* @brief Fireplace object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
#include "tiles.h"
void Fireplace_Action1(Entity* this);
void sub_0809B7DC(Entity* this);
void sub_0809B7C0(Entity* this);
void Fireplace_Init(Entity* this);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[30];
/*0x86*/ u16 unk_86;
} FireplaceEntity;
void Fireplace(Entity* e) {
static void (*const Fireplace_Actions[])(Entity*) = {
void Fireplace_Action1(FireplaceEntity* this);
void sub_0809B7DC(FireplaceEntity* this);
void sub_0809B7C0(FireplaceEntity* this);
void Fireplace_Init(FireplaceEntity* this);
void Fireplace(FireplaceEntity* this) {
static void (*const Fireplace_Actions[])(FireplaceEntity*) = {
Fireplace_Init,
Fireplace_Action1,
};
Fireplace_Actions[e->action](e);
Fireplace_Actions[super->action](this);
}
void Fireplace_Init(Entity* this) {
this->action = 1;
this->spriteSettings.draw = 1;
this->speed = 0x80;
if (CheckFlags(this->field_0x86.HWORD)) {
void Fireplace_Init(FireplaceEntity* this) {
super->action = 1;
super->spriteSettings.draw = 1;
super->speed = 0x80;
if (CheckFlags(this->unk_86)) {
sub_0809B7DC(this);
DeleteThisEntity();
} else {
sub_0807B7D8(0x30b, TILE(this->x.HALF.HI, this->y.HALF.HI), 2);
SetMetaTile(SPECIAL_META_TILE_97, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
sub_0807B7D8(0x30b, TILE(super->x.HALF.HI, super->y.HALF.HI), 2);
SetMetaTile(SPECIAL_META_TILE_97, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
}
Fireplace_Action1(this);
}
void Fireplace_Action1(Entity* this) {
void Fireplace_Action1(FireplaceEntity* this) {
sub_0809B7C0(this);
if (this->timer) {
SetFlag(this->field_0x86.HWORD);
if (super->timer) {
SetFlag(this->unk_86);
DeleteThisEntity();
}
}
void sub_0809B7C0(Entity* this) {
u32 tileType = GetMetaTileTypeByEntity(this);
void sub_0809B7C0(FireplaceEntity* this) {
u32 tileType = GetMetaTileTypeByEntity(super);
if (tileType != SPECIAL_META_TILE_97 && tileType != SPECIAL_META_TILE_98) {
sub_0809B7DC(this);
}
}
void sub_0809B7DC(Entity* this) {
sub_0807B7D8(0xc3 << 2, TILE(this->x.HALF.HI, this->y.HALF.HI), 2);
SetMetaTile(SPECIAL_META_TILE_98, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
this->timer = 1;
void sub_0809B7DC(FireplaceEntity* this) {
sub_0807B7D8(0xc3 << 2, TILE(super->x.HALF.HI, super->y.HALF.HI), 2);
SetMetaTile(SPECIAL_META_TILE_98, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
super->timer = 1;
}
+47 -41
View File
@@ -4,101 +4,107 @@
*
* @brief Flame object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "sound.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[30];
/*0x86*/ u16 unk_86;
} FlameEntity;
extern void sub_0807AB44(Entity*, s32, s32);
void (*const Flame_Actions[])(Entity*);
void (*const Flame_Actions[])(FlameEntity*);
void Flame(Entity* this) {
Flame_Actions[this->action](this);
void Flame(FlameEntity* this) {
Flame_Actions[super->action](this);
}
void Flame_Init(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
if (this->type2 != 0) {
this->timer = this->type2;
void Flame_Init(FlameEntity* this) {
super->action = 1;
super->spriteSettings.draw = TRUE;
if (super->type2 != 0) {
super->timer = super->type2;
}
InitializeAnimation(this, 0);
switch (this->type) {
InitializeAnimation(super, 0);
switch (super->type) {
case 1:
this->y.HALF.HI -= 8;
this->timer = 40;
super->y.HALF.HI -= 8;
super->timer = 40;
break;
case 2:
this->timer = 15;
sub_08004168(this);
super->timer = 15;
sub_08004168(super);
break;
case 3:
CopyPosition(this->parent, this);
CopyPosition(super->parent, super);
break;
case 4:
if (!CheckFlags(this->field_0x86.HWORD)) {
this->spriteSettings.draw = FALSE;
this->subAction = 1;
if (!CheckFlags(this->unk_86)) {
super->spriteSettings.draw = FALSE;
super->subAction = 1;
return;
}
}
EnqueueSFX(SFX_124);
}
void Flame_Action1(Entity* this) {
void Flame_Action1(FlameEntity* this) {
u32 val;
GetNextFrame(this);
GetNextFrame(super);
switch (this->type) {
switch (super->type) {
case 0:
default:
if (this->type2 == 0)
if (super->type2 == 0)
return;
case 1:
case 2:
if (this->timer-- != 0)
if (super->timer-- != 0)
return;
if (this->type == 2) {
sub_0807B7D8(((u16*)this->child)[3], COORD_TO_TILE(this), this->collisionLayer);
sub_0807AB44(this, 0, 0x10);
sub_0807AB44(this, 0, -0x10);
sub_0807AB44(this, 0x10, 0);
sub_0807AB44(this, -0x10, 0);
if (super->type == 2) {
sub_0807B7D8(((u16*)super->child)[3], COORD_TO_TILE(super), super->collisionLayer);
sub_0807AB44(super, 0, 0x10);
sub_0807AB44(super, 0, -0x10);
sub_0807AB44(super, 0x10, 0);
sub_0807AB44(super, -0x10, 0);
}
DeleteThisEntity();
break;
case 3:
if (this->parent->next == NULL) {
if (super->parent->next == NULL) {
DeleteThisEntity();
}
if (--this->timer == 0) {
if (--super->timer == 0) {
DeleteThisEntity();
}
CopyPosition(this->parent, this);
CopyPosition(super->parent, super);
break;
case 4:
val = CheckFlags(this->field_0x86.HWORD);
if (this->subAction == 0) {
val = CheckFlags(this->unk_86);
if (super->subAction == 0) {
if (val)
return;
this->subAction = 1;
this->spriteSettings.draw = 0;
super->subAction = 1;
super->spriteSettings.draw = 0;
} else {
if (!val)
return;
this->subAction = 0;
this->spriteSettings.draw = 1;
InitializeAnimation(this, 0);
super->subAction = 0;
super->spriteSettings.draw = 1;
InitializeAnimation(super, 0);
EnqueueSFX(SFX_124);
}
break;
}
}
void (*const Flame_Actions[])(Entity*) = {
void (*const Flame_Actions[])(FlameEntity*) = {
Flame_Init,
Flame_Action1,
};
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Floating Block object
*/
#define NENT_DEPRECATED
#include "object.h"
void FloatingBlock(Entity* this) {
+9 -9
View File
@@ -1,10 +1,10 @@
#define NENT_DEPRECATED
/**
* @file floatingPlatform.c
* @ingroup Objects
*
* @brief Floating Platform object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "object.h"
@@ -15,20 +15,20 @@ typedef struct {
u16 unk70;
} FloatingPlatformEntity;
void sub_080860D8(FloatingPlatformEntity*);
void sub_0808611C(FloatingPlatformEntity*);
void FloatingPlatform_Init(FloatingPlatformEntity*);
void FloatingPlatform_Action1(FloatingPlatformEntity*);
bool32 sub_08086168(FloatingPlatformEntity*);
void FloatingPlatform(Entity* this) {
static void (*const actionFuncs[])(FloatingPlatformEntity*) = {
sub_080860D8,
sub_0808611C,
static void (*const FloatingPlatform_Action[])(FloatingPlatformEntity*) = {
FloatingPlatform_Init,
FloatingPlatform_Action1,
};
actionFuncs[this->action]((FloatingPlatformEntity*)this);
FloatingPlatform_Action[this->action]((FloatingPlatformEntity*)this);
}
void sub_080860D8(FloatingPlatformEntity* this) {
void FloatingPlatform_Init(FloatingPlatformEntity* this) {
super->action = 1;
super->speed = 0x100;
super->spriteSettings.draw = 1;
@@ -38,7 +38,7 @@ void sub_080860D8(FloatingPlatformEntity* this) {
UpdateRailMovement(super, (u16**)&super->child, &this->unk70);
}
void sub_0808611C(FloatingPlatformEntity* this) {
void FloatingPlatform_Action1(FloatingPlatformEntity* this) {
bool32 iVar2 = sub_08086168(this);
if (super->timer != 0 && super->parent->timer == 0) {
-2
View File
@@ -4,11 +4,9 @@
*
* @brief Four Elements object
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "message.h"
#include "object.h"
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Frozen Flower object
*/
#define NENT_DEPRECATED
#include "object.h"
void FrozenFlower_Init(Entity*);
-1
View File
@@ -7,7 +7,6 @@
#define NENT_DEPRECATED
#include "enemy/octorokBoss.h"
#include "functions.h"
#include "global.h"
#include "message.h"
#include "object.h"
+2 -2
View File
@@ -193,12 +193,12 @@ static void sub_08090E4C(FurnitureEntity*);
static void sub_08090CDC(u32, u32, u32);
void Furniture(Entity* this) {
static FurnitureAction* const sFurnitureActions[] = {
static FurnitureAction* const Furniture_Actions[] = {
FurnitureInit,
FurnitureUpdate,
};
sFurnitureActions[this->action]((FurnitureEntity*)this);
Furniture_Actions[this->action]((FurnitureEntity*)this);
}
static void FurnitureInit(FurnitureEntity* this) {
+14 -13
View File
@@ -4,23 +4,24 @@
*
* @brief Giant Leaf object
*/
#define NENT_DEPRECATED
#include "map.h"
#include "object.h"
void sub_0808D618(Entity* ent);
void sub_0808D618(Entity* this);
void GiantLeaf(Entity* ent) {
if (ent->action == 0) {
ent->action = 1;
ent->spriteSettings.draw = 1;
ent->spriteRendering.b3 = 3;
ent->spritePriority.b0 = 7;
ent->frameIndex = ent->type;
sub_0808D618(ent);
void GiantLeaf(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->spriteSettings.draw = 1;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->frameIndex = this->type;
sub_0808D618(this);
}
}
void sub_0808D618(Entity* ent) {
void sub_0808D618(Entity* this) {
static const s16 gUnk_08121750[] = {
0x41, 0x40, 0x3f, 0x3e, 0x1, 0x0, -0x1, -0x2, -0x3e, -0x3f, -0x40, -0x41, -0x7e,
};
@@ -31,9 +32,9 @@ void sub_0808D618(Entity* ent) {
const s16* arr;
u32 i;
arr = (ent->type != 0) ? gUnk_0812176A : gUnk_08121750;
tilePos = (((ent->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
((((ent->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64);
arr = (this->type != 0) ? gUnk_0812176A : gUnk_08121750;
tilePos = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64);
for (i = 0; i < 13; i++) {
SetMetaTile(16500, tilePos + arr[i], LAYER_BOTTOM);
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Giant Rock object
*/
#define NENT_DEPRECATED
#include "entity.h"
void GiantRock(Entity* this) {
+4 -4
View File
@@ -16,15 +16,15 @@ typedef struct {
u16 metaTilePos;
} GiantRock2Entity;
void GiantRock2_Init(GiantRock2Entity*);
void GiantRock2_Idle(GiantRock2Entity*);
void GiantRock2_Init(GiantRock2Entity* this);
void GiantRock2_Idle(GiantRock2Entity* this);
void GiantRock2(Entity* this) {
static void (*const actionFuncs[])(GiantRock2Entity*) = {
static void (*const GiantRock2_Action[])(GiantRock2Entity*) = {
GiantRock2_Init,
GiantRock2_Idle,
};
actionFuncs[this->action]((GiantRock2Entity*)this);
GiantRock2_Action[this->action]((GiantRock2Entity*)this);
}
void GiantRock2_Init(GiantRock2Entity* this) {
-1
View File
@@ -4,7 +4,6 @@
*
* @brief Giant Twig object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
+17 -12
View File
@@ -45,21 +45,26 @@ void GraveyardKey_Action2(Entity*, const struct_gUnk_08123FB0*);
void GraveyardKey_Action3(Entity*, const struct_gUnk_08123FB0*);
static const struct_gUnk_08123FB0 gUnk_08123FB0[] = {
{ sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021,
0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x63, 0x63, 0x10, 0, 0x1800, 0, 0x18,
{ sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x13,
Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_HEART_PIECE, ITEM_HEART_PIECE, 0x10, 0, 0x1800, 0, 0x18,
#if defined(JP) || defined(DEMO_JP) || defined(EU)
0xCD,
#else
0xd0,
#endif
0, 0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0xf, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, 0x3c, 0x3c, 0x2, Q_16_16(1.0), 0x1800, 0x140, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0xd, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x1a, Q_16_16(1.0), 0x1800, 0x100, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0x0, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, 0x1, 0x0 },
{ NULL, NULL, 0, 0, 0, 0, 0x0, 0x5c, 0x5c, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0xf, Q_16_16(1.0), 0x1800,
0x60, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x2, Q_16_16(1.0), 0x1800,
0x140, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0xd, Q_16_16(1.0), 0x1800,
0x60, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x1a, Q_16_16(1.0), 0x1800,
0x100, 0x40, 0x4021, 0x1, 0x0 },
{ sub_0809D91C, NULL, 0, 0, 0, 0, 0, ITEM_QST_GRAVEYARD_KEY, ITEM_QST_GRAVEYARD_KEY, 0x13, Q_16_16(1.0), 0x1800,
0x60, 0x40, 0x4021, 0x1, 0x0 },
{ NULL, NULL, 0, 0, 0, 0, 0, ITEM_KINSTONE, ITEM_KINSTONE, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 },
};
void GraveyardKey(Entity* this) {
@@ -85,10 +90,10 @@ void GraveyardKey_Init(Entity* this, const struct_gUnk_08123FB0* param_2) {
this->y.HALF.HI -= param_2->y;
this->z.WORD = 0;
this->timer = param_2->timer;
if ((this->direction & 0x80)) {
if ((this->direction & DIR_NOT_MOVING_CHECK)) {
dir = this->direction;
if (dir == 0x81) {
this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ 0x10;
if (dir == (DIR_NOT_MOVING_CHECK | 0x1)) {
this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ DirectionSouth;
}
}
UpdateSpriteForCollisionLayer(this);
+253 -244
View File
@@ -4,28 +4,37 @@
*
* @brief Great Fairy object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
#include "save.h"
#include "screen.h"
#include "script.h"
void GreatFairy_InitializeAnimation(Entity*);
Entity* GreatFairy_CreateForm(Entity*, u32, u32);
void sub_080873D0(Entity*);
extern void (*const GreatFairy_Main[])(Entity*);
extern void (*const GreatFairy_Behaviors[])(Entity*);
extern void (*const GreatFairy_WingsBehaviors[])(Entity*);
extern void (*const GreatFairy_WakeBehaviors[])(Entity*);
extern void (*const GreatFairy_MiniBehaviors[])(Entity*);
extern void (*const GreatFairy_MiniAffineBehaviors[])(Entity*);
extern void (*const GreatFairy_DropletBehaviors[])(Entity*);
extern void (*const GreatFairy_RippleBehaviors[])(Entity*);
extern void (*const GreatFairy_BigRippleBehaviors[])(Entity*);
extern void (*const GreatFairy_EnergyBehaviors[])(Entity*);
extern void (*const GreatFairy_Form1Behaviors[])(Entity*);
extern void (*const GreatFairy_Form2Behaviors[])(Entity*);
extern void (*const gUnk_081207A4[])(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ s16 unk_68;
/*0x6a*/ s16 unk_6a;
/*0x6c*/ u8 unused1[24];
/*0x84*/ u16 unk_84;
} GreatFairyEntity;
void GreatFairy_InitializeAnimation(GreatFairyEntity*);
Entity* GreatFairy_CreateForm(GreatFairyEntity*, u32, u32);
void sub_080873D0(GreatFairyEntity*);
extern void (*const GreatFairy_Main[])(GreatFairyEntity*);
extern void (*const GreatFairy_Behaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_WingsBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_WakeBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_MiniBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_MiniAffineBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_DropletBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_RippleBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_BigRippleBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_EnergyBehaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_Form1Behaviors[])(GreatFairyEntity*);
extern void (*const GreatFairy_Form2Behaviors[])(GreatFairyEntity*);
extern void (*const gUnk_081207A4[])(GreatFairyEntity*);
extern const s16 GreatFairy_RippleOffsets[10];
extern u8 gUnk_0812079C[8];
@@ -45,21 +54,21 @@ enum {
};
// Main
void GreatFairy(Entity* this) {
if (this->action == 0) {
void GreatFairy(GreatFairyEntity* this) {
if (super->action == 0) {
s32 temp = 11;
this->type2 = this->type % temp;
super->type2 = super->type % temp;
}
GreatFairy_Main[this->type2](this);
GreatFairy_Main[super->type2](this);
}
// Behaviors
void GreatFairy_CallBehavior(Entity* this) {
GreatFairy_Behaviors[this->action](this);
void GreatFairy_CallBehavior(GreatFairyEntity* this) {
GreatFairy_Behaviors[super->action](this);
if ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) < 168) {
gRoomControls.camera_target = this;
gRoomControls.camera_target = super;
gRoomControls.scrollSpeed = 2;
} else {
gRoomControls.camera_target = &gPlayerEntity;
@@ -68,13 +77,13 @@ void GreatFairy_CallBehavior(Entity* this) {
}
// Init
void GreatFairy_Init(Entity* this) {
void GreatFairy_Init(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->timer = 0;
this->cutsceneBeh.HWORD = 290;
super->timer = 0;
this->unk_84 = 290;
}
void GreatFairy_DormantUpdate(Entity* this) {
void GreatFairy_DormantUpdate(GreatFairyEntity* this) {
u16* pFrame; // r1@2
s32 frame; // r1@4
Entity* ripple; // r5@16
@@ -82,13 +91,13 @@ void GreatFairy_DormantUpdate(Entity* this) {
if (!CheckRoomFlag(0))
return;
pFrame = &this->cutsceneBeh.HWORD;
pFrame = &this->unk_84;
if (*pFrame != 0) {
--*pFrame;
}
switch (*pFrame) {
case 0:
this->action = 2;
super->action = 2;
break;
case 130:
case 150:
@@ -97,421 +106,421 @@ void GreatFairy_DormantUpdate(Entity* this) {
case 289:
ripple = GreatFairy_CreateForm(this, RIPPLE, 0);
if (ripple) {
PositionRelative(this, ripple, Q_16_16(GreatFairy_RippleOffsets[this->timer]),
Q_16_16(GreatFairy_RippleOffsets[this->timer + 1]));
this->timer += 2;
PositionRelative(super, ripple, Q_16_16(GreatFairy_RippleOffsets[super->timer]),
Q_16_16(GreatFairy_RippleOffsets[super->timer + 1]));
super->timer += 2;
break;
}
}
}
void GreatFairy_CreateBigRipple(Entity* this) {
void GreatFairy_CreateBigRipple(GreatFairyEntity* this) {
Entity* ripple;
ripple = GreatFairy_CreateForm(this, BIGRIPPLE, 0);
if (ripple != NULL) {
PositionRelative(this, ripple, 0, Q_16_16(8.0));
this->action = 3;
PositionRelative(super, ripple, 0, Q_16_16(8.0));
super->action = 3;
}
}
// Great Fairy spawning in update
void GreatFairy_SpawningUpdate(Entity* this) {
void GreatFairy_SpawningUpdate(GreatFairyEntity* this) {
Entity* mini;
u32 var;
if (gRoomVars.animFlags & 1) {
mini = GreatFairy_CreateForm(this, WAKE, 0); //???
if (mini != NULL) {
CopyPosition(this, mini);
CopyPosition(super, mini);
SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 4);
SoundReq(SFX_145);
this->action = 4;
this->timer = 60;
this->spriteSettings.draw = 1;
super->action = 4;
super->timer = 60;
super->spriteSettings.draw = 1;
}
}
}
void GreatFairy_MiniUpdate(Entity* this) {
void GreatFairy_MiniUpdate(GreatFairyEntity* this) {
Entity* target;
GetNextFrame(this);
if (this->timer != 0) {
--this->timer;
GetNextFrame(super);
if (super->timer != 0) {
--super->timer;
} else {
target = GreatFairy_CreateForm(this, WINGS, 0);
if (target != NULL) {
PositionRelative(this, target, 0, Q_16_16(-20.0));
this->action = 5;
this->timer = 120;
this->subtimer = 0;
PositionRelative(super, target, 0, Q_16_16(-20.0));
super->action = 5;
super->timer = 120;
super->subtimer = 0;
}
}
}
// This is the great fairy's "normal" form
void GreatFairy_FinalUpdate(Entity* this) {
void GreatFairy_FinalUpdate(GreatFairyEntity* this) {
Entity* target;
if (this->timer != 0) {
--this->timer;
if (super->timer != 0) {
--super->timer;
} else {
if ((this->subtimer == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) {
PositionRelative(this, target, 0, Q_16_16(-76.0));
target->parent = this;
this->subtimer = 1;
if ((super->subtimer == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) {
PositionRelative(super, target, 0, Q_16_16(-76.0));
target->parent = super;
super->subtimer = 1;
}
}
GetNextFrame(this);
GetNextFrame(super);
}
void GreatFairy_WingsCallBehavior(Entity* this) {
GreatFairy_WingsBehaviors[this->action](this);
void GreatFairy_WingsCallBehavior(GreatFairyEntity* this) {
GreatFairy_WingsBehaviors[super->action](this);
}
void GreatFairy_WingsInit(Entity* this) {
void GreatFairy_WingsInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spritePriority.b0 = 5;
this->spriteSettings.draw = 1;
this->spriteRendering.alphaBlend = 1;
super->spritePriority.b0 = 5;
super->spriteSettings.draw = 1;
super->spriteRendering.alphaBlend = 1;
gScreen.controls.layerFXControl = 0xF40;
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 8);
this->speed = 1024;
SetAffineInfo(this, 1024, 256, 0);
super->speed = 1024;
SetAffineInfo(super, 1024, 256, 0);
}
void GreatFairy_WingsUpdate(Entity* this) {
this->speed -= 32;
if (this->speed == 256) {
this->action = 2;
sub_0805EC60(this);
void GreatFairy_WingsUpdate(GreatFairyEntity* this) {
super->speed -= 32;
if (super->speed == 256) {
super->action = 2;
sub_0805EC60(super);
gRoomVars.animFlags |= 32;
gActiveScriptInfo.syncFlags |= 4;
} else {
SetAffineInfo(this, this->speed, 256, 0);
SetAffineInfo(super, super->speed, 256, 0);
}
}
void nullsub_116(Entity* this) {
void nullsub_116(GreatFairyEntity* this) {
}
// The wake that appears beneath the Great Fairy as she stands in the water
void GreatFairy_WakeCallBehavior(Entity* this) {
GreatFairy_WakeBehaviors[this->action](this);
void GreatFairy_WakeCallBehavior(GreatFairyEntity* this) {
GreatFairy_WakeBehaviors[super->action](this);
}
void GreatFairy_WakeInit(Entity* this) {
void GreatFairy_WakeInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.draw = 1;
this->spritePriority.b0 = 6;
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 6;
}
void GreatFairy_WakeUpdate(Entity* this) {
GetNextFrame(this);
void GreatFairy_WakeUpdate(GreatFairyEntity* this) {
GetNextFrame(super);
}
// The miniature sprite that emerges from the water when Great Fairy is spawned
void GreatFairy_MiniCallBehavior(Entity* this) {
GreatFairy_MiniBehaviors[this->action](this);
void GreatFairy_MiniCallBehavior(GreatFairyEntity* this) {
GreatFairy_MiniBehaviors[super->action](this);
}
void GreatFairy_MiniInit(Entity* this) {
void GreatFairy_MiniInit(GreatFairyEntity* this) {
Entity* aff;
aff = GreatFairy_CreateForm(this, MINIAFFINE, 0);
if (aff != NULL) {
CopyPosition(this, aff);
aff->parent = this;
CopyPosition(super, aff);
aff->parent = super;
GreatFairy_InitializeAnimation(this);
this->spriteSettings.draw = 1;
this->subtimer = 0;
super->spriteSettings.draw = 1;
super->subtimer = 0;
}
}
// Spawns a droplet of water once it reaches a certain height
void GreatFairy_MiniRisingUpdate(Entity* this) {
void GreatFairy_MiniRisingUpdate(GreatFairyEntity* this) {
Entity* target;
GetNextFrame(this);
this->z.WORD -= Q_16_16(0.5);
if (this->z.HALF.HI == -20) {
this->action = 2;
GetNextFrame(super);
super->z.WORD -= Q_16_16(0.5);
if (super->z.HALF.HI == -20) {
super->action = 2;
SoundReq(SFX_HEART_CONTAINER_SPAWN);
} else {
if (((this->z.HALF.HI == -10) && (this->subtimer == 0)) &&
if (((super->z.HALF.HI == -10) && (super->subtimer == 0)) &&
(target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) {
PositionRelative(this, target, 0, Q_16_16(4.0));
this->subtimer = 1;
PositionRelative(super, target, 0, Q_16_16(4.0));
super->subtimer = 1;
}
}
}
// Deletes itself
void GreatFairy_MiniRemoveMe(Entity* this) {
GetNextFrame(this);
void GreatFairy_MiniRemoveMe(GreatFairyEntity* this) {
GetNextFrame(super);
sub_080873D0(this);
if (gRoomVars.animFlags & 1) {
DeleteEntity(this);
DeleteEntity(super);
}
}
// Same as mini Great Fairy except it is able to stretch
void GreatFairy_MiniAffineCallBehavior(Entity* this) {
GreatFairy_MiniAffineBehaviors[this->action](this);
void GreatFairy_MiniAffineCallBehavior(GreatFairyEntity* this) {
GreatFairy_MiniAffineBehaviors[super->action](this);
}
void GreatFairy_MiniAffineInit(Entity* this) {
void GreatFairy_MiniAffineInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spritePriority.b0 = 6;
this->spriteSettings.draw = 1;
super->spritePriority.b0 = 6;
super->spriteSettings.draw = 1;
}
// Getting ready for affine transformation
void GreatFairy_MiniAffineInit2(Entity* this) {
Entity* parent = this->parent;
void GreatFairy_MiniAffineInit2(GreatFairyEntity* this) {
Entity* parent = super->parent;
CopyPosition(parent, this);
CopyPosition(parent, super);
if (this->z.HALF.HI == -20) {
this->action = 2;
this->timer = 90;
this->speed = 4096;
this->spriteRendering.b0 = 3;
SetAffineInfo(this, 256, 256, 0);
if (super->z.HALF.HI == -20) {
super->action = 2;
super->timer = 90;
super->speed = 4096;
super->spriteRendering.b0 = 3;
SetAffineInfo(super, 256, 256, 0);
}
}
// Mini great fairy stretch
void GreatFairy_MiniAffineUpdate(Entity* this) {
if (--this->timer == 0) {
void GreatFairy_MiniAffineUpdate(GreatFairyEntity* this) {
if (--super->timer == 0) {
gRoomVars.animFlags |= 1;
this->action = 3;
sub_0805EC60(this);
super->action = 3;
sub_0805EC60(super);
} else {
this->speed -= 24;
SetAffineInfo(this, 256, this->speed >> 4, 0);
super->speed -= 24;
SetAffineInfo(super, 256, super->speed >> 4, 0);
}
}
// The droplet that falls off of the mini Great Fairy emerging from the water
void GreatFairy_DropletCallBehavior(Entity* this) {
GreatFairy_DropletBehaviors[this->action](this);
void GreatFairy_DropletCallBehavior(GreatFairyEntity* this) {
GreatFairy_DropletBehaviors[super->action](this);
}
void GreatFairy_DropletInit(Entity* this) {
void GreatFairy_DropletInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.draw = 1;
this->z.HALF.HI = 0;
this->spritePriority.b0 = 5;
super->spriteSettings.draw = 1;
super->z.HALF.HI = 0;
super->spritePriority.b0 = 5;
SoundReq(SFX_140);
}
void GreatFairy_DropletUpdate(Entity* this) {
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
DeleteEntity(this);
void GreatFairy_DropletUpdate(GreatFairyEntity* this) {
GetNextFrame(super);
if (super->frame & ANIM_DONE) {
DeleteEntity(super);
}
}
// Ripples that appear before the great fairy emerges
void GreatFairy_RippleCallBehavior(Entity* this) {
GreatFairy_RippleBehaviors[this->action](this);
void GreatFairy_RippleCallBehavior(GreatFairyEntity* this) {
GreatFairy_RippleBehaviors[super->action](this);
}
void GreatFairy_RippleInit(Entity* this) {
void GreatFairy_RippleInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.draw = 1;
this->spritePriority.b0 = 6;
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 6;
}
void GreatFairy_RippleUpdate(Entity* this) {
void GreatFairy_RippleUpdate(GreatFairyEntity* this) {
if (gRoomVars.animFlags & 2) {
DeleteEntity(this);
DeleteEntity(super);
} else {
GetNextFrame(this);
GetNextFrame(super);
}
}
// Big ripple that appears in the spot where the fairy emerges from
void GreatFairy_BigRippleCallBehavior(Entity* this) {
GreatFairy_BigRippleBehaviors[this->action](this);
void GreatFairy_BigRippleCallBehavior(GreatFairyEntity* this) {
GreatFairy_BigRippleBehaviors[super->action](this);
}
void GreatFairy_BigRippleInit(Entity* this) {
void GreatFairy_BigRippleInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->timer = 120;
this->spriteSettings.draw = 1;
this->spritePriority.b0 = 5;
super->timer = 120;
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 5;
SoundReq(SFX_TELEPORTER);
}
void GreatFairy_BigRippleUpdate(Entity* this) {
void GreatFairy_BigRippleUpdate(GreatFairyEntity* this) {
Entity* target;
GetNextFrame(this);
if (this->timer != 0) {
--this->timer;
GetNextFrame(super);
if (super->timer != 0) {
--super->timer;
} else {
target = GreatFairy_CreateForm(this, MINI, 0);
if (target != NULL) {
PositionRelative(this, target, 0, Q_16_16(-8.0));
PositionRelative(super, target, 0, Q_16_16(-8.0));
gRoomVars.animFlags |= 2;
DeleteEntity(this);
DeleteEntity(super);
}
}
}
// Energy bands that surround the mini Great Fairy as it is transforming
void GreatFairy_EnergyCallBehavior(Entity* this) {
GreatFairy_EnergyBehaviors[this->action](this);
void GreatFairy_EnergyCallBehavior(GreatFairyEntity* this) {
GreatFairy_EnergyBehaviors[super->action](this);
}
void GreatFairy_EnergyInit(Entity* this) {
void GreatFairy_EnergyInit(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.draw = 1;
this->spritePriority.b0 = 5;
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 5;
}
void GreatFairy_EnergyUpdate(Entity* this) {
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
DeleteEntity(this);
void GreatFairy_EnergyUpdate(GreatFairyEntity* this) {
GetNextFrame(super);
if (super->frame & ANIM_DONE) {
DeleteEntity(super);
}
}
void sub_08087114(Entity* this) {
if (this->type2 == 0) {
GreatFairy_Form1Behaviors[this->action](this);
void sub_08087114(GreatFairyEntity* this) {
if (super->type2 == 0) {
GreatFairy_Form1Behaviors[super->action](this);
} else {
GreatFairy_Form2Behaviors[this->action](this);
GetNextFrame(this);
GreatFairy_Form2Behaviors[super->action](this);
GetNextFrame(super);
}
}
void sub_08087150(Entity* this) {
void sub_08087150(GreatFairyEntity* this) {
GreatFairy_InitializeAnimation(this);
this->spriteSettings.draw = 1;
this->spriteOrientation.flipY = 0;
this->spriteRendering.b3 = 0;
this->spritePriority.b0 = 3;
this->speed = 0x80;
this->direction = 0x10;
this->palette.b.b4 = gUnk_0812079C[0];
this->palette.b.b0 = gUnk_0812079C[0];
super->spriteSettings.draw = 1;
super->spriteOrientation.flipY = 0;
super->spriteRendering.b3 = 0;
super->spritePriority.b0 = 3;
super->speed = 0x80;
super->direction = 0x10;
super->palette.b.b4 = gUnk_0812079C[0];
super->palette.b.b0 = gUnk_0812079C[0];
}
void nullsub_516(Entity* this) {
void nullsub_516(GreatFairyEntity* this) {
}
void sub_080871A8(Entity* this) {
if (--this->timer == 0) {
this->action = 3;
this->timer = 60;
void sub_080871A8(GreatFairyEntity* this) {
if (--super->timer == 0) {
super->action = 3;
super->timer = 60;
gRoomVars.animFlags |= 4;
}
}
void sub_080871D0(Entity* this) {
if (--this->timer == 0) {
void sub_080871D0(GreatFairyEntity* this) {
if (--super->timer == 0) {
gRoomVars.animFlags |= 8;
DeleteEntity(this);
DeleteEntity(super);
}
}
void sub_080871F8(Entity* this) {
Entity* temp = this->child;
void sub_080871F8(GreatFairyEntity* this) {
Entity* temp = super->child;
if ((temp->x.HALF.HI == this->x.HALF.HI) && (temp->y.HALF.HI - 32 == this->y.HALF.HI)) {
this->action = 2;
if ((temp->x.HALF.HI == super->x.HALF.HI) && (temp->y.HALF.HI - 32 == super->y.HALF.HI)) {
super->action = 2;
} else {
this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32);
LinearMoveUpdate(this);
super->direction =
CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32);
LinearMoveUpdate(super);
}
}
void sub_08087240(Entity* this) {
void sub_08087240(GreatFairyEntity* this) {
if (gRoomVars.animFlags & 4) {
this->action = 3;
this->timer = 20;
this->direction = 16;
super->action = 3;
super->timer = 20;
super->direction = 16;
}
}
void sub_08087264(Entity* this) {
if (this->timer != 0) {
this->timer--;
LinearMoveUpdate(this);
void sub_08087264(GreatFairyEntity* this) {
if (super->timer != 0) {
super->timer--;
LinearMoveUpdate(super);
}
}
void sub_0808727C(Entity* this) {
if (--this->timer == 0) {
DeleteEntity(this);
void sub_0808727C(GreatFairyEntity* this) {
if (--super->timer == 0) {
DeleteEntity(super);
}
}
void sub_08087294(Entity* this) {
gUnk_081207A4[this->action](this);
void sub_08087294(GreatFairyEntity* this) {
gUnk_081207A4[super->action](this);
}
void sub_080872AC(Entity* this) {
this->spriteSettings.draw = 1;
this->spriteOrientation.flipY = 1;
this->spriteRendering.b3 = 0;
this->field_0x68.HWORD = this->x.HALF.HI;
this->field_0x6a.HWORD = this->y.HALF.HI;
this->direction = (u8)Random() & 0x1F;
this->speed = 32;
void sub_080872AC(GreatFairyEntity* this) {
super->spriteSettings.draw = 1;
super->spriteOrientation.flipY = 1;
super->spriteRendering.b3 = 0;
this->unk_68 = super->x.HALF.HI;
this->unk_6a = super->y.HALF.HI;
super->direction = (u8)Random() & 0x1F;
super->speed = 32;
GreatFairy_InitializeAnimation(this);
}
void sub_080872F8(Entity* this) {
void sub_080872F8(GreatFairyEntity* this) {
s32 temp;
LinearMoveUpdate(this);
GetNextFrame(this);
if (((u16)(this->field_0x68.HWORD - this->x.HALF.HI) > 0xc) ||
((u16)(this->field_0x6a.HWORD - this->y.HALF.HI) > 0xc)) {
this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, (s16)this->field_0x68.HWORD,
(s16)this->field_0x6a.HWORD);
this->direction = (this->direction + gUnk_081207AC[Random() & 3]) & 0x1f;
LinearMoveUpdate(super);
GetNextFrame(super);
if (((u16)(this->unk_68 - super->x.HALF.HI) > 0xc) || ((u16)(this->unk_6a - super->y.HALF.HI) > 0xc)) {
super->direction =
CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, (s16)this->unk_68, (s16)this->unk_6a);
super->direction = (super->direction + gUnk_081207AC[Random() & 3]) & 0x1f;
}
temp = gSineTable[this->timer + 64];
this->z.HALF.HI = (temp >> 6) - 8;
this->timer++;
temp = gSineTable[super->timer + 64];
super->z.HALF.HI = (temp >> 6) - 8;
super->timer++;
}
void GreatFairy_InitializeAnimation(Entity* this) {
void GreatFairy_InitializeAnimation(GreatFairyEntity* this) {
s32 temp = 11;
this->action = 1;
this->type2 = this->type % temp;
this->collisionLayer = 2;
InitializeAnimation(this, this->type2);
SetDefaultPriority(this, PRIO_MESSAGE);
super->action = 1;
super->type2 = super->type % temp;
super->collisionLayer = 2;
InitializeAnimation(super, super->type2);
SetDefaultPriority(super, PRIO_MESSAGE);
}
Entity* GreatFairy_CreateForm(Entity* this, u32 curForm, u32 parameter) {
Entity* GreatFairy_CreateForm(GreatFairyEntity* this, u32 curForm, u32 parameter) {
s32 nextForm;
Entity* ent;
nextForm = this->type;
nextForm = super->type;
nextForm /= 11;
ent = CreateObject(GREAT_FAIRY, (u8)nextForm * 11 + curForm, parameter);
return ent;
}
void sub_080873D0(Entity* this) {
void sub_080873D0(GreatFairyEntity* this) {
Entity* ent;
if (this->timer != 0) {
this->timer--;
if (super->timer != 0) {
super->timer--;
} else {
ent = GreatFairy_CreateForm(this, 8, 0);
if (ent != NULL) {
CopyPosition(this, ent);
this->timer = 48;
CopyPosition(super, ent);
super->timer = 48;
}
}
}
@@ -527,11 +536,11 @@ void sub_080873FC(void) {
}
}
void sub_08087424(Entity* this, ScriptExecutionContext* context) {
void sub_08087424(GreatFairyEntity* this, ScriptExecutionContext* context) {
Entity* ent;
ResetPlayerAnimationAndAction();
ent = CreateObject(THUNDERBOLD, 0, 0);
ent = CreateObject(THUNDERBOLT, 0, 0);
if (ent != NULL) {
ent->parent = &gPlayerEntity;
CopyPosition(&gPlayerEntity, ent);
@@ -548,7 +557,7 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) {
}
}
void sub_0808747C(Entity* this, ScriptExecutionContext* context) {
void sub_0808747C(GreatFairyEntity* this, ScriptExecutionContext* context) {
u32 iVar1 = 0;
iVar1 = (u32)FindEntity(OBJECT, SPECIAL_FX, 0x6, 0xb, 0x0);
@@ -558,7 +567,7 @@ void sub_0808747C(Entity* this, ScriptExecutionContext* context) {
context->condition = iVar1;
}
void (*const GreatFairy_Main[])(Entity*) = {
void (*const GreatFairy_Main[])(GreatFairyEntity*) = {
GreatFairy_CallBehavior,
GreatFairy_WingsCallBehavior,
GreatFairy_WakeCallBehavior,
@@ -572,7 +581,7 @@ void (*const GreatFairy_Main[])(Entity*) = {
sub_08087294,
};
void (*const GreatFairy_Behaviors[])(Entity*) = {
void (*const GreatFairy_Behaviors[])(GreatFairyEntity*) = {
GreatFairy_Init, GreatFairy_DormantUpdate, GreatFairy_CreateBigRipple,
GreatFairy_SpawningUpdate, GreatFairy_MiniUpdate, GreatFairy_FinalUpdate,
};
@@ -581,57 +590,57 @@ const s16 GreatFairy_RippleOffsets[10] = {
0, 0, -32, -8, 16, 20, 24, -12, -16, 24,
};
void (*const GreatFairy_WingsBehaviors[])(Entity*) = {
void (*const GreatFairy_WingsBehaviors[])(GreatFairyEntity*) = {
GreatFairy_WingsInit,
GreatFairy_WingsUpdate,
nullsub_116,
};
void (*const GreatFairy_WakeBehaviors[])(Entity*) = {
void (*const GreatFairy_WakeBehaviors[])(GreatFairyEntity*) = {
GreatFairy_WakeInit,
GreatFairy_WakeUpdate,
};
void (*const GreatFairy_MiniBehaviors[])(Entity*) = {
void (*const GreatFairy_MiniBehaviors[])(GreatFairyEntity*) = {
GreatFairy_MiniInit,
GreatFairy_MiniRisingUpdate,
GreatFairy_MiniRemoveMe,
};
void (*const GreatFairy_MiniAffineBehaviors[])(Entity*) = {
void (*const GreatFairy_MiniAffineBehaviors[])(GreatFairyEntity*) = {
GreatFairy_MiniAffineInit,
GreatFairy_MiniAffineInit2,
GreatFairy_MiniAffineUpdate,
DeleteEntity,
(void (*)(GreatFairyEntity*))DeleteEntity,
};
void (*const GreatFairy_DropletBehaviors[])(Entity*) = {
void (*const GreatFairy_DropletBehaviors[])(GreatFairyEntity*) = {
GreatFairy_DropletInit,
GreatFairy_DropletUpdate,
};
void (*const GreatFairy_RippleBehaviors[])(Entity*) = {
void (*const GreatFairy_RippleBehaviors[])(GreatFairyEntity*) = {
GreatFairy_RippleInit,
GreatFairy_RippleUpdate,
};
void (*const GreatFairy_BigRippleBehaviors[])(Entity*) = {
void (*const GreatFairy_BigRippleBehaviors[])(GreatFairyEntity*) = {
GreatFairy_BigRippleInit,
GreatFairy_BigRippleUpdate,
};
void (*const GreatFairy_EnergyBehaviors[])(Entity*) = {
void (*const GreatFairy_EnergyBehaviors[])(GreatFairyEntity*) = {
GreatFairy_EnergyInit,
GreatFairy_EnergyUpdate,
};
void (*const GreatFairy_Form1Behaviors[])(Entity*) = {
void (*const GreatFairy_Form1Behaviors[])(GreatFairyEntity*) = {
sub_08087150,
nullsub_516,
sub_080871A8,
sub_080871D0,
};
void (*const GreatFairy_Form2Behaviors[])(Entity*) = {
void (*const GreatFairy_Form2Behaviors[])(GreatFairyEntity*) = {
sub_08087150, sub_080871F8, sub_08087240, sub_08087264, sub_0808727C,
};
+3 -3
View File
@@ -5,11 +5,11 @@
* @brief Gust Jar Particle object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "player.h"
#include "asm.h"
#include "room.h"
#include "entity.h"
#include "physics.h"
#include "player.h"
#include "room.h"
void GustJarParticle_Init(Entity*);
void GustJarParticle_Action1(Entity*);
-1
View File
@@ -9,7 +9,6 @@
#include "enemy/gyorg.h"
#include "entity.h"
#include "functions.h"
#include "global.h"
#include "object.h"
#include "room.h"
#include "screen.h"
+40 -32
View File
@@ -4,6 +4,7 @@
*
* @brief HeartContainer object
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "flags.h"
@@ -11,12 +12,19 @@
#include "item.h"
#include "sound.h"
static void HeartContainer_Init(Entity*);
static void HeartContainer_Action1(Entity*);
static void HeartContainer_Action2(Entity*);
static void HeartContainer_Action3(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[28];
/*0x84*/ u16 unk_84;
/*0x86*/ u16 unk_86;
} HeartContainerEntity;
static void (*const HeartContainer_Actions[])(Entity*) = {
static void HeartContainer_Init(HeartContainerEntity* this);
static void HeartContainer_Action1(HeartContainerEntity* this);
static void HeartContainer_Action2(HeartContainerEntity* this);
static void HeartContainer_Action3(HeartContainerEntity* this);
static void (*const HeartContainer_Actions[])(HeartContainerEntity*) = {
HeartContainer_Init,
HeartContainer_Action1,
HeartContainer_Action2,
@@ -25,49 +33,49 @@ static void (*const HeartContainer_Actions[])(Entity*) = {
const Hitbox3D gUnk_08121C58 = { 0, -3, { 5, 3, 3, 5 }, 6, 6, 12, {} };
void HeartContainer(Entity* this) {
HeartContainer_Actions[this->action](this);
void HeartContainer(HeartContainerEntity* this) {
HeartContainer_Actions[super->action](this);
}
static void HeartContainer_Init(Entity* this) {
if (CheckFlags(this->cutsceneBeh.HWORD)) {
static void HeartContainer_Init(HeartContainerEntity* this) {
if (CheckFlags(this->unk_84)) {
DeleteThisEntity();
}
this->action = 1;
this->type = 0x62;
this->spriteSettings.draw = 0;
this->hitbox = (Hitbox*)&gUnk_08121C58;
this->collisionLayer = 3;
this->updatePriority = PRIO_NO_BLOCK;
super->action = 1;
super->type = 0x62;
super->spriteSettings.draw = 0;
super->hitbox = (Hitbox*)&gUnk_08121C58;
super->collisionLayer = 3;
super->updatePriority = PRIO_NO_BLOCK;
}
static void HeartContainer_Action1(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 2;
this->spriteSettings.draw = 1;
this->spriteRendering.b0 = 3;
static void HeartContainer_Action1(HeartContainerEntity* this) {
if (CheckFlags(this->unk_86)) {
super->action = 2;
super->spriteSettings.draw = 1;
super->spriteRendering.b0 = 3;
HeartContainer_Action2(this);
}
}
static void HeartContainer_Action2(Entity* this) {
int var0 = 0x400 - this->subtimer * 8;
static void HeartContainer_Action2(HeartContainerEntity* this) {
int var0 = 0x400 - super->subtimer * 8;
if (var0 > 0x100) {
this->subtimer++;
SetAffineInfo(this, var0, var0, 0);
super->subtimer++;
SetAffineInfo(super, var0, var0, 0);
} else {
this->action = 3;
this->collisionFlags |= 0x10;
sub_0805EC60(this);
super->action = 3;
super->collisionFlags |= 0x10;
sub_0805EC60(super);
SoundReq(SFX_HEART_CONTAINER_SPAWN);
}
sub_08080CB4(this);
sub_08080CB4(super);
}
static void HeartContainer_Action3(Entity* this) {
sub_08080CB4(this);
if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) {
SetFlag(this->cutsceneBeh.HWORD);
static void HeartContainer_Action3(HeartContainerEntity* this) {
sub_08080CB4(super);
if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(super)) {
SetFlag(this->unk_84);
CreateItemEntity(ITEM_HEART_CONTAINER, 0, 0);
DeleteThisEntity();
}
+38 -29
View File
@@ -4,52 +4,61 @@
*
* @brief Hidden Ladder Down object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "tiles.h"
void HiddenLadderDown_Init(Entity*);
void HiddenLadderDown_Action1(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[8];
/*0x70*/ u16 unk_70;
/*0x72*/ u8 unused2[20];
/*0x86*/ u16 unk_86;
} HiddenLadderDownEntity;
void HiddenLadderDown(Entity* this) {
static void (*const HiddenLadderDown_Actions[])(Entity*) = {
void HiddenLadderDown_Init(HiddenLadderDownEntity* this);
void HiddenLadderDown_Action1(HiddenLadderDownEntity* this);
void HiddenLadderDown(HiddenLadderDownEntity* this) {
static void (*const HiddenLadderDown_Actions[])(HiddenLadderDownEntity*) = {
HiddenLadderDown_Init,
HiddenLadderDown_Action1,
};
if (this->action < 2) {
HiddenLadderDown_Actions[this->action](this);
if (super->action < 2) {
HiddenLadderDown_Actions[super->action](this);
}
}
void HiddenLadderDown_Init(Entity* this) {
void HiddenLadderDown_Init(HiddenLadderDownEntity* this) {
u16* puVar3;
this->action = 1;
this->spritePriority.b0 = 7;
this->animIndex = 0;
this->field_0x70.HALF.LO = COORD_TO_TILE(this);
puVar3 = &this->field_0x70.HALF.LO;
if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2;
this->spriteSettings.draw = TRUE;
SetMetaTileType(META_TILE_TYPE_418, *puVar3 + TILE_POS(-1, -1), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_419, *puVar3 + TILE_POS(0, -1), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_420, *puVar3 + TILE_POS(1, -1), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_421, *puVar3 + TILE_POS(-1, 0), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_422, *puVar3 + TILE_POS(0, 0), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_423, *puVar3 + TILE_POS(1, 0), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_424, *puVar3 + TILE_POS(-1, 1), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_425, *puVar3 + TILE_POS(0, 1), this->collisionLayer);
SetMetaTileType(META_TILE_TYPE_426, *puVar3 + TILE_POS(1, 1), this->collisionLayer);
super->action = 1;
super->spritePriority.b0 = 7;
super->animIndex = 0;
this->unk_70 = COORD_TO_TILE(super);
puVar3 = &this->unk_70;
if (CheckFlags(this->unk_86) != 0) {
super->action = 2;
super->spriteSettings.draw = TRUE;
SetMetaTileType(META_TILE_TYPE_418, *puVar3 + TILE_POS(-1, -1), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_419, *puVar3 + TILE_POS(0, -1), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_420, *puVar3 + TILE_POS(1, -1), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_421, *puVar3 + TILE_POS(-1, 0), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_422, *puVar3 + TILE_POS(0, 0), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_423, *puVar3 + TILE_POS(1, 0), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_424, *puVar3 + TILE_POS(-1, 1), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_425, *puVar3 + TILE_POS(0, 1), super->collisionLayer);
SetMetaTileType(META_TILE_TYPE_426, *puVar3 + TILE_POS(1, 1), super->collisionLayer);
}
}
void HiddenLadderDown_Action1(Entity* this) {
if (GetMetaTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) {
this->action = 2;
this->spriteSettings.draw = TRUE;
SetFlag(this->field_0x86.HWORD);
void HiddenLadderDown_Action1(HiddenLadderDownEntity* this) {
if (GetMetaTileType(this->unk_70, super->collisionLayer) == 0x1a6) {
super->action = 2;
super->spriteSettings.draw = TRUE;
SetFlag(this->unk_86);
}
}
+29 -20
View File
@@ -4,40 +4,49 @@
*
* @brief Hit Switch object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "physics.h"
void HitSwitch(Entity* this) {
Entity* parent = this->parent;
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[12];
/*0x74*/ u8 unk_74;
/*0x75*/ u8 unk_75;
/*0x76*/ u8 unk_76;
} HitSwitchEntity;
void HitSwitch(HitSwitchEntity* this) {
Entity* parent = super->parent;
if (parent->next == NULL) {
DeleteThisEntity();
}
if (this->action == 0) {
this->action = 1;
this->field_0x76.HALF.LO = parent->animationState;
this->field_0x74.HALF.LO = this->spriteOffsetX;
this->field_0x74.HALF.HI = this->spriteOffsetY;
InitializeAnimation(this, this->animationState);
if (super->action == 0) {
super->action = 1;
this->unk_76 = parent->animationState;
this->unk_74 = super->spriteOffsetX;
this->unk_75 = super->spriteOffsetY;
InitializeAnimation(super, super->animationState);
}
if (parent->animationState != this->field_0x76.HALF.LO) {
if (parent->animationState != this->unk_76) {
DeleteThisEntity();
}
this->spriteSettings.draw = parent->spriteSettings.draw;
CopyPositionAndSpriteOffset(parent, this);
this->spriteOffsetX += this->field_0x74.HALF.LO;
this->spriteOffsetY += this->field_0x74.HALF.HI;
if (this->animationState != 2) {
this->y.HALF.HI++;
this->spriteOffsetY--;
super->spriteSettings.draw = parent->spriteSettings.draw;
CopyPositionAndSpriteOffset(parent, super);
super->spriteOffsetX += this->unk_74;
super->spriteOffsetY += this->unk_75;
if (super->animationState != 2) {
super->y.HALF.HI++;
super->spriteOffsetY--;
} else {
this->y.HALF.HI--;
this->spriteOffsetY++;
super->y.HALF.HI--;
super->spriteOffsetY++;
}
GetNextFrame(this);
if (this->frame & 0x80) {
GetNextFrame(super);
if (super->frame & 0x80) {
DeleteThisEntity();
}
}
+1 -3
View File
@@ -4,11 +4,9 @@
*
* @brief Hittable Lever object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
+94 -89
View File
@@ -4,16 +4,25 @@
*
* @brief House Door Exterior object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "npc.h"
#include "object.h"
#include "room.h"
#include "script.h"
#include "sound.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u16 unk_68;
/*0x6a*/ u16 unk_6a;
/*0x6c*/ u8 unk_6c;
/*0x6d*/ u8 unused1[23];
/*0x84*/ ScriptExecutionContext* context;
} HouseDoorExteriorEntity;
typedef struct {
/*0x00*/ u16 unk0;
/*0x02*/ u16 unk2;
@@ -24,62 +33,57 @@ typedef struct {
/*0x08*/ u8* unk8;
} unk_DoorProperty;
typedef struct {
/*0x00*/ u8 filler0[0x8];
/*0x08*/ u32 unk8;
} unk_80868EC;
static void sub_080868EC(Entity* entity, unk_80868EC* arg1);
static void sub_080868EC(Entity* entity, ScriptExecutionContext* context);
static bool32 sub_080867CC(u32);
void sub_0808681C(Entity*);
void sub_080866D8(Entity*);
void sub_080867E4(Entity*);
void sub_080868B0(Entity*);
static u8 sub_08086954(Entity*);
void HouseDoorExterior_Type2(HouseDoorExteriorEntity* this);
void HouseDoorExterior_Type0(HouseDoorExteriorEntity* this);
void HouseDoorExterior_Type1(HouseDoorExteriorEntity* this);
void HouseDoorExterior_Type3(HouseDoorExteriorEntity* this);
static u8 sub_08086954(HouseDoorExteriorEntity* this);
static const Hitbox gUnk_081206AC = { 0, -5, { 5, 3, 3, 5 }, 10, 4 };
void HouseDoorExterior(Entity* this) {
static void (*const typeFuncs[])(Entity*) = {
sub_080866D8,
sub_080867E4,
sub_0808681C,
sub_080868B0,
void HouseDoorExterior(HouseDoorExteriorEntity* this) {
static void (*const HouseDoorExterior_Types[])(HouseDoorExteriorEntity*) = {
HouseDoorExterior_Type0,
HouseDoorExterior_Type1,
HouseDoorExterior_Type2,
HouseDoorExterior_Type3,
};
typeFuncs[this->type2](this);
HouseDoorExterior_Types[super->type2](this);
}
void sub_080866D8(Entity* this) {
void HouseDoorExterior_Type0(HouseDoorExteriorEntity* this) {
unk_DoorProperty* prop;
Entity* entity;
HouseDoorExteriorEntity* entity;
u32 i;
if (this->action == 0) {
this->action = 1;
*((u32*)(&this->field_0x68)) = 0;
this->field_0x6c.HALF.LO = this->timer;
SetDefaultPriority(this, PRIO_PLAYER_EVENT);
if (super->action == 0) {
super->action = 1;
*((u32*)(&this->unk_68)) = 0;
this->unk_6c = super->timer;
SetDefaultPriority(super, PRIO_PLAYER_EVENT);
}
prop = GetCurrentRoomProperty(this->field_0x6c.HALF.LO);
prop = GetCurrentRoomProperty(this->unk_6c);
for (i = 0; prop->unk0 != 0xFFFF && i < 32; prop++, i++) {
int mask = 1 << i;
if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) &&
if ((*((u32*)(&this->unk_68)) & mask) == 0 && sub_080867CC(prop->unk5) &&
CheckRegionOnScreen(prop->unk0, prop->unk2, 32, 32)) {
entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6);
entity = (HouseDoorExteriorEntity*)CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6);
if (entity != NULL) {
entity->field_0x6c.HALF.LO = i;
entity->x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16;
entity->y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32;
entity->parent = this;
entity->field_0x68.HWORD = prop->unk0;
entity->field_0x6a.HWORD = prop->unk2;
entity->collisionLayer = prop->unk4;
entity->subAction = prop->unk5;
UpdateSpriteForCollisionLayer(entity);
*((u32*)(&this->field_0x68)) |= mask;
entity->unk_6c = i;
entity->base.x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16;
entity->base.y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32;
entity->base.parent = super;
entity->unk_68 = prop->unk0;
entity->unk_6a = prop->unk2;
entity->base.collisionLayer = prop->unk4;
entity->base.subAction = prop->unk5;
UpdateSpriteForCollisionLayer(&entity->base);
*((u32*)(&this->unk_68)) |= mask;
if (prop->unk8) {
*((ScriptExecutionContext**)(&entity->cutsceneBeh)) = StartCutscene(entity, (u16*)prop->unk8);
entity->context = StartCutscene(&entity->base, (u16*)prop->unk8);
}
}
}
@@ -96,63 +100,64 @@ static bool32 sub_080867CC(u32 arg0) {
return CheckGlobalFlag(TATEKAKE_HOUSE);
}
void sub_080867E4(Entity* this) {
if (!CheckRegionOnScreen(this->field_0x68.HWORD, this->field_0x6a.HWORD, 32, 32)) {
*((u32*)(&this->parent->field_0x68)) = *((u32*)(&this->parent->field_0x68)) & ~(1 << this->field_0x6c.HALF.LO);
void HouseDoorExterior_Type1(HouseDoorExteriorEntity* this) {
if (!CheckRegionOnScreen(this->unk_68, this->unk_6a, 32, 32)) {
*((u32*)(&((HouseDoorExteriorEntity*)super->parent)->unk_68)) =
*((u32*)(&((HouseDoorExteriorEntity*)super->parent)->unk_68)) & ~(1 << this->unk_6c);
DeleteThisEntity();
}
sub_0808681C(this);
HouseDoorExterior_Type2(this);
}
void sub_0808681C(Entity* this) {
switch (this->action) {
void HouseDoorExterior_Type2(HouseDoorExteriorEntity* this) {
switch (super->action) {
case 0:
this->action = 1;
this->timer = 8;
this->spriteSettings.draw = 1;
this->frameIndex = 0;
this->hitbox = (Hitbox*)&gUnk_081206AC;
if (this->subAction == 1) {
this->action = 2;
this->frameIndex = 1;
super->action = 1;
super->timer = 8;
super->spriteSettings.draw = 1;
super->frameIndex = 0;
super->hitbox = (Hitbox*)&gUnk_081206AC;
if (super->subAction == 1) {
super->action = 2;
super->frameIndex = 1;
}
if (this->flags & ENT_SCRIPTED) {
this->action = 2;
if (super->flags & ENT_SCRIPTED) {
super->action = 2;
}
break;
case 1:
if (!sub_08086954(this)) {
this->action++;
this->frameIndex = 1;
super->action++;
super->frameIndex = 1;
sub_08078AC0(16, 0, 1);
SoundReq(SFX_111);
}
break;
}
if (this->flags & ENT_SCRIPTED) {
ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
sub_080868EC(this, *(void**)&this->cutsceneBeh);
if (super->flags & ENT_SCRIPTED) {
ExecuteScript(super, this->context);
sub_080868EC(super, this->context);
}
}
void sub_080868B0(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->spriteSettings.draw = 1;
this->hitbox = (Hitbox*)&gUnk_081206AC;
this->timer = 8;
void HouseDoorExterior_Type3(HouseDoorExteriorEntity* this) {
if (super->action == 0) {
super->action = 1;
super->spriteSettings.draw = 1;
super->hitbox = (Hitbox*)&gUnk_081206AC;
super->timer = 8;
}
ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
sub_080868EC(this, *(void**)&this->cutsceneBeh);
ExecuteScript(super, this->context);
sub_080868EC(super, this->context);
}
static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
u32 var0 = arg1->unk8;
arg1->unk8 = 0;
while (var0 != 0) {
u32 rightMostSetBit = var0 & (~var0 + 1);
var0 ^= rightMostSetBit;
static void sub_080868EC(Entity* entity, ScriptExecutionContext* context) {
u32 postScriptActions = context->postScriptActions;
context->postScriptActions = 0;
while (postScriptActions != 0) {
u32 rightMostSetBit = postScriptActions & (~postScriptActions + 1);
postScriptActions ^= rightMostSetBit;
switch (rightMostSetBit) {
case 0x80:
entity->frameIndex = 0;
@@ -168,30 +173,30 @@ static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
}
}
void sub_0808692C(Entity* this) {
this->flags &= ~ENT_SCRIPTED;
this->type2 = 2;
this->action = (this->frameIndex == 0) ? 1 : 2;
this->subAction = 0;
this->timer = 8;
void sub_0808692C(HouseDoorExteriorEntity* this) {
super->flags &= ~ENT_SCRIPTED;
super->type2 = 2;
super->action = (super->frameIndex == 0) ? 1 : 2;
super->subAction = 0;
super->timer = 8;
}
static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) {
if (GetAnimationStateInRectRadius(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
static u8 sub_08086954(HouseDoorExteriorEntity* this) {
if (sub_0800445C(super)) {
if (GetAnimationStateInRectRadius(super, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
(u16)gPlayerState.playerInput.heldInput == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) {
this->timer--;
super->timer--;
}
} else {
this->timer = 8;
super->timer = 8;
}
return this->timer;
return super->timer;
}
void sub_080869A4(Entity* this, ScriptExecutionContext* context) {
void sub_080869A4(HouseDoorExteriorEntity* this, ScriptExecutionContext* context) {
context->condition = 0;
if (!sub_08086954(this)) {
this->timer = 8;
super->timer = 8;
context->condition = 1;
}
}
+2 -2
View File
@@ -33,12 +33,12 @@ static const HouseDoorInteriorFrameIndices_struct HouseDoorInteriorFrameIndices[
};
void HouseDoorInterior(Entity* this) {
static void (*const actionFuncs[])(HouseDoorInteriorEntity*) = {
static void (*const HouseDoorInterior_Actions[])(HouseDoorInteriorEntity*) = {
HouseDoorInterior_Init,
HouseDoorInterior_Action1,
HouseDoorInterior_Delete,
};
actionFuncs[this->action]((HouseDoorInteriorEntity*)this);
HouseDoorInterior_Actions[this->action]((HouseDoorInteriorEntity*)this);
}
typedef struct {
+15 -7
View File
@@ -4,20 +4,28 @@
*
* @brief HouseSign object
*/
#include "entity.h"
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[24];
/*0x80*/ s16 unk_80;
/*0x82*/ s16 unk_82;
} HouseSignEntity;
/*
This object is created by HouseSignManager.
It checks whether the 0x10 x 0x10 rect at field_0x80, field_0x82 is still on the screen.
If not, then it deletes itself and unsets the this->type2 bit in the managers field_0x20 bitfield.
If not, then it deletes itself and unsets the super->type2 bit in the managers field_0x20 bitfield.
*/
void HouseSign(Entity* this) {
if (this->action == 0) {
this->action = 1;
void HouseSign(HouseSignEntity* this) {
if (super->action == 0) {
super->action = 1;
}
if (CheckRectOnScreen((s16)this->field_0x80.HWORD, (s16)this->field_0x82.HWORD, 0x10, 0x10) == 0) {
this->parent->zVelocity &= ~(1 << this->type2);
if (CheckRectOnScreen(this->unk_80, this->unk_82, 0x10, 0x10) == 0) {
super->parent->zVelocity &= ~(1 << super->type2);
DeleteThisEntity();
}
}
+4 -6
View File
@@ -4,10 +4,8 @@
*
* @brief Item for Sale object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "kinstone.h"
#include "message.h"
@@ -88,15 +86,15 @@ void ItemForSale_Action1(ItemForSaleEntity* this) {
gHUD.rActionPlayerState = 2;
} else {
if (super->type == 0x36) {
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
super->action = 3;
gRoomVars.animFlags = 1;
gPlayerState.queued_action = PLAYER_08070E9C;
}
} else {
if (super->interactType != 0) {
super->interactType = 0;
if (super->interactType != INTERACTION_NONE) {
super->interactType = INTERACTION_NONE;
super->subAction = 1;
sub_08078B48();
ResetActiveItems();
+214 -211
View File
@@ -4,6 +4,8 @@
*
* @brief Item On Ground object
*/
#define NENT_DEPRECATED
#include "object/itemOnGround.h"
#include "collision.h"
#include "entity.h"
#include "flags.h"
@@ -16,40 +18,41 @@
#include "sound.h"
#include "tiles.h"
void sub_08081150(Entity*);
void sub_08081150(ItemOnGroundEntity* this);
u8 sub_0808147C(u32);
void sub_080814A4(Entity*);
u32 sub_080814C0(Entity*);
void sub_08081500(Entity*);
void sub_0808153C(Entity*);
void sub_08081598(Entity*);
void sub_080813BC(Entity*);
void sub_080810FC(Entity*);
void ItemOnGround_Init(Entity*);
void ItemOnGround_Action1(Entity*);
void ItemOnGround_Action2(Entity*);
void ItemOnGround_Action3(Entity*);
void ItemOnGround_Action4(Entity*);
void sub_080810A8(Entity*);
void sub_080810FC(Entity*);
void sub_08081150(Entity*);
void sub_08081134(Entity*);
void sub_08081188(Entity*);
void sub_080811AC(Entity*);
void sub_080811C8(Entity*);
void sub_080811D8(Entity*);
void sub_08081248(Entity*);
void sub_0808126C(Entity*);
void sub_0808127C(Entity*);
void nullsub_113(Entity*);
void sub_080812A0(Entity*);
void sub_080812A8(Entity*);
void sub_080812E8(Entity*);
void nullsub_510(Entity*);
void sub_080813D4(Entity*);
void sub_080813E8(Entity*);
void sub_080813F0(Entity*);
bool32 CheckShouldPlayItemGetCutscene(Entity*);
void sub_080814A4(ItemOnGroundEntity* this);
u32 sub_080814C0(ItemOnGroundEntity* this);
void sub_08081500(ItemOnGroundEntity* this);
void sub_0808153C(ItemOnGroundEntity* this);
void sub_08081598(ItemOnGroundEntity* this);
void sub_080813BC(ItemOnGroundEntity* this);
void sub_080810FC(ItemOnGroundEntity* this);
void ItemOnGround_Init(ItemOnGroundEntity* this);
void ItemOnGround_Action1(ItemOnGroundEntity* this);
void ItemOnGround_Action2(ItemOnGroundEntity* this);
void ItemOnGround_Action3(ItemOnGroundEntity* this);
void ItemOnGround_Action4(ItemOnGroundEntity* this);
void sub_080810A8(ItemOnGroundEntity* this);
void sub_080810FC(ItemOnGroundEntity* this);
void sub_08081150(ItemOnGroundEntity* this);
void sub_08081134(ItemOnGroundEntity* this);
void sub_08081188(ItemOnGroundEntity* this);
void sub_080811AC(ItemOnGroundEntity* this);
void sub_080811C8(ItemOnGroundEntity* this);
void sub_080811D8(ItemOnGroundEntity* this);
void sub_08081248(ItemOnGroundEntity* this);
void sub_0808126C(ItemOnGroundEntity* this);
void sub_0808127C(ItemOnGroundEntity* this);
void nullsub_113(ItemOnGroundEntity* this);
void sub_080812A0(ItemOnGroundEntity* this);
void sub_080812A8(ItemOnGroundEntity* this);
void sub_080812E8(ItemOnGroundEntity* this);
void nullsub_510(ItemOnGroundEntity* this);
void sub_080813D4(ItemOnGroundEntity* this);
void sub_080813E8(ItemOnGroundEntity* this);
void sub_080813F0(ItemOnGroundEntity* this);
bool32 CheckShouldPlayItemGetCutscene(ItemOnGroundEntity* this);
void sub_08081404(ItemOnGroundEntity*, u32);
typedef struct {
u8 unk0[2];
@@ -58,18 +61,18 @@ typedef struct {
u8 unk5[3];
} Unk_0811E84C;
void ItemOnGround(Entity* this) {
static void (*const ItemOnGround_Actions[])(Entity*) = {
void ItemOnGround(ItemOnGroundEntity* this) {
static void (*const ItemOnGround_Actions[])(ItemOnGroundEntity*) = {
ItemOnGround_Init, ItemOnGround_Action1, ItemOnGround_Action2, ItemOnGround_Action3, ItemOnGround_Action4,
};
if (this->contactFlags & 0x80) {
switch (this->contactFlags & 0x7F) {
if (super->contactFlags & 0x80) {
switch (super->contactFlags & 0x7F) {
case 20:
this->action = 3;
COLLISION_OFF(this);
this->spriteSettings.draw = 1;
this->collisionFlags |= 0x10;
this->child = this->contactedEntity;
super->action = 3;
COLLISION_OFF(super);
super->spriteSettings.draw = 1;
super->collisionFlags |= 0x10;
super->child = super->contactedEntity;
break;
case 0:
case 1:
@@ -87,38 +90,38 @@ void ItemOnGround(Entity* this) {
}
}
if (sub_0806F520(this)) {
if (sub_0806F520(super)) {
sub_080813BC(this);
} else {
ItemOnGround_Actions[this->action](this);
ItemOnGround_Actions[super->action](this);
}
if (this->type == 0x5C) {
if (super->type == 0x5C) {
gRoomVars.field_0x4++;
}
sub_08080CB4(this);
sub_08080CB4(super);
}
void ItemOnGround_Init(Entity* this) {
static void (*const gUnk_0811E7E8[])(Entity*) = {
void ItemOnGround_Init(ItemOnGroundEntity* this) {
static void (*const gUnk_0811E7E8[])(ItemOnGroundEntity*) = {
sub_080810A8, sub_080810FC, sub_08081150, sub_08081134, sub_08081188, sub_080810A8,
sub_080810A8, sub_080811AC, sub_080811C8, sub_080811D8, sub_080810A8,
};
if (this->field_0x86.HWORD && CheckFlags(this->field_0x86.HWORD)) {
if (this->unk_86 && CheckFlags(this->unk_86)) {
DeleteThisEntity();
}
if (this->type != ITEM_FAIRY) {
this->spriteSettings.draw = 1;
this->spritePriority.b1 = 3;
this->spriteSettings.shadow = 0;
this->hitType = 7;
this->collisionFlags = 0x47;
this->hurtType = 0x44;
this->health = 0xFF;
this->hitbox = (Hitbox*)&gUnk_080FD1A8;
switch (this->type) {
if (super->type != ITEM_FAIRY) {
super->spriteSettings.draw = 1;
super->spritePriority.b1 = 3;
super->spriteSettings.shadow = 0;
super->hitType = 7;
super->collisionFlags = 0x47;
super->hurtType = 0x44;
super->health = 0xFF;
super->hitbox = (Hitbox*)&gUnk_080FD1A8;
switch (super->type) {
case ITEM_SHELLS:
case ITEM_RUPEE1:
case ITEM_RUPEE5:
@@ -129,144 +132,144 @@ void ItemOnGround_Init(Entity* this) {
case ITEM_BOMBS5:
case ITEM_ARROWS5:
case ITEM_HEART:
this->flags2 = 0x17;
super->flags2 = 0x17;
break;
default:
this->flags2 = 0x11;
super->flags2 = 0x11;
break;
}
this->field_0x68.HALF.HI = this->timer;
this->field_0x6a.HALF.LO = 0;
this->field_0x6c.HWORD = 0;
this->field_0x68.HALF.LO = 0;
this->timer = 0;
SetDefaultPriority(this, PRIO_NO_BLOCK);
this->gustJarFlags = sub_0808147C(this->type);
gUnk_0811E7E8[this->field_0x68.HALF.HI](this);
this->unk_69 = super->timer;
this->unk_6a = 0;
this->unk_6c = 0;
this->unk_68 = 0;
super->timer = 0;
SetDefaultPriority(super, PRIO_NO_BLOCK);
super->gustJarFlags = sub_0808147C(super->type);
gUnk_0811E7E8[this->unk_69](this);
} else {
Entity* entity = CreateObject(FAIRY, 0x60, 0);
if (entity != NULL) {
entity->timer = 0;
if (this->timer == 1) {
if (super->timer == 1) {
entity->type2 = 2;
}
CopyPosition(this, entity);
CopyPosition(super, entity);
DeleteThisEntity();
}
}
}
void sub_080810A8(Entity* this) {
this->action = 1;
void sub_080810A8(ItemOnGroundEntity* this) {
super->action = 1;
sub_080814A4(this);
if (this->direction & 0x80) {
this->direction &= 0x1F;
if (this->speed == 0) {
this->speed = 0x100;
if (super->direction & 0x80) {
super->direction &= 0x1F;
if (super->speed == 0) {
super->speed = 0x100;
}
} else {
this->direction |= 0xFF;
super->direction |= 0xFF;
}
if (this->zVelocity == 0) {
this->zVelocity = Q_16_16(1.875);
if (super->zVelocity == 0) {
super->zVelocity = Q_16_16(1.875);
}
if (this->collisionLayer == 2) {
ResolveCollisionLayer(this);
if (super->collisionLayer == 2) {
ResolveCollisionLayer(super);
}
}
void sub_080810FC(Entity* this) {
if (this->type != ITEM_HEART) {
void sub_080810FC(ItemOnGroundEntity* this) {
if (super->type != ITEM_HEART) {
sub_08081598(this);
} else {
this->action = 2;
this->subAction = 0;
COLLISION_ON(this);
this->flags2 = 0x11;
CopyPosition(&gPlayerEntity, this);
super->action = 2;
super->subAction = 0;
COLLISION_ON(super);
super->flags2 = 0x11;
CopyPosition(&gPlayerEntity, super);
}
}
void sub_08081134(Entity* this) {
void sub_08081134(ItemOnGroundEntity* this) {
sub_080814A4(this);
this->field_0x6c.HWORD += 80;
this->unk_6c += 80;
sub_08081150(this);
}
void sub_08081150(Entity* this) {
this->action = 2;
COLLISION_ON(this);
this->z.HALF.HI = -0x80;
this->spriteOrientation.flipY = 1;
this->spriteRendering.b3 = 1;
void sub_08081150(ItemOnGroundEntity* this) {
super->action = 2;
COLLISION_ON(super);
super->z.HALF.HI = -0x80;
super->spriteOrientation.flipY = 1;
super->spriteRendering.b3 = 1;
SoundReq(SFX_12D);
}
void sub_08081188(Entity* this) {
this->action = 2;
COLLISION_ON(this);
if (this->collisionLayer == 2) {
ResolveCollisionLayer(this);
void sub_08081188(ItemOnGroundEntity* this) {
super->action = 2;
COLLISION_ON(super);
if (super->collisionLayer == 2) {
ResolveCollisionLayer(super);
}
}
void sub_080811AC(Entity* this) {
this->action = 2;
this->spriteSettings.draw = 0;
this->field_0x6e.HWORD = GetMetaTileTypeByEntity(this);
void sub_080811AC(ItemOnGroundEntity* this) {
super->action = 2;
super->spriteSettings.draw = 0;
this->unk_6e = GetMetaTileTypeByEntity(super);
}
void sub_080811C8(Entity* this) {
this->action = 2;
this->spriteSettings.draw = 0;
void sub_080811C8(ItemOnGroundEntity* this) {
super->action = 2;
super->spriteSettings.draw = 0;
}
void sub_080811D8(Entity* this) {
void sub_080811D8(ItemOnGroundEntity* this) {
sub_08081188(this);
SoundReq(SFX_215);
}
void ItemOnGround_Action1(Entity* this) {
if (this->field_0x68.HALF.HI != 6) {
ProcessMovement2(this);
void ItemOnGround_Action1(ItemOnGroundEntity* this) {
if (this->unk_69 != 6) {
ProcessMovement2(super);
} else {
LinearMoveUpdate(this);
LinearMoveUpdate(super);
}
GravityUpdate(this, Q_8_8(40.0));
if (this->zVelocity <= 0) {
this->action = 2;
COLLISION_ON(this);
GravityUpdate(super, Q_8_8(40.0));
if (super->zVelocity <= 0) {
super->action = 2;
COLLISION_ON(super);
sub_080814A4(this);
}
}
void ItemOnGround_Action2(Entity* this) {
static void (*const gUnk_0811E814[])(Entity*) = {
void ItemOnGround_Action2(ItemOnGroundEntity* this) {
static void (*const gUnk_0811E814[])(ItemOnGroundEntity*) = {
sub_08081248, sub_08081248, sub_0808126C, sub_0808127C, nullsub_113, sub_080812A0,
sub_08081248, sub_080812A8, sub_080812E8, nullsub_510, sub_08081248,
};
gUnk_0811E814[this->field_0x68.HALF.HI](this);
gUnk_0811E814[this->unk_69](this);
}
void sub_08081248(Entity* this) {
void sub_08081248(ItemOnGroundEntity* this) {
sub_08081500(this);
if (sub_080814C0(this)) {
sub_08081404(this, 0);
} else {
sub_0800442E(this);
sub_0800442E(super);
}
}
void sub_0808126C(Entity* this) {
UpdateAnimationSingleFrame(this);
void sub_0808126C(ItemOnGroundEntity* this) {
UpdateAnimationSingleFrame(super);
sub_0808153C(this);
}
void sub_0808127C(Entity* this) {
void sub_0808127C(ItemOnGroundEntity* this) {
if (sub_080814C0(this)) {
sub_08081404(this, 0);
} else {
@@ -274,112 +277,112 @@ void sub_0808127C(Entity* this) {
}
}
void nullsub_113(Entity* this) {
void nullsub_113(ItemOnGroundEntity* this) {
}
void sub_080812A0(Entity* this) {
void sub_080812A0(ItemOnGroundEntity* this) {
sub_08081500(this);
}
void sub_080812A8(Entity* this) {
if (GetCollisionDataAtEntity(this) != COLLISION_DATA_15 &&
this->field_0x6e.HWORD != GetMetaTileTypeByEntity(this)) {
this->direction = 0;
this->speed = 0;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.HI = 0;
void sub_080812A8(ItemOnGroundEntity* this) {
if (GetCollisionDataAtEntity(super) != COLLISION_DATA_15 &&
this->unk_6e != GetMetaTileTypeByEntity(super)) {
super->direction = 0;
super->speed = 0;
super->spriteSettings.draw = 1;
this->unk_69 = 0;
sub_080810A8(this);
}
}
void sub_080812E8(Entity* this) {
void sub_080812E8(ItemOnGroundEntity* this) {
PlayerState* playerState = &gPlayerState;
#ifdef EU
if ((playerState->swim_state & 0x80) && IsColliding(this, &gPlayerEntity)) {
if ((playerState->swim_state & 0x80) && IsColliding(super, &gPlayerEntity)) {
#else
if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 &&
IsColliding(this, &gPlayerEntity)) {
IsColliding(super, &gPlayerEntity)) {
#endif
sub_080810FC(this);
}
}
void nullsub_510(Entity* this) {
void nullsub_510(ItemOnGroundEntity* this) {
}
void ItemOnGround_Action3(Entity* this) {
Entity* other = this->child;
void ItemOnGround_Action3(ItemOnGroundEntity* this) {
Entity* other = super->child;
if (!(other->kind == PLAYER_ITEM && other->id == 3)) {
sub_08081404(this, 0);
} else {
CopyPosition(other, this);
this->z.HALF.HI--;
CopyPosition(other, super);
super->z.HALF.HI--;
other = &gPlayerEntity;
if (IsColliding(this, other)) {
if (IsColliding(super, other)) {
sub_080810FC(this);
}
}
}
void ItemOnGround_Action4(Entity* this) {
if (--this->timer) {
Entity* other = this->child;
this->x.WORD = other->x.WORD;
this->y.WORD = other->y.WORD;
this->spriteOrientation.flipY = other->spriteOrientation.flipY;
this->spriteRendering.b3 = other->spriteRendering.b3;
GravityUpdate(this, Q_8_8(40.0));
void ItemOnGround_Action4(ItemOnGroundEntity* this) {
if (--super->timer) {
Entity* other = super->child;
super->x.WORD = other->x.WORD;
super->y.WORD = other->y.WORD;
super->spriteOrientation.flipY = other->spriteOrientation.flipY;
super->spriteRendering.b3 = other->spriteRendering.b3;
GravityUpdate(super, Q_8_8(40.0));
} else {
sub_08081404(this, 1);
}
}
void sub_080813BC(Entity* this) {
static void (*const subActionFuncs[])(Entity*) = {
void sub_080813BC(ItemOnGroundEntity* this) {
static void (*const subActionFuncs[])(ItemOnGroundEntity*) = {
sub_080813D4,
sub_080813E8,
sub_080813F0,
};
subActionFuncs[this->subAction](this);
subActionFuncs[super->subAction](this);
}
void sub_080813D4(Entity* this) {
this->subAction = 1;
this->gustJarTolerance = 1;
this->spriteSettings.draw = 1;
void sub_080813D4(ItemOnGroundEntity* this) {
super->subAction = 1;
super->gustJarTolerance = 1;
super->spriteSettings.draw = 1;
}
void sub_080813E8(Entity* this) {
sub_0806F4E8(this);
void sub_080813E8(ItemOnGroundEntity* this) {
sub_0806F4E8(super);
}
void sub_080813F0(Entity* this) {
if (sub_0806F3E4(this)) {
void sub_080813F0(ItemOnGroundEntity* this) {
if (sub_0806F3E4(super)) {
sub_080810FC(this);
}
}
void sub_08081404(Entity* this, u32 arg1) {
if (arg1 && this->field_0x86.HWORD) {
SetFlag(this->field_0x86.HWORD);
void sub_08081404(ItemOnGroundEntity* this, u32 arg1) {
if (arg1 && this->unk_86) {
SetFlag(this->unk_86);
}
DeleteThisEntity();
}
bool32 sub_08081420(Entity* this) {
bool32 sub_08081420(ItemOnGroundEntity* this) {
if (CheckShouldPlayItemGetCutscene(this)) {
SetDefaultPriority(this, PRIO_PLAYER_EVENT);
CreateItemEntity(this->type, this->type2, 0);
SetDefaultPriority(super, PRIO_PLAYER_EVENT);
CreateItemEntity(super->type, super->type2, 0);
return TRUE;
} else {
GiveItem(this->type, this->type2);
GiveItem(super->type, super->type2);
return FALSE;
}
}
bool32 CheckShouldPlayItemGetCutscene(Entity* this) {
return ((gItemMetaData[this->type].unk3 & 0x2) || !GetInventoryValue(this->type));
bool32 CheckShouldPlayItemGetCutscene(ItemOnGroundEntity* this) {
return ((gItemMetaData[super->type].unk3 & 0x2) || !GetInventoryValue(super->type));
}
static const Unk_0811E84C gUnk_0811E84C[118] = {
@@ -412,79 +415,79 @@ void sub_0808148C(u32 arg0) {
}
}
void sub_080814A4(Entity* this) {
if (this->field_0x68.HALF.HI == 10) {
this->field_0x6c.HWORD = 120;
void sub_080814A4(ItemOnGroundEntity* this) {
if (this->unk_69 == 10) {
this->unk_6c = 120;
} else {
this->field_0x6c.HWORD = 600;
this->unk_6c = 600;
}
}
u32 sub_080814C0(Entity* this) {
u32 sub_080814C0(ItemOnGroundEntity* this) {
if (!AnyPrioritySet()) {
if (--this->field_0x6c.HWORD == 0) {
if (--this->unk_6c == 0) {
return TRUE;
}
if (this->field_0x6c.HWORD < 90) {
this->spriteSettings.draw ^= 1;
if (this->unk_6c < 90) {
super->spriteSettings.draw ^= 1;
}
}
return FALSE;
}
void sub_08081500(Entity* this) {
if (this->field_0x68.HALF.LO == 0) {
u32 var0 = sub_080044EC(this, 0x2800);
void sub_08081500(ItemOnGroundEntity* this) {
if (this->unk_68 == 0) {
u32 var0 = sub_080044EC(super, 0x2800);
if (var0 == 0) {
this->field_0x68.HALF.LO = 1;
this->unk_68 = 1;
} else {
if (var0 == 1) {
sub_0808148C(this->type);
UpdateSpriteForCollisionLayer(this);
sub_0808148C(super->type);
UpdateSpriteForCollisionLayer(super);
}
ProcessMovement2(this);
ProcessMovement2(super);
}
}
}
void sub_0808153C(Entity* this) {
if (this->field_0x68.HALF.LO > 1)
void sub_0808153C(ItemOnGroundEntity* this) {
if (this->unk_68 > 1)
return;
if (this->field_0x68.HALF.LO == 0) {
if (!GravityUpdate(this, Q_8_8(16.0)) && !sub_0800442E(this)) {
this->field_0x68.HALF.LO = 1;
this->zVelocity = Q_16_16(1.875);
sub_0808148C(this->type);
UpdateSpriteForCollisionLayer(this);
if (this->unk_68 == 0) {
if (!GravityUpdate(super, Q_8_8(16.0)) && !sub_0800442E(super)) {
this->unk_68 = 1;
super->zVelocity = Q_16_16(1.875);
sub_0808148C(super->type);
UpdateSpriteForCollisionLayer(super);
}
} else {
if (!GravityUpdate(this, Q_8_8(40.0))) {
this->field_0x68.HALF.LO = 2;
sub_0808148C(this->type);
if (!GravityUpdate(super, Q_8_8(40.0))) {
this->unk_68 = 2;
sub_0808148C(super->type);
}
}
}
void sub_08081598(Entity* this) {
if (this->health == 0) {
void sub_08081598(ItemOnGroundEntity* this) {
if (super->health == 0) {
sub_08081404(this, 1);
}
COLLISION_OFF(this);
this->action = 4;
this->timer = 14;
this->zVelocity = Q_16_16(2.0);
this->spriteSettings.draw = 1;
this->spritePriority.b1 = 2;
this->spritePriority.b0 = 3;
this->child = &gPlayerEntity;
CopyPosition(this->child, this);
this->z.HALF.HI -= 4;
if (this->type != 0x5F && sub_08081420(this)) {
COLLISION_OFF(super);
super->action = 4;
super->timer = 14;
super->zVelocity = Q_16_16(2.0);
super->spriteSettings.draw = 1;
super->spritePriority.b1 = 2;
super->spritePriority.b0 = 3;
super->child = &gPlayerEntity;
CopyPosition(super->child, super);
super->z.HALF.HI -= 4;
if (super->type != 0x5F && sub_08081420(this)) {
sub_08081404(this, 1);
}
}
+34 -27
View File
@@ -4,6 +4,7 @@
*
* @brief Jail Bars object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "functions.h"
@@ -11,56 +12,62 @@
#include "sound.h"
#include "tiles.h"
static void SetJailBarTiles(Entity*, u32);
void JailBars_Init(Entity*);
void JailBars_Action1(Entity*);
void JailBars_Action2(Entity*);
void JailBars_Action3(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[30];
/*0x86*/ u16 unk_86;
} JailBarsEntity;
void JailBars(Entity* this) {
static void (*const JailBars_Actions[])(Entity*) = {
static void SetJailBarTiles(JailBarsEntity* this, u32);
void JailBars_Init(JailBarsEntity* this);
void JailBars_Action1(JailBarsEntity* this);
void JailBars_Action2(JailBarsEntity* this);
void JailBars_Action3(JailBarsEntity* this);
void JailBars(JailBarsEntity* this) {
static void (*const JailBars_Actions[])(JailBarsEntity*) = {
JailBars_Init,
JailBars_Action1,
JailBars_Action2,
JailBars_Action3,
};
JailBars_Actions[this->action](this);
JailBars_Actions[super->action](this);
}
void JailBars_Init(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD) == 0) {
this->action = 1;
void JailBars_Init(JailBarsEntity* this) {
if (CheckFlags(this->unk_86) == 0) {
super->action = 1;
SetJailBarTiles(this, 0);
} else {
this->action = 3;
InitializeAnimation(this, 1);
super->action = 3;
InitializeAnimation(super, 1);
SetJailBarTiles(this, 1);
}
this->spriteSettings.draw = 3; // ???
this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this);
super->spriteSettings.draw = 3; // ???
super->collisionLayer = 1;
UpdateSpriteForCollisionLayer(super);
}
void JailBars_Action1(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2;
void JailBars_Action1(JailBarsEntity* this) {
if (CheckFlags(this->unk_86) != 0) {
super->action = 2;
SetJailBarTiles(this, 1);
SoundReq(SFX_10B);
}
}
void JailBars_Action2(Entity* this) {
GetNextFrame(this);
if (this->frame & ANIM_DONE) {
this->action = 3;
InitializeAnimation(this, 1);
void JailBars_Action2(JailBarsEntity* this) {
GetNextFrame(super);
if (super->frame & ANIM_DONE) {
super->action = 3;
InitializeAnimation(super, 1);
}
}
void JailBars_Action3(Entity* this) {
void JailBars_Action3(JailBarsEntity* this) {
}
static void SetJailBarTiles(Entity* this, u32 arg1) {
static void SetJailBarTiles(JailBarsEntity* this, u32 arg1) {
static const s16 gUnk_08124960[] = {
SPECIAL_META_TILE_35,
-0x3,
@@ -97,5 +104,5 @@ static void SetJailBarTiles(Entity* this, u32 arg1) {
if (arg1 == 1) {
puVar1 = gUnk_0812497A;
}
SetMultipleTiles((const TileData*)puVar1, COORD_TO_TILE(this), 1);
SetMultipleTiles((const TileData*)puVar1, COORD_TO_TILE(super), 1);
}
+2 -2
View File
@@ -21,14 +21,14 @@ void JapaneseSubtitle_Type3(Entity*);
const u16 gUnk_08124B10[] = { 0x40, 0x58, 0x68, 0x80, 0x94, 0xA8, 0xB0, 0x0 };
void JapaneseSubtitle(Entity* this) {
static void (*const typeFuncs[])(Entity*) = {
static void (*const JapaneseSubtitle_Types[])(Entity*) = {
JapaneseSubtitle_Type0,
JapaneseSubtitle_Type1,
JapaneseSubtitle_Type2,
JapaneseSubtitle_Type3,
};
typeFuncs[this->type]((Entity*)this);
JapaneseSubtitle_Types[this->type]((Entity*)this);
}
void JapaneseSubtitle_Type0(Entity* this) {
+101 -93
View File
@@ -4,120 +4,128 @@
*
* @brief Jar Portal object
*/
#define NENT_DEPRECATED
#include "area.h"
#include "functions.h"
#include "object.h"
#include "tiles.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68;
/*0x69*/ u8 unused1[19];
/*0x7c*/ u8 unk_7c;
} JarPortalEntity;
extern u32 PortalReadyForMinish(void);
u32 sub_0808C128(Entity*);
void sub_0808C13C(Entity*);
void JarPortal_Init(Entity*);
void JarPortal_Action1(Entity*);
void JarPortal_Action2(Entity*);
void JarPortal_Action3(Entity*);
void JarPortal_Action4(Entity*);
void sub_0808C148(Entity*, bool32);
void sub_0808C01C(Entity*, u32);
u32 sub_0808C128(JarPortalEntity* this);
void sub_0808C13C(JarPortalEntity* this);
void JarPortal_Init(JarPortalEntity* this);
void JarPortal_Action1(JarPortalEntity* this);
void JarPortal_Action2(JarPortalEntity* this);
void JarPortal_Action3(JarPortalEntity* this);
void JarPortal_Action4(JarPortalEntity* this);
void sub_0808C148(JarPortalEntity* this, bool32);
void sub_0808C01C(JarPortalEntity* this, u32);
void JarPortal(Entity* this) {
static void (*const JarPortal_Actions[])(Entity*) = {
void JarPortal(JarPortalEntity* this) {
static void (*const JarPortal_Actions[])(JarPortalEntity*) = {
JarPortal_Init, JarPortal_Action1, JarPortal_Action2, JarPortal_Action3, JarPortal_Action4,
};
JarPortal_Actions[this->action](this);
JarPortal_Actions[super->action](this);
}
void JarPortal_Init(Entity* this) {
COLLISION_ON(this);
this->hitType = 1;
this->collisionFlags = 0x47;
this->hurtType = 0x44;
this->flags2 = 0x80;
this->field_0x68.HALF.LO = 0;
if (CheckLocalFlag(this->type)) {
if (this->field_0x7c.BYTES.byte0 != 0) {
this->action = 1;
InitAnimationForceUpdate(this, 0);
void JarPortal_Init(JarPortalEntity* this) {
COLLISION_ON(super);
super->hitType = 1;
super->collisionFlags = 0x47;
super->hurtType = 0x44;
super->flags2 = 0x80;
this->unk_68 = 0;
if (CheckLocalFlag(super->type)) {
if (this->unk_7c != 0) {
super->action = 1;
InitAnimationForceUpdate(super, 0);
} else {
this->action = 3;
InitAnimationForceUpdate(this, 1);
super->action = 3;
InitAnimationForceUpdate(super, 1);
}
} else {
if (this->field_0x7c.BYTES.byte0 == 0) {
this->action = 1;
InitAnimationForceUpdate(this, 0);
if (this->unk_7c == 0) {
super->action = 1;
InitAnimationForceUpdate(super, 0);
} else {
this->action = 3;
InitAnimationForceUpdate(this, 1);
super->action = 3;
InitAnimationForceUpdate(super, 1);
}
}
}
void JarPortal_Action1(Entity* this) {
void JarPortal_Action1(JarPortalEntity* this) {
if (sub_0808C128(this)) {
this->action++;
super->action++;
sub_0808C13C(this);
if (this->field_0x7c.BYTES.byte0 == 0) {
SetLocalFlag(this->type);
if (this->unk_7c == 0) {
SetLocalFlag(super->type);
} else {
ClearLocalFlag(this->type);
ClearLocalFlag(super->type);
}
sub_0808C148(this, FALSE);
}
sub_0808C01C(this, 0);
}
void JarPortal_Action2(Entity* this) {
GravityUpdate(this, Q_8_8(32.0));
switch (this->subAction) {
void JarPortal_Action2(JarPortalEntity* this) {
GravityUpdate(super, Q_8_8(32.0));
switch (super->subAction) {
case 0:
if (this->zVelocity < Q_16_16(1.5)) {
++this->subAction;
InitAnimationForceUpdate(this, 2);
if (super->zVelocity < Q_16_16(1.5)) {
++super->subAction;
InitAnimationForceUpdate(super, 2);
}
break;
case 1:
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->subAction;
this->zVelocity = Q_16_16(0.5);
UpdateAnimationSingleFrame(super);
if (!super->z.HALF.HI) {
++super->subAction;
super->zVelocity = Q_16_16(0.5);
}
break;
case 2:
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->action;
this->subtimer = 0;
InitAnimationForceUpdate(this, 1);
UpdateAnimationSingleFrame(super);
if (!super->z.HALF.HI) {
++super->action;
super->subtimer = 0;
InitAnimationForceUpdate(super, 1);
sub_0808C148(this, TRUE);
}
break;
}
}
void JarPortal_Action3(Entity* this) {
void JarPortal_Action3(JarPortalEntity* this) {
if (sub_0808C128(this)) {
++this->action;
++super->action;
sub_0808C13C(this);
if (!this->field_0x7c.BYTES.byte0)
ClearLocalFlag(this->type);
if (!this->unk_7c)
ClearLocalFlag(super->type);
else
SetLocalFlag(this->type);
SetLocalFlag(super->type);
sub_0808C148(this, FALSE);
}
sub_0808C01C(this, 1);
}
void sub_0808C01C(Entity* this, u32 r1) {
if (CheckPlayerProximity(this->x.HALF.HI - 0x18, this->y.HALF.HI - 0x18, 0x30, 0x30)) {
void sub_0808C01C(JarPortalEntity* this, u32 r1) {
if (CheckPlayerProximity(super->x.HALF.HI - 0x18, super->y.HALF.HI - 0x18, 0x30, 0x30)) {
u32 type;
gArea.portal_x = this->x.HALF.HI;
gArea.portal_y = this->y.HALF.HI;
gArea.portal_x = super->x.HALF.HI;
gArea.portal_y = super->y.HALF.HI;
gArea.portal_exit_dir = 2;
type = 4;
type = PT_JAR;
if (r1 != 0)
type = 2;
type = PT_2;
gArea.portal_type = type;
if (r1 == 1) {
if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) {
@@ -127,62 +135,62 @@ void sub_0808C01C(Entity* this, u32 r1) {
gArea.portal_mode = 3;
}
}
CreateMagicSparkles(this->x.HALF.HI, this->y.HALF.HI, this->collisionLayer);
if (this->subtimer == 0) {
this->subtimer = 1;
CreateMagicSparkles(super->x.HALF.HI, super->y.HALF.HI, super->collisionLayer);
if (super->subtimer == 0) {
super->subtimer = 1;
SoundReq(SFX_NEAR_PORTAL);
}
}
}
}
void JarPortal_Action4(Entity* this) {
GravityUpdate(this, Q_8_8(32.0));
switch (this->subAction) {
void JarPortal_Action4(JarPortalEntity* this) {
GravityUpdate(super, Q_8_8(32.0));
switch (super->subAction) {
case 0:
if (this->zVelocity < Q_16_16(1.5)) {
this->subAction = 1;
InitAnimationForceUpdate(this, 3);
if (super->zVelocity < Q_16_16(1.5)) {
super->subAction = 1;
InitAnimationForceUpdate(super, 3);
}
break;
case 1:
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->subAction;
this->zVelocity = Q_16_16(0.5);
UpdateAnimationSingleFrame(super);
if (!super->z.HALF.HI) {
++super->subAction;
super->zVelocity = Q_16_16(0.5);
}
break;
case 2:
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
this->action = 1;
InitAnimationForceUpdate(this, 0);
UpdateAnimationSingleFrame(super);
if (!super->z.HALF.HI) {
super->action = 1;
InitAnimationForceUpdate(super, 0);
sub_0808C148(this, TRUE);
}
break;
}
}
u32 sub_0808C128(Entity* this) {
return this->contactFlags == 157;
u32 sub_0808C128(JarPortalEntity* this) {
return super->contactFlags == 157;
}
void sub_0808C13C(Entity* this) {
this->subAction = 0;
this->zVelocity = Q_16_16(2.5);
void sub_0808C13C(JarPortalEntity* this) {
super->subAction = 0;
super->zVelocity = Q_16_16(2.5);
}
void sub_0808C148(Entity* this, bool32 setTiles) {
u32 tilePos = COORD_TO_TILE(this);
void sub_0808C148(JarPortalEntity* this, bool32 setTiles) {
u32 tilePos = COORD_TO_TILE(super);
if (!setTiles) {
SetMetaTile(SPECIAL_META_TILE_146, tilePos + TILE_POS(-1, 0), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_147, tilePos + TILE_POS(0, 0), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_148, tilePos + TILE_POS(-1, 1), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_149, tilePos + TILE_POS(0, 1), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_146, tilePos + TILE_POS(-1, 0), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_147, tilePos + TILE_POS(0, 0), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_148, tilePos + TILE_POS(-1, 1), super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_149, tilePos + TILE_POS(0, 1), super->collisionLayer);
} else {
RestorePrevTileEntity(tilePos + TILE_POS(-1, 0), this->collisionLayer);
RestorePrevTileEntity(tilePos + 0, this->collisionLayer);
RestorePrevTileEntity(tilePos + TILE_POS(-1, 1), this->collisionLayer);
RestorePrevTileEntity(tilePos + TILE_POS(0, 1), this->collisionLayer);
RestorePrevTileEntity(tilePos + TILE_POS(-1, 0), super->collisionLayer);
RestorePrevTileEntity(tilePos + 0, super->collisionLayer);
RestorePrevTileEntity(tilePos + TILE_POS(-1, 1), super->collisionLayer);
RestorePrevTileEntity(tilePos + TILE_POS(0, 1), super->collisionLayer);
}
}
+2 -4
View File
@@ -4,10 +4,8 @@
*
* @brief Key Stealing Takkuri object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {
@@ -478,8 +476,8 @@ void sub_0809E1F0(KeyStealingTakkuriEntity* this) {
}
void sub_0809E210(KeyStealingTakkuriEntity* this) {
gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, super)) & 0xfe;
gPlayerState.animation = 0x100;
gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, super)) & 0xfe;
gPlayerState.animation = ANIM_DEFAULT;
}
void sub_0809E238(KeyStealingTakkuriEntity* this) {
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "kinstone.h"
#include "object.h"
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Ladder Hole In Bookshelf object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "player.h"
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Ladder Up object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Lamp object
*/
#define NENT_DEPRECATED
#include "entity.h"
void Lamp_Init(Entity* this);
-2
View File
@@ -4,10 +4,8 @@
*
* @brief Lava Platform object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "object.h"
-1
View File
@@ -4,7 +4,6 @@
*
* @brief Light Door object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
#include "screen.h"
+87 -77
View File
@@ -4,6 +4,7 @@
*
* @brief Lightable Switch object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "flags.h"
@@ -14,154 +15,163 @@
#include "sound.h"
#include "tiles.h"
static void sub_0809EB30(Entity*);
static void sub_0809EAD8(Entity*);
static void sub_0809EABC(Entity*);
static void LightableSwitch_Type0(Entity*);
static void LightableSwitch_Type1(Entity*);
static void LightableSwitch_Type0_Init(Entity*);
static void LightableSwitch_Type0_Action1(Entity*);
static void LightableSwitch_Type1_Action3(Entity*);
static void LightableSwitch_Type1_Action2(Entity*);
static void LightableSwitch_Type1_Action1(Entity*);
static void LightableSwitch_Type1_Init(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[12];
/*0x74*/ u16 unk_74;
/*0x76*/ u8 unused2[14];
/*0x84*/ u16 unk_84;
/*0x86*/ u16 unk_86;
} LightableSwitchEntity;
void LightableSwitch(Entity* this) {
static void (*const LightableSwitch_Types[])(Entity*) = {
static void sub_0809EB30(LightableSwitchEntity* this);
static void sub_0809EAD8(LightableSwitchEntity* this);
static void sub_0809EABC(LightableSwitchEntity* this);
static void LightableSwitch_Type0(LightableSwitchEntity* this);
static void LightableSwitch_Type1(LightableSwitchEntity* this);
static void LightableSwitch_Type0_Init(LightableSwitchEntity* this);
static void LightableSwitch_Type0_Action1(LightableSwitchEntity* this);
static void LightableSwitch_Type1_Action3(LightableSwitchEntity* this);
static void LightableSwitch_Type1_Action2(LightableSwitchEntity* this);
static void LightableSwitch_Type1_Action1(LightableSwitchEntity* this);
static void LightableSwitch_Type1_Init(LightableSwitchEntity* this);
void LightableSwitch(LightableSwitchEntity* this) {
static void (*const LightableSwitch_Types[])(LightableSwitchEntity*) = {
LightableSwitch_Type0,
LightableSwitch_Type1,
};
LightableSwitch_Types[this->type](this);
LightableSwitch_Types[super->type](this);
sub_0809EB30(this);
}
void LightableSwitch_Type0(Entity* this) {
static void (*const LightableSwitch_Type0_Actions[])(Entity*) = {
void LightableSwitch_Type0(LightableSwitchEntity* this) {
static void (*const LightableSwitch_Type0_Actions[])(LightableSwitchEntity*) = {
LightableSwitch_Type0_Init,
LightableSwitch_Type0_Action1,
};
LightableSwitch_Type0_Actions[this->action](this);
LightableSwitch_Type0_Actions[super->action](this);
}
void LightableSwitch_Type0_Init(Entity* this) {
this->action = 1;
COLLISION_ON(this);
this->frameIndex = 0;
this->collisionFlags = 7;
this->hurtType = 0x48;
this->hitType = 0x28;
this->flags2 = 10;
this->hitbox = (Hitbox*)&gHitbox_0;
void LightableSwitch_Type0_Init(LightableSwitchEntity* this) {
super->action = 1;
COLLISION_ON(super);
super->frameIndex = 0;
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 0x28;
super->flags2 = 10;
super->hitbox = (Hitbox*)&gHitbox_0;
sub_0809EAD8(this);
UpdateSpriteForCollisionLayer(this);
UpdateSpriteForCollisionLayer(super);
sub_0809EABC(this);
}
void LightableSwitch_Type0_Action1(Entity* this) {
void LightableSwitch_Type0_Action1(LightableSwitchEntity* this) {
if ((this->contactFlags & 0x80) != 0) {
if (CheckFlags(this->field_0x86.HWORD) != 0) {
ClearFlag(this->field_0x86.HWORD);
if ((super->contactFlags & 0x80) != 0) {
if (CheckFlags(this->unk_86) != 0) {
ClearFlag(this->unk_86);
} else {
SetFlag(this->field_0x86.HWORD);
SetFlag(this->unk_86);
}
EnqueueSFX(SFX_110);
}
sub_0809EABC(this);
}
static void sub_0809EABC(Entity* this) {
static void sub_0809EABC(LightableSwitchEntity* this) {
bool32 anySet = 0;
if (CheckFlags(this->field_0x86.HWORD)) {
if (CheckFlags(this->unk_86)) {
anySet = 1;
}
if (this->frameIndex != anySet) {
this->frameIndex = anySet;
if (super->frameIndex != anySet) {
super->frameIndex = anySet;
}
}
static void sub_0809EAD8(Entity* this) {
static void sub_0809EAD8(LightableSwitchEntity* this) {
u8 bVar1;
Entity* pEVar2;
if (this->type2 != 0) {
if (super->type2 != 0) {
this->child = GetCurrentRoomProperty(this->type2);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
super->child = GetCurrentRoomProperty(super->type2);
UpdateRailMovement(super, (u16**)&super->child, &this->unk_74);
} else {
SetMetaTile(SPECIAL_META_TILE_80, COORD_TO_TILE(this), this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_80, COORD_TO_TILE(super), super->collisionLayer);
}
}
static void sub_0809EB30(Entity* this) {
static void sub_0809EB30(LightableSwitchEntity* this) {
u16 uVar1;
u16* puVar2;
if (this->type2 != 0) {
if ((this->direction & 0x80) == 0) {
LinearMoveUpdate(this);
if (super->type2 != 0) {
if ((super->direction & 0x80) == 0) {
LinearMoveUpdate(super);
}
puVar2 = &this->field_0x74.HWORD;
puVar2 = &this->unk_74;
if (!--*puVar2) {
UpdateRailMovement(this, (u16**)&this->child, puVar2);
UpdateRailMovement(super, (u16**)&super->child, puVar2);
}
}
}
void LightableSwitch_Type1(Entity* this) {
static void (*const LightableSwitch_Type1_Actions[])(Entity*) = {
void LightableSwitch_Type1(LightableSwitchEntity* this) {
static void (*const LightableSwitch_Type1_Actions[])(LightableSwitchEntity*) = {
LightableSwitch_Type1_Init,
LightableSwitch_Type1_Action1,
LightableSwitch_Type1_Action2,
LightableSwitch_Type1_Action3,
};
LightableSwitch_Type1_Actions[this->action](this);
LightableSwitch_Type1_Actions[super->action](this);
}
void LightableSwitch_Type1_Init(Entity* this) {
void LightableSwitch_Type1_Init(LightableSwitchEntity* this) {
this->action = 1;
COLLISION_ON(this);
this->frameIndex = 3;
this->collisionFlags = 7;
this->hurtType = 0x48;
this->hitType = 0x28;
this->flags2 = 10;
this->hitbox = (Hitbox*)&gHitbox_0;
super->action = 1;
COLLISION_ON(super);
super->frameIndex = 3;
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 0x28;
super->flags2 = 10;
super->hitbox = (Hitbox*)&gHitbox_0;
sub_0809EAD8(this);
UpdateSpriteForCollisionLayer(this);
if (CheckFlags(this->cutsceneBeh.HWORD) != 0) {
this->action = 3;
this->frameIndex = 2;
UpdateSpriteForCollisionLayer(super);
if (CheckFlags(this->unk_84)) {
super->action = 3;
super->frameIndex = 2;
}
}
void LightableSwitch_Type1_Action1(Entity* this) {
if ((this->contactFlags & 0x80) != 0) {
this->action = 2;
this->timer = 16;
this->frameIndex = 2;
SetFlag(this->field_0x86.HWORD);
void LightableSwitch_Type1_Action1(LightableSwitchEntity* this) {
if ((super->contactFlags & 0x80) != 0) {
super->action = 2;
super->timer = 16;
super->frameIndex = 2;
SetFlag(this->unk_86);
EnqueueSFX(SFX_110);
}
}
void LightableSwitch_Type1_Action2(Entity* this) {
void LightableSwitch_Type1_Action2(LightableSwitchEntity* this) {
if (CheckFlags(this->cutsceneBeh.HWORD) != 0) {
this->action = 3;
if (CheckFlags(this->unk_84)) {
super->action = 3;
} else {
if (--this->timer == 0) {
this->action = 1;
this->frameIndex = 3;
ClearFlag(this->field_0x86.HWORD);
if (--super->timer == 0) {
super->action = 1;
super->frameIndex = 3;
ClearFlag(this->unk_86);
EnqueueSFX(SFX_110);
}
}
}
void LightableSwitch_Type1_Action3(Entity* this) {
void LightableSwitch_Type1_Action3(LightableSwitchEntity* this) {
}
+23 -36
View File
@@ -1,10 +1,11 @@
#define NENT_DEPRECATED
/**
* @file lilypadLarge.c
* @ingroup Objects
*
* @brief Large Lilypad object
*/
#define NENT_DEPRECATED
#include "object/lilypadLarge.h"
#include "area.h"
#include "functions.h"
#include "item.h"
@@ -12,51 +13,37 @@
#include "map.h"
#include "tiles.h"
typedef struct {
Entity base;
u8 unk_68[4];
s32 unk_6c;
s32 unk_70;
s16 unk_74;
s16 unk_76;
union SplitWord unk_78;
union SplitWord unk_7c;
u8 unk_80[2];
u16 unk_82;
u8 unk_84;
u8 unk_85;
} LilypadLargeEntity;
extern s8 gUnk_08126EE4[];
void sub_080855E8(LilypadLargeEntity*);
void sub_08085CDC(LilypadLargeEntity*);
void LilypadLarge_Action1(LilypadLargeEntity*);
void LilypadLarge_Action4(LilypadLargeEntity*);
void sub_08085EFC(LilypadLargeEntity*);
void sub_08085F1C(LilypadLargeEntity*);
void sub_08085E74(LilypadLargeEntity*);
void sub_08085F48(LilypadLargeEntity*);
void sub_08085D28(LilypadLargeEntity*);
void sub_08085D60(LilypadLargeEntity*);
void sub_08085504(LilypadLargeEntity*);
void sub_080855E8(LilypadLargeEntity*);
void sub_08085A1C(LilypadLargeEntity*);
void sub_08085C5C(LilypadLargeEntity*);
void sub_08085CDC(LilypadLargeEntity*);
void sub_08085D10(LilypadLargeEntity*);
void LilypadLarge_Init(LilypadLargeEntity*);
void LilypadLarge_Action1(LilypadLargeEntity*);
void LilypadLarge_Action2(LilypadLargeEntity*);
void LilypadLarge_Action3(LilypadLargeEntity*);
void LilypadLarge_Action4(LilypadLargeEntity*);
void LilypadLarge_Action5(LilypadLargeEntity*);
void sub_08085B40(LilypadLargeEntity*);
void sub_08085A98(LilypadLargeEntity*);
void sub_08085A44(LilypadLargeEntity*);
void LilypadLarge(LilypadLargeEntity* this) {
static void (*const actionFuncs[])(LilypadLargeEntity*) = {
sub_08085504, sub_080855E8, sub_08085A1C, sub_08085C5C, sub_08085CDC, sub_08085D10,
static void (*const LilypadLarge_actions[])(LilypadLargeEntity*) = {
LilypadLarge_Init, LilypadLarge_Action1, LilypadLarge_Action2,
LilypadLarge_Action3, LilypadLarge_Action4, LilypadLarge_Action5,
};
actionFuncs[super->action](this);
LilypadLarge_actions[super->action](this);
}
static const Hitbox gUnk_08120640;
void sub_08085504(LilypadLargeEntity* this) {
void LilypadLarge_Init(LilypadLargeEntity* this) {
if (super->type == 0xff) {
if (GetInventoryValue(ITEM_FLIPPERS)) {
DeleteThisEntity();
@@ -98,10 +85,10 @@ void sub_08085504(LilypadLargeEntity* this) {
this->unk_85 = 0;
this->unk_84 = 0;
InitializeAnimation(super, 9);
sub_080855E8(this);
LilypadLarge_Action1(this);
}
void sub_080855E8(LilypadLargeEntity* this) {
void LilypadLarge_Action1(LilypadLargeEntity* this) {
static const u32 gUnk_08120620[] = {
0x5000,
0x18000,
@@ -332,7 +319,7 @@ void sub_080855E8(LilypadLargeEntity* this) {
sub_08085F48(this);
}
void sub_08085A1C(LilypadLargeEntity* this) {
void LilypadLarge_Action2(LilypadLargeEntity* this) {
static void (*const subActionFuncs[])(LilypadLargeEntity*) = {
sub_08085A44,
sub_08085A98,
@@ -404,7 +391,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
ResetCollisionLayer(super);
if (GetVvvAtEntity(super) == VVV_13) {
ResetCollisionLayer(&gPlayerEntity);
sub_08085CDC(this);
LilypadLarge_Action4(this);
super->direction = GetFacingDirection(&gPlayerEntity, super);
LinearMoveDirection(&gPlayerEntity, 0x100, super->direction);
}
@@ -433,7 +420,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
}
}
void sub_08085C5C(LilypadLargeEntity* this) {
void LilypadLarge_Action3(LilypadLargeEntity* this) {
if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) {
LinearMoveUpdate(super);
gPlayerEntity.speed = super->speed;
@@ -454,7 +441,7 @@ void sub_08085C5C(LilypadLargeEntity* this) {
}
}
void sub_08085CDC(LilypadLargeEntity* this) {
void LilypadLarge_Action4(LilypadLargeEntity* this) {
this->unk_78.WORD += 0x100000;
if (this->unk_78.WORD_U < 0x4000000) {
SetAffineInfo(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI);
@@ -463,7 +450,7 @@ void sub_08085CDC(LilypadLargeEntity* this) {
}
}
void sub_08085D10(LilypadLargeEntity* this) {
void LilypadLarge_Action5(LilypadLargeEntity* this) {
if (EntityHasDuplicateID(super) != 0) {
SetLocalFlag(super->type2);
DeleteThisEntity();
@@ -566,7 +553,7 @@ void sub_08085E74(LilypadLargeEntity* this) {
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = super->direction;
gPlayerState.animation = 0x100;
gPlayerState.animation = ANIM_DEFAULT;
gRoomControls.camera_target = super;
if (gPlayerState.item != NULL) {
DeleteEntity(gPlayerState.item);
+4 -3
View File
@@ -4,9 +4,10 @@
*
* @brief LilypadLargeFalling object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "global.h"
#include "object/lilypadLarge.h"
void LilypadLargeFalling(Entity* this) {
Entity* parent;
@@ -22,7 +23,7 @@ void LilypadLargeFalling(Entity* this) {
if (parent->z.WORD == 0) {
DeleteThisEntity();
} else {
int position = 0x120 - parent->z.HALF.HI;
SetAffineInfo(this, position, position, parent->field_0x7c.HALF_U.HI);
s32 position = 0x120 - parent->z.HALF.HI;
SetAffineInfo(this, position, position, ((LilypadLargeEntity*)parent)->unk_7c.HALF_U.HI);
}
}
+30 -23
View File
@@ -4,39 +4,46 @@
*
* @brief Lilypad Small object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
static void sub_08097B24(Entity* this);
static bool32 CheckMovePlayer(Entity* this);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[8];
/*0x70*/ u16 unk_70;
} LilypadSmallEntity;
void LilypadSmall(Entity* this) {
static void sub_08097B24(LilypadSmallEntity* this);
static bool32 CheckMovePlayer(LilypadSmallEntity* this);
void LilypadSmall(LilypadSmallEntity* this) {
u32 rand;
u16* psVar4;
if (this->action == 0) {
this->action = 1;
this->timer = 90;
if (super->action == 0) {
super->action = 1;
super->timer = 90;
rand = Random();
this->subtimer = rand;
this->frameIndex = (rand >> 0x10) & 3;
this->spriteSettings.draw = TRUE;
this->spritePriority.b0 = 7;
this->child = GetCurrentRoomProperty(this->type2);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x70.HALF.LO);
super->subtimer = rand;
super->frameIndex = (rand >> 0x10) & 3;
super->spriteSettings.draw = TRUE;
super->spritePriority.b0 = 7;
super->child = GetCurrentRoomProperty(super->type2);
UpdateRailMovement(super, (u16**)&super->child, &this->unk_70);
}
SyncPlayerToPlatform(this, CheckMovePlayer(this));
SyncPlayerToPlatform(super, CheckMovePlayer(this));
sub_08097B24(this);
psVar4 = (u16*)&this->field_0x70;
psVar4 = &this->unk_70;
if (--*psVar4 == 0) {
UpdateRailMovement(this, (u16**)&this->child, psVar4);
UpdateRailMovement(super, (u16**)&super->child, psVar4);
}
}
static bool32 CheckMovePlayer(Entity* this) {
static bool32 CheckMovePlayer(LilypadSmallEntity* this) {
if (!(gPlayerState.flags & PL_MINISH)) {
return FALSE;
} else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) {
} else if (EntityInRectRadius(super, &gPlayerEntity, 8, 8) == 0) {
return FALSE;
} else if (!PlayerCanBeMoved()) {
return FALSE;
@@ -50,7 +57,7 @@ static bool32 CheckMovePlayer(Entity* this) {
}
}
static void sub_08097B24(Entity* this) {
static void sub_08097B24(LilypadSmallEntity* this) {
static const u16 gUnk_08123318[] = {
0x100, 0x101, 0x102, 0x101, 0x100, 0xff, 0xfe, 0xff,
};
@@ -58,13 +65,13 @@ static void sub_08097B24(Entity* this) {
u32 temp2;
const u16* temp3;
if (--this->timer == 0) {
this->timer = 90;
this->frameIndex = (this->frameIndex + 1) & 3;
if (--super->timer == 0) {
super->timer = 90;
super->frameIndex = (super->frameIndex + 1) & 3;
}
temp3 = gUnk_08123318;
temp2 = ++this->subtimer;
temp2 = ++super->subtimer;
temp = temp3[(temp2 >> 5) & 7];
SetAffineInfo(this, temp, temp, 0);
SetAffineInfo(super, temp, temp, 0);
}
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "message.h"
#include "object.h"
+8 -9
View File
@@ -5,7 +5,6 @@
* @brief Link Emptying Bottle object
* Handles effects of using water, mineral water or a fairy in a bottle in PlayerItemBottle_UseOther.
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "item.h"
@@ -19,20 +18,20 @@ typedef struct {
extern u32 sub_080B1A0C(Entity*, s32, s32);
void sub_08094774(LinkEmptyingBottleEntity*);
void sub_080948D0(LinkEmptyingBottleEntity*);
void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity*);
void LinkEmptyingBottle_Action1(LinkEmptyingBottleEntity*);
void sub_080948E8(LinkEmptyingBottleEntity*);
void sub_08094980(LinkEmptyingBottleEntity*, u32, u32);
void LinkEmptyingBottle(LinkEmptyingBottleEntity* this) {
static void (*const gUnk_08122A10[])(LinkEmptyingBottleEntity*) = {
sub_08094774,
sub_080948D0,
static void (*const LinkEmptyingBottle_Actions[])(LinkEmptyingBottleEntity*) = {
LinkEmptyingBottle_Init,
LinkEmptyingBottle_Action1,
};
gUnk_08122A10[super->action](this);
LinkEmptyingBottle_Actions[super->action](this);
}
void sub_08094774(LinkEmptyingBottleEntity* this) {
void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity* this) {
static const s8 gUnk_08122A18[] = { 0, -8, 8, 1, 2, 8, -8, 1 };
Entity* effect;
Entity* child;
@@ -79,7 +78,7 @@ void sub_08094774(LinkEmptyingBottleEntity* this) {
DeleteThisEntity();
}
void sub_080948D0(LinkEmptyingBottleEntity* this) {
void LinkEmptyingBottle_Action1(LinkEmptyingBottleEntity* this) {
static void (*const gUnk_08122A20[])(LinkEmptyingBottleEntity*) = {
NULL,
sub_080948E8,
-1
View File
@@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {
-1
View File
@@ -7,7 +7,6 @@
#define NENT_DEPRECATED
#include "functions.h"
#include "game.h"
#include "global.h"
#include "item.h"
#include "itemMetaData.h"
#include "message.h"
+32 -23
View File
@@ -4,46 +4,55 @@
*
* @brief Lit Area object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "room.h"
#include "screen.h"
void LitArea(Entity* this) {
if (this->action == 0) {
if (this->field_0x86.HWORD != 0 && CheckFlags(this->field_0x86.HWORD) == 0) {
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u16 unk_68;
/*0x6a*/ u16 unk_6a;
/*0x6c*/ u8 unused1[26];
/*0x86*/ u16 unk_86;
} LitAreaEntity;
void LitArea(LitAreaEntity* this) {
if (super->action == 0) {
if (this->unk_86 != 0 && CheckFlags(this->unk_86) == 0) {
return;
}
this->spriteSettings.draw = 1;
this->action = 1;
this->spriteRendering.alphaBlend = 2;
this->spriteRendering.b0 = 3;
this->frameIndex = 3;
this->flags |= ENT_PERSIST;
this->subtimer = gRoomControls.room;
this->timer = 2;
this->field_0x68.HWORD = -2;
this->field_0x6a.HWORD = 0x80;
SetAffineInfo(this, 0x80, 0x80, 0);
super->spriteSettings.draw = 1;
super->action = 1;
super->spriteRendering.alphaBlend = 2;
super->spriteRendering.b0 = 3;
super->frameIndex = 3;
super->flags |= ENT_PERSIST;
super->subtimer = gRoomControls.room;
super->timer = 2;
this->unk_68 = -2;
this->unk_6a = 0x80;
SetAffineInfo(super, 0x80, 0x80, 0);
} else {
if (--this->timer == 0) {
this->timer = 2;
this->field_0x6a.HWORD += this->field_0x68.HWORD;
if (this->field_0x6a.HWORD < 0x78) {
this->field_0x68.HWORD = 1;
if (--super->timer == 0) {
super->timer = 2;
this->unk_6a += this->unk_68;
if (this->unk_6a < 0x78) {
this->unk_68 = 1;
}
if (0x88 < this->field_0x6a.HWORD) {
this->field_0x68.HWORD = -1;
if (this->unk_6a > 0x88) {
this->unk_68 = -1;
}
SetAffineInfo(this, this->field_0x6a.HWORD, this->field_0x6a.HWORD, 0);
SetAffineInfo(super, this->unk_6a, this->unk_6a, 0);
}
}
gScreen.lcd.displayControl |= DISPCNT_OBJWIN_ON;
gScreen.controls.windowOutsideControl = (gScreen.controls.windowOutsideControl & 0xff) | WINOUT_WINOBJ_BG0 |
WINOUT_WINOBJ_BG1 | WINOUT_WINOBJ_BG2 | WINOUT_WINOBJ_OBJ |
WINOUT_WINOBJ_CLR;
if ((gRoomControls.room != this->subtimer) && (gRoomControls.reload_flags == 0)) {
if ((gRoomControls.room != super->subtimer) && (gRoomControls.reload_flags == 0)) {
DeleteThisEntity();
}
}
+129 -113
View File
@@ -4,6 +4,7 @@
*
* @brief Looked Door object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "common.h"
#include "effects.h"
@@ -15,31 +16,45 @@
#include "sound.h"
#include "tiles.h"
void LockedDoor_Init(Entity*);
void LockedDoor_Action1(Entity*);
void LockedDoor_Action2(Entity*);
void LockedDoor_Action3(Entity*);
void LockedDoor_Action4(Entity*);
void LockedDoor_Action5(Entity*);
void LockedDoor_Action6(Entity*);
void LockedDoor_Action7(Entity*);
void LockedDoor_Action8(Entity*);
void sub_08083638(Entity*);
void sub_08083658(Entity*);
void sub_080836A0(Entity*);
void sub_080836DC(Entity*, u32, u32);
u32 sub_08083734(Entity*, u32);
u32 sub_080837B0(Entity*);
void sub_08083814(Entity*, u32);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
/*0x74*/ u16 unk_74;
/*0x76*/ u16 unk_76;
/*0x78*/ u8 unused2[6];
/*0x7e*/ u8 unk_7e;
/*0x7f*/ u8 unused3[5];
/*0x84*/ u16 unk_84;
/*0x86*/ u16 unk_86;
} LockedDoorEntity;
void (*const LockedDoor_Actions[])(Entity*) = {
void LockedDoor_Init(LockedDoorEntity* this);
void LockedDoor_Action1(LockedDoorEntity* this);
void LockedDoor_Action2(LockedDoorEntity* this);
void LockedDoor_Action3(LockedDoorEntity* this);
void LockedDoor_Action4(LockedDoorEntity* this);
void LockedDoor_Action5(LockedDoorEntity* this);
void LockedDoor_Action6(LockedDoorEntity* this);
void LockedDoor_Action7(LockedDoorEntity* this);
void LockedDoor_Action8(LockedDoorEntity* this);
void sub_08083638(LockedDoorEntity* this);
void sub_08083658(LockedDoorEntity* this);
void sub_080836A0(LockedDoorEntity* this);
void sub_080836DC(Entity* this, u32, u32);
u32 sub_080837B0(LockedDoorEntity* this);
void sub_08083814(LockedDoorEntity* this, u32);
void (*const LockedDoor_Actions[])(LockedDoorEntity*) = {
LockedDoor_Init, LockedDoor_Action1, LockedDoor_Action2, LockedDoor_Action3, LockedDoor_Action4,
LockedDoor_Action5, LockedDoor_Action6, LockedDoor_Action7, LockedDoor_Action8,
};
void LockedDoor(Entity* this) {
LockedDoor_Actions[this->action](this);
void LockedDoor(LockedDoorEntity* this) {
LockedDoor_Actions[super->action](this);
}
typedef struct PACKED {
@@ -88,54 +103,53 @@ const u8 gLockedDoorInteractDirections[] = {
0xD7,
};
void LockedDoor_Init(Entity* this) {
if (this->cutsceneBeh.HWORD != 0xFFFF && CheckFlags(this->cutsceneBeh.HWORD)) {
void LockedDoor_Init(LockedDoorEntity* this) {
if (this->unk_84 != 0xFFFF && CheckFlags(this->unk_84)) {
DeleteThisEntity();
}
if (!sub_080837B0(this))
return;
this->type2 = (this->type >> 2) & 3;
this->frameIndex = this->type & 3;
this->speed = 0x300;
this->field_0x70.HALF.LO = this->x.HALF.HI;
this->field_0x70.HALF.HI = this->y.HALF.HI;
this->field_0x7c.BYTES.byte2 = this->type & 3;
this->hitbox = (Hitbox*)&gHitbox_2;
this->spritePriority.b0 = 5;
this->frame = this->type & 0xF;
this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);
this->field_0x74.HWORD = GetMetaTileIndex(this->field_0x76.HWORD, this->collisionLayer);
switch (this->type2) {
super->type2 = (super->type >> 2) & 3;
super->frameIndex = super->type & 3;
super->speed = 0x300;
this->unk_70 = super->x.HALF.HI;
this->unk_72 = super->y.HALF.HI;
this->unk_7e = super->type & 3;
super->hitbox = (Hitbox*)&gHitbox_2;
super->spritePriority.b0 = 5;
super->frame = super->type & 0xF;
this->unk_76 = TILE(super->x.HALF.HI, super->y.HALF.HI);
this->unk_74 = GetMetaTileIndex(this->unk_76, super->collisionLayer);
switch (super->type2) {
case 0:
if (!CheckFlags(this->field_0x86.HWORD)) {
if (this->type & 0x10) {
this->action = 3;
if (!CheckFlags(this->unk_86)) {
if (super->type & 0x10) {
super->action = 3;
} else {
sub_080836A0(this);
}
} else {
this->type &= ~0x10;
super->type &= ~0x10;
sub_08083638(this);
}
break;
case 1:
if (!CheckFlags(this->field_0x86.HWORD)) {
if (!CheckFlags(this->unk_86)) {
sub_08083638(this);
} else {
sub_080836A0(this);
}
break;
case 2:
if (!CheckFlags(this->field_0x86.HWORD)) {
this->frameIndex |= 4;
sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD);
if (!CheckFlags(this->unk_86)) {
super->frameIndex |= 4;
sub_080836DC(super, this->unk_7e, this->unk_76);
if (!AreaIsDungeon()) {
this->action = 5;
super->action = 5;
} else {
this->action = 8;
AddInteractableSmallKeyLock(this);
SetInteractableObjectCollision(this, 0, gLockedDoorInteractDirections[this->field_0x7c.BYTES.byte2],
NULL);
super->action = 8;
AddInteractableSmallKeyLock(super);
SetInteractableObjectCollision(super, 0, gLockedDoorInteractDirections[this->unk_7e], NULL);
}
} else {
DeleteThisEntity();
@@ -147,19 +161,19 @@ void LockedDoor_Init(Entity* this) {
}
}
void LockedDoor_Action1(Entity* this) {
if (--this->timer == 0) {
this->action = 2;
this->timer = 7;
SetMetaTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer);
void LockedDoor_Action1(LockedDoorEntity* this) {
if (--super->timer == 0) {
super->action = 2;
super->timer = 7;
SetMetaTile(this->unk_74, this->unk_76, super->collisionLayer);
EnqueueSFX(SFX_10B);
}
}
void LockedDoor_Action2(Entity* this) {
LinearMoveUpdate(this);
if (--this->timer == 0) {
if (this->type & 0x80) {
void LockedDoor_Action2(LockedDoorEntity* this) {
LinearMoveUpdate(super);
if (--super->timer == 0) {
if (super->type & 0x80) {
sub_08083638(this);
} else {
DeleteThisEntity();
@@ -167,91 +181,91 @@ void LockedDoor_Action2(Entity* this) {
}
}
void LockedDoor_Action3(Entity* this) {
if (sub_08083734(this, this->field_0x7c.BYTES.byte2)) {
this->action = 4;
sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD);
void LockedDoor_Action3(LockedDoorEntity* this) {
if (sub_08083734(super, this->unk_7e)) {
super->action = 4;
sub_080836DC(super, this->unk_7e, this->unk_76);
}
}
void LockedDoor_Action4(Entity* this) {
LinearMoveUpdate(this);
if (!--this->timer) {
if (this->type & 0x10) {
this->type &= ~0x10;
void LockedDoor_Action4(LockedDoorEntity* this) {
LinearMoveUpdate(super);
if (!--super->timer) {
if (super->type & 0x10) {
super->type &= ~0x10;
sub_080836A0(this);
} else {
if (this->type & 0x80) {
if (super->type & 0x80) {
sub_080836A0(this);
} else {
this->action = 5;
super->action = 5;
}
}
sub_08083814(this, this->field_0x7c.BYTES.byte2);
sub_08083814(this, this->unk_7e);
EnqueueSFX(SFX_10B);
}
}
void LockedDoor_Action5(Entity* this) {
void LockedDoor_Action5(LockedDoorEntity* this) {
}
void LockedDoor_Action6(Entity* this) {
if (this->type2 == 0) {
if (!CheckFlags(this->field_0x86.HWORD))
void LockedDoor_Action6(LockedDoorEntity* this) {
if (super->type2 == 0) {
if (!CheckFlags(this->unk_86))
return;
} else {
if (CheckFlags(this->field_0x86.HWORD))
if (CheckFlags(this->unk_86))
return;
}
sub_08083658(this);
}
void LockedDoor_Action7(Entity* this) {
if (this->type2 == 0) {
if (CheckFlags(this->field_0x86.HWORD))
void LockedDoor_Action7(LockedDoorEntity* this) {
if (super->type2 == 0) {
if (CheckFlags(this->unk_86))
return;
} else {
if (!CheckFlags(this->field_0x86.HWORD))
if (!CheckFlags(this->unk_86))
return;
}
this->action = 3;
super->action = 3;
}
void LockedDoor_Action8(Entity* this) {
if (this->interactType == 0 && !CheckFlags(this->field_0x86.HWORD))
void LockedDoor_Action8(LockedDoorEntity* this) {
if (super->interactType == INTERACTION_NONE && !CheckFlags(this->unk_86))
return;
this->action = 1;
this->timer = 20;
super->action = 1;
super->timer = 20;
sub_08083658(this);
SetFlag(this->field_0x86.HWORD);
SetFlag(this->unk_86);
ModDungeonKeys(-1);
}
void sub_08083638(Entity* this) {
this->action = 7;
this->spriteSettings.draw = 0;
this->x.HALF.HI = this->field_0x70.HALF.LO;
this->y.HALF.HI = this->field_0x70.HALF.HI;
void sub_08083638(LockedDoorEntity* this) {
super->action = 7;
super->spriteSettings.draw = 0;
super->x.HALF.HI = this->unk_70;
super->y.HALF.HI = this->unk_72;
}
void sub_08083658(Entity* this) {
void sub_08083658(LockedDoorEntity* this) {
const struct_0811F680* tmp;
this->action = 1;
this->timer = 20;
this->direction = this->field_0x7c.BYTES.byte2 << 3;
tmp = &gUnk_0811F680[this->field_0x7c.BYTES.byte2];
this->x.HALF.HI += tmp->x;
this->y.HALF.HI += tmp->y;
RequestPriorityDuration(this, 60);
super->action = 1;
super->timer = 20;
super->direction = this->unk_7e << 3;
tmp = &gUnk_0811F680[this->unk_7e];
super->x.HALF.HI += tmp->x;
super->y.HALF.HI += tmp->y;
RequestPriorityDuration(super, 60);
SoundReq(SFX_10B);
}
void sub_080836A0(Entity* this) {
this->action = 6;
this->spriteSettings.draw = 1;
this->x.HALF.HI = this->field_0x70.HALF.LO;
this->y.HALF.HI = this->field_0x70.HALF.HI;
SetMetaTile(SPECIAL_META_TILE_34, this->field_0x76.HWORD, this->collisionLayer);
void sub_080836A0(LockedDoorEntity* this) {
super->action = 6;
super->spriteSettings.draw = 1;
super->x.HALF.HI = this->unk_70;
super->y.HALF.HI = this->unk_72;
SetMetaTile(SPECIAL_META_TILE_34, this->unk_76, super->collisionLayer);
}
void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) {
@@ -259,7 +273,7 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) {
SetMetaTile(SPECIAL_META_TILE_34, unk_1, this->collisionLayer);
this->timer = 7;
this->spriteSettings.draw = 1;
this->direction = (unk_0 << 3) ^ 0x10;
this->direction = (unk_0 << 3) ^ DirectionSouth;
tmp = &gUnk_0811F688[unk_0];
if (this->type2 != 2) {
this->x.HALF.HI += tmp->x;
@@ -268,28 +282,30 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) {
}
u32 sub_08083734(Entity* this, u32 unk0) {
// TODO this is used in bossDoor, carlovObject, lockedDoor, metalDoor and minecartDoor. Do they have the same entity
// struct?
switch (unk0) {
case 0:
if (this->field_0x70.HALF_U.HI + 0xd - gPlayerEntity.y.HALF.HI < 0)
if (((LockedDoorEntity*)this)->unk_72 + 0xd - gPlayerEntity.y.HALF.HI < 0)
return 1;
break;
case 1:
if (gPlayerEntity.x.HALF.HI - (this->field_0x70.HALF_U.LO - 0xb) < 0)
if (gPlayerEntity.x.HALF.HI - (((LockedDoorEntity*)this)->unk_70 - 0xb) < 0)
return 1;
break;
case 2:
if (gPlayerEntity.y.HALF.HI - (this->field_0x70.HALF_U.HI - 0x8) < 0)
if (gPlayerEntity.y.HALF.HI - (((LockedDoorEntity*)this)->unk_72 - 0x8) < 0)
return 1;
break;
case 3:
if (this->field_0x70.HALF_U.LO + 0xa - gPlayerEntity.x.HALF.HI < 0)
if (((LockedDoorEntity*)this)->unk_70 + 0xa - gPlayerEntity.x.HALF.HI < 0)
return 1;
break;
}
return 0;
}
u32 sub_080837B0(Entity* this) {
u32 sub_080837B0(LockedDoorEntity* this) {
u32 tmp;
u32 tmp2 = gRoomControls.area;
if (tmp2 < 0x40) {
@@ -308,24 +324,24 @@ u32 sub_080837B0(Entity* this) {
tmp = gUnk_0811F690[tmp2 - 0x40];
}
if (tmp2 == 0x68) {
ChangeObjPalette(this, 0);
ChangeObjPalette(super, 0);
} else {
if (tmp2 == 0x88) {
ChangeObjPalette(this, 1);
ChangeObjPalette(super, 1);
}
}
LoadFixedGFX(this, tmp);
LoadFixedGFX(super, tmp);
}
void sub_08083814(Entity* this, u32 unk0) {
void sub_08083814(LockedDoorEntity* this, u32 unk0) {
Entity* fx;
const struct_0811F730* tmp = &gUnk_0811F730[unk0];
fx = CreateFx(this, FX_DASH, 0x40);
fx = CreateFx(super, FX_DASH, 0x40);
if (fx) {
fx->x.HALF.HI += tmp->unk_00.x;
fx->y.HALF.HI += tmp->unk_00.y;
}
fx = CreateFx(this, FX_DASH, 0x40);
fx = CreateFx(super, FX_DASH, 0x40);
if (fx) {
fx->x.HALF.HI += tmp->unk_02.x;
fx->y.HALF.HI += tmp->unk_02.y;
+33 -26
View File
@@ -4,43 +4,50 @@
*
* @brief Macro Acorn object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "map.h"
#include "object.h"
#include "physics.h"
#include "tiles.h"
void MacroAcorn_Init(Entity*);
void MacroAcorn_Action1(Entity*);
void sub_0809E5F0(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[24];
/*0x80*/ u16 unk_80;
} MacroAcornEntity;
void MacroAcorn(Entity* this) {
static void (*const MacroAcorn_Actions[])(Entity*) = {
void MacroAcorn_Init(MacroAcornEntity* this);
void MacroAcorn_Action1(MacroAcornEntity* this);
void sub_0809E5F0(MacroAcornEntity* this);
void MacroAcorn(MacroAcornEntity* this) {
static void (*const MacroAcorn_Actions[])(MacroAcornEntity*) = {
MacroAcorn_Init,
MacroAcorn_Action1,
};
MacroAcorn_Actions[this->action](this);
MacroAcorn_Actions[super->action](this);
}
void MacroAcorn_Init(Entity* this) {
void MacroAcorn_Init(MacroAcornEntity* this) {
u32 bVar2;
Entity* pEVar3;
this->action = 1;
if (this->type == 0xff) {
this->frameIndex = this->type2;
super->action = 1;
if (super->type == 0xff) {
super->frameIndex = super->type2;
} else {
bVar2 = (this->type & 1) ? 4 : 0;
if ((this->type & 2)) {
bVar2 = (super->type & 1) ? 4 : 0;
if ((super->type & 2)) {
if (gEntCount < 0x45) {
this->frameIndex = bVar2;
super->frameIndex = bVar2;
pEVar3 = CreateObject(HUGE_ACORN, 0xff, ++bVar2);
CopyPosition(this, pEVar3);
CopyPosition(super, pEVar3);
pEVar3 = CreateObject(HUGE_ACORN, 0xff, ++bVar2);
PositionRelative(this, pEVar3, 0, 0x10000);
PositionRelative(super, pEVar3, 0, 0x10000);
pEVar3->spriteOffsetY = -1;
pEVar3 = CreateObject(HUGE_ACORN, 0xff, ++bVar2);
CopyPosition(this, pEVar3);
CopyPosition(super, pEVar3);
} else {
DeleteThisEntity();
}
@@ -49,26 +56,26 @@ void MacroAcorn_Init(Entity* this) {
if (pEVar3 == NULL) {
DeleteThisEntity();
} else {
this->frameIndex = bVar2;
CopyPosition(this, pEVar3);
super->frameIndex = bVar2;
CopyPosition(super, pEVar3);
}
}
sub_0809E5F0(this);
}
if ((this->frameIndex & 1) != 0) {
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
if ((super->frameIndex & 1) != 0) {
super->spriteRendering.b3 = 3;
super->spritePriority.b0 = 7;
}
}
void MacroAcorn_Action1(Entity* this) {
void MacroAcorn_Action1(MacroAcornEntity* this) {
}
void sub_0809E5F0(Entity* this) {
u32 position = COORD_TO_TILE(this);
this->field_0x80.HWORD = position;
switch (this->type) {
void sub_0809E5F0(MacroAcornEntity* this) {
u32 position = COORD_TO_TILE(super);
this->unk_80 = position;
switch (super->type) {
case 2:
SetMetaTile(SPECIAL_META_TILE_34, position + TILE_POS(3, -1), LAYER_BOTTOM);
SetMetaTile(SPECIAL_META_TILE_109, position + TILE_POS(4, -1), LAYER_BOTTOM);
+2 -2
View File
@@ -31,13 +31,13 @@ void sub_0809A9D4(MacroBookEntity*);
void sub_0809AA9C(MacroBookEntity*, Entity*, u32);
void MacroBook(Entity* this) {
static void (*const actionFuncs[])(MacroBookEntity*) = {
static void (*const MacroBook_Actions[])(MacroBookEntity*) = {
MacroBook_Init,
MacroBook_Action1,
MacroBook_Action2,
MacroBook_Action3,
};
actionFuncs[this->action]((MacroBookEntity*)this);
MacroBook_Actions[this->action]((MacroBookEntity*)this);
}
void MacroBook_Init(MacroBookEntity* this) {
-1
View File
@@ -34,7 +34,6 @@ void MacroDecoration(Entity* this) {
void MacroDecoration_Init(MacroDecorationEntity* this) {
u32 bVar1;
u32 uVar2;
super->action = 1;
UpdateSpriteForCollisionLayer(super);
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Macro Mushroom Stalk object
*/
#define NENT_DEPRECATED
#include "area.h"
#include "entity.h"
#include "main.h"
+4 -4
View File
@@ -34,20 +34,20 @@ void MacroPlayer_Type0_Action10(MacroPlayerEntity*);
void sub_0808CB9C(MacroPlayerEntity*);
void MacroPlayer(Entity* this) {
static void (*const typeFuncs[])(MacroPlayerEntity*) = {
static void (*const MacroPlayer_Types[])(MacroPlayerEntity*) = {
MacroPlayer_Type0,
MacroPlayer_Type1,
};
typeFuncs[this->type]((MacroPlayerEntity*)this);
MacroPlayer_Types[this->type]((MacroPlayerEntity*)this);
}
void MacroPlayer_Type0(MacroPlayerEntity* this) {
static void (*const actionFuncs[])(MacroPlayerEntity*) = {
static void (*const MacroPlayer_Type0_Actions[])(MacroPlayerEntity*) = {
MacroPlayer_Type0_Init, MacroPlayer_Type0_Action1, MacroPlayer_Type0_Action2, MacroPlayer_Type0_Action3,
MacroPlayer_Type0_Action4, MacroPlayer_Type0_Action5, MacroPlayer_Type0_Action6, MacroPlayer_Type0_Action7,
MacroPlayer_Type0_Action8, MacroPlayer_Type0_Action9, MacroPlayer_Type0_Action10,
};
actionFuncs[super->action](this);
MacroPlayer_Type0_Actions[super->action](this);
sub_0808CB9C(this);
}
+1
View File
@@ -4,6 +4,7 @@
*
* @brief Macro Shoe object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "tiles.h"
+56 -44
View File
@@ -4,31 +4,43 @@
*
* @brief Mask object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.h"
#include "tiles.h"
void Mask_Init(Entity*);
void Mask_Action1(Entity*);
void Mask_Action2(Entity*);
void Mask_Delete(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[16];
/*0x78*/ u16 unk_78;
/*0x7a*/ u16 unk_7a;
/*0x7c*/ u16 unk_7c;
/*0x7e*/ u16 unk_7e;
/*0x80*/ u8 unused2[6];
/*0x86*/ u16 unk_86;
} MaskEntity;
void Mask(Entity* this) {
static void (*const Mask_Actions[])(Entity*) = {
void Mask_Init(MaskEntity* this);
void Mask_Action1(MaskEntity* this);
void Mask_Action2(MaskEntity* this);
void Mask_Delete(MaskEntity* this);
void Mask(MaskEntity* this) {
static void (*const Mask_Actions[])(MaskEntity*) = {
Mask_Init,
Mask_Action1,
Mask_Action2,
Mask_Delete,
};
Mask_Actions[this->action](this);
Mask_Actions[super->action](this);
}
void Mask_Init(Entity* this) {
if (this->type2 & 0xC0) {
if (CheckFlags(this->field_0x86.HWORD)) {
void Mask_Init(MaskEntity* this) {
if (super->type2 & 0xC0) {
if (CheckFlags(this->unk_86)) {
s32 field_0x0a;
switch (this->type2 & 0xC0) {
switch (super->type2 & 0xC0) {
case 0x40:
field_0x0a = gRoomTransition.stairs_idx;
@@ -38,7 +50,7 @@ void Mask_Init(Entity* this) {
DeleteThisEntity();
break;
default:
ClearFlag(this->field_0x86.HWORD);
ClearFlag(this->unk_86);
}
break;
@@ -49,26 +61,26 @@ void Mask_Init(Entity* this) {
}
}
this->action = 1;
this->zVelocity = Q_16_16(1.5);
super->action = 1;
super->zVelocity = Q_16_16(1.5);
this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000;
this->unk_78 = ((Random() & 7) << 10) | 0x2000;
this->subtimer = this->timer >> 1;
this->timer = 0;
super->subtimer = super->timer >> 1;
super->timer = 0;
this->frameIndex = this->type2 & 0x3f;
super->frameIndex = super->type2 & 0x3f;
this->field_0x7c.HALF_U.HI = COORD_TO_TILE(this);
this->field_0x7c.HALF_U.LO = GetMetaTileIndex(this->field_0x7c.HALF_U.HI, LAYER_BOTTOM);
this->unk_7e = COORD_TO_TILE(super);
this->unk_7c = GetMetaTileIndex(this->unk_7e, LAYER_BOTTOM);
this->field_0x7a.HWORD = GetCollisionDataAtMetaTilePos((u16)this->field_0x7c.HALF.HI, LAYER_BOTTOM);
this->unk_7a = GetCollisionDataAtMetaTilePos(this->unk_7e, LAYER_BOTTOM);
SetMetaTile(SPECIAL_META_TILE_34, this->field_0x7c.HALF_U.HI, LAYER_BOTTOM);
SetMetaTile(SPECIAL_META_TILE_34, this->unk_7e, LAYER_BOTTOM);
}
// Probably related to knocking it down
void Mask_Action1(Entity* this) {
void Mask_Action1(MaskEntity* this) {
// Check for the first frame of bonking animation
if (gPlayerEntity.action != PLAYER_BOUNCE) {
return;
@@ -79,54 +91,54 @@ void Mask_Action1(Entity* this) {
}
// Check if link is close enough to the mask
if (this->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) {
if (super->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) {
return;
}
if (this->x.HALF.HI - gPlayerEntity.x.HALF.HI >= this->subtimer ||
this->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -this->subtimer) {
if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI >= super->subtimer ||
super->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -super->subtimer) {
return;
}
// Presumably, make the mask fall
SetMetaTile(this->field_0x7c.HALF_U.LO, this->field_0x7c.HALF_U.HI, LAYER_BOTTOM);
SetMetaTile(this->unk_7c, this->unk_7e, LAYER_BOTTOM);
SetCollisionData(this->field_0x7a.HWORD, (u16)this->field_0x7c.HALF.HI, 1);
SetCollisionData(this->unk_7a, this->unk_7e, 1);
this->action = 2;
super->action = 2;
this->z.HALF.HI -= 0x20;
this->y.HALF.HI += 0x20;
super->z.HALF.HI -= 0x20;
super->y.HALF.HI += 0x20;
this->spriteRendering.b3 = 2;
super->spriteRendering.b3 = 2;
}
// Probably falling down
void Mask_Action2(Entity* this) {
if (this->timer == 1) {
this->action = 3;
void Mask_Action2(MaskEntity* this) {
if (super->timer == 1) {
super->action = 3;
this->timer = 0;
switch (this->type2 & 0xC0) {
super->timer = 0;
switch (super->type2 & 0xC0) {
case 0x80:
EnqueueSFX(SFX_SECRET);
case 0x40:
SetFlag(this->field_0x86.HWORD);
SetFlag(this->unk_86);
break;
}
CreateFx(this, FX_POT_SHATTER, 0);
CreateFx(super, FX_POT_SHATTER, 0);
CreateRandomItemDrop(this, 3);
CreateRandomItemDrop(super, 3);
} else {
sub_080044EC(this, this->field_0x78.HWORD);
sub_080044EC(super, this->unk_78);
if (this->z.HALF.HI == 0) {
this->timer++;
if (super->z.HALF.HI == 0) {
super->timer++;
}
}
}
void Mask_Delete(Entity* this) {
void Mask_Delete(MaskEntity* this) {
DeleteThisEntity();
}
+2 -3
View File
@@ -8,7 +8,6 @@
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "global.h"
#include "item.h"
#include "new_player.h"
#include "object.h"
@@ -49,14 +48,14 @@ void MazaalBossObject_Action8(MazaalBossObjectEntity* this); // 0809ACE8
void sub_0809AD68(MazaalBossObjectEntity* this); // 0809AD68
void sub_0809AD8C(MazaalBossObjectEntity* this); // 0809AD8C
void MazaalBossObject(Entity* thisx) {
void MazaalBossObject(Entity* this) {
static void (*const MazaalBossObject_Actions[])(MazaalBossObjectEntity*) = {
MazaalBossObject_Action0, MazaalBossObject_Action1, MazaalBossObject_Action2,
MazaalBossObject_Action3, MazaalBossObject_Action4, MazaalBossObject_Action5,
MazaalBossObject_Action6, MazaalBossObject_Action7, MazaalBossObject_Action8,
};
MazaalBossObject_Actions[thisx->action]((MazaalBossObjectEntity*)thisx);
MazaalBossObject_Actions[this->action]((MazaalBossObjectEntity*)this);
}
void MazaalBossObject_Action0(MazaalBossObjectEntity* this) {
+1 -1
View File
@@ -4,8 +4,8 @@
*
* @brief Mazaal Object object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "global.h"
#include "physics.h"
void MazaalObject(Entity* this) {
+81 -66
View File
@@ -4,6 +4,7 @@
*
* @brief Metal Door object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
@@ -14,105 +15,119 @@
#include "sound.h"
#include "tiles.h"
extern u32 sub_08083734(Entity*, u32);
void sub_080A080C(Entity*);
void sub_080A0870(Entity*);
void MetalDoor_Init(Entity*);
void MetalDoor_Action1(Entity*);
void MetalDoor_Action2(Entity*);
void MetalDoor_Action3(Entity*);
void MetalDoor_Action4(Entity*);
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
/*0x74*/ u16 unk_74;
/*0x76*/ u16 unk_76;
/*0x78*/ u16 unk_78;
/*0x7a*/ u16 unk_7a;
/*0x7c*/ u8 unused2[8];
/*0x84*/ u16 unk_84;
/*0x86*/ u16 unk_86;
} MetalDoorEntity;
void MetalDoor(Entity* this) {
static void (*const MetalDoor_Actions[])(Entity*) = {
extern u32 sub_08083734(Entity*, u32);
void sub_080A080C(MetalDoorEntity* this);
void sub_080A0870(MetalDoorEntity* this);
void MetalDoor_Init(MetalDoorEntity* this);
void MetalDoor_Action1(MetalDoorEntity* this);
void MetalDoor_Action2(MetalDoorEntity* this);
void MetalDoor_Action3(MetalDoorEntity* this);
void MetalDoor_Action4(MetalDoorEntity* this);
void MetalDoor(MetalDoorEntity* this) {
static void (*const MetalDoor_Actions[])(MetalDoorEntity*) = {
MetalDoor_Init, MetalDoor_Action1, MetalDoor_Action2, MetalDoor_Action3, MetalDoor_Action4,
};
MetalDoor_Actions[this->action](this);
MetalDoor_Actions[super->action](this);
}
void MetalDoor_Init(Entity* this) {
if ((this->cutsceneBeh.HWORD != 0xffff) && CheckFlags(this->cutsceneBeh.HWORD)) {
void MetalDoor_Init(MetalDoorEntity* this) {
if ((this->unk_84 != 0xffff) && CheckFlags(this->unk_84)) {
DeleteThisEntity();
}
this->action = 1;
this->speed = 0x300;
this->spriteSettings.draw = 0;
this->frameIndex = 0;
this->spriteSettings.flipY = 1;
this->hitbox = (Hitbox*)&gHitbox_3;
this->spritePriority.b0 = 5;
this->field_0x70.HALF.LO = this->x.HALF.HI;
this->field_0x70.HALF.HI = this->y.HALF.HI;
this->field_0x74.HWORD = COORD_TO_TILE(this);
super->action = 1;
super->speed = 0x300;
super->spriteSettings.draw = 0;
super->frameIndex = 0;
super->spriteSettings.flipY = 1;
super->hitbox = (Hitbox*)&gHitbox_3;
super->spritePriority.b0 = 5;
this->unk_70 = super->x.HALF.HI;
this->unk_72 = super->y.HALF.HI;
this->unk_74 = COORD_TO_TILE(super);
}
void MetalDoor_Action1(Entity* this) {
if (sub_08083734(this, 2) != 0) {
this->action = 2;
this->timer = 12;
this->spriteSettings.draw = TRUE;
this->direction = 0;
this->y.HALF.HI += 0x24;
void MetalDoor_Action1(MetalDoorEntity* this) {
if (sub_08083734(super, 2) != 0) {
super->action = 2;
super->timer = 12;
super->spriteSettings.draw = TRUE;
super->direction = 0;
super->y.HALF.HI += 0x24;
sub_080A080C(this);
}
}
void MetalDoor_Action2(Entity* this) {
void MetalDoor_Action2(MetalDoorEntity* this) {
u8 bVar1;
Entity* ent;
Entity* fx;
LinearMoveUpdate(this);
LinearMoveUpdate(super);
if (--this->timer == 0) {
this->action = 3;
this->z.HALF.HI = 0;
this->x.HALF.HI = this->field_0x70.HALF.LO;
this->y.HALF.HI = this->field_0x70.HALF.HI;
ent = CreateFx(this, FX_DASH, 0x40);
if (ent != NULL) {
ent->x.HALF.HI += 0xc;
ent->y.HALF.HI -= 0xc;
if (--super->timer == 0) {
super->action = 3;
super->z.HALF.HI = 0;
super->x.HALF.HI = this->unk_70;
super->y.HALF.HI = this->unk_72;
fx = CreateFx(super, FX_DASH, 0x40);
if (fx != NULL) {
fx->x.HALF.HI += 0xc;
fx->y.HALF.HI -= 0xc;
}
ent = CreateFx(this, FX_DASH, 0x40);
if (ent != NULL) {
ent->x.HALF.HI -= 0xc;
ent->y.HALF.HI -= 0xc;
fx = CreateFx(super, FX_DASH, 0x40);
if (fx != NULL) {
fx->x.HALF.HI -= 0xc;
fx->y.HALF.HI -= 0xc;
}
EnqueueSFX(SFX_10B);
}
}
void MetalDoor_Action3(Entity* this) {
if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 4;
this->timer = 12;
this->direction = 0x10;
this->y.HALF.HI += 2;
void MetalDoor_Action3(MetalDoorEntity* this) {
if (CheckFlags(this->unk_86)) {
super->action = 4;
super->timer = 12;
super->direction = 0x10;
super->y.HALF.HI += 2;
sub_080A0870(this);
SoundReq(SFX_10B);
}
}
void MetalDoor_Action4(Entity* this) {
void MetalDoor_Action4(MetalDoorEntity* this) {
LinearMoveUpdate(this);
LinearMoveUpdate(super);
if (--this->timer == 0) {
if (--super->timer == 0) {
DeleteThisEntity();
}
}
void sub_080A080C(Entity* this) {
this->field_0x76.HWORD = GetMetaTileIndex(this->field_0x74.HWORD - 1, this->collisionLayer);
this->field_0x78.HWORD = GetMetaTileIndex(this->field_0x74.HWORD, this->collisionLayer);
this->field_0x7a.HWORD = GetMetaTileIndex(this->field_0x74.HWORD + 1, this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD - 1, this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD, this->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, this->field_0x74.HWORD + 1, this->collisionLayer);
void sub_080A080C(MetalDoorEntity* this) {
this->unk_76 = GetMetaTileIndex(this->unk_74 - 1, super->collisionLayer);
this->unk_78 = GetMetaTileIndex(this->unk_74, super->collisionLayer);
this->unk_7a = GetMetaTileIndex(this->unk_74 + 1, super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, this->unk_74 - 1, super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, this->unk_74, super->collisionLayer);
SetMetaTile(SPECIAL_META_TILE_34, this->unk_74 + 1, super->collisionLayer);
}
void sub_080A0870(Entity* this) {
SetMetaTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer);
SetMetaTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer);
SetMetaTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer);
void sub_080A0870(MetalDoorEntity* this) {
SetMetaTile(this->unk_76, this->unk_74 - 1, super->collisionLayer);
SetMetaTile(this->unk_78, this->unk_74, super->collisionLayer);
SetMetaTile(this->unk_7a, this->unk_74 + 1, super->collisionLayer);
}
+10 -10
View File
@@ -12,21 +12,21 @@
typedef struct {
Entity base;
u8 filler[0x1C];
u8 filler[28];
MinecartData* minecartData;
} MinecartEntity;
extern void sub_08017744(Entity*);
u32 sub_08091DDC(MinecartEntity*);
void Minecart_Init(MinecartEntity*);
void Minecart_Action1(MinecartEntity*);
void Minecart_Action2(MinecartEntity*);
void Minecart_Action3(MinecartEntity*);
void Minecart_Action4(MinecartEntity*);
void Minecart_Action5(MinecartEntity*);
void Minecart_Action6(MinecartEntity*);
void Minecart_Action7(MinecartEntity*);
u32 sub_08091DDC(MinecartEntity* this);
void Minecart_Init(MinecartEntity* this);
void Minecart_Action1(MinecartEntity* this);
void Minecart_Action2(MinecartEntity* this);
void Minecart_Action3(MinecartEntity* this);
void Minecart_Action4(MinecartEntity* this);
void Minecart_Action5(MinecartEntity* this);
void Minecart_Action6(MinecartEntity* this);
void Minecart_Action7(MinecartEntity* this);
extern const KeyValuePair* const gUnk_081223D8[];

Some files were not shown because too many files have changed in this diff Show More