mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Clean up lock/unlock anim movement
This commit is contained in:
parent
cd5a03d4aa
commit
5515e328b2
@ -152,8 +152,8 @@
|
|||||||
create_movement_action walk_slow_diag_northeast, MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_UP_RIGHT
|
create_movement_action walk_slow_diag_northeast, MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_UP_RIGHT
|
||||||
create_movement_action walk_slow_diag_southwest, MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_LEFT
|
create_movement_action walk_slow_diag_southwest, MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_LEFT
|
||||||
create_movement_action walk_slow_diag_southeast, MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_RIGHT
|
create_movement_action walk_slow_diag_southeast, MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_RIGHT
|
||||||
create_movement_action store_lock_anim, MOVEMENT_ACTION_STORE_AND_LOCK_ANIM
|
create_movement_action lock_anim, MOVEMENT_ACTION_LOCK_ANIM
|
||||||
create_movement_action free_unlock_anim, MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM
|
create_movement_action unlock_anim, MOVEMENT_ACTION_UNLOCK_ANIM
|
||||||
create_movement_action walk_left_affine, MOVEMENT_ACTION_WALK_LEFT_AFFINE
|
create_movement_action walk_left_affine, MOVEMENT_ACTION_WALK_LEFT_AFFINE
|
||||||
create_movement_action walk_right_affine, MOVEMENT_ACTION_WALK_RIGHT_AFFINE
|
create_movement_action walk_right_affine, MOVEMENT_ACTION_WALK_RIGHT_AFFINE
|
||||||
create_movement_action levitate, MOVEMENT_ACTION_LEVITATE
|
create_movement_action levitate, MOVEMENT_ACTION_LEVITATE
|
||||||
|
@ -144,7 +144,7 @@ Route111_EventScript_RootFossilDisappeared::
|
|||||||
|
|
||||||
@ Unused
|
@ Unused
|
||||||
Route111_Movement_PlayerFall::
|
Route111_Movement_PlayerFall::
|
||||||
store_lock_anim
|
lock_anim
|
||||||
walk_fast_down
|
walk_fast_down
|
||||||
walk_fast_down
|
walk_fast_down
|
||||||
walk_fast_down
|
walk_fast_down
|
||||||
|
@ -232,8 +232,8 @@
|
|||||||
#define MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_UP_RIGHT 0x91
|
#define MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_UP_RIGHT 0x91
|
||||||
#define MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_LEFT 0x92
|
#define MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_LEFT 0x92
|
||||||
#define MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_RIGHT 0x93
|
#define MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_RIGHT 0x93
|
||||||
#define MOVEMENT_ACTION_STORE_AND_LOCK_ANIM 0x94
|
#define MOVEMENT_ACTION_LOCK_ANIM 0x94
|
||||||
#define MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM 0x95
|
#define MOVEMENT_ACTION_UNLOCK_ANIM 0x95
|
||||||
#define MOVEMENT_ACTION_WALK_LEFT_AFFINE 0x96
|
#define MOVEMENT_ACTION_WALK_LEFT_AFFINE 0x96
|
||||||
#define MOVEMENT_ACTION_WALK_RIGHT_AFFINE 0x97
|
#define MOVEMENT_ACTION_WALK_RIGHT_AFFINE 0x97
|
||||||
#define MOVEMENT_ACTION_LEVITATE 0x98
|
#define MOVEMENT_ACTION_LEVITATE 0x98
|
||||||
|
@ -63,7 +63,7 @@ struct PairedPalettes
|
|||||||
|
|
||||||
struct LockedAnimObjectEvents
|
struct LockedAnimObjectEvents
|
||||||
{
|
{
|
||||||
u8 objectEventIds[OBJECT_EVENTS_COUNT];
|
u8 localIds[OBJECT_EVENTS_COUNT];
|
||||||
u8 count;
|
u8 count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,9 +253,9 @@ u8 MovementAction_AcroEndWheelieMoveRight_Step1(struct ObjectEvent *, struct Spr
|
|||||||
u8 MovementAction_Levitate_Step0(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_Levitate_Step0(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_StopLevitate_Step0(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_StopLevitate_Step0(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_StopLevitateAtTop_Step0(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_StopLevitateAtTop_Step0(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_LockAnim_Step0(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_Finish(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_Finish(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_FreeAndUnlockAnim_Step0(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_UnlockAnim_Step0(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_FlyUp_Step0(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_FlyUp_Step0(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_FlyUp_Step1(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_FlyUp_Step1(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 MovementAction_Fly_Finish(struct ObjectEvent *, struct Sprite *);
|
u8 MovementAction_Fly_Finish(struct ObjectEvent *, struct Sprite *);
|
||||||
@ -410,8 +410,8 @@ u8 (*const gMovementActionFuncs_WalkSlowDiagonalUpLeft[])(struct ObjectEvent *,
|
|||||||
u8 (*const gMovementActionFuncs_WalkSlowDiagonalUpRight[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_WalkSlowDiagonalUpRight[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_WalkSlowDiagonalDownLeft[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_WalkSlowDiagonalDownLeft[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_WalkSlowDiagonalDownRight[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_WalkSlowDiagonalDownRight[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_StoreAndLockAnim[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_LockAnim[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_FreeAndUnlockAnim[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_UnlockAnim[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_WalkLeftAffine[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_WalkLeftAffine[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_WalkRightAffine[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_WalkRightAffine[])(struct ObjectEvent *, struct Sprite *);
|
||||||
u8 (*const gMovementActionFuncs_Levitate[])(struct ObjectEvent *, struct Sprite *);
|
u8 (*const gMovementActionFuncs_Levitate[])(struct ObjectEvent *, struct Sprite *);
|
||||||
@ -570,8 +570,8 @@ u8 (*const *const gMovementActionFuncs[])(struct ObjectEvent *, struct Sprite *)
|
|||||||
[MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_UP_RIGHT] = gMovementActionFuncs_WalkSlowDiagonalUpRight,
|
[MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_UP_RIGHT] = gMovementActionFuncs_WalkSlowDiagonalUpRight,
|
||||||
[MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_LEFT] = gMovementActionFuncs_WalkSlowDiagonalDownLeft,
|
[MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_LEFT] = gMovementActionFuncs_WalkSlowDiagonalDownLeft,
|
||||||
[MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_RIGHT] = gMovementActionFuncs_WalkSlowDiagonalDownRight,
|
[MOVEMENT_ACTION_WALK_SLOW_DIAGONAL_DOWN_RIGHT] = gMovementActionFuncs_WalkSlowDiagonalDownRight,
|
||||||
[MOVEMENT_ACTION_STORE_AND_LOCK_ANIM] = gMovementActionFuncs_StoreAndLockAnim,
|
[MOVEMENT_ACTION_LOCK_ANIM] = gMovementActionFuncs_LockAnim,
|
||||||
[MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM] = gMovementActionFuncs_FreeAndUnlockAnim,
|
[MOVEMENT_ACTION_UNLOCK_ANIM] = gMovementActionFuncs_UnlockAnim,
|
||||||
[MOVEMENT_ACTION_WALK_LEFT_AFFINE] = gMovementActionFuncs_WalkLeftAffine,
|
[MOVEMENT_ACTION_WALK_LEFT_AFFINE] = gMovementActionFuncs_WalkLeftAffine,
|
||||||
[MOVEMENT_ACTION_WALK_RIGHT_AFFINE] = gMovementActionFuncs_WalkRightAffine,
|
[MOVEMENT_ACTION_WALK_RIGHT_AFFINE] = gMovementActionFuncs_WalkRightAffine,
|
||||||
[MOVEMENT_ACTION_LEVITATE] = gMovementActionFuncs_Levitate,
|
[MOVEMENT_ACTION_LEVITATE] = gMovementActionFuncs_Levitate,
|
||||||
|
@ -8746,13 +8746,13 @@ static void DoRippleFieldEffect(struct ObjectEvent *objectEvent, struct Sprite *
|
|||||||
FieldEffectStart(FLDEFF_RIPPLE);
|
FieldEffectStart(FLDEFF_RIPPLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 (*const gMovementActionFuncs_StoreAndLockAnim[])(struct ObjectEvent *, struct Sprite *) = {
|
u8 (*const gMovementActionFuncs_LockAnim[])(struct ObjectEvent *, struct Sprite *) = {
|
||||||
MovementAction_StoreAndLockAnim_Step0,
|
MovementAction_LockAnim_Step0,
|
||||||
MovementAction_Finish,
|
MovementAction_Finish,
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 (*const gMovementActionFuncs_FreeAndUnlockAnim[])(struct ObjectEvent *, struct Sprite *) = {
|
u8 (*const gMovementActionFuncs_UnlockAnim[])(struct ObjectEvent *, struct Sprite *) = {
|
||||||
MovementAction_FreeAndUnlockAnim_Step0,
|
MovementAction_UnlockAnim_Step0,
|
||||||
MovementAction_Finish,
|
MovementAction_Finish,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -8768,36 +8768,36 @@ u8 (*const gMovementActionFuncs_FlyDown[])(struct ObjectEvent *, struct Sprite *
|
|||||||
MovementAction_Fly_Finish,
|
MovementAction_Fly_Finish,
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
u8 MovementAction_LockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
bool32 ableToStore = FALSE;
|
bool32 ableToStore = FALSE;
|
||||||
if (sLockedAnimObjectEvents == NULL)
|
if (sLockedAnimObjectEvents == NULL)
|
||||||
{
|
{
|
||||||
sLockedAnimObjectEvents = AllocZeroed(sizeof(struct LockedAnimObjectEvents));
|
sLockedAnimObjectEvents = AllocZeroed(sizeof(struct LockedAnimObjectEvents));
|
||||||
sLockedAnimObjectEvents->objectEventIds[0] = objectEvent->localId;
|
sLockedAnimObjectEvents->localIds[0] = objectEvent->localId;
|
||||||
sLockedAnimObjectEvents->count = 1;
|
sLockedAnimObjectEvents->count = 1;
|
||||||
ableToStore = TRUE;
|
ableToStore = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 firstFreeSlot;
|
u8 firstFreeSlot = OBJECT_EVENTS_COUNT;
|
||||||
bool32 found;
|
bool32 found = FALSE;
|
||||||
for (firstFreeSlot = 16, found = FALSE, i = 0; i < 16; i++)
|
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (firstFreeSlot == 16 && sLockedAnimObjectEvents->objectEventIds[i] == 0)
|
if (firstFreeSlot == OBJECT_EVENTS_COUNT && sLockedAnimObjectEvents->localIds[i] == 0)
|
||||||
firstFreeSlot = i;
|
firstFreeSlot = i;
|
||||||
|
|
||||||
if (sLockedAnimObjectEvents->objectEventIds[i] == objectEvent->localId)
|
if (sLockedAnimObjectEvents->localIds[i] == objectEvent->localId)
|
||||||
{
|
{
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found && firstFreeSlot != 16)
|
if (!found && firstFreeSlot != OBJECT_EVENTS_COUNT)
|
||||||
{
|
{
|
||||||
sLockedAnimObjectEvents->objectEventIds[firstFreeSlot] = objectEvent->localId;
|
sLockedAnimObjectEvents->localIds[firstFreeSlot] = objectEvent->localId;
|
||||||
sLockedAnimObjectEvents->count++;
|
sLockedAnimObjectEvents->count++;
|
||||||
ableToStore = TRUE;
|
ableToStore = TRUE;
|
||||||
}
|
}
|
||||||
@ -8813,7 +8813,7 @@ u8 MovementAction_StoreAndLockAnim_Step0(struct ObjectEvent *objectEvent, struct
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 MovementAction_FreeAndUnlockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
u8 MovementAction_UnlockAnim_Step0(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
bool32 ableToStore;
|
bool32 ableToStore;
|
||||||
u8 index;
|
u8 index;
|
||||||
@ -8823,9 +8823,9 @@ u8 MovementAction_FreeAndUnlockAnim_Step0(struct ObjectEvent *objectEvent, struc
|
|||||||
{
|
{
|
||||||
ableToStore = FALSE;
|
ableToStore = FALSE;
|
||||||
index = FindLockedObjectEventIndex(objectEvent);
|
index = FindLockedObjectEventIndex(objectEvent);
|
||||||
if (index != 16)
|
if (index != OBJECT_EVENTS_COUNT)
|
||||||
{
|
{
|
||||||
sLockedAnimObjectEvents->objectEventIds[index] = 0;
|
sLockedAnimObjectEvents->localIds[index] = 0;
|
||||||
sLockedAnimObjectEvents->count--;
|
sLockedAnimObjectEvents->count--;
|
||||||
ableToStore = TRUE;
|
ableToStore = TRUE;
|
||||||
}
|
}
|
||||||
@ -8848,7 +8848,7 @@ u8 FindLockedObjectEventIndex(struct ObjectEvent *objectEvent)
|
|||||||
|
|
||||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||||
{
|
{
|
||||||
if (sLockedAnimObjectEvents->objectEventIds[i] == objectEvent->localId)
|
if (sLockedAnimObjectEvents->localIds[i] == objectEvent->localId)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return OBJECT_EVENTS_COUNT;
|
return OBJECT_EVENTS_COUNT;
|
||||||
|
@ -27,33 +27,33 @@ struct RotatingTilePuzzle
|
|||||||
|
|
||||||
static const u8 sMovement_ShiftRight[] =
|
static const u8 sMovement_ShiftRight[] =
|
||||||
{
|
{
|
||||||
MOVEMENT_ACTION_STORE_AND_LOCK_ANIM,
|
MOVEMENT_ACTION_LOCK_ANIM,
|
||||||
MOVEMENT_ACTION_WALK_NORMAL_RIGHT,
|
MOVEMENT_ACTION_WALK_NORMAL_RIGHT,
|
||||||
MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM,
|
MOVEMENT_ACTION_UNLOCK_ANIM,
|
||||||
MOVEMENT_ACTION_STEP_END
|
MOVEMENT_ACTION_STEP_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sMovement_ShiftDown[] =
|
static const u8 sMovement_ShiftDown[] =
|
||||||
{
|
{
|
||||||
MOVEMENT_ACTION_STORE_AND_LOCK_ANIM,
|
MOVEMENT_ACTION_LOCK_ANIM,
|
||||||
MOVEMENT_ACTION_WALK_NORMAL_DOWN,
|
MOVEMENT_ACTION_WALK_NORMAL_DOWN,
|
||||||
MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM,
|
MOVEMENT_ACTION_UNLOCK_ANIM,
|
||||||
MOVEMENT_ACTION_STEP_END
|
MOVEMENT_ACTION_STEP_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sMovement_ShiftLeft[] =
|
static const u8 sMovement_ShiftLeft[] =
|
||||||
{
|
{
|
||||||
MOVEMENT_ACTION_STORE_AND_LOCK_ANIM,
|
MOVEMENT_ACTION_LOCK_ANIM,
|
||||||
MOVEMENT_ACTION_WALK_NORMAL_LEFT,
|
MOVEMENT_ACTION_WALK_NORMAL_LEFT,
|
||||||
MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM,
|
MOVEMENT_ACTION_UNLOCK_ANIM,
|
||||||
MOVEMENT_ACTION_STEP_END
|
MOVEMENT_ACTION_STEP_END
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 sMovement_ShiftUp[] =
|
static const u8 sMovement_ShiftUp[] =
|
||||||
{
|
{
|
||||||
MOVEMENT_ACTION_STORE_AND_LOCK_ANIM,
|
MOVEMENT_ACTION_LOCK_ANIM,
|
||||||
MOVEMENT_ACTION_WALK_NORMAL_UP,
|
MOVEMENT_ACTION_WALK_NORMAL_UP,
|
||||||
MOVEMENT_ACTION_FREE_AND_UNLOCK_ANIM,
|
MOVEMENT_ACTION_UNLOCK_ANIM,
|
||||||
MOVEMENT_ACTION_STEP_END
|
MOVEMENT_ACTION_STEP_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user