diff --git a/src/code_0804AA84.c b/src/code_0804AA84.c index cdc00c3f..ec885d7b 100644 --- a/src/code_0804AA84.c +++ b/src/code_0804AA84.c @@ -3,8 +3,9 @@ #include "area.h" #include "main.h" #include "utils.h" -#include "functions.h" #include "screen.h" +#include "object.h" +#include "functions.h" typedef struct { u8 filler[18]; @@ -39,7 +40,7 @@ void sub_0804AAD4(void) { MemClear(&gUnk_02018EB0, 0x28); gUnk_02018EB0.unk = 0; EraseAllEntities(); - CreateObject(0x3d, gArea.curPortalType, 0); + CreateObject(OBJECT_3D, gArea.curPortalType, 0); gArea.filler[8]++; } diff --git a/src/code_0805436C.c b/src/code_0805436C.c index 2e12b6b0..1f62af3d 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -242,7 +242,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) { UpdateSpriteOrderAndFlip(itemEntity); } } else { - itemEntity = CreateObject(0, itemID, adjustedParam); + itemEntity = CreateObject(GROUND_ITEM, itemID, adjustedParam); if (itemEntity != NULL) { if (arg0 == &gPlayerEntity) { itemEntity->actionDelay = 1; diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c index c25aa18e..de25d3b3 100644 --- a/src/code_08077DF4.c +++ b/src/code_08077DF4.c @@ -2,6 +2,7 @@ #include "entity.h" #include "player.h" #include "utils.h" +#include "object.h" #include "functions.h" typedef struct { @@ -110,7 +111,7 @@ void sub_08077F84(void) { GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) { sub_0807AA80(&gPlayerEntity); gPlayerState.jumpStatus |= 8; - obj = CreateObject(0x44, 0, 0); + obj = CreateObject(OBJECT_44, 0, 0); if (obj != NULL) { obj->x = gPlayerEntity.x; obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc; diff --git a/src/code_080A29BC.c b/src/code_080A29BC.c index c8476217..a33d6124 100644 --- a/src/code_080A29BC.c +++ b/src/code_080A29BC.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.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? 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) { Entity* pEVar1; - pEVar1 = CreateObject(0xf, 2, 0); + pEVar1 = CreateObject(SPECIAL_FX, 2, 0); if (pEVar1 != NULL) { pEVar1->x.HALF.HI = gRoomControls.roomOriginX + xOff; 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* pEVar1; - pEVar1 = CreateObjectWithParent(parent, 0, form, parameter); + pEVar1 = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter); if (pEVar1 != NULL) { 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* ent; - ent = CreateObjectWithParent(parent, 0, form, subtype); + ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype); if (ent != NULL) { ent->actionDelay = 5; *(u32*)(&ent->field_0x86) = param_4; diff --git a/src/createObject.c b/src/createObject.c index 16f5df16..cf3655c9 100644 --- a/src/createObject.c +++ b/src/createObject.c @@ -3,6 +3,7 @@ #include "coord.h" #include "room.h" #include "createObject.h" +#include "object.h" Entity* CreateObject(u32 subtype, u32 form, u32 parameter) { Entity* entity; @@ -31,7 +32,7 @@ Entity* CreateObjectWithParent(Entity* parentEnt, u32 subtype, u32 form, u32 par } 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) { @@ -41,7 +42,7 @@ void CreateDust(Entity* parent) { void CreateDustAt(s32 xOff, s32 yOff, u32 layer) { Entity* ent; - ent = CreateObject(0xf, 2, 0); + ent = CreateObject(SPECIAL_FX, 2, 0); if (ent != NULL) { ent->x.HALF.HI = gRoomControls.roomOriginX + xOff; 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* ent; - ent = CreateObjectWithParent(parent, 0, form, parameter); + ent = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter); if (ent != NULL) { 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* ent; - ent = CreateObjectWithParent(parent, 0, form, subtype); + ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype); if (ent != NULL) { ent->actionDelay = 5; ent->field_0x86.HWORD = param_4; diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 0e465090..77bf64da 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -1,6 +1,7 @@ #include "enemy.h" #include "random.h" #include "createObject.h" +#include "object.h" #include "functions.h" extern void sub_08078930(Entity*); @@ -283,7 +284,7 @@ void sub_0802CBC4(Entity* this) { } sub_08078954(this); - ent = CreateObjectWithParent(this, 0x20, 0, 0); + ent = CreateObjectWithParent(this, OBJECT_20, 0, 0); if (ent) { ent->collisionLayer = this->collisionLayer; } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index b57cfd81..3e6efe65 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -2,6 +2,7 @@ #include "entity.h" #include "player.h" #include "random.h" +#include "object.h" #include "functions.h" extern void sub_08078954(Entity*); @@ -522,7 +523,7 @@ void sub_0802B048(Entity* this) { if (this->parent->next) { this->parent->field_0x80.HALF.HI = 0; } - ent = CreateObjectWithParent(this, 0x20, 0, 0); + ent = CreateObjectWithParent(this, OBJECT_20, 0, 0); if (ent != NULL) { this->collisionLayer = 1; } else { diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index f9792c8a..3cadd15f 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -3,6 +3,7 @@ #include "sprite.h" #include "enemy.h" #include "random.h" +#include "object.h" #include "functions.h" // Gibudo 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)) { Entity* E; - E = CreateObject(0x2a, 3, 0); + E = CreateObject(OBJECT_2A, 3, 0); if (E != 0) { E->type2 = this->actionDelay; 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; } *(Entity**)&this->field_0x80.HWORD = E; - E = CreateObject(0x2a, 3, 0); + E = CreateObject(OBJECT_2A, 3, 0); if (E != 0) { E->type2 = this->actionDelay; 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; } *(Entity**)&this->cutsceneBeh.HWORD = E; - E = CreateObject(0x2a, 3, 0); + E = CreateObject(OBJECT_2A, 3, 0); if (E != 0) { E->type2 = this->actionDelay; E->spritePriority.b0 = (E->spritePriority.b0 & 0xf8) | 3; diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 5d4302df..ca5e2c47 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -1,5 +1,6 @@ #include "enemy.h" #include "random.h" +#include "object.h" #include "functions.h" extern void sub_08008796(Entity*, u32, u32, u32); @@ -347,7 +348,7 @@ bool32 sub_0802C0E8(Entity* this) { void sub_0802C18C(Entity* this) { this->field_0x78.HALF.LO--; if ((this->field_0x78.HALF.LO & 7) == 0) { - Entity* ent = CreateObject(0xf, 0x11, 0x40); + Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40); if (ent) { PositionRelative(this, ent, 0, 0x10000); } diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 4a47b4b7..adc59447 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -1,6 +1,7 @@ #include "enemy.h" #include "entity.h" #include "random.h" +#include "object.h" #include "functions.h" extern u32 sub_080002E0(u32, u32); @@ -85,7 +86,7 @@ void sub_08025020(Entity* this) { break; default: if (this->damageType == 0x82 && this->iframes < 0) { - Entity* ent = CreateObject(0x21, 2, 0); + Entity* ent = CreateObject(OBJECT_21, 2, 0); if (ent != NULL) { ent->spritePriority.b0 = 3; CopyPosition(this, ent); @@ -550,7 +551,7 @@ void sub_08025B18(Entity* this) { for (; i < 9; i++, offset += 2) { 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) { PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000); ent->x.HALF.HI &= -0x10; @@ -564,7 +565,7 @@ void sub_08025B18(Entity* this) { void sub_08025BD4(Entity* this) { 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) { PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000, gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000); diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 4a6541fa..e11228e6 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -1,5 +1,6 @@ #include "enemy.h" #include "entity.h" +#include "object.h" #include "functions.h" extern void (*const gUnk_080CD234[])(Entity*); @@ -114,7 +115,7 @@ void sub_0802B35C(Entity* this) { void sub_0802B4A8(Entity* this) { if (--this->actionDelay == 0) { - Entity* ent = CreateObjectWithParent(this, 0, 0x60, 0); + Entity* ent = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0); if (ent) { ent->y.HALF.HI -= 4; } diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index bf541184..0b2103fd 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -1,6 +1,7 @@ #include "global.h" #include "enemy.h" #include "entity.h" +#include "object.h" #include "functions.h" static bool32 ShouldSpawnTreeItem(Entity*); @@ -35,14 +36,14 @@ void TreeItem(Entity* this) { if (var0 >= 0) { if (var0 > 7) { if (var0 == 8) { - itemEntity = CreateObject(0x40, 0x60, 0); + itemEntity = CreateObject(FAIRY, 0x60, 0); if (itemEntity) { itemEntity->actionDelay = 0; CopyPosition(this, itemEntity); } } } else { - itemEntity = CreateObject(0x96, 0x7, gUnk_080D2AB0[var0]); + itemEntity = CreateObject(OBJECT_96, 0x7, gUnk_080D2AB0[var0]); if (itemEntity) { CopyPosition(this, itemEntity); itemEntity->y.HALF.HI += 16; diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 918ab7d4..e469cd03 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -2,8 +2,9 @@ #include "entity.h" #include "screen.h" #include "random.h" -#include "functions.h" +#include "object.h" #include "structures.h" +#include "functions.h" void sub_0802A39C(Entity*); void sub_0802A334(Entity*); @@ -28,7 +29,7 @@ void sub_0802A250(Entity* this) { InitializeAnimation(this, 0); UpdateSpriteForCollisionLayer(this); - ent = CreateObject(0x66, 0, 0); + ent = CreateObject(OBJECT_66, 0, 0); if (ent) { ent->parent = this; } diff --git a/src/fileScreen.c b/src/fileScreen.c index 717db8a6..f048b296 100644 --- a/src/fileScreen.c +++ b/src/fileScreen.c @@ -6,6 +6,7 @@ #include "menu.h" #include "random.h" #include "textbox.h" +#include "object.h" #include "functions.h" // copy, erase, start @@ -213,7 +214,7 @@ static void HandleFileScreenEnter(void) { sub_080503A8(0x5); LoadPaletteGroup(0x9); for (i = 0; i < 26; i++) { - CreateObject(0x48, i, 0); + CreateObject(FILE_SCREEN_OBJECTS, i, 0); } sub_080A70AC(&gUnk_080FC8D0); diff --git a/src/intro.c b/src/intro.c index 6d24d922..8eca40dc 100644 --- a/src/intro.c +++ b/src/intro.c @@ -2,11 +2,12 @@ #include "global.h" #include "main.h" #include "entity.h" -#include "functions.h" #include "utils.h" #include "screen.h" -#include "structures.h" +#include "object.h" #include "textbox.h" +#include "structures.h" +#include "functions.h" typedef struct { u8 filler0[0x4]; @@ -251,7 +252,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) { gFadeControl.field_0x4 = -1; gIntroState.subState++; gIntroState.timer = 90; - pEVar2 = CreateObject(0xb4, 0, 0); + pEVar2 = CreateObject(OBJECT_B4, 0, 0); if (pEVar2 != NULL) { pEVar2->x.HALF.HI = 0; pEVar2->y.HALF.HI = DISPLAY_HEIGHT / 2 - 8; @@ -289,7 +290,7 @@ static void HandleTitlescreenAnimationIntro(void) { if (--gIntroState.timer == 0) { gIntroState.timer = 300; gIntroState.subState++; - CreateObject(0xBD, 0, 0); + CreateObject(OBJECT_BD, 0, 0); DoFade(6, 16); SoundReq(SFX_F8); } diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 0d6a3363..709bef05 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -3,8 +3,9 @@ #include "flags.h" #include "screen.h" #include "manager.h" -#include "functions.h" +#include "object.h" #include "structures.h" +#include "functions.h" typedef struct { Manager manager; @@ -159,7 +160,7 @@ void sub_0805A4B4(Manager15* this) { void sub_0805A4CC(Manager15* this, u32 unk_0) { Entity* tmp; - tmp = CreateObject(0x8e, unk_0, 0); + tmp = CreateObject(OBJECT_8E, unk_0, 0); if (tmp) { tmp->x.HALF.HI = this->unk_38 + gRoomControls.roomOriginX; tmp->y.HALF.HI = this->unk_3a + gRoomControls.roomOriginY - 0x30; diff --git a/src/manager/manager1A.c b/src/manager/manager1A.c index 379ac5b9..80c2975a 100644 --- a/src/manager/manager1A.c +++ b/src/manager/manager1A.c @@ -5,6 +5,7 @@ #include "room.h" #include "screen.h" #include "utils.h" +#include "object.h" #include "functions.h" typedef struct { @@ -100,14 +101,14 @@ void sub_0805B048(Manager1A* this) { } if (!tmp->unk_10) 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) { obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY; } if (this->manager.unk_0a != 0xa || CheckLocalFlag(0x4B)) return; - obj = CreateObject(0x28, 3, 3); + obj = CreateObject(OBJECT_28, 3, 3); if (obj) { obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY; diff --git a/src/manager/manager26.c b/src/manager/manager26.c index 80613c41..89da7a38 100644 --- a/src/manager/manager26.c +++ b/src/manager/manager26.c @@ -3,6 +3,7 @@ #include "entity.h" #include "flags.h" #include "room.h" +#include "object.h" #include "functions.h" typedef struct { @@ -37,7 +38,7 @@ void sub_0805C6D0(Manager26* this) { this->unk_29 = 0; while (tmp->unk_00 != 0xFF && this->manager.unk_0e < 0x20) { Entity* obj; - obj = CreateObject(0x4C, tmp->unk_01, tmp->unk_02); + obj = CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02); if (obj) { obj->actionDelay = tmp->unk_03; obj->x.HALF.HI = gRoomControls.roomOriginX + tmp->unk_04; diff --git a/src/manager/manager3.c b/src/manager/manager3.c index 5be578f2..24b5be70 100644 --- a/src/manager/manager3.c +++ b/src/manager/manager3.c @@ -6,6 +6,7 @@ #include "player.h" #include "random.h" #include "audio.h" +#include "object.h" // Facilitates the usage of minish portals. @@ -75,7 +76,7 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) { r = Random(); if ((r & 0x7) != 0) return; - spark = CreateObject(0xF, 0x26, 0); + spark = CreateObject(SPECIAL_FX, 0x26, 0); if (!spark) return; offsetX = (r >> 0x8) & 0xF; diff --git a/src/npc/ezloCap.c b/src/npc/ezloCap.c index 1dd254cb..655ad588 100644 --- a/src/npc/ezloCap.c +++ b/src/npc/ezloCap.c @@ -4,6 +4,7 @@ #include "save.h" #include "script.h" #include "audio.h" +#include "object.h" #include "functions.h" extern Hitbox gUnk_080FD170; @@ -200,12 +201,12 @@ void sub_0806DB44(Entity* this, ScriptExecutionContext* context) { void sub_0806DB84(Entity* this, ScriptExecutionContext* context) { Entity* ent; this->hitbox = (Hitbox*)&gUnk_08114154; - ent = CreateObject(0x3e, 4, 0); + ent = CreateObject(OBJECT_3E, 4, 0); if (ent != NULL) { PositionRelative(this, ent, -0x80000, 0); *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_08016030); } - ent = CreateObject(0x3e, 5, 0); + ent = CreateObject(OBJECT_3E, 5, 0); if (ent != NULL) { PositionRelative(this, ent, 0x80000, 0); *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_0801606C); diff --git a/src/npc/simon.c b/src/npc/simon.c index 20cb40e5..f5f1aad7 100644 --- a/src/npc/simon.c +++ b/src/npc/simon.c @@ -1,10 +1,11 @@ #include "global.h" #include "audio.h" #include "entity.h" -#include "functions.h" #include "room.h" #include "flags.h" #include "script.h" +#include "object.h" +#include "functions.h" typedef struct { u8 filler[4]; @@ -31,7 +32,7 @@ void sub_0806C224(void) { } void Simon_CreateChest(Entity* this) { - CreateObjectWithParent(this, 0xf, 0x43, 0); + CreateObjectWithParent(this, SPECIAL_FX, 0x43, 0); SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer); SoundReq(SFX_SECRET_BIG); } diff --git a/src/npc/syrup.c b/src/npc/syrup.c index f3a1b5dc..8a60ddb7 100644 --- a/src/npc/syrup.c +++ b/src/npc/syrup.c @@ -46,7 +46,7 @@ void sub_0806A26C(Entity* this) { u8 unk; u32 uVar2; Entity* pEVar1; - pEVar1 = CreateObject(0xf, 0x2f, 0); + pEVar1 = CreateObject(SPECIAL_FX, 0x2f, 0); if (pEVar1 != NULL) { PositionEntityOnTop(this, pEVar1); if (uVar2 = Random(), uVar2) { diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index 12cbf897..f9de2600 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -1,5 +1,6 @@ #include "global.h" #include "entity.h" +#include "object.h" #include "functions.h" extern void sub_0800449C(Entity*, u32); @@ -23,7 +24,7 @@ void sub_0809CC74(Entity* this) { this->spritePriority.b0 = 5; /* Create steam clouds */ for (i = 0; i < 3; i++) { - ent = CreateObject(0x92, 1, i); + ent = CreateObject(BAKER_OVEN, 1, i); if (ent) { ent->parent = this; PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000); diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index fb771024..866309ae 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -1,7 +1,8 @@ #include "global.h" #include "entity.h" -#include "functions.h" #include "flags.h" +#include "object.h" +#include "functions.h" extern void sub_08098E3C(Entity*); extern void sub_08098E88(Entity*); @@ -98,12 +99,12 @@ void sub_08098E88(Entity* this) { Entity* ent1; Entity* ent2; - ent1 = CreateObject(0x82, 1, 0); + ent1 = CreateObject(BIG_VORTEX, 1, 0); if (ent1 != NULL) { PositionRelative(this, ent1, 0, -0x10000); ent1->spriteOffsetY = 8; } - ent2 = CreateObject(0x82, 2, 0); + ent2 = CreateObject(BIG_VORTEX, 2, 0); if (ent2 != NULL) { PositionRelative(this, ent2, 0, -0x20000); ent2->spriteOffsetY = 0x10; diff --git a/src/object/bird.c b/src/object/bird.c index 6e8cf037..3d1558e3 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -4,6 +4,7 @@ #include "flags.h" #include "save.h" #include "random.h" +#include "object.h" #include "functions.h" extern void (*const gUnk_08123EC0[])(Entity*); @@ -37,7 +38,7 @@ void sub_0809CF54(Entity* this) { SoundReq(SFX_123); UpdateSpriteForCollisionLayer(this); InitAnimationForceUpdate(this, 0); - target = CreateObject(0x95, 1, 0); + target = CreateObject(BIRD, 1, 0); if (target != NULL) { target->parent = this; PositionRelative(this, target, 0, 0x80000); diff --git a/src/object/cloud.c b/src/object/cloud.c index 20247c76..a2c20ff6 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -5,8 +5,9 @@ #include "player.h" #include "flags.h" #include "random.h" -#include "functions.h" +#include "object.h" #include "structures.h" +#include "functions.h" extern void sub_0809F7BC(Entity*); extern void sub_0809F7F4(Entity*); @@ -148,7 +149,7 @@ Entity* sub_0809F770(Entity* this) { Entity* cloud; int uVar1; - cloud = CreateObject(163, 1, 0); + cloud = CreateObject(CLOUD, 1, 0); if (cloud) { PositionEntityOnTop(this, cloud); uVar1 = Random(); diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 08ac1cd2..9ad2c2a3 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -8,6 +8,7 @@ #include "save.h" #include "random.h" #include "script.h" +#include "object.h" #include "structures.h" #include "functions.h" @@ -481,7 +482,7 @@ Entity* GreatFairy_CreateForm(Entity* this, u32 curForm, u32 parameter) { nextForm = this->type; nextForm /= 11; - ent = CreateObject(0x1b, (u8)nextForm * 11 + curForm, parameter); + ent = CreateObject(GREAT_FAIRY, (u8)nextForm * 11 + curForm, parameter); return ent; } @@ -514,7 +515,7 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) { Entity* ent; sub_080791D0(); - ent = CreateObject(0x64, 0, 0); + ent = CreateObject(OBJECT_64, 0, 0); if (ent != NULL) { ent->parent = &gPlayerEntity; CopyPosition(&gPlayerEntity, ent); diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index c800b29a..876fdc6a 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -4,6 +4,7 @@ #include "room.h" #include "script.h" #include "audio.h" +#include "object.h" #include "functions.h" typedef struct { @@ -53,7 +54,7 @@ void sub_080866D8(Entity* this) { int mask = 1 << i; if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) && 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) { entity->field_0x6c.HALF.LO = i; entity->x.HALF.HI = gRoomControls.roomOriginX + prop->unk0 + 16; diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 4ed95a19..493ed137 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -2,8 +2,9 @@ #include "audio.h" #include "entity.h" #include "flags.h" -#include "functions.h" #include "player.h" +#include "object.h" +#include "functions.h" void sub_08081150(Entity*); u8 sub_0808147C(u32); @@ -124,7 +125,7 @@ void sub_08080F20(Entity* this) { this->field_0x1c = sub_0808147C(this->type); gUnk_0811E7E8[this->field_0x68.HALF.HI](this); } else { - Entity* entity = CreateObject(0x40, 0x60, 0); + Entity* entity = CreateObject(FAIRY, 0x60, 0); if (entity) { entity->actionDelay = 0; if (this->actionDelay == 1) { diff --git a/src/object/object1A.c b/src/object/object1A.c index f028481d..ad3b1389 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "random.h" +#include "object.h" #include "functions.h" extern void sub_08086A6C(); @@ -21,7 +22,7 @@ void sub_080869DC(Entity* ent) { ent->spriteSettings.b.draw = 0; ent->hitbox = &gUnk_080FD1A8; ent->field_0x3c |= 16; - itemEntity = CreateObject(0, ent->type, 0); + itemEntity = CreateObject(GROUND_ITEM, ent->type, 0); if (itemEntity != NULL) { itemEntity->actionDelay = 10; itemEntity->parent = ent; diff --git a/src/object/object49.c b/src/object/object49.c index c945f632..0be4c477 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -1,10 +1,11 @@ #include "global.h" #include "audio.h" #include "entity.h" -#include "functions.h" #include "coord.h" #include "random.h" +#include "object.h" #include "structures.h" +#include "functions.h" static void sub_0808F2B0(Entity*); void sub_0808F14C(Entity*); @@ -32,7 +33,7 @@ void sub_0808F0D0(Entity* this) { Entity* ent; u32 uVar3; - ent = CreateObjectWithParent(this, 0x49, 2, 0); + ent = CreateObjectWithParent(this, OBJECT_49, 2, 0); this->attachedEntity = ent; if (ent == NULL) { DeleteThisEntity(); diff --git a/src/object/object9E.c b/src/object/object9E.c index f8e89b4e..771f7e80 100644 --- a/src/object/object9E.c +++ b/src/object/object9E.c @@ -2,6 +2,7 @@ #include "entity.h" #include "coord.h" #include "room.h" +#include "object.h" #include "functions.h" extern Hitbox gUnk_080FD168; @@ -28,7 +29,7 @@ void Object9E(Entity* this) { SetTile(0x4066, tilePos - 1, *layer); SetTile(0x4065, tilePos, *layer); UpdateSpriteForCollisionLayer(this); - ent = CreateObject(0x9e, 1, 0); + ent = CreateObject(OBJECT_9E, 1, 0); if (ent != NULL) { this->attachedEntity = ent; CopyPosition(this, ent); diff --git a/src/object/pot.c b/src/object/pot.c index 2a1a1e23..7aff3672 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -1,9 +1,10 @@ #include "global.h" #include "entity.h" -#include "functions.h" #include "flags.h" #include "player.h" #include "room.h" +#include "object.h" +#include "functions.h" void sub_08082824(Entity*); static void sub_08082850(Entity*, Entity*); @@ -283,7 +284,7 @@ u32 sub_0808288C(Entity* this, u32 form, u32 arg2, u32 arg3) { result = 0x80; break; default: - entity = CreateObjectWithParent(this, 0, form, arg2); + entity = CreateObjectWithParent(this, GROUND_ITEM, form, arg2); if (entity) { if (arg3 == 2) { entity->actionDelay = 5; diff --git a/src/object/smoke.c b/src/object/smoke.c index 86c75efc..565daa79 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "random.h" +#include "object.h" #include "functions.h" extern void (*const gUnk_08121060[])(Entity*); @@ -21,7 +22,7 @@ void sub_0808A40C(Entity* this) { } if (--this->actionDelay == 0) { this->actionDelay = 0x40 - (Random() & 0x1f); - ent = CreateObject(0x2d, 1, 0); + ent = CreateObject(SMOKE, 1, 0); if (ent != NULL) { CopyPosition(this, ent); ent->x.HALF.HI += gUnk_08121068[(Random() & 7)]; diff --git a/src/player.c b/src/player.c index 232b5d21..821d1b8c 100644 --- a/src/player.c +++ b/src/player.c @@ -7,6 +7,7 @@ #include "area.h" #include "save.h" #include "game.h" +#include "object.h" #include "functions.h" static void (*const sPlayerActions[])(Entity*); @@ -616,7 +617,7 @@ void PortalActivateInit(Entity* this) { this->subAction = 3; this->field_0xf = 0x1e; gPlayerState.field_0x8 = 0x738; - CreateObjectWithParent(this, 6, 1, 0); + CreateObjectWithParent(this, OBJECT_6, 1, 0); sub_08077B20(); sub_0805E544(); } @@ -746,7 +747,7 @@ void sub_0807193C(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frames.all & 0x80) { this->subAction++; - child = CreateObjectWithParent(this, 6, 0, 0); + child = CreateObjectWithParent(this, OBJECT_6, 0, 0); this->attachedEntity = child; if (child != NULL) { if (this->animationState == 2) @@ -943,7 +944,7 @@ void sub_08071D04(Entity* this) { idx = GetBottleContaining(0x28); if (idx != 0) { gSave.stats.bottles[idx - 1] = 0x20; - CreateObject(0x40, 0x60, 2); + CreateObject(FAIRY, 0x60, 2); deltaHealth = 32; } diff --git a/src/room.c b/src/room.c index 3529459b..18ca4e10 100644 --- a/src/room.c +++ b/src/room.c @@ -962,12 +962,12 @@ void sub_0804BF38(u32 arg0, struct_0804BF38* arg1) if (numEnts != 0) { for (xOff = 0; entCnt < numEnts; xOff += 0x10, entCnt++) { - fx = CreateObject(0xf, 0xf, 0); + fx = CreateObject(SPECIAL_FX, 0xf, 0); if (fx != NULL) { 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 = CreateObject(0xf, 0x54, 0); + fx = CreateObject(SPECIAL_FX, 0x54, 0); if (fx != NULL) { 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;