diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 3025e0849..d4b89fbae 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2575,7 +2575,7 @@ bool8 MovementType_WanderAround_Step2(struct ObjectEvent *objectEvent, struct Sp { if (!ObjectEventExecSingleMovementAction(objectEvent, sprite)) return FALSE; - SetMovementDelay(sprite, sMovementDelaysMedium[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysMedium[Random() % ARRAY_COUNT(sMovementDelaysMedium)]); sprite->sTypeFuncId = 3; return TRUE; } @@ -2855,7 +2855,7 @@ bool8 MovementType_LookAround_Step2(struct ObjectEvent *objectEvent, struct Spri { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysMedium[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysMedium[Random() % ARRAY_COUNT(sMovementDelaysMedium)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -2907,7 +2907,7 @@ bool8 MovementType_WanderUpAndDown_Step2(struct ObjectEvent *objectEvent, struct if (!ObjectEventExecSingleMovementAction(objectEvent, sprite)) return FALSE; - SetMovementDelay(sprite, sMovementDelaysMedium[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysMedium[Random() % ARRAY_COUNT(sMovementDelaysMedium)]); sprite->sTypeFuncId = 3; return TRUE; } @@ -2975,7 +2975,7 @@ bool8 MovementType_WanderLeftAndRight_Step2(struct ObjectEvent *objectEvent, str if (!ObjectEventExecSingleMovementAction(objectEvent, sprite)) return FALSE; - SetMovementDelay(sprite, sMovementDelaysMedium[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysMedium[Random() % ARRAY_COUNT(sMovementDelaysMedium)]); sprite->sTypeFuncId = 3; return TRUE; } @@ -3195,7 +3195,7 @@ bool8 MovementType_FaceDownAndUp_Step2(struct ObjectEvent *objectEvent, struct S { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysMedium[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysMedium[Random() % ARRAY_COUNT(sMovementDelaysMedium)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3245,7 +3245,7 @@ bool8 MovementType_FaceLeftAndRight_Step2(struct ObjectEvent *objectEvent, struc { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysMedium[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysMedium[Random() % ARRAY_COUNT(sMovementDelaysMedium)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3295,7 +3295,7 @@ bool8 MovementType_FaceUpAndLeft_Step2(struct ObjectEvent *objectEvent, struct S { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3345,7 +3345,7 @@ bool8 MovementType_FaceUpAndRight_Step2(struct ObjectEvent *objectEvent, struct { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3395,7 +3395,7 @@ bool8 MovementType_FaceDownAndLeft_Step2(struct ObjectEvent *objectEvent, struct { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3445,7 +3445,7 @@ bool8 MovementType_FaceDownAndRight_Step2(struct ObjectEvent *objectEvent, struc { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3495,7 +3495,7 @@ bool8 MovementType_FaceDownUpAndLeft_Step2(struct ObjectEvent *objectEvent, stru { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3545,7 +3545,7 @@ bool8 MovementType_FaceDownUpAndRight_Step2(struct ObjectEvent *objectEvent, str { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3595,7 +3595,7 @@ bool8 MovementType_FaceUpLeftAndRight_Step2(struct ObjectEvent *objectEvent, str { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; } @@ -3645,7 +3645,7 @@ bool8 MovementType_FaceDownLeftAndRight_Step2(struct ObjectEvent *objectEvent, s { if (ObjectEventExecSingleMovementAction(objectEvent, sprite)) { - SetMovementDelay(sprite, sMovementDelaysShort[Random() & 3]); + SetMovementDelay(sprite, sMovementDelaysShort[Random() % ARRAY_COUNT(sMovementDelaysShort)]); objectEvent->singleMovementActive = FALSE; sprite->sTypeFuncId = 3; }