mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Document object lock and some trainer approach
This commit is contained in:
parent
0064333e4a
commit
9e59581220
@ -1565,7 +1565,7 @@
|
|||||||
.byte 0xd8
|
.byte 0xd8
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
.macro cmdD9
|
.macro lockfortrainer
|
||||||
.byte 0xd9
|
.byte 0xd9
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ gScriptCmdTable:: @ 81DB67C
|
|||||||
.4byte ScrCmd_freerotatingtilepuzzle @ 0xd6
|
.4byte ScrCmd_freerotatingtilepuzzle @ 0xd6
|
||||||
.4byte ScrCmd_warpmossdeepgym @ 0xd7
|
.4byte ScrCmd_warpmossdeepgym @ 0xd7
|
||||||
.4byte ScrCmd_selectapproachingtrainer @ 0xd8
|
.4byte ScrCmd_selectapproachingtrainer @ 0xd8
|
||||||
.4byte ScrCmd_cmdD9 @ 0xd9
|
.4byte ScrCmd_lockfortrainer @ 0xd9
|
||||||
.4byte ScrCmd_closebraillemessage @ 0xda
|
.4byte ScrCmd_closebraillemessage @ 0xda
|
||||||
.4byte ScrCmd_messageinstant @ 0xdb
|
.4byte ScrCmd_messageinstant @ 0xdb
|
||||||
.4byte ScrCmd_fadescreenswapbuffers @ 0xdc
|
.4byte ScrCmd_fadescreenswapbuffers @ 0xdc
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
EventScript_271354:: @ 8271354
|
EventScript_StartTrainerApproach:: @ 8271354
|
||||||
selectapproachingtrainer
|
selectapproachingtrainer
|
||||||
cmdD9
|
lockfortrainer
|
||||||
|
EventScript_TrainerApproach:: @ 8271356
|
||||||
EventScript_ShowSecondTrainerIntro:: @ 8271356
|
special PlayTrainerEncounterMusic
|
||||||
special SetUpTrainerEncounterMusic
|
special DoTrainerApproach
|
||||||
special EndTrainerApproach
|
|
||||||
waitstate
|
waitstate
|
||||||
goto EventScript_ShowTrainerIntroMsg
|
goto EventScript_ShowTrainerIntroMsg
|
||||||
|
|
||||||
@ -14,11 +13,12 @@ EventScript_TryDoNormalTrainerBattle:: @ 8271362
|
|||||||
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
|
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
|
||||||
waitmovement 0
|
waitmovement 0
|
||||||
specialvar VAR_RESULT, GetTrainerFlag
|
specialvar VAR_RESULT, GetTrainerFlag
|
||||||
compare VAR_RESULT, 0
|
compare VAR_RESULT, FALSE
|
||||||
goto_if_ne EventScript_NoNormalTrainerBattle
|
goto_if_ne EventScript_NoNormalTrainerBattle
|
||||||
special SetUpTrainerEncounterMusic
|
special PlayTrainerEncounterMusic
|
||||||
special SetUpTrainerMovement
|
special SetTrainerFacingDirection
|
||||||
goto EventScript_ShowTrainerIntroMsg
|
goto EventScript_ShowTrainerIntroMsg
|
||||||
|
|
||||||
EventScript_NoNormalTrainerBattle:: @ 8271389
|
EventScript_NoNormalTrainerBattle:: @ 8271389
|
||||||
gotopostbattlescript
|
gotopostbattlescript
|
||||||
|
|
||||||
@ -27,27 +27,29 @@ EventScript_TryDoDoubleTrainerBattle:: @ 827138A
|
|||||||
faceplayer
|
faceplayer
|
||||||
call EventScript_RevealTrainer
|
call EventScript_RevealTrainer
|
||||||
specialvar VAR_RESULT, GetTrainerFlag
|
specialvar VAR_RESULT, GetTrainerFlag
|
||||||
compare VAR_RESULT, 0
|
compare VAR_RESULT, FALSE
|
||||||
goto_if_ne EventScript_NoDoubleTrainerBattle
|
goto_if_ne EventScript_NoDoubleTrainerBattle
|
||||||
special HasEnoughMonsForDoubleBattle
|
special HasEnoughMonsForDoubleBattle
|
||||||
compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
|
compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
|
||||||
goto_if_ne EventScript_NotEnoughMonsForDoubleBattle
|
goto_if_ne EventScript_NotEnoughMonsForDoubleBattle
|
||||||
special SetUpTrainerEncounterMusic
|
special PlayTrainerEncounterMusic
|
||||||
special SetUpTrainerMovement
|
special SetTrainerFacingDirection
|
||||||
goto EventScript_ShowTrainerIntroMsg
|
goto EventScript_ShowTrainerIntroMsg
|
||||||
|
|
||||||
EventScript_NotEnoughMonsForDoubleBattle:: @ 82713BA
|
EventScript_NotEnoughMonsForDoubleBattle:: @ 82713BA
|
||||||
special ShowTrainerCantBattleSpeech
|
special ShowTrainerCantBattleSpeech
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
release
|
release
|
||||||
end
|
end
|
||||||
|
|
||||||
EventScript_NoDoubleTrainerBattle:: @ 82713C1
|
EventScript_NoDoubleTrainerBattle:: @ 82713C1
|
||||||
gotopostbattlescript
|
gotopostbattlescript
|
||||||
|
|
||||||
EventScript_DoNoIntroTrainerBattle:: @ 82713C2
|
EventScript_DoNoIntroTrainerBattle:: @ 82713C2
|
||||||
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
|
applymovement VAR_LAST_TALKED, Movement_RevealTrainer
|
||||||
waitmovement 0
|
waitmovement 0
|
||||||
special SetUpTrainerEncounterMusic
|
special PlayTrainerEncounterMusic
|
||||||
trainerbattlebegin
|
trainerbattlebegin
|
||||||
gotopostbattlescript
|
gotopostbattlescript
|
||||||
|
|
||||||
@ -56,8 +58,8 @@ EventScript_TryDoRematchBattle:: @ 82713D1
|
|||||||
specialvar VAR_RESULT, IsTrainerReadyForRematch
|
specialvar VAR_RESULT, IsTrainerReadyForRematch
|
||||||
compare VAR_RESULT, FALSE
|
compare VAR_RESULT, FALSE
|
||||||
goto_if_eq EventScript_NoRematchTrainerBattle
|
goto_if_eq EventScript_NoRematchTrainerBattle
|
||||||
special SetUpTrainerEncounterMusic
|
special PlayTrainerEncounterMusic
|
||||||
special SetUpTrainerMovement
|
special SetTrainerFacingDirection
|
||||||
special ShowTrainerIntroSpeech
|
special ShowTrainerIntroSpeech
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
@ -65,6 +67,7 @@ EventScript_TryDoRematchBattle:: @ 82713D1
|
|||||||
waitstate
|
waitstate
|
||||||
releaseall
|
releaseall
|
||||||
end
|
end
|
||||||
|
|
||||||
EventScript_NoRematchTrainerBattle:: @ 82713F7
|
EventScript_NoRematchTrainerBattle:: @ 82713F7
|
||||||
gotopostbattlescript
|
gotopostbattlescript
|
||||||
|
|
||||||
@ -75,8 +78,8 @@ EventScript_TryDoDoubleRematchBattle:: @ 82713F8
|
|||||||
special HasEnoughMonsForDoubleBattle
|
special HasEnoughMonsForDoubleBattle
|
||||||
compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
|
compare VAR_RESULT, PLAYER_HAS_TWO_USABLE_MONS
|
||||||
goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle
|
goto_if_ne EventScript_NotEnoughMonsForDoubleRematchBattle
|
||||||
special SetUpTrainerEncounterMusic
|
special PlayTrainerEncounterMusic
|
||||||
special SetUpTrainerMovement
|
special SetTrainerFacingDirection
|
||||||
special ShowTrainerIntroSpeech
|
special ShowTrainerIntroSpeech
|
||||||
waitmessage
|
waitmessage
|
||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
@ -84,8 +87,10 @@ EventScript_TryDoDoubleRematchBattle:: @ 82713F8
|
|||||||
waitstate
|
waitstate
|
||||||
releaseall
|
releaseall
|
||||||
end
|
end
|
||||||
|
|
||||||
EventScript_NoDoubleRematchTrainerBattle:: @ 8271427
|
EventScript_NoDoubleRematchTrainerBattle:: @ 8271427
|
||||||
gotopostbattlescript
|
gotopostbattlescript
|
||||||
|
|
||||||
EventScript_NotEnoughMonsForDoubleRematchBattle:: @ 8271428
|
EventScript_NotEnoughMonsForDoubleRematchBattle:: @ 8271428
|
||||||
special ShowTrainerCantBattleSpeech
|
special ShowTrainerCantBattleSpeech
|
||||||
waitmessage
|
waitmessage
|
||||||
@ -108,7 +113,7 @@ EventScript_ShowTrainerIntroMsg:: @ 827143C
|
|||||||
waitbuttonpress
|
waitbuttonpress
|
||||||
special TryPrepareSecondApproachingTrainer
|
special TryPrepareSecondApproachingTrainer
|
||||||
compare VAR_RESULT, TRUE
|
compare VAR_RESULT, TRUE
|
||||||
goto_if_eq EventScript_ShowSecondTrainerIntro
|
goto_if_eq EventScript_TrainerApproach
|
||||||
goto EventScript_DoTrainerBattle
|
goto EventScript_DoTrainerBattle
|
||||||
|
|
||||||
EventScript_DoTrainerBattle:: @ 8271454
|
EventScript_DoTrainerBattle:: @ 8271454
|
||||||
|
@ -66,8 +66,8 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special ShowTrainerIntroSpeech
|
def_special ShowTrainerIntroSpeech
|
||||||
def_special ShowTrainerCantBattleSpeech
|
def_special ShowTrainerCantBattleSpeech
|
||||||
def_special GetTrainerFlag
|
def_special GetTrainerFlag
|
||||||
def_special EndTrainerApproach
|
def_special DoTrainerApproach
|
||||||
def_special SetUpTrainerEncounterMusic
|
def_special PlayTrainerEncounterMusic
|
||||||
def_special ShouldTryRematchBattle
|
def_special ShouldTryRematchBattle
|
||||||
def_special IsTrainerReadyForRematch
|
def_special IsTrainerReadyForRematch
|
||||||
def_special BattleSetup_StartRematchBattle
|
def_special BattleSetup_StartRematchBattle
|
||||||
@ -324,7 +324,7 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special StartGroudonKyogreBattle
|
def_special StartGroudonKyogreBattle
|
||||||
def_special BattleSetup_StartLegendaryBattle
|
def_special BattleSetup_StartLegendaryBattle
|
||||||
def_special StartRegiBattle
|
def_special StartRegiBattle
|
||||||
def_special SetUpTrainerMovement
|
def_special SetTrainerFacingDirection
|
||||||
def_special DoSealedChamberShakingEffect2
|
def_special DoSealedChamberShakingEffect2
|
||||||
def_special FoundBlackGlasses
|
def_special FoundBlackGlasses
|
||||||
def_special StartDroughtWeatherBlend
|
def_special StartDroughtWeatherBlend
|
||||||
|
@ -37,7 +37,7 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerSc
|
|||||||
void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript);
|
void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript);
|
||||||
void SetUpTwoTrainersBattle(void);
|
void SetUpTwoTrainersBattle(void);
|
||||||
bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
|
bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
|
||||||
void SetUpTrainerMovement(void);
|
void SetTrainerFacingDirection(void);
|
||||||
u8 GetTrainerBattleMode(void);
|
u8 GetTrainerBattleMode(void);
|
||||||
bool8 GetTrainerFlag(void);
|
bool8 GetTrainerFlag(void);
|
||||||
bool8 HasTrainerBeenFought(u16 trainerId);
|
bool8 HasTrainerBeenFought(u16 trainerId);
|
||||||
@ -49,7 +49,7 @@ void ShowTrainerIntroSpeech(void);
|
|||||||
const u8 *BattleSetup_GetScriptAddrAfterBattle(void);
|
const u8 *BattleSetup_GetScriptAddrAfterBattle(void);
|
||||||
const u8 *BattleSetup_GetTrainerPostBattleScript(void);
|
const u8 *BattleSetup_GetTrainerPostBattleScript(void);
|
||||||
void ShowTrainerCantBattleSpeech(void);
|
void ShowTrainerCantBattleSpeech(void);
|
||||||
void SetUpTrainerEncounterMusic(void);
|
void PlayTrainerEncounterMusic(void);
|
||||||
const u8 *GetTrainerALoseText(void);
|
const u8 *GetTrainerALoseText(void);
|
||||||
const u8 *GetTrainerBLoseText(void);
|
const u8 *GetTrainerBLoseText(void);
|
||||||
const u8 *GetTrainerWonSpeech(void);
|
const u8 *GetTrainerWonSpeech(void);
|
||||||
|
@ -71,7 +71,7 @@ void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys);
|
|||||||
void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys);
|
void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys);
|
||||||
bool8 RS_IsRunningDisallowed(u8 tile);
|
bool8 RS_IsRunningDisallowed(u8 tile);
|
||||||
bool8 IsBikingDisallowedByPlayer(void);
|
bool8 IsBikingDisallowedByPlayer(void);
|
||||||
bool8 player_should_look_direction_be_enforced_upon_movement(void);
|
bool8 IsPlayerNotUsingAcroBikeOnBumpySlope(void);
|
||||||
void GetOnOffBike(u8 transitionFlags);
|
void GetOnOffBike(u8 transitionFlags);
|
||||||
void BikeClearState(int newDirHistory, int newAbStartHistory);
|
void BikeClearState(int newDirHistory, int newAbStartHistory);
|
||||||
void Bike_UpdateBikeCounterSpeed(u8 counter);
|
void Bike_UpdateBikeCounterSpeed(u8 counter);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#ifndef GUARD_EVENT_OBJECT_LOCK_H
|
#ifndef GUARD_EVENT_OBJECT_LOCK_H
|
||||||
#define GUARD_EVENT_OBJECT_LOCK_H
|
#define GUARD_EVENT_OBJECT_LOCK_H
|
||||||
|
|
||||||
bool8 sub_80983C4(void);
|
bool8 IsFreezePlayerFinished(void);
|
||||||
void ScriptFreezeObjectEvents(void);
|
void ScriptFreezeObjectEvents(void);
|
||||||
bool8 sub_809847C(void);
|
bool8 IsFreezeSelectedObjectAndPlayerFinished(void);
|
||||||
void LockSelectedObjectEvent(void);
|
void LockSelectedObjectEvent(void);
|
||||||
void sub_8098630(void);
|
void FreezeForApproachingTrainers(void);
|
||||||
bool8 sub_8098734(void);
|
bool8 IsFreezeObjectAndPlayerFinished(void);
|
||||||
void ScriptUnfreezeObjectEvents(void);
|
void ScriptUnfreezeObjectEvents(void);
|
||||||
void UnionRoom_UnlockPlayerAndChatPartner(void);
|
void UnionRoom_UnlockPlayerAndChatPartner(void);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void DestroyExtraMovementTask(u8);
|
|||||||
void UnfreezeObjectEvents(void);
|
void UnfreezeObjectEvents(void);
|
||||||
void FreezeObjectEventsExceptOne(u8 objectEventId);
|
void FreezeObjectEventsExceptOne(u8 objectEventId);
|
||||||
void TurnObjectEventSprite(u8, u8);
|
void TurnObjectEventSprite(u8, u8);
|
||||||
void sub_8098074(u8 var1, u8 var2);
|
void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2);
|
||||||
void FreezeObjectEvents(void);
|
void FreezeObjectEvents(void);
|
||||||
bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent);
|
bool8 FreezeObjectEvent(struct ObjectEvent *objectEvent);
|
||||||
u8 GetMoveDirectionFastAnimNum(u8);
|
u8 GetMoveDirectionFastAnimNum(u8);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
extern const u8 EventScript_TestSignpostMsg[];
|
extern const u8 EventScript_TestSignpostMsg[];
|
||||||
extern const u8 EventScript_TryGetTrainerScript[];
|
extern const u8 EventScript_TryGetTrainerScript[];
|
||||||
extern const u8 EventScript_271354[];
|
extern const u8 EventScript_StartTrainerApproach[];
|
||||||
extern const u8 EventScript_DoNoIntroTrainerBattle[];
|
extern const u8 EventScript_DoNoIntroTrainerBattle[];
|
||||||
extern const u8 EventScript_TryDoDoubleTrainerBattle[];
|
extern const u8 EventScript_TryDoDoubleTrainerBattle[];
|
||||||
extern const u8 EventScript_TryDoNormalTrainerBattle[];
|
extern const u8 EventScript_TryDoNormalTrainerBattle[];
|
||||||
|
@ -34,7 +34,7 @@ u8 PlayerGetZCoord(void);
|
|||||||
void SetPlayerAvatarTransitionFlags(u16 a);
|
void SetPlayerAvatarTransitionFlags(u16 a);
|
||||||
void sub_808BCE8(void);
|
void sub_808BCE8(void);
|
||||||
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
|
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
|
||||||
void sub_808B864(void);
|
void PlayerFreeze(void);
|
||||||
void sub_808BCF4(void);
|
void sub_808BCF4(void);
|
||||||
void SetSpinStartFacingDir(u8);
|
void SetSpinStartFacingDir(u8);
|
||||||
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
|
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
|
||||||
|
@ -17,8 +17,8 @@ extern bool8 gTrainerApproachedPlayer;
|
|||||||
extern u8 gApproachingTrainerId;
|
extern u8 gApproachingTrainerId;
|
||||||
|
|
||||||
bool8 CheckForTrainersWantingBattle(void);
|
bool8 CheckForTrainersWantingBattle(void);
|
||||||
void sub_80B4578(struct ObjectEvent *var);
|
void SetHiddenTrainerMovement(struct ObjectEvent *var);
|
||||||
void EndTrainerApproach(void);
|
void DoTrainerApproach(void);
|
||||||
void TryPrepareSecondApproachingTrainer(void);
|
void TryPrepareSecondApproachingTrainer(void);
|
||||||
u8 FldEff_ExclamationMarkIcon(void);
|
u8 FldEff_ExclamationMarkIcon(void);
|
||||||
u8 FldEff_QuestionMarkIcon(void);
|
u8 FldEff_QuestionMarkIcon(void);
|
||||||
|
@ -923,7 +923,7 @@ static void Script_PrintApprenticeMessage(void)
|
|||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
sub_808BCF4();
|
sub_808BCF4();
|
||||||
DrawDialogueFrame(0, 1);
|
DrawDialogueFrame(0, 1);
|
||||||
PrintApprenticeMessage();
|
PrintApprenticeMessage();
|
||||||
|
@ -1197,7 +1197,7 @@ void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerSc
|
|||||||
gSelectedObjectEvent = trainerObjEventId;
|
gSelectedObjectEvent = trainerObjEventId;
|
||||||
gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId;
|
gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId;
|
||||||
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
||||||
ScriptContext1_SetupScript(EventScript_271354);
|
ScriptContext1_SetupScript(EventScript_StartTrainerApproach);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1210,7 +1210,7 @@ void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript)
|
|||||||
|
|
||||||
void SetUpTwoTrainersBattle(void)
|
void SetUpTwoTrainersBattle(void)
|
||||||
{
|
{
|
||||||
ScriptContext1_SetupScript(EventScript_271354);
|
ScriptContext1_SetupScript(EventScript_StartTrainerApproach);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1220,10 +1220,12 @@ bool32 GetTrainerFlagFromScriptPointer(const u8 *data)
|
|||||||
return FlagGet(TRAINER_FLAGS_START + flag);
|
return FlagGet(TRAINER_FLAGS_START + flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUpTrainerMovement(void)
|
// Set trainer's movement type so they stop and remain facing that direction
|
||||||
|
// Note: Only for trainers who are spoken to directly
|
||||||
|
// For trainers who spot the player this is handled by PlayerFaceApproachingTrainer
|
||||||
|
void SetTrainerFacingDirection(void)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *objectEvent = &gObjectEvents[gSelectedObjectEvent];
|
struct ObjectEvent *objectEvent = &gObjectEvents[gSelectedObjectEvent];
|
||||||
|
|
||||||
SetTrainerMovementType(objectEvent, GetTrainerFacingDirectionMovementType(objectEvent->facingDirection));
|
SetTrainerMovementType(objectEvent, GetTrainerFacingDirectionMovementType(objectEvent->facingDirection));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1437,7 +1439,7 @@ void ShowTrainerCantBattleSpeech(void)
|
|||||||
ShowFieldMessage(GetTrainerCantBattleSpeech());
|
ShowFieldMessage(GetTrainerCantBattleSpeech());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetUpTrainerEncounterMusic(void)
|
void PlayTrainerEncounterMusic(void)
|
||||||
{
|
{
|
||||||
u16 trainerId;
|
u16 trainerId;
|
||||||
u16 music;
|
u16 music;
|
||||||
|
@ -963,9 +963,10 @@ bool8 IsBikingDisallowedByPlayer(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 player_should_look_direction_be_enforced_upon_movement(void)
|
bool8 IsPlayerNotUsingAcroBikeOnBumpySlope(void)
|
||||||
{
|
{
|
||||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior) != FALSE)
|
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE)
|
||||||
|
&& MetatileBehavior_IsBumpySlope(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else
|
else
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -16,18 +16,19 @@ bool8 IsPlayerStandingStill(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80983A4(u8 taskId)
|
// Freeze player once their movement is finished
|
||||||
|
static void Task_FreezePlayer(u8 taskId)
|
||||||
{
|
{
|
||||||
if (IsPlayerStandingStill())
|
if (IsPlayerStandingStill())
|
||||||
{
|
{
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80983C4(void)
|
bool8 IsFreezePlayerFinished(void)
|
||||||
{
|
{
|
||||||
if (FuncIsActiveTask(sub_80983A4))
|
if (FuncIsActiveTask(Task_FreezePlayer))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -42,30 +43,35 @@ bool8 sub_80983C4(void)
|
|||||||
void ScriptFreezeObjectEvents(void)
|
void ScriptFreezeObjectEvents(void)
|
||||||
{
|
{
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
CreateTask(sub_80983A4, 80);
|
CreateTask(Task_FreezePlayer, 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8098400(u8 taskId)
|
#define tPlayerFrozen data[0]
|
||||||
|
#define tObjectFrozen data[1]
|
||||||
|
#define tObjectId data[2]
|
||||||
|
|
||||||
|
// Freeze selected object and player once their movement is finished
|
||||||
|
static void Task_FreezeSelectedObjectAndPlayer(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
if (!task->data[0] && IsPlayerStandingStill() == TRUE)
|
if (!task->tPlayerFrozen && IsPlayerStandingStill() == TRUE)
|
||||||
{
|
{
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
task->data[0] = 1;
|
task->tPlayerFrozen = TRUE;
|
||||||
}
|
}
|
||||||
if (!task->data[1] && !gObjectEvents[gSelectedObjectEvent].singleMovementActive)
|
if (!task->tObjectFrozen && !gObjectEvents[gSelectedObjectEvent].singleMovementActive)
|
||||||
{
|
{
|
||||||
FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]);
|
FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]);
|
||||||
task->data[1] = 1;
|
task->tObjectFrozen = TRUE;
|
||||||
}
|
}
|
||||||
if (task->data[0] && task->data[1])
|
if (task->tPlayerFrozen && task->tObjectFrozen)
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_809847C(void)
|
bool8 IsFreezeSelectedObjectAndPlayerFinished(void)
|
||||||
{
|
{
|
||||||
if (FuncIsActiveTask(sub_8098400))
|
if (FuncIsActiveTask(Task_FreezeSelectedObjectAndPlayer))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -80,11 +86,11 @@ void LockSelectedObjectEvent(void)
|
|||||||
{
|
{
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
FreezeObjectEventsExceptOne(gSelectedObjectEvent);
|
FreezeObjectEventsExceptOne(gSelectedObjectEvent);
|
||||||
taskId = CreateTask(sub_8098400, 80);
|
taskId = CreateTask(Task_FreezeSelectedObjectAndPlayer, 80);
|
||||||
if (!gObjectEvents[gSelectedObjectEvent].singleMovementActive)
|
if (!gObjectEvents[gSelectedObjectEvent].singleMovementActive)
|
||||||
{
|
{
|
||||||
FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]);
|
FreezeObjectEvent(&gObjectEvents[gSelectedObjectEvent]);
|
||||||
gTasks[taskId].data[1] = 1;
|
gTasks[taskId].tObjectFrozen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,64 +124,71 @@ void Script_ClearHeldMovement(void)
|
|||||||
ObjectEventClearHeldMovementIfActive(&gObjectEvents[gSelectedObjectEvent]);
|
ObjectEventClearHeldMovementIfActive(&gObjectEvents[gSelectedObjectEvent]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80985BC(u8 taskId)
|
// Freeze designated object and player once their movement is finished
|
||||||
|
static void Task_FreezeObjectAndPlayer(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
u8 objectEventId = task->data[2];
|
u8 objectEventId = task->tObjectId;
|
||||||
|
|
||||||
if (!task->data[0] && IsPlayerStandingStill() == TRUE)
|
if (!task->tPlayerFrozen && IsPlayerStandingStill() == TRUE)
|
||||||
{
|
{
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
task->data[0] = 1;
|
task->tPlayerFrozen = TRUE;
|
||||||
}
|
}
|
||||||
if (!task->data[1] && !gObjectEvents[objectEventId].singleMovementActive)
|
if (!task->tObjectFrozen && !gObjectEvents[objectEventId].singleMovementActive)
|
||||||
{
|
{
|
||||||
FreezeObjectEvent(&gObjectEvents[objectEventId]);
|
FreezeObjectEvent(&gObjectEvents[objectEventId]);
|
||||||
task->data[1] = 1;
|
task->tObjectFrozen = TRUE;
|
||||||
}
|
}
|
||||||
if (task->data[0] && task->data[1])
|
if (task->tPlayerFrozen && task->tObjectFrozen)
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8098630(void)
|
void FreezeForApproachingTrainers(void)
|
||||||
{
|
{
|
||||||
u8 trainerObjectId1, trainerObjectId2, taskId;
|
u8 trainerObjectId1, trainerObjectId2, taskId;
|
||||||
trainerObjectId1 = GetChosenApproachingTrainerObjectEventId(0);
|
trainerObjectId1 = GetChosenApproachingTrainerObjectEventId(0);
|
||||||
if(gNoOfApproachingTrainers == 2)
|
|
||||||
|
if (gNoOfApproachingTrainers == 2)
|
||||||
{
|
{
|
||||||
|
// Get second trainer, freeze all other objects
|
||||||
trainerObjectId2 = GetChosenApproachingTrainerObjectEventId(1);
|
trainerObjectId2 = GetChosenApproachingTrainerObjectEventId(1);
|
||||||
sub_8098074(trainerObjectId1, trainerObjectId2);
|
FreezeObjectEventsExceptTwo(trainerObjectId1, trainerObjectId2);
|
||||||
taskId = CreateTask(sub_80985BC, 80);
|
|
||||||
gTasks[taskId].data[2] = trainerObjectId1;
|
// Start task to freeze trainer 1 (and player) after movement
|
||||||
if(!gObjectEvents[trainerObjectId1].singleMovementActive)
|
taskId = CreateTask(Task_FreezeObjectAndPlayer, 80);
|
||||||
|
gTasks[taskId].tObjectId = trainerObjectId1;
|
||||||
|
if (!gObjectEvents[trainerObjectId1].singleMovementActive)
|
||||||
{
|
{
|
||||||
FreezeObjectEvent(&gObjectEvents[trainerObjectId1]);
|
FreezeObjectEvent(&gObjectEvents[trainerObjectId1]);
|
||||||
gTasks[taskId].data[1] = 1;
|
gTasks[taskId].tObjectFrozen = TRUE;
|
||||||
}
|
}
|
||||||
taskId = CreateTask(sub_80985BC, 81);
|
|
||||||
gTasks[taskId].data[2] = trainerObjectId2;
|
// Start task to freeze trainer 2 after movement
|
||||||
if(!gObjectEvents[trainerObjectId2].singleMovementActive)
|
taskId = CreateTask(Task_FreezeObjectAndPlayer, 81);
|
||||||
|
gTasks[taskId].tObjectId = trainerObjectId2;
|
||||||
|
if (!gObjectEvents[trainerObjectId2].singleMovementActive)
|
||||||
{
|
{
|
||||||
FreezeObjectEvent(&gObjectEvents[trainerObjectId2]);
|
FreezeObjectEvent(&gObjectEvents[trainerObjectId2]);
|
||||||
gTasks[taskId].data[1] = 1;
|
gTasks[taskId].tObjectFrozen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FreezeObjectEventsExceptOne(trainerObjectId1);
|
FreezeObjectEventsExceptOne(trainerObjectId1);
|
||||||
taskId = CreateTask(sub_80985BC, 80);
|
taskId = CreateTask(Task_FreezeObjectAndPlayer, 80);
|
||||||
gTasks[taskId].data[2] = trainerObjectId1;
|
gTasks[taskId].tObjectId = trainerObjectId1;
|
||||||
if(!gObjectEvents[trainerObjectId1].singleMovementActive)
|
if (!gObjectEvents[trainerObjectId1].singleMovementActive)
|
||||||
{
|
{
|
||||||
FreezeObjectEvent(&gObjectEvents[trainerObjectId1]);
|
FreezeObjectEvent(&gObjectEvents[trainerObjectId1]);
|
||||||
gTasks[taskId].data[1] = 1;
|
gTasks[taskId].tObjectFrozen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_8098734(void)
|
bool8 IsFreezeObjectAndPlayerFinished(void)
|
||||||
{
|
{
|
||||||
if (FuncIsActiveTask(sub_80985BC))
|
if (FuncIsActiveTask(Task_FreezeObjectAndPlayer))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -185,3 +198,7 @@ bool8 sub_8098734(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef tPlayerFrozen
|
||||||
|
#undef tObjectFrozen
|
||||||
|
#undef tObjectId
|
||||||
|
@ -6579,7 +6579,7 @@ bool8 MovementAction_RevealTrainer_Step0(struct ObjectEvent *objectEvent, struct
|
|||||||
{
|
{
|
||||||
if (objectEvent->movementType == MOVEMENT_TYPE_HIDDEN)
|
if (objectEvent->movementType == MOVEMENT_TYPE_HIDDEN)
|
||||||
{
|
{
|
||||||
sub_80B4578(objectEvent);
|
SetHiddenTrainerMovement(objectEvent);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (objectEvent->movementType != MOVEMENT_TYPE_TREE_DISGUISE && objectEvent->movementType != MOVEMENT_TYPE_MOUNTAIN_DISGUISE)
|
if (objectEvent->movementType != MOVEMENT_TYPE_TREE_DISGUISE && objectEvent->movementType != MOVEMENT_TYPE_MOUNTAIN_DISGUISE)
|
||||||
@ -8971,13 +8971,14 @@ void DestroyExtraMovementTask(u8 taskId)
|
|||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_8098074(u8 var1, u8 var2)
|
// Used to freeze other objects except two trainers approaching for battle
|
||||||
|
void FreezeObjectEventsExceptTwo(u8 objectEventId1, u8 objectEventId2)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
for(i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
for(i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||||
{
|
{
|
||||||
if(i != var1 && i != var2 &&
|
if(i != objectEventId1 && i != objectEventId2 &&
|
||||||
gObjectEvents[i].active && i != gPlayerAvatar.objectEventId)
|
gObjectEvents[i].active && i != gPlayerAvatar.objectEventId)
|
||||||
FreezeObjectEvent(&gObjectEvents[i]);
|
FreezeObjectEvent(&gObjectEvents[i]);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8);
|
|||||||
|
|
||||||
static void PlayCollisionSoundIfNotFacingWarp(u8 a);
|
static void PlayCollisionSoundIfNotFacingWarp(u8 a);
|
||||||
|
|
||||||
static void sub_808C280(struct ObjectEvent *);
|
static void HideShowWarpArrow(struct ObjectEvent *);
|
||||||
|
|
||||||
static void StartStrengthAnim(u8, u8);
|
static void StartStrengthAnim(u8, u8);
|
||||||
static void Task_PushBoulder(u8 taskId);
|
static void Task_PushBoulder(u8 taskId);
|
||||||
@ -323,7 +323,7 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys)
|
|||||||
{
|
{
|
||||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
sub_808C280(playerObjEvent);
|
HideShowWarpArrow(playerObjEvent);
|
||||||
if (gPlayerAvatar.preventStep == FALSE)
|
if (gPlayerAvatar.preventStep == FALSE)
|
||||||
{
|
{
|
||||||
Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
|
Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
|
||||||
@ -940,9 +940,9 @@ u8 PlayerGetCopyableMovement(void)
|
|||||||
return gObjectEvents[gPlayerAvatar.objectEventId].playerCopyableMovement;
|
return gObjectEvents[gPlayerAvatar.objectEventId].playerCopyableMovement;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_808B6BC(u8 a)
|
static void PlayerForceSetHeldMovement(u8 movementActionId)
|
||||||
{
|
{
|
||||||
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], a);
|
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], movementActionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement)
|
void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement)
|
||||||
@ -1020,12 +1020,13 @@ void PlayerJumpLedge(u8 direction)
|
|||||||
PlayerSetAnimId(GetJump2MovementAction(direction), 8);
|
PlayerSetAnimId(GetJump2MovementAction(direction), 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_808B864(void)
|
// Stop player on current facing direction once they're done moving and if they're not currently Acro Biking on bumpy slope
|
||||||
|
void PlayerFreeze(void)
|
||||||
{
|
{
|
||||||
if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
|
if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
|
||||||
{
|
{
|
||||||
if (player_should_look_direction_be_enforced_upon_movement())
|
if (IsPlayerNotUsingAcroBikeOnBumpySlope())
|
||||||
sub_808B6BC(GetFaceDirectionMovementAction(gObjectEvents[gPlayerAvatar.objectEventId].facingDirection));
|
PlayerForceSetHeldMovement(GetFaceDirectionMovementAction(gObjectEvents[gPlayerAvatar.objectEventId].facingDirection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1424,7 +1425,7 @@ void SetPlayerAvatarWatering(u8 direction)
|
|||||||
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFaceDirectionAnimNum(direction));
|
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFaceDirectionAnimNum(direction));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_808C280(struct ObjectEvent *objectEvent)
|
static void HideShowWarpArrow(struct ObjectEvent *objectEvent)
|
||||||
{
|
{
|
||||||
s16 x;
|
s16 x;
|
||||||
s16 y;
|
s16 y;
|
||||||
@ -1435,6 +1436,7 @@ static void sub_808C280(struct ObjectEvent *objectEvent)
|
|||||||
{
|
{
|
||||||
if (sArrowWarpMetatileBehaviorChecks2[x](metatileBehavior) && direction == objectEvent->movementDirection)
|
if (sArrowWarpMetatileBehaviorChecks2[x](metatileBehavior) && direction == objectEvent->movementDirection)
|
||||||
{
|
{
|
||||||
|
// Show warp arrow if applicable
|
||||||
x = objectEvent->currentCoords.x;
|
x = objectEvent->currentCoords.x;
|
||||||
y = objectEvent->currentCoords.y;
|
y = objectEvent->currentCoords.y;
|
||||||
MoveCoords(direction, &x, &y);
|
MoveCoords(direction, &x, &y);
|
||||||
|
@ -1971,7 +1971,7 @@ bool8 UseRegisteredKeyItemOnField(void)
|
|||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
sub_808BCF4();
|
sub_808BCF4();
|
||||||
gSpecialVar_ItemId = gSaveBlock1Ptr->registeredItem;
|
gSpecialVar_ItemId = gSaveBlock1Ptr->registeredItem;
|
||||||
taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1Ptr->registeredItem), 8);
|
taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1Ptr->registeredItem), 8);
|
||||||
|
@ -1114,7 +1114,7 @@ static void StartMatchCall(void)
|
|||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
sub_808BCF4();
|
sub_808BCF4();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
src/scrcmd.c
12
src/scrcmd.c
@ -1212,7 +1212,7 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScriptFreezeObjectEvents();
|
ScriptFreezeObjectEvents();
|
||||||
SetupNativeScript(ctx, sub_80983C4);
|
SetupNativeScript(ctx, IsFreezePlayerFinished);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1228,12 +1228,12 @@ bool8 ScrCmd_lock(struct ScriptContext *ctx)
|
|||||||
if (gObjectEvents[gSelectedObjectEvent].active)
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
||||||
{
|
{
|
||||||
LockSelectedObjectEvent();
|
LockSelectedObjectEvent();
|
||||||
SetupNativeScript(ctx, sub_809847C);
|
SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ScriptFreezeObjectEvents();
|
ScriptFreezeObjectEvents();
|
||||||
SetupNativeScript(ctx, sub_80983C4);
|
SetupNativeScript(ctx, IsFreezePlayerFinished);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2190,7 +2190,7 @@ bool8 ScrCmd_selectapproachingtrainer(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_cmdD9(struct ScriptContext *ctx)
|
bool8 ScrCmd_lockfortrainer(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
if (IsUpdateLinkStateCBActive())
|
if (IsUpdateLinkStateCBActive())
|
||||||
{
|
{
|
||||||
@ -2200,8 +2200,8 @@ bool8 ScrCmd_cmdD9(struct ScriptContext *ctx)
|
|||||||
{
|
{
|
||||||
if (gObjectEvents[gSelectedObjectEvent].active)
|
if (gObjectEvents[gSelectedObjectEvent].active)
|
||||||
{
|
{
|
||||||
sub_8098630();
|
FreezeForApproachingTrainers();
|
||||||
SetupNativeScript(ctx, sub_8098734);
|
SetupNativeScript(ctx, IsFreezeObjectAndPlayerFinished);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -541,7 +541,7 @@ void ShowStartMenu(void)
|
|||||||
if (!IsUpdateLinkStateCBActive())
|
if (!IsUpdateLinkStateCBActive())
|
||||||
{
|
{
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
sub_808B864();
|
PlayerFreeze();
|
||||||
sub_808BCF4();
|
sub_808BCF4();
|
||||||
}
|
}
|
||||||
CreateStartMenuTask(Task_ShowStartMenu);
|
CreateStartMenuTask(Task_ShowStartMenu);
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
static u8 CheckTrainer(u8 objectEventId);
|
static u8 CheckTrainer(u8 objectEventId);
|
||||||
static u8 GetTrainerApproachDistance(struct ObjectEvent *trainerObj);
|
static u8 GetTrainerApproachDistance(struct ObjectEvent *trainerObj);
|
||||||
static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 approachDistance, u8 direction);
|
static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 approachDistance, u8 direction);
|
||||||
static void TrainerApproachPlayer(struct ObjectEvent *trainerObj, u8 range);
|
static void InitTrainerApproachTask(struct ObjectEvent *trainerObj, u8 range);
|
||||||
static void Task_RunTrainerSeeFuncList(u8 taskId);
|
static void Task_RunTrainerSeeFuncList(u8 taskId);
|
||||||
static void Task_DestroyTrainerApproachTask(u8 taskId);
|
static void Task_EndTrainerApproach(u8 taskId);
|
||||||
static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnimNum);
|
static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnimNum);
|
||||||
|
|
||||||
static u8 GetTrainerApproachDistanceSouth(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceSouth(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y);
|
||||||
@ -33,7 +33,7 @@ static u8 GetTrainerApproachDistanceNorth(struct ObjectEvent *trainerObj, s16 ra
|
|||||||
static u8 GetTrainerApproachDistanceWest(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceWest(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y);
|
||||||
static u8 GetTrainerApproachDistanceEast(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceEast(struct ObjectEvent *trainerObj, s16 range, s16 x, s16 y);
|
||||||
|
|
||||||
static bool8 sub_80B4178(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
static bool8 TrainerSeeIdle(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
||||||
static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
||||||
static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
||||||
static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj);
|
||||||
@ -71,20 +71,35 @@ static u8 (*const sDirectionalApproachDistanceFuncs[])(struct ObjectEvent *train
|
|||||||
GetTrainerApproachDistanceEast,
|
GetTrainerApproachDistanceEast,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TRSEE_NONE,
|
||||||
|
TRSEE_EXCLAMATION,
|
||||||
|
TRSEE_EXCLAMATION_WAIT,
|
||||||
|
TRSEE_MOVE_TO_PLAYER,
|
||||||
|
TRSEE_PLAYER_FACE,
|
||||||
|
TRSEE_PLAYER_FACE_WAIT,
|
||||||
|
TRSEE_REVEAL_DISGUISE,
|
||||||
|
TRSEE_REVEAL_DISGUISE_WAIT,
|
||||||
|
TRSEE_REVEAL_HIDDEN,
|
||||||
|
TRSEE_HIDDEN_POP_OUT,
|
||||||
|
TRSEE_HIDDEN_JUMP,
|
||||||
|
TRSEE_REVEAL_HIDDEN_WAIT,
|
||||||
|
};
|
||||||
|
|
||||||
static bool8 (*const sTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) =
|
static bool8 (*const sTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) =
|
||||||
{
|
{
|
||||||
sub_80B4178,
|
[TRSEE_NONE] = TrainerSeeIdle,
|
||||||
TrainerExclamationMark,
|
[TRSEE_EXCLAMATION] = TrainerExclamationMark,
|
||||||
WaitTrainerExclamationMark,
|
[TRSEE_EXCLAMATION_WAIT] = WaitTrainerExclamationMark,
|
||||||
TrainerMoveToPlayer,
|
[TRSEE_MOVE_TO_PLAYER] = TrainerMoveToPlayer,
|
||||||
PlayerFaceApproachingTrainer,
|
[TRSEE_PLAYER_FACE] = PlayerFaceApproachingTrainer,
|
||||||
WaitPlayerFaceApproachingTrainer,
|
[TRSEE_PLAYER_FACE_WAIT] = WaitPlayerFaceApproachingTrainer,
|
||||||
RevealDisguisedTrainer,
|
[TRSEE_REVEAL_DISGUISE] = RevealDisguisedTrainer,
|
||||||
WaitRevealDisguisedTrainer,
|
[TRSEE_REVEAL_DISGUISE_WAIT] = WaitRevealDisguisedTrainer,
|
||||||
RevealHiddenTrainer,
|
[TRSEE_REVEAL_HIDDEN] = RevealHiddenTrainer,
|
||||||
PopOutOfAshHiddenTrainer,
|
[TRSEE_HIDDEN_POP_OUT] = PopOutOfAshHiddenTrainer,
|
||||||
JumpInPlaceHiddenTrainer,
|
[TRSEE_HIDDEN_JUMP] = JumpInPlaceHiddenTrainer,
|
||||||
WaitRevealHiddenTrainer,
|
[TRSEE_REVEAL_HIDDEN_WAIT] = WaitRevealHiddenTrainer,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool8 (*const sTrainerSeeFuncList2[])(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) =
|
static bool8 (*const sTrainerSeeFuncList2[])(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj) =
|
||||||
@ -233,7 +248,7 @@ bool8 CheckForTrainersWantingBattle(void)
|
|||||||
static u8 CheckTrainer(u8 objectEventId)
|
static u8 CheckTrainer(u8 objectEventId)
|
||||||
{
|
{
|
||||||
const u8 *scriptPtr;
|
const u8 *scriptPtr;
|
||||||
u8 ret = 1;
|
u8 numTrainers = 1;
|
||||||
u8 approachDistance;
|
u8 approachDistance;
|
||||||
|
|
||||||
if (InTrainerHill() == TRUE)
|
if (InTrainerHill() == TRUE)
|
||||||
@ -268,16 +283,16 @@ static u8 CheckTrainer(u8 objectEventId)
|
|||||||
if (GetMonsStateToDoubles_2() != 0)
|
if (GetMonsStateToDoubles_2() != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ret = 2;
|
numTrainers = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
gApproachingTrainers[gNoOfApproachingTrainers].objectEventId = objectEventId;
|
gApproachingTrainers[gNoOfApproachingTrainers].objectEventId = objectEventId;
|
||||||
gApproachingTrainers[gNoOfApproachingTrainers].trainerScriptPtr = scriptPtr;
|
gApproachingTrainers[gNoOfApproachingTrainers].trainerScriptPtr = scriptPtr;
|
||||||
gApproachingTrainers[gNoOfApproachingTrainers].radius = approachDistance;
|
gApproachingTrainers[gNoOfApproachingTrainers].radius = approachDistance;
|
||||||
TrainerApproachPlayer(&gObjectEvents[objectEventId], approachDistance - 1);
|
InitTrainerApproachTask(&gObjectEvents[objectEventId], approachDistance - 1);
|
||||||
gNoOfApproachingTrainers++;
|
gNoOfApproachingTrainers++;
|
||||||
|
|
||||||
return ret;
|
return numTrainers;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -357,8 +372,7 @@ static u8 GetTrainerApproachDistanceEast(struct ObjectEvent *trainerObj, s16 ran
|
|||||||
static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 approachDistance, u8 direction)
|
static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 approachDistance, u8 direction)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
u8 unk19_temp;
|
u8 rangeX, rangeY;
|
||||||
u8 unk19b_temp;
|
|
||||||
u8 i;
|
u8 i;
|
||||||
u8 collision;
|
u8 collision;
|
||||||
|
|
||||||
@ -376,17 +390,16 @@ static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 ap
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// preserve mapobj_unk_19 before clearing.
|
rangeX = trainerObj->rangeX;
|
||||||
unk19_temp = trainerObj->rangeX;
|
rangeY = trainerObj->rangeY;
|
||||||
unk19b_temp = trainerObj->rangeY;
|
|
||||||
trainerObj->rangeX = 0;
|
trainerObj->rangeX = 0;
|
||||||
trainerObj->rangeY = 0;
|
trainerObj->rangeY = 0;
|
||||||
|
|
||||||
collision = GetCollisionAtCoords(trainerObj, x, y, direction);
|
collision = GetCollisionAtCoords(trainerObj, x, y, direction);
|
||||||
|
|
||||||
trainerObj->rangeX = unk19_temp;
|
trainerObj->rangeX = rangeX;
|
||||||
trainerObj->rangeY = unk19b_temp;
|
trainerObj->rangeY = rangeY;
|
||||||
if (collision == 4)
|
if (collision == COLLISION_OBJECT_EVENT)
|
||||||
return approachDistance;
|
return approachDistance;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -397,7 +410,7 @@ static u8 CheckPathBetweenTrainerAndPlayer(struct ObjectEvent *trainerObj, u8 ap
|
|||||||
#define tOutOfAshSpriteId data[4]
|
#define tOutOfAshSpriteId data[4]
|
||||||
#define tTrainerObjectEventId data[7]
|
#define tTrainerObjectEventId data[7]
|
||||||
|
|
||||||
static void TrainerApproachPlayer(struct ObjectEvent *trainerObj, u8 range)
|
static void InitTrainerApproachTask(struct ObjectEvent *trainerObj, u8 range)
|
||||||
{
|
{
|
||||||
struct Task *task;
|
struct Task *task;
|
||||||
|
|
||||||
@ -407,7 +420,7 @@ static void TrainerApproachPlayer(struct ObjectEvent *trainerObj, u8 range)
|
|||||||
task->tTrainerObjectEventId = gApproachingTrainers[gNoOfApproachingTrainers].objectEventId;
|
task->tTrainerObjectEventId = gApproachingTrainers[gNoOfApproachingTrainers].objectEventId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80B40C8(TaskFunc followupFunc)
|
static void StartTrainerApproach(TaskFunc followupFunc)
|
||||||
{
|
{
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
TaskFunc taskFunc;
|
TaskFunc taskFunc;
|
||||||
@ -419,7 +432,7 @@ static void sub_80B40C8(TaskFunc followupFunc)
|
|||||||
|
|
||||||
taskFunc = Task_RunTrainerSeeFuncList;
|
taskFunc = Task_RunTrainerSeeFuncList;
|
||||||
SetTaskFuncWithFollowupFunc(taskId, taskFunc, followupFunc);
|
SetTaskFuncWithFollowupFunc(taskId, taskFunc, followupFunc);
|
||||||
gTasks[taskId].tFuncId = 1;
|
gTasks[taskId].tFuncId = TRSEE_EXCLAMATION;
|
||||||
taskFunc(taskId);
|
taskFunc(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,11 +451,12 @@ static void Task_RunTrainerSeeFuncList(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 sub_80B4178(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 TrainerSeeIdle(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_EXCLAMATION
|
||||||
static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
u8 direction;
|
u8 direction;
|
||||||
@ -451,10 +465,11 @@ static bool8 TrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectE
|
|||||||
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON);
|
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON);
|
||||||
direction = GetFaceDirectionMovementAction(trainerObj->facingDirection);
|
direction = GetFaceDirectionMovementAction(trainerObj->facingDirection);
|
||||||
ObjectEventSetHeldMovement(trainerObj, direction);
|
ObjectEventSetHeldMovement(trainerObj, direction);
|
||||||
task->tFuncId++;
|
task->tFuncId++; // TRSEE_EXCLAMATION_WAIT
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_EXCLAMATION_WAIT
|
||||||
static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (FieldEffectActiveListContains(FLDEFF_EXCLAMATION_MARK_ICON))
|
if (FieldEffectActiveListContains(FLDEFF_EXCLAMATION_MARK_ICON))
|
||||||
@ -463,15 +478,16 @@ static bool8 WaitTrainerExclamationMark(u8 taskId, struct Task *task, struct Obj
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
task->tFuncId++;
|
task->tFuncId++; // TRSEE_MOVE_TO_PLAYER
|
||||||
if (trainerObj->movementType == MOVEMENT_TYPE_TREE_DISGUISE || trainerObj->movementType == MOVEMENT_TYPE_MOUNTAIN_DISGUISE)
|
if (trainerObj->movementType == MOVEMENT_TYPE_TREE_DISGUISE || trainerObj->movementType == MOVEMENT_TYPE_MOUNTAIN_DISGUISE)
|
||||||
task->tFuncId = 6;
|
task->tFuncId = TRSEE_REVEAL_DISGUISE;
|
||||||
if (trainerObj->movementType == MOVEMENT_TYPE_HIDDEN)
|
if (trainerObj->movementType == MOVEMENT_TYPE_HIDDEN)
|
||||||
task->tFuncId = 8;
|
task->tFuncId = TRSEE_REVEAL_HIDDEN;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_MOVE_TO_PLAYER
|
||||||
static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (!ObjectEventIsMovementOverridden(trainerObj) || ObjectEventClearHeldMovementIfFinished(trainerObj))
|
if (!ObjectEventIsMovementOverridden(trainerObj) || ObjectEventClearHeldMovementIfFinished(trainerObj))
|
||||||
@ -484,12 +500,13 @@ static bool8 TrainerMoveToPlayer(u8 taskId, struct Task *task, struct ObjectEven
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ObjectEventSetHeldMovement(trainerObj, MOVEMENT_ACTION_FACE_PLAYER);
|
ObjectEventSetHeldMovement(trainerObj, MOVEMENT_ACTION_FACE_PLAYER);
|
||||||
task->tFuncId++;
|
task->tFuncId++; // TRSEE_PLAYER_FACE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_PLAYER_FACE
|
||||||
static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerObj;
|
struct ObjectEvent *playerObj;
|
||||||
@ -497,6 +514,7 @@ static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct O
|
|||||||
if (ObjectEventIsMovementOverridden(trainerObj) && !ObjectEventClearHeldMovementIfFinished(trainerObj))
|
if (ObjectEventIsMovementOverridden(trainerObj) && !ObjectEventClearHeldMovementIfFinished(trainerObj))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
// Set trainer's movement type so they stop and remain facing that direction
|
||||||
SetTrainerMovementType(trainerObj, GetTrainerFacingDirectionMovementType(trainerObj->facingDirection));
|
SetTrainerMovementType(trainerObj, GetTrainerFacingDirectionMovementType(trainerObj->facingDirection));
|
||||||
TryOverrideTemplateCoordsForObjectEvent(trainerObj, GetTrainerFacingDirectionMovementType(trainerObj->facingDirection));
|
TryOverrideTemplateCoordsForObjectEvent(trainerObj, GetTrainerFacingDirectionMovementType(trainerObj->facingDirection));
|
||||||
OverrideTemplateCoordsForObjectEvent(trainerObj);
|
OverrideTemplateCoordsForObjectEvent(trainerObj);
|
||||||
@ -507,10 +525,11 @@ static bool8 PlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct O
|
|||||||
|
|
||||||
sub_808BCE8();
|
sub_808BCE8();
|
||||||
ObjectEventSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetFaceDirectionMovementAction(GetOppositeDirection(trainerObj->facingDirection)));
|
ObjectEventSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetFaceDirectionMovementAction(GetOppositeDirection(trainerObj->facingDirection)));
|
||||||
task->tFuncId++;
|
task->tFuncId++; // TRSEE_PLAYER_FACE_WAIT
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_PLAYER_FACE_WAIT
|
||||||
static bool8 WaitPlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 WaitPlayerFaceApproachingTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
@ -521,25 +540,28 @@ static bool8 WaitPlayerFaceApproachingTrainer(u8 taskId, struct Task *task, stru
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_REVEAL_DISGUISE
|
||||||
static bool8 RevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 RevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (!ObjectEventIsMovementOverridden(trainerObj)
|
if (!ObjectEventIsMovementOverridden(trainerObj)
|
||||||
|| ObjectEventClearHeldMovementIfFinished(trainerObj))
|
|| ObjectEventClearHeldMovementIfFinished(trainerObj))
|
||||||
{
|
{
|
||||||
ObjectEventSetHeldMovement(trainerObj, MOVEMENT_ACTION_REVEAL_TRAINER);
|
ObjectEventSetHeldMovement(trainerObj, MOVEMENT_ACTION_REVEAL_TRAINER);
|
||||||
task->tFuncId++;
|
task->tFuncId++; // TRSEE_REVEAL_DISGUISE_WAIT
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_REVEAL_DISGUISE_WAIT
|
||||||
static bool8 WaitRevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 WaitRevealDisguisedTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (ObjectEventClearHeldMovementIfFinished(trainerObj))
|
if (ObjectEventClearHeldMovementIfFinished(trainerObj))
|
||||||
task->tFuncId = 3;
|
task->tFuncId = TRSEE_MOVE_TO_PLAYER;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_REVEAL_HIDDEN
|
||||||
static bool8 RevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 RevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (!ObjectEventIsMovementOverridden(trainerObj)
|
if (!ObjectEventIsMovementOverridden(trainerObj)
|
||||||
@ -551,6 +573,7 @@ static bool8 RevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEven
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_HIDDEN_POP_OUT
|
||||||
static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (ObjectEventCheckHeldMovementStatus(trainerObj))
|
if (ObjectEventCheckHeldMovementStatus(trainerObj))
|
||||||
@ -565,6 +588,7 @@ static bool8 PopOutOfAshHiddenTrainer(u8 taskId, struct Task *task, struct Objec
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_HIDDEN_JUMP
|
||||||
static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
struct Sprite *sprite;
|
struct Sprite *sprite;
|
||||||
@ -584,33 +608,34 @@ static bool8 JumpInPlaceHiddenTrainer(u8 taskId, struct Task *task, struct Objec
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRSEE_REVEAL_HIDDEN_WAIT
|
||||||
static bool8 WaitRevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
static bool8 WaitRevealHiddenTrainer(u8 taskId, struct Task *task, struct ObjectEvent *trainerObj)
|
||||||
{
|
{
|
||||||
if (!FieldEffectActiveListContains(FLDEFF_ASH_PUFF))
|
if (!FieldEffectActiveListContains(FLDEFF_ASH_PUFF))
|
||||||
task->tFuncId = 3;
|
task->tFuncId = TRSEE_MOVE_TO_PLAYER;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tFuncId
|
|
||||||
#undef tTrainerRange
|
#undef tTrainerRange
|
||||||
#undef tOutOfAshSpriteId
|
#undef tOutOfAshSpriteId
|
||||||
#undef tTrainerObjectEventId
|
#undef tTrainerObjectEventId
|
||||||
|
|
||||||
static void sub_80B44C8(u8 taskId)
|
#define tObjEvent data[1]
|
||||||
|
|
||||||
|
static void Task_SetHiddenTrainerMovement(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
struct ObjectEvent *objEvent;
|
struct ObjectEvent *objEvent;
|
||||||
|
|
||||||
// another objEvent loaded into by loadword?
|
LoadWordFromTwoHalfwords(&task->tObjEvent, (u32 *)&objEvent);
|
||||||
LoadWordFromTwoHalfwords(&task->data[1], (u32 *)&objEvent);
|
|
||||||
if (!task->data[7])
|
if (!task->data[7])
|
||||||
{
|
{
|
||||||
ObjectEventClearHeldMovement(objEvent);
|
ObjectEventClearHeldMovement(objEvent);
|
||||||
task->data[7]++;
|
task->data[7]++;
|
||||||
}
|
}
|
||||||
sTrainerSeeFuncList2[task->data[0]](taskId, task, objEvent);
|
sTrainerSeeFuncList2[task->tFuncId](taskId, task, objEvent);
|
||||||
if (task->data[0] == 3 && !FieldEffectActiveListContains(FLDEFF_ASH_PUFF))
|
if (task->tFuncId == ((int)ARRAY_COUNT(sTrainerSeeFuncList2) - 1) && !FieldEffectActiveListContains(FLDEFF_ASH_PUFF))
|
||||||
{
|
{
|
||||||
SetTrainerMovementType(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection));
|
SetTrainerMovementType(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection));
|
||||||
TryOverrideTemplateCoordsForObjectEvent(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection));
|
TryOverrideTemplateCoordsForObjectEvent(objEvent, GetTrainerFacingDirectionMovementType(objEvent->facingDirection));
|
||||||
@ -622,17 +647,18 @@ static void sub_80B44C8(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B4578(struct ObjectEvent *var)
|
// Called when a "buried" trainer has the reveal_trainer movement applied, from direct interaction
|
||||||
|
void SetHiddenTrainerMovement(struct ObjectEvent *objEvent)
|
||||||
{
|
{
|
||||||
StoreWordInTwoHalfwords(&gTasks[CreateTask(sub_80B44C8, 0)].data[1], (u32)var);
|
StoreWordInTwoHalfwords(&gTasks[CreateTask(Task_SetHiddenTrainerMovement, 0)].tObjEvent, (u32)objEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EndTrainerApproach(void)
|
void DoTrainerApproach(void)
|
||||||
{
|
{
|
||||||
sub_80B40C8(Task_DestroyTrainerApproachTask);
|
StartTrainerApproach(Task_EndTrainerApproach);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_DestroyTrainerApproachTask(u8 taskId)
|
static void Task_EndTrainerApproach(u8 taskId)
|
||||||
{
|
{
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
EnableBothScriptContexts();
|
EnableBothScriptContexts();
|
||||||
|
Loading…
Reference in New Issue
Block a user