Merge branch 'master' into tilemap-docs

This commit is contained in:
octorock
2023-12-31 02:12:41 +01:00
549 changed files with 15821 additions and 15437 deletions
+2 -3
View File
@@ -4,7 +4,6 @@
*
* @brief Bomb Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "functions.h"
@@ -113,10 +112,10 @@ void PlayerItemBomb_Action1(PlayerItemBombEntity* this) {
}
switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) {
case EQUIP_SLOT_A:
input = PLAYER_INPUT_1;
input = INPUT_USE_ITEM1;
break;
case EQUIP_SLOT_B:
input = PLAYER_INPUT_2;
input = INPUT_USE_ITEM2;
break;
case EQUIP_SLOT_NONE:
input = 0;
+11 -12
View File
@@ -4,7 +4,6 @@
*
* @brief Boomerang Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "functions.h"
@@ -68,13 +67,13 @@ void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this) {
super->frameIndex = 0xff;
this->unk_80 = 0;
#ifdef EU
super->spriteVramOffset = gPlayerEntity.spriteVramOffset;
super->spriteVramOffset = gPlayerEntity.base.spriteVramOffset;
#endif
super->animIndex = 11;
super->parent = &gPlayerEntity;
super->parent = &gPlayerEntity.base;
this->unk_86 = 0;
if ((super->animationState & 2) != 0) {
super->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX;
super->spriteSettings.flipX = ~gPlayerEntity.base.spriteSettings.flipX;
}
if (this->unk_68 == 12) {
super->speed = 0x280;
@@ -105,31 +104,31 @@ void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this) {
sub_0801B804(this);
if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != super ||
(gPlayerState.item == super && gPlayerEntity.action != PLAYER_NORMAL)) {
(gPlayerState.item == super && gPlayerEntity.base.action != PLAYER_NORMAL)) {
if (gPlayerState.item == super) {
gPlayerState.item = NULL;
}
DeleteThisEntity();
}
if ((gPlayerEntity.frame & 1) == 0) {
if ((gPlayerEntity.base.frame & 1) == 0) {
if (this->unk_68 == 12) {
cVar3 = 6;
} else {
cVar3 = 0;
}
frameIndex = (gPlayerEntity.frame >> 4) + cVar3;
frameIndex = (gPlayerEntity.base.frame >> 4) + cVar3;
if (super->frameIndex != frameIndex) {
super->frameIndex = frameIndex;
sub_080042D0(super, super->frameIndex, super->spriteIndex);
}
sub_08078E84(super, &gPlayerEntity);
sub_08078E84(super, &gPlayerEntity.base);
} else {
super->action = 2;
super->spriteVramOffset = 0xd5;
COLLISION_ON(super);
super->collisionFlags |= 1;
super->flags2 = gPlayerEntity.flags2;
super->flags2 = gPlayerEntity.base.flags2;
super->spriteIndex = 0xa6;
super->spriteSettings.flipX = 0;
super->spriteSettings.draw = 1;
@@ -172,7 +171,7 @@ void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) {
}
}
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) {
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) {
if (!uVar6) {
uVar6 = sub_080040E2(super, &gUnk_08003E44);
}
@@ -215,9 +214,9 @@ void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this) {
if (super->speed < 0x280) {
super->speed += 8;
}
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->direction = GetFacingDirection(super, &gPlayerEntity.base);
LinearMoveUpdate(super);
if (sub_0800419C(super, &gPlayerEntity, 2, 2) != 0) {
if (sub_0800419C(super, &gPlayerEntity.base, 2, 2) != 0) {
DeleteThisEntity();
}
}
+14 -21
View File
@@ -4,8 +4,8 @@
*
* @brief Bottle Player Item
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "playerItem/playerItemBottle.h"
#include "functions.h"
#include "item.h"
#include "object.h"
@@ -13,13 +13,6 @@
#include "sound.h"
#include "tiles.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 bottleIndex; /**< @see Item */
/*0x69*/ u8 unused[6];
/*0x6f*/ u8 bottleContent; /**< @see Item */
} PlayerItemBottleEntity;
void PlayerItemBottle_UseEmptyBottle(Entity*);
void PlayerItemBottle_Action1(PlayerItemBottleEntity*);
void sub_0801BDE8(Entity*, Entity*);
@@ -55,8 +48,8 @@ void PlayerItemBottle_Init(PlayerItemBottleEntity* this) {
return;
}
COLLISION_ON(super);
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
super->flags2 = gPlayerEntity.flags2;
super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20;
super->flags2 = gPlayerEntity.base.flags2;
super->hurtType = 0x1f;
super->type = 1;
super->type2 = ITEM_BOTTLE_EMPTY;
@@ -109,7 +102,7 @@ void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) {
}
DeleteThisEntity();
}
sub_0801BDE8(super, &gPlayerEntity);
sub_0801BDE8(super, &gPlayerEntity.base);
switch (this->bottleContent) {
case ITEM_BOTTLE_EMPTY:
PlayerItemBottle_UseEmptyBottle2(super);
@@ -125,8 +118,8 @@ void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) {
case ITEM_BOTTLE_PICOLYTE_GREEN:
case ITEM_BOTTLE_PICOLYTE_BLUE:
case ITEM_BOTTLE_PICOLYTE_WHITE:
if (gPlayerEntity.frame == 1) {
gPlayerEntity.frame = 0;
if (gPlayerEntity.base.frame == 1) {
gPlayerEntity.base.frame = 0;
PlayerItemBottle_UsePotionOrPicolyte(this);
}
break;
@@ -177,7 +170,7 @@ void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity* this) {
}
void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) {
if (gPlayerEntity.frame == 1) {
if (gPlayerEntity.base.frame == 1) {
if (this->bottleContent != ITEM_QST_DOGFOOD) {
SetBottleContents(ITEM_BOTTLE_EMPTY, this->bottleIndex - 0x1c);
}
@@ -200,7 +193,7 @@ void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) {
SoundReq(SFX_ELEMENT_CHARGE);
}
}
if (gPlayerEntity.frame == 2) {
if (gPlayerEntity.base.frame == 2) {
switch (this->bottleContent) {
case ITEM_BOTTLE_WATER:
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0);
@@ -210,7 +203,7 @@ void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) {
break;
}
}
if (gPlayerEntity.frame == 3) {
if (gPlayerEntity.base.frame == 3) {
switch (this->bottleContent) {
case ITEM_BOTTLE_WATER:
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0);
@@ -235,7 +228,7 @@ void sub_0801BDE8(Entity* this, Entity* ent2) {
flipX = ent2->spriteSettings.flipX;
animationState = (ent2->animationState >> 1);
this->spriteSettings.flipX = flipX ^ (animationState & 1);
sub_08078E84(this, &gPlayerEntity);
sub_08078E84(this, &gPlayerEntity.base);
}
void PlayerItemBottle_UseEmptyBottle(Entity* this) {
@@ -280,9 +273,9 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
this->hitbox->offset_y = ptr[1];
this->hitbox->width = ptr[2];
this->hitbox->height = ptr[3];
if ((gPlayerEntity.frame & 0xf) != 0) {
if ((gPlayerEntity.base.frame & 0xf) != 0) {
if (this->type2 == ITEM_BOTTLE_EMPTY) {
ptr2 = &gUnk_080B7878[((gPlayerEntity.frame & 0xf) - 1) * 2];
ptr2 = &gUnk_080B7878[((gPlayerEntity.base.frame & 0xf) - 1) * 2];
iVar2 = ptr2[0];
if (this->spriteSettings.flipX != 0) {
iVar2 = -iVar2;
@@ -294,6 +287,6 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
}
if (this->type2 != ITEM_BOTTLE_EMPTY) {
COLLISION_OFF(&gPlayerEntity);
COLLISION_OFF(&gPlayerEntity.base);
}
}
+10 -11
View File
@@ -4,7 +4,6 @@
*
* @brief Bow Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
@@ -88,17 +87,17 @@ void PlayerItemBow_Init(PlayerItemBowEntity* this) {
super->speed = 0x300;
}
super->direction = super->animationState << 2;
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
super->flags2 = gPlayerEntity.flags2;
super->collisionFlags = gPlayerEntity.base.collisionFlags + 1;
super->flags2 = gPlayerEntity.base.flags2;
if (super->collisionLayer == 2) {
super->type2 = 1;
} else {
super->type2 = 0;
}
super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY;
ptr = &gUnk_080B3E40[super->animationState >> 1];
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + ptr->x;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + ptr->y;
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + ptr->x;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + ptr->y;
super->spriteSettings.flipX = ptr->spriteSettings;
super->spriteSettings.flipY = ptr->unk_3;
super->animIndex = ptr->animIndex;
@@ -165,7 +164,7 @@ void PlayerItemBow_Action1(PlayerItemBowEntity* this) {
if (super->type2 == 0) {
sub_0800451C(super);
}
if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) && (!tmp2) &&
if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) && (!tmp2) &&
sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0) {
super->timer = 30;
super->action++;
@@ -226,21 +225,21 @@ void PlayerItemBow_Action1(PlayerItemBowEntity* this) {
}
}
arrowCount = gSave.stats.arrowCount;
if (super->frameIndex - this->unk_78 != gPlayerEntity.frameIndex) {
super->frameIndex = gPlayerEntity.frameIndex + this->unk_78;
if (super->frameIndex - this->unk_78 != gPlayerEntity.base.frameIndex) {
super->frameIndex = gPlayerEntity.base.frameIndex + this->unk_78;
if (arrowCount == 0) {
super->frameIndex += 0x2a;
}
sub_080042D0(super, super->frameIndex, super->spriteIndex);
}
if ((gPlayerEntity.frame & 1) != 0 && arrowCount != 0) {
if ((gPlayerEntity.base.frame & 1) != 0 && arrowCount != 0) {
entity = CreatePlayerItem(PLAYER_ITEM_BOW, 1, super->hurtType, 9);
if (entity != NULL) {
gPlayerState.attack_status |= 0x80;
ModArrows(-1);
}
}
sub_08078E84(super, &gPlayerEntity);
sub_08078E84(super, &gPlayerEntity.base);
}
}
+1 -2
View File
@@ -4,7 +4,6 @@
*
* @brief Cell Overwrite Set Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "common.h"
#include "entity.h"
@@ -340,7 +339,7 @@ const u16 gUnk_080B7A3E[] = {
void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) {
static const s8 offsetByDirection[] = { 0, -16, 16, 0, 0, 16, -16, 0 };
u32 tmp;
Entity* player = &gPlayerEntity;
Entity* player = &gPlayerEntity.base;
if (super->action == 0) {
this->tileType = GetMetaTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe],
+5 -6
View File
@@ -4,7 +4,6 @@
*
* @brief Dash Sword Player Item
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "player.h"
@@ -68,13 +67,13 @@ void sub_0801B938(Entity* this) {
const s8* ptr;
if ((this->animationState & 2)) {
this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX ^ 1;
this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX ^ 1;
} else {
this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX;
}
if ((u8)(gPlayerEntity.animIndex + 0x68) < 4) {
this->frameIndex = gPlayerEntity.frameIndex + 0x2e;
if ((u8)(gPlayerEntity.base.animIndex + 0x68) < 4) {
this->frameIndex = gPlayerEntity.base.frameIndex + 0x2e;
sub_080042D0(this, this->frameIndex, this->spriteIndex);
} else {
this->frameIndex = 0xff;
@@ -83,7 +82,7 @@ void sub_0801B938(Entity* this) {
this->hitbox = (Hitbox*)&gUnk_080B7850[this->animationState >> 1];
ptr = &gUnk_080B7848[(this->animationState >> 1) * 2];
sub_08008782(this, -(gPlayerState.skills & SKILL_ROCK_BREAKER) != 0, ptr[0], ptr[1]);
sub_08078E84(this, &gPlayerEntity);
sub_08078E84(this, &gPlayerEntity.base);
}
void sub_0801B9F0(Entity* this) {
+2 -3
View File
@@ -4,7 +4,6 @@
*
* @brief Fire Rod Projectile Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
@@ -39,7 +38,7 @@ void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this) {
super->action = 1;
CopyPosition(super->parent, super);
if (super->type == 0) {
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
super->collisionFlags = gPlayerEntity.base.collisionFlags + 1;
super->hitbox = (Hitbox*)&gUnk_08127278;
super->speed = 0x400;
if (super->collisionLayer == 2) {
@@ -71,7 +70,7 @@ void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this
if (super->type2 == 0) {
sub_0800451C(super);
}
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0 &&
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0 &&
sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) {
CreateFx(super, FX_SWORD_MAGIC, 0);
DeleteThisEntity();
+4 -5
View File
@@ -4,7 +4,6 @@
*
* @brief Gust Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "functions.h"
@@ -71,7 +70,7 @@ void PlayerItemGust(Entity* this) {
static void PlayerItemGust_Init(PlayerItemGustEntity* this) {
super->action = GUST_UPDATE;
super->flags2 = gPlayerEntity.flags2;
super->flags2 = gPlayerEntity.base.flags2;
super->direction = super->animationState << 2;
super->speed = 0x200;
super->flags |= ENT_COLLIDE | ENT_PERSIST;
@@ -167,8 +166,8 @@ bool32 sub_080ACDB0(PlayerItemGustEntity* this) {
u32 tmp;
if (super->type == 0) {
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_08126EE4[super->animationState];
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_08126EE4[super->animationState + 1];
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + gUnk_08126EE4[super->animationState];
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + gUnk_08126EE4[super->animationState + 1];
} else {
if ((super->animationState & 2) != 0) {
super->y.HALF.HI = super->parent->y.HALF.HI - 3;
@@ -220,7 +219,7 @@ bool32 sub_080ACDB0(PlayerItemGustEntity* this) {
}
}
}
super->collisionLayer = gPlayerEntity.collisionLayer;
super->collisionLayer = gPlayerEntity.base.collisionLayer;
return 0;
}
+10 -12
View File
@@ -4,12 +4,10 @@
*
* @brief Gust Big Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "functions.h"
#include "global.h"
#include "new_player.h"
#include "player.h"
#include "sound.h"
#include "tiles.h"
@@ -69,14 +67,14 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) {
u8 uVar2;
Entity* pEVar3;
this->unk_84 = super->x.WORD = gPlayerEntity.x.WORD;
this->unk_80 = super->y.WORD = gPlayerEntity.y.WORD;
uVar2 = super->animationState = gPlayerEntity.animationState & 0xe;
this->unk_84 = super->x.WORD = gPlayerEntity.base.x.WORD;
this->unk_80 = super->y.WORD = gPlayerEntity.base.y.WORD;
uVar2 = super->animationState = gPlayerEntity.base.animationState & 0xe;
super->direction = (u8)(uVar2 << 2);
super->speed = 0x400;
super->hitType = 0x96;
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80;
super->flags2 = gPlayerEntity.flags2;
super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x80;
super->flags2 = gPlayerEntity.base.flags2;
pEVar3 = super->child;
if (pEVar3 != NULL) {
super->action = 1;
@@ -101,9 +99,9 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) {
super->damage = gUnk_080B3DE0[super->type * 2 + 1];
super->hurtType = 0x1b;
super->hitbox = (Hitbox*)gUnk_080B3DE8[super->type];
gNewPlayerEntity.unk_70 = super;
sub_08078CD0(&gPlayerEntity);
gNewPlayerEntity.unk_70 = pEVar3;
gPlayerEntity.unk_70 = super;
sub_08078CD0(&gPlayerEntity.base);
gPlayerEntity.unk_70 = pEVar3;
InitializeAnimation(super, super->type + 10);
sub_08018FA0(super);
}
@@ -131,7 +129,7 @@ void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this) {
sub_08018FA0(super);
break;
}
sub_08078CD0(&gPlayerEntity);
sub_08078CD0(&gPlayerEntity.base);
}
void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this) {
@@ -209,7 +207,7 @@ void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this) {
}
void sub_08018FA0(Entity* this) {
this->collisionLayer = gPlayerEntity.collisionLayer;
this->collisionLayer = gPlayerEntity.base.collisionLayer;
if (this->collisionLayer == 2) {
this->type2 = 1;
}
+7 -8
View File
@@ -4,7 +4,6 @@
*
* @brief Gust Jar Player Item
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "player.h"
@@ -34,7 +33,7 @@ void PlayerItemGustJar(Entity* this) {
DeleteThisEntity();
}
PlayerItemGustJar_Actions[this->action](this);
sub_08078E84(this, &gPlayerEntity);
sub_08078E84(this, &gPlayerEntity.base);
}
void PlayerItemGustJar_Init(Entity* this) {
@@ -66,10 +65,10 @@ void PlayerItemGustJar_Action2(Entity* this) {
if (gPlayerState.field_0x1c == 3) {
this->action++;
InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 8);
InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 8);
} else if (gPlayerState.field_0x1c == 6) {
this->action = 4;
InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 4);
InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 4);
} else {
windSound = 0;
if (this->type != 0) {
@@ -122,7 +121,7 @@ void PlayerItemGustJar_Action2(Entity* this) {
}
this->subtimer = 15;
}
this->frameIndex = gPlayerEntity.frameIndex - (gPlayerEntity.frame & 0x7f);
this->frameIndex = gPlayerEntity.base.frameIndex - (gPlayerEntity.base.frame & 0x7f);
}
}
@@ -130,7 +129,7 @@ void PlayerItemGustJar_Action3(Entity* this) {
switch (gPlayerState.field_0x1c & 0xf) {
case 6:
this->action++;
InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 4);
InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 4);
break;
case 1:
sub_080ADCA0(this, 0);
@@ -151,11 +150,11 @@ void PlayerItemGustJar_Action4(Entity* this) {
}
void sub_080ADC84(Entity* this) {
this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX;
}
void sub_080ADCA0(Entity* this, u32 param_2) {
const u8* pFVar1 = gUnk_08132714[(param_2 + (gPlayerEntity.animationState >> 1))];
const u8* pFVar1 = gUnk_08132714[(param_2 + (gPlayerEntity.base.animationState >> 1))];
const u8* pFVar2;
this->animPtr = (void*)pFVar1;
+7 -13
View File
@@ -4,16 +4,10 @@
*
* @brief Held Object Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
#include "functions.h"
#include "new_player.h"
#include "new_player.h"
#include "new_player.h"
#include "player.h"
#include "player.h"
#include "player.h"
#include "sound.h"
#include "tiles.h"
@@ -93,7 +87,7 @@ void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this) {
PlayerDropHeldObject();
DeleteThisEntity();
} else {
if ((gPlayerState.heldObject == 0) || ((gNewPlayerEntity.unk_79 & 0x7f) != 0)) {
if ((gPlayerState.heldObject == 0) || ((gPlayerEntity.unk_79 & 0x7f) != 0)) {
sub_080AD27C(this);
super->subAction++;
super->flags &= ~0x80;
@@ -211,13 +205,13 @@ void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) {
}
} else {
tmp = gPlayerEntity.frame & 1;
tmp = gPlayerEntity.base.frame & 1;
if (tmp != 0) {
SoundReq(SFX_PLY_VO5);
sub_080AD27C(this);
return;
}
if ((gPlayerState.heldObject != 0) && ((gNewPlayerEntity.unk_79 & 0x80) == 0)) {
if ((gPlayerState.heldObject != 0) && ((gPlayerEntity.unk_79 & 0x80) == 0)) {
return;
}
sub_080AD27C(this);
@@ -242,7 +236,7 @@ void sub_080AD27C(PlayerItemHeldObjectEntity* this) {
static const u32 gUnk_081320D4[] = { Q_16_16(0), Q_16_16(0.5), Q_16_16(1.25), Q_16_16(1.25) };
u32 tmp;
PlayerItemHeldObjectEntity* child = (PlayerItemHeldObjectEntity*)super->child;
gNewPlayerEntity.unk_74 = NULL;
gPlayerEntity.unk_74 = NULL;
if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) {
if (child != this) {
(child->base).subAction = 2;
@@ -256,9 +250,9 @@ void sub_080AD27C(PlayerItemHeldObjectEntity* this) {
(child->base).z.HALF.HI += 8;
super->z.HALF.HI = (child->base).z.HALF.HI;
super->collisionLayer = (child->base).collisionLayer;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI;
super->x.HALF.HI = gPlayerEntity.x.HALF.HI;
super->collisionFlags = gPlayerEntity.collisionFlags;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI;
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI;
super->collisionFlags = gPlayerEntity.base.collisionFlags;
super->flags |= 0x80;
sub_0801766C(super);
} else {
+11 -12
View File
@@ -4,7 +4,6 @@
*
* @brief Lantern Player Item
*/
#define NENT_DEPRECATED
#include "entity.h"
#include "functions.h"
#include "item.h"
@@ -31,7 +30,7 @@ void PlayerItemLantern_Init(Entity* this) {
this->updatePriority = 6;
this->collisionFlags = 7;
this->flags2 = -0x80;
this->animationState = gPlayerEntity.animationState & 0xe;
this->animationState = gPlayerEntity.base.animationState & 0xe;
if (AllocMutableHitbox(this) == NULL) {
DeleteThisEntity();
}
@@ -43,27 +42,27 @@ void PlayerItemLantern_Init(Entity* this) {
void PlayerItemLantern_Action1(Entity* this) {
Entity* object;
static const s8 offsets[] = { 6, -6, 7, -3, -5, 2, -7, -3 };
this->animationState = gPlayerEntity.animationState & 0xe;
this->animationState = gPlayerEntity.base.animationState & 0xe;
this->hitbox->offset_x = offsets[this->animationState];
this->hitbox->offset_y = offsets[this->animationState + 1];
this->hitbox->width = 4;
this->hitbox->height = 4;
if (!((gPlayerEntity.frameIndex < 0x37) && ((u32)gPlayerEntity.spriteIndex == 6))) {
if (!((gPlayerEntity.base.frameIndex < 0x37) && ((u32)gPlayerEntity.base.spriteIndex == 6))) {
this->frameIndex = 0xff;
this->flags &= ~ENT_COLLIDE;
} else {
this->flags |= ENT_COLLIDE;
this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
this->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY;
if (gPlayerEntity.frameIndex != this->frameIndex) {
this->frameIndex = gPlayerEntity.frameIndex;
this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX;
this->spriteSettings.flipY = gPlayerEntity.base.spriteSettings.flipY;
if (gPlayerEntity.base.frameIndex != this->frameIndex) {
this->frameIndex = gPlayerEntity.base.frameIndex;
sub_080042D0(this, this->frameIndex, this->spriteIndex);
}
this->frame = gPlayerEntity.frame;
this->frameSpriteSettings = gPlayerEntity.frameSpriteSettings;
this->frame = gPlayerEntity.base.frame;
this->frameSpriteSettings = gPlayerEntity.base.frameSpriteSettings;
}
if (IsItemEquipped(ITEM_LANTERN_ON) < EQUIP_SLOT_NONE) {
if (((this->frameIndex != 0xff) && (gPlayerEntity.spriteSettings.draw != 0)) && (this->timer-- == 0)) {
if (((this->frameIndex != 0xff) && (gPlayerEntity.base.spriteSettings.draw != 0)) && (this->timer-- == 0)) {
this->timer = 4;
object = CreateObject(LAMP_PARTICLE, 0, 0x10);
if (object != NULL) {
@@ -73,7 +72,7 @@ void PlayerItemLantern_Action1(Entity* this) {
object->spriteOffsetY = offsets[this->animationState + 1];
}
}
sub_08078E84(this, &gPlayerEntity);
sub_08078E84(this, &gPlayerEntity.base);
} else {
DeleteThisEntity();
}
+7 -8
View File
@@ -4,7 +4,6 @@
*
* @brief Pacci Cane Player Item
*/
#define NENT_DEPRECATED
#include "common.h"
#include "entity.h"
#include "functions.h"
@@ -36,30 +35,30 @@ void PlayerItemPacciCane_Action1(Entity* this) {
u32 playerFrame;
u32 frameIndex;
u32 flipX;
if (((gPlayerEntity.frame & ANIM_DONE) != 0) || (this != gPlayerState.item)) {
if (((gPlayerEntity.base.frame & ANIM_DONE) != 0) || (this != gPlayerState.item)) {
if (this == gPlayerState.item) {
gPlayerState.item = NULL;
}
DeleteEntity(this);
} else {
playerFrame = gPlayerEntity.frame & 0xf;
playerFrame = gPlayerEntity.base.frame & 0xf;
if (playerFrame != 0xf) {
frameIndex = gPlayerEntity.frameIndex;
frameIndex = gPlayerEntity.base.frameIndex;
playerFrame += 0x91;
if (frameIndex - playerFrame != this->frameIndex) {
this->frameIndex = frameIndex + 0x6f;
sub_080042D0(this, this->frameIndex, this->spriteIndex);
}
sub_08078E84(this, &gPlayerEntity);
sub_08078E84(this, &gPlayerEntity.base);
} else {
this->frameIndex = -1;
}
}
if ((gPlayerEntity.animationState & 2)) {
flipX = gPlayerEntity.spriteSettings.flipX ^ 1;
if ((gPlayerEntity.base.animationState & 2)) {
flipX = gPlayerEntity.base.spriteSettings.flipX ^ 1;
} else {
flipX = gPlayerEntity.spriteSettings.flipX;
flipX = gPlayerEntity.base.spriteSettings.flipX;
}
this->spriteSettings.flipX = flipX;
}
@@ -4,7 +4,6 @@
*
* @brief Pacci Cane Projectile Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "entity.h"
#include "functions.h"
@@ -73,8 +72,8 @@ void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* thi
super->speed = 0x200;
this->unk_74 = 0x40;
this->unk_78 = 0x1e0;
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[super->animationState];
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[super->animationState + 1];
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + gUnk_0811B9A0[super->animationState];
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + gUnk_0811B9A0[super->animationState + 1];
super->collisionFlags = 7;
super->flags2 = 0x8a;
super->hitbox = (Hitbox*)&gUnk_0811B9D0;
@@ -83,7 +82,7 @@ void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* thi
} else {
super->type = 0;
}
super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY;
ptr = &gUnk_0811B9A8[(super->animationState >> 1)];
super->spriteSettings.flipX = ptr->flipX;
super->spriteSettings.flipY = ptr->flipY;
@@ -127,7 +126,7 @@ void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity*
if (super->type == 0) {
sub_0800451C(super);
}
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) {
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) {
if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) {
if (GetVvvAtEntity(super) == VVV_25) {
super->action = 4;
+19 -20
View File
@@ -4,7 +4,6 @@
*
* @brief Shield Player Item
*/
#define NENT_DEPRECATED
#include "collision.h"
#include "entity.h"
#include "functions.h"
@@ -76,7 +75,7 @@ void PlayerItemShield_Init(PlayerItemShieldEntity* this) {
} else {
this->unk_70 = 0;
}
super->animationState = gPlayerEntity.animationState & 0xe;
super->animationState = gPlayerEntity.base.animationState & 0xe;
sub_08079BD8(super);
LoadSwapGFX(super, 1, 3);
PlayerItemShield_Action1(this);
@@ -87,10 +86,10 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) {
u8* pbVar3;
u32 tmp2;
if ((gPlayerEntity.iframes == 0) || ((u8)gPlayerEntity.iframes == 0x81)) {
gPlayerEntity.iframes = super->iframes;
gPlayerEntity.knockbackDirection = super->knockbackDirection;
gPlayerEntity.knockbackDuration = super->knockbackDuration;
if ((gPlayerEntity.base.iframes == 0) || ((u8)gPlayerEntity.base.iframes == 0x81)) {
gPlayerEntity.base.iframes = super->iframes;
gPlayerEntity.base.knockbackDirection = super->knockbackDirection;
gPlayerEntity.base.knockbackDuration = super->knockbackDuration;
super->knockbackDuration = 0;
super->iframes = 0;
}
@@ -98,7 +97,7 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) {
if ((gPlayerState.shield_status != 0) && (super == gPlayerState.item)) {
if ((gPlayerState.shield_status & 0x80) != 0) {
super->hitbox = (Hitbox*)gUnk_08127240[super->animationState >> 1];
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20;
COLLISION_ON(super);
gPlayerState.shield_status &= ~0x80;
sub_080176E4(super);
@@ -132,16 +131,16 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) {
DeleteThisEntity();
}
if (((gPlayerEntity.spriteIndex == 1u) || (gPlayerEntity.spriteIndex == 4u)) &&
((u8)(gPlayerEntity.frameIndex - 0x25) < 0x3f)) {
super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
super->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY;
if ((gPlayerEntity.frameIndex - 0x25 + this->unk_70 != super->frameIndex) &&
((super->frameIndex = gPlayerEntity.frameIndex - 0x25 + this->unk_70,
this->unk_68 != 0xe || ((gPlayerEntity.frame & 0x7f) == 0)))) {
if (((gPlayerEntity.base.spriteIndex == 1u) || (gPlayerEntity.base.spriteIndex == 4u)) &&
((u8)(gPlayerEntity.base.frameIndex - 0x25) < 0x3f)) {
super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX;
super->spriteSettings.flipY = gPlayerEntity.base.spriteSettings.flipY;
if ((gPlayerEntity.base.frameIndex - 0x25 + this->unk_70 != super->frameIndex) &&
((super->frameIndex = gPlayerEntity.base.frameIndex - 0x25 + this->unk_70,
this->unk_68 != 0xe || ((gPlayerEntity.base.frame & 0x7f) == 0)))) {
sub_080042D0(super, super->frameIndex, super->spriteIndex);
}
if (((this->unk_68 == 0xe) && ((gPlayerEntity.frame & 0x7f) != 0))) {
if (((this->unk_68 == 0xe) && ((gPlayerEntity.base.frame & 0x7f) != 0))) {
if (--this->unk_78 == 0) {
this->unk_74++;
tmp2 = this->unk_74 * 4;
@@ -156,16 +155,16 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) {
pbVar3 = &this->unk_7c[this->unk_74 * 4];
this->unk_78 = pbVar3[1];
if ((gPlayerState.shield_status & 0x40) != 0) {
u32 temp = (gPlayerEntity.frame & 0x7f) + 8;
u32 temp = (gPlayerEntity.base.frame & 0x7f) + 8;
sub_080042D0(super, temp + pbVar3[0], super->spriteIndex);
} else {
sub_080042D0(super, (gPlayerEntity.frame & 0x7f) + pbVar3[0], super->spriteIndex);
sub_080042D0(super, (gPlayerEntity.base.frame & 0x7f) + pbVar3[0], super->spriteIndex);
}
}
}
super->frame = gPlayerEntity.frame;
super->frameSpriteSettings = gPlayerEntity.frameSpriteSettings;
sub_08078E84(super, &gPlayerEntity);
super->frame = gPlayerEntity.base.frame;
super->frameSpriteSettings = gPlayerEntity.base.frameSpriteSettings;
sub_08078E84(super, &gPlayerEntity.base);
} else {
super->frameIndex = 0xff;
}
+3 -4
View File
@@ -4,7 +4,6 @@
*
* @brief Spiral Beam Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
@@ -32,10 +31,10 @@ void PlayerItemSpiralBeam(PlayerItemSpiralBeamEntity* this) {
void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity* this) {
static const Hitbox gUnk_08109AD0 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 };
CopyPosition(&gPlayerEntity, super);
CopyPosition(&gPlayerEntity.base, super);
super->action++;
super->spriteSettings.draw = TRUE;
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
super->collisionFlags = gPlayerEntity.base.collisionFlags + 1;
super->hitbox = (Hitbox*)&gUnk_08109AD0;
super->speed = 0x380;
super->animationState = super->animationState & 0x7f;
@@ -59,7 +58,7 @@ void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity* this) {
if (super->type2 == 0) {
sub_0800451C(super);
}
if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) &&
if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) &&
sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) {
CreateFx(super, FX_SWORD_MAGIC, 0);
DeleteThisEntity();
+17 -18
View File
@@ -4,7 +4,6 @@
*
* @brief Sword Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "effects.h"
#include "entity.h"
@@ -35,7 +34,7 @@ void PlayerItemSword(Entity* this) {
};
PlayerItemSword_Actions[this->action]((PlayerItemSwordEntity*)this);
if (this->type == 0) {
sub_08078E84(this, &gPlayerEntity);
sub_08078E84(this, &gPlayerEntity.base);
this->hitbox->offset_x += this->spriteOffsetX;
this->hitbox->offset_y += this->spriteOffsetY;
}
@@ -60,8 +59,8 @@ void PlayerItemSword_Init(PlayerItemSwordEntity* this) {
DeleteThisEntity();
}
LoadSwapGFX(super, 1, 3);
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
super->flags2 = gPlayerEntity.flags2;
super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20;
super->flags2 = gPlayerEntity.base.flags2;
super->updatePriority = 6;
super->contactFlags = 0;
super->iframes = 0;
@@ -184,7 +183,7 @@ void PlayerItemSword_Action1(PlayerItemSwordEntity* this) {
break;
}
}
if ((gPlayerEntity.frame & 0x20) != 0) {
if ((gPlayerEntity.base.frame & 0x20) != 0) {
SoundReq(SFX_116);
}
} else {
@@ -196,7 +195,7 @@ void PlayerItemSword_Action1(PlayerItemSwordEntity* this) {
super->hurtType = 0xb;
}
}
if (((gPlayerState.swordDamage) != 0) && ((gPlayerEntity.frame & 0x40) != 0)) {
if (((gPlayerState.swordDamage) != 0) && ((gPlayerEntity.base.frame & 0x40) != 0)) {
type = FX_BLUE_SPARKLE;
if ((gPlayerState.swordDamage) == 1) {
type = FX_SPARKLE2;
@@ -213,7 +212,7 @@ void PlayerItemSword_Action1(PlayerItemSwordEntity* this) {
}
}
}
sub_080A78B8(this, &gPlayerEntity);
sub_080A78B8(this, &gPlayerEntity.base);
sub_080A7A84(this);
} else {
if (!((gPlayerState.attack_status == 0) || (gPlayerState.item->hurtType == 0))) {
@@ -237,18 +236,18 @@ void PlayerItemSword_Action2(PlayerItemSwordEntity* this) {
gPlayerState.item = NULL;
DeleteThisEntity();
}
if ((gPlayerEntity.frame & 0x80) != 0) {
if ((gPlayerEntity.base.frame & 0x80) != 0) {
gPlayerState.item = NULL;
DeleteThisEntity();
} else {
sub_080A78B8(this, &gPlayerEntity);
if ((gPlayerEntity.frame & 0x20) != 0) {
sub_080A78B8(this, &gPlayerEntity.base);
if ((gPlayerEntity.base.frame & 0x20) != 0) {
SoundReq(SFX_PLY_VO3);
}
if (super->frameIndex > 0x8a) {
super->frameIndex = 0xff;
}
if ((gPlayerEntity.frame & 8) != 0) {
if ((gPlayerEntity.base.frame & 8) != 0) {
super->flags |= ENT_COLLIDE;
sub_080A7B98(this);
} else {
@@ -337,7 +336,7 @@ void sub_080A78B8(PlayerItemSwordEntity* this, Entity* param_2) {
void sub_080A7A54(PlayerItemSwordEntity* this) {
const u8* tmp;
tmp = &gUnk_08129096[(gPlayerEntity.frameIndex - 0x6a) * 4];
tmp = &gUnk_08129096[(gPlayerEntity.base.frameIndex - 0x6a) * 4];
super->hitbox->offset_x = tmp[0];
super->hitbox->offset_y = tmp[1];
super->hitbox->width = tmp[2];
@@ -355,11 +354,11 @@ void sub_080A7A84(PlayerItemSwordEntity* this) {
u32 tmp2;
u32 yOffset;
if ((gPlayerEntity.frame & 0xf) != 0) {
uVar3 = gUnk_08129072[((gPlayerEntity.frame & 0xf) - 1)][0];
if ((gPlayerEntity.base.frame & 0xf) != 0) {
uVar3 = gUnk_08129072[((gPlayerEntity.base.frame & 0xf) - 1)][0];
one = 1;
yOffset = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one];
if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.spriteSettings.flipX == 1)) {
yOffset = gUnk_08129072[(gPlayerEntity.base.frame & 0xf) - 1][one];
if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.base.spriteSettings.flipX == 1)) {
uVar3 = -uVar3;
}
if (super->type != 0) {
@@ -376,9 +375,9 @@ void sub_080A7A84(PlayerItemSwordEntity* this) {
((gPlayerState.sword_state & 0xc0) == 0)) {
entity = super;
if (GetVvvRelativeToEntity(entity, xOffset, yOffset) == VVV_46) {
SoundReqClipped(&gPlayerEntity, SFX_ITEM_GLOVES_KNOCKBACK);
SoundReqClipped(&gPlayerEntity.base, SFX_ITEM_GLOVES_KNOCKBACK);
} else {
SoundReqClipped(&gPlayerEntity, SFX_METAL_CLINK);
SoundReqClipped(&gPlayerEntity.base, SFX_METAL_CLINK);
}
effect = CreateObject(SPECIAL_FX, FX_LIGHTNING, 0);
if (effect != NULL) {
+3 -4
View File
@@ -4,7 +4,6 @@
*
* @brief Sword Beam Player Item
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "common.h"
#include "effects.h"
@@ -41,10 +40,10 @@ static const u8 PlayerItemSwordBeam_Palettes[] = { 0, 4, 1, 2, 0xff };
void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this) {
static const Hitbox hitbox = { 0, 0, { 4, 0, 0, 0 }, 6, 6 };
CopyPosition(&gPlayerEntity, super);
CopyPosition(&gPlayerEntity.base, super);
super->action++;
super->spriteSettings.draw = 1;
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
super->collisionFlags = gPlayerEntity.base.collisionFlags + 1;
super->hitbox = (Hitbox*)&hitbox;
super->speed = 0x380;
this->unk_74 = 2;
@@ -89,7 +88,7 @@ void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this) {
if (super->type2 == 0) {
sub_0800451C(super);
}
if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) &&
if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) &&
(sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0)) {
CreateFx(super, FX_SWORD_MAGIC, 0);
DeleteThisEntity();