diff --git a/data/scripts/std_msgbox.inc b/data/scripts/std_msgbox.inc index 40026c8ea0..8d5e4167cb 100644 --- a/data/scripts/std_msgbox.inc +++ b/data/scripts/std_msgbox.inc @@ -8,13 +8,13 @@ Std_MsgboxNPC: return Std_MsgboxSign: - setflag FLAG_SAFE_FOLLOWER_MOVEMENT + setflag FLAG_SAFE_FOLLOWER_MOVEMENT lockall message NULL waitmessage waitbuttonpress releaseall - clearflag FLAG_SAFE_FOLLOWER_MOVEMENT + clearflag FLAG_SAFE_FOLLOWER_MOVEMENT return Std_MsgboxDefault: diff --git a/include/config/overworld.h b/include/config/overworld.h index ff5937743c..7f5be368c2 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -54,10 +54,16 @@ // 16x32, 32x32, 64x64 etc are fine #define OW_MON_WANDER_WALK TRUE // If true, OW pokemon with MOVEMENT_TYPE_WANDER will walk-in-place in between steps. // Follower Pokémon -#define OW_FOLLOWERS_ENABLED TRUE // Enables follower Pokémon, HGSS style. Requires OW_POKEMON_OBJECT_EVENTS. Note that additional scripting may be required for them to be fully supported! +#define OW_FOLLOWERS_ENABLED FALSE // Enables follower Pokémon, HGSS style. Requires OW_POKEMON_OBJECT_EVENTS. Note that additional scripting may be required for them to be fully supported! #define OW_FOLLOWERS_BOBBING TRUE // If true, follower pokemon will bob up and down during their idle & walking animations #define OW_FOLLOWERS_POKEBALLS TRUE // Followers will emerge from the pokeball they are stored in, instead of a normal pokeball +// New/old handling for followers during scripts; +// TRUE: Script collisions hide follower, FLAG_SAFE_FOLLOWER_MOVEMENT on by default +// (scripted player movement moves follower too!) +// FALSE: Script collisions unhandled, FLAG_SAFE_FOLLOWER_MOVEMENT off by default +#define OW_FOLLOWERS_SCRIPT_MOVEMENT TRUE + // Out-of-battle Ability effects #define OW_SYNCHRONIZE_NATURE GEN_LATEST // In Gen8+, if a Pokémon with Synchronize leads the party, wild Pokémon will always have their same Nature as opposed to the 50% chance in previous games. Gift Pokémon excluded. // In USUM (here GEN_7), if a Pokémon with Synchronize leads the party, gift Pokémon will always have their same Nature regardless of their Egg Group. diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index 63849ec676..b9f2622b54 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -295,26 +295,6 @@ #define SHADOW_SIZE_XL_BATTLE_ONLY SHADOW_SIZE_NONE // Battle-only definition for XL shadow size. -// If true, adds a small amount of overhead -// to OW code so that large (48x48, 64x64) OWs -// will display correctly under bridges, etc. -#define LARGE_OW_SUPPORT TRUE - -// See global.h for the toggle of OW_GFX_COMPRESS -// Compressed gfx are incompatible with non-power-of-two sprite sizes: -// (You should not use 48x48 sprites/tables for compressed gfx) -// 16x32, 32x32, 64x64 etc are fine - -// Followers will emerge from the pokeball they are stored in, -// instead of a normal pokeball -#define OW_MON_POKEBALLS TRUE - -// New/old handling for followers during scripts; -// TRUE: Script collisions hide follower, FLAG_SAFE_FOLLOWER_MOVEMENT on by default -// (scripted player movement moves follower too!) -// FALSE: Script collisions unhandled, FLAG_SAFE_FOLLOWER_MOVEMENT off by default -#define OW_MON_SCRIPT_MOVEMENT TRUE - // If set, the only pokemon allowed to follow you // will be those matching species, met location, // and/or met level; diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 5c7243b0f8..e6c3c4ddf5 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -2092,9 +2092,8 @@ static void RefreshFollowerGraphics(struct ObjectEvent *objEvent) sprite->y += -(graphicsInfo->height >> 1) - sprite->centerToCornerVecY; } - #if OW_GFX_COMPRESS - LoadSheetGraphicsInfo(graphicsInfo, objEvent->graphicsId, sprite); - #endif + if (OW_GFX_COMPRESS) + LoadSheetGraphicsInfo(graphicsInfo, objEvent->graphicsId, sprite); sprite->oam.shape = graphicsInfo->oam->shape; sprite->oam.size = graphicsInfo->oam->size; @@ -5515,8 +5514,8 @@ 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; } @@ -6209,7 +6208,8 @@ u32 GetObjectObjectCollidesWith(struct ObjectEvent *objectEvent, s16 x, s16 y, b if (objectEvent->localId == OBJ_EVENT_ID_FOLLOWER) return OBJECT_EVENTS_COUNT; // follower cannot collide with other objects, but they can collide with it - if (addCoords) { + if (addCoords) + { x += objectEvent->currentCoords.x; y += objectEvent->currentCoords.y; } diff --git a/src/scrcmd.c b/src/scrcmd.c index 1dd23c36b3..b45a0d76a3 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -998,7 +998,8 @@ bool8 ScrCmd_fadeinbgm(struct ScriptContext *ctx) return FALSE; } -struct ObjectEvent * ScriptHideFollower(void) { +struct ObjectEvent * ScriptHideFollower(void) +{ struct ObjectEvent *obj = GetFollowerObject(); if (obj == NULL || obj->invisible) @@ -2562,11 +2563,13 @@ bool8 Scrcmd_getobjectfacingdirection(struct ScriptContext *ctx) return FALSE; } -bool8 ScrFunc_hidefollower(struct ScriptContext *ctx) { +bool8 ScrFunc_hidefollower(struct ScriptContext *ctx) +{ bool16 wait = VarGet(ScriptReadHalfword(ctx)); struct ObjectEvent *obj; - if ((obj = ScriptHideFollower()) != NULL && wait) { + if ((obj = ScriptHideFollower()) != NULL && wait) + { sMovingNpcId = obj->localId; sMovingNpcMapGroup = obj->mapGroup; sMovingNpcMapNum = obj->mapNum; diff --git a/src/script.c b/src/script.c index 91cf29a87a..acdaf3f241 100644 --- a/src/script.c +++ b/src/script.c @@ -256,7 +256,7 @@ void ScriptContext_SetupScript(const u8 *ptr) InitScriptContext(&sGlobalScriptContext, gScriptCmdTable, gScriptCmdTableEnd); SetupBytecodeScript(&sGlobalScriptContext, ptr); LockPlayerFieldControls(); - if (OW_MON_SCRIPT_MOVEMENT) + if (OW_FOLLOWERS_SCRIPT_MOVEMENT) FlagSet(FLAG_SAFE_FOLLOWER_MOVEMENT); sGlobalScriptContextStatus = CONTEXT_RUNNING; } diff --git a/src/script_movement.c b/src/script_movement.c index 021be6d621..28e9e02a47 100644 --- a/src/script_movement.c +++ b/src/script_movement.c @@ -222,7 +222,7 @@ static void ScriptMovement_TakeStep(u8 taskId, u8 moveScrId, u8 objEventId, cons // 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_MON_SCRIPT_MOVEMENT && + if (OW_FOLLOWERS_SCRIPT_MOVEMENT && gSprites[obj->spriteId].sTimer == 1 && (objEventId = GetObjectObjectCollidesWith(obj, 0, 0, TRUE)) < OBJECT_EVENTS_COUNT && // switch `obj` to follower