Use new entity struct for player

This commit is contained in:
octorock 2023-12-30 22:08:56 +01:00
parent 5676cb7890
commit a818f1b704
279 changed files with 3482 additions and 3475 deletions

View File

@ -220,9 +220,6 @@ typedef struct Entity_ {
/*0x62*/ u8 spriteOffsetX;
/*0x63*/ s8 spriteOffsetY;
/*0x64*/ void* myHeap; /**< Heap data allocated with #zMalloc. */
#ifdef ENT_DEPRECATED
GENERIC_ENTITY_FIELDS
#endif
} Entity;
typedef struct {
@ -248,8 +245,8 @@ typedef struct LinkedList {
* to allow the iteration of all Entity's.
*/
extern LinkedList gEntityLists[9];
extern Entity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES];
extern Entity gEntities[MAX_ENTITIES];
extern GenericEntity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES];
extern GenericEntity gEntities[MAX_ENTITIES];
typedef void(EntityAction)(Entity*);
typedef void (*EntityActionPtr)(Entity*);

View File

@ -1,26 +0,0 @@
#ifndef NEW_PLAYER_H
#define NEW_PLAYER_H
#include "entity.h"
// TODO Use new player entity struct everywhere once it is fully discovered.
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u32 unk_68;
/*0x6c*/ u8 unk_6c;
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unk_6e;
/*0x6f*/ u8 unk_6f;
/*0x70*/ Entity* unk_70;
/*0x74*/ Entity* unk_74;
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u16 unk_7a;
/*0x7c*/ u32 unk_7c;
/*0x80*/ u8 unk_80[8];
} PlayerEntity;
#define gNewPlayerEntity (*(PlayerEntity*)&gPlayerEntity)
#endif // NEW_PLAYER_H

View File

@ -1,9 +1,6 @@
#ifndef DEATHFX_H
#define DEATHFX_H
#ifdef ENT_DEPRECATED
#error "deathFx.h requires new entities"
#endif
#include "entity.h"
typedef struct {

View File

@ -1,9 +1,6 @@
#ifndef LINKANIMATION_H
#define LINKANIMATION_H
#ifdef ENT_DEPRECATED
#error "linkAnimtion.h requires new entities"
#endif
#include "entity.h"
typedef struct {

View File

@ -0,0 +1,25 @@
#ifndef PUSHABLEFURNITURE_H
#define PUSHABLEFURNITURE_H
#include "object.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[0x8];
/*0x70*/ u16 unk_70;
/*0x72*/ u16 unk_72;
/*0x74*/ u16 unk_74;
/*0x76*/ u16 unk_76;
/*0x78*/ u8 unk_78[0x2];
/*0x7a*/ u16 unk_7a;
/*0x7c*/ u16 unk_7c;
/*0x7e*/ u16 unk_7e;
/*0x80*/ u8 unk_80;
/*0x81*/ u8 unk_81;
/*0x82*/ u8 unk_82;
/*0x83*/ u8 unk_83;
/*0x84*/ u8 unk_84[0x2];
/*0x86*/ u16 unk_86;
} PushableFurnitureEntity;
#endif // PUSHABLEFURNITURE_H

View File

@ -4,6 +4,23 @@
#include "global.h"
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ union SplitWord unk_68;
/*0x6c*/ u8 unk_6c;
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unk_6e;
/*0x6f*/ u8 unk_6f;
/*0x70*/ Entity* unk_70;
/*0x74*/ Entity* unk_74;
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u16 unk_7a;
/*0x7c*/ union SplitWord unk_7c;
/*0x80*/ union SplitWord unk_80;
/*0x84*/ union SplitWord unk_84;
} PlayerEntity;
enum PlayerActions {
PLAYER_INIT,
PLAYER_NORMAL,
@ -585,9 +602,9 @@ extern const u8 gQuiverSizes[];
extern Entity* gPlayerClones[];
extern PlayerState gPlayerState;
extern Entity gPlayerEntity;
extern PlayerEntity gPlayerEntity;
void DoPlayerAction(Entity*);
void DoPlayerAction(PlayerEntity*);
bool32 CheckInitPauseMenu(void);
void SetPlayerControl(PlayerControlMode mode);
void ResetActiveItems(void);

View File

@ -0,0 +1,13 @@
#ifndef PLAYERITEMBOTTLE_H
#define PLAYERITEMBOTTLE_H
#include "entity.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 bottleIndex; /**< @see Item */
/*0x69*/ u8 unused[6];
/*0x6f*/ u8 bottleContent; /**< @see Item */
} PlayerItemBottleEntity;
#endif // PLAYERITEMBOTTLE_H

View File

