Merge pull request #686 from notyourav/followtest

document unused zelda follower and gust jar states
This commit is contained in:
Theo 2024-01-01 13:10:06 -08:00 committed by GitHub
commit 6fb8b41a8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 684 additions and 627 deletions

View File

@ -348,8 +348,8 @@ sub_080041E8: @ 0x080041E8
subs r0, r0, r2
subs r1, r1, r3
thumb_func_start sub_080041EC
sub_080041EC: @ 0x080041EC
thumb_func_start CalcDistance
CalcDistance: @ 0x080041EC
adds r2, r0, #0
muls r0, r2, r0
adds r3, r1, #0

View File

@ -301,8 +301,8 @@ CalculateDirectionTo: @ 0x080045D4
ldr r3, _08004694 @ =ram_CalcCollisionDirection
bx r3
non_word_aligned_thumb_func_start sub_080045DA
sub_080045DA: @ 0x080045DA
non_word_aligned_thumb_func_start CalcOffsetAngle
CalcOffsetAngle: @ 0x080045DA
push {r0, r1, r4, r5, r6, lr}
movs r6, #0x40
cmp r0, #0

View File

@ -83,7 +83,7 @@ _080085E6:
ldr r3, _080088A8 @ =gPlayerState
ldrb r2, [r3, #0x1c]
orrs r2, r2
bne _0800861A // field_0x1c != 0
bne _0800861A // gustJarState != 0
ldrb r2, [r3, #5]
orrs r2, r2
bne _0800861A // heldObject != 0

View File

@ -339,7 +339,7 @@ gUnk_0810B65C:: @ 0810B65C
gUnk_0810B65E:: @ 0810B65E
.incbin "npc5/gUnk_0810B65E.bin"
gUnk_0810B660:: @ 0810B660
gZeldaFollowerText:: @ 0810B660
.4byte gUnk_0810B650
.4byte gUnk_0810B652
.4byte gUnk_0810B654

View File

@ -39,7 +39,7 @@ extern void ResetCollisionLayer(struct Entity_*);
extern void sub_08004596(struct Entity_*, u32);
extern u32 sub_080045B4(struct Entity_*, u32, u32);
extern u32 CalculateDirectionTo(u32, u32, u32, u32);
extern u32 sub_080045DA(s32, s32);
extern u32 CalcOffsetAngle(s32, s32);
extern u32 sub_080086B4(u32, u32, const u8*);
extern u32 ResolveCollisionLayer(struct Entity_*);
extern void sub_0800417E(struct Entity_*, u32);

View File

@ -11,8 +11,8 @@ typedef struct {
/*0x6d*/ u8 unk_6d;
/*0x6e*/ u8 unk_6e;
/*0x6f*/ u8 unk_6f;
/*0x70*/ Entity* unk_70;
/*0x74*/ Entity* unk_74;
/*0x70*/ Entity* pulledJarEntity;
/*0x74*/ Entity* carriedEntity;
/*0x78*/ u8 unk_78;
/*0x79*/ u8 unk_79;
/*0x7a*/ u16 unk_7a;
@ -298,6 +298,24 @@ typedef enum {
SWORD_MOVE_LOW_BEAM,
} SwordMove;
typedef enum {
PL_JAR_NONE = 0x0,
PL_JAR_SUCK = 0x1,
PL_JAR_2 = 0x2,
PL_JAR_3 = 0x3,
PL_JAR_BLAST_INIT = 0x4,
PL_JAR_BLAST_UPDATE = 0x5,
PL_JAR_BLAST_DONE = 0x6,
PL_JAR_ENT_ATTACHED = 0x7,
} GustJarState;
typedef enum {
JAR_CHARGE_NONE = 0,
JAR_CHARGE_SMALL = 1,
JAR_CHARGE_MID = 2,
JAR_CHARGE_BIG = 3,
} GustJarCharge;
typedef enum {
ANIM_DEFAULT = 0x100,
ANIM_WALK = 0x104,
@ -492,8 +510,8 @@ typedef struct {
/*0x18*/ u16 startPosY;
/*0x1a*/ u8 mobility;
/*0x1b*/ u8 sword_state;
/*0x1c*/ u8 field_0x1c;
/*0x1d*/ u8 gustJarSpeed;
/*0x1c*/ u8 gustJarState;
/*0x1d*/ u8 gustJarCharge;
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[2];
/*0x21*/ u8 bow_state;

View File

@ -208,7 +208,7 @@ u32 UpdatePlayerCollision(void) {
((gPlayerState.sword_state & 0x10) != 0)) ||
((sub_080806BC(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x,
gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 &&
(((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) ||
(((gPlayerState.heldObject != 0 || ((gPlayerState.gustJarState & 0xf) != 0)) ||
(sub_0807BD14(&gPlayerEntity.base, index) == 0)))))) {
return 3;
}

View File

@ -391,7 +391,7 @@ CollisionResult sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSetting
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;
tgt->gustJarTolerance = tgt->gustJarTolerance - gPlayerState.gustJarCharge;
if ((s8)tgt->gustJarTolerance <= 0) {
tgt->gustJarTolerance = 0;
tgt->subAction = 2;

View File

@ -96,8 +96,8 @@ void sub_0802A8F4(BombPeahatEntity* this) {
}
void sub_0802A8FC(BombPeahatEntity* this) {
if ((gPlayerState.field_0x1c & 0xf) == 0) {
super->health = gPlayerState.field_0x1c & 0xf;
if ((gPlayerState.gustJarState & 0xf) == 0) {
super->health = gPlayerState.gustJarState & 0xf;
}
}

View File

@ -303,7 +303,7 @@ void sub_08044550(DustEntity* this) {
u8 uVar1;
const s8* ptr;
if ((gPlayerState.field_0x1c & 0xf) == 1) {
if ((gPlayerState.gustJarState & 0xf) == 1) {
if (super->speed < 0x100) {
super->speed += 0x10;
}

View File

@ -189,7 +189,7 @@ void Enemy64_Action2_SubAction0(Enemy64Entity* this) {
}
void Enemy64_Action2_SubAction1(Enemy64Entity* this) {
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
u32 tmp = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
if (4 < (((super->direction - tmp) + 2) & 0xff)) {
if (((tmp - super->direction) & 0x80) != 0) {
super->direction--;
@ -290,7 +290,7 @@ void Enemy64_Action3(Enemy64Entity* this) {
}
void Enemy64_Action3_SubAction0(Enemy64Entity* this) {
u32 tmp = sub_080045DA(gRoomControls.origin_x + 0xa8 - super->x.HALF.HI,
u32 tmp = CalcOffsetAngle(gRoomControls.origin_x + 0xa8 - super->x.HALF.HI,
gRoomControls.origin_y + 0x80 - super->y.HALF.HI);
if (tmp != super->direction) {
if (((tmp - super->direction) & 0x80) != 0) {
@ -490,7 +490,7 @@ void sub_080499F0(Enemy64Entity* this) {
((this->unk_7c & 1) == 0)) {
if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
((this->unk_7c & 2) == 0)) {
tmp = sub_080045DA((s32)gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
tmp = CalcOffsetAngle((s32)gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
(s32)gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.base.x.WORD = super->x.WORD + gSineTable[tmp] * 0x2400;
gPlayerEntity.base.y.WORD = super->y.WORD + gSineTable[tmp + 0x40] * -0x2400;

View File

@ -156,7 +156,7 @@ void FlyingPot_SubAction2(FlyingPotEntity* this) {
}
void FlyingPot_SubAction3(FlyingPotEntity* this) {
if (!(gPlayerState.field_0x1c & 0xF)) {
if (!(gPlayerState.gustJarState & 0xF)) {
sub_08037408(this);
}
}

View File

@ -100,7 +100,7 @@ void sub_08039CE0(FlyingSkullEntity* this) {
}
void sub_08039D4C(FlyingSkullEntity* this) {
if ((gPlayerState.field_0x1c & 0xf) == 0) {
if ((gPlayerState.gustJarState & 0xf) == 0) {
sub_0803A0E0(this);
}
}

View File

@ -260,7 +260,7 @@ void sub_08046AE8(GyorgMaleEntity* this) {
}
void sub_08046B18(GyorgMaleEntity* this) {
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
u32 tmp = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
if (tmp != super->direction) {
if (((tmp - super->direction) & 0xFF) > 0x80) {
this->unk_76 -= 0x100;
@ -283,13 +283,13 @@ void sub_08046B8C(GyorgMaleEntity* this) {
this->unk_82 = gRoomControls.origin_y + 0x210;
sub_08047D88(this);
} else {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->direction = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
}
}
void sub_08046C04(GyorgMaleEntity* this) {
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
u32 tmp = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
if (tmp != super->direction) {
if (((tmp - super->direction) & 0xFF) > 0x80) {
this->unk_76 -= 0x100;
@ -311,7 +311,7 @@ void sub_08046C88(GyorgMaleEntity* this) {
sub_08048178(this, sub_08048158(this->unk_70));
sub_08047D88(this);
} else {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->direction = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
}
}
@ -348,7 +348,7 @@ void sub_08046D44(GyorgMaleEntity* this) {
}
void sub_08046D98(GyorgMaleEntity* this) {
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
u32 tmp = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
if (tmp != super->direction) {
if (((tmp - super->direction) & 0xFF) > 0x80) {
this->unk_76 -= 0x100;
@ -369,7 +369,7 @@ void sub_08046E0C(GyorgMaleEntity* this) {
this->unk_76 = super->direction << 8;
sub_08047D88(this);
} else {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->direction = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
}
}
@ -456,7 +456,7 @@ void sub_08046FE8(GyorgMaleEntity* this) {
}
void sub_0804702C(GyorgMaleEntity* this) {
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
u32 tmp = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
if (((super->direction - tmp + 2) & 0xFF) > 4) {
if ((tmp - super->direction) & 0x80) {
super->direction--;
@ -607,7 +607,7 @@ void sub_080473B8(GyorgMaleEntity* this) {
}
void sub_080473F0(GyorgMaleEntity* this) {
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
u32 tmp = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
if (((super->direction - tmp + 2) & 0xFF) > 4) {
s32 tmp2 = tmp - super->direction;
if (tmp2 & 0x80) {
@ -791,7 +791,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
if (super->speed < 0x300) {
super->speed += 8;
}
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->direction = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047E48(this);
if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x80)) {
super->action = 2;
@ -896,7 +896,7 @@ void sub_08047978(GyorgMaleEntity* this) {
void sub_08047B08(GyorgMaleEntity* this) {
sub_08047D88(this);
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->direction = CalcOffsetAngle(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->speed = 0x200;
sub_08047E58(this);
if (!EntityWithinDistance(super, this->unk_80, this->unk_82, 4))
@ -1066,7 +1066,7 @@ void sub_08047EA4(GyorgMaleEntity* this, u32 unk1) {
return;
if (this->unk_7c & 1) {
tmp2 = sub_08047F68(this) << 8;
dir = sub_080045DA(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
dir = CalcOffsetAngle(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
tmp = dir - (tmp / 256);
tmp &= 0xFF;
@ -1149,7 +1149,7 @@ void sub_08048004(GyorgMaleEntity* this) {
if (b != 3) {
if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (!(this->unk_7c & 2)) {
u32 tmp = sub_080045DA(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
u32 tmp = CalcOffsetAngle(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.base.x.WORD = super->x.WORD + (gSineTable[tmp] * 9216);
gPlayerEntity.base.y.WORD = super->y.WORD - (gSineTable[tmp + 0x40] * 9216);

View File

@ -167,11 +167,11 @@ void OctorokBoss_Hit_SubAction1(OctorokBossEntity* this) {
if (diffX > 8 || diffY > 8) {
this->heap->field_0x2 = 1;
#if defined(JP) || defined(DEMO_JP) || defined(EU)
super->direction = ((s32)sub_080045DA((((gRoomControls.origin_x + 0x108) << 0x10) - super->x.WORD),
super->direction = ((s32)CalcOffsetAngle((((gRoomControls.origin_x + 0x108) << 0x10) - super->x.WORD),
(((gRoomControls.origin_y + 0x88) << 0x10) - super->y.WORD))) >>
3;
#else
super->direction = ((s32)sub_080045DA(gRoomControls.origin_x + 0x108 - super->x.HALF.HI,
super->direction = ((s32)CalcOffsetAngle(gRoomControls.origin_x + 0x108 - super->x.HALF.HI,
gRoomControls.origin_y + 0x88 - super->y.HALF.HI)) >>
3;
#endif
@ -689,7 +689,7 @@ void OctorokBoss_Action1_AimTowardsPlayer(OctorokBossEntity* this) {
s32 tmp1;
s32 tmp2;
tmp1 = (u8)(sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) -
tmp1 = (u8)(CalcOffsetAngle(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) -
(((u8)(-this->angle.HALF.HI) ^ 0x80)));
if (IS_FROZEN(this) == FALSE) {
tmp2 = 8;
@ -898,7 +898,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
if (this->unk_80 == 0) {
super->direction =
sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD);
CalcOffsetAngle(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD);
tmp = ((u8) - (this->angle.HALF.HI + 0x80)) - super->direction;
if (tmp < 0) {
tmp = -tmp;
@ -912,7 +912,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
this->unk_80 = 1;
this->timer = 2;
this->heap->targetAngle =
sub_080045DA((gRoomControls.origin_x + 0x108) * 0x10000 - super->x.WORD,
CalcOffsetAngle((gRoomControls.origin_x + 0x108) * 0x10000 - super->x.WORD,
(gRoomControls.origin_y + 0x88) * 0x10000 - super->y.WORD);
this->heap->targetAngle = (u8) - (this->heap->targetAngle + 0x80);
SoundReq(SFX_ED);
@ -956,7 +956,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
} else {
this->timer--;
if ((gPlayerState.flags == PL_FROZEN) && (this->timer == 0x3c)) {
tmp = sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD);
tmp = CalcOffsetAngle(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD);
if ((u8)((tmp - ((u8) - this->angle.HALF.HI ^ 0x80))) > 0x80) {
this->heap->targetAngle = this->angle.HALF.HI + 0x30;
} else {
@ -1178,7 +1178,7 @@ void sub_08036AF0(OctorokBossEntity* this, s32 radius, s32 angleSpeed) {
continue;
} else {
heap->tailObjects[index - 1]->angle.HALF.HI =
sub_080045DA(heap->tailObjects[index - 1]->base.x.WORD - heap->tailObjects[index]->base.x.WORD,
CalcOffsetAngle(heap->tailObjects[index - 1]->base.x.WORD - heap->tailObjects[index]->base.x.WORD,
heap->tailObjects[index - 1]->base.y.WORD - heap->tailObjects[index]->base.y.WORD);
tmp = FixedMul(gSineTable[heap->tailObjects[index - 1]->angle.HALF.HI], radius << 4);
tmp = FixedDiv(tmp, 0x100);

View File

@ -18,9 +18,9 @@ void sub_08076DF4(ItemBehavior* this, u32 index) {
this->playerAnimationState = gPlayerEntity.base.animationState;
this->priority |= 0x80;
this->priority++;
gPlayerState.gustJarSpeed = 1;
gPlayerEntity.unk_74 = NULL;
gPlayerState.field_0x1c = 1;
gPlayerState.gustJarCharge = JAR_CHARGE_SMALL;
gPlayerEntity.carriedEntity = NULL;
gPlayerState.gustJarState = PL_JAR_SUCK;
sub_08077BB8(this);
} else {
DeleteItemBehavior(this, index);
@ -30,7 +30,7 @@ void sub_08076DF4(ItemBehavior* this, u32 index) {
void sub_08076E60(ItemBehavior* this, u32 index) {
Entity* playerItem;
if ((gPlayerState.field_0x1c & 0xf) == 0) {
if ((gPlayerState.gustJarState & 0xf) == 0) {
DeleteItemBehavior(this, index);
}
if ((this->playerFrame & 0x80) != 0) {
@ -47,7 +47,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) {
}
void sub_08076EC8(ItemBehavior* this, u32 index) {
if ((gPlayerState.field_0x1c & 0xf) == 0) {
if ((gPlayerState.gustJarState & 0xf) == PL_JAR_NONE) {
DeleteItemBehavior(this, index);
return;
}
@ -55,11 +55,11 @@ void sub_08076EC8(ItemBehavior* this, u32 index) {
if (IsItemActive(this)) {
u32 animIndex;
if (this->timer > 0xef) {
gPlayerState.gustJarSpeed = 3;
gPlayerState.gustJarCharge = JAR_CHARGE_BIG;
} else if (++this->timer > 0x77) {
gPlayerState.gustJarSpeed = 2;
gPlayerState.gustJarCharge = JAR_CHARGE_MID;
} else {
gPlayerState.gustJarSpeed = 1;
gPlayerState.gustJarCharge = JAR_CHARGE_SMALL;
}
if (gPlayerEntity.base.subAction == 0x1b) {
@ -87,16 +87,16 @@ void sub_08076EC8(ItemBehavior* this, u32 index) {
void sub_08076F64(ItemBehavior* this, u32 index) {
Entity* item;
PlayerEntity* player;
switch (gPlayerState.field_0x1c & 0xf) {
case 5:
switch (gPlayerState.gustJarState & 0xf) {
case PL_JAR_BLAST_UPDATE:
if (this->playerFrame & 0x80) {
if (this->subtimer) {
this->subtimer = 0;
this->timer = 0;
gPlayerState.gustJarSpeed = 1;
gPlayerState.gustJarCharge = JAR_CHARGE_SMALL;
player = &gPlayerEntity;
player->unk_74 = NULL;
gPlayerState.field_0x1c = 1;
player->carriedEntity = NULL;
gPlayerState.gustJarState = PL_JAR_SUCK;
gPlayerState.field_0xa &= ~(8 >> index);
this->stateID = 2;
SetItemAnim(this, ANIM_GUSTJAR_SUCK);
@ -106,7 +106,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
}
return;
} else {
gPlayerState.field_0x1c = 6;
gPlayerState.gustJarState = PL_JAR_BLAST_DONE;
SetItemAnim(this, ANIM_GUSTJAR_END);
return;
}
@ -126,18 +126,18 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
return;
}
return;
case 3:
gPlayerState.field_0x1c = 4;
case 4:
case PL_JAR_3:
gPlayerState.gustJarState = PL_JAR_BLAST_INIT;
case PL_JAR_BLAST_INIT:
if (IsItemActive(this)) {
this->subtimer = 1;
}
UpdateItemAnim(this);
if (this->playerFrame & 1) {
gPlayerState.field_0x1c = 5;
gPlayerEntity.unk_70 = NULL;
if (gPlayerState.gustJarSpeed) {
gPlayerState.gustJarState = PL_JAR_BLAST_UPDATE;
gPlayerEntity.pulledJarEntity = NULL;
if (gPlayerState.gustJarCharge) {
CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
}
}
@ -149,27 +149,27 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
gPlayerEntity.base.speed = 0x80;
UpdatePlayerMovement();
return;
case 6:
case PL_JAR_BLAST_DONE:
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) == 0)
return;
break;
case 7:
case PL_JAR_ENT_ATTACHED:
SetItemAnim(this, ANIM_GUSTJAR_BLOW);
gPlayerState.field_0x1c = 3;
gPlayerState.gustJarSpeed = 0;
gPlayerState.gustJarState = PL_JAR_3;
gPlayerState.gustJarCharge = JAR_CHARGE_NONE;
return;
case 1:
case 2:
case PL_JAR_SUCK:
case PL_JAR_2:
default:
gPlayerState.field_0x1c = 3;
gPlayerState.gustJarState = PL_JAR_3;
SetItemAnim(this, ANIM_GUSTJAR_BLOW);
return;
case 0:
case PL_JAR_NONE:
break;
}
gPlayerState.field_0x1c = 0;
gPlayerEntity.unk_70 = NULL;
gPlayerState.gustJarState = PL_JAR_NONE;
gPlayerEntity.pulledJarEntity = NULL;
DeleteItemBehavior(this, index);
}

View File

@ -62,7 +62,7 @@ void sub_080768F8(ItemBehavior* this, u32 index) {
u32 bVar1;
u32 bVar2;
bVar1 = gPlayerState.field_0x1c | gPlayerState.attack_status | gPlayerState.heldObject | gPlayerState.jump_status;
bVar1 = gPlayerState.gustJarState | gPlayerState.attack_status | gPlayerState.heldObject | gPlayerState.jump_status;
bVar2 = (gPlayerState.flags & PL_IN_MINECART);
bVar1 |= bVar2;
if (bVar1 == 0) {

View File

@ -35,7 +35,7 @@ void ItemRocsCape(ItemBehavior* this, u32 index) {
}
} else {
if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.attack_status |
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.moleMittsState) == 0) &&
gPlayerState.heldObject | gPlayerState.gustJarState | gPlayerState.moleMittsState) == 0) &&
((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 &&
gPlayerState.floor_type != SURFACE_PIT) ||
(gPlayerEntity.base.z.WORD != 0)) ||

View File

@ -56,7 +56,7 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
PlayerCancelHoldItem(this, param_3);
} else {
PlayerEntity* playerEnt = &gPlayerEntity;
playerEnt->unk_74 = param_2;
playerEnt->carriedEntity = param_2;
playerEnt->base.subtimer = 0;
param_2->child = this->field_0x18;
param_2->carryFlags = playerEnt->base.carryFlags;

View File

@ -38,7 +38,7 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) {
context->y.HALF.HI = yOffset;
xOffset -= this->x.HALF.HI;
this->direction = sub_080045DA(xOffset, yOffset - this->y.HALF.HI);
this->direction = CalcOffsetAngle(xOffset, yOffset - this->y.HALF.HI);
this->animationState = (this->animationState & 0x80) | gUnk_08114134[this->direction >> 4];
}

View File

@ -154,7 +154,7 @@ void sub_0806991C(GormanEntity* this, ScriptExecutionContext* context) {
context->unk_19 = 8;
context->postScriptActions |= 2;
context->condition = 0;
tmp = sub_080045DA(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI);
tmp = CalcOffsetAngle(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI);
super->direction = tmp;
super->animationState = (super->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c];
gActiveScriptInfo.flags |= 1;
@ -170,7 +170,7 @@ void sub_080699AC(GormanEntity* this, ScriptExecutionContext* context) {
context->unk_19 = 8;
context->postScriptActions |= 2;
context->condition = 0;
tmp = sub_080045DA(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI);
tmp = CalcOffsetAngle(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI);
super->direction = tmp;
super->animationState = (super->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c];
gActiveScriptInfo.flags |= 1;

View File

@ -524,7 +524,7 @@ void sub_080626E0(Entity* this, ScriptExecutionContext* context) {
}
if (--context->unk_19 == 0) {
context->unk_19 = 10;
uVar4 = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
uVar4 = CalcOffsetAngle(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
this->direction = (u8)uVar4;
uVar4 = Random();
this->direction = (this->direction + uVar4 % 0xb) - 5;

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ void Bush_Init(BushEntity* this) {
}
void Bush_Action1(BushEntity* this) {
if (((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
if (((gPlayerState.gustJarState & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer);
DeleteThisEntity();
}
@ -108,7 +108,7 @@ void Bush_Action2SubAction2(BushEntity* this) {
super->spriteOffsetX = 0;
sub_0807B9B8(this->unk_70, COORD_TO_TILE(super), super->collisionLayer);
}
if (((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
if (((gPlayerState.gustJarState & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) {
Bush_Action2SubAction5(this);
}
if (sub_0806F3E4(super) && ((super->gustJarFlags & 0xf) == 1)) {

View File

@ -264,7 +264,7 @@ void ChuchuBossStartParticle_Type9(ChuchuBossStartParticleEntity* this) {
DeleteThisEntity();
}
if (gPlayerState.field_0x1c != 1) {
if (gPlayerState.gustJarState != 1) {
DeleteThisEntity();
}
} else {

View File

@ -710,7 +710,7 @@ void sub_0809567C(CutsceneMiscObjectEntity* this) {
super->action = 3;
super->subAction = 1;
super->speed = 0x400;
super->direction = sub_080045DA(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16));
super->direction = CalcOffsetAngle(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16));
}
void CutsceneMiscObject_Type15(CutsceneMiscObjectEntity* this) {

View File

@ -83,10 +83,11 @@ void EvilSpirit_Action1(EvilSpiritEntity* this) {
this->unk7a = this->unk7c;
super->speed = 0x300;
super->direction =
sub_080045DA(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80;
CalcOffsetAngle(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80;
} else {
super->speed = 0x600;
dir = sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) ^
dir =
CalcOffsetAngle(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) ^
0x80;
if (dir != super->direction) {
if ((u8)(dir - super->direction) > 0x80) {
@ -178,7 +179,7 @@ void EvilSpirit_Action3(EvilSpiritEntity* this) {
short iVar4;
int iVar6;
super->direction = sub_080045DA(this->x - super->x.WORD, this->y - super->y.WORD);
super->direction = CalcOffsetAngle(this->x - super->x.WORD, this->y - super->y.WORD);
if ((super->contactFlags & 0x7f) == 0x13) {
super->speed = 0x100;
super->gustJarTolerance--;

View File

@ -20,7 +20,7 @@ typedef struct {
/*0x70*/ u8 unk_70;
} FileScreenObjectsEntity;
extern u32 sub_080041EC(s32, s32);
extern u32 CalcDistance(s32, s32);
static bool32 sub_0808E950(void);
static void sub_0808EABC(FileScreenObjectsEntity*);
@ -550,14 +550,14 @@ static u32 sub_0808EF6C(FileScreenObjectsEntity* this) {
return 0;
}
var4 = var7 = sub_080041EC(var0, var2);
var4 = var7 = CalcDistance(var0, var2);
var4 += 128;
var7 = var4 + var7 * 16;
if (this->unk_6c < var7) {
var7 = this->unk_6c;
}
super->speed = var7;
super->direction = sub_080045DA(var0, var2) >> 3;
super->direction = CalcOffsetAngle(var0, var2) >> 3;
LinearMoveUpdate(super);
return 1;
}

View File

@ -44,7 +44,7 @@ void GustJarParticle_Action1(Entity* this) {
if (sub_0806F3E4(this)) {
DeleteThisEntity();
} else if ((gPlayerState.field_0x1c & 0xf) != 1) {
} else if ((gPlayerState.gustJarState & 0xf) != 1) {
DeleteThisEntity();
}
}

View File

@ -91,7 +91,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) {
PausePlayer();
ResetActiveItems();
gPlayerState.heldObject = 4;
gPlayerEntity.unk_74 = super;
gPlayerEntity.carriedEntity = super;
gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP;
MessageClose();
}
@ -104,7 +104,7 @@ void ItemForSale_Action2(ItemForSaleEntity* this) {
gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP;
super->spriteSettings.draw = gPlayerEntity.base.spriteSettings.draw;
if ((gPlayerState.heldObject == 0) || (super != gPlayerEntity.unk_74)) {
if ((gPlayerState.heldObject == 0) || (super != gPlayerEntity.carriedEntity)) {
sub_080819B4(this);
} else {
ptr = sub_080784E4();
@ -129,7 +129,7 @@ void sub_080819B4(ItemForSaleEntity* this) {
DeleteThisEntity();
}
gPlayerState.heldObject = 0;
gPlayerEntity.unk_74 = 0;
gPlayerEntity.carriedEntity = 0;
ptr = &gUnk_0200AF00;
gRoomVars.shopItemType = 0;
ptr->rActionInteractObject = R_ACTION_NONE;

View File

@ -433,7 +433,7 @@ void sub_0809E0D4(KeyStealingTakkuriEntity* this, ScriptExecutionContext* contex
varY2 = varY;
if (--context->unk_19 == 0) {
context->unk_19 = 8;
super->direction = sub_080045DA(varX2 - super->x.HALF.HI, varY2 - super->y.HALF.HI);
super->direction = CalcOffsetAngle(varX2 - super->x.HALF.HI, varY2 - super->y.HALF.HI);
}
varX3 = super->x.HALF.HI - varX2;
varY3 = super->y.HALF.HI - varY2;

View File

@ -125,8 +125,8 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) {
this->unk_70 = 0;
this->unk_6c = 0;
}
if (gPlayerState.field_0x1c == 3) {
tmp = gUnk_08120620[gPlayerState.gustJarSpeed - 1];
if (gPlayerState.gustJarState == PL_JAR_3) {
tmp = gUnk_08120620[gPlayerState.gustJarCharge - 1];
switch (gPlayerEntity.base.animationState & 6) {
case 4:
this->unk_70 -= tmp;
@ -154,7 +154,7 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) {
uVar4 = gPlayerEntity.base.y.HALF.HI + gUnk_08126EE4[gPlayerEntity.base.animationState | 1];
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, sVar10, uVar4);
switch (gPlayerState.gustJarSpeed) {
switch (gPlayerState.gustJarCharge) {
case 3:
tmp = 0x400;
break;

View File

@ -70,7 +70,7 @@ void Minecart_Action1(MinecartEntity* this) {
SoundReq(SFX_13B);
} else {
if (sub_0800445C(super) != 0) {
if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.field_0x1c ||
if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.gustJarState ||
gPlayerState.heldObject || gPlayerState.jump_status)) {
super->timer++;
} else {

View File

@ -117,5 +117,5 @@ void sub_0809F448(Entity* this) {
break;
}
this->speed = (tmp > 0 ? tmp : -tmp) / (tmp2->unk_1 << 8);
this->direction = sub_080045DA(tmp, 0) >> 3;
this->direction = CalcOffsetAngle(tmp, 0) >> 3;
}

View File

@ -116,7 +116,7 @@ void ObjectA8_Action2Subaction0(ObjectA8Entity* this) {
}
void ObjectA8_Action2Subaction1(ObjectA8Entity* this) {
if ((gPlayerState.field_0x1c & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
if ((gPlayerState.gustJarState & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
super->action = 3;
} else {
sub_0806F4E8(super);
@ -124,7 +124,7 @@ void ObjectA8_Action2Subaction1(ObjectA8Entity* this) {
}
void ObjectA8_Action2Subaction2(ObjectA8Entity* this) {
if ((gPlayerState.field_0x1c & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
if ((gPlayerState.gustJarState & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
super->action = 3;
} else {
if (sub_0806F3E4(super)) {

View File

@ -204,7 +204,7 @@ void ObjectOnSpinyBeetle_Action3Subaction0(ObjectOnSpinyBeetleEntity* this) {
}
void ObjectOnSpinyBeetle_Action3Subaction1(ObjectOnSpinyBeetleEntity* this) {
if ((gPlayerState.field_0x1c & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
if ((gPlayerState.gustJarState & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
super->spriteOffsetX = 0;
super->action = 1;
} else {
@ -219,7 +219,7 @@ void ObjectOnSpinyBeetle_Action3Subaction2(ObjectOnSpinyBeetleEntity* this) {
super->spriteOffsetY = -2;
(super->parent)->child = NULL;
}
if ((gPlayerState.field_0x1c & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
if ((gPlayerState.gustJarState & 0xf) != 1 || (super->contactFlags & 0x7f) != 0x13) {
sub_080989C0(this);
} else {
if ((sub_0806F3E4(super) != 0) && (super->type == 0)) {
@ -229,7 +229,7 @@ void ObjectOnSpinyBeetle_Action3Subaction2(ObjectOnSpinyBeetleEntity* this) {
}
void ObjectOnSpinyBeetle_Action3Subaction3(ObjectOnSpinyBeetleEntity* this) {
if (gPlayerState.field_0x1c == 0) {
if (gPlayerState.gustJarState == 0) {
sub_080989C0(this);
} else {
(this->base).flags &= ~ENT_COLLIDE;

View File

@ -181,7 +181,7 @@ void OctorokBossObject_Action1(OctorokBossObjectEntity* this) {
return;
}
case 1:
super->direction = sub_080045DA(this->helper->tailObjects[super->timer]->x.WORD - super->x.WORD,
super->direction = CalcOffsetAngle(this->helper->tailObjects[super->timer]->x.WORD - super->x.WORD,
this->helper->tailObjects[super->timer]->y.WORD - super->y.WORD);
LinearMoveAngle(super, super->speed, super->direction);
if (EntityInRectRadius(super, this->helper->tailObjects[super->timer], 2, 2) == 0) {
@ -207,7 +207,7 @@ void OctorokBossObject_Action1(OctorokBossObjectEntity* this) {
case 2:
if (super->parent->type2 == 3) {
Entity* object = ((OctorokBossObjectEntity*)super->parent)->helper->mouthObject;
super->direction = sub_080045DA(object->x.WORD - super->x.WORD, object->y.WORD - super->y.WORD);
super->direction = CalcOffsetAngle(object->x.WORD - super->x.WORD, object->y.WORD - super->y.WORD);
LinearMoveAngle(super, 0x280, super->direction);
if (sub_0806FC80(super, super->parent, 0x48) == 0) {
return;

View File

@ -250,7 +250,7 @@ void sub_080826FC(PotEntity* this) {
}
void sub_0808270C(PotEntity* this) {
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) {
if ((gPlayerState.gustJarState & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) {
super->spriteOffsetX = 0;
super->action = 1;
SetBottomTile(0x4000, COORD_TO_TILE(super), super->collisionLayer);
@ -267,7 +267,7 @@ void sub_08082778(PotEntity* this) {
SetBottomTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer);
}
if ((gPlayerState.field_0x1c & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) {
if ((gPlayerState.gustJarState & 0xF) != 0x1 || (super->contactFlags & 0x7F) != 0x13) {
BreakPot(this, NULL);
} else {
sub_0806F3E4(super);
@ -275,7 +275,7 @@ void sub_08082778(PotEntity* this) {
}
void sub_080827F8(PotEntity* this) {
if (gPlayerState.field_0x1c == 0) {
if (gPlayerState.gustJarState == 0) {
BreakPot(this, NULL);
}
}

View File

@ -65,7 +65,7 @@ void PullableMushroom_Init(PullableMushroomEntity* this) {
super->hitType = 0x6e;
super->collisionMask = 0x0e;
super->gustJarFlags = 1;
super->flags |= 0x80;
COLLISION_ON(super);
super->spriteOffsetY = 4;
break;
case 1:
@ -116,13 +116,14 @@ void PullableMushroom_Action1_Type0(PullableMushroomEntity* this) {
}
void PullableMushroom_Action1_Type1(PullableMushroomEntity* this) {
if (*(u16*)&super->parent->action == 0x201) {
if (super->parent->action == 1 && super->parent->subAction == 2) {
super->parent->child = NULL;
DeleteThisEntity();
} else if (super->parent->action == 2) {
sub_0808B168(this, 0);
}
}
void sub_0808ABC4(PullableMushroomEntity* this) {
static const s8 gUnk_081211CC[] = { 0, -128, 0, -6, 0, 0, 5, -4, 0, 0, 0, 0, 0, -128, -5, -4 };
u32 tmp;
@ -292,7 +293,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) {
this->unk_7c = 1;
super->animationState = AnimationStateFlip90(gPlayerEntity.base.animationState >> 1);
super->direction = (super->animationState << 3);
super->flags &= ~0x80;
COLLISION_OFF(super);
super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX;
InitializeAnimation(super, super->animationState + 5);
if (sub_0808B21C(this, 0)) {
@ -320,7 +321,7 @@ void PullableMushroom_Action3(PullableMushroomEntity* this) {
};
funcs[super->subAction](this);
if ((((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) && (super->type == 1)) {
if ((((gPlayerState.gustJarState & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) && (super->type == 1)) {
(super->parent)->action = 1;
(super->parent)->subAction = 1;
super->direction = DirectionTurnAround(super->parent->direction);
@ -336,7 +337,7 @@ void sub_0808B05C(PullableMushroomEntity* this) {
super->animationState = AnimationStateFlip90(gPlayerEntity.base.animationState >> 1);
super->direction = super->animationState << 3;
super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX;
super->flags &= ~0x80;
COLLISION_OFF(super);
InitializeAnimation(super, super->animationState + 5);
if (sub_0808B21C(this, 1)) {
sub_0808B168((PullableMushroomEntity*)super->child, 1);

View File

@ -199,7 +199,7 @@ void sub_080845DC(SpecialFxObject* this) {
void sub_080845F8(SpecialFxObject* this) {
if (((8 - (super->x.HALF.HI & 0xF)) | (8 - (super->y.HALF.HI & 0xF))) != 0) {
super->direction = sub_080045DA((8 - (super->x.HALF.HI & 0xF)), (8 - (super->y.HALF.HI & 0xF))) >> 3;
super->direction = CalcOffsetAngle((8 - (super->x.HALF.HI & 0xF)), (8 - (super->y.HALF.HI & 0xF))) >> 3;
LinearMoveUpdate(super);
}
sub_08084630(this);

View File

@ -55,16 +55,16 @@ bool32 sub_0806F3E4(Entity* ent) {
GenericEntity tmp_ent;
s8* p;
if ((gPlayerState.field_0x1c & 0x7F) != 1)
if ((gPlayerState.gustJarState & 0x7F) != PL_JAR_SUCK)
return 0;
switch (gPlayerState.gustJarSpeed) {
case 1:
switch (gPlayerState.gustJarCharge) {
case JAR_CHARGE_SMALL:
ent->knockbackSpeed += 64;
break;
case 2:
case JAR_CHARGE_MID:
ent->knockbackSpeed += 128;
break;
case 3:
case JAR_CHARGE_BIG:
ent->knockbackSpeed += 192;
break;
}
@ -76,18 +76,18 @@ bool32 sub_0806F3E4(Entity* ent) {
LinearMoveDirection(ent, ent->knockbackSpeed, GetFacingDirection(ent, &tmp_ent.base));
if (sub_0800419C(&tmp_ent.base, ent, 4, 4)) {
u32 state = ent->gustJarFlags & 0xF;
if (state == 2) {
if (state == PL_JAR_2) {
Entity* item;
ent->subAction = 3;
gPlayerEntity.unk_70 = ent;
gPlayerState.field_0x1c = 7;
gPlayerEntity.pulledJarEntity = ent;
gPlayerState.gustJarState = PL_JAR_ENT_ATTACHED;
item = CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0);
if (item != NULL) {
item->child = ent;
ent->parent = item;
}
SoundReq(SFX_ED);
} else if (state == 1) {
} else if (state == PL_JAR_SUCK) {
gPlayerState.item->type = 1;
SoundReq(SFX_EF);
}

View File

@ -25,28 +25,27 @@
#include "screenTransitions.h"
#include "sound.h"
#define GRAVITY_RATE Q_8_8(32)
#define SLOPE_SPEED_MODIFIER 0x50
#define kGravityRate Q_8_8(32)
#define kWalkSpeedSlopeSubtractor Q_8_8(0.3125)
#define kWalkSpeed Q_8_8(1.25)
#define kWalkSpeedRolling Q_8_8(2.0)
#define kWalkSpeedGustJar Q_8_8(0.5)
#define kWalkSpeedShield Q_8_8(0.75)
#define kWalkSpeedSwordCharge Q_8_8(0.875)
#define kWalkSpeedBurning Q_8_8(3)
#define WALK_SPEED Q_8_8(1.25)
#define ROLL_SPEED Q_8_8(2.0)
#define GUST_JAR_SPEED Q_8_8(0.5)
#define SHIELDING_SPEED Q_8_8(0.75)
#define SWORD_CHARGE_SPEED Q_8_8(0.875)
#define BURNING_SPEED Q_8_8(3)
#define JUMP_SPEED_FWD Q_8_8(1)
#define kJumpSpeedForward Q_8_8(1)
/* Jumping out of a hole */
#define JUMP_SPEED_HOLE_FWD Q_8_8(0.46875)
#define JUMP_SPEED_HOLE_Z Q_16_16(1.625)
#define kJumpSpeedHoleForward Q_8_8(0.46875)
#define kJumpSpeedHoleZ Q_16_16(1.625)
/* Bouncing off a wall */
#define BOUNCE_SPEED_FWD Q_8_8(1.0)
#define BOUNCE_SPEED_Z Q_16_16(2.0)
#define kBounceSpeedForward Q_8_8(1.0)
#define kBounceSpeedZ Q_16_16(2.0)
#define PULL_SPEED Q_8_8(0.5)
#define PUSH_SPEED Q_8_8(0.5)
#define kPullSpeed Q_8_8(0.5)
#define kPushSpeed Q_8_8(0.5)
#define FALL_DAMAGE 2
#define kFallDamage 2
typedef void(PlayerEntityAction)(PlayerEntity*);
@ -392,7 +391,7 @@ static void PlayerNormal(PlayerEntity* this) {
if (gPlayerState.flags & PL_CAPTURED) {
super->spritePriority.b1 = 0;
super->knockbackDuration = 0;
super->speed = WALK_SPEED;
super->speed = kWalkSpeed;
gPlayerState.pushedObject = 0x80;
gPlayerState.framestate = PL_STATE_TRAPPED;
if ((super->animationState >> 1) + 92 == super->animIndex && (u16)super->spriteIndex == 2)
@ -421,14 +420,14 @@ static void PlayerNormal(PlayerEntity* this) {
}
if (!gPlayerState.swim_state && (gPlayerState.jump_status & 0xC0) == 0) {
if (gPlayerState.shield_status || gPlayerState.bow_state) {
super->speed = SHIELDING_SPEED;
super->speed = kWalkSpeedShield;
} else {
if (gPlayerState.sword_state) {
super->speed = SWORD_CHARGE_SPEED;
} else if (gPlayerState.field_0x1c) {
super->speed = GUST_JAR_SPEED;
super->speed = kWalkSpeedSwordCharge;
} else if (gPlayerState.gustJarState != PL_JAR_NONE) {
super->speed = kWalkSpeedGustJar;
} else {
super->speed = WALK_SPEED;
super->speed = kWalkSpeed;
}
}
}
@ -536,7 +535,7 @@ static void PlayerNormal(PlayerEntity* this) {
if ((gPlayerState.sword_state & 0x10) == 0) {
super->direction = gPlayerState.direction;
if (gPlayerState.flags & PL_BURNING) {
super->speed = BURNING_SPEED;
super->speed = kWalkSpeedBurning;
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0)
super->direction = 4 * (super->animationState & 0xE);
DeleteClones();
@ -624,7 +623,7 @@ static void PlayerFallUpdate(PlayerEntity* this) {
RespawnPlayer();
gPlayerState.field_0xa = 0;
super->iframes = 32;
ModHealth(-FALL_DAMAGE);
ModHealth(-kFallDamage);
}
}
}
@ -641,19 +640,19 @@ static void PlayerBounce(PlayerEntity* this) {
static void PlayerBounceInit(PlayerEntity* this) {
COLLISION_OFF(super);
super->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(super->animationState)));
super->speed = BOUNCE_SPEED_FWD;
super->speed = kBounceSpeedForward;
super->knockbackDuration = 0;
super->subAction++;
super->timer = gPlayerState.field_0x38;
super->spriteIndex = 1;
if (!(gPlayerState.flags & PL_MINISH)) {
super->zVelocity = BOUNCE_SPEED_Z;
super->zVelocity = kBounceSpeedZ;
gPlayerState.animation = ANIM_BOUNCE;
InitScreenShake(16, 0);
} else {
gPlayerState.animation = ANIM_BOUNCE_MINISH;
super->zVelocity = (BOUNCE_SPEED_Z * 3) / 4;
super->zVelocity = (kBounceSpeedZ * 3) / 4;
}
gPlayerState.jump_status = 0x80;
@ -668,7 +667,7 @@ static void PlayerBounceUpdate(PlayerEntity* this) {
UpdatePlayerMovement();
UpdateFloorType();
if (CheckQueuedAction() || GravityUpdate(super, GRAVITY_RATE))
if (CheckQueuedAction() || GravityUpdate(super, kGravityRate))
return;
gPlayerState.jump_status = 0;
@ -866,7 +865,7 @@ static void PlayerJumpInit(PlayerEntity* this) {
temp <<= 12;
super->zVelocity = temp;
super->speed = JUMP_SPEED_FWD;
super->speed = kJumpSpeedForward;
DeleteClones();
SoundReq(SFX_PLY_JUMP);
SoundReq(SFX_PLY_VO4);
@ -885,14 +884,14 @@ static void sub_08071130(PlayerEntity* this) {
LinearMoveUpdate(super);
if (GravityUpdate(super, GRAVITY_RATE))
if (GravityUpdate(super, kGravityRate))
return;
gPlayerState.jump_status = 0;
ResetCollisionLayer(super);
if (this->unk_74 != NULL)
ResetCollisionLayer(this->unk_74);
if (this->carriedEntity != NULL)
ResetCollisionLayer(this->carriedEntity);
DoTileInteractionHere(super, 7);
@ -1041,7 +1040,7 @@ static void PortalJumpOnUpdate(PlayerEntity* this) {
if ((super->x.HALF.HI != x) || (super->y.HALF.HI != y)) {
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gArea.portal_x, gArea.portal_y);
super->speed = JUMP_SPEED_FWD;
super->speed = kJumpSpeedForward;
UpdatePlayerMovement();
}
@ -1081,7 +1080,7 @@ static void PortalStandUpdate(PlayerEntity* this) {
super->direction = gPlayerState.direction;
super->animationState = Direction8ToAnimationState(super->direction);
super->zVelocity = Q_16_16(2.0);
super->speed = JUMP_SPEED_FWD;
super->speed = kJumpSpeedForward;
super->action = PLAYER_MINISH;
super->subAction = 7;
super->subtimer = 0;
@ -1216,7 +1215,7 @@ static void PortalShrinkUpdate(PlayerEntity* this) {
static void PortalEnterUpdate(PlayerEntity* this) {
if (super->timer == 0) {
if (GravityUpdate(super, GRAVITY_RATE))
if (GravityUpdate(super, kGravityRate))
return;
super->spriteSettings.draw = FALSE;
@ -1311,7 +1310,7 @@ static void PlayerTalkEzlo_Init(PlayerEntity* this) {
return;
}
if (!GravityUpdate(super, GRAVITY_RATE)) {
if (!GravityUpdate(super, kGravityRate)) {
gPlayerState.jump_status = 0;
}
}
@ -1406,7 +1405,7 @@ static void PlayerPushInit(PlayerEntity* this) {
super->timer = 0;
super->subtimer = 1;
} else {
super->speed = (gPlayerState.flags & PL_MINISH) ? PUSH_SPEED / 2 : PUSH_SPEED;
super->speed = (gPlayerState.flags & PL_MINISH) ? kPushSpeed / 2 : kPushSpeed;
}
PlayerPushUpdate(this);
}
@ -1419,19 +1418,19 @@ static void PlayerPushUpdate(PlayerEntity* this) {
static const PushFrame sPushFrames[] = {
{ 5, 0 },
{ 1, PUSH_SPEED * 2 },
{ 1, kPushSpeed * 2 },
{ 5, 0 },
{ 1, PUSH_SPEED * 2 },
{ 1, kPushSpeed * 2 },
{ 2, 0 },
{ 1, PUSH_SPEED * 2 },
{ 1, kPushSpeed * 2 },
{ 2, 0 },
{ 1, PUSH_SPEED * 2 },
{ 1, kPushSpeed * 2 },
{ 3, 0 },
{ 1, PUSH_SPEED * 2 },
{ 8, PUSH_SPEED * 3 / 4 },
{ 8, PUSH_SPEED * 3 / 4 },
{ 8, PUSH_SPEED * 3 / 4 },
{ 8, PUSH_SPEED / 2 },
{ 1, kPushSpeed * 2 },
{ 8, kPushSpeed * 3 / 4 },
{ 8, kPushSpeed * 3 / 4 },
{ 8, kPushSpeed * 3 / 4 },
{ 8, kPushSpeed / 2 },
{ 0xFF, 0 },
};
@ -1491,7 +1490,7 @@ static void PlayerMinishDieInit(PlayerEntity* this) {
if (gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS))
return;
if (GravityUpdate(super, GRAVITY_RATE)) {
if (GravityUpdate(super, kGravityRate)) {
if (gPlayerState.flags & PL_NO_CAP)
gPlayerState.animation = ANIM_JUMP_NOCAP;
else
@ -1637,7 +1636,7 @@ static void sub_08071E04(PlayerEntity* this) {
static void sub_08071E74(PlayerEntity* this) {
u32 temp;
GravityUpdate(super, GRAVITY_RATE);
GravityUpdate(super, kGravityRate);
UpdatePlayerMovement();
temp = super->timer--;
if (temp == 0)
@ -1703,7 +1702,7 @@ static void PlayerFrozenInit(PlayerEntity* this) {
}
static void PlayerFrozenUpdate(PlayerEntity* this) {
if (GravityUpdate(super, GRAVITY_RATE) == 0) {
if (GravityUpdate(super, kGravityRate) == 0) {
UpdateSpriteForCollisionLayer(super);
gPlayerState.jump_status = 0;
if (gPlayerState.field_0x14 == 0) {
@ -1807,7 +1806,7 @@ static void sub_08072168(PlayerEntity* this) {
u32 i;
UpdateAnimationSingleFrame(super);
i = (u16)sub_0806F854(super, 0, -12) ? GRAVITY_RATE * 2 : GRAVITY_RATE;
i = (u16)sub_0806F854(super, 0, -12) ? kGravityRate * 2 : kGravityRate;
GravityUpdate(super, i);
if (gPlayerState.field_0x3a) {
LinearMoveUpdate(super);
@ -1837,7 +1836,7 @@ static void PlayerPull(PlayerEntity* this) {
static void sub_08072214(PlayerEntity* this) {
super->subAction = 1;
super->speed = PULL_SPEED;
super->speed = kPullSpeed;
super->timer = gPlayerState.field_0x38;
super->direction = Direction8FromAnimationState(AnimationStateFlip180(super->animationState));
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
@ -1904,7 +1903,7 @@ static void sub_08072354(PlayerEntity* this) {
sub_0806F854(super, 0, -12);
UpdateAnimationSingleFrame(super);
sub_08079744(super);
if (GravityUpdate(super, GRAVITY_RATE))
if (GravityUpdate(super, kGravityRate))
return;
super->spritePriority.b1 = 0;
@ -1983,7 +1982,7 @@ static void sub_080724DC(PlayerEntity* this) {
if (gRoomControls.reload_flags == 0) {
super->updatePriority = super->updatePriorityPrev;
PlayerWaitForScroll(this);
} else if (gPlayerState.field_0x1c == 0) {
} else if (gPlayerState.gustJarState == PL_JAR_NONE) {
UpdateAnimationSingleFrame(super);
}
} else {
@ -2112,14 +2111,14 @@ static void PlayerRollUpdate(PlayerEntity* this) {
switch (super->frame & 0xf) {
case 0:
if ((super->frame & 0xf) == 0) {
super->speed = ROLL_SPEED;
super->speed = kWalkSpeedRolling;
}
break;
case 1:
super->speed += ROLL_SPEED / 16;
super->speed += kWalkSpeedRolling / 16;
break;
case 2:
super->speed = (ROLL_SPEED * 3 / 2);
super->speed = (kWalkSpeedRolling * 3 / 2);
break;
case 3:
super->speed = 0;
@ -2229,8 +2228,8 @@ static void sub_08072ACC(PlayerEntity* this) {
} else if (super->subtimer > 7) {
COLLISION_ON(super);
super->direction = gPlayerState.direction;
super->zVelocity = JUMP_SPEED_HOLE_Z;
super->speed = JUMP_SPEED_HOLE_FWD;
super->zVelocity = kJumpSpeedHoleZ;
super->speed = kJumpSpeedHoleForward;
super->spritePriority.b0 = 4;
super->spritePriority.b1 = 1;
gPlayerState.jump_status = 0x41;
@ -2277,7 +2276,7 @@ static void sub_08072B5C(PlayerEntity* this) {
temp <<= 12;
super->zVelocity = temp;
super->speed = JUMP_SPEED_FWD;
super->speed = kJumpSpeedForward;
gPlayerState.animation = ANIM_JUMP;
SoundReq(SFX_PLY_JUMP);
}
@ -2285,7 +2284,7 @@ static void sub_08072B5C(PlayerEntity* this) {
static void sub_08072C48(PlayerEntity* this) {
UpdateAnimationSingleFrame(super);
LinearMoveUpdate(super);
if (GravityUpdate(super, GRAVITY_RATE))
if (GravityUpdate(super, kGravityRate))
return;
DoTileInteractionHere(super, 7);
@ -2403,7 +2402,7 @@ static void sub_08072D54(PlayerEntity* this) {
super->timer = 0;
}
if (!GravityUpdate(super, GRAVITY_RATE)) {
if (!GravityUpdate(super, kGravityRate)) {
COLLISION_ON(super);
if (super->collisionLayer == 1) {
ResetCollisionLayer(super);
@ -2724,7 +2723,7 @@ static void sub_08073468(PlayerEntity* this) {
}
static void sub_080734D4(PlayerEntity* this) {
GravityUpdate(super, -(GRAVITY_RATE / 2));
GravityUpdate(super, -(kGravityRate / 2));
if (super->zVelocity > 0 || gPlayerState.field_0x38 == 1) {
super->zVelocity = Q_16_16(4.5625);
super->subAction++;
@ -2732,7 +2731,7 @@ static void sub_080734D4(PlayerEntity* this) {
}
static void sub_08073504(PlayerEntity* this) {
GravityUpdate(super, super->zVelocity < 0 ? GRAVITY_RATE / 4 : GRAVITY_RATE * 2);
GravityUpdate(super, super->zVelocity < 0 ? kGravityRate / 4 : kGravityRate * 2);
if (super->zVelocity < 0 && super->z.HALF.HI > -32) {
super->subAction++;
this->unk_80.WORD = super->direction << 8;
@ -2908,7 +2907,7 @@ static void sub_0807380C(PlayerEntity* this) {
}
gPlayerState.animation = sAnims[super->animationState >> 1];
if (super->z.HALF.HI < -16) {
GravityUpdate(super, GRAVITY_RATE / 16);
GravityUpdate(super, kGravityRate / 16);
} else {
if (--super->timer == 0) {
super->subAction = 7;
@ -2939,7 +2938,7 @@ void sub_08073884(PlayerEntity* this) {
else
InitParachuteRoom();
}
GravityUpdate(super, -((GRAVITY_RATE * 3) / 4));
GravityUpdate(super, -((kGravityRate * 3) / 4));
UpdateAnimationSingleFrame(super);
}
@ -2993,13 +2992,13 @@ static void sub_080739EC(PlayerEntity* this) {
gPlayerState.direction = super->direction;
if (gPlayerState.jump_status & 0x80)
super->collisions = COL_NONE;
v = GRAVITY_RATE;
v = kGravityRate;
} else {
if ((u16)sub_0806F854(super, 0, -12)) {
gPlayerState.jump_status |= 8;
v = GRAVITY_RATE * 2;
v = kGravityRate * 2;
} else {
v = GRAVITY_RATE;
v = kGravityRate;
if (gPlayerState.jump_status & 0x10)
v /= 2;
}
@ -3079,7 +3078,7 @@ void sub_08073B8C(PlayerEntity* this) {
--super->timer;
return;
}
GravityUpdate(super, GRAVITY_RATE * 2);
GravityUpdate(super, kGravityRate * 2);
if (super->z.HALF.HI >= -8) {
if (!gPlayerState.field_0x14 && (sub_0807A2B8() || !sub_08079D48())) {
COLLISION_ON(super);
@ -3173,7 +3172,7 @@ static void sub_08073D20(PlayerEntity* this) {
}
if (!UpdatePlayerCollision()) {
UpdateActiveItems(super);
if (!GravityUpdate(super, GRAVITY_RATE))
if (!GravityUpdate(super, kGravityRate))
gPlayerState.jump_status = 0;
if ((gPlayerState.field_0x7 & 0x80) == 0 && !gPlayerState.field_0xa) {
if (super->iframes <= 8) {
@ -3251,7 +3250,7 @@ static void sub_08073FD0(PlayerEntity* this) {
SoundReq(SFX_PLY_JUMP);
}
}
GravityUpdate(super, GRAVITY_RATE);
GravityUpdate(super, kGravityRate);
if (super->zVelocity == 0) {
super->subAction++;
SoundReq(SFX_PLY_GROW);
@ -3270,7 +3269,7 @@ static void sub_08074018(PlayerEntity* this) {
}
static void sub_08074060(PlayerEntity* this) {
if (!GravityUpdate(super, GRAVITY_RATE)) {
if (!GravityUpdate(super, kGravityRate)) {
super->hitbox = (Hitbox*)&gPlayerHitbox;
super->direction = DirectionSouth;
super->animationState = IdleSouth;
@ -3320,7 +3319,7 @@ void sub_080740D8(PlayerEntity* this) {
LinearMoveUpdate(super);
else
super->subtimer = 1;
if (!GravityUpdate(super, GRAVITY_RATE))
if (!GravityUpdate(super, kGravityRate))
PlayerSetNormalAndCollide();
}
@ -3367,7 +3366,7 @@ static void sub_08074244(PlayerEntity* this, u32 a1, u32 a2) {
tmp = 4 * super->animationState;
}
if (a1 != tmp || a2 != tmp) {
gPlayerState.speed_modifier -= SLOPE_SPEED_MODIFIER;
gPlayerState.speed_modifier -= kWalkSpeedSlopeSubtractor;
}
}
}
@ -3788,7 +3787,7 @@ void SurfaceAction_ConveyerEast(PlayerEntity* this) {
static void conveyer_push(PlayerEntity* this) {
ResetActiveItems();
super->spritePriority.b1 = 0;
super->speed = WALK_SPEED;
super->speed = kWalkSpeed;
gPlayerState.flags |= PL_CONVEYOR_PUSHED;
gPlayerState.field_0xa |= 0x80;
gPlayerState.mobility |= 0x80;
@ -3839,7 +3838,7 @@ static void sub_08074CF8(PlayerEntity* this) {
sub_08074D34(this, *(ScriptExecutionContext**)&this->unk_84.WORD);
if ((this->unk_80.HALF.HI & 1) != 0)
super->animationState = v3;
GravityUpdate(super, GRAVITY_RATE);
GravityUpdate(super, kGravityRate);
UpdateAnimationSingleFrame(super);
}
@ -3995,7 +3994,7 @@ void sub_0807501C(PlayerEntity* this) {
void sub_0807508C(PlayerEntity* this) {
UpdateAnimationSingleFrame(super);
if (GravityUpdate(super, GRAVITY_RATE)) {
if (GravityUpdate(super, kGravityRate)) {
LinearMoveUpdate(super);
} else {
if (!gPlayerState.field_0x39) {

View File

@ -61,7 +61,7 @@ void PlayerItemGust(Entity* this) {
PlayerItemGust_Update,
};
if ((gPlayerState.field_0x1c & 0x7f) != 1) {
if ((gPlayerState.gustJarState & 0x7f) != 1) {
DeleteThisEntity();
}
PlayerItemGust_Actions[this->action]((PlayerItemGustEntity*)this);

View File

@ -85,7 +85,7 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) {
super->child->spriteOffsetX = 0;
super->child->spriteSettings.draw = 0;
} else {
if (gPlayerState.field_0x1c == 0) {
if (gPlayerState.gustJarState == PL_JAR_NONE) {
DeleteThisEntity();
}
super->action = 2;
@ -93,14 +93,14 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) {
super->spriteIndex = 0xa6;
super->palette.raw = 0x33;
super->spriteVramOffset = 0;
super->type = gPlayerState.gustJarSpeed - 1;
super->type = gPlayerState.gustJarCharge - 1;
super->timer = gUnk_080B3DE0[super->type * 2];
super->damage = gUnk_080B3DE0[super->type * 2 + 1];
super->hurtType = 0x1b;
super->hitbox = (Hitbox*)gUnk_080B3DE8[super->type];
gPlayerEntity.unk_70 = super;
gPlayerEntity.pulledJarEntity = super;
sub_08078CD0(&gPlayerEntity.base);
gPlayerEntity.unk_70 = pEVar3;
gPlayerEntity.pulledJarEntity = pEVar3;
InitializeAnimation(super, super->type + 10);
sub_08018FA0(super);
}
@ -108,18 +108,15 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) {
}
void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this) {
u8 bVar1;
bVar1 = super->child->gustJarState & 4;
if (bVar1 == 0) {
gPlayerState.field_0x1c = bVar1;
if ((super->child->gustJarState & 4) == 0) {
gPlayerState.gustJarState = PL_JAR_NONE;
DeleteThisEntity();
}
switch (gPlayerState.field_0x1c) {
case 0:
switch (gPlayerState.gustJarState) {
case PL_JAR_NONE:
PlayerItemGustBig_Action3(this);
break;
case 5:
case PL_JAR_BLAST_UPDATE:
super->child->subAction = 4;
COLLISION_ON(super);
super->action = 2;

View File

@ -29,7 +29,7 @@ void PlayerItemGustJar(Entity* this) {
PlayerItemGustJar_Action3, PlayerItemGustJar_Action4,
};
if (((Entity*)gPlayerState.item != this) || (gPlayerState.field_0x1c == 0)) {
if (((Entity*)gPlayerState.item != this) || (gPlayerState.gustJarState == PL_JAR_NONE)) {
DeleteThisEntity();
}
PlayerItemGustJar_Actions[this->action](this);
@ -63,10 +63,10 @@ void PlayerItemGustJar_Action2(Entity* this) {
u32 in_r2;
int windSound;
if (gPlayerState.field_0x1c == 3) {
if (gPlayerState.gustJarState == PL_JAR_3) {
this->action++;
InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 8);
} else if (gPlayerState.field_0x1c == 6) {
} else if (gPlayerState.gustJarState == PL_JAR_BLAST_DONE) {
this->action = 4;
InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 4);
} else {
@ -84,11 +84,11 @@ void PlayerItemGustJar_Action2(Entity* this) {
}
}
} else {
if ((gPlayerState.field_0x1c & 0xf) == 7) {
if ((gPlayerState.gustJarState & 0xf) == PL_JAR_ENT_ATTACHED) {
this->frameDuration = 0x7f;
}
switch (gPlayerState.gustJarSpeed) {
switch (gPlayerState.gustJarCharge) {
case 3:
sub_080ADCDC(this, 3);
this->palette.b.b0 = 0;
@ -109,7 +109,7 @@ void PlayerItemGustJar_Action2(Entity* this) {
break;
}
if ((gPlayerState.field_0x1c & 0xf) == 7) {
if ((gPlayerState.gustJarState & 0xf) == PL_JAR_ENT_ATTACHED) {
windSound = SFX_EE;
in_r2 = 1;
}
@ -126,12 +126,12 @@ void PlayerItemGustJar_Action2(Entity* this) {
}
void PlayerItemGustJar_Action3(Entity* this) {
switch (gPlayerState.field_0x1c & 0xf) {
case 6:
switch (gPlayerState.gustJarState & 0xf) {
case PL_JAR_BLAST_DONE:
this->action++;
InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 4);
break;
case 1:
case PL_JAR_SUCK:
sub_080ADCA0(this, 0);
this->action = 2;
break;

View File

@ -235,7 +235,7 @@ void sub_080AD27C(PlayerItemHeldObjectEntity* this) {
static const u32 gUnk_081320D4[] = { Q_16_16(0), Q_16_16(0.5), Q_16_16(1.25), Q_16_16(1.25) };
u32 tmp;
PlayerItemHeldObjectEntity* child = (PlayerItemHeldObjectEntity*)super->child;
gPlayerEntity.unk_74 = NULL;
gPlayerEntity.carriedEntity = NULL;
if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) {
if (child != this) {
(child->base).subAction = 2;

View File

@ -229,7 +229,7 @@ bool32 IsPreventedFromUsingItem(void) {
}
return FALSE;
default:
if ((((gUnk_0200AF00.rActionInteractObject == R_ACTION_ROLL) && (gPlayerState.field_0x1c == 0)) &&
if ((((gUnk_0200AF00.rActionInteractObject == R_ACTION_ROLL) && (gPlayerState.gustJarState == 0)) &&
(gPlayerState.floor_type != SURFACE_SWAMP)) &&
((((gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) != 0 &&
((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) &&
@ -339,7 +339,7 @@ ItemBehavior* CreateItem3(Item itemId) {
gItemDefinitions[itemId].priority >= gActiveItems[ACTIVE_ITEM_0].priority) {
DeleteItemBehavior(&gActiveItems[ACTIVE_ITEM_0], 0);
gPlayerState.grab_status = 0;
gPlayerState.field_0x1c = 0;
gPlayerState.gustJarState = 0;
gPlayerState.sword_state = 0;
return &gActiveItems[ACTIVE_ITEM_0];
}
@ -395,7 +395,7 @@ void ResetActiveItems() {
}
gPlayerState.moleMittsState = 0;
gPlayerState.field_0x1c = 0;
gPlayerState.gustJarState = PL_JAR_NONE;
gPlayerState.bow_state = 0;
gPlayerState.grab_status = 0;
gPlayerState.itemAnimPriority = 0;
@ -405,7 +405,7 @@ void ResetActiveItems() {
gPlayerState.heldObject = 0;
gPlayerState.flags &= ~(PL_ROLLING | PL_SWORD_THRUST);
gPlayerEntity.unk_70 = NULL;
gPlayerEntity.pulledJarEntity = NULL;
if ((gPlayerState.jump_status & 0xc0) == 0) {
gPlayerState.jump_status = 0;
@ -1104,7 +1104,8 @@ bool32 sub_080782C0(void) {
if (gPlayerState.heldObject != 4) {
return FALSE;
}
if ((gPlayerEntity.unk_74)->child->kind != OBJECT || (gPlayerEntity.unk_74)->child->id != SHOP_ITEM) {
if ((gPlayerEntity.carriedEntity)->child->kind != OBJECT ||
(gPlayerEntity.carriedEntity)->child->id != SHOP_ITEM) {
return FALSE;
}
}
@ -1580,7 +1581,7 @@ void sub_08078CD0(PlayerEntity* this) {
u32 tmp;
const s8* ptr;
entity = this->unk_70;
entity = this->pulledJarEntity;
entity->z.HALF.HI = super->z.HALF.HI - 1;
entity->spriteOrientation.flipY = super->spriteOrientation.flipY;
entity->collisionLayer = super->collisionLayer;
@ -1605,7 +1606,7 @@ void sub_08078D60(void) {
Entity* player;
player = &gPlayerEntity.base;
iVar4 = (*(Entity**)&((GenericEntity*)player)->field_0x74)->child;
iVar4 = ((PlayerEntity*)player)->carriedEntity->child;
if (iVar4->action != 2)
return;
@ -1815,7 +1816,7 @@ void sub_080790E4(Entity* this) {
void PlayerDropHeldObject(void) {
gPlayerState.heldObject = 0;
gPlayerState.grab_status = 0;
gPlayerEntity.unk_74 = NULL;
gPlayerEntity.carriedEntity = NULL;
}
void PlayerResetStateFromFusion(void) {
@ -2109,7 +2110,7 @@ void sub_080797EC(void) {
animation = ANIM_BOW_WALK;
}
} else {
if (gPlayerState.field_0x1c) {
if (gPlayerState.gustJarState) {
return;
} else if (gPlayerState.heldObject) {
animation = ANIM_CARRY;
@ -2166,7 +2167,7 @@ void ResolvePlayerAnimation(void) {
if (gPlayerState.heldObject) {
anim = ANIM_CARRY_STAND_NOCAP;
} else {
if (gPlayerState.field_0x1c | gPlayerState.moleMittsState) {
if (gPlayerState.gustJarState | gPlayerState.moleMittsState) {
return;
}
if (gPlayerState.flags & PL_CONVEYOR_PUSHED) {
@ -2209,7 +2210,7 @@ void ResolvePlayerAnimation(void) {
if (gPlayerState.heldObject) {
anim = ANIM_CARRY_STAND;
} else {
if (gPlayerState.field_0x1c | gPlayerState.moleMittsState) {
if (gPlayerState.gustJarState | gPlayerState.moleMittsState) {
return;
}
if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) {
@ -2722,7 +2723,7 @@ void sub_0807A5B8(u32 direction) {
pbVar4 = gUnk_0800833C;
} else if (((gPlayerState.flags & PL_PARACHUTE) != 0) || gPlayerState.jump_status != 0) {
pbVar4 = gUnk_0800845C;
} else if (gPlayerState.heldObject != 0 || gPlayerState.field_0x1c != 0) {
} else if (gPlayerState.heldObject != 0 || gPlayerState.gustJarState != 0) {
pbVar4 = gUnk_080084BC;
} else if (gPlayerState.attachedBeetleCount != 0) {
pbVar4 = gUnk_0800851C;

View File

@ -436,7 +436,7 @@ void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y)
context->y.HALF.HI = y;
xOffset = context->x.HALF.HI - entity->x.HALF.HI;
yOffset = context->y.HALF.HI - entity->y.HALF.HI;
direction = sub_080045DA(xOffset, yOffset);
direction = CalcOffsetAngle(xOffset, yOffset);
entity->direction = direction;
entity->animationState = (entity->animationState & 0x80) | sDirectionTable[(u8)direction >> 4];
}
@ -1394,7 +1394,7 @@ void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context) {
if (!--context->unk_19) {
context->unk_19 = 8;
entity->direction =
sub_080045DA(context->x.HALF.HI - entity->x.HALF.HI, context->y.HALF.HI - entity->y.HALF.HI);
CalcOffsetAngle(context->x.HALF.HI - entity->x.HALF.HI, context->y.HALF.HI - entity->y.HALF.HI);
}
tmp = entity->x.HALF.HI - context->x.HALF.HI;
tmp2 = entity->y.HALF.HI - context->y.HALF.HI;