Create new entity structs for Objects

This commit is contained in:
octorock 2023-07-31 21:31:30 +02:00
parent eb233b05cd
commit 4d67e6fe1f
178 changed files with 3741 additions and 3500 deletions

View File

@ -22883,19 +22883,19 @@
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_Thunderbold_0.bin",
"path": "animations/gSpriteAnimations_Thunderbolt_0.bin",
"start": 1190252,
"size": 16,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_Thunderbold_1.bin",
"path": "animations/gSpriteAnimations_Thunderbolt_1.bin",
"start": 1190268,
"size": 12,
"type": "animation"
},
{
"path": "animations/gSpriteAnimations_Thunderbold_2.bin",
"path": "animations/gSpriteAnimations_Thunderbolt_2.bin",
"start": 1190280,
"size": 28,
"type": "animation"

View File

@ -1,20 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gSpriteAnimations_Thunderbold_0:: @ 0812296C
.include "animations/gSpriteAnimations_Thunderbold_0.s"
gSpriteAnimations_Thunderbold_1:: @ 0812297C
.include "animations/gSpriteAnimations_Thunderbold_1.s"
gSpriteAnimations_Thunderbold_2:: @ 08122988
.include "animations/gSpriteAnimations_Thunderbold_2.s"
gSpriteAnimations_Thunderbold:: @ 081229A4
.4byte gSpriteAnimations_Thunderbold_0
.4byte gSpriteAnimations_Thunderbold_1
.4byte gSpriteAnimations_Thunderbold_2
.4byte 00000000

View File

@ -0,0 +1,20 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gSpriteAnimations_Thunderbolt_0:: @ 0812296C
.include "animations/gSpriteAnimations_Thunderbolt_0.s"
gSpriteAnimations_Thunderbolt_1:: @ 0812297C
.include "animations/gSpriteAnimations_Thunderbolt_1.s"
gSpriteAnimations_Thunderbolt_2:: @ 08122988
.include "animations/gSpriteAnimations_Thunderbolt_2.s"
gSpriteAnimations_Thunderbolt:: @ 081229A4
.4byte gSpriteAnimations_Thunderbolt_0
.4byte gSpriteAnimations_Thunderbolt_1
.4byte gSpriteAnimations_Thunderbolt_2
.4byte 00000000

View File

@ -825,7 +825,7 @@ gSpritePtrs:: @ 080029B4
.4byte 00000000
.4byte 00000000
.4byte gSpriteAnimations_Thunderbold
.4byte gSpriteAnimations_Thunderbolt
.4byte 00000000
.4byte 00000000
.4byte 00000000

View File

@ -19,7 +19,7 @@ extern void sub_08001290(struct Entity_*, u32);
extern void GenericKnockback(struct Entity_*);
extern u32 GetFuserId(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_*, u32);
extern u32 GravityUpdate(struct Entity_* entity, u32 gravity);
extern u32 CheckOnScreen(struct Entity_*);
extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32);

View File

@ -6,7 +6,6 @@
#include "player.h"
void CreateItemEntity(u32, u32, u32);
void sub_08081404(Entity*, u32);
extern void ExecuteItemFunction(ItemBehavior* this, u32 index);
extern void ItemDebug(ItemBehavior*, u32);

View File

@ -134,7 +134,7 @@ typedef enum {
EZLO_CAP_FLYING,
GIANT_TWIG,
OBJECT_63,
THUNDERBOLD,
THUNDERBOLT,
LADDER_HOLE,
WATER_DROP_OBJECT,
GLEEROK_PARTICLE,
@ -330,7 +330,7 @@ void SwordsmanNewsletter();
void EzloCapFlying();
void GiantTwig();
void Object63();
void Thunderbold();
void Thunderbolt();
void LadderHoleInBookshelf();
void WaterDropObject();
void GleerokParticle();

View File

@ -0,0 +1,12 @@
#ifndef CUTSCENEORCHESTRATOR_H
#define CUTSCENEORCHESTRATOR_H
#include "script.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused1[28];
/*0x84*/ ScriptExecutionContext* context;
} CutsceneOrchestratorEntity;
#endif // CUTSCENEORCHESTRATOR_H

View File

