Fix Vs Seeker Trainer Battle script issue (#7615)

This commit is contained in:
psf 2025-08-26 06:25:18 -07:00 committed by GitHub
parent 1bb9a1c86b
commit 8044255fee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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;
}