Fixed follower script release bug.
This commit is contained in:
parent
bdcbb5c700
commit
29150322ce
3 changed files with 10 additions and 28 deletions
|
@ -92,6 +92,7 @@ void OverrideSecretBaseDecorationSpriteScript(u8 localId, u8 mapNum, u8 mapGroup
|
||||||
void GetMapCoordsFromSpritePos(s16, s16, s16 *, s16 *);
|
void GetMapCoordsFromSpritePos(s16, s16, s16 *, s16 *);
|
||||||
u8 GetFaceDirectionAnimNum(u8);
|
u8 GetFaceDirectionAnimNum(u8);
|
||||||
void SetSpritePosToOffsetMapCoords(s16 *, s16 *, s16, s16);
|
void SetSpritePosToOffsetMapCoords(s16 *, s16 *, s16, s16);
|
||||||
|
void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite);
|
||||||
void ObjectEventClearHeldMovement(struct ObjectEvent *);
|
void ObjectEventClearHeldMovement(struct ObjectEvent *);
|
||||||
void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *);
|
void ObjectEventClearHeldMovementIfActive(struct ObjectEvent *);
|
||||||
struct Pokemon * GetFirstLiveMon(void);
|
struct Pokemon * GetFirstLiveMon(void);
|
||||||
|
|
|
@ -157,7 +157,6 @@ static void CameraObject_0(struct Sprite *);
|
||||||
static void CameraObject_1(struct Sprite *);
|
static void CameraObject_1(struct Sprite *);
|
||||||
static void CameraObject_2(struct Sprite *);
|
static void CameraObject_2(struct Sprite *);
|
||||||
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, struct ObjectEventTemplate *templates, u8 count);
|
static struct ObjectEventTemplate *FindObjectEventTemplateByLocalId(u8 localId, struct ObjectEventTemplate *templates, u8 count);
|
||||||
static void ClearObjectEventMovement(struct ObjectEvent *, struct Sprite *);
|
|
||||||
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
|
static void ObjectEventSetSingleMovement(struct ObjectEvent *, struct Sprite *, u8);
|
||||||
static void SetSpriteDataForNormalStep(struct Sprite *, u8, u8);
|
static void SetSpriteDataForNormalStep(struct Sprite *, u8, u8);
|
||||||
static void InitSpriteForFigure8Anim(struct Sprite *sprite);
|
static void InitSpriteForFigure8Anim(struct Sprite *sprite);
|
||||||
|
@ -5105,7 +5104,7 @@ bool8 MovementType_Invisible_Step2(struct ObjectEvent *objectEvent, struct Sprit
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
void ClearObjectEventMovement(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
objectEvent->singleMovementActive = FALSE;
|
objectEvent->singleMovementActive = FALSE;
|
||||||
objectEvent->heldMovementActive = FALSE;
|
objectEvent->heldMovementActive = FALSE;
|
||||||
|
|
34
src/scrcmd.c
34
src/scrcmd.c
|
@ -1011,14 +1011,8 @@ bool8 ScrCmd_applymovement(struct ScriptContext *ctx)
|
||||||
if (objEvent == NULL || gSprites[objEvent->spriteId].data[1] == 0) {
|
if (objEvent == NULL || gSprites[objEvent->spriteId].data[1] == 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
// ClearEventObjectMovement(
|
ClearObjectEventMovement(objEvent, &gSprites[objEvent->spriteId]);
|
||||||
objEvent->singleMovementActive = 0;
|
gSprites[objEvent->spriteId].animCmdIndex = 0; // Needed to set start frame of animation
|
||||||
objEvent->heldMovementActive = FALSE;
|
|
||||||
objEvent->heldMovementFinished = FALSE;
|
|
||||||
objEvent->movementActionId = 0xFF;
|
|
||||||
gSprites[objEvent->spriteId].data[1] = 0;
|
|
||||||
// )
|
|
||||||
gSprites[objEvent->spriteId].animCmdIndex = 0; // Needed because of weird animCmdIndex stuff
|
|
||||||
ScriptMovement_StartObjectMovementScript(OBJ_EVENT_ID_FOLLOWER, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, EnterPokeballMovement);
|
ScriptMovement_StartObjectMovementScript(OBJ_EVENT_ID_FOLLOWER, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, EnterPokeballMovement);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1268,15 +1262,9 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 playerObjectId;
|
u8 playerObjectId;
|
||||||
struct ObjectEvent *followerObject = GetFollowerObject();
|
struct ObjectEvent *followerObject = GetFollowerObject();
|
||||||
if (followerObject) { // Release follower from movement
|
// Release follower from movement iff it exists and is in the shadowing state
|
||||||
// ObjectEventClearHeldMovement( TODO: Change the way data[1] determines state
|
if (followerObject && gSprites[followerObject->spriteId].data[1] == 0)
|
||||||
followerObject->singleMovementActive = FALSE;
|
ClearObjectEventMovement(followerObject, &gSprites[followerObject->spriteId]);
|
||||||
followerObject->movementActionId = 0xFF;
|
|
||||||
followerObject->heldMovementActive = FALSE;
|
|
||||||
followerObject->heldMovementFinished = FALSE;
|
|
||||||
gSprites[followerObject->spriteId].data[2] = 0;
|
|
||||||
// )
|
|
||||||
}
|
|
||||||
|
|
||||||
HideFieldMessageBox();
|
HideFieldMessageBox();
|
||||||
playerObjectId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
playerObjectId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||||
|
@ -1290,15 +1278,9 @@ bool8 ScrCmd_release(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 playerObjectId;
|
u8 playerObjectId;
|
||||||
struct ObjectEvent *followerObject = GetFollowerObject();
|
struct ObjectEvent *followerObject = GetFollowerObject();
|
||||||
if (followerObject) { // Release follower from movement
|
// Release follower from movement iff it exists and is in the shadowing state
|
||||||
// ObjectEventClearHeldMovement(
|
if (followerObject && gSprites[followerObject->spriteId].data[1] == 0)
|
||||||
followerObject->singleMovementActive = FALSE;
|
ClearObjectEventMovement(followerObject, &gSprites[followerObject->spriteId]);
|
||||||
followerObject->movementActionId = 0xFF;
|
|
||||||
followerObject->heldMovementActive = FALSE;
|
|
||||||
followerObject->heldMovementFinished = FALSE;
|
|
||||||
gSprites[followerObject->spriteId].data[2] = 0;
|
|
||||||
// )
|
|
||||||
}
|
|
||||||
|
|
||||||
HideFieldMessageBox();
|
HideFieldMessageBox();
|
||||||
if (gObjectEvents[gSelectedObjectEvent].active)
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
||||||
|
|
Loading…
Reference in a new issue