Apply suggestions from code review
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
parent
a859f40e37
commit
7d1bbf62e1
@ -2440,9 +2440,7 @@
|
||||
.2byte \dest
|
||||
.endm
|
||||
|
||||
@ hide any follower pokemon if present,
|
||||
@ putting them into their pokeball;
|
||||
@ by default waits for their movement to finish
|
||||
@ Hides any follower Pokémon if present, putting them into their Poké Ball; by default waits for their movement to finish.
|
||||
.macro hidefollower wait=1
|
||||
callnative ScrFunc_hidefollower
|
||||
.2byte \wait
|
||||
|
||||
@ -1928,8 +1928,8 @@ struct Pokemon *GetFirstLiveMon(void)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[i];
|
||||
if ((OW_MON_ALLOWED_SPECIES && GetMonData(mon, MON_DATA_SPECIES_OR_EGG) != VarGet(OW_MON_ALLOWED_SPECIES))
|
||||
|| (OW_MON_ALLOWED_MET_LVL && GetMonData(mon, MON_DATA_MET_LEVEL) != VarGet(OW_MON_ALLOWED_MET_LVL))
|
||||
|| (OW_MON_ALLOWED_MET_LOC && GetMonData(mon, MON_DATA_MET_LOCATION) != VarGet(OW_MON_ALLOWED_MET_LOC)))
|
||||
|| (OW_MON_ALLOWED_MET_LVL && GetMonData(mon, MON_DATA_MET_LEVEL) != VarGet(OW_MON_ALLOWED_MET_LVL))
|
||||
|| (OW_MON_ALLOWED_MET_LOC && GetMonData(mon, MON_DATA_MET_LOCATION) != VarGet(OW_MON_ALLOWED_MET_LOC)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -5514,7 +5514,7 @@ bool8 FollowablePlayerMovement_Step(struct ObjectEvent *objectEvent, struct Spri
|
||||
// During a script, if player sidesteps or backsteps,
|
||||
// mirror player's direction instead
|
||||
if (ArePlayerFieldControlsLocked()
|
||||
&& gObjectEvents[gPlayerAvatar.objectEventId].facingDirection != gObjectEvents[gPlayerAvatar.objectEventId].movementDirection)
|
||||
&& gObjectEvents[gPlayerAvatar.objectEventId].facingDirection != gObjectEvents[gPlayerAvatar.objectEventId].movementDirection)
|
||||
{
|
||||
direction = gObjectEvents[gPlayerAvatar.objectEventId].movementDirection;
|
||||
objectEvent->facingDirectionLocked = TRUE;
|
||||
@ -6412,9 +6412,9 @@ bool8 ObjectEventSetHeldMovement(struct ObjectEvent *objectEvent, u8 movementAct
|
||||
|
||||
// When player is moved via script, set copyable movement
|
||||
// for any followers via a lookup table
|
||||
if (ArePlayerFieldControlsLocked() &&
|
||||
objectEvent->isPlayer &&
|
||||
FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT))
|
||||
if (ArePlayerFieldControlsLocked()
|
||||
&& objectEvent->isPlayer
|
||||
&& FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT))
|
||||
{
|
||||
objectEvent->playerCopyableMovement = sActionIdToCopyableMovement[objectEvent->movementActionId];
|
||||
}
|
||||
@ -6445,9 +6445,9 @@ void ObjectEventClearHeldMovement(struct ObjectEvent *objectEvent)
|
||||
|
||||
// When player is moved via script, set copyable movement
|
||||
// for any followers via a lookup table
|
||||
if (ArePlayerFieldControlsLocked() &&
|
||||
objectEvent->isPlayer &&
|
||||
FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT))
|
||||
if (ArePlayerFieldControlsLocked()
|
||||
&& objectEvent->isPlayer
|
||||
&& FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT))
|
||||
{
|
||||
objectEvent->playerCopyableMovement = sActionIdToCopyableMovement[objectEvent->movementActionId];
|
||||
}
|
||||
|
||||
@ -998,7 +998,7 @@ bool8 ScrCmd_fadeinbgm(struct ScriptContext *ctx)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
struct ObjectEvent * ScriptHideFollower(void)
|
||||
struct ObjectEvent *ScriptHideFollower(void)
|
||||
{
|
||||
struct ObjectEvent *obj = GetFollowerObject();
|
||||
|
||||
@ -1030,9 +1030,9 @@ bool8 ScrCmd_applymovement(struct ScriptContext *ctx)
|
||||
gObjectEvents[GetObjectEventIdByLocalId(localId)].directionOverwrite = DIR_NONE;
|
||||
ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
|
||||
sMovingNpcId = localId;
|
||||
if (localId != OBJ_EVENT_ID_FOLLOWER &&
|
||||
!FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT)
|
||||
&& (movementScript < Common_Movement_FollowerSafeStart || movementScript > Common_Movement_FollowerSafeEnd))
|
||||
if (localId != OBJ_EVENT_ID_FOLLOWER
|
||||
&& !FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT)
|
||||
&& (movementScript < Common_Movement_FollowerSafeStart || movementScript > Common_Movement_FollowerSafeEnd))
|
||||
{
|
||||
ScriptHideFollower();
|
||||
}
|
||||
|
||||
@ -215,19 +215,17 @@ static void ScriptMovement_TakeStep(u8 taskId, u8 moveScrId, u8 objEventId, cons
|
||||
u8 nextMoveActionId;
|
||||
struct ObjectEvent *obj = &gObjectEvents[objEventId];
|
||||
|
||||
if (ObjectEventIsHeldMovementActive(obj) &&
|
||||
!ObjectEventClearHeldMovementIfFinished(obj))
|
||||
if (ObjectEventIsHeldMovementActive(obj) && !ObjectEventClearHeldMovementIfFinished(obj))
|
||||
{
|
||||
// If, while undergoing scripted movement,
|
||||
// a non-player object collides with an active follower pokemon,
|
||||
// put that follower into a pokeball
|
||||
// (sTimer helps limit this expensive check to once per step)
|
||||
if (OW_FOLLOWERS_SCRIPT_MOVEMENT &&
|
||||
gSprites[obj->spriteId].sTimer == 1 &&
|
||||
(objEventId = GetObjectObjectCollidesWith(obj, 0, 0, TRUE)) < OBJECT_EVENTS_COUNT &&
|
||||
if (OW_FOLLOWERS_SCRIPT_MOVEMENT && gSprites[obj->spriteId].sTimer == 1
|
||||
&& (objEventId = GetObjectObjectCollidesWith(obj, 0, 0, TRUE)) < OBJECT_EVENTS_COUNT
|
||||
// switch `obj` to follower
|
||||
((obj = &gObjectEvents[objEventId])->movementType == MOVEMENT_TYPE_FOLLOW_PLAYER) &&
|
||||
gSprites[obj->spriteId].sTypeFuncId != 0)
|
||||
&& ((obj = &gObjectEvents[objEventId])->movementType == MOVEMENT_TYPE_FOLLOW_PLAYER)
|
||||
&& gSprites[obj->spriteId].sTypeFuncId != 0)
|
||||
{
|
||||
ClearObjectEventMovement(obj, &gSprites[obj->spriteId]);
|
||||
ScriptMovement_StartObjectMovementScript(obj->localId, obj->mapNum, obj->mapGroup, EnterPokeballMovement);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user