Merge pull request #536 from hatal175/various

This commit is contained in:
notyourav 2022-07-23 11:16:08 -07:00 committed by GitHub
commit ccba86d292
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 191 additions and 153 deletions

View File

@ -21,7 +21,7 @@ extern u32 sub_08002632(struct Entity_*);
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY); extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
extern u32 GravityUpdate(struct Entity_*, u32); extern u32 GravityUpdate(struct Entity_*, u32);
extern u32 CheckOnScreen(struct Entity_*); extern u32 CheckOnScreen(struct Entity_*);
extern u32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32); extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
extern void UpdateAnimationVariableFrames(struct Entity_*, u32); extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
extern u32 sub_080043E8(struct Entity_*); extern u32 sub_080043E8(struct Entity_*);
extern void sub_08004484(struct Entity_*, struct Entity_*); extern void sub_08004484(struct Entity_*, struct Entity_*);

View File

@ -154,7 +154,7 @@ enum PlayerItemId {
PL_ITEM_CELL_OVERWRITE_SET2, PL_ITEM_CELL_OVERWRITE_SET2,
}; };
enum SurfaceType { typedef enum {
SURFACE_NORMAL, SURFACE_NORMAL,
SURFACE_PIT, SURFACE_PIT,
SURFACE_2, SURFACE_2,
@ -200,7 +200,7 @@ enum SurfaceType {
SURFACE_AUTO_LADDER, SURFACE_AUTO_LADDER,
SURFACE_CLIMB_WALL, SURFACE_CLIMB_WALL,
SURFACE_2C, SURFACE_2C,
}; } SurfaceType;
typedef enum { typedef enum {
SKILL_NONE = 0, SKILL_NONE = 0,
@ -255,7 +255,8 @@ typedef struct {
/*0x1d*/ u8 gustJarSpeed; /*0x1d*/ u8 gustJarSpeed;
/*0x1e*/ u8 dash_state; /*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[3]; /*0x1f*/ u8 field_0x1f[3];
/*0x22*/ u16 field_0x22[2]; /*0x22*/ u16 tilePosition;
/*0x24*/ u16 tileType;
/*0x26*/ u8 swim_state; /*0x26*/ u8 swim_state;
/*0x27*/ u8 field_0x27[5]; /*0x27*/ u8 field_0x27[5];
/*0x2c*/ Entity* item; /*0x2c*/ Entity* item;
@ -376,7 +377,7 @@ void sub_08077728(u32);
void PutAwayItems(void); void PutAwayItems(void);
void sub_08079E58(s32 speed, u32 direction); void sub_08079E58(s32 speed, u32 direction);
void RespawnPlayer(void); void RespawnPlayer(void);
u32 GetSurfaceCalcType(Entity*, s32, s32); SurfaceType GetSurfaceCalcType(Entity*, s32, s32);
void UpdatePlayerMovement(void); void UpdatePlayerMovement(void);
void EnablePlayerDraw(Entity*); void EnablePlayerDraw(Entity*);
void sub_080797EC(void); void sub_080797EC(void);

View File

@ -67,7 +67,12 @@ void InitPlayerMacro(u32 param_1) {
ASM_FUNC("asm/non_matching/code_0805EC04/UpdatePlayerInput.inc", void UpdatePlayerInput()) ASM_FUNC("asm/non_matching/code_0805EC04/UpdatePlayerInput.inc", void UpdatePlayerInput())
u32 ConvInputToState(u32 keys) { u32 ConvInputToState(u32 keys) {
u32 result = (s32) - (keys & 0x200) >> 0x1f & 0x1000; u32 result;
if (keys & L_BUTTON) {
result = 0x1000;
} else {
result = 0;
}
if (keys & R_BUTTON) { if (keys & R_BUTTON) {
result |= 0x20; result |= 0x20;
result |= 0x8000; result |= 0x8000;

View File

@ -31,7 +31,7 @@ void sub_0803C624(BowMoblinEntity*);
void sub_0803C6DC(BowMoblinEntity*); void sub_0803C6DC(BowMoblinEntity*);
void sub_0803C714(BowMoblinEntity*); void sub_0803C714(BowMoblinEntity*);
void sub_0803C634(BowMoblinEntity*); void sub_0803C634(BowMoblinEntity*);
u32 sub_0803C6F8(BowMoblinEntity*); bool32 sub_0803C6F8(BowMoblinEntity*);
bool32 sub_0803C568(BowMoblinEntity*); bool32 sub_0803C568(BowMoblinEntity*);
void sub_0803C664(BowMoblinEntity*); void sub_0803C664(BowMoblinEntity*);
@ -111,7 +111,7 @@ void sub_0803C234(BowMoblinEntity* this) {
sub_0803C4B0(this); sub_0803C4B0(this);
} }
} else if (sub_0803C6F8(this) != 0) { } else if (sub_0803C6F8(this)) {
sub_0800417E(super, super->collisions); sub_0800417E(super, super->collisions);
super->animationState = ((super->direction + 4) & 0x18) >> 2; super->animationState = ((super->direction + 4) & 0x18) >> 2;
this->unk_0x83++; this->unk_0x83++;
@ -369,10 +369,8 @@ void sub_0803C6DC(BowMoblinEntity* this) {
GetNextFrame(super); GetNextFrame(super);
} }
u32 sub_0803C6F8(BowMoblinEntity* this) { bool32 sub_0803C6F8(BowMoblinEntity* this) {
u32 tmp = (super->collisions & gUnk_080CFFBC[(super->animationState ^ 1) / 2]); return (super->collisions & gUnk_080CFFBC[(super->animationState ^ 1) / 2]) != 0;
u32 tmp2 = -tmp;
return (tmp2 | tmp) >> 0x1f;
} }
void sub_0803C714(BowMoblinEntity* this) { void sub_0803C714(BowMoblinEntity* this) {

View File

@ -370,7 +370,7 @@ void sub_08031024(EyegoreEntity* this) {
gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI); gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI);
} else { } else {
this->unk_79 = 1; this->unk_79 = 1;
this->unk_78 = (boolresult >> 0x1f); this->unk_78 = boolresult != 0;
super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_74, this->unk_76); super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_74, this->unk_76);
} }
} else { } else {

View File

@ -342,7 +342,12 @@ void sub_08067C44(Entity* this) {
s32 iVar4; s32 iVar4;
u32 uVar5; u32 uVar5;
uVar5 = -((s32) - (gPlayerState.flags & PL_MINISH) >> 0x1f); if ((gPlayerState.flags & PL_MINISH) != 0) {
uVar5 = TRUE;
} else {
uVar5 = FALSE;
}
if (uVar5 != this->field_0x68.HALF.HI) { if (uVar5 != this->field_0x68.HALF.HI) {
if (uVar5 == 0) { if (uVar5 == 0) {
sub_08078778(this); sub_08078778(this);

View File

@ -200,8 +200,12 @@ void Cow_ShowDialogue(Entity* ent) {
} }
void sub_0806920C(Entity* ent) { void sub_0806920C(Entity* ent) {
u32 var0 = gPlayerState.flags & PL_MINISH; u32 var1;
u32 var1 = -var0 >> 0x1F; if ((gPlayerState.flags & PL_MINISH) != 0) {
var1 = TRUE;
} else {
var1 = FALSE;
}
if (var1 != ent->field_0x6c.HALF.HI) { if (var1 != ent->field_0x6c.HALF.HI) {
if (var1 == 0) { if (var1 == 0) {

View File

@ -9,7 +9,7 @@ void sub_08069FE8(Entity*);
u32 sub_08069EF0(Entity*); u32 sub_08069EF0(Entity*);
extern u8 gUnk_08111DA8[]; extern u8 gUnk_08111DA8[];
u32 sub_08069F90(Entity*); bool32 sub_08069F90(Entity*);
void sub_08069F6C(Entity*); void sub_08069F6C(Entity*);
void sub_08069D00(Entity*); void sub_08069D00(Entity*);
void sub_08069CB8(Entity*); void sub_08069CB8(Entity*);
@ -24,9 +24,9 @@ extern u8 gUnk_08111E30[];
void sub_0806A080(Entity*); void sub_0806A080(Entity*);
extern Dialog gUnk_08111E34[]; extern Dialog gUnk_08111E34[][10];
extern u16 gUnk_08111F74[]; extern u16 gUnk_08111F74[][5];
extern u16 gUnk_08111FD8[]; extern u16 gUnk_08111FD8[];
@ -71,11 +71,7 @@ void sub_08069B44(Entity* this) {
(GetInventoryValue(ITEM_QST_DOGFOOD) != 2)) { (GetInventoryValue(ITEM_QST_DOGFOOD) != 2)) {
this->action = 4; this->action = 4;
} }
#if defined(JP) || defined(EU) || defined(DEMO_JP) if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
if ((this->type == 2) && (CheckLocalFlag(0xcc) == 0)) {
#else
if ((this->type == 2) && (CheckLocalFlag(0xcf) == 0)) {
#endif
SetTile(0x4072, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer); SetTile(0x4072, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer);
} }
} }
@ -83,7 +79,7 @@ void sub_08069B44(Entity* this) {
void sub_08069C40(Entity* this) { void sub_08069C40(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (sub_08069F90(this) != 0) { if (sub_08069F90(this)) {
if ((gPlayerState.flags & PL_MINISH) != 0) { if ((gPlayerState.flags & PL_MINISH) != 0) {
sub_08069CB8(this); sub_08069CB8(this);
} else { } else {
@ -135,7 +131,7 @@ void sub_08069D00(Entity* this) {
void sub_08069D54(Entity* this) { void sub_08069D54(Entity* this) {
u16 collisions; u16 collisions;
if (sub_08069F90(this) == 0) { if (!sub_08069F90(this)) {
this->timer -= 1; this->timer -= 1;
if (this->timer != 0) { if (this->timer != 0) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
@ -161,7 +157,7 @@ void sub_08069D54(Entity* this) {
return; return;
} }
} }
if (sub_08069F90(this) != 0) { if (sub_08069F90(this)) {
this->action = 1; this->action = 1;
} else { } else {
this->action = 3; this->action = 3;
@ -171,7 +167,7 @@ void sub_08069D54(Entity* this) {
void sub_08069DF8(Entity* this) { void sub_08069DF8(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (sub_08069F90(this) != 0) { if (sub_08069F90(this)) {
this->action = 1; this->action = 1;
} else { } else {
this->timer -= 1; this->timer -= 1;
@ -211,8 +207,8 @@ void sub_08069E50(Entity* this) {
this->action = 7; this->action = 7;
InitAnimationForceUpdate(this, 0x29); InitAnimationForceUpdate(this, 0x29);
sub_080788E0(this); sub_080788E0(this);
EnqueueSFX(0xd1); EnqueueSFX(SFX_VO_DOG);
EnqueueSFX(0xcd); EnqueueSFX(SFX_TASK_COMPLETE);
} }
} }
@ -249,9 +245,9 @@ u32 sub_08069EF0(Entity* this) {
void Dog_Head(Entity* this) { void Dog_Head(Entity* this) {
u32 frame; u32 frame;
frame = this->frame & 0xffffff7f; frame = this->frame & ~ANIM_DONE;
if (frame != 0) { if (frame != 0) {
frame = frame + this->field_0x68.HWORD; frame += this->field_0x68.HWORD;
} }
SetExtraSpriteFrame(this, 0, frame - 1); SetExtraSpriteFrame(this, 0, frame - 1);
SetExtraSpriteFrame(this, 1, this->frameIndex); SetExtraSpriteFrame(this, 1, this->frameIndex);
@ -266,9 +262,9 @@ void sub_08069F6C(Entity* this) {
} }
} }
u32 sub_08069F90(Entity* this) { bool32 sub_08069F90(Entity* this) {
if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
return 1; return TRUE;
} else { } else {
return EntityInRectRadius(this, &gPlayerEntity, 0x14, 0x14); return EntityInRectRadius(this, &gPlayerEntity, 0x14, 0x14);
} }
@ -282,7 +278,13 @@ void sub_08069FBC(Entity* this) {
} }
void sub_08069FE8(Entity* this) { void sub_08069FE8(Entity* this) {
u32 tmp = -((s32) - (gPlayerState.flags & PL_MINISH) >> 0x1f); u32 tmp;
if ((gPlayerState.flags & PL_MINISH) != 0) {
tmp = TRUE;
} else {
tmp = FALSE;
}
if (tmp != this->field_0x6a.HALF.LO) { if (tmp != this->field_0x6a.HALF.LO) {
if (tmp == 0) { if (tmp == 0) {
sub_08078778(this); sub_08078778(this);
@ -313,7 +315,7 @@ void sub_0806A028(Entity* this) {
} }
void sub_0806A080(Entity* this) { void sub_0806A080(Entity* this) {
ShowNPCDialogue(this, (Dialog*)&gUnk_08111E34 + this->type2 * 10 + gSave.global_progress); ShowNPCDialogue(this, &(gUnk_08111E34[this->type2][gSave.global_progress]));
} }
void sub_0806A0A4(Entity* this) { void sub_0806A0A4(Entity* this) {
@ -336,7 +338,7 @@ void sub_0806A0A4(Entity* this) {
} }
} }
} }
MessageNoOverlap(gUnk_08111F74[(u32)gSave.global_progress * 5 + dialog], this); MessageNoOverlap(gUnk_08111F74[gSave.global_progress][dialog], this);
} }
void sub_0806A144(Entity* this) { void sub_0806A144(Entity* this) {

View File

@ -65,7 +65,12 @@ void sub_08065A50(Entity* this) {
void sub_08065A64(Entity* this) { void sub_08065A64(Entity* this) {
u32 uVar2; u32 uVar2;
uVar2 = -(gPlayerState.flags & PL_MINISH) >> 0x1f; if ((gPlayerState.flags & PL_MINISH) != 0) {
uVar2 = TRUE;
} else {
uVar2 = FALSE;
}
if (uVar2 != this->field_0x68.HALF.HI) { if (uVar2 != this->field_0x68.HALF.HI) {
if (uVar2 == 0) { if (uVar2 == 0) {
sub_08078778(this); sub_08078778(this);

View File

@ -148,7 +148,7 @@ void sub_08060528(Entity* this) {
this->zVelocity = Q_16_16(2.0); this->zVelocity = Q_16_16(2.0);
this->field_0x6c.HALF.HI = 1; this->field_0x6c.HALF.HI = 1;
sub_080788E0(this); sub_080788E0(this);
EnqueueSFX(0x7c); EnqueueSFX(SFX_PLY_JUMP);
} else { } else {
this->field_0x6a.HWORD -= 1; this->field_0x6a.HWORD -= 1;
} }

View File

@ -141,7 +141,11 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) {
iVar3 = GetInventoryValue(ITEM_MAGIC_BOOMERANG); iVar3 = GetInventoryValue(ITEM_MAGIC_BOOMERANG);
uVar5 = 2; uVar5 = 2;
if (iVar3 == 0) { if (iVar3 == 0) {
uVar5 = (-bVar2 | bVar2) >> 0x1f; if (bVar2) {
uVar5 = 1;
} else {
uVar5 = 0;
}
} }
} }
iVar4 = 0xffffffff; iVar4 = 0xffffffff;

View File

@ -307,7 +307,14 @@ void sub_080842D8(ChestSpawnerEntity* this) {
gUnk_0811F880, gUnk_0811F880,
gUnk_0811F88A, gUnk_0811F88A,
}; };
s32 index = -(-(super->x.HALF.HI & 8) >> 0x1f); s32 index;
if ((super->x.HALF.HI & 8) != 0) {
index = 1;
} else {
index = 0;
}
if ((super->y.HALF.HI & 8) != 0) { if ((super->y.HALF.HI & 8) != 0) {
index += 2; index += 2;
} }

View File

@ -20,7 +20,7 @@ void sub_08093ED0(Object64Entity*);
void sub_08093EF0(Object64Entity*); void sub_08093EF0(Object64Entity*);
typedef struct { typedef struct {
u16 unk_0; u16 sfx;
u8 unk_2; u8 unk_2;
u8 unk_3; u8 unk_3;
} struct_08122950; } struct_08122950;
@ -40,7 +40,7 @@ void Object64(Object64Entity* this) {
} }
void sub_08093E3C(Object64Entity* this) { void sub_08093E3C(Object64Entity* this) {
const u16* ptr; const struct_08122950* ptr;
super->action = 1; super->action = 1;
super->flags &= 0x7f; super->flags &= 0x7f;
super->spriteSettings.draw = 1; super->spriteSettings.draw = 1;
@ -48,9 +48,9 @@ void sub_08093E3C(Object64Entity* this) {
ResolveCollisionLayer(super); ResolveCollisionLayer(super);
} }
InitializeAnimation(super, super->type); InitializeAnimation(super, super->type);
ptr = &gUnk_08122950[super->type].unk_0; ptr = &gUnk_08122950[super->type];
if ((ptr[0] != 0) && ((super->type2 & 0x40) == 0)) { if ((ptr->sfx != SFX_NONE) && ((super->type2 & 0x40) == 0)) {
EnqueueSFX(ptr[0]); EnqueueSFX(ptr->sfx);
} }
if ((super->type2 & 0x20) != 0) { if ((super->type2 & 0x20) != 0) {
super->spriteRendering.b3 = 1; super->spriteRendering.b3 = 1;

View File

@ -14,104 +14,104 @@ typedef struct {
u8 unk_00 : 4; u8 unk_00 : 4;
u8 unk_00_4 : 4; u8 unk_00_4 : 4;
u8 unk_01; u8 unk_01;
u16 unk_02; u16 sfx;
} struct_0811F960; } struct_0811F960;
// way more legible like this than if clang-format were to put multiple elements on each line // way more legible like this than if clang-format were to put multiple elements on each line
// clang-format off // clang-format off
const struct_0811F960 gUnk_0811F960[] = { const struct_0811F960 gUnk_0811F960[] = {
{0x1, 0x0, 0x00, 0x12D}, {0x1, 0x0, 0x00, SFX_12D},
{0x0, 0x0, 0x00, 0x0FD}, {0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x0, 0x00, 0x124}, {0x0, 0x0, 0x00, SFX_124},
{0x0, 0x1, 0x11, 0x123}, {0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x12, 0x164}, {0x0, 0x1, 0x12, SFX_164},
{0x0, 0x1, 0x13, 0x10D}, {0x0, 0x1, 0x13, SFX_10D},
{0x0, 0x0, 0x00, 0x0FF}, {0x0, 0x0, 0x00, SFX_FF},
{0x5, 0x1, 0x00, 0x000}, {0x5, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x2, 0x1, 0x00, 0x084}, {0x2, 0x1, 0x00, SFX_WATER_SPLASH},
{0x2, 0x1, 0x00, 0x084}, {0x2, 0x1, 0x00, SFX_WATER_SPLASH},
{0x0, 0x0, 0x00, 0x195}, {0x0, 0x0, 0x00, SFX_195},
{0x0, 0x0, 0x00, 0x164}, {0x0, 0x0, 0x00, SFX_164},
{0x0, 0x0, 0x00, 0x10D}, {0x0, 0x0, 0x00, SFX_10D},
{0x0, 0x1, 0x00, 0x074}, {0x0, 0x1, 0x00, SFX_METAL_CLINK},
{0x0, 0x0, 0x00, 0x10C}, {0x0, 0x0, 0x00, SFX_BUTTON_PRESS},
{0x5, 0x0, 0x00, 0x000}, {0x5, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x10, 0x123}, {0x0, 0x0, 0x10, SFX_123},
{0x5, 0x1, 0x00, 0x000}, {0x5, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x164}, {0x0, 0x0, 0x00, SFX_164},
{0x0, 0x1, 0x14, 0x1A8}, {0x0, 0x1, 0x14, SFX_1A8},
{0x0, 0x1, 0x10, 0x088}, {0x0, 0x1, 0x10, SFX_88},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x3, 0x0, 0x00, 0x197}, {0x3, 0x0, 0x00, SFX_197},
{0x3, 0x0, 0x00, 0x000}, {0x3, 0x0, 0x00, SFX_NONE},
{0x6, 0x1, 0x00, 0x074}, {0x6, 0x1, 0x00, SFX_METAL_CLINK},
{0x3, 0x0, 0x00, 0x074}, {0x3, 0x0, 0x00, SFX_METAL_CLINK},
{0x0, 0x0, 0x00, 0x074}, {0x0, 0x0, 0x00, SFX_METAL_CLINK},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x7, 0x0, 0x00, 0x000}, {0x7, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x3, 0x1, 0x00, 0x000}, {0x3, 0x1, 0x00, SFX_NONE},
{0x8, 0x1, 0x00, 0x000}, {0x8, 0x1, 0x00, SFX_NONE},
{0x9, 0x1, 0x00, 0x15F}, {0x9, 0x1, 0x00, SFX_15F},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x2, 0x1, 0x00, 0x084}, {0x2, 0x1, 0x00, SFX_WATER_SPLASH},
{0x0, 0x0, 0x00, 0x074}, {0x0, 0x0, 0x00, SFX_METAL_CLINK},
{0x0, 0x0, 0x00, 0x164}, {0x0, 0x0, 0x00, SFX_164},
{0xA, 0x1, 0x00, 0x000}, {0xA, 0x1, 0x00, SFX_NONE},
{0xA, 0x1, 0x00, 0x000}, {0xA, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x9, 0x1, 0x00, 0x15F}, {0x9, 0x1, 0x00, SFX_15F},
{0x9, 0x1, 0x00, 0x15F}, {0x9, 0x1, 0x00, SFX_15F},
{0x9, 0x1, 0x00, 0x15F}, {0x9, 0x1, 0x00, SFX_15F},
{0x0, 0x0, 0x00, 0x000}, {0x0, 0x0, 0x00, SFX_NONE},
{0x2, 0x0, 0x00, 0x17F}, {0x2, 0x0, 0x00, SFX_LAVA_TILE_LAND},
{0x0, 0x1, 0x11, 0x123}, {0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x11, 0x123}, {0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x11, 0x123}, {0x0, 0x1, 0x11, SFX_123},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x1B4}, {0x0, 0x1, 0x00, SFX_1B4},
{0x0, 0x1, 0x13, 0x164}, {0x0, 0x1, 0x13, SFX_164},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x10, 0x088}, {0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, 0x088}, {0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, 0x088}, {0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x11D}, {0x0, 0x0, 0x00, SFX_11D},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, 0x164}, {0x0, 0x0, 0x00, SFX_164},
{0x0, 0x0, 0x00, 0x0FD}, {0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x0, 0x00, 0x0FD}, {0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x0, 0x00, 0x0FD}, {0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0xB, 0x1, 0x00, 0x000}, {0xB, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x000}, {0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, 0x0FD}, {0x0, 0x1, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0x2, 0x1, 0x00, 0x084}, {0x2, 0x1, 0x00, SFX_WATER_SPLASH},
#ifndef EU #ifndef EU
{0x0, 0x0, 0x18, 0x124}, {0x0, 0x0, 0x18, SFX_124},
#else #else
{0x0, 0x0, 0x16, 0x124}, {0x0, 0x0, 0x16, SFX_124},
#endif #endif
{0xC, 0x0, 0x00, 0x124}, {0xC, 0x0, 0x00, SFX_124},
{0x0, 0x0, 0x00, 0x0FD}, {0x0, 0x0, 0x00, SFX_ITEM_BOMB_EXPLODE},
{0xD, 0x1, 0x00, 0x000}, {0xD, 0x1, 0x00, SFX_NONE},
{0xD, 0x1, 0x00, 0x000}, {0xD, 0x1, 0x00, SFX_NONE},
}; };
// clang-format on // clang-format on
@ -166,8 +166,8 @@ void sub_080844E0(SpecialFxObject* this) {
if (ptr->unk_00 == 6) { if (ptr->unk_00 == 6) {
super->speed = 0x40; super->speed = 0x40;
} }
if (ptr->unk_02 && !(super->type2 & 0x40)) { if (ptr->sfx != SFX_NONE && !(super->type2 & 0x40)) {
EnqueueSFX(ptr->unk_02); EnqueueSFX(ptr->sfx);
} }
if (super->type2 & 0x80) { if (super->type2 & 0x80) {
CreateRandomItemDrop(super, ptr->unk_01); CreateRandomItemDrop(super, ptr->unk_01);

View File

@ -3705,7 +3705,7 @@ void SurfaceAction_20(Entity* this) {
if (e != NULL) { if (e != NULL) {
e->timer = 1; e->timer = 1;
UpdateSpriteForCollisionLayer(e); UpdateSpriteForCollisionLayer(e);
CloneTile(57, gPlayerState.field_0x22[0], this->collisionLayer); CloneTile(57, gPlayerState.tilePosition, this->collisionLayer);
} }
} }
SurfaceAction_Water(this); SurfaceAction_Water(this);

View File

@ -149,7 +149,11 @@ void sub_0801B680(Entity* this) {
if (sub_0801B864(this)) { if (sub_0801B864(this)) {
uvar1 = this->field_0x68.HALF.LO; uvar1 = this->field_0x68.HALF.LO;
uvar1 ^= 0xc; uvar1 ^= 0xc;
uVar6 = ((u32)(-uvar1 | uvar1)) >> 0x1f; if (uvar1) {
uVar6 = TRUE;
} else {
uVar6 = FALSE;
}
} }
if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) { if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) {

View File

@ -356,8 +356,8 @@ NONMATCH("asm/non_matching/playerItemSword/sub_080A7A84.inc", void sub_080A7A84(
if (super->type != 0) { if (super->type != 0) {
sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + uVar4); sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + uVar4);
} else { } else {
if ((((super->z.WORD == 0) && (sub_08008796(super, ((u32) - (gPlayerState.skills & 8)) >> 0x1f, if ((((super->z.WORD == 0) && (sub_08008796(super, (gPlayerState.skills & 8) != 0, super->x.HALF.HI + uVar3,
super->x.HALF.HI + uVar3, super->y.HALF.HI + uVar4) == NULL)) && super->y.HALF.HI + uVar4) == NULL)) &&
(gPlayerState.sword_state != 0)) && (gPlayerState.sword_state != 0)) &&
((gPlayerState.sword_state & 0xc0) == 0)) { ((gPlayerState.sword_state & 0xc0) == 0)) {
if (GetRelativeCollisionTile(super, uVar3, uVar4) == 0x2e) { if (GetRelativeCollisionTile(super, uVar3, uVar4) == 0x2e) {

View File

@ -56,7 +56,7 @@ void* sub_08077C54(ItemBehavior*);
u32 sub_08079FD4(Entity*, u32); u32 sub_08079FD4(Entity*, u32);
void LoadRoomGfx(void); void LoadRoomGfx(void);
u32 sub_0807A094(u32); u32 sub_0807A094(u32);
u32 GetSurfaceCalcType(Entity*, s32, s32); SurfaceType GetSurfaceCalcType(Entity*, s32, s32);
void sub_0807AAF8(Entity*, u32); void sub_0807AAF8(Entity*, u32);
extern struct_0811BE48 gUnk_0811BE48[]; extern struct_0811BE48 gUnk_0811BE48[];
@ -243,7 +243,7 @@ bool32 sub_080777A0(void) {
return FALSE; return FALSE;
default: default:
if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) && if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) &&
(gPlayerState.floor_type != 0x11)) && (gPlayerState.floor_type != SURFACE_SWAMP)) &&
((((gPlayerState.field_0x90 & 0xf00) != 0 && ((((gPlayerState.field_0x90 & 0xf00) != 0 &&
((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) && ((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) &&
((gPlayerState.jump_status == 0 && (gPlayerState.field_0x3[1] == 0)))))) { ((gPlayerState.jump_status == 0 && (gPlayerState.field_0x3[1] == 0)))))) {
@ -1192,8 +1192,8 @@ void ClearPlayerState(void) {
gPlayerState.field_0x1f[0] = 0; gPlayerState.field_0x1f[0] = 0;
gPlayerState.field_0x1f[1] = 0; gPlayerState.field_0x1f[1] = 0;
gPlayerState.field_0x1f[2] = 0; gPlayerState.field_0x1f[2] = 0;
gPlayerState.field_0x22[0] = 0; gPlayerState.tilePosition = 0;
gPlayerState.field_0x22[1] = 0; gPlayerState.tileType = 0;
gPlayerState.swim_state = 0; gPlayerState.swim_state = 0;
gPlayerState.item = NULL; gPlayerState.item = NULL;
gPlayerState.speed_modifier = 0; gPlayerState.speed_modifier = 0;
@ -1863,15 +1863,15 @@ void UpdateFloorType(void) {
gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity); gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity);
} }
u32 GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) { SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
u32 position = TILE(param_1->x.HALF.HI + (u32)x, param_1->y.HALF.HI + y); u32 position = TILE(param_1->x.HALF.HI + (u32)x, param_1->y.HALF.HI + y);
u32 tileType = GetTileTypeByPos(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.collisionLayer); u32 tileType = GetTileTypeByPos(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.collisionLayer);
if (tileType != gPlayerState.field_0x22[1]) { if (tileType != gPlayerState.tileType) {
gPlayerState.field_0x37 = 0; gPlayerState.field_0x37 = 0;
} }
if ((tileType != gPlayerState.field_0x22[1]) || (position != gPlayerState.field_0x22[0])) { if ((tileType != gPlayerState.tileType) || (position != gPlayerState.tilePosition)) {
gPlayerState.field_0x22[0] = position; gPlayerState.tilePosition = position;
gPlayerState.field_0x22[1] = tileType; gPlayerState.tileType = tileType;
gPlayerState.field_0x11 = 0; gPlayerState.field_0x11 = 0;
} }

View File

@ -201,8 +201,11 @@ u32 GetCharacter(Token* token) {
case 0x14: case 0x14:
case 0x15: case 0x15:
code = 0xb; code = 0xb;
// This is a comparison to 0 but couldn't make it do the bit trick if ((uVar6 ^ 0x14) != 0) {
uVar6 = (-(uVar6 ^ 0x14) | (uVar6 ^ 0x14)) >> 0x1f; uVar6 = 1;
} else {
uVar6 = 0;
}
} }
token->param = (u16)uVar6; token->param = (u16)uVar6;
break; break;