gustjar player fields

This commit is contained in:
theo3 2024-01-01 13:02:57 -08:00
parent 5324928f44
commit f5c6178ed4
34 changed files with 146 additions and 128 deletions

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

@ -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

@ -291,7 +291,7 @@ void Enemy64_Action3(Enemy64Entity* this) {
void Enemy64_Action3_SubAction0(Enemy64Entity* this) {
u32 tmp = CalcOffsetAngle(gRoomControls.origin_x + 0xa8 - super->x.HALF.HI,
gRoomControls.origin_y + 0x80 - super->y.HALF.HI);
gRoomControls.origin_y + 0x80 - super->y.HALF.HI);
if (tmp != super->direction) {
if (((tmp - super->direction) & 0x80) != 0) {
super->direction--;
@ -491,7 +491,7 @@ void sub_080499F0(Enemy64Entity* this) {
if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
((this->unk_7c & 2) == 0)) {
tmp = CalcOffsetAngle((s32)gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
(s32)gPlayerEntity.base.y.HALF.HI - super->y.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

@ -1067,7 +1067,7 @@ void sub_08047EA4(GyorgMaleEntity* this, u32 unk1) {
if (this->unk_7c & 1) {
tmp2 = sub_08047F68(this) << 8;
dir = CalcOffsetAngle(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI);
tmp = dir - (tmp / 256);
tmp &= 0xFF;
gPlayerEntity.base.x.WORD += (gSineTable[tmp] - gSineTable[dir]) * tmp2;
@ -1150,7 +1150,7 @@ void sub_08048004(GyorgMaleEntity* this) {
if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (!(this->unk_7c & 2)) {
u32 tmp = CalcOffsetAngle(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.base.y.HALF.HI - super->y.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

@ -168,11 +168,11 @@ void OctorokBoss_Hit_SubAction1(OctorokBossEntity* this) {
this->heap->field_0x2 = 1;
#if defined(JP) || defined(DEMO_JP) || defined(EU)
super->direction = ((s32)CalcOffsetAngle((((gRoomControls.origin_x + 0x108) << 0x10) - super->x.WORD),
(((gRoomControls.origin_y + 0x88) << 0x10) - super->y.WORD))) >>
(((gRoomControls.origin_y + 0x88) << 0x10) - super->y.WORD))) >>
3;
#else
super->direction = ((s32)CalcOffsetAngle(gRoomControls.origin_x + 0x108 - super->x.HALF.HI,
gRoomControls.origin_y + 0x88 - super->y.HALF.HI)) >>
gRoomControls.origin_y + 0x88 - super->y.HALF.HI)) >>
3;
#endif
super->speed = 0x100;
@ -913,7 +913,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
this->timer = 2;
this->heap->targetAngle =
CalcOffsetAngle((gRoomControls.origin_x + 0x108) * 0x10000 - super->x.WORD,
(gRoomControls.origin_y + 0x88) * 0x10000 - super->y.WORD);
(gRoomControls.origin_y + 0x88) * 0x10000 - super->y.WORD);
this->heap->targetAngle = (u8) - (this->heap->targetAngle + 0x80);
SoundReq(SFX_ED);
}
@ -1179,7 +1179,7 @@ void sub_08036AF0(OctorokBossEntity* this, s32 radius, s32 angleSpeed) {
} else {
heap->tailObjects[index - 1]->angle.HALF.HI =
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);
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);
heap->tailObjects[index - 1]->base.x.WORD = heap->tailObjects[index]->base.x.WORD + ((s32)tmp << 8);

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

@ -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

@ -86,8 +86,9 @@ void EvilSpirit_Action1(EvilSpiritEntity* this) {
CalcOffsetAngle(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80;
} else {
super->speed = 0x600;
dir = CalcOffsetAngle(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) ^
0x80;
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) {
super->direction += 3;

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

@ -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

@ -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

@ -182,7 +182,7 @@ void OctorokBossObject_Action1(OctorokBossObjectEntity* this) {
}
case 1:
super->direction = CalcOffsetAngle(this->helper->tailObjects[super->timer]->x.WORD - super->x.WORD,
this->helper->tailObjects[super->timer]->y.WORD - super->y.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) {
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

@ -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

@ -424,7 +424,7 @@ static void PlayerNormal(PlayerEntity* this) {
} else {
if (gPlayerState.sword_state) {
super->speed = kWalkSpeedSwordCharge;
} else if (gPlayerState.field_0x1c) {
} else if (gPlayerState.gustJarState != PL_JAR_NONE) {
super->speed = kWalkSpeedGustJar;
} else {
super->speed = kWalkSpeed;
@ -890,8 +890,8 @@ static void sub_08071130(PlayerEntity* this) {
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);
@ -1982,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 {

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;