From 8044255fee5e84b87168c23f904fcce7dc277c25 Mon Sep 17 00:00:00 2001 From: psf <77138753+pkmnsnfrn@users.noreply.github.com> Date: Tue, 26 Aug 2025 06:25:18 -0700 Subject: [PATCH] Fix Vs Seeker Trainer Battle script issue (#7615) --- src/vs_seeker.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/vs_seeker.c b/src/vs_seeker.c index 15829c3bd5..1a7dc68c72 100644 --- a/src/vs_seeker.c +++ b/src/vs_seeker.c @@ -529,7 +529,6 @@ void ClearRematchMovementByTrainerId(void) TryGetObjectEventIdByLocalIdAndMap(objectEventTemplates[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objEventId); objectEvent = &gObjectEvents[objEventId]; - GetRandomFaceDirectionMovementType(&objectEventTemplates[i]); TryOverrideTemplateCoordsForObjectEvent(objectEvent, sFaceDirectionMovementTypeByFacingDirection[objectEvent->facingDirection]); if (gSelectedObjectEvent == objEventId) @@ -705,22 +704,11 @@ static u8 GetResponseMovementTypeFromTrainerGraphicsId(u8 graphicsId) #endif //FREE_MATCH_CALL static u16 GetTrainerFlagFromScript(const u8 *script) - /* - * The trainer flag is a little-endian short located +2 from - * the script pointer, assuming the trainerbattle command is - * first in the script. Because scripts are unaligned, and - * because the ARM processor requires shorts to be 16-bit - * aligned, this function needs to perform explicit bitwise - * operations to get the correct flag. - * - * 5c XX YY ZZ ... - * -- -- - */ { - u16 trainerFlag; - - script += 2; - trainerFlag = script[0]; + // The trainer flag is located 3 bytes (command + flags + localIdA) from the script pointer, assuming the trainerbattle command is first in the script. + // Because scripts are unaligned, and because the ARM processor requires shorts to be 16-bit aligned, this function needs to perform explicit bitwise operations to get the correct flag. + script += 3; + u16 trainerFlag = script[0]; trainerFlag |= script[1] << 8; return trainerFlag; }