mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
clean up trainer see file
This commit is contained in:
parent
5744356989
commit
b7a2335347
@ -5,19 +5,21 @@ struct ApproachingTrainer
|
|||||||
{
|
{
|
||||||
u8 mapObjectId;
|
u8 mapObjectId;
|
||||||
u8 radius; // plus 1
|
u8 radius; // plus 1
|
||||||
u8 field_2;
|
|
||||||
u8 field_3;
|
|
||||||
const u8 *trainerScriptPtr;
|
const u8 *trainerScriptPtr;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
u8 field_9;
|
|
||||||
u8 field_A;
|
|
||||||
u8 field_B;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct ApproachingTrainer gApproachingTrainers[2];
|
extern struct ApproachingTrainer gApproachingTrainers[2];
|
||||||
|
|
||||||
void sub_80B4578(struct MapObject *);
|
bool8 CheckForTrainersWantingBattle(void);
|
||||||
|
void sub_80B4578(struct MapObject *var);
|
||||||
|
void EndTrainerApproach(void);
|
||||||
|
void sub_80B45D0(void);
|
||||||
|
u8 FldEff_ExclamationMarkIcon1(void);
|
||||||
|
u8 FldEff_ExclamationMarkIcon2(void);
|
||||||
|
u8 FldEff_HeartIcon(void);
|
||||||
u8 GetCurrentApproachingTrainerMapObjectId(void);
|
u8 GetCurrentApproachingTrainerMapObjectId(void);
|
||||||
void sub_8155D78(struct MapObject *);
|
u8 GetChosenApproachingTrainerMapObjectId(u8 arrayId);
|
||||||
|
void sub_80B4808(void);
|
||||||
|
|
||||||
#endif // GUARD_TRAINER_SEE_H
|
#endif // GUARD_TRAINER_SEE_H
|
||||||
|
@ -27,45 +27,40 @@ extern bool8 GetTrainerHillTrainerFlag(u8 mapObjectId);
|
|||||||
extern void sub_809BE48(u16 npcId);
|
extern void sub_809BE48(u16 npcId);
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
u8 CheckTrainer(u8 mapObjectId);
|
static u8 CheckTrainer(u8 mapObjectId);
|
||||||
u8 GetTrainerApproachDistance(struct MapObject *trainerObj);
|
static u8 GetTrainerApproachDistance(struct MapObject *trainerObj);
|
||||||
void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range);
|
static u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction);
|
||||||
u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction);
|
static void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range);
|
||||||
void Task_RunTrainerSeeFuncList(u8 taskId);
|
static void Task_RunTrainerSeeFuncList(u8 taskId);
|
||||||
void Task_DestroyTrainerApproachTask(u8 taskId);
|
static void Task_DestroyTrainerApproachTask(u8 taskId);
|
||||||
void sub_80B46D8(struct Sprite *sprite, u16 a2, u8 a3);
|
static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnimNum);
|
||||||
|
|
||||||
u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
||||||
u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
||||||
u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
||||||
u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
static u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
||||||
|
|
||||||
bool8 sub_80B4178(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B4178(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B417C(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B417C(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B41C0(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B41C0(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B4200(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B4200(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B425C(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B425C(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B4318(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B4318(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B435C(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B435C(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B4390(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B4390(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B43AC(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B43AC(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
||||||
|
|
||||||
bool8 sub_80B43AC(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
static void SpriteCB_TrainerIcons(struct Sprite *sprite);
|
||||||
bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
|
||||||
bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
|
||||||
bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainerObj);
|
|
||||||
|
|
||||||
void objc_exclamation_mark_probably(struct Sprite *sprite);
|
|
||||||
|
|
||||||
// const rom data
|
// const rom data
|
||||||
const u8 gEmotion_ExclamationMarkGfx[] = INCBIN_U8("graphics/misc/emotion_exclamation.4bpp");
|
static const u8 sEmotion_ExclamationMarkGfx[] = INCBIN_U8("graphics/misc/emotion_exclamation.4bpp");
|
||||||
const u8 gEmotion_QuestionMarkGfx[] = INCBIN_U8("graphics/misc/emotion_question.4bpp");
|
static const u8 sEmotion_QuestionMarkGfx[] = INCBIN_U8("graphics/misc/emotion_question.4bpp");
|
||||||
const u8 gEmotion_HeartGfx[] = INCBIN_U8("graphics/misc/emotion_heart.4bpp");
|
static const u8 sEmotion_HeartGfx[] = INCBIN_U8("graphics/misc/emotion_heart.4bpp");
|
||||||
|
|
||||||
u8 (*const sDirectionalApproachDistanceFuncs[])(struct MapObject *trainerObj, s16 range, s16 x, s16 y) =
|
static u8 (*const sDirectionalApproachDistanceFuncs[])(struct MapObject *trainerObj, s16 range, s16 x, s16 y) =
|
||||||
{
|
{
|
||||||
GetTrainerApproachDistanceSouth,
|
GetTrainerApproachDistanceSouth,
|
||||||
GetTrainerApproachDistanceNorth,
|
GetTrainerApproachDistanceNorth,
|
||||||
@ -73,7 +68,7 @@ u8 (*const sDirectionalApproachDistanceFuncs[])(struct MapObject *trainerObj, s1
|
|||||||
GetTrainerApproachDistanceEast,
|
GetTrainerApproachDistanceEast,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool8 (*const gTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct MapObject *trainerObj) =
|
static bool8 (*const sTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct MapObject *trainerObj) =
|
||||||
{
|
{
|
||||||
sub_80B4178,
|
sub_80B4178,
|
||||||
sub_80B417C,
|
sub_80B417C,
|
||||||
@ -89,7 +84,7 @@ bool8 (*const gTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct MapObj
|
|||||||
sub_80B44AC
|
sub_80B44AC
|
||||||
};
|
};
|
||||||
|
|
||||||
bool8 (*const gTrainerSeeFuncList2[])(u8 taskId, struct Task *task, struct MapObject *trainerObj) =
|
static bool8 (*const sTrainerSeeFuncList2[])(u8 taskId, struct Task *task, struct MapObject *trainerObj) =
|
||||||
{
|
{
|
||||||
sub_80B43AC,
|
sub_80B43AC,
|
||||||
sub_80B43E0,
|
sub_80B43E0,
|
||||||
@ -97,7 +92,7 @@ bool8 (*const gTrainerSeeFuncList2[])(u8 taskId, struct Task *task, struct MapOb
|
|||||||
sub_80B44AC,
|
sub_80B44AC,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct OamData gOamData_855077C =
|
static const struct OamData sOamData_Icons =
|
||||||
{
|
{
|
||||||
.y = 0,
|
.y = 0,
|
||||||
.affineMode = 0,
|
.affineMode = 0,
|
||||||
@ -114,55 +109,55 @@ const struct OamData gOamData_855077C =
|
|||||||
.affineParam = 0,
|
.affineParam = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct SpriteFrameImage gSpriteImageTable_8550784[] =
|
static const struct SpriteFrameImage sSpriteImageTable_ExclamationQuestionMark[] =
|
||||||
{
|
{
|
||||||
{gEmotion_ExclamationMarkGfx, 0x80},
|
{sEmotion_ExclamationMarkGfx, 0x80},
|
||||||
{gEmotion_QuestionMarkGfx, 0x80}
|
{sEmotion_QuestionMarkGfx, 0x80}
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct SpriteFrameImage gSpriteImageTable_8550794[] =
|
static const struct SpriteFrameImage sSpriteImageTable_HeartIcon[] =
|
||||||
{
|
{
|
||||||
{gEmotion_HeartGfx, 0x80}
|
{sEmotion_HeartGfx, 0x80}
|
||||||
};
|
};
|
||||||
|
|
||||||
const union AnimCmd gSpriteAnim_855079C[] =
|
static const union AnimCmd sSpriteAnim_Icons1[] =
|
||||||
{
|
{
|
||||||
ANIMCMD_FRAME(0, 60),
|
ANIMCMD_FRAME(0, 60),
|
||||||
ANIMCMD_END
|
ANIMCMD_END
|
||||||
};
|
};
|
||||||
|
|
||||||
const union AnimCmd gSpriteAnim_85507A4[] =
|
static const union AnimCmd sSpriteAnim_Icons2[] =
|
||||||
{
|
{
|
||||||
ANIMCMD_FRAME(1, 60),
|
ANIMCMD_FRAME(1, 60),
|
||||||
ANIMCMD_END
|
ANIMCMD_END
|
||||||
};
|
};
|
||||||
|
|
||||||
const union AnimCmd *const gSpriteAnimTable_85507AC[] =
|
static const union AnimCmd *const sSpriteAnimTable_Icons[] =
|
||||||
{
|
{
|
||||||
gSpriteAnim_855079C,
|
sSpriteAnim_Icons1,
|
||||||
gSpriteAnim_85507A4
|
sSpriteAnim_Icons2
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct SpriteTemplate gSpriteTemplate_85507B4 =
|
static const struct SpriteTemplate sSpriteTemplate_ExclamationQuestionMark =
|
||||||
{
|
{
|
||||||
.tileTag = 0xffff,
|
.tileTag = 0xffff,
|
||||||
.paletteTag = 0xffff,
|
.paletteTag = 0xffff,
|
||||||
.oam = &gOamData_855077C,
|
.oam = &sOamData_Icons,
|
||||||
.anims = gSpriteAnimTable_85507AC,
|
.anims = sSpriteAnimTable_Icons,
|
||||||
.images = gSpriteImageTable_8550784,
|
.images = sSpriteImageTable_ExclamationQuestionMark,
|
||||||
.affineAnims = gDummySpriteAffineAnimTable,
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
.callback = objc_exclamation_mark_probably
|
.callback = SpriteCB_TrainerIcons
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct SpriteTemplate gSpriteTemplate_85507CC =
|
static const struct SpriteTemplate sSpriteTemplate_HeartIcon =
|
||||||
{
|
{
|
||||||
.tileTag = 0xffff,
|
.tileTag = 0xffff,
|
||||||
.paletteTag = 0x1004,
|
.paletteTag = 0x1004,
|
||||||
.oam = &gOamData_855077C,
|
.oam = &sOamData_Icons,
|
||||||
.anims = gSpriteAnimTable_85507AC,
|
.anims = sSpriteAnimTable_Icons,
|
||||||
.images = gSpriteImageTable_8550794,
|
.images = sSpriteImageTable_HeartIcon,
|
||||||
.affineAnims = gDummySpriteAffineAnimTable,
|
.affineAnims = gDummySpriteAffineAnimTable,
|
||||||
.callback = objc_exclamation_mark_probably
|
.callback = SpriteCB_TrainerIcons
|
||||||
};
|
};
|
||||||
|
|
||||||
// code
|
// code
|
||||||
@ -223,7 +218,7 @@ bool8 CheckForTrainersWantingBattle(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CheckTrainer(u8 mapObjectId)
|
static u8 CheckTrainer(u8 mapObjectId)
|
||||||
{
|
{
|
||||||
const u8 *scriptPtr;
|
const u8 *scriptPtr;
|
||||||
u8 ret = 1;
|
u8 ret = 1;
|
||||||
@ -276,7 +271,7 @@ u8 CheckTrainer(u8 mapObjectId)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetTrainerApproachDistance(struct MapObject *trainerObj)
|
static u8 GetTrainerApproachDistance(struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
u8 i;
|
u8 i;
|
||||||
@ -302,7 +297,7 @@ u8 GetTrainerApproachDistance(struct MapObject *trainerObj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns how far south the player is from trainer. 0 if out of trainer's sight.
|
// Returns how far south the player is from trainer. 0 if out of trainer's sight.
|
||||||
u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
static u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
if (trainerObj->coords2.x == x
|
if (trainerObj->coords2.x == x
|
||||||
&& y > trainerObj->coords2.y
|
&& y > trainerObj->coords2.y
|
||||||
@ -313,7 +308,7 @@ u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns how far north the player is from trainer. 0 if out of trainer's sight.
|
// Returns how far north the player is from trainer. 0 if out of trainer's sight.
|
||||||
u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
static u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
if (trainerObj->coords2.x == x
|
if (trainerObj->coords2.x == x
|
||||||
&& y < trainerObj->coords2.y
|
&& y < trainerObj->coords2.y
|
||||||
@ -324,7 +319,7 @@ u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns how far west the player is from trainer. 0 if out of trainer's sight.
|
// Returns how far west the player is from trainer. 0 if out of trainer's sight.
|
||||||
u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
static u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
if (trainerObj->coords2.y == y
|
if (trainerObj->coords2.y == y
|
||||||
&& x < trainerObj->coords2.x
|
&& x < trainerObj->coords2.x
|
||||||
@ -335,7 +330,7 @@ u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns how far east the player is from trainer. 0 if out of trainer's sight.
|
// Returns how far east the player is from trainer. 0 if out of trainer's sight.
|
||||||
u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
static u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
if (trainerObj->coords2.y == y
|
if (trainerObj->coords2.y == y
|
||||||
&& x > trainerObj->coords2.x
|
&& x > trainerObj->coords2.x
|
||||||
@ -347,7 +342,7 @@ u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x
|
|||||||
|
|
||||||
#define COLLISION_MASK (~1)
|
#define COLLISION_MASK (~1)
|
||||||
|
|
||||||
u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction)
|
static u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
u8 unk19_temp;
|
u8 unk19_temp;
|
||||||
@ -387,9 +382,10 @@ u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDis
|
|||||||
|
|
||||||
#define tFuncId data[0]
|
#define tFuncId data[0]
|
||||||
#define tTrainerRange data[3]
|
#define tTrainerRange data[3]
|
||||||
|
#define tOutOfAshSpriteId data[4]
|
||||||
#define tTrainerMapObjectId data[7]
|
#define tTrainerMapObjectId data[7]
|
||||||
|
|
||||||
void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range)
|
static void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range)
|
||||||
{
|
{
|
||||||
struct Task *task;
|
struct Task *task;
|
||||||
|
|
||||||
@ -399,7 +395,7 @@ void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range)
|
|||||||
task->tTrainerMapObjectId = gApproachingTrainers[gNoOfApproachingTrainers].mapObjectId;
|
task->tTrainerMapObjectId = gApproachingTrainers[gNoOfApproachingTrainers].mapObjectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B40C8(TaskFunc followupFunc)
|
static void sub_80B40C8(TaskFunc followupFunc)
|
||||||
{
|
{
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
TaskFunc taskFunc;
|
TaskFunc taskFunc;
|
||||||
@ -415,7 +411,7 @@ void sub_80B40C8(TaskFunc followupFunc)
|
|||||||
taskFunc(taskId);
|
taskFunc(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Task_RunTrainerSeeFuncList(u8 taskId)
|
static void Task_RunTrainerSeeFuncList(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
struct MapObject *trainerObj = &gMapObjects[task->tTrainerMapObjectId];
|
struct MapObject *trainerObj = &gMapObjects[task->tTrainerMapObjectId];
|
||||||
@ -426,16 +422,16 @@ void Task_RunTrainerSeeFuncList(u8 taskId)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (gTrainerSeeFuncList[task->tFuncId](taskId, task, trainerObj));
|
while (sTrainerSeeFuncList[task->tFuncId](taskId, task, trainerObj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B4178(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B4178(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B417C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B417C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
u8 direction;
|
u8 direction;
|
||||||
|
|
||||||
@ -447,42 +443,42 @@ bool8 sub_80B417C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B41C0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B41C0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (FieldEffectActiveListContains(0))
|
if (FieldEffectActiveListContains(FLDEFF_EXCLAMATION_MARK_ICON_1))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
if (trainerObj->animPattern == 57 || trainerObj->animPattern == 58)
|
if (trainerObj->animPattern == 57 || trainerObj->animPattern == 58)
|
||||||
task->data[0] = 6;
|
task->tFuncId = 6;
|
||||||
if (trainerObj->animPattern == 63)
|
if (trainerObj->animPattern == 63)
|
||||||
task->data[0] = 8;
|
task->tFuncId = 8;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B4200(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B4200(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (!(FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)) || FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
if (!(FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)) || FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
{
|
{
|
||||||
if (task->data[3])
|
if (task->tTrainerRange)
|
||||||
{
|
{
|
||||||
FieldObjectSetSpecialAnim(trainerObj, GetGoSpeed0AnimId(trainerObj->mapobj_unk_18));
|
FieldObjectSetSpecialAnim(trainerObj, GetGoSpeed0AnimId(trainerObj->mapobj_unk_18));
|
||||||
task->data[3]--;
|
task->tTrainerRange--;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FieldObjectSetSpecialAnim(trainerObj, 0x3E);
|
FieldObjectSetSpecialAnim(trainerObj, 0x3E);
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B425C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B425C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
struct MapObject *playerObj;
|
struct MapObject *playerObj;
|
||||||
|
|
||||||
@ -499,11 +495,11 @@ bool8 sub_80B425C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
|||||||
|
|
||||||
sub_808BCE8();
|
sub_808BCE8();
|
||||||
FieldObjectSetSpecialAnim(&gMapObjects[gPlayerAvatar.mapObjectId], GetFaceDirectionAnimId(GetOppositeDirection(trainerObj->mapobj_unk_18)));
|
FieldObjectSetSpecialAnim(&gMapObjects[gPlayerAvatar.mapObjectId], GetFaceDirectionAnimId(GetOppositeDirection(trainerObj->mapobj_unk_18)));
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B4318(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B4318(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
struct MapObject *playerObj = &gMapObjects[gPlayerAvatar.mapObjectId];
|
struct MapObject *playerObj = &gMapObjects[gPlayerAvatar.mapObjectId];
|
||||||
|
|
||||||
@ -513,37 +509,37 @@ bool8 sub_80B4318(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B435C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B435C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)
|
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)
|
||||||
|| FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
|| FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
{
|
{
|
||||||
FieldObjectSetSpecialAnim(trainerObj, 0x59);
|
FieldObjectSetSpecialAnim(trainerObj, 0x59);
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B4390(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B4390(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
if (FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
task->data[0] = 3;
|
task->tFuncId = 3;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B43AC(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B43AC(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)
|
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)
|
||||||
|| FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
|| FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
{
|
{
|
||||||
FieldObjectSetSpecialAnim(trainerObj, 0x3E);
|
FieldObjectSetSpecialAnim(trainerObj, 0x3E);
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(trainerObj))
|
if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(trainerObj))
|
||||||
{
|
{
|
||||||
@ -551,17 +547,17 @@ bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
|||||||
gFieldEffectArguments[1] = trainerObj->coords2.y;
|
gFieldEffectArguments[1] = trainerObj->coords2.y;
|
||||||
gFieldEffectArguments[2] = gSprites[trainerObj->spriteId].subpriority - 1;
|
gFieldEffectArguments[2] = gSprites[trainerObj->spriteId].subpriority - 1;
|
||||||
gFieldEffectArguments[3] = 2;
|
gFieldEffectArguments[3] = 2;
|
||||||
task->data[4] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH);
|
task->tOutOfAshSpriteId = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH);
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
struct Sprite *sprite;
|
struct Sprite *sprite;
|
||||||
|
|
||||||
if (gSprites[task->data[4]].animCmdIndex == 2)
|
if (gSprites[task->tOutOfAshSpriteId].animCmdIndex == 2)
|
||||||
{
|
{
|
||||||
trainerObj->mapobj_bit_26 = 0;
|
trainerObj->mapobj_bit_26 = 0;
|
||||||
trainerObj->mapobj_bit_2 = 1;
|
trainerObj->mapobj_bit_2 = 1;
|
||||||
@ -570,21 +566,26 @@ bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
|||||||
sprite->oam.priority = 2;
|
sprite->oam.priority = 2;
|
||||||
FieldObjectClearAnimIfSpecialAnimFinished(trainerObj);
|
FieldObjectClearAnimIfSpecialAnimFinished(trainerObj);
|
||||||
FieldObjectSetSpecialAnim(trainerObj, sub_80934BC(trainerObj->mapobj_unk_18));
|
FieldObjectSetSpecialAnim(trainerObj, sub_80934BC(trainerObj->mapobj_unk_18));
|
||||||
task->data[0]++;
|
task->tFuncId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
static bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
if (!FieldEffectActiveListContains(49))
|
if (!FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH))
|
||||||
task->data[0] = 3;
|
task->tFuncId = 3;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B44C8(u8 taskId)
|
#undef tFuncId
|
||||||
|
#undef tTrainerRange
|
||||||
|
#undef tOutOfAshSpriteId
|
||||||
|
#undef tTrainerMapObjectId
|
||||||
|
|
||||||
|
static void sub_80B44C8(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
struct MapObject *mapObj;
|
struct MapObject *mapObj;
|
||||||
@ -596,8 +597,8 @@ void sub_80B44C8(u8 taskId)
|
|||||||
FieldObjectClearAnim(mapObj);
|
FieldObjectClearAnim(mapObj);
|
||||||
task->data[7]++;
|
task->data[7]++;
|
||||||
}
|
}
|
||||||
gTrainerSeeFuncList2[task->data[0]](taskId, task, mapObj);
|
sTrainerSeeFuncList2[task->data[0]](taskId, task, mapObj);
|
||||||
if (task->data[0] == 3 && !FieldEffectActiveListContains(49))
|
if (task->data[0] == 3 && !FieldEffectActiveListContains(FLDEFF_POP_OUT_OF_ASH))
|
||||||
{
|
{
|
||||||
npc_set_running_behaviour_etc(mapObj, npc_running_behaviour_by_direction(mapObj->mapobj_unk_18));
|
npc_set_running_behaviour_etc(mapObj, npc_running_behaviour_by_direction(mapObj->mapobj_unk_18));
|
||||||
sub_808F23C(mapObj, npc_running_behaviour_by_direction(mapObj->mapobj_unk_18));
|
sub_808F23C(mapObj, npc_running_behaviour_by_direction(mapObj->mapobj_unk_18));
|
||||||
@ -619,7 +620,7 @@ void EndTrainerApproach(void)
|
|||||||
sub_80B40C8(Task_DestroyTrainerApproachTask);
|
sub_80B40C8(Task_DestroyTrainerApproachTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Task_DestroyTrainerApproachTask(u8 taskId)
|
static void Task_DestroyTrainerApproachTask(u8 taskId)
|
||||||
{
|
{
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
EnableBothScriptContexts();
|
EnableBothScriptContexts();
|
||||||
@ -648,79 +649,93 @@ void sub_80B45D0(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define sLocalId data[0]
|
||||||
|
#define sMapNum data[1]
|
||||||
|
#define sMapGroup data[2]
|
||||||
|
#define sData3 data[3]
|
||||||
|
#define sData4 data[4]
|
||||||
|
#define sFldEffId data[7]
|
||||||
|
|
||||||
u8 FldEff_ExclamationMarkIcon1(void)
|
u8 FldEff_ExclamationMarkIcon1(void)
|
||||||
{
|
{
|
||||||
u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_85507B4, 0, 0, 0x53);
|
u8 spriteId = CreateSpriteAtEnd(&sSpriteTemplate_ExclamationQuestionMark, 0, 0, 0x53);
|
||||||
|
|
||||||
if (spriteId != MAX_SPRITES)
|
if (spriteId != MAX_SPRITES)
|
||||||
sub_80B46D8(&gSprites[spriteId], 0, 0);
|
SetIconSpriteData(&gSprites[spriteId], FLDEFF_EXCLAMATION_MARK_ICON_1, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 FldEff_ExclamationMarkIcon2(void)
|
u8 FldEff_ExclamationMarkIcon2(void)
|
||||||
{
|
{
|
||||||
u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_85507B4, 0, 0, 0x52);
|
u8 spriteId = CreateSpriteAtEnd(&sSpriteTemplate_ExclamationQuestionMark, 0, 0, 0x52);
|
||||||
|
|
||||||
if (spriteId != MAX_SPRITES)
|
if (spriteId != MAX_SPRITES)
|
||||||
sub_80B46D8(&gSprites[spriteId], 33, 1);
|
SetIconSpriteData(&gSprites[spriteId], FLDEFF_EXCLAMATION_MARK_ICON_2, 1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 FldEff_HeartIcon(void)
|
u8 FldEff_HeartIcon(void)
|
||||||
{
|
{
|
||||||
u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_85507CC, 0, 0, 0x52);
|
u8 spriteId = CreateSpriteAtEnd(&sSpriteTemplate_HeartIcon, 0, 0, 0x52);
|
||||||
|
|
||||||
if (spriteId != MAX_SPRITES)
|
if (spriteId != MAX_SPRITES)
|
||||||
{
|
{
|
||||||
struct Sprite *sprite = &gSprites[spriteId];
|
struct Sprite *sprite = &gSprites[spriteId];
|
||||||
|
|
||||||
sub_80B46D8(sprite, 46, 0);
|
SetIconSpriteData(sprite, FLDEFF_HEART_ICON, 0);
|
||||||
sprite->oam.paletteNum = 2;
|
sprite->oam.paletteNum = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B46D8(struct Sprite *sprite, u16 a2, u8 a3)
|
static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnimNum)
|
||||||
{
|
{
|
||||||
sprite->oam.priority = 1;
|
sprite->oam.priority = 1;
|
||||||
sprite->coordOffsetEnabled = 1;
|
sprite->coordOffsetEnabled = 1;
|
||||||
|
|
||||||
sprite->data[0] = gFieldEffectArguments[0];
|
sprite->sLocalId = gFieldEffectArguments[0];
|
||||||
sprite->data[1] = gFieldEffectArguments[1];
|
sprite->sMapNum = gFieldEffectArguments[1];
|
||||||
sprite->data[2] = gFieldEffectArguments[2];
|
sprite->sMapGroup = gFieldEffectArguments[2];
|
||||||
sprite->data[3] = -5;
|
sprite->sData3 = -5;
|
||||||
sprite->data[7] = a2;
|
sprite->sFldEffId = fldEffId;
|
||||||
|
|
||||||
StartSpriteAnim(sprite, a3);
|
StartSpriteAnim(sprite, spriteAnimNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void objc_exclamation_mark_probably(struct Sprite *sprite)
|
static void SpriteCB_TrainerIcons(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
u8 mapObjId;
|
u8 mapObjId;
|
||||||
|
|
||||||
if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjId)
|
if (TryGetFieldObjectIdByLocalIdAndMap(sprite->sLocalId, sprite->sMapNum, sprite->sMapGroup, &mapObjId)
|
||||||
|| sprite->animEnded)
|
|| sprite->animEnded)
|
||||||
{
|
{
|
||||||
FieldEffectStop(sprite, sprite->data[7]);
|
FieldEffectStop(sprite, sprite->sFldEffId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct Sprite *mapObjSprite = &gSprites[gMapObjects[mapObjId].spriteId];
|
struct Sprite *mapObjSprite = &gSprites[gMapObjects[mapObjId].spriteId];
|
||||||
sprite->data[4] += sprite->data[3];
|
sprite->sData4 += sprite->sData3;
|
||||||
sprite->pos1.x = mapObjSprite->pos1.x;
|
sprite->pos1.x = mapObjSprite->pos1.x;
|
||||||
sprite->pos1.y = mapObjSprite->pos1.y - 16;
|
sprite->pos1.y = mapObjSprite->pos1.y - 16;
|
||||||
sprite->pos2.x = mapObjSprite->pos2.x;
|
sprite->pos2.x = mapObjSprite->pos2.x;
|
||||||
sprite->pos2.y = mapObjSprite->pos2.y + sprite->data[4];
|
sprite->pos2.y = mapObjSprite->pos2.y + sprite->sData4;
|
||||||
if (sprite->data[4])
|
if (sprite->sData4)
|
||||||
sprite->data[3]++;
|
sprite->sData3++;
|
||||||
else
|
else
|
||||||
sprite->data[3] = 0;
|
sprite->sData3 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef sLocalId
|
||||||
|
#undef sMapNum
|
||||||
|
#undef sMapGroup
|
||||||
|
#undef sData3
|
||||||
|
#undef sData4
|
||||||
|
#undef sFldEffId
|
||||||
|
|
||||||
u8 GetCurrentApproachingTrainerMapObjectId(void)
|
u8 GetCurrentApproachingTrainerMapObjectId(void)
|
||||||
{
|
{
|
||||||
if (gApproachingTrainerId == 0)
|
if (gApproachingTrainerId == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user