summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/object/houseSign.h13
-rw-r--r--include/object/itemForSale.h13
-rw-r--r--src/item/itemGustJar.c16
-rw-r--r--src/item/itemLantern.c12
-rw-r--r--src/item/itemOcarina.c6
-rw-r--r--src/item/itemRocsCape.c10
-rw-r--r--src/item/itemTryPickupObject.c14
-rw-r--r--src/manager/fallingItemManager.c15
-rw-r--r--src/manager/goronMerchantShopManager.c25
-rw-r--r--src/manager/houseSignManager.c21
-rw-r--r--src/object/houseSign.c10
-rw-r--r--src/object/itemForSale.c10
12 files changed, 91 insertions, 74 deletions
diff --git a/include/object/houseSign.h b/include/object/houseSign.h
new file mode 100644
index 00000000..c437adee
--- /dev/null
+++ b/include/object/houseSign.h
@@ -0,0 +1,13 @@
+#ifndef HOUSESIGN_H
+#define HOUSESIGN_H
+
+#include "entity.h"
+
+typedef struct {
+ /*0x00*/ Entity base;
+ /*0x68*/ u8 unused1[24];
+ /*0x80*/ s16 unk_80;
+ /*0x82*/ s16 unk_82;
+} HouseSignEntity;
+
+#endif // HOUSESIGN_H
diff --git a/include/object/itemForSale.h b/include/object/itemForSale.h
new file mode 100644
index 00000000..6f22e5e0
--- /dev/null
+++ b/include/object/itemForSale.h
@@ -0,0 +1,13 @@
+#ifndef ITEMFORSALE_H
+#define ITEMFORSALE_H
+
+#include "object.h"
+
+typedef struct {
+ /*0x00*/ Entity base;
+ /*0x68*/ u8 unk_68[0x18];
+ /*0x80*/ u16 unk_80;
+ /*0x82*/ u16 unk_82;
+} ItemForSaleEntity;
+
+#endif // ITEMFORSALE_H
diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c
index 8a040ec9..54dae3b2 100644
--- a/src/item/itemGustJar.c
+++ b/src/item/itemGustJar.c
@@ -1,7 +1,7 @@
-#define ENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "item.h"
+#include "new_player.h"
#include "playeritem.h"
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* this, u32);
@@ -20,7 +20,7 @@ void sub_08076DF4(ItemBehavior* this, u32 index) {
this->priority |= 0x80;
this->priority++;
gPlayerState.gustJarSpeed = 1;
- *(u32*)&gPlayerEntity.field_0x74 = 0;
+ gNewPlayerEntity.unk_74 = NULL;
gPlayerState.field_0x1c = 1;
sub_08077BB8(this);
} else {
@@ -87,7 +87,7 @@ void sub_08076EC8(ItemBehavior* this, u32 index) {
void sub_08076F64(ItemBehavior* this, u32 index) {
Entity* item;
- Entity* player;
+ PlayerEntity* player;
switch (gPlayerState.field_0x1c & 0xf) {
case 5:
if (this->playerFrame & 0x80) {
@@ -95,15 +95,15 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
this->subtimer = 0;
this->timer = 0;
gPlayerState.gustJarSpeed = 1;
- player = &gPlayerEntity;
- *(u32*)&player->field_0x74 = 0;
+ player = &gNewPlayerEntity;
+ player->unk_74 = NULL;
gPlayerState.field_0x1c = 1;
gPlayerState.field_0xa &= ~(8 >> index);
this->stateID = 2;
SetItemAnim(this, ANIM_GUSTJAR_SUCK);
item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0);
if (item) {
- item->parent = player;
+ item->parent = &player->base;
}
return;
} else {
@@ -137,7 +137,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if (this->playerFrame & 1) {
gPlayerState.field_0x1c = 5;
- gPlayerEntity.field_0x70.WORD = 0;
+ gNewPlayerEntity.unk_70 = NULL;
if (gPlayerState.gustJarSpeed) {
CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
}
@@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
break;
}
gPlayerState.field_0x1c = 0;
- gPlayerEntity.field_0x70.WORD = 0;
+ gNewPlayerEntity.unk_70 = NULL;
DeleteItemBehavior(this, index);
}
diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c
index e5b7c91e..f7806bd0 100644
--- a/src/item/itemLantern.c
+++ b/src/item/itemLantern.c
@@ -1,9 +1,9 @@
-#define ENT_DEPRECATED
-#include "item.h"
#include "functions.h"
-#include "sound.h"
-#include "object.h"
#include "game.h"
+#include "item.h"
+#include "new_player.h"
+#include "object.h"
+#include "sound.h"
extern s8 gUnk_08126EEC[];
extern Entity* CreatePlayerItemForItemIfNotExists(ItemBehavior*);
@@ -98,7 +98,7 @@ void sub_08075B54(ItemBehavior* this, u32 index) {
gPlayerEntity.collisionLayer, 0x40) != 0)) {
this->animPriority = 0xf;
this->stateID++;
- gPlayerEntity.field_0x7a.HWORD = 2;
+ gNewPlayerEntity.unk_7a = 2;
object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0);
if (object != NULL) {
object->spriteVramOffset = gPlayerEntity.spriteVramOffset;
@@ -129,6 +129,6 @@ void sub_08075C9C(ItemBehavior* this, u32 index) {
gPlayerState.field_0xa = (~(8 >> index)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> index)) & gPlayerState.keepFacing;
} else {
- gPlayerEntity.field_0x7a.HWORD++;
+ gNewPlayerEntity.unk_7a++;
}
}
diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c
index 196ea132..4b88138c 100644
--- a/src/item/itemOcarina.c
+++ b/src/item/itemOcarina.c
@@ -1,6 +1,6 @@
-#define ENT_DEPRECATED
#include "functions.h"
#include "item.h"
+#include "new_player.h"
#include "sound.h"
extern void ResetPlayerVelocity(void);
@@ -14,7 +14,7 @@ void ItemOcarina(ItemBehavior* this, u32 index) {
OcarinaUpdate,
};
gOcarinaStates[this->stateID](this, index);
- gPlayerEntity.field_0x7a.HWORD++;
+ gNewPlayerEntity.unk_7a++;
}
void OcarinaUse(ItemBehavior* this, u32 index) {
@@ -25,7 +25,7 @@ void OcarinaUse(ItemBehavior* this, u32 index) {
gPlayerEntity.animationState = 0x04;
gPlayerEntity.spriteSettings.flipX = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
- gPlayerEntity.field_0x7a.HWORD = 2;
+ gNewPlayerEntity.unk_7a = 2;
gPlayerState.flags |= PL_USE_OCARINA;
gPlayerState.field_0x27[0] = -1;
gPauseMenuOptions.disabled = 1;
diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c
index 6ece003d..d284ba28 100644
--- a/src/item/itemRocsCape.c
+++ b/src/item/itemRocsCape.c
@@ -1,7 +1,7 @@
-#define ENT_DEPRECATED
+#include "functions.h"
#include "item.h"
+#include "new_player.h"
#include "sound.h"
-#include "functions.h"
void sub_08076758(ItemBehavior*, u32);
extern void sub_08077F84(void);
@@ -67,18 +67,18 @@ void sub_08076758(ItemBehavior* this, u32 index) {
if (this->stateID < 2) {
if ((gPlayerEntity.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) {
this->stateID = 2;
- gPlayerEntity.field_0x7a.HWORD = 2;
+ gNewPlayerEntity.unk_7a = 2;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status |= 0x10;
gPlayerState.animation = ANIM_ROCS_CAPE;
SoundReq(SFX_172);
}
} else {
- gPlayerEntity.field_0x7a.HWORD++;
+ gNewPlayerEntity.unk_7a++;
}
} else {
if (this->stateID > 1) {
- gPlayerEntity.field_0x7a.HWORD++;
+ gNewPlayerEntity.unk_7a++;
gPlayerState.jump_status &= 0xef;
}
}
diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c
index 774ab613..b3aa25a1 100644
--- a/src/item/itemTryPickupObject.c
+++ b/src/item/itemTryPickupObject.c
@@ -1,6 +1,6 @@
-#define ENT_DEPRECATED
#include "functions.h"
#include "item.h"
+#include "new_player.h"
#include "playeritem.h"
#include "sound.h"
@@ -39,8 +39,8 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
gPlayerState.framestate = 4;
this->stateID = 2;
this->animPriority = 0xf;
- if ((gPlayerEntity.field_0x78.HALF.HI & 0x80)) {
- gPlayerEntity.field_0x78.HALF.HI = 0;
+ if ((gNewPlayerEntity.unk_79 & 0x80)) {
+ gNewPlayerEntity.unk_79 = 0;
COLLISION_ON(&gPlayerEntity);
gPlayerState.heldObject = 4;
gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing;
@@ -56,11 +56,11 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
if (param_2 == NULL) {
PlayerCancelHoldItem(this, param_3);
} else {
- Entity* playerEnt = &gPlayerEntity;
- *(Entity**)&playerEnt->field_0x74 = param_2;
- playerEnt->subtimer = 0;
+ PlayerEntity* playerEnt = &gNewPlayerEntity;
+ playerEnt->unk_74 = param_2;
+ playerEnt->base.subtimer = 0;
param_2->child = this->field_0x18;
- param_2->carryFlags = playerEnt->carryFlags;
+ param_2->carryFlags = playerEnt->base.carryFlags;
param_2->parent = (Entity*)this;
this->field_0x18 = param_2;
param_2->type2 = this->field_0x2[1];
diff --git a/src/manager/fallingItemManager.c b/src/manager/fallingItemManager.c
index 49ba18e0..740c91a3 100644
--- a/src/manager/fallingItemManager.c
+++ b/src/manager/fallingItemManager.c
@@ -6,10 +6,11 @@
*
* If you leave the room without picking the item up and enter again, the item falls from the sky again.
*/
-#define ENT_DEPRECATED
#include "manager/fallingItemManager.h"
+
#include "flags.h"
#include "object.h"
+#include "object/itemOnGround.h"
#include "room.h"
void FallingItemManager_Init(FallingItemManager*);
@@ -33,13 +34,13 @@ void FallingItemManager_Init(FallingItemManager* this) {
void FallingItemManager_Action1(FallingItemManager* this) {
if (CheckFlags(this->field_0x3e)) {
- Entity* object = CreateObject(GROUND_ITEM, super->type, super->type2);
+ ItemOnGroundEntity* object = (ItemOnGroundEntity*)CreateObject(GROUND_ITEM, super->type, super->type2);
if (object != NULL) {
- object->timer = this->field_0x35;
- object->collisionLayer = this->field_0x36;
- object->x.HALF.HI = this->field_0x38 + gRoomControls.origin_x;
- object->y.HALF.HI = this->field_0x3a + gRoomControls.origin_y;
- object->field_0x86.HWORD = this->field_0x3c;
+ object->base.timer = this->field_0x35;
+ object->base.collisionLayer = this->field_0x36;
+ object->base.x.HALF.HI = this->field_0x38 + gRoomControls.origin_x;
+ object->base.y.HALF.HI = this->field_0x3a + gRoomControls.origin_y;
+ object->unk_86 = this->field_0x3c;
}
DeleteThisEntity();
}
diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c
index b68ceb88..c2493c99 100644
--- a/src/manager/goronMerchantShopManager.c
+++ b/src/manager/goronMerchantShopManager.c
@@ -4,12 +4,13 @@
*
* @brief Spawns the shop items for the kinstones for the goron merchant.
*/
-#define ENT_DEPRECATED
#include "manager/goronMerchantShopManager.h"
+
#include "asm.h"
#include "flags.h"
-#include "object.h"
#include "item.h"
+#include "object.h"
+#include "object/itemForSale.h"
typedef struct {
u16 minType;
@@ -60,17 +61,17 @@ void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) {
count = 0;
for (count = 0; count < 3;) {
if (CheckGlobalFlag(GORON_KAKERA_L + count) == 0) {
- Entity* object =
- CreateObject(SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType);
+ ItemForSaleEntity* object = (ItemForSaleEntity*)CreateObject(
+ SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType);
if (object != NULL) {
- object->timer = 1;
- object->subtimer = count;
- object->x.HALF.HI = spawnData->x + gRoomControls.origin_x;
- object->y.HALF.HI = spawnData->y + gRoomControls.origin_y;
- object->field_0x80.HWORD = spawnData->x;
- object->field_0x82.HWORD = spawnData->y;
- object->collisionLayer = 1;
- object->parent = (Entity*)this;
+ object->base.timer = 1;
+ object->base.subtimer = count;
+ object->base.x.HALF.HI = spawnData->x + gRoomControls.origin_x;
+ object->base.y.HALF.HI = spawnData->y + gRoomControls.origin_y;
+ object->unk_80 = spawnData->x;
+ object->unk_82 = spawnData->y;
+ object->base.collisionLayer = 1;
+ object->base.parent = (Entity*)this;
this->itemActive[count] = 1;
}
}
diff --git a/src/manager/houseSignManager.c b/src/manager/houseSignManager.c
index 48784225..c33bd50a 100644
--- a/src/manager/houseSignManager.c
+++ b/src/manager/houseSignManager.c
@@ -7,12 +7,13 @@
* Spawns HOUSE_SIGN objects that check this and unsets the value in the bitfield.
* Creates the signs on the houses in hyrule town.
*/
-#define ENT_DEPRECATED
#include "manager/houseSignManager.h"
+
#include "area.h"
+#include "asm.h"
#include "object.h"
+#include "object/houseSign.h"
#include "room.h"
-#include "asm.h"
typedef struct {
u16 x;
@@ -57,15 +58,15 @@ void HouseSignManager_Main(HouseSignManager* this) {
u32 bitfieldFlag = 1 << type2;
if ((((this->bitfield & bitfieldFlag) == 0) &&
(CheckRectOnScreen(spawnData->x, spawnData->y, 0x10, 0x10) != 0))) {
- Entity* object = CreateObject(HOUSE_SIGN, spawnData->type, type2);
+ HouseSignEntity* object = (HouseSignEntity*)CreateObject(HOUSE_SIGN, spawnData->type, type2);
if (object != NULL) {
- object->frameIndex = spawnData->frameIndex;
- object->x.HALF.HI = gRoomControls.origin_x + spawnData->x;
- object->y.HALF.HI = gRoomControls.origin_y + spawnData->y;
- object->parent = (Entity*)this;
- object->field_0x80.HWORD = spawnData->x;
- object->field_0x82.HWORD = spawnData->y;
- object->collisionLayer = spawnData->collisionLayer;
+ object->base.frameIndex = spawnData->frameIndex;
+ object->base.x.HALF.HI = gRoomControls.origin_x + spawnData->x;
+ object->base.y.HALF.HI = gRoomControls.origin_y + spawnData->y;
+ object->base.parent = (Entity*)this;
+ object->unk_80 = spawnData->x;
+ object->unk_82 = spawnData->y;
+ object->base.collisionLayer = spawnData->collisionLayer;
this->bitfield |= bitfieldFlag;
}
}
diff --git a/src/object/houseSign.c b/src/object/houseSign.c
index 29a7dc5c..149d3cc6 100644
--- a/src/object/houseSign.c
+++ b/src/object/houseSign.c
@@ -4,15 +4,9 @@
*
* @brief HouseSign object
*/
-#include "asm.h"
-#include "entity.h"
+#include "object/houseSign.h"
-typedef struct {
- /*0x00*/ Entity base;
- /*0x68*/ u8 unused1[24];
- /*0x80*/ s16 unk_80;
- /*0x82*/ s16 unk_82;
-} HouseSignEntity;
+#include "asm.h"
/*
This object is created by HouseSignManager.
diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c
index dda0c547..fc67ff26 100644
--- a/src/object/itemForSale.c
+++ b/src/object/itemForSale.c
@@ -4,19 +4,13 @@
*
* @brief Item for Sale object
*/
+#include "object/itemForSale.h"
+
#include "functions.h"
#include "hitbox.h"
#include "kinstone.h"
#include "message.h"
#include "new_player.h"
-#include "object.h"
-
-typedef struct {
- /*0x00*/ Entity base;
- /*0x68*/ u8 unk_68[0x18];
- /*0x80*/ u16 unk_80;
- /*0x82*/ u16 unk_82;
-} ItemForSaleEntity;
typedef struct {
u8 before[0x20];