Merge pull request #630 from Reinmmar/MissingPlayerStateFlags

A bunch of flags and animations
This commit is contained in:
notyourav 2023-09-20 13:12:56 -04:00 committed by GitHub
commit 755f26dc72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
94 changed files with 838 additions and 630 deletions

View File

@ -3,7 +3,7 @@ SCRIPT_START script_PlayerGetSword
SetInventoryValue ITEM_SMITH_SWORD, 0x0001
CallWithArg PutItemAnySlot, ITEM_SMITH_SWORD
PlaySound SFX_ITEM_GET
CallWithArg SetPlayerAnimation2, 0x0000045f
CallWithArg SetPlayerAnimation2, ANIM_GET_ITEM_SWORD
Call WaitForPlayerAnim
MessageFromTargetPos TEXT_ITEM_GET, 0x01, 0x000e
WaitUntilTextboxCloses

View File

@ -2,7 +2,7 @@
SCRIPT_START script_PlayerGetGreenCap
BeginBlock
Call sub_08094BE0
CallWithArg SetPlayerAnimation2, 0x0000045b
CallWithArg SetPlayerAnimation2, ANIM_GET_ITEM_BIG_NOCAP
PlaySound SFX_ITEM_GET
EndBlock
Call WaitForPlayerAnim
@ -10,7 +10,7 @@ SCRIPT_START script_PlayerGetGreenCap
SetSyncFlag 0x00000008
BeginBlock
CallWithArg ResetPlayerFlag, PL_NO_CAP
CallWithArg SetPlayerAnimation2, 0x000008e4
CallWithArg SetPlayerAnimation2, ANIM_GET_NEWCAP
EndBlock
Call WaitForPlayerAnim
SetAnimationState 0x0004

View File

@ -7,11 +7,11 @@ SCRIPT_START script_PlayerAtTakeover
_0807EDD4 0x0168, 0x0058
SetAnimationState 0x0004
DoPostScriptAction 0x0000
CallWithArg SetPlayerAnimation2, 0x000003c5
CallWithArg SetPlayerAnimation2, ANIM_EZLO_SEARCH
Call WaitForPlayerAnim
MessageFromTargetPos TEXT_VAATI, 0x18, 0x000c
WaitUntilTextboxCloses
CallWithArg SetPlayerAnimation2, 0x000003c9
CallWithArg SetPlayerAnimation2, ANIM_EZLO_LEAVE_LEFT
Call WaitForPlayerAnim
SetAnimationState 0x0004
DoPostScriptAction 0x0000

View File

@ -3,7 +3,7 @@ SCRIPT_START script_PlayerStonesFall
EndBlock
SetAnimationState 0x0004
DoPostScriptAction 0x0000
CallWithArg SetPlayerAnimation2, 0x000003c5
CallWithArg SetPlayerAnimation2, ANIM_EZLO_SEARCH
Call WaitForPlayerAnim
SetSyncFlag 0x00000004
Call SetPlayerActionNormal

View File

@ -3,7 +3,7 @@ SCRIPT_START script_PlayerGetWhiteSword
SetInventoryValue ITEM_GREEN_SWORD, 0x0001
CallWithArg PutItemAnySlot, ITEM_GREEN_SWORD
PlaySound SFX_ITEM_GET
CallWithArg SetPlayerAnimation2, 0x000001e2
CallWithArg SetPlayerAnimation2, ANIM_GET_WHITE_SWORD
Call WaitForPlayerAnim
MessageNoOverlap TEXT_ITEM_GET, 0x02
WaitUntilTextboxCloses

View File

@ -2,7 +2,7 @@
SCRIPT_START script_PlayerPickUpFinalSword
CallWithArg sub_08095E7C, script_CutsceneMiscObjectSwordCharge11
PlaySound SFX_1D3
CallWithArg SetPlayerAnimation2, 0x000008e3
CallWithArg SetPlayerAnimation2, ANIM_GET_LAST_SWORD
Call sub_08096028
Wait 0x0078
SetSyncFlag 0x00020000

View File

@ -1,7 +1,7 @@
@ Player at Sanctuary pick up sword
SCRIPT_START script_PlayerPickUpSword
PlaySound SFX_1D3
CallWithArg SetPlayerAnimation2, 0x000008bf
CallWithArg SetPlayerAnimation2, ANIM_GET_NEW_SWORD
Call sub_08096028
Wait 0x003c
SetSyncFlag 0x00020000

View File

@ -14,7 +14,7 @@ SCRIPT_START script_08016482
DisablePlayerControl
SetPlayerAction 0x00005408
StartPlayerScript script_08016384
SetPlayerAnimation 0x03a0
SetPlayerAnimation ANIM_FALL_ON_BACK
_0807E8E4_0
_0807E8E4_1
_0807E8E4_2

View File

