Document some player item stuff

This commit is contained in:
octorock
2022-08-09 18:48:05 +02:00
parent dd59d70447
commit ad44d63b73
134 changed files with 1616 additions and 1484 deletions
+43 -37
View File
@@ -39,7 +39,16 @@ extern const u16* gUnk_080B4550[];
extern const u16 gUnk_080B77C0[];
extern BgAnimationFrame* gUnk_080B7278[];
void sub_0801AD6C(u16*, u32);
typedef struct {
u16 tileType;
u16 kind;
u16 id;
u16 type;
u16 type2;
u16 unk_a;
} Data;
void sub_0801AD6C(const Data*, u32);
bool32 sub_0801A4F8(void);
bool32 sub_0801AA58(Entity*, u32, u32);
void sub_0801AB08(u16*, LayerStruct*);
@@ -146,7 +155,7 @@ NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A2B0.inc",
u32 temp5;
uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1];
if ((((gPlayerState.field_0x35 | gPlayerState.field_0xd) & 0x80) == 0) && ((gPlayerEntity.frame & 1) != 0)) {
if ((((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) == 0) && ((gPlayerEntity.frame & 1) != 0)) {
position = (u16)(position + uVar1);
temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.collisionLayer));
switch (temp4) {
@@ -264,10 +273,10 @@ bool32 sub_0801A4F8(void) {
if (GetInventoryValue(ITEM_POWER_BRACELETS) != 1) {
return FALSE;
}
if ((gPlayerState.field_0xd & 0x80) != 0) {
if ((gPlayerState.direction & 0x80) != 0) {
return FALSE;
}
if (gPlayerState.field_0xd != gPlayerEntity.direction) {
if (gPlayerState.direction != gPlayerEntity.direction) {
return FALSE;
}
tmp = (((gPlayerEntity.direction + 4) & 0x18) >> 3);
@@ -275,7 +284,7 @@ bool32 sub_0801A4F8(void) {
return FALSE;
}
} else {
if (((gPlayerState.field_0x35 | gPlayerState.field_0xd) & 0x80) != 0) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) {
return FALSE;
}
if ((gPlayerEntity.frame & 1) == 0) {
@@ -411,19 +420,18 @@ u32 sub_0801AC68(u32 position, u32 data) {
return data << 2;
}
extern const u16 gUnk_080B44C0[];
extern const u16 gUnk_080B44C2[];
extern const Data gUnk_080B44C0[];
extern const Data gUnk_080B44C2[];
extern const u32 gUnk_080B44B8[];
NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801AC98.inc", void sub_0801AC98()) {
u32 width;
u32 height;
u32 indexX;
u32 width;
u32 indexY;
const u16* puVar7;
const Data* ptr1;
const Data* ptr2;
u32 position;
const u32* ptr;
u32 tmp;
width = gRoomControls.width >> 4;
height = gRoomControls.height >> 4;
@@ -431,32 +439,30 @@ NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801AC98.inc", void sub_0801AC98
for (indexY = 0; indexY < height; indexY++) {
for (indexX = 0; indexX < width; indexX++, position++) {
for (puVar7 = gUnk_080B44C0; puVar7[0] != 0xffff; puVar7 += 6) {
if (puVar7[0] == GetTileType(position, 1)) {
ptr = gUnk_080B44B8 + puVar7[5];
if (ptr[0] != 0) {
sub_0801AD6C((u16*)puVar7, position);
for (ptr1 = gUnk_080B44C0; ptr1->tileType != 0xffff; ptr1++) {
if (ptr1->tileType == GetTileType(position, 1)) {
if (gUnk_080B44B8[ptr1->unk_a] != 0) {
sub_0801AD6C(ptr1, position);
break;
}
}
}
for (puVar7 = gUnk_080B44C2; puVar7[0] != 0xffff; puVar7 += 6) {
if (puVar7[0] == GetTileType(position, 2)) {
ptr = gUnk_080B44B8 + puVar7[5];
if (ptr[0] != 0) {
sub_0801AD6C((u16*)puVar7, position);
for (ptr2 = gUnk_080B44C2; ptr2->tileType != 0xffff; ptr2++) {
if (ptr2->tileType == GetTileType(position, 2)) {
if (gUnk_080B44B8[ptr2->unk_a] != 0) {
sub_0801AD6C(ptr2, position);
break;
}
}
}
}
tmp = (position + 0x40);
position = tmp - width;
position = position + (0x40 - width);
}
}
END_NONMATCH
void sub_0801AD6C(u16* param_1, u32 param_2) {
void sub_0801AD6C(const Data* param_1, u32 tilePosition) {
Entity* entity;
Manager* manager;
s32 tmpX1;
@@ -464,16 +470,16 @@ void sub_0801AD6C(u16* param_1, u32 param_2) {
s32 tmpX2;
s32 tmpY2;
if (param_1[1] != MANAGER) {
if (param_1->kind != MANAGER) {
entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = (u8)param_1[1];
entity->id = (u8)param_1[2];
entity->type = (u8)param_1[3];
entity->type2 = (u8)param_1[4];
tmpX1 = ((u16)param_2 & 0x3f) * 0x10 + 8;
entity->kind = (u8)param_1->kind;
entity->id = (u8)param_1->id;
entity->type = (u8)param_1->type;
entity->type2 = (u8)param_1->type2;
tmpX1 = ((u16)tilePosition & 0x3f) * 0x10 + 8;
entity->x.HALF.HI = tmpX1 + gRoomControls.origin_x;
tmpY1 = (s16)((param_2 & 0xfc0) >> 2) + 8;
tmpY1 = (s16)((tilePosition & 0xfc0) >> 2) + 8;
entity->y.HALF.HI = tmpY1 + gRoomControls.origin_y;
entity->collisionLayer = 0;
ResolveCollisionLayer(entity);
@@ -482,14 +488,14 @@ void sub_0801AD6C(u16* param_1, u32 param_2) {
} else {
manager = GetEmptyManager();
if (manager != NULL) {
manager->kind = (u8)param_1[1];
manager->id = (u8)param_1[2];
manager->type = (u8)param_1[3];
manager->type2 = (u8)param_1[4];
manager->kind = (u8)param_1->kind;
manager->id = (u8)param_1->id;
manager->type = (u8)param_1->type;
manager->type2 = (u8)param_1->type2;
// TODO are these fields common for all managers or does this usually create managers of certain types?
tmpX2 = ((u16)param_2 & 0x3f) * 0x10 + 8;
tmpX2 = ((u16)tilePosition & 0x3f) * 0x10 + 8;
*(u16*)(&manager[1].timer + 10) = tmpX2 + gRoomControls.origin_x;
tmpY2 = (s16)((param_2 & 0xfc0) >> 2) + 8;
tmpY2 = (s16)((tilePosition & 0xfc0) >> 2) + 8;
*(u16*)(&manager[1].timer + 12) = tmpY2 + gRoomControls.origin_y;
AppendEntityToList((Entity*)manager, gUnk_081091E4[manager->kind]);
}
+161 -136
View File
@@ -1,17 +1,26 @@
#include "global.h"
#include "asm.h"
#include "collision.h"
#include "common.h"
#include "enemy.h"
#include "entity.h"
#include "functions.h"
#include "game.h"
#include "global.h"
#include "item.h"
#include "object.h"
#include "player.h"
#include "save.h"
#include "common.h"
#include "functions.h"
#include "enemy.h"
#include "object.h"
#include "game.h"
extern u8 gCollidableCount;
extern u8 gUnk_080B3740[];
typedef enum {
COL_FLAG_1 = 1,
COL_FLAG_2 = 2,
COL_FLAG_4 = 4,
COL_FLAG_8 = 8,
} ColSettingsFlags;
typedef struct {
/*0x00*/ u8 orgKnockbackSpeed;
/*0x01*/ u8 orgIframes;
@@ -23,8 +32,8 @@ typedef struct {
/*0x07*/ u8 tgtKnockbackDuration;
/*0x08*/ u8 orgDamage;
/*0x09*/ u8 tgtConfusedTime;
/*0x0a*/ u8 _a;
/*0x0b*/ u8 _b;
/*0x0a*/ u8 flags; /**< @see ColSettingsFlags */
/*0x0b*/ u8 pad;
} ColSettings;
extern ColSettings gCollisionMtx[173 * 34];
@@ -32,10 +41,8 @@ extern ColSettings gCollisionMtx[173 * 34];
extern void ram_CollideAll(void);
u32 sub_08081420(Entity*);
extern void SoundReqClipped(Entity*, u32);
s32 sub_08018308(Entity*, Entity*, u32, ColSettings*);
void sub_08079D84(void);
void sub_080180BC(Entity*, Entity*);
void sub_0807AFE8(void);
typedef struct {
void* last;
@@ -208,51 +215,49 @@ bool32 IsCollidingPlayer(Entity* this) {
return FALSE;
}
s32 sub_08017874(Entity* a, Entity* b) {
s32 newDmg;
s32 v5;
s32 v6;
s32 CalculateDamage(Entity* org, Entity* tgt) {
s32 damage;
s32 health;
asm("" ::: "r1");
if (a->kind == PLAYER) {
newDmg = b->damage;
if (org->kind == PLAYER) {
damage = tgt->damage;
switch (gSave.stats.charm) {
case 47:
newDmg /= 4;
case BOTTLE_CHARM_NAYRU:
damage /= 4;
break;
case 48:
newDmg /= 2;
case BOTTLE_CHARM_FARORE:
damage /= 2;
break;
}
if (newDmg <= 0)
newDmg = 1;
v5 = ModHealth(-newDmg);
SoundReqClipped(a, SFX_PLY_VO6);
if (damage <= 0)
damage = 1;
health = ModHealth(-damage);
SoundReqClipped(org, SFX_PLY_VO6);
} else {
v6 = b->damage;
if (b->kind == PLAYER_ITEM) {
damage = tgt->damage;
if (tgt->kind == PLAYER_ITEM) {
switch (gSave.stats.charm) {
case 48:
v6 = 3 * v6 / 2;
case BOTTLE_CHARM_FARORE:
damage = 3 * damage / 2;
break;
case 49:
v6 *= 2;
case BOTTLE_CHARM_DIN:
damage *= 2;
break;
}
}
v5 = a->health - v6;
if (a->kind == ENEMY) {
if ((a->field_0x6c.HALF.HI & 1) != 0)
SoundReqClipped(a, SFX_BOSS_HIT);
health = org->health - damage;
if (org->kind == ENEMY) {
if ((org->field_0x6c.HALF.HI & 1) != 0)
SoundReqClipped(org, SFX_BOSS_HIT);
else
SoundReqClipped(a, SFX_HIT);
SoundReqClipped(org, SFX_HIT);
}
}
if (v5 <= 0) {
COLLISION_OFF(a);
if (health <= 0) {
COLLISION_OFF(org);
return 0;
}
return v5;
return health;
}
void sub_08017940(Entity* org, Entity* tgt) {
@@ -308,51 +313,71 @@ Entity* sub_08017A90(Entity* a1, Entity* parent) {
return NULL;
}
typedef s32 (*CollisionHandler)(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08018288(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
typedef CollisionResult (*CollisionHandler)(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult CollisionMazaalShrinkRay(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
CollisionResult sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSettings* settings);
const CollisionHandler gUnk_080B3744[] = {
sub_08018308, CollisionNoOp, CollisionNoOp, CollisionGroundItem, sub_08017B58, sub_08017EB0,
sub_08017F3C, sub_08017F40, sub_0801802C, sub_08017DD4, sub_080180E8, sub_08017BBC,
sub_08017C40, sub_08017D6C, sub_08017D28, sub_08018168, sub_08018228, sub_08018250,
sub_08018288, sub_080182A8, sub_08017B1C, sub_08017CBC, sub_08017E88,
const CollisionHandler gCollisionHandlers[] = {
CollisionDefault,
CollisionNoOp,
CollisionNoOp,
CollisionGroundItem,
sub_08017B58,
sub_08017EB0,
sub_08017F3C,
sub_08017F40,
sub_0801802C,
sub_08017DD4,
sub_080180E8,
sub_08017BBC,
sub_08017C40,
sub_08017D6C,
sub_08017D28,
sub_08018168,
sub_08018228,
sub_08018250,
CollisionMazaalShrinkRay,
sub_080182A8,
sub_08017B1C,
sub_08017CBC,
sub_08017E88,
};
s32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
return 0;
CollisionResult CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
return RESULT_NO_COLLISION;
}
// origin: player or sword
// target: item
s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
COLLISION_OFF(tgt);
tgt->contactFlags = org->hurtType | 0x80;
if ((tgt->type == 0x5F || tgt->type == 0x60) && sub_08081420(tgt))
tgt->health = 0;
return 2;
return RESULT_COLLISION_WITHOUT_SET;
}
s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if ((gPlayerState.dash_state & 0x60) != 0) {
COLLISION_OFF(tgt);
} else {
@@ -360,10 +385,10 @@ s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
org->iframes = -20;
org->knockbackSpeed = 640;
}
return 1;
return RESULT_COLLISION;
}
s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if ((tgt->gustJarState & 4) != 0) {
if (tgt->gustJarTolerance) {
tgt->gustJarTolerance = tgt->gustJarTolerance - gPlayerState.gustJarSpeed;
@@ -379,10 +404,10 @@ s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if ((gPlayerState.flags & (PL_BUSY | PL_MINISH | PL_BURNING | PL_IN_MINECART)) == 0) {
Entity* e = CreateObject(LINK_FIRE, 1, 0);
if (e != NULL) {
@@ -392,21 +417,21 @@ s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
}
tgt->damage = 4;
org->health = sub_08017874(org, tgt);
org->health = CalculateDamage(org, tgt);
org->knockbackDuration = 12;
org->iframes = 30;
org->knockbackSpeed = 384;
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if ((gPlayerState.flags & (PL_BUSY | PL_MINISH | PL_FROZEN | PL_IN_MINECART)) == 0 &&
gPlayerState.queued_action == PLAYER_INIT) {
if (org->action == 1 || org->action == 24) {
tgt->damage = 4;
org->health = sub_08017874(org, tgt);
org->health = CalculateDamage(org, tgt);
gPlayerState.flags = PL_FROZEN;
gPlayerState.queued_action = PLAYER_FROZEN;
}
@@ -416,10 +441,10 @@ s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
org->knockbackSpeed = 640;
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
direction = DirectionNormalize(DirectionTurnAround(direction) - 0xc);
if (DirectionNormalize(-direction + tgt->direction) < 0x19) {
org->iframes = -12;
@@ -433,10 +458,10 @@ s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
if (org->iframes == 0)
org->iframes = -1;
}
return 1;
return RESULT_COLLISION;
}
s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
gPlayerState.mobility = 1;
org->field_0x7a.HWORD = 600;
org->knockbackDuration = 12;
@@ -444,10 +469,10 @@ s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
org->knockbackSpeed = 640;
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 x;
u32 y;
ColSettings* p;
@@ -463,16 +488,16 @@ s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
y = 0xae4;
}
p = &gCollisionMtx[x + y];
return sub_08018308(org, tgt, direction, p);
return CollisionDefault(org, tgt, direction, p);
}
int sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
org->contactFlags = 0;
if (tgt->damage & 0x80)
tgt->damage &= ~0x80;
else
tgt->damage = 4;
gPlayerEntity.health = sub_08017874(&gPlayerEntity, tgt);
gPlayerEntity.health = CalculateDamage(&gPlayerEntity, tgt);
tgt->iframes = -12;
if ((gPlayerState.flags & PL_MINISH) == 0) {
sub_08079D84();
@@ -486,25 +511,25 @@ int sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
org->knockbackDuration = 2;
org->knockbackSpeed = 640;
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->damage == 0)
return 0;
return RESULT_NO_COLLISION;
if (org == &gPlayerEntity) {
u32 temp = tgt->damage;
u32 prevDamage = tgt->damage;
tgt->damage = 8;
gPlayerEntity.health = sub_08017874(&gPlayerEntity, tgt);
tgt->damage = temp;
gPlayerEntity.health = CalculateDamage(&gPlayerEntity, tgt);
tgt->damage = prevDamage;
gPlayerEntity.knockbackDuration = 12;
gPlayerEntity.iframes = 16;
gPlayerEntity.knockbackSpeed = 384;
@@ -516,14 +541,14 @@ s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
}
if (tgt->iframes == 0)
tgt->iframes = -1;
return 1;
return RESULT_COLLISION;
}
s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
return 1;
CollisionResult sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
return RESULT_COLLISION;
}
s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
if (PlayerCanBeMoved() &&
@@ -548,8 +573,8 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
org->spriteOrientation.flipY = tgt->spriteOrientation.flipY;
org->iframes = -1;
tgt->iframes = -8;
ResetPlayerItem();
return 1;
ResetActiveItems();
return RESULT_COLLISION;
}
} else {
org->health = 0;
@@ -557,39 +582,39 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else if (tgt->kind == ENEMY && org == &gPlayerEntity) {
sub_08004484(tgt, org);
}
return 0;
return RESULT_NO_COLLISION;
}
s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
int kind;
u32 x;
kind = org->kind;
if (kind == 1) {
if (kind == PLAYER) {
if (PlayerCanBeMoved()) {
if (((DirectionNormalize(DirectionTurnAround(direction) -
Direction8FromAnimationState(tgt->animationState) + 5))) > 0xA) {
x = 0x11aa;
return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
return CollisionDefault(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
} else {
sub_080180BC(org, tgt);
return 1;
return RESULT_COLLISION;
}
}
} else if (kind == 8) {
} else if (kind == PLAYER_ITEM) {
if (DirectionNormalize(
(DirectionTurnAround(org->direction) - Direction8FromAnimationState(tgt->animationState) + 5)) <= 0xA) {
org->health = 0;
sub_080180BC(org, tgt);
return 1;
return RESULT_COLLISION;
}
} else {
org->health = 0;
return 0;
return RESULT_NO_COLLISION;
}
x = 0x11aa;
return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
return CollisionDefault(org, tgt, direction, &gCollisionMtx[x + org->hurtType]);
}
void sub_080180BC(Entity* org, Entity* tgt) {
@@ -600,7 +625,7 @@ void sub_080180BC(Entity* org, Entity* tgt) {
tgt->subAction = -1;
}
s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 v3;
u32 x;
@@ -613,13 +638,13 @@ s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
tgt->iframes = -16;
tgt->knockbackSpeed = 768;
sub_08017940(org, tgt);
return 1;
return RESULT_COLLISION;
}
x = 0x352;
return sub_08018308(org, tgt, v3, &gCollisionMtx[org->hurtType + x]);
return CollisionDefault(org, tgt, v3, &gCollisionMtx[org->hurtType + x]);
}
s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org == &gPlayerEntity) {
if (PlayerCanBeMoved() &&
@@ -639,7 +664,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
gPlayerEntity.iframes = 0xff;
tgt->iframes = -8;
PutAwayItems();
return 1;
return RESULT_COLLISION;
}
} else {
org->health = 0;
@@ -647,16 +672,16 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity)) {
sub_08004484(tgt, &gPlayerEntity);
}
return 0;
return RESULT_NO_COLLISION;
}
s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity && PlayerCanBeMoved())
sub_08004484(tgt, org);
return 0;
return RESULT_NO_COLLISION;
}
s32 sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
org->iframes = -1;
if (org->direction == 0) {
tgt->iframes = 16;
@@ -664,18 +689,18 @@ s32 sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
} else {
tgt->iframes = -1;
}
return 1;
return RESULT_COLLISION;
}
s32 sub_08018288(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult CollisionMazaalShrinkRay(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (org == &gPlayerEntity)
sub_0807AFE8();
PlayerShrinkByRay();
else
org->health = 0;
return 1;
return RESULT_COLLISION;
}
s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
if (tgt->confusedTime == 0) {
if (org->iframes == 0)
org->iframes = -1;
@@ -683,12 +708,12 @@ s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
tgt->iframes = -1;
} else {
u32 x = 0x92a;
return sub_08018308(org, tgt, direction, &gCollisionMtx[org->hurtType + x]);
return CollisionDefault(org, tgt, direction, &gCollisionMtx[org->hurtType + x]);
}
return 1;
return RESULT_COLLISION;
}
s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
u32 confused = 0;
if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity) {
sub_08004484(tgt, org);
@@ -697,7 +722,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) &&
gPlayerEntity.animationState ==
AnimationStateFlip180(Direction8ToAnimationState(DirectionRoundUp(direction)))) {
return 0;
return RESULT_NO_COLLISION;
}
if (!confused) {
u32 tmp2;
@@ -709,7 +734,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
tgt->damage = settings->tgtDamage;
tmp2 = 0xFF;
if (settings->tgtDamage != 0)
org->health = sub_08017874(org, tgt);
org->health = CalculateDamage(org, tgt);
if (settings->orgConfusedTime > org->confusedTime)
org->confusedTime = settings->orgConfusedTime;
tgt->knockbackSpeed = 16 * settings->tgtKnockbackSpeed;
@@ -719,15 +744,15 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
tgt->knockbackDuration = settings->tgtKnockbackDuration;
tmp2 &= (org->damage = settings->orgDamage);
if (tmp2 != 0)
tgt->health = sub_08017874(tgt, org);
tgt->health = CalculateDamage(tgt, org);
if (settings->tgtConfusedTime > tgt->confusedTime)
tgt->confusedTime = settings->tgtConfusedTime;
}
if (settings->_a & 1)
if (settings->flags & COL_FLAG_1)
sub_08017940(org, tgt);
if (settings->_a & 2)
if (settings->flags & COL_FLAG_2)
org->contactFlags = 0xca;
if (settings->_a & 4) {
if (settings->flags & COL_FLAG_4) {
Entity* parent = tgt->parent;
if (parent != NULL) {
parent->contactFlags = 0xcc;
@@ -746,7 +771,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
sub_080179EC(org, tgt);
}
} else if (org->id == PL_ITEM_BOW) {
if (org->damage || (settings->_a & 8)) {
if (org->damage || (settings->flags & COL_FLAG_8)) {
sub_08017A90(org, tgt);
}
} else if (org->id == PL_ITEM_BOOMERANG) {
@@ -760,5 +785,5 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
if (tgt->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) {
gPlayerEntity.iframes = 0x80;
}
return 1;
return RESULT_COLLISION;
}
+2 -2
View File
@@ -30,8 +30,8 @@ void ResetPaletteTable(u32 a1) {
sub_0801D000(a1);
}
void sub_0801CFD0(u32 a1) {
Palette* p = &gPaletteList[a1];
void sub_0801CFD0(u32 index) {
Palette* p = &gPaletteList[index];
p->_0_0 = 4;
p->_0_4 = 1;
p->_1 = 0x80;
+4 -4
View File
@@ -69,11 +69,11 @@ void sub_080300E8(void) {
}
}
void sub_08030118(u32 param_1) {
if (((s32)(u32)gRoomTransition.armos_data.field_0xac >> (param_1)&1) != 0) {
SetLocalFlagByBank(FLAG_BANK_3, param_1 + 0x67);
void sub_08030118(u32 armosId) {
if (((gRoomTransition.armos_data.field_0xac >> armosId) & 1) != 0) {
SetLocalFlagByBank(FLAG_BANK_3, armosId + 0x67);
} else {
ClearLocalFlagByBank(FLAG_BANK_3, param_1 + 0x67);
ClearLocalFlagByBank(FLAG_BANK_3, armosId + 0x67);
}
}
+1 -1
View File
@@ -252,7 +252,7 @@ void sub_08021B64(Entity* this) {
} else {
gPlayerState.mobility |= 0x80;
gPlayerState.speed_modifier -= 0x50;
gPlayerState.field_0xaa++;
gPlayerState.attachedBeetleCount++;
CopyPositionAndSpriteOffset(&gPlayerEntity, this);
this->x.HALF.HI += gUnk_080CB5E4[(this->subtimer++ & 0xe) >> 1];
this->z.HALF.HI--;
+1 -1
View File
@@ -1830,7 +1830,7 @@ Entity* sub_08027D20(ChuchuBossEntity* this) {
r4->spriteVramOffset = super->spriteVramOffset;
r4->palette.b.b0 = super->palette.b.b0;
#endif
r4->y.HALF.HI += 1;
r4->y.HALF.HI++;
r4->spriteOffsetY = 8;
#ifndef EU
LoadFixedGFX(r4, 0x3e);
+1 -1
View File
@@ -277,7 +277,7 @@ void sub_08044498(DustEntity* this) {
u32 xdiff, ydiff;
uVar4 = COORD_TO_TILE(&gPlayerEntity);
tmp = (gPlayerState.playerInput.field_0x92 & 0xf00);
tmp = (gPlayerState.playerInput.newInput & 0xf00);
if (tmp != this->unk_75 || uVar4 != this->unk_76) {
this->unk_75 = tmp;
this->unk_76 = uVar4;
+3 -3
View File
@@ -411,13 +411,13 @@ void Enemy64_Action4_SubAction5(Enemy64Entity* this) {
super->subAction = 6;
super->spriteSettings.draw = 0;
entity = super->child;
entity->flags &= 0x7f;
entity->flags &= ~0x80;
entity->spriteSettings.draw = 0;
entity = entity->child;
entity->flags &= 0x7f;
entity->flags &= ~0x80;
entity->spriteSettings.draw = 0;
entity = entity->child;
entity->flags &= 0x7f;
entity->flags &= ~0x80;
entity->spriteSettings.draw = 0;
entity = &gPlayerEntity;
entity->x.HALF.HI = gRoomControls.origin_x + 0xa8;
+1 -1
View File
@@ -384,7 +384,7 @@ void sub_0803F6EC(GhiniEntity* this) {
}
void sub_0803F738(GhiniEntity* this) {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
sub_0806FA90(&gPlayerEntity, super, 0, 1);
+1 -1
View File
@@ -166,7 +166,7 @@ void sub_08037690(GibdoEntity* this) {
void sub_080376D0(GibdoEntity* this) {
if (!sub_080379EC(this)) {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, super);
+1 -1
View File
@@ -1076,7 +1076,7 @@ void sub_0802E300(GleerokEntity* this) {
}
}
this->unk_79 &= 0x7f;
this->unk_79 &= ~0x80;
heap = this->unk_84;
dir = sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity)) << 3;
index = 0;
+1 -1
View File
@@ -90,7 +90,7 @@ void GyorgMaleEye_Action2(GyorgMaleEyeEntity* this) {
sub_08048F50(this);
if (--super->timer == 0) {
super->action = 3;
super->flags &= 0x7f;
super->flags &= ~0x80;
InitializeAnimation(super, super->animIndex + 4);
}
}
+1 -1
View File
@@ -198,7 +198,7 @@ void sub_0802805C(LikeLikeEntity* this) {
if (super->subtimer >= 0x19 || gSave.stats.health == 0) {
LikeLike_ReleasePlayer(this);
} else {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.mobility |= 0x80;
PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0));
+2 -2
View File
@@ -557,7 +557,7 @@ void sub_0803A978(Entity* this) {
this->action = 0x12;
this->timer = 3;
COLLISION_OFF(this);
*(u8*)(*(int*)&this->field_0x74 + 0x10) &= 0x7f;
*(u8*)(*(int*)&this->field_0x74 + 0x10) &= ~0x80;
InitializeAnimation(this, 8);
InitAnimationForceUpdate(this->child, 3);
}
@@ -1244,7 +1244,7 @@ void sub_0803B804(Entity* this) {
}
void sub_0803B824(Entity* this) {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.mobility |= 0x80;
sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1);
gPlayerEntity.spriteOffsetY = -6;
+1 -1
View File
@@ -39,7 +39,7 @@ void MiniFireballGuy_OnCollision(Entity* this) {
void MiniFireballGuy_OnDeath(Entity* this) {
if ((this != this->parent) && (this->parent != NULL)) {
this->field_0x6c.HALF.LO &= 0x7f;
this->field_0x6c.HALF.LO &= ~0x80;
this->parent->child = this->child;
this->child->parent = this->parent;
}
+1 -1
View File
@@ -50,7 +50,7 @@ void MiniSlime_OnCollision(Entity* this) {
void MiniSlime_OnDeath(Entity* this) {
Entity* parent = this->parent;
if ((this != parent) && (parent != NULL)) {
this->field_0x6c.HALF.LO &= 0x7f;
this->field_0x6c.HALF.LO &= ~0x80;
this->parent->child = this->child;
this->child->parent = this->parent;
if (this->field_0x6c.HALF.HI & 0x40)
+1 -1
View File
@@ -237,7 +237,7 @@ void sub_08033000(MulldozerEntity* this) {
super->subtimer = 16;
if ((this->unk_82 & 0x80) != 0) {
super->direction = (super->direction + 0x18) & 0x1c;
this->unk_82 &= 0x7f;
this->unk_82 &= ~0x80;
} else {
super->direction = (super->direction + 8) & 0x1c;
this->unk_82 |= 0x80;
+1 -1
View File
@@ -1226,7 +1226,7 @@ void sub_08036F60(OctorokBossEntity* this) {
void OctorokBoss_StepSound(OctorokBossEntity* this, u32 frameMask) {
if ((gRoomTransition.frameCount & frameMask) == 0) {
if (IS_FROZEN(this) == FALSE) {
SoundReq(SFX_163);
SoundReq(SFX_TOGGLE_DIVING);
} else {
SoundReq(SFX_ICE_BLOCK_SLIDE);
}
+1 -1
View File
@@ -828,7 +828,7 @@ void sub_08024E4C(Entity* this) {
sub_08024A14(this, 0, 8);
} else {
Entity* player = &gPlayerEntity;
ResetPlayerItem();
ResetActiveItems();
gPlayerState.flags |= PL_DISABLE_ITEMS;
gPlayerState.field_0xa |= 0x80;
gPlayerState.queued_action = PLAYER_0807204C;
+1 -1
View File
@@ -167,7 +167,7 @@ void sub_0802953C(Entity* this) {
if (((this->subtimer > 0x2d) || (gSave.stats.rupees == 0)) && (this->timer == 0)) {
sub_080296D8(this);
} else {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
+1 -1
View File
@@ -226,7 +226,7 @@ void VaatiProjectileFunction0Action9(Entity* this) {
}
void sub_0803E444(Entity* this) {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa |= 0x80;
sub_0806FA90(this, this->contactedEntity, 0, -2);
+1 -1
View File
@@ -113,7 +113,7 @@ void WizzrobeFire_Action2(WizzrobeEntity* this) {
this->timer1 = 0x28;
super->timer = 40;
super->subtimer = 0;
super->flags &= 0x7f;
super->flags &= ~0x80;
SetTile(this->tileIndex, this->tilePosition, super->collisionLayer);
EnqueueSFX(SFX_156);
InitializeAnimation(super, super->direction >> 3);
+1 -1
View File
@@ -120,7 +120,7 @@ void WizzrobeIce_Action2(WizzrobeEntity* this) {
this->timer1 = 0x28;
super->timer = 40;
super->subtimer = 0;
super->flags &= 0x7f;
super->flags &= ~0x80;
SetTile(this->tileIndex, this->tilePosition, super->collisionLayer);
EnqueueSFX(SFX_156);
InitializeAnimation(super, super->direction >> 3);
+2 -2
View File
@@ -136,7 +136,7 @@ void WizzrobeWind_Action2(WizzrobeEntity* this) {
this->timer1 = 0x28;
super->timer = 40;
super->subtimer = 0;
super->flags &= 0x7f;
super->flags &= ~0x80;
EnqueueSFX(SFX_156);
SetTile(this->tileIndex, this->tilePosition, super->collisionLayer);
InitializeAnimation(super, super->direction >> 3);
@@ -264,7 +264,7 @@ void sub_0802F9C8(WizzrobeEntity* this) {
if (super->type2 != 0) {
ProcessMovement0(super);
if (super->collisions != COL_NONE) {
super->flags &= 0x7f;
super->flags &= ~0x80;
this->timer1 = 0x28;
}
}
+50 -49
View File
@@ -972,10 +972,10 @@ static void InitializePlayer(void) {
Entity* pl;
sub_080784C8();
MemClear(&gUnk_03000B80, sizeof gUnk_03000B80);
MemClear(&gPlayerState, sizeof gPlayerState);
MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof gPlayerState.path_memory);
MemClear(&gPlayerEntity, sizeof gPlayerEntity);
MemClear(&gActiveItems, sizeof(gActiveItems));
MemClear(&gPlayerState, sizeof(gPlayerState));
MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof(gPlayerState.path_memory));
MemClear(&gPlayerEntity, sizeof(gPlayerEntity));
pl = &gPlayerEntity;
@@ -2463,68 +2463,69 @@ void ModArrows(s32 arrows) {
* 1: B
* 2: Not equipped
*/
u32 IsItemEquipped(u32 itemID) {
u32 itemSlot;
EquipSlot IsItemEquipped(u32 itemId) {
EquipSlot equipSlot;
if (itemID == gSave.stats.itemButtons[SLOT_A])
itemSlot = 0;
else if (itemID == gSave.stats.itemButtons[SLOT_B])
itemSlot = 1;
else
itemSlot = 2;
return itemSlot;
if (itemId == gSave.stats.itemButtons[SLOT_A]) {
equipSlot = EQUIP_SLOT_A;
} else if (itemId == gSave.stats.itemButtons[SLOT_B]) {
equipSlot = EQUIP_SLOT_B;
} else {
equipSlot = EQUIP_SLOT_NONE;
}
return equipSlot;
}
void PutItemOnSlot(u32 itemID) {
u32 itemSlot;
u32 itemID2 = itemID;
if (itemID2 < 0x47) {
void PutItemOnSlot(u32 itemId) {
EquipSlot equipSlot;
u32 itemId2 = itemId;
if (itemId2 < 0x47) {
SetInventoryValue(0, 1);
}
if (itemID2 - 1 < 0x1f) {
itemSlot = 2;
if (itemId2 - 1 < 0x1f) {
equipSlot = EQUIP_SLOT_NONE;
if (gSave.stats.itemButtons[SLOT_A] == ITEM_NONE) {
itemSlot = 0;
equipSlot = EQUIP_SLOT_A;
} else if (gSave.stats.itemButtons[SLOT_B] == ITEM_NONE) {
itemSlot = 1;
equipSlot = EQUIP_SLOT_B;
}
if (itemSlot == 2) {
u32 temp = gItemMetaData[itemID2].menuSlot;
if (equipSlot == EQUIP_SLOT_NONE) {
u32 temp = gItemMetaData[itemId2].menuSlot;
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_A]].menuSlot) {
itemSlot = 0;
equipSlot = EQUIP_SLOT_A;
} else {
if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_B]].menuSlot) {
itemSlot = 1;
equipSlot = EQUIP_SLOT_B;
}
}
if (itemSlot == 2) {
if (equipSlot == EQUIP_SLOT_NONE) {
return;
}
}
ForceEquipItem(itemID2, itemSlot);
ForceEquipItem(itemId2, equipSlot);
}
}
void ForceEquipItem(u32 itemID, u32 itemSlot) {
void ForceEquipItem(u32 itemId, u32 equipSlot) {
u32 otherItem;
u32 otherItemIndex;
u32 otherItemSlot;
u32 replacedItem;
if ((itemID - 1 < 0x1f) && (itemSlot < 2)) {
otherItemIndex = itemSlot == 0;
replacedItem = gSave.stats.itemButtons[itemSlot];
otherItem = gSave.stats.itemButtons[otherItemIndex];
if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemID].menuSlot) {
if ((itemId - 1 < 0x1f) && (equipSlot < EQUIP_SLOT_NONE)) {
otherItemSlot = equipSlot == EQUIP_SLOT_A;
replacedItem = gSave.stats.itemButtons[equipSlot];
otherItem = gSave.stats.itemButtons[otherItemSlot];
if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemId].menuSlot) {
otherItem = replacedItem;
}
gSave.stats.itemButtons[itemSlot] = itemID;
gSave.stats.itemButtons[otherItemIndex] = otherItem;
gSave.stats.itemButtons[equipSlot] = itemId;
gSave.stats.itemButtons[otherItemSlot] = otherItem;
gUnk_0200AF00.unk_13 = 0x7f;
gUnk_0200AF00.unk_14 = 0x7f;
}
}
u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
u32 SetBottleContents(u32 itemId, u32 bottleIndex) {
if (bottleIndex > 3) {
bottleIndex = 0;
for (bottleIndex = 0; gSave.stats.bottles[bottleIndex] != ITEM_BOTTLE_EMPTY;) {
@@ -2536,7 +2537,7 @@ u32 SetBottleContents(u32 itemID, u32 bottleIndex) {
return bottleIndex;
}
}
gSave.stats.bottles[bottleIndex] = itemID;
gSave.stats.bottles[bottleIndex] = itemId;
return bottleIndex;
}
@@ -2614,7 +2615,7 @@ void EnableRandomDrops(void) {
extern void sub_08000F14(s16*, const s16*, const s16*, const s16*);
extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*);
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter);
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter);
u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
extern const u8 gUnk_080FE1B4[] /* = {
ITEM_NONE, ITEM_RUPEE1, ITEM_RUPEE5, ITEM_RUPEE20, ITEM_HEART, ITEM_FAIRY,
@@ -2717,11 +2718,11 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) {
return ITEM_NONE;
}
u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) {
u32 adjustedParam = itemParameter;
Entity* itemEntity;
switch (itemID) {
switch (itemId) {
case ITEM_ENEMY_BEETLE:
if (!GetInventoryValue(ITEM_SMITH_SWORD)) {
return ITEM_NONE;
@@ -2757,22 +2758,22 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
return ITEM_NONE;
}
if (itemID != ITEM_KINSTONE) {
adjustedParam = itemID - ITEM_KINSTONE_GREEN;
if (itemId != ITEM_KINSTONE) {
adjustedParam = itemId - ITEM_KINSTONE_GREEN;
rand = (Random() & 0x3f);
adjustedParam = gUnk_080FE1DD[(rand + adjustedParam * 0x40)];
if (adjustedParam == 0) {
itemID = ITEM_NONE;
itemId = ITEM_NONE;
} else {
itemID = ITEM_KINSTONE;
itemId = ITEM_KINSTONE;
}
}
break;
}
}
if (itemID != ITEM_NONE) {
if (itemID != ITEM_ENEMY_BEETLE) {
itemEntity = CreateObject(GROUND_ITEM, itemID, adjustedParam);
if (itemId != ITEM_NONE) {
if (itemId != ITEM_ENEMY_BEETLE) {
itemEntity = CreateObject(GROUND_ITEM, itemId, adjustedParam);
if (itemEntity != NULL) {
if (arg0 == &gPlayerEntity) {
itemEntity->timer = 1;
@@ -2800,7 +2801,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
}
}
}
return itemID;
return itemId;
}
void Subtask_WorldEvent(void) {
+1 -1
View File
@@ -1313,7 +1313,7 @@ void CgbSound(void) {
if (channels->n4 & 0x80) {
*nrx0ptr = 0x80;
*nrx4ptr = channels->n4;
channels->n4 &= 0x7f;
channels->n4 &= ~0x80;
}
} else {
envelopeStepTimeAndDir &= 0xf;
+13 -13
View File
@@ -1,14 +1,14 @@
#include "global.h"
#include "sound.h"
#include "main.h"
#include "player.h"
#include "structures.h"
#include "save.h"
#include "message.h"
#include "functions.h"
#include "screen.h"
#include "gba/m4a.h"
#include "global.h"
#include "main.h"
#include "message.h"
#include "object.h"
#include "player.h"
#include "save.h"
#include "screen.h"
#include "sound.h"
#include "structures.h"
#include "ui.h"
extern u8 gUnk_03003DE0;
@@ -197,7 +197,7 @@ void PlayerUpdate(Entity* this) {
else
gPlayerState.flags &= ~PL_DRUGGED;
if (EntityIsDeleted(this) == 0) {
if (!EntityIsDeleted(this)) {
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
PutAwayItems();
if (gPlayerState.flags & PL_MOLDWORM_RELEASED) {
@@ -218,7 +218,7 @@ void PlayerUpdate(Entity* this) {
}
sub_08078FB0(this);
DrawEntity(this);
sub_0807A050();
UpdatePlayerPalette();
}
// Responsible for some life things like low health beep and initiating the death sequence
@@ -234,7 +234,7 @@ static void HandlePlayerLife(Entity* this) {
gPlayerState.flags &= ~(PL_FALLING | PL_CONVEYOR_PUSHED);
if (gPlayerState.flags & PL_BURNING)
ResetPlayerItem();
ResetActiveItems();
if ((gPlayerState.flags & PL_CLONING) && gPlayerState.chargeState.action == 0)
DeleteClones();
if (sub_08079B24() == 0)
@@ -309,7 +309,7 @@ static void HandlePlayerLife(Entity* this) {
static void sub_080171F0(void) {
if (gPlayerState.mobility != 0)
ResetPlayerItem();
ResetActiveItems();
if (gPlayerState.field_0x14 != 0)
gPlayerState.field_0x14--;
if (gPlayerEntity.field_0x7a.HWORD != 0)
@@ -331,7 +331,7 @@ static void sub_080171F0(void) {
gPlayerState.keepFacing &= ~0x80;
gPlayerState.mobility = 0;
gPlayerState.speed_modifier = 0;
gPlayerState.field_0xaa = 0;
gPlayerState.attachedBeetleCount = 0;
MemClear(&gCarriedEntity, sizeof(gCarriedEntity));
gPlayerEntity.spriteOffsetY = gPlayerState.spriteOffsetY;
gPlayerState.spriteOffsetY = 0;
+34 -8
View File
@@ -3,14 +3,40 @@
// TODO - How does this relate to PlayerItemFunctions? Is this just a lookup table?
void (*const gItemFunctions[])(ItemBehavior*, u32) = {
ItemDebug, ItemSword, ItemSword, ItemSword, ItemSword, ItemSword, ItemSword,
ItemBomb, ItemBomb, ItemBow, ItemBow, ItemBoomerang, ItemBoomerang, ItemShield,
ItemShield, ItemLantern, ItemLantern, ItemGustJar, ItemPacciCane, ItemMoleMitts, ItemRocsCape,
ItemPegasusBoots, ItemDebug, ItemOcarina, ItemDebug, ItemDebug, ItemDebug, ItemTryPickupObject,
ItemJarEmpty, ItemJarEmpty, ItemJarEmpty, ItemJarEmpty,
[ITEM_NONE] = ItemDebug,
[ITEM_SMITH_SWORD] = ItemSword,
[ITEM_GREEN_SWORD] = ItemSword,
[ITEM_RED_SWORD] = ItemSword,
[ITEM_BLUE_SWORD] = ItemSword,
[ITEM_UNUSED_SWORD] = ItemSword,
[ITEM_FOURSWORD] = ItemSword,
[ITEM_BOMBS] = ItemBomb,
[ITEM_REMOTE_BOMBS] = ItemBomb,
[ITEM_BOW] = ItemBow,
[ITEM_LIGHT_ARROW] = ItemBow,
[ITEM_BOOMERANG] = ItemBoomerang,
[ITEM_MAGIC_BOOMERANG] = ItemBoomerang,
[ITEM_SHIELD] = ItemShield,
[ITEM_MIRROR_SHIELD] = ItemShield,
[ITEM_LANTERN_OFF] = ItemLantern,
[ITEM_LANTERN_ON] = ItemLantern,
[ITEM_GUST_JAR] = ItemGustJar,
[ITEM_PACCI_CANE] = ItemPacciCane,
[ITEM_MOLE_MITTS] = ItemMoleMitts,
[ITEM_ROCS_CAPE] = ItemRocsCape,
[ITEM_PEGASUS_BOOTS] = ItemPegasusBoots,
[ITEM_FIRE_ROD] = ItemDebug,
[ITEM_OCARINA] = ItemOcarina,
[ITEM_ORB_GREEN] = ItemDebug,
[ITEM_ORB_BLUE] = ItemDebug,
[ITEM_ORB_RED] = ItemDebug,
[ITEM_TRY_PICKUP_OBJECT] = ItemTryPickupObject,
[ITEM_BOTTLE1] = ItemJarEmpty,
[ITEM_BOTTLE2] = ItemJarEmpty,
[ITEM_BOTTLE3] = ItemJarEmpty,
[ITEM_BOTTLE4] = ItemJarEmpty,
};
void sub_080752E8(ItemBehavior* behavior, u32 idx) {
gItemFunctions[behavior->behaviorID](behavior, idx);
void ExecuteItemFunction(ItemBehavior* behavior, u32 index) {
gItemFunctions[behavior->behaviorId](behavior, index);
}
+6 -61
View File
@@ -10,14 +10,14 @@ void sub_08076488(ItemBehavior*, u32);
void sub_08076518(ItemBehavior*, u32);
void sub_080765E0(ItemBehavior*, u32);
void ItemBomb(ItemBehavior* this, u32 idx) {
void ItemBomb(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08075FF8, NULL, sub_08076488, sub_08076518, sub_080765E0,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08075FF8(ItemBehavior* this, u32 idx) {
void sub_08075FF8(ItemBehavior* this, u32 index) {
static const s8 gUnk_0811BDAC[] = {
0, -8, 4, -1, 0, 2, -4, -1,
};
@@ -28,13 +28,13 @@ void sub_08075FF8(ItemBehavior* this, u32 idx) {
s32 x;
s32 y;
if ((gPlayerState.jump_status | gPlayerState.field_0x3[1]) == 0) {
if ((gPlayerState.jump_status | gPlayerState.attack_status) == 0) {
bombCount = 0;
for (entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); entity != NULL;
entity = FindNextDuplicateID(entity, 2)) {
bombCount++;
}
maxBombs = this->behaviorID == 7 ? 3 : 1;
maxBombs = this->behaviorId == 7 ? 3 : 1;
if (maxBombs > bombCount) {
entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_BOMB);
if (entity != NULL) {
@@ -45,60 +45,5 @@ void sub_08075FF8(ItemBehavior* this, u32 idx) {
}
}
}
DeletePlayerItem(this, idx);
}
void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
if (param_2 != NULL) {
if ((param_2->carryFlags & 1) != 0) {
return;
}
param_2->action = 2;
param_2->subAction = param_2->carryFlags & 1;
}
this->field_0x18 = param_2;
if ((gPlayerState.flags & PL_NO_CAP)) {
sub_08077DF4(this, 0x928);
} else {
sub_08077DF4(this, 0x338);
}
gPlayerState.heldObject = 3;
gPlayerState.framestate = PL_STATE_HOLD;
this->stateID = 2;
this->field_0xf = 0xf;
if ((gPlayerEntity.field_0x78.HALF.HI & 0x80)) {
gPlayerEntity.field_0x78.HALF.HI = 0;
COLLISION_ON(&gPlayerEntity);
gPlayerState.heldObject = 4;
gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing;
gPlayerState.field_0xa = ~(8 >> param_3) & gPlayerState.field_0xa;
this->stateID = 3;
this->field_0xf = 0;
} else {
gPlayerState.field_0xa |= (8 >> param_3);
gPlayerState.keepFacing |= (8 >> param_3);
}
param_2 = CreatePlayerItemWithParent(this, PLAYER_ITEM_13);
if (param_2 == NULL) {
PlayerCancelHoldItem(this, param_3);
} else {
Entity* playerEnt = &gPlayerEntity;
*(Entity**)&playerEnt->field_0x74 = param_2;
playerEnt->subtimer = 0;
param_2->child = this->field_0x18;
param_2->carryFlags = playerEnt->carryFlags;
param_2->parent = (Entity*)this;
this->field_0x18 = param_2;
param_2->type2 = this->field_0x2[1];
param_2->timer = this->timer;
param_2->subtimer = this->subtimer;
if ((this->field_0x18->carryFlags & 0xf0) == 0x10) {
this->timer = 8;
} else {
this->timer = 0;
}
SoundReq(SFX_PLY_LIFT);
}
DeleteItemBehavior(this, index);
}
+13 -13
View File
@@ -4,29 +4,29 @@
void sub_08075D2C(ItemBehavior*, u32);
void sub_08075D88(ItemBehavior*, u32);
void ItemBoomerang(ItemBehavior* this, u32 idx) {
void ItemBoomerang(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08075D2C,
sub_08075D88,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08075D2C(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 8) == 0) && (sub_08077C94(this, this->behaviorID) == NULL)) {
this->field_0x9 |= 0xf;
void sub_08075D2C(ItemBehavior* this, u32 index) {
if (((gPlayerState.attack_status & 8) == 0) && (FindPlayerItemForItem(this, this->behaviorId) == NULL)) {
this->priority |= 0xf;
sub_0806F948(&gPlayerEntity);
sub_08077C0C(this, 0xb);
sub_08077D38(this, idx);
gPlayerState.field_0x3[1] |= 8;
CreatePlayerItemIfNotExists(this, ITEM_BOOMERANG);
sub_08077D38(this, index);
gPlayerState.attack_status |= 8;
} else {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
void sub_08075D88(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x3[1] & 0x80) == 0) {
if (((this->behaviorID == 0xc) && ((gPlayerState.field_0xa & 0x80) != 0)) && ((this->playerFrame & 2) != 0)) {
void sub_08075D88(ItemBehavior* this, u32 index) {
if ((gPlayerState.attack_status & 0x80) == 0) {
if (((this->behaviorId == 0xc) && ((gPlayerState.field_0xa & 0x80) != 0)) && ((this->playerFrame & 2) != 0)) {
ResetPlayerVelocity();
return;
}
@@ -35,5 +35,5 @@ void sub_08075D88(ItemBehavior* this, u32 idx) {
return;
}
}
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
+27 -30
View File
@@ -9,81 +9,78 @@ void sub_08075F38(ItemBehavior*, u32);
void sub_08075F84(ItemBehavior*, u32);
void sub_08075D88(ItemBehavior*, u32);
void ItemBow(ItemBehavior* this, u32 idx) {
void ItemBow(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08075DF4, sub_08075E40, sub_08075EC0, sub_08075F38, sub_08075F84, sub_08075D88,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08075DF4(ItemBehavior* this, u32 idx) {
if ((gPlayerState.field_0x3[1] & 8) == 0) {
this->field_0x9 |= 0x80;
void sub_08075DF4(ItemBehavior* this, u32 index) {
if ((gPlayerState.attack_status & 8) == 0) {
this->priority |= 0x80;
sub_0806F948(&gPlayerEntity);
sub_08077BB8(this);
sub_08077D38(this, idx);
sub_08077D38(this, index);
gPlayerState.field_0x1f[2] = 1;
} else {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
void sub_08075E40(ItemBehavior* this, u32 idx) {
u8 bVar1;
void sub_08075E40(ItemBehavior* this, u32 index) {
if (gPlayerState.field_0x1f[2] != 0) {
bVar1 = gPlayerState.field_0x3[1] & 0x80;
if (bVar1 == 0) {
if ((gPlayerState.attack_status & 0x80) == 0) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
this->stateID = 2;
this->field_0x9 &= ~0x80;
this->priority &= ~0x80;
if (gSave.stats.arrowCount != 0) {
this->field_0xf = bVar1;
gPlayerState.field_0xa &= ~(8 >> idx);
this->animPriority = 0;
gPlayerState.field_0xa &= ~(8 >> index);
}
}
return;
}
}
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
void sub_08075EC0(ItemBehavior* this, u32 idx) {
void sub_08075EC0(ItemBehavior* this, u32 index) {
u8 arrowCount;
s32 iVar2;
arrowCount = gSave.stats.arrowCount;
iVar2 = sub_08077EFC(this);
iVar2 = IsItemActive(this);
if (iVar2 != 0 && arrowCount != 0) {
if (((gPlayerState.field_0x3[1] & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) {
if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) {
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
} else {
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
sub_08077DF4(this, 0x27c);
this->field_0xf = 0xf;
this->field_0x9 |= 0xf;
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
SetItemAnim(this, 0x27c);
this->animPriority = 0xf;
this->priority |= 0xf;
this->stateID = 3;
}
}
void sub_08075F38(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
void sub_08075F38(ItemBehavior* this, u32 index) {
if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
UpdateItemAnim(this);
if ((this->playerFrame & 1) != 0) {
this->stateID = 4;
}
} else {
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
void sub_08075F84(ItemBehavior* this, u32 idx) {
if (((gPlayerState.field_0x3[1] & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
void sub_08075F84(ItemBehavior* this, u32 index) {
if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) {
sub_08077E3C(this, 5);
} else {
@@ -94,5 +91,5 @@ void sub_08075F84(ItemBehavior* this, u32 idx) {
}
}
gPlayerState.field_0x1f[2] = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
+5 -5
View File
@@ -1,9 +1,9 @@
#include "item.h"
extern Entity* sub_08077BD4(ItemBehavior*);
extern void DeletePlayerItem(ItemBehavior*, u32);
extern Entity* CreatePlayerItemForItemIfNotExists(ItemBehavior*);
extern void DeleteItemBehavior(ItemBehavior*, u32);
void ItemDebug(ItemBehavior* beh, u32 idx) {
sub_08077BD4(beh);
DeletePlayerItem(beh, idx);
void ItemDebug(ItemBehavior* this, u32 index) {
CreatePlayerItemForItemIfNotExists(this);
DeleteItemBehavior(this, index);
}
+37 -37
View File
@@ -4,41 +4,41 @@
#include "functions.h"
#include "playeritem.h"
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32);
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* this, u32);
void ItemGustJar(ItemBehavior* this, u32 idx) {
void ItemGustJar(ItemBehavior* this, u32 index) {
gPlayerState.framestate = PL_STATE_GUSTJAR;
ItemGustJar_StateFunctions[this->stateID](this, idx);
ItemGustJar_StateFunctions[this->stateID](this, index);
}
void sub_08076DF4(ItemBehavior* this, u32 idx) {
if (sub_0807A894(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
void sub_08076DF4(ItemBehavior* this, u32 index) {
if (GetCollisionTileInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, idx);
sub_08077D38(this, index);
this->timer = 0;
this->playerAnimationState = gPlayerEntity.animationState;
this->field_0x9 |= 0x80;
this->field_0x9++;
this->priority |= 0x80;
this->priority++;
gPlayerState.gustJarSpeed = 1;
*(u32*)&gPlayerEntity.field_0x74 = 0;
gPlayerState.field_0x1c = 1;
sub_08077BB8(this);
} else {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
void sub_08076E60(ItemBehavior* this, u32 idx) {
void sub_08076E60(ItemBehavior* this, u32 index) {
Entity* playerItem;
if ((gPlayerState.field_0x1c & 0xf) == 0) {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
if ((this->playerFrame & 0x80) != 0) {
this->stateID = 2;
sub_08077DF4(this, 0x504);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
playerItem = CreatePlayerItem(PLAYER_ITEM_10, 0, 0, 0);
SetItemAnim(this, 0x504);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0);
if (playerItem != NULL) {
playerItem->parent = &gPlayerEntity;
}
@@ -47,14 +47,14 @@ void sub_08076E60(ItemBehavior* this, u32 idx) {
}
}
void sub_08076EC8(ItemBehavior* this, u32 idx) {
void sub_08076EC8(ItemBehavior* this, u32 index) {
if ((gPlayerState.field_0x1c & 0xf) == 0) {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
return;
}
if (sub_08077EFC(this)) {
u32 val;
if (IsItemActive(this)) {
u32 animIndex;
if (this->timer > 0xef) {
gPlayerState.gustJarSpeed = 3;
} else if (++this->timer > 0x77) {
@@ -64,17 +64,17 @@ void sub_08076EC8(ItemBehavior* this, u32 idx) {
}
if (gPlayerEntity.subAction == 0x1b) {
val = 0x524;
animIndex = 0x524;
} else {
if (gPlayerState.field_0xd & 0x80) {
val = 0x504;
if (gPlayerState.direction & 0x80) {
animIndex = 0x504;
} else {
val = 0x518;
animIndex = 0x518;
}
}
if (val != *(u16*)&this->field_0x10) {
sub_08077DF4(this, val);
if (animIndex != this->animIndex) {
SetItemAnim(this, animIndex);
} else {
UpdateItemAnim(this);
}
@@ -82,10 +82,10 @@ void sub_08076EC8(ItemBehavior* this, u32 idx) {
}
this->stateID++;
gPlayerState.field_0xa |= 8 >> idx;
gPlayerState.field_0xa |= 8 >> index;
}
void sub_08076F64(ItemBehavior* this, u32 idx) {
void sub_08076F64(ItemBehavior* this, u32 index) {
Entity* item;
Entity* player;
switch (gPlayerState.field_0x1c & 0xf) {
@@ -98,21 +98,21 @@ void sub_08076F64(ItemBehavior* this, u32 idx) {
player = &gPlayerEntity;
*(u32*)&player->field_0x74 = 0;
gPlayerState.field_0x1c = 1;
gPlayerState.field_0xa &= ~(8 >> idx);
gPlayerState.field_0xa &= ~(8 >> index);
this->stateID = 2;
sub_08077DF4(this, 0x504);
item = CreatePlayerItem(PLAYER_ITEM_10, 0, 0, 0);
SetItemAnim(this, 0x504);
item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0);
if (item) {
item->parent = player;
}
return;
} else {
gPlayerState.field_0x1c = 6;
sub_08077DF4(this, 0x510);
SetItemAnim(this, 0x510);
return;
}
} else {
if (sub_08077EFC(this)) {
if (IsItemActive(this)) {
this->subtimer = 1;
}
@@ -130,7 +130,7 @@ void sub_08076F64(ItemBehavior* this, u32 idx) {
case 3:
gPlayerState.field_0x1c = 4;
case 4:
if (sub_08077EFC(this)) {
if (IsItemActive(this)) {
this->subtimer = 1;
}
@@ -139,7 +139,7 @@ void sub_08076F64(ItemBehavior* this, u32 idx) {
gPlayerState.field_0x1c = 5;
gPlayerEntity.field_0x70.WORD = 0;
if (gPlayerState.gustJarSpeed) {
CreatePlayerItem(PLAYER_ITEM_11, 0, 0, 0);
CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
}
}
@@ -155,7 +155,7 @@ void sub_08076F64(ItemBehavior* this, u32 idx) {
return;
break;
case 7:
sub_08077DF4(this, 0x514);
SetItemAnim(this, 0x514);
gPlayerState.field_0x1c = 3;
gPlayerState.gustJarSpeed = 0;
return;
@@ -163,17 +163,17 @@ void sub_08076F64(ItemBehavior* this, u32 idx) {
case 2:
default:
gPlayerState.field_0x1c = 3;
sub_08077DF4(this, 0x514);
SetItemAnim(this, 0x514);
return;
case 0:
break;
}
gPlayerState.field_0x1c = 0;
gPlayerEntity.field_0x70.WORD = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
void (*const ItemGustJar_StateFunctions[])(ItemBehavior* beh, u32) = {
void (*const ItemGustJar_StateFunctions[])(ItemBehavior*, u32) = {
sub_08076DF4,
sub_08076E60,
sub_08076EC8,
+16 -16
View File
@@ -7,27 +7,27 @@ void sub_08077618(ItemBehavior*, u32);
void sub_08077640(ItemBehavior*, u32);
void sub_0807766C(ItemBehavior*, u32);
void ItemJarEmpty(ItemBehavior* this, u32 idx) {
void ItemJarEmpty(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08077534,
sub_08077618,
sub_08077640,
sub_0807766C,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08077534(ItemBehavior* this, u32 idx) {
void sub_08077534(ItemBehavior* this, u32 index) {
u32 tmp;
sub_08077D38(this, idx);
sub_08077D38(this, index);
sub_0806F948(&gPlayerEntity);
sub_08077BB8(this);
this->field_0x9 |= 0xf;
tmp = this->behaviorID;
this->priority |= 0xf;
tmp = this->behaviorId;
this->timer = gSave.filler86[tmp + 0x14];
switch (this->timer) {
case 0x20:
sub_08077DF4(this, 0x614);
SetItemAnim(this, 0x614);
return;
case 0x21:
case 0x22:
@@ -43,40 +43,40 @@ void sub_08077534(ItemBehavior* this, u32 idx) {
this->stateID = 3;
gPlayerEntity.animationState = 4;
gPlayerEntity.spriteSettings.flipX = 0;
sub_08077DF4(this, 0x2df);
SetItemAnim(this, 0x2df);
break;
case 0x2f:
case 0x30:
case 0x31:
default:
this->stateID = 3;
sub_08077DF4(this, 0x610);
SetItemAnim(this, 0x610);
break;
}
gPlayerEntity.flags &= ~ENT_COLLIDE;
}
void sub_08077618(ItemBehavior* this, u32 idx) {
void sub_08077618(ItemBehavior* this, u32 index) {
if ((this->playerFrame & 0x80) != 0) {
sub_08077DF4(this, 0x618);
this->stateID += 1;
SetItemAnim(this, 0x618);
this->stateID++;
} else {
UpdateItemAnim(this);
}
}
void sub_08077640(ItemBehavior* this, u32 idx) {
void sub_08077640(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
void sub_0807766C(ItemBehavior* this, u32 idx) {
void sub_0807766C(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
+32 -31
View File
@@ -5,41 +5,41 @@
#include "game.h"
extern s8 gUnk_08126EEC[];
extern Entity* sub_08077BD4(ItemBehavior*);
extern Entity* CreatePlayerItemForItemIfNotExists(ItemBehavior*);
extern void sub_0807AB44(Entity*, s32, s32);
void sub_08075A0C(ItemBehavior*, u32);
void sub_08075ADC(ItemBehavior*, u32);
void sub_08075B54(ItemBehavior*, u32);
void sub_08075C9C(ItemBehavior*, u32);
void ItemLantern(ItemBehavior* this, u32 idx) {
void ItemLantern(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08075A0C,
sub_08075ADC,
sub_08075B54,
sub_08075C9C,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08075A0C(ItemBehavior* this, u32 idx) {
void sub_08075A0C(ItemBehavior* this, u32 index) {
Entity* object;
u32 itemSlot;
EquipSlot equipSlot;
s8* tmp;
itemSlot = IsItemEquipped(this->behaviorID);
equipSlot = IsItemEquipped(this->behaviorId);
if (gPlayerState.heldObject != 0 || gPlayerState.queued_action == PLAYER_ROLL || gPlayerState.jump_status != 0 ||
gPlayerState.item != NULL || (gPlayerState.flags & PL_MINISH) != 0) {
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
ForceEquipItem(ITEM_LANTERN_OFF, equipSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
DeletePlayerItem(this, idx);
ForceEquipItem(ITEM_LANTERN_OFF, equipSlot);
DeleteItemBehavior(this, index);
} else {
this->field_0x9 |= 0x80;
sub_08077D38(this, idx);
sub_08077BD4(this);
this->priority |= 0x80;
sub_08077D38(this, index);
CreatePlayerItemForItemIfNotExists(this);
sub_0806F948(&gPlayerEntity);
this->behaviorID = 0x10;
ForceEquipItem(ITEM_LANTERN_ON, itemSlot);
this->behaviorId = 0x10;
ForceEquipItem(ITEM_LANTERN_ON, equipSlot);
tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6];
object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0);
if (object != NULL) {
@@ -50,7 +50,7 @@ void sub_08075A0C(ItemBehavior* this, u32 idx) {
}
}
void sub_08075ADC(ItemBehavior* this, u32 idx) {
void sub_08075ADC(ItemBehavior* this, u32 index) {
u32 bVar1;
if (
@@ -59,11 +59,11 @@ void sub_08075ADC(ItemBehavior* this, u32 idx) {
#endif
(this->playerFrame & 1) == 0 || (gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED)) != 0 ||
sub_08079D48() == 0) {
this->field_0xf = 0;
this->animPriority = 0;
this->stateID++;
gPlayerState.flags |= PL_USE_LANTERN;
bVar1 = 8 >> idx;
gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1);
bVar1 = 8 >> index;
gPlayerState.attack_status &= ~((bVar1 << 4) | bVar1);
bVar1 = ~bVar1;
gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa;
gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing;
@@ -73,18 +73,19 @@ void sub_08075ADC(ItemBehavior* this, u32 idx) {
}
}
void sub_08075B54(ItemBehavior* this, u32 idx) {
void sub_08075B54(ItemBehavior* this, u32 index) {
u32 bVar1;
u32 itemSlot;
EquipSlot equipSlot;
Entity* object;
s8* tmp;
if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) {
itemSlot = IsItemEquipped(this->behaviorID);
if (!(((sub_08077F10(this) == 0) && (itemSlot < 2)) || (gPlayerState.jump_status != 0))) {
ForceEquipItem(ITEM_LANTERN_OFF, itemSlot);
equipSlot = IsItemEquipped(this->behaviorId);
if (!(((IsItemActivatedThisFrame(this) == 0) && (equipSlot < EQUIP_SLOT_NONE)) ||
(gPlayerState.jump_status != 0))) {
ForceEquipItem(ITEM_LANTERN_OFF, equipSlot);
gPlayerState.flags &= ~PL_USE_LANTERN;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
SoundReq(SFX_ITEM_LANTERN_OFF);
} else {
if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.frameIndex < 0x37)) &&
@@ -94,7 +95,7 @@ void sub_08075B54(ItemBehavior* this, u32 idx) {
if ((gPlayerState.jump_status == 0) &&
(sub_080B1BA4(TILE(gPlayerEntity.x.HALF.HI + tmp[0], gPlayerEntity.y.HALF.HI + tmp[1]),
gPlayerEntity.collisionLayer, 0x40) != 0)) {
this->field_0xf = 0xf;
this->animPriority = 0xf;
this->stateID++;
gPlayerEntity.field_0x7a.HWORD = 2;
object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0);
@@ -103,8 +104,8 @@ void sub_08075B54(ItemBehavior* this, u32 idx) {
object->x.HALF.HI = tmp[0] + object->x.HALF.HI;
object->y.HALF.HI = tmp[1] + object->y.HALF.HI;
}
sub_08077DF4(this, 0x60c);
bVar1 = (8 >> (idx));
SetItemAnim(this, 0x60c);
bVar1 = (8 >> (index));
gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1;
}
@@ -113,7 +114,7 @@ void sub_08075B54(ItemBehavior* this, u32 idx) {
}
}
void sub_08075C9C(ItemBehavior* this, u32 idx) {
void sub_08075C9C(ItemBehavior* this, u32 index) {
s8* tmp;
UpdateItemAnim(this);
@@ -122,10 +123,10 @@ void sub_08075C9C(ItemBehavior* this, u32 idx) {
sub_0807AB44(&gPlayerEntity, tmp[0], tmp[1]);
}
if ((this->playerFrame & 0x80) != 0) {
this->field_0xf = 0;
this->animPriority = 0;
this->stateID--;
gPlayerState.field_0xa = (~(8 >> idx)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> idx)) & gPlayerState.keepFacing;
gPlayerState.field_0xa = (~(8 >> index)) & gPlayerState.field_0xa;
gPlayerState.keepFacing = (~(8 >> index)) & gPlayerState.keepFacing;
} else {
gPlayerEntity.field_0x7a.HWORD++;
}
+17 -17
View File
@@ -14,27 +14,27 @@ void sub_080771C8(ItemBehavior*, u32);
void sub_080772A8(ItemBehavior*, u32);
void sub_08077448(ItemBehavior*, u32);
void ItemMoleMitts(ItemBehavior* this, u32 idx) {
void ItemMoleMitts(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08077130,
sub_080771C8,
sub_080772A8,
sub_08077448,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08077130(ItemBehavior* this, u32 idx) {
void sub_08077130(ItemBehavior* this, u32 index) {
s32 iVar1;
if (gPlayerState.jump_status == 0) {
sub_08077D38(this, idx);
sub_08077D38(this, index);
gPlayerState.moleMittsState = 1;
this->field_0x9 |= 0x80;
this->priority |= 0x80;
iVar1 = sub_080774A0();
if (iVar1 != 0) {
if (this->timer == 0) {
sub_08077DF4(this, 0x50c);
SetItemAnim(this, 0x50c);
this->stateID = 2;
if (iVar1 == 0x56) {
if ((gPlayerEntity.animationState & 2) != 0) {
@@ -45,16 +45,16 @@ void sub_08077130(ItemBehavior* this, u32 idx) {
}
}
} else {
sub_08077DF4(this, 0x508);
SetItemAnim(this, 0x508);
this->stateID = 1;
}
} else {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
gPlayerState.moleMittsState = 0;
}
}
void sub_080771C8(ItemBehavior* this, u32 idx) {
void sub_080771C8(ItemBehavior* this, u32 index) {
static const u8 gUnk_0811BE14[] = {
0x1,
0x12,
@@ -63,7 +63,7 @@ void sub_080771C8(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
gPlayerState.moleMittsState = 0;
} else {
if (((this->playerFrame & 0x20) != 0) && (this->subtimer == 0xff)) {
@@ -71,7 +71,7 @@ void sub_080771C8(ItemBehavior* this, u32 idx) {
}
if ((this->playerFrame & 0x10) != 0) {
if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) {
sub_08077DF4(this, 0x520);
SetItemAnim(this, 0x520);
this->stateID = 3;
SoundReq(SFX_107);
} else {
@@ -95,7 +95,7 @@ void sub_080771C8(ItemBehavior* this, u32 idx) {
}
}
void sub_080772A8(ItemBehavior* this, u32 idx) {
void sub_080772A8(ItemBehavior* this, u32 index) {
static const s16 gUnk_0811BE16[] = {
0,
0xc0,
@@ -104,7 +104,7 @@ void sub_080772A8(ItemBehavior* this, u32 idx) {
};
Entity* effect;
if (((this->playerFrame & 8) != 0) && sub_08077F10(this)) {
if (((this->playerFrame & 8) != 0) && IsItemActivatedThisFrame(this)) {
this->timer = 1;
}
if (GetInventoryValue(ITEM_DIG_BUTTERFLY) == 1) {
@@ -131,7 +131,7 @@ void sub_080772A8(ItemBehavior* this, u32 idx) {
return;
}
}
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
gPlayerState.moleMittsState = 0;
} else {
if ((this->playerFrame & 0x60) != 0) {
@@ -140,7 +140,7 @@ void sub_080772A8(ItemBehavior* this, u32 idx) {
SoundReq(SFX_108);
CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0);
} else {
sub_08077DF4(this, 0x51c);
SetItemAnim(this, 0x51c);
effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0);
if (effect != NULL) {
effect->animationState = this->playerAnimationState;
@@ -160,7 +160,7 @@ void sub_080772A8(ItemBehavior* this, u32 idx) {
}
}
void sub_08077448(ItemBehavior* this, u32 idx) {
void sub_08077448(ItemBehavior* this, u32 index) {
gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10;
gPlayerEntity.speed = 0x100;
if (((this->playerFrame & 1) != 0) && (this->field_0x5 != 0)) {
@@ -169,7 +169,7 @@ void sub_08077448(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerState.moleMittsState = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
+11 -12
View File
@@ -7,20 +7,20 @@ extern void CreateBird(Entity*);
void OcarinaUse(ItemBehavior*, u32);
void OcarinaUpdate(ItemBehavior*, u32);
void ItemOcarina(ItemBehavior* this, u32 idx) {
void ItemOcarina(ItemBehavior* this, u32 index) {
static void (*const gOcarinaStates[])(ItemBehavior*, u32) = {
OcarinaUse,
OcarinaUpdate,
};
gOcarinaStates[this->stateID](this, idx);
gPlayerEntity.field_0x7a.HWORD += 1;
gOcarinaStates[this->stateID](this, index);
gPlayerEntity.field_0x7a.HWORD++;
}
void OcarinaUse(ItemBehavior* this, u32 idx) {
void OcarinaUse(ItemBehavior* this, u32 index) {
if (gPlayerState.queued_action == PLAYER_ROLL) {
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
} else {
this->field_0x9 |= 0xf;
this->priority |= 0xf;
gPlayerEntity.animationState = 0x04;
gPlayerEntity.spriteSettings.flipX = 0;
gPlayerEntity.flags &= ~ENT_COLLIDE;
@@ -28,17 +28,16 @@ void OcarinaUse(ItemBehavior* this, u32 idx) {
gPlayerState.flags |= PL_USE_OCARINA;
gPlayerState.field_0x27[0] = -1;
gPauseMenuOptions.disabled = 1;
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing;
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> index) | gPlayerState.keepFacing;
ResetPlayerVelocity();
sub_08077D38(this, idx);
sub_08077D38(this, index);
SoundReq(SFX_216);
SetPlayerEventPriority();
}
}
void OcarinaUpdate(ItemBehavior* this, u32 idx) {
// TODO regalloc
void OcarinaUpdate(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
@@ -47,6 +46,6 @@ void OcarinaUpdate(ItemBehavior* this, u32 idx) {
gPauseMenuOptions.disabled = 0;
CreateBird(&gPlayerEntity);
ResetPlayerEventPriority();
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
}
+13 -13
View File
@@ -7,28 +7,28 @@
void sub_08076C98(ItemBehavior*, u32);
void sub_08076CBC(ItemBehavior*, u32);
void ItemPacciCane(ItemBehavior* beh, u32 idx) {
static void (*const stateFuncs[])(ItemBehavior * beh, u32) = {
void ItemPacciCane(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08076C98,
sub_08076CBC,
};
stateFuncs[beh->stateID](beh, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08076C98(ItemBehavior* beh, u32 idx) {
beh->field_0x9 |= 0xf;
sub_08077D38(beh, idx);
void sub_08076C98(ItemBehavior* this, u32 index) {
this->priority |= 0xf;
sub_08077D38(this, index);
sub_0806F948(&gPlayerEntity);
sub_08077BB8(beh);
sub_08077BB8(this);
}
void sub_08076CBC(ItemBehavior* beh, u32 idx) {
if ((beh->playerFrame & 0x80) != 0) {
DeletePlayerItem(beh, idx);
void sub_08076CBC(ItemBehavior* this, u32 index) {
if ((this->playerFrame & 0x80) != 0) {
DeleteItemBehavior(this, index);
} else {
if ((beh->playerFrame & 0x40) != 0) {
CreatePlayerItemWithParent(beh, PLAYER_ITEM_12);
if ((this->playerFrame & 0x40) != 0) {
CreatePlayerItemWithParent(this, PLAYER_ITEM_PACCI_CANE_PROJECTILE);
}
UpdateItemAnim(beh);
UpdateItemAnim(this);
}
}
+30 -30
View File
@@ -14,7 +14,7 @@ void sub_08076A88(ItemBehavior*, u32);
extern u16 gUnk_0800275C[];
extern u8 gUnk_0811BE38[];
void ItemPegasusBoots(ItemBehavior* this, u32 idx) {
void ItemPegasusBoots(ItemBehavior* this, u32 index) {
static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = {
sub_080768F8,
sub_08076964,
@@ -26,8 +26,8 @@ void ItemPegasusBoots(ItemBehavior* this, u32 idx) {
if (gPlayerEntity.field_0x7a.HWORD != 0) {
gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0;
DeletePlayerItem(this, idx);
gPlayerState.itemAnimPriority = 0;
DeleteItemBehavior(this, index);
} else {
--this->timer;
if ((this->timer & 7) == 0) {
@@ -54,15 +54,15 @@ void ItemPegasusBoots(ItemBehavior* this, u32 idx) {
}
}
}
ItemPegasusBoots_StateFunctions[this->stateID](this, idx);
ItemPegasusBoots_StateFunctions[this->stateID](this, index);
}
}
void sub_080768F8(ItemBehavior* this, u32 idx) {
void sub_080768F8(ItemBehavior* this, u32 index) {
u32 bVar1;
u32 bVar2;
bVar1 = gPlayerState.field_0x1c | gPlayerState.field_0x3[1] | gPlayerState.heldObject | gPlayerState.jump_status;
bVar1 = gPlayerState.field_0x1c | gPlayerState.attack_status | gPlayerState.heldObject | gPlayerState.jump_status;
bVar2 = (gPlayerState.flags & PL_IN_MINECART);
bVar1 |= bVar2;
if (bVar1 == 0) {
@@ -73,19 +73,19 @@ void sub_080768F8(ItemBehavior* this, u32 idx) {
} else {
gPlayerState.animation = 0xc14;
}
sub_08077D38(this, idx);
sub_08076964(this, idx);
sub_08077D38(this, index);
sub_08076964(this, index);
} else {
gPlayerState.dash_state = 0;
gPlayerState.field_0xe = 0;
DeletePlayerItem(this, idx);
gPlayerState.itemAnimPriority = 0;
DeleteItemBehavior(this, index);
}
}
void sub_08076964(ItemBehavior* this, u32 idx) {
Entity* bombEntity;
void sub_08076964(ItemBehavior* this, u32 index) {
Entity* entity;
u32 uVar3;
if (sub_08077EFC(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) {
if (IsItemActive(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) {
UpdateItemAnim(this);
if ((gPlayerState.flags & PL_MINISH) == 0) {
@@ -95,28 +95,28 @@ void sub_08076964(ItemBehavior* this, u32 idx) {
if ((++gPlayerState.dash_state) == 0x1e) {
if ((gPlayerState.flags & PL_FLAGS2) != 0) {
gPlayerState.dash_state = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
return;
}
gPlayerState.dash_state = 0x40;
gPlayerState.field_0xa &= ~(8 >> idx);
gPlayerState.field_0xa &= ~(8 >> index);
this->stateID++;
if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 &&
(gPlayerState.skills & SKILL_DASH_ATTACK) != 0) {
gPlayerState.field_0xab = 3;
sub_08077DF4(this, 0x298);
bombEntity = CreatePlayerItemWithParent(this, PLAYER_ITEM_C);
if (bombEntity != NULL) {
gPlayerState.lastSwordMove = SWORD_MOVE_DASH;
SetItemAnim(this, 0x298);
entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD);
if (entity != NULL) {
if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) {
uVar3 = gSave.stats.itemButtons[SLOT_A];
} else {
uVar3 = gSave.stats.itemButtons[SLOT_B];
}
bombEntity->field_0x68.HALF.LO = uVar3;
entity->field_0x68.HALF.LO = uVar3;
return;
}
} else if ((gPlayerState.flags & PL_MINISH) == 0) {
sub_08077DF4(this, 0x104);
SetItemAnim(this, 0x104);
return;
} else {
gPlayerState.animation = 0xc10;
@@ -127,15 +127,15 @@ void sub_08076964(ItemBehavior* this, u32 idx) {
}
}
gPlayerState.dash_state = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
void sub_08076A88(ItemBehavior* this, u32 idx) {
void sub_08076A88(ItemBehavior* this, u32 index) {
u32 uVar1;
u32 uVar2;
u8* ptr;
if ((sub_08077EFC(this) != 0) && (gPlayerState.dash_state != 0)) {
if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerEntity.speed = 0x300;
} else {
@@ -148,27 +148,27 @@ void sub_08076A88(ItemBehavior* this, u32 idx) {
gPlayerEntity.subAction = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerState.field_0x38 = 0;
gPlayerState.field_0xd = 0xff;
gPlayerState.direction = 0xff;
return;
}
this->subtimer = 1;
return;
}
ptr = gUnk_0811BE38;
if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.field_0x90) == 0) {
if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) {
this->direction = (this->playerAnimationState & 0xe) * 4;
if ((gPlayerState.field_0xd != 0xff) && (gPlayerState.field_0xd != this->direction)) {
if (((gPlayerState.field_0xd - this->direction) & 0x1f) < 0x10) {
if ((gPlayerState.direction != 0xff) && (gPlayerState.direction != this->direction)) {
if (((gPlayerState.direction - this->direction) & 0x1f) < 0x10) {
this->direction = this->direction + 2;
}
this->direction--;
this->direction &= 0x1f;
}
gPlayerState.field_0xd = this->direction;
gPlayerState.direction = this->direction;
UpdateItemAnim(this);
return;
}
}
gPlayerState.dash_state = 0;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
+18 -20
View File
@@ -5,23 +5,23 @@
void sub_08076758(ItemBehavior*, u32);
extern void sub_08077F84(void);
void ItemRocsCape(ItemBehavior* this, u32 arg1) {
void ItemRocsCape(ItemBehavior* this, u32 index) {
if (this->stateID != 0) {
sub_08076758(this, arg1);
sub_08076758(this, index);
return;
}
if (gPlayerState.item == NULL) {
if (gPlayerState.field_0x0[1]) {
if (((gPlayerState.field_0x3[1] | gPlayerState.heldObject) == 0) &&
if (gPlayerState.grab_status) {
if (((gPlayerState.attack_status | gPlayerState.heldObject) == 0) &&
(((gPlayerState.floor_type != SURFACE_DOOR && (gPlayerState.floor_type != SURFACE_PIT)) ||
((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) {
if ((gPlayerState.jump_status == 0) || ((gPlayerState.jump_status & 7) == 3)) {
if (-1 < gPlayerEntity.z.WORD) {
gPlayerState.field_0x0[1] = 0;
this->stateID += 1;
gPlayerState.grab_status = 0;
this->stateID++;
gPlayerState.keepFacing = 0;
gPlayerState.jump_status = 1;
gPlayerState.field_0xe = -1;
gPlayerState.itemAnimPriority = -1;
gPlayerState.item = NULL;
gPlayerEntity.zVelocity = Q_16_16(2.0);
sub_08077F84();
@@ -29,25 +29,25 @@ void ItemRocsCape(ItemBehavior* this, u32 arg1) {
return;
}
} else {
sub_08076758(this, arg1);
sub_08076758(this, index);
return;
}
}
} else {
if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.attack_status |
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.moleMittsState) == 0) &&
((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 &&
gPlayerState.floor_type != SURFACE_PIT) ||
(gPlayerEntity.z.WORD != 0)) ||
(gPlayerState.field_0x14 != 0)))) {
if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3)) {
sub_08076758(this, arg1);
sub_08076758(this, index);
return;
} else if (gPlayerEntity.z.WORD >= 0) {
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status = 1;
gPlayerState.item = NULL;
this->stateID += 1;
this->stateID++;
sub_08077F84();
SoundReq(SFX_PLY_VO4);
return;
@@ -55,16 +55,14 @@ void ItemRocsCape(ItemBehavior* this, u32 arg1) {
}
}
}
DeletePlayerItem(this, arg1);
DeleteItemBehavior(this, index);
}
void sub_08076758(ItemBehavior* this, u32 arg1) {
s32 iVar1;
gPlayerState.field_0xe = 0;
void sub_08076758(ItemBehavior* this, u32 index) {
gPlayerState.itemAnimPriority = 0;
if ((((gPlayerState.jump_status & 0x28) == 0) && (gPlayerState.jump_status != 0)) &&
((gPlayerState.jump_status & 7) != 3)) {
if (sub_08077EFC(this)) {
if (IsItemActive(this)) {
if (this->stateID < 2) {
if ((gPlayerEntity.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) {
this->stateID = 2;
@@ -75,15 +73,15 @@ void sub_08076758(ItemBehavior* this, u32 arg1) {
SoundReq(SFX_172);
}
} else {
gPlayerEntity.field_0x7a.HWORD += 1;
gPlayerEntity.field_0x7a.HWORD++;
}
} else {
if (this->stateID > 1) {
gPlayerEntity.field_0x7a.HWORD += 1;
gPlayerEntity.field_0x7a.HWORD++;
gPlayerState.jump_status &= 0xef;
}
}
} else {
DeletePlayerItem(this, arg1);
DeleteItemBehavior(this, index);
}
}
+23 -23
View File
@@ -8,45 +8,45 @@ void sub_08076D04(ItemBehavior*, u32);
void sub_08076D34(ItemBehavior*, u32);
void sub_08076D94(ItemBehavior*, u32);
void ItemShield(ItemBehavior* beh, u32 idx) {
void ItemShield(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08076D04,
sub_08076D34,
sub_08076D94,
};
stateFuncs[beh->stateID](beh, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08076D04(ItemBehavior* beh, u32 idx) {
gPlayerState.field_0x3[0] = 0x81;
beh->field_0x9 = 2;
void sub_08076D04(ItemBehavior* this, u32 index) {
gPlayerState.shield_status = 0x81;
this->priority = 2;
sub_0806F948(&gPlayerEntity);
sub_08077D38(beh, idx);
sub_08077BB8(beh);
sub_08077D38(this, index);
sub_08077BB8(this);
}
void sub_08076D34(ItemBehavior* beh, u32 idx) {
if (sub_08077EFC(beh) != 0) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
if (beh->playerFrame != 0) {
beh->stateID++;
beh->field_0xf = 0;
gPlayerState.field_0xa &= ~(u8)(8 >> idx);
void sub_08076D34(ItemBehavior* this, u32 index) {
if (IsItemActive(this) != 0) {
gPlayerState.shield_status |= 1;
UpdateItemAnim(this);
if (this->playerFrame != 0) {
this->stateID++;
this->animPriority = 0;
gPlayerState.field_0xa &= ~(u8)(8 >> index);
SoundReq(SFX_15D);
}
} else {
gPlayerState.field_0x3[0] = 0;
DeletePlayerItem(beh, idx);
gPlayerState.shield_status = 0;
DeleteItemBehavior(this, index);
}
}
void sub_08076D94(ItemBehavior* beh, u32 idx) {
if (sub_08077EFC(beh)) {
gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh);
void sub_08076D94(ItemBehavior* this, u32 index) {
if (IsItemActive(this)) {
gPlayerState.shield_status |= 1;
UpdateItemAnim(this);
} else {
gPlayerState.field_0x3[0] = 0;
DeletePlayerItem(beh, idx);
gPlayerState.shield_status = 0;
DeleteItemBehavior(this, index);
}
}
+85 -82
View File
@@ -1,8 +1,9 @@
#include "item.h"
#include "functions.h"
#include "sound.h"
#include "item.h"
#include "object.h"
#include "player.h"
#include "playeritem.h"
#include "sound.h"
void sub_080759B8(ItemBehavior*, u32);
void sub_080754B8(ItemBehavior*, u32);
@@ -16,20 +17,20 @@ void sub_080758B0(ItemBehavior*, u32);
void sub_08075900(ItemBehavior*, u32);
void sub_08075694(ItemBehavior*, u32);
void ItemSword(ItemBehavior* this, u32 idx) {
void ItemSword(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08075338, sub_080754B8, sub_080755F0, sub_0807564C, sub_08075738,
sub_08075580, sub_08075898, sub_080758B0, sub_08075900,
};
gPlayerState.framestate = PL_STATE_SWORD;
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void sub_08075338(ItemBehavior* this, u32 idx) {
void sub_08075338(ItemBehavior* this, u32 index) {
u32 temp, temp2;
if (gPlayerState.flags & PL_MINISH) {
this->field_0x9 |= 0x80;
sub_08077D38(this, idx);
this->priority |= 0x80;
sub_08077D38(this, index);
gPlayerState.animation = 0xc00;
SoundReq(SFX_PLY_VO1);
return;
@@ -40,20 +41,20 @@ void sub_08075338(ItemBehavior* this, u32 idx) {
if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity < Q_16_16(1.5) &&
(gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD != 0) {
gPlayerState.jump_status |= 0x20;
gPlayerState.field_0xab = 7;
gPlayerState.field_0x3[1] |= (8 >> idx) | ((8 >> idx) << 4);
gPlayerState.lastSwordMove = SWORD_MOVE_DOWN_THRUST;
gPlayerState.attack_status |= (8 >> index) | ((8 >> index) << 4);
sub_08077B98(this);
this->stateID = 6;
sub_08075898(this, idx);
sub_08075898(this, index);
return;
}
}
#ifndef EU
sub_080759B8(this, idx);
sub_080759B8(this, index);
return;
} else if (gPlayerEntity.z.WORD) {
#endif
sub_080759B8(this, idx);
sub_080759B8(this, index);
return;
}
@@ -67,19 +68,19 @@ void sub_08075338(ItemBehavior* this, u32 idx) {
}
// Do the roll attack.
sub_08077D38(this, idx);
sub_08077D38(this, index);
sub_08077B98(this);
temp = (8 >> idx);
gPlayerState.field_0x3[1] |= temp | (temp << 4);
temp = (8 >> index);
gPlayerState.attack_status |= temp | (temp << 4);
gPlayerState.field_0xa |= temp;
gPlayerState.keepFacing |= temp;
this->stateID = 8;
this->timer = 0x14;
this->field_0xf = 6;
this->field_0x9 |= 0x80;
gPlayerState.field_0xab = 2;
this->animPriority = 6;
this->priority |= 0x80;
gPlayerState.lastSwordMove = SWORD_MOVE_ROLL;
gPlayerState.flags |= PL_SWORD_THRUST;
sub_08077DF4(this, 0x130);
SetItemAnim(this, 0x130);
SoundReq(SFX_PLY_VO3);
return;
}
@@ -96,105 +97,107 @@ void sub_08075338(ItemBehavior* this, u32 idx) {
}
}
sub_08077D38(this, idx);
sub_08077D38(this, index);
sub_08077B98(this);
}
void sub_080754B8(ItemBehavior* this, u32 idx) {
u32 iVar1;
void sub_080754B8(ItemBehavior* this, u32 index) {
u32 swordBeam;
if ((gPlayerState.sword_state & 0x80) != 0) {
sub_08075694(this, idx);
} else if (gPlayerState.field_0x3[1] != 0) {
sub_08075694(this, index);
} else if (gPlayerState.attack_status != 0) {
UpdateItemAnim(this);
if (this->playerFrame != 0) {
this->field_0x9 &= ~0x80;
this->priority &= ~0x80;
}
if (gPlayerEntity.frameSpriteSettings & 1) {
iVar1 = sub_0807B014();
if (iVar1 && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) {
swordBeam = GetSwordBeam();
if (swordBeam && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) {
CreatePlayerItemWithParent(this, PLAYER_ITEM_SWORD_BEAM1);
if (iVar1 == 0xf) {
gPlayerState.field_0xab = 5;
if (swordBeam == 0xf) {
// SKILL_SWORD_BEAM (full health)
gPlayerState.lastSwordMove = SWORD_MOVE_FULL_BEAM;
} else {
gPlayerState.field_0xab = 8;
// SKILL_PERIL_BEAM (low health)
gPlayerState.lastSwordMove = SWORD_MOVE_LOW_BEAM;
}
}
}
if ((this->playerFrame & 0x80) != 0) {
if (((gPlayerState.flags & 0x80) != 0) || ((gPlayerState.skills & SKILL_SPIN_ATTACK) == 0)) {
sub_080759B8(this, idx);
sub_080759B8(this, index);
} else {
sub_08075580(this, idx);
sub_08075580(this, index);
}
}
} else {
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
}
void sub_08075580(ItemBehavior* this, u32 idx) {
if ((sub_08077EFC(this) != 0) && (gPlayerState.jump_status == 0)) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
void sub_08075580(ItemBehavior* this, u32 index) {
if ((IsItemActive(this) != 0) && (gPlayerState.jump_status == 0)) {
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
gPlayerState.sword_state = 1;
gPlayerState.item->hurtType = 0xd;
this->field_0xf = 0;
this->animPriority = 0;
this->stateID = 2;
if ((gPlayerState.skills & SKILL_FAST_SPIN) != 0) {
this->timer = 0x28; // TODO spin speed?
} else {
this->timer = 0x50;
}
sub_08077DF4(this, 0x168);
SetItemAnim(this, 0x168);
CreateObject(SWORD_PARTICLE, 0, 0);
return;
}
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
void sub_080755F0(ItemBehavior* this, u32 idx) {
if (sub_08077EFC(this) != 0) {
void sub_080755F0(ItemBehavior* this, u32 index) {
if (IsItemActive(this) != 0) {
if (sub_08077EC8(this) == 0) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) != 0) {
if ((gPlayerState.sword_state | gPlayerState.attack_status) != 0) {
if (--this->timer == 0) {
this->stateID = 3;
this->field_0x9 |= 0x80;
this->priority |= 0x80;
gPlayerState.sword_state = gPlayerState.sword_state | 0x20;
}
} else {
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
}
} else {
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
}
void sub_0807564C(ItemBehavior* this, u32 idx) {
if ((gPlayerState.sword_state | gPlayerState.field_0x3[1]) == 0) {
sub_080759B8(this, idx);
void sub_0807564C(ItemBehavior* this, u32 index) {
if ((gPlayerState.sword_state | gPlayerState.attack_status) == 0) {
sub_080759B8(this, index);
} else {
if ((sub_08077EC8(this) == 0) && ((sub_08077EFC(this) == 0 || ((gPlayerState.sword_state & 0x80) != 0)))) {
sub_08075694(this, idx);
if ((sub_08077EC8(this) == 0) && ((IsItemActive(this) == 0 || ((gPlayerState.sword_state & 0x80) != 0)))) {
sub_08075694(this, index);
}
}
}
void sub_08075694(ItemBehavior* this, u32 idx) {
void sub_08075694(ItemBehavior* this, u32 index) {
this->timer = 1;
if (gPlayerState.flags & PL_SWORD_THRUST) {
gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.flags &= ~PL_ROLLING;
sub_08077DF4(this, 300);
SetItemAnim(this, 300);
} else {
gPlayerState.field_0xab = 1;
sub_08077DF4(this, 0x124);
gPlayerState.lastSwordMove = SWORD_MOVE_SPIN;
SetItemAnim(this, 0x124);
}
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
this->stateID = 4;
this->field_0xf = 6;
this->animPriority = 6;
gPlayerEntity.hurtType = 0x1e;
gPlayerState.sword_state |= 0x40;
gPlayerState.sword_state &= 0xdf;
@@ -205,20 +208,20 @@ void sub_08075694(ItemBehavior* this, u32 idx) {
SoundReq(SFX_PLY_VO2);
}
void sub_08075738(ItemBehavior* this, u32 idx) {
void sub_08075738(ItemBehavior* this, u32 index) {
u32 bVar6;
if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, idx);
if (gPlayerState.attack_status == 0) {
sub_080759B8(this, index);
} else {
UpdateItemAnim(this);
if (sub_08077F10(this)) {
if (IsItemActivatedThisFrame(this)) {
this->timer = 2;
}
if ((gPlayerState.sword_state & 0x10) != 0) {
if ((gPlayerState.field_0xd & 0x80) == 0) {
this->direction = gPlayerState.field_0xd;
if ((gPlayerState.direction & 0x80) == 0) {
this->direction = gPlayerState.direction;
}
gPlayerEntity.direction = this->direction;
gPlayerEntity.speed = 0x180;
@@ -229,13 +232,13 @@ void sub_08075738(ItemBehavior* this, u32 idx) {
}
if ((bVar6 <= ++this->subtimer) || (--this->timer == 0)) {
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
}
} else {
if (((((gPlayerEntity.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
((gPlayerState.skills & SKILL_FOURSWORD) != 0))) {
Entity* bombEnt = CreatePlayerItemWithParent(this, PLAYER_ITEM_14);
Entity* bombEnt = CreatePlayerItemWithParent(this, PLAYER_ITEM_SPIRAL_BEAM);
if (bombEnt) {
bombEnt->animationState = (gPlayerEntity.animationState & 6) | 0x80;
}
@@ -244,34 +247,34 @@ void sub_08075738(ItemBehavior* this, u32 idx) {
if ((((gPlayerEntity.frameSpriteSettings & 2) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) &&
(((gPlayerState.skills & SKILL_GREAT_SPIN) != 0 && (--this->timer != 0)))) {
gPlayerState.sword_state |= 0x10;
gPlayerState.field_0xab = 6;
gPlayerState.lastSwordMove = SWORD_MOVE_GREAT_SPIN;
this->direction = gPlayerEntity.animationState << 2;
this->timer = 1;
this->subtimer = 1;
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> idx);
sub_08077DF4(this, 0x128);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
SetItemAnim(this, 0x128);
}
if ((this->playerFrame & 0x80) != 0) {
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
}
}
}
void sub_08075898(ItemBehavior* this, u32 idx) {
if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, idx);
void sub_08075898(ItemBehavior* this, u32 index) {
if (gPlayerState.attack_status == 0) {
sub_080759B8(this, index);
}
}
void sub_080758B0(ItemBehavior* this, u32 idx) {
if (gPlayerState.field_0x3[1] == 0) {
sub_080759B8(this, idx);
void sub_080758B0(ItemBehavior* this, u32 index) {
if (gPlayerState.attack_status == 0) {
sub_080759B8(this, index);
} else {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
this->field_0xf = 0;
this->animPriority = 0;
if ((gPlayerState.sword_state & 0x20) != 0) {
this->stateID = 3;
} else {
@@ -282,20 +285,20 @@ void sub_080758B0(ItemBehavior* this, u32 idx) {
}
}
void sub_08075900(ItemBehavior* this, u32 idx) {
void sub_08075900(ItemBehavior* this, u32 index) {
if (gPlayerState.floor_type == SURFACE_SWAMP) {
gPlayerState.flags &= ~PL_ROLLING;
sub_080759B8(this, idx);
sub_080759B8(this, index);
} else {
UpdateItemAnim(this);
if ((gPlayerState.sword_state & 0x80) != 0) {
gPlayerState.sword_state = 0xa0;
sub_0807564C(this, idx);
sub_0807564C(this, index);
} else {
if (this->timer != 0) {
if (--this->timer == 0) {
sub_08077DF4(this, 0x134);
SetItemAnim(this, 0x134);
}
gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3;
gPlayerEntity.speed = 0x300;
@@ -306,19 +309,19 @@ void sub_08075900(ItemBehavior* this, u32 idx) {
} else {
if ((this->playerFrame & 0x80) != 0) {
gPlayerState.flags &= ~PL_ROLLING;
sub_080759B8(this, idx);
sub_080759B8(this, index);
}
}
}
}
}
void sub_080759B8(ItemBehavior* this, u32 idx) {
void sub_080759B8(ItemBehavior* this, u32 index) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerEntity.hurtType = 0;
}
gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.sword_state = 0;
gPlayerState.item = NULL;
DeletePlayerItem(this, idx);
DeleteItemBehavior(this, index);
}
+89 -34
View File
@@ -1,11 +1,12 @@
#include "item.h"
#include "functions.h"
#include "sound.h"
#include "playeritem.h"
u32 sub_08077F64(ItemBehavior* arg0, u32 idx);
u32 sub_08077F64(ItemBehavior* arg0, u32 index);
u32 sub_080789A8(void);
void sub_080762C4(ItemBehavior*, Entity*, u8, u32);
void sub_08076088(ItemBehavior*, void*, u32);
void sub_08076088(ItemBehavior*, Entity*, u32);
void ItemPickupCheck(ItemBehavior*, u32);
void sub_080762D8(ItemBehavior*, u32);
void sub_08076488(ItemBehavior*, u32);
@@ -13,24 +14,79 @@ void sub_08076518(ItemBehavior*, u32);
void sub_080765E0(ItemBehavior*, u32);
void sub_0807660C(ItemBehavior*, u32);
void ItemTryPickupObject(ItemBehavior* this, u32 idx) {
void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
if (param_2 != NULL) {
if ((param_2->carryFlags & 1) != 0) {
return;
}
param_2->action = 2;
param_2->subAction = param_2->carryFlags & 1;
}
this->field_0x18 = param_2;
if ((gPlayerState.flags & PL_NO_CAP)) {
SetItemAnim(this, 0x928);
} else {
SetItemAnim(this, 0x338);
}
gPlayerState.heldObject = 3;
gPlayerState.framestate = 4;
this->stateID = 2;
this->animPriority = 0xf;
if ((gPlayerEntity.field_0x78.HALF.HI & 0x80)) {
gPlayerEntity.field_0x78.HALF.HI = 0;
COLLISION_ON(&gPlayerEntity);
gPlayerState.heldObject = 4;
gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing;
gPlayerState.field_0xa = ~(8 >> param_3) & gPlayerState.field_0xa;
this->stateID = 3;
this->animPriority = 0;
} else {
gPlayerState.field_0xa |= (8 >> param_3);
gPlayerState.keepFacing |= (8 >> param_3);
}
param_2 = CreatePlayerItemWithParent(this, PLAYER_ITEM_HELD_OBJECT);
if (param_2 == NULL) {
PlayerCancelHoldItem(this, param_3);
} else {
Entity* playerEnt = &gPlayerEntity;
*(Entity**)&playerEnt->field_0x74 = param_2;
playerEnt->subtimer = 0;
param_2->child = this->field_0x18;
param_2->carryFlags = playerEnt->carryFlags;
param_2->parent = (Entity*)this;
this->field_0x18 = param_2;
param_2->type2 = this->field_0x2[1];
param_2->timer = this->timer;
param_2->subtimer = this->subtimer;
if ((this->field_0x18->carryFlags & 0xf0) == 0x10) {
this->timer = 8;
} else {
this->timer = 0;
}
SoundReq(SFX_PLY_LIFT);
}
}
void ItemTryPickupObject(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
ItemPickupCheck, sub_080762D8, sub_08076488, sub_08076518, sub_080765E0, sub_0807660C,
};
stateFuncs[this->stateID](this, idx);
stateFuncs[this->stateID](this, index);
}
void ItemPickupCheck(ItemBehavior* this, u32 idx) {
void ItemPickupCheck(ItemBehavior* this, u32 index) {
Entity* carried;
if (!(((gPlayerState.field_0x3[1] != 0) ||
(((gPlayerState.jump_status != 0 && ((gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) == 0)) ||
(gPlayerState.field_0x0[1] = gPlayerEntity.animationState | 0x80, 8 < gPlayerEntity.iframes)))))) {
if (gPlayerState.attack_status == 0 &&
(gPlayerState.jump_status == 0 || (gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) != 0) &&
(gPlayerState.grab_status = gPlayerEntity.animationState | 0x80, gPlayerEntity.iframes <= 8)) {
switch (sub_080789A8()) {
case 2:
if (((gCarriedEntity.unk_8)->carryFlags & 0xf) == 0) {
sub_08076088(this, gCarriedEntity.unk_8, idx);
sub_08076088(this, gCarriedEntity.unk_8, index);
return;
}
carried = gCarriedEntity.unk_8;
@@ -38,24 +94,24 @@ void ItemPickupCheck(ItemBehavior* this, u32 idx) {
carried->action = 2;
carried->subAction = 5;
gPlayerState.framestate = PL_STATE_THROW;
sub_080762C4(this, carried, 2, idx);
sub_080762C4(this, carried, 2, index);
gUnk_0200AF00.unk_2e = 8;
SoundReq(SFX_102);
break;
case 1:
sub_080762C4(this, 0, 1, idx);
sub_080762C4(this, 0, 1, index);
SoundReq(SFX_102);
break;
case 0:
this->stateID = 5;
this->timer = 0x0f;
this->field_0xf = 6;
gPlayerState.field_0xa = (8 >> idx) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> idx) | gPlayerState.keepFacing;
this->animPriority = 6;
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> index) | gPlayerState.keepFacing;
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
sub_08077DF4(this, 0x378);
SetItemAnim(this, 0x378);
} else {
sub_08077DF4(this, 0x948);
SetItemAnim(this, 0x948);
}
SoundReq(SFX_88);
break;
@@ -63,7 +119,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 idx) {
break;
}
} else {
PlayerCancelHoldItem(this, idx);
PlayerCancelHoldItem(this, index);
}
}
@@ -73,14 +129,14 @@ void sub_080762C4(ItemBehavior* this, Entity* arg1, u8 arg2, u32 arg3) {
sub_08077D38(this, arg3);
}
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 idx))
ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_080762D8.inc", void sub_080762D8(ItemBehavior* this, u32 index))
void sub_08076488(ItemBehavior* this, u32 idx) {
void sub_08076488(ItemBehavior* this, u32 index) {
u32 bVar1;
s32 iVar2;
if (this->timer == 0) {
if (PlayerTryDropObject(this, idx) != 0) {
if (PlayerTryDropObject(this, index) != 0) {
if ((((this->field_0x18->carryFlags) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) {
return;
}
@@ -88,11 +144,11 @@ void sub_08076488(ItemBehavior* this, u32 idx) {
if ((this->playerFrame & 0x80) != 0) {
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerState.heldObject = 4;
bVar1 = ~(8 >> idx);
bVar1 = ~(8 >> index);
gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing;
gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa;
this->stateID++;
this->field_0xf = 0;
this->animPriority = 0;
}
}
} else {
@@ -108,19 +164,18 @@ void sub_08076518(ItemBehavior* this, u32 index) {
if (gPlayerEntity.knockbackDuration != 0) {
PlayerCancelHoldItem(this, index);
} else {
if ((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_8000 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) !=
0) {
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_8000 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0) {
sub_0806F948(&gPlayerEntity);
gPlayerState.heldObject = 5;
this->field_0x18->subAction = 2;
this->field_0x18->direction = (gPlayerEntity.animationState & 0xe) << 2;
this->field_0x18 = NULL;
this->stateID++;
this->field_0xf = 0x0f;
this->animPriority = 0x0f;
if ((gPlayerState.flags & PL_NO_CAP) != 0) {
sub_08077DF4(this, 0x930);
SetItemAnim(this, 0x930);
} else {
sub_08077DF4(this, 0x344);
SetItemAnim(this, 0x344);
}
gPlayerState.field_0xa |= 8 >> index;
gPlayerState.keepFacing |= 8 >> index;
@@ -130,20 +185,20 @@ void sub_08076518(ItemBehavior* this, u32 index) {
}
}
void sub_080765E0(ItemBehavior* this, u32 idx) {
if (PlayerTryDropObject(this, idx) != 0) {
void sub_080765E0(ItemBehavior* this, u32 index) {
if (PlayerTryDropObject(this, index) != 0) {
if ((this->playerFrame & 0x80) != 0) {
PlayerCancelHoldItem(this, idx);
PlayerCancelHoldItem(this, index);
} else {
UpdateItemAnim(this);
}
}
}
void sub_0807660C(ItemBehavior* this, u32 idx) {
void sub_0807660C(ItemBehavior* this, u32 index) {
UpdateItemAnim(this);
if ((this->timer-- == 0) || (gPlayerState.field_0x0[1] == 0)) {
gPlayerState.field_0x0[1] = 0;
DeletePlayerItem(this, idx);
if ((this->timer-- == 0) || (gPlayerState.grab_status == 0)) {
gPlayerState.grab_status = 0;
DeleteItemBehavior(this, index);
}
}
+43
View File
@@ -0,0 +1,43 @@
#include "item.h"
#include "playeritem.h"
#include "structures.h"
const ItemDefinition gItemDefinitions[] = {
[ITEM_NONE] = { TRUE, 1, CREATE_ITEM_0, PLAYER_ITEM_NONE, 0, 0, FALSE, FALSE },
[ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE },
[ITEM_REMOTE_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE },
[ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE },
[ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE },
[ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 2072, 3, FALSE, FALSE },
[ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 1796, 3, FALSE, FALSE },
[ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE },
[ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE },
#ifdef EU
[ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE },
[ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE },
#else
[ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE },
[ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE },
#endif
[ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, 1280, 2, FALSE, FALSE },
[ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, 1576, 6, TRUE, FALSE },
[ITEM_MOLE_MITTS] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NONE2, 0, 2, TRUE, FALSE },
[ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, 2060, 0, FALSE, FALSE },
[ITEM_PEGASUS_BOOTS] = { TRUE, CREATE_ITEM_1, PLAYER_ITEM_SWORD, 12, 260, 6, FALSE, FALSE },
[ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, 260, 6, FALSE, FALSE },
[ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, 2273, 6, FALSE, FALSE },
[ITEM_ORB_GREEN] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED2, 0, 1, TRUE, TRUE },
[ITEM_ORB_BLUE] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED, 0, 1, TRUE, TRUE },
[ITEM_ORB_RED] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET2, 0, 1, TRUE, TRUE },
[ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, 832, 4, FALSE, TRUE },
[ITEM_BOTTLE1] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },
[ITEM_BOTTLE2] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },
[ITEM_BOTTLE3] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },
[ITEM_BOTTLE4] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },
};
+1 -1
View File
@@ -31,7 +31,7 @@ const ItemMetaData gItemMetaData[] = {
[ITEM_ORB_GREEN] = { 0x63u, 0u, 0u, 0u, 0u, 0u, 0u, 0u },
[ITEM_ORB_BLUE] = { 0x63u, 0u, 0u, 0u, 0u, 0u, 0u, 0u },
[ITEM_ORB_RED] = { 0x63u, 0u, 0u, 0u, 0u, 0u, 0u, 0u },
[ITEM_TRAP] = { 0x63u, 0u, 0u, 0u, 0u, 0u, 0u, 0u },
[ITEM_TRY_PICKUP_OBJECT] = { 0x63u, 0u, 0u, 0u, 0u, 0u, 0u, 0u },
[ITEM_BOTTLE1] = { MENU_SLOT_BOTTLE0, 0x3u, 0u, 0x1u, 0x20u, TEXT_ITEM_GET, 0x20u, 0x5u },
[ITEM_BOTTLE2] = { MENU_SLOT_BOTTLE1, 0x3u, 0u, 0x1u, 0x20u, TEXT_ITEM_GET, 0x20u, 0x5u },
[ITEM_BOTTLE3] = { MENU_SLOT_BOTTLE2, 0x3u, 0u, 0x1u, 0x20u, TEXT_ITEM_GET, 0x20u, 0x5u },
+1 -1
View File
@@ -83,7 +83,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) {
}
bool32 PortalReadyForMinish(void) {
if ((gPlayerState.flags & PL_MINISH) && !gPlayerState.field_0xaa && (gArea.portal_type != 0x6) &&
if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != 0x6) &&
(gPlayerState.heldObject == 0)) {
switch (gPlayerState.framestate) {
case PL_STATE_IDLE:
+1 -1
View File
@@ -365,7 +365,7 @@ void MiscManager_TypeB(MiscManager* this) {
bool32 sub_080593CC(MiscManager* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
(gPlayerState.playerInput.field_0x90 & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) {
(gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) {
return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
}
return FALSE;
+3 -3
View File
@@ -75,7 +75,7 @@ void PauseMenu_Variant0(void) {
(u16)gRoomTransition.player_status.overworld_map_y);
gPauseMenuOptions.unk2[4] = ptr->_4;
gPauseMenuOptions.unk2[5] = sub_0801DB94();
if (IsItemEquipped(ITEM_LANTERN_ON) != 2) {
if (IsItemEquipped(ITEM_LANTERN_ON) != EQUIP_SLOT_NONE) {
r1 = 0x10;
} else {
r1 = 0xf;
@@ -399,8 +399,8 @@ void PauseMenu_ItemMenu_Update(void) {
}
case B_BUTTON:
if (gPauseMenu.items[menuSlot] != 0) {
u32 t = !!(gInput.newKeys ^ 1);
ForceEquipItem(gPauseMenu.items[menuSlot], t);
u32 slot = !!(gInput.newKeys ^ 1);
ForceEquipItem(gPauseMenu.items[menuSlot], slot);
SoundReq(SFX_TEXTBOX_SELECT);
}
break;
+2 -1
View File
@@ -20,7 +20,8 @@ void NPCUpdate(Entity* this) {
if (gNPCFunctions[this->id][1] != NULL)
gNPCFunctions[this->id][1](this);
if (this->health % 0x80) {
if (this->health % 0x80) { // If this NPC was created by DelayedEntityLoadManager_Main, we need to update the
// location in gNPCData.
NPCStruct* npc = gNPCData;
npc += (this->health - 1);
npc->x = this->x.HALF.HI - gRoomControls.origin_x;
+4 -4
View File
@@ -418,12 +418,12 @@ void sub_0806D520(Entity* this, u32 param_2) {
}
void sub_0806D5D4(void) {
u32 itemSlot;
EquipSlot equipSlot;
InitBiggoronTimer();
itemSlot = IsItemEquipped(ITEM_SHIELD);
if (itemSlot != 2) {
gSave.stats.itemButtons[itemSlot] = ITEM_NONE;
equipSlot = IsItemEquipped(ITEM_SHIELD);
if (equipSlot != EQUIP_SLOT_NONE) {
gSave.stats.itemButtons[equipSlot] = ITEM_NONE;
}
SetInventoryValue(ITEM_SHIELD, 0);
}
+9 -8
View File
@@ -144,7 +144,7 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext
if (BladeBrothers_EquippedItem) {}
if (p = this->timer, BladeBrothers_EquippedItem[p]) {
ForceEquipItem(BladeBrothers_EquippedItem[this->timer], 0);
ForceEquipItem(BladeBrothers_EquippedItem[this->timer], EQUIP_SLOT_A);
}
InitPlayerMacro(BladeBrothers_PlayerMacros[this->timer]);
}
@@ -157,9 +157,10 @@ void sub_08068BB4(Entity* this) {
*(&this->field_0x68.HALF.HI + 1) = item;
}
// Restore previous equipped items.
void sub_08068BD0(Entity* this) {
ForceEquipItem(this->field_0x68.HALF.HI, 0);
ForceEquipItem(*(u8*)(&this->field_0x68.HALF.HI + 1), 1);
ForceEquipItem(this->field_0x68.HALF.HI, EQUIP_SLOT_A);
ForceEquipItem(*(u8*)(&this->field_0x68.HALF.HI + 1), EQUIP_SLOT_B);
}
static void sub_08068BEC(Entity* this, u32 unused) {
@@ -337,18 +338,18 @@ void sub_08068E78(Entity* this) {
MessageNoOverlap(gUnk_08111714[this->timer], this);
}
void sub_08068E90(Entity* this) {
void BladeBrothers_LearnSkill(Entity* this) {
// Learn a skill.
PlayerState* s = &gPlayerState;
*(u16*)&s->skills = (1 << (gUnk_08111740[this->timer] - 1)) | *(u16*)&s->skills;
}
void sub_08068EB4(void) {
gPlayerState.field_0xab = 0;
void BladeBrothers_ResetLastSwordMove(void) {
gPlayerState.lastSwordMove = SWORD_MOVE_NONE;
}
void sub_08068EC4(Entity* this, ScriptExecutionContext* context) {
if (gUnk_08111740[this->timer] == gPlayerState.field_0xab) {
void BladeBrothers_CheckLastSwordMove(Entity* this, ScriptExecutionContext* context) {
if (gUnk_08111740[this->timer] == gPlayerState.lastSwordMove) {
context->wait = gUnk_0811172A[this->timer];
context->condition = 1;
} else {
+2 -2
View File
@@ -69,7 +69,7 @@ void sub_08064570(CastleMaidEntity* this) {
if (LoadExtraSpriteData(super, data) == 0) {
return;
}
super->action += 1;
super->action++;
super->timer = 0;
tmp2 = sub_0805ACC0(super);
if (tmp2 == 0) {
@@ -84,7 +84,7 @@ void sub_08064570(CastleMaidEntity* this) {
case 1:
sub_0807DD94(super, NULL);
if (super->interactType != 0) {
super->action += 1;
super->action++;
super->interactType = 0;
InitializeAnimation(super, sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity)));
if (this->dialogFunc != NULL) {
+2 -2
View File
@@ -7,7 +7,7 @@ void sub_0806BFD8(Entity* this);
void DrLeft(Entity* this) {
if (this->type == 0) {
if (this->action == 0) {
this->action += 1;
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
sub_0807DD50(this);
}
@@ -17,7 +17,7 @@ void DrLeft(Entity* this) {
sub_0806BFD8(this);
} else {
if (this->action == 0) {
this->action += 1;
this->action++;
this->frameIndex = 0;
SortEntityBelow(this, this);
}
+1 -1
View File
@@ -104,7 +104,7 @@ void sub_08065AA4(Entity* this) {
void Epona_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->action++;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 7);
} else {
+1 -1
View File
@@ -121,7 +121,7 @@ void sub_08060158(Entity* this) {
if (tmp2 & 0x80) {
this->animationState = sub_0806F5B0(index);
}
tmp2 &= 0x7f;
tmp2 &= ~0x80;
this->frame = tmp1;
this->frameIndex = tmp2;
this->frameSpriteSettings = 1;
+7 -7
View File
@@ -253,25 +253,25 @@ void sub_08064428(GuardWithSpearEntity* this) {
ShowNPCDialogue(super, pDialog);
}
void sub_08064470(Entity* this, ScriptExecutionContext* context) {
if (gPlayerState.field_0xab == 1) {
void GuardWithSpear_CheckSwordMoveSpin(Entity* this, ScriptExecutionContext* context) {
if (gPlayerState.lastSwordMove == SWORD_MOVE_SPIN) {
context->condition = 1;
} else {
context->condition = 0;
}
}
void sub_08064488(void) {
void GuardWithSpear_ResetLastSwordMoveIfNotInSwordState(void) {
if (gPlayerState.framestate != PL_STATE_SWORD) {
gPlayerState.field_0xab = 0;
gPlayerState.lastSwordMove = SWORD_MOVE_NONE;
}
}
void sub_080644A4(void) {
gPlayerState.field_0xab = 0;
void GuardWithSpear_ResetLastSwordMove(void) {
gPlayerState.lastSwordMove = SWORD_MOVE_NONE;
}
void sub_080644B4(Entity* this, ScriptExecutionContext* context) {
void CheckLastSwordMove(Entity* this, ScriptExecutionContext* context) {
context->condition = this->animationState == context->intVariable;
}
+1 -1
View File
@@ -100,7 +100,7 @@ void sub_0806C4F8(Entity* this) {
void Mama_Fusion(Entity* this) {
if (this->action == 0) {
if (sub_0806C454(this) != 0) {
this->action += 1;
this->action++;
this->spriteSettings.draw = 1;
this->y.HALF.HI -= 4;
InitializeAnimation(this, 2);
+2 -2
View File
@@ -180,8 +180,8 @@ void NPC4E_SaveEquippedItems(Entity* this) {
}
void NPC4E_RestoreEquippedItems(Entity* this) {
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.LO), 0);
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.HI), 1);
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.LO), EQUIP_SLOT_A);
ForceEquipItem(sub_0806DBF4(this->field_0x68.HALF.HI), EQUIP_SLOT_B);
}
void sub_0806DC7C(void) {
+1 -1
View File
@@ -17,7 +17,7 @@ void NPC58(Entity* this) {
if (LoadExtraSpriteData(this, gUnk_081146D0) == 0) {
return;
}
this->action += 1;
this->action++;
this->spriteSettings.draw = 2;
this->spriteRendering.b3 = 0;
this->spritePriority.b0 = 0;
+2 -2
View File
@@ -29,7 +29,7 @@ void sub_08063A80(Entity* this) {
}
void sub_08063A98(Entity* this) {
this->action += 1;
this->action++;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 4);
sub_08078778(this);
@@ -157,7 +157,7 @@ void sub_08063CAC(Entity* this) {
void Pina_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->action++;
this->spriteSettings.draw = 1;
this->y.HALF.HI -= 4;
InitAnimationForceUpdate(this, 2);
+1 -1
View File
@@ -320,7 +320,7 @@ void sub_0806AEE4(Entity* this) {
if (tmp2 & 0x80) {
this->animationState = sub_0806F5B0(index);
}
tmp2 &= 0x7f;
tmp2 &= ~0x80;
this->frame = tmp1;
this->frameIndex = tmp2;
this->frameSpriteSettings = 1;
+1 -1
View File
@@ -195,7 +195,7 @@ void (*const gObjectFunctions[])(Entity*) = {
[PINWHEEL] = Pinwheel,
[OBJECT_BF] = ObjectBF,
[ENEMY_ITEM] = EnemyItem,
[OBJECT_C1] = LinkAnimation,
[LINK_ANIMATION] = LinkAnimation,
};
void ObjectInit(Entity*);
+1 -1
View File
@@ -71,7 +71,7 @@ void sub_0808BBE0(BarrelSpiderwebEntity* this) {
ptr = &gUnk_0812144C[diff * 2];
SetAffineInfo(super, ptr[0], ptr[1], 0);
} else {
super->contactFlags &= 0x7f;
super->contactFlags &= ~0x80;
}
}
+1 -1
View File
@@ -97,7 +97,7 @@ void BigIceBlock_Action2(BigIceBlockEntity* this) {
}
super->action = 3;
super->timer = 60;
super->flags &= 0x7f;
super->flags &= ~0x80;
}
void sub_08099880(BigIceBlockEntity* this) {
+1 -1
View File
@@ -238,7 +238,7 @@ void Bird_Type8(Entity* this) {
PutAwayItems();
gPlayerState.swim_state = 0;
gPlayerState.jump_status = 0;
gPlayerEntity.flags &= 0x7f;
gPlayerEntity.flags &= ~0x80;
gPlayerEntity.spriteSettings.draw = 0;
gPriorityHandler.sys_priority = 6;
gPauseMenuOptions.disabled = 1;
+1 -1
View File
@@ -213,7 +213,7 @@ void Book_Action5(Entity* this) {
u32 sub_0809B688(Entity* this) {
u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
if (ret == 1 && gPlayerState.field_0xd != 16) {
if (ret == 1 && gPlayerState.direction != 16) {
ret = 0;
}
+4 -4
View File
@@ -140,7 +140,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
if (super->parent->action == 2) {
switch (super->parent->subAction) {
case 1:
if ((gPlayerState.field_0xd & 0x80) != 0) {
if ((gPlayerState.direction & 0x80) != 0) {
InitializeAnimation(super, 4);
} else {
GetNextFrame(super);
@@ -163,7 +163,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
} else {
gPlayerState.mobility |= 0x80;
gPlayerState.heldObject = 5;
if ((gPlayerState.field_0xd & 0x80) != 0) {
if ((gPlayerState.direction & 0x80) != 0) {
InitializeAnimation(super, (super->type >> 1) + 3);
} else {
GetNextFrame(super);
@@ -181,7 +181,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
RestorePrevTileEntity(0xdc, super->collisionLayer);
sub_08096A78(this);
}
if ((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) {
return;
}
if (gUnk_0200AF00.unk_2f != 3) {
@@ -297,7 +297,7 @@ void CrenelBeanSprout_Action6SubAction1(CrenelBeanSproutEntity* this) {
sub_0807B7D8(gUnk_081231AE[super->type2], COORD_TO_TILE(super), super->collisionLayer);
super->type2++;
if (super->type2 == super->subtimer) {
gPlayerState.keepFacing &= 0x7f;
gPlayerState.keepFacing &= ~0x80;
super->subAction++;
super->timer = 60;
} else {
+2 -2
View File
@@ -9,8 +9,8 @@
#include "main.h"
#include "menu.h"
#include "object.h"
#include "player.h"
extern int sub_0807A094(int);
extern u32 sub_080041EC(int, int);
static bool32 sub_0808E950(void);
@@ -104,7 +104,7 @@ void sub_0808E818(Entity* this) {
this->field_0x68.HWORD = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100;
this->field_0x70.BYTES.byte0 = 4;
this->animationState = 2;
var1 = gUnk_08133368[sub_0807A094(1) - 22] & 0xFFFFFF;
var1 = gUnk_08133368[GetPlayerPalette(TRUE) - 22] & 0xFFFFFF;
LoadPalettes(&gGlobalGfxAndPalettes[var1], 31, 1);
}
+1 -1
View File
@@ -319,7 +319,7 @@ void FrozenOctorok_Action1SubAction6(FrozenOctorokEntity* this) {
super->subAction = 7;
}
if ((gRoomTransition.frameCount & 0xf) == 0) {
SoundReq(SFX_163);
SoundReq(SFX_TOGGLE_DIVING);
}
}
+1 -1
View File
@@ -179,7 +179,7 @@ void sub_0808692C(Entity* this) {
static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) {
if (GetAnimationStateInRectRadius(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
(u16)gPlayerState.playerInput.field_0x90 == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) {
(u16)gPlayerState.playerInput.heldInput == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) {
this->timer--;
}
} else {
+1 -1
View File
@@ -92,7 +92,7 @@ void HouseDoorInterior_Action1(HouseDoorInteriorEntity* this) {
if (sub_0800445C(super) && this->unk7d == 0) {
ptr = gUnk_081227CC + super->type2;
if (GetAnimationStateInRectRadius(super, ptr->x, ptr->y) >= 0 &&
ptr->animationState == gPlayerEntity.animationState && gPlayerState.playerInput.field_0x90 & ptr->unk2) {
ptr->animationState == gPlayerEntity.animationState && gPlayerState.playerInput.heldInput & ptr->unk2) {
--super->timer;
}
} else {
+3 -3
View File
@@ -99,7 +99,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) {
super->interactType = 0;
super->subAction = 1;
sub_08078B48();
ResetPlayerItem();
ResetActiveItems();
gPlayerState.heldObject = 4;
gNewPlayerEntity.unk_74 = super;
gUnk_0200AF00.unk_2f = 2;
@@ -119,9 +119,9 @@ void ItemForSale_Action2(ItemForSaleEntity* this) {
} else {
ptr = sub_080784E4();
if (((*(int*)(ptr + 8) == 0) ||
((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.playerInput.field_0x92 &
((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.playerInput.newInput &
(PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) &&
((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) {
((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) {
sub_080819B4(this);
}
}
+1 -1
View File
@@ -28,7 +28,7 @@ void LampParticle_Init(Entity* this) {
}
void LampParticle_Action1(Entity* this) {
if (1 < IsItemEquipped(ITEM_LANTERN_ON)) {
if (IsItemEquipped(ITEM_LANTERN_ON) >= EQUIP_SLOT_NONE) {
DeleteThisEntity();
}
GetNextFrame(this);
+1 -1
View File
@@ -570,7 +570,7 @@ void sub_08085E74(LilypadLargeEntity* this) {
if (gPlayerState.item != NULL) {
DeleteEntity(gPlayerState.item);
}
ResetPlayerItem();
ResetActiveItems();
}
void sub_08085EFC(LilypadLargeEntity* this) {
+2 -3
View File
@@ -10,6 +10,7 @@
#include "functions.h"
#include "object.h"
#include "physics.h"
#include "player.h"
typedef struct {
Entity base;
@@ -17,8 +18,6 @@ typedef struct {
u16 unk6a;
} MacroPlayerEntity;
extern int sub_0807A094(int);
void MacroPlayer_Type0(MacroPlayerEntity*);
void MacroPlayer_Type1(MacroPlayerEntity*);
void MacroPlayer_Type0_Init(MacroPlayerEntity*);
@@ -118,7 +117,7 @@ void MacroPlayer_Type0_Init(MacroPlayerEntity* this) {
super->spriteRendering.b0 = 3;
SetAffineInfo(super, 4, 4, 0);
gUnk_02018EB0.unk_14 = super;
ChangeObjPalette(super, sub_0807A094(0));
ChangeObjPalette(super, GetPlayerPalette(FALSE));
pEVar1 = CreateObject(PORTAL_FALLING_PLAYER, 1, 0);
if (pEVar1 != NULL) {
pEVar1->parent = super;
+4 -4
View File
@@ -12,7 +12,7 @@
typedef struct {
Entity base;
u8 filler[0x1C];
struct_030010EC* minecartData;
MinecartData* minecartData;
} MinecartEntity;
extern void sub_08017744(Entity*);
@@ -39,7 +39,7 @@ void Minecart(Entity* this) {
}
void Minecart_Init(MinecartEntity* this) {
struct_030010EC* unk = &gRoomTransition.minecart_data[super->timer];
MinecartData* unk = &gRoomTransition.minecart_data[super->timer];
this->minecartData = unk;
if ((gRoomControls.room != unk->room) || (gPlayerState.flags & PL_IN_MINECART) != 0) {
@@ -88,7 +88,7 @@ void Minecart_Action1(MinecartEntity* this) {
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.speed = 0x100;
gPlayerEntity.flags &= ~PL_MINISH;
ResetPlayerItem();
ResetActiveItems();
DeleteClones();
SoundReq(SFX_PLY_JUMP);
}
@@ -279,7 +279,7 @@ void Minecart_Action5(MinecartEntity* this) {
}
void Minecart_Action6(MinecartEntity* this) {
struct_030010EC* minecartData;
MinecartData* minecartData;
if (gPlayerState.jump_status == 0) {
super->action = 1;
+1 -1
View File
@@ -46,7 +46,7 @@ void MinishSizedEntrance_Action1(Entity* this) {
}
}
if ((gPlayerState.flags & PL_MINISH) && EntityInRectRadius(this, &gPlayerEntity, 4, 4) &&
(gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.playerInput.field_0x90) & gUnk_0812225C[this->type2])) {
(gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.playerInput.heldInput) & gUnk_0812225C[this->type2])) {
DoExitTransition(GetCurrentRoomProperty(this->timer));
}
}
+2 -2
View File
@@ -166,7 +166,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
this->child->parent = this->parent;
GET_HELPER(this->child) = GET_HELPER(this);
}
this->type2 += 1;
this->type2++;
}
CopyPosition(GET_HELPER(this)->tailObjects[0], this);
return;
@@ -193,7 +193,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
this->parent->subAction = 0;
return;
}
this->timer += 1;
this->timer++;
return;
case 2:
if (this->parent->type2 == 3) {
+1 -1
View File
@@ -169,7 +169,7 @@ void sub_08084B1C(PlayerCloneEntity* this) {
super->collisionFlags = gPlayerEntity.collisionFlags;
super->hurtType = gPlayerEntity.hurtType;
CopyPosition(super, super->child);
if (gPlayerState.field_0x3[1] != 0) {
if (gPlayerState.attack_status != 0) {
super->child->damage = gPlayerState.item->damage;
super->child->frameIndex = gPlayerState.item->frameIndex;
super->child->spriteSettings.flipX = gPlayerState.item->spriteSettings.flipX;
+1 -1
View File
@@ -121,7 +121,7 @@ void Pot_Action1(Entity* this) {
if (GetTileUnderEntity(this) == 13) {
CreateFx(this, FX_FALL_DOWN, 0);
} else if (tileType == 0x4005) {
gPlayerState.field_0xab = 4;
gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT;
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
}
sub_08082850(this, NULL);
+3 -3
View File
@@ -222,7 +222,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) {
u32 uVar1;
if (super->timer != 0) {
uVar1 = sub_0808B1F0(this, super->child);
if ((gPlayerState.playerInput.field_0x90 & gUnk_081211E4[super->animationState]) != 0) {
if ((gPlayerState.playerInput.heldInput & gUnk_081211E4[super->animationState]) != 0) {
GetNextFrame(super);
if (uVar1 < 0x40) {
sub_080044AE(&gPlayerEntity, 0x40, super->direction);
@@ -247,7 +247,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) {
this->unk_7c = 1;
super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1);
super->direction = (super->animationState << 3);
super->flags &= 0x7f;
super->flags &= ~0x80;
super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
InitializeAnimation(super, super->animationState + 5);
if (sub_0808B21C(this, 0)) {
@@ -291,7 +291,7 @@ void sub_0808B05C(PullableMushroomEntity* this) {
super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1);
super->direction = super->animationState << 3;
super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX;
super->flags &= 0x7f;
super->flags &= ~0x80;
InitializeAnimation(super, super->animationState + 5);
if (sub_0808B21C(this, 1)) {
sub_0808B168((PullableMushroomEntity*)super->child, 1);
+1 -1
View File
@@ -32,7 +32,7 @@ void PushableRock(PushableRockEntity* this) {
void PushableRock_Init(PushableRockEntity* this) {
super->spriteSettings.draw = 1;
super->action += 1;
super->action++;
super->spriteRendering.b3 = 2;
super->spritePriority.b0 = 4;
super->spritePriority.b1 = 3;
+1 -1
View File
@@ -148,7 +148,7 @@ void SmallIceBlock_Action3(SmallIceBlockEntity* this) {
}
super->action = 4;
super->timer = 60;
super->flags &= 0x7f;
super->flags &= ~0x80;
}
void SmallIceBlock_Action4(SmallIceBlockEntity* this) {
+1 -1
View File
@@ -53,7 +53,7 @@ void SmokeParticle_Action1(Entity* this) {
if (this->frame < 5) {
this->hitbox = (Hitbox*)gUnk_08120A54[this->frame];
} else {
this->flags &= 0x7f;
this->flags &= ~0x80;
}
}
}
+2 -2
View File
@@ -70,7 +70,7 @@ void SwordParticle_Action1(SwordParticleEntity* this) {
u32 tmp2;
if (super->type2 != 0) {
if ((gPlayerState.field_0x1f[2] == 0) || ((gPlayerState.field_0x3[1] & 0x80) != 0)) {
if ((gPlayerState.field_0x1f[2] == 0) || ((gPlayerState.attack_status & 0x80) != 0)) {
DeleteThisEntity();
}
if (gPlayerState.field_0x1f[2] >= 0x50) {
@@ -85,7 +85,7 @@ void SwordParticle_Action1(SwordParticleEntity* this) {
DeleteThisEntity();
}
} else {
if (gPlayerState.field_0x3[1] == 0) {
if (gPlayerState.attack_status == 0) {
DeleteThisEntity();
}
if ((gPlayerState.sword_state & 1) != 0) {
+1 -1
View File
@@ -42,7 +42,7 @@ void Thunderbold(ThunderboldEntity* this) {
void Thunderbold_Init(ThunderboldEntity* this) {
const struct_08122950* ptr;
super->action = 1;
super->flags &= 0x7f;
super->flags &= ~0x80;
super->spriteSettings.draw = 1;
if (super->collisionLayer == 0) {
ResolveCollisionLayer(super);
+1 -1
View File
@@ -53,7 +53,7 @@ void UnusedSkull_Init(UnusedSkullEntity* this) {
void UnusedSkull_Action1(UnusedSkullEntity* this) {
if (super->contactFlags == 0x9c) {
super->action = 2;
super->flags &= 0x7f;
super->flags &= ~0x80;
CreateFx(super, FX_ICE, 0);
EnqueueSFX(SFX_10D);
}
+88 -88
View File
@@ -6,94 +6,94 @@
const Hitbox* const gObjectHitboxes[] = { NULL, &gHitbox_0, &gHitbox_30, &gHitbox_2, &gHitbox_3 };
const ObjectDefinition gObjectDefinition_F[] = {
{ { 1, 0, 0, 0, 59, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_FALL_DOWN
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_EXPLOSION
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_DEATH
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BUSH
{ { 1, 0, 0, 0, 81, 2, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK
{ { 1, 0, 0, 0, 236, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_POT_SHATTER
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_6
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_8
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_9
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_A
{ { 1, 0, 0, 0, 72, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_WATER_SPLASH
{ { 1, 0, 0, 0, 78, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_LAVA_SPLASH
{ { 1, 0, 0, 0, 85, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ICE
{ { 1, 0, 0, 0, 18, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK_HUGE
{ { 1, 0, 0, 0, 81, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK_SMALL
{ { 1, 0, 0, 0, 93, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_REFLECT
{ { 1, 0, 0, 0, 89, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_DASH
{ { 1, 0, 0, 0, 0, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BLUE_SPARKLE
{ { 1, 0, 0, 0, 228, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_RED_BUSH
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE2
{ { 1, 0, 0, 0, 81, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK2
{ { 1, 0, 0, 0, 176, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_FIRE
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT
{ { 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } }, // FX_18
{ { 1, 0, 0, 0, 0, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SWORD_MAGIC
{ { 1, 0, 0, 0, 64, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_LIGHTNING
{ { 1, 0, 0, 0, 4, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_LIGHTNING_STRIKE
{ { 1, 0, 0, 0, 32, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_STARS
{ { 1, 0, 0, 0, 32, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_STARS_STRIKE
{ { 1, 0, 0, 0, 32, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_STARS_STRIKE2
{ { 1, 0, 0, 0, 28, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_REFLECT2
{ { 1, 0, 0, 0, 20, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_RIPPLE
{ { 1, 0, 0, 0, 30, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_RIPPLE_LARGE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE_LARGE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE2
{ { 1, 0, 0, 0, 243, 0, 0 }, { 1, 0, 0, 0, 163, 0, 0 } }, // FX_SWEAT
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_26
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, 163, 0, 0 } }, // FX_27
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_EXPLOSION
{ { 1, 0, 0, 0, 113, 0, 0 }, { 71, 0, 0, 0, 163, 0, 0 } }, // FX_CONFETTI
{ { 1, 0, 0, 0, 113, 0, 0 }, { 71, 0, 0, 0, 163, 0, 0 } }, // FX_CONFETTI_LARGE
{ { 1, 0, 0, 0, 72, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GREEN_SPLASH2
{ { 1, 0, 0, 0, 93, 2, 0 }, { 1, 0, 0, 0, 163, 0, 0 } }, // FX_REFLECT3
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, 163, 0, 0 } }, // FX_SIGN
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_SMOKE2
{ { 1, 0, 0, 0, 89, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_SMOKE_SMALL
{ { 1, 0, 0, 0, 57, 2, 0 }, { 171, 0, 0, 0, 163, 0, 0 } }, // FX_SPARKLE_SECRET
{ { 1, 0, 0, 0, 205, 2, 0 }, { 3, 0, 0, 0, 163, 0, 0 } }, // FX_MAILBOX_UNUSED
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, 163, 0, 0 } }, // FX_32
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, 163, 0, 0 } }, // FX_33
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, 163, 0, 0 } }, // FX_34
{ { 1, 0, 0, 0, 96, 2, 0 }, { 3, 0, 0, 0, 162, 0, 1 } }, // FX_BIG_EXPLOSION
{ { 1, 0, 0, 0, 78, 2, 0 }, { 0, 0, 0, 0, 163, 0, 1 } }, // FX_LAVA_SPLASH_HUGE
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT2
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BUSH_CUT2
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BUSH_CUT3
{ { 1, 0, 0, 0, 29, 2, 0 }, { 3, 0, 0, 0, 163, 0, 0 } }, // FX_EGG
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, 163, 0, 0 } }, // FX_WOOD
{ { 1, 0, 0, 0, 366, 0, 0 }, { 0, 0, 0, 0, 163, 0, 0 } }, // FX_BONE
{ { 1, 0, 0, 0, 379, 0, 0 }, { 4, 0, 0, 0, 163, 0, 1 } }, // FX_STARS2
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT3
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT4
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT5
{ { 1, 0, 0, 0, 28, 0, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_REFLECT4
{ { 1, 0, 0, 0, 372, 0, 0 }, { 0, 0, 0, 0, 163, 0, 1 } }, // FX_STEAM_EFC
{ { 1, 0, 0, 0, 96, 2, 0 }, { 3, 0, 0, 0, 162, 0, 1 } }, // FX_BIG_EXPLOSION2
{ { 1, 0, 0, 0, 446, 0, 0 }, { 184, 0, 0, 0, 163, 0, 1 } }, // FX_WHITE_SPLASH
{ { 1, 0, 0, 0, 85, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_WHITE_ROCK
{ { 1, 0, 0, 0, 452, 0, 0 }, { 0, 0, 0, 0, 163, 0, 1 } }, // FX_GIANT_EXPLOSION
{ { 1, 0, 0, 0, 452, 0, 0 }, { 0, 0, 0, 0, 163, 0, 1 } }, // FX_GIANT_EXPLOSION2
{ { 1, 0, 0, 0, 452, 0, 0 }, { 0, 0, 0, 0, 163, 0, 1 } }, // FX_GIANT_EXPLOSION3
{ { 1, 0, 0, 0, 457, 0, 0 }, { 285, 0, 0, 0, 163, 0, 1 } }, // FX_GREEN_ORB
{ { 1, 0, 0, 0, 458, 0, 0 }, { 285, 0, 0, 0, 163, 0, 1 } }, // FX_GREEN_ORB_SLOW
{ { 1, 0, 0, 0, 459, 0, 0 }, { 3, 0, 0, 0, 163, 0, 1 } }, // FX_WHITE_AURA
{ { 1, 0, 0, 0, 29, 2, 0 }, { 4, 0, 0, 0, 163, 0, 0 } }, // FX_WOOD2
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE3
{ { 1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, 163, 0, 1 } }, // FX_MAGIC_STORM
{ { 1, 0, 0, 0, 0, 0, 0 }, { 4, 0, 0, 0, 163, 0, 1 } }, // FX_BLUE_EFC
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, 163, 0, 1 } }, // FX_REFLECT5
{ { 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 163, 0, 1 } }, // FX_GIANT_EXPLOSION4
{ { 1, 0, 0, 0, 78, 2, 0 }, { 382, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GREEN_SPLASH
{ { 1, 0, 0, 0, 154, 2, 0 }, { 319, 0, 0, 0, 162, 0, 1 } }, // FX_BLUE_PUFF
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, 162, 0, 1 } }, // FX_WHITE_PUFF
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_AURA_BASE
{ { 1, 0, 0, 0, 217, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_READ_AURA
{ { 1, 0, 0, 0, 217, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_BLUE_AURA
{ { 1, 0, 0, 0, 59, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_FALL_DOWN
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_EXPLOSION
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_DEATH
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BUSH
{ { 1, 0, 0, 0, 81, 2, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK
{ { 1, 0, 0, 0, 236, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_POT_SHATTER
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_6
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_8
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_9
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_A
{ { 1, 0, 0, 0, 72, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_WATER_SPLASH
{ { 1, 0, 0, 0, 78, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_LAVA_SPLASH
{ { 1, 0, 0, 0, 85, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ICE
{ { 1, 0, 0, 0, 18, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK_HUGE
{ { 1, 0, 0, 0, 81, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK_SMALL
{ { 1, 0, 0, 0, 93, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_REFLECT
{ { 1, 0, 0, 0, 89, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_DASH
{ { 1, 0, 0, 0, 0, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BLUE_SPARKLE
{ { 1, 0, 0, 0, 228, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_RED_BUSH
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE2
{ { 1, 0, 0, 0, 81, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_ROCK2
{ { 1, 0, 0, 0, 176, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_FIRE
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT
{ { 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } }, // FX_18
{ { 1, 0, 0, 0, 0, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SWORD_MAGIC
{ { 1, 0, 0, 0, 64, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_LIGHTNING
{ { 1, 0, 0, 0, 4, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_LIGHTNING_STRIKE
{ { 1, 0, 0, 0, 32, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_STARS
{ { 1, 0, 0, 0, 32, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_STARS_STRIKE
{ { 1, 0, 0, 0, 32, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_STARS_STRIKE2
{ { 1, 0, 0, 0, 28, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_REFLECT2
{ { 1, 0, 0, 0, 20, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_RIPPLE
{ { 1, 0, 0, 0, 30, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_RIPPLE_LARGE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE_LARGE
{ { 1, 0, 0, 0, 154, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BROWN_SMOKE2
{ { 1, 0, 0, 0, 243, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_SWEAT
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_26
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_27
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_EXPLOSION
{ { 1, 0, 0, 0, 113, 0, 0 }, { 71, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_CONFETTI
{ { 1, 0, 0, 0, 113, 0, 0 }, { 71, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_CONFETTI_LARGE
{ { 1, 0, 0, 0, 72, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GREEN_SPLASH2
{ { 1, 0, 0, 0, 93, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_REFLECT3
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_SIGN
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_SMOKE2
{ { 1, 0, 0, 0, 89, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SLOW_SMOKE_SMALL
{ { 1, 0, 0, 0, 57, 2, 0 }, { 171, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_SPARKLE_SECRET
{ { 1, 0, 0, 0, 205, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_MAILBOX_UNUSED
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_32
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_33
{ { 1, 0, 0, 0, 96, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_34
{ { 1, 0, 0, 0, 96, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 1 } }, // FX_BIG_EXPLOSION
{ { 1, 0, 0, 0, 78, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_LAVA_SPLASH_HUGE
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT2
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BUSH_CUT2
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_BUSH_CUT3
{ { 1, 0, 0, 0, 29, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_EGG
{ { 1, 0, 0, 0, 0, 0, 0 }, { 5, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_WOOD
{ { 1, 0, 0, 0, 366, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_BONE
{ { 1, 0, 0, 0, 379, 0, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_STARS2
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT3
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT4
{ { 1, 0, 0, 0, 228, 2, 0 }, { 2, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GRASS_CUT5
{ { 1, 0, 0, 0, 28, 0, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_REFLECT4
{ { 1, 0, 0, 0, 372, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_STEAM_EFC
{ { 1, 0, 0, 0, 96, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 1 } }, // FX_BIG_EXPLOSION2
{ { 1, 0, 0, 0, 446, 0, 0 }, { 184, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_WHITE_SPLASH
{ { 1, 0, 0, 0, 85, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_WHITE_ROCK
{ { 1, 0, 0, 0, 452, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_GIANT_EXPLOSION
{ { 1, 0, 0, 0, 452, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_GIANT_EXPLOSION2
{ { 1, 0, 0, 0, 452, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_GIANT_EXPLOSION3
{ { 1, 0, 0, 0, 457, 0, 0 }, { 285, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_GREEN_ORB
{ { 1, 0, 0, 0, 458, 0, 0 }, { 285, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_GREEN_ORB_SLOW
{ { 1, 0, 0, 0, 459, 0, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_WHITE_AURA
{ { 1, 0, 0, 0, 29, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 0 } }, // FX_WOOD2
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_SPARKLE3
{ { 1, 0, 0, 0, 0, 0, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_MAGIC_STORM
{ { 1, 0, 0, 0, 0, 0, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_BLUE_EFC
{ { 1, 0, 0, 0, 60, 2, 0 }, { 4, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_REFLECT5
{ { 1, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_GIANT_EXPLOSION4
{ { 1, 0, 0, 0, 78, 2, 0 }, { 382, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_GREEN_SPLASH
{ { 1, 0, 0, 0, 154, 2, 0 }, { 319, 0, 0, 0, SPRITE_SPECIALFX, 0, 1 } }, // FX_BLUE_PUFF
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 1 } }, // FX_WHITE_PUFF
{ { 1, 0, 0, 0, 154, 2, 0 }, { 3, 0, 0, 0, SPRITE_SPECIALFX, 0, 0 } }, // FX_AURA_BASE
{ { 1, 0, 0, 0, 217, 2, 0 }, { 0, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_READ_AURA
{ { 1, 0, 0, 0, 217, 2, 0 }, { 1, 0, 0, 0, SPRITE_SPECIALFX_1, 0, 1 } }, // FX_BLUE_AURA
};
#ifdef EU
const ObjectDefinition gObjectDefinition_7[] = {
+2 -2
View File
@@ -13,10 +13,10 @@ extern const ObjectDefinition gObjectDefinitions[];
static Entity* CreateSpeechBubble(Entity*, u32, s32, s32);
Entity* sub_080A276C(Entity* parent, u32 type, u32 type2) {
Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) {
Entity* e = CreateItemGetEntity();
if (e != NULL) {
e->id = OBJECT_C1;
e->id = LINK_ANIMATION;
e->kind = OBJECT;
e->type = type;
e->type2 = type2;
+3 -3
View File
@@ -83,7 +83,7 @@ bool32 sub_0806F3E4(Entity* ent) {
ent->subAction = 3;
gNewPlayerEntity.unk_70 = ent;
gPlayerState.field_0x1c = 7;
item = CreatePlayerItem(PLAYER_ITEM_11, 0, 0, 0);
item = CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
if (item != NULL) {
item->child = ent;
ent->parent = item;
@@ -247,10 +247,10 @@ bool32 sub_0806F8DC(Entity* ent) {
u32 sub_0806F948(Entity* ent) {
u32 v1;
if (gPlayerState.field_0xd == 0xFF)
if (gPlayerState.direction == 0xFF)
return ent->animationState;
v1 = gPlayerState.field_0xd / 4;
v1 = gPlayerState.direction / 4;
if ((v1 & 1) && !(((v1 + 1) - ent->animationState) & 4)) {
return ent->animationState;
} else {
+96 -97
View File
@@ -5,24 +5,24 @@
* @brief Player entity
*/
#include "global.h"
#include "collision.h"
#include "asm.h"
#include "sound.h"
#include "entity.h"
#include "player.h"
#include "message.h"
#include "common.h"
#include "area.h"
#include "item.h"
#include "save.h"
#include "object.h"
#include "asm.h"
#include "collision.h"
#include "common.h"
#include "entity.h"
#include "functions.h"
#include "hitbox.h"
#include "game.h"
#include "screen.h"
#include "global.h"
#include "hitbox.h"
#include "item.h"
#include "main.h"
#include "message.h"
#include "object.h"
#include "player.h"
#include "playeritem.h"
#include "save.h"
#include "screen.h"
#include "sound.h"
#define GRAVITY_RATE Q_8_8(32)
#define SLOPE_SPEED_MODIFIER 0x50
@@ -340,9 +340,9 @@ void DoPlayerAction(Entity* this) {
}
static void PlayerInit(Entity* this) {
u32 equip_status;
u32 equipSlot;
gPlayerState.field_0x0[0] = 0xff;
gPlayerState.prevAnim = 0xff;
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
COLLISION_ON(this);
@@ -364,9 +364,9 @@ static void PlayerInit(Entity* this) {
ResolveCollisionLayer(this);
}
equip_status = IsItemEquipped(ITEM_LANTERN_ON);
if (equip_status != 2) {
sub_08077728(equip_status);
equipSlot = IsItemEquipped(ITEM_LANTERN_ON);
if (equipSlot != EQUIP_SLOT_NONE) {
CreateItemEquippedAtSlot(equipSlot);
}
DeleteClones();
UpdatePlayerSkills();
@@ -379,7 +379,7 @@ static void PlayerInit(Entity* this) {
gPlayerState.swim_state = 1;
ResolvePlayerAnimation();
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
PlayerSwimming(this);
ent = FindEntity(OBJECT, SPECIAL_FX, 0x6, FX_WATER_SPLASH, 0x0);
if (ent != NULL) {
DeleteEntity(ent);
@@ -401,12 +401,11 @@ static void PlayerNormal(Entity* this) {
else
gPlayerState.animation = 604;
sub_0806F948(&gPlayerEntity);
ResetPlayerItem();
sub_08077698(this);
ResetActiveItems();
UpdateActiveItems(this);
return;
}
if (gPlayerState.flags & PL_IN_MINECART) {
u32 x;
this->hurtType = 30;
gPlayerState.framestate = PL_STATE_C;
sub_08070BEC(this, this->speed == 0 ? 1 : 0);
@@ -422,7 +421,7 @@ static void PlayerNormal(Entity* this) {
return;
}
if (!gPlayerState.swim_state && (gPlayerState.jump_status & 0xC0) == 0) {
if (gPlayerState.field_0x3[0] || gPlayerState.field_0x1f[2]) {
if (gPlayerState.shield_status || gPlayerState.field_0x1f[2]) {
this->speed = SHIELDING_SPEED;
} else {
if (gPlayerState.sword_state) {
@@ -446,7 +445,7 @@ static void PlayerNormal(Entity* this) {
if (gPlayerState.jump_status == 0 && (gPlayerState.flags & PL_BURNING) == 0) {
if (this->knockbackDuration == 0 && sub_080782C0()) {
if (gRoomVars.shopItemType == 0) {
ResetPlayerItem();
ResetActiveItems();
}
if ((gPlayerState.flags & (PL_USE_OCARINA | PL_FLAGS2)) == 0) {
UpdateFloorType();
@@ -456,7 +455,7 @@ static void PlayerNormal(Entity* this) {
}
if (((gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_CAPTURED | PL_FALLING | PL_BURNING |
PL_IN_MINECART | PL_ROLLING)) |
gPlayerState.field_0xaa) == 0) {
gPlayerState.attachedBeetleCount) == 0) {
switch (UpdatePlayerCollision()) {
case 0:
gPlayerState.pushedObject ^= 0x80;
@@ -486,7 +485,7 @@ static void PlayerNormal(Entity* this) {
if (sub_0807AC54(this)) {
return;
}
sub_08077698(this);
UpdateActiveItems(this);
if (CheckQueuedAction())
return;
@@ -511,7 +510,7 @@ static void PlayerNormal(Entity* this) {
}
}
UpdatePlayerMovement();
if ((this->frame & 2) == 0 && !gPlayerState.field_0x3[1])
if ((this->frame & 2) == 0 && !gPlayerState.attack_status)
UpdateAnimationSingleFrame(this);
return;
}
@@ -520,7 +519,7 @@ static void PlayerNormal(Entity* this) {
if (gPlayerState.swim_state) {
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
PlayerSwimming(this);
} else {
if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) == 0)
this->spritePriority.b1 = 1;
@@ -536,10 +535,10 @@ static void PlayerNormal(Entity* this) {
}
}
if ((gPlayerState.sword_state & 0x10) == 0) {
this->direction = gPlayerState.field_0xd;
this->direction = gPlayerState.direction;
if (gPlayerState.flags & PL_BURNING) {
this->speed = BURNING_SPEED;
if ((gPlayerState.field_0xd & 0x80) != 0)
if ((gPlayerState.direction & 0x80) != 0)
this->direction = 4 * (this->animationState & 0xE);
DeleteClones();
}
@@ -582,7 +581,7 @@ static void PlayerFall(Entity* this) {
PlayerFallUpdate,
};
gPlayerState.field_0xd = 0xFF;
gPlayerState.direction = 0xFF;
gPlayerState.pushedObject = 0x80;
gPlayerState.framestate = PL_STATE_FALL;
@@ -607,7 +606,7 @@ static void PlayerFallInit(Entity* this) {
this->subAction++;
COLLISION_OFF(this);
this->spritePriority.b1 = 0;
ResetPlayerItem();
ResetActiveItems();
DeleteClones();
SoundReq(SFX_PLY_VO7);
SoundReq(SFX_FALL_HOLE);
@@ -660,7 +659,7 @@ static void PlayerBounceInit(Entity* this) {
gPlayerState.jump_status = 0x80;
SoundReq(SFX_14C);
ResetPlayerItem();
ResetActiveItems();
ResetPlayerVelocity();
}
@@ -798,7 +797,7 @@ static void PlayerItemGetInit(Entity* this) {
}
this->subAction = 1;
ResetPlayerItem();
ResetActiveItems();
ResetPlayerVelocity();
}
@@ -849,7 +848,7 @@ static void PlayerJumpInit(Entity* this) {
if ((gPlayerState.heldObject | gPlayerState.sword_state) == 0) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
ResetPlayerItem();
ResetActiveItems();
if (gPlayerState.flags & PL_NO_CAP) {
gPlayerState.animation = 0x420;
} else {
@@ -970,7 +969,7 @@ static void PlayerDrownInit(Entity* this) {
else
gPlayerState.animation = 0x44c;
}
ResetPlayerItem();
ResetActiveItems();
}
static void sub_080712F0(Entity* this) {
@@ -1073,12 +1072,12 @@ static void PortalStandUpdate(Entity* this) {
break;
}
if ((gPlayerState.field_0xd & 0x84) == 0) {
if (this->direction != gPlayerState.field_0xd) {
if ((gPlayerState.direction & 0x84) == 0) {
if (this->direction != gPlayerState.direction) {
this->timer = 8;
}
if (this->timer-- == 0) {
this->direction = gPlayerState.field_0xd;
this->direction = gPlayerState.direction;
this->animationState = Direction8ToAnimationState(this->direction);
this->zVelocity = Q_16_16(2.0);
this->speed = JUMP_SPEED_FWD;
@@ -1089,7 +1088,7 @@ static void PortalStandUpdate(Entity* this) {
gPlayerState.flags &= ~PL_USE_PORTAL;
return;
}
this->direction = gPlayerState.field_0xd;
this->direction = gPlayerState.direction;
} else {
this->timer = 8;
}
@@ -1100,7 +1099,7 @@ static void PortalStandUpdate(Entity* this) {
return;
}
} else {
sub_08077698(this);
UpdateActiveItems(this);
}
ResolvePlayerAnimation();
}
@@ -1285,8 +1284,8 @@ static void PlayerTalkEzlo(Entity* this) {
}
static void PlayerTalkEzlo_Init(Entity* this) {
ResetPlayerItem();
gUnk_03000B80[3].field_0xf = 0;
ResetActiveItems();
gActiveItems[ACTIVE_ITEM_LANTERN].animPriority = 0;
this->iframes = 0;
gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT;
this->updatePriority = PRIO_PLAYER_EVENT;
@@ -1522,7 +1521,7 @@ static void PlayerMinishDieInit(Entity* this) {
gPlayerState.jump_status = 0;
gPlayerState.pushedObject = 0;
sub_0800451C(this);
ResetPlayerItem();
ResetActiveItems();
SoundReq(SFX_PLY_DIE);
}
@@ -1656,7 +1655,7 @@ static void PlayerEmptyBottle(Entity* this) {
static void PlayerEmptyBottleInit(Entity* this) {
Entity* ent;
ResetPlayerItem();
ResetActiveItems();
ent = CreatePlayerItemWithParent((ItemBehavior*)this, PLAYER_ITEM_BOTTLE);
if (ent != NULL) {
ent->field_0x68.HALF.LO = gPlayerState.field_0x38;
@@ -1755,7 +1754,7 @@ static void sub_08072064(Entity* this) {
COLLISION_OFF(this);
this->timer = gPlayerState.field_0x3a;
gPlayerState.animation = gPlayerState.field_0x38 | (gPlayerState.field_0x39 << 8);
ResetPlayerItem();
ResetActiveItems();
}
static void sub_08072098(Entity* this) {
@@ -1799,7 +1798,7 @@ static void sub_08072100(Entity* this) {
} else {
gPlayerState.animation = 0x104;
}
ResetPlayerItem();
ResetActiveItems();
sub_08072168(this);
}
@@ -1814,7 +1813,7 @@ static void sub_08072168(Entity* this) {
} else {
UpdatePlayerMovement();
}
gPlayerState.field_0xd = this->direction;
gPlayerState.direction = this->direction;
UpdatePlayerCollision();
if (this->timer-- == 0) {
this->knockbackDuration = 0;
@@ -1895,7 +1894,7 @@ static void PlayerLavaInit(Entity* this) {
this->knockbackDuration = 10;
}
gPlayerState.flags |= (PL_BURNING | PL_BUSY);
ResetPlayerItem();
ResetActiveItems();
SoundReq(SFX_124);
SoundReq(SFX_PLY_VO6);
}
@@ -1978,7 +1977,7 @@ static void sub_080724DC(Entity* this) {
DeleteClones();
if (GetTileUnderEntity(this) != 0x29) {
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
sub_0807AE20(this);
PlayerUpdateSwimming(this);
}
if (gRoomControls.reload_flags == 0) {
this->updatePriority = this->updatePriorityPrev;
@@ -2002,7 +2001,7 @@ static void sub_080724DC(Entity* this) {
static void sub_0807258C(Entity* this) {
if (gRoomControls.reload_flags == 0) {
if (sub_0807A894(this) == 0x29) {
if (GetCollisionTileInFront(this) == 0x29) {
UpdatePlayerMovement();
if (sub_080797C4() != 0) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
@@ -2020,7 +2019,7 @@ static void sub_0807258C(Entity* this) {
}
}
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
sub_0807AE20(this);
PlayerUpdateSwimming(this);
}
}
@@ -2043,7 +2042,7 @@ static void PlayerRollInit(Entity* this) {
}
this->subAction = 1;
this->timer = 0;
ResetPlayerItem();
ResetActiveItems();
temp = gPlayerState.flags;
if (gPlayerState.flags & PL_MINISH) {
this->spritePriority.b1 = 0;
@@ -2132,9 +2131,9 @@ static void PlayerRollUpdate(Entity* this) {
this->hurtType = 0;
}
if (this->frame & 0x40) {
sub_08077698(this);
UpdateActiveItems(this);
}
if ((this->frame & ANIM_DONE) || (gPlayerState.field_0x3[1] != 0)) {
if ((this->frame & ANIM_DONE) || (gPlayerState.attack_status != 0)) {
ResetPlayerAnimationAndAction();
}
if (this->frame & ANIM_DONE) {
@@ -2195,7 +2194,7 @@ static void PlayerInHoleInit(Entity* this) {
}
}
SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer);
ResetPlayerItem();
ResetActiveItems();
PlayerInHoleUpdate(this);
SoundReq(SFX_81);
}
@@ -2223,11 +2222,11 @@ static void PlayerInHoleUpdate(Entity* this) {
}
static void sub_08072ACC(Entity* this) {
if (gPlayerState.field_0xd == 0xff) {
if (gPlayerState.direction == 0xff) {
this->subtimer = 0;
} else if (this->subtimer > 7) {
COLLISION_ON(this);
this->direction = gPlayerState.field_0xd;
this->direction = gPlayerState.direction;
this->zVelocity = JUMP_SPEED_HOLE_Z;
this->speed = JUMP_SPEED_HOLE_FWD;
this->spritePriority.b0 = 4;
@@ -2236,7 +2235,7 @@ static void sub_08072ACC(Entity* this) {
PlayerSetNormalAndCollide();
RestorePrevTileEntity(COORD_TO_TILE(this), this->collisionLayer);
} else {
this->animationState = Direction8ToAnimationState(gPlayerState.field_0xd);
this->animationState = Direction8ToAnimationState(gPlayerState.direction);
this->subtimer++;
}
}
@@ -2335,7 +2334,7 @@ static void sub_08072CFC(Entity* this) {
gPlayerState.animation = 0x810;
this->timer = 5;
this->subtimer = 0;
ResetPlayerItem();
ResetActiveItems();
}
static const u16 sTiles[] = {
@@ -2471,10 +2470,10 @@ static void sub_08072F94(Entity* this) {
case SURFACE_CLIMB_WALL:
case SURFACE_2C:
this->spritePriority.b1 = 0;
bVar1 = gPlayerState.field_0xd;
if ((gPlayerState.field_0xd & 0x80) == 0) {
this->direction = gPlayerState.field_0xd;
if ((gPlayerState.field_0xd == 8) || (gPlayerState.field_0xd == 0x18)) {
bVar1 = gPlayerState.direction;
if ((gPlayerState.direction & 0x80) == 0) {
this->direction = gPlayerState.direction;
if ((gPlayerState.direction == 8) || (gPlayerState.direction == 0x18)) {
if (gPlayerState.floor_type == SURFACE_LADDER) {
return;
}
@@ -2613,7 +2612,7 @@ static void sub_080731D8(Entity* this) {
}
gRoomControls.camera_target = NULL;
DeleteClones();
ResetPlayerItem();
ResetActiveItems();
}
static void sub_080732D0(Entity* this) {
@@ -2714,7 +2713,7 @@ static void sub_08073468(Entity* this) {
gPlayerState.flags |= PL_PARACHUTE;
CreateObjectWithParent(this, EZLO_CAP_FLYING, 0, 0);
}
ResetPlayerItem();
ResetActiveItems();
if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1)
COLLISION_OFF(this);
}
@@ -2749,7 +2748,7 @@ static void sub_08073504(Entity* this) {
static void sub_08073584(Entity* this) {
u32 state, dir, idx;
if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c ||
if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c ||
(gPlayerState.flags & PL_PARACHUTE) == 0) {
gPlayerState.jump_status |= 0x40;
PlayerSetNormalAndCollide();
@@ -2771,9 +2770,9 @@ static void sub_08073584(Entity* this) {
else
this->speed = 0x80;
if ((gPlayerState.field_0xd & 0x80) == 0) {
if (this->direction != gPlayerState.field_0xd) {
if (((this->direction - gPlayerState.field_0xd) & 0x1F) < 0x10)
if ((gPlayerState.direction & 0x80) == 0) {
if (this->direction != gPlayerState.direction) {
if (((this->direction - gPlayerState.direction) & 0x1F) < 0x10)
*(u32*)&this->field_0x80 -= 0x20;
else
*(u32*)&this->field_0x80 += 0x20;
@@ -2802,8 +2801,8 @@ static void sub_08073584(Entity* this) {
this->animationState = state;
idx = 0;
state = gPlayerState.field_0xd >> 2;
if (!this->field_0x86.HALF.HI || ((gPlayerState.field_0xd & 0x80) == 0 && this->animationState != state)) {
state = gPlayerState.direction >> 2;
if (!this->field_0x86.HALF.HI || ((gPlayerState.direction & 0x80) == 0 && this->animationState != state)) {
static const u16 sAnims1[] = {
0x0708,
0x071C,
@@ -2811,7 +2810,7 @@ static void sub_08073584(Entity* this) {
0x0714,
};
if ((gPlayerState.field_0xd & 0x80) == 0) {
if ((gPlayerState.direction & 0x80) == 0) {
if (this->animationState != state) {
if (this->animationState == (state ^ 4)) {
idx = 2;
@@ -2947,7 +2946,7 @@ static void DoJump(Entity* this) {
static void sub_08073924(Entity* this) {
if ((gPlayerState.flags & PL_ROLLING) == 0 && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) {
gPlayerState.jump_status = 0x40;
gPlayerState.field_0xd = 0xff;
gPlayerState.direction = 0xff;
this->direction = 0xff;
PutAwayItems();
sub_08073968(this);
@@ -2956,7 +2955,7 @@ static void sub_08073924(Entity* this) {
static void sub_08073968(Entity* this) {
if ((gPlayerState.jump_status & 0xC0) == 0) {
this->direction = gPlayerState.field_0xd;
this->direction = gPlayerState.direction;
}
CheckPlayerVelocity();
if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) {
@@ -2983,7 +2982,7 @@ static void sub_080739EC(Entity* this) {
u32 v;
if ((gPlayerState.jump_status & 0xC0) != 0) {
gPlayerState.field_0xd = this->direction;
gPlayerState.direction = this->direction;
if (gPlayerState.jump_status & 0x80)
this->collisions = COL_NONE;
v = GRAVITY_RATE;
@@ -3037,7 +3036,7 @@ static void sub_08073AD4(Entity* this) {
if (gPlayerState.queued_action != PLAYER_INIT || gPlayerState.swim_state != 0) {
return;
}
if (gPlayerState.field_0x3[1])
if (gPlayerState.attack_status)
sub_08073B60(this);
}
gPlayerState.jump_status = tmp + 1;
@@ -3050,7 +3049,7 @@ static void sub_08073AD4(Entity* this) {
static void sub_08073B60(Entity* this) {
gPlayerState.sword_state = 0;
gPlayerState.field_0x3[1] = 0;
gPlayerState.attack_status = 0;
gPlayerState.jump_status = 0;
ResolvePlayerAnimation();
sub_080085B0(this);
@@ -3060,7 +3059,7 @@ static void sub_08073B60(Entity* this) {
}
void sub_08073B8C(Entity* this) {
if (!gPlayerState.field_0x3[1]) {
if (!gPlayerState.attack_status) {
sub_08073B60(this);
return;
}
@@ -3087,7 +3086,7 @@ void sub_08073B8C(Entity* this) {
}
void sub_08073C30(Entity* this) {
if (!gPlayerState.field_0x3[1] || this->timer-- == 0) {
if (!gPlayerState.attack_status || this->timer-- == 0) {
sub_08073B60(this);
} else {
COLLISION_ON(this);
@@ -3165,18 +3164,18 @@ static void sub_08073D20(Entity* this) {
COLLISION_ON(this);
}
if (!UpdatePlayerCollision()) {
sub_08077698(this);
UpdateActiveItems(this);
if (!GravityUpdate(this, GRAVITY_RATE))
gPlayerState.jump_status = 0;
if ((gPlayerState.field_0x7 & 0x80) == 0 && !gPlayerState.field_0xa) {
if (this->iframes <= 8) {
if (gPlayerState.swim_state) {
gPlayerState.framestate = PL_STATE_SWIM;
sub_0807ACCC(this);
PlayerSwimming(this);
UpdatePlayerMovement();
} else {
this->direction = gPlayerState.field_0xd;
if ((gPlayerState.field_0xd & 0x80) == 0) {
this->direction = gPlayerState.direction;
if ((gPlayerState.direction & 0x80) == 0) {
gPlayerState.framestate = PL_STATE_WALK;
UpdatePlayerMovement();
}
@@ -3211,7 +3210,7 @@ static void sub_08073F04(Entity* this) {
this->zVelocity = Q_16_16(2.5);
this->speed = 0x100;
gPlayerState.flags &= ~PL_MINISH;
ResetPlayerItem();
ResetActiveItems();
}
static void sub_08073F4C(Entity* this) {
@@ -3332,7 +3331,7 @@ void SurfaceAction_DoNothing(Entity* this) {
void SurfaceAction_Pit(Entity* this) {
if (!sub_080741C4() && sub_08079C30(this)) {
if (this->action != PLAYER_FALL) {
ResetPlayerItem();
ResetActiveItems();
gPlayerState.queued_action = PLAYER_FALL;
}
}
@@ -3355,7 +3354,7 @@ static void sub_08074244(Entity* this, u32 a1, u32 a2) {
if (!sub_080741C4()) {
u32 tmp;
if (gPlayerState.dash_state == 0) {
tmp = gPlayerState.field_0xd;
tmp = gPlayerState.direction;
} else {
tmp = 4 * this->animationState;
}
@@ -3421,7 +3420,7 @@ static void hide(Entity* this) {
this->spriteSettings.draw = 0;
COLLISION_OFF(this);
this->knockbackDuration = 0;
ResetPlayerItem();
ResetActiveItems();
}
void SurfaceAction_14(Entity* this) {
@@ -3519,7 +3518,7 @@ void SurfaceAction_ShallowWater(Entity* this) {
this->spritePriority.b0 = 4;
gPlayerState.swim_state = 0;
}
if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_ANY_DIRECTION) ||
if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) ||
gPlayerState.surfacePositionSameTimer == 1)
SoundReq(SFX_WATER_WALK);
}
@@ -3563,7 +3562,7 @@ void SurfaceAction_Swamp(Entity* this) {
CreateObjectWithParent(this, OBJECT_70, 0, 0);
CreateFx(this, FX_GREEN_SPLASH, 0);
SoundReq(SFX_161);
} else if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_ANY_DIRECTION) != 0) {
} else if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) != 0) {
SoundReq(SFX_161);
} else if ((gRoomTransition.frameCount & 0xf) == 0) {
SoundReq(SFX_161);
@@ -3611,11 +3610,11 @@ static void sub_08074808(Entity* this) {
if ((gPlayerState.flags & PL_MINISH) == 0)
CreateFx(this, FX_WATER_SPLASH, 0);
SoundReq(SFX_1A5);
ResetPlayerItem();
ResetActiveItems();
}
if ((gPlayerState.swim_state & 0xF) != 1) {
sub_08079744(this);
--gPlayerState.swim_state;
gPlayerState.swim_state--;
}
gPlayerState.flags &= ~(PL_BURNING | PL_FROZEN);
if ((gPlayerState.flags & PL_DRUGGED) != 0 && this->field_0x7a.HWORD <= 0xEu)
@@ -3668,7 +3667,7 @@ void SurfaceAction_Ladder(Entity* this) {
this->spriteOrientation.flipY = 1;
this->animationState = IdleNorth;
this->collisionLayer = 3;
ResetPlayerItem();
ResetActiveItems();
}
}
@@ -3696,7 +3695,7 @@ void SurfaceAction_AutoLadder(Entity* this) {
gPlayerState.animation = 726;
this->direction = DirectionNorth;
}
ResetPlayerItem();
ResetActiveItems();
}
}
@@ -3719,7 +3718,7 @@ void SurfaceAction_Dust(Entity* this) {
if (!sub_080741C4()) {
gPlayerState.speed_modifier -= 128;
if (gPlayerState.surfacePositionSameTimer == 1 ||
(gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_ANY_DIRECTION) != 0) {
(gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) != 0) {
if (gPlayerState.floor_type == SURFACE_DUST)
CreateObjectWithParent(this, DIRT_PARTICLE, 1, 0);
else
@@ -3732,7 +3731,7 @@ void SurfaceAction_26(Entity* this) {
u32 v1;
if (gPlayerState.dash_state == 0)
v1 = gPlayerState.field_0xd;
v1 = gPlayerState.direction;
else
v1 = 4 * this->animationState;
sub_08074244(this, v1, v1);
@@ -3780,7 +3779,7 @@ void SurfaceAction_ConveyerEast(Entity* this) {
}
static void conveyer_push(Entity* this) {
ResetPlayerItem();
ResetActiveItems();
this->spritePriority.b1 = 0;
this->speed = WALK_SPEED;
gPlayerState.flags |= PL_CONVEYOR_PUSHED;
+26 -25
View File
@@ -1,6 +1,7 @@
#include "global.h"
#include "functions.h"
#include "player.h"
#include "playeritem.h"
typedef void(PlayerItemFunc)(Entity*);
@@ -38,31 +39,31 @@ extern const PlayerItemDefinition gPlayerItemDefinitions[];
extern const PlayerItemDefinition* gAdditionalPlayerItemDefinitions[3];
PlayerItemFunc* const gPlayerItemFunctions[] = {
DeleteEntity,
PlayerItemSword,
PlayerItemBomb,
PlayerItemBoomerang,
PlayerItemBow,
PlayerItemShield,
PlayerItemLantern,
PlayerItemNulled,
PlayerItemGustJar,
PlayerItemPacciCane,
DeleteEntity,
DeleteEntity,
PlayerItemDashSword,
PlayerItemCellOverwriteSet,
PlayerItemBottle,
PlayerItemSwordBeam,
PlayerItemGust,
PlayerItemGustBig,
PlayerItemPacciCaneProjectile,
PlayerItemHeldObject,
PlayerItemSpiralBeam,
PlayerItemFireRodProjectile,
PlayerItemSwordBeam,
PlayerItemNulled2,
PlayerItemCellOverwriteSet,
[PLAYER_ITEM_NONE] = DeleteEntity,
[PLAYER_ITEM_SWORD] = PlayerItemSword,
[PLAYER_ITEM_BOMB] = PlayerItemBomb,
[PLAYER_ITEM_BOOMERANG] = PlayerItemBoomerang,
[PLAYER_ITEM_BOW] = PlayerItemBow,
[PLAYER_ITEM_SHIELD] = PlayerItemShield,
[PLAYER_ITEM_LANTERN] = PlayerItemLantern,
[PLAYER_ITEM_NULLED] = PlayerItemNulled,
[PLAYER_ITEM_GUST_JAR] = PlayerItemGustJar,
[PLAYER_ITEM_PACCI_CANE] = PlayerItemPacciCane,
[PLAYER_ITEM_NONE2] = DeleteEntity,
[PLAYER_ITEM_NONE3] = DeleteEntity,
[PLAYER_ITEM_DASH_SWORD] = PlayerItemDashSword,
[PLAYER_ITEM_CELL_OVERWRITE_SET] = PlayerItemCellOverwriteSet,
[PLAYER_ITEM_BOTTLE] = PlayerItemBottle,
[PLAYER_ITEM_SWORD_BEAM1] = PlayerItemSwordBeam,
[PLAYER_ITEM_GUST] = PlayerItemGust,
[PLAYER_ITEM_GUST_BIG] = PlayerItemGustBig,
[PLAYER_ITEM_PACCI_CANE_PROJECTILE] = PlayerItemPacciCaneProjectile,
[PLAYER_ITEM_HELD_OBJECT] = PlayerItemHeldObject,
[PLAYER_ITEM_SPIRAL_BEAM] = PlayerItemSpiralBeam,
[PLAYER_ITEM_FIRE_ROD_PROJECTILE] = PlayerItemFireRodProjectile,
[PLAYER_ITEM_SWORD_BEAM2] = PlayerItemSwordBeam,
[PLAYER_ITEM_NULLED2] = PlayerItemNulled2,
[PLAYER_ITEM_CELL_OVERWRITE_SET2] = PlayerItemCellOverwriteSet,
};
void ItemInit(Entity*);
+5 -5
View File
@@ -80,7 +80,7 @@ void sub_0801B250(PlayerItemBombEntity* this) {
super->spriteSettings.draw = 1;
super->action = 1;
super->spritePriority.b1 = 3;
super->flags &= 0x7f;
super->flags &= ~0x80;
if (super->type == 0xff) {
super->timer = 60;
} else if (super->type == 0xfe) {
@@ -105,17 +105,17 @@ void sub_0801B2CC(PlayerItemBombEntity* this) {
RegisterCarryEntity(super);
}
switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) {
case 0:
case EQUIP_SLOT_A:
unaff_r5 = PLAYER_INPUT_1;
break;
case 1:
case EQUIP_SLOT_B:
unaff_r5 = PLAYER_INPUT_2;
break;
case 2:
case EQUIP_SLOT_NONE:
unaff_r5 = 0;
break;
}
if ((gPlayerState.playerInput.field_0x92 & unaff_r5) != 0) {
if ((gPlayerState.playerInput.newInput & unaff_r5) != 0) {
super->timer = 0;
super->subtimer = 1;
}
+15 -15
View File
@@ -68,8 +68,8 @@ void PlayerItemBoomerang_Init(Entity* this) {
uVar1 = 30;
}
this->timer = uVar1;
if (((s8)gPlayerState.field_0xd) >= 0) {
this->direction = gPlayerState.field_0xd;
if (((s8)gPlayerState.direction) >= 0) {
this->direction = gPlayerState.direction;
} else {
this->direction = this->animationState << 2;
}
@@ -89,7 +89,7 @@ void sub_0801B584(Entity* this) {
u32 cVar3;
sub_0801B804(this);
if ((gPlayerState.field_0x3[1] == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != this ||
if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != this ||
(gPlayerState.item == this && gPlayerEntity.action != PLAYER_NORMAL)) {
if (gPlayerState.item == this) {
gPlayerState.item = NULL;
@@ -124,7 +124,7 @@ void sub_0801B584(Entity* this) {
this->y.HALF.HI += gUnk_080B7826[iVar2 + 1];
InitializeAnimation(this, 0);
gPlayerState.item = NULL;
gPlayerState.field_0x3[1] |= 0x80;
gPlayerState.attack_status |= 0x80;
}
}
@@ -133,8 +133,8 @@ void sub_0801B680(Entity* this) {
u32 uVar6;
sub_0801B804(this);
if ((this->field_0x68.HALF.LO == 12) && (this->field_0x80.HALF.LO == 0) && ((gPlayerState.field_0xd & 0x80) == 0)) {
if (((this->field_0x82.HALF.HI - gPlayerState.field_0xd) & 0x1f) > 0x10) {
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;
@@ -208,26 +208,26 @@ void sub_0801B7A8(Entity* this) {
}
void sub_0801B804(Entity* this) {
u32 itemSlot;
EquipSlot equipSlot;
u32 uVar1;
itemSlot = IsItemEquipped(ITEM_MAGIC_BOOMERANG);
switch (itemSlot) {
case 0:
equipSlot = IsItemEquipped(ITEM_MAGIC_BOOMERANG);
switch (equipSlot) {
case EQUIP_SLOT_A:
uVar1 = 1;
break;
case 1:
case EQUIP_SLOT_B:
uVar1 = 2;
break;
case 2:
case EQUIP_SLOT_NONE:
uVar1 = 0;
break;
}
if ((uVar1 & gPlayerState.playerInput.field_0x90) == 0) {
if ((uVar1 & gPlayerState.playerInput.heldInput) == 0) {
this->field_0x80.HALF.LO = 1;
gPlayerState.field_0xa &= 0x7f;
gPlayerState.keepFacing &= 0x7f;
gPlayerState.field_0xa &= ~0x80;
gPlayerState.keepFacing &= ~0x80;
} else {
gPlayerState.field_0xa |= 0x80;
gPlayerState.keepFacing |= 0x80;
+3 -3
View File
@@ -170,7 +170,7 @@ void sub_0801917C(PlayerItemBowEntity* this) {
InitializeAnimation(super, super->animIndex + 2);
}
sub_08017744(super);
super->flags &= 0x7f;
super->flags &= ~0x80;
super->speed = 0;
tmp3 = super->x.WORD;
if (tmp3 < 0) {
@@ -195,7 +195,7 @@ void sub_0801917C(PlayerItemBowEntity* this) {
super->direction ^= 0x10;
super->speed = 0x100;
super->zVelocity = Q_16_16(0.5);
super->flags &= 0x7f;
super->flags &= ~0x80;
InitializeAnimation(super, 6);
} else {
super->action++;
@@ -230,7 +230,7 @@ void sub_0801917C(PlayerItemBowEntity* this) {
if ((gPlayerEntity.frame & 1) != 0 && arrowCount != 0) {
entity = CreatePlayerItem(PLAYER_ITEM_BOW, 1, super->hurtType, 9);
if (entity != NULL) {
gPlayerState.field_0x3[1] |= 0x80;
gPlayerState.attack_status |= 0x80;
ModArrows(-1);
}
}
+1 -1
View File
@@ -77,7 +77,7 @@ void sub_080A310C(FireRodProjectileEntity* this) {
if (sub_08008790(super, 0xc)) {
DeleteThisEntity();
}
super->child = CreatePlayerItem(PLAYER_ITEM_15, 1, 0, this->unk68);
super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk68);
if (super->child != NULL) {
super->child->parent = super;
}
+1 -1
View File
@@ -221,7 +221,7 @@ static void sub_080ACECC(GustEntity* this) {
Entity* entity;
if (super->type < 3 && super->child == NULL && (s32)this->unk78 >= 0 && gUnk_0812AAE8[super->type] <= this->unk78) {
entity = CreatePlayerItem(PLAYER_ITEM_10, super->type + 1, 0, 0);
entity = CreatePlayerItem(PLAYER_ITEM_GUST, super->type + 1, 0, 0);
if (entity != NULL) {
entity->parent = super;
super->child = entity;
+3 -3
View File
@@ -34,7 +34,7 @@ void sub_080ACF2C(PlayerItemHeldObjectEntity*);
void sub_080ACFCC(PlayerItemHeldObjectEntity*);
void sub_080AD040(PlayerItemHeldObjectEntity*);
void sub_080AD274(PlayerItemHeldObjectEntity*);
u32 sub_0806F8DC(Entity*);
bool32 sub_0806F8DC(Entity*);
void PlayerItemHeldObject(Entity* this) {
static void (*const subActionFuncs[])(PlayerItemHeldObjectEntity*) = {
@@ -91,7 +91,7 @@ void sub_080ACFCC(PlayerItemHeldObjectEntity* this) {
if ((gPlayerState.heldObject == 0) || ((gNewPlayerEntity.unk_79 & 0x7f) != 0)) {
sub_080AD27C(this);
super->subAction++;
super->flags &= 0x7f;
super->flags &= ~0x80;
super->direction = 0xff;
super->zVelocity = 0;
}
@@ -216,7 +216,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) {
return;
}
sub_080AD27C(this);
super->flags &= 0x7f;
super->flags &= ~0x80;
super->direction = 0xff;
super->zVelocity = tmp & 1;
return;
+1 -1
View File
@@ -56,7 +56,7 @@ void sub_08054AC8(Entity* this) {
this->frame = gPlayerEntity.frame;
this->frameSpriteSettings = gPlayerEntity.frameSpriteSettings;
}
if (IsItemEquipped(ITEM_LANTERN_ON) < 2) {
if (IsItemEquipped(ITEM_LANTERN_ON) < EQUIP_SLOT_NONE) {
if (((this->frameIndex != 0xff) && (gPlayerEntity.spriteSettings.draw != 0)) && (this->timer-- == 0)) {
this->timer = 4;
object = CreateObject(LAMP_PARTICLE, 0, 0x10);
+8 -8
View File
@@ -55,19 +55,19 @@ NONMATCH("asm/non_matching/playerItemShield/sub_080A2E00.inc", void sub_080A2E00
this->iframes = 0;
}
uVar4 = gPlayerState.field_0x3[0];
uVar4 = gPlayerState.shield_status;
if ((uVar4 != 0) && (this == gPlayerState.item)) {
if ((uVar4 & 0x80) != 0) {
this->hitbox = gUnk_08127240[this->animationState >> 1];
this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20;
this->flags = this->flags | 0x80;
gPlayerState.field_0x3[0] = uVar4 & 0x7f;
gPlayerState.shield_status = uVar4 & 0x7f;
sub_080176E4(this);
} else {
if ((this->contactFlags & 0x80) != 0) {
if ((((this->contactFlags & 0x7f) == 0x42) && (*(char*)&this->field_0x68 == 0xe)) &&
((uVar4 & 0x40) == 0)) {
pEVar1 = CreatePlayerItem(PLAYER_ITEM_15, 0, 0, *(char*)&this->field_0x68);
pEVar1 = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 0, 0, *(char*)&this->field_0x68);
this->child = pEVar1;
if (pEVar1 != NULL) {
pEVar1->subtimer = 1;
@@ -77,7 +77,7 @@ NONMATCH("asm/non_matching/playerItemShield/sub_080A2E00.inc", void sub_080A2E00
*(u32*)&this->field_0x78 = gUnk_08127220[1];
*(u32*)&this->field_0x74 = uVar4 & 0x40;
*(u8**)&this->field_0x7c = gUnk_08127220;
gPlayerState.field_0x3[0] = gPlayerState.field_0x3[0] | 0x40;
gPlayerState.shield_status |= 0x40;
}
if (*(int*)&this->field_0x6c == 0) {
SoundReq(0x118);
@@ -86,7 +86,7 @@ NONMATCH("asm/non_matching/playerItemShield/sub_080A2E00.inc", void sub_080A2E00
}
}
} else {
gPlayerState.field_0x3[0] = 0;
gPlayerState.shield_status = 0;
if (gPlayerState.item == this) {
gPlayerState.item = NULL;
}
@@ -109,16 +109,16 @@ NONMATCH("asm/non_matching/playerItemShield/sub_080A2E00.inc", void sub_080A2E00
iVar5 = (*(int*)&this->field_0x74) * 4;
iVar2 = *(u8**)&this->field_0x7c;
if (iVar2[iVar5] == 0xff) {
if ((gPlayerState.field_0x3[0] & 0x40) != 0) {
if ((gPlayerState.shield_status & 0x40) != 0) {
*(u8**)&this->field_0x7c = gUnk_081271DC;
gPlayerState.field_0x3[0] = gPlayerState.field_0x3[0] & 0xbf;
gPlayerState.shield_status = gPlayerState.shield_status & 0xbf;
}
*(u32*)&this->field_0x74 = 0;
iVar2 = *(u8**)&this->field_0x7c;
}
pbVar3 = &iVar2[*(int*)&this->field_0x74 * 4];
*(u32*)&this->field_0x78 = pbVar3[1];
if ((gPlayerState.field_0x3[0] & 0x40) != 0) {
if ((gPlayerState.shield_status & 0x40) != 0) {
u32 temp = (gPlayerEntity.frame & 0x7f) + 8;
sub_080042D0(this, temp + *pbVar3, (u16)this->spriteIndex);
} else {

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