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 -8
View File
@@ -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);
}
+6 -6
View File
@@ -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++;
}
}
+3 -3
View File
@@ -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;
+6 -6
View File
@@ -1,7 +1,7 @@
#define ENT_DEPRECATED
#include "item.h"
#include "sound.h"
#include "functions.h"
#include "item.h"
#include "new_player.h"
#include "sound.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;
}
}
+7 -7
View File
@@ -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];