use object enum in object creation

This commit is contained in:
Henny022p 2021-05-02 02:27:18 +02:00
parent 0cfa5a9a06
commit f477e63fa4
36 changed files with 98 additions and 65 deletions

View File

@ -3,8 +3,9 @@
#include "area.h" #include "area.h"
#include "main.h" #include "main.h"
#include "utils.h" #include "utils.h"
#include "functions.h"
#include "screen.h" #include "screen.h"
#include "object.h"
#include "functions.h"
typedef struct { typedef struct {
u8 filler[18]; u8 filler[18];
@ -39,7 +40,7 @@ void sub_0804AAD4(void) {
MemClear(&gUnk_02018EB0, 0x28); MemClear(&gUnk_02018EB0, 0x28);
gUnk_02018EB0.unk = 0; gUnk_02018EB0.unk = 0;
EraseAllEntities(); EraseAllEntities();
CreateObject(0x3d, gArea.curPortalType, 0); CreateObject(OBJECT_3D, gArea.curPortalType, 0);
gArea.filler[8]++; gArea.filler[8]++;
} }

View File

@ -242,7 +242,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
UpdateSpriteOrderAndFlip(itemEntity); UpdateSpriteOrderAndFlip(itemEntity);
} }
} else { } else {
itemEntity = CreateObject(0, itemID, adjustedParam); itemEntity = CreateObject(GROUND_ITEM, itemID, adjustedParam);
if (itemEntity != NULL) { if (itemEntity != NULL) {
if (arg0 == &gPlayerEntity) { if (arg0 == &gPlayerEntity) {
itemEntity->actionDelay = 1; itemEntity->actionDelay = 1;

View File

@ -2,6 +2,7 @@
#include "entity.h" #include "entity.h"
#include "player.h" #include "player.h"
#include "utils.h" #include "utils.h"
#include "object.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
@ -110,7 +111,7 @@ void sub_08077F84(void) {
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) { GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {
sub_0807AA80(&gPlayerEntity); sub_0807AA80(&gPlayerEntity);
gPlayerState.jumpStatus |= 8; gPlayerState.jumpStatus |= 8;
obj = CreateObject(0x44, 0, 0); obj = CreateObject(OBJECT_44, 0, 0);
if (obj != NULL) { if (obj != NULL) {
obj->x = gPlayerEntity.x; obj->x = gPlayerEntity.x;
obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc; obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc;

View File

@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "room.h" #include "room.h"
#include "object.h"
void sub_080A29BC(Entity* parent) { // TODO this is CreateDust, why is it here again? Fogot to delete file? void sub_080A29BC(Entity* parent) { // TODO this is CreateDust, why is it here again? Fogot to delete file?
CreateFx(parent, 2, 0); CreateFx(parent, 2, 0);
@ -9,7 +10,7 @@ void sub_080A29BC(Entity* parent) { // TODO this is CreateDust, why is it here a
void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) { void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) {
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateObject(0xf, 2, 0); pEVar1 = CreateObject(SPECIAL_FX, 2, 0);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff; pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff;
pEVar1->y.HALF.HI = gRoomControls.roomOriginY + yOff; pEVar1->y.HALF.HI = gRoomControls.roomOriginY + yOff;
@ -32,7 +33,7 @@ void sub_080A2A14(Entity* parent) {
Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) { Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateObjectWithParent(parent, 0, form, parameter); pEVar1 = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
pEVar1->actionDelay = 5; pEVar1->actionDelay = 5;
} }
@ -42,7 +43,7 @@ Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) { Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
Entity* ent; Entity* ent;
ent = CreateObjectWithParent(parent, 0, form, subtype); ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype);
if (ent != NULL) { if (ent != NULL) {
ent->actionDelay = 5; ent->actionDelay = 5;
*(u32*)(&ent->field_0x86) = param_4; *(u32*)(&ent->field_0x86) = param_4;

View File

@ -3,6 +3,7 @@
#include "coord.h" #include "coord.h"
#include "room.h" #include "room.h"
#include "createObject.h" #include "createObject.h"
#include "object.h"
Entity* CreateObject(u32 subtype, u32 form, u32 parameter) { Entity* CreateObject(u32 subtype, u32 form, u32 parameter) {
Entity* entity; Entity* entity;
@ -31,7 +32,7 @@ Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 form, u32 par
} }
Entity* CreateFx(Entity* parentEnt, u32 form, u32 parameter) { Entity* CreateFx(Entity* parentEnt, u32 form, u32 parameter) {
return CreateObjectWithParent(parentEnt, 0xf, form, parameter); return CreateObjectWithParent(parentEnt, SPECIAL_FX, form, parameter);
} }
void CreateDust(Entity* parent) { void CreateDust(Entity* parent) {
@ -41,7 +42,7 @@ void CreateDust(Entity* parent) {
void CreateDustAt(s32 xOff, s32 yOff, u32 layer) { void CreateDustAt(s32 xOff, s32 yOff, u32 layer) {
Entity* ent; Entity* ent;
ent = CreateObject(0xf, 2, 0); ent = CreateObject(SPECIAL_FX, 2, 0);
if (ent != NULL) { if (ent != NULL) {
ent->x.HALF.HI = gRoomControls.roomOriginX + xOff; ent->x.HALF.HI = gRoomControls.roomOriginX + xOff;
ent->y.HALF.HI = gRoomControls.roomOriginY + yOff; ent->y.HALF.HI = gRoomControls.roomOriginY + yOff;
@ -64,7 +65,7 @@ void CreateWaterSplash(Entity* parent) {
Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) { Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
Entity* ent; Entity* ent;
ent = CreateObjectWithParent(parent, 0, form, parameter); ent = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter);
if (ent != NULL) { if (ent != NULL) {
ent->actionDelay = 5; ent->actionDelay = 5;
} }
@ -74,7 +75,7 @@ Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) { Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
Entity* ent; Entity* ent;
ent = CreateObjectWithParent(parent, 0, form, subtype); ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype);
if (ent != NULL) { if (ent != NULL) {
ent->actionDelay = 5; ent->actionDelay = 5;
ent->field_0x86.HWORD = param_4; ent->field_0x86.HWORD = param_4;

View File

@ -1,6 +1,7 @@
#include "enemy.h" #include "enemy.h"
#include "random.h" #include "random.h"
#include "createObject.h" #include "createObject.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void sub_08078930(Entity*); extern void sub_08078930(Entity*);
@ -283,7 +284,7 @@ void sub_0802CBC4(Entity* this) {
} }
sub_08078954(this); sub_08078954(this);
ent = CreateObjectWithParent(this, 0x20, 0, 0); ent = CreateObjectWithParent(this, OBJECT_20, 0, 0);
if (ent) { if (ent) {
ent->collisionLayer = this->collisionLayer; ent->collisionLayer = this->collisionLayer;
} }

View File

@ -2,6 +2,7 @@
#include "entity.h" #include "entity.h"
#include "player.h" #include "player.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void sub_08078954(Entity*); extern void sub_08078954(Entity*);
@ -522,7 +523,7 @@ void sub_0802B048(Entity* this) {
if (this->parent->next) { if (this->parent->next) {
this->parent->field_0x80.HALF.HI = 0; this->parent->field_0x80.HALF.HI = 0;
} }
ent = CreateObjectWithParent(this, 0x20, 0, 0); ent = CreateObjectWithParent(this, OBJECT_20, 0, 0);
if (ent != NULL) { if (ent != NULL) {
this->collisionLayer = 1; this->collisionLayer = 1;
} else { } else {

View File

@ -3,6 +3,7 @@
#include "sprite.h" #include "sprite.h"
#include "enemy.h" #include "enemy.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
// Gibudo // Gibudo
void sub_08037794(); void sub_08037794();
@ -373,7 +374,7 @@ void sub_08037B10(Entity* this) {
} }
NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* this)) { NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* this)) {
Entity* E; Entity* E;
E = CreateObject(0x2a, 3, 0); E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) { if (E != 0) {
E->type2 = this->actionDelay; E->type2 = this->actionDelay;
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
@ -382,7 +383,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th
E->parent = this; E->parent = this;
} }
*(Entity**)&this->field_0x80.HWORD = E; *(Entity**)&this->field_0x80.HWORD = E;
E = CreateObject(0x2a, 3, 0); E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) { if (E != 0) {
E->type2 = this->actionDelay; E->type2 = this->actionDelay;
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;
@ -391,7 +392,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th
E->parent = this; E->parent = this;
} }
*(Entity**)&this->cutsceneBeh.HWORD = E; *(Entity**)&this->cutsceneBeh.HWORD = E;
E = CreateObject(0x2a, 3, 0); E = CreateObject(OBJECT_2A, 3, 0);
if (E != 0) { if (E != 0) {
E->type2 = this->actionDelay; E->type2 = this->actionDelay;
E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3;

View File

@ -1,5 +1,6 @@
#include "enemy.h" #include "enemy.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void sub_08008796(Entity*, u32, u32, u32); extern void sub_08008796(Entity*, u32, u32, u32);
@ -347,7 +348,7 @@ bool32 sub_0802C0E8(Entity* this) {
void sub_0802C18C(Entity* this) { void sub_0802C18C(Entity* this) {
this->field_0x78.HALF.LO--; this->field_0x78.HALF.LO--;
if ((this->field_0x78.HALF.LO & 7) == 0) { if ((this->field_0x78.HALF.LO & 7) == 0) {
Entity* ent = CreateObject(0xf, 0x11, 0x40); Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
if (ent) { if (ent) {
PositionRelative(this, ent, 0, 0x10000); PositionRelative(this, ent, 0, 0x10000);
} }

View File

@ -1,6 +1,7 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h" #include "entity.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern u32 sub_080002E0(u32, u32); extern u32 sub_080002E0(u32, u32);
@ -85,7 +86,7 @@ void sub_08025020(Entity* this) {
break; break;
default: default:
if (this->damageType == 0x82 && this->iframes < 0) { if (this->damageType == 0x82 && this->iframes < 0) {
Entity* ent = CreateObject(0x21, 2, 0); Entity* ent = CreateObject(OBJECT_21, 2, 0);
if (ent != NULL) { if (ent != NULL) {
ent->spritePriority.b0 = 3; ent->spritePriority.b0 = 3;
CopyPosition(this, ent); CopyPosition(this, ent);
@ -550,7 +551,7 @@ void sub_08025B18(Entity* this) {
for (; i < 9; i++, offset += 2) { for (; i < 9; i++, offset += 2) {
sub_08025AB8((((x + offset[0]) >> 4) & 0x3fU) | ((((y + offset[1]) >> 4) & 0x3fU) << 6), layer); sub_08025AB8((((x + offset[0]) >> 4) & 0x3fU) | ((((y + offset[1]) >> 4) & 0x3fU) << 6), layer);
ent = CreateObject(0x21, 2, 0); ent = CreateObject(OBJECT_21, 2, 0);
if (ent) { if (ent) {
PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000); PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000);
ent->x.HALF.HI &= -0x10; ent->x.HALF.HI &= -0x10;
@ -564,7 +565,7 @@ void sub_08025B18(Entity* this) {
void sub_08025BD4(Entity* this) { void sub_08025BD4(Entity* this) {
if (this->field_0x82.HALF.LO && (this->frames.all & 1) == 0) { if (this->field_0x82.HALF.LO && (this->frames.all & 1) == 0) {
Entity* ent = CreateObject(0x21, 0, 0); Entity* ent = CreateObject(OBJECT_21, 0, 0);
if (ent) { if (ent) {
PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000, PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000,
gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000); gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000);

View File

@ -1,5 +1,6 @@
#include "enemy.h" #include "enemy.h"
#include "entity.h" #include "entity.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void (*const gUnk_080CD234[])(Entity*); extern void (*const gUnk_080CD234[])(Entity*);
@ -114,7 +115,7 @@ void sub_0802B35C(Entity* this) {
void sub_0802B4A8(Entity* this) { void sub_0802B4A8(Entity* this) {
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
Entity* ent = CreateObjectWithParent(this, 0, 0x60, 0); Entity* ent = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0);
if (ent) { if (ent) {
ent->y.HALF.HI -= 4; ent->y.HALF.HI -= 4;
} }

View File

@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "enemy.h" #include "enemy.h"
#include "entity.h" #include "entity.h"
#include "object.h"
#include "functions.h" #include "functions.h"
static bool32 ShouldSpawnTreeItem(Entity*); static bool32 ShouldSpawnTreeItem(Entity*);
@ -35,14 +36,14 @@ void TreeItem(Entity* this) {
if (var0 >= 0) { if (var0 >= 0) {
if (var0 > 7) { if (var0 > 7) {
if (var0 == 8) { if (var0 == 8) {
itemEntity = CreateObject(0x40, 0x60, 0); itemEntity = CreateObject(FAIRY, 0x60, 0);
if (itemEntity) { if (itemEntity) {
itemEntity->actionDelay = 0; itemEntity->actionDelay = 0;
CopyPosition(this, itemEntity); CopyPosition(this, itemEntity);
} }
} }
} else { } else {
itemEntity = CreateObject(0x96, 0x7, gUnk_080D2AB0[var0]); itemEntity = CreateObject(OBJECT_96, 0x7, gUnk_080D2AB0[var0]);
if (itemEntity) { if (itemEntity) {
CopyPosition(this, itemEntity); CopyPosition(this, itemEntity);
itemEntity->y.HALF.HI += 16; itemEntity->y.HALF.HI += 16;

View File

@ -2,8 +2,9 @@
#include "entity.h" #include "entity.h"
#include "screen.h" #include "screen.h"
#include "random.h" #include "random.h"
#include "functions.h" #include "object.h"
#include "structures.h" #include "structures.h"
#include "functions.h"
void sub_0802A39C(Entity*); void sub_0802A39C(Entity*);
void sub_0802A334(Entity*); void sub_0802A334(Entity*);
@ -28,7 +29,7 @@ void sub_0802A250(Entity* this) {
InitializeAnimation(this, 0); InitializeAnimation(this, 0);
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
ent = CreateObject(0x66, 0, 0); ent = CreateObject(OBJECT_66, 0, 0);
if (ent) { if (ent) {
ent->parent = this; ent->parent = this;
} }

View File

@ -6,6 +6,7 @@
#include "menu.h" #include "menu.h"
#include "random.h" #include "random.h"
#include "textbox.h" #include "textbox.h"
#include "object.h"
#include "functions.h" #include "functions.h"
// copy, erase, start // copy, erase, start
@ -213,7 +214,7 @@ static void HandleFileScreenEnter(void) {
sub_080503A8(0x5); sub_080503A8(0x5);
LoadPaletteGroup(0x9); LoadPaletteGroup(0x9);
for (i = 0; i < 26; i++) { for (i = 0; i < 26; i++) {
CreateObject(0x48, i, 0); CreateObject(FILE_SCREEN_OBJECTS, i, 0);
} }
sub_080A70AC(&gUnk_080FC8D0); sub_080A70AC(&gUnk_080FC8D0);

View File

@ -2,11 +2,12 @@
#include "global.h" #include "global.h"
#include "main.h" #include "main.h"
#include "entity.h" #include "entity.h"
#include "functions.h"
#include "utils.h" #include "utils.h"
#include "screen.h" #include "screen.h"
#include "structures.h" #include "object.h"
#include "textbox.h" #include "textbox.h"
#include "structures.h"
#include "functions.h"
typedef struct { typedef struct {
u8 filler0[0x4]; u8 filler0[0x4];
@ -251,7 +252,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) {
gFadeControl.field_0x4 = -1; gFadeControl.field_0x4 = -1;
gIntroState.subState++; gIntroState.subState++;
gIntroState.timer = 90; gIntroState.timer = 90;
pEVar2 = CreateObject(0xb4, 0, 0); pEVar2 = CreateObject(OBJECT_B4, 0, 0);
if (pEVar2 != NULL) { if (pEVar2 != NULL) {
pEVar2->x.HALF.HI = 0; pEVar2->x.HALF.HI = 0;
pEVar2->y.HALF.HI = DISPLAY_HEIGHT / 2 - 8; pEVar2->y.HALF.HI = DISPLAY_HEIGHT / 2 - 8;
@ -289,7 +290,7 @@ static void HandleTitlescreenAnimationIntro(void) {
if (--gIntroState.timer == 0) { if (--gIntroState.timer == 0) {
gIntroState.timer = 300; gIntroState.timer = 300;
gIntroState.subState++; gIntroState.subState++;
CreateObject(0xBD, 0, 0); CreateObject(OBJECT_BD, 0, 0);
DoFade(6, 16); DoFade(6, 16);
SoundReq(SFX_F8); SoundReq(SFX_F8);
} }

View File

@ -3,8 +3,9 @@
#include "flags.h" #include "flags.h"
#include "screen.h" #include "screen.h"
#include "manager.h" #include "manager.h"
#include "functions.h" #include "object.h"
#include "structures.h" #include "structures.h"
#include "functions.h"
typedef struct { typedef struct {
Manager manager; Manager manager;
@ -159,7 +160,7 @@ void sub_0805A4B4(Manager15* this) {
void sub_0805A4CC(Manager15* this, u32 unk_0) { void sub_0805A4CC(Manager15* this, u32 unk_0) {
Entity* tmp; Entity* tmp;
tmp = CreateObject(0x8e, unk_0, 0); tmp = CreateObject(OBJECT_8E, unk_0, 0);
if (tmp) { if (tmp) {
tmp->x.HALF.HI = this->unk_38 + gRoomControls.roomOriginX; tmp->x.HALF.HI = this->unk_38 + gRoomControls.roomOriginX;
tmp->y.HALF.HI = this->unk_3a + gRoomControls.roomOriginY - 0x30; tmp->y.HALF.HI = this->unk_3a + gRoomControls.roomOriginY - 0x30;

View File

@ -5,6 +5,7 @@
#include "room.h" #include "room.h"
#include "screen.h" #include "screen.h"
#include "utils.h" #include "utils.h"
#include "object.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
@ -100,14 +101,14 @@ void sub_0805B048(Manager1A* this) {
} }
if (!tmp->unk_10) if (!tmp->unk_10)
return; return;
obj = CreateObject(0x28, tmp->unk_10->unk_00, tmp->unk_10->unk_01); obj = CreateObject(OBJECT_28, tmp->unk_10->unk_00, tmp->unk_10->unk_01);
if (obj) { if (obj) {
obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX; obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX;
obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY;
} }
if (this->manager.unk_0a != 0xa || CheckLocalFlag(0x4B)) if (this->manager.unk_0a != 0xa || CheckLocalFlag(0x4B))
return; return;
obj = CreateObject(0x28, 3, 3); obj = CreateObject(OBJECT_28, 3, 3);
if (obj) { if (obj) {
obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX; obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX;
obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY;

View File

@ -3,6 +3,7 @@
#include "entity.h" #include "entity.h"
#include "flags.h" #include "flags.h"
#include "room.h" #include "room.h"
#include "object.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
@ -37,7 +38,7 @@ void sub_0805C6D0(Manager26* this) {
this->unk_29 = 0; this->unk_29 = 0;
while (tmp->unk_00 != 0xFF && this->manager.unk_0e < 0x20) { while (tmp->unk_00 != 0xFF && this->manager.unk_0e < 0x20) {
Entity* obj; Entity* obj;
obj = CreateObject(0x4C, tmp->unk_01, tmp->unk_02); obj = CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02);
if (obj) { if (obj) {
obj->actionDelay = tmp->unk_03; obj->actionDelay = tmp->unk_03;
obj->x.HALF.HI = gRoomControls.roomOriginX + tmp->unk_04; obj->x.HALF.HI = gRoomControls.roomOriginX + tmp->unk_04;

View File

@ -6,6 +6,7 @@
#include "player.h" #include "player.h"
#include "random.h" #include "random.h"
#include "audio.h" #include "audio.h"
#include "object.h"
// Facilitates the usage of minish portals. // Facilitates the usage of minish portals.
@ -75,7 +76,7 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
r = Random(); r = Random();
if ((r & 0x7) != 0) if ((r & 0x7) != 0)
return; return;
spark = CreateObject(0xF, 0x26, 0); spark = CreateObject(SPECIAL_FX, 0x26, 0);
if (!spark) if (!spark)
return; return;
offsetX = (r >> 0x8) & 0xF; offsetX = (r >> 0x8) & 0xF;

View File

@ -4,6 +4,7 @@
#include "save.h" #include "save.h"
#include "script.h" #include "script.h"
#include "audio.h" #include "audio.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern Hitbox gUnk_080FD170; extern Hitbox gUnk_080FD170;
@ -200,12 +201,12 @@ void sub_0806DB44(Entity* this, ScriptExecutionContext* context) {
void sub_0806DB84(Entity* this, ScriptExecutionContext* context) { void sub_0806DB84(Entity* this, ScriptExecutionContext* context) {
Entity* ent; Entity* ent;
this->hitbox = (Hitbox*)&gUnk_08114154; this->hitbox = (Hitbox*)&gUnk_08114154;
ent = CreateObject(0x3e, 4, 0); ent = CreateObject(OBJECT_3E, 4, 0);
if (ent != NULL) { if (ent != NULL) {
PositionRelative(this, ent, -0x80000, 0); PositionRelative(this, ent, -0x80000, 0);
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_08016030); *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_08016030);
} }
ent = CreateObject(0x3e, 5, 0); ent = CreateObject(OBJECT_3E, 5, 0);
if (ent != NULL) { if (ent != NULL) {
PositionRelative(this, ent, 0x80000, 0); PositionRelative(this, ent, 0x80000, 0);
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_0801606C); *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_0801606C);

View File

@ -1,10 +1,11 @@
#include "global.h" #include "global.h"
#include "audio.h" #include "audio.h"
#include "entity.h" #include "entity.h"
#include "functions.h"
#include "room.h" #include "room.h"
#include "flags.h" #include "flags.h"
#include "script.h" #include "script.h"
#include "object.h"
#include "functions.h"
typedef struct { typedef struct {
u8 filler[4]; u8 filler[4];
@ -31,7 +32,7 @@ void sub_0806C224(void) {
} }
void Simon_CreateChest(Entity* this) { void Simon_CreateChest(Entity* this) {
CreateObjectWithParent(this, 0xf, 0x43, 0); CreateObjectWithParent(this, SPECIAL_FX, 0x43, 0);
SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer); SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer);
SoundReq(SFX_SECRET_BIG); SoundReq(SFX_SECRET_BIG);
} }

View File

@ -46,7 +46,7 @@ void sub_0806A26C(Entity* this) {
u8 unk; u8 unk;
u32 uVar2; u32 uVar2;
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateObject(0xf, 0x2f, 0); pEVar1 = CreateObject(SPECIAL_FX, 0x2f, 0);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
PositionEntityOnTop(this, pEVar1); PositionEntityOnTop(this, pEVar1);
if (uVar2 = Random(), uVar2) { if (uVar2 = Random(), uVar2) {

View File

@ -1,5 +1,6 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void sub_0800449C(Entity*, u32); extern void sub_0800449C(Entity*, u32);
@ -23,7 +24,7 @@ void sub_0809CC74(Entity* this) {
this->spritePriority.b0 = 5; this->spritePriority.b0 = 5;
/* Create steam clouds */ /* Create steam clouds */
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
ent = CreateObject(0x92, 1, i); ent = CreateObject(BAKER_OVEN, 1, i);
if (ent) { if (ent) {
ent->parent = this; ent->parent = this;
PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000); PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000);

View File

@ -1,7 +1,8 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "functions.h"
#include "flags.h" #include "flags.h"
#include "object.h"
#include "functions.h"
extern void sub_08098E3C(Entity*); extern void sub_08098E3C(Entity*);
extern void sub_08098E88(Entity*); extern void sub_08098E88(Entity*);
@ -98,12 +99,12 @@ void sub_08098E88(Entity* this) {
Entity* ent1; Entity* ent1;
Entity* ent2; Entity* ent2;
ent1 = CreateObject(0x82, 1, 0); ent1 = CreateObject(BIG_VORTEX, 1, 0);
if (ent1 != NULL) { if (ent1 != NULL) {
PositionRelative(this, ent1, 0, -0x10000); PositionRelative(this, ent1, 0, -0x10000);
ent1->spriteOffsetY = 8; ent1->spriteOffsetY = 8;
} }
ent2 = CreateObject(0x82, 2, 0); ent2 = CreateObject(BIG_VORTEX, 2, 0);
if (ent2 != NULL) { if (ent2 != NULL) {
PositionRelative(this, ent2, 0, -0x20000); PositionRelative(this, ent2, 0, -0x20000);
ent2->spriteOffsetY = 0x10; ent2->spriteOffsetY = 0x10;

View File

@ -4,6 +4,7 @@
#include "flags.h" #include "flags.h"
#include "save.h" #include "save.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void (*const gUnk_08123EC0[])(Entity*); extern void (*const gUnk_08123EC0[])(Entity*);
@ -37,7 +38,7 @@ void sub_0809CF54(Entity* this) {
SoundReq(SFX_123); SoundReq(SFX_123);
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
InitAnimationForceUpdate(this, 0); InitAnimationForceUpdate(this, 0);
target = CreateObject(0x95, 1, 0); target = CreateObject(BIRD, 1, 0);
if (target != NULL) { if (target != NULL) {
target->parent = this; target->parent = this;
PositionRelative(this, target, 0, 0x80000); PositionRelative(this, target, 0, 0x80000);

View File

@ -5,8 +5,9 @@
#include "player.h" #include "player.h"
#include "flags.h" #include "flags.h"
#include "random.h" #include "random.h"
#include "functions.h" #include "object.h"
#include "structures.h" #include "structures.h"
#include "functions.h"
extern void sub_0809F7BC(Entity*); extern void sub_0809F7BC(Entity*);
extern void sub_0809F7F4(Entity*); extern void sub_0809F7F4(Entity*);
@ -148,7 +149,7 @@ Entity* sub_0809F770(Entity* this) {
Entity* cloud; Entity* cloud;
int uVar1; int uVar1;
cloud = CreateObject(163, 1, 0); cloud = CreateObject(CLOUD, 1, 0);
if (cloud) { if (cloud) {
PositionEntityOnTop(this, cloud); PositionEntityOnTop(this, cloud);
uVar1 = Random(); uVar1 = Random();

View File

@ -8,6 +8,7 @@
#include "save.h" #include "save.h"
#include "random.h" #include "random.h"
#include "script.h" #include "script.h"
#include "object.h"
#include "structures.h" #include "structures.h"
#include "functions.h" #include "functions.h"
@ -481,7 +482,7 @@ Entity* GreatFairy_CreateForm(Entity* this, u32 curForm, u32 parameter) {
nextForm = this->type; nextForm = this->type;
nextForm /= 11; nextForm /= 11;
ent = CreateObject(0x1b, (u8)nextForm * 11 + curForm, parameter); ent = CreateObject(GREAT_FAIRY, (u8)nextForm * 11 + curForm, parameter);
return ent; return ent;
} }
@ -514,7 +515,7 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) {
Entity* ent; Entity* ent;
sub_080791D0(); sub_080791D0();
ent = CreateObject(0x64, 0, 0); ent = CreateObject(OBJECT_64, 0, 0);
if (ent != NULL) { if (ent != NULL) {
ent->parent = &gPlayerEntity; ent->parent = &gPlayerEntity;
CopyPosition(&gPlayerEntity, ent); CopyPosition(&gPlayerEntity, ent);

View File

@ -4,6 +4,7 @@
#include "room.h" #include "room.h"
#include "script.h" #include "script.h"
#include "audio.h" #include "audio.h"
#include "object.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
@ -53,7 +54,7 @@ void sub_080866D8(Entity* this) {
int mask = 1 << i; int mask = 1 << i;
if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) && if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) &&
sub_080562CC(prop->unk0, prop->unk2, 32, 32)) { sub_080562CC(prop->unk0, prop->unk2, 32, 32)) {
entity = CreateObject(0x19, prop->unk7, prop->unk6); entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6);
if (entity) { if (entity) {
entity->field_0x6c.HALF.LO = i; entity->field_0x6c.HALF.LO = i;
entity->x.HALF.HI = gRoomControls.roomOriginX + prop->unk0 + 16; entity->x.HALF.HI = gRoomControls.roomOriginX + prop->unk0 + 16;

View File

@ -2,8 +2,9 @@
#include "audio.h" #include "audio.h"
#include "entity.h" #include "entity.h"
#include "flags.h" #include "flags.h"
#include "functions.h"
#include "player.h" #include "player.h"
#include "object.h"
#include "functions.h"
void sub_08081150(Entity*); void sub_08081150(Entity*);
u8 sub_0808147C(u32); u8 sub_0808147C(u32);
@ -124,7 +125,7 @@ void sub_08080F20(Entity* this) {
this->field_0x1c = sub_0808147C(this->type); this->field_0x1c = sub_0808147C(this->type);
gUnk_0811E7E8[this->field_0x68.HALF.HI](this); gUnk_0811E7E8[this->field_0x68.HALF.HI](this);
} else { } else {
Entity* entity = CreateObject(0x40, 0x60, 0); Entity* entity = CreateObject(FAIRY, 0x60, 0);
if (entity) { if (entity) {
entity->actionDelay = 0; entity->actionDelay = 0;
if (this->actionDelay == 1) { if (this->actionDelay == 1) {

View File

@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void sub_08086A6C(); extern void sub_08086A6C();
@ -21,7 +22,7 @@ void sub_080869DC(Entity* ent) {
ent->spriteSettings.b.draw = 0; ent->spriteSettings.b.draw = 0;
ent->hitbox = &gUnk_080FD1A8; ent->hitbox = &gUnk_080FD1A8;
ent->field_0x3c |= 16; ent->field_0x3c |= 16;
itemEntity = CreateObject(0, ent->type, 0); itemEntity = CreateObject(GROUND_ITEM, ent->type, 0);
if (itemEntity != NULL) { if (itemEntity != NULL) {
itemEntity->actionDelay = 10; itemEntity->actionDelay = 10;
itemEntity->parent = ent; itemEntity->parent = ent;

View File

@ -1,10 +1,11 @@
#include "global.h" #include "global.h"
#include "audio.h" #include "audio.h"
#include "entity.h" #include "entity.h"
#include "functions.h"
#include "coord.h" #include "coord.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "structures.h" #include "structures.h"
#include "functions.h"
static void sub_0808F2B0(Entity*); static void sub_0808F2B0(Entity*);
void sub_0808F14C(Entity*); void sub_0808F14C(Entity*);
@ -32,7 +33,7 @@ void sub_0808F0D0(Entity* this) {
Entity* ent; Entity* ent;
u32 uVar3; u32 uVar3;
ent = CreateObjectWithParent(this, 0x49, 2, 0); ent = CreateObjectWithParent(this, OBJECT_49, 2, 0);
this->attachedEntity = ent; this->attachedEntity = ent;
if (ent == NULL) { if (ent == NULL) {
DeleteThisEntity(); DeleteThisEntity();

View File

@ -2,6 +2,7 @@
#include "entity.h" #include "entity.h"
#include "coord.h" #include "coord.h"
#include "room.h" #include "room.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern Hitbox gUnk_080FD168; extern Hitbox gUnk_080FD168;
@ -28,7 +29,7 @@ void Object9E(Entity* this) {
SetTile(0x4066, tilePos - 1, *layer); SetTile(0x4066, tilePos - 1, *layer);
SetTile(0x4065, tilePos, *layer); SetTile(0x4065, tilePos, *layer);
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
ent = CreateObject(0x9e, 1, 0); ent = CreateObject(OBJECT_9E, 1, 0);
if (ent != NULL) { if (ent != NULL) {
this->attachedEntity = ent; this->attachedEntity = ent;
CopyPosition(this, ent); CopyPosition(this, ent);

View File

@ -1,9 +1,10 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "functions.h"
#include "flags.h" #include "flags.h"
#include "player.h" #include "player.h"
#include "room.h" #include "room.h"
#include "object.h"
#include "functions.h"
void sub_08082824(Entity*); void sub_08082824(Entity*);
static void sub_08082850(Entity*, Entity*); static void sub_08082850(Entity*, Entity*);
@ -283,7 +284,7 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) {
result = 0x80; result = 0x80;
break; break;
default: default:
entity = CreateObjectWithParent(this, 0, form, arg2); entity = CreateObjectWithParent(this, GROUND_ITEM, form, arg2);
if (entity) { if (entity) {
if (arg3 == 2) { if (arg3 == 2) {
entity->actionDelay = 5; entity->actionDelay = 5;

View File

@ -1,6 +1,7 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
#include "random.h" #include "random.h"
#include "object.h"
#include "functions.h" #include "functions.h"
extern void (*const gUnk_08121060[])(Entity*); extern void (*const gUnk_08121060[])(Entity*);
@ -21,7 +22,7 @@ void sub_0808A40C(Entity* this) {
} }
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
this->actionDelay = 0x40 - (Random() & 0x1f); this->actionDelay = 0x40 - (Random() & 0x1f);
ent = CreateObject(0x2d, 1, 0); ent = CreateObject(SMOKE, 1, 0);
if (ent != NULL) { if (ent != NULL) {
CopyPosition(this, ent); CopyPosition(this, ent);
ent->x.HALF.HI += gUnk_08121068[(Random() & 7)]; ent->x.HALF.HI += gUnk_08121068[(Random() & 7)];

View File

@ -7,6 +7,7 @@
#include "area.h" #include "area.h"
#include "save.h" #include "save.h"
#include "game.h" #include "game.h"
#include "object.h"
#include "functions.h" #include "functions.h"
static void (*const sPlayerActions[])(Entity*); static void (*const sPlayerActions[])(Entity*);
@ -616,7 +617,7 @@ void PortalActivateInit(Entity* this) {
this->subAction = 3; this->subAction = 3;
this->field_0xf = 0x1e; this->field_0xf = 0x1e;
gPlayerState.field_0x8 = 0x738; gPlayerState.field_0x8 = 0x738;
CreateObjectWithParent(this, 6, 1, 0); CreateObjectWithParent(this, OBJECT_6, 1, 0);
sub_08077B20(); sub_08077B20();
sub_0805E544(); sub_0805E544();
} }
@ -746,7 +747,7 @@ void sub_0807193C(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frames.all & 0x80) { if (this->frames.all & 0x80) {
this->subAction++; this->subAction++;
child = CreateObjectWithParent(this, 6, 0, 0); child = CreateObjectWithParent(this, OBJECT_6, 0, 0);
this->attachedEntity = child; this->attachedEntity = child;
if (child != NULL) { if (child != NULL) {
if (this->animationState == 2) if (this->animationState == 2)
@ -943,7 +944,7 @@ void sub_08071D04(Entity* this) {
idx = GetBottleContaining(0x28); idx = GetBottleContaining(0x28);
if (idx != 0) { if (idx != 0) {
gSave.stats.bottles[idx - 1] = 0x20; gSave.stats.bottles[idx - 1] = 0x20;
CreateObject(0x40, 0x60, 2); CreateObject(FAIRY, 0x60, 2);
deltaHealth = 32; deltaHealth = 32;
} }

View File

@ -962,12 +962,12 @@ void sub_0804BF38(u32 arg0, struct_0804BF38* arg1)
if (numEnts != 0) { if (numEnts != 0) {
for (xOff = 0; entCnt < numEnts; xOff += 0x10, entCnt++) { for (xOff = 0; entCnt < numEnts; xOff += 0x10, entCnt++) {
fx = CreateObject(0xf, 0xf, 0); fx = CreateObject(SPECIAL_FX, 0xf, 0);
if (fx != NULL) { if (fx != NULL) {
fx->x.HALF.HI = gUnk_080D8E50[iVar3].x + gRoomControls.roomOriginX + xOff; fx->x.HALF.HI = gUnk_080D8E50[iVar3].x + gRoomControls.roomOriginX + xOff;
fx->y.HALF.HI = gUnk_080D8E50[iVar3].y + gRoomControls.roomOriginY + (entCnt & 1) * 8; fx->y.HALF.HI = gUnk_080D8E50[iVar3].y + gRoomControls.roomOriginY + (entCnt & 1) * 8;
} }
fx = CreateObject(0xf, 0x54, 0); fx = CreateObject(SPECIAL_FX, 0x54, 0);
if (fx != NULL) { if (fx != NULL) {
fx->x.HALF.HI = gUnk_080D8E50[iVar3].x + gRoomControls.roomOriginX + xOff; fx->x.HALF.HI = gUnk_080D8E50[iVar3].x + gRoomControls.roomOriginX + xOff;
fx->y.HALF.HI = gUnk_080D8E50[iVar3].y + gRoomControls.roomOriginY + -0xc + (entCnt & 1) * 8; fx->y.HALF.HI = gUnk_080D8E50[iVar3].y + gRoomControls.roomOriginY + -0xc + (entCnt & 1) * 8;