@ -0,0 +1,18 @@
#ifndef ITEMONGROUND_H
#define ITEMONGROUND_H
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68;
/*0x69*/ u8 unk_69;
/*0x6a*/ u8 unk_6a;
/*0x6b*/ u8 unused1[1];
/*0x6c*/ u16 unk_6c;
/*0x6e*/ u16 unk_6e;
/*0x70*/ u8 unused2[22];
/*0x86*/ u16 unk_86;
} ItemOnGroundEntity;
#endif // ITEMONGROUND_H

View File

@ -0,0 +1,21 @@
#ifndef LILYPADLARGE_H
#define LILYPADLARGE_H
#include "entity.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;
#endif // LILYPADLARGE_H

View File

@ -706,7 +706,7 @@ SECTIONS {
src/object/ezloCapFlying.o(.text);
src/object/giantTwig.o(.text);
src/object/object63.o(.text);
src/object/thunderbold.o(.text);
src/object/thunderbolt.o(.text);
src/object/ladderHoleInBookshelf.o(.text);
src/object/waterDropObject.o(.text);
src/object/gleerokParticle.o(.text);
@ -1487,8 +1487,8 @@ SECTIONS {
src/object/ezloCapFlying.o(.rodata);
src/object/giantTwig.o(.rodata);
src/object/object63.o(.rodata);
src/object/thunderbold.o(.rodata);
data/animations/object/thunderbold.o(.rodata);
src/object/thunderbolt.o(.rodata);
data/animations/object/thunderbolt.o(.rodata);
src/object/ladderHoleInBookshelf.o(.rodata);
src/object/gleerokParticle.o(.rodata);
src/object/linkEmptyingBottle.o(.rodata);

View File

@ -71,7 +71,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) {
super->timer = 120;
SetPlayerControl(2);
sub_08078B48();
object = CreateObject(THUNDERBOLD, 0, 0);
object = CreateObject(THUNDERBOLT, 0, 0);
if (object != NULL) {
object->x.HALF.HI = gRoomControls.origin_x + 0x88;
object->y.HALF.HI = gRoomControls.origin_y + 0x48;

View File

@ -102,7 +102,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[EZLO_CAP_FLYING] = EzloCapFlying,
[GIANT_TWIG] = GiantTwig,
[OBJECT_63] = Object63,
[THUNDERBOLD] = Thunderbold,
[THUNDERBOLT] = Thunderbolt,
[LADDER_HOLE] = LadderHoleInBookshelf,
[WATER_DROP_OBJECT] = WaterDropObject,
[GLEEROK_PARTICLE] = GleerokParticle,

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;
}
}

View File

@ -4,6 +4,7 @@
*
* @brief Angry Statue object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "hitbox.h"

View File

@ -4,6 +4,7 @@
*
* @brief Archway object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "game.h"

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;
}
}
}

View File

@ -4,74 +4,81 @@
*
* @brief Baker Oven object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.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;
@ -82,31 +89,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 y;
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);
y = this->field_0x80.HWORD;
SetTile(0x402e, y - 0x01, this->collisionLayer);
SetTile(0x4022, y - 0x00, this->collisionLayer);
SetTile(0x4022, y + 0x01, this->collisionLayer);
SetTile(0x4026, y - 0x41, this->collisionLayer);
SetTile(0x4026, y - 0x40, this->collisionLayer);
SetTile(0x4024, y - 0x3f, this->collisionLayer);
SetTile(0x4026, y - 0x81, this->collisionLayer);
SetTile(0x4026, y - 0x80, this->collisionLayer);
y = this->unk_80;
SetTile(0x402e, y - 0x01, super->collisionLayer);
SetTile(0x4022, y - 0x00, super->collisionLayer);
SetTile(0x4022, y + 0x01, super->collisionLayer);
SetTile(0x4026, y - 0x41, super->collisionLayer);
SetTile(0x4026, y - 0x40, super->collisionLayer);
SetTile(0x4024, y - 0x3f, super->collisionLayer);
SetTile(0x4026, y - 0x81, super->collisionLayer);
SetTile(0x4026, y - 0x80, super->collisionLayer);
}

View File

@ -4,6 +4,7 @@
*
* @brief Barrel Inside object
*/
#define NENT_DEPRECATED
#include "entity.h"
typedef struct {

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;
}
}

