Merge pull request #545 from hatal175/various2

This commit is contained in:
notyourav 2022-08-01 13:27:38 -07:00 committed by GitHub
commit f02fb72cfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 205 additions and 202 deletions

View File

@ -22,32 +22,23 @@ script_080145F8:
Wait 0x0018 Wait 0x0018
EnablePlayerControl EnablePlayerControl
Jump script_080145F8 Jump script_080145F8
.endif
script_08014632: script_08014632:
CheckRoomFlag 0x0000 CheckRoomFlag 0x0000
JumpIfNot script_08014632 JumpIfNot script_08014632
SetPlayerIdle SetPlayerIdle
Call DisablePauseMenuAndPutAwayItems Call DisablePauseMenuAndPutAwayItems
script_08014642: script_08014642:
.ifdef EU
CheckRoomFlag 0x0009 CheckRoomFlag 0x0009
.else
CheckRoomFlag 0x0004
.endif
JumpIf script_08014642 JumpIf script_08014642
SetSyncFlag 0x00000004 SetSyncFlag 0x00000004
WaitForSyncFlagAndClear 0x00000008 WaitForSyncFlagAndClear 0x00000008
Call EnablePauseMenu Call EnablePauseMenu
EnablePlayerControl EnablePlayerControl
Jump script_080145F8 Jump script_080145F8
.else
CheckRoomFlag 0x0000
JumpIfNot script_080145F8
SetPlayerIdle
Call DisablePauseMenuAndPutAwayItems
script_08014608:
CheckRoomFlag 0x0004
JumpIf script_08014608
SetSyncFlag 0x00000004
WaitForSyncFlagAndClear 0x00000008
Call EnablePauseMenu
EnablePlayerControl
Jump script_080145F8
.endif
.align 2, 0 .align 2, 0

View File

@ -302,10 +302,11 @@ typedef struct {
/*0x39*/ u8 field_0x39; /*0x39*/ u8 field_0x39;
/*0x3a*/ u8 field_0x3a; /*0x3a*/ u8 field_0x3a;
/*0x3b*/ u8 field_0x3b; /*0x3b*/ u8 field_0x3b;
/*0x3c*/ u8 field_0x3c[2]; /*0x3c*/ u8 field_0x3c;
/*0x3d*/ u8 moleMittsState;
/*0x3e*/ u8 swordDamage : 2; /*0x3e*/ u8 swordDamage : 2;
/* */ u8 filler14 : 6; /* */ u8 filler14 : 6;
/*0x3f*/ u8 field_0x3f; /*0x3f*/ s8 spriteOffsetY;
/*0x40*/ u32 path_memory[16]; /*0x40*/ u32 path_memory[16];
/*0x80*/ u16 speed_modifier; /*0x80*/ u16 speed_modifier;
/*0x82*/ u8 field_0x82[9]; /*0x82*/ u8 field_0x82[9];

View File

@ -21,7 +21,7 @@ Entity* sub_08049DF4(u32 arg0) {
} }
Entity* sub_08049E18(void) { Entity* sub_08049E18(void) {
if ((gPlayerState.field_0x3c[0] == 0) && if ((gPlayerState.field_0x3c == 0) &&
!(gPlayerState.flags & !(gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN |
PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING))) { PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING))) {
@ -32,7 +32,7 @@ Entity* sub_08049E18(void) {
} }
Entity* sub_08049E4C(void) { Entity* sub_08049E4C(void) {
if ((gPlayerState.field_0x3c[0] == 0) && if ((gPlayerState.field_0x3c == 0) &&
!(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_MINISH | !(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_MINISH |
PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT |
PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING))) { PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING))) {
@ -43,7 +43,7 @@ Entity* sub_08049E4C(void) {
} }
Entity* sub_08049E80(void) { Entity* sub_08049E80(void) {
if ((gPlayerState.field_0x3c[0] != 0) || !(gPlayerState.flags & 0x80)) { if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & 0x80)) {
return NULL; return NULL;
} }
gUnk_020000B0 = &gPlayerEntity; gUnk_020000B0 = &gPlayerEntity;
@ -51,7 +51,7 @@ Entity* sub_08049E80(void) {
} }
Entity* sub_08049EB0(void) { Entity* sub_08049EB0(void) {
if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x80190)) { if ((gPlayerState.field_0x3c == 0) && !(gPlayerState.flags & 0x80190)) {
gUnk_020000B0 = &gPlayerEntity; gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity; return &gPlayerEntity;
} }

View File

@ -167,8 +167,8 @@ void sub_08037690(GibdoEntity* this) {
void sub_080376D0(GibdoEntity* this) { void sub_080376D0(GibdoEntity* this) {
if (!sub_080379EC(this)) { if (!sub_080379EC(this)) {
ResetPlayerItem(); ResetPlayerItem();
gPlayerState.mobility = gPlayerState.mobility | 0x80; gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80; gPlayerState.field_0xa |= 0x80;
CopyPositionAndSpriteOffset(&gPlayerEntity, super); CopyPositionAndSpriteOffset(&gPlayerEntity, super);
UpdateAnimationSingleFrame(super); UpdateAnimationSingleFrame(super);
if ((super->frame & 1) != 0) { if ((super->frame & 1) != 0) {

View File

@ -126,7 +126,7 @@ void Gleerok_OnDeath(GleerokEntity* this) {
gPlayerState.field_0x14 = 1; gPlayerState.field_0x14 = 1;
if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) { if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) {
gPlayerState.field_0x3f = 0xfa; gPlayerState.spriteOffsetY = -6;
} }
gUnk_080CD75C[super->action](this); gUnk_080CD75C[super->action](this);
@ -523,7 +523,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE
return; return;
gPlayerState.field_0x14 = 1; gPlayerState.field_0x14 = 1;
gPlayerState.field_0x3f = 0xfc; gPlayerState.spriteOffsetY = -4;
break; break;
case 4: case 4:
@ -956,7 +956,7 @@ void sub_0802E0B8(GleerokEntity* this) {
if (val) { if (val) {
if (sub_0806FC80(super, &gPlayerEntity, val)) { if (sub_0806FC80(super, &gPlayerEntity, val)) {
gPlayerState.field_0x14 = 1; gPlayerState.field_0x14 = 1;
gPlayerState.field_0x3f = 0xfa; gPlayerState.spriteOffsetY = -6;
} }
} }
@ -1006,7 +1006,7 @@ void sub_0802E1D0(GleerokEntity* this) {
if (super->frame & 0x3f) { if (super->frame & 0x3f) {
if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) { if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) {
gPlayerState.field_0x14 = 1; gPlayerState.field_0x14 = 1;
gPlayerState.field_0x3f = 0xfa; gPlayerState.spriteOffsetY = -6;
} }
} }
if (super->frame & 0x40) { if (super->frame & 0x40) {

View File

@ -5,211 +5,219 @@
* @brief Like Like enemy * @brief Like Like enemy
*/ */
#define NENT_DEPRECATED
#include "enemy.h" #include "enemy.h"
#include "message.h" #include "message.h"
#include "save.h" #include "save.h"
#include "object.h" #include "object.h"
#include "item.h" #include "item.h"
typedef struct {
Entity base;
u8 filler[0x18];
u8 stolenItem;
u8 filler2;
u8 field_0x82;
u8 prevSpritePriority;
} LikeLikeEntity;
extern bool32 ItemIsShield(u32); extern bool32 ItemIsShield(u32);
void sub_0802810C(Entity*); void LikeLike_ReleasePlayer(LikeLikeEntity*);
void sub_080281A0(Entity*); void sub_080281A0(LikeLikeEntity*);
bool32 sub_080281E0(u32); bool32 LikeLike_StealItem(u32);
void sub_08028224(u32); void LikeLike_ReturnStolenItem(u32);
extern void (*const LikeLike_Functions[])(Entity*); extern void (*const LikeLike_Functions[])(Entity*);
extern void (*const gUnk_080CC714[])(Entity*); extern void (*const gUnk_080CC714[])(LikeLikeEntity*);
void LikeLike(Entity* this) { void LikeLike(Entity* this) {
EnemyFunctionHandler(this, LikeLike_Functions); EnemyFunctionHandler(this, LikeLike_Functions);
SetChildOffset(this, 0, 1, -0x10); SetChildOffset(this, 0, 1, -0x10);
} }
void LikeLike_OnTick(Entity* this) { void LikeLike_OnTick(LikeLikeEntity* this) {
gUnk_080CC714[this->action](this); gUnk_080CC714[super->action](this);
} }
void LikeLike_OnCollision(Entity* this) { void LikeLike_OnCollision(LikeLikeEntity* this) {
if (this->hitType == 1) { if (super->hitType == 1) {
this->action = 3; super->action = 3;
COLLISION_OFF(this); COLLISION_OFF(super);
this->hitType = 0x8c; super->hitType = 0x8c;
} else { } else {
if (this->action == 7) { if (super->action == 7) {
sub_0802810C(this); LikeLike_ReleasePlayer(this);
} else if (this->contactFlags & 0x80) { } else if (super->contactFlags & 0x80) {
u8 tmp = this->contactFlags & ~0x80; u8 tmp = super->contactFlags & ~0x80;
if (tmp == 0) { if (tmp == 0) {
this->action = 7; super->action = 7;
this->timer = 95; super->timer = 95;
this->subtimer = tmp; super->subtimer = tmp;
this->flags2 &= 0xfc; super->flags2 &= 0xfc;
this->field_0x82.HALF.HI = gPlayerEntity.spritePriority.b1; this->prevSpritePriority = gPlayerEntity.spritePriority.b1;
} }
} }
} }
if (this->health == 0) { if (super->health == 0) {
this->timer = 32; super->timer = 32;
} }
if (this->confusedTime) { if (super->confusedTime) {
Create0x68FX(this, FX_STARS); Create0x68FX(super, FX_STARS);
} }
EnemyFunctionHandlerAfterCollision(this, LikeLike_Functions); EnemyFunctionHandlerAfterCollision(super, LikeLike_Functions);
} }
void LikeLike_OnDeath(Entity* this) { void LikeLike_OnDeath(LikeLikeEntity* this) {
if (this->timer == 2 && this->field_0x80.HALF.LO != 0xff) { if (super->timer == 2 && this->stolenItem != 0xff) {
SetDefaultPriority(this, PRIO_NO_BLOCK); SetDefaultPriority(super, PRIO_NO_BLOCK);
sub_08028224(this->field_0x80.HALF.LO); LikeLike_ReturnStolenItem(this->stolenItem);
} }
GenericDeath(this); GenericDeath(super);
} }
void LikeLike_OnGrabbed(Entity* this) { void LikeLike_OnGrabbed(LikeLikeEntity* this) {
/* ... */
} }
void sub_08027E70(Entity* this) { void LikeLike_Init(LikeLikeEntity* this) {
sub_0804A720(this); sub_0804A720(super);
switch (this->type) { switch (super->type) {
case 0: case 0:
this->action = 3; super->action = 3;
this->spriteSettings.draw = 0; super->spriteSettings.draw = 0;
COLLISION_OFF(this); COLLISION_OFF(super);
this->timer = 0; super->timer = 0;
break; break;
case 1: case 1:
this->action = 1; super->action = 1;
this->spriteSettings.draw = 1; super->spriteSettings.draw = 1;
this->timer = 8; super->timer = 8;
InitializeAnimation(this, 1); InitializeAnimation(super, 1);
break; break;
case 2: case 2:
this->action = 1; super->action = 1;
this->spriteSettings.draw = 0; super->spriteSettings.draw = 0;
this->timer = 0; super->timer = 0;
this->hitType = 1; super->hitType = 1;
InitializeAnimation(this, 0); InitializeAnimation(super, 0);
break; break;
} }
this->direction = 0; super->direction = 0;
this->field_0x82.HALF.LO = 0; this->field_0x82 = 0;
this->animationState = 0; super->animationState = 0;
this->field_0x82.HALF.HI = 0; this->prevSpritePriority = 0;
this->field_0x80.HALF.LO = 0xff; this->stolenItem = 0xff;
} }
void sub_08027EFC(Entity* this) { void sub_08027EFC(LikeLikeEntity* this) {
if (this->hitType == 1) if (super->hitType == 1)
return; return;
if (sub_08049FDC(this, 1)) { if (sub_08049FDC(super, 1)) {
if (!sub_08049FA0(this) && (Random() & 0x30)) { if (!sub_08049FA0(super) && (Random() & 0x30)) {
this->direction = sub_08049EE4(this); super->direction = sub_08049EE4(super);
} else { } else {
this->direction = this->field_0x82.HALF.LO; super->direction = this->field_0x82;
} }
if (--this->timer == 0) { if (--super->timer == 0) {
this->direction = sub_08049F84(this, 1); super->direction = sub_08049F84(super, 1);
this->field_0x82.HALF.LO = this->direction; this->field_0x82 = super->direction;
this->timer = 8; super->timer = 8;
} }
ProcessMovement0(this); ProcessMovement0(super);
GetNextFrame(this); GetNextFrame(super);
} else { } else {
this->action = 6; super->action = 6;
COLLISION_OFF(this); COLLISION_OFF(super);
InitializeAnimation(this, 2); InitializeAnimation(super, 2);
} }
} }
void nullsub_12(Entity* this) { void nullsub_12(LikeLikeEntity* this) {
/* ... */
} }
void sub_08027F84(Entity* this) { void sub_08027F84(LikeLikeEntity* this) {
if (sub_08049FDC(this, 1)) { if (sub_08049FDC(super, 1)) {
this->action = 5; super->action = 5;
this->spriteSettings.draw = 1; super->spriteSettings.draw = 1;
InitializeAnimation(this, 0); InitializeAnimation(super, 0);
CreateDust(this); CreateDust(super);
} }
} }
void sub_08027FB4(Entity* this) { void sub_08027FB4(LikeLikeEntity* this) {
if (--this->timer == 0) { if (--super->timer == 0) {
this->action = 1; super->action = 1;
this->timer = 1; super->timer = 1;
this->flags2 |= 1; super->flags2 |= 1;
} }
GetNextFrame(this); GetNextFrame(super);
} }
void sub_08027FE0(Entity* this) { void sub_08027FE0(LikeLikeEntity* this) {
GetNextFrame(this); GetNextFrame(super);
if (this->frame & 1) { if (super->frame & 1) {
this->action = 1; super->action = 1;
COLLISION_ON(this); COLLISION_ON(super);
this->direction = sub_08049F84(this, 1); super->direction = sub_08049F84(super, 1);
this->timer = 8; super->timer = 8;
this->spritePriority.b1 = 1; super->spritePriority.b1 = 1;
InitializeAnimation(this, 1); InitializeAnimation(super, 1);
} }
} }
void sub_0802802C(Entity* this) { void sub_0802802C(LikeLikeEntity* this) {
GetNextFrame(this); GetNextFrame(super);
if (this->frame & 1) { if (super->frame & 1) {
this->action = 3; super->action = 3;
this->spriteSettings.draw = 0; super->spriteSettings.draw = 0;
this->direction = 0; super->direction = 0;
this->timer = 0; super->timer = 0;
CreateDust(this); CreateDust(super);
} }
} }
void sub_0802805C(Entity* this) { void sub_0802805C(LikeLikeEntity* this) {
u8* tmp; u8* tmp;
UpdateAnimationVariableFrames(this, 2); UpdateAnimationVariableFrames(super, 2);
if (sub_0807953C()) { if (sub_0807953C()) {
u32 tmp2 = Random(); u32 tmp2 = Random();
u32 tmp3 = this->subtimer + 1; u32 tmp3 = super->subtimer + 1;
tmp3 += (tmp2 & 1); tmp3 += (tmp2 & 1);
this->subtimer = tmp3; super->subtimer = tmp3;
} }
if (this->subtimer >= 0x19 || gSave.stats.health == 0) { if (super->subtimer >= 0x19 || gSave.stats.health == 0) {
sub_0802810C(this); LikeLike_ReleasePlayer(this);
} else { } else {
ResetPlayerItem(); ResetPlayerItem();
gPlayerState.mobility |= 0x80; gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0)); PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0));
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); tmp = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex);
gPlayerEntity.spriteOffsetX = tmp[0]; gPlayerEntity.spriteOffsetX = tmp[0];
gPlayerEntity.spriteOffsetY = tmp[1]; gPlayerEntity.spriteOffsetY = tmp[1];
gPlayerEntity.spritePriority.b1 = 0; gPlayerEntity.spritePriority.b1 = 0;
if (--this->timer == 0) { if (--super->timer == 0) {
sub_080281A0(this); sub_080281A0(this);
} }
if ((this->timer & 3) == 0) { if ((super->timer & 3) == 0) {
EnqueueSFX(SFX_PLACE_OBJ); EnqueueSFX(SFX_PLACE_OBJ);
} }
} }
} }
void sub_0802810C(Entity* this) { void LikeLike_ReleasePlayer(LikeLikeEntity* this) {
// This matches but ugly // This matches but ugly
#ifndef NON_MATCHING #ifndef NON_MATCHING
register u32 tmp asm("r3"); register u32 tmp asm("r3");
@ -223,34 +231,33 @@ void sub_0802810C(Entity* this) {
gPlayerEntity.zVelocity = Q_16_16(1.5); gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = -60; gPlayerEntity.iframes = -60;
tmp = 0; tmp = 0;
gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState);
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI; gPlayerEntity.spritePriority.b1 = this->prevSpritePriority;
gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY; gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY;
gPlayerEntity.spriteOffsetY = tmp; gPlayerEntity.spriteOffsetY = tmp;
this->action = 4; super->action = 4;
this->timer = 80; super->timer = 80;
this->subtimer = tmp; super->subtimer = tmp;
this->flags2 |= 2; super->flags2 |= 2;
if (this->iframes == 0) { if (super->iframes == 0) {
this->iframes = -18; super->iframes = -18;
} }
} }
void sub_080281A0(Entity* this) { void sub_080281A0(LikeLikeEntity* this) {
this->subtimer = 25; super->subtimer = 25;
if (sub_080281E0(ITEM_MIRROR_SHIELD)) { if (LikeLike_StealItem(ITEM_MIRROR_SHIELD)) {
this->field_0x80.HALF.LO = ITEM_MIRROR_SHIELD; this->stolenItem = ITEM_MIRROR_SHIELD;
MessageFromTarget(TEXT_INDEX(TEXT_ITEM_GET, 0x78)); MessageFromTarget(TEXT_INDEX(TEXT_ITEM_GET, 0x78));
} else if (sub_080281E0(ITEM_SHIELD)) { } else if (LikeLike_StealItem(ITEM_SHIELD)) {
this->field_0x80.HALF.LO = ITEM_SHIELD; this->stolenItem = ITEM_SHIELD;
MessageFromTarget(TEXT_INDEX(TEXT_ITEM_GET, 0x78)); MessageFromTarget(TEXT_INDEX(TEXT_ITEM_GET, 0x78));
} else { } else {
ModHealth(-1); ModHealth(-1);
} }
} }
/** Can steal item */ bool32 LikeLike_StealItem(u32 item) {
bool32 sub_080281E0(u32 item) {
bool32 ret = FALSE; bool32 ret = FALSE;
if (GetInventoryValue(item) == 1) { if (GetInventoryValue(item) == 1) {
if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) { if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) {
@ -268,8 +275,7 @@ bool32 sub_080281E0(u32 item) {
return ret; return ret;
} }
/** Return stolen item */ void LikeLike_ReturnStolenItem(u32 item) {
void sub_08028224(u32 item) {
#ifdef EU #ifdef EU
CreateItemEntity(item, 0, 1); CreateItemEntity(item, 0, 1);
#else #else
@ -279,9 +285,14 @@ void sub_08028224(u32 item) {
} }
void (*const LikeLike_Functions[])(Entity*) = { void (*const LikeLike_Functions[])(Entity*) = {
LikeLike_OnTick, LikeLike_OnCollision, GenericKnockback, LikeLike_OnDeath, GenericConfused, LikeLike_OnGrabbed, (EntityActionPtr)LikeLike_OnTick,
(EntityActionPtr)LikeLike_OnCollision,
GenericKnockback,
(EntityActionPtr)LikeLike_OnDeath,
GenericConfused,
(EntityActionPtr)LikeLike_OnGrabbed,
}; };
void (*const gUnk_080CC714[])(Entity*) = { void (*const gUnk_080CC714[])(LikeLikeEntity*) = {
sub_08027E70, sub_08027EFC, nullsub_12, sub_08027F84, sub_08027FB4, sub_08027FE0, sub_0802802C, sub_0802805C, LikeLike_Init, sub_08027EFC, nullsub_12, sub_08027F84, sub_08027FB4, sub_08027FE0, sub_0802802C, sub_0802805C,
}; };

View File

@ -1245,7 +1245,7 @@ void sub_0803B804(Entity* this) {
void sub_0803B824(Entity* this) { void sub_0803B824(Entity* this) {
ResetPlayerItem(); ResetPlayerItem();
gPlayerState.mobility = gPlayerState.mobility | 0x80; gPlayerState.mobility |= 0x80;
sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1); sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1);
gPlayerEntity.spriteOffsetY = -6; gPlayerEntity.spriteOffsetY = -6;
gPlayerEntity.spritePriority.b1 = 0; gPlayerEntity.spritePriority.b1 = 0;

View File

@ -227,8 +227,8 @@ void VaatiProjectileFunction0Action9(Entity* this) {
void sub_0803E444(Entity* this) { void sub_0803E444(Entity* this) {
ResetPlayerItem(); ResetPlayerItem();
gPlayerState.mobility = gPlayerState.mobility | 0x80; gPlayerState.mobility |= 0x80;
gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80; gPlayerState.field_0xa |= 0x80;
sub_0806FA90(this, this->contactedEntity, 0, -2); sub_0806FA90(this, this->contactedEntity, 0, -2);
gPlayerEntity.spriteOffsetY += 0xe; gPlayerEntity.spriteOffsetY += 0xe;
} }

View File

@ -333,8 +333,8 @@ static void sub_080171F0(void) {
gPlayerState.speed_modifier = 0; gPlayerState.speed_modifier = 0;
gPlayerState.field_0xaa = 0; gPlayerState.field_0xaa = 0;
MemClear(&gCarriedEntity, 0x8c); MemClear(&gCarriedEntity, 0x8c);
gPlayerEntity.spriteOffsetY = gPlayerState.field_0x3f; gPlayerEntity.spriteOffsetY = gPlayerState.spriteOffsetY;
gPlayerState.field_0x3f = 0; gPlayerState.spriteOffsetY = 0;
sub_0807B0C8(); sub_0807B0C8();
if (gPlayerState.flags & PL_CLONING) if (gPlayerState.flags & PL_CLONING)

View File

@ -29,7 +29,7 @@ void sub_08077130(ItemBehavior* this, u32 idx) {
if (gPlayerState.jump_status == 0) { if (gPlayerState.jump_status == 0) {
sub_08077D38(this, idx); sub_08077D38(this, idx);
gPlayerState.field_0x3c[1] = 1; gPlayerState.moleMittsState = 1;
this->field_0x5[4] |= 0x80; this->field_0x5[4] |= 0x80;
iVar1 = sub_080774A0(); iVar1 = sub_080774A0();
if (iVar1 != 0) { if (iVar1 != 0) {
@ -50,7 +50,7 @@ void sub_08077130(ItemBehavior* this, u32 idx) {
} }
} else { } else {
DeletePlayerItem(this, idx); DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0; gPlayerState.moleMittsState = 0;
} }
} }
@ -64,7 +64,7 @@ void sub_080771C8(ItemBehavior* this, u32 idx) {
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
DeletePlayerItem(this, idx); DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0; gPlayerState.moleMittsState = 0;
} else { } else {
if (((this->field_0x5[9] & 0x20) != 0) && (this->field_0x5[3] == 0xff)) { if (((this->field_0x5[9] & 0x20) != 0) && (this->field_0x5[3] == 0xff)) {
CreateObjectWithParent(&gPlayerEntity, 0x1e, this->field_0x5[9], 1); CreateObjectWithParent(&gPlayerEntity, 0x1e, this->field_0x5[9], 1);
@ -132,7 +132,7 @@ void sub_080772A8(ItemBehavior* this, u32 idx) {
} }
} }
DeletePlayerItem(this, idx); DeletePlayerItem(this, idx);
gPlayerState.field_0x3c[1] = 0; gPlayerState.moleMittsState = 0;
} else { } else {
if ((this->field_0x5[9] & 0x60) != 0) { if ((this->field_0x5[9] & 0x60) != 0) {
gPlayerEntity.frameDuration = 1; gPlayerEntity.frameDuration = 1;
@ -168,7 +168,7 @@ void sub_08077448(ItemBehavior* this, u32 idx) {
} }
UpdateItemAnim(this); UpdateItemAnim(this);
if ((this->field_0x5[9] & 0x80) != 0) { if ((this->field_0x5[9] & 0x80) != 0) {
gPlayerState.field_0x3c[1] = 0; gPlayerState.moleMittsState = 0;
DeletePlayerItem(this, idx); DeletePlayerItem(this, idx);
} }
} }

View File

@ -35,7 +35,7 @@ void ItemRocsCape(ItemBehavior* this, u32 arg1) {
} }
} else { } else {
if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.field_0x3[1] | if (((u8)(gPlayerState.sword_state | gPlayerState.field_0xa | gPlayerState.field_0x3[1] |
gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) && gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.moleMittsState) == 0) &&
((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 && ((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 &&
gPlayerState.floor_type != SURFACE_PIT) || gPlayerState.floor_type != SURFACE_PIT) ||
(gPlayerEntity.z.WORD != 0)) || (gPlayerEntity.z.WORD != 0)) ||

View File

@ -11,12 +11,12 @@ void Carlov(Entity* this) {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }
if ((this->frame & 0x10) != 0) { if ((this->frame & 0x10) != 0) {
this->frame = this->frame & 0xef; this->frame &= ~0x10;
EnqueueSFX(SFX_PLACE_OBJ); EnqueueSFX(SFX_PLACE_OBJ);
InitScreenShake(16, 0); InitScreenShake(16, 0);
} }
if ((this->frame & 0x20) != 0) { if ((this->frame & 0x20) != 0) {
this->frame = this->frame & 0xdf; this->frame &= ~0x20;
EnqueueSFX(SFX_PLY_JUMP); EnqueueSFX(SFX_PLY_JUMP);
} }
} }

View File

@ -58,12 +58,12 @@ void BakerOven_Action1(Entity* this) {
if (this->type) { if (this->type) {
GetNextFrame(this); GetNextFrame(this);
frames = &this->frame; frames = &this->frame;
if (*frames & 1) { if (this->frame & 1) {
*frames &= 0xfe; this->frame &= ~1;
this->y.HALF.HI++; this->y.HALF.HI++;
} }
if ((*frames & 0x80) && this->frameDuration == 1) { if ((*frames & ANIM_DONE) && this->frameDuration == 1) {
this->action = 2; this->action = 2;
this->spriteSettings.draw = 0; this->spriteSettings.draw = 0;
} }

View File

@ -418,12 +418,12 @@ void sub_08094FA8(CutsceneMiscObjectEntity* this) {
super->action = 4; super->action = 4;
#ifndef EU #ifndef EU
if (!CheckGlobalFlag(BIN_DOGFOOD)) { if (!CheckGlobalFlag(BIN_DOGFOOD)) {
CreateItemEntity(0x1c, 0, 0); CreateItemEntity(ITEM_BOTTLE1, 0, 0);
SetGlobalFlag(BIN_DOGFOOD); SetGlobalFlag(BIN_DOGFOOD);
super->timer = 60; super->timer = 60;
} }
#else #else
CreateItemEntity(0x1c, 0, 0); CreateItemEntity(ITEM_BOTTLE1, 0, 0);
#endif #endif
} }
break; break;
@ -459,7 +459,7 @@ void sub_08095088(CutsceneMiscObjectEntity* this) {
break; break;
case 2: case 2:
if ((gMessage.doTextBox & 0x7F) == 0) { if ((gMessage.doTextBox & 0x7F) == 0) {
CreateItemEntity(0x5b, 0, 0); CreateItemEntity(ITEM_JABBERNUT, 0, 0);
DeleteThisEntity(); DeleteThisEntity();
} }
break; break;

View File

@ -68,7 +68,7 @@ static void HeartContainer_Action3(Entity* this) {
sub_08080CB4(this); sub_08080CB4(this);
if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) { if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) {
SetFlag(this->cutsceneBeh.HWORD); SetFlag(this->cutsceneBeh.HWORD);
CreateItemEntity(0x62, 0, 0); CreateItemEntity(ITEM_HEART_CONTAINER, 0, 0);
DeleteThisEntity(); DeleteThisEntity();
} }
} }

View File

@ -141,7 +141,7 @@ void LavaPlatform_Type1Action2(LavaPlatformEntity* this) {
super->action = 3; super->action = 3;
super->flags &= ~ENT_COLLIDE; super->flags &= ~ENT_COLLIDE;
super->timer = 20; super->timer = 20;
gPlayerState.field_0x3f = 0xfd; gPlayerState.spriteOffsetY = -3;
} }
} }
} }
@ -149,7 +149,7 @@ void LavaPlatform_Type1Action2(LavaPlatformEntity* this) {
/** Player is standing on the platform. */ /** Player is standing on the platform. */
void LavaPlatform_Type1Action3(LavaPlatformEntity* this) { void LavaPlatform_Type1Action3(LavaPlatformEntity* this) {
if (LavaPlatform_IsPlayerOnPlatform(this)) { if (LavaPlatform_IsPlayerOnPlatform(this)) {
gPlayerState.field_0x3f = 0xfd; gPlayerState.spriteOffsetY = -3;
} }
if (--super->timer == 0) { if (--super->timer == 0) {
super->action = 4; super->action = 4;
@ -219,7 +219,7 @@ void LavaPlatform_Type1Action6(LavaPlatformEntity* this) {
if ((super->frame & ANIM_DONE) != 0) { if ((super->frame & ANIM_DONE) != 0) {
sub_0809264C(this); sub_0809264C(this);
if (tmp) { if (tmp) {
gPlayerState.field_0x3f = 0xfd; gPlayerState.spriteOffsetY = -3;
} }
} }
} }

View File

@ -69,7 +69,7 @@ void Object1F_Action1(Object1FEntity* this) {
if (this->unk6c) { if (this->unk6c) {
this->unk6c--; this->unk6c--;
uVar1 = gPlayerState.field_0x3c[1]; uVar1 = gPlayerState.moleMittsState;
} else { } else {
ProcessMovement2(super); ProcessMovement2(super);
uVar1 = GravityUpdate(super, Q_8_8(40.0)); uVar1 = GravityUpdate(super, Q_8_8(40.0));

View File

@ -61,7 +61,7 @@ void Whirlwind_Action1(Entity* this) {
} }
if (this->spriteSettings.draw != 0) { if (this->spriteSettings.draw != 0) {
GetNextFrame(this); GetNextFrame(this);
if ((((((gPlayerState.flags & PL_MINISH) == 0)) && (gPlayerState.field_0x3c[0] == 0)) && if ((((((gPlayerState.flags & PL_MINISH) == 0)) && (gPlayerState.field_0x3c == 0)) &&
((gPlayerEntity.action == 4 || ((gPlayerEntity.flags & ENT_COLLIDE) != 0)))) && ((gPlayerEntity.action == 4 || ((gPlayerEntity.flags & ENT_COLLIDE) != 0)))) &&
((gPlayerEntity.action != 6 && (sub_0800419C(this, &gPlayerEntity, 0xc, 0xc) != 0)))) { ((gPlayerEntity.action != 6 && (sub_0800419C(this, &gPlayerEntity, 0xc, 0xc) != 0)))) {
if (((gPlayerState.flags & PL_PARACHUTE) == 0) && (gPlayerEntity.action != 4)) { if (((gPlayerState.flags & PL_PARACHUTE) == 0) && (gPlayerEntity.action != 4)) {

View File

@ -1561,7 +1561,7 @@ static void sub_08071D04(Entity* this) {
if (deltaHealth != 0) { if (deltaHealth != 0) {
ModHealth(deltaHealth); ModHealth(deltaHealth);
this->subAction = 3; this->subAction = 3;
gPlayerState.field_0x3c[0] = 0; gPlayerState.field_0x3c = 0;
this->direction = 0xff; this->direction = 0xff;
this->speed = 0; this->speed = 0;
this->zVelocity = Q_16_16(1.5); this->zVelocity = Q_16_16(1.5);
@ -2749,7 +2749,7 @@ static void sub_08073504(Entity* this) {
static void sub_08073584(Entity* this) { static void sub_08073584(Entity* this) {
u32 state, dir, idx; u32 state, dir, idx;
if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c[0] || if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c ||
(gPlayerState.flags & PL_PARACHUTE) == 0) { (gPlayerState.flags & PL_PARACHUTE) == 0) {
gPlayerState.jump_status |= 0x40; gPlayerState.jump_status |= 0x40;
PlayerSetNormalAndCollide(); PlayerSetNormalAndCollide();
@ -3570,7 +3570,7 @@ void SurfaceAction_Swamp(Entity* this) {
gPlayerState.speed_modifier -= 0xf0; gPlayerState.speed_modifier -= 0xf0;
gPlayerState.framestate = 0x1b; gPlayerState.framestate = 0x1b;
if (gPlayerState.field_0x37 < 0xf0) { if (gPlayerState.field_0x37 < 0xf0) {
gPlayerState.field_0x3f = gPlayerState.field_0x3f + 4 + (gPlayerState.field_0x37 >> 5); gPlayerState.spriteOffsetY = gPlayerState.spriteOffsetY + 4 + (gPlayerState.field_0x37 >> 5);
return; return;
} }
} }
@ -3585,7 +3585,7 @@ void SurfaceAction_Swamp(Entity* this) {
void SurfaceAction_Water(Entity* this) { void SurfaceAction_Water(Entity* this) {
if (!sub_080741C4()) { if (!sub_080741C4()) {
if (gPlayerState.field_0x14 == 0) { if (gPlayerState.field_0x14 == 0) {
gPlayerState.field_0x3f += 2; gPlayerState.spriteOffsetY += 2;
} else { } else {
gPlayerState.swim_state = 0; gPlayerState.swim_state = 0;
this->spritePriority.b0 = 4; this->spritePriority.b0 = 4;
@ -3625,7 +3625,7 @@ static void sub_08074808(Entity* this) {
} }
void SurfaceAction_Button(Entity* this) { void SurfaceAction_Button(Entity* this) {
gPlayerState.field_0x3f -= 2; gPlayerState.spriteOffsetY -= 2;
} }
void sub_080748D4(void) { void sub_080748D4(void) {

View File

@ -53,7 +53,7 @@ void PlayerItemCellOverwriteSet(Entity* this) {
TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe],
player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]),
this->collisionLayer); this->collisionLayer);
gPlayerState.mobility &= 0x7f; gPlayerState.mobility &= ~0x80;
DeleteThisEntity(); DeleteThisEntity();
} }
if ((gInput.heldKeys & B_BUTTON) != 0) { if ((gInput.heldKeys & B_BUTTON) != 0) {

View File

@ -67,7 +67,7 @@ void OpenSmallChest(u32 pos, u32 layer) {
SetLocalFlag(t->localFlag); SetLocalFlag(t->localFlag);
CreateItemEntity(t->_2, t->_3, 0); CreateItemEntity(t->_2, t->_3, 0);
} else { } else {
CreateItemEntity(0x60, 0, 0); CreateItemEntity(ITEM_FAIRY, 0, 0);
} }
sub_0807B7D8(0x74, pos, layer); sub_0807B7D8(0x74, pos, layer);
RequestPriorityDuration(NULL, 120); RequestPriorityDuration(NULL, 120);

View File

@ -406,7 +406,7 @@ void ResetPlayerItem() {
index++; index++;
} while (index <= 2); } while (index <= 2);
gPlayerState.field_0x3c[1] = 0; gPlayerState.moleMittsState = 0;
gPlayerState.field_0x1c = 0; gPlayerState.field_0x1c = 0;
gPlayerState.field_0x1f[2] = 0; gPlayerState.field_0x1f[2] = 0;
gPlayerState.field_0x0[1] = 0; gPlayerState.field_0x0[1] = 0;
@ -1202,8 +1202,8 @@ void ClearPlayerState(void) {
gPlayerState.field_0x38 = 0; gPlayerState.field_0x38 = 0;
gPlayerState.field_0x39 = 0; gPlayerState.field_0x39 = 0;
gPlayerState.field_0x3a = 0; gPlayerState.field_0x3a = 0;
gPlayerState.field_0x3f = 0; gPlayerState.spriteOffsetY = 0;
gPlayerState.field_0x3c[0] = 0; gPlayerState.field_0x3c = 0;
MemFill32(0xffffffff, gPlayerState.path_memory, 0x40); MemFill32(0xffffffff, gPlayerState.path_memory, 0x40);
MemClear(&gUnk_03003DF0, 0x188); MemClear(&gUnk_03003DF0, 0x188);
} }
@ -1516,7 +1516,7 @@ ASM_FUNC("asm/non_matching/playerUtils/sub_08079550.inc", u32 sub_08079550(void)
void sub_08079708(Entity* this) { void sub_08079708(Entity* this) {
gPlayerState.framestate = 0x12; gPlayerState.framestate = 0x12;
gPlayerState.field_0x3c[0] = 0xff; gPlayerState.field_0x3c = 0xff;
this->flags &= ~ENT_COLLIDE; this->flags &= ~ENT_COLLIDE;
this->action = 0xa; this->action = 0xa;
this->subAction = 0; this->subAction = 0;
@ -1571,7 +1571,7 @@ void ResolvePlayerAnimation(void) {
if (gPlayerState.heldObject != 0) { if (gPlayerState.heldObject != 0) {
anim = 0x92c; anim = 0x92c;
} else { } else {
if ((gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) != 0) { if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) {
return; return;
} }
if ((gPlayerState.flags & PL_FLAGS2000000) != 0) { if ((gPlayerState.flags & PL_FLAGS2000000) != 0) {
@ -1614,7 +1614,7 @@ void ResolvePlayerAnimation(void) {
if (gPlayerState.heldObject != 0) { if (gPlayerState.heldObject != 0) {
anim = 0x350; anim = 0x350;
} else { } else {
if ((gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) != 0) { if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) {
return; return;
} }
if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) { if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) {
@ -1855,7 +1855,7 @@ bool32 PlayerCanBeMoved(void) {
if ((gPlayerState.flags & if ((gPlayerState.flags &
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS | (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS |
PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 || PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 ||
gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == PLAYER_FALL || gPlayerState.field_0x3c != 0 || gPlayerEntity.action == PLAYER_FALL ||
gPlayerEntity.action == PLAYER_08071DB8) { gPlayerEntity.action == PLAYER_08071DB8) {
return FALSE; return FALSE;
} else { } else {

View File

@ -98,7 +98,7 @@ void MandiblesProjectile_Action1(Entity* this) {
void MandiblesProjectile_Action2(Entity* this) { void MandiblesProjectile_Action2(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if ((this->frame & 0x40) != 0) { if ((this->frame & 0x40) != 0) {
this->frame &= 0xbf; this->frame &= ~0x40;
EnqueueSFX(SFX_15D); EnqueueSFX(SFX_15D);
} }
this->field_0x78.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); this->field_0x78.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI);

View File

@ -3644,7 +3644,7 @@ void sub_StateChange_DarkHyruleCastleOutside_ZeldaStatuePlatform(void) {
LoadRoomEntityList(&gUnk_080EADB8); LoadRoomEntityList(&gUnk_080EADB8);
SetTileType(0x4072, 0x145, 1); SetTileType(0x4072, 0x145, 1);
SetTileType(0x4072, 0x149, 1); SetTileType(0x4072, 0x149, 1);
gArea.queued_bgm = 0; gArea.queued_bgm = SFX_NONE;
} }
} }
@ -3689,7 +3689,7 @@ void sub_StateChange_DarkHyruleCastleOutside_Garden(void) {
if (!CheckLocalFlag(0x7f)) { if (!CheckLocalFlag(0x7f)) {
LoadRoomEntityList(&gUnk_080EAEC0); LoadRoomEntityList(&gUnk_080EAEC0);
SetLocalFlag(0x7f); SetLocalFlag(0x7f);
gArea.queued_bgm = 0x11; gArea.queued_bgm = BGM_BEAT_VAATI;
} else { } else {
LoadRoomEntityList(&gUnk_080EAF20); LoadRoomEntityList(&gUnk_080EAF20);
gArea.queued_bgm = gArea.bgm; gArea.queued_bgm = gArea.bgm;
@ -5785,9 +5785,9 @@ void sub_StateChange_HyruleField_OutsideCastle(void) {
} }
if (!CheckGlobalFlag(TABIDACHI)) { if (!CheckGlobalFlag(TABIDACHI)) {
#ifdef EU #ifdef EU
gArea.queued_bgm = 0x10; gArea.queued_bgm = BGM_FESTIVAL_APPROACH;
#else #else
gArea.queued_bgm = 0x13; gArea.queued_bgm = BGM_BEANSTALK;
#endif #endif
} }
} }