@ -1,4 +1,3 @@
#define ENT_DEPRECATED
#include "beanstalkSubtask.h"
#include "backgroundAnimations.h"
@ -174,7 +173,7 @@ u32 UpdatePlayerCollision(void) {
s32 framestate;
u32 tmp2;
u32 tmp3;
// There are some weird assignment necessary to access gPlayerEntity.animationState correctly.
// There are some weird assignment necessary to access gPlayerEntity.base.animationState correctly.
u32 animationState1;
u32 animationState2;
u32 animationState3;
@ -194,40 +193,40 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
if (gPlayerState.dash_state != 0 || gPlayerEntity.action == PLAYER_CLIMB) {
direction = gPlayerEntity.direction;
if (gPlayerState.dash_state != 0 || gPlayerEntity.base.action == PLAYER_CLIMB) {
direction = gPlayerEntity.base.direction;
} else {
direction = gPlayerState.direction;
}
if (((direction & (DIR_NOT_MOVING_CHECK | 0x3)) == 0) && (gPlayerState.field_0xa == 0)) {
index = sub_0807BDB8(&gPlayerEntity, direction >> 2);
index = sub_0807BDB8(&gPlayerEntity.base, direction >> 2);
if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) {
ptr1 = &gUnk_080B4490[index * 2];
if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]), gPlayerEntity.collisionLayer) ==
0xff) {
if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr1[0], -ptr1[1]),
gPlayerEntity.base.collisionLayer) == 0xff) {
if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) ||
((gPlayerState.sword_state & 0x10) != 0)) ||
((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 &&
((sub_080806BC(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x,
gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 &&
(((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) ||
(sub_0807BD14(&gPlayerEntity, index) == 0)))))) {
(sub_0807BD14(&gPlayerEntity.base, index) == 0)))))) {
return 3;
}
gPlayerEntity.direction = (index << 3);
gPlayerEntity.base.direction = (index << 3);
return 0xf;
}
}
}
layer = GetLayerByIndex(gPlayerEntity.collisionLayer);
ptr1 = &gUnk_080B4468[gPlayerEntity.animationState & 6];
position = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]);
tileType = GetTileType(position, gPlayerEntity.collisionLayer);
layer = GetLayerByIndex(gPlayerEntity.base.collisionLayer);
ptr1 = &gUnk_080B4468[gPlayerEntity.base.animationState & 6];
position = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr1[0], -ptr1[1]);
tileType = GetTileType(position, gPlayerEntity.base.collisionLayer);
if (tileType < 0x4000) {
direction = sub_080B1B54(tileType);
} else {
direction = tileType;
}
animationState1 = gPlayerEntity.animationState;
animationState1 = gPlayerEntity.base.animationState;
animationState2 = animationState1 & 0xff;
switch (direction) {
@ -235,7 +234,7 @@ u32 UpdatePlayerCollision(void) {
if (sub_0801A458(layer, position, 2) == 0) {
return 0;
}
layer->mapData[position] = 0x4001 + (gPlayerEntity.animationState >> 1);
layer->mapData[position] = 0x4001 + (gPlayerEntity.base.animationState >> 1);
if ((gPlayerState.flags & PL_MINISH) != 0) {
gPlayerState.pushedObject = 0xc0;
} else {
@ -243,42 +242,42 @@ u32 UpdatePlayerCollision(void) {
}
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x28:
if ((gPlayerState.flags & PL_MINISH) != 0) {
return 0;
}
gPlayerEntity.action = gPlayerEntity.action;
gPlayerEntity.base.action = gPlayerEntity.base.action;
if (gPlayerState.field_0xa != 0) {
return 0;
}
if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction !=
if ((Direction8FromAnimationState(gPlayerEntity.base.animationState)) - gPlayerState.direction !=
DirectionNorth) {
return 0;
}
if ((gPlayerEntity.direction & DIR_NOT_MOVING_CHECK) != 0) {
if ((gPlayerEntity.base.direction & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if (sub_080B1B44(position, gPlayerEntity.collisionLayer) != 0xf) {
if (sub_080B1B44(position, gPlayerEntity.base.collisionLayer) != 0xf) {
return 0;
}
if (sub_08079778() == 0) {
return 0;
}
ptr1 = &gUnk_080B4478[gPlayerEntity.animationState & 6];
transition = sub_08080734((gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) + ptr1[0],
(gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) + ptr1[1]);
ptr1 = &gUnk_080B4478[gPlayerEntity.base.animationState & 6];
transition = sub_08080734((gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) + ptr1[0],
(gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) + ptr1[1]);
if (transition == NULL) {
return 0;
}
if ((gPlayerEntity.animationState & 2) != 0) {
gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + transition->startY + 6;
if ((gPlayerEntity.base.animationState & 2) != 0) {
gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + transition->startY + 6;
} else {
gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + transition->startX;
gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + transition->startX;
}
sub_08078AC0(4, 0, 1);
return 0;
@ -286,18 +285,18 @@ u32 UpdatePlayerCollision(void) {
if (sub_0801A2B0(layer, position, 0xb) == 0) {
return 0;
}
layer->mapData[position] = 0x401c + (gPlayerEntity.animationState >> 1);
layer->mapData[position] = 0x401c + (gPlayerEntity.base.animationState >> 1);
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.type = 1;
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
gPlayerEntity.base.type = 1;
return 1;
case 0x70:
if ((gPlayerState.field_0x35 & 0x80) == 0) {
if ((gPlayerEntity.frame & 1) != 0) {
if ((gPlayerEntity.base.frame & 1) != 0) {
if (sub_0801A9F0(gPlayerState.field_0x35 << 2, tileType, position) != 0) {
return 1;
}
@ -310,7 +309,7 @@ u32 UpdatePlayerCollision(void) {
if (gPlayerState.flags & PL_MINISH) {
return 0;
}
if (gPlayerEntity.animationState != IdleNorth) {
if (gPlayerEntity.base.animationState != IdleNorth) {
return 0;
}
gUnk_0200AF00.rActionInteractTile = R_ACTION_READ;
@ -318,7 +317,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gPlayerState.mobility = 1;
sub_080A7CFC(position, gPlayerEntity.collisionLayer);
sub_080A7CFC(position, gPlayerEntity.base.collisionLayer);
return 1;
case 0x1a:
if ((animationState1 & 0xff) != 0) {
@ -332,7 +331,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gPlayerState.mobility = 1;
OpenSmallChest(position, gPlayerEntity.collisionLayer);
OpenSmallChest(position, gPlayerEntity.base.collisionLayer);
return 2;
case 0x71:
if (HasDungeonSmallKey() == 0) {
@ -343,7 +342,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
gPlayerState.mobility = 1;
sub_0804B388(position, gPlayerEntity.collisionLayer);
sub_0804B388(position, gPlayerEntity.base.collisionLayer);
return 2;
case 0x3d:
case 0x4040 ... 0x4048:
@ -358,61 +357,61 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
#endif
if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction !=
if ((Direction8FromAnimationState(gPlayerEntity.base.animationState)) - gPlayerState.direction !=
DirectionNorth) {
return 0;
}
if ((gPlayerEntity.direction & 0x80) != 0) {
if ((gPlayerEntity.base.direction & 0x80) != 0) {
return 0;
}
if (gPlayerEntity.subtimer < 6) {
if (gPlayerEntity.base.subtimer < 6) {
return 0;
}
gPlayerState.jump_status = 0x81;
gPlayerState.flags |= PL_USE_PORTAL;
gPlayerState.queued_action = PLAYER_USEPORTAL;
gPlayerEntity.zVelocity = 0x20000;
COLLISION_OFF(&gPlayerEntity);
gPlayerEntity.base.zVelocity = 0x20000;
COLLISION_OFF(&gPlayerEntity.base);
return 1;
case 0x400b:
if (sub_0801A2B0(layer, position, 8) == 0) {
return 0;
}
if ((gPlayerEntity.collisionLayer == 3) && (gMapTop.mapData[position] == 0x400b)) {
gMapTop.mapData[position] = 0x400c + (gPlayerEntity.animationState >> 1);
if ((gPlayerEntity.base.collisionLayer == 3) && (gMapTop.mapData[position] == 0x400b)) {
gMapTop.mapData[position] = 0x400c + (gPlayerEntity.base.animationState >> 1);
} else {
layer->mapData[position] = 0x400c + (gPlayerEntity.animationState >> 1);
layer->mapData[position] = 0x400c + (gPlayerEntity.base.animationState >> 1);
}
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x405a:
if (sub_0801A2B0(layer, position, 2) == 0) {
return 0;
}
layer->mapData[position] = 0x405b + (gPlayerEntity.animationState >> 1);
layer->mapData[position] = 0x405b + (gPlayerEntity.base.animationState >> 1);
gPlayerState.pushedObject = 0x98;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x4036:
if (sub_0801A2B0(layer, position, 0xb) == 0) {
return 0;
}
layer->mapData[position] = 0x4037 + (gPlayerEntity.animationState >> 1);
layer->mapData[position] = 0x4037 + (gPlayerEntity.base.animationState >> 1);
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x403e:
if ((animationState1 & 0xff) != 0) {
@ -421,25 +420,25 @@ u32 UpdatePlayerCollision(void) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 2) == 0) {
if ((gPlayerEntity.base.frame & 2) == 0) {
return 0;
}
layer->mapData[position] = 0x403f;
gPlayerState.pushedObject = 0x82;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x72:
if ((gPlayerState.field_0x35 & 0x80) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 1) == 0) {
if ((gPlayerEntity.base.frame & 1) == 0) {
return 0;
}
position = sub_0801A570(&gPlayerEntity, 1);
position = sub_0801A570(&gPlayerEntity.base, 1);
if (position == 0xffff) {
return 0;
}
@ -449,7 +448,7 @@ u32 UpdatePlayerCollision(void) {
index = 0;
tmp3 = 0;
while (index < 3) {
if ((((*(u32*)(&(gPlayerClones[0])->field_0x6c)) & (1 << index)) != 0) &&
if ((((*(u32*)(&(((GenericEntity*)gPlayerClones[0]))->field_0x6c)) & (1 << index)) != 0) &&
(sub_0801A570(gPlayerClones[index], 0) == position)) {
tmp3++;
}
@ -462,20 +461,20 @@ u32 UpdatePlayerCollision(void) {
if (pushedBlock == NULL) {
return 0;
}
pushedBlock->direction = Direction8FromAnimationState(gPlayerEntity.animationState);
pushedBlock->direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
pushedBlock->x.HALF.HI = ((position & 0xfff & 0x3f) << 4) + 8 + gRoomControls.origin_x;
pushedBlock->y.HALF.HI = ((position & 0xfc0) >> 2) + 8 + gRoomControls.origin_y;
pushedBlock->collisionLayer = gPlayerEntity.collisionLayer;
pushedBlock->collisionLayer = gPlayerEntity.base.collisionLayer;
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = pushedBlock->direction;
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = pushedBlock->direction;
return 1;
case 0x402b ... 0x402d:
if (sub_0801A370(layer, position) != 0) {
layer->mapData[position] = 0x4030 + ((gPlayerEntity.animationState & 4) >> 2);
layer->mapData[position] = 0x4030 + ((gPlayerEntity.base.animationState & 4) >> 2);
if ((gPlayerState.flags & PL_MINISH) != 0) {
gPlayerState.pushedObject = 0xa0;
} else {
@ -483,9 +482,9 @@ u32 UpdatePlayerCollision(void) {
}
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
} else {
return 0;
@ -494,7 +493,7 @@ u32 UpdatePlayerCollision(void) {
if (sub_0801A458(layer, position, 8) == 0) {
return 0;
}
layer->mapData[position] = 0x404b + (gPlayerEntity.animationState >> 1);
layer->mapData[position] = 0x404b + (gPlayerEntity.base.animationState >> 1);
if ((gPlayerState.flags & PL_MINISH) != 0) {
gPlayerState.pushedObject = 0xc0;
} else {
@ -502,21 +501,21 @@ u32 UpdatePlayerCollision(void) {
}
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x4052:
if (gPlayerState.field_0x35 != 0) {
return 0;
}
SetTile(0x4054, position, gPlayerEntity.collisionLayer);
SetTile(0x4054, position, gPlayerEntity.base.collisionLayer);
return 4;
case 0x4053:
if (gPlayerState.field_0x35 != 6) {
return 0;
}
SetTile(0x4054, position, gPlayerEntity.collisionLayer);
SetTile(0x4054, position, gPlayerEntity.base.collisionLayer);
return 4;
case 0x4055:
position--;
@ -525,12 +524,12 @@ u32 UpdatePlayerCollision(void) {
if (gPlayerState.field_0x35 != 0) {
return 0;
}
if ((gPlayerEntity.y.HALF.HI & 0xf) < 10) {
if ((gPlayerEntity.base.y.HALF.HI & 0xf) < 10) {
return 0;
}
for (index = 0; index < 3; index++) {
if (sub_0801A8D0(gPlayerClones[index], 0) == position) {
SetTile(0x4059, position, gPlayerEntity.collisionLayer);
SetTile(0x4059, position, gPlayerEntity.base.collisionLayer);
return 4;
}
}
@ -542,12 +541,12 @@ u32 UpdatePlayerCollision(void) {
if (gPlayerState.field_0x35 != 6) {
return 0;
}
if ((gPlayerEntity.x.HALF.HI & 0xf) < 10) {
if ((gPlayerEntity.base.x.HALF.HI & 0xf) < 10) {
return 0;
}
for (index = 0; index < 3; index++) {
if (sub_0801A8D0(gPlayerClones[index], 6) == position) {
SetTile(0x4059, position, gPlayerEntity.collisionLayer);
SetTile(0x4059, position, gPlayerEntity.base.collisionLayer);
return 4;
}
}
@ -561,30 +560,30 @@ u32 UpdatePlayerCollision(void) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 1) == 0) {
if ((gPlayerEntity.base.frame & 1) == 0) {
return 0;
}
SetTile(0x4074, position, gPlayerEntity.collisionLayer);
SetTile(0x4074, position, gPlayerEntity.base.collisionLayer);
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = PLAYER_PUSH;
gPlayerState.flags |= PL_BUSY;
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.base.x.HALF.LO = 0;
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case 0x407d:
animationState3 = gPlayerEntity.animationState;
animationState3 = gPlayerEntity.base.animationState;
if ((animationState2) != 4) {
return 0;
}
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 1) == 0) {
if ((gPlayerEntity.base.frame & 1) == 0) {
return 0;
}
SetTile(0x4074, position, gPlayerEntity.collisionLayer);
sub_080001D0(0xd, position, gPlayerEntity.collisionLayer);
SetTile(0x4074, position, gPlayerEntity.base.collisionLayer);
sub_080001D0(0xd, position, gPlayerEntity.base.collisionLayer);
return 1;
default:
return 0;
@ -597,11 +596,11 @@ bool32 sub_0801A2B0(LayerStruct* layer, u32 position, u32 collisionType) {
s16 y;
u16 temp4;
uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1];
uVar1 = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
if ((((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) == 0) &&
((gPlayerEntity.frame & 1) != 0)) {
((gPlayerEntity.base.frame & 1) != 0)) {
position = (u16)(position - (-uVar1)); // necessary for match
temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.collisionLayer));
temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.base.collisionLayer));
switch (temp4) {
case 0x52:
break;
@ -633,16 +632,16 @@ bool32 sub_0801A370(LayerStruct* layer, u32 position) {
s32 offset;
s32 temp;
if ((gPlayerEntity.animationState & 2) == 0) {
if ((gPlayerEntity.base.animationState & 2) == 0) {
return FALSE;
}
if (!sub_0801A4F8()) {
return FALSE;
}
topLayer = GetLayerByIndex(2);
offset = gUnk_080B4488[gPlayerEntity.animationState >> 1];
offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
pos = position + offset;
tileType = GetTileType(pos, gPlayerEntity.collisionLayer);
tileType = GetTileType(pos, gPlayerEntity.base.collisionLayer);
switch (tileType) {
case 0x402b:
pos += offset;
@ -653,7 +652,7 @@ bool32 sub_0801A370(LayerStruct* layer, u32 position) {
if (topLayer->collisionData[pos - 0x80] == 0x46) {
return FALSE;
}
switch ((u16)sub_080B1B54(GetTileType(pos, gPlayerEntity.collisionLayer))) {
switch ((u16)sub_080B1B54(GetTileType(pos, gPlayerEntity.base.collisionLayer))) {
case 0x52:
return FALSE;
case 0x26:
@ -686,10 +685,10 @@ bool32 sub_0801A370(LayerStruct* layer, u32 position) {
bool32 sub_0801A458(LayerStruct* layer, u32 position, u32 collisionType) {
u32 tileType;
u32 pos;
s32 offset = gUnk_080B4488[gPlayerEntity.animationState >> 1];
s32 offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
if (sub_0801A4F8()) {
pos = position + offset;
tileType = GetTileType(pos, gPlayerEntity.collisionLayer);
tileType = GetTileType(pos, gPlayerEntity.base.collisionLayer);
switch (sub_080B1B54(tileType)) {
case 0x52:
case 0x26:
@ -719,18 +718,18 @@ bool32 sub_0801A4F8(void) {
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) {
return FALSE;
}
if (gPlayerState.direction != gPlayerEntity.direction) {
if (gPlayerState.direction != gPlayerEntity.base.direction) {
return FALSE;
}
tmp = (((gPlayerEntity.direction + 4) & DirectionWest) >> 3);
if ((gUnk_080B44A0[tmp] & gPlayerEntity.collisions) == 0) {
tmp = (((gPlayerEntity.base.direction + 4) & DirectionWest) >> 3);
if ((gUnk_080B44A0[tmp] & gPlayerEntity.base.collisions) == 0) {
return FALSE;
}
} else {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return FALSE;
}
if ((gPlayerEntity.frame & 1) == 0) {
if ((gPlayerEntity.base.frame & 1) == 0) {
return FALSE;
}
}
@ -931,9 +930,10 @@ u32 sub_0801A8D0(Entity* this, u32 param_2) {
bool32 sub_0801A980(void) {
u16 tileType;
const s16* ptr;
GetLayerByIndex(gPlayerEntity.collisionLayer);
ptr = &gUnk_080B44A8[gPlayerEntity.animationState & 6];
tileType = GetTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), gPlayerEntity.collisionLayer);
GetLayerByIndex(gPlayerEntity.base.collisionLayer);
ptr = &gUnk_080B44A8[gPlayerEntity.base.animationState & 6];
tileType =
GetTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), gPlayerEntity.base.collisionLayer);
if (tileType < 0x4000) {
sub_080B1B54(tileType);
}
@ -971,7 +971,7 @@ bool32 sub_0801A9F0(u32 param_1, u32 param_2, u32 param_3) {
}
if (cond) {
return sub_0801AA58(&gPlayerEntity, param_3, param_1);
return sub_0801AA58(&gPlayerEntity.base, param_3, param_1);
}
return FALSE;

View File

@ -24,8 +24,8 @@ Entity* sub_08049E18(void) {
!(gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN |
PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING))) {
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
gUnk_020000B0 = &gPlayerEntity.base;
return &gPlayerEntity.base;
}
return NULL;
}
@ -35,8 +35,8 @@ Entity* sub_08049E4C(void) {
!(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_MINISH |
PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT |
PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING))) {
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
gUnk_020000B0 = &gPlayerEntity.base;
return &gPlayerEntity.base;
}
return NULL;
}
@ -45,15 +45,15 @@ Entity* sub_08049E80(void) {
if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & PL_MINISH)) {
return NULL;
}
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
gUnk_020000B0 = &gPlayerEntity.base;
return &gPlayerEntity.base;
}
Entity* sub_08049EB0(void) {
if ((gPlayerState.field_0x3c == 0) &&
!(gPlayerState.flags & (PL_MOLDWORM_CAPTURED | PL_DISABLE_ITEMS | PL_MINISH | PL_CAPTURED))) {
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
gUnk_020000B0 = &gPlayerEntity.base;
return &gPlayerEntity.base;
}
return NULL;
}

View File

@ -1,4 +1,3 @@
#define ENT_DEPRECATED
#include "asm.h"
#include "collision.h"
#include "common.h"
@ -75,10 +74,10 @@ void CollisionMain(void) {
doCollision = &ram_CollideAll;
// Check to see if we should disable collision this frame
if (gPlayerState.controlMode != CONTROL_ENABLED) {
u32 flags = gPlayerEntity.flags;
COLLISION_OFF(&gPlayerEntity);
u32 flags = gPlayerEntity.base.flags;
COLLISION_OFF(&gPlayerEntity.base);
doCollision();
gPlayerEntity.flags = flags; // reset collision to before
gPlayerEntity.base.flags = flags; // reset collision to before
} else {
doCollision();
}
@ -89,7 +88,7 @@ void RegisterPlayerHitbox(void) {
gUnk_02018EA0 = (LinkedList2*)&gUnk_03003C70[0].last;
gUnk_03003C70[0].last = &gUnk_03003C70[0].last;
gUnk_03003C70[0].first = &gUnk_03003C70[0].last;
gUnk_03003C70[0].node = &gPlayerEntity;
gUnk_03003C70[0].node = &gPlayerEntity.base;
}
u32 sub_0801766C(Entity* this) {
@ -212,7 +211,7 @@ bool32 IsColliding(Entity* this, Entity* that) {
bool32 IsCollidingPlayer(Entity* this) {
if (PlayerCanBeMoved())
return IsColliding(this, &gPlayerEntity);
return IsColliding(this, &gPlayerEntity.base);
return FALSE;
}
@ -248,7 +247,7 @@ s32 CalculateDamage(Entity* org, Entity* tgt) {
}
health = org->health - damage;
if (org->kind == ENEMY) {
if ((org->field_0x6c.HALF.HI & 1) != 0)
if ((((GenericEntity*)org)->field_0x6c.HALF.HI & 1) != 0)
SoundReqClipped(org, SFX_BOSS_HIT);
else
SoundReqClipped(org, SFX_HIT);
@ -277,8 +276,8 @@ void sub_08017940(Entity* org, Entity* tgt) {
r1 = 0;
r1 = (u32)(org == &gPlayerEntity ? gPlayerEntity.knockbackDuration
: (tgt == &gPlayerEntity ? tgt->knockbackDuration : 0)) >>
r1 = (u32)(org == &gPlayerEntity.base ? gPlayerEntity.base.knockbackDuration
: (tgt == &gPlayerEntity.base ? tgt->knockbackDuration : 0)) >>
3;
// Anything requiring the evaluation of r1 could be written here.
@ -464,7 +463,7 @@ CollisionResult sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSetting
CollisionResult sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
gPlayerState.mobility = 1;
org->field_0x7a.HWORD = 600;
((GenericEntity*)org)->field_0x7a.HWORD = 600;
org->knockbackDuration = 12;
org->iframes = 16;
org->knockbackSpeed = 640;
@ -484,7 +483,7 @@ CollisionResult sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSetting
y = 0xac2;
} else {
tgt->contactFlags = 0xcb;
tgt->field_0x78.HALF.HI = org->hurtType;
((GenericEntity*)tgt)->field_0x78.HALF.HI = org->hurtType;
x = org->hurtType;
y = 0xae4;
}
@ -498,17 +497,17 @@ CollisionResult sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSetting
tgt->damage &= ~0x80;
else
tgt->damage = 4;
gPlayerEntity.health = CalculateDamage(&gPlayerEntity, tgt);
gPlayerEntity.base.health = CalculateDamage(&gPlayerEntity.base, tgt);
tgt->iframes = -12;
if ((gPlayerState.flags & PL_MINISH) == 0) {
sub_08079D84();
org->iframes = 90;
} else {
gPlayerEntity.contactFlags = tgt->hurtType | 0x80;
gPlayerEntity.iframes = 12;
gPlayerEntity.knockbackDuration = 16;
gPlayerEntity.knockbackDirection = DirectionTurnAround(direction);
gPlayerEntity.knockbackSpeed = 640;
gPlayerEntity.base.contactFlags = tgt->hurtType | 0x80;
gPlayerEntity.base.iframes = 12;
gPlayerEntity.base.knockbackDuration = 16;
gPlayerEntity.base.knockbackDirection = DirectionTurnAround(direction);
gPlayerEntity.base.knockbackSpeed = 640;
}
if (tgt->iframes == 0)
tgt->iframes = -1;
@ -526,19 +525,19 @@ CollisionResult sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSetting
CollisionResult sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->damage == 0)
return RESULT_NO_COLLISION;
if (org == &gPlayerEntity) {
if (org == &gPlayerEntity.base) {
u32 prevDamage = tgt->damage;
tgt->damage = 8;
gPlayerEntity.health = CalculateDamage(&gPlayerEntity, tgt);
gPlayerEntity.base.health = CalculateDamage(&gPlayerEntity.base, tgt);
tgt->damage = prevDamage;
gPlayerEntity.knockbackDuration = 12;
gPlayerEntity.iframes = 16;
gPlayerEntity.knockbackSpeed = 384;
gPlayerEntity.base.knockbackDuration = 12;
gPlayerEntity.base.iframes = 16;
gPlayerEntity.base.knockbackSpeed = 384;
} else if (org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) {
org->knockbackDuration = 8;
org->iframes = -6;
org->knockbackSpeed = 384;
gPlayerEntity.iframes = 0x80;
gPlayerEntity.base.iframes = 0x80;
}
if (tgt->iframes == 0)
tgt->iframes = -1;
@ -551,7 +550,7 @@ CollisionResult sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSetting
CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
if (org == &gPlayerEntity.base) {
if (PlayerCanBeMoved() &&
#ifdef EU
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
@ -580,7 +579,7 @@ CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSetting
} else {
org->health = 0;
}
} else if (tgt->kind == ENEMY && org == &gPlayerEntity) {
} else if (tgt->kind == ENEMY && org == &gPlayerEntity.base) {
sub_08004484(tgt, org);
}
return RESULT_NO_COLLISION;
@ -647,7 +646,7 @@ CollisionResult sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSetting
CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
if (org == &gPlayerEntity.base) {
if (PlayerCanBeMoved() &&
#ifdef EU
(gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 &&
@ -659,10 +658,10 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting
gPlayerState.field_0xa |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.jump_status = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerEntity.spriteRendering.b3 = tgt->spriteRendering.b3;
gPlayerEntity.spriteOrientation.flipY = tgt->spriteOrientation.flipY;
gPlayerEntity.iframes = 0xff;
COLLISION_OFF(&gPlayerEntity.base);
gPlayerEntity.base.spriteRendering.b3 = tgt->spriteRendering.b3;
gPlayerEntity.base.spriteOrientation.flipY = tgt->spriteOrientation.flipY;
gPlayerEntity.base.iframes = 0xff;
tgt->iframes = -8;
PutAwayItems();
return RESULT_COLLISION;
@ -670,14 +669,14 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting
} else {
org->health = 0;
}
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity)) {
sub_08004484(tgt, &gPlayerEntity);
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity.base)) {
sub_08004484(tgt, &gPlayerEntity.base);
}
return RESULT_NO_COLLISION;
}
CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity && PlayerCanBeMoved())
if (org == &gPlayerEntity.base && PlayerCanBeMoved())
sub_08004484(tgt, org);
return RESULT_NO_COLLISION;
}
@ -694,7 +693,7 @@ CollisionResult sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSetting
}
CollisionResult CollisionMazaalShrinkRay(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity)
if (org == &gPlayerEntity.base)
PlayerShrinkByRay();
else
org->health = 0;
@ -716,12 +715,12 @@ CollisionResult sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSetting
CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 confused = 0;
if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity) {
if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity.base) {
sub_08004484(tgt, org);
confused = 1;
}
if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) &&
gPlayerEntity.animationState ==
gPlayerEntity.base.animationState ==
AnimationStateFlip180(Direction8ToAnimationState(DirectionRoundUp(direction)))) {
return RESULT_NO_COLLISION;
}
@ -780,11 +779,11 @@ CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSet
SoundReqClipped(tgt, SFX_HIT);
}
} else if (org->id == PL_ITEM_SHIELD) {
gPlayerEntity.iframes = 0x80;
gPlayerEntity.base.iframes = 0x80;
}
}
if (tgt->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) {
gPlayerEntity.iframes = 0x80;
gPlayerEntity.base.iframes = 0x80;
}
return RESULT_COLLISION;
}

View File

@ -60,8 +60,8 @@ void sub_080300C4(void) {
void sub_080300E8(void) {
if (gRoomTransition.armos_data.field_0xae != 0xff) {
const u16* ptr = &gRoomTransition.armos_data.data[gRoomTransition.armos_data.field_0xae * 2];
gPlayerEntity.x.HALF.HI = ptr[0];
gPlayerEntity.y.HALF.HI = ptr[1] + 0xc;
gPlayerEntity.base.x.HALF.HI = ptr[0];
gPlayerEntity.base.y.HALF.HI = ptr[1] + 0xc;
gRoomTransition.armos_data.field_0xae = 0xff;
}
}
@ -92,7 +92,7 @@ void sub_080301BC(ArmosEntity* this) {
}
void sub_080301D4(ArmosEntity* this) {
if ((super->action == 1) && (super->contactedEntity == &gPlayerEntity)) {
if ((super->action == 1) && (super->contactedEntity == &gPlayerEntity.base)) {
super->iframes = -0x1e;
}
if ((super->health != 0) && (super->health != this->unk_81)) {
@ -429,7 +429,7 @@ bool32 sub_0803086C(ArmosEntity* this) {
if (GetTileType(pos, super->collisionLayer) == 0x4049) {
if (CheckPlayerInRegion(centerX, centerY, 2, 0xc) != 0) {
if (CheckPlayerInRegion(centerX, centerY - 4, 2, 4) != 0) {
gPlayerEntity.spritePriority.b0 = 3;
gPlayerEntity.base.spritePriority.b0 = 3;
DoExitTransition(this->unk_7c);
gRoomTransition.armos_data.field_0xae = this->unk_80;
return TRUE;

View File

@ -44,7 +44,7 @@ void Beetle_OnCollision(BeetleEntity* this) {
super->subtimer = 0;
COLLISION_OFF(super);
super->spritePriority.b0 = 3;
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
CopyPositionAndSpriteOffset(&gPlayerEntity.base, super);
super->z.HALF.HI = -1;
this->unk_87 = 1;
InitializeAnimation(super, 6);
@ -159,7 +159,7 @@ void sub_08021984(BeetleEntity* this) {
void sub_08021A10(BeetleEntity* this) {
GetNextFrame(super);
if (EntityInRectRadius(super, &gPlayerEntity, 120, 80) && sub_08021D00(this) == 0) {
if (EntityInRectRadius(super, &gPlayerEntity.base, 120, 80) && sub_08021D00(this) == 0) {
if (--super->timer == 0) {
super->action = 3;
super->timer = (Random() & 0x3f) + 30;
@ -250,17 +250,17 @@ void sub_08021B64(BeetleEntity* this) {
super->action = 6;
super->zVelocity = Q_16_16(1.0);
this->unk_87 = 0;
if (gPlayerEntity.direction != 0xff) {
super->direction = DirectionSouth ^ gPlayerEntity.direction;
if (gPlayerEntity.base.direction != 0xff) {
super->direction = DirectionSouth ^ gPlayerEntity.base.direction;
} else {
super->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth;
super->direction = (gPlayerEntity.base.animationState << 2) ^ DirectionSouth;
}
InitializeAnimation(super, 5);
} else {
gPlayerState.mobility |= 0x80;
gPlayerState.speed_modifier -= 0x50;
gPlayerState.attachedBeetleCount++;
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
CopyPositionAndSpriteOffset(&gPlayerEntity.base, super);
super->x.HALF.HI += gUnk_080CB5E4[(super->subtimer++ & 0xe) >> 1];
super->z.HALF.HI--;
GetNextFrame(super);

View File

@ -44,7 +44,7 @@ void Bobomb_OnCollision(BobombEntity* this) {
case 1:
if (this->unk_82) {
super->knockbackDuration = 0;
gPlayerEntity.knockbackDuration = 4;
gPlayerEntity.base.knockbackDuration = 4;
}
return;
case 0xe:
@ -114,7 +114,7 @@ void sub_0802C83C(BobombEntity* this) {
if (this->unk_82) {
if (--super->timer == 0) {
super->action = 3;
switch (gPlayerEntity.animationState & 6) {
switch (gPlayerEntity.base.animationState & 6) {
case 2:
super->x.HALF.HI -= 6;
break;
@ -218,7 +218,7 @@ void sub_0802CA10(BobombEntity* this) {
}
} else {
this->unk_83 = 2;
super->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest);
super->direction = (((gPlayerEntity.base.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest);
sub_0802CC18(this);
GetNextFrame(super);
}
@ -242,7 +242,7 @@ void sub_0802CA94(BobombEntity* this) {
super->speed = 0;
this->unk_83 = 0;
this->unk_81 = 0;
super->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL);
super->direction = ((gPlayerEntity.base.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL);
InitializeAnimation(super, (super->direction >> 4) | IdleWest);
}

View File

@ -213,7 +213,7 @@ void sub_0802AAC0(BombPeahatEntity* this) {
#ifdef EU
} else if (entity->timer == 0) {
if (sub_080B1B44(COORD_TO_TILE(super), 1) == 0) {
if (EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) && entity->subtimer <= 0x50) {
if (EntityInRectRadius(super, &gPlayerEntity.base, 0x10, 0x10) && entity->subtimer <= 0x50) {
this->unk_81 = 0;
}
} else if (entity->subtimer <= 0x13) {

View File

@ -311,7 +311,7 @@ void BusinessScrub_Action5(BusinessScrubEntity* this) {
}
void BusinessScrub_Action6(BusinessScrubEntity* this) {
if (gPlayerEntity.action == PLAYER_ITEMGET) {
if (gPlayerEntity.base.action == PLAYER_ITEMGET) {
if (this->unk_81 == 0) {
SetPlayerControl(1);
this->unk_81 = 1;

View File

@ -464,7 +464,7 @@ void sub_08026090(ChuchuBossEntity* this) {
} else {
PausePlayer();
if (super->timer-- == 0) {
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
DeleteThisEntity();
}
}
@ -540,7 +540,7 @@ void sub_08026110(ChuchuBossEntity* this) {
void sub_0802626C(ChuchuBossEntity* this) {
gPauseMenuOptions.disabled = 1;
gUnk_080CC20C[this->unk_84->unk_03](this);
if (gPlayerEntity.action != PLAYER_ROOMTRANSITION && gPlayerEntity.action != PLAYER_ROOM_EXIT) {
if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION && gPlayerEntity.base.action != PLAYER_ROOM_EXIT) {
PausePlayer();
}
}
@ -558,7 +558,7 @@ void sub_080262A8(ChuchuBossEntity* this) {
this->unk_7c = 0;
this->unk_7d = 0x1e;
this->unk_84->unk_03 = 3;
gPlayerEntity.animationState = 0;
gPlayerEntity.base.animationState = 0;
gRoomControls.camera_target = super;
gRoomControls.scrollSpeed = 1;
SetTile(0x4022, 0x2c8, 1);
@ -566,7 +566,7 @@ void sub_080262A8(ChuchuBossEntity* this) {
}
void sub_08026328(ChuchuBossEntity* this) {
if (gPlayerEntity.action != PLAYER_ROOMTRANSITION) {
if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION) {
this->unk_7d = 0x78;
this->unk_84->unk_03++;
sub_08078AC0(10, 0, 0);
@ -576,20 +576,20 @@ void sub_08026328(ChuchuBossEntity* this) {
void sub_08026358(ChuchuBossEntity* this) {
u32 bVar1;
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) {
bVar1 = --this->unk_7d;
if (bVar1 == 0) {
this->unk_7c = 0;
this->unk_7d = 0x1e;
this->unk_84->unk_03++;
gPlayerEntity.animationState = 0;
gPlayerEntity.base.animationState = 0;
gRoomControls.camera_target = super;
gRoomControls.scrollSpeed = 1;
} else if (bVar1 < 0x61) {
if (bVar1 < 0x5c) {
gPlayerEntity.animationState = 4;
gPlayerEntity.base.animationState = 4;
} else {
gPlayerEntity.animationState = 2;
gPlayerEntity.base.animationState = 2;
}
}
}
@ -655,7 +655,7 @@ void sub_080264D4(ChuchuBossEntity* this) {
void sub_0802650C(ChuchuBossEntity* this) {
if (((ChuchuBossEntity*)super->child)->unk_81 == 0) {
this->unk_84->unk_03++;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
}
sub_08027870(this);
}
@ -681,7 +681,7 @@ void sub_08026580(ChuchuBossEntity* this) {
super->speed = 0;
super->subAction = 2;
this->unk_7c = 0x3c;
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
if (this->unk_84->unk_04 == 2) {
this->unk_80 = 0x48;
this->unk_81 += 16;
@ -731,7 +731,7 @@ void sub_08026634(ChuchuBossEntity* this) {
super->speed = 0x180;
} else {
if ((gRoomTransition.frameCount & 0x7f) == 0) {
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
}
if (this->unk_84->unk_04 == 2) {
super->speed = 0x100;
@ -793,7 +793,7 @@ void sub_08026808(ChuchuBossEntity* this) {
if (pEVar4->unk_78.HALF_U.HI > 0xb0) {
pEVar4->unk_78.HALF_U.HI -= 8;
} else {
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
super->subAction = 4;
pEVar4->unk_78.HALF_U.HI = 0xa0;
pEVar5->unk_78.HALF_U.HI = 0xa0;
@ -1201,9 +1201,9 @@ void sub_08027064(ChuchuBossEntity* this) {
SoundReq(SFX_PLY_JUMP);
}
if (this->unk_84->unk_03 != 0) {
if (super->y.HALF.HI != gPlayerEntity.y.HALF.HI) {
if (super->y.HALF.HI != gPlayerEntity.base.y.HALF.HI) {
if ((gRoomTransition.frameCount & 0xf) == 0) {
if (super->y.HALF.HI > gPlayerEntity.y.HALF.HI) {
if (super->y.HALF.HI > gPlayerEntity.base.y.HALF.HI) {
this->unk_84->unk_0c = 0;
} else {
this->unk_84->unk_0c = 0x10;
@ -1243,7 +1243,7 @@ void sub_08027064(ChuchuBossEntity* this) {
*(char*)((int)pEVar10 + 0x84) = 1;
uVar2 = 0;
if (this->unk_84->unk_03 > 1) {
if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) {
if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) {
uVar2 = 24;
} else {
uVar2 = 8;
@ -1785,8 +1785,8 @@ void sub_08027BBC(ChuchuBossEntity* this) {
*(u8*)((int)pEVar6 + 0x85) = 1;
}
super->animationState = super->direction >> 2;
if (super->y.HALF.HI != gPlayerEntity.y.HALF.HI) {
if (super->y.HALF.HI > gPlayerEntity.y.HALF.HI) {
if (super->y.HALF.HI != gPlayerEntity.base.y.HALF.HI) {
if (super->y.HALF.HI > gPlayerEntity.base.y.HALF.HI) {
this->unk_84->unk_0c = 0;
} else {
this->unk_84->unk_0c = 0x10;

View File

@ -173,7 +173,7 @@ void sub_08038F20(CuccoAggrEntity* this) {
}
void sub_08038F44(CuccoAggrEntity* this) {
super->direction = GetFacingDirection(&gPlayerEntity, super);
super->direction = GetFacingDirection(&gPlayerEntity.base, super);
sub_080390F8(this);
ProcessMovement0(super);
sub_080044EC(super, 0x1800);
@ -193,7 +193,7 @@ void sub_08038FA0(CuccoAggrEntity* this) {
if (this->unk_78) {
if ((this->unk_78-- & 0x7) == 0) {
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity));
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity.base));
}
sub_080390F8(this);
@ -278,7 +278,7 @@ void sub_08039120(CuccoAggrEntity* this) {
void sub_08039140(CuccoAggrEntity* this) {
super->action = 6;
super->timer = Random();
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
super->z.HALF.HI = -4;
this->unk_78 = 0xb4;
sub_080390F8(this);

View File

@ -137,12 +137,12 @@ u32 sub_08022B20(Entity* this) {
if (!sub_08049DF4(2))
return 0;
return EntityInRectRadius(this, &gPlayerEntity, 36, 36);
return EntityInRectRadius(this, &gPlayerEntity.base, 36, 36);
}
void sub_08022B44(Entity* this) {
this->zVelocity = Q_16_16(0.75);
this->direction = GetFacingDirection(this, &gPlayerEntity);
this->direction = GetFacingDirection(this, &gPlayerEntity.base);
if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast))
this->spriteSettings.flipX = (this->direction >> 4) ^ 1;

View File

@ -202,7 +202,7 @@ void sub_08044310(DustEntity* this) {
uVar7 = 0xff;
tmp = 0xff;
switch (gPlayerEntity.animationState / 2 & 3) {
switch (gPlayerEntity.base.animationState / 2 & 3) {
case 0:
for (i = 0; i < this->unk_74; i++) {
if ((((Hitbox3D*)&super->hitbox[i])[1].unknown[2] == 0) &&
@ -276,15 +276,15 @@ void sub_08044498(DustEntity* this) {
u32 tmp;
u32 xdiff, ydiff;
uVar4 = COORD_TO_TILE(&gPlayerEntity);
uVar4 = COORD_TO_TILE(&gPlayerEntity.base);
tmp = (gPlayerState.playerInput.newInput & 0xf00);
if (tmp != this->unk_75 || uVar4 != this->unk_76) {
this->unk_75 = tmp;
this->unk_76 = uVar4;
pbVar2 = HEAP->items;
uVar4 = HEAP->unk_0;
xdiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI;
ydiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI;
xdiff = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI;
ydiff = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI;
for (i = 0; i < uVar4; i++) {
if (xdiff - pbVar2[i].unk_0 < 0x10 && ydiff - pbVar2[i].unk_1 < 0x10) {
@ -292,7 +292,7 @@ void sub_08044498(DustEntity* this) {
if (pEVar1 == NULL) {
return;
}
CopyPosition(&gPlayerEntity, pEVar1);
CopyPosition(&gPlayerEntity.base, pEVar1);
return;
}
}
@ -307,9 +307,10 @@ void sub_08044550(DustEntity* this) {
if (super->speed < 0x100) {
super->speed += 0x10;
}
ptr = &gUnk_08126EE4[gPlayerEntity.animationState & 0xe];
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.x.HALF.HI + ptr[0],
gPlayerEntity.y.HALF.HI + ptr[1]);
ptr = &gUnk_08126EE4[gPlayerEntity.base.animationState & 0xe];
super->direction =
CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.base.x.HALF.HI + ptr[0],
gPlayerEntity.base.y.HALF.HI + ptr[1]);
LinearMoveUpdate(super);
} else {
sub_080445C0(this);

View File

@ -160,7 +160,7 @@ void Enemy50_OnGrabbed(Enemy50Entity* this) {
void Enemy50_SubAction0(Enemy50Entity* this) {
super->subAction = 1;
super->gustJarTolerance = 0x3c;
InitializeAnimation(super, (gPlayerEntity.animationState >> 2) + 5);
InitializeAnimation(super, (gPlayerEntity.base.animationState >> 2) + 5);
}
void Enemy50_SubAction1(Enemy50Entity* this) {
@ -302,7 +302,7 @@ void Enemy50_Action9(Enemy50Entity* this) {
if (sub_0807953C()) {
this->unk_78 += 8;
}
if (gPlayerEntity.health == 0) {
if (gPlayerEntity.base.health == 0) {
this->unk_78 = 0xe0;
}
this->unk_78++;
@ -312,7 +312,7 @@ void Enemy50_Action9(Enemy50Entity* this) {
super->iframes = -0xc;
super->knockbackDuration = 0x14;
super->knockbackSpeed = 0x180;
super->knockbackDirection = gPlayerEntity.animationState << 2 ^ 0x10;
super->knockbackDirection = gPlayerEntity.base.animationState << 2 ^ 0x10;
sub_08041128(this);
sub_0803F6EC(this);
} else {

View File

@ -348,7 +348,7 @@ void Enemy64_Action4(Enemy64Entity* this) {
void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
SoundReq(SFX_BOSS_DIE);
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
if (PlayerCanBeMoved() && gPlayerEntity.base.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 30;
@ -359,7 +359,7 @@ void Enemy64_Action4_SubAction0(Enemy64Entity* this) {
}
void Enemy64_Action4_SubAction1(Enemy64Entity* this) {
if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) {
if (PlayerCanBeMoved() && gPlayerEntity.base.z.HALF.HI == 0) {
SetPlayerControl(CONTROL_2);
super->subAction = 2;
super->timer = 1;
@ -416,7 +416,7 @@ void Enemy64_Action4_SubAction5(Enemy64Entity* this) {
entity = entity->child;
entity->flags &= ~0x80;
entity->spriteSettings.draw = 0;
entity = &gPlayerEntity;
entity = &gPlayerEntity.base;
entity->x.HALF.HI = gRoomControls.origin_x + 0xa8;
entity->y.HALF.HI = gRoomControls.origin_y + 0x80;
entity->animationState = 0;
@ -459,9 +459,9 @@ void Enemy64_Action4_SubAction7(Enemy64Entity* this) {
void sub_08049944(Enemy64Entity* this) {
this->unk_7c = (this->unk_7c << 1 & 0x7f) | (this->unk_7c & 0x80);
if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) {
if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x20)) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
if (gPlayerEntity.base.z.HALF.HI == 0) {
gPlayerState.flags |= PL_FLAGS2;
this->unk_7c |= 1;
}
@ -478,22 +478,22 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) {
tmpY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI;
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
gPlayerEntity.base.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.base.x.HALF.HI;
gPlayerEntity.base.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.base.y.HALF.HI;
}
}
void sub_080499F0(Enemy64Entity* this) {
u32 tmp;
if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) &&
if ((((super->action != 0) && (gPlayerEntity.base.z.HALF.HI == 0)) && (PlayerCanBeMoved())) &&
((this->unk_7c & 1) == 0)) {
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
((this->unk_7c & 2) == 0)) {
tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
(s32)gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.x.WORD = super->x.WORD + gSineTable[tmp] * 0x2400;
gPlayerEntity.y.WORD = super->y.WORD + gSineTable[tmp + 0x40] * -0x2400;
tmp = sub_080045DA((s32)gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
(s32)gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.base.x.WORD = super->x.WORD + gSineTable[tmp] * 0x2400;
gPlayerEntity.base.y.WORD = super->y.WORD + gSineTable[tmp + 0x40] * -0x2400;
}
this->unk_7c = 0;
}
@ -532,7 +532,7 @@ void sub_08049B20(Enemy64Entity* this) {
tmpY = super->y.HALF.HI;
LinearMoveAngle(super, super->speed, super->direction);
if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI;
gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI;
gPlayerEntity.base.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.base.x.HALF.HI;
gPlayerEntity.base.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.base.y.HALF.HI;
}
}

View File

@ -80,7 +80,7 @@ void sub_0802C334(FallingBoulderEntity* this) {
u16 tmp;
if (this->unk_7c == 0) {
u32 tmp = gRoomControls.origin_y;
entity = &gPlayerEntity;
entity = &gPlayerEntity.base;
if (entity == NULL)
return;
if (entity->y.HALF.HI - tmp <= 0x38) {

View File

@ -220,7 +220,7 @@ void FlyingPot_Action3(FlyingPotEntity* this) {
if (super->z.HALF.HI <= -6) {
super->action = FLYING_POT_ACTION_4;
super->timer = 10;
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
}
}

View File

@ -137,7 +137,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
RegisterCarryEntity(super);
} else {
if ((gPlayerState.flags & PL_MINISH) == 0) {
Entity* player = &gPlayerEntity;
Entity* player = &gPlayerEntity.base;
if (EntityWithinDistance(super, player->x.HALF.HI, player->y.HALF.HI, 0x30)) {
if (super->type == 1) {
super->action = 3;
@ -165,15 +165,15 @@ void sub_08039EE4(FlyingSkullEntity* this) {
COLLISION_OFF(super);
super->collisions = COL_NONE;
super->hitbox = (Hitbox*)&gUnk_080FD340;
gPlayerEntity.animationState;
this->unk_0x76 = gPlayerEntity.animationState;
gPlayerEntity.base.animationState;
this->unk_0x76 = gPlayerEntity.base.animationState;
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
}
void sub_08039F4C(FlyingSkullEntity* this) {
if (gPlayerEntity.animationState != this->unk_0x76) {
super->frameIndex = AnimationStateIdle(gPlayerEntity.animationState - this->unk_0x76 + super->frameIndex);
this->unk_0x76 = gPlayerEntity.animationState;
if (gPlayerEntity.base.animationState != this->unk_0x76) {
super->frameIndex = AnimationStateIdle(gPlayerEntity.base.animationState - this->unk_0x76 + super->frameIndex);
this->unk_0x76 = gPlayerEntity.base.animationState;
}
}
@ -210,7 +210,7 @@ void sub_0803A048(FlyingSkullEntity* this) {
if (super->z.HALF.HI <= -6) {
super->action = 5;
super->timer = 10;
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
}
}

View File

@ -121,7 +121,7 @@ void Ghini_OnGrabbed(GhiniEntity* this) {
void Ghini_SubAction0(GhiniEntity* this) {
super->subAction = 1;
super->gustJarTolerance = 0x3c;
InitializeAnimation(super, (gPlayerEntity.animationState >> 2) + 5);
InitializeAnimation(super, (gPlayerEntity.base.animationState >> 2) + 5);
}
void Ghini_SubAction1(GhiniEntity* this) {
@ -259,7 +259,7 @@ void Ghini_Action9(GhiniEntity* this) {
if (sub_0807953C() != 0) {
this->unk_78 += 0xc;
}
if (gPlayerEntity.health == 0) {
if (gPlayerEntity.base.health == 0) {
this->unk_78 = 0xe0;
}
if (++this->unk_78 >= 0xe0) {
@ -268,7 +268,7 @@ void Ghini_Action9(GhiniEntity* this) {
super->iframes = -0xc;
super->knockbackDuration = 0x14;
super->knockbackSpeed = 0x180;
super->knockbackDirection = gPlayerEntity.animationState << 2 ^ 0x10;
super->knockbackDirection = gPlayerEntity.base.animationState << 2 ^ 0x10;
sub_0803F51C(this);
sub_0803F6EC(this);
} else {
@ -363,18 +363,18 @@ void sub_0803F694(GhiniEntity* this) {
void sub_0803F6C0(GhiniEntity* this) {
super->frame &= ~1;
gPlayerEntity.iframes = 0xc;
gPlayerEntity.base.iframes = 0xc;
ModHealth(-4);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6);
}
void sub_0803F6EC(GhiniEntity* this) {
if (gPlayerEntity.health != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.iframes = -0x3c;
if (gPlayerEntity.base.health != 0) {
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerEntity.base.zVelocity = Q_16_16(1.5);
gPlayerEntity.base.z.HALF.HI = -2;
gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2;
gPlayerEntity.base.iframes = -0x3c;
gPlayerState.jump_status = 0x41;
}
gPlayerState.flags &= ~PL_CAPTURED;
@ -384,7 +384,7 @@ void sub_0803F738(GhiniEntity* this) {
ResetActiveItems();
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
sub_0806FA90(&gPlayerEntity, super, 0, 1);
sub_0806FA90(&gPlayerEntity.base, super, 0, 1);
super->spriteOffsetY -= 2;
}

View File

@ -166,7 +166,7 @@ void sub_080376D0(GibdoEntity* this) {
ResetActiveItems();
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
CopyPositionAndSpriteOffset(&gPlayerEntity.base, super);
UpdateAnimationSingleFrame(super);
if ((super->frame & 1) != 0) {
if (--this->field_0x7c == 0) {
@ -352,19 +352,19 @@ void sub_08037A58(GibdoEntity* this) {
void sub_08037ACC(GibdoEntity* this) {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = 30;
gPlayerEntity.knockbackDirection = DirectionFromAnimationState(super->animationState);
gPlayerEntity.knockbackDuration = 4;
gPlayerEntity.knockbackSpeed = 0x180;
COLLISION_ON(&gPlayerEntity.base);
gPlayerEntity.base.iframes = 30;
gPlayerEntity.base.knockbackDirection = DirectionFromAnimationState(super->animationState);
gPlayerEntity.base.knockbackDuration = 4;
gPlayerEntity.base.knockbackSpeed = 0x180;
}
// Damage player maybe?
void sub_08037B10(GibdoEntity* this) {
u32 health;
gPlayerEntity.iframes = 0xc;
gPlayerEntity.base.iframes = 0xc;
health = ModHealth(-8);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6);
if (health == 0) {
sub_08037A58(this);
this->field_0x76 = 240;

View File

@ -170,7 +170,7 @@ void Gleerok_OnDeath(GleerokEntity* this) {
this->unk_74--;
gScreen.controls.alphaBlend = this->unk_74 | (this->unk_75 << 8);
if (gScreen.controls.alphaBlend == 0x1000) {
sub_0807AABC(&gPlayerEntity);
sub_0807AABC(&gPlayerEntity.base);
DeleteThisEntity();
}
}
@ -189,7 +189,7 @@ void Gleerok_OnDeath(GleerokEntity* this) {
case 0:
gPlayerState.field_0x14 = 1;
if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) {
if (sub_0806FC80(super, &gPlayerEntity.base, super->frame & 0x3f)) {
gPlayerState.spriteOffsetY = -6;
}
@ -215,10 +215,10 @@ void sub_0802D170(GleerokEntity* this) {
this->unk_84->filler2[0].unk0.HALF.HI = 0x10;
if (sub_0802EB08(this->unk_84, 0x40, 2) == 0 && sub_0802EA88(this->unk_84) == 0) {
super->action = 2;
gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x98;
gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0xd8;
gPlayerEntity.animationState = 0;
RestorePrevTileEntity(COORD_TO_TILE(&gPlayerEntity), 2);
gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x98;
gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0xd8;
gPlayerEntity.base.animationState = 0;
RestorePrevTileEntity(COORD_TO_TILE(&gPlayerEntity.base), 2);
gRoomControls.camera_target = super;
SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8);
}
@ -318,7 +318,7 @@ void sub_0802D3B8(GleerokEntity* this) {
if (CheckGlobalFlag(LV2_CLEAR)) {
gScreen.lcd.displayControl &= 0xfdff;
sub_0807AABC(&gPlayerEntity);
sub_0807AABC(&gPlayerEntity.base);
DeleteThisEntity();
}
@ -436,7 +436,7 @@ void sub_0802D674(GleerokEntity* this) {
u32 val;
gPauseMenuOptions.disabled = 1;
if (gPlayerEntity.z.WORD != 0)
if (gPlayerEntity.base.z.WORD != 0)
return;
if (this->unk_7c.WORD == 0x96) {
SoundReq(SFX_BOSS_HIT);
@ -450,13 +450,13 @@ void sub_0802D674(GleerokEntity* this) {
SoundReq(SFX_BOSS_HIT);
} else if (val <= 0x3c) {
if (val == 0x3c) {
CreateSpeechBubbleExclamationMark(&gPlayerEntity, 0xc, -0x18);
CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 0xc, -0x18);
}
gPlayerEntity.animationState = 0;
gPlayerEntity.base.animationState = 0;
} else if (val <= 0x59) {
gPlayerEntity.animationState = 2;
gPlayerEntity.base.animationState = 2;
} else if (val <= 0x77) {
gPlayerEntity.animationState = 6;
gPlayerEntity.base.animationState = 6;
}
}
@ -520,7 +520,7 @@ void sub_0802D7B4(GleerokEntity* this) {
super->action = 1;
super->subAction = 0;
this->unk_84->ent2->timer = 24;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
#ifndef EU
gPlayerState.controlMode = CONTROL_1;
#endif
@ -577,7 +577,7 @@ void sub_0802D86C(GleerokEntity* this) {
if (((GleerokEntity*)(super->parent))->unk_80 == 0)
return;
if (!EntityInRectRadius(super, &gPlayerEntity, 8, 8))
if (!EntityInRectRadius(super, &gPlayerEntity.base, 8, 8))
return;
gPlayerState.field_0x14 = 1;
@ -710,7 +710,7 @@ void sub_0802D86C(GleerokEntity* this) {
void sub_0802DB84(GleerokEntity* this) {
u32 timer;
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
if (this->unk_84->filler[0].unk0.HALF.HI == super->direction) {
super->subAction = 1;
this->unk_78 = 0;
@ -744,7 +744,7 @@ void sub_0802DB84(GleerokEntity* this) {
}
void sub_0802DC1C(GleerokEntity* this) {
u32 diff = GetFacingDirection(super, &gPlayerEntity);
u32 diff = GetFacingDirection(super, &gPlayerEntity.base);
diff = (this->unk_84->filler[0].unk0.HALF.HI - diff) & 0x1f;
if (diff > 0x10) {
@ -788,7 +788,7 @@ void sub_0802DC1C(GleerokEntity* this) {
void sub_0802DCE0(GleerokEntity* this) {
if (this->unk_84->ent2->timer != 12) {
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
if (this->unk_84->filler[5].unk0.HALF.HI == super->direction) {
this->unk_84->ent2->timer = 12;
this->unk_82 = 4;
@ -1009,7 +1009,7 @@ void sub_0802E0B8(GleerokEntity* this) {
val = super->frame & 0x3f;
if (val) {
if (sub_0806FC80(super, &gPlayerEntity, val)) {
if (sub_0806FC80(super, &gPlayerEntity.base, val)) {
gPlayerState.field_0x14 = 1;
gPlayerState.spriteOffsetY = -6;
}
@ -1059,7 +1059,7 @@ void sub_0802E1D0(GleerokEntity* this) {
GetNextFrame(super);
}
if (super->frame & 0x3f) {
if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) {
if (sub_0806FC80(super, &gPlayerEntity.base, super->frame & 0x3f)) {
gPlayerState.field_0x14 = 1;
gPlayerState.spriteOffsetY = -6;
}
@ -1133,7 +1133,7 @@ void sub_0802E300(GleerokEntity* this) {
this->unk_79 &= ~0x80;
heap = this->unk_84;
dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) << 3;
dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) << 3;
index = 0;
ptr2 = &this->unk_80;
tmp = 0;
@ -1403,7 +1403,7 @@ void sub_0802E9B0(GleerokEntity* this) {
s32 uVar4;
Gleerok_HeapStruct* heap;
iVar2 = sub_080041DC(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI) >> 4;
iVar2 = sub_080041DC(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI) >> 4;
if (iVar2 < 0x60) {
iVar2 = 10;
} else {

View File

@ -159,13 +159,13 @@ void GyorgChild_Action2(GyorgChildEntity* this) {
switch (super->animationState >> 1) {
case 0:
case 2:
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->attackOffsetX;
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->attackOffsetX;
super->y.HALF.HI = gRoomControls.scroll_y + this->attackOffsetY;
break;
case 1:
default:
super->x.HALF.HI = gRoomControls.scroll_x + this->attackOffsetX;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->attackOffsetY;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->attackOffsetY;
break;
}
if (super->type2 == 0) {

View File

@ -93,8 +93,8 @@ void GyorgFemale_Setup(GyorgFemaleEntity* this) {
MemClear(&gMapDataTopSpecial, 0x8000);
sub_0804660C(this, 0);
sub_080464C0(this);
gPlayerEntity.collisionLayer = 2;
UpdateSpriteForCollisionLayer(&gPlayerEntity);
gPlayerEntity.base.collisionLayer = 2;
UpdateSpriteForCollisionLayer(&gPlayerEntity.base);
#ifndef EU
RegisterTransitionManager(this, sub_08046498, 0);
#else
@ -272,8 +272,8 @@ void sub_08046518(void) {
void sub_080465C8(void) {
s32 x, y;
x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3;
y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3;
x = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) >> 3;
y = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) >> 3;
if (gMapDataBottomSpecial[(y << 7) + x]) {
gPlayerState.field_0x14 = 1;
}
@ -435,7 +435,7 @@ void GyorgFemale_ProcessEyeHit(GyorgFemaleEntity* this) {
#ifndef EU
if (((GyorgHeap*)super->myHeap)->unk_3c != 0xFF) {
#endif
tmp = &gPlayerEntity;
tmp = &gPlayerEntity.base;
tmp->knockbackDirection = ((GyorgHeap*)super->myHeap)->unk_3c;
tmp->iframes = 0xF4;
tmp->knockbackDuration = 0xA;

View File

@ -83,9 +83,9 @@ void GyorgFemaleEye_OnCollision(GyorgFemaleEyeEntity* this) {
#endif
(*(((GyorgHeap**)&parent->base.myHeap)))->unk_18[super->type] = super->contactedEntity;
(*(((GyorgHeap**)&parent->base.myHeap)))->reflectFxPos.HALF.x =
(gPlayerEntity.x.HALF.HI + super->x.HALF.HI) / 2;
(gPlayerEntity.base.x.HALF.HI + super->x.HALF.HI) / 2;
(*(((GyorgHeap**)&parent->base.myHeap)))->reflectFxPos.HALF.y =
(gPlayerEntity.y.HALF.HI + super->y.HALF.HI) / 2;
(gPlayerEntity.base.y.HALF.HI + super->y.HALF.HI) / 2;
(*(((GyorgHeap**)&parent->base.myHeap)))->unk_3c = (super->knockbackDirection ^= 0x10);
#ifndef EU
break;

View File

@ -58,11 +58,11 @@ void GyorgFemaleMouth(Entity* this) {
GetNextFrame(this);
}
if (tmp & 2) {
if (this->y.HALF.HI < gPlayerEntity.y.HALF.HI) {
if (this->y.HALF.HI < gPlayerEntity.base.y.HALF.HI) {
tmp++;
}
} else {
if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) {
if (this->x.HALF.HI < gPlayerEntity.base.x.HALF.HI) {
tmp++;
}
}

View File

@ -111,8 +111,8 @@ void GyorgMale(GyorgMaleEntity* this) {
if (super->spriteSettings.draw == 1 && (super->y.HALF.HI - gRoomControls.scroll_y + 0x30) > 0x100u) {
super->spriteSettings.draw = 0;
}
this->unk_84 = gPlayerEntity.x.HALF.HI;
this->unk_86 = gPlayerEntity.y.HALF.HI;
this->unk_84 = gPlayerEntity.base.x.HALF.HI;
this->unk_86 = gPlayerEntity.base.y.HALF.HI;
}
void sub_08046898(GyorgMaleEntity* this) {
@ -793,7 +793,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
}
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047E48(this);
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@ -858,7 +858,7 @@ void sub_08047978(GyorgMaleEntity* this) {
tmp->parent = super;
}
}
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@ -1016,10 +1016,10 @@ void sub_08047D88(GyorgMaleEntity* this) {
return;
if (super->animIndex == 1)
return;
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x20))
return;
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI != 0)
if (gPlayerEntity.base.z.HALF.HI != 0)
return;
this->unk_7c |= 1;
}
@ -1033,8 +1033,8 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) {
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY;
gPlayerEntity.base.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.base.y.HALF.HI += super->y.HALF.HI - oldY;
}
}
}
@ -1051,8 +1051,8 @@ void sub_08047E58(GyorgMaleEntity* this) {
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (PlayerCanBeMoved()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY;
gPlayerEntity.base.x.HALF.HI += super->x.HALF.HI - oldX;
gPlayerEntity.base.y.HALF.HI += super->y.HALF.HI - oldY;
}
}
}
@ -1066,11 +1066,12 @@ void sub_08047EA4(GyorgMaleEntity* this, u32 unk1) {
return;
if (this->unk_7c & 1) {
tmp2 = sub_08047F68(this) << 8;
dir = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI, gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
dir = sub_080045DA(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
tmp = dir - (tmp / 256);
tmp &= 0xFF;
gPlayerEntity.x.WORD += (gSineTable[tmp] - gSineTable[dir]) * tmp2;
gPlayerEntity.y.WORD -= (gSineTable[tmp + 0x40] - gSineTable[dir + 0x40]) * tmp2;
gPlayerEntity.base.x.WORD += (gSineTable[tmp] - gSineTable[dir]) * tmp2;
gPlayerEntity.base.y.WORD -= (gSineTable[tmp + 0x40] - gSineTable[dir + 0x40]) * tmp2;
}
this->unk_7a = this->unk_78;
}
@ -1081,8 +1082,8 @@ const u16 gUnk_080D1C04[0x20] = { 0, 1, 4, 9, 16, 25, 36, 49, 64, 8
u32 sub_08047F68(GyorgMaleEntity* this) {
s32 diffX, diffY;
s32 distSquared, approx;
diffX = gPlayerEntity.x.HALF.HI - super->x.HALF.HI;
diffY = gPlayerEntity.y.HALF.HI - super->y.HALF.HI;
diffX = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI;
diffY = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI;
distSquared = (diffX * diffX) + (diffY * diffY);
if (distSquared == 0x400)
return 0x20;
@ -1121,15 +1122,15 @@ void sub_08048004(GyorgMaleEntity* this) {
return;
if (super->animIndex == 0) {
COLLISION_OFF(super);
if (gPlayerEntity.z.HALF.HI != 0)
if (gPlayerEntity.base.z.HALF.HI != 0)
return;
if (!PlayerCanBeMoved())
return;
if (this->unk_7c & 1) {
u32 b = super->spriteRendering.b3;
if (b == 3) {
s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3);
s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3);
s32 posX = ((gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) >> 3);
s32 posY = ((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) >> 3);
u16* tmp = (u16*)&gMapDataBottomSpecial;
if (tmp[(posY << 7) + posX]) {
if (!(this->unk_7c & 2)) {
@ -1137,8 +1138,8 @@ void sub_08048004(GyorgMaleEntity* this) {
}
if ((this->unk_7c & 0x80))
return;
gPlayerEntity.x.HALF.HI = this->unk_84;
gPlayerEntity.y.HALF.HI = this->unk_86;
gPlayerEntity.base.x.HALF.HI = this->unk_84;
gPlayerEntity.base.y.HALF.HI = this->unk_86;
return;
}
}
@ -1146,12 +1147,12 @@ void sub_08048004(GyorgMaleEntity* this) {
} else {
u32 b = super->spriteRendering.b3;
if (b != 3) {
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (!(this->unk_7c & 2)) {
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.x.WORD = super->x.WORD + (gSineTable[tmp] * 9216);
gPlayerEntity.y.WORD = super->y.WORD - (gSineTable[tmp + 0x40] * 9216);
u32 tmp = sub_080045DA(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.base.x.WORD = super->x.WORD + (gSineTable[tmp] * 9216);
gPlayerEntity.base.y.WORD = super->y.WORD - (gSineTable[tmp + 0x40] * 9216);
}
}
}

View File

@ -83,7 +83,7 @@ void sub_0802BC74(HelmasaurEntity* this) {
sub_0802C1C0(this);
super->subAction = 1;
super->gustJarTolerance = 60;
super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1);
super->animationState = AnimationStateFlip90(gPlayerEntity.base.animationState >> 1);
InitializeAnimation(super, super->animationState);
}

View File

@ -139,7 +139,7 @@ void Keese_Sleep(KeeseEntity* this) {
if (super->timer != 0) {
super->timer--;
} else {
if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x70))
Keese_StartFly(this);
}
}
@ -165,7 +165,7 @@ void sub_08021F24(KeeseEntity* this) {
super->timer = gKeeseRestDurations[Random() & 0xF];
InitializeAnimation(super, KeeseAnimation_Rest);
} else if ((this->sleepTimer == 0) &&
!(EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
!(EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x70))) {
super->action = KEESE_ACTION_SLEEP;
super->timer = 30;
InitializeAnimation(super, KeeseAnimation_Rest);

View File

@ -250,8 +250,8 @@ void Lakitu_Cloudless(LakituEntity* this) {
}
bool32 sub_0803CA4C(LakituEntity* this) {
if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (EntityInRectRadius(super, &gPlayerEntity, 0x70, 0x50)) {
if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x28) == 0) {
if (EntityInRectRadius(super, &gPlayerEntity.base, 0x70, 0x50)) {
return TRUE;
}
}
@ -260,7 +260,7 @@ bool32 sub_0803CA4C(LakituEntity* this) {
}
void sub_0803CA84(LakituEntity* this, u32 unkParameter) {
u32 altAnimState = GetFacingDirection(super, &gPlayerEntity);
u32 altAnimState = GetFacingDirection(super, &gPlayerEntity.base);
if (((altAnimState - 3) & 7) > 2 || ((super->animationState - (altAnimState >> 3)) & 3) > 1) {
altAnimState = DirectionRoundUp(altAnimState) >> 3;
@ -304,7 +304,7 @@ void sub_0803CB34(LakituEntity* this) {
super->action = LIGHTNING_THROW;
super->hitType = 0xa6;
this->unk_78 = GetFacingDirection(super, &gPlayerEntity);
this->unk_78 = GetFacingDirection(super, &gPlayerEntity.base);
InitAnimationForceUpdate(super, super->animationState + 8);
}

View File

@ -68,7 +68,7 @@ void sub_0803CD40(LakituCloudEntity* this) {
ModHealth(-2);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6);
sub_08079D84();
sub_0803CE3C(this);

View File

@ -53,7 +53,7 @@ void LikeLike_OnCollision(LikeLikeEntity* this) {
super->timer = 95;
super->subtimer = tmp;
super->flags2 &= 0xfc;
this->prevSpritePriority = gPlayerEntity.spritePriority.b1;
this->prevSpritePriority = gPlayerEntity.base.spritePriority.b1;
}
}
}
@ -198,12 +198,12 @@ void sub_0802805C(LikeLikeEntity* this) {
} else {
ResetActiveItems();
gPlayerState.mobility |= 0x80;
PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0));
PositionRelative(super, &gPlayerEntity.base, 0, Q_16_16(1.0));
tmp = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex);
gPlayerEntity.spriteOffsetX = tmp[0];
gPlayerEntity.spriteOffsetY = tmp[1];
gPlayerEntity.spritePriority.b1 = 0;
gPlayerEntity.base.spriteOffsetX = tmp[0];
gPlayerEntity.base.spriteOffsetY = tmp[1];
gPlayerEntity.base.spritePriority.b1 = 0;
if (--super->timer == 0) {
sub_080281A0(this);
@ -225,14 +225,14 @@ void LikeLike_ReleasePlayer(LikeLikeEntity* this) {
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = -60;
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerEntity.base.zVelocity = Q_16_16(1.5);
gPlayerEntity.base.iframes = -60;
tmp = 0;
gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.spritePriority.b1 = this->prevSpritePriority;
gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY;
gPlayerEntity.spriteOffsetY = tmp;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
gPlayerEntity.base.spritePriority.b1 = this->prevSpritePriority;
gPlayerEntity.base.z.HALF.HI = gPlayerEntity.base.spriteOffsetY;
gPlayerEntity.base.spriteOffsetY = tmp;
super->action = 4;
super->timer = 80;
super->subtimer = tmp;

View File

@ -424,7 +424,7 @@ void sub_0803A660(MazaalBraceletEntity* this) {
} else {
super->action = 7;
super->timer = 0;
uVar2 = GetFacingDirection(super, &gPlayerEntity);
uVar2 = GetFacingDirection(super, &gPlayerEntity.base);
super->direction = (u8)uVar2;
super->speed = 0x280;
return;
@ -615,11 +615,11 @@ void sub_0803AA00(MazaalBraceletEntity* this) {
sub_08004596(super, direction);
}
LinearMoveUpdate(super);
if ((super->direction == direction) || (super->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) {
if ((super->direction == direction) || (super->y.HALF.HI >= gPlayerEntity.base.y.HALF.HI)) {
super->action = 0x13;
super->spriteSettings.draw = 0;
super->direction = direction;
this->unk_80.HWORD = gPlayerEntity.x.HALF.HI;
this->unk_80.HWORD = gPlayerEntity.base.x.HALF.HI;
InitAnimationForceUpdate(super->child, 4);
}
}
@ -1184,7 +1184,7 @@ void sub_0803B5C0(MazaalBraceletEntity* this) {
u32 direction;
u32 temp;
direction = GetFacingDirection(super, &gPlayerEntity);
direction = GetFacingDirection(super, &gPlayerEntity.base);
if (direction < 10) {
direction = 10;
}
@ -1202,8 +1202,8 @@ void sub_0803B5C0(MazaalBraceletEntity* this) {
}
u32 sub_0803B610(MazaalBraceletEntity* this) {
return EntityWithinDistance(super, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[super->type],
gPlayerEntity.y.HALF.HI - 0xc, 8);
return EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI + gUnk_080CFD19[super->type],
gPlayerEntity.base.y.HALF.HI - 0xc, 8);
}
// sub_0803B698 was the tail of super function
@ -1211,9 +1211,9 @@ void sub_0803B63C(MazaalBraceletEntity* this) {
int y;
int x;
x = gPlayerEntity.x.HALF.HI;
x = gPlayerEntity.base.x.HALF.HI;
x += gUnk_080CFD19[super->type];
y = gPlayerEntity.y.HALF.HI - 0xc;
y = gPlayerEntity.base.y.HALF.HI - 0xc;
if (super->timer++ > 180) {
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y);
} else {
@ -1270,29 +1270,29 @@ void sub_0803B798(void) {
~(PL_CAPTURED | PL_FLAGS10000 | PL_GYORG_FIGHT | PL_ROLLING | PL_MOLDWORM_CAPTURED | PL_IN_HOLE |
PL_MOLDWORM_RELEASED | PL_CLONING | PL_USE_LANTERN | PL_PARACHUTE | PL_CONVEYOR_PUSHED | PL_ENTER_MINECART |
PL_SWORD_THRUST | PL_USE_OCARINA | PL_CLIMBING | PL_FLAGS40000000 | PL_FLAGS80000000);
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;
gPlayerEntity.direction = 0x10;
gPlayerEntity.animationState = 4;
gPlayerEntity.spritePriority.b1 = 1;
gPlayerEntity.spriteOffsetY = 0;
gPlayerEntity.speed = 0x140;
gPlayerEntity.iframes = -0x1e;
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerEntity.base.zVelocity = Q_16_16(1.5);
gPlayerEntity.base.z.HALF.HI = -10;
gPlayerEntity.base.direction = 0x10;
gPlayerEntity.base.animationState = 4;
gPlayerEntity.base.spritePriority.b1 = 1;
gPlayerEntity.base.spriteOffsetY = 0;
gPlayerEntity.base.speed = 0x140;
gPlayerEntity.base.iframes = -0x1e;
}
void sub_0803B804(MazaalBraceletEntity* this) {
gPlayerEntity.iframes = 30;
gPlayerEntity.base.iframes = 30;
ModHealth(-4);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6);
}
void sub_0803B824(MazaalBraceletEntity* this) {
ResetActiveItems();
gPlayerState.mobility |= 0x80;
sub_0806FA90(super, &gPlayerEntity, gUnk_080CFD1D[super->type], 1);
gPlayerEntity.spriteOffsetY = -6;
gPlayerEntity.spritePriority.b1 = 0;
sub_0806FA90(super, &gPlayerEntity.base, gUnk_080CFD1D[super->type], 1);
gPlayerEntity.base.spriteOffsetY = -6;
gPlayerEntity.base.spritePriority.b1 = 0;
}
u32 sub_0803B870(MazaalBraceletEntity* this) {
@ -1303,8 +1303,8 @@ u32 sub_0803B870(MazaalBraceletEntity* this) {
super->action = 0x18;
super->timer = 68;
super->spriteSettings.draw = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.iframes = -0x10;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
gPlayerEntity.base.iframes = -0x10;
sub_0803B824(this);
entity->hitType = 0x13;
InitAnimationForceUpdate(entity, 7);

View File

@ -246,7 +246,7 @@ void sub_08033FFC(MazaalHeadEntity* this) {
break;
default:
if (((this->unk_74)->base.flags & ENT_COLLIDE) != 0) {
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
sub_08034420(this);
gPlayerState.controlMode = CONTROL_1;
ResetPlayerAnimationAndAction();
@ -567,12 +567,12 @@ void sub_0803473C(MazaalHeadEntity* this) {
if (0x28 < (this->unk_74)->base.action) {
return;
}
playerX = gPlayerEntity.x.HALF.HI - 0x60;
playerX = gPlayerEntity.base.x.HALF.HI - 0x60;
} else {
if (0x28 < (this->unk_78)->base.action) {
return;
}
playerX = gPlayerEntity.x.HALF.HI + 0x60;
playerX = gPlayerEntity.base.x.HALF.HI + 0x60;
}
roomX = gRoomControls.origin_x;
if (playerX - 4 > super->x.HALF.HI) {
@ -593,7 +593,7 @@ void sub_0803473C(MazaalHeadEntity* this) {
}
void sub_080347B4(MazaalHeadEntity* this) {
u32 playerX = gPlayerEntity.x.HALF.HI;
u32 playerX = gPlayerEntity.base.x.HALF.HI;
u32 roomX = gRoomControls.origin_x;
if (playerX - 4 > super->x.HALF.HI) {
if (roomX + 0xe0 < super->x.HALF.HI) {

View File

@ -111,12 +111,12 @@ void Moldworm_OnCollision(MoldwormEntity* this) {
}
if (super->health == 0 && this->unk_7f == 0 && super->action == 7) {
CopyPosition(super, &gPlayerEntity);
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.direction = 0xff;
gPlayerEntity.iframes = -0x14;
CopyPosition(super, &gPlayerEntity.base);
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerEntity.base.spriteSettings.draw = 1;
gPlayerEntity.base.zVelocity = Q_16_16(1.5);
gPlayerEntity.base.direction = 0xff;
gPlayerEntity.base.iframes = -0x14;
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED;
}
@ -183,9 +183,9 @@ void sub_08023288(MoldwormEntity* this) {
u32 i;
for (i = 0; i < 0x10; i++) {
u32 x = gPlayerEntity.x.HALF.HI + gUnk_080CBC70[idx + 0];
u32 y = gPlayerEntity.y.HALF.HI + gUnk_080CBC70[idx + 1];
if (sub_08023A38(GetTileTypeByPos(x, y, gPlayerEntity.collisionLayer))) {
u32 x = gPlayerEntity.base.x.HALF.HI + gUnk_080CBC70[idx + 0];
u32 y = gPlayerEntity.base.y.HALF.HI + gUnk_080CBC70[idx + 1];
if (sub_08023A38(GetTileTypeByPos(x, y, gPlayerEntity.base.collisionLayer))) {
sub_08023990(this, x, y);
return;
}
@ -282,7 +282,7 @@ void sub_080234D8(MoldwormEntity* this) {
}
void sub_0802351C(MoldwormEntity* this) {
if ((super->timer != 0) && ((super->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) {
if ((super->timer != 0) && ((super->type2 == 1) || (gPlayerEntity.base.frameIndex == 0xff))) {
super->timer = 0;
super->child->action = 3;
super->child->subtimer = this->unk_80;
@ -292,10 +292,10 @@ void sub_0802351C(MoldwormEntity* this) {
if (this->unk_7f == 0) {
if (super->type2 == 0) {
gPlayerEntity.animationState = super->animationState & 7;
gPlayerEntity.base.animationState = super->animationState & 7;
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
PositionRelative(super, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[super->animationState & 7]));
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[super->animationState & 7];
PositionRelative(super, &gPlayerEntity.base, 0, Q_16_16(gUnk_080CBC90[super->animationState & 7]));
gPlayerEntity.base.spriteOffsetY = -gUnk_080CBC90[super->animationState & 7];
}
} else {
super->action = 4;
@ -429,13 +429,13 @@ void sub_08023894(MoldwormEntity* this) {
InitializeAnimation(super, super->animationState);
if (super->parent->type2 == 0) {
gPlayerState.flags |= PL_MOLDWORM_RELEASED;
gPlayerEntity.x.HALF.HI = super->x.HALF.HI;
gPlayerEntity.y.HALF.HI = super->y.HALF.HI;
gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(this->unk_74, super));
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
gPlayerEntity.iframes = 12;
gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI;
gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI;
gPlayerEntity.base.direction = DirectionRoundUp(GetFacingDirection(this->unk_74, super));
gPlayerEntity.base.animationState = gPlayerEntity.base.direction >> 2;
gPlayerEntity.base.iframes = 12;
ModHealth(-0x10);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6);
}
}
}
@ -482,7 +482,7 @@ void sub_08023990(MoldwormEntity* this, u32 param_2, u32 param_3) {
super->spritePriority.b0 = 7;
super->x.HALF.HI = param_2;
super->y.HALF.HI = param_3;
super->collisionLayer = gPlayerEntity.collisionLayer;
super->collisionLayer = gPlayerEntity.base.collisionLayer;
UpdateSpriteForCollisionLayer(super);
InitializeAnimation(super, 0x16);

View File

@ -228,7 +228,7 @@ void OctorokBoss_Hit_SubAction2(OctorokBossEntity* this) {
} else {
super->subAction = 3;
this->timer = 150;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
}
}
@ -389,9 +389,9 @@ void OctorokBoss_Init(OctorokBossEntity* this) {
super->action = INTRO;
super->subAction = 0;
this->timer = 0x3c;
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.x.HALF.HI = super->x.HALF.HI;
gPlayerEntity.y.HALF.HI = super->y.HALF.HI - 0xa0;
gPlayerEntity.base.spriteSettings.draw = 0;
gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI;
gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI - 0xa0;
gRoomControls.camera_target = super;
break;
case LEG_BR:
@ -476,8 +476,8 @@ void OctorokBoss_Intro_SubAction2(OctorokBossEntity* this) {
if (this->timer-- == 0) {
super->subAction = 3;
this->timer = 60;
gPlayerEntity.spriteSettings.draw |= 1;
gRoomControls.camera_target = &gPlayerEntity;
gPlayerEntity.base.spriteSettings.draw |= 1;
gRoomControls.camera_target = &gPlayerEntity.base;
gRoomControls.scrollSpeed = 1;
}
}
@ -486,8 +486,8 @@ void OctorokBoss_Intro_SubAction3(OctorokBossEntity* this) {
// Move the camera to the player
if (this->timer-- == 0) {
// Move the player inside the arena
gPlayerEntity.direction = 0x10;
gPlayerEntity.animationState = 4;
gPlayerEntity.base.direction = 0x10;
gPlayerEntity.base.animationState = 4;
sub_08078AC0(0x1e, 0, 0);
this->timer = 60;
super->subAction = 4;
@ -499,22 +499,22 @@ void OctorokBoss_Intro_SubAction4(OctorokBossEntity* this) {
super->subAction = 5;
this->timer = 45;
// Make the player look towards the exit
gPlayerEntity.animationState = 0;
gPlayerEntity.base.animationState = 0;
} else {
// Spawn exclamation bubble at a certain time
if (this->timer == 0x1e) {
CreateSpeechBubbleExclamationMark(&gPlayerEntity, 0xc, -0x18);
CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 0xc, -0x18);
}
}
}
void OctorokBoss_Intro_SubAction5(OctorokBossEntity* this) {
if (gPlayerEntity.animationState == 4) {
if (gPlayerEntity.base.animationState == 4) {
if (this->timer++ > 0x1e) {
// Play boss theme, enable control and switch to main action
super->action = ACTION1;
super->subAction = 0;
gRoomControls.scrollSpeed = gPlayerEntity.animationState;
gRoomControls.scrollSpeed = gPlayerEntity.base.animationState;
OctorokBoss_SetAttackTimer(this);
gPauseMenuOptions.disabled = 0;
SoundReq(BGM_BOSS_THEME);
@ -522,7 +522,7 @@ void OctorokBoss_Intro_SubAction5(OctorokBossEntity* this) {
} else {
if (this->timer-- == 0) {
// Player looks back towards Octorok
gPlayerEntity.animationState = 4;
gPlayerEntity.base.animationState = 4;
}
}
}
@ -689,7 +689,7 @@ void OctorokBoss_Action1_AimTowardsPlayer(OctorokBossEntity* this) {
s32 tmp1;
s32 tmp2;
tmp1 = (u8)(sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) -
tmp1 = (u8)(sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) -
(((u8)(-this->angle.HALF.HI) ^ 0x80)));
if (IS_FROZEN(this) == FALSE) {
tmp2 = 8;
@ -792,13 +792,13 @@ void OctorokBoss_Action1_Attack(OctorokBossEntity* this) {
sub_08036FE4(this);
if (this->unk_80 != 0) {
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 2;
gPlayerEntity.base.spriteSettings.draw = 0;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
gPlayerEntity.base.collisionLayer = 2;
PausePlayer();
PutAwayItems();
gPlayerEntity.parent = super;
sub_08036914(&gPlayerEntity, (u8) - (this->angle.HALF.HI + 0x80), 0x3800);
gPlayerEntity.base.parent = super;
sub_08036914(&gPlayerEntity.base, (u8) - (this->angle.HALF.HI + 0x80), 0x3800);
}
}
@ -897,17 +897,18 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
s32 tmp;
if (this->unk_80 == 0) {
super->direction = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD);
super->direction =
sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD);
tmp = ((u8) - (this->angle.HALF.HI + 0x80)) - super->direction;
if (tmp < 0) {
tmp = -tmp;
}
if (tmp < 0x10) {
if (sub_0806FC80(super, &gPlayerEntity, 0xf0) != 0) {
if (sub_0806FC80(super, &gPlayerEntity.base, 0xf0) != 0) {
if ((gPlayerState.flags & PL_FROZEN) == 0) {
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
LinearMoveAngle(&gPlayerEntity, 0x280, -this->angle.HALF.HI);
if (sub_0806FC80(super, &gPlayerEntity, 0x48) != 0) {
if ((gPlayerEntity.base.flags & PL_MINISH) != 0) {
LinearMoveAngle(&gPlayerEntity.base, 0x280, -this->angle.HALF.HI);
if (sub_0806FC80(super, &gPlayerEntity.base, 0x48) != 0) {
this->unk_80 = 1;
this->timer = 2;
this->heap->targetAngle =
@ -938,9 +939,9 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
this->unk_80 = 0;
this->angularSpeed.HWORD = 0x100;
this->heap->mouthObject->timer++;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.collisionLayer = 1;
gPlayerEntity.base.spriteSettings.draw = 1;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
gPlayerEntity.base.collisionLayer = 1;
sub_080792BC(0x400, (u32)(-(this->angle.HALF.HI + 0x80) * 0x1000000) >> 0x1b, 0x30);
OctorokBoss_SetAttackTimer(this);
SoundReq(SFX_EF);
@ -955,7 +956,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
} else {
this->timer--;
if ((gPlayerState.flags == PL_FROZEN) && (this->timer == 0x3c)) {
tmp = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD);
tmp = sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD);
if ((u8)((tmp - ((u8) - this->angle.HALF.HI ^ 0x80))) > 0x80) {
this->heap->targetAngle = this->angle.HALF.HI + 0x30;
} else {
@ -1083,9 +1084,9 @@ void OctorokBoss_Burning_SubAction2(OctorokBossEntity* this) {
void sub_080368D8(OctorokBossEntity* this) {
if (this->unk_80 != 0) {
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.collisionLayer = 1;
gPlayerEntity.base.spriteSettings.draw = 1;
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerEntity.base.collisionLayer = 1;
}
this->unk_76 = 0xa0;
this->unk_74 = 0xa0;

View File

@ -102,7 +102,7 @@ static void sub_08037D54(Entity* this) {
this->animationState |= 0xff;
sub_08037E14(this);
} else {
u32 dir = GetFacingDirection(this, &gPlayerEntity);
u32 dir = GetFacingDirection(this, &gPlayerEntity.base);
this->direction = (dir + 4) & 0x18;
this->animationState = this->direction >> 3;
InitializeAnimation(this, this->animationState + 4);
@ -116,7 +116,7 @@ void sub_08037E14(Entity* this) {
const s8* ptr;
s32 x, y;
this->timer = 8;
dir = (GetFacingDirection(this, &gPlayerEntity) + 4) & 0x18;
dir = (GetFacingDirection(this, &gPlayerEntity.base) + 4) & 0x18;
layer = (u8*)GetLayerByIndex(this->collisionLayer)->collisionData;
ptr = gUnk_080CF498 + (dir >> 2);
x = this->x.HALF.HI + *ptr;
@ -135,7 +135,7 @@ void sub_08037E14(Entity* this) {
}
bool32 sub_08037E90(Entity* this) {
u32 dir = sub_0804A044(this, &gPlayerEntity, 8);
u32 dir = sub_0804A044(this, &gPlayerEntity.base, 8);
if (dir != 0xff) {
this->action = 2;
this->timer = 3;

View File

@ -126,7 +126,7 @@ void sub_08024060(PestoEntity* this) {
if (super->hitType != 0x6e) {
COLLISION_OFF(super);
super->hitType = 0x6e;
super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3;
super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3;
}
GetNextFrame(super);
@ -199,7 +199,7 @@ void sub_080241C0(PestoEntity* this) {
switch (this->unk_80) {
case 0:
if (PlayerInRange(super, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(super, 3) &&
gPlayerEntity.action != PLAYER_USEENTRANCE) {
gPlayerEntity.base.action != PLAYER_USEENTRANCE) {
this->unk_80++;
super->speed = 0;
sub_08024A14(this, 3, 10);
@ -408,8 +408,8 @@ void sub_080244E8(PestoEntity* this) {
this->unk_84 = 0;
super->flags2 &= 0xfc;
sub_080249DC(this);
this->unk_85 = gPlayerEntity.spritePriority.b1;
gPlayerEntity.flags &= ~ENT_COLLIDE;
this->unk_85 = gPlayerEntity.base.spritePriority.b1;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
if (gPlayerState.swim_state != 0) {
@ -526,7 +526,7 @@ void sub_080244E8(PestoEntity* this) {
}
break;
case 7:
if (gPlayerEntity.z.HALF.HI == 0) {
if (gPlayerEntity.base.z.HALF.HI == 0) {
this->unk_80 = 0;
super->speed = 0x80;
sub_08024B38(this);
@ -843,7 +843,7 @@ void sub_08024E4C(PestoEntity* this) {
super->subtimer = 8;
sub_08024A14(this, 0, 8);
} else {
Entity* player = &gPlayerEntity;
Entity* player = &gPlayerEntity.base;
ResetActiveItems();
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
@ -868,15 +868,15 @@ void sub_08024E4C(PestoEntity* this) {
void sub_08024F50(PestoEntity* this) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
CopyPosition(super, &gPlayerEntity);
gPlayerEntity.action = PLAYER_NORMAL;
COLLISION_ON(&gPlayerEntity);
gPlayerEntity.iframes = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.speed = 0;
gPlayerEntity.spritePriority.b1 = this->unk_85;
gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY;
gPlayerEntity.spriteOffsetY = 0;
CopyPosition(super, &gPlayerEntity.base);
gPlayerEntity.base.action = PLAYER_NORMAL;
COLLISION_ON(&gPlayerEntity.base);
gPlayerEntity.base.iframes = -0x3c;
gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2;
gPlayerEntity.base.speed = 0;
gPlayerEntity.base.spritePriority.b1 = this->unk_85;
gPlayerEntity.base.z.HALF.HI = gPlayerEntity.base.spriteOffsetY;
gPlayerEntity.base.spriteOffsetY = 0;
super->flags2 |= 3;
this->unk_83 = 0xc0;
this->unk_80 += 2;

View File

@ -152,17 +152,17 @@ void sub_08020874(RollobiteEntity* this) {
void sub_0802088C(RollobiteEntity* this) {
super->subAction = 1;
COLLISION_OFF(super);
this->unk_85 = gPlayerEntity.animationState;
this->unk_85 = gPlayerEntity.base.animationState;
super->spritePriority.b1 = 0;
}
void sub_080208B4(RollobiteEntity* this) {
s8 uVar1 = (this->unk_85 - gPlayerEntity.animationState) / 2;
s8 uVar1 = (this->unk_85 - gPlayerEntity.base.animationState) / 2;
if (uVar1) {
super->animationState = (super->animationState + uVar1) & 3;
InitializeAnimation(super, super->animationState + 0x10);
}
this->unk_85 = gPlayerEntity.animationState;
this->unk_85 = gPlayerEntity.base.animationState;
}
void sub_080208F0(RollobiteEntity* this) {

View File

@ -86,8 +86,8 @@ void sub_0803827C(RopeGoldenEntity* this) {
if (super->subtimer != 0) {
super->subtimer--;
} else {
if ((sub_0804A044(super, &gPlayerEntity, 0x8) != 0xff) ||
(EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
if ((sub_0804A044(super, &gPlayerEntity.base, 0x8) != 0xff) ||
(EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x24) != 0)) {
sub_080383E4(this);
return;
}
@ -157,7 +157,7 @@ void sub_080383AC(RopeGoldenEntity* this) {
super->action = 1;
super->timer = 8;
super->speed = 0x100;
super->direction = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity));
super->direction = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity.base));
v = super->direction >> 3;
if (v != super->animationState) {
super->animationState = v;
@ -170,7 +170,7 @@ void sub_080383E4(RopeGoldenEntity* this) {
super->action = 2;
super->timer = 8;
super->speed = 0x280;
v = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity));
v = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity.base));
super->direction = v;
this->unk_78 = v;
super->animationState = super->direction >> 3;

View File

@ -76,7 +76,7 @@ void RupeeLike_OnCollision(RupeeLikeEntity* this) {
super->subtimer = 0;
this->unk_83 = 0x41;
super->flags2 &= 0xfc;
this->unk_80 = gPlayerEntity.spritePriority.b1;
this->unk_80 = gPlayerEntity.base.spritePriority.b1;
EnqueueSFX(SFX_PLACE_OBJ);
} else {
if (super->confusedTime != 0) {
@ -131,7 +131,7 @@ void sub_08029474(RupeeLikeEntity* this) {
if (super->frame & ANIM_DONE) {
super->action = 3;
super->timer = 8;
bVar1 = GetFacingDirection(super, &gPlayerEntity);
bVar1 = GetFacingDirection(super, &gPlayerEntity.base);
super->direction = bVar1;
super->animationState = (bVar1 << 0x18) >> 0x1c;
InitializeAnimation(super, super->animationState);
@ -148,7 +148,7 @@ void sub_080294D4(RupeeLikeEntity* this) {
if (sub_08049FDC(super, 1) != 0) {
if (--super->timer == 0) {
super->timer = 8;
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity));
sub_08004596(super, GetFacingDirection(super, &gPlayerEntity.base));
sub_0802969C(this);
}
ProcessMovement0(super);
@ -177,11 +177,11 @@ void sub_0802953C(RupeeLikeEntity* this) {
} else {
ResetActiveItems();
gPlayerState.mobility |= 0x80;
PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0));
PositionRelative(super, &gPlayerEntity.base, 0, Q_16_16(1.0));
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex);
gPlayerEntity.spriteOffsetX = pbVar3[0];
gPlayerEntity.spriteOffsetY = pbVar3[1] - 1;
gPlayerEntity.spritePriority.b1 = 0;
gPlayerEntity.base.spriteOffsetX = pbVar3[0];
gPlayerEntity.base.spriteOffsetY = pbVar3[1] - 1;
gPlayerEntity.base.spritePriority.b1 = 0;
if (--this->unk_83 == 0) {
this->unk_83 = 0x41;
if (gSave.stats.rupees != 0) {
@ -245,14 +245,14 @@ void sub_080296C8(RupeeLikeEntity* this) {
void sub_080296D8(RupeeLikeEntity* this) {
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->unk_80;
gPlayerEntity.spriteOffsetY = 0;
gPlayerEntity.speed = 0x140;
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerEntity.base.zVelocity = Q_16_16(1.5);
gPlayerEntity.base.iframes = 0xa6;
gPlayerEntity.base.z.HALF.HI = -2;
gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2;
gPlayerEntity.base.spritePriority.b1 = this->unk_80;
gPlayerEntity.base.spriteOffsetY = 0;
gPlayerEntity.base.speed = 0x140;
super->action = 5;
super->subtimer = 60;
super->flags2 |= 3;

View File

@ -134,19 +134,19 @@ void sub_08033958(SpinyBeetleEntity* this) {
case 0:
if (this->unk_78 == 0)
return;
if (super->y.HALF.HI - gPlayerEntity.y.HALF.HI > 0x30)
if (super->y.HALF.HI - gPlayerEntity.base.y.HALF.HI > 0x30)
return;
break;
case 0x10:
if (gPlayerEntity.y.HALF.HI - super->y.HALF.HI > 0x30)
if (gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI > 0x30)
return;
break;
case 8:
if (gPlayerEntity.x.HALF.HI - super->x.HALF.HI > 0x30)
if (gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI > 0x30)
return;
break;
case 0x18:
if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI > 0x30)
if (super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI > 0x30)
return;
break;
}

View File

@ -170,7 +170,7 @@ void Stalfos_Init(StalfosEntity* this) {
} else {
super->action = 4;
super->direction = 0xff;
super->animationState = (((GetFacingDirection(super, &gPlayerEntity) + 4) & 0x18) >> 3);
super->animationState = (((GetFacingDirection(super, &gPlayerEntity.base) + 4) & 0x18) >> 3);
sub_0803981C(this);
}
}
@ -347,7 +347,7 @@ u32 sub_080398C0(StalfosEntity* this) {
u32 rand = Random();
if ((super->type == 0) && sub_08049FDC(super, 1) &&
(EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x58) != 0)) {
return GetFacingDirection(super, &gPlayerEntity);
return GetFacingDirection(super, &gPlayerEntity.base);
} else {
if ((sub_08049FA0(super) == 0) && ((rand & 7) != 0)) {
return sub_08049EE4(super);

View File

@ -1,13 +1,12 @@
#define ENT_DEPRECATED
#include "entity.h"
void sub_080451CC(Entity* this, Entity* other) {
void sub_080451CC(GenericEntity* this, GenericEntity* other) {
u8* pThis;
u8* pOther;
other->flags = this->flags & ~ENT_DID_INIT;
other->x.WORD = this->x.WORD;
other->y.WORD = this->y.WORD;
other->z.WORD = this->z.WORD;
other->base.flags = this->base.flags & ~ENT_DID_INIT;
other->base.x.WORD = this->base.x.WORD;
other->base.y.WORD = this->base.y.WORD;
other->base.z.WORD = this->base.z.WORD;
pThis = (u8*)&this->field_0x68;
pOther = (u8*)&other->field_0x68;

View File

@ -83,11 +83,11 @@ static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) {
s32 expectedStateX, expectedStateY;
s32 playerState;
if (gPlayerEntity.action != PLAYER_BOUNCE) {
if (gPlayerEntity.base.action != PLAYER_BOUNCE) {
return FALSE;
}
diff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI;
diff = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI;
expectedStateX = 6;
if (diff & 0x8000) {
expectedStateX = 2;
@ -98,7 +98,7 @@ static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) {
return FALSE;
}
diff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI;
diff = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI;
expectedStateY = 0;
if (diff & 0x8000) {
expectedStateY = 4;
@ -109,7 +109,7 @@ static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) {
return FALSE;
}
playerState = gPlayerEntity.animationState;
playerState = gPlayerEntity.base.animationState;
if ((playerState == 0 && expectedStateY == 0) || (playerState == 4 && expectedStateY == 4) ||
(playerState == 6 && expectedStateX == 6) || (playerState == 2 && expectedStateX == 2)) {
return TRUE;

View File

@ -555,8 +555,8 @@ static void sub_08042C34(VaatiArmEntity* this) {
super->subAction = 1;
random = Random() & 6;
temp = &gUnk_080D12F8[random];
x = gPlayerEntity.x.HALF.HI + *temp;
y = gPlayerEntity.y.HALF.HI + *(temp + 1);
x = gPlayerEntity.base.x.HALF.HI + *temp;
y = gPlayerEntity.base.y.HALF.HI + *(temp + 1);
if ((gRoomControls.origin_x + 0x20) > x) {
x = gRoomControls.origin_x + 0x20;
}
@ -693,7 +693,7 @@ static void sub_08042EF4(VaatiArmEntity* this) {
UpdateAnimationSingleFrame(super);
if (!sub_08043C98(this)) {
if (--super->timer == 0) {
if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x50)) {
super->subAction = 6;
super->timer = 40;
} else {

View File

@ -183,7 +183,7 @@ void VaatiEyesMacroFunction0Type2(VaatiEyesMacroEntity* this) {
super->animationState = 0xff;
}
CopyPositionAndSpriteOffset(super->parent, super);
uVar2 = (GetFacingDirection(super, &gPlayerEntity) + 1) & 0x1e;
uVar2 = (GetFacingDirection(super, &gPlayerEntity.base) + 1) & 0x1e;
temp = (xy*)&gUnk_080CDE70[uVar2];
if (temp->x != super->frameIndex) {
if (temp->y != super->frameIndex) {
@ -237,7 +237,7 @@ void sub_0802EFB8(VaatiEyesMacroEntity* this) {
if ((rand >> 0x10 & 3) != 0) {
uVar1 = rand & 0x18;
} else {
uVar3 = GetFacingDirection(&gPlayerEntity, super);
uVar3 = GetFacingDirection(&gPlayerEntity.base, super);
uVar1 = (uVar3 + 4) & 0x18;
}
iVar4 = sub_080B1B44(TILE(super->x.HALF.HI, super->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);

View File

@ -73,9 +73,9 @@ void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) {
super->action = 5;
COLLISION_OFF(super);
super->spritePriority.b1 = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.spriteOrientation.flipY = super->spriteOrientation.flipY;
gPlayerEntity.spriteRendering.b3 = super->spriteRendering.b3;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
gPlayerEntity.base.spriteOrientation.flipY = super->spriteOrientation.flipY;
gPlayerEntity.base.spriteRendering.b3 = super->spriteRendering.b3;
sub_0803E444(this);
#ifndef EU
SetPlayerControl(2);
@ -85,8 +85,8 @@ void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) {
}
} else {
gPlayerState.flags &= ~PL_DISABLE_ITEMS;
entity = &gPlayerEntity;
entity->flags = gPlayerEntity.flags | ENT_COLLIDE;
entity = &gPlayerEntity.base;
entity->flags = gPlayerEntity.base.flags | ENT_COLLIDE;
}
#endif
}
@ -174,7 +174,7 @@ void VaatiProjectileFunction0Action3(VaatiProjectileEntity* this) {
void VaatiProjectileFunction0Action4(VaatiProjectileEntity* this) {
if (--super->timer == 0) {
super->action = 1;
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
}
GetNextFrame(super);
}
@ -221,8 +221,8 @@ void VaatiProjectileFunction0Action8(VaatiProjectileEntity* this) {
}
void VaatiProjectileFunction0Action9(VaatiProjectileEntity* this) {
super->x.HALF.HI = gPlayerEntity.x.HALF.HI;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI;
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI;
if (super->z.HALF.HI < -8) {
if (super->animIndex != 2) {
super->timer = 0;
@ -239,7 +239,7 @@ void sub_0803E444(VaatiProjectileEntity* this) {
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
sub_0806FA90(super, super->contactedEntity, 0, -2);
gPlayerEntity.spriteOffsetY += 0xe;
gPlayerEntity.base.spriteOffsetY += 0xe;
}
void sub_0803E480(VaatiProjectileEntity* this) {
@ -284,7 +284,7 @@ void sub_0803E4D8(VaatiProjectileEntity* this) {
u32 tile;
tile = TILE(super->x.HALF.HI, super->y.HALF.HI + 8);
if (sub_080B1B44(tile, gPlayerEntity.collisionLayer) != 0xff) {
SetTile(0x4074, tile, gPlayerEntity.collisionLayer);
if (sub_080B1B44(tile, gPlayerEntity.base.collisionLayer) != 0xff) {
SetTile(0x4074, tile, gPlayerEntity.base.collisionLayer);
}
}

View File

@ -281,8 +281,8 @@ void VaatiRebornEnemyType0Action2(VaatiRebornEnemyEntity* this) {
if ((super->frame & ANIM_DONE) != 0) {
super->spriteSettings.draw = 1;
if (4 < this->unk_81) {
super->x.HALF.HI = gPlayerEntity.x.HALF.HI;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18;
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI - 0x18;
}
if (--this->unk_77 == 0) {
super->action = 1;
@ -364,7 +364,7 @@ void VaatiRebornEnemyType0Action4(VaatiRebornEnemyEntity* this) {
if ((super->frame & 0x10) != 0) {
super->frame &= 0xef;
if (this->unk_84 == 0xff) {
index = Direction8RoundUp(GetFacingDirection(super, &gPlayerEntity));
index = Direction8RoundUp(GetFacingDirection(super, &gPlayerEntity.base));
this->unk_84 = gUnk_080D04C0[index >> 2];
super->subtimer = 0;
}
@ -410,7 +410,7 @@ void VaatiRebornEnemyType0Action5(VaatiRebornEnemyEntity* this) {
if (!((this->unk_86 < 2) || (3 < this->unk_87)) && (Random() & 0x10) != 0) {
this->unk_87++;
super->subtimer = (Random() & 0x3f) + 64;
uVar3 = GetFacingDirection(super, &gPlayerEntity);
uVar3 = GetFacingDirection(super, &gPlayerEntity.base);
super->direction = (uVar3 & 0x10) | DirectionEast;
} else {
this->unk_74++;
@ -903,15 +903,15 @@ u32 sub_0803E028(VaatiRebornEnemyEntity* this) {
return ret;
}
tmp = gRoomControls.origin_x + 0x58;
if (tmp > gPlayerEntity.x.HALF.HI) {
if (tmp > gPlayerEntity.base.x.HALF.HI) {
return ret;
}
tmp = gRoomControls.origin_y + 0x58;
if (tmp > gPlayerEntity.x.HALF.HI) {
if (tmp > gPlayerEntity.base.x.HALF.HI) {
return ret;
}
tmp = gRoomControls.origin_y + 0xf8;
if (tmp >= gPlayerEntity.x.HALF.HI) {
if (tmp >= gPlayerEntity.base.x.HALF.HI) {
this->unk_81 += 5;
ret = 1;
}

View File

@ -676,7 +676,7 @@ void VaatiTransfiguredType2Action1(VaatiTransfiguredEntity* this) {
CopyPosition(super->parent, super);
switch (super->type2) {
case 2:
uVar3 = GetFacingDirection(super, &gPlayerEntity);
uVar3 = GetFacingDirection(super, &gPlayerEntity.base);
t = &gUnk_080D0B18[uVar3];
super->x.HALF.HI += t->x;
super->y.HALF.HI += t->y;

View File

@ -5,9 +5,9 @@
* @brief Vaati Wrath enemy
*/
#include "enemy/vaatiWrath.h"
#include "functions.h"
#include "message.h"
#include "new_player.h"
#include "object.h"
#include "save.h"
#include "screen.h"
@ -217,7 +217,7 @@ void VaatiWrathType0Action1(VaatiWrathEntity* this) {
super->subAction = 6;
super->timer = 30;
gRoomTransition.field_0x38 |= 1;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
gPlayerState.controlMode = CONTROL_1;
break;
default:
@ -421,7 +421,7 @@ void VaatiWrathType0Action9(VaatiWrathEntity* this) {
sub_08042214(this);
} else {
if (--super->timer == 0) {
if ((gPlayerEntity.x.HALF.HI - super->x.HALF.HI) + 0x40u < 0x81) {
if ((gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI) + 0x40u < 0x81) {
super->action = 10;
this->unk_7b = 0;
((VaatiWrathHeapStruct*)super->myHeap)->eyes[0]->timer = 1;
@ -588,7 +588,7 @@ void sub_08041BE8(VaatiWrathEntity* this) {
DeleteEntity(entity);
((VaatiWrathHeapStruct*)super->myHeap)->object5b = NULL;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
#endif
entity = ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0];
entity->myHeap = NULL;
@ -834,13 +834,13 @@ u32 sub_0804207C(VaatiWrathEntity* this) {
if (((arm != NULL) && (arm->action >= 5)) && EntityWithinDistance(arm, x, y, 0x30)) {
return CalculateDirectionTo(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
if (gPlayerEntity.y.HALF.HI < 0x40) {
if (gPlayerEntity.base.y.HALF.HI < 0x40) {
tmp = gRoomControls.origin_y + 0x18;
} else {
tmp = gPlayerEntity.y.HALF.HI - 0x28;
tmp = gPlayerEntity.base.y.HALF.HI - 0x28;
}
return CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.x.HALF.HI, tmp);
return CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.base.x.HALF.HI, tmp);
}
}
}
@ -860,12 +860,12 @@ void sub_0804212C(VaatiWrathEntity* this) {
}
arm = NULL;
y = super->y.HALF.HI - 0x44;
if (gPlayerEntity.y.HALF.HI - y < 0x61u) {
if (gPlayerEntity.base.y.HALF.HI - y < 0x61u) {
x = super->x.HALF.HI - 0x38;
if (gPlayerEntity.x.HALF.HI - x < 0x39u) {
if (gPlayerEntity.base.x.HALF.HI - x < 0x39u) {
arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[1];
} else {
if ((gPlayerEntity.x.HALF.HI - super->x.HALF.HI) < 0x39u) {
if ((gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI) < 0x39u) {
arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[0];
}
}
@ -1005,8 +1005,8 @@ void VaatiWrathType0PreAction(VaatiWrathEntity* this) {
case PL_STATE_IDLE:
case PL_STATE_WALK:
if (gPlayerState.item == NULL) {
if (gNewPlayerEntity.unk_7a == 0) {
if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) {
if (gPlayerEntity.unk_7a == 0) {
if ((gPlayerEntity.base.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) {
CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x70), 0);
gRoomTransition.field_0x38 |= 2;
}
@ -1054,7 +1054,7 @@ void VaatiWrathType2(VaatiWrathEntity* this) {
sub_0806FA90(((VaatiWrathHeapStruct*)super->myHeap)->type0, super, 0, -1);
super->spriteOffsetY++;
if (super->animIndex == 0x12) {
uVar1 = GetFacingDirection(super, &gPlayerEntity);
uVar1 = GetFacingDirection(super, &gPlayerEntity.base);
super->x.HALF.HI = gUnk_080D0EB0[uVar1] + super->x.HALF.HI;
}
}

View File

@ -42,9 +42,9 @@ void WallMaster_OnCollision(WallMasterEntity* this) {
if (super->hitType != 0x75 && ((super->contactFlags & 0x7f) == 0 || (super->contactFlags & 0x7f) == 0x1e)) {
super->action = 5;
COLLISION_OFF(super);
this->unk_7e = gPlayerEntity.x.HALF.HI;
this->unk_80 = gPlayerEntity.y.HALF.HI;
this->unk_82 = gPlayerEntity.z.HALF.HI;
this->unk_7e = gPlayerEntity.base.x.HALF.HI;
this->unk_80 = gPlayerEntity.base.y.HALF.HI;
this->unk_82 = gPlayerEntity.base.z.HALF.HI;
if (super->action != 3) {
InitializeAnimation(super, 1);
}
@ -150,12 +150,12 @@ void sub_0802A69C(WallMasterEntity* this) {
sub_0802A7D0(this);
gPlayerState.field_0xa |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerEntity.x.HALF.HI = this->unk_7e;
gPlayerEntity.y.HALF.HI = this->unk_80;
gPlayerEntity.z.HALF.HI = this->unk_82;
gPlayerEntity.base.x.HALF.HI = this->unk_7e;
gPlayerEntity.base.y.HALF.HI = this->unk_80;
gPlayerEntity.base.z.HALF.HI = this->unk_82;
if (gPlayerEntity.z.HALF.HI != super->z.HALF.HI) {
if (gPlayerEntity.z.HALF.HI < super->z.HALF.HI) {
if (gPlayerEntity.base.z.HALF.HI != super->z.HALF.HI) {
if (gPlayerEntity.base.z.HALF.HI < super->z.HALF.HI) {
super->z.HALF.HI--;
} else {
super->z.HALF.HI++;
@ -171,7 +171,7 @@ void sub_0802A69C(WallMasterEntity* this) {
} else if (super->frame & 0x1) {
super->frame = flags;
super->spriteOffsetY = 3;
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.base.spriteSettings.draw = 0;
}
}

View File

@ -49,7 +49,7 @@ void WallMaster2_OnCollision(WallMaster2Entity* this) {
super->action = 3;
COLLISION_OFF(super);
InitializeAnimation(super, 1);
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
break;
}
if (super->confusedTime != 0) {
@ -133,8 +133,8 @@ void sub_0802CE68(WallMaster2Entity* this) {
gPlayerState.field_0xa |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
super->direction = GetFacingDirection(super, &gPlayerEntity);
if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 4)) {
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
LinearMoveUpdate(super);
}
sub_0802CFD8(this);
@ -145,7 +145,7 @@ void sub_0802CE68(WallMaster2Entity* this) {
super->timer = 30;
} else if (super->frame & 1) {
super->frame = frames;
gPlayerEntity.spriteSettings.draw = 0;
gPlayerEntity.base.spriteSettings.draw = 0;
}
}

View File

@ -76,8 +76,8 @@ void sub_0802A334(Entity* this) {
}
void sub_0802A39C(Entity* this) {
u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3;
u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset - 10) >> 3;
u32 x = (gPlayerEntity.base.x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3;
u32 y = (gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset - 10) >> 3;
if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) {
COLLISION_OFF(this);
} else {

View File

@ -95,7 +95,7 @@ void WizzrobeFire_Action2(WizzrobeEntity* this) {
super->child->spriteSettings.draw = 0;
break;
case 6:
if (EntityInRectRadius(super, &gPlayerEntity, 0xa0, 0xa0) && CheckOnScreen(super)) {
if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) {
Entity* projectile = CreateProjectileWithParent(super, FIRE_PROJECTILE, 1);
if (projectile != NULL) {
projectile->direction = super->direction & 0x18;

View File

@ -102,7 +102,7 @@ void WizzrobeIce_Action2(WizzrobeEntity* this) {
super->child->spriteSettings.draw = 0;
break;
case 0xa:
if (EntityInRectRadius(super, &gPlayerEntity, 0xa0, 0xa0) && CheckOnScreen(super)) {
if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) {
Entity* projectile = CreateProjectileWithParent(super, ICE_PROJECTILE, 1);
if (projectile != NULL) {
projectile->direction = super->direction & 0x18;

View File

@ -118,7 +118,7 @@ void WizzrobeWind_Action2(WizzrobeEntity* this) {
super->parent->spriteSettings.draw = 0;
break;
case 8:
if (EntityInRectRadius(super, &gPlayerEntity, 0xa0, 0xa0) && CheckOnScreen(super)) {
if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) {
Entity* projectile = CreateProjectileWithParent(super, WIND_PROJECTILE, 1);
if (projectile != NULL) {
projectile->direction = super->direction & 0x18;

View File

@ -1,4 +1,3 @@
#define ENT_DEPRECATED
#include "area.h"
#include "common.h"
#include "functions.h"
@ -187,12 +186,12 @@ static void UpdatePriorityTimer(void) {
void SetPlayerEventPriority(void) {
gPriorityHandler.event_priority = PRIO_PLAYER_EVENT;
gPlayerEntity.updatePriority = PRIO_PLAYER_EVENT;
gPlayerEntity.base.updatePriority = PRIO_PLAYER_EVENT;
}
void ResetPlayerEventPriority(void) {
gPriorityHandler.event_priority = PRIO_MIN;
gPlayerEntity.updatePriority = PRIO_PLAYER;
gPlayerEntity.base.updatePriority = PRIO_PLAYER;
}
void RevokePriority(Entity* e) {
@ -237,7 +236,7 @@ void UpdateManagers(void) {
void EraseAllEntities(void) {
DeleteAllEntities();
MemClear(&gPriorityHandler, sizeof(PriorityHandler));
MemClear(&gPlayerEntity, 10880);
MemClear(&gPlayerEntity.base, 10880);
MemClear(&gUnk_02033290, 2048);
sub_0805E98C();
gEntCount = 0;
@ -249,9 +248,9 @@ void EraseAllEntities(void) {
Entity* GetEmptyEntity() {
u8 flags_ip;
Entity* end;
Entity* rv;
Entity* currentEnt;
GenericEntity* end;
GenericEntity* rv;
GenericEntity* currentEnt;
LinkedList* nextList;
LinkedList* listPtr;
@ -262,21 +261,21 @@ Entity* GetEmptyEntity() {
end = currentEnt + ARRAY_COUNT(gEntities);
do {
if (currentEnt->prev == 0) {
return currentEnt;
if (currentEnt->base.prev == 0) {
return &currentEnt->base;
}
} while (++currentEnt < end);
}
currentEnt = &gPlayerEntity;
currentEnt = (GenericEntity*)&gPlayerEntity.base;
do {
if ((s32)currentEnt->prev < 0 && (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2)) &&
currentEnt != gUpdateContext.current_entity) {
ClearDeletedEntity(currentEnt);
return currentEnt;
if ((s32)currentEnt->base.prev < 0 && (currentEnt->base.flags & (ENT_UNUSED1 | ENT_UNUSED2)) &&
(Entity*)currentEnt != gUpdateContext.current_entity) {
ClearDeletedEntity(&currentEnt->base);
return &currentEnt->base;
}
} while (++currentEnt < (Entity*)&gCarriedEntity);
} while (++currentEnt < (GenericEntity*)&gCarriedEntity);
flags_ip = 0;
rv = NULL;
@ -284,37 +283,35 @@ Entity* GetEmptyEntity() {
endListPtr = listPtr + ARRAY_COUNT(gEntityLists);
do {
currentEnt = listPtr->first;
currentEnt = (GenericEntity*)listPtr->first;
nextList = listPtr + 1;
while ((u32)currentEnt != (u32)listPtr) {
if (currentEnt->kind != MANAGER &&
flags_ip < (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED)) &&
gUpdateContext.current_entity != currentEnt) {
flags_ip = currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED);
if (currentEnt->base.kind != MANAGER &&
flags_ip < (currentEnt->base.flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED)) &&
gUpdateContext.current_entity != &currentEnt->base) {
flags_ip = currentEnt->base.flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED);
rv = currentEnt;
}
currentEnt = currentEnt->next;
currentEnt = (GenericEntity*)currentEnt->base.next;
}
listPtr = nextList;
} while (listPtr < endListPtr);
if (rv) {
DeleteEntity(rv);
ClearDeletedEntity(rv);
DeleteEntity(&rv->base);
ClearDeletedEntity(&rv->base);
}
return rv;
return &rv->base;
}
extern Entity gAuxPlayerEntities[7];
Entity* CreateAuxPlayerEntity(void) {
Entity* ent = gAuxPlayerEntities;
GenericEntity* ent = gAuxPlayerEntities;
do {
if (ent->prev == NULL) {
return ent;
if (ent->base.prev == NULL) {
return &ent->base;
}
} while (++ent < &gAuxPlayerEntities[7]);
@ -382,17 +379,17 @@ void DeleteEntity(Entity* ent) {
}
void ClearAllDeletedEntities(void) {
Entity* ent = &gPlayerEntity;
GenericEntity* ent = (GenericEntity*)&gPlayerEntity.base;
do {
//! @bug if prev pointed to a VALID location higher than a signed int, would still be deleted
if ((int)ent->prev < 0) {
ClearDeletedEntity(ent);
if ((int)ent->base.prev < 0) {
ClearDeletedEntity(&ent->base);
}
} while (ent++, ent < (&gPlayerEntity + 80));
} while (ent++, ent < (((GenericEntity*)&gPlayerEntity.base) + 80));
}
void ClearDeletedEntity(Entity* ent) {
DmaClear32(3, ent, sizeof(Entity));
DmaClear32(3, ent, sizeof(GenericEntity));
gEntCount--;
}

View File

@ -388,12 +388,12 @@ static void UpdateWindcrests(void) {
u32 hi_x, hi_y;
s32 x, y;
x = gPlayerEntity.x.HALF.HI;
x = gPlayerEntity.base.x.HALF.HI;
if (x < 0)
x += 0xf;
hi_x = x >> 4;
y = gPlayerEntity.y.HALF.HI;
y = gPlayerEntity.base.y.HALF.HI;
if (y < 0)
y += 0xf;
hi_y = y >> 4;

View File

@ -3,7 +3,6 @@
*
* @brief Game Utils
*/
#define ENT_DEPRECATED
#include "backgroundAnimations.h"
#include "enemy.h"
#include "entity.h"
@ -113,9 +112,9 @@ void InitializePlayer(void) {
MemClear(&gActiveItems, sizeof(gActiveItems));
MemClear(&gPlayerState, sizeof(gPlayerState));
MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof(gPlayerState.path_memory));
MemClear(&gPlayerEntity, sizeof(gPlayerEntity));
MemClear(&gPlayerEntity.base, sizeof(gPlayerEntity));
pl = &gPlayerEntity;
pl = &gPlayerEntity.base;
gRoomControls.camera_target = pl;
gPlayerState.queued_action = sPlayerSpawnStates[gRoomTransition.player_status.spawn_type];
@ -211,7 +210,7 @@ s32 ModHealth(s32 delta) {
newHealth = stats->maxHealth;
}
stats->health = newHealth;
gPlayerEntity.health = newHealth;
gPlayerEntity.base.health = newHealth;
return newHealth;
}
@ -387,8 +386,8 @@ u32 StairsAreValid(void) {
void InitParachuteRoom(void) {
gRoomTransition.transitioningOut = 1;
gRoomTransition.player_status.start_pos_x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) & 0x3F8;
gRoomTransition.player_status.start_pos_y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) & 0x3F8;
gRoomTransition.player_status.start_pos_x = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) & 0x3F8;
gRoomTransition.player_status.start_pos_y = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) & 0x3F8;
gRoomTransition.player_status.start_anim = 4;
gRoomTransition.player_status.spawn_type = PL_SPAWN_PARACHUTE_FORWARD;
gRoomTransition.player_status.area_next = gRoomControls.area;
@ -434,10 +433,10 @@ bool32 CanDispEzloMessage(void) {
return FALSE;
if ((gPlayerState.flags & (PL_NO_CAP | PL_CAPTURED | PL_DISABLE_ITEMS)) || (gPlayerState.framestate_last > tmp) ||
gPlayerState.item || gPlayerEntity.field_0x7a.HWORD)
gPlayerState.item || gPlayerEntity.unk_7a)
return FALSE;
if ((gPlayerEntity.z.HALF.HI & 0x8000) && !gPlayerState.field_0xa)
if ((gPlayerEntity.base.z.HALF.HI & 0x8000) && !gPlayerState.field_0xa)
return FALSE;
GenerateAreaHint();
@ -450,7 +449,7 @@ void DisplayEzloMessage(void) {
u32 height;
u32 idx;
if (gRoomTransition.hint_height == 0) {
height = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y > 96 ? 1 : 13;
height = gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y > 96 ? 1 : 13;
} else {
height = gRoomTransition.hint_height;
}
@ -489,11 +488,11 @@ void DecreasePortalTimer(void) {
void UpdatePlayerMapCoords(void) {
if (!AreaHasNoEnemies()) {
if (AreaIsOverworld()) {
gRoomTransition.player_status.overworld_map_x = gPlayerEntity.x.HALF_U.HI;
gRoomTransition.player_status.overworld_map_y = gPlayerEntity.y.HALF_U.HI;
gRoomTransition.player_status.overworld_map_x = gPlayerEntity.base.x.HALF_U.HI;
gRoomTransition.player_status.overworld_map_y = gPlayerEntity.base.y.HALF_U.HI;
} else if (AreaIsDungeon()) {
gRoomTransition.player_status.dungeon_map_x = gPlayerEntity.x.HALF.HI;
gRoomTransition.player_status.dungeon_map_y = gPlayerEntity.y.HALF.HI;
gRoomTransition.player_status.dungeon_map_x = gPlayerEntity.base.x.HALF.HI;
gRoomTransition.player_status.dungeon_map_y = gPlayerEntity.base.y.HALF.HI;
}
}
}
@ -739,25 +738,25 @@ void CheckAreaDiscovery(void) {
}
void UpdatePlayerRoomStatus(void) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
gPlayerState.startPosX = gPlayerEntity.base.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.base.y.HALF.HI;
if (sub_08053144()) {
MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status);
if (AreaIsDungeon()) {
gRoomTransition.player_status.dungeon_area = gRoomControls.area;
gRoomTransition.player_status.dungeon_room = gRoomControls.room;
gRoomTransition.player_status.dungeon_x = gPlayerEntity.x.HALF.HI;
gRoomTransition.player_status.dungeon_y = gPlayerEntity.y.HALF.HI;
gRoomTransition.player_status.dungeon_x = gPlayerEntity.base.x.HALF.HI;
gRoomTransition.player_status.dungeon_y = gPlayerEntity.base.y.HALF.HI;
}
}
}
void sub_08053250(void) {
gRoomTransition.player_status.spawn_type = PL_SPAWN_DEFAULT;
gRoomTransition.player_status.start_pos_x = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x;
gRoomTransition.player_status.start_pos_y = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
gRoomTransition.player_status.start_anim = gPlayerEntity.animationState;
gRoomTransition.player_status.layer = gPlayerEntity.collisionLayer;
gRoomTransition.player_status.start_pos_x = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x;
gRoomTransition.player_status.start_pos_y = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y;
gRoomTransition.player_status.start_anim = gPlayerEntity.base.animationState;
gRoomTransition.player_status.layer = gPlayerEntity.base.collisionLayer;
gRoomTransition.player_status.area_next = gRoomControls.area;
gRoomTransition.player_status.room_next = gRoomControls.room;
MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status);

View File

@ -1,4 +1,3 @@
#define ENT_DEPRECATED
#include "functions.h"
#include "gba/m4a.h"
#include "global.h"
@ -237,7 +236,7 @@ static void HandlePlayerLife(Entity* this) {
gUnk_0200AF00.rActionInteractTile = R_ACTION_NONE;
gUnk_0200AF00.rActionGrabbing = R_ACTION_NONE;
if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0))
if ((gPlayerEntity.base.contactFlags & 0x80) && (gPlayerEntity.base.iframes > 0))
SoundReq(SFX_86);
gPlayerState.flags &= ~(PL_FALLING | PL_CONVEYOR_PUSHED);
@ -320,15 +319,15 @@ static void sub_080171F0(void) {
ResetActiveItems();
if (gPlayerState.field_0x14 != 0)
gPlayerState.field_0x14--;
if (gPlayerEntity.field_0x7a.HWORD != 0)
gPlayerEntity.field_0x7a.HWORD--;
if (gPlayerEntity.unk_7a != 0)
gPlayerEntity.unk_7a--;
gPlayerEntity.contactFlags &= ~0x80;
if (gPlayerEntity.action != PLAYER_DROWN)
gPlayerEntity.base.contactFlags &= ~0x80;
if (gPlayerEntity.base.action != PLAYER_DROWN)
COPY_FLAG_FROM_TO(gPlayerState.flags, 0x2, 0x10000);
gPlayerState.flags &= ~PL_FLAGS2;
sub_080028E0(&gPlayerEntity);
sub_080028E0(&gPlayerEntity.base);
if (gPlayerState.flags & PL_CLONING)
gUnk_0200AF00.rActionPlayerState = R_ACTION_CANCEL;
@ -341,23 +340,23 @@ static void sub_080171F0(void) {
gPlayerState.speed_modifier = 0;
gPlayerState.attachedBeetleCount = 0;
MemClear(&gCarriedEntity, sizeof(gCarriedEntity));
gPlayerEntity.spriteOffsetY = gPlayerState.spriteOffsetY;
gPlayerEntity.base.spriteOffsetY = gPlayerState.spriteOffsetY;
gPlayerState.spriteOffsetY = 0;
sub_0807B0C8();
if (gPlayerState.flags & PL_CLONING)
gPlayerClones[0]->spriteOffsetY = gPlayerClones[1]->spriteOffsetY = gPlayerClones[2]->spriteOffsetY = 0;
if (gPlayerEntity.action == PLAYER_CLIMB)
if (gPlayerEntity.base.action == PLAYER_CLIMB)
gPlayerState.flags |= PL_CLIMBING;
else
gPlayerState.flags &= ~PL_CLIMBING;
sub_0807A8D8(&gPlayerEntity);
sub_0807A8D8(&gPlayerEntity.base);
if (gPlayerState.jump_status & 0xc0)
gPlayerEntity.iframes = 0xfe;
gPlayerEntity.base.iframes = 0xfe;
if (gPlayerEntity.action != PLAYER_ROOMTRANSITION) {
sub_08077FEC(gPlayerEntity.action);
if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION) {
sub_08077FEC(gPlayerEntity.base.action);
}
}

View File

@ -38,8 +38,8 @@ void sub_08075FF8(ItemBehavior* this, u32 index) {
if (maxBombs > bombCount) {
entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_BOMB);
if (entity != NULL) {
pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6];
PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[1]));
pos = &gUnk_0811BDAC[gPlayerEntity.base.animationState & 6];
PositionRelative(&gPlayerEntity.base, entity, Q_16_16(pos[0]), Q_16_16(pos[1]));
ModBombs(-1);
SoundReq(SFX_PLACE_OBJ);
}

View File

@ -15,7 +15,7 @@ void ItemBoomerang(ItemBehavior* this, u32 index) {
void sub_08075D2C(ItemBehavior* this, u32 index) {
if (((gPlayerState.attack_status & 8) == 0) && (FindPlayerItemForItem(this, this->behaviorId) == NULL)) {
this->priority |= 0xf;
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
CreatePlayerItemIfNotExists(this, ITEM_BOOMERANG);
sub_08077D38(this, index);
gPlayerState.attack_status |= 8;

View File

@ -19,7 +19,7 @@ void ItemBow(ItemBehavior* this, u32 index) {
void sub_08075DF4(ItemBehavior* this, u32 index) {
if ((gPlayerState.attack_status & 8) == 0) {
this->priority |= 0x80;
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
sub_08077BB8(this);
sub_08077D38(this, index);
gPlayerState.bow_state = 1;

View File

@ -1,7 +1,6 @@
#include "entity.h"
#include "functions.h"
#include "item.h"
#include "new_player.h"
#include "playeritem.h"
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* this, u32);
@ -12,15 +11,15 @@ void ItemGustJar(ItemBehavior* this, u32 index) {
}
void sub_08076DF4(ItemBehavior* this, u32 index) {
if (GetCollisionTileInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
if (GetCollisionTileInFront(&gPlayerEntity.base) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, index);
this->timer = 0;
this->playerAnimationState = gPlayerEntity.animationState;
this->playerAnimationState = gPlayerEntity.base.animationState;
this->priority |= 0x80;
this->priority++;
gPlayerState.gustJarSpeed = 1;
gNewPlayerEntity.unk_74 = NULL;
gPlayerEntity.unk_74 = NULL;
gPlayerState.field_0x1c = 1;
sub_08077BB8(this);
} else {
@ -40,7 +39,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0);
if (playerItem != NULL) {
playerItem->parent = &gPlayerEntity;
playerItem->parent = &gPlayerEntity.base;
}
} else {
UpdateItemAnim(this);
@ -63,7 +62,7 @@ void sub_08076EC8(ItemBehavior* this, u32 index) {
gPlayerState.gustJarSpeed = 1;
}
if (gPlayerEntity.subAction == 0x1b) {
if (gPlayerEntity.base.subAction == 0x1b) {
animIndex = ANIM_GUSTJAR_524;
} else {
if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) {
@ -95,7 +94,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
this->subtimer = 0;
this->timer = 0;
gPlayerState.gustJarSpeed = 1;
player = &gNewPlayerEntity;
player = &gPlayerEntity;
player->unk_74 = NULL;
gPlayerState.field_0x1c = 1;
gPlayerState.field_0xa &= ~(8 >> index);
@ -119,9 +118,9 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((gPlayerState.flags & PL_FLAGS2))
return;
gPlayerEntity.direction =
DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.animationState));
gPlayerEntity.speed = 0x80;
gPlayerEntity.base.direction =
DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.base.animationState));
gPlayerEntity.base.speed = 0x80;
UpdatePlayerMovement();
return;
@ -137,7 +136,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if (this->playerFrame & 1) {
gPlayerState.field_0x1c = 5;
gNewPlayerEntity.unk_70 = NULL;
gPlayerEntity.unk_70 = NULL;
if (gPlayerState.gustJarSpeed) {
CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
}
@ -145,8 +144,9 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
if (gPlayerState.flags & PL_FLAGS2)
return;
gPlayerEntity.direction = DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.animationState));
gPlayerEntity.speed = 0x80;
gPlayerEntity.base.direction =
DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.base.animationState));
gPlayerEntity.base.speed = 0x80;
UpdatePlayerMovement();
return;
case 6:
@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
break;
}
gPlayerState.field_0x1c = 0;
gNewPlayerEntity.unk_70 = NULL;
gPlayerEntity.unk_70 = NULL;
DeleteItemBehavior(this, index);
}

View File

@ -20,7 +20,7 @@ void ItemJarEmpty(ItemBehavior* this, u32 index) {
void sub_08077534(ItemBehavior* this, u32 index) {
u32 tmp;
sub_08077D38(this, index);
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
sub_08077BB8(this);
this->priority |= 0xf;
tmp = this->behaviorId;
@ -41,8 +41,8 @@ void sub_08077534(ItemBehavior* this, u32 index) {
case ITEM_BOTTLE_PICOLYTE_BLUE:
case ITEM_BOTTLE_PICOLYTE_WHITE:
this->stateID = 3;
gPlayerEntity.animationState = 4;
gPlayerEntity.spriteSettings.flipX = 0;
gPlayerEntity.base.animationState = 4;
gPlayerEntity.base.spriteSettings.flipX = 0;
SetItemAnim(this, ANIM_BOTTLE_DRINK);
break;
case BOTTLE_CHARM_NAYRU:
@ -53,7 +53,7 @@ void sub_08077534(ItemBehavior* this, u32 index) {
SetItemAnim(this, ANIM_BOTTLE_POUR);
break;
}
gPlayerEntity.flags &= ~ENT_COLLIDE;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
}
void sub_08077618(ItemBehavior* this, u32 index) {
@ -68,7 +68,7 @@ void sub_08077618(ItemBehavior* this, u32 index) {
void sub_08077640(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.base.flags |= ENT_COLLIDE;
DeleteItemBehavior(this, index);
}
}
@ -76,7 +76,7 @@ void sub_08077640(ItemBehavior* this, u32 index) {
void sub_0807766C(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.base.flags |= ENT_COLLIDE;
DeleteItemBehavior(this, index);
}
}

View File

@ -1,7 +1,6 @@
#include "functions.h"
#include "game.h"
#include "item.h"
#include "new_player.h"
#include "object.h"
#include "sound.h"
@ -38,13 +37,13 @@ void sub_08075A0C(ItemBehavior* this, u32 index) {
this->priority |= 0x80;
sub_08077D38(this, index);
CreatePlayerItemForItemIfNotExists(this);
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
this->behaviorId = 0x10;
ForceEquipItem(ITEM_LANTERN_ON, equipSlot);
tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6];
object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0);
tmp = &gUnk_08126EEC[gPlayerEntity.base.animationState & 6];
object = CreateObjectWithParent(&gPlayerEntity.base, LAMP_PARTICLE, 1, 0);
if (object != NULL) {
object->spriteVramOffset = gPlayerEntity.spriteVramOffset;
object->spriteVramOffset = gPlayerEntity.base.spriteVramOffset;
object->x.HALF.HI = tmp[0] + object->x.HALF.HI;
object->y.HALF.HI = tmp[1] + object->y.HALF.HI;
}
@ -89,19 +88,19 @@ void sub_08075B54(ItemBehavior* this, u32 index) {
DeleteItemBehavior(this, index);
SoundReq(SFX_ITEM_LANTERN_OFF);
} else {
if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.frameIndex < 0x37)) &&
((u16)gPlayerEntity.spriteIndex == 6)) {
tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6];
if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.base.frameIndex < 0x37)) &&
((u16)gPlayerEntity.base.spriteIndex == 6)) {
tmp = &gUnk_08126EEC[gPlayerEntity.base.animationState & 6];
if ((gPlayerState.jump_status == 0) &&
(sub_080B1BA4(TILE(gPlayerEntity.x.HALF.HI + tmp[0], gPlayerEntity.y.HALF.HI + tmp[1]),
gPlayerEntity.collisionLayer, 0x40) != 0)) {
(sub_080B1BA4(TILE(gPlayerEntity.base.x.HALF.HI + tmp[0], gPlayerEntity.base.y.HALF.HI + tmp[1]),
gPlayerEntity.base.collisionLayer, 0x40) != 0)) {
this->animPriority = 0xf;
this->stateID++;
gNewPlayerEntity.unk_7a = 2;
object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0);
gPlayerEntity.unk_7a = 2;
object = CreateObjectWithParent(&gPlayerEntity.base, LAMP_PARTICLE, 1, 0);
if (object != NULL) {
object->spriteVramOffset = gPlayerEntity.spriteVramOffset;
object->spriteVramOffset = gPlayerEntity.base.spriteVramOffset;
object->x.HALF.HI = tmp[0] + object->x.HALF.HI;
object->y.HALF.HI = tmp[1] + object->y.HALF.HI;
}
@ -120,8 +119,8 @@ void sub_08075C9C(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x10) != 0) {
tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6];
sub_0807AB44(&gPlayerEntity, tmp[0], tmp[1]);
tmp = &gUnk_08126EEC[gPlayerEntity.base.animationState & 6];
sub_0807AB44(&gPlayerEntity.base, tmp[0], tmp[1]);
}
if ((this->playerFrame & 0x80) != 0) {
this->animPriority = 0;
@ -129,6 +128,6 @@ void sub_08075C9C(ItemBehavior* this, u32 index) {
gPlayerState.field_0xa = (~(8 >> index)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> index)) & gPlayerState.keepFacing;
} else {
gNewPlayerEntity.unk_7a++;
gPlayerEntity.unk_7a++;
}
}

View File

@ -37,10 +37,10 @@ void sub_08077130(ItemBehavior* this, u32 index) {
SetItemAnim(this, ANIM_MOLEMITTS_DIG);
this->stateID = 2;
if (iVar1 == 0x56) {
if ((gPlayerEntity.animationState & 2) != 0) {
gPlayerEntity.y.HALF.HI = (gPlayerEntity.y.HALF.HI & 0xfff0) | 6;
if ((gPlayerEntity.base.animationState & 2) != 0) {
gPlayerEntity.base.y.HALF.HI = (gPlayerEntity.base.y.HALF.HI & 0xfff0) | 6;
} else {
gPlayerEntity.x.HALF.HI = (gPlayerEntity.x.HALF.HI & 0xfff0) | 8;
gPlayerEntity.base.x.HALF.HI = (gPlayerEntity.base.x.HALF.HI & 0xfff0) | 8;
}
}
}
@ -67,22 +67,22 @@ void sub_080771C8(ItemBehavior* this, u32 index) {
gPlayerState.moleMittsState = 0;
} else {
if (((this->playerFrame & 0x20) != 0) && (this->subtimer == 0xff)) {
CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 1);
CreateObjectWithParent(&gPlayerEntity.base, MOLE_MITTS_PARTICLE, this->playerFrame, 1);
}
if ((this->playerFrame & 0x10) != 0) {
if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) {
if (sub_0800875A(&gPlayerEntity.base, 0xd, this) == 0) {
SetItemAnim(this, ANIM_MOLEMITTS_MISS);
this->stateID = 3;
SoundReq(SFX_ITEM_GLOVES_AIR);
} else {
if (this->subtimer != 0xff) {
object = CreateObjectWithParent(&gPlayerEntity, OBJECT_1F, 0, this->field_0x2[1]);
object = CreateObjectWithParent(&gPlayerEntity.base, OBJECT_1F, 0, this->field_0x2[1]);
if (object != NULL) {
object->timer = this->timer;
object->subtimer = this->subtimer;
object->animationState = gPlayerEntity.animationState & 6;
gPlayerEntity.frame = 0;
gPlayerEntity.frameDuration = gUnk_0811BE14[this->subtimer];
object->animationState = gPlayerEntity.base.animationState & 6;
gPlayerEntity.base.frame = 0;
gPlayerEntity.base.frameDuration = gUnk_0811BE14[this->subtimer];
}
} else {
if ((this->field_0x2[1] == 0x0f) && (this->timer == 0x17)) {
@ -110,22 +110,22 @@ void sub_080772A8(ItemBehavior* this, u32 index) {
if (GetInventoryValue(ITEM_DIG_BUTTERFLY) == 1) {
if ((this->playerFrame & 7) != 3) {
sub_08077E3C(this, 2);
gPlayerEntity.speed = gUnk_0811BE16[this->playerFrame & 7] << 1;
gPlayerEntity.base.speed = gUnk_0811BE16[this->playerFrame & 7] << 1;
} else {
UpdateItemAnim(this);
gPlayerEntity.speed = gUnk_0811BE16[this->playerFrame & 7];
gPlayerEntity.base.speed = gUnk_0811BE16[this->playerFrame & 7];
}
} else {
UpdateItemAnim(this);
gPlayerEntity.speed = gUnk_0811BE16[this->playerFrame & 7];
gPlayerEntity.base.speed = gUnk_0811BE16[this->playerFrame & 7];
}
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
if (gPlayerEntity.speed != 0) {
gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2;
if (gPlayerEntity.base.speed != 0) {
UpdatePlayerMovement();
}
if ((this->playerFrame & 0x10) != 0) {
if (this->timer != 0) {
gPlayerEntity.frameDuration = 1;
gPlayerEntity.base.frameDuration = 1;
if (sub_080774A0()) {
this->timer = 0;
return;
@ -135,21 +135,21 @@ void sub_080772A8(ItemBehavior* this, u32 index) {
gPlayerState.moleMittsState = 0;
} else {
if ((this->playerFrame & 0x60) != 0) {
gPlayerEntity.frameDuration = 1;
if (sub_0807B5B0(&gPlayerEntity)) {
gPlayerEntity.base.frameDuration = 1;
if (sub_0807B5B0(&gPlayerEntity.base)) {
SoundReq(SFX_108);
CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0);
CreateObjectWithParent(&gPlayerEntity.base, MOLE_MITTS_PARTICLE, this->playerFrame, 0);
} else {
SetItemAnim(this, ANIM_MOLEMITTS_CLANG);
effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0);
effect = CreateFx(&gPlayerEntity.base, FX_STARS_STRIKE, 0);
if (effect != NULL) {
effect->animationState = this->playerAnimationState;
effect->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1;
effect->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1;
}
effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0);
effect = CreateFx(&gPlayerEntity.base, FX_STARS_STRIKE, 0);
if (effect != NULL) {
effect->animationState = this->playerAnimationState;
effect->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1;
effect->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1;
effect->subtimer = 1;
}
this->stateID = 3;
@ -161,8 +161,8 @@ void sub_080772A8(ItemBehavior* this, u32 index) {
}
void sub_08077448(ItemBehavior* this, u32 index) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10;
gPlayerEntity.speed = 0x100;
gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2 ^ 0x10;
gPlayerEntity.base.speed = 0x100;
if (((this->playerFrame & 1) != 0) && (this->field_0x5 != 0)) {
UpdatePlayerMovement();
}
@ -178,16 +178,16 @@ s32 sub_080774A0(void) {
u32 iVar2;
u32 uVar3;
uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity), -gUnk_0811BE1E[gPlayerEntity.animationState & 6],
-gUnk_0811BE1E[(gPlayerEntity.animationState & 6) + 1]);
uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity.base), -gUnk_0811BE1E[gPlayerEntity.base.animationState & 6],
-gUnk_0811BE1E[(gPlayerEntity.base.animationState & 6) + 1]);
iVar2 = sub_080B1B44(uVar3, gPlayerEntity.collisionLayer);
iVar2 = sub_080B1B44(uVar3, gPlayerEntity.base.collisionLayer);
if (iVar2 > 0x16)
return 0;
if (iVar2 < 0xf)
return 0;
if (sub_080B1AE0(uVar3, gPlayerEntity.collisionLayer) != 0x56) {
if (sub_080B1AE0(uVar3, gPlayerEntity.base.collisionLayer) != 0x56) {
return 1;
} else {
return 0x56;

View File

@ -1,6 +1,5 @@
#include "functions.h"
#include "item.h"
#include "new_player.h"
#include "sound.h"
extern void ResetPlayerVelocity(void);
@ -14,7 +13,7 @@ void ItemOcarina(ItemBehavior* this, u32 index) {
OcarinaUpdate,
};
gOcarinaStates[this->stateID](this, index);
gNewPlayerEntity.unk_7a++;
gPlayerEntity.unk_7a++;
}
void OcarinaUse(ItemBehavior* this, u32 index) {
@ -22,10 +21,10 @@ void OcarinaUse(ItemBehavior* this, u32 index) {
DeleteItemBehavior(this, index);
} else {
this->priority |= 0xf;
gPlayerEntity.animationState = 0x04;
gPlayerEntity.spriteSettings.flipX = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
gNewPlayerEntity.unk_7a = 2;
gPlayerEntity.base.animationState = 0x04;
gPlayerEntity.base.spriteSettings.flipX = 0;
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
gPlayerEntity.unk_7a = 2;
gPlayerState.flags |= PL_USE_OCARINA;
gPlayerState.field_0x27[0] = -1;
gPauseMenuOptions.disabled = 1;
@ -41,11 +40,11 @@ void OcarinaUse(ItemBehavior* this, u32 index) {
void OcarinaUpdate(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerState.flags &= ~PL_USE_OCARINA;
gPlayerState.field_0x27[0] = 0;
gPauseMenuOptions.disabled = 0;
CreateBird(&gPlayerEntity);
CreateBird(&gPlayerEntity.base);
ResetPlayerEventPriority();
DeleteItemBehavior(this, index);
}

View File

@ -18,7 +18,7 @@ void ItemPacciCane(ItemBehavior* this, u32 index) {
void sub_08076C98(ItemBehavior* this, u32 index) {
this->priority |= 0xf;
sub_08077D38(this, index);
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
sub_08077BB8(this);
}

View File

@ -1,4 +1,3 @@
#define ENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "functions.h"
@ -25,7 +24,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 index) {
Entity* fx;
u32 uVar4;
if (gPlayerEntity.field_0x7a.HWORD != 0) {
if (gPlayerEntity.unk_7a != 0) {
gPlayerState.dash_state = 0;
gPlayerState.itemAnimPriority = 0;
DeleteItemBehavior(this, index);
@ -36,11 +35,11 @@ void ItemPegasusBoots(ItemBehavior* this, u32 index) {
}
if (((gPlayerState.flags & PL_MINISH) == 0) && ((this->timer & 7) == 0)) {
if (gPlayerState.floor_type == SURFACE_SWAMP) {
if (gPlayerEntity.spriteOffsetY == 0) {
CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0);
if (gPlayerEntity.base.spriteOffsetY == 0) {
CreateFx(&gPlayerEntity.base, FX_GREEN_SPLASH, 0);
}
} else {
fx = CreateFx(&gPlayerEntity, FX_DASH, 0x40);
fx = CreateFx(&gPlayerEntity.base, FX_DASH, 0x40);
if ((fx != NULL) && (fx->y.HALF.HI = fx->y.HALF.HI + 2, this->stateID != 2)) {
uVar4 = Random() & 3;
if ((Random() & 1) != 0) {
@ -86,7 +85,7 @@ void sub_080768F8(ItemBehavior* this, u32 index) {
void sub_08076964(ItemBehavior* this, u32 index) {
Entity* entity;
u32 uVar3;
if (IsItemActive(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) {
if (IsItemActive(this) && gPlayerEntity.base.z.WORD == 0 && gPlayerState.dash_state) {
UpdateItemAnim(this);
if ((gPlayerState.flags & PL_MINISH) == 0) {
@ -113,7 +112,7 @@ void sub_08076964(ItemBehavior* this, u32 index) {
} else {
uVar3 = gSave.stats.equipped[SLOT_B];
}
entity->field_0x68.HALF.LO = uVar3;
((GenericEntity*)entity)->field_0x68.HALF.LO = uVar3;
return;
}
} else if (!(gPlayerState.flags & PL_MINISH)) {
@ -138,16 +137,16 @@ void sub_08076A88(ItemBehavior* this, u32 index) {
if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) {
if (!(gPlayerState.flags & PL_MINISH)) {
gPlayerEntity.speed = 0x300;
gPlayerEntity.base.speed = 0x300;
} else {
gPlayerEntity.speed = 0x280;
gPlayerEntity.base.speed = 0x280;
}
uVar2 = gUnk_0800275C[(gPlayerEntity.animationState & 0xe) * 4];
if (uVar2 == (gPlayerEntity.collisions & uVar2)) {
uVar2 = gUnk_0800275C[(gPlayerEntity.base.animationState & 0xe) * 4];
if (uVar2 == (gPlayerEntity.base.collisions & uVar2)) {
if (this->subtimer != 0) {
gPlayerEntity.action = PLAYER_BOUNCE;
gPlayerEntity.subAction = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerEntity.base.action = PLAYER_BOUNCE;
gPlayerEntity.base.subAction = 0;
COLLISION_OFF(&gPlayerEntity.base);
gPlayerState.field_0x38 = 0;
gPlayerState.direction = DIR_NONE;
return;
@ -156,7 +155,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) {
return;
}
ptr = gUnk_0811BE38;
if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) {
if ((*(u16*)&ptr[(gPlayerEntity.base.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) {
this->direction = (this->playerAnimationState & 0xe) * 4;
if ((gPlayerState.direction != DIR_NONE) && (gPlayerState.direction != this->direction)) {
if (((gPlayerState.direction - this->direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast |

View File

@ -1,6 +1,5 @@
#include "functions.h"
#include "item.h"
#include "new_player.h"
#include "sound.h"
void sub_08076758(ItemBehavior*, u32);
@ -15,16 +14,16 @@ void ItemRocsCape(ItemBehavior* this, u32 index) {
if (gPlayerState.grab_status) {
if (((gPlayerState.attack_status | gPlayerState.heldObject) == 0) &&
(((gPlayerState.floor_type != SURFACE_DOOR && (gPlayerState.floor_type != SURFACE_PIT)) ||
((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) {
((gPlayerEntity.base.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) {
if ((gPlayerState.jump_status == 0) || ((gPlayerState.jump_status & 7) == 3)) {
if (-1 < gPlayerEntity.z.WORD) {
if (-1 < gPlayerEntity.base.z.WORD) {
gPlayerState.grab_status = 0;
this->stateID++;
gPlayerState.keepFacing = 0;
gPlayerState.jump_status = 1;
gPlayerState.itemAnimPriority = -1;
gPlayerState.item = NULL;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.base.zVelocity = Q_16_16(2.0);
sub_08077F84();
SoundReq(SFX_PLY_VO4);
return;
@ -39,13 +38,13 @@ void ItemRocsCape(ItemBehavior* this, u32 index) {
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.moleMittsState) == 0) &&
((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 &&
gPlayerState.floor_type != SURFACE_PIT) ||
(gPlayerEntity.z.WORD != 0)) ||
(gPlayerEntity.base.z.WORD != 0)) ||
(gPlayerState.field_0x14 != 0)))) {
if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3)) {
sub_08076758(this, index);
return;
} else if (gPlayerEntity.z.WORD >= 0) {
gPlayerEntity.zVelocity = Q_16_16(2.0);
} else if (gPlayerEntity.base.z.WORD >= 0) {
gPlayerEntity.base.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status = 1;
gPlayerState.item = NULL;
this->stateID++;
@ -65,20 +64,20 @@ void sub_08076758(ItemBehavior* this, u32 index) {
((gPlayerState.jump_status & 7) != 3)) {
if (IsItemActive(this)) {
if (this->stateID < 2) {
if ((gPlayerEntity.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) {
if ((gPlayerEntity.base.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) {
this->stateID = 2;
gNewPlayerEntity.unk_7a = 2;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.unk_7a = 2;
gPlayerEntity.base.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status |= 0x10;
gPlayerState.animation = ANIM_ROCS_CAPE;
SoundReq(SFX_172);
}
} else {
gNewPlayerEntity.unk_7a++;
gPlayerEntity.unk_7a++;
}
} else {
if (this->stateID > 1) {
gNewPlayerEntity.unk_7a++;
gPlayerEntity.unk_7a++;
gPlayerState.jump_status &= 0xef;
}
}

View File

@ -20,7 +20,7 @@ void ItemShield(ItemBehavior* this, u32 index) {
void sub_08076D04(ItemBehavior* this, u32 index) {
gPlayerState.shield_status = 0x81;
this->priority = 2;
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
sub_08077D38(this, index);
sub_08077BB8(this);
}

View File

@ -38,8 +38,8 @@ void sub_08075338(ItemBehavior* this, u32 index) {
if (gPlayerState.jump_status) {
if ((gPlayerState.jump_status & 7) != 3) {
if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity < Q_16_16(1.5) &&
(gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD != 0) {
if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.base.zVelocity < Q_16_16(1.5) &&
(gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.base.z.WORD != 0) {
gPlayerState.jump_status |= 0x20;
gPlayerState.lastSwordMove = SWORD_MOVE_DOWN_THRUST;
gPlayerState.attack_status |= (8 >> index) | ((8 >> index) << 4);
@ -52,7 +52,7 @@ void sub_08075338(ItemBehavior* this, u32 index) {
#ifndef EU
sub_080759B8(this, index);
return;
} else if (gPlayerEntity.z.WORD) {
} else if (gPlayerEntity.base.z.WORD) {
#endif
sub_080759B8(this, index);
return;
@ -87,7 +87,7 @@ void sub_08075338(ItemBehavior* this, u32 index) {
if ((gPlayerState.sword_state & 0x80) == 0) {
gPlayerState.sword_state = 0;
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
}
if (gPlayerState.item) {
@ -112,7 +112,7 @@ void sub_080754B8(ItemBehavior* this, u32 index) {
this->priority &= ~0x80;
}
if (gPlayerEntity.frameSpriteSettings & 1) {
if (gPlayerEntity.base.frameSpriteSettings & 1) {
swordBeam = GetSwordBeam();
if (swordBeam && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) {
CreatePlayerItemWithParent(this, PLAYER_ITEM_SWORD_BEAM1);
@ -198,7 +198,7 @@ void sub_08075694(ItemBehavior* this, u32 index) {
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
this->stateID = 4;
this->animPriority = 6;
gPlayerEntity.hurtType = 0x1e;
gPlayerEntity.base.hurtType = 0x1e;
gPlayerState.sword_state |= 0x40;
gPlayerState.sword_state &= 0xdf;
if ((gPlayerState.chargeState.action == 4) && ((gPlayerState.flags & PL_CLONING) == 0)) {
@ -223,8 +223,8 @@ void sub_08075738(ItemBehavior* this, u32 index) {
if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) {
this->direction = gPlayerState.direction;
}
gPlayerEntity.direction = this->direction;
gPlayerEntity.speed = 0x180;
gPlayerEntity.base.direction = this->direction;
gPlayerEntity.base.speed = 0x180;
if ((this->playerFrame & 0x80) != 0) {
bVar6 = 10;
if ((gPlayerState.skills & SKILL_LONG_SPIN) != 0) {
@ -236,19 +236,19 @@ void sub_08075738(ItemBehavior* this, u32 index) {
}
}
} else {
if (((((gPlayerEntity.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
if (((((gPlayerEntity.base.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
((gPlayerState.skills & SKILL_FOURSWORD) != 0))) {
Entity* bombEnt = CreatePlayerItemWithParent(this, PLAYER_ITEM_SPIRAL_BEAM);
if (bombEnt) {
bombEnt->animationState = (gPlayerEntity.animationState & 6) | 0x80;
bombEnt->animationState = (gPlayerEntity.base.animationState & 6) | 0x80;
}
}
if ((((gPlayerEntity.frameSpriteSettings & 2) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
if ((((gPlayerEntity.base.frameSpriteSettings & 2) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
(((gPlayerState.skills & SKILL_GREAT_SPIN) != 0 && (--this->timer != 0)))) {
gPlayerState.sword_state |= 0x10;
gPlayerState.lastSwordMove = SWORD_MOVE_GREAT_SPIN;
this->direction = gPlayerEntity.animationState << 2;
this->direction = gPlayerEntity.base.animationState << 2;
this->timer = 1;
this->subtimer = 1;
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
@ -300,11 +300,11 @@ void sub_08075900(ItemBehavior* this, u32 index) {
if (--this->timer == 0) {
SetItemAnim(this, ANIM_ROLLATTACK_END);
}
gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3;
gPlayerEntity.speed = 0x300;
gPlayerEntity.base.direction = (gPlayerEntity.base.animationState >> 1) << 3;
gPlayerEntity.base.speed = 0x300;
UpdatePlayerMovement();
if ((gRoomTransition.frameCount & 3) == 0) {
CreateFx(&gPlayerEntity, FX_DASH, 0x40);
CreateFx(&gPlayerEntity.base, FX_DASH, 0x40);
}
} else {
if ((this->playerFrame & 0x80) != 0) {
@ -318,7 +318,7 @@ void sub_08075900(ItemBehavior* this, u32 index) {
void sub_080759B8(ItemBehavior* this, u32 index) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerEntity.hurtType = 0;
gPlayerEntity.base.hurtType = 0;
}
gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.sword_state = 0;

View File

@ -1,6 +1,5 @@
#include "functions.h"
#include "item.h"
#include "new_player.h"
#include "playeritem.h"
#include "sound.h"
@ -39,9 +38,9 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
gPlayerState.framestate = 4;
this->stateID = 2;
this->animPriority = 0xf;
if ((gNewPlayerEntity.unk_79 & 0x80)) {
gNewPlayerEntity.unk_79 = 0;
COLLISION_ON(&gPlayerEntity);
if ((gPlayerEntity.unk_79 & 0x80)) {
gPlayerEntity.unk_79 = 0;
COLLISION_ON(&gPlayerEntity.base);
gPlayerState.heldObject = 4;
gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing;
gPlayerState.field_0xa = ~(8 >> param_3) & gPlayerState.field_0xa;
@ -56,7 +55,7 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
if (param_2 == NULL) {
PlayerCancelHoldItem(this, param_3);
} else {
PlayerEntity* playerEnt = &gNewPlayerEntity;
PlayerEntity* playerEnt = &gPlayerEntity;
playerEnt->unk_74 = param_2;
playerEnt->base.subtimer = 0;
param_2->child = this->field_0x18;
@ -87,7 +86,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) {
if (gPlayerState.attack_status == 0 &&
(gPlayerState.jump_status == 0 || (gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) != 0) &&
(gPlayerState.grab_status = gPlayerEntity.animationState | 0x80, gPlayerEntity.iframes <= 8)) {
(gPlayerState.grab_status = gPlayerEntity.base.animationState | 0x80, gPlayerEntity.base.iframes <= 8)) {
switch (sub_080789A8()) {
case 2:
@ -143,7 +142,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
return;
}
if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) {
if (gPlayerEntity.base.iframes < 9 && gPlayerEntity.base.knockbackDuration == 0) {
if (this->field_0x18 != NULL) {
if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) {
if (!(gPlayerState.playerInput.heldInput & INPUT_ACTION)) { // Pressing R
@ -169,10 +168,10 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
if (!gPlayerState.jump_status) {
if (gPlayerState.heldObject == 1 && sub_0800875A(&gPlayerEntity, 6, this) != 0) {
if (gPlayerState.heldObject == 1 && sub_0800875A(&gPlayerEntity.base, 6, this) != 0) {
sub_08076088(this, NULL, index);
return;
} else if (gUnk_0811BE38[gPlayerEntity.animationState >> 1] & gPlayerState.playerInput.heldInput) {
} else if (gUnk_0811BE38[gPlayerEntity.base.animationState >> 1] & gPlayerState.playerInput.heldInput) {
UpdateItemAnim(this);
if (!(gPlayerState.flags & PL_NO_CAP)) {
@ -194,9 +193,9 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
sub_08076088(this, this->field_0x18, index);
} else {
if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.animationState >> 1]) {
if (gPlayerEntity.subtimer < 6) {
gPlayerEntity.subtimer++;
if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.base.animationState >> 1]) {
if (gPlayerEntity.base.subtimer < 6) {
gPlayerEntity.base.subtimer++;
return;
}
@ -217,7 +216,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) {
SetItemAnim(this, animIndex);
}
} else {
gPlayerEntity.subtimer = 0;
gPlayerEntity.base.subtimer = 0;
if (!(gPlayerState.flags & PL_NO_CAP)) {
SetItemAnim(this, ANIM_PULL);
@ -242,7 +241,7 @@ void sub_08076488(ItemBehavior* this, u32 index) {
}
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.base.flags |= ENT_COLLIDE;
gPlayerState.heldObject = 4;
bVar1 = ~(8 >> index);
gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing;
@ -261,14 +260,14 @@ void sub_08076518(ItemBehavior* this, u32 index) {
if (PlayerTryDropObject(this, index)) {
gPlayerState.framestate = PL_STATE_HOLD;
if ((gPlayerState.jump_status & 0x80) == 0 && gPlayerState.field_0x1f[0] == 0) {
if (gPlayerEntity.knockbackDuration != 0) {
if (gPlayerEntity.base.knockbackDuration != 0) {
PlayerCancelHoldItem(this, index);
} else {
if ((gPlayerState.playerInput.newInput & (INPUT_LIFT_THROW | INPUT_CANCEL | INPUT_INTERACT)) != 0) {
sub_0806F948(&gPlayerEntity);
sub_0806F948(&gPlayerEntity.base);
gPlayerState.heldObject = 5;
this->field_0x18->subAction = 2;
this->field_0x18->direction = (gPlayerEntity.animationState & 0xe) << 2;
this->field_0x18->direction = (gPlayerEntity.base.animationState & 0xe) << 2;
this->field_0x18 = NULL;
this->stateID++;
this->animPriority = 0x0f;

View File

@ -566,7 +566,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
if (itemId != ITEM_ENEMY_BEETLE) {
itemEntity = CreateObject(GROUND_ITEM, itemId, adjustedParam);
if (itemEntity != NULL) {
if (arg0 == &gPlayerEntity) {
if (arg0 == &gPlayerEntity.base) {
itemEntity->timer = 1;
} else {
itemEntity->timer = 0;

View File

@ -15,7 +15,7 @@ void CloudStaircaseTransitionManager_Main(CloudStaircaseTransitionManager* this)
this->y = 0;
}
if (((CheckPlayerInRegion(this->x, this->y, 0x14, 0x40) != 0) &&
(((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) + gPlayerEntity.z.HALF.HI) < 0)) &&
(((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) + gPlayerEntity.base.z.HALF.HI) < 0)) &&
(gRoomControls.scroll_y == gRoomControls.origin_y)) {
MemClear(&gRoomTransition.player_status, sizeof(PlayerRoomStatus));
gRoomTransition.transitioningOut = 1;

View File

@ -77,8 +77,8 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager*
u16 offsetX, offsetY, offsetX2, offsetY2;
u32 tmp, tmp2;
if (gDiggingCaveEntranceTransition.isDiggingCave) {
offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x;
offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x;
offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y;
offsetX2 = (entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16 + 8;
offsetY2 = ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 6) * 16 + 0x18;
tmp = offsetX - offsetX2;
@ -89,10 +89,10 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager*
DiggingCaveEntranceManager_EnterEntrance(this, entr);
return TRUE;
} else {
if (COORD_TO_TILE(&gPlayerEntity) != entr->sourceTilePosition)
if (COORD_TO_TILE(&gPlayerEntity.base) != entr->sourceTilePosition)
return FALSE;
offsetY2 = gRoomControls.origin_y + ((entr->sourceTilePosition >> 6) << 4) + 6;
if (gPlayerEntity.y.HALF.HI >= offsetY2)
if (gPlayerEntity.base.y.HALF.HI >= offsetY2)
return FALSE;
DiggingCaveEntranceManager_EnterEntrance(this, entr);
return TRUE;
@ -109,10 +109,10 @@ void DiggingCaveEntranceManager_EnterEntrance(DiggingCaveEntranceManager* this,
gRoomControls.area = entr->targetArea;
gRoomControls.room = entr->targetRoom;
gDiggingCaveEntranceTransition.entrance = entr;
gDiggingCaveEntranceTransition.offsetX =
gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - ((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16);
gDiggingCaveEntranceTransition.offsetY =
gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2);
gDiggingCaveEntranceTransition.offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x -
((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16);
gDiggingCaveEntranceTransition.offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y -
((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2);
#ifndef EU
isDiggingCave = gDiggingCaveEntranceTransition.isDiggingCave;

View File

@ -121,7 +121,7 @@ static void EzloHintManager_Action3(EzloHintManager* this) {
if (gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_FALLING | PL_IN_MINECART | PL_CAPTURED))
return;
if (gPlayerEntity.z.HALF.HI != 0)
if (gPlayerEntity.base.z.HALF.HI != 0)
return;
gPlayerState.jump_status = 0;
CreateEzloHint(this->msg_idx, this->msg_height);
@ -136,7 +136,7 @@ static void EzloHintManager_Action3(EzloHintManager* this) {
return;
case 3:
/* wait for player to finish talking */
if (gPlayerEntity.action == PLAYER_NORMAL || gPlayerEntity.action == PLAYER_MINISH) {
if (gPlayerEntity.base.action == PLAYER_NORMAL || gPlayerEntity.base.action == PLAYER_MINISH) {
gPlayerState.controlMode = CONTROL_1;
ResetPlayerEventPriority();
SetFlag(this->flag1);

View File

@ -9,7 +9,6 @@
* (There is also a part about changing the music and setting it back when the fight is done, which is song 0x33 (a
* fight theme) by default but can be overridden through room data)
*/
#define ENT_DEPRECATED
#include "manager/fightManager.h"
#include "area.h"
#include "common.h"
@ -113,7 +112,7 @@ void FightManager_LoadFight(FightManager* this) {
while (prop->kind != 0xFF) {
ent = LoadRoomEntity(prop++);
if ((ent != NULL) && (ent->kind == ENEMY)) {
ent->field_0x6c.HALF.HI |= 0x40;
((GenericEntity*)ent)->field_0x6c.HALF.HI |= 0x40;
FightManagerHelper_Monitor(monitor, ent, counter++);
}
if (counter >= 7) {

View File

@ -155,8 +155,10 @@ void sub_0805B210(HoleManager* this) {
gRoomTransition.player_status.start_pos_y = tmp->unk_06;
break;
case 1:
gRoomTransition.player_status.start_pos_x = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04;
gRoomTransition.player_status.start_pos_y = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06;
gRoomTransition.player_status.start_pos_x =
gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04;
gRoomTransition.player_status.start_pos_y =
gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06;
break;
case 2:
gRoomTransition.player_status.start_pos_x = tmp->unk_04;

View File

@ -13,11 +13,11 @@
void HyruleTownBellManager_Main(HyruleTownBellManager* this) {
RoomControls* roomControls = &gRoomControls;
u32 a = roomControls->origin_x + 0x1f8;
u32 x = (a - gPlayerEntity.x.HALF.HI) + 0x10;
u32 x = (a - gPlayerEntity.base.x.HALF.HI) + 0x10;
u32 b = roomControls->origin_y + 0x140;
u32 y = (b - gPlayerEntity.y.HALF.HI) + 0x10;
u32 y = (b - gPlayerEntity.base.y.HALF.HI) + 0x10;
if (super->action == 0) {
if (x < 0x20 && y < 0x20 && gPlayerEntity.z.HALF.HI < -0x18 && gPlayerState.framestate == PL_STATE_CAPE) {
if (x < 0x20 && y < 0x20 && gPlayerEntity.base.z.HALF.HI < -0x18 && gPlayerState.framestate == PL_STATE_CAPE) {
super->action++;
super->timer = 90;
SoundReq(SFX_10A);

View File

@ -49,8 +49,8 @@ void LightManager_Main(LightManager* this) {
if (gArea.lightType == 2) {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
} else {
if (CheckRectOnScreen(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, 0, 0)) {
if (CheckRectOnScreen(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x,
gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, 0, 0)) {
gScreen.lcd.displayControl |= DISPCNT_WIN0_ON;
} else {
gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON;
@ -79,8 +79,8 @@ void LightManager_Main(LightManager* this) {
}
super->timer = uVar3;
sub_0801E160(gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x,
gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y - 9 + gPlayerEntity.z.HALF.HI,
sub_0801E160(gPlayerEntity.base.x.HALF.HI - gRoomControls.scroll_x,
gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y - 9 + gPlayerEntity.base.z.HALF.HI,
uVar3 + this->unk20);
}
}

View File

@ -88,8 +88,8 @@ void LightRayManager_Action1(LightRayManager* this) {
if (prop->unk0 == 0xff)
return;
x = gPlayerEntity.x.HALF.HI / 16;
y = gPlayerEntity.y.HALF.HI / 16;
x = gPlayerEntity.base.x.HALF.HI / 16;
y = gPlayerEntity.base.y.HALF.HI / 16;
for (; prop->unk0 != 0xff; prop++) {
if (prop->unk0 != this->unk_21) {

View File

@ -164,7 +164,7 @@ void MiscManager_Type1(MiscManager* this) {
PutAwayItems();
}
if (super->timer == 60) {
gPlayerEntity.animationState = super->subtimer;
gPlayerEntity.base.animationState = super->subtimer;
}
if (!--super->timer) {
super->action = 3;
@ -298,7 +298,7 @@ void sub_08059278(void) {
void MiscManager_Type8(MiscManager* this) {
super->action = 1;
gRoomControls.camera_target = &gPlayerEntity;
gRoomControls.camera_target = &gPlayerEntity.base;
}
void MiscManager_Type9(MiscManager* this) {
@ -363,9 +363,9 @@ void MiscManager_TypeB(MiscManager* this) {
}
bool32 sub_080593CC(MiscManager* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.base.animationState == 0 &&
(gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) == INPUT_UP) {
return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
return EntityWithinDistance(&gPlayerEntity.base, this->unk_38, this->unk_3a + 0xC, 6);
}
return FALSE;
}
@ -395,7 +395,7 @@ void MiscManager_TypeD(MiscManager* this) {
if (gRoomVars.field_0x0) {
StartPlayerScript(gUnk_08108380[gRoomControls.scroll_direction]);
} else {
StartPlayerScript(gUnk_08108380[gPlayerEntity.animationState >> 1]);
StartPlayerScript(gUnk_08108380[gPlayerEntity.base.animationState >> 1]);
}
}
DeleteThisEntity();
@ -431,7 +431,7 @@ void MiscManager_TypeE(MiscManager* this) {
#if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP)
void MiscManager_TypeF(MiscManager* this) {
SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT);
if (gPlayerEntity.action == PLAYER_TALKEZLO) {
if (gPlayerEntity.base.action == PLAYER_TALKEZLO) {
DeleteThisEntity();
}
gInput.heldKeys |= SELECT_BUTTON;

View File

@ -6,7 +6,6 @@
*
* E.g. for pushable rock.
*/
#define ENT_DEPRECATED
#include "manager/moveableObjectManager.h"
#include "flags.h"
#include "room.h"
@ -15,7 +14,7 @@ void MoveableObjectManager_Main(MoveableObjectManager* this) {
Entity* object = CreateObject(super->timer, super->type, super->type2);
if (!object)
return;
object->field_0x86.HWORD = this->flags;
((GenericEntity*)object)->field_0x86.HWORD = this->flags;
if (CheckFlags(this->flags)) {
object->x.HALF.HI = this->unk_36 | (this->unk_37 & 0xF) << 8; // r1
object->y.HALF.HI = this->unk_3c & 0xFFF;

View File

@ -4,10 +4,11 @@
*
* @brief Creates pushable furniture based on a room property list.
*/
#define ENT_DEPRECATED
#include "manager/pushableFurnitureManager.h"
#include "flags.h"
#include "object.h"
#include "object/pushableFurniture.h"
#include "room.h"
void PushableFurnitureManager_Init(PushableFurnitureManager*);
@ -36,16 +37,16 @@ void PushableFurnitureManager_Init(PushableFurnitureManager* this) {
this->unk_28 = 0;
this->unk_29 = 0;
while (tmp->unk_00 != 0xFF && super->timer < 0x20) {
Entity* obj;
obj = CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02);
if (obj) {
obj->timer = tmp->unk_03;
obj->x.HALF.HI = gRoomControls.origin_x + tmp->unk_04;
obj->y.HALF.HI = gRoomControls.origin_y + tmp->unk_06;
obj->parent = (Entity*)this;
obj->collisionLayer = 1;
obj->field_0x82.HALF.HI = super->timer;
obj->field_0x82.HALF.LO = tmp->unk_00;
PushableFurnitureEntity* furniture =
(PushableFurnitureEntity*)CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02);
if (furniture) {
furniture->base.timer = tmp->unk_03;
furniture->base.x.HALF.HI = gRoomControls.origin_x + tmp->unk_04;
furniture->base.y.HALF.HI = gRoomControls.origin_y + tmp->unk_06;
furniture->base.parent = (Entity*)this;
furniture->base.collisionLayer = 1;
furniture->unk_83 = super->timer;
furniture->unk_82 = tmp->unk_00;
this->unk_29 |= 1 << super->timer;
}
tmp++;
@ -76,13 +77,13 @@ void PushableFurnitureManager_Action2(PushableFurnitureManager* this) {
void sub_0805C7CC(PushableFurnitureManager* this) {
if (gPlayerState.flags & PL_MINISH) {
if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x10) {
if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x10) {
super->subAction = 1;
} else {
super->subAction = 0;
}
} else {
if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x28) {
if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x28) {
super->subAction = 3;
} else {
super->subAction = 2;

View File

@ -93,7 +93,7 @@ void sub_080588F8(RollingBarrelManager* this) {
}
}
if (super->timer) {
s32 tmp = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
s32 tmp = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y;
u32 tmp2;
tmp2 = (((unsigned)(tmp - 0x50 < 0 ? 0x50 - tmp : tmp - 0x50) >> 3) * 0x3000) + 0x4000;
if (super->subtimer == 0) {
@ -134,14 +134,14 @@ void sub_08058A04(RollingBarrelManager* this) {
{ 0x9C, 0x78, 0x1A, 0x16 }, { 0x9A, 0x70, 0x1A, 0x18 },
{ 0x98, 0x64, 0x1E, 0x1E }, { 0x98, 0x6A, 0x1C, 0x10 } };
s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x;
s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
s32 tmp = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x;
s32 tmp2 = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y;
if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) &&
(tmp2 - 0x45 < 0x17u) && (gPlayerEntity.z.HALF.HI == 0)) {
(tmp2 - 0x45 < 0x17u) && (gPlayerEntity.base.z.HALF.HI == 0)) {
gPlayerState.queued_action = PLAYER_FALL;
gPlayerState.field_0x38 = 0;
gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x78;
gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x50;
gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x78;
gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x50;
return;
}
if (tmp < 0x78) {
@ -176,8 +176,8 @@ u32 sub_08058B08(RollingBarrelManager* this, u32 unk1, u32 unk2, const struct_08
tmp -= unk1;
tmp >>= 3;
unk3 += tmp;
tmp2 = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - unk3->unk_0);
tmp3 = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - unk3->unk_2);
tmp2 = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x - unk3->unk_0);
tmp3 = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y - unk3->unk_2);
return ((tmp2 < unk3->unk_4) && (tmp3 < unk3->unk_6));
}
}
@ -230,8 +230,8 @@ void sub_08058BC8(RollingBarrelManager* this) {
void sub_08058CB0(RollingBarrelManager* this) {
static const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C };
u32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x;
u32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y;
u32 tmp = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x;
u32 tmp2 = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y;
u32 tmp3;
if (tmp < 0x78) {
tmp3 = 1;
@ -248,12 +248,12 @@ void sub_08058CB0(RollingBarrelManager* this) {
}
void sub_08058CFC(void) {
u32 tmp = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y;
u32 tmp = gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y;
if (tmp < 0x4C) {
sub_080044AE(&gPlayerEntity, 0xC0, 0x10);
sub_080044AE(&gPlayerEntity.base, 0xC0, 0x10);
}
if (tmp > 0x54) {
sub_080044AE(&gPlayerEntity, 0xC0, 0);
sub_080044AE(&gPlayerEntity.base, 0xC0, 0);
}
}

View File

@ -22,10 +22,10 @@ void SpecialWarpManager_Main(SpecialWarpManager* this) {
if (super->timer == 0 || gPlayerState.floor_type == SURFACE_LADDER) {
for (data = this->warpList; data->posX != 0xffff; data++) {
collisionLayer = (data->unk_07.all & 0x3);
if ((collisionLayer & gPlayerEntity.collisionLayer) != 0) {
if ((collisionLayer & gPlayerEntity.base.collisionLayer) != 0) {
if ((gPlayerState.flags & PL_MINISH) != 0 || data->unk_07.b.unk2 != 0) {
if (CheckPlayerInRegion(data->posX, data->posY, data->width, data->height) &&
gPlayerEntity.z.HALF.HI == 0) {
gPlayerEntity.base.z.HALF.HI == 0) {
DoExitTransition(GetCurrentRoomProperty(data->roomProperty));
}
}

View File

@ -334,14 +334,14 @@ void TempleOfDropletsManager_Type6_Action1(TempleOfDropletsManager* this) {
}
void TempleOfDropletsManager_Type6_Action2(TempleOfDropletsManager* this) {
if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.item)) {
if ((gPlayerEntity.base.health != 0) && (gPlayerEntity.base.z.HALF.HI == 0) && (!gPlayerState.item)) {
switch (gPlayerState.framestate_last) {
case PL_STATE_IDLE:
case PL_STATE_WALK:
if (sub_0805A73C(this)) {
super->action++;
sub_08004168(&gPlayerEntity);
gPlayerEntity.animationState = 4;
sub_08004168(&gPlayerEntity.base);
gPlayerEntity.base.animationState = 4;
RequestPriorityDuration((Entity*)this, 600);
SetPlayerControl(0xFF);
gPauseMenuOptions.disabled = 1;

View File

@ -24,10 +24,10 @@ void TilePuzzleManager_Main(TilePuzzleManager* this) {
super->action = IN_PROGRESS;
super->subtimer = super->timer;
this->own_tile = (((this->x >> 4) & 0x3fU) | ((this->y >> 4) & 0x3fU) << 6);
this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity));
this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base));
break;
case 1:
this->player_current_tile = COORD_TO_TILE((&gPlayerEntity));
this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base));
if (this->player_current_tile != this->player_previous_tile) {
this->player_previous_tile = this->player_current_tile;
switch (GetTileType(this->player_current_tile, super->type2)) {

View File

@ -63,8 +63,8 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) {
s32 distY;
Entity* object;
distX = gPlayerEntity.x.HALF.HI - (gRoomControls.origin_x + 0x88);
distY = gPlayerEntity.y.HALF.HI - (gRoomControls.origin_y + 0x40);
distX = gPlayerEntity.base.x.HALF.HI - (gRoomControls.origin_x + 0x88);
distY = gPlayerEntity.base.y.HALF.HI - (gRoomControls.origin_y + 0x40);
if (distX * distX + distY * distY < 0x901) {
super->action = 2;
super->subAction = 0;
@ -76,7 +76,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) {
object->x.HALF.HI = gRoomControls.origin_x + 0x88;
object->y.HALF.HI = gRoomControls.origin_y + 0x48;
}
object = CreateSpeechBubbleExclamationMark(&gPlayerEntity, 8, 0xfffffff0);
object = CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 8, 0xfffffff0);
if (object != NULL) {
object->spritePriority.b0 = 3;
}
@ -85,10 +85,10 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) {
}
void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) {
gPlayerEntity.animationState = 0;
if (gPlayerEntity.z.HALF.HI != 0) {
if (gPlayerEntity.y.HALF.HI < (gRoomControls.origin_y + 0x48)) {
gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x48;
gPlayerEntity.base.animationState = 0;
if (gPlayerEntity.base.z.HALF.HI != 0) {
if (gPlayerEntity.base.y.HALF.HI < (gRoomControls.origin_y + 0x48)) {
gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x48;
}
} else {
if (--super->timer == 0) {

View File

@ -11,10 +11,10 @@
void WaterfallBottomManager_Main(WaterfallBottomManager* this) {
SetTile(0x4014, 0x5c3, 1);
if ((gRoomControls.origin_y + 200 < gPlayerEntity.y.HALF.HI) &&
((u32)(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) {
gPlayerEntity.collisionLayer = 3;
UpdateSpriteForCollisionLayer(&gPlayerEntity);
if ((gRoomControls.origin_y + 200 < gPlayerEntity.base.y.HALF.HI) &&
((u32)(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) {
gPlayerEntity.base.collisionLayer = 3;
UpdateSpriteForCollisionLayer(&gPlayerEntity.base);
}
DeleteManager(super);
}

View File

@ -153,11 +153,11 @@ void sub_080596E0(WeatherChangeManager* this) {
}
u32 sub_08059844(void) {
return gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > gRoomControls.width >> 1;
return gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > gRoomControls.width >> 1;
}
u32 sub_0805986C(void) {
return gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > 0x200;
return gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > 0x200;
}
void sub_08059894(const u16* unk1, const u16* unk2, u32 unk3) {

View File

@ -25,8 +25,8 @@ void Anju(AnjuEntity* this) {
if (super->interactType == INTERACTION_FUSE) {
super->action = 2;
super->interactType = INTERACTION_NONE;
InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(
GetFacingDirection(super, &gPlayerEntity)));
InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(GetFacingDirection(
super, &gPlayerEntity.base)));
InitializeNPCFusion(super);
} else {
ExecuteScriptAndHandleAnimation(super, NULL);

Some files were not shown because too many files have changed in this diff Show More