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
+2 -1
View File
@@ -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);
+4 -3
View File
@@ -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;
+2 -1
View File
@@ -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);
+3 -2
View File
@@ -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();
+3 -2
View File
@@ -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);
+2 -1
View File
@@ -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;
+3 -2
View File
@@ -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) {
+2 -1
View File
@@ -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;
+3 -2
View File
@@ -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();
+2 -1
View File
@@ -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);
+3 -2
View File
@@ -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;
+2 -1
View File
@@ -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)];