View File

@ -5,9 +5,8 @@
* @brief Beanstalk object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;

View File

@ -4,10 +4,8 @@
*
* @brief Bed Cover object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

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);
}

View File

@ -16,8 +16,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*) = {

View File

@ -16,17 +16,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);
@ -38,13 +38,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;
@ -66,30 +66,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;
}
@ -141,7 +141,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;
@ -201,7 +201,7 @@ void sub_08088C9C(BigBarrelEntity* this) {
}
}
void sub_08088DB4(BigBarrelEntity* this) {
void BigBarrel_Type2(BigBarrelEntity* this) {
switch (super->action) {
case 0:
super->action = 1;
@ -240,7 +240,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;
@ -266,8 +266,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:
@ -285,13 +285,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;
}
SetTileType(0x76, COORD_TO_TILE(super), 2);
break;

View File

@ -4,10 +4,8 @@
*
* @brief Big Ice Block object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "item.h"
#include "object.h"

View File

@ -4,10 +4,8 @@
*
* @brief Big Pushable Lever object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

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) {

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,17 +379,15 @@ void Bird_Type10(Entity* this) {
}
void CreateBird(Entity* this) {
Entity* birdEnt;
#ifndef EU
if (AreaAllowsWarp()) {
#else
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;
}
}
}

View File

@ -4,10 +4,8 @@
*
* @brief Block Pushed object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

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;
}
@ -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,
};

View File

@ -4,10 +4,8 @@
*
* @brief Boss Door object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "object.h"

View File

