mirror of https://github.com/zeldaret/tmc.git
Merge pull request #618 from octorock/playerItems
Create new entity structs for Player Items
This commit is contained in:
commit
064bc43e78
|
@ -20,7 +20,7 @@ typedef struct {
|
|||
static_assert(sizeof(OctorokBossHeap) == 0x30);
|
||||
|
||||
struct OctorokBossEntity {
|
||||
Entity base;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ union SplitHWord field_0x68;
|
||||
/*0x6a*/ union SplitHWord field_0x6a;
|
||||
/*0x6c*/ union SplitHWord field_0x6c;
|
||||
|
|
|
@ -1,49 +1,56 @@
|
|||
/**
|
||||
* @file playerItemBomb.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Bomb Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
#include "player.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u32 unk_68;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u32 unk_68;
|
||||
} PlayerItemBombEntity;
|
||||
|
||||
void sub_0801B418(Entity*);
|
||||
void sub_0801B3A4(PlayerItemBombEntity*);
|
||||
void sub_0801B250(PlayerItemBombEntity*);
|
||||
void sub_0801B2CC(PlayerItemBombEntity*);
|
||||
void sub_0801B318(PlayerItemBombEntity*);
|
||||
void sub_0801B38C(PlayerItemBombEntity*);
|
||||
void sub_0801B330(PlayerItemBombEntity*);
|
||||
void sub_0801B340(PlayerItemBombEntity*);
|
||||
void sub_0801B354(PlayerItemBombEntity*);
|
||||
void sub_0801B368(PlayerItemBombEntity*);
|
||||
void sub_0801B384(PlayerItemBombEntity*);
|
||||
void sub_0801B418(Entity* this);
|
||||
void sub_0801B3A4(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_Init(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_Action1(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_Action2(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_Action3(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_SubAction0(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_SubAction1(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_SubAction2(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_SubAction3(PlayerItemBombEntity* this);
|
||||
void PlayerItemBomb_SubAction4(PlayerItemBombEntity* this);
|
||||
|
||||
static void (*const actionFuncs[])(PlayerItemBombEntity*) = {
|
||||
sub_0801B250,
|
||||
sub_0801B2CC,
|
||||
sub_0801B318,
|
||||
sub_0801B38C,
|
||||
static void (*const PlayerItemBomb_Actions[])(PlayerItemBombEntity*) = {
|
||||
PlayerItemBomb_Init,
|
||||
PlayerItemBomb_Action1,
|
||||
PlayerItemBomb_Action2,
|
||||
PlayerItemBomb_Action3,
|
||||
};
|
||||
|
||||
static void (*const subActionFuncs[])(PlayerItemBombEntity*) = {
|
||||
sub_0801B330, sub_0801B340, sub_0801B354, sub_0801B368, sub_0801B384,
|
||||
static void (*const PlayerItemBomb_SubActions[])(PlayerItemBombEntity*) = {
|
||||
PlayerItemBomb_SubAction0, PlayerItemBomb_SubAction1, PlayerItemBomb_SubAction2,
|
||||
PlayerItemBomb_SubAction3, PlayerItemBomb_SubAction4,
|
||||
};
|
||||
|
||||
static const Hitbox unusedHitbox = { 0, 0, { 4, 0, 0, 4 }, 22, 22 };
|
||||
static const Hitbox gUnk_080B77F4 = { 0, 0, 6, 0, 0, 6, 4, 4 };
|
||||
|
||||
void PlayerItemBomb(PlayerItemBombEntity* this) {
|
||||
u8 uVar1, uVar2;
|
||||
u8 action, uVar2;
|
||||
|
||||
actionFuncs[super->action](this);
|
||||
PlayerItemBomb_Actions[super->action](this);
|
||||
GetNextFrame(super);
|
||||
uVar2 = uVar1 = super->action;
|
||||
if (uVar1 != 0x03) {
|
||||
uVar2 = action = super->action;
|
||||
if (action != 3) {
|
||||
if (super->timer != 0) {
|
||||
if (*(u8*)&this->unk_68 == 7) {
|
||||
super->timer--;
|
||||
|
@ -56,11 +63,11 @@ void PlayerItemBomb(PlayerItemBombEntity* this) {
|
|||
}
|
||||
} else {
|
||||
if (super->subtimer != 0) {
|
||||
if (super->subtimer-- == 0x01) {
|
||||
if ((uVar1 == 0x02) && (super->subAction == 1)) {
|
||||
if (super->subtimer-- == 1) {
|
||||
if ((action == 2) && (super->subAction == 1)) {
|
||||
gPlayerState.heldObject = 0;
|
||||
}
|
||||
super->action = 0x03;
|
||||
super->action = 3;
|
||||
super->spritePriority.b1 = 2;
|
||||
super->timer = 15;
|
||||
super->spriteSettings.draw = 0;
|
||||
|
@ -76,7 +83,7 @@ void PlayerItemBomb(PlayerItemBombEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_0801B250(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_Init(PlayerItemBombEntity* this) {
|
||||
super->spriteSettings.draw = 1;
|
||||
super->action = 1;
|
||||
super->spritePriority.b1 = 3;
|
||||
|
@ -98,59 +105,59 @@ void sub_0801B250(PlayerItemBombEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_0801B2CC(PlayerItemBombEntity* this) {
|
||||
u16 unaff_r5;
|
||||
void PlayerItemBomb_Action1(PlayerItemBombEntity* this) {
|
||||
u16 input;
|
||||
|
||||
if (!sub_0800442E(super)) {
|
||||
RegisterCarryEntity(super);
|
||||
}
|
||||
switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) {
|
||||
case EQUIP_SLOT_A:
|
||||
unaff_r5 = PLAYER_INPUT_1;
|
||||
input = PLAYER_INPUT_1;
|
||||
break;
|
||||
case EQUIP_SLOT_B:
|
||||
unaff_r5 = PLAYER_INPUT_2;
|
||||
input = PLAYER_INPUT_2;
|
||||
break;
|
||||
case EQUIP_SLOT_NONE:
|
||||
unaff_r5 = 0;
|
||||
input = 0;
|
||||
break;
|
||||
}
|
||||
if ((gPlayerState.playerInput.newInput & unaff_r5) != 0) {
|
||||
if ((gPlayerState.playerInput.newInput & input) != 0) {
|
||||
super->timer = 0;
|
||||
super->subtimer = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B318(PlayerItemBombEntity* this) {
|
||||
subActionFuncs[super->subAction](this);
|
||||
void PlayerItemBomb_Action2(PlayerItemBombEntity* this) {
|
||||
PlayerItemBomb_SubActions[super->subAction](this);
|
||||
}
|
||||
|
||||
void sub_0801B330(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_SubAction0(PlayerItemBombEntity* this) {
|
||||
super->subAction++;
|
||||
sub_08079BD8(super);
|
||||
}
|
||||
|
||||
void sub_0801B340(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_SubAction1(PlayerItemBombEntity* this) {
|
||||
super->spritePriority.b1 = 2;
|
||||
}
|
||||
|
||||
void sub_0801B354(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_SubAction2(PlayerItemBombEntity* this) {
|
||||
super->spritePriority.b1 = 3;
|
||||
}
|
||||
|
||||
void sub_0801B368(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_SubAction3(PlayerItemBombEntity* this) {
|
||||
super->action--;
|
||||
super->subAction = 0;
|
||||
if (0x3c < super->timer) {
|
||||
if (super->timer > 60) {
|
||||
super->timer = 60;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B384(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_SubAction4(PlayerItemBombEntity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
void sub_0801B38C(PlayerItemBombEntity* this) {
|
||||
void PlayerItemBomb_Action3(PlayerItemBombEntity* this) {
|
||||
if (super->timer-- == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
@ -158,7 +165,7 @@ void sub_0801B38C(PlayerItemBombEntity* this) {
|
|||
|
||||
void sub_0801B3A4(PlayerItemBombEntity* this) {
|
||||
u32 tmp;
|
||||
if (super->subtimer >= 0x29) {
|
||||
if (super->subtimer > 40) {
|
||||
tmp = 8;
|
||||
} else {
|
||||
tmp = 4;
|
||||
|
|
|
@ -1,213 +1,228 @@
|
|||
#include "entity.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
/**
|
||||
* @file playerItemBoomerang.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Boomerang Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "sound.h"
|
||||
|
||||
void sub_0801B804(Entity*);
|
||||
Entity* sub_0801B864(Entity*);
|
||||
void sub_0801B584(Entity*);
|
||||
void PlayerItemBoomerang_Init(Entity*);
|
||||
void sub_0801B680(Entity*);
|
||||
void sub_0801B7A8(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ u8 unused1[23];
|
||||
/*0x80*/ u8 unk_80;
|
||||
/*0x81*/ u8 unused2[1];
|
||||
/*0x83*/ union SplitHWord unk_82;
|
||||
/*0x84*/ u8 unused3[2];
|
||||
/*0x86*/ u16 unk_86;
|
||||
} PlayerItemBoomerangEntity;
|
||||
|
||||
void sub_0801B804(PlayerItemBoomerangEntity* this);
|
||||
Entity* sub_0801B864(Entity* this);
|
||||
void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this);
|
||||
void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this);
|
||||
void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this);
|
||||
void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this);
|
||||
|
||||
extern Entity* sub_08008782(Entity*, u32, s32, s32);
|
||||
extern bool32 sub_080040E2(Entity*, u8*);
|
||||
extern Hitbox gUnk_081271CC;
|
||||
extern u8 gUnk_08003E44;
|
||||
|
||||
void PlayerItemBoomerang(Entity* this) {
|
||||
static void (*const PlayerItemBoomerang_Actions[])(Entity*) = {
|
||||
void PlayerItemBoomerang(PlayerItemBoomerangEntity* this) {
|
||||
static void (*const PlayerItemBoomerang_Actions[])(PlayerItemBoomerangEntity*) = {
|
||||
PlayerItemBoomerang_Init,
|
||||
sub_0801B584,
|
||||
sub_0801B680,
|
||||
sub_0801B7A8,
|
||||
PlayerItemBoomerang_Action1,
|
||||
PlayerItemBoomerang_Action2,
|
||||
PlayerItemBoomerang_Action3,
|
||||
};
|
||||
|
||||
// Unused
|
||||
static const u16 gUnk_080B780C[] = { 0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x0 };
|
||||
|
||||
PlayerItemBoomerang_Actions[this->action](this);
|
||||
if (this->animIndex != 0xb) {
|
||||
if (this->animationState == 6) {
|
||||
this->field_0x86.HWORD += 0x2000;
|
||||
PlayerItemBoomerang_Actions[super->action](this);
|
||||
if (super->animIndex != 0xb) {
|
||||
if (super->animationState == 6) {
|
||||
this->unk_86 += 0x2000;
|
||||
} else {
|
||||
this->field_0x86.HWORD -= 0x2000;
|
||||
this->unk_86 -= 0x2000;
|
||||
}
|
||||
SetAffineInfo(this, 0x100, 0x100, this->field_0x86.HWORD);
|
||||
SetAffineInfo(super, 0x100, 0x100, this->unk_86);
|
||||
}
|
||||
|
||||
this->subtimer--;
|
||||
if ((this->subtimer & 0xf) == 0) {
|
||||
super->subtimer--;
|
||||
if ((super->subtimer & 0xf) == 0) {
|
||||
EnqueueSFX(SFX_FB);
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerItemBoomerang_Init(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
gPlayerState.item = this;
|
||||
this->action = 1;
|
||||
this->hitbox = &gUnk_081271CC;
|
||||
this->frameIndex = 0xff;
|
||||
this->field_0x80.HALF.LO = 0;
|
||||
void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this) {
|
||||
gPlayerState.item = super;
|
||||
super->action = 1;
|
||||
super->hitbox = &gUnk_081271CC;
|
||||
super->frameIndex = 0xff;
|
||||
this->unk_80 = 0;
|
||||
#ifdef EU
|
||||
this->spriteVramOffset = gPlayerEntity.spriteVramOffset;
|
||||
super->spriteVramOffset = gPlayerEntity.spriteVramOffset;
|
||||
#endif
|
||||
this->animIndex = 11;
|
||||
this->parent = &gPlayerEntity;
|
||||
this->field_0x86.HWORD = 0;
|
||||
if ((this->animationState & 2) != 0) {
|
||||
this->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX;
|
||||
super->animIndex = 11;
|
||||
super->parent = &gPlayerEntity;
|
||||
this->unk_86 = 0;
|
||||
if ((super->animationState & 2) != 0) {
|
||||
super->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX;
|
||||
}
|
||||
if (this->field_0x68.HALF.LO == 12) {
|
||||
this->speed = 0x280;
|
||||
uVar1 = 60;
|
||||
if (this->unk_68 == 12) {
|
||||
super->speed = 0x280;
|
||||
super->timer = 60;
|
||||
} else {
|
||||
this->speed = 0x200;
|
||||
uVar1 = 30;
|
||||
super->speed = 0x200;
|
||||
super->timer = 30;
|
||||
}
|
||||
this->timer = uVar1;
|
||||
if (((s8)gPlayerState.direction) >= 0) {
|
||||
this->direction = gPlayerState.direction;
|
||||
super->direction = gPlayerState.direction;
|
||||
} else {
|
||||
this->direction = this->animationState << 2;
|
||||
super->direction = super->animationState << 2;
|
||||
}
|
||||
this->field_0x82.HALF.HI = this->direction;
|
||||
if (this->collisionLayer == 2) {
|
||||
this->type2 = 1;
|
||||
this->unk_82.HALF.HI = super->direction;
|
||||
if (super->collisionLayer == 2) {
|
||||
super->type2 = 1;
|
||||
}
|
||||
LoadSwapGFX(this, 1, 3);
|
||||
sub_0801766C(this);
|
||||
sub_0801B584(this);
|
||||
LoadSwapGFX(super, 1, 3);
|
||||
sub_0801766C(super);
|
||||
PlayerItemBoomerang_Action1(this);
|
||||
}
|
||||
|
||||
void sub_0801B584(Entity* this) {
|
||||
void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this) {
|
||||
static const s8 gUnk_080B7826[] = { 0, -8, 8, -4, 0, 8, -8, -4 };
|
||||
u32 frameIndex;
|
||||
int iVar2;
|
||||
u32 cVar3;
|
||||
|
||||
sub_0801B804(this);
|
||||
if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != this ||
|
||||
(gPlayerState.item == this && gPlayerEntity.action != PLAYER_NORMAL)) {
|
||||
if (gPlayerState.item == this) {
|
||||
if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != super ||
|
||||
(gPlayerState.item == super && gPlayerEntity.action != PLAYER_NORMAL)) {
|
||||
if (gPlayerState.item == super) {
|
||||
gPlayerState.item = NULL;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
if ((gPlayerEntity.frame & 1) == 0) {
|
||||
if (this->field_0x68.HALF.LO == 12) {
|
||||
if (this->unk_68 == 12) {
|
||||
cVar3 = 6;
|
||||
} else {
|
||||
cVar3 = 0;
|
||||
}
|
||||
frameIndex = (gPlayerEntity.frame >> 4) + cVar3;
|
||||
if (this->frameIndex != frameIndex) {
|
||||
this->frameIndex = frameIndex;
|
||||
sub_080042D0(this, this->frameIndex, this->spriteIndex);
|
||||
if (super->frameIndex != frameIndex) {
|
||||
super->frameIndex = frameIndex;
|
||||
sub_080042D0(super, super->frameIndex, super->spriteIndex);
|
||||
}
|
||||
sub_08078E84(this, &gPlayerEntity);
|
||||
sub_08078E84(super, &gPlayerEntity);
|
||||
} else {
|
||||
this->action = 2;
|
||||
this->spriteVramOffset = 0xd5;
|
||||
COLLISION_ON(this);
|
||||
this->collisionFlags |= 1;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
this->spriteIndex = 0xa6;
|
||||
this->spriteSettings.flipX = 0;
|
||||
this->spriteSettings.draw = 1;
|
||||
super->action = 2;
|
||||
super->spriteVramOffset = 0xd5;
|
||||
COLLISION_ON(super);
|
||||
super->collisionFlags |= 1;
|
||||
super->flags2 = gPlayerEntity.flags2;
|
||||
super->spriteIndex = 0xa6;
|
||||
super->spriteSettings.flipX = 0;
|
||||
super->spriteSettings.draw = 1;
|
||||
|
||||
iVar2 = (this->animationState >> 1) * 2;
|
||||
this->x.HALF.HI += gUnk_080B7826[iVar2];
|
||||
this->y.HALF.HI += gUnk_080B7826[iVar2 + 1];
|
||||
InitializeAnimation(this, 0);
|
||||
iVar2 = (super->animationState >> 1) * 2;
|
||||
super->x.HALF.HI += gUnk_080B7826[iVar2];
|
||||
super->y.HALF.HI += gUnk_080B7826[iVar2 + 1];
|
||||
InitializeAnimation(super, 0);
|
||||
gPlayerState.item = NULL;
|
||||
gPlayerState.attack_status |= 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B680(Entity* this) {
|
||||
u32 uvar1;
|
||||
u32 uVar6;
|
||||
void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) {
|
||||
u32 uVar1;
|
||||
bool32 uVar6;
|
||||
|
||||
sub_0801B804(this);
|
||||
if ((this->field_0x68.HALF.LO == 12) && (this->field_0x80.HALF.LO == 0) && ((gPlayerState.direction & 0x80) == 0)) {
|
||||
if (((this->field_0x82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) {
|
||||
this->field_0x82.HWORD += 0x40;
|
||||
this->field_0x82.HALF.HI &= 0x1f;
|
||||
this->direction = this->field_0x82.HALF.HI;
|
||||
if ((this->unk_68 == 12) && (this->unk_80 == 0) && ((gPlayerState.direction & 0x80) == 0)) {
|
||||
if (((this->unk_82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) {
|
||||
this->unk_82.HWORD += 0x40;
|
||||
this->unk_82.HALF.HI &= 0x1f;
|
||||
super->direction = this->unk_82.HALF.HI;
|
||||
} else {
|
||||
this->field_0x82.HWORD -= 0x40;
|
||||
this->field_0x82.HALF.HI &= 0x1f;
|
||||
this->direction = this->field_0x82.HALF.HI;
|
||||
this->unk_82.HWORD -= 0x40;
|
||||
this->unk_82.HALF.HI &= 0x1f;
|
||||
super->direction = this->unk_82.HALF.HI;
|
||||
}
|
||||
}
|
||||
LinearMoveUpdate(this);
|
||||
uVar6 = 0;
|
||||
if (sub_0801B864(this)) {
|
||||
uvar1 = this->field_0x68.HALF.LO;
|
||||
uvar1 ^= 0xc;
|
||||
if (uvar1) {
|
||||
LinearMoveUpdate(super);
|
||||
uVar6 = FALSE;
|
||||
if (sub_0801B864(super)) {
|
||||
uVar1 = this->unk_68;
|
||||
uVar1 ^= 0xc;
|
||||
if (uVar1) {
|
||||
uVar6 = TRUE;
|
||||
} else {
|
||||
uVar6 = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) {
|
||||
if (uVar6 == 0) {
|
||||
uVar6 = sub_080040E2(this, &gUnk_08003E44);
|
||||
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) {
|
||||
if (!uVar6) {
|
||||
uVar6 = sub_080040E2(super, &gUnk_08003E44);
|
||||
}
|
||||
}
|
||||
|
||||
if (uVar6 == 0) {
|
||||
if (--this->timer < 0xc) {
|
||||
this->speed = this->speed + -0x10;
|
||||
if (!uVar6) {
|
||||
if (--super->timer < 0xc) {
|
||||
super->speed = super->speed + -0x10;
|
||||
}
|
||||
if (this->timer == 0) {
|
||||
uVar6 = 1;
|
||||
if (super->timer == 0) {
|
||||
uVar6 = TRUE;
|
||||
}
|
||||
if (this->contactFlags & 0x80) {
|
||||
uVar6 = 1;
|
||||
if (super->contactFlags & 0x80) {
|
||||
uVar6 = TRUE;
|
||||
}
|
||||
if (uVar6 == 0) {
|
||||
if (!uVar6) {
|
||||
return;
|
||||
}
|
||||
if (this->field_0x68.HALF.LO == 12) {
|
||||
this->timer = 30;
|
||||
if (this->unk_68 == 12) {
|
||||
super->timer = 30;
|
||||
} else {
|
||||
this->timer = 12;
|
||||
super->timer = 12;
|
||||
}
|
||||
} else {
|
||||
this->timer = 1;
|
||||
super->timer = 1;
|
||||
}
|
||||
|
||||
if (uVar6) {
|
||||
this->action++;
|
||||
this->speed = 0x1c0;
|
||||
super->action++;
|
||||
super->speed = 0x1c0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B7A8(Entity* this) {
|
||||
void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this) {
|
||||
sub_0801B804(this);
|
||||
if (this->timer != 0) {
|
||||
this->timer--;
|
||||
if (super->timer != 0) {
|
||||
super->timer--;
|
||||
} else {
|
||||
sub_0801B864(this);
|
||||
if (this->speed < 0x280) {
|
||||
this->speed += 8;
|
||||
sub_0801B864(super);
|
||||
if (super->speed < 0x280) {
|
||||
super->speed += 8;
|
||||
}
|
||||
this->direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
LinearMoveUpdate(this);
|
||||
if (sub_0800419C(this, &gPlayerEntity, 2, 2) != 0) {
|
||||
super->direction = GetFacingDirection(super, &gPlayerEntity);
|
||||
LinearMoveUpdate(super);
|
||||
if (sub_0800419C(super, &gPlayerEntity, 2, 2) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B804(Entity* this) {
|
||||
void sub_0801B804(PlayerItemBoomerangEntity* this) {
|
||||
EquipSlot equipSlot;
|
||||
u32 uVar1;
|
||||
|
||||
|
@ -225,7 +240,7 @@ void sub_0801B804(Entity* this) {
|
|||
}
|
||||
|
||||
if ((uVar1 & gPlayerState.playerInput.heldInput) == 0) {
|
||||
this->field_0x80.HALF.LO = 1;
|
||||
this->unk_80 = 1;
|
||||
gPlayerState.field_0xa &= ~0x80;
|
||||
gPlayerState.keepFacing &= ~0x80;
|
||||
} else {
|
||||
|
|
|
@ -1,53 +1,67 @@
|
|||
/**
|
||||
* @file playerItemBottle.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Bottle Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
#include "save.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "item.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(Entity*);
|
||||
void PlayerItemBottle_Action1(PlayerItemBottleEntity*);
|
||||
void sub_0801BDE8(Entity*, Entity*);
|
||||
void PlayerItemBottle_UseEmptyBottle2(Entity*);
|
||||
void PlayerItemBottle_UsePotionOrPicolyte(Entity*);
|
||||
void PlayerItemBottle_UseOther(Entity*);
|
||||
void PlayerItemBottle_Init(Entity*);
|
||||
void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity*);
|
||||
void PlayerItemBottle_UseOther(PlayerItemBottleEntity*);
|
||||
void PlayerItemBottle_Init(PlayerItemBottleEntity*);
|
||||
|
||||
extern u32 SetBottleContents(u32 itemID, u32 bottleIndex);
|
||||
extern void sub_0801B9F0(Entity* this);
|
||||
|
||||
void PlayerItemBottle(Entity* this) {
|
||||
static void (*const PlayerItemBottle_Actions[])(Entity*) = {
|
||||
void PlayerItemBottle(PlayerItemBottleEntity* this) {
|
||||
static void (*const PlayerItemBottle_Actions[])(PlayerItemBottleEntity*) = {
|
||||
PlayerItemBottle_Init,
|
||||
PlayerItemBottle_Action1,
|
||||
};
|
||||
PlayerItemBottle_Actions[this->action](this);
|
||||
PlayerItemBottle_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void PlayerItemBottle_Init(Entity* this) {
|
||||
u32 bottleType;
|
||||
void PlayerItemBottle_Init(PlayerItemBottleEntity* this) {
|
||||
u32 bottleContent;
|
||||
|
||||
if (this->field_0x68.HALF.LO == ITEM_QST_DOGFOOD) {
|
||||
bottleType = ITEM_QST_DOGFOOD;
|
||||
if (this->bottleIndex == ITEM_QST_DOGFOOD) {
|
||||
bottleContent = ITEM_QST_DOGFOOD;
|
||||
} else {
|
||||
u32 tmp = this->field_0x68.HALF.LO;
|
||||
bottleType = gSave.saved_status.field_0x24[tmp - 6];
|
||||
u32 tmp = this->bottleIndex;
|
||||
bottleContent = gSave.stats.bottles[tmp - ITEM_BOTTLE1];
|
||||
}
|
||||
this->field_0x6e.HALF.HI = bottleType;
|
||||
switch (bottleType) {
|
||||
this->bottleContent = bottleContent;
|
||||
switch (bottleContent) {
|
||||
case ITEM_BOTTLE_EMPTY:
|
||||
if (AllocMutableHitbox(this) == NULL) {
|
||||
if (AllocMutableHitbox(super) == NULL) {
|
||||
return;
|
||||
}
|
||||
COLLISION_ON(this);
|
||||
this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
this->hurtType = 0x1f;
|
||||
this->type = 1;
|
||||
this->type2 = ITEM_BOTTLE_EMPTY;
|
||||
this->timer = 82;
|
||||
this->subtimer = 27;
|
||||
sub_0801766C(this);
|
||||
COLLISION_ON(super);
|
||||
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
|
||||
super->flags2 = gPlayerEntity.flags2;
|
||||
super->hurtType = 0x1f;
|
||||
super->type = 1;
|
||||
super->type2 = ITEM_BOTTLE_EMPTY;
|
||||
super->timer = 82;
|
||||
super->subtimer = 27;
|
||||
sub_0801766C(super);
|
||||
SoundReq(SFX_1DC);
|
||||
break;
|
||||
case ITEM_BOTTLE_BUTTER:
|
||||
|
@ -61,43 +75,43 @@ void PlayerItemBottle_Init(Entity* this) {
|
|||
case ITEM_BOTTLE_PICOLYTE_GREEN:
|
||||
case ITEM_BOTTLE_PICOLYTE_BLUE:
|
||||
case ITEM_BOTTLE_PICOLYTE_WHITE:
|
||||
this->timer = 213;
|
||||
this->subtimer = 60;
|
||||
super->timer = 213;
|
||||
super->subtimer = 60;
|
||||
break;
|
||||
case BOTTLE_CHARM_NAYRU:
|
||||
case BOTTLE_CHARM_FARORE:
|
||||
case BOTTLE_CHARM_DIN:
|
||||
default:
|
||||
this->timer = 55;
|
||||
this->subtimer = 0;
|
||||
super->timer = 55;
|
||||
super->subtimer = 0;
|
||||
}
|
||||
this->action = 1;
|
||||
this->frameIndex = 0xff;
|
||||
gPlayerState.item = this;
|
||||
LoadSwapGFX(this, 1, 3);
|
||||
super->action = 1;
|
||||
super->frameIndex = 0xff;
|
||||
gPlayerState.item = super;
|
||||
LoadSwapGFX(super, 1, 3);
|
||||
PlayerItemBottle_Action1(this);
|
||||
}
|
||||
|
||||
void PlayerItemBottle_Action1(Entity* this) {
|
||||
int iVar1;
|
||||
void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) {
|
||||
u32 bottleIndex;
|
||||
|
||||
if (gPlayerState.item != this) {
|
||||
if ((this->type == 1) && (this->type2 != ITEM_BOTTLE_EMPTY)) {
|
||||
iVar1 = this->field_0x68.HALF.LO - 0x1c;
|
||||
SetBottleContents(this->type2, iVar1);
|
||||
if (gPlayerState.item != super) {
|
||||
if ((super->type == 1) && (super->type2 != ITEM_BOTTLE_EMPTY)) {
|
||||
bottleIndex = this->bottleIndex - ITEM_BOTTLE1;
|
||||
SetBottleContents(super->type2, bottleIndex);
|
||||
#if defined(EU) || defined(JP) || defined(DEMO_JP)
|
||||
CreateItemEntity(this->type2, iVar1, 5);
|
||||
CreateItemEntity(super->type2, bottleIndex, 5);
|
||||
#else
|
||||
InitItemGetSequence(this->type2, iVar1, 5);
|
||||
InitItemGetSequence(super->type2, bottleIndex, 5);
|
||||
#endif
|
||||
SoundReq(SFX_ITEM_GET);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_0801BDE8(this, &gPlayerEntity);
|
||||
switch (this->field_0x6e.HALF.HI) {
|
||||
sub_0801BDE8(super, &gPlayerEntity);
|
||||
switch (this->bottleContent) {
|
||||
case ITEM_BOTTLE_EMPTY:
|
||||
PlayerItemBottle_UseEmptyBottle2(this);
|
||||
PlayerItemBottle_UseEmptyBottle2(super);
|
||||
break;
|
||||
case ITEM_BOTTLE_BUTTER:
|
||||
case ITEM_BOTTLE_MILK:
|
||||
|
@ -127,15 +141,15 @@ void PlayerItemBottle_UseEmptyBottle2(Entity* this) {
|
|||
PlayerItemBottle_UseEmptyBottle(this);
|
||||
}
|
||||
|
||||
void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) {
|
||||
void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity* this) {
|
||||
u32 health;
|
||||
u32 bottleType;
|
||||
u32 bottleContent;
|
||||
|
||||
bottleType = ITEM_BOTTLE_EMPTY;
|
||||
bottleContent = ITEM_BOTTLE_EMPTY;
|
||||
health = 0;
|
||||
switch (this->field_0x6e.HALF.HI) {
|
||||
switch (this->bottleContent) {
|
||||
case ITEM_BOTTLE_MILK:
|
||||
bottleType = ITEM_BOTTLE_HALF_MILK;
|
||||
bottleContent = ITEM_BOTTLE_HALF_MILK;
|
||||
case ITEM_BOTTLE_HALF_MILK:
|
||||
health = 40;
|
||||
break;
|
||||
|
@ -152,69 +166,69 @@ void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) {
|
|||
case ITEM_BOTTLE_PICOLYTE_GREEN:
|
||||
case ITEM_BOTTLE_PICOLYTE_BLUE:
|
||||
case ITEM_BOTTLE_PICOLYTE_WHITE:
|
||||
gSave.stats.picolyteType = this->field_0x6e.HALF.HI;
|
||||
gSave.stats.picolyteType = this->bottleContent;
|
||||
gSave.stats.picolyteTimer = 900;
|
||||
SoundReq(SFX_PICOLYTE);
|
||||
break;
|
||||
}
|
||||
ModHealth(health);
|
||||
SetBottleContents(bottleType, this->field_0x68.HALF.LO - 0x1c);
|
||||
SetBottleContents(bottleContent, this->bottleIndex - 0x1c);
|
||||
}
|
||||
|
||||
void PlayerItemBottle_UseOther(Entity* this) {
|
||||
void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) {
|
||||
if (gPlayerEntity.frame == 1) {
|
||||
if (this->field_0x6e.HALF.HI != 0x36) {
|
||||
SetBottleContents(ITEM_BOTTLE_EMPTY, this->field_0x68.HALF.LO - 0x1c);
|
||||
if (this->bottleContent != ITEM_QST_DOGFOOD) {
|
||||
SetBottleContents(ITEM_BOTTLE_EMPTY, this->bottleIndex - 0x1c);
|
||||
}
|
||||
switch (this->field_0x6e.HALF.HI) {
|
||||
switch (this->bottleContent) {
|
||||
case ITEM_BOTTLE_WATER:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0);
|
||||
break;
|
||||
case ITEM_BOTTLE_MINERAL_WATER:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 1);
|
||||
break;
|
||||
case ITEM_BOTTLE_FAIRY:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 2, 2);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 2, 2);
|
||||
ModHealth(0x20);
|
||||
break;
|
||||
case BOTTLE_CHARM_NAYRU:
|
||||
case BOTTLE_CHARM_FARORE:
|
||||
case BOTTLE_CHARM_DIN:
|
||||
gSave.stats.charm = this->field_0x6e.HALF.HI;
|
||||
gSave.stats.charm = this->bottleContent;
|
||||
gSave.stats.charmTimer = 3600;
|
||||
SoundReq(SFX_ELEMENT_CHARGE);
|
||||
}
|
||||
}
|
||||
if (gPlayerEntity.frame == 2) {
|
||||
switch (this->field_0x6e.HALF.HI) {
|
||||
switch (this->bottleContent) {
|
||||
case ITEM_BOTTLE_WATER:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0);
|
||||
break;
|
||||
case ITEM_BOTTLE_MINERAL_WATER:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (gPlayerEntity.frame == 3) {
|
||||
switch (this->field_0x6e.HALF.HI) {
|
||||
switch (this->bottleContent) {
|
||||
case ITEM_BOTTLE_WATER:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0);
|
||||
break;
|
||||
case ITEM_BOTTLE_MINERAL_WATER:
|
||||
CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 0);
|
||||
CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801BDE8(Entity* this, Entity* ent2) {
|
||||
u32 uVar1;
|
||||
u32 frameIndex;
|
||||
u32 flipX;
|
||||
u32 animationState;
|
||||
|
||||
uVar1 = (ent2->frameIndex - this->timer) + this->subtimer;
|
||||
if (uVar1 != this->frameIndex) {
|
||||
this->frameIndex = uVar1;
|
||||
frameIndex = (ent2->frameIndex - this->timer) + this->subtimer;
|
||||
if (frameIndex != this->frameIndex) {
|
||||
this->frameIndex = frameIndex;
|
||||
sub_080042D0(this, this->frameIndex, (u16)this->spriteIndex);
|
||||
}
|
||||
flipX = ent2->spriteSettings.flipX;
|
||||
|
@ -235,8 +249,8 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
|
|||
16, -12, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
};
|
||||
int iVar2;
|
||||
Hitbox* pHVar5;
|
||||
s32 iVar2;
|
||||
Hitbox* hitbox;
|
||||
const u8* ptr;
|
||||
const s8* ptr2;
|
||||
|
||||
|
@ -256,11 +270,11 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
|
|||
|
||||
ptr = &bottleHitboxParameters[(this->frameIndex - 0x1b) * 4];
|
||||
if (this->spriteSettings.flipX != 0) {
|
||||
pHVar5 = this->hitbox;
|
||||
pHVar5->offset_x = -ptr[0];
|
||||
hitbox = this->hitbox;
|
||||
hitbox->offset_x = -ptr[0];
|
||||
} else {
|
||||
pHVar5 = this->hitbox;
|
||||
pHVar5->offset_x = ptr[0];
|
||||
hitbox = this->hitbox;
|
||||
hitbox->offset_x = ptr[0];
|
||||
}
|
||||
this->hitbox->offset_y = ptr[1];
|
||||
this->hitbox->width = ptr[2];
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
/**
|
||||
* @file playerItemBow.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Bow Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "asm.h"
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
#include "object.h"
|
||||
#include "playeritem.h"
|
||||
#include "sound.h"
|
||||
#include "save.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68;
|
||||
u8 unk_69[3];
|
||||
u32 unk_6c;
|
||||
u32 unk_70;
|
||||
u32 unk_74;
|
||||
u32 unk_78;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ u8 unk_69[3];
|
||||
/*0x6c*/ u32 unk_6c;
|
||||
/*0x70*/ u32 unk_70;
|
||||
/*0x74*/ u32 unk_74;
|
||||
/*0x78*/ u32 unk_78;
|
||||
} PlayerItemBowEntity;
|
||||
|
||||
typedef struct {
|
||||
|
@ -37,20 +42,20 @@ extern Entity* sub_08008782(Entity*, u32, s32, s32);
|
|||
extern void sub_08017744(Entity*);
|
||||
extern void ModArrows(s32);
|
||||
|
||||
void sub_08019468(PlayerItemBowEntity*);
|
||||
void sub_08018FE4(PlayerItemBowEntity*);
|
||||
void sub_0801917C(PlayerItemBowEntity*);
|
||||
void sub_08019410(PlayerItemBowEntity*);
|
||||
void sub_08019444(PlayerItemBowEntity*);
|
||||
void sub_08019468(PlayerItemBowEntity* this);
|
||||
void PlayerItemBow_Init(PlayerItemBowEntity* this);
|
||||
void PlayerItemBow_Action1(PlayerItemBowEntity* this);
|
||||
void PlayerItemBow_Action2(PlayerItemBowEntity* this);
|
||||
void PlayerItemBow_Action3(PlayerItemBowEntity* this);
|
||||
|
||||
void PlayerItemBow(Entity* this) {
|
||||
static void (*const gUnk_080B3E30[])(PlayerItemBowEntity*) = {
|
||||
sub_08018FE4,
|
||||
sub_0801917C,
|
||||
sub_08019410,
|
||||
sub_08019444,
|
||||
static void (*const PlayerItemBow_Actions[])(PlayerItemBowEntity*) = {
|
||||
PlayerItemBow_Init,
|
||||
PlayerItemBow_Action1,
|
||||
PlayerItemBow_Action2,
|
||||
PlayerItemBow_Action3,
|
||||
};
|
||||
gUnk_080B3E30[this->action]((PlayerItemBowEntity*)this);
|
||||
PlayerItemBow_Actions[this->action]((PlayerItemBowEntity*)this);
|
||||
}
|
||||
|
||||
static const Hitbox gUnk_080B3E70;
|
||||
|
@ -66,14 +71,14 @@ static const struct_080B3E40 gUnk_080B3E40[] = {
|
|||
static const Hitbox gUnk_080B3E70 = { 0, 0, { 4, 0, 0, 0 }, 6, 4 };
|
||||
static const Hitbox gUnk_080B3E78 = { 0, 0, { 0, 0, 0, 4 }, 4, 6 };
|
||||
|
||||
void sub_08018FE4(PlayerItemBowEntity* this) {
|
||||
void PlayerItemBow_Init(PlayerItemBowEntity* this) {
|
||||
Entity* object;
|
||||
const struct_080B3E40* ptr;
|
||||
super->action = 1;
|
||||
if (super->type != 0) {
|
||||
super->spriteSettings.draw = 1;
|
||||
super->flags |= 0x80;
|
||||
this->unk_74 = 0x6a;
|
||||
this->unk_74 = 106;
|
||||
super->hurtType = super->type2;
|
||||
super->spriteIndex = 0xa6;
|
||||
if (super->hurtType == 0x0e) {
|
||||
|
@ -114,7 +119,7 @@ void sub_08018FE4(PlayerItemBowEntity* this) {
|
|||
LoadSwapGFX(super, 1, 3);
|
||||
sub_08079BD8(super);
|
||||
if (this->unk_68 == 0xa) {
|
||||
this->unk_78 = 0x3c;
|
||||
this->unk_78 = 60;
|
||||
object = CreateObject(SWORD_PARTICLE, super->type, 1);
|
||||
if (object != NULL) {
|
||||
CopyPosition(super, object);
|
||||
|
@ -122,11 +127,11 @@ void sub_08018FE4(PlayerItemBowEntity* this) {
|
|||
} else {
|
||||
this->unk_78 = 0;
|
||||
}
|
||||
sub_0801917C(this);
|
||||
PlayerItemBow_Action1(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801917C(PlayerItemBowEntity* this) {
|
||||
void PlayerItemBow_Action1(PlayerItemBowEntity* this) {
|
||||
u8 arrowCount;
|
||||
bool32 tmp2;
|
||||
s32 tmp3;
|
||||
|
@ -138,7 +143,7 @@ void sub_0801917C(PlayerItemBowEntity* this) {
|
|||
DeleteThisEntity();
|
||||
}
|
||||
GetNextFrame(super);
|
||||
if (this->unk_74 < 0x18) {
|
||||
if (this->unk_74 < 24) {
|
||||
super->spriteSettings.draw ^= 1;
|
||||
}
|
||||
LinearMoveUpdate(super);
|
||||
|
@ -238,7 +243,7 @@ void sub_0801917C(PlayerItemBowEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08019410(PlayerItemBowEntity* this) {
|
||||
void PlayerItemBow_Action2(PlayerItemBowEntity* this) {
|
||||
if (super->timer < 0xf) {
|
||||
InitializeAnimation(super, super->animIndex);
|
||||
} else {
|
||||
|
@ -249,7 +254,7 @@ void sub_08019410(PlayerItemBowEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08019444(PlayerItemBowEntity* this) {
|
||||
void PlayerItemBow_Action3(PlayerItemBowEntity* this) {
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
if (GravityUpdate(super, Q_8_8(32.0)) == 0) {
|
||||
|
@ -258,7 +263,7 @@ void sub_08019444(PlayerItemBowEntity* this) {
|
|||
}
|
||||
|
||||
void sub_08019468(PlayerItemBowEntity* this) {
|
||||
if (super->hurtType == 0x0e) {
|
||||
if (super->hurtType == 0xe) {
|
||||
CreateFx(super, FX_REFLECT5, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,77 +1,84 @@
|
|||
/**
|
||||
* @file playerItemCellOverwriteSet.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Cell Overwrite Set Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "common.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
#include "common.h"
|
||||
#include "asm.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[4];
|
||||
/*0x6c*/ u16 tileType;
|
||||
} PlayerItemCellOverwriteSetEntity;
|
||||
|
||||
extern const u8 gUnk_080B7910[];
|
||||
extern const u8 gUnk_080B79A7[];
|
||||
extern const u8 gUnk_080B7A3E[]; // TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4
|
||||
|
||||
void PlayerItemCellOverwriteSet(Entity* this) {
|
||||
void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) {
|
||||
static const s8 gUnk_080B7B6C[] = { 0x0, -0x10, 0x10, 0x0, 0x0, 0x10, -0x10, 0x0 };
|
||||
u32 tmp;
|
||||
Entity* player = &gPlayerEntity;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->field_0x6c.HWORD =
|
||||
GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe],
|
||||
player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]),
|
||||
this->collisionLayer);
|
||||
this->action++;
|
||||
if (super->action == 0) {
|
||||
this->tileType = GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe],
|
||||
player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]),
|
||||
super->collisionLayer);
|
||||
super->action++;
|
||||
}
|
||||
gPlayerState.mobility |= 0x80;
|
||||
tmp = gInput.heldKeys & R_BUTTON;
|
||||
if ((gInput.heldKeys & A_BUTTON) != 0) {
|
||||
if ((R_BUTTON & gInput.newKeys) != 0) {
|
||||
this->field_0x6c.HWORD =
|
||||
GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe],
|
||||
player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]),
|
||||
this->collisionLayer);
|
||||
this->tileType = GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe],
|
||||
player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]),
|
||||
super->collisionLayer);
|
||||
}
|
||||
if ((gInput.heldKeys & R_BUTTON) != 0) {
|
||||
player->iframes = 2;
|
||||
} else {
|
||||
if ((gInput.newKeys & DPAD_RIGHT) != 0) {
|
||||
this->field_0x6c.HWORD--;
|
||||
this->tileType--;
|
||||
}
|
||||
if ((gInput.newKeys & DPAD_LEFT) != 0) {
|
||||
this->field_0x6c.HWORD++;
|
||||
this->tileType++;
|
||||
}
|
||||
if ((gInput.heldKeys & (DPAD_LEFT | DPAD_RIGHT)) != 0) {
|
||||
if (++this->subtimer > 0x1e) {
|
||||
this->subtimer = 30;
|
||||
if (++super->subtimer > 0x1e) {
|
||||
super->subtimer = 30;
|
||||
if ((gInput.heldKeys & DPAD_RIGHT) != 0) {
|
||||
this->field_0x6c.HWORD--;
|
||||
this->tileType--;
|
||||
}
|
||||
if ((gInput.heldKeys & DPAD_LEFT) != 0) {
|
||||
this->field_0x6c.HWORD++;
|
||||
this->tileType++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this->subtimer = 0;
|
||||
super->subtimer = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sub_0807B7D8(this->field_0x6c.HWORD,
|
||||
sub_0807B7D8(this->tileType,
|
||||
TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe],
|
||||
player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]),
|
||||
this->collisionLayer);
|
||||
super->collisionLayer);
|
||||
gPlayerState.mobility &= ~0x80;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((gInput.heldKeys & B_BUTTON) != 0) {
|
||||
sub_0807B7D8(this->field_0x6c.HWORD,
|
||||
TILE(player->x.HALF.HI + gUnk_080B7B6C[0], player->y.HALF.HI + gUnk_080B7B6C[1]),
|
||||
this->collisionLayer);
|
||||
sub_0807B7D8(this->field_0x6c.HWORD,
|
||||
TILE(player->x.HALF.HI + gUnk_080B7B6C[2], player->y.HALF.HI + gUnk_080B7B6C[3]),
|
||||
this->collisionLayer);
|
||||
sub_0807B7D8(this->field_0x6c.HWORD,
|
||||
TILE(player->x.HALF.HI + gUnk_080B7B6C[4], player->y.HALF.HI + gUnk_080B7B6C[5]),
|
||||
this->collisionLayer);
|
||||
sub_0807B7D8(this->field_0x6c.HWORD,
|
||||
TILE(player->x.HALF.HI + gUnk_080B7B6C[6], player->y.HALF.HI + gUnk_080B7B6C[7]),
|
||||
this->collisionLayer);
|
||||
sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[0], player->y.HALF.HI + gUnk_080B7B6C[1]),
|
||||
super->collisionLayer);
|
||||
sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[2], player->y.HALF.HI + gUnk_080B7B6C[3]),
|
||||
super->collisionLayer);
|
||||
sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[4], player->y.HALF.HI + gUnk_080B7B6C[5]),
|
||||
super->collisionLayer);
|
||||
sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[6], player->y.HALF.HI + gUnk_080B7B6C[7]),
|
||||
super->collisionLayer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,52 +1,56 @@
|
|||
|
||||
/**
|
||||
* @file playerItemDashSword.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Dash Sword Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
|
||||
extern Entity* sub_08008782(Entity*, u32, s32, s32);
|
||||
|
||||
void sub_0801B8FC(Entity*);
|
||||
void sub_0801B8B0(Entity*);
|
||||
void sub_0801B938(Entity*);
|
||||
void PlayerItemDashSword_Action1(Entity* this);
|
||||
void PlayerItemDashSword_Init(Entity* this);
|
||||
void sub_0801B938(Entity* this);
|
||||
|
||||
extern void sub_08017744(Entity*);
|
||||
|
||||
void PlayerItemDashSword(Entity* this) {
|
||||
static void (*const PlayerItemC_Actions[])(Entity*) = {
|
||||
sub_0801B8B0,
|
||||
sub_0801B8FC,
|
||||
static void (*const PlayerItemDashSword_Actions[])(Entity*) = {
|
||||
PlayerItemDashSword_Init,
|
||||
PlayerItemDashSword_Action1,
|
||||
};
|
||||
PlayerItemC_Actions[this->action](this);
|
||||
PlayerItemDashSword_Actions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_0801B8B0(Entity* this) {
|
||||
void PlayerItemDashSword_Init(Entity* this) {
|
||||
if (gPlayerState.dash_state != 0) {
|
||||
gPlayerState.item = this;
|
||||
this->flags |= ENT_PERSIST;
|
||||
this->action = 0x01;
|
||||
this->action = 1;
|
||||
this->flags2 = 8;
|
||||
LoadSwapGFX(this, 1, 3);
|
||||
sub_08079BD8(this);
|
||||
sub_0801766C(this);
|
||||
sub_0801B8FC(this);
|
||||
PlayerItemDashSword_Action1(this);
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B8FC(Entity* this) {
|
||||
Entity* pbVar1;
|
||||
pbVar1 = (Entity*)gPlayerState.item;
|
||||
if ((Entity*)gPlayerState.item != this) {
|
||||
void PlayerItemDashSword_Action1(Entity* this) {
|
||||
if (gPlayerState.item != this) {
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
if (gPlayerState.dash_state == 0) {
|
||||
gPlayerState.item = NULL;
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
pbVar1->flags |= ENT_COLLIDE;
|
||||
pbVar1->collisionFlags = 0x21;
|
||||
sub_0801B938(pbVar1);
|
||||
this->flags |= ENT_COLLIDE;
|
||||
this->collisionFlags = 0x21;
|
||||
sub_0801B938(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,46 +1,52 @@
|
|||
/**
|
||||
* @file playerItemFireRodProjectile.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Fire Rod Projectile Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "sound.h"
|
||||
#include "physics.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "physics.h"
|
||||
#include "playeritem.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk68;
|
||||
u16 unk6a;
|
||||
u32 unk6c;
|
||||
} FireRodProjectileEntity;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x6a*/ u8 unused[2];
|
||||
/*0x6c*/ u32 unk_6c;
|
||||
} PlayerItemFireRodProjectileEntity;
|
||||
|
||||
extern u8 gUnk_08003E44;
|
||||
|
||||
void sub_080A3084(FireRodProjectileEntity*);
|
||||
void sub_080A310C(FireRodProjectileEntity*);
|
||||
void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this);
|
||||
void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this);
|
||||
|
||||
void PlayerItemFireRodProjectile(Entity* this) {
|
||||
static void (*const actionFuncs[])(FireRodProjectileEntity*) = {
|
||||
sub_080A3084,
|
||||
sub_080A310C,
|
||||
static void (*const PlayerItemFireRodProjectile_Actions[])(PlayerItemFireRodProjectileEntity*) = {
|
||||
PlayerItemFireRodProjectile_Init,
|
||||
PlayerItemFireRodProjectile_Action1,
|
||||
};
|
||||
actionFuncs[this->action]((FireRodProjectileEntity*)this);
|
||||
PlayerItemFireRodProjectile_Actions[this->action]((PlayerItemFireRodProjectileEntity*)this);
|
||||
}
|
||||
|
||||
void sub_080A3084(FireRodProjectileEntity* this) {
|
||||
void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this) {
|
||||
static const Hitbox gUnk_08127278 = { 0, 0, { 4, 2, 2, 4 }, 6, 6 };
|
||||
super->spriteSettings.draw = 1;
|
||||
super->action = 0x01;
|
||||
super->action = 1;
|
||||
CopyPosition(super->parent, super);
|
||||
if (super->type == 0) {
|
||||
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
|
||||
super->hitbox = (Hitbox*)&gUnk_08127278;
|
||||
super->speed = 0x400;
|
||||
if (super->collisionLayer == 0x02) {
|
||||
super->type2 = 0x01;
|
||||
if (super->collisionLayer == 2) {
|
||||
super->type2 = 1;
|
||||
}
|
||||
super->direction = Direction8FromAnimationState(super->animationState);
|
||||
this->unk6c = 60;
|
||||
this->unk_6c = 60;
|
||||
sub_0801766C(super);
|
||||
LinearMoveUpdate(super);
|
||||
SoundReq(SFX_ITEM_SWORD_BEAM);
|
||||
|
@ -48,17 +54,17 @@ void sub_080A3084(FireRodProjectileEntity* this) {
|
|||
super->timer = 6;
|
||||
}
|
||||
InitializeAnimation(super, 0x18);
|
||||
sub_080A310C(this);
|
||||
PlayerItemFireRodProjectile_Action1(this);
|
||||
}
|
||||
|
||||
void sub_080A310C(FireRodProjectileEntity* this) {
|
||||
void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this) {
|
||||
if (super->type != 0) {
|
||||
if (super->timer-- == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
GetNextFrame(super);
|
||||
if (this->unk6c-- != 0) {
|
||||
if (this->unk_6c-- != 0) {
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
super->timer++;
|
||||
|
@ -77,7 +83,7 @@ void sub_080A310C(FireRodProjectileEntity* this) {
|
|||
if (sub_08008790(super, 0xc)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk68);
|
||||
super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk_68);
|
||||
if (super->child != NULL) {
|
||||
super->child->parent = super;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
/**
|
||||
* @file playerItemGust.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Gust Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "player.h"
|
||||
#include "playeritem.h"
|
||||
|
||||
enum {
|
||||
|
@ -12,20 +18,21 @@ enum {
|
|||
};
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u32 filler68[2];
|
||||
u32 timer;
|
||||
u32 offset_iter;
|
||||
u32 unk78;
|
||||
} GustEntity;
|
||||
typedef void(GustActionFunc)(GustEntity*);
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u32 filler68[2];
|
||||
/*0x70*/ u32 timer;
|
||||
/*0x74*/ u32 offset_iter;
|
||||
/*0x78*/ u32 unk78;
|
||||
} PlayerItemGustEntity;
|
||||
|
||||
typedef void(GustActionFunc)(PlayerItemGustEntity*);
|
||||
|
||||
static GustActionFunc PlayerItemGust_Init;
|
||||
static GustActionFunc PlayerItemGust_Update;
|
||||
|
||||
static void sub_080ACC78(GustEntity*);
|
||||
/*static*/ bool32 sub_080ACDB0(GustEntity*);
|
||||
static void sub_080ACECC(GustEntity*);
|
||||
static void sub_080ACC78(PlayerItemGustEntity*);
|
||||
/*static*/ bool32 sub_080ACDB0(PlayerItemGustEntity*);
|
||||
static void sub_080ACECC(PlayerItemGustEntity*);
|
||||
|
||||
typedef struct {
|
||||
u16 bits;
|
||||
|
@ -50,7 +57,7 @@ extern const s8 gUnk_08126EE4[];
|
|||
// type 2: same as 1?
|
||||
// type 3: horizontal spread
|
||||
void PlayerItemGust(Entity* this) {
|
||||
static GustActionFunc* const sActions[] = {
|
||||
static GustActionFunc* const PlayerItemGust_Actions[] = {
|
||||
PlayerItemGust_Init,
|
||||
PlayerItemGust_Update,
|
||||
};
|
||||
|
@ -58,11 +65,11 @@ void PlayerItemGust(Entity* this) {
|
|||
if ((gPlayerState.field_0x1c & 0x7f) != 1) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sActions[this->action]((GustEntity*)this);
|
||||
PlayerItemGust_Actions[this->action]((PlayerItemGustEntity*)this);
|
||||
this->iframes = 0;
|
||||
}
|
||||
|
||||
static void PlayerItemGust_Init(GustEntity* this) {
|
||||
static void PlayerItemGust_Init(PlayerItemGustEntity* this) {
|
||||
super->action = GUST_UPDATE;
|
||||
super->flags2 = gPlayerEntity.flags2;
|
||||
super->direction = super->animationState << 2;
|
||||
|
@ -75,14 +82,14 @@ static void PlayerItemGust_Init(GustEntity* this) {
|
|||
sub_0801766C(super);
|
||||
}
|
||||
|
||||
static void PlayerItemGust_Update(GustEntity* this) {
|
||||
static void PlayerItemGust_Update(PlayerItemGustEntity* this) {
|
||||
if (sub_080ACDB0(this) == FALSE) {
|
||||
sub_080ACC78(this);
|
||||
sub_080ACECC(this);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_080ACC78(GustEntity* this) {
|
||||
static void sub_080ACC78(PlayerItemGustEntity* this) {
|
||||
s32 width;
|
||||
Obj11* o;
|
||||
Entity* child;
|
||||
|
@ -151,7 +158,7 @@ static void sub_080ACC78(GustEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
bool32 sub_080ACDB0(GustEntity* this) {
|
||||
bool32 sub_080ACDB0(PlayerItemGustEntity* this) {
|
||||
s32 sVar2;
|
||||
s32 sVar3;
|
||||
Entity* pEVar4;
|
||||
|
@ -217,7 +224,7 @@ bool32 sub_080ACDB0(GustEntity* this) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void sub_080ACECC(GustEntity* this) {
|
||||
static void sub_080ACECC(PlayerItemGustEntity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (super->type < 3 && super->child == NULL && (s32)this->unk78 >= 0 && gUnk_0812AAE8[super->type] <= this->unk78) {
|
||||
|
|
|
@ -1,31 +1,46 @@
|
|||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
/**
|
||||
* @file playerItemGustBig.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @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"
|
||||
|
||||
extern void sub_08078CD0(Entity*);
|
||||
extern void sub_08018FA0(Entity*);
|
||||
extern void sub_08018CBC(Entity*);
|
||||
extern void sub_08018DE8(Entity*);
|
||||
extern void sub_08018E68(Entity*);
|
||||
extern void sub_08018F6C(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[24];
|
||||
/*0x80*/ u32 unk_80;
|
||||
/*0x84*/ u32 unk_84;
|
||||
} PlayerItemGustBigEntity;
|
||||
|
||||
extern void sub_08078CD0(Entity* this);
|
||||
extern void sub_08018FA0(Entity* this);
|
||||
extern void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this);
|
||||
extern void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this);
|
||||
extern void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this);
|
||||
extern void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this);
|
||||
|
||||
extern u32 sub_08007DD6(u32, const u16*);
|
||||
|
||||
extern const u8 gUnk_08003E44[];
|
||||
|
||||
void PlayerItemGustBig(Entity* this) {
|
||||
static void (*const gUnk_080B3DD0[])(Entity*) = {
|
||||
sub_08018CBC,
|
||||
sub_08018DE8,
|
||||
sub_08018E68,
|
||||
sub_08018F6C,
|
||||
void PlayerItemGustBig(PlayerItemGustBigEntity* this) {
|
||||
static void (*const PlayerItemGustBig_Actions[])(PlayerItemGustBigEntity*) = {
|
||||
PlayerItemGustBig_Init,
|
||||
PlayerItemGustBig_Action1,
|
||||
PlayerItemGustBig_Action2,
|
||||
PlayerItemGustBig_Action3,
|
||||
};
|
||||
if (this->health) {
|
||||
this->iframes = 0;
|
||||
gUnk_080B3DD0[this->action](this);
|
||||
if (super->health) {
|
||||
super->iframes = 0;
|
||||
PlayerItemGustBig_Actions[super->action](this);
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
@ -48,95 +63,95 @@ static const Hitbox gUnk_080B3E18 = { 0, 0, { 6, 3, 3, 6 }, 6, 6 };
|
|||
static const Hitbox gUnk_080B3E20 = { 0, 0, { 6, 3, 3, 6 }, 8, 8 };
|
||||
static const Hitbox gUnk_080B3E28 = { 0, 0, { 6, 3, 3, 6 }, 12, 12 };
|
||||
|
||||
void sub_08018CBC(Entity* this) {
|
||||
void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) {
|
||||
u32 PVar1;
|
||||
u8 uVar2;
|
||||
Entity* pEVar3;
|
||||
|
||||
*(u32*)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD;
|
||||
*(u32*)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD;
|
||||
uVar2 = this->animationState = gPlayerEntity.animationState & 0xe;
|
||||
this->direction = (u8)(uVar2 << 2);
|
||||
this->speed = 0x400;
|
||||
this->hitType = 0x96;
|
||||
this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80;
|
||||
this->flags2 = gPlayerEntity.flags2;
|
||||
pEVar3 = this->child;
|
||||
this->unk_84 = super->x.WORD = gPlayerEntity.x.WORD;
|
||||
this->unk_80 = super->y.WORD = gPlayerEntity.y.WORD;
|
||||
uVar2 = super->animationState = gPlayerEntity.animationState & 0xe;
|
||||
super->direction = (u8)(uVar2 << 2);
|
||||
super->speed = 0x400;
|
||||
super->hitType = 0x96;
|
||||
super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80;
|
||||
super->flags2 = gPlayerEntity.flags2;
|
||||
pEVar3 = super->child;
|
||||
if (pEVar3 != NULL) {
|
||||
this->action = 1;
|
||||
COLLISION_OFF(this);
|
||||
this->timer = 86;
|
||||
this->hurtType = 0x1c;
|
||||
this->damage = 6;
|
||||
this->hitbox = (Hitbox*)&gUnk_080B3E18;
|
||||
this->child->spriteOffsetX = 0;
|
||||
this->child->spriteSettings.draw = 0;
|
||||
super->action = 1;
|
||||
COLLISION_OFF(super);
|
||||
super->timer = 86;
|
||||
super->hurtType = 0x1c;
|
||||
super->damage = 6;
|
||||
super->hitbox = (Hitbox*)&gUnk_080B3E18;
|
||||
super->child->spriteOffsetX = 0;
|
||||
super->child->spriteSettings.draw = 0;
|
||||
} else {
|
||||
if (gPlayerState.field_0x1c == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 2;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->spriteIndex = 0xa6;
|
||||
this->palette.raw = 0x33;
|
||||
this->spriteVramOffset = 0;
|
||||
this->type = gPlayerState.gustJarSpeed - 1;
|
||||
this->timer = gUnk_080B3DE0[this->type * 2];
|
||||
this->damage = gUnk_080B3DE0[this->type * 2 + 1];
|
||||
this->hurtType = 0x1b;
|
||||
this->hitbox = (Hitbox*)gUnk_080B3DE8[this->type];
|
||||
(u32*)gPlayerEntity.field_0x70.WORD = this;
|
||||
super->action = 2;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->spriteIndex = 0xa6;
|
||||
super->palette.raw = 0x33;
|
||||
super->spriteVramOffset = 0;
|
||||
super->type = gPlayerState.gustJarSpeed - 1;
|
||||
super->timer = gUnk_080B3DE0[super->type * 2];
|
||||
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);
|
||||
(u32*)gPlayerEntity.field_0x70.WORD = pEVar3;
|
||||
InitializeAnimation(this, this->type + 10);
|
||||
sub_08018FA0(this);
|
||||
gNewPlayerEntity.unk_70 = pEVar3;
|
||||
InitializeAnimation(super, super->type + 10);
|
||||
sub_08018FA0(super);
|
||||
}
|
||||
sub_0801766C(this);
|
||||
sub_0801766C(super);
|
||||
}
|
||||
|
||||
void sub_08018DE8(Entity* this) {
|
||||
void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this) {
|
||||
u8 bVar1;
|
||||
|
||||
bVar1 = this->child->gustJarState & 4;
|
||||
bVar1 = super->child->gustJarState & 4;
|
||||
if (bVar1 == 0) {
|
||||
gPlayerState.field_0x1c = bVar1;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
switch (gPlayerState.field_0x1c) {
|
||||
case 0:
|
||||
sub_08018F6C(this);
|
||||
PlayerItemGustBig_Action3(this);
|
||||
break;
|
||||
case 5:
|
||||
this->child->subAction = 4;
|
||||
COLLISION_ON(this);
|
||||
this->action = 2;
|
||||
this->spritePriority.b0 = 2;
|
||||
this->child->spriteSettings.draw = 1;
|
||||
sub_08018FA0(this);
|
||||
super->child->subAction = 4;
|
||||
COLLISION_ON(super);
|
||||
super->action = 2;
|
||||
super->spritePriority.b0 = 2;
|
||||
super->child->spriteSettings.draw = 1;
|
||||
sub_08018FA0(super);
|
||||
break;
|
||||
}
|
||||
sub_08078CD0(&gPlayerEntity);
|
||||
}
|
||||
|
||||
void sub_08018E68(Entity* this) {
|
||||
void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this) {
|
||||
s32 y;
|
||||
s32 x;
|
||||
if (this->child == NULL) {
|
||||
GetNextFrame(this);
|
||||
sub_08008790(this, 5);
|
||||
if (super->child == NULL) {
|
||||
GetNextFrame(super);
|
||||
sub_08008790(super, 5);
|
||||
} else {
|
||||
if ((this->child->gustJarState & 4) == 0) {
|
||||
if ((super->child->gustJarState & 4) == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((this->contactFlags & 0x80) != 0) {
|
||||
sub_08018F6C(this);
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
PlayerItemGustBig_Action3(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this->timer-- != 0) {
|
||||
LinearMoveUpdate(this);
|
||||
if (super->timer-- != 0) {
|
||||
LinearMoveUpdate(super);
|
||||
|
||||
switch (this->direction) {
|
||||
switch (super->direction) {
|
||||
case DirectionNorth:
|
||||
x = 0;
|
||||
y = -4;
|
||||
|
@ -154,38 +169,38 @@ void sub_08018E68(Entity* this) {
|
|||
y = 0;
|
||||
break;
|
||||
}
|
||||
if (this->child != NULL) {
|
||||
this->child->direction = this->direction;
|
||||
CopyPosition(this, this->child);
|
||||
if (super->child != NULL) {
|
||||
super->child->direction = super->direction;
|
||||
CopyPosition(super, super->child);
|
||||
}
|
||||
if (this->type2 == 0) {
|
||||
sub_0800451C(this);
|
||||
if (super->type2 == 0) {
|
||||
sub_0800451C(super);
|
||||
}
|
||||
if (sub_08007DD6(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) {
|
||||
if (sub_08007DD6(sub_080B1A0C(super, x, y), gUnk_080B3DF4) != 0) {
|
||||
return;
|
||||
}
|
||||
if (GetRelativeCollisionTile(this, x, y) == 0x74) {
|
||||
if (GetRelativeCollisionTile(super, x, y) == 0x74) {
|
||||
return;
|
||||
}
|
||||
if (sub_080040D8(this, (u8*)gUnk_08003E44, this->x.HALF.HI + x, this->y.HALF.HI + y) == 0) {
|
||||
if (sub_080040D8(super, (u8*)gUnk_08003E44, super->x.HALF.HI + x, super->y.HALF.HI + y) == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->child == NULL) {
|
||||
InitializeAnimation(this, this->type + 0xd);
|
||||
if (super->child == NULL) {
|
||||
InitializeAnimation(super, super->type + 0xd);
|
||||
}
|
||||
this->action++;
|
||||
sub_08018F6C(this);
|
||||
super->action++;
|
||||
PlayerItemGustBig_Action3(this);
|
||||
}
|
||||
|
||||
void sub_08018F6C(Entity* this) {
|
||||
if (this->child != NULL) {
|
||||
this->child->subAction = 5;
|
||||
this->child->spriteSettings.draw = 1;
|
||||
void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this) {
|
||||
if (super->child != NULL) {
|
||||
super->child->subAction = 5;
|
||||
super->child->spriteSettings.draw = 1;
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
if (this->frame == 0) {
|
||||
GetNextFrame(super);
|
||||
if (super->frame == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -194,8 +209,8 @@ void sub_08018F6C(Entity* this) {
|
|||
|
||||
void sub_08018FA0(Entity* this) {
|
||||
this->collisionLayer = gPlayerEntity.collisionLayer;
|
||||
if (this->collisionLayer == 0x02) {
|
||||
this->type2 = 0x01;
|
||||
if (this->collisionLayer == 2) {
|
||||
this->type2 = 1;
|
||||
}
|
||||
SoundReq(this->type + SFX_EA);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
/**
|
||||
* @file playerItemGustJar.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Gust Jar Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
#include "sound.h"
|
||||
|
||||
extern const u8* gUnk_08132714[]; // Anim index lists?
|
||||
|
@ -18,7 +25,7 @@ void sub_080ADCDC(Entity*, u32);
|
|||
void sub_080ADCA0(Entity*, u32);
|
||||
|
||||
void PlayerItemGustJar(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
static void (*const PlayerItemGustJar_Actions[])(Entity*) = {
|
||||
PlayerItemGustJar_Init, PlayerItemGustJar_Action1, PlayerItemGustJar_Action2,
|
||||
PlayerItemGustJar_Action3, PlayerItemGustJar_Action4,
|
||||
};
|
||||
|
@ -26,7 +33,7 @@ void PlayerItemGustJar(Entity* this) {
|
|||
if (((Entity*)gPlayerState.item != this) || (gPlayerState.field_0x1c == 0)) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
actionFuncs[this->action](this);
|
||||
PlayerItemGustJar_Actions[this->action](this);
|
||||
sub_08078E84(this, &gPlayerEntity);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
/**
|
||||
* @file playerItemHeldObject.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Held Object Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "asm.h"
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "player.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
#include "new_player.h"
|
||||
#include "player.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68[4];
|
||||
u16 unk_6c;
|
||||
u16 unk_6e;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68[4];
|
||||
/*0x6c*/ u16 unk_6c;
|
||||
/*0x6e*/ u16 unk_6e;
|
||||
} PlayerItemHeldObjectEntity;
|
||||
|
||||
extern bool32 ProcessMovement10(Entity*);
|
||||
|
||||
typedef struct {
|
||||
|
@ -28,26 +29,26 @@ typedef struct {
|
|||
u8 unk3;
|
||||
} struct_gUnk_081320B8;
|
||||
|
||||
bool32 sub_080AD32C(PlayerItemHeldObjectEntity*);
|
||||
void sub_080AD27C(PlayerItemHeldObjectEntity*);
|
||||
void sub_080ACF2C(PlayerItemHeldObjectEntity*);
|
||||
void sub_080ACFCC(PlayerItemHeldObjectEntity*);
|
||||
void sub_080AD040(PlayerItemHeldObjectEntity*);
|
||||
void sub_080AD274(PlayerItemHeldObjectEntity*);
|
||||
bool32 sub_080AD32C(PlayerItemHeldObjectEntity* this);
|
||||
void sub_080AD27C(PlayerItemHeldObjectEntity* this);
|
||||
void PlayerItemHeldObject_SubAction0(PlayerItemHeldObjectEntity* this);
|
||||
void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this);
|
||||
void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this);
|
||||
void PlayerItemHeldObject_SubAction3(PlayerItemHeldObjectEntity* this);
|
||||
|
||||
void PlayerItemHeldObject(Entity* this) {
|
||||
static void (*const subActionFuncs[])(PlayerItemHeldObjectEntity*) = {
|
||||
sub_080ACF2C,
|
||||
sub_080ACFCC,
|
||||
sub_080AD040,
|
||||
sub_080AD274,
|
||||
static void (*const PlayerItemHeldObject_SubActions[])(PlayerItemHeldObjectEntity*) = {
|
||||
PlayerItemHeldObject_SubAction0,
|
||||
PlayerItemHeldObject_SubAction1,
|
||||
PlayerItemHeldObject_SubAction2,
|
||||
PlayerItemHeldObject_SubAction3,
|
||||
};
|
||||
subActionFuncs[this->subAction]((PlayerItemHeldObjectEntity*)this);
|
||||
PlayerItemHeldObject_SubActions[this->subAction]((PlayerItemHeldObjectEntity*)this);
|
||||
}
|
||||
|
||||
static const Hitbox3D gUnk_081320E4;
|
||||
|
||||
void sub_080ACF2C(PlayerItemHeldObjectEntity* this) {
|
||||
void PlayerItemHeldObject_SubAction0(PlayerItemHeldObjectEntity* this) {
|
||||
static const struct_gUnk_081320B8 gUnk_081320B8[] = { { 0, 2, 0xe8, 0 }, { 0, 5, 0xe0, 0 }, { 0, 5, 0xf2, 0 } };
|
||||
PlayerItemHeldObjectEntity* child;
|
||||
PlayerItemHeldObjectEntity* child2;
|
||||
|
@ -80,7 +81,7 @@ void sub_080ACF2C(PlayerItemHeldObjectEntity* this) {
|
|||
this->unk_6e = (child->base).id;
|
||||
}
|
||||
|
||||
void sub_080ACFCC(PlayerItemHeldObjectEntity* this) {
|
||||
void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this) {
|
||||
Entity* child = super->child;
|
||||
if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) {
|
||||
if (child->action != 2) {
|
||||
|
@ -101,7 +102,7 @@ void sub_080ACFCC(PlayerItemHeldObjectEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080AD040(PlayerItemHeldObjectEntity* this) {
|
||||
void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) {
|
||||
static const s8 gUnk_081320C4[] = {
|
||||
0, -6, 6, 0, 0, 6, -6, 0,
|
||||
};
|
||||
|
@ -222,7 +223,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080AD274(PlayerItemHeldObjectEntity* this) {
|
||||
void PlayerItemHeldObject_SubAction3(PlayerItemHeldObjectEntity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,33 @@
|
|||
/**
|
||||
* @file playerItemLantern.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Lantern Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
#include "player.h"
|
||||
|
||||
void sub_08054AC8(Entity*);
|
||||
void sub_08054A60(Entity*);
|
||||
void PlayerItemLantern_Init(Entity* this);
|
||||
void PlayerItemLantern_Action1(Entity* this);
|
||||
|
||||
void PlayerItemLantern(Entity* this) {
|
||||
static void (*const gUnk_080FEEA8[])(Entity*) = {
|
||||
sub_08054A60,
|
||||
sub_08054AC8,
|
||||
static void (*const PlayerItemLantern_Actions[])(Entity*) = {
|
||||
PlayerItemLantern_Init,
|
||||
PlayerItemLantern_Action1,
|
||||
};
|
||||
gUnk_080FEEA8[this->action](this);
|
||||
PlayerItemLantern_Actions[this->action](this);
|
||||
this->contactFlags = 0;
|
||||
}
|
||||
|
||||
void sub_08054A60(Entity* this) {
|
||||
void PlayerItemLantern_Init(Entity* this) {
|
||||
this->flags |= (ENT_PERSIST | ENT_COLLIDE);
|
||||
this->action = 1;
|
||||
this->timer = 4;
|
||||
this->frameIndex = -1;
|
||||
// TODO regalloc and mov 6 too early
|
||||
this->updatePriority = 6;
|
||||
this->collisionFlags = 7;
|
||||
this->flags2 = -0x80;
|
||||
|
@ -31,10 +37,10 @@ void sub_08054A60(Entity* this) {
|
|||
}
|
||||
sub_0801766C(this);
|
||||
LoadSwapGFX(this, 1, 3);
|
||||
sub_08054AC8(this);
|
||||
PlayerItemLantern_Action1(this);
|
||||
}
|
||||
|
||||
void sub_08054AC8(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;
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
#include "entity.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
/**
|
||||
* @file playerItemPacciCane.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Pacci Cane Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "common.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
#include "save.h"
|
||||
#include "sound.h"
|
||||
#include "structures.h"
|
||||
|
||||
void PlayerItemPacciCane_Action1(Entity*);
|
||||
|
|
|
@ -1,26 +1,45 @@
|
|||
/**
|
||||
* @file playerItemPacciCaneProjectile.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Pacci Cane Projectile Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
#include "object.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[4];
|
||||
/*0x6c*/ u32 unk_6c;
|
||||
/*0x70*/ u32 unk_70;
|
||||
/*0x74*/ s32 unk_74;
|
||||
/*0x78*/ s32 unk_78;
|
||||
/*0x7c*/ u32 unk_7c;
|
||||
} PlayerItemPacciCaneProjectileEntity;
|
||||
|
||||
static const Hitbox gUnk_0811B9D0;
|
||||
|
||||
void PlayerItemPacciCaneProjectile_Init(Entity* this);
|
||||
void sub_080701F8(Entity* this);
|
||||
void sub_0807037C(Entity* this);
|
||||
void sub_08070398(Entity* this);
|
||||
void sub_080703BC(Entity* this);
|
||||
void sub_08070458(Entity* this);
|
||||
void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* this);
|
||||
void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* this);
|
||||
void PlayerItemPacciCaneProjectile_Action2(PlayerItemPacciCaneProjectileEntity* this);
|
||||
void PlayerItemPacciCaneProjectile_Action3(PlayerItemPacciCaneProjectileEntity* this);
|
||||
void PlayerItemPacciCaneProjectile_Action4(PlayerItemPacciCaneProjectileEntity* this);
|
||||
void sub_08070458(PlayerItemPacciCaneProjectileEntity* this);
|
||||
|
||||
extern void sub_08017744(Entity*);
|
||||
extern u8* sub_08008782(Entity*, u32, u32, u32);
|
||||
|
||||
void PlayerItemPacciCaneProjectile(Entity* this) {
|
||||
static void (*const PlayerItemPacciCaneProjectile_Actions[])(Entity*) = {
|
||||
PlayerItemPacciCaneProjectile_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC,
|
||||
void PlayerItemPacciCaneProjectile(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
static void (*const PlayerItemPacciCaneProjectile_Actions[])(PlayerItemPacciCaneProjectileEntity*) = {
|
||||
PlayerItemPacciCaneProjectile_Init, PlayerItemPacciCaneProjectile_Action1,
|
||||
PlayerItemPacciCaneProjectile_Action2, PlayerItemPacciCaneProjectile_Action3,
|
||||
PlayerItemPacciCaneProjectile_Action4,
|
||||
};
|
||||
PlayerItemPacciCaneProjectile_Actions[this->action](this);
|
||||
PlayerItemPacciCaneProjectile_Actions[super->action](this);
|
||||
}
|
||||
|
||||
extern u8 gUnk_08003E44;
|
||||
|
@ -34,7 +53,7 @@ typedef struct {
|
|||
u8 filler[3];
|
||||
} gUnk_0811B9A8_struct;
|
||||
|
||||
void PlayerItemPacciCaneProjectile_Init(Entity* this) {
|
||||
void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
static const s8 gUnk_0811B9A0[] = {
|
||||
0, -18, 14, 0, 0, 14, -14, 0,
|
||||
};
|
||||
|
@ -46,36 +65,36 @@ void PlayerItemPacciCaneProjectile_Init(Entity* this) {
|
|||
};
|
||||
const gUnk_0811B9A8_struct* ptr;
|
||||
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
COLLISION_ON(this);
|
||||
this->direction = this->animationState << 2;
|
||||
this->speed = 0x200;
|
||||
*(u32*)&this->field_0x74 = 0x40;
|
||||
*(u32*)&this->field_0x78 = 0x1e0;
|
||||
this->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[this->animationState];
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[this->animationState + 1];
|
||||
this->collisionFlags = 7;
|
||||
this->flags2 = 0x8a;
|
||||
this->hitbox = (Hitbox*)&gUnk_0811B9D0;
|
||||
if (this->collisionLayer == 2) {
|
||||
this->type = 1;
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
COLLISION_ON(super);
|
||||
super->direction = super->animationState << 2;
|
||||
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->collisionFlags = 7;
|
||||
super->flags2 = 0x8a;
|
||||
super->hitbox = (Hitbox*)&gUnk_0811B9D0;
|
||||
if (super->collisionLayer == 2) {
|
||||
super->type = 1;
|
||||
} else {
|
||||
this->type = 0;
|
||||
super->type = 0;
|
||||
}
|
||||
this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
|
||||
ptr = &gUnk_0811B9A8[(this->animationState >> 1)];
|
||||
this->spriteSettings.flipX = ptr->flipX;
|
||||
this->spriteSettings.flipY = ptr->flipY;
|
||||
this->animIndex = ptr->animIndex;
|
||||
*(int*)&this->field_0x6c = ptr->unk2;
|
||||
this->field_0x70.WORD = ptr->unk3;
|
||||
sub_0801766C(this);
|
||||
InitializeAnimation(this, this->animIndex);
|
||||
super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
|
||||
ptr = &gUnk_0811B9A8[(super->animationState >> 1)];
|
||||
super->spriteSettings.flipX = ptr->flipX;
|
||||
super->spriteSettings.flipY = ptr->flipY;
|
||||
super->animIndex = ptr->animIndex;
|
||||
this->unk_6c = ptr->unk2;
|
||||
this->unk_70 = ptr->unk3;
|
||||
sub_0801766C(super);
|
||||
InitializeAnimation(super, super->animIndex);
|
||||
SoundReq(SFX_1DD);
|
||||
}
|
||||
|
||||
void sub_080701F8(Entity* this) {
|
||||
void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
static const s8 gUnk_0811B9C8[] = {
|
||||
0, -4, 4, 0, 0, 4, -4, 0,
|
||||
};
|
||||
|
@ -84,87 +103,87 @@ void sub_080701F8(Entity* this) {
|
|||
u8* iVar3;
|
||||
Entity* pEVar4;
|
||||
|
||||
cVar1 = gUnk_0811B9C8[this->animationState];
|
||||
cVar2 = gUnk_0811B9C8[this->animationState + 1];
|
||||
iVar3 = sub_08008782(this, 10, cVar1, cVar2);
|
||||
cVar1 = gUnk_0811B9C8[super->animationState];
|
||||
cVar2 = gUnk_0811B9C8[super->animationState + 1];
|
||||
iVar3 = sub_08008782(super, 10, cVar1, cVar2);
|
||||
if (iVar3) {
|
||||
pEVar4 = CreateObject(OBJECT_53, iVar3[5], iVar3[2]);
|
||||
if (pEVar4) {
|
||||
pEVar4->timer = iVar3[3];
|
||||
pEVar4->x.HALF.HI = this->x.HALF.HI + cVar1;
|
||||
pEVar4->y.HALF.HI = this->y.HALF.HI + cVar2;
|
||||
pEVar4->x.HALF.HI = super->x.HALF.HI + cVar1;
|
||||
pEVar4->y.HALF.HI = super->y.HALF.HI + cVar2;
|
||||
}
|
||||
|
||||
sub_08070458(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((--(*(int*)&this->field_0x74) == -1) || (--(*(int*)&this->field_0x78) == -1)) {
|
||||
if ((--(this->unk_74) == -1) || (--(this->unk_78) == -1)) {
|
||||
sub_08070458(this);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (this->type == 0) {
|
||||
sub_0800451C(this);
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
if (super->type == 0) {
|
||||
sub_0800451C(super);
|
||||
}
|
||||
if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) {
|
||||
if (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) == 0) {
|
||||
if (GetTileUnderEntity(this) == 0x19) {
|
||||
this->action = 4;
|
||||
COLLISION_OFF(this);
|
||||
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
|
||||
this->y.HALF.HI = (this->y.HALF.HI & 0xfff0) | 8;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->field_0x7c.WORD = GetTileIndex(COORD_TO_TILE(this), this->collisionLayer);
|
||||
InitializeAnimation(this, 0x14);
|
||||
SetTile(0x4020, COORD_TO_TILE(this), this->collisionLayer);
|
||||
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) {
|
||||
if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) {
|
||||
if (GetTileUnderEntity(super) == 0x19) {
|
||||
super->action = 4;
|
||||
COLLISION_OFF(super);
|
||||
super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8;
|
||||
super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) | 8;
|
||||
super->spritePriority.b0 = 7;
|
||||
this->unk_7c = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer);
|
||||
InitializeAnimation(super, 0x14);
|
||||
SetTile(0x4020, COORD_TO_TILE(super), super->collisionLayer);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sub_08070458(this);
|
||||
}
|
||||
}
|
||||
if (this->contactFlags != 0) {
|
||||
if (super->contactFlags != 0) {
|
||||
sub_08070458(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0807037C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
void PlayerItemPacciCaneProjectile_Action2(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08070398(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
if (GravityUpdate(this, Q_8_8(32.0)) == 0) {
|
||||
void PlayerItemPacciCaneProjectile_Action3(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
if (GravityUpdate(super, Q_8_8(32.0)) == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080703BC(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
switch (GetTileIndex(COORD_TO_TILE(this), this->collisionLayer)) {
|
||||
void PlayerItemPacciCaneProjectile_Action4(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
GetNextFrame(super);
|
||||
switch (GetTileIndex(COORD_TO_TILE(super), super->collisionLayer)) {
|
||||
default:
|
||||
this->field_0x7c.WORD = 0;
|
||||
this->unk_7c = 0;
|
||||
sub_08070458(this);
|
||||
break;
|
||||
case 0x4021:
|
||||
sub_08070458(this);
|
||||
break;
|
||||
case 0x4070:
|
||||
*(int*)&this->field_0x78 = 0xff;
|
||||
this->unk_78 = 0xff;
|
||||
case 0x4020:
|
||||
if (--(*(int*)&this->field_0x78) == -1) {
|
||||
if (--(this->unk_78) == -1) {
|
||||
sub_08070458(this);
|
||||
} else {
|
||||
if (this->contactFlags == 0) {
|
||||
if (super->contactFlags == 0) {
|
||||
return;
|
||||
}
|
||||
if (((this->contactFlags & 0x7f) == 0) && (this->action != 0x1a)) {
|
||||
if (((super->contactFlags & 0x7f) == 0) && (super->action != 0x1a)) {
|
||||
return;
|
||||
}
|
||||
sub_08070458(this);
|
||||
|
@ -174,15 +193,15 @@ void sub_080703BC(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_08070458(Entity* this) {
|
||||
this->action = 2;
|
||||
COLLISION_OFF(this);
|
||||
this->speed = 0;
|
||||
if (this->field_0x7c.WORD != 0) {
|
||||
SetTile(this->field_0x7c.WORD, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
|
||||
void sub_08070458(PlayerItemPacciCaneProjectileEntity* this) {
|
||||
super->action = 2;
|
||||
COLLISION_OFF(super);
|
||||
super->speed = 0;
|
||||
if (this->unk_7c != 0) {
|
||||
SetTile(this->unk_7c, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
}
|
||||
InitializeAnimation(this, 0x13);
|
||||
sub_08017744(this);
|
||||
InitializeAnimation(super, 0x13);
|
||||
sub_08017744(super);
|
||||
SoundReq(SFX_199);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +1,35 @@
|
|||
/**
|
||||
* @file playerItemShield.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Shield Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
#include "playeritem.h"
|
||||
#include "sound.h"
|
||||
|
||||
const Hitbox gUnk_081271CC = { 0, 0, { 1, 0, 0, 1 }, 8, 8 };
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68;
|
||||
u8 unk_69[3];
|
||||
u32 bounceTimer;
|
||||
u32 unk_70;
|
||||
u32 unk_74;
|
||||
u32 unk_78;
|
||||
u8* unk_7c;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ u8 unk_69[3];
|
||||
/*0x6c*/ u32 bounceTimer;
|
||||
/*0x70*/ u32 unk_70;
|
||||
/*0x74*/ u32 unk_74;
|
||||
/*0x78*/ u32 unk_78;
|
||||
/*0x7c*/ u8* unk_7c;
|
||||
} PlayerItemShieldEntity;
|
||||
void sub_080A2D98(PlayerItemShieldEntity*);
|
||||
void sub_080A2E00(PlayerItemShieldEntity*);
|
||||
void (*const gUnk_081271D4[])(PlayerItemShieldEntity*) = {
|
||||
sub_080A2D98,
|
||||
sub_080A2E00,
|
||||
|
||||
void PlayerItemShield_Init(PlayerItemShieldEntity* this);
|
||||
void PlayerItemShield_Action1(PlayerItemShieldEntity* this);
|
||||
void (*const PlayerItemShield_Actions[])(PlayerItemShieldEntity*) = {
|
||||
PlayerItemShield_Init,
|
||||
PlayerItemShield_Action1,
|
||||
};
|
||||
const u8 gUnk_081271DC[] = {
|
||||
7, 60, 0, 0, 0, 2, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 3, 2, 0, 0, 4, 2, 0, 0, 5, 2, 0, 0, 6, 2, 0, 0, 7, 20,
|
||||
|
@ -48,16 +54,16 @@ const Hitbox gUnk_08127258 = { 5, -4, { 0, 0, 0, 0 }, 5, 7 };
|
|||
const Hitbox gUnk_08127260 = { 0, 0, { 0, 0, 0, 0 }, 6, 7 };
|
||||
const Hitbox gUnk_08127268 = { -5, -4, { 0, 0, 0, 0 }, 5, 7 };
|
||||
|
||||
void sub_080A2E00(PlayerItemShieldEntity* this);
|
||||
void PlayerItemShield_Action1(PlayerItemShieldEntity* this);
|
||||
|
||||
void PlayerItemShield(PlayerItemShieldEntity* this) {
|
||||
if (this->bounceTimer != 0) {
|
||||
this->bounceTimer--;
|
||||
}
|
||||
gUnk_081271D4[super->action](this);
|
||||
PlayerItemShield_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_080A2D98(PlayerItemShieldEntity* this) {
|
||||
void PlayerItemShield_Init(PlayerItemShieldEntity* this) {
|
||||
gPlayerState.item = super;
|
||||
super->action = 1;
|
||||
super->updatePriority = 6;
|
||||
|
@ -73,10 +79,10 @@ void sub_080A2D98(PlayerItemShieldEntity* this) {
|
|||
super->animationState = gPlayerEntity.animationState & 0xe;
|
||||
sub_08079BD8(super);
|
||||
LoadSwapGFX(super, 1, 3);
|
||||
sub_080A2E00(this);
|
||||
PlayerItemShield_Action1(this);
|
||||
}
|
||||
|
||||
void sub_080A2E00(PlayerItemShieldEntity* this) {
|
||||
void PlayerItemShield_Action1(PlayerItemShieldEntity* this) {
|
||||
Entity* playerItem;
|
||||
u8* pbVar3;
|
||||
u32 tmp2;
|
||||
|
|
|
@ -1,60 +1,71 @@
|
|||
#include "entity.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
/**
|
||||
* @file playerItemSpiral Beam.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Spiral Beam Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused1[4];
|
||||
/*0x6c*/ u32 unk_6c;
|
||||
} PlayerItemSpiralBeamEntity;
|
||||
|
||||
extern u8 gUnk_08003E44;
|
||||
|
||||
void sub_0805FBE8(Entity*);
|
||||
void sub_0805FC74(Entity*);
|
||||
void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity*);
|
||||
void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity*);
|
||||
|
||||
void PlayerItemSpiralBeam(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_0805FBE8,
|
||||
sub_0805FC74,
|
||||
void PlayerItemSpiralBeam(PlayerItemSpiralBeamEntity* this) {
|
||||
static void (*const PlayerItemSpiralBeam_Actions[])(PlayerItemSpiralBeamEntity*) = {
|
||||
PlayerItemSpiralBeam_Init,
|
||||
PlayerItemSpiralBeam_Action1,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
PlayerItemSpiralBeam_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void sub_0805FBE8(Entity* this) {
|
||||
void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity* this) {
|
||||
static const Hitbox gUnk_08109AD0 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 };
|
||||
CopyPosition(&gPlayerEntity, this);
|
||||
this->action++;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->collisionFlags = gPlayerEntity.collisionFlags + 1;
|
||||
this->hitbox = (Hitbox*)&gUnk_08109AD0;
|
||||
this->speed = 0x380;
|
||||
this->animationState = this->animationState & 0x7f;
|
||||
if (this->collisionLayer == 2) {
|
||||
this->type2 = 1;
|
||||
CopyPosition(&gPlayerEntity, super);
|
||||
super->action++;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
|
||||
super->hitbox = (Hitbox*)&gUnk_08109AD0;
|
||||
super->speed = 0x380;
|
||||
super->animationState = super->animationState & 0x7f;
|
||||
if (super->collisionLayer == 2) {
|
||||
super->type2 = 1;
|
||||
}
|
||||
this->direction = this->animationState << 2;
|
||||
*(u32*)&this->field_0x6c = 0x3c;
|
||||
InitializeAnimation(this, (this->animationState >> 1) + 0xc);
|
||||
sub_0801766C(this);
|
||||
LinearMoveUpdate(this);
|
||||
sub_0805FC74(this);
|
||||
super->direction = super->animationState << 2;
|
||||
this->unk_6c = 60;
|
||||
InitializeAnimation(super, (super->animationState >> 1) + 0xc);
|
||||
sub_0801766C(super);
|
||||
LinearMoveUpdate(super);
|
||||
PlayerItemSpiralBeam_Action1(this);
|
||||
SoundReq(SFX_ITEM_SWORD_BEAM);
|
||||
}
|
||||
|
||||
void sub_0805FC74(Entity* this) {
|
||||
int iVar1;
|
||||
|
||||
if (--*(int*)&this->field_0x6c != -1) {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->timer++;
|
||||
if (this->type2 == 0) {
|
||||
sub_0800451C(this);
|
||||
void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity* this) {
|
||||
if (this->unk_6c-- != 0) {
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
super->timer++;
|
||||
if (super->type2 == 0) {
|
||||
sub_0800451C(super);
|
||||
}
|
||||
if (!sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) &&
|
||||
sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI)) {
|
||||
CreateFx(this, FX_SWORD_MAGIC, 0);
|
||||
if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) &&
|
||||
sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) {
|
||||
CreateFx(super, FX_SWORD_MAGIC, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->contactFlags != 0) {
|
||||
CreateFx(this, FX_SWORD_MAGIC, 0);
|
||||
if (super->contactFlags != 0) {
|
||||
CreateFx(super, FX_SWORD_MAGIC, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,32 +1,38 @@
|
|||
/**
|
||||
* @file playerItemSword.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Sword Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
#include "asm.h"
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "object.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
} PlayerItemSwordEntity;
|
||||
|
||||
void sub_080A78B8(PlayerItemSwordEntity*, Entity*);
|
||||
void sub_080A7B98(PlayerItemSwordEntity*);
|
||||
|
||||
void sub_080A7A54(PlayerItemSwordEntity*);
|
||||
void sub_080A7824(PlayerItemSwordEntity*);
|
||||
void sub_080A76CC(PlayerItemSwordEntity*);
|
||||
void sub_080A758C(PlayerItemSwordEntity*);
|
||||
void PlayerItemSword_Action2(PlayerItemSwordEntity*);
|
||||
void PlayerItemSword_Action1(PlayerItemSwordEntity*);
|
||||
void PlayerItemSword_Init(PlayerItemSwordEntity*);
|
||||
void sub_080A7A84(PlayerItemSwordEntity*);
|
||||
|
||||
void PlayerItemSword(Entity* this) {
|
||||
static void (*const gUnk_0812905C[])(PlayerItemSwordEntity*) = {
|
||||
sub_080A758C,
|
||||
sub_080A76CC,
|
||||
sub_080A7824,
|
||||
static void (*const PlayerItemSword_Actions[])(PlayerItemSwordEntity*) = {
|
||||
PlayerItemSword_Init,
|
||||
PlayerItemSword_Action1,
|
||||
PlayerItemSword_Action2,
|
||||
};
|
||||
gUnk_0812905C[this->action]((PlayerItemSwordEntity*)this);
|
||||
PlayerItemSword_Actions[this->action]((PlayerItemSwordEntity*)this);
|
||||
if (this->type == 0) {
|
||||
sub_08078E84(this, &gPlayerEntity);
|
||||
this->hitbox->offset_x += this->spriteOffsetX;
|
||||
|
@ -34,7 +40,7 @@ void PlayerItemSword(Entity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080A758C(PlayerItemSwordEntity* this) {
|
||||
void PlayerItemSword_Init(PlayerItemSwordEntity* this) {
|
||||
static const u8 gUnk_08129068[] = {
|
||||
0x56,
|
||||
0x55,
|
||||
|
@ -79,16 +85,16 @@ void sub_080A758C(PlayerItemSwordEntity* this) {
|
|||
break;
|
||||
}
|
||||
super->action++;
|
||||
sub_080A7824(this);
|
||||
PlayerItemSword_Action2(this);
|
||||
} else {
|
||||
super->damage = gPlayerState.swordDamage * 2 + 4;
|
||||
sub_080A76CC(this);
|
||||
PlayerItemSword_Action1(this);
|
||||
}
|
||||
gPlayerState.item = super;
|
||||
sub_08079BD8(super);
|
||||
SoundReq(gUnk_0812906C[GetRandomByWeight(gUnk_08129068)]);
|
||||
} else {
|
||||
sub_080A76CC(this);
|
||||
PlayerItemSword_Action1(this);
|
||||
}
|
||||
SoundReq(SFX_10E);
|
||||
}
|
||||
|
@ -147,7 +153,7 @@ static const s8 gUnk_081292E2[] = { 0x0, 0x2, -0x8, 0xa, -0x8, 0xa, 0x0
|
|||
0x0, -0x2, 0x10, -0x12, 0x10, -0x12, 0x0, -0x16, 0x0, -0x16, -0xc,
|
||||
-0x14, -0xc, -0x10, -0xc, -0xc, 0x0, -0x2 };
|
||||
|
||||
void sub_080A76CC(PlayerItemSwordEntity* this) {
|
||||
void PlayerItemSword_Action1(PlayerItemSwordEntity* this) {
|
||||
Entity* effect;
|
||||
Effect type;
|
||||
const s8* ptr;
|
||||
|
@ -221,7 +227,7 @@ void sub_080A76CC(PlayerItemSwordEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void sub_080A7824(PlayerItemSwordEntity* this) {
|
||||
void PlayerItemSword_Action2(PlayerItemSwordEntity* this) {
|
||||
if (gPlayerState.item != super) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
|
@ -1,109 +1,120 @@
|
|||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "physics.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
#include "effects.h"
|
||||
#include "common.h"
|
||||
/**
|
||||
* @file playerItemSwordBeam.c
|
||||
* @ingroup Items
|
||||
*
|
||||
* @brief Sword Beam Player Item
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "common.h"
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "physics.h"
|
||||
#include "player.h"
|
||||
#include "sound.h"
|
||||
|
||||
void sub_08019498(Entity*);
|
||||
void sub_08019580(Entity*);
|
||||
void sub_08019644(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[4];
|
||||
/*0x6c*/ u32 unk_6c;
|
||||
/*0x70*/ u32 unk_70;
|
||||
/*0x74*/ u32 unk_74;
|
||||
} PlayerItemSwordBeamEntity;
|
||||
|
||||
void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this);
|
||||
void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this);
|
||||
void PlayerItemSwordBeam_CyclePalettes(PlayerItemSwordBeamEntity* this);
|
||||
|
||||
extern u8 gUnk_08003E44;
|
||||
|
||||
void PlayerItemSwordBeam(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_08019498,
|
||||
sub_08019580,
|
||||
void PlayerItemSwordBeam(PlayerItemSwordBeamEntity* this) {
|
||||
static void (*const PlayerItemSwordBeam_Actions[])(PlayerItemSwordBeamEntity*) = {
|
||||
PlayerItemSwordBeam_Init,
|
||||
PlayerItemSwordBeam_Action1,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
PlayerItemSwordBeam_Actions[super->action](this);
|
||||
}
|
||||
|
||||
static const u8 gUnk_080B43FC[] = { 30, 29, 30, 29 };
|
||||
static const u8 gUnk_080B4400[] = { 0, 4, 1, 2, -1, 0, 0, 0 };
|
||||
static const u8 PlayerItemSwordBeam_AnimIndices[] = { 30, 29, 30, 29 };
|
||||
static const u8 PlayerItemSwordBeam_Palettes[] = { 0, 4, 1, 2, 0xff };
|
||||
|
||||
void sub_08019498(Entity* this) {
|
||||
static const Hitbox gUnk_080B4408 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 };
|
||||
CopyPosition(&gPlayerEntity, this);
|
||||
this->action += 0x01;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->collisionFlags = gPlayerEntity.collisionFlags + 1;
|
||||
this->hitbox = (Hitbox*)&gUnk_080B4408;
|
||||
this->speed = 0x380;
|
||||
*(u32*)&this->field_0x74 = 2;
|
||||
this->field_0x70.WORD = 0;
|
||||
if (this->collisionLayer == 0x02) {
|
||||
this->type2 = 0x01;
|
||||
void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this) {
|
||||
static const Hitbox hitbox = { 0, 0, { 4, 0, 0, 0 }, 6, 6 };
|
||||
CopyPosition(&gPlayerEntity, super);
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->collisionFlags = gPlayerEntity.collisionFlags + 1;
|
||||
super->hitbox = (Hitbox*)&hitbox;
|
||||
super->speed = 0x380;
|
||||
this->unk_74 = 2;
|
||||
this->unk_70 = 0;
|
||||
if (super->collisionLayer == 2) {
|
||||
super->type2 = 1;
|
||||
}
|
||||
this->direction = this->animationState << 2;
|
||||
*(u32*)&this->field_0x6c = 0x3c;
|
||||
switch (this->animationState) {
|
||||
super->direction = super->animationState << 2;
|
||||
this->unk_6c = 60;
|
||||
switch (super->animationState) {
|
||||
case 0:
|
||||
this->x.HALF.HI += -3;
|
||||
this->y.HALF.HI += -8;
|
||||
this->spriteSettings.flipY = 1;
|
||||
super->x.HALF.HI -= 3;
|
||||
super->y.HALF.HI -= 8;
|
||||
super->spriteSettings.flipY = 1;
|
||||
break;
|
||||
case 4:
|
||||
this->x.HALF.HI += 2;
|
||||
super->x.HALF.HI += 2;
|
||||
break;
|
||||
case 2:
|
||||
this->spriteSettings.flipX = 1;
|
||||
this->x.HALF.HI++;
|
||||
this->y.HALF.HI += -4;
|
||||
super->spriteSettings.flipX = 1;
|
||||
super->x.HALF.HI++;
|
||||
super->y.HALF.HI -= 4;
|
||||
break;
|
||||
case 6:
|
||||
this->x.HALF.HI--;
|
||||
this->y.HALF.HI += -4;
|
||||
super->x.HALF.HI--;
|
||||
super->y.HALF.HI -= 4;
|
||||
break;
|
||||
}
|
||||
|
||||
InitializeAnimation(this, gUnk_080B43FC[this->animationState >> 1]);
|
||||
sub_0801766C(this);
|
||||
LinearMoveUpdate(this);
|
||||
sub_08019580(this);
|
||||
InitializeAnimation(super, PlayerItemSwordBeam_AnimIndices[super->animationState >> 1]);
|
||||
sub_0801766C(super);
|
||||
LinearMoveUpdate(super);
|
||||
PlayerItemSwordBeam_Action1(this);
|
||||
SoundReq(SFX_ITEM_SWORD_BEAM);
|
||||
}
|
||||
|
||||
void sub_08019580(Entity* this) {
|
||||
if (--*(int*)&this->field_0x6c != -1) {
|
||||
GetNextFrame(this);
|
||||
LinearMoveUpdate(this);
|
||||
this->timer++;
|
||||
if (this->type2 == 0) {
|
||||
sub_0800451C(this);
|
||||
void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this) {
|
||||
if (this->unk_6c-- != 0) {
|
||||
GetNextFrame(super);
|
||||
LinearMoveUpdate(super);
|
||||
super->timer++;
|
||||
if (super->type2 == 0) {
|
||||
sub_0800451C(super);
|
||||
}
|
||||
if ((sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) &&
|
||||
(sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) != 0)) {
|
||||
CreateFx(this, FX_SWORD_MAGIC, 0);
|
||||
if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) &&
|
||||
(sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0)) {
|
||||
CreateFx(super, FX_SWORD_MAGIC, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->contactFlags != 0) {
|
||||
CreateFx(this, FX_SWORD_MAGIC, 0);
|
||||
if (super->contactFlags != 0) {
|
||||
CreateFx(super, FX_SWORD_MAGIC, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (sub_08008790(this, 0xc) != NULL) {
|
||||
if (sub_08008790(super, 0xc) != NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
sub_08019644(this);
|
||||
PlayerItemSwordBeam_CyclePalettes(this);
|
||||
}
|
||||
|
||||
void sub_08019644(Entity* this) {
|
||||
s32 iVar1;
|
||||
|
||||
iVar1 = *(int*)&this->field_0x74 + -1;
|
||||
*(int*)&this->field_0x74 = iVar1;
|
||||
if (iVar1 == 0) {
|
||||
*(int*)&this->field_0x74 = 2;
|
||||
this->field_0x70.WORD++;
|
||||
if (gUnk_080B4400[this->field_0x70.WORD] == 0xff) {
|
||||
this->field_0x70.WORD = iVar1;
|
||||
void PlayerItemSwordBeam_CyclePalettes(PlayerItemSwordBeamEntity* this) {
|
||||
if (--this->unk_74 == 0) {
|
||||
this->unk_74 = 2;
|
||||
this->unk_70++;
|
||||
if (PlayerItemSwordBeam_Palettes[this->unk_70] == 0xff) {
|
||||
this->unk_70 = 0;
|
||||
}
|
||||
ChangeObjPalette(this, (u32)gUnk_080B4400[this->field_0x70.WORD]);
|
||||
ChangeObjPalette(super, PlayerItemSwordBeam_Palettes[this->unk_70]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue