Use new entity structs in a few more files

This commit is contained in:
octorock
2023-12-30 18:42:30 +01:00
parent 3b87c04162
commit 5676cb7890
12 changed files with 93 additions and 76 deletions
+8 -7
View File
@@ -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();
}
+13 -12
View File
@@ -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;
}
}
+12 -11
View File
@@ -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 "object.h"
#include "room.h"
#include "asm.h"
#include "object.h"
#include "object/houseSign.h"
#include "room.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;
}
}