@ -5,10 +5,9 @@
* @brief Bush object
*/
#define NENT_DEPRECATED
#include "global.h"
#include "object.h"
#include "functions.h"
#include "hitbox.h"
#include "object.h"
typedef struct {
/*0x00*/ Entity base;

View File

@ -4,176 +4,188 @@
*
* @brief Button object
*/
#include "object.h"
#define NENT_DEPRECATED
#include "functions.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 unk_74;
/*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 = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) {
this->action = 5;
SetTileType(0x7A, this->field_0x74.HWORD, this->collisionLayer);
this->unk_74 = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
((((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6);
this->unk_72 = GetTileType(this->unk_74, super->collisionLayer);
if (super->type == 0 && CheckFlags(this->unk_86)) {
super->action = 5;
SetTileType(0x7A, this->unk_74, 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 = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
super->action = 2;
this->unk_72 = GetTileType(this->unk_74, 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);
u32 sub_08081D28(Entity*);
void sub_08081E6C(Entity*);
u32 sub_08081F7C(ButtonEntity*, u32);
u32 sub_08081D28(ButtonEntity*);
void sub_08081E6C(ButtonEntity*);
void Button_Action3(Entity* this) {
void Button_Action3(ButtonEntity* this) {
if (!sub_08081F7C(this, 0x78))
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;
SetTile(0x4035, this->field_0x74.HWORD, this->collisionLayer);
void Button_Action4(ButtonEntity* this) {
if (super->timer != 0) {
super->timer--;
if (super->subtimer != 0) {
super->subtimer = 0;
SetTile(0x4035, this->unk_74, 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);
SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer);
super->action = 2;
ClearFlag(this->unk_86);
SetTileType(0x77, this->unk_74, super->collisionLayer);
SoundReq(SFX_BUTTON_PRESS);
}
}
void Button_Action5(Entity* this) {
void Button_Action5(ButtonEntity* this) {
if (sub_08081F7C(this, 0x7a)) {
sub_08081E6C(this);
}
}
Entity* sub_08081D74(Entity*);
Entity* sub_08081D74(ButtonEntity*);
u32 sub_08081CB0(Entity* this) {
bool32 sub_08081CB0(ButtonEntity* this) {
u16 tmp;
if (sub_08081D74(this)) {
this->field_0x70.HALF.LO = -1;
if (GetTileType(this->field_0x74.HWORD, this->collisionLayer) == 0x4035) {
sub_0807B7D8(0x78, this->field_0x74.HWORD, this->collisionLayer);
this->unk_70 = -1;
if (GetTileType(this->unk_74, super->collisionLayer) == 0x4035) {
sub_0807B7D8(0x78, this->unk_74, super->collisionLayer);
}
return 1;
return TRUE;
} else {
tmp = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
tmp = GetTileType(this->unk_74, super->collisionLayer);
if (tmp != 0x77 && tmp != 0x79 && tmp != 0x4035) {
this->field_0x70.HALF.LO = GetTileIndex(this->field_0x74.HWORD, this->collisionLayer);
return 1;
this->unk_70 = GetTileIndex(this->unk_74, 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 (GetTileIndex(this->field_0x74.HWORD, this->collisionLayer) != this->field_0x70.HALF_U.LO) {
return 0;
if (GetTileIndex(this->unk_74, 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 (sub_080B1B44(this->field_0x74.HWORD, this->collisionLayer) == 0xF) {
if (sub_080B1B44(this->unk_74, super->collisionLayer) == 0xF) {
return 0;
}
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;
}
@ -186,13 +198,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 = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
tmp2 = GetTileType(this->unk_74, super->collisionLayer);
tmp1 = gUnk_0811EE50;
do {
if (*tmp1 == tmp2)
@ -207,20 +219,20 @@ extern u16 gMapDataTopSpecial[0x2000];
extern u16 gMapDataBottomSpecial[];
void sub_08081E6C(Entity* this) {
void sub_08081E6C(ButtonEntity* this) {
u32 r4;
LayerStruct* r1;
u16* tmp2;
u16* tmp;
u16* tmp3;
u32 r6 = this->field_0x74.HWORD;
u32 r5 = this->collisionLayer;
u32 r6 = this->unk_74;
u32 r5 = super->collisionLayer;
u32 tile = GetTileType(r6, r5);
if (tile < 0x4000)
return;
r1 = GetLayerByIndex(r5);
r4 = (this->type == 0 ? 0x7a : 0x78);
r4 = (super->type == 0 ? 0x7a : 0x78);
tmp = r1->metatiles;
tmp = tmp + (r1->unkData2[r4] << 2);
tmp2 = (r5 == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial);
@ -254,25 +266,25 @@ void sub_08081F24(Entity* this) {
}
}
u32 sub_08081F7C(Entity* this, u32 r7) {
bool32 sub_08081F7C(ButtonEntity* this, u32 r7) {
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);
SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer);
sub_08081F24(this);
if (super->timer == 6) {
SetFlag(this->unk_86);
SetTileType(r7, this->unk_74, super->collisionLayer);
sub_08081F24(super);
SoundReq(SFX_BUTTON_PRESS);
if (this->field_0x70.HALF_U.LO != 0xFFFF)
SetTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer);
return 0;
if (this->unk_70 != 0xFFFF)
SetTile(this->unk_70, this->unk_74, super->collisionLayer);
return FALSE;
}
}
return 1;
return TRUE;
}
void sub_08081FF8(Entity* this) {

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

View File

@ -4,10 +4,8 @@
*
* @brief Chest Spawner object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "item.h"
#include "object.h"
#include "screen.h"

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 = 0;
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();
}

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*);

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;
}

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);
}
}

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
void CrackingGround(Entity* this) {

View File

@ -4,10 +4,8 @@
*
* @brief Crenel Bean Sprout object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "object.h"

View File

@ -10,10 +10,10 @@
#include "entity.h"
#include "fileselect.h"
#include "functions.h"
#include "item.h"
#include "npc.h"
#include "object.h"
#include "script.h"
#include "item.h"
typedef struct {
Entity base;

View File

@ -67,49 +67,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*);
@ -119,18 +111,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);
@ -141,7 +138,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;
@ -209,7 +206,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();
@ -223,7 +220,7 @@ void sub_08094C30(CutsceneMiscObjectEntity* this) {
UpdateAnimationSingleFrame(super);
}
void sub_08094C88(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type3(CutsceneMiscObjectEntity* this) {
u32 tmp;
if (super->action != 0) {
@ -282,7 +279,7 @@ void sub_08094D70(CutsceneMiscObjectEntity* this) {
}
}
void sub_08094D94(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type4(CutsceneMiscObjectEntity* this) {
u32 tmp;
if (super->action != 0) {
@ -315,7 +312,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);
@ -389,7 +386,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;
@ -440,7 +437,7 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095088(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) {
u32 tmp;
switch (super->action) {
@ -472,7 +469,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);
@ -492,7 +489,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);
@ -504,7 +501,7 @@ void sub_08095188(CutsceneMiscObjectEntity* this) {
HandleEntity0x82Actions(super);
}
void sub_080951C4(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type10(CutsceneMiscObjectEntity* this) {
Entity* p;
if (super->action == 0) {
@ -544,7 +541,7 @@ void sub_08095244(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095288(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) {
Entity* p;
if (super->action == 0) {
@ -606,7 +603,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;
@ -658,7 +655,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) {
@ -717,7 +714,7 @@ void sub_0809567C(CutsceneMiscObjectEntity* this) {
super->direction = sub_080045DA(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;
@ -771,7 +768,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;
@ -791,7 +788,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);
@ -812,7 +809,7 @@ void sub_08095810(CutsceneMiscObjectEntity* this) {
}
}
void sub_0809584C(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type18(CutsceneMiscObjectEntity* this) {
u32 tmp, idx;
idx = super->health;
@ -835,7 +832,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);
@ -847,7 +844,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);
@ -881,7 +878,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;
@ -912,7 +909,7 @@ void sub_08095A68(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095A8C(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type23(CutsceneMiscObjectEntity* this) {
switch (super->action) {
case 0:
super->action++;
@ -945,7 +942,7 @@ void sub_08095A8C(CutsceneMiscObjectEntity* this) {
}
}
void sub_08095B48(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type24(CutsceneMiscObjectEntity* this) {
Entity* p;
u32 tmp;
@ -985,7 +982,7 @@ void sub_08095BE0(CutsceneMiscObjectEntity* this, u32 val) {
}
}
void sub_08095C00(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type25(CutsceneMiscObjectEntity* this) {
if (super->action & 0x80) {
DeleteThisEntity();
} else {
@ -1009,7 +1006,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);
@ -1037,7 +1034,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;
@ -1072,7 +1069,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) {
@ -1139,7 +1136,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) {
@ -1193,7 +1190,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);
@ -1203,7 +1200,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);
@ -1237,7 +1234,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;
@ -1261,7 +1258,7 @@ void sub_080961B0(CutsceneMiscObjectEntity* this) {
}
}
void sub_080961F4(CutsceneMiscObjectEntity* this) {
void CutsceneMiscObject_Type38(CutsceneMiscObjectEntity* this) {
super->spriteSettings.draw = 1;
super->frameIndex = 0;
}
@ -1288,11 +1285,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);
}

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"

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);

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

View File

@ -4,10 +4,8 @@
*
* @brief Enemy Item object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

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;

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"

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "new_player.h"
#include "object.h"

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,

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"

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;

View File

@ -4,13 +4,12 @@
*
* @brief Figurine Device object
*/
#define NENT_DEPRECATED
#include "figurineMenu.h"
#include "fileselect.h"
#include "functions.h"
#include "kinstone.h"
#include "item.h"
#include "kinstone.h"
#include "message.h"
#include "object.h"
#include "screen.h"

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_Action1(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_Action1,
};
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_Action1(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 ? 0x400 : 0x100;
this->unk_70 = 4;
super->animationState = 2;
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 = 0;
break;
case DPAD_RIGHT:
this->animationState = 1;
super->animationState = 1;
break;
case DPAD_DOWN:
this->animationState = 2;
super->animationState = 2;
break;
case DPAD_LEFT:
this->animationState = 3;
super->animationState = 3;
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 = sub_080045DA(var0, var2) >> 3;
LinearMoveUpdate(this);
super->speed = var7;
super->direction = sub_080045DA(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);
}
}

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;

View File

@ -4,53 +4,60 @@
*
* @brief Fireplace object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "object.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);
SetTile(0x4061, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
sub_0807B7D8(0x30b, TILE(super->x.HALF.HI, super->y.HALF.HI), 2);
SetTile(0x4061, 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 = GetTileTypeByEntity(this);
void sub_0809B7C0(FireplaceEntity* this) {
u32 tileType = GetTileTypeByEntity(super);
if (tileType != 0x4061 && tileType != 0x4062) {
sub_0809B7DC(this);
}
}
void sub_0809B7DC(Entity* this) {
sub_0807B7D8(0xc3 << 2, TILE(this->x.HALF.HI, this->y.HALF.HI), 2);
SetTile(0x4062, 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);
SetTile(0x4062, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
super->timer = 1;
}

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,
};

View File

@ -4,6 +4,7 @@
*
* @brief Floating Block object
*/
#define NENT_DEPRECATED
#include "object.h"
void FloatingBlock(Entity* this) {

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) {

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"

View File

@ -4,6 +4,7 @@
*
* @brief Frozen Flower object
*/
#define NENT_DEPRECATED
#include "object.h"
void FrozenFlower_Init(Entity*);

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"

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

View File

@ -194,12 +194,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) {

View File

@ -4,22 +4,23 @@
*
* @brief Giant Leaf object
*/
#define NENT_DEPRECATED
#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,
};
@ -30,9 +31,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++) {
SetTile(16500, tilePos + arr[i], 1);

View File

@ -4,6 +4,7 @@
*
* @brief Giant Rock object
*/
#define NENT_DEPRECATED
#include "entity.h"
void GiantRock(Entity* this) {

View File

@ -15,15 +15,15 @@ typedef struct {
u16 tile;
} 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) {

View File

@ -4,10 +4,8 @@
*
* @brief Giant Twig object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
typedef struct {

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,
};

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*);

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"

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();
}

View File

@ -4,52 +4,60 @@
*
* @brief Hidden Ladder Down object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.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;
SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer);
SetTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer);
SetTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer);
SetTileType(0x1a5, *puVar3 - 1, this->collisionLayer);
SetTileType(0x1a6, *puVar3, this->collisionLayer);
SetTileType(0x1a7, *puVar3 + 1, this->collisionLayer);
SetTileType(0x1a8, *puVar3 + 0x3f, this->collisionLayer);
SetTileType(0x1a9, *puVar3 + 0x40, this->collisionLayer);
SetTileType(0x1aa, *puVar3 + 0x41, 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;
SetTileType(0x1a2, *puVar3 - 0x41, super->collisionLayer);
SetTileType(0x1a3, *puVar3 - 0x40, super->collisionLayer);
SetTileType(0x1a4, *puVar3 - 0x3f, super->collisionLayer);
SetTileType(0x1a5, *puVar3 - 1, super->collisionLayer);
SetTileType(0x1a6, *puVar3, super->collisionLayer);
SetTileType(0x1a7, *puVar3 + 1, super->collisionLayer);
SetTileType(0x1a8, *puVar3 + 0x3f, super->collisionLayer);
SetTileType(0x1a9, *puVar3 + 0x40, super->collisionLayer);
SetTileType(0x1aa, *puVar3 + 0x41, super->collisionLayer);
}
}
void HiddenLadderDown_Action1(Entity* this) {
if (GetTileType(*(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 (GetTileType(this->unk_70, super->collisionLayer) == 0x1a6) {
super->action = 2;
super->spriteSettings.draw = TRUE;
SetFlag(this->unk_86);
}
}

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();
}
}

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;

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;
}
}

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 {

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();
}
}

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"

View File

@ -4,11 +4,12 @@
*
* @brief Item On Ground object
*/
#define NENT_DEPRECATED
#include "object/itemOnGround.h"
#include "collision.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "item.h"
#include "itemMetaData.h"
@ -16,40 +17,41 @@
#include "player.h"
#include "sound.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 +60,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 +89,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 +131,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 = GetTileTypeByEntity(this);
void sub_080811AC(ItemOnGroundEntity* this) {
super->action = 2;
super->spriteSettings.draw = 0;
this->unk_6e = GetTileTypeByEntity(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,111 +276,111 @@ 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 (sub_080B1B0C(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) {
this->direction = 0;
this->speed = 0;
this->spriteSettings.draw = 1;
this->field_0x68.HALF.HI = 0;
void sub_080812A8(ItemOnGroundEntity* this) {
if (sub_080B1B0C(super) != 0xF && this->unk_6e != GetTileTypeByEntity(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] = {
@ -411,79 +413,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);
}
}

View File

@ -4,63 +4,69 @@
*
* @brief Jail Bars object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "room.h"
#include "sound.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[] = { 0x4023, -0x3, 0x4023, -0x2, 0x4023, -0x1, 0x4023,
0x0, 0x4023, 0x1, 0x4023, 0x2, -0x1 };
static const s16 gUnk_0812497A[] = { 0x4023, -0x3, 0x4023, -0x2, 0x4088, -0x1, 0x4087,
@ -71,5 +77,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);
}

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) {

View File

@ -4,115 +4,123 @@
*
* @brief Jar Portal object
*/
#define NENT_DEPRECATED
#include "area.h"
#include "functions.h"
#include "object.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*, u32);
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, u32);
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, 0);
}
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, 1);
}
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, 0);
}
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;
if (r1 != 0)
@ -126,64 +134,64 @@ 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, 1);
}
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, u32 a2) {
void sub_0808C148(JarPortalEntity* this, u32 a2) {
u32 pos;
pos = COORD_TO_TILE(this);
pos = COORD_TO_TILE(super);
if (!a2) {
SetTile(16530, pos - 1, this->collisionLayer);
SetTile(16531, pos, this->collisionLayer);
SetTile(16532, pos + 63, this->collisionLayer);
SetTile(16533, pos + 64, this->collisionLayer);
SetTile(16530, pos - 1, super->collisionLayer);
SetTile(16531, pos, super->collisionLayer);
SetTile(16532, pos + 63, super->collisionLayer);
SetTile(16533, pos + 64, super->collisionLayer);
} else {
RestorePrevTileEntity(pos - 1, this->collisionLayer);
RestorePrevTileEntity(pos, this->collisionLayer);
RestorePrevTileEntity(pos + 63, this->collisionLayer);
RestorePrevTileEntity(pos + 64, this->collisionLayer);
RestorePrevTileEntity(pos - 1, super->collisionLayer);
RestorePrevTileEntity(pos, super->collisionLayer);
RestorePrevTileEntity(pos + 63, super->collisionLayer);
RestorePrevTileEntity(pos + 64, super->collisionLayer);
}
}

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 {

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "kinstone.h"
#include "object.h"

View File

@ -4,6 +4,7 @@
*
* @brief Ladder Hole In Bookshelf object
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "player.h"

View File

@ -4,6 +4,7 @@
*
* @brief Ladder Up object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"

View File

@ -4,6 +4,7 @@
*
* @brief Lamp object
*/
#define NENT_DEPRECATED
#include "entity.h"
void Lamp_Init(Entity* this);

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"

View File

@ -4,10 +4,8 @@
*
* @brief Light Door object
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
#include "screen.h"

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "object.h"
#include "screen.h"

View File

@ -4,164 +4,173 @@
*
* @brief Lightable Switch object
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "object.h"
#include "room.h"
#include "sound.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 {
SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer);
SetTile(0x4050, 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) {
}

View File

@ -1,61 +1,47 @@
#define NENT_DEPRECATED
/**
* @file lilypadLarge.c
* @ingroup Objects
*
* @brief Large Lilypad object
*/
#include "global.h"
#define NENT_DEPRECATED
#include "object/lilypadLarge.h"
#include "area.h"
#include "functions.h"
#include "item.h"
#include "object.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();
@ -97,10 +83,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,
@ -331,7 +317,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,
@ -403,7 +389,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
ResetCollisionLayer(super);
if (GetTileUnderEntity(super) == 0xd) {
ResetCollisionLayer(&gPlayerEntity);
sub_08085CDC(this);
LilypadLarge_Action4(this);
super->direction = GetFacingDirection(&gPlayerEntity, super);
LinearMoveDirection(&gPlayerEntity, 0x100, super->direction);
}
@ -432,7 +418,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;
@ -453,7 +439,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);
@ -462,7 +448,7 @@ void sub_08085CDC(LilypadLargeEntity* this) {
}
}
void sub_08085D10(LilypadLargeEntity* this) {
void LilypadLarge_Action5(LilypadLargeEntity* this) {
if (EntityHasDuplicateID(super) != 0) {
SetLocalFlag(super->type2);
DeleteThisEntity();

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);
}
}

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);
}

View File

@ -6,7 +6,6 @@
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "global.h"
#include "message.h"
#include "object.h"

View File

@ -5,10 +5,8 @@
* @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 "global.h"
#include "item.h"
#include "object.h"
@ -19,20 +17,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 +77,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,

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