diff --git a/include/createEnemy.h b/include/createEnemy.h deleted file mode 100644 index 584632ca..00000000 --- a/include/createEnemy.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef GUARD_CREATEENEMY_H -#define GUARD_CREATEENEMY_H - -#include "entity.h" - -Entity* CreateEnemy(u8, u8); - -#endif // GUARD_CREATEENEMY_H diff --git a/include/enemy.h b/include/enemy.h index 0b3e8ecb..655af99a 100644 --- a/include/enemy.h +++ b/include/enemy.h @@ -4,6 +4,112 @@ #include "global.h" #include "entity.h" +typedef enum { + /*0x00*/ OCTOROCK, + /*0x01*/ CHUCHU, + /*0x02*/ LEEVER, + /*0x03*/ PEAHAT, + /*0x04*/ ROLLOBITE, + /*0x05*/ DARK_NUT, + /*0x06*/ HANGING_SEED, + /*0x07*/ BEETLE, + /*0x08*/ KEESE, + /*0x09*/ DOOR_MIMIC, + /*0x0a*/ ROCK_CHUCHU, + /*0x0b*/ SPINY_CHUCHU, + /*0x0c*/ CUCCO_CHICK_AGGR, + /*0x0d*/ MOLDORM, + /*0x0e*/ ENEMY_E, + /*0x0f*/ MOLDWORM, + /*0x10*/ SLUGGULA, + /*0x11*/ PESTO, + /*0x12*/ PUFFSTOOL, + /*0x13*/ CHUCHU_BOSS, + /*0x14*/ LIKE_LIKE, + /*0x15*/ SPEAR_MOBLIN, + /*0x16*/ BUSINESS_SCRUB, + /*0x17*/ RUPEE_LIKE, + /*0x18*/ MADDERPILLAR, + /*0x19*/ WATER_DROP, + /*0x1a*/ WALL_MASTER, + /*0x1b*/ BOMB_PEAHAT, + /*0x1c*/ SPARK, + /*0x1d*/ CHASER, + /*0x1e*/ SPIKED_BEETLE, + /*0x1f*/ SENSOR_BLADE_TRAP, + /*0x20*/ HELMASAUR, + /*0x21*/ FALLING_BOULDER, + /*0x22*/ BOBOMB, + /*0x23*/ WALL_MASTER_2, + /*0x24*/ GLEEROCK, + /*0x25*/ VAATI_EYES_MACRO, + /*0x26*/ TEKTITE, + /*0x27*/ WIZZROBE_WIND, + /*0x28*/ WIZZROBE_FIRE, + /*0x29*/ WIZZROBE_ICE, + /*0x2a*/ ARMOS, + /*0x2b*/ EYEGORE, + /*0x2c*/ ROPE, + /*0x2d*/ SMALL_PESTO, + /*0x2e*/ ACRO_BANDIT, + /*0x2f*/ BLADE_TRAP, + /*0x30*/ KEATON, + /*0x31*/ CROW, + /*0x32*/ MULLDOZER, + /*0x33*/ BOMBAROSSA, + /*0x34*/ WISP, + /*0x35*/ SPINY_BEETLE, + /*0x36*/ MAZAAL_HEAD, + /*0x37*/ MAZAAL_MACRO, + /*0x38*/ MAZAAL_HAND, + /*0x39*/ OCTOROCK_BOSS, + /*0x3a*/ FLYING_POT, + /*0x3b*/ GOBDO, + /*0x3c*/ OCTOROCK_GOLDEN, + /*0x3d*/ TEKTITE_GOLDEN, + /*0x3e*/ ROPE_GOLDEN, + /*0x3f*/ CLOUD_PIRANHA, + /*0x40*/ SCISSORS_BEETLE, + /*0x41*/ CUCCO_AGGR, + /*0x42*/ STALFOS, + /*0x43*/ FLYING_SKULL, + /*0x44*/ MAZAAL_BRACELET, + /*0x45*/ TAKKURI, + /*0x46*/ BOW_MOBLIN, + /*0x47*/ LAKITU, + /*0x48*/ LAKITU_CLOUD, + /*0x49*/ ENEMY_49, + /*0x4a*/ VAATI_REBORN_ENEMY, + /*0x4b*/ VAATI_PROJECTILE, + /*0x4c*/ BALL_CHAIN_SOLIDER, + /*0x4d*/ ENEMY_4D, + /*0x4e*/ GHINI, + /*0x4f*/ VAATI_TRANSFIGURED, + /*0x50*/ ENEMY_50, + /*0x51*/ VAATI_WRATH, + /*0x52*/ VAATI_ARM, + /*0x53*/ DUST, + /*0x54*/ VAATI_BALL, + /*0x55*/ OCTOROCK2, + /*0x56*/ SLIME, + /*0x57*/ MINI_SLIME, + /*0x58*/ FIREBALL_GUY, + /*0x59*/ MINI_FIREBALL_GUY, + /*0x5a*/ ENEMY_5A, + /*0x5b*/ BUSINESS_SCRUB_PROLOGUE, + /*0x5c*/ GYORG_FEMALE, + /*0x5d*/ GYORG_MALE, + /*0x5e*/ CURTAIN, + /*0x5f*/ ENEMY_5F, + /*0x60*/ GYORG_CHILD, + /*0x61*/ GYORG_FEMALE_EYE, + /*0x62*/ ENEMY_62, + /*0x63*/ GYORG_FEMALE_MOUTH, + /*0x64*/ ENEMY_64, + /*0x65*/ TREE_ITEM, + /*0x66*/ ENEMY_66 +} Enemy; + extern void Octorok(Entity*); extern void Chuchu(Entity*); extern void Leever(Entity*); 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..7e1fe6c3 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -234,7 +234,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) { } if (itemID != 0) { if (itemID == 0xff) { - itemEntity = CreateEnemy(7, 0); + itemEntity = CreateEnemy(BEETLE, 0); if (itemEntity != NULL) { itemEntity->x.HALF.HI = arg0->x.HALF.HI; itemEntity->y.HALF.HI = arg0->y.HALF.HI; @@ -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.c b/src/enemy.c index 7baf1323..38c96f98 100644 --- a/src/enemy.c +++ b/src/enemy.c @@ -4,108 +4,108 @@ // clang-format off void (*const gEnemyFunctions[])(Entity* ent) = { - /*0x00*/ Octorok, - /*0x01*/ Chuchu, - /*0x02*/ Leever, - /*0x03*/ Peahat, - /*0x04*/ Rollobite, - /*0x05*/ DarkNut, - /*0x06*/ HangingSeed, - /*0x07*/ Beetle, - /*0x08*/ Keese, - /*0x09*/ DoorMimic, - /*0x0a*/ RockChuchu, - /*0x0b*/ SpinyChuchu, - /*0x0c*/ CuccoChickAggr, - /*0x0d*/ Moldorm, - /*0x0e*/ EnemyE, - /*0x0f*/ Moldworm, - /*0x10*/ Sluggula, - /*0x11*/ Pesto, - /*0x12*/ Puffstool, - /*0x13*/ ChuchuBoss, - /*0x14*/ LikeLike, - /*0x15*/ SpearMoblin, - /*0x16*/ BusinessScrub, - /*0x17*/ RupeeLike, - /*0x18*/ Madderpillar, - /*0x19*/ WaterDrop, - /*0x1a*/ WallMaster, - /*0x1b*/ BombPeahat, - /*0x1c*/ Spark, - /*0x1d*/ Chaser, - /*0x1e*/ SpikedBeetle, - /*0x1f*/ SensorBladeTrap, - /*0x20*/ Helmasaur, - /*0x21*/ FallingBoulder, - /*0x22*/ Bobomb, - /*0x23*/ WallMaster2, - /*0x24*/ Gleerok, - /*0x25*/ VaatiEyesMacro, - /*0x26*/ Tektite, - /*0x27*/ WizzrobeWind, - /*0x28*/ WizzrobeFire, - /*0x29*/ WizzrobeIce, - /*0x2a*/ Armos, - /*0x2b*/ Eyegore, - /*0x2c*/ Rope, - /*0x2d*/ SmallPesto, - /*0x2e*/ AcroBandit, - /*0x2f*/ BladeTrap, - /*0x30*/ Keaton, - /*0x31*/ Crow, - /*0x32*/ Mulldozer, - /*0x33*/ Bombarossa, - /*0x34*/ Wisp, - /*0x35*/ SpinyBeetle, - /*0x36*/ MazaalHead, - /*0x37*/ MazaalMacro, - /*0x38*/ MazaalHand, - /*0x39*/ OctorokBoss, - /*0x3a*/ FlyingPot, - /*0x3b*/ Gibdo, - /*0x3c*/ OctorokGolden, - /*0x3d*/ TektiteGolden, - /*0x3e*/ RopeGolden, - /*0x3f*/ CloudPiranha, - /*0x40*/ ScissorsBeetle, - /*0x41*/ CuccoAggr, - /*0x42*/ Stalfos, - /*0x43*/ FlyingSkull, - /*0x44*/ MazaalBracelet, - /*0x45*/ Takkuri, - /*0x46*/ BowMoblin, - /*0x47*/ Lakitu, - /*0x48*/ LakituCloud, - /*0x49*/ Enemy49, - /*0x4a*/ VaatiRebornEnemy, - /*0x4b*/ VaatiProjectile, - /*0x4c*/ BallChainSoldier, - /*0x4d*/ Enemy4D, - /*0x4e*/ Ghini, - /*0x4f*/ VaatiTransfigured, - /*0x50*/ Enemy50, - /*0x51*/ VaatiWrath, - /*0x52*/ VaatiArm, - /*0x53*/ Dust, - /*0x54*/ VaatiBall, - /*0x55*/ Octorok, - /*0x56*/ Slime, - /*0x57*/ MiniSlime, - /*0x58*/ FireballGuy, - /*0x59*/ MiniFireballGuy, - /*0x5a*/ Enemy5A, - /*0x5b*/ BusinessScrubPrologue, - /*0x5c*/ GyorgFemale, - /*0x5d*/ GyorgMale, - /*0x5e*/ Curtain, - /*0x5f*/ Enemy5F, - /*0x60*/ GyorgChild, - /*0x61*/ GyorgFemaleEye, - /*0x62*/ Enemy62, - /*0x63*/ GyorgFemaleMouth, - /*0x64*/ Enemy64, - /*0x65*/ TreeItem, - /*0x66*/ Enemy66 + [OCTOROCK] = Octorok, + [CHUCHU] = Chuchu, + [LEEVER] = Leever, + [PEAHAT] = Peahat, + [ROLLOBITE] = Rollobite, + [DARK_NUT] = DarkNut, + [HANGING_SEED] = HangingSeed, + [BEETLE] = Beetle, + [KEESE] = Keese, + [DOOR_MIMIC] = DoorMimic, + [ROCK_CHUCHU] = RockChuchu, + [SPINY_CHUCHU] = SpinyChuchu, + [CUCCO_CHICK_AGGR] = CuccoChickAggr, + [MOLDORM] = Moldorm, + [ENEMY_E] = EnemyE, + [MOLDWORM] = Moldworm, + [SLUGGULA] = Sluggula, + [PESTO] = Pesto, + [PUFFSTOOL] = Puffstool, + [CHUCHU_BOSS] = ChuchuBoss, + [LIKE_LIKE] = LikeLike, + [SPEAR_MOBLIN] = SpearMoblin, + [BUSINESS_SCRUB] = BusinessScrub, + [RUPEE_LIKE] = RupeeLike, + [MADDERPILLAR] = Madderpillar, + [WATER_DROP] = WaterDrop, + [WALL_MASTER] = WallMaster, + [BOMB_PEAHAT] = BombPeahat, + [SPARK] = Spark, + [CHASER] = Chaser, + [SPIKED_BEETLE] = SpikedBeetle, + [SENSOR_BLADE_TRAP] = SensorBladeTrap, + [HELMASAUR] = Helmasaur, + [FALLING_BOULDER] = FallingBoulder, + [BOBOMB] = Bobomb, + [WALL_MASTER_2] = WallMaster2, + [GLEEROCK] = Gleerok, + [VAATI_EYES_MACRO] = VaatiEyesMacro, + [TEKTITE] = Tektite, + [WIZZROBE_WIND] = WizzrobeWind, + [WIZZROBE_FIRE] = WizzrobeFire, + [WIZZROBE_ICE] = WizzrobeIce, + [ARMOS] = Armos, + [EYEGORE] = Eyegore, + [ROPE] = Rope, + [SMALL_PESTO] = SmallPesto, + [ACRO_BANDIT] = AcroBandit, + [BLADE_TRAP] = BladeTrap, + [KEATON] = Keaton, + [CROW] = Crow, + [MULLDOZER] = Mulldozer, + [BOMBAROSSA] = Bombarossa, + [WISP] = Wisp, + [SPINY_BEETLE] = SpinyBeetle, + [MAZAAL_HEAD] = MazaalHead, + [MAZAAL_MACRO] = MazaalMacro, + [MAZAAL_HAND] = MazaalHand, + [OCTOROCK_BOSS] = OctorokBoss, + [FLYING_POT] = FlyingPot, + [GOBDO] = Gibdo, + [OCTOROCK_GOLDEN] = OctorokGolden, + [TEKTITE_GOLDEN] = TektiteGolden, + [ROPE_GOLDEN] = RopeGolden, + [CLOUD_PIRANHA] = CloudPiranha, + [SCISSORS_BEETLE] = ScissorsBeetle, + [CUCCO_AGGR] = CuccoAggr, + [STALFOS] = Stalfos, + [FLYING_SKULL] = FlyingSkull, + [MAZAAL_BRACELET] = MazaalBracelet, + [TAKKURI] = Takkuri, + [BOW_MOBLIN] = BowMoblin, + [LAKITU] = Lakitu, + [LAKITU_CLOUD] = LakituCloud, + [ENEMY_49] = Enemy49, + [VAATI_REBORN_ENEMY] = VaatiRebornEnemy, + [VAATI_PROJECTILE] = VaatiProjectile, + [BALL_CHAIN_SOLIDER] = BallChainSoldier, + [ENEMY_4D] = Enemy4D, + [GHINI] = Ghini, + [VAATI_TRANSFIGURED] = VaatiTransfigured, + [ENEMY_50] = Enemy50, + [VAATI_WRATH] = VaatiWrath, + [VAATI_ARM] = VaatiArm, + [DUST] = Dust, + [VAATI_BALL] = VaatiBall, + [OCTOROCK2] = Octorok, + [SLIME] = Slime, + [MINI_SLIME] = MiniSlime, + [FIREBALL_GUY] = FireballGuy, + [MINI_FIREBALL_GUY] = MiniFireballGuy, + [ENEMY_5A] = Enemy5A, + [BUSINESS_SCRUB_PROLOGUE] = BusinessScrubPrologue, + [GYORG_FEMALE] = GyorgFemale, + [GYORG_MALE] = GyorgMale, + [CURTAIN] = Curtain, + [ENEMY_5F] = Enemy5F, + [GYORG_CHILD] = GyorgChild, + [GYORG_FEMALE_EYE] = GyorgFemaleEye, + [ENEMY_62] = Enemy62, + [GYORG_FEMALE_MOUTH] = GyorgFemaleMouth, + [ENEMY_64] = Enemy64, + [TREE_ITEM] = TreeItem, + [ENEMY_66] = Enemy66 }; // clang-format on diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 8b3c977f..e506a605 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -1,5 +1,6 @@ #include "global.h" #include "entity.h" +#include "enemy.h" #include "random.h" #include "functions.h" @@ -12,7 +13,6 @@ extern u32 sub_080322A4(Entity*); void sub_080322E8(Entity*); extern void sub_08032338(Entity*); extern Entity* sub_08049DF4(u32); -extern u32 GetNextFunction(Entity*); extern Entity* gUnk_020000B0; extern u8 gEntCount; @@ -212,33 +212,33 @@ void sub_08031C58(Entity* this) { u32 tmp = Random(); tmp &= 3; - a = CreateEnemy(0x2e, 1); + a = CreateEnemy(ACRO_BANDIT, 1); a->type2 = 0; a->parent = NULL; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); - a->attachedEntity = CreateEnemy(0x2e, 1); + a->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); b = a->attachedEntity; b->type2 = 1; b->parent = a; b->field_0x74.HALF.LO = tmp; sub_08031E48(this, b); - b->attachedEntity = CreateEnemy(0x2e, 1); + b->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); a = b->attachedEntity; a->type2 = 2; a->parent = b; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); - a->attachedEntity = CreateEnemy(0x2e, 1); + a->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); b = a->attachedEntity; b->type2 = 3; b->parent = a; b->field_0x74.HALF.LO = tmp; sub_08031E48(this, b); - b->attachedEntity = CreateEnemy(0x2e, 1); + b->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); a = b->attachedEntity; a->type2 = 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..c661e0aa 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -1,13 +1,14 @@ #include "global.h" #include "entity.h" +#include "enemy.h" #include "player.h" #include "random.h" +#include "object.h" #include "functions.h" extern void sub_08078954(Entity*); extern void sub_08078930(Entity*); extern s32 sub_080012DC(Entity*); -extern u32 GetNextFunction(Entity*); extern Entity* sub_08049DF4(u32); extern void sub_08079BD8(Entity*); @@ -339,7 +340,7 @@ void sub_0802AD54(Entity* this) { } void sub_0802ADDC(Entity* this) { - Entity* ent = CreateEnemy(0x1b, this->type + 2); + Entity* ent = CreateEnemy(BOMB_PEAHAT, this->type + 2); if (ent != NULL) { ent->type2 = !!sub_0802B234(this); ent->parent = this; @@ -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 { @@ -567,7 +568,7 @@ void sub_0802B1BC(Entity* this) { void sub_0802B204(Entity* this) { if (sub_080044EC(this, 0x2800) == 1) { - Entity* ent = CreateEnemy(0x22, 1); + Entity* ent = CreateEnemy(BOBOMB, 1); if (ent) { CopyPosition(this, ent); ent->parent = this->parent; diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index d551c54d..f7851aad 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -71,7 +71,7 @@ void sub_08045454(Entity* this) { /* Create 2-5 new MiniFireballGuy */ for (i = 0; i < count; i++) - entities[i] = CreateEnemy(0x59, this->type); + entities[i] = CreateEnemy(MINI_FIREBALL_GUY, this->type); off = gUnk_080D1810; for (i = 0; i < count; i++) { diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index f9792c8a..3a318a4d 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(); @@ -189,7 +190,7 @@ void sub_0803773C(Entity* this) { void sub_0803775C(Entity* this) { Entity* x; if (!(--this->actionDelay)) { - x = CreateEnemy(0x42, 0); + x = CreateEnemy(STALFOS, 0); if (x != 0) { sub_0804A4E4(this, x); sub_08037C0C(this, x); @@ -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/gyorgMale.c b/src/enemy/gyorgMale.c index 9c703777..ed48da55 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -669,7 +669,7 @@ void sub_08047508(Entity* this) { this->field_0x76.HWORD = this->direction << 8; } if (--this->field_0x7c.HALF.HI == 0) { - Entity* tmp = CreateEnemy(0x62, Random() & 3); + Entity* tmp = CreateEnemy(ENEMY_62, Random() & 3); if (tmp) { tmp->parent = this; } @@ -724,7 +724,7 @@ void sub_0804763C(Entity* this) { this->field_0x76.HWORD = this->direction << 8; } if (--this->field_0x7c.HALF.HI == 0) { - Entity* tmp = CreateEnemy(0x62, Random() & 3); + Entity* tmp = CreateEnemy(ENEMY_62, Random() & 3); if (tmp) { tmp->parent = this; } @@ -831,7 +831,7 @@ void sub_08047978(Entity* this) { if (--this->field_0x7c.HALF.HI == 0) { Entity* tmp; this->field_0x7c.HALF.HI = 0xF0; - tmp = CreateEnemy(0x62, Random() & 3); + tmp = CreateEnemy(ENEMY_62, Random() & 3); if (tmp) { tmp->parent = this; } diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 5d4302df..169f9db2 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); @@ -92,7 +93,7 @@ void sub_0802BCA8(Entity* this) { this->damageType = 0x19; this->field_0x3a = this->field_0x3a & 0xfb; this->field_0x1c = 0x12; - ent = CreateEnemy(0x20, 1); + ent = CreateEnemy(HELMASAUR, 1); if (ent) { ent->animationState = this->animationState; CopyPosition(this, ent); @@ -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/madderpillar.c b/src/enemy/madderpillar.c index 0679a87d..00cc3b3a 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -82,32 +82,32 @@ void sub_0802999C(Entity* this) { if (gEntCount < 0x44) { Entity *ent1, *ent2, *ent3, *ent4, *ent5, *ent6; - ent1 = CreateEnemy(0x18, 1); + ent1 = CreateEnemy(MADDERPILLAR, 1); ent1->parent = this; PositionRelative(this, ent1, 0, 5); this->attachedEntity = ent1; - ent2 = CreateEnemy(0x18, 2); + ent2 = CreateEnemy(MADDERPILLAR, 2); ent2->parent = this; PositionRelative(this, ent2, 0, 4); ent1->attachedEntity = ent2; - ent3 = CreateEnemy(0x18, 3); + ent3 = CreateEnemy(MADDERPILLAR, 3); ent3->parent = this; PositionRelative(this, ent3, 0, 3); ent2->attachedEntity = ent3; - ent4 = CreateEnemy(0x18, 4); + ent4 = CreateEnemy(MADDERPILLAR, 4); ent4->parent = this; PositionRelative(this, ent4, 0, 2); ent3->attachedEntity = ent4; - ent5 = CreateEnemy(0x18, 5); + ent5 = CreateEnemy(MADDERPILLAR, 5); ent5->parent = this; PositionRelative(this, ent5, 0, 1); ent4->attachedEntity = ent5; - ent6 = CreateEnemy(0x18, 6); + ent6 = CreateEnemy(MADDERPILLAR, 6); ent6->attachedEntity = this; ent6->parent = this; PositionRelative(this, ent6, 0, 0); diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 819b0a13..be47d87f 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -177,10 +177,10 @@ void sub_0803A274(Entity* this) { if (gEntCount < 0x45) { if (this->type == 0) { - pEVar1 = CreateEnemy(0x38, 0); + pEVar1 = CreateEnemy(MAZAAL_HAND, 0); pEVar1->parent = this; this->attachedEntity = pEVar1; - pEVar1 = CreateEnemy(0x44, 2); + pEVar1 = CreateEnemy(MAZAAL_BRACELET, 2); pEVar1->parent = this; *(Entity**)&this->field_0x74 = pEVar1; pEVar1 = CreateObject(OBJECT_7E, 1, 0); @@ -188,10 +188,10 @@ void sub_0803A274(Entity* this) { pEVar1->attachedEntity = this->attachedEntity; PositionRelative(this->parent, this, 0x100000, 0x200000); } else { - pEVar1 = CreateEnemy(0x38, 1); + pEVar1 = CreateEnemy(MAZAAL_HAND, 1); pEVar1->parent = this; this->attachedEntity = pEVar1; - pEVar1 = CreateEnemy(0x44, 3); + pEVar1 = CreateEnemy(MAZAAL_BRACELET, 3); pEVar1->parent = this; *(Entity**)&this->field_0x74 = pEVar1; pEVar1 = CreateObject(OBJECT_7E, 2, 0); @@ -968,7 +968,7 @@ void sub_0803B1B8(Entity* this) { temp->y.HALF.HI += this->hitbox->offset_y; temp->spritePriority.b0 = 3; } - temp = CreateObject(0, 0x5e, 0); + temp = CreateObject(GROUND_ITEM, 0x5e, 0); if (temp != (Entity*)0x0) { temp->actionDelay = 0; temp->direction = 0x90; @@ -1083,7 +1083,7 @@ void sub_0803B3F4(Entity* this) { void sub_0803B480(Entity* this) { Entity* target; - if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(0x2d, 1, 0), target != (Entity*)0x0)) { + if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != (Entity*)0x0)) { PositionRelative(this, target, gUnk_080CFD08[this->type] << 0x10, 0); } if (--this->field_0x7c.HALF.HI == 0) { @@ -1210,7 +1210,7 @@ void sub_0803B724(Entity* param_1) { u8 temp; if (((param_1->field_0xf < 3) && (param_1->cutsceneBeh.HALF.LO != 0)) && - (pEVar1 = CreateEnemy(7, 1), pEVar1 != (Entity*)0x0)) { + (pEVar1 = CreateEnemy(BEETLE, 1), pEVar1 != (Entity*)0x0)) { pEVar1->type2 = 1; random_value = Random(); temp = gUnk_080CFD1B[param_1->type]; diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 56e1c976..1139af36 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -4,6 +4,7 @@ #include "screen.h" #include "audio.h" #include "random.h" +#include "object.h" #include "functions.h" extern void UnloadOBJPalette(Entity*); @@ -135,9 +136,9 @@ void sub_08033F3C(Entity* this) { this->field_0x6c.HALF.HI |= 1; this->field_0x80.HALF.LO = 0; InitializeAnimation(this, 0); - pEVar1 = CreateEnemy(0x36, 1); + pEVar1 = CreateEnemy(MAZAAL_HEAD, 1); pEVar1->parent = this; - pEVar2 = CreateObject(0x7e, 0, 0); + pEVar2 = CreateObject(OBJECT_7E, 0, 0); pEVar2->parent = this; if (gScreenTransition.field_0x39 == 0) { this->action = 0xd; @@ -145,15 +146,15 @@ void sub_08033F3C(Entity* this) { this->actionDelay = 0xfc; this->flags = this->flags & 0x7f; } else { - pEVar2 = CreateEnemy(0x44, 0); + pEVar2 = CreateEnemy(MAZAAL_BRACELET, 0); pEVar2->parent = this; *(Entity**)&pEVar2->field_0x78 = this; *(Entity**)&this->field_0x74 = pEVar2; - pEVar2 = CreateEnemy(0x44, 1); + pEVar2 = CreateEnemy(MAZAAL_BRACELET, 1); pEVar2->parent = this; *(Entity**)&pEVar2->field_0x78 = pEVar1; *(Entity**)&this->field_0x78 = pEVar2; - CreateEnemy(0x36, 4)->parent = this; + CreateEnemy(MAZAAL_HEAD, 4)->parent = this; } } } @@ -670,7 +671,7 @@ NONMATCH("asm/non_matching/mazaal/sub_080348A4.inc", u32 sub_080348A4(Entity* th InitializeAnimation(hand_, 5); break; case 8: - pEVar4 = CreateEnemy(0x36, hand_->type + 2); + pEVar4 = CreateEnemy(MAZAAL_HEAD, hand_->type + 2); if (pEVar4 != NULL) { pEVar4->parent = this; } diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 3da60dee..d3dbee34 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -83,7 +83,7 @@ void sub_08034CC4(Entity* this) { sub_08034F70(this); InitializeAnimation(this, this->type); SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer); - entity = CreateEnemy(0x37, 2); + entity = CreateEnemy(MAZAAL_MACRO, 2); if (entity != NULL) { this->attachedEntity = entity; entity->parent = this; @@ -97,7 +97,7 @@ void sub_08034D4C(Entity* this) { GetNextFrame(this); if (--this->field_0x78.HWORD == 0) { - if ((this->field_0xf < 8) && (entity = CreateEnemy(0x4b, 0), entity != (Entity*)0x0)) { + if ((this->field_0xf < 8) && (entity = CreateEnemy(VAATI_PROJECTILE, 0), entity != (Entity*)0x0)) { entity->direction = (s32)Random() % 5 + 0xc; entity->x.HALF.HI = (gRoomControls.width / 2) + gRoomControls.roomOriginX; entity->y.HALF.HI = gRoomControls.roomOriginY + 8; @@ -231,7 +231,7 @@ void sub_08035050(Entity* this) { this->flags = this->flags & 0x7f; this->currentHealth = 0; - entity = CreateEnemy(0x4b, 0); + entity = CreateEnemy(VAATI_PROJECTILE, 0); if (entity != NULL) { entity->type2 = 1; entity->collisionLayer = 3; @@ -258,7 +258,7 @@ u32 sub_08035084(Entity* this) { if (i == vulnPillar) { entity = this; } else { - entity = CreateEnemy(0x37, 1); + entity = CreateEnemy(MAZAAL_MACRO, 1); } entity->x.HALF.HI = gRoomControls.roomOriginX + *coords; entity->y.HALF.HI = gRoomControls.roomOriginY + *(coords + 1); diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index f7ed8161..8076e1ca 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -55,19 +55,19 @@ void sub_08022C58(Entity* this) { if (gEntCount >= 0x45) return; - tail0 = CreateEnemy(0xd, 1); + tail0 = CreateEnemy(MOLDORM, 1); this->attachedEntity = tail0; tail0->spritePriority.b0 = 5; tail0->parent = this; CopyPosition(this, tail0); - tail1 = CreateEnemy(0xd, 2); + tail1 = CreateEnemy(MOLDORM, 2); tail0->attachedEntity = tail1; tail1->spritePriority.b0 = 5; tail1->parent = this; CopyPosition(this, tail1); - tail2 = CreateEnemy(0xd, 3); + tail2 = CreateEnemy(MOLDORM, 3); tail1->attachedEntity = tail2; tail2->spritePriority.b0 = 5; tail2->parent = this; diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index 11d5166e..403ae1b5 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -111,28 +111,28 @@ void sub_080231BC(Entity* this) { if (gEntCount < 0x40) { Entity* ent; - ent = this->attachedEntity = CreateEnemy(0xf, 1); + ent = this->attachedEntity = CreateEnemy(MOLDWORM, 1); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(0xf, 2); + ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 2); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(0xf, 3); + ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 3); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(0xf, 4); + ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 4); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(0xf, 5); + ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 5); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(0xf, 6); + ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 6); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(0xf, 7); + ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 7); ent->parent = this; - ent->attachedEntity = CreateEnemy(0xf, 8); + ent->attachedEntity = CreateEnemy(MOLDWORM, 8); *(Entity**)&ent->attachedEntity->field_0x74 = ent; ent = ent->attachedEntity; ent->parent = this; diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 5c134ed8..adcbea9d 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -51,7 +51,7 @@ void Peahat_OnTick(Entity* this) { void sub_0801FFDC(Entity* this) { if (this->field_0x82.HALF.LO) { if (this->bitfield == 0x94) { - Entity* ent = CreateEnemy(3, PeahatForm_Propeller); + Entity* ent = CreateEnemy(PEAHAT, PeahatForm_Propeller); if (ent) { CopyPosition(this, ent); ent->height.HALF.HI -= 8; 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/rockChuchu.c b/src/enemy/rockChuchu.c index 977257bd..3f27ae13 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -41,7 +41,7 @@ void sub_08022254(Entity* this) { case 0x16: case 0x1c: CreateFx(this, 4, 0); - ent = CreateEnemy(1, 1); + ent = CreateEnemy(CHUCHU, 1); if (ent) { ent->type2 = 1; ent->iframes = -8; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 10984c27..8a75457f 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -91,7 +91,7 @@ void sub_080293DC(Entity* this) { void sub_0802940C(Entity* this) { Entity* ent; - ent = CreateEnemy(0x17, this->type); + ent = CreateEnemy(RUPEE_LIKE, this->type); if (ent != NULL) { sub_0804A720(this); ent->parent = this; diff --git a/src/enemy/slime.c b/src/enemy/slime.c index fc7714e3..cd79f8f7 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -99,7 +99,7 @@ void sub_080450A8(Entity* this) { /* Create 2-4 new MiniSlime */ for (i = 0; i < count; i++) - entities[i] = CreateEnemy(0x57, this->type); + entities[i] = CreateEnemy(MINI_SLIME, this->type); off = gUnk_080D16D4; for (i = 0; i < count; i++) { diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 436baf3c..21a9b985 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -130,7 +130,7 @@ void sub_08023CE0(Entity* this) { GetNextFrame(this); if (this->frames.all) { if (this->frames.all & 0x80) { - Entity* ent = CreateEnemy(0x10, 1); + Entity* ent = CreateEnemy(SLUGGULA, 1); if (ent) { sub_0804A4E4(this, ent); DeleteThisEntity(); @@ -161,7 +161,7 @@ void sub_08023E54(Entity* this) { if (this->field_0xf++ > 27) { this->field_0xf = 0; - ent = CreateEnemy(0x10, 2); + ent = CreateEnemy(SLUGGULA, 2); if (ent) { const s8* ptr = &gUnk_080CBDF7[this->animationState * 2]; PositionRelative(this, ent, ptr[0] << 0x10, ptr[1] << 0x10); diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index a7d68131..1d09e3c1 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -1,10 +1,10 @@ #include "global.h" #include "entity.h" +#include "enemy.h" #include "coord.h" #include "random.h" #include "functions.h" -extern u32 GetNextFunction(Entity*); extern void sub_080317F8(Entity*); extern void (*gUnk_080CE530[])(Entity*); @@ -122,7 +122,7 @@ void sub_080317F8(Entity* this) { } void sub_08031840(Entity* this) { - Entity* enemy = CreateEnemy(0x2d, this->type); + Entity* enemy = CreateEnemy(SMALL_PESTO, this->type); if (enemy != NULL) { CopyPosition(this, enemy); enemy->parent = this; 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 4db7a974..c501409f 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" #include "object.h" @@ -643,7 +644,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(); } @@ -970,7 +971,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;