@ -6,6 +6,16 @@
#define MAX_ROOMS 64
typedef enum {
PT_TREESTUMP,
PT_ROCK,
PT_2,
PT_DUNGEON,
PT_JAR,
PT_5,
PT_TOD,
} PortalTypes;
typedef struct {
u16 pixel_width;
u16 pixel_height;

View File

@ -95,6 +95,12 @@ typedef enum {
CONTROL_DISABLED,
} PlayerControlMode;
typedef enum {
DIR_DIAGONAL = 0x4,
DIR_NOT_MOVING_CHECK = 0x80,
DIR_NONE = 0xff,
} PlayerDirections;
typedef enum {
PL_BUSY = 0x1,
PL_FLAGS2 = 0x2,
@ -125,6 +131,8 @@ typedef enum {
PL_SWORD_THRUST = 0x8000000,
PL_USE_OCARINA = 0x10000000,
PL_CLIMBING = 0x20000000,
PL_FLAGS40000000 = 0x40000000,
PL_FLAGS80000000 = 0x80000000,
} PlayerFlags;
enum PlayerItemId {
@ -274,6 +282,167 @@ typedef enum {
SWORD_MOVE_LOW_BEAM,
} SwordMove;
typedef enum {
ANIM_DEFAULT = 0x100,
ANIM_WALK = 0x104,
ANIM_SWORD = 0x108,
ANIM_BOUNCE = 0x114,
ANIM_SPINATTACK = 0x124,
ANIM_GREATSPIN = 0x128,
ANIM_ROLLATTACK_SPIN = 0x12c,
ANIM_ROLLATTACK_SLIDE = 0x130,
ANIM_ROLLATTACK_END = 0x134,
ANIM_SHIELD_PULLOUT = 0x158,
ANIM_SHIELD_WALK = 0x160,
ANIM_SHIELD = 0x164,
ANIM_SWORD_CHARGE = 0x168,
ANIM_SWORD_CHARGE_WALK = 0x16c,
ANIM_SWORD_CHARGE_BUMP = 0x170,
ANIM_DOWN_THRUST = 0x174,
ANIM_FALL = 0x1b8,
ANIM_GET_ITEM_BIG = 0x1b9,
ANIM_FALL_MINISH = 0x1ba,
ANIM_DIE1 = 0x1bc,
ANIM_GET_WHITE_SWORD = 0x1e2,
ANIM_BOW_PULLOUT = 0x21c,
ANIM_TRAPPED = 0x25c,
ANIM_BOW_SHOOT = 0x27c,
ANIM_BOW_CHARGE = 0x280,
ANIM_BOW_WALK = 0x284,
ANIM_ROCS_CAPE = 0x288,
ANIM_SWIM_STILL = 0x28c,
ANIM_SWIM_MOVE = 0x290,
ANIM_FROZEN = 0x294,
ANIM_DASH = 0x298,
ANIM_ELECTROCUTED = 0x29c,
ANIM_ROLL = 0x2ac,
ANIM_DIE2 = 0x2bd,
ANIM_DIVE = 0x2be,
ANIM_IN_LAVA = 0x2c1,
ANIM_PORTAL = 0x2c2,
ANIM_PORTAL_SHRINK = 0x2c3,
ANIM_DROWN_RESPAWN = 0x2ce,
ANIM_CLIMB1_UP = 0x2cf,
ANIM_CLIMB2_UP = 0x2d0,
ANIM_CLIMB1_DOWN = 0x2d1,
ANIM_CLIMB2_DOWN = 0x2d2,
ANIM_CLIMB_FROM_TOP = 0x2d3,
ANIM_CLIMB_LEFT = 0x2d4,
ANIM_CLIMB_RIGHT = 0x2d5,
ANIM_CLIMB_TO_TOP = 0x2d6,
ANIM_BOTTLE_DRINK = 0x2df,
ANIM_GET_ITEM_SMALL = 0x2e0,
ANIM_PICKUP = 0x338,
ANIM_PUSH = 0x33c,
ANIM_PULL = 0x340,
ANIM_THROW = 0x344,
ANIM_CARRY = 0x348,
ANIM_PULL2 = 0x34c,
ANIM_CARRY_STAND = 0x350,
ANIM_GRAB = 0x378,
ANIM_FALL_ON_BACK = 0x3a0,
ANIM_LAUNCHED = 0x3c0,
ANIM_EZLO_SEARCH = 0x3c5,
ANIM_EZLO_APPEAR_LEFT = 0x3c6,
ANIM_EZLO_EYES_UP = 0x3c7,
ANIM_EZLO_HEAD_DOWN = 0x3c8,
ANIM_EZLO_LEAVE_LEFT = 0x3c9,
ANIM_EZLO_APPEAR_RIGHT = 0x3ca,
ANIM_EZLO_EYES_MIDDLE = 0x3cc,
ANIM_EZLO_LEAVE_RIGHT = 0x3cd,
ANIM_DEFAULT_NOCAP = 0x400,
ANIM_WALK_NOCAP = 0x404,
ANIM_SWORD_NOCAP = 0x408,
ANIM_SHIELD_PULLOUT_NOCAP = 0x40c,
ANIM_SHIELD_WALK_NOCAP = 0x410,
ANIM_SHIELD_NOCAP = 0x414,
ANIM_BOUNCE_NOCAP = 0x418,
ANIM_HOP_NOCAP = 0x41c,
ANIM_JUMP_NOCAP = 0x420,
ANIM_LAND_NOCAP = 0x424,
ANIM_ROLL_NOCAP = 0x438,
ANIM_DROWN_NOCAP = 0x44c,
ANIM_FALL_NOCAP = 0x458,
ANIM_DIE1_NOCAP = 0x459,
ANIM_DIE2_NOCAP = 0x45a,
ANIM_GET_ITEM_BIG_NOCAP = 0x45b,
ANIM_GET_ITEM_SMALL_NOCAP = 0x45e,
ANIM_GET_ITEM_SWORD = 0x45f,
ANIM_GUSTJAR_PULLOUT = 0x500,
ANIM_GUSTJAR_SUCK = 0x504,
ANIM_MOLEMITTS_FLOOR = 0x508,
ANIM_MOLEMITTS_DIG = 0x50c,
ANIM_GUSTJAR_END = 0x510,
ANIM_GUSTJAR_BLOW = 0x514,
ANIM_GUSTJAR_WALK = 0x518,
ANIM_MOLEMITTS_CLANG = 0x51c,
ANIM_MOLEMITTS_MISS = 0x520,
ANIM_GUSTJAR_524 = 0x524,
ANIM_ENTER_POT = 0x52c,
ANIM_IN_POT = 0x530,
ANIM_LANTERN_LIGHT = 0x600,
ANIM_LANTERN_ON = 0x604,
ANIM_LANTERN = 0x608,
ANIM_LANTERN_BURN = 0x60c,
ANIM_BOTTLE_POUR = 0x610,
ANIM_BOTTLE_SWING = 0x614,
ANIM_BOTTLE_SWING_END = 0x618,
ANIM_FALL_IN_HOLE = 0x61c,
ANIM_IN_HOLE = 0x620,
ANIM_SPRING_JUMP = 0x624,
ANIM_CANE = 0x628,
ANIM_PARACHUTE_ACTIVATE = 0x700,
ANIM_BOOMERANG_MAGIC = 0x704,
ANIM_PARACHUTE = 0x708,
ANIM_MINECART_PAUSE = 0x70c,
ANIM_MINECART = 0x710,
ANIM_DROWN = 0x72c,
ANIM_PARACHUTE_FALL = 0x730,
ANIM_PUT_ON_EZLO = 0x734,
ANIM_SLEEP = 0x736,
ANIM_WAKEUP = 0x737,
ANIM_PORTAL_ACTIVATE = 0x738,
ANIM_SLEEP_NOCAP = 0x73a,
ANIM_WAKEUP_NOCAP = 0x73b,
ANIM_GROW = 0x73c,
ANIM_HOP = 0x80c,
ANIM_JUMP = 0x810,
ANIM_BOOMERANG = 0x818,
ANIM_LAND = 0x820,
ANIM_MOLDWORM_CAPTURED = 0x8b0,
ANIM_GET_NEW_SWORD = 0x8bf,
ANIM_OCARINA = 0x8e1,
ANIM_GET_LAST_SWORD = 0x8e3,
ANIM_GET_NEWCAP = 0x8e4,
ANIM_PICKUP_NOCAP = 0x928,
ANIM_CARRY_STAND_NOCAP = 0x92c,
ANIM_THROW_NOCAP = 0x930,
ANIM_CARRY_NOCAP = 0x934,
ANIM_PUSH_NOCAP = 0x93c,
ANIM_PULL_NOCAP = 0x944,
ANIM_GRAB_NOCAP = 0x948,
ANIM_FALL_IN_HOLE_NOCAP = 0x950,
ANIM_IN_HOLE_NOCAP = 0x954,
ANIM_SWORD_MINISH = 0xc00,
ANIM_WALK_MINISH = 0xc04,
ANIM_ROLL_MINISH = 0xc08,
ANIM_SWIM_MINISH = 0xc0c,
ANIM_DASH_MINISH = 0xc10,
ANIM_DASH_CHARGE_MINISH = 0xc14,
ANIM_BOUNCE_MINISH = 0xc18,
ANIM_DROWN_MINISH = 0xc19,
ANIM_DIE1_MINISH = 0xc1a,
ANIM_DIE2_MINISH = 0xc1b,
ANIM_DIVE_MINISH = 0xc1c,
} PlayerAnimation;
typedef enum {
PAS_NORTH,
PAS_EAST,
PAS_SOUTH,
PAS_WEST,
} PlayerAnimationState;
typedef struct {
/*0x00*/ u8 prevAnim;
/*0x01*/ u8 grab_status;
@ -303,7 +472,8 @@ typedef struct {
/*0x1c*/ u8 field_0x1c;
/*0x1d*/ u8 gustJarSpeed;
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[3];
/*0x1f*/ u8 field_0x1f[2];
/*0x21*/ u8 bow_state;
/*0x22*/ u16 tilePosition;
/*0x24*/ u16 tileType;
/*0x26*/ u8 swim_state; /**< Is the player swimming? 0x80 for diving */

View File

@ -168,7 +168,7 @@ typedef enum {
SFX_FALL_HOLE,
SFX_86,
SFX_PLY_DIE,
SFX_88,
SFX_GRAB,
SFX_BARREL_RELEASE,
SFX_BARREL_ENTER,
SFX_BARREL_ROLL,
@ -295,7 +295,7 @@ typedef enum {
SFX_PLACE_OBJ,
SFX_105,
SFX_106,
SFX_107,
SFX_ITEM_GLOVES_AIR,
SFX_108,
SFX_ITEM_GET,
SFX_10A,

View File

@ -170,7 +170,7 @@ u32 UpdatePlayerCollision(void) {
u32 index;
const s16* ptr1;
const s16* ptr2;
s32 tmp1;
s32 framestate;
u32 tmp2;
u32 tmp3;
// There are some weird assignment necessary to access gPlayerEntity.animationState correctly.
@ -178,18 +178,18 @@ u32 UpdatePlayerCollision(void) {
u32 animationState2;
u32 animationState3;
if (gPlayerState.framestate == 0) {
tmp1 = gPlayerState.framestate_last;
if (gPlayerState.framestate == PL_STATE_IDLE) {
framestate = gPlayerState.framestate_last;
} else {
tmp1 = gPlayerState.framestate;
framestate = gPlayerState.framestate;
}
switch (tmp1) {
case 3:
switch (framestate) {
case PL_STATE_GUSTJAR:
return 0;
case 0x12:
case PL_STATE_DIE:
return 0;
case 0x16:
case PL_STATE_DROWN:
return 0;
}
@ -198,7 +198,7 @@ u32 UpdatePlayerCollision(void) {
} else {
direction = gPlayerState.direction;
}
if (((direction & 0x83) == 0) && (gPlayerState.field_0xa == 0)) {
if (((direction & (DIR_NOT_MOVING_CHECK | 0x3)) == 0) && (gPlayerState.field_0xa == 0)) {
index = sub_0807BDB8(&gPlayerEntity, direction >> 2);
if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) {
ptr1 = &gUnk_080B4490[index * 2];
@ -254,10 +254,11 @@ u32 UpdatePlayerCollision(void) {
if (gPlayerState.field_0xa != 0) {
return 0;
}
if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != 0) {
if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction !=
DirectionNorth) {
return 0;
}
if ((gPlayerEntity.direction & 0x80) != 0) {
if ((gPlayerEntity.direction & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if (sub_080B1B44(position, gPlayerEntity.collisionLayer) != 0xf) {
@ -356,7 +357,8 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
#endif
if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != 0) {
if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction !=
DirectionNorth) {
return 0;
}
if ((gPlayerEntity.direction & 0x80) != 0) {
@ -415,7 +417,7 @@ u32 UpdatePlayerCollision(void) {
if ((animationState1 & 0xff) != 0) {
return 0;
}
if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 2) == 0) {
@ -555,7 +557,7 @@ u32 UpdatePlayerCollision(void) {
if (animationState3 == 0) {
return 0;
}
if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 1) == 0) {
@ -574,7 +576,7 @@ u32 UpdatePlayerCollision(void) {
if ((animationState2) != 4) {
return 0;
}
if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return 0;
}
if ((gPlayerEntity.frame & 1) == 0) {
@ -595,7 +597,8 @@ bool32 sub_0801A2B0(LayerStruct* layer, u32 position, u32 collisionType) {
u16 temp4;
uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1];
if ((((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) == 0) && ((gPlayerEntity.frame & 1) != 0)) {
if ((((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) == 0) &&
((gPlayerEntity.frame & 1) != 0)) {
position = (u16)(position - (-uVar1)); // necessary for match
temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.collisionLayer));
switch (temp4) {
@ -712,18 +715,18 @@ bool32 sub_0801A4F8(void) {
if (GetInventoryValue(ITEM_POWER_BRACELETS) != 1) {
return FALSE;
}
if ((gPlayerState.direction & 0x80) != 0) {
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) {
return FALSE;
}
if (gPlayerState.direction != gPlayerEntity.direction) {
return FALSE;
}
tmp = (((gPlayerEntity.direction + 4) & 0x18) >> 3);
tmp = (((gPlayerEntity.direction + 4) & DirectionWest) >> 3);
if ((gUnk_080B44A0[tmp] & gPlayerEntity.collisions) == 0) {
return FALSE;
}
} else {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & 0x80) != 0) {
if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) {
return FALSE;
}
if ((gPlayerEntity.frame & 1) == 0) {

View File

@ -445,7 +445,7 @@ void AcroBandit_Type1Action4(Entity* this) {
}
}
if (this->direction & 0xf)
if (this->direction & (0x3 | DirectionEast | DIR_DIAGONAL))
this->spriteSettings.flipX = (this->direction >> 4 ^ 1);
ProcessMovement0(this);
@ -486,7 +486,7 @@ void AcroBandit_Type1Action6(Entity* this) {
this->action = 7;
dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2];
this->direction = dir;
if (dir >= 0x10) {
if (dir >= DirectionSouth) {
this->spriteSettings.flipX = 1;
} else {
this->spriteSettings.flipX = 0;
@ -570,7 +570,7 @@ static void sub_080322E8(Entity* this) {
}
} else {
u8 tmp = this->direction;
if (tmp & 0xF) {
if (tmp & (0x3 | DirectionEast | DIR_DIAGONAL)) {
tmp >>= 4;
tmp ^= 1;
if (tmp != this->spriteSettings.flipX) {

View File

@ -105,7 +105,8 @@ void sub_080218CC(Entity* this) {
if (this->subAction == 0) {
this->subAction = 1;
this->spriteSettings.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) &
(0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest);
this->speed = 0x100;
this->zVelocity = Q_16_16(1.125);
}
@ -244,9 +245,9 @@ void sub_08021B64(Entity* this) {
this->zVelocity = Q_16_16(1.0);
((u8*)&this->field_0x86)[1] = 0;
if (gPlayerEntity.direction != 0xff) {
this->direction = 0x10 ^ gPlayerEntity.direction;
this->direction = DirectionSouth ^ gPlayerEntity.direction;
} else {
this->direction = (gPlayerEntity.animationState << 2) ^ 0x10;
this->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth;
}
InitializeAnimation(this, 5);
} else {

View File

@ -10,18 +10,20 @@
#include "room.h"
#include "object.h"
#define DIR_NOT_MOVING_CHECK 0x80
void BladeTrap(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->child = GetCurrentRoomProperty(this->type);
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
}
if (!(this->direction & 0x80)) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
LinearMoveUpdate(this);
}
if (!(--this->field_0x74.HWORD)) {
if (!(this->direction & 0x80)) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
EnqueueSFX(SFX_METAL_CLINK);
}
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);

View File

@ -62,7 +62,7 @@ void Bobomb_OnCollision(Entity* this) {
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x80.HALF.HI = 1;
InitializeAnimation(this, this->direction >> 4 | 6);
InitializeAnimation(this, this->direction >> 4 | IdleWest);
break;
}
}
@ -123,7 +123,7 @@ void sub_0802C83C(Entity* this) {
} else {
this->field_0x82.HALF.LO = 2;
this->timer = 120;
InitializeAnimation(this, (this->direction >> 4) | 6);
InitializeAnimation(this, (this->direction >> 4) | IdleWest);
COLLISION_OFF(this);
this->hitType = 0x6e;
}
@ -147,7 +147,7 @@ void sub_0802C8D8(Entity* this) {
this->action = 1;
this->timer = 60;
this->subtimer = 0;
this->direction = (Random() & 0x18) | 4;
this->direction = (Random() & 0x18) | DIR_DIAGONAL;
this->carryFlags = 0;
this->gustJarFlags = 0x12;
this->field_0x82.HALF.LO = 0;
@ -163,7 +163,7 @@ void sub_0802C91C(Entity* this) {
if (this->field_0x82.HALF.LO) {
if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
InitializeAnimation(this, (this->direction >> 4) | 2);
InitializeAnimation(this, (this->direction >> 4) | IdleEast);
}
if (--this->timer == 0) {
sub_0802CBC4(this);
@ -180,7 +180,7 @@ void sub_0802C91C(Entity* this) {
}
if (--this->timer == 0) {
this->timer = 60;
this->direction = (this->direction + 8) & 0x1c;
this->direction = (this->direction + 8) & (DirectionWest | DIR_DIAGONAL);
InitializeAnimation(this, this->direction >> 4);
}
}
@ -196,7 +196,7 @@ void sub_0802C9D0(Entity* this) {
this->spritePriority.b1 = 0;
this->field_0x82.HALF.HI = 1;
sub_0802CC18(this);
InitializeAnimation(this, (this->direction >> 4) | 6);
InitializeAnimation(this, (this->direction >> 4) | IdleWest);
GetNextFrame(this);
}
@ -210,7 +210,7 @@ void sub_0802CA10(Entity* this) {
}
} else {
this->field_0x82.HALF.HI = 2;
this->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c;
this->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest);
sub_0802CC18(this);
GetNextFrame(this);
}
@ -234,8 +234,8 @@ void sub_0802CA94(Entity* this) {
this->speed = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
this->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c;
InitializeAnimation(this, (this->direction >> 4) | 6);
this->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL);
InitializeAnimation(this, (this->direction >> 4) | IdleWest);
}
void sub_0802CAF8(Entity* this) {
@ -264,7 +264,7 @@ void sub_0802CB68(Entity* this) {
this->action = 1;
this->subAction = 0;
this->direction = Random() & 0x18;
this->direction |= 4;
this->direction |= IdleSouth;
COLLISION_ON(this);
if (this->field_0x82.HALF.LO) {
this->timer = 200;

View File

@ -141,10 +141,10 @@ void sub_0802A9A8(Entity* this) {
this->field_0x82.HWORD = 1;
if (this->field_0x80.HALF.LO) {
this->x.HALF.HI = gRoomControls.scroll_x - 0x10;
this->direction = 8;
this->direction = DirectionEast;
} else {
this->x.HALF.HI = gRoomControls.scroll_x + 0x100;
this->direction = 0x18;
this->direction = DirectionWest;
}
this->y.HALF.HI = gRoomControls.scroll_y + 0x40;
this->timer = 128;
@ -221,7 +221,7 @@ void sub_0802AAC0(Entity* this) {
#ifndef EU
this->field_0x78.HALF.LO = 0;
this->field_0x78.HALF.HI = 4;
this->direction = 0xff;
this->direction = DIR_NONE;
#endif
InitializeAnimation(this, 0);
}

View File

@ -79,7 +79,7 @@ void BusinessScrub_Action0(Entity* this) {
this->field_0x78.HWORD = this->x.HALF.HI;
this->field_0x7a.HWORD = this->y.HALF.HI;
this->animationState = 0;
this->direction = 0x10;
this->direction = DirectionSouth;
sub_08028E9C(this);
if ((*(u8*)this->field_0x7c.WORD & 1) || CheckFlags(this->field_0x86.HWORD)) {
this->action = 4;
@ -455,8 +455,8 @@ void sub_080290FC(Entity* this) {
if (this->timer != 0) {
this->timer--;
if ((this->timer < 16) && ((this->timer & 1) == 0)) {
s32 sVar3 = ((this->direction & 0x10) != 0) ? -1 : 1;
if ((this->direction & 8) != 0) {
s32 sVar3 = (this->direction & DirectionSouth) ? -1 : 1;
if (this->direction & DirectionEast) {
this->x.HALF.HI += ((this->timer & 8) != 0) ? -sVar3 : sVar3;
} else {
this->y.HALF.HI += ((this->timer & 8) != 0) ? sVar3 : -sVar3;

View File

@ -66,7 +66,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) {
super->subtimer = 0;
this->unk_78 = super->x.HALF.HI;
this->unk_7a = super->y.HALF.HI;
super->animationState = 0;
super->animationState = IdleNorth;
super->direction = 0x10;
super->action = 5;
super->timer = 120;

View File

@ -34,7 +34,7 @@ void sub_0802B540(Entity* this) {
this->timer--;
} else {
u32 direction = sub_0804A024(this, 1, 0xc);
if (direction != 0xff) {
if (direction != DIR_NONE) {
this->action = 2;
this->speed = 0x40;
this->direction = direction;

View File

@ -554,7 +554,7 @@ void sub_080262A8(ChuchuBossEntity* this) {
super->timer = 1;
sub_080276F4(super, 6, 1);
if (super->type2 == 0) {
gPlayerState.animation = 0x104;
gPlayerState.animation = ANIM_WALK;
this->unk_84->unk_03 = 1;
} else {
this->unk_7c = 0;

View File

@ -119,10 +119,11 @@ void sub_08022AA4(Entity* this) {
if (!sub_08049FA0(this) && (rand >> 8) & 3) {
this->direction = sub_08049EE4(this);
} else {
this->direction = (rand >> 0x10) & 0x1f;
this->direction =
(rand >> 0x10) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest);
}
if (this->direction & 0xf)
if (this->direction & (0x3 | DirectionEast | DIR_DIAGONAL))
this->spriteSettings.flipX = (this->direction >> 4) ^ 1;
}
@ -144,7 +145,7 @@ void sub_08022B44(Entity* this) {
this->zVelocity = Q_16_16(0.75);
this->direction = GetFacingDirection(this, &gPlayerEntity);
if (this->direction & 0xf)
if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast))
this->spriteSettings.flipX = (this->direction >> 4) ^ 1;
EnqueueSFX(SFX_VO_CHEEP);

View File

@ -108,7 +108,7 @@ void Enemy4D_Init(Enemy4DEntity* this) {
super->child = projectile;
COLLISION_ON(super);
super->spriteSettings.draw = TRUE;
super->animationState = 2;
super->animationState = IdleEast;
this->unk_7b = 0;
this->unk_7c = 0;
this->unk_7e = 0x28;

View File

@ -146,7 +146,7 @@ void Eyegore_OnGrabbed(EyegoreEntity* this) {
void Eyegore_Init(EyegoreEntity* this) {
sub_0804A720(super);
super->action = 1;
super->animationState = 2;
super->animationState = IdleEast;
super->x.HALF.HI &= 0xfff0;
super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) + 0xc;
this->unk_6d |= 8;
@ -198,7 +198,7 @@ void Eyegore_Action3(EyegoreEntity* this) {
GetNextFrame(super);
if ((super->frame & ANIM_DONE) != 0) {
super->flags |= ENT_COLLIDE;
super->animationState = 2;
super->animationState = IdleEast;
sub_08030E58(this);
InitializeAnimation(super, 2);
sub_08030FB4(this);
@ -242,7 +242,7 @@ void Eyegore_Action5(EyegoreEntity* this) {
GetNextFrame(super);
switch (super->frame & 7) {
case 1:
if (super->animationState != 2) {
if (super->animationState != IdleEast) {
if (super->animationState >= 3) {
this->unk_7f = (super->animationState - 1) & 3;
} else {
@ -266,7 +266,7 @@ void Eyegore_Action5(EyegoreEntity* this) {
if (sub_08049FDC(super, 1)) {
sub_08030E58(this);
} else {
if (super->animationState == 2) {
if (super->animationState == IdleEast) {
super->action = 6;
super->flags &= ~ENT_COLLIDE;
InitializeAnimation(super, 0xe);

View File

@ -117,7 +117,7 @@ void sub_08045524(Entity* this) {
this->zVelocity = Q_16_16(1.75);
tmp = sub_0804A024(this, 1, 8);
if (tmp != 0xff && (Random() & 3) == 0) {
if (tmp != DIR_NONE && (Random() & 3) == 0) {
this->timer = Random() & 3;
this->direction = DirectionRound(tmp);
} else {

View File

@ -164,8 +164,8 @@ void sub_08046930(GyorgMaleEntity* this) {
return;
super->subAction = 1;
super->timer = 1;
super->animationState = 0;
super->direction = 0;
super->animationState = IdleNorth;
super->direction = IdleNorth;
#ifdef EU
super->speed = 0x200;
#else

View File

@ -215,9 +215,9 @@ void sub_0802BE80(Entity* this) {
}
void sub_0802BEBC(Entity* this) {
this->direction ^= 0x10;
this->direction ^= DirectionSouth;
ProcessMovement2(this);
this->direction ^= 0x10;
this->direction ^= DirectionSouth;
if (!sub_080044EC(this, Q_16_16(0.125))) {
sub_0802C1C0(this);
}

View File

@ -89,7 +89,7 @@ void sub_0803CD6C(Entity* this) {
void sub_0803CDA8(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
LinearMoveUpdate(this);
}
@ -123,7 +123,7 @@ void sub_0803CE14(Entity* this) {
UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD);
direction = this->direction;
if (direction & 0x80) {
if (direction & DIR_NOT_MOVING_CHECK) {
return;
}

View File

@ -73,7 +73,8 @@ void Leever_Idle(Entity* this) {
if (Leever_PlayerInRange(this, Random() & 0x1f)) {
this->action = 2;
this->spriteSettings.draw = TRUE;
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f;
this->direction =
(GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & (0x3 | DirectionNorthWest);
InitializeAnimation(this, LeeverAnimation_DigUp);
UpdateSpriteForCollisionLayer(this);
} else {

View File

@ -369,16 +369,16 @@ void sub_08029EEC(Entity* this) {
void sub_08029F0C(Entity* this) {
switch (this->direction >> 3) {
case 0:
case 0: // UP
this->field_0x78.HWORD = this->y.HALF.HI - 0x10;
break;
case 1:
case 1: // RIGHT
this->field_0x78.HWORD = this->x.HALF.HI + 0x10;
break;
case 2:
case 2: // DOWN
this->field_0x78.HWORD = this->y.HALF.HI + 0x10;
break;
case 3:
case 3: // LEFT
this->field_0x78.HWORD = this->x.HALF.HI - 0x10;
break;
}
@ -386,25 +386,25 @@ void sub_08029F0C(Entity* this) {
bool32 sub_08029F48(Entity* this) {
switch (this->direction >> 3) {
case 0:
case 0: // UP
if (this->y.HALF.HI <= this->field_0x78.HWORD) {
this->y.HALF.HI = this->field_0x78.HWORD;
return TRUE;
}
break;
case 1:
case 1: // RIGHT
if (this->x.HALF.HI >= this->field_0x78.HWORD) {
this->x.HALF.HI = this->field_0x78.HWORD;
return TRUE;
}
break;
case 2:
case 2: // DOWN
if (this->y.HALF.HI >= this->field_0x78.HWORD) {
this->y.HALF.HI = this->field_0x78.HWORD;
return TRUE;
}
break;
case 3:
case 3: // LEFT
if (this->x.HALF.HI <= this->field_0x78.HWORD) {
this->x.HALF.HI = this->field_0x78.HWORD;
return TRUE;

View File

@ -509,7 +509,7 @@ void sub_0803A8B8(Entity* this) {
this->action = 0x10;
this->timer = 30;
this->direction = 0;
this->direction = DirectionNorth;
this->speed = 0x80;
ptr = gUnk_080CED6C;
@ -553,7 +553,7 @@ void sub_0803A978(Entity* this) {
sub_08004596(this, 0x10);
}
LinearMoveUpdate(this);
if (this->direction == 0x10) {
if (this->direction == DirectionSouth) {
this->action = 0x12;
this->timer = 3;
COLLISION_OFF(this);
@ -1225,7 +1225,10 @@ void sub_0803B724(Entity* param_1) {
void sub_0803B798(void) {
gPlayerState.jump_status = 0x41;
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerState.flags &=
~(PL_CAPTURED | PL_FLAGS10000 | PL_GYORG_FIGHT | PL_ROLLING | PL_MOLDWORM_CAPTURED | PL_IN_HOLE |
PL_MOLDWORM_RELEASED | PL_CLONING | PL_USE_LANTERN | PL_PARACHUTE | PL_CONVEYOR_PUSHED | PL_ENTER_MINECART |
PL_SWORD_THRUST | PL_USE_OCARINA | PL_CLIMBING | PL_FLAGS40000000 | PL_FLAGS80000000);
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;

View File

@ -561,7 +561,7 @@ void sub_0803473C(Entity* this) {
if (roomX + 0xe0 < this->x.HALF.HI) {
return;
}
this->direction = 8;
this->direction = DirectionEast;
} else {
if (playerX + 4 >= this->x.HALF.HI) {
return;
@ -569,7 +569,7 @@ void sub_0803473C(Entity* this) {
if (roomX + 0x90 > this->x.HALF.HI) {
return;
}
this->direction = 0x18;
this->direction = DirectionWest;
}
LinearMoveUpdate(this);
}
@ -581,7 +581,7 @@ void sub_080347B4(Entity* this) {
if (roomX + 0xe0 < this->x.HALF.HI) {
return;
}
this->direction = 8;
this->direction = DirectionEast;
} else {
if (playerX + 4 >= this->x.HALF.HI) {
return;
@ -589,7 +589,7 @@ void sub_080347B4(Entity* this) {
if (roomX + 0x90 > this->x.HALF.HI) {
return;
}
this->direction = 0x18;
this->direction = DirectionWest;
}
LinearMoveUpdate(this);
}

View File

@ -209,7 +209,7 @@ void sub_08022F14(Entity* this) {
}
this->direction += this->field_0x78.HALF.LO;
this->direction &= 0x1f;
this->direction &= DirectionNorthWest | 0x3;
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
this->frameIndex = this->animationState;

View File

@ -182,7 +182,8 @@ void Peahat_ChargeStart(Entity* this) {
this->action = 3;
this->timer = 120;
this->speed = 192;
this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f;
this->direction =
(GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & (0x3 | DirectionNorthWest);
}
} else {
sub_080205F8(this);
@ -226,6 +227,8 @@ void Peahat_ChargeEnd(Entity* this) {
}
}
#define DIR_NONE 0xff
void Peahat_Stunned(Entity* this) {
switch (this->animationState) {
default:
@ -236,7 +239,7 @@ void Peahat_Stunned(Entity* this) {
this->hitType = 0x71;
}
if (this->direction == 0xff)
if (this->direction == DIR_NONE)
this->direction = this->knockbackDirection;
ProcessMovement0(this);
@ -364,7 +367,7 @@ void sub_08020604(Entity* this) {
this->direction = sub_08049EE4(this);
} else {
this->direction += this->field_0x80.HALF.LO;
this->direction &= 0x1f;
this->direction &= (0x3 | DirectionNorthWest);
}
}

View File

@ -387,7 +387,7 @@ void sub_080244E8(Entity* this) {
if (tmp == 0) {
this->field_0x80.HALF.LO++;
this->timer = 12;
this->direction = 0x10;
this->direction = DirectionSouth;
this->speed = tmp;
this->cutsceneBeh.HALF.LO = 0;
this->flags2 &= 0xfc;
@ -554,13 +554,13 @@ void sub_08024940(Entity* this) {
}
void sub_080249DC(Entity* this) {
u8 direction = ((this->direction + 2) & 0x1c) >> 2;
u8 direction = ((this->direction + 2) & DirectionNorthWest) >> 2;
this->animationState = direction;
InitializeAnimation(this, this->animationState);
}
void sub_080249F4(Entity* this) {
u32 direction = ((this->direction + 2) & 0x1f);
u32 direction = ((this->direction + 2) & (0x3 | DirectionNorthWest));
direction >>= 2;
if (direction != this->animationState) {
this->animationState = direction;
@ -770,8 +770,8 @@ void sub_08024D00(Entity* this) {
this->field_0x80.HALF.LO++;
this->timer = (Random() & 0xf) + 32;
this->direction += this->field_0x80.HALF.HI ? 4 : 0x1c;
this->direction &= 0x1f;
this->direction += this->field_0x80.HALF.HI ? DirectionNorthEast : DirectionNorthWest;
this->direction &= 0x3 | DirectionNorthWest;
this->field_0x80.HALF.HI ^= 0x40;
sub_08024A14(this, 3, 0x10);
@ -783,8 +783,8 @@ void sub_08024D00(Entity* this) {
this->timer = (Random() & 0x1f) + 32;
} else {
if (--this->subtimer == 0) {
this->direction += this->field_0x80.HALF.HI ? 1 : 0x1f;
this->direction &= 0x1f;
this->direction += this->field_0x80.HALF.HI ? 1 : (0x3 | DirectionNorthWest);
this->direction &= 0x3 | DirectionNorthWest;
this->subtimer = 16;
sub_080249DC(this);

View File

@ -338,7 +338,7 @@ void sub_080255AC(Entity* this) {
}
tmp -= 7;
this->direction = (GetFacingDirection(ent, this) + tmp) & 0x1f;
this->direction = (GetFacingDirection(ent, this) + tmp) & (0x3 | DirectionNorthWest);
}
if (this->field_0x78.HWORD == 0) {
@ -378,7 +378,7 @@ void sub_080256B4(Entity* this) {
this->action = 1;
this->timer = (Random() & 3) + 4;
this->subtimer = 30;
this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & 0x1c;
this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & DirectionNorthWest;
this->field_0x78.HWORD = gUnk_080CC000[Random() & 0xf];
this->field_0x7a.HALF.LO = ((s32)Random() % 0x18) << 1;
this->field_0x7a.HALF.HI = 0;

View File

@ -39,7 +39,7 @@ void Rollobite_OnCollision(Entity* this) {
if (this->hitType == 34 && this->health != 0xff) {
this->action = 4;
this->zVelocity = Q_16_16(2.0);
this->direction = 0xff;
this->direction = DIR_NONE;
this->health = 0xff;
this->hitType = 35;
InitializeAnimation(this, this->animationState + 8);
@ -49,7 +49,7 @@ void Rollobite_OnCollision(Entity* this) {
if (this->action == 4 || this->action == 5) {
this->action = 4;
this->timer = 180;
this->direction = 0xff;
this->direction = DIR_NONE;
InitializeAnimation(this, this->animationState + 0x10);
}
}
@ -74,7 +74,7 @@ void Rollobite_OnGrabbed(Entity* this) {
if (this->subAction < 3 && !sub_0806F520(this)) {
this->action = 4;
COLLISION_ON(this);
this->direction = 0xff;
this->direction = DIR_NONE;
InitializeAnimation(this, this->animationState + 0x10);
} else {
gUnk_080CA6A4[this->subAction](this);
@ -107,7 +107,7 @@ void sub_080207A8(Entity* this) {
COLLISION_ON(this);
this->spritePriority.b0 = 4;
this->gustJarState &= 0xfb;
this->direction ^= 0x10;
this->direction ^= DirectionSouth;
this->zVelocity = Q_16_16(1.5);
this->speed = 0x80;
InitializeAnimation(this, this->animationState + 0x10);
@ -193,7 +193,7 @@ void Rollobite_RolledUp(Entity* this) {
if (unk == 1)
EnqueueSFX(SFX_PLACE_OBJ);
if ((this->direction & 0x80) == 0)
if (!(this->direction & DIR_NOT_MOVING_CHECK))
ProcessMovement2(this);
}
}
@ -248,8 +248,8 @@ void sub_08020A7C(Entity* this) {
if (sub_08049FA0(this) == 0) {
int tmp = DirectionRoundUp(sub_08049EE4(this));
if ((state ^ 0x10) == tmp)
state ^= 0x10;
if ((state ^ DirectionSouth) == tmp)
state ^= DirectionSouth;
}
this->direction = state;

View File

@ -131,7 +131,7 @@ void sub_08038304(Entity* this) {
}
this->field_0x7a.HALF.LO = this->field_0x78.HALF.HI;
this->field_0x78.HALF.HI = cVar2;
this->direction = (this->direction + cVar2) & 0x18;
this->direction = (this->direction + cVar2) & DirectionWest;
} else {
this->direction = this->field_0x78.HALF.LO;
}

View File

@ -218,7 +218,7 @@ void sub_08029688(Entity* this) {
void sub_0802969C(Entity* this) {
u32 bVar1;
if ((this->direction & 0xf) != 0) {
if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) {
bVar1 = this->direction >> 4;
if (bVar1 != this->animationState) {

View File

@ -42,16 +42,16 @@ void sub_0802BA18(Entity* this) {
this->direction = direction;
switch (direction >> 3) {
case 0:
case 0: // UP
this->field_0x7a.HWORD = this->y.HALF.HI - this->field_0x7c.HALF.HI;
break;
case 1:
case 1: // RIGHT
this->field_0x7a.HWORD = this->x.HALF.HI + this->field_0x7c.HALF.LO;
break;
case 2:
case 2: // DOWN
this->field_0x7a.HWORD = this->y.HALF.HI + this->field_0x7c.HALF.HI;
break;
case 3:
case 3: // LEFT
this->field_0x7a.HWORD = this->x.HALF.HI - this->field_0x7c.HALF.LO;
break;
}
@ -62,19 +62,19 @@ void sub_0802BA8C(Entity* this) {
sub_0802BB10(this);
} else {
switch (this->direction >> 3) {
case 0:
case 0: // UP
if (this->field_0x7a.HWORD >= this->y.HALF.HI)
sub_0802BB10(this);
break;
case 1:
case 1: // RIGHT
if (this->field_0x7a.HWORD <= this->x.HALF.HI)
sub_0802BB10(this);
break;
case 2:
case 2: // DOWN
if (this->field_0x7a.HWORD <= this->y.HALF.HI)
sub_0802BB10(this);
break;
case 3:
case 3: // LEFT
if (this->field_0x7a.HWORD >= this->x.HALF.HI)
sub_0802BB10(this);
break;
@ -91,7 +91,7 @@ void sub_0802BAFC(Entity* this) {
void sub_0802BB10(Entity* this) {
this->action = 3;
this->speed = 0xc0;
this->direction = this->direction ^ 0x10;
this->direction = this->direction ^ DirectionSouth;
EnqueueSFX(SFX_METAL_CLINK);
}

View File

@ -91,8 +91,8 @@ void sub_08031714(Entity* this) {
if (sub_08049FA0(this) == 0 && (this->subtimer & 1) != 0) {
this->direction = sub_08049EE4(this);
} else {
this->direction += 0x18;
this->direction = ((Random() & 0xe) + this->direction) & 0x1f;
this->direction += DirectionWest;
this->direction = ((Random() & 0xe) + this->direction) & (0x3 | DirectionNorthWest);
}
sub_080317E0(this);
}

View File

@ -60,7 +60,7 @@ void sub_0802B35C(Entity* this) {
if (--this->subtimer == 0) {
this->subtimer = 120;
this->direction += is_head ? 0x08 : 0x18;
this->direction += is_head ? DirectionEast : DirectionWest;
this->direction = DirectionRound(this->direction);
}
} else {

View File

@ -176,7 +176,7 @@ void sub_08028488(Entity* this) {
this->timer = (Random() & 7) * 3 + 64;
break;
case 4:
this->direction = (this->direction + 0x10) & 0x18;
this->direction = (this->direction + 0x10) & DirectionWest;
/* fallthrough */
case 1:
default:
@ -265,7 +265,7 @@ void sub_08028604(Entity* this) {
this->timer = this->timer + 0x10;
this->field_0x82.HALF.HI--;
}
this->direction = (iVar3 + 4U) & 0x18;
this->direction = (iVar3 + 4U) & DirectionWest;
iVar3 = Direction8ToAnimationState(this->direction);
}
} else {

View File

@ -107,7 +107,7 @@ void sub_0802B7A4(Entity* this) {
this->timer = gUnk_080CD314[Random() & 3];
this->speed = 0x60;
sub_0802B960(this);
if (this->direction != 0xff) {
if (this->direction != DIR_NONE) {
u32 animation = this->direction >> 3;
if (animation != this->animationState) {
this->animationState = animation & 3;

View File

@ -159,7 +159,7 @@ void sub_0802F300(Entity* this) {
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
}
if (--this->timer == 0) {
@ -214,6 +214,6 @@ static void sub_0802F45C(Entity* this) {
this->direction = sub_08049F84(this, 1);
} else {
temp = (Random() & 0xf) + 0x18;
this->direction = (temp + this->direction) & 0x1f;
this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest);
}
}

View File

@ -136,7 +136,7 @@ void sub_08038048(Entity* this) {
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
}
if (--this->timer == 0) {
@ -185,6 +185,6 @@ void sub_08038168(Entity* this) {
this->direction = sub_08049F84(this, 1);
} else {
temp = (Random() & 0xf) + 0x18;
this->direction = (temp + this->direction) & 0x1f;
this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest);
}
}

View File

@ -74,7 +74,7 @@ void sub_0804468C(Entity* this) {
case 0:
this->action = 1;
this->timer = 1;
this->direction = (this->field_0x78.HALF.HI * 8) & 0x1f;
this->direction = (this->field_0x78.HALF.HI * 8) & (0x3 | DirectionNorthWest);
this->field_0x78.HALF.LO = 0;
this->field_0x82.HALF.HI = 0;
this->spriteSettings.draw = 0;
@ -123,7 +123,7 @@ void sub_0804474C(Entity* this) {
if (--this->timer == 0) {
this->timer = 2;
this->direction++;
this->direction &= 0x1f;
this->direction &= 0x3 | DirectionNorthWest;
}
LinearMoveUpdate(this);
UpdateAnimationSingleFrame(this);
@ -253,7 +253,7 @@ void sub_080449F8(Entity* this) {
this->timer = 4;
this->direction++;
this->direction &= 0x1f;
this->direction &= 0x3 | DirectionNorthWest;
if (vaati->field_0x80.HALF.LO == 0)
vaati->field_0x74.HALF.LO = 1;
break;
@ -266,9 +266,9 @@ void sub_080449F8(Entity* this) {
}
break;
case 1:
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
LinearMoveUpdate(this);
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
this->timer = 2;
break;
case 3:
@ -324,7 +324,7 @@ void sub_08044B04(Entity* this) {
if (--this->timer == 0) {
this->timer = this->field_0x78.HALF.LO ? 4 : 2;
this->direction++;
this->direction &= 0x1f;
this->direction &= 0x3 | DirectionNorthWest;
}
if (--this->subtimer == 0) {
if (this->timer != 2) {
@ -346,11 +346,11 @@ void sub_08044B04(Entity* this) {
case 1:
if (--this->timer == 0) {
this->timer = 6;
this->direction = (this->direction + 1) & 0x1f;
this->direction = (this->direction + 1) & (0x3 | DirectionNorthWest);
if (++this->subtimer == 0x30) {
u32 direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
this->speed = 0;
this->direction = (direction + 16) & 0x1f;
this->direction = (direction + 16) & (0x3 | DirectionNorthWest);
this->timer = 16;
this->subtimer = 16;
this->field_0x74.HALF.LO++;
@ -485,18 +485,18 @@ void sub_08044E74(Entity* this, u32 state) {
switch (state) {
case 2:
this->action = 2;
this->direction += 0x18;
this->direction &= 0x1f;
this->direction += DirectionWest;
this->direction &= 0x3 | DirectionNorthWest;
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
this->speed = 12288;
LinearMoveUpdate(this);
this->direction += 0x8;
this->direction &= 0x1f;
this->direction += DirectionEast;
this->direction &= 0x3 | DirectionNorthWest;
this->speed = 1280;
LinearMoveUpdate(this);
break;
case 1:
this->direction = (this->direction + 8) & 0x1f;
this->direction = (this->direction + 8) & (0x3 | DirectionNorthWest);
break;
case 0:
if (this->field_0x78.HALF.LO) {
@ -507,9 +507,9 @@ void sub_08044E74(Entity* this, u32 state) {
} while (this->timer-- != 3);
break;
case 1:
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
LinearMoveUpdate(this);
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
break;
}
} else {

View File

@ -232,7 +232,7 @@ void sub_0802EFB8(Entity* this) {
}
iVar4 = sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);
if (iVar4 != 0) {
this->direction = 0xff;
this->direction = DIR_NONE;
} else {
this->timer = (rand & 3) + 1;
this->direction = (uVar1 & 0x18);
@ -251,7 +251,7 @@ void sub_0802F04C(Entity* this) {
return;
}
switch (this->direction >> 3) {
case 0:
case 0: // UP
if (((oldY & 0xf) > 8) && ((this->y.HALF.HI & 0xf) < 9)) {
this->timer--;
oldY = (this->y.HALF.HI & 0xfff0) + 8;
@ -263,7 +263,7 @@ void sub_0802F04C(Entity* this) {
return;
}
break;
case 1:
case 1: // RIGHT
if (((oldX & 0xf) < 8) && ((this->x.HALF.HI & 0xf) >= 8)) {
this->timer--;
oldX = (this->x.HALF.HI & 0xfff0) + 8;
@ -275,7 +275,7 @@ void sub_0802F04C(Entity* this) {
return;
}
break;
case 2:
case 2: // DOWN
if (((oldY & 0xf) < 8) && ((this->y.HALF.HI & 0xf) >= 8)) {
this->timer--;
oldY = (this->y.HALF.HI & 0xfff0) + 8;
@ -287,7 +287,7 @@ void sub_0802F04C(Entity* this) {
return;
}
break;
default:
default: // LEFT
if (((oldX & 0xf) >= 9) && ((this->x.HALF.HI & 0xf) < 9)) {
this->timer--;
oldX = (this->x.HALF.HI & 0xfff0) + 8;

View File

@ -187,7 +187,7 @@ void VaatiProjectileFunction0Action5(Entity* this) {
void VaatiProjectileFunction0Action6(Entity* this) {
if (--this->timer == 0) {
this->action = 7;
this->direction = 0x10;
this->direction = DirectionSouth;
this->speed = 0x300;
}
sub_0803E444(this);

View File

@ -103,7 +103,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) {
this->timer = 0;
this->field_0x76.HALF.LO = 0;
this->spriteSettings.draw = 1;
this->direction = 0xff;
this->direction = DIR_NONE;
this->spritePriority.b0 = 4;
this->z.WORD = 0;
this->field_0x80.HALF.LO = 2;
@ -149,12 +149,12 @@ void VaatiRebornEnemyType0Action1(Entity* this) {
this->action = 2;
this->field_0x74.HALF.LO = 0;
this->timer = 16;
this->direction = 0xff;
this->direction = DIR_NONE;
} else {
if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) {
this->direction = ((Random() & 0x80) >> 3) | 8;
this->direction = ((Random() & 0x80) >> 3) | DirectionEast;
} else {
this->direction = 0xff;
this->direction = DIR_NONE;
}
}
} else {
@ -165,7 +165,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) {
this->field_0x74.HALF.HI = this->field_0x74.HALF.LO & 0x80;
this->field_0x74.HALF.LO = 0;
this->timer = 192;
this->direction = 0xff;
this->direction = DIR_NONE;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 0);
}
@ -176,7 +176,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) {
case 0:
this->action = 4;
this->timer = 160;
this->direction = 0xff;
this->direction = DIR_NONE;
this->cutsceneBeh.HALF.LO = 0xff;
InitAnimationForceUpdate(this, 1);
break;
@ -184,21 +184,21 @@ void VaatiRebornEnemyType0Action1(Entity* this) {
this->action = 6;
this->field_0x74.HALF.LO = 0;
this->timer = 0;
this->direction = 0xff;
this->direction = DIR_NONE;
break;
case 3:
this->action = 5;
this->field_0x74.HALF.LO = 0;
this->subtimer = 32;
this->direction = 0xff;
this->direction = DIR_NONE;
break;
case 2:
this->field_0x74.HALF.LO = 0;
this->timer = 32;
if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) {
this->direction = ((Random() & 0x80) >> 3) | 8;
this->direction = ((Random() & 0x80) >> 3) | DirectionEast;
} else {
this->direction = 0xff;
this->direction = DIR_NONE;
}
break;
}
@ -340,7 +340,7 @@ void VaatiRebornEnemyType0Action4(Entity* this) {
this->action = 1;
this->cutsceneBeh.HALF.LO = 0xff;
this->timer = 1;
this->direction = (this->direction + 0x10) & 0x1f;
this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest);
InitAnimationForceUpdate(this, 0);
} else {
if ((this->frame & 0x10) != 0) {
@ -369,7 +369,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) {
if (this->field_0x80.HALF.LO == 0) {
this->action = 1;
this->timer = 1;
this->direction = 0xff;
this->direction = DIR_NONE;
InitAnimationForceUpdate(this, 0);
return;
}
@ -394,7 +394,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) {
this->field_0x86.HALF.HI++;
this->subtimer = (Random() & 0x3f) + 64;
uVar3 = GetFacingDirection(this, &gPlayerEntity);
this->direction = (uVar3 & 0x10) | 8;
this->direction = (uVar3 & 0x10) | DirectionEast;
} else {
this->field_0x74.HALF.LO++;
this->field_0x86.HALF.HI = 0;
@ -408,7 +408,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) {
this->action = 1;
this->field_0x74.HALF.LO = 0;
this->timer = 1;
this->direction = 0xff;
this->direction = DIR_NONE;
}
break;
}
@ -557,7 +557,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) {
this->field_0x74.HALF.LO = 1;
this->field_0x74.HALF.HI = 0;
this->spriteOffsetY = -2;
this->direction = 0xff;
this->direction = DIR_NONE;
PositionRelative(source, this, 0, Q_16_16(2.0));
InitAnimationForceUpdate(this, 2);
}
@ -601,7 +601,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) {
void VaatiRebornEnemyType3Action0(Entity* this) {
this->action = 1;
this->field_0x74.HALF.LO = 0;
this->direction = 0xff;
this->direction = DIR_NONE;
this->spriteOffsetY = -1;
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
sub_0803DC0C(this);
@ -621,7 +621,7 @@ void VaatiRebornEnemyType3Action1(Entity* this) {
} else {
if (this->field_0x74.HALF.LO != 0) {
this->field_0x74.HALF.LO = 0;
this->direction = 0xff;
this->direction = DIR_NONE;
InitAnimationForceUpdate(this, 2);
}
}
@ -855,7 +855,7 @@ void VaatiRebornEnemyType0PreAction(Entity* this) {
this->field_0x7c = this->y;
}
if (this->field_0x76.HALF.LO == 0) {
if ((this->direction == 0xff) || sub_08049FA0(this)) {
if ((this->direction == DIR_NONE) || sub_08049FA0(this)) {
if (this->field_0x80.HALF.LO == 0) {
this->animationState = (this->animationState + 1) & 3;
this->spriteOffsetX = gUnk_080D04D3[this->animationState];
@ -863,7 +863,7 @@ void VaatiRebornEnemyType0PreAction(Entity* this) {
return;
}
bVar1 = sub_08049EE4(this);
this->direction = (bVar1 & 0x10) | 8;
this->direction = (bVar1 & 0x10) | DirectionEast;
this->field_0x76.HALF.LO = 0x10;
} else {
this->field_0x76.HALF.LO--;

View File

@ -888,7 +888,7 @@ void sub_080406A0(Entity* this) {
this->direction = tmp + 0x1f;
}
}
this->direction &= 0x1f;
this->direction &= 0x3 | DirectionNorthWest;
this->field_0x86.HALF.LO = uVar5;
}
@ -974,7 +974,7 @@ void sub_08040770(Entity* this) {
this->direction = tmp3 + 0x1F;
}
}
this->direction &= 0x1F;
this->direction &= 0x3 | DirectionNorthWest;
this->field_0x86.HALF.LO = tmp2;
}

View File

@ -383,7 +383,7 @@ void VaatiWrathType0Action7(Entity* this) {
UpdateAnimationSingleFrame(this);
if (gRoomControls.origin_y + 0x48 != this->y.HALF.HI) {
this->speed = 0x100;
this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? 0x10 : 0;
this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? DirectionSouth : DirectionNorth;
LinearMoveUpdate(this);
} else {
if (--this->timer == 0) {
@ -398,7 +398,7 @@ void VaatiWrathType0Action8(Entity* this) {
LinearMoveUpdate(this);
if (((gRoomControls.origin_x + 0x20) > this->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < this->x.HALF.HI)) {
if (0x3f < this->speed) {
this->direction ^= 0x10;
this->direction ^= DirectionSouth;
}
}
if (--this->timer == 0) {
@ -451,7 +451,7 @@ void VaatiWrathType0ActionA(Entity* this) {
if (this->field_0x7a.HALF.HI == 0xf0) {
this->action = 0xb;
this->subAction = 0;
this->direction = 0;
this->direction = DirectionNorth;
this->speed = 0x100;
this->zVelocity = Q_16_16(1.125);
ChangeObjPalette(this, 0x16b);
@ -521,7 +521,7 @@ void VaatiWrathType0ActionC(Entity* this) {
if (this->z.HALF.HI < -4) {
this->subAction = 1;
this->timer = 120;
this->direction = 0x10;
this->direction = DirectionSouth;
this->speed = 0x80;
}
break;

View File

@ -179,8 +179,8 @@ void Subtask_PortalCutscene_0(void) {
gScreen.bg1.yOffset = 0;
controls->scroll_y = 0;
portalId = gArea.portal_type;
if ((portalId == 2) && (gUI.roomControls.area != 2)) {
portalId = 3;
if ((portalId == PT_2) && (gUI.roomControls.area != 2)) {
portalId = PT_DUNGEON;
}
ptr = &gUnk_080D4138[portalId];
LoadPaletteGroup(ptr->paletteGroup);
@ -247,19 +247,19 @@ void RespawnAsMinish(void) {
bool32 sub_0804AD18(void) {
switch (gArea.portal_type) {
case 0:
case 1:
case 2:
case PT_TREESTUMP:
case PT_ROCK:
case PT_2:
if (!CheckGlobalFlag(ENTRANCE_0 + gArea.portal_type)) {
return FALSE;
}
// else: return TRUE implicitely, because it's stored in r0. But does not match if returning explicitely.
break;
case 6:
case PT_TOD:
return FALSE;
case 3:
case 4:
case 5:
case PT_DUNGEON:
case PT_JAR:
case PT_5:
default:
return FALSE;
}

View File

@ -4,14 +4,14 @@
void sub_08075DF4(ItemBehavior*, u32);
void sub_08075E40(ItemBehavior*, u32);
void sub_08075EC0(ItemBehavior*, u32);
void ItemBowShoot(ItemBehavior*, u32);
void sub_08075F38(ItemBehavior*, u32);
void sub_08075F84(ItemBehavior*, u32);
void sub_08075D88(ItemBehavior*, u32);
void ItemBow(ItemBehavior* this, u32 index) {
static void (*const stateFuncs[])(ItemBehavior*, u32) = {
sub_08075DF4, sub_08075E40, sub_08075EC0, sub_08075F38, sub_08075F84, sub_08075D88,
sub_08075DF4, sub_08075E40, ItemBowShoot, sub_08075F38, sub_08075F84, sub_08075D88,
};
stateFuncs[this->stateID](this, index);
}
@ -22,14 +22,14 @@ void sub_08075DF4(ItemBehavior* this, u32 index) {
sub_0806F948(&gPlayerEntity);
sub_08077BB8(this);
sub_08077D38(this, index);
gPlayerState.field_0x1f[2] = 1;
gPlayerState.bow_state = 1;
} else {
DeleteItemBehavior(this, index);
}
}
void sub_08075E40(ItemBehavior* this, u32 index) {
if (gPlayerState.field_0x1f[2] != 0) {
if (gPlayerState.bow_state != 0) {
if ((gPlayerState.attack_status & 0x80) == 0) {
UpdateItemAnim(this);
if ((this->playerFrame & 0x80) != 0) {
@ -43,24 +43,24 @@ void sub_08075E40(ItemBehavior* this, u32 index) {
return;
}
}
gPlayerState.field_0x1f[2] = 0;
gPlayerState.bow_state = 0;
DeleteItemBehavior(this, index);
}
void sub_08075EC0(ItemBehavior* this, u32 index) {
void ItemBowShoot(ItemBehavior* this, u32 index) {
u8 arrowCount;
s32 iVar2;
s32 isShooting;
arrowCount = gSave.stats.arrowCount;
iVar2 = IsItemActive(this);
if (iVar2 != 0 && arrowCount != 0) {
if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.field_0x1f[2] == 0)) {
gPlayerState.field_0x1f[2] = 0;
isShooting = IsItemActive(this);
if (isShooting && arrowCount != 0) {
if (((gPlayerState.attack_status & 0x80) != 0) || (gPlayerState.bow_state == 0)) {
gPlayerState.bow_state = 0;
DeleteItemBehavior(this, index);
}
} else {
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
SetItemAnim(this, 0x27c);
SetItemAnim(this, ANIM_BOW_SHOOT);
this->animPriority = 0xf;
this->priority |= 0xf;
this->stateID = 3;
@ -68,19 +68,19 @@ void sub_08075EC0(ItemBehavior* this, u32 index) {
}
void sub_08075F38(ItemBehavior* this, u32 index) {
if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) {
UpdateItemAnim(this);
if ((this->playerFrame & 1) != 0) {
this->stateID = 4;
}
} else {
gPlayerState.field_0x1f[2] = 0;
gPlayerState.bow_state = 0;
DeleteItemBehavior(this, index);
}
}
void sub_08075F84(ItemBehavior* this, u32 index) {
if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.field_0x1f[2] != 0)) {
if (((gPlayerState.attack_status & 0x80) == 0) && (gPlayerState.bow_state != 0)) {
if (GetInventoryValue(ITEM_ARROW_BUTTERFLY) == 1) {
sub_08077E3C(this, 5);
} else {
@ -90,6 +90,6 @@ void sub_08075F84(ItemBehavior* this, u32 index) {
return;
}
}
gPlayerState.field_0x1f[2] = 0;
gPlayerState.bow_state = 0;
DeleteItemBehavior(this, index);
}

View File

@ -36,7 +36,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) {
}
if ((this->playerFrame & 0x80) != 0) {
this->stateID = 2;
SetItemAnim(this, 0x504);
SetItemAnim(this, ANIM_GUSTJAR_SUCK);
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0);
if (playerItem != NULL) {
@ -64,12 +64,12 @@ void sub_08076EC8(ItemBehavior* this, u32 index) {
}
if (gPlayerEntity.subAction == 0x1b) {
animIndex = 0x524;
animIndex = ANIM_GUSTJAR_524;
} else {
if (gPlayerState.direction & 0x80) {
animIndex = 0x504;
if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) {
animIndex = ANIM_GUSTJAR_SUCK;
} else {
animIndex = 0x518;
animIndex = ANIM_GUSTJAR_WALK;
}
}
@ -100,7 +100,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
gPlayerState.field_0x1c = 1;
gPlayerState.field_0xa &= ~(8 >> index);
this->stateID = 2;
SetItemAnim(this, 0x504);
SetItemAnim(this, ANIM_GUSTJAR_SUCK);
item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0);
if (item) {
item->parent = player;
@ -108,7 +108,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
return;
} else {
gPlayerState.field_0x1c = 6;
SetItemAnim(this, 0x510);
SetItemAnim(this, ANIM_GUSTJAR_END);
return;
}
} else {
@ -155,7 +155,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
return;
break;
case 7:
SetItemAnim(this, 0x514);
SetItemAnim(this, ANIM_GUSTJAR_BLOW);
gPlayerState.field_0x1c = 3;
gPlayerState.gustJarSpeed = 0;
return;
@ -163,7 +163,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) {
case 2:
default:
gPlayerState.field_0x1c = 3;
SetItemAnim(this, 0x514);
SetItemAnim(this, ANIM_GUSTJAR_BLOW);
return;
case 0:
break;

View File

@ -27,7 +27,7 @@ void sub_08077534(ItemBehavior* this, u32 index) {
this->timer = gSave.stats.bottles[tmp - ITEM_BOTTLE1];
switch (this->timer) {
case ITEM_BOTTLE_EMPTY:
SetItemAnim(this, 0x614);
SetItemAnim(this, ANIM_BOTTLE_SWING);
return;
case ITEM_BOTTLE_BUTTER:
case ITEM_BOTTLE_MILK:
@ -43,22 +43,22 @@ void sub_08077534(ItemBehavior* this, u32 index) {
this->stateID = 3;
gPlayerEntity.animationState = 4;
gPlayerEntity.spriteSettings.flipX = 0;
SetItemAnim(this, 0x2df);
SetItemAnim(this, ANIM_BOTTLE_DRINK);
break;
case BOTTLE_CHARM_NAYRU:
case BOTTLE_CHARM_FARORE:
case BOTTLE_CHARM_DIN:
default:
this->stateID = 3;
SetItemAnim(this, 0x610);
SetItemAnim(this, ANIM_BOTTLE_POUR);
break;
}
gPlayerEntity.flags &= ~ENT_COLLIDE;
}
void sub_08077618(ItemBehavior* this, u32 index) {
if ((this->playerFrame & 0x80) != 0) {
SetItemAnim(this, 0x618);
if (this->playerFrame & 0x80) {
SetItemAnim(this, ANIM_BOTTLE_SWING_END);
this->stateID++;
} else {
UpdateItemAnim(this);

View File

@ -104,7 +104,7 @@ void sub_08075B54(ItemBehavior* this, u32 index) {
object->x.HALF.HI = tmp[0] + object->x.HALF.HI;
object->y.HALF.HI = tmp[1] + object->y.HALF.HI;
}
SetItemAnim(this, 0x60c);
SetItemAnim(this, ANIM_LANTERN_BURN);
bVar1 = (8 >> (index));
gPlayerState.field_0xa |= bVar1;
gPlayerState.keepFacing |= bVar1;

View File

@ -34,7 +34,7 @@ void sub_08077130(ItemBehavior* this, u32 index) {
iVar1 = sub_080774A0();
if (iVar1 != 0) {
if (this->timer == 0) {
SetItemAnim(this, 0x50c);
SetItemAnim(this, ANIM_MOLEMITTS_DIG);
this->stateID = 2;
if (iVar1 == 0x56) {
if ((gPlayerEntity.animationState & 2) != 0) {
@ -45,7 +45,7 @@ void sub_08077130(ItemBehavior* this, u32 index) {
}
}
} else {
SetItemAnim(this, 0x508);
SetItemAnim(this, ANIM_MOLEMITTS_FLOOR);
this->stateID = 1;
}
} else {
@ -71,9 +71,9 @@ void sub_080771C8(ItemBehavior* this, u32 index) {
}
if ((this->playerFrame & 0x10) != 0) {
if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) {
SetItemAnim(this, 0x520);
SetItemAnim(this, ANIM_MOLEMITTS_MISS);
this->stateID = 3;
SoundReq(SFX_107);
SoundReq(SFX_ITEM_GLOVES_AIR);
} else {
if (this->subtimer != 0xff) {
object = CreateObjectWithParent(&gPlayerEntity, OBJECT_1F, 0, this->field_0x2[1]);
@ -140,7 +140,7 @@ void sub_080772A8(ItemBehavior* this, u32 index) {
SoundReq(SFX_108);
CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0);
} else {
SetItemAnim(this, 0x51c);
SetItemAnim(this, ANIM_MOLEMITTS_CLANG);
effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0);
if (effect != NULL) {
effect->animationState = this->playerAnimationState;

View File

@ -67,11 +67,11 @@ void sub_080768F8(ItemBehavior* this, u32 index) {
bVar1 |= bVar2;
if (bVar1 == 0) {
gPlayerState.dash_state = 1;
gPlayerState.field_0x1f[2] = bVar1;
if ((gPlayerState.flags & PL_MINISH) == 0) {
gPlayerState.bow_state = bVar1;
if (!(gPlayerState.flags & PL_MINISH)) {
this->timer = 0x10;
} else {
gPlayerState.animation = 0xc14;
gPlayerState.animation = ANIM_DASH_CHARGE_MINISH;
}
sub_08077D38(this, index);
sub_08076964(this, index);
@ -104,7 +104,7 @@ void sub_08076964(ItemBehavior* this, u32 index) {
if (HasSwordEquipped() && (gPlayerState.flags & PL_MINISH) == 0 &&
(gPlayerState.skills & SKILL_DASH_ATTACK) != 0) {
gPlayerState.lastSwordMove = SWORD_MOVE_DASH;
SetItemAnim(this, 0x298);
SetItemAnim(this, ANIM_DASH);
entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD);
if (entity != NULL) {
if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) {
@ -115,11 +115,11 @@ void sub_08076964(ItemBehavior* this, u32 index) {
entity->field_0x68.HALF.LO = uVar3;
return;
}
} else if ((gPlayerState.flags & PL_MINISH) == 0) {
SetItemAnim(this, 0x104);
} else if (!(gPlayerState.flags & PL_MINISH)) {
SetItemAnim(this, ANIM_WALK);
return;
} else {
gPlayerState.animation = 0xc10;
gPlayerState.animation = ANIM_DASH_MINISH;
return;
}
} else {
@ -136,7 +136,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) {
u8* ptr;
if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) {
if ((gPlayerState.flags & PL_MINISH) == 0) {
if (!(gPlayerState.flags & PL_MINISH)) {
gPlayerEntity.speed = 0x300;
} else {
gPlayerEntity.speed = 0x280;
@ -148,7 +148,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) {
gPlayerEntity.subAction = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerState.field_0x38 = 0;
gPlayerState.direction = 0xff;
gPlayerState.direction = DIR_NONE;
return;
}
this->subtimer = 1;
@ -157,12 +157,13 @@ void sub_08076A88(ItemBehavior* this, u32 index) {
ptr = gUnk_0811BE38;
if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) {
this->direction = (this->playerAnimationState & 0xe) * 4;
if ((gPlayerState.direction != 0xff) && (gPlayerState.direction != this->direction)) {
if (((gPlayerState.direction - this->direction) & 0x1f) < 0x10) {
if ((gPlayerState.direction != DIR_NONE) && (gPlayerState.direction != this->direction)) {
if (((gPlayerState.direction - this->direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast |
DirectionSouth | DirectionWest)) < DirectionSouth) {
this->direction = this->direction + 2;
}
this->direction--;
this->direction &= 0x1f;
this->direction &= 0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest;
}
gPlayerState.direction = this->direction;
UpdateItemAnim(this);

View File

@ -69,7 +69,7 @@ void sub_08076758(ItemBehavior* this, u32 index) {
gPlayerEntity.field_0x7a.HWORD = 2;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status |= 0x10;
gPlayerState.animation = 0x288;
gPlayerState.animation = ANIM_ROCS_CAPE;
SoundReq(SFX_172);
}
} else {

View File

@ -31,7 +31,7 @@ void sub_08075338(ItemBehavior* this, u32 index) {
if (gPlayerState.flags & PL_MINISH) {
this->priority |= 0x80;
sub_08077D38(this, index);
gPlayerState.animation = 0xc00;
gPlayerState.animation = ANIM_SWORD_MINISH;
SoundReq(SFX_PLY_VO1);
return;
}
@ -80,7 +80,7 @@ void sub_08075338(ItemBehavior* this, u32 index) {
this->priority |= 0x80;
gPlayerState.lastSwordMove = SWORD_MOVE_ROLL;
gPlayerState.flags |= PL_SWORD_THRUST;
SetItemAnim(this, 0x130);
SetItemAnim(this, ANIM_ROLLATTACK_SLIDE);
SoundReq(SFX_PLY_VO3);
return;
}
@ -150,7 +150,7 @@ void sub_08075580(ItemBehavior* this, u32 index) {
} else {
this->timer = 0x50;
}
SetItemAnim(this, 0x168);
SetItemAnim(this, ANIM_SWORD_CHARGE);
CreateObject(SWORD_PARTICLE, 0, 0);
return;
}
@ -190,10 +190,10 @@ void sub_08075694(ItemBehavior* this, u32 index) {
if (gPlayerState.flags & PL_SWORD_THRUST) {
gPlayerState.flags &= ~PL_SWORD_THRUST;
gPlayerState.flags &= ~PL_ROLLING;
SetItemAnim(this, 300);
SetItemAnim(this, ANIM_ROLLATTACK_SPIN);
} else {
gPlayerState.lastSwordMove = SWORD_MOVE_SPIN;
SetItemAnim(this, 0x124);
SetItemAnim(this, ANIM_SPINATTACK);
}
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
this->stateID = 4;
@ -220,7 +220,7 @@ void sub_08075738(ItemBehavior* this, u32 index) {
}
if ((gPlayerState.sword_state & 0x10) != 0) {
if ((gPlayerState.direction & 0x80) == 0) {
if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) {
this->direction = gPlayerState.direction;
}
gPlayerEntity.direction = this->direction;
@ -252,7 +252,7 @@ void sub_08075738(ItemBehavior* this, u32 index) {
this->timer = 1;
this->subtimer = 1;
gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index);
SetItemAnim(this, 0x128);
SetItemAnim(this, ANIM_GREATSPIN);
}
if ((this->playerFrame & 0x80) != 0) {
@ -298,7 +298,7 @@ void sub_08075900(ItemBehavior* this, u32 index) {
} else {
if (this->timer != 0) {
if (--this->timer == 0) {
SetItemAnim(this, 0x134);
SetItemAnim(this, ANIM_ROLLATTACK_END);
}
gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3;
gPlayerEntity.speed = 0x300;

View File

@ -25,9 +25,9 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) {
this->field_0x18 = param_2;
if ((gPlayerState.flags & PL_NO_CAP)) {
SetItemAnim(this, 0x928);
SetItemAnim(this, ANIM_PICKUP_NOCAP);
} else {
SetItemAnim(this, 0x338);
SetItemAnim(this, ANIM_PICKUP);
}
gPlayerState.heldObject = 3;
gPlayerState.framestate = 4;
@ -108,12 +108,12 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) {
this->animPriority = 6;
gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa;
gPlayerState.keepFacing = (8 >> index) | gPlayerState.keepFacing;
if ((gPlayerState.flags & PL_NO_CAP) == 0) {
SetItemAnim(this, 0x378);
if (!(gPlayerState.flags & PL_NO_CAP)) {
SetItemAnim(this, ANIM_GRAB);
} else {
SetItemAnim(this, 0x948);
SetItemAnim(this, ANIM_GRAB_NOCAP);
}
SoundReq(SFX_88);
SoundReq(SFX_GRAB);
break;
default:
break;
@ -172,10 +172,10 @@ void sub_08076518(ItemBehavior* this, u32 index) {
this->field_0x18 = NULL;
this->stateID++;
this->animPriority = 0x0f;
if ((gPlayerState.flags & PL_NO_CAP) != 0) {
SetItemAnim(this, 0x930);
if (gPlayerState.flags & PL_NO_CAP) {
SetItemAnim(this, ANIM_THROW_NOCAP);
} else {
SetItemAnim(this, 0x344);
SetItemAnim(this, ANIM_THROW);
}
gPlayerState.field_0xa |= 8 >> index;
gPlayerState.keepFacing |= 8 >> index;

View File

@ -4,38 +4,38 @@
const ItemDefinition gItemDefinitions[] = {
[ITEM_NONE] = { TRUE, 1, CREATE_ITEM_0, PLAYER_ITEM_NONE, 0, 0, FALSE, FALSE },
[ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, 264, 6, TRUE, TRUE },
[ITEM_SMITH_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE },
[ITEM_GREEN_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE },
[ITEM_RED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE },
[ITEM_BLUE_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE },
[ITEM_UNUSED_SWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE },
[ITEM_FOURSWORD] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_SWORD, ANIM_SWORD, 6, TRUE, TRUE },
[ITEM_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE },
[ITEM_REMOTE_BOMBS] = { TRUE, 3, CREATE_ITEM_4, PLAYER_ITEM_BOMB, 0, 3, FALSE, FALSE },
[ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE },
[ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, 540, 3, FALSE, FALSE },
[ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 2072, 3, FALSE, FALSE },
[ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, 1796, 3, FALSE, FALSE },
[ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE },
[ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, 344, 2, FALSE, FALSE },
[ITEM_BOW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, ANIM_BOW_PULLOUT, 3, FALSE, FALSE },
[ITEM_LIGHT_ARROW] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOW, ANIM_BOW_PULLOUT, 3, FALSE, FALSE },
[ITEM_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, ANIM_BOOMERANG, 3, FALSE, FALSE },
[ITEM_MAGIC_BOOMERANG] = { TRUE, 5, CREATE_ITEM_3, PLAYER_ITEM_BOOMERANG, ANIM_BOOMERANG_MAGIC, 3, FALSE, FALSE },
[ITEM_SHIELD] = { FALSE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, ANIM_SHIELD_PULLOUT, 2, FALSE, FALSE },
[ITEM_MIRROR_SHIELD] = { TRUE, 1, CREATE_ITEM_3, PLAYER_ITEM_SHIELD, ANIM_SHIELD_PULLOUT, 2, FALSE, FALSE },
#ifdef EU
[ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE },
[ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 6, FALSE, FALSE },
[ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 6, FALSE, FALSE },
[ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 6, FALSE, FALSE },
#else
[ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE },
[ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, 1536, 2, FALSE, FALSE },
[ITEM_LANTERN_OFF] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 2, FALSE, FALSE },
[ITEM_LANTERN_ON] = { TRUE, 3, CREATE_ITEM_5, PLAYER_ITEM_LANTERN, ANIM_LANTERN_LIGHT, 2, FALSE, FALSE },
#endif
[ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, 1280, 2, FALSE, FALSE },
[ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, 1576, 6, TRUE, FALSE },
[ITEM_GUST_JAR] = { TRUE, 6, CREATE_ITEM_3, PLAYER_ITEM_GUST_JAR, ANIM_GUSTJAR_PULLOUT, 2, FALSE, FALSE },
[ITEM_PACCI_CANE] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_PACCI_CANE, ANIM_CANE, 6, TRUE, FALSE },
[ITEM_MOLE_MITTS] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NONE2, 0, 2, TRUE, FALSE },
[ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, 2060, 0, FALSE, FALSE },
[ITEM_PEGASUS_BOOTS] = { TRUE, CREATE_ITEM_1, PLAYER_ITEM_SWORD, 12, 260, 6, FALSE, FALSE },
[ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, 260, 6, FALSE, FALSE },
[ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, 2273, 6, FALSE, FALSE },
[ITEM_ROCS_CAPE] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_NONE3, ANIM_HOP, 0, FALSE, FALSE },
[ITEM_PEGASUS_BOOTS] = { TRUE, 1, CREATE_ITEM_1, PLAYER_ITEM_DASH_SWORD, ANIM_WALK, 6, FALSE, FALSE },
[ITEM_FIRE_ROD] = { TRUE, 4, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET, ANIM_WALK, 6, FALSE, FALSE },
[ITEM_OCARINA] = { TRUE, 7, CREATE_ITEM_3, PLAYER_ITEM_NONE, ANIM_OCARINA, 6, FALSE, FALSE },
[ITEM_ORB_GREEN] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED2, 0, 1, TRUE, TRUE },
[ITEM_ORB_BLUE] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_NULLED, 0, 1, TRUE, TRUE },
[ITEM_ORB_RED] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_CELL_OVERWRITE_SET2, 0, 1, TRUE, TRUE },
[ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, 832, 4, FALSE, TRUE },
[ITEM_TRY_PICKUP_OBJECT] = { TRUE, 2, CREATE_ITEM_3, PLAYER_ITEM_HELD_OBJECT, ANIM_PULL, 4, FALSE, TRUE },
[ITEM_BOTTLE1] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },
[ITEM_BOTTLE2] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },
[ITEM_BOTTLE3] = { TRUE, 3, CREATE_ITEM_3, PLAYER_ITEM_BOTTLE, 0, 6, TRUE, FALSE },

View File

@ -34,7 +34,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) {
gArea.portal_type = super->type;
if (!CheckGlobalFlag(EZERO_1ST)) {
gArea.portal_mode = 1;
gArea.portal_type = 5;
gArea.portal_type = PT_5;
} else {
if ((gPlayerState.flags & PL_USE_PORTAL) && gPlayerState.jump_status == 0) {
gArea.portal_mode = 2;
@ -83,7 +83,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) {
}
bool32 PortalReadyForMinish(void) {
if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != 0x6) &&
if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != PT_TOD) &&
(gPlayerState.heldObject == 0)) {
switch (gPlayerState.framestate) {
case PL_STATE_IDLE:

View File

@ -2080,7 +2080,7 @@ bool32 MoveNorthWest(Entity* this, s32 radius, s32 angle, u32 collisionType) {
bool32 ProcessMovement0(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 0);
result = ProcessMovementInternal(this, this->speed, this->direction, 0);
} else {
@ -2092,7 +2092,7 @@ bool32 ProcessMovement0(Entity* this) {
bool32 ProcessMovement1(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 1);
result = ProcessMovementInternal(this, this->speed, this->direction, 1);
} else {
@ -2104,7 +2104,7 @@ bool32 ProcessMovement1(Entity* this) {
bool32 ProcessMovement2(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 2);
result = ProcessMovementInternal(this, this->speed, this->direction, 2);
} else {
@ -2116,7 +2116,7 @@ bool32 ProcessMovement2(Entity* this) {
bool32 ProcessMovement10(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 10);
result = ProcessMovementInternal(this, this->speed, this->direction, 10);
} else {
@ -2128,7 +2128,7 @@ bool32 ProcessMovement10(Entity* this) {
bool32 ProcessMovement12(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 12);
result = ProcessMovementInternal(this, this->speed, this->direction, 12);
} else {
@ -2140,7 +2140,7 @@ bool32 ProcessMovement12(Entity* this) {
bool32 ProcessMovement0_custom(Entity* this, u32 direction, u32 speed) {
bool32 result;
if ((direction & 0x80) == 0) {
if (!(direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, direction, 0);
result = ProcessMovementInternal(this, speed, direction, 0);
} else {
@ -2152,7 +2152,7 @@ bool32 ProcessMovement0_custom(Entity* this, u32 direction, u32 speed) {
bool32 ProcessMovement3(Entity* this) {
bool32 result;
if (((this->direction & 0x80) == 0) && (sub_080AF0C8(this) == 0)) {
if (!(this->direction & DIR_NOT_MOVING_CHECK) && !sub_080AF0C8(this)) {
CalculateEntityTileCollisions(this, this->direction, 3);
result = ProcessMovementInternal(this, this->speed, this->direction, 3);
} else {
@ -2165,25 +2165,29 @@ bool32 sub_080AF0C8(Entity* this) {
u32 tileType = GetTileTypeByEntity(this);
switch (tileType) {
case 0x87:
if (((this->direction + 7) & 0x1f) < 0x10) {
if (((this->direction + 7) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth |
DirectionWest)) < DirectionSouth) {
this->collisions = COL_NORTH_ANY;
return TRUE;
}
break;
case 0x8a:
if (((this->direction - 1) & 0x1f) < 0x10) {
if (((this->direction - 1) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth |
DirectionWest)) < DirectionSouth) {
this->collisions = COL_EAST_ANY;
return TRUE;
}
break;
case 0x88:
if (((this->direction - 9) & 0x1f) < 0x10) {
if (((this->direction - 9) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth |
DirectionWest)) < DirectionSouth) {
this->collisions = COL_SOUTH_ANY;
return TRUE;
}
break;
case 0x89:
if (((this->direction - 0x11) & 0x1f) < 0x10) {
if (((this->direction - 0x11) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth |
DirectionWest)) < DirectionSouth) {
this->collisions = COL_WEST_ANY;
return TRUE;
}
@ -2195,7 +2199,7 @@ bool32 sub_080AF0C8(Entity* this) {
bool32 ProcessMovement4(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 4);
result = ProcessMovementInternal(this, this->speed, this->direction, 4);
} else {
@ -2207,7 +2211,7 @@ bool32 ProcessMovement4(Entity* this) {
bool32 ProcessMovement5(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 5);
result = ProcessMovementInternal(this, this->speed, this->direction, 5);
} else {
@ -2231,7 +2235,7 @@ void Knockback2(Entity* this) {
bool32 ProcessMovement6(Entity* this) {
bool32 result;
if ((this->direction & 0x80) == 0) {
if (!(this->direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, this->direction, 6);
result = ProcessMovementInternal(this, this->speed, this->direction, 6);
} else {
@ -2243,7 +2247,7 @@ bool32 ProcessMovement6(Entity* this) {
bool32 ProcessMovement6_custom(Entity* this, u32 direction, u32 speed) {
bool32 result;
if ((direction & 0x80) == 0) {
if (!(direction & DIR_NOT_MOVING_CHECK)) {
CalculateEntityTileCollisions(this, direction, 6);
result = ProcessMovementInternal(this, speed, direction, 6);
} else {

View File

@ -206,12 +206,12 @@ void sub_08066570(Entity* this) {
direction = GetFacingDirection(this, &gPlayerEntity);
cond = TRUE;
dir2 = (direction & 0x18);
dir1 = (this->direction & 0x18);
tmp = 0x18;
dir2 = (direction & DirectionWest);
dir1 = (this->direction & DirectionWest);
tmp = DirectionWest;
if (dir1 == dir2) {
dir1 = (direction + 5) & 7;
dir2 = (this->direction + 5) & 7;
dir1 = (direction + 5) & (0x3 | DirectionNorthEast);
dir2 = (this->direction + 5) & (0x3 | DirectionNorthEast);
if (dir2 < 3 && dir1 < 3) {
cond = FALSE;
}

View File

@ -222,7 +222,7 @@ void Book_Action5(BookEntity* this) {
u32 sub_0809B688(Entity* this) {
u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12);
if (ret == 1 && gPlayerState.direction != 16) {
if (ret == 1 && gPlayerState.direction != DirectionSouth) {
ret = 0;
}

View File

@ -53,7 +53,7 @@ void ChuchuBossCutscene_Action3(Entity* this) {
GetNextFrame(this);
if (--this->timer == 0) {
this->action++;
this->direction = 0;
this->direction = DirectionNorth;
this->speed = 0x100;
this->zVelocity = Q_16_16(2.0);
this->spriteOrientation.flipY = 0;

View File

@ -138,7 +138,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
if (super->parent->action == 2) {
switch (super->parent->subAction) {
case 1:
if ((gPlayerState.direction & 0x80) != 0) {
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) {
InitializeAnimation(super, 4);
} else {
GetNextFrame(super);
@ -161,7 +161,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
} else {
gPlayerState.mobility |= 0x80;
gPlayerState.heldObject = 5;
if ((gPlayerState.direction & 0x80) != 0) {
if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) {
InitializeAnimation(super, (super->type >> 1) + 3);
} else {
GetNextFrame(super);

View File

@ -43,7 +43,7 @@ static void FileScreenObjects_Type15(FileScreenObjectsEntity*);
static void FileScreenObjects_Type18(FileScreenObjectsEntity*);
static void FileScreenObjects_Type19(FileScreenObjectsEntity*);
static void FileScreenObjects_Type21(FileScreenObjectsEntity*);
static void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity*);
static void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity*);
static void FileScreenObjects_Type23_Init(FileScreenObjectsEntity*);
typedef struct {
@ -86,7 +86,7 @@ void FileScreenObjects(FileScreenObjectsEntity* this) {
void FileScreenObjects_Type23(FileScreenObjectsEntity* this) {
static void (*const FileScreenObjects_Type23_Actions[])(FileScreenObjectsEntity*) = {
FileScreenObjects_Type23_Init,
FileScreenObjects_Type23_Action1,
FileScreenObjects_Type23_LinkPreview,
};
FileScreenObjects_Type23_Actions[super->action](this);
}
@ -99,7 +99,7 @@ void FileScreenObjects_Type23_Init(FileScreenObjectsEntity* this) {
super->action = 1;
}
void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity* this) {
void FileScreenObjects_Type23_LinkPreview(FileScreenObjectsEntity* this) {
u32 var0;
u32 offset;
@ -114,9 +114,9 @@ void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity* this) {
if (super->type2 != gMapDataBottomSpecial.unk6) {
super->type2 = gMapDataBottomSpecial.unk6;
this->unk_68 = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100;
this->unk_68 = CheckGlobalFlag(EZERO_1ST) == 0 ? ANIM_DEFAULT_NOCAP : ANIM_DEFAULT;
this->unk_70 = 4;
super->animationState = 2;
super->animationState = PAS_SOUTH;
offset = gUnk_08133368[GetPlayerPalette(TRUE) - 22] & 0xFFFFFF;
LoadPalettes(&gGlobalGfxAndPalettes[offset], 31, 1);
}
@ -125,16 +125,16 @@ void FileScreenObjects_Type23_Action1(FileScreenObjectsEntity* this) {
if (gInput.heldKeys & L_BUTTON) {
switch (gInput.newKeys) {
case DPAD_UP:
super->animationState = 0;
super->animationState = PAS_NORTH;
break;
case DPAD_RIGHT:
super->animationState = 1;
super->animationState = PAS_EAST;
break;
case DPAD_DOWN:
super->animationState = 2;
super->animationState = PAS_SOUTH;
break;
case DPAD_LEFT:
super->animationState = 3;
super->animationState = PAS_WEST;
break;
case B_BUTTON:
this->unk_70 = this->unk_70 ? 0 : 4;

View File

@ -90,10 +90,10 @@ void GraveyardKey_Init(Entity* this, const struct_gUnk_08123FB0* param_2) {
this->y.HALF.HI -= param_2->y;
this->z.WORD = 0;
this->timer = param_2->timer;
if ((this->direction & 0x80)) {
if ((this->direction & DIR_NOT_MOVING_CHECK)) {
dir = this->direction;
if (dir == 0x81) {
this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ 0x10;
if (dir == (DIR_NOT_MOVING_CHECK | 0x1)) {
this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ DirectionSouth;
}
}
UpdateSpriteForCollisionLayer(this);

View File

@ -122,9 +122,9 @@ void sub_0808C01C(JarPortalEntity* this, u32 r1) {
gArea.portal_x = super->x.HALF.HI;
gArea.portal_y = super->y.HALF.HI;
gArea.portal_exit_dir = 2;
type = 4;
type = PT_JAR;
if (r1 != 0)
type = 2;
type = PT_2;
gArea.portal_type = type;
if (r1 == 1) {
if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) {

View File

@ -477,7 +477,7 @@ void sub_0809E1F0(KeyStealingTakkuriEntity* this) {
void sub_0809E210(KeyStealingTakkuriEntity* this) {
gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, super)) & 0xfe;
gPlayerState.animation = 0x100;
gPlayerState.animation = ANIM_DEFAULT;
}
void sub_0809E238(KeyStealingTakkuriEntity* this) {

View File

@ -551,7 +551,7 @@ void sub_08085E74(LilypadLargeEntity* this) {
gPlayerEntity.x.HALF.LO = 0;
gPlayerEntity.y.HALF.LO = 0;
gPlayerEntity.direction = super->direction;
gPlayerState.animation = 0x100;
gPlayerState.animation = ANIM_DEFAULT;
gRoomControls.camera_target = super;
if (gPlayerState.item != NULL) {
DeleteEntity(gPlayerState.item);

View File

@ -271,7 +271,7 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) {
SetTile(0x4022, unk_1, this->collisionLayer);
this->timer = 7;
this->spriteSettings.draw = 1;
this->direction = (unk_0 << 3) ^ 0x10;
this->direction = (unk_0 << 3) ^ DirectionSouth;
tmp = &gUnk_0811F688[unk_0];
if (this->type2 != 2) {
this->x.HALF.HI += tmp->x;

View File

@ -11,7 +11,7 @@
typedef struct {
Entity base;
u8 filler[0x1C];
u8 filler[28];
MinecartData* minecartData;
} MinecartEntity;

View File

@ -52,7 +52,7 @@ void sub_0808A484(Entity* this) {
this->action = 1;
this->spriteSettings.draw = TRUE;
this->speed = 0x40;
this->direction = 6;
this->direction = DirectionNorthEast | 0x2;
this->spriteRendering.b3 = 1;
this->spritePriority.b0 = 0;
this->spriteOrientation.flipY = 1;

View File

@ -48,7 +48,7 @@ const struct_0811F960 gUnk_0811F960[] = {
{0x5, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_164},
{0x0, 0x1, 0x14, SFX_1A8},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, SFX_GRAB},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_NONE},
@ -87,9 +87,9 @@ const struct_0811F960 gUnk_0811F960[] = {
{0x0, 0x1, 0x00, SFX_1B4},
{0x0, 0x1, 0x13, SFX_164},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, SFX_88},
{0x0, 0x1, 0x10, SFX_GRAB},
{0x0, 0x1, 0x10, SFX_GRAB},
{0x0, 0x1, 0x10, SFX_GRAB},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x1, 0x00, SFX_NONE},
{0x0, 0x0, 0x00, SFX_11D},

View File

@ -69,15 +69,15 @@ void SwordParticle_Action1(SwordParticleEntity* this) {
u32 tmp2;
if (super->type2 != 0) {
if ((gPlayerState.field_0x1f[2] == 0) || ((gPlayerState.attack_status & 0x80) != 0)) {
if ((gPlayerState.bow_state == 0) || ((gPlayerState.attack_status & 0x80) != 0)) {
DeleteThisEntity();
}
if (gPlayerState.field_0x1f[2] >= 0x50) {
if (gPlayerState.bow_state >= 0x50) {
super->spriteSettings.draw = 1;
tmp1 = gPlayerState.field_0x1f[2];
tmp1 = gPlayerState.bow_state;
ptr = gUnk_081217D8;
} else {
if (gPlayerState.field_0x1f[2] != 0) {
if (gPlayerState.bow_state != 0) {
super->spriteSettings.draw = 0;
return;
}

View File

@ -321,7 +321,7 @@ void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3) {
ptr = ptr + (u32)ptr[1] * -3;
}
if (*ptr == 0xff) {
this->direction = 0xff;
this->direction = DIR_NONE;
this->speed = 0;
} else {
this->direction = (u8)*ptr;

View File

@ -245,17 +245,21 @@ bool32 sub_0806F8DC(Entity* ent) {
return TRUE;
}
#define CDIR_DIAGONAL 1
#define CDirectionSouth 4
#define CDirectionWest 6
u32 sub_0806F948(Entity* ent) {
u32 v1;
if (gPlayerState.direction == 0xFF)
u32 direction;
if (gPlayerState.direction == DIR_NONE)
return ent->animationState;
v1 = gPlayerState.direction / 4;
if ((v1 & 1) && !(((v1 + 1) - ent->animationState) & 4)) {
direction = gPlayerState.direction / 4;
if ((direction & CDIR_DIAGONAL) && !(((direction + 1) - ent->animationState) & CDirectionSouth)) {
return ent->animationState;
} else {
ent->spriteSettings.flipX = v1 > 4;
ent->animationState = v1 & 6;
ent->spriteSettings.flipX = direction > CDirectionSouth;
ent->animationState = direction & CDirectionWest;
}
return ent->animationState;
}

File diff suppressed because it is too large Load Diff

View File

@ -105,7 +105,7 @@ void ItemInit(Entity* this) {
} else {
this->spriteVramOffset = definition->gfx & 0x3ff;
}
if (this->animationState == 0) {
if (this->animationState == IdleNorth) {
this->animationState = gPlayerEntity.animationState & 6;
}

View File

@ -148,8 +148,9 @@ void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) {
bool32 uVar6;
sub_0801B804(this);
if ((this->unk_68 == 12) && (this->unk_80 == 0) && ((gPlayerState.direction & 0x80) == 0)) {
if (((this->unk_82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) {
if ((this->unk_68 == 12) && (this->unk_80 == 0) && !(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) {
if (((this->unk_82.HALF.HI - gPlayerState.direction) &
(0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest)) > DirectionSouth) {
this->unk_82.HWORD += 0x40;
this->unk_82.HALF.HI &= 0x1f;
super->direction = this->unk_82.HALF.HI;

View File

@ -210,16 +210,16 @@ void PlayerItemBow_Action1(PlayerItemBowEntity* this) {
}
} else {
if ((PlayerItemBowEntity*)gPlayerState.item != this || (gPlayerState.field_0x1f[2] == 0)) {
if ((PlayerItemBowEntity*)gPlayerState.item != this || (gPlayerState.bow_state == 0)) {
if ((PlayerItemBowEntity*)gPlayerState.item == this) {
gPlayerState.item = 0;
}
gPlayerState.field_0x1f[2] = 0;
gPlayerState.bow_state = 0;
DeleteThisEntity();
}
if ((this->unk_68 == 0xa) && (gPlayerState.field_0x1f[2] != 0)) {
if (gPlayerState.field_0x1f[2] < 0x78) {
gPlayerState.field_0x1f[2]++;
if ((this->unk_68 == 0xa) && (gPlayerState.bow_state != 0)) {
if (gPlayerState.bow_state < 0x78) {
gPlayerState.bow_state++;
} else {
super->hurtType = 0x0e;
}

View File

@ -378,7 +378,7 @@ void ResetActiveItems() {
gPlayerState.moleMittsState = 0;
gPlayerState.field_0x1c = 0;
gPlayerState.field_0x1f[2] = 0;
gPlayerState.bow_state = 0;
gPlayerState.grab_status = 0;
gPlayerState.itemAnimPriority = 0;
gPlayerState.dash_state = 0;
@ -495,7 +495,7 @@ Entity* sub_08077CF8(u32 id, u32 type, u32 type2, u32 unk) {
}
void sub_08077D38(ItemBehavior* this, u32 index) {
u32 r6;
u32 anim;
ItemDefinition* ptr;
gPlayerState.field_0xa |= 8 >> index;
@ -510,16 +510,16 @@ void sub_08077D38(ItemBehavior* this, u32 index) {
if ((gPlayerState.flags & PL_NO_CAP)) {
switch (this->behaviorId) {
case 0x1b:
r6 = 0x948;
anim = ANIM_GRAB_NOCAP;
break;
case 1:
r6 = 0x408;
anim = ANIM_SWORD_NOCAP;
break;
case 0xd:
r6 = 0x40c;
anim = ANIM_SHIELD_PULLOUT_NOCAP;
break;
}
SetItemAnim(this, r6);
SetItemAnim(this, anim);
} else {
SetItemAnim(this, ptr->frameIndex);
}
@ -588,8 +588,8 @@ void DeleteItemBehavior(ItemBehavior* this, u32 index) {
}
bool32 sub_08077EC8(ItemBehavior* this) {
if ((gPlayerState.sword_state & 8) != 0) {
SetItemAnim(this, 0x170);
if (gPlayerState.sword_state & 8) {
SetItemAnim(this, ANIM_SWORD_CHARGE_BUMP);
this->timer = 0x28;
this->stateID = 7;
this->animPriority = 6;
@ -1043,15 +1043,15 @@ void DetermineRButtonInteraction(void) {
}
bool32 sub_080782C0(void) {
u8 tmp;
u8 framestate;
Entity* entity;
if (gPlayerState.framestate == PL_STATE_IDLE) {
tmp = gPlayerState.framestate_last;
framestate = gPlayerState.framestate_last;
} else {
tmp = gPlayerState.framestate;
framestate = gPlayerState.framestate;
}
switch (tmp) {
switch (framestate) {
case PL_STATE_SWORD:
case PL_STATE_GUSTJAR:
case PL_STATE_C:
@ -1363,7 +1363,7 @@ void ClearPlayerState(void) {
gPlayerState.dash_state = 0;
gPlayerState.field_0x1f[0] = 0;
gPlayerState.field_0x1f[1] = 0;
gPlayerState.field_0x1f[2] = 0;
gPlayerState.bow_state = 0;
gPlayerState.tilePosition = 0;
gPlayerState.tileType = 0;
gPlayerState.swim_state = 0;
@ -1490,7 +1490,7 @@ bool32 CheckQueuedAction(void) {
// this doesnt seem to have any real function where its used
void CheckPlayerVelocity(void) {
u32 angle = gPlayerState.direction;
if ((angle & 0x80) != 0) {
if ((angle & DIR_NOT_MOVING_CHECK) != 0) {
ResetPlayerVelocity();
} else {
gPlayerState.vel_x = gSineTable[angle * 8];
@ -1576,9 +1576,10 @@ void sub_08079064(Entity* this) {
if (gPlayerState.itemAnimPriority < maxAnimPriority) {
gPlayerState.animation = animIndex;
} else if ((gPlayerState.swim_state & 0x80) != 0) {
gPlayerState.animation = 0x2be;
gPlayerState.animation = ANIM_DIVE;
} else {
if (gPlayerState.animation == 0x608 || gPlayerState.animation == 0x104 || gPlayerState.animation == 0x404) {
if (gPlayerState.animation == ANIM_LANTERN || gPlayerState.animation == ANIM_WALK ||
gPlayerState.animation == ANIM_WALK_NOCAP) {
sub_080790E4(this);
}
}
@ -1616,9 +1617,9 @@ void sub_080790E4(Entity* this) {
gPlayerState.field_0x35 = this->animationState;
gPlayerState.framestate = PL_STATE_PUSH;
if ((gPlayerState.flags & PL_NO_CAP) != 0) {
gPlayerState.animation = 0x93c;
gPlayerState.animation = ANIM_PUSH_NOCAP;
} else {
gPlayerState.animation = 0x33c;
gPlayerState.animation = ANIM_PUSH;
}
}
@ -1672,7 +1673,7 @@ void PlayerMinishSetNormalAndCollide(void) {
gPlayerEntity.action = PLAYER_MINISH;
gPlayerEntity.subAction = 1;
gPlayerEntity.collisionFlags &= 0xfb;
gPlayerState.animation = 0xc18;
gPlayerState.animation = ANIM_BOUNCE_MINISH;
gPlayerState.flags &=
~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE);
gPlayerState.swim_state = 0;
@ -1752,7 +1753,7 @@ code_3:
void sub_08079520(Entity* this) {
s32 tmp = gPlayerState.direction;
if (tmp < 0x80) {
if (tmp < DIR_NOT_MOVING_CHECK) {
this->direction = gPlayerState.direction;
} else {
this->direction = (this->animationState >> 1) << 3;
@ -1773,7 +1774,7 @@ bool32 sub_08079550(void) {
if (gDiggingCaveEntranceTransition.isDiggingCave == 0) {
if ((gPlayerState.dash_state == 0 || (gPlayerState.flags & PL_BURNING)) &&
(gPlayerState.swim_state != 0 || (gPlayerState.sword_state & 0x40) ||
gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & 0x80))) {
gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & DIR_NOT_MOVING_CHECK))) {
gPlayerEntity.subtimer = 0;
return FALSE;
}
@ -1865,72 +1866,74 @@ void sub_080797EC(void) {
if ((gPlayerState.flags & PL_NO_CAP) != 0) {
if (gPlayerState.heldObject != 0) {
animation = 0x934;
animation = ANIM_CARRY_NOCAP;
} else if (gPlayerState.shield_status != 0) {
animation = 0x410;
} else if (gPlayerState.field_0x1f[2] == 0) {
animation = ANIM_SHIELD_WALK_NOCAP;
} else if (gPlayerState.bow_state == 0) {
if (gPlayerState.swim_state != 0) {
animation = 0x290;
animation = ANIM_SWIM_MOVE;
} else {
animation = 0x16c;
animation = ANIM_SWORD_CHARGE_WALK;
if ((gPlayerState.sword_state & 0x48) != 0) {
gPlayerState.prevAnim = 0x6c;
return;
} else if (gPlayerState.sword_state == 0) {
if (gPlayerState.framestate == 0) {
gPlayerState.framestate = 1;
if (gPlayerState.framestate == PL_STATE_IDLE) {
gPlayerState.framestate = PL_STATE_WALK;
}
animation = 0x404;
animation = ANIM_WALK_NOCAP;
} else {
animation = 0x16c;
animation = ANIM_SWORD_CHARGE_WALK;
if (sub_080793E4(0)) {
if (sub_080B1B44(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) {
gPlayerState.sword_state &= ~8;
animation = 0x170;
animation = ANIM_SWORD_CHARGE_BUMP;
}
}
}
}
} else {
animation = 0x284;
animation = ANIM_BOW_WALK;
}
} else {
if (gPlayerState.field_0x1c != 0) {
return;
} else if (gPlayerState.heldObject != 0) {
animation = 0x348;
animation = ANIM_CARRY;
} else if (gPlayerState.dash_state != 0) {
animation = 0x298;
animation = ANIM_DASH;
} else if ((gPlayerState.flags & PL_IN_MINECART) != 0) {
animation = 0x710;
animation = ANIM_MINECART;
} else if (gPlayerState.shield_status != 0) {
animation = 0x160;
} else if (gPlayerState.field_0x1f[2] != 0) {
animation = 0x284;
animation = ANIM_SHIELD_WALK;
} else if (gPlayerState.bow_state != 0) {
animation = ANIM_BOW_WALK;
} else {
if (gPlayerState.swim_state != 0) {
animation = 0x290;
animation = ANIM_SWIM_MOVE;
} else {
animation = 0x16c;
animation = ANIM_SWORD_CHARGE_WALK;
if ((gPlayerState.sword_state & 0x48) != 0) {
gPlayerState.prevAnim = 0x6c;
return;
} else if (gPlayerState.sword_state != 0) {
animation = 0x16c;
animation = ANIM_SWORD_CHARGE_WALK;
if (sub_080793E4(0)) {
if (sub_080B1B44(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) {
gPlayerState.sword_state &= ~8;
animation = 0x170;
animation = ANIM_SWORD_CHARGE_BUMP;
}
}
} else {
if (gPlayerState.framestate == 0) {
gPlayerState.framestate = 1;
if (gPlayerState.framestate == PL_STATE_IDLE) {
gPlayerState.framestate = PL_STATE_WALK;
}
if ((gPlayerState.flags & PL_USE_LANTERN) != 0) {
animation = 0x608;
animation = ANIM_LANTERN;
} else {
animation = 0x104;
// Change to test animations I guess
animation = ANIM_WALK;
// animation = 12;
}
}
}
@ -1949,19 +1952,19 @@ void ResolvePlayerAnimation(void) {
u32 anim;
if ((gPlayerState.flags & PL_NO_CAP) != 0) {
if (gPlayerState.heldObject != 0) {
anim = 0x92c;
anim = ANIM_CARRY_STAND_NOCAP;
} else {
if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) {
return;
}
if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) != 0) {
anim = 0x810;
anim = ANIM_JUMP;
} else if (gPlayerState.shield_status != 0) {
anim = 0x414;
} else if (gPlayerState.field_0x1f[2] != 0) {
anim = 0x280;
anim = ANIM_SHIELD_NOCAP;
} else if (gPlayerState.bow_state != 0) {
anim = ANIM_BOW_CHARGE;
} else if (gPlayerState.swim_state != 0) {
anim = 0x28c;
anim = ANIM_SWIM_STILL;
} else {
if ((gPlayerState.sword_state & 0x48) != 0) {
return;
@ -1972,54 +1975,54 @@ void ResolvePlayerAnimation(void) {
}
if ((gPlayerState.flags & PL_USE_PORTAL) != 0) {
switch (gArea.portal_type) {
case 5:
anim = 0x400;
case PT_5:
anim = ANIM_DEFAULT_NOCAP;
break;
case 4:
anim = 0x100;
case PT_JAR:
anim = ANIM_DEFAULT;
break;
default:
anim = 0x2c2;
anim = ANIM_PORTAL;
break;
}
} else {
anim = 0x400;
anim = ANIM_DEFAULT_NOCAP;
}
} else {
anim = 0x168;
anim = ANIM_SWORD_CHARGE;
}
}
}
} else {
if (gPlayerState.heldObject != 0) {
anim = 0x350;
anim = ANIM_CARRY_STAND;
} else {
if ((gPlayerState.field_0x1c | gPlayerState.moleMittsState) != 0) {
return;
}
if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) {
anim = 0x8b0;
anim = ANIM_MOLDWORM_CAPTURED;
} else if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) != 0) {
anim = 0x810;
anim = ANIM_JUMP;
} else if (gPlayerState.dash_state != 0) {
anim = 0x298;
anim = ANIM_DASH;
} else if ((gPlayerState.flags & PL_IN_MINECART) != 0) {
anim = 0x70c;
anim = ANIM_MINECART_PAUSE;
} else if (gPlayerState.shield_status != 0) {
anim = 0x164;
} else if (gPlayerState.field_0x1f[2] != 0) {
anim = 0x280;
anim = ANIM_SHIELD;
} else if (gPlayerState.bow_state != 0) {
anim = ANIM_BOW_CHARGE;
} else if (gPlayerState.swim_state != 0) {
anim = 0x28c;
anim = ANIM_SWIM_STILL;
} else {
if ((gPlayerState.sword_state & 0x48) != 0) {
return;
}
if ((gPlayerState.flags & PL_USE_PORTAL) != 0) {
anim = (gArea.portal_type == 4) ? 0x530 : 0x2c2;
anim = (gArea.portal_type == PT_JAR) ? ANIM_IN_POT : ANIM_PORTAL;
} else {
if (gPlayerState.sword_state != 0) {
anim = 0x168;
anim = ANIM_SWORD_CHARGE;
} else {
if (gPlayerState.attack_status != 0) {
return;
@ -2028,9 +2031,9 @@ void ResolvePlayerAnimation(void) {
if (gActiveItems[ACTIVE_ITEM_LANTERN].animPriority != 0) {
return;
}
anim = 0x604;
anim = ANIM_LANTERN_ON;
} else {
anim = 0x100;
anim = ANIM_DEFAULT;
}
}
}
@ -2071,8 +2074,8 @@ bool32 sub_08079B24(void) {
}
if ((gPlayerState.jump_status & 0x41) == 0) {
gPlayerState.jump_status = 0x41;
gPlayerEntity.direction = 0xff;
gPlayerState.direction = 0xff;
gPlayerEntity.direction = DIR_NONE;
gPlayerState.direction = DIR_NONE;
return TRUE;
} else {
return TRUE;
@ -2659,7 +2662,7 @@ bool32 sub_0807AC54(Entity* this) {
this->action = 0x1d;
this->subAction = 0;
this->y.HALF.LO = 0;
gPlayerState.animation = 0x2cf;
gPlayerState.animation = ANIM_CLIMB1_UP;
return TRUE;
case SURFACE_AUTO_LADDER:
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
@ -2749,7 +2752,7 @@ void PlayerUpdateSwimming(Entity* this) {
ModHealth(-2);
SoundReq(SFX_PLY_VO6);
}
if ((this->direction & 0x80) != 0) {
if (this->direction & DIR_NOT_MOVING_CHECK) {
if ((gRoomTransition.frameCount & 0xf) == 0) {
CreateRandomWaterTrace(this, 4);
}
@ -2824,21 +2827,21 @@ u32 GetSwordBeam(void) {
}
void sub_0807B068(Entity* entity) {
if ((gPlayerState.dash_state | gPlayerState.attack_status) == 0) {
if (gPlayerState.swim_state != 0) {
if ((gPlayerState.swim_state & 0x80) != 0) {
gPlayerState.animation = 0xc1c;
if (!(gPlayerState.dash_state | gPlayerState.attack_status)) {
if (gPlayerState.swim_state) {
if (gPlayerState.swim_state & 0x80) {
gPlayerState.animation = ANIM_DIVE_MINISH;
} else {
gPlayerState.animation = 0xc0c;
gPlayerState.animation = ANIM_SWIM_MINISH;
}
} else {
if ((gPlayerState.direction & 0x80) != 0) {
if (gPlayerState.animation != 0xc18) {
gPlayerState.animation = 0xc18;
if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) {
if (gPlayerState.animation != ANIM_BOUNCE_MINISH) {
gPlayerState.animation = ANIM_BOUNCE_MINISH;
}
} else {
if (gPlayerState.animation != 0xc04) {
gPlayerState.animation = 0xc04;
if (gPlayerState.animation != ANIM_WALK_MINISH) {
gPlayerState.animation = ANIM_WALK_MINISH;
}
}
}
@ -2902,7 +2905,7 @@ void sub_0807B1EC(PlayerEntity* this) {
if (--super->timer == 0) {
this->unk_6e++;
super->zVelocity = Q_16_16(1.0);
gPlayerState.animation = 0x2c2;
gPlayerState.animation = ANIM_PORTAL;
}
}

View File

@ -88,7 +88,7 @@ void sub_080A82D8(Entity* this) {
this->action = 4;
COLLISION_OFF(this);
this->zVelocity = Q_16_16(1.0);
this->direction ^= 0x10;
this->direction ^= DirectionSouth;
this->speed = 0x80;
}

View File

@ -24,7 +24,7 @@ void FireProjectile_Init(Entity* this) {
InitializeAnimation(this, this->direction >> 3);
} else {
this->action = 2;
InitializeAnimation(this, this->direction >> 3 | 4);
InitializeAnimation(this, this->direction >> 3 | IdleSouth);
EnqueueSFX(SFX_15E);
}
}
@ -41,7 +41,7 @@ void FireProjectile_Action1(Entity* this) {
if (this->spriteSettings.draw == 1) {
CopyPosition(parent, this);
if (this->timer != 0) {
direction = parent->direction & 0x18;
direction = parent->direction & DirectionWest;
this->direction = direction;
this->timer = 0;
InitializeAnimation(this, direction >> 3);

View File

@ -264,7 +264,7 @@ void sub_080AC6F0(Entity* this) {
u32 uVar4;
u32 tmp;
uVar4 = this->direction & 0x1f;
uVar4 = this->direction & (0x3 | DirectionNorthWest);
uVar1 = this->direction >> 5;
iVar3 = uVar1 * 3;
tmp = gUnk_0812A9C0[this->animationState] - uVar1 * 3;

View File

@ -24,7 +24,7 @@ void IceProjectile_Init(Entity* this) {
InitializeAnimation(this, this->direction >> 3);
} else {
this->action = 2;
InitializeAnimation(this, this->direction >> 3 | 4);
InitializeAnimation(this, this->direction >> 3 | IdleSouth);
EnqueueSFX(SFX_160);
}
}
@ -43,7 +43,7 @@ void IceProjectile_Action1(Entity* this) {
if (this->spriteSettings.draw == 1) {
CopyPosition(parent, this);
if (this->timer != 0) {
direction = parent->direction & 0x18;
direction = parent->direction & DirectionWest;
this->direction = direction;
this->timer = 0;
InitializeAnimation(this, direction >> 3);

View File

@ -36,7 +36,7 @@ void V3TennisBallProjectile_OnCollision(Entity* this) {
this->speed += 0x80 * 2;
this->child = this->contactedEntity;
if (sub_080ACB40(this)) {
this->direction = 0;
this->direction = DirectionNorth;
} else {
this->direction = this->knockbackDirection;
}
@ -53,7 +53,7 @@ void V3TennisBallProjectile_OnCollision(Entity* this) {
void V3TennisBallProjectile_Init(Entity* this) {
this->action = 1;
this->direction = 0x10;
this->direction = DirectionSouth;
this->z.HALF.HI = -4;
this->child = NULL;
InitializeAnimation(this, 7);

View File

@ -24,7 +24,7 @@ void WindProjectile_Init(Entity* this) {
InitializeAnimation(this, this->direction >> 3);
} else {
this->action = 2;
InitializeAnimation(this, this->direction >> 3 | 4);
InitializeAnimation(this, this->direction >> 3 | IdleSouth);
EnqueueSFX(SFX_15F);
}
}
@ -40,7 +40,7 @@ void WindProjectile_Action1(Entity* this) {
} else {
if (this->spriteSettings.draw == 1) {
CopyPosition(parent, this);
direction = (parent->direction + 4) & 0x18;
direction = (parent->direction + 4) & DirectionWest;
if (this->timer != 0) {
this->direction = direction;
this->animationState = direction >> 2;

View File

@ -1582,25 +1582,25 @@ void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) {
void sub_0807F1C4(Entity* entity, ScriptExecutionContext* context) {
if (gPlayerState.flags & PL_NO_CAP) {
gPlayerState.animation = 0x459;
gPlayerState.animation = ANIM_DIE1_NOCAP;
} else {
gPlayerState.animation = 0x1bc;
gPlayerState.animation = ANIM_DIE1;
}
}
void sub_0807F1E8(Entity* entity, ScriptExecutionContext* context) {
if (gPlayerState.flags & PL_NO_CAP) {
gPlayerState.animation = 0x45a;
gPlayerState.animation = ANIM_DIE2_NOCAP;
} else {
gPlayerState.animation = 0x2bd;
gPlayerState.animation = ANIM_DIE2;
}
}
void sub_0807F210(Entity* entity, ScriptExecutionContext* context) {
if (gPlayerState.flags & PL_NO_CAP) {
gPlayerState.animation = 0x41c;
gPlayerState.animation = ANIM_HOP_NOCAP;
} else {
gPlayerState.animation = 0x80c;
gPlayerState.animation = ANIM_HOP;
}
}

View File

@ -958,7 +958,7 @@ const Song gSongTable[] = {
[SFX_FALL_HOLE] = { &sfxFallHole, MUSIC_PLAYER_04, MUSIC_PLAYER_04 },
[SFX_86] = { &sfx86, MUSIC_PLAYER_0F, MUSIC_PLAYER_0F },
[SFX_PLY_DIE] = { &sfxPlyDie, MUSIC_PLAYER_1D, MUSIC_PLAYER_1D },
[SFX_88] = { &sfx88, MUSIC_PLAYER_1C, MUSIC_PLAYER_1C },
[SFX_GRAB] = { &sfx88, MUSIC_PLAYER_1C, MUSIC_PLAYER_1C },
[SFX_BARREL_RELEASE] = { &sfxBarrelRelease, MUSIC_PLAYER_1B, MUSIC_PLAYER_1B },
[SFX_BARREL_ENTER] = { &sfxBarrelEnter, MUSIC_PLAYER_1A, MUSIC_PLAYER_1A },
[SFX_BARREL_ROLL] = { &sfxBarrelRoll, MUSIC_PLAYER_19, MUSIC_PLAYER_19 },
@ -1089,7 +1089,7 @@ const Song gSongTable[] = {
[SFX_PLACE_OBJ] = { &sfx104, MUSIC_PLAYER_0D, MUSIC_PLAYER_0D },
[SFX_105] = { &sfx105, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E },
[SFX_106] = { &sfx106, MUSIC_PLAYER_0B, MUSIC_PLAYER_0B },
[SFX_107] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A },
[SFX_ITEM_GLOVES_AIR] = { &sfx107, MUSIC_PLAYER_0A, MUSIC_PLAYER_0A },
[SFX_108] = { &sfx108, MUSIC_PLAYER_09, MUSIC_PLAYER_09 },
[SFX_ITEM_GET] = { &sfx109, MUSIC_PLAYER_1E, MUSIC_PLAYER_1E },
[SFX_10A] = { &sfx10A, MUSIC_PLAYER_08, MUSIC_PLAYER_08 },