mirror of
https://github.com/zeldaret/tmc
synced 2026-08-02 08:32:26 -04:00
Decompile some functions
This commit is contained in:
@@ -14,6 +14,11 @@ extern Hitbox gUnk_080B3E18;
|
||||
extern u8 gUnk_080B3DE0[];
|
||||
extern Hitbox* gUnk_080B3DE8[];
|
||||
|
||||
extern u32 sub_08007DD6(u32, const u16*);
|
||||
|
||||
extern const u16 gUnk_080B3DF4[];
|
||||
extern const u8 gUnk_08003E44[];
|
||||
|
||||
void PlayerItem11(Entity* this) {
|
||||
if (this->health) {
|
||||
this->iframes = 0;
|
||||
@@ -93,7 +98,66 @@ void sub_08018DE8(Entity* this) {
|
||||
sub_08078CD0(&gPlayerEntity);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItem11/sub_08018E68.inc", void sub_08018E68(Entity* this))
|
||||
void sub_08018E68(Entity* this) {
|
||||
s32 y;
|
||||
s32 x;
|
||||
if (this->child == NULL) {
|
||||
GetNextFrame(this);
|
||||
sub_08008790(this, 5);
|
||||
} else {
|
||||
if ((this->child->field_0x3a & 4) == 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
sub_08018F6C(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this->actionDelay-- != 0) {
|
||||
LinearMoveUpdate(this);
|
||||
|
||||
switch (this->direction) {
|
||||
case DirectionNorth:
|
||||
x = 0;
|
||||
y = -4;
|
||||
break;
|
||||
case DirectionSouth:
|
||||
x = 0;
|
||||
y = 4;
|
||||
break;
|
||||
case DirectionWest:
|
||||
x = -4;
|
||||
y = 0;
|
||||
break;
|
||||
case DirectionEast:
|
||||
x = 4;
|
||||
y = 0;
|
||||
break;
|
||||
}
|
||||
if (this->child != NULL) {
|
||||
this->child->direction = this->direction;
|
||||
CopyPosition(this, this->child);
|
||||
}
|
||||
if (this->type2 == 0) {
|
||||
sub_0800451C(this);
|
||||
}
|
||||
if (sub_08007DD6(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) {
|
||||
return;
|
||||
}
|
||||
if (GetRelativeCollisionTile(this, x, y) == 0x74) {
|
||||
return;
|
||||
}
|
||||
if (sub_080040D8(this, (u8*)gUnk_08003E44, this->x.HALF.HI + x, this->y.HALF.HI + y) == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->child == NULL) {
|
||||
InitializeAnimation(this, this->type + 0xd);
|
||||
}
|
||||
this->action++;
|
||||
sub_08018F6C(this);
|
||||
}
|
||||
|
||||
void sub_08018F6C(Entity* this) {
|
||||
if (this->child != NULL) {
|
||||
|
||||
@@ -1,26 +1,218 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "asm.h"
|
||||
#include "effects.h"
|
||||
#include "functions.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "sound.h"
|
||||
#include "functions.h"
|
||||
#include "new_player.h"
|
||||
#include "player.h"
|
||||
|
||||
extern void (*const gUnk_081320A8[])(Entity*);
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68[4];
|
||||
u16 unk_6c;
|
||||
u16 unk_6e;
|
||||
} PlayerItem13Entity;
|
||||
extern bool32 ProcessMovement10(Entity*);
|
||||
|
||||
extern const s8 gUnk_081320C4[];
|
||||
|
||||
bool32 sub_080AD32C(PlayerItem13Entity*);
|
||||
void sub_080AD27C(PlayerItem13Entity*);
|
||||
u32 sub_0806F8DC(Entity*);
|
||||
|
||||
extern const u16 gUnk_081320CC[];
|
||||
extern const u32 gUnk_081320D4[];
|
||||
|
||||
void PlayerItem13(Entity* this) {
|
||||
gUnk_081320A8[this->subAction](this);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItem13/sub_080ACF2C.inc", void sub_080ACF2C(Entity* this))
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItem13/sub_080ACFCC.inc", void sub_080ACFCC(Entity* this))
|
||||
void sub_080ACFCC(PlayerItem13Entity* this) {
|
||||
Entity* child = super->child;
|
||||
if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) {
|
||||
if (child->action != 2) {
|
||||
sub_08079184();
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
if ((gPlayerState.heldObject == 0) || ((gNewPlayerEntity.unk_79 & 0x7f) != 0)) {
|
||||
sub_080AD27C(this);
|
||||
super->subAction++;
|
||||
super->flags &= 0x7f;
|
||||
super->direction = 0xff;
|
||||
super->zVelocity = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sub_08079184();
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItem13/sub_080AD040.inc", void sub_080AD040(Entity* this))
|
||||
void sub_080AD040(PlayerItem13Entity* this) {
|
||||
PlayerItem13Entity* child;
|
||||
u32 tile;
|
||||
u32 tmp;
|
||||
|
||||
child = (PlayerItem13Entity*)super->child;
|
||||
if ((child->base).action != 2) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((super->bitfield & 0x80) != 0) {
|
||||
super->z.WORD = 0;
|
||||
}
|
||||
if (super->speed != 0) {
|
||||
|
||||
if ((super->knockbackDuration & 0x80) != 0) {
|
||||
super->direction = super->knockbackDirection;
|
||||
super->knockbackDuration = 0;
|
||||
}
|
||||
if (GetRelativeCollisionTile(super, gUnk_081320C4[super->direction >> 2],
|
||||
gUnk_081320C4[(super->direction >> 2) + 1]) == 0x74) {
|
||||
LinearMoveUpdate(super);
|
||||
} else {
|
||||
tile = sub_080B1B0C(super);
|
||||
if ((tile != 0x24) && (tile != 0x26)) {
|
||||
ProcessMovement10(super);
|
||||
}
|
||||
}
|
||||
if (GravityUpdate(super, 0x2000) == 0) {
|
||||
(child->base).zVelocity = super->zVelocity;
|
||||
(child->base).x = super->x;
|
||||
(child->base).y = super->y;
|
||||
(child->base).z = super->z;
|
||||
tile = GetTileUnderEntity(super);
|
||||
switch (tile) {
|
||||
case 0xd:
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
case 0x13:
|
||||
case 0x5a:
|
||||
if (child == this) {
|
||||
|
||||
switch (tile) {
|
||||
case 0xd:
|
||||
CreateFx(super, FX_FALL_DOWN, 0);
|
||||
break;
|
||||
case 0x5a:
|
||||
CreateFx(super, FX_LAVA_SPLASH, 0);
|
||||
break;
|
||||
case 0x10:
|
||||
case 0x11:
|
||||
CreateFx(super, FX_WATER_SPLASH, 0);
|
||||
break;
|
||||
case 0x13:
|
||||
CreateFx(super, FX_GREEN_SPLASH, 0);
|
||||
break;
|
||||
}
|
||||
(child->base).subAction = 4;
|
||||
} else {
|
||||
(child->base).subAction = 3;
|
||||
}
|
||||
DeleteThisEntity();
|
||||
break;
|
||||
}
|
||||
if (super->child == super) {
|
||||
if (super->type2 != 0xff) {
|
||||
if (super->type2 == 0x0f) {
|
||||
CreateFx(super, super->actionDelay, 0x80);
|
||||
} else {
|
||||
CreateObjectWithParent(super, super->type2, super->actionDelay, 0);
|
||||
}
|
||||
}
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
if (super->actionDelay != 0 || sub_080AD32C(child)) {
|
||||
if (super->actionDelay == 1) {
|
||||
SoundReq(SFX_104);
|
||||
}
|
||||
UpdateSpriteForCollisionLayer(super);
|
||||
child->base.subAction = 3;
|
||||
child->base.spriteRendering.b3 = super->spriteRendering.b3;
|
||||
child->base.spriteOrientation.flipY = super->spriteOrientation.flipY;
|
||||
child->base.spritePriority.b0 = super->spritePriority.b0;
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
SoundReq(SFX_104);
|
||||
super->actionDelay++;
|
||||
super->zVelocity = 0x10000;
|
||||
super->speed /= 2;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sub_0800451C(super);
|
||||
sub_0806F8DC(super);
|
||||
CopyPosition(super, (Entity*)child);
|
||||
(child->base).zVelocity = super->zVelocity;
|
||||
(child->base).direction = super->direction;
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
tmp = gPlayerEntity.frame & 1;
|
||||
if (tmp != 0) {
|
||||
SoundReq(SFX_PLY_VO5);
|
||||
sub_080AD27C(this);
|
||||
return;
|
||||
}
|
||||
if ((gPlayerState.heldObject != 0) && ((gNewPlayerEntity.unk_79 & 0x80) == 0)) {
|
||||
return;
|
||||
}
|
||||
sub_080AD27C(this);
|
||||
super->flags &= 0x7f;
|
||||
super->direction = 0xff;
|
||||
super->zVelocity = tmp & 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080AD274(Entity* this) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItem13/sub_080AD27C.inc", void sub_080AD27C(Entity* this))
|
||||
void sub_080AD27C(PlayerItem13Entity* this) {
|
||||
u32 tmp;
|
||||
PlayerItem13Entity* child = (PlayerItem13Entity*)super->child;
|
||||
gNewPlayerEntity.unk_74 = NULL;
|
||||
if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) {
|
||||
if (child != this) {
|
||||
(child->base).subAction = 2;
|
||||
} else {
|
||||
super->spritePriority.b1 = 3;
|
||||
}
|
||||
super->hitbox = (child->base).hitbox;
|
||||
tmp = super->field_0x16 >> 4;
|
||||
super->speed = gUnk_081320CC[tmp];
|
||||
super->zVelocity = gUnk_081320D4[tmp];
|
||||
(child->base).z.HALF.HI += 8;
|
||||
super->z.HALF.HI = (child->base).z.HALF.HI;
|
||||
super->collisionLayer = (child->base).collisionLayer;
|
||||
super->y.HALF.HI = gPlayerEntity.y.HALF.HI;
|
||||
super->x.HALF.HI = gPlayerEntity.x.HALF.HI;
|
||||
super->field_0x3c = gPlayerEntity.field_0x3c;
|
||||
super->flags |= 0x80;
|
||||
sub_0801766C(super);
|
||||
} else {
|
||||
sub_08079184();
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_080AD32C(Entity* this) {
|
||||
bool32 sub_080AD32C(PlayerItem13Entity* this) {
|
||||
bool32 result = FALSE;
|
||||
if (((this->field_0x16 & 0xf0) == 0x10) || ((this->kind == OBJECT && ((this->id == 5 || (this->id == 0x7d)))))) {
|
||||
if (((super->field_0x16 & 0xf0) == 0x10) ||
|
||||
((super->kind == OBJECT && ((super->id == 5 || (super->id == 0x7d)))))) {
|
||||
result = TRUE;
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -1,45 +1,54 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "asm.h"
|
||||
#include "item.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u32 unk_68;
|
||||
} PlayerItemBombEntity;
|
||||
|
||||
extern void (*const gUnk_080B77C8[])(Entity*);
|
||||
void sub_0801B418(Entity*);
|
||||
void sub_0801B3A4(Entity*);
|
||||
void sub_0801B3A4(PlayerItemBombEntity*);
|
||||
|
||||
extern void (*const gUnk_080B77D8[])(Entity*);
|
||||
|
||||
void PlayerItemBomb(Entity* this) {
|
||||
extern const Hitbox gUnk_080B77F4;
|
||||
|
||||
void PlayerItemBomb(PlayerItemBombEntity* this) {
|
||||
u8 uVar1, uVar2;
|
||||
|
||||
gUnk_080B77C8[this->action](this);
|
||||
GetNextFrame(this);
|
||||
// TODO regalloc
|
||||
uVar2 = uVar1 = this->action;
|
||||
gUnk_080B77C8[super->action](super);
|
||||
GetNextFrame(super);
|
||||
uVar2 = uVar1 = super->action;
|
||||
if (uVar1 != 0x03) {
|
||||
if (this->actionDelay != 0) {
|
||||
if (this->field_0x68.HALF.LO == 7) {
|
||||
this->actionDelay -= 1;
|
||||
if (super->actionDelay != 0) {
|
||||
if (*(u8*)&this->unk_68 == 7) {
|
||||
super->actionDelay -= 1;
|
||||
}
|
||||
if (this->actionDelay == 0) {
|
||||
this->field_0xf = 0x50;
|
||||
*(u32*)&this->field_0x68 = 0;
|
||||
this->spriteRendering.b0 = 3;
|
||||
SetAffineInfo(this, 0x100, 0x100, 0);
|
||||
if (super->actionDelay == 0) {
|
||||
super->field_0xf = 0x50;
|
||||
this->unk_68 = 0;
|
||||
super->spriteRendering.b0 = 3;
|
||||
SetAffineInfo(super, 0x100, 0x100, 0);
|
||||
}
|
||||
} else {
|
||||
if (this->field_0xf != 0) {
|
||||
if (this->field_0xf-- == 0x01) {
|
||||
if ((uVar1 == 0x02) && (this->subAction == 1)) {
|
||||
if (super->field_0xf != 0) {
|
||||
if (super->field_0xf-- == 0x01) {
|
||||
if ((uVar1 == 0x02) && (super->subAction == 1)) {
|
||||
gPlayerState.heldObject = 0;
|
||||
}
|
||||
this->action = 0x03;
|
||||
this->spritePriority.b1 = 2;
|
||||
this->actionDelay = 0x0f;
|
||||
this->spriteSettings.draw = 0;
|
||||
sub_0805EC60(this);
|
||||
FreeCarryEntity(this);
|
||||
CreateObjectWithParent(this, 0x20, 0, 0);
|
||||
sub_0801B418(this);
|
||||
super->action = 0x03;
|
||||
super->spritePriority.b1 = 2;
|
||||
super->actionDelay = 0x0f;
|
||||
super->spriteSettings.draw = 0;
|
||||
sub_0805EC60(super);
|
||||
FreeCarryEntity(super);
|
||||
CreateObjectWithParent(super, 0x20, 0, 0);
|
||||
sub_0801B418(super);
|
||||
} else {
|
||||
sub_0801B3A4(this);
|
||||
}
|
||||
@@ -48,9 +57,50 @@ void PlayerItemBomb(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemBomb/sub_0801B250.inc", void sub_0801B250(Entity* this))
|
||||
void sub_0801B250(PlayerItemBombEntity* this) {
|
||||
super->spriteSettings.draw = 1;
|
||||
super->action = 1;
|
||||
super->spritePriority.b1 = 3;
|
||||
super->flags &= 0x7f;
|
||||
if (super->type == 0xff) {
|
||||
super->actionDelay = 0x3c;
|
||||
} else if (super->type == 0xfe) {
|
||||
super->actionDelay = 0x0f;
|
||||
super->type = 0xff;
|
||||
} else {
|
||||
super->actionDelay = 0x96;
|
||||
}
|
||||
super->hitbox = (Hitbox*)&gUnk_080B77F4;
|
||||
super->field_0x16 = 0;
|
||||
if (*(u8*)&this->unk_68 == 7) {
|
||||
InitializeAnimation(super, 5);
|
||||
} else {
|
||||
InitializeAnimation(super, 0x15);
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemBomb/sub_0801B2CC.inc", void sub_0801B2CC(Entity* this))
|
||||
void sub_0801B2CC(PlayerItemBombEntity* this) {
|
||||
u16 unaff_r5;
|
||||
|
||||
if (!sub_0800442E(super)) {
|
||||
RegisterCarryEntity(super);
|
||||
}
|
||||
switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) {
|
||||
case 0:
|
||||
unaff_r5 = 1;
|
||||
break;
|
||||
case 1:
|
||||
unaff_r5 = 2;
|
||||
break;
|
||||
case 2:
|
||||
unaff_r5 = 0;
|
||||
break;
|
||||
}
|
||||
if ((unaff_r5 & gPlayerState.field_0x92) != 0) {
|
||||
super->actionDelay = 0;
|
||||
super->field_0xf = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B318(Entity* this) {
|
||||
gUnk_080B77D8[this->subAction](this);
|
||||
@@ -87,7 +137,28 @@ void sub_0801B38C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemBomb/sub_0801B3A4.inc", void sub_0801B3A4(Entity* this))
|
||||
void sub_0801B3A4(PlayerItemBombEntity* this) {
|
||||
u32 tmp;
|
||||
if (super->field_0xf >= 0x29) {
|
||||
tmp = 8;
|
||||
} else {
|
||||
tmp = 4;
|
||||
if ((this->unk_68 & 0x8000) != 0) {
|
||||
this->unk_68 -= 0x10;
|
||||
} else {
|
||||
this->unk_68 += 0x10;
|
||||
}
|
||||
if (0x7f < (this->unk_68 & 0xf0) - 1) {
|
||||
this->unk_68 ^= 0x8000;
|
||||
}
|
||||
SetAffineInfo(super, 0x130 - (this->unk_68 & 0xf0), 0x130 - (this->unk_68 & 0xf0), 0);
|
||||
}
|
||||
if ((super->field_0xf & tmp) == 0) {
|
||||
super->palette.b.b0 = 0;
|
||||
} else {
|
||||
super->palette.b.b0 = super->palette.b.b4;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801B418(Entity* this) {
|
||||
s32 x;
|
||||
|
||||
@@ -1,18 +1,104 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "global.h"
|
||||
#include "asm.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "effects.h"
|
||||
#include "object.h"
|
||||
|
||||
extern void (*const gUnk_080B3E30[])(Entity*);
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68;
|
||||
u8 unk_69[3];
|
||||
u32 unk_6c;
|
||||
u32 unk_70;
|
||||
u32 unk_74;
|
||||
u32 unk_78;
|
||||
} PlayerItemBowEntity;
|
||||
|
||||
typedef struct {
|
||||
s8 x;
|
||||
s8 y;
|
||||
u8 spriteSettings;
|
||||
u8 unk_3;
|
||||
s8 unk_4;
|
||||
s8 unk_5;
|
||||
u8 animIndex;
|
||||
u8 unk_7;
|
||||
Hitbox* hitbox;
|
||||
} struct_080B3E40;
|
||||
|
||||
extern const struct_080B3E40 gUnk_080B3E40[];
|
||||
|
||||
void sub_0801917C(PlayerItemBowEntity*);
|
||||
|
||||
void PlayerItemBow(Entity* this) {
|
||||
gUnk_080B3E30[(this->action)](this);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemBow/sub_08018FE4.inc", void sub_08018FE4(Entity* this))
|
||||
void sub_08018FE4(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;
|
||||
super->hurtType = super->type2;
|
||||
super->spriteIndex = 0xa6;
|
||||
if (super->hurtType == 0x0e) {
|
||||
super->speed = 0x400;
|
||||
} else {
|
||||
super->speed = 0x300;
|
||||
}
|
||||
super->direction = super->animationState << 2;
|
||||
super->field_0x3c = gPlayerEntity.field_0x3c + 1;
|
||||
super->flags2 = gPlayerEntity.flags2;
|
||||
if (super->collisionLayer == 2) {
|
||||
super->type2 = 1;
|
||||
} else {
|
||||
super->type2 = 0;
|
||||
}
|
||||
super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
|
||||
ptr = &gUnk_080B3E40[super->animationState >> 1];
|
||||
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + ptr->x;
|
||||
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + ptr->y;
|
||||
super->spriteSettings.flipX = ptr->spriteSettings;
|
||||
super->spriteSettings.flipY = ptr->unk_3;
|
||||
super->animIndex = ptr->animIndex;
|
||||
this->unk_6c = ptr->unk_4;
|
||||
this->unk_70 = ptr->unk_5;
|
||||
super->hitbox = ptr->hitbox;
|
||||
sub_0801766C(super);
|
||||
if (super->hurtType == 0x0e) {
|
||||
super->animIndex += 6;
|
||||
super->spriteVramOffset = 0;
|
||||
}
|
||||
InitializeAnimation(super, super->animIndex);
|
||||
SoundReq(SFX_FC);
|
||||
} else {
|
||||
super->updatePriority = 6;
|
||||
super->frameIndex = 0xff;
|
||||
super->spriteSettings.flipX = gUnk_080B3E40[super->animationState >> 1].spriteSettings;
|
||||
gPlayerState.item = super;
|
||||
LoadSwapGFX(super, 1, 3);
|
||||
sub_08079BD8(super);
|
||||
if (this->unk_68 == 0xa) {
|
||||
this->unk_78 = 0x3c;
|
||||
object = CreateObject(OBJECT_43, super->type, 1);
|
||||
if (object != NULL) {
|
||||
CopyPosition(super, object);
|
||||
}
|
||||
} else {
|
||||
this->unk_78 = 0;
|
||||
}
|
||||
sub_0801917C(this);
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemBow/sub_0801917C.inc", void sub_0801917C(Entity* this))
|
||||
ASM_FUNC("asm/non_matching/playerItemBow/sub_0801917C.inc", void sub_0801917C(PlayerItemBowEntity* this))
|
||||
|
||||
void sub_08019410(Entity* this) {
|
||||
if (this->actionDelay < 0xf) {
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
#include "entity.h"
|
||||
#include "player.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
|
||||
extern void (*const gUnk_080FEEA8[])(Entity*);
|
||||
|
||||
void sub_08054AC8(Entity*);
|
||||
|
||||
extern const s8 gUnk_080FEEB0[];
|
||||
|
||||
void PlayerItemLantern(Entity* this) {
|
||||
gUnk_080FEEA8[this->action](this);
|
||||
this->bitfield = 0;
|
||||
@@ -29,4 +33,40 @@ void sub_08054A60(Entity* this) {
|
||||
sub_08054AC8(this);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemLantern/sub_08054AC8.inc", void sub_08054AC8(Entity* this))
|
||||
void sub_08054AC8(Entity* this) {
|
||||
Entity* object;
|
||||
this->animationState = gPlayerEntity.animationState & 0xe;
|
||||
this->hitbox->offset_x = gUnk_080FEEB0[this->animationState];
|
||||
this->hitbox->offset_y = gUnk_080FEEB0[this->animationState + 1];
|
||||
this->hitbox->width = 4;
|
||||
this->hitbox->height = 4;
|
||||
if (!((gPlayerEntity.frameIndex < 0x37) && ((u32)gPlayerEntity.spriteIndex == 6))) {
|
||||
this->frameIndex = 0xff;
|
||||
this->flags &= ~ENT_COLLIDE;
|
||||
} else {
|
||||
this->flags |= ENT_COLLIDE;
|
||||
this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
|
||||
this->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY;
|
||||
if (gPlayerEntity.frameIndex != this->frameIndex) {
|
||||
this->frameIndex = gPlayerEntity.frameIndex;
|
||||
sub_080042D0(this, this->frameIndex, this->spriteIndex);
|
||||
}
|
||||
this->frame = gPlayerEntity.frame;
|
||||
this->frameSpriteSettings = gPlayerEntity.frameSpriteSettings;
|
||||
}
|
||||
if (IsItemEquipped(ITEM_LANTERN_ON) < 2) {
|
||||
if (((this->frameIndex != 0xff) && (gPlayerEntity.spriteSettings.draw != 0)) && (this->actionDelay-- == 0)) {
|
||||
this->actionDelay = 4;
|
||||
object = CreateObject(OBJECT_45, 0, 0x10);
|
||||
if (object != NULL) {
|
||||
PositionRelative(this, object, 0, 0x20000);
|
||||
object->spritePriority.b0 = this->spritePriority.b0;
|
||||
object->spriteOffsetX = gUnk_080FEEB0[this->animationState];
|
||||
object->spriteOffsetY = gUnk_080FEEB0[this->animationState + 1];
|
||||
}
|
||||
}
|
||||
sub_08078E84(this, &gPlayerEntity);
|
||||
} else {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "sound.h"
|
||||
|
||||
extern void (*const gUnk_0812905C[])(Entity*);
|
||||
|
||||
extern u8 gUnk_08129096[];
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u8 unk_68;
|
||||
} PlayerItemSwordEntity;
|
||||
|
||||
void sub_080A78B8(PlayerItemSwordEntity*, Entity*);
|
||||
void sub_080A7B98(PlayerItemSwordEntity*);
|
||||
|
||||
void sub_080A7A54(PlayerItemSwordEntity*);
|
||||
|
||||
void PlayerItemSword(Entity* this) {
|
||||
gUnk_0812905C[this->action](this);
|
||||
if (this->type == 0) {
|
||||
@@ -18,20 +30,122 @@ ASM_FUNC("asm/non_matching/playerItemSword/sub_080A758C.inc", void sub_080A758C(
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemSword/sub_080A76CC.inc", void sub_080A76CC(Entity* this))
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemSword/sub_080A7824.inc", void sub_080A7824(Entity* this))
|
||||
void sub_080A7824(PlayerItemSwordEntity* this) {
|
||||
if (gPlayerState.item != super) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (gPlayerState.field_0x3[1] != 0) {
|
||||
if (gPlayerState.jump_status == 0) {
|
||||
gPlayerState.item = NULL;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if ((gPlayerEntity.frame & 0x80) != 0) {
|
||||
gPlayerState.item = NULL;
|
||||
DeleteThisEntity();
|
||||
} else {
|
||||
sub_080A78B8(this, &gPlayerEntity);
|
||||
if ((gPlayerEntity.frame & 0x20) != 0) {
|
||||
SoundReq(SFX_PLY_VO3);
|
||||
}
|
||||
if (super->frameIndex > 0x8a) {
|
||||
super->frameIndex = 0xff;
|
||||
}
|
||||
if ((gPlayerEntity.frame & 8) != 0) {
|
||||
super->flags |= ENT_COLLIDE;
|
||||
sub_080A7B98(this);
|
||||
} else {
|
||||
super->flags &= ~ENT_COLLIDE;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gPlayerState.item = NULL;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemSword/sub_080A78B8.inc", void sub_080A78B8(Entity* this))
|
||||
void sub_080A78B8(PlayerItemSwordEntity* this, Entity* param_2) {
|
||||
u32 flipX;
|
||||
|
||||
void sub_080A7A54(Entity* this) {
|
||||
if ((gPlayerState.sword_state & 0x20) != 0) {
|
||||
super->frameIndex = param_2->frameIndex - 0x6a;
|
||||
if ((gRoomTransition.frameCount & 4) != 0) {
|
||||
sub_080042D0(super, (super->animationState >> 1) + 0xb1, super->spriteIndex);
|
||||
} else {
|
||||
sub_080042D0(super, super->frameIndex, super->spriteIndex);
|
||||
}
|
||||
} else {
|
||||
if (param_2->frameIndex - 0x6a != super->frameIndex) {
|
||||
super->frameIndex = param_2->frameIndex - 0x6a;
|
||||
sub_080042D0(super, (u32)super->frameIndex, super->spriteIndex);
|
||||
}
|
||||
}
|
||||
if ((gPlayerState.sword_state & 0x40) != 0) {
|
||||
super->spriteSettings.flipX = 0;
|
||||
} else {
|
||||
if ((param_2->animationState & 2) != 0) {
|
||||
flipX = param_2->spriteSettings.flipX ^ 1;
|
||||
} else {
|
||||
flipX = param_2->spriteSettings.flipX;
|
||||
}
|
||||
super->spriteSettings.flipX = flipX;
|
||||
}
|
||||
if ((super->bitfield & 0x80) != 0) {
|
||||
if ((param_2->iframes == 0) || ((u8)param_2->iframes == 0x81)) {
|
||||
param_2->iframes = super->iframes;
|
||||
param_2->knockbackDirection = super->knockbackDirection;
|
||||
param_2->knockbackDuration = super->knockbackDuration;
|
||||
super->knockbackDuration = 0;
|
||||
super->knockbackDirection = 0;
|
||||
super->iframes = 0;
|
||||
}
|
||||
if ((gPlayerState.flags & 0x8000000) != 0) {
|
||||
gPlayerState.sword_state |= 0x80;
|
||||
} else if (gPlayerState.sword_state != 0) {
|
||||
switch (super->bitfield & 0x7f) {
|
||||
case 0x44:
|
||||
break;
|
||||
case 0x43:
|
||||
case 0xd:
|
||||
gPlayerState.sword_state |= 8;
|
||||
param_2->knockbackDuration = 2;
|
||||
if ((gPlayerState.sword_state & 0x20) == 0) {
|
||||
gPlayerState.sword_state &= 0xfe;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ((gPlayerState.sword_state & 0xc0) == 0) {
|
||||
gPlayerState.sword_state = 0;
|
||||
gPlayerState.field_0x3[1] = 0;
|
||||
gPlayerState.item = NULL;
|
||||
DeleteThisEntity();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (super->iframes != 0) {
|
||||
if (super->iframes >= 1) {
|
||||
super->iframes--;
|
||||
} else {
|
||||
super->iframes++;
|
||||
}
|
||||
}
|
||||
sub_080A7A54(this);
|
||||
if ((*(u8*)&super->spriteSettings * 0x2000000) < 0) { // TODO
|
||||
super->hitbox->offset_x = -super->hitbox->offset_x;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080A7A54(PlayerItemSwordEntity* this) {
|
||||
u8* tmp;
|
||||
|
||||
tmp = &gUnk_08129096[(gPlayerEntity.frameIndex - 0x6a) * 4];
|
||||
this->hitbox->offset_x = tmp[0];
|
||||
this->hitbox->offset_y = tmp[1];
|
||||
this->hitbox->width = tmp[2];
|
||||
this->hitbox->height = tmp[3];
|
||||
super->hitbox->offset_x = tmp[0];
|
||||
super->hitbox->offset_y = tmp[1];
|
||||
super->hitbox->width = tmp[2];
|
||||
super->hitbox->height = tmp[3];
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemSword/sub_080A7A84.inc", void sub_080A7A84(Entity* this))
|
||||
|
||||
ASM_FUNC("asm/non_matching/playerItemSword/sub_080A7B98.inc", void sub_080A7B98(Entity* this))
|
||||
ASM_FUNC("asm/non_matching/playerItemSword/sub_080A7B98.inc", void sub_080A7B98(PlayerItemSwordEntity* this))
|
||||
|
||||
Reference in New Issue
Block a user