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