Fixed follower interaction with Lavaridge, Escalator, Escape warps.
This commit is contained in:
parent
66acabe5c6
commit
8dc6da09fa
1 changed files with 23 additions and 12 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "trig.h"
|
||||
#include "util.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/event_object_movement.h"
|
||||
#include "constants/metatile_behaviors.h"
|
||||
#include "constants/rgb.h"
|
||||
|
@ -1419,7 +1420,7 @@ void FieldCB_FallWarpExit(void)
|
|||
Overworld_PlaySpecialMapMusic();
|
||||
WarpFadeInScreen();
|
||||
ScriptContext2_Enable();
|
||||
FreezeObjectEvents(); // TODO: How does this interact with follower pokemon?
|
||||
FreezeObjectEvents();
|
||||
CreateTask(Task_FallWarpFieldEffect, 0);
|
||||
gFieldCallback = NULL;
|
||||
}
|
||||
|
@ -1551,6 +1552,15 @@ static bool8 FallWarpEffect_End(struct Task *task)
|
|||
#define tState data[0]
|
||||
#define tGoingUp data[1]
|
||||
|
||||
static void HideFollowerForFieldEffect(void) {
|
||||
struct ObjectEvent *followerObj = GetFollowerObject();
|
||||
if (!followerObj || followerObj->invisible)
|
||||
return;
|
||||
ClearObjectEventMovement(followerObj, &gSprites[followerObj->spriteId]);
|
||||
gSprites[followerObj->spriteId].animCmdIndex = 0; // Avoids a visual glitch with follower's animation frame
|
||||
ObjectEventSetHeldMovement(followerObj, MOVEMENT_ACTION_ENTER_POKEBALL);
|
||||
}
|
||||
|
||||
void StartEscalatorWarp(u8 metatileBehavior, u8 priority)
|
||||
{
|
||||
u8 taskId;
|
||||
|
@ -1571,9 +1581,10 @@ static void Task_EscalatorWarpOut(u8 taskId)
|
|||
|
||||
static bool8 EscalatorWarpOut_Init(struct Task *task)
|
||||
{
|
||||
FreezeObjectEvents(); // TODO: Follower pokemon interaction
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
StartEscalator(task->tGoingUp);
|
||||
HideFollowerForFieldEffect(); // Hide follower before warping
|
||||
task->tState++;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1949,13 +1960,15 @@ static void Task_LavaridgeGymB1FWarp(u8 taskId)
|
|||
|
||||
static bool8 LavaridgeGymB1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
FreezeObjectEvents(); // TODO: Follower pokemon interaction
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
SetCameraPanningCallback(NULL);
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objectEvent->fixedPriority = 1;
|
||||
task->data[1] = 1;
|
||||
task->data[0]++;
|
||||
if (objectEvent->localId == OBJ_EVENT_ID_PLAYER) // Hide follower before warping
|
||||
HideFollowerForFieldEffect();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2066,7 +2079,7 @@ static void Task_LavaridgeGymB1FWarpExit(u8 taskId)
|
|||
static bool8 LavaridgeGymB1FWarpExitEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
CameraObjectReset2();
|
||||
FreezeObjectEvents(); // TODO: Follower pokemon interaction
|
||||
FreezeObjectEvents();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objectEvent->invisible = TRUE;
|
||||
task->data[0]++;
|
||||
|
@ -2142,11 +2155,13 @@ static void Task_LavaridgeGym1FWarp(u8 taskId)
|
|||
|
||||
static bool8 LavaridgeGym1FWarpEffect_Init(struct Task *task, struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||
{
|
||||
FreezeObjectEvents(); // TODO: Follower pokemon interaction
|
||||
FreezeObjectEvents();
|
||||
CameraObjectReset2();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
objectEvent->fixedPriority = 1;
|
||||
task->data[0]++;
|
||||
if (objectEvent->localId == OBJ_EVENT_ID_PLAYER) // Hide follower before warping
|
||||
HideFollowerForFieldEffect();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2231,7 +2246,8 @@ void SpriteCB_AshPuff(struct Sprite *sprite)
|
|||
void StartEscapeRopeFieldEffect(void)
|
||||
{
|
||||
ScriptContext2_Enable();
|
||||
FreezeObjectEvents(); // TODO: Follower pokemon interaction
|
||||
FreezeObjectEvents();
|
||||
HideFollowerForFieldEffect(); // hide follower before warping
|
||||
CreateTask(Task_EscapeRopeWarpOut, 80);
|
||||
}
|
||||
|
||||
|
@ -2994,15 +3010,10 @@ static void Task_SurfFieldEffect(u8 taskId)
|
|||
|
||||
static void SurfFieldEffect_Init(struct Task *task)
|
||||
{
|
||||
struct ObjectEvent *followerObject = GetFollowerObject();
|
||||
ScriptContext2_Enable();
|
||||
FreezeObjectEvents();
|
||||
// Put follower into pokeball before using Surf
|
||||
if (followerObject && !followerObject->invisible) {
|
||||
ClearObjectEventMovement(followerObject, &gSprites[followerObject->spriteId]);
|
||||
gSprites[followerObject->spriteId].animCmdIndex = 0; // Needed because of weird animCmdIndex stuff
|
||||
ObjectEventSetHeldMovement(followerObject, MOVEMENT_ACTION_ENTER_POKEBALL);
|
||||
}
|
||||
HideFollowerForFieldEffect();
|
||||
gPlayerAvatar.preventStep = TRUE;
|
||||
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING);
|
||||
PlayerGetDestCoords(&task->tDestX, &task->tDestY);
|
||||
|
|
Loading…
Reference in a new issue