cherry pick 8960588d0b0b9e31c8971173396f6e631930229b

This commit is contained in:
Evan 2020-06-28 17:22:59 -06:00 committed by ghoulslash
parent d3d29d7cb5
commit 598f5dd914
5 changed files with 8 additions and 28 deletions

Binary file not shown.

View File

@ -22,7 +22,6 @@
#include "trainer_see.h" #include "trainer_see.h"
#include "trainer_hill.h" #include "trainer_hill.h"
#include "util.h" #include "util.h"
#include "follow_me.h"
#include "constants/event_object_movement.h" #include "constants/event_object_movement.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_effects.h" #include "constants/field_effects.h"
@ -1228,11 +1227,10 @@ u8 GetFirstInactiveObjectEventId(void)
u8 GetObjectEventIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroupId) u8 GetObjectEventIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroupId)
{ {
if (localId == 0xFE) if (localId < OBJ_EVENT_ID_PLAYER)
return GetFollowerObjectId(); {
else if (localId < OBJ_EVENT_ID_PLAYER)
return GetObjectEventIdByLocalIdAndMapInternal(localId, mapNum, mapGroupId); return GetObjectEventIdByLocalIdAndMapInternal(localId, mapNum, mapGroupId);
}
return GetObjectEventIdByLocalId(localId); return GetObjectEventIdByLocalId(localId);
} }
@ -2415,10 +2413,7 @@ void SetObjectEventDirection(struct ObjectEvent *objectEvent, u8 direction)
static const u8 *GetObjectEventScriptPointerByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup) static const u8 *GetObjectEventScriptPointerByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
{ {
if (GetFollowerLocalId() == 0 || GetFollowerLocalId() != localId) return GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup)->script;
return GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup)->script;
else
return GetFollowerScriptPointer();
} }
const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId) const u8 *GetObjectEventScriptPointerByObjectEventId(u8 objectEventId)
@ -5029,7 +5024,7 @@ static bool8 DoesObjectCollideWithObjectAt(struct ObjectEvent *objectEvent, s16
for (i = 0; i < OBJECT_EVENTS_COUNT; i++) for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
{ {
curObject = &gObjectEvents[i]; curObject = &gObjectEvents[i];
if (curObject->active && curObject != objectEvent && !FollowMe_IsCollisionExempt(curObject, objectEvent)) if (curObject->active && curObject != objectEvent)
{ {
// check for collision if curObject is active, not the object in question, and not exempt from collisions // check for collision if curObject is active, not the object in question, and not exempt from collisions
if ((curObject->currentCoords.x == x && curObject->currentCoords.y == y) || (curObject->previousCoords.x == x && curObject->previousCoords.y == y)) if ((curObject->currentCoords.x == x && curObject->currentCoords.y == y) || (curObject->previousCoords.x == x && curObject->previousCoords.y == y))
@ -5185,9 +5180,6 @@ bool8 ObjectEventSetHeldMovement(struct ObjectEvent *objectEvent, u8 movementAct
objectEvent->heldMovementActive = TRUE; objectEvent->heldMovementActive = TRUE;
objectEvent->heldMovementFinished = FALSE; objectEvent->heldMovementFinished = FALSE;
gSprites[objectEvent->spriteId].data[2] = 0; gSprites[objectEvent->spriteId].data[2] = 0;
FollowMe(objectEvent, movementActionId, FALSE);
return FALSE; return FALSE;
} }

View File

@ -28,7 +28,6 @@
#include "trainer_see.h" #include "trainer_see.h"
#include "trainer_hill.h" #include "trainer_hill.h"
#include "wild_encounter.h" #include "wild_encounter.h"
#include "follow_me.h"
#include "constants/event_bg.h" #include "constants/event_bg.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
#include "constants/field_poison.h" #include "constants/field_poison.h"
@ -480,10 +479,10 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me
static const u8 *GetInteractedWaterScript(struct MapPosition *unused1, u8 metatileBehavior, u8 direction) static const u8 *GetInteractedWaterScript(struct MapPosition *unused1, u8 metatileBehavior, u8 direction)
{ {
if (FlagGet(FLAG_BADGE05_GET) == TRUE && PartyHasMonWithSurf() == TRUE && IsPlayerFacingSurfableFishableWater() == TRUE && CheckFollowerFlag(FOLLOWER_FLAG_CAN_SURF)) if (FlagGet(FLAG_BADGE05_GET) == TRUE && PartyHasMonWithSurf() == TRUE && IsPlayerFacingSurfableFishableWater() == TRUE)
return EventScript_UseSurf; return EventScript_UseSurf;
if (MetatileBehavior_IsWaterfall(metatileBehavior) == TRUE && CheckFollowerFlag(FOLLOWER_FLAG_CAN_WATERFALL)) if (MetatileBehavior_IsWaterfall(metatileBehavior) == TRUE)
{ {
if (FlagGet(FLAG_BADGE08_GET) == TRUE && IsPlayerSurfingNorth() == TRUE) if (FlagGet(FLAG_BADGE08_GET) == TRUE && IsPlayerSurfingNorth() == TRUE)
return EventScript_UseWaterfall; return EventScript_UseWaterfall;
@ -495,9 +494,6 @@ static const u8 *GetInteractedWaterScript(struct MapPosition *unused1, u8 metati
static bool32 TrySetupDiveDownScript(void) static bool32 TrySetupDiveDownScript(void)
{ {
if (!CheckFollowerFlag(FOLLOWER_FLAG_CAN_DIVE))
return FALSE;
if (FlagGet(FLAG_BADGE07_GET) && TrySetDiveWarp() == 2) if (FlagGet(FLAG_BADGE07_GET) && TrySetDiveWarp() == 2)
{ {
ScriptContext1_SetupScript(EventScript_UseDive); ScriptContext1_SetupScript(EventScript_UseDive);
@ -508,9 +504,6 @@ static bool32 TrySetupDiveDownScript(void)
static bool32 TrySetupDiveEmergeScript(void) static bool32 TrySetupDiveEmergeScript(void)
{ {
if (!CheckFollowerFlag(FOLLOWER_FLAG_CAN_DIVE))
return FALSE;
if (FlagGet(FLAG_BADGE07_GET) && gMapHeader.mapType == MAP_TYPE_UNDERWATER && TrySetDiveWarp() == 1) if (FlagGet(FLAG_BADGE07_GET) && gMapHeader.mapType == MAP_TYPE_UNDERWATER && TrySetDiveWarp() == 1)
{ {
ScriptContext1_SetupScript(EventScript_UseDiveUnderwater); ScriptContext1_SetupScript(EventScript_UseDiveUnderwater);

View File

@ -1081,7 +1081,7 @@ static void CreateBobbingEffect(struct ObjectEvent *objectEvent, struct Sprite *
} }
} }
u8 sub_8155800(u8 oldSpriteId) u8 DoBobbingFieldEffect(u8 oldSpriteId)
{ {
u8 spriteId; u8 spriteId;
struct Sprite *sprite; struct Sprite *sprite;

View File

@ -20,7 +20,6 @@
#include "strings.h" #include "strings.h"
#include "task.h" #include "task.h"
#include "tv.h" #include "tv.h"
#include "follow_me.h"
#include "wild_encounter.h" #include "wild_encounter.h"
#include "constants/abilities.h" #include "constants/abilities.h"
#include "constants/event_objects.h" #include "constants/event_objects.h"
@ -1425,8 +1424,6 @@ void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
gPlayerAvatar.spriteId = objectEvent->spriteId; gPlayerAvatar.spriteId = objectEvent->spriteId;
gPlayerAvatar.gender = gender; gPlayerAvatar.gender = gender;
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_5 | PLAYER_AVATAR_FLAG_ON_FOOT); SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_5 | PLAYER_AVATAR_FLAG_ON_FOOT);
CreateFollowerAvatar();
} }
void SetPlayerInvisibility(bool8 invisible) void SetPlayerInvisibility(bool8 invisible)
@ -1672,8 +1669,6 @@ static void CreateStopSurfingTask(u8 direction)
taskId = CreateTask(Task_StopSurfingInit, 0xFF); taskId = CreateTask(Task_StopSurfingInit, 0xFF);
gTasks[taskId].data[0] = direction; gTasks[taskId].data[0] = direction;
Task_StopSurfingInit(taskId); Task_StopSurfingInit(taskId);
PrepareFollowerDismountSurf();
} }
static void Task_StopSurfingInit(u8 taskId) static void Task_StopSurfingInit(u8 taskId)