mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
decompile trainer see
This commit is contained in:
parent
a612ef12a0
commit
5744356989
@ -29290,7 +29290,7 @@ sub_81A9B04: @ 81A9B04
|
|||||||
cmp r0, 0
|
cmp r0, 0
|
||||||
beq _081A9B2E
|
beq _081A9B2E
|
||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
bl sub_80B47E0
|
bl GetChosenApproachingTrainerMapObjectId
|
||||||
ldr r1, =gSelectedMapObject
|
ldr r1, =gSelectedMapObject
|
||||||
strb r0, [r1]
|
strb r0, [r1]
|
||||||
ldr r0, =gTrainerBattleOpponent_B
|
ldr r0, =gTrainerBattleOpponent_B
|
||||||
|
@ -345,7 +345,7 @@ sub_8098630: @ 8098630
|
|||||||
mov r6, r8
|
mov r6, r8
|
||||||
push {r6,r7}
|
push {r6,r7}
|
||||||
movs r0, 0
|
movs r0, 0
|
||||||
bl sub_80B47E0
|
bl GetChosenApproachingTrainerMapObjectId
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r4, r0, 24
|
lsrs r4, r0, 24
|
||||||
ldr r0, =gNoOfApproachingTrainers
|
ldr r0, =gNoOfApproachingTrainers
|
||||||
@ -353,7 +353,7 @@ sub_8098630: @ 8098630
|
|||||||
cmp r0, 0x2
|
cmp r0, 0x2
|
||||||
bne _080986E0
|
bne _080986E0
|
||||||
movs r0, 0x1
|
movs r0, 0x1
|
||||||
bl sub_80B47E0
|
bl GetChosenApproachingTrainerMapObjectId
|
||||||
lsls r0, 24
|
lsls r0, 24
|
||||||
lsrs r0, 24
|
lsrs r0, 24
|
||||||
adds r5, r0, 0
|
adds r5, r0, 0
|
||||||
|
1401
asm/trainer_see.s
1401
asm/trainer_see.s
File diff suppressed because it is too large
Load Diff
@ -844,7 +844,7 @@ EventScript_271354:: @ 8271354
|
|||||||
|
|
||||||
EventScript_271356:: @ 8271356
|
EventScript_271356:: @ 8271356
|
||||||
special SetUpTrainerEncounterMusic
|
special SetUpTrainerEncounterMusic
|
||||||
special sub_80B45AC
|
special EndTrainerApproach
|
||||||
waitstate
|
waitstate
|
||||||
goto EventScript_ShowTrainerIntroMsg
|
goto EventScript_ShowTrainerIntroMsg
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ gFieldEffectScriptPointers:: @ 82DB9D4
|
|||||||
.4byte gFieldEffectScript_Unknown66
|
.4byte gFieldEffectScript_Unknown66
|
||||||
|
|
||||||
gFieldEffectScript_ExclamationMarkIcon1:: @ 82DBAE0
|
gFieldEffectScript_ExclamationMarkIcon1:: @ 82DBAE0
|
||||||
field_eff_callnative oei_exclamation_mark
|
field_eff_callnative FldEff_ExclamationMarkIcon1
|
||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_UseCutOnTallGrass:: @ 82DBAE6
|
gFieldEffectScript_UseCutOnTallGrass:: @ 82DBAE6
|
||||||
@ -207,7 +207,7 @@ gFieldEffectScript_FlyIn:: @ 82DBBE9
|
|||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_ExclamationMarkIcon2:: @ 82DBBEF
|
gFieldEffectScript_ExclamationMarkIcon2:: @ 82DBBEF
|
||||||
field_eff_callnative sub_80B4658
|
field_eff_callnative FldEff_ExclamationMarkIcon2
|
||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_FeetInFlowingWater:: @ 82DBBF5
|
gFieldEffectScript_FeetInFlowingWater:: @ 82DBBF5
|
||||||
@ -260,7 +260,7 @@ gFieldEffectScript_Unknown45:: @ 82DBC4B
|
|||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_HeartIcon:: @ 82DBC56
|
gFieldEffectScript_HeartIcon:: @ 82DBC56
|
||||||
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, sub_80B4690
|
field_eff_loadfadedpal_callnative gFieldEffectObjectPaletteInfo0, FldEff_HeartIcon
|
||||||
field_eff_end
|
field_eff_end
|
||||||
|
|
||||||
gFieldEffectScript_Unknown47:: @ 82DBC60
|
gFieldEffectScript_Unknown47:: @ 82DBC60
|
||||||
|
@ -65,7 +65,7 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special ShowTrainerIntroSpeech
|
def_special ShowTrainerIntroSpeech
|
||||||
def_special ShowTrainerCantBattleSpeech
|
def_special ShowTrainerCantBattleSpeech
|
||||||
def_special GetTrainerFlag
|
def_special GetTrainerFlag
|
||||||
def_special sub_80B45AC
|
def_special EndTrainerApproach
|
||||||
def_special SetUpTrainerEncounterMusic
|
def_special SetUpTrainerEncounterMusic
|
||||||
def_special ShouldTryRematchBattle
|
def_special ShouldTryRematchBattle
|
||||||
def_special IsTrainerReadyForRematch
|
def_special IsTrainerReadyForRematch
|
||||||
|
@ -71,8 +71,9 @@ enum FieldEffectScriptIdx
|
|||||||
|
|
||||||
extern u32 gFieldEffectArguments[8];
|
extern u32 gFieldEffectArguments[8];
|
||||||
|
|
||||||
u8 FieldEffectStart(u8);
|
u32 FieldEffectStart(u8);
|
||||||
bool8 FieldEffectActiveListContains(u8 id);
|
bool8 FieldEffectActiveListContains(u8 id);
|
||||||
void sub_80B69DC(void);
|
void sub_80B69DC(void);
|
||||||
|
void FieldEffectStop(struct Sprite *sprite, u8 id);
|
||||||
|
|
||||||
#endif //GUARD_FIELD_EFFECTS_H
|
#endif //GUARD_FIELD_EFFECTS_H
|
||||||
|
@ -60,7 +60,7 @@ void sub_808E82C(u8, u8, u8, s16, s16);
|
|||||||
void sub_808E7E4(u8, u8, u8);
|
void sub_808E7E4(u8, u8, u8);
|
||||||
void sub_808E78C(u8, u8, u8, u8);
|
void sub_808E78C(u8, u8, u8, u8);
|
||||||
void sub_808E75C(s16, s16);
|
void sub_808E75C(s16, s16);
|
||||||
void FieldObjectGetLocalIdAndMap(struct MapObject *, u8 *, u8 *, u8 *);
|
void FieldObjectGetLocalIdAndMap(struct MapObject *mapObject, void *localId, void *mapNum, void *mapGroup);
|
||||||
void npc_coords_shift(struct MapObject *, s16, s16);
|
void npc_coords_shift(struct MapObject *, s16, s16);
|
||||||
void sub_808EB08(struct MapObject *, s16, s16);
|
void sub_808EB08(struct MapObject *, s16, s16);
|
||||||
void sub_808F254(u8, u8, u8);
|
void sub_808F254(u8, u8, u8);
|
||||||
@ -79,6 +79,15 @@ u8 GetFieldObjectIdByXYZ(u16 x, u16 y, u8 z);
|
|||||||
void npc_set_running_behaviour_etc(struct MapObject *mapObject, u8 animPattern);
|
void npc_set_running_behaviour_etc(struct MapObject *mapObject, u8 animPattern);
|
||||||
u8 npc_running_behaviour_by_direction(u8 direction);
|
u8 npc_running_behaviour_by_direction(u8 direction);
|
||||||
const u8 *GetFieldObjectScriptPointerByFieldObjectId(u8 mapObjectId);
|
const u8 *GetFieldObjectScriptPointerByFieldObjectId(u8 mapObjectId);
|
||||||
|
u8 sub_8092C8C(struct MapObject *mapObject, s16 x, s16 y, u8 direction);
|
||||||
|
u8 GetFaceDirectionAnimId(u32);
|
||||||
|
u8 GetGoSpeed0AnimId(u32);
|
||||||
|
u8 sub_80934BC(u32);
|
||||||
|
bool8 FieldObjectSetSpecialAnim(struct MapObject *mapObject, u8 specialAnimId);
|
||||||
|
bool8 FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(struct MapObject *mapObject);
|
||||||
|
u8 FieldObjectCheckIfSpecialAnimFinishedOrInactive(struct MapObject *mapObject);
|
||||||
|
void sub_808F23C(const struct MapObject *mapObject, u8 movementType);
|
||||||
|
void sub_808F208(const struct MapObject *mapObject);
|
||||||
|
|
||||||
// Exported data declarations
|
// Exported data declarations
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ void PlayerGetDestCoords(s16 *, s16 *);
|
|||||||
u8 player_get_direction_lower_nybble(void);
|
u8 player_get_direction_lower_nybble(void);
|
||||||
u8 player_get_direction_upper_nybble(void);
|
u8 player_get_direction_upper_nybble(void);
|
||||||
u8 player_get_x22(void);
|
u8 player_get_x22(void);
|
||||||
|
void sub_808BCE8(void);
|
||||||
|
|
||||||
void sub_808D074(u8);
|
void sub_808D074(u8);
|
||||||
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
|
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
|
||||||
|
@ -224,7 +224,7 @@ struct MapObject
|
|||||||
/*0x0C*/ struct Coords16 coords1;
|
/*0x0C*/ struct Coords16 coords1;
|
||||||
/*0x10*/ struct Coords16 coords2;
|
/*0x10*/ struct Coords16 coords2;
|
||||||
/*0x14*/ struct Coords16 coords3;
|
/*0x14*/ struct Coords16 coords3;
|
||||||
/*0x18*/ u8 mapobj_unk_18:4; //current direction?
|
/*0x18*/ u8 mapobj_unk_18:4; // current direction?
|
||||||
/*0x18*/ u8 placeholder18:4;
|
/*0x18*/ u8 placeholder18:4;
|
||||||
/*0x19*/ union __attribute__((packed)) {
|
/*0x19*/ union __attribute__((packed)) {
|
||||||
u8 as_byte;
|
u8 as_byte;
|
||||||
|
@ -28,5 +28,7 @@ void sub_8097750(struct Sprite *);
|
|||||||
bool8 sub_8097758(struct Sprite *);
|
bool8 sub_8097758(struct Sprite *);
|
||||||
void sub_8097FA4(struct MapObject *);
|
void sub_8097FA4(struct MapObject *);
|
||||||
void sub_8098044(u8);
|
void sub_8098044(u8);
|
||||||
|
void UnfreezeMapObjects(void);
|
||||||
|
void sub_80974D0(u8 mapObjectId);
|
||||||
|
|
||||||
#endif //GUARD_MAP_OBJ_8097404_H
|
#endif //GUARD_MAP_OBJ_8097404_H
|
||||||
|
@ -8,16 +8,16 @@ struct ApproachingTrainer
|
|||||||
u8 field_2;
|
u8 field_2;
|
||||||
u8 field_3;
|
u8 field_3;
|
||||||
const u8 *trainerScriptPtr;
|
const u8 *trainerScriptPtr;
|
||||||
u8 field_8;
|
u8 taskId;
|
||||||
u8 field_9;
|
u8 field_9;
|
||||||
u8 field_A;
|
u8 field_A;
|
||||||
u8 field_B;
|
u8 field_B;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct ApproachingTrainer gApproachingTrainers[];
|
extern struct ApproachingTrainer gApproachingTrainers[2];
|
||||||
|
|
||||||
void sub_80B4578(struct MapObject *);
|
void sub_80B4578(struct MapObject *);
|
||||||
u8 sub_80B47BC(void);
|
u8 GetCurrentApproachingTrainerMapObjectId(void);
|
||||||
void sub_8155D78(struct MapObject *);
|
void sub_8155D78(struct MapObject *);
|
||||||
|
|
||||||
#endif //GUARD_TRAINER_SEE_H
|
#endif // GUARD_TRAINER_SEE_H
|
||||||
|
@ -122,7 +122,6 @@ SECTIONS {
|
|||||||
src/battle_setup.o(.text);
|
src/battle_setup.o(.text);
|
||||||
asm/cable_club.o(.text);
|
asm/cable_club.o(.text);
|
||||||
src/trainer_see.o(.text);
|
src/trainer_see.o(.text);
|
||||||
asm/trainer_see.o(.text);
|
|
||||||
src/wild_encounter.o(.text);
|
src/wild_encounter.o(.text);
|
||||||
asm/field_effect.o(.text);
|
asm/field_effect.o(.text);
|
||||||
asm/unknown_task.o(.text);
|
asm/unknown_task.o(.text);
|
||||||
|
@ -1174,11 +1174,11 @@ void npc_by_local_id_and_map_set_field_1_bit_x20(u8 localId, u8 mapNum, u8 mapGr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FieldObjectGetLocalIdAndMap(struct MapObject *mapObject, u8 *localId, u8 *mapNum, u8 *mapGroup)
|
void FieldObjectGetLocalIdAndMap(struct MapObject *mapObject, void *localId, void *mapNum, void *mapGroup)
|
||||||
{
|
{
|
||||||
*localId = mapObject->localId;
|
*(u8*)(localId) = mapObject->localId;
|
||||||
*mapNum = mapObject->mapNum;
|
*(u8*)(mapNum) = mapObject->mapNum;
|
||||||
*mapGroup = mapObject->mapGroup;
|
*(u8*)(mapGroup) = mapObject->mapGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_808E75C(s16 x, s16 y)
|
void sub_808E75C(s16 x, s16 y)
|
||||||
@ -3426,7 +3426,7 @@ void FieldObjectCB_TreeDisguise(struct Sprite *sprite)
|
|||||||
mapObject = &gMapObjects[sprite->data[0]];
|
mapObject = &gMapObjects[sprite->data[0]];
|
||||||
if (mapObject->mapobj_unk_21 == 0 || (mapObject->mapobj_unk_21 == 1 && !sprite->data[7]))
|
if (mapObject->mapobj_unk_21 == 0 || (mapObject->mapobj_unk_21 == 1 && !sprite->data[7]))
|
||||||
{
|
{
|
||||||
FieldObjectGetLocalIdAndMap(mapObject, (u8 *)&gFieldEffectArguments[0], (u8 *)&gFieldEffectArguments[1], (u8 *)&gFieldEffectArguments[2]);
|
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
|
||||||
mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_TREE_DISGUISE);
|
mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_TREE_DISGUISE);
|
||||||
mapObject->mapobj_unk_21 = 1;
|
mapObject->mapobj_unk_21 = 1;
|
||||||
sprite->data[7] ++;
|
sprite->data[7] ++;
|
||||||
@ -3447,7 +3447,7 @@ void FieldObjectCB_MountainDisguise(struct Sprite *sprite)
|
|||||||
mapObject = &gMapObjects[sprite->data[0]];
|
mapObject = &gMapObjects[sprite->data[0]];
|
||||||
if (mapObject->mapobj_unk_21 == 0 || (mapObject->mapobj_unk_21 == 1 && !sprite->data[7]))
|
if (mapObject->mapobj_unk_21 == 0 || (mapObject->mapobj_unk_21 == 1 && !sprite->data[7]))
|
||||||
{
|
{
|
||||||
FieldObjectGetLocalIdAndMap(mapObject, (u8 *)&gFieldEffectArguments[0], (u8 *)&gFieldEffectArguments[1], (u8 *)&gFieldEffectArguments[2]);
|
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
|
||||||
mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_MOUNTAIN_DISGUISE);
|
mapObject->mapobj_unk_1A = FieldEffectStart(FLDEFF_MOUNTAIN_DISGUISE);
|
||||||
mapObject->mapobj_unk_21 = 1;
|
mapObject->mapobj_unk_21 = 1;
|
||||||
sprite->data[7] ++;
|
sprite->data[7] ++;
|
||||||
@ -4694,7 +4694,7 @@ bool8 sub_80954CC(struct MapObject *mapObject, struct Sprite *sprite)
|
|||||||
|
|
||||||
bool8 do_exclamation_mark_bubble_1(struct MapObject *mapObject, struct Sprite *sprite)
|
bool8 do_exclamation_mark_bubble_1(struct MapObject *mapObject, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
FieldObjectGetLocalIdAndMap(mapObject, (u8 *)&gFieldEffectArguments[0], (u8 *)&gFieldEffectArguments[1], (u8 *)&gFieldEffectArguments[2]);
|
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
|
||||||
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON_1);
|
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON_1);
|
||||||
sprite->data[2] = 1;
|
sprite->data[2] = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4702,7 +4702,7 @@ bool8 do_exclamation_mark_bubble_1(struct MapObject *mapObject, struct Sprite *s
|
|||||||
|
|
||||||
bool8 do_exclamation_mark_bubble_2(struct MapObject *mapObject, struct Sprite *sprite)
|
bool8 do_exclamation_mark_bubble_2(struct MapObject *mapObject, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
FieldObjectGetLocalIdAndMap(mapObject, (u8 *)&gFieldEffectArguments[0], (u8 *)&gFieldEffectArguments[1], (u8 *)&gFieldEffectArguments[2]);
|
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
|
||||||
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON_2);
|
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON_2);
|
||||||
sprite->data[2] = 1;
|
sprite->data[2] = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -4710,7 +4710,7 @@ bool8 do_exclamation_mark_bubble_2(struct MapObject *mapObject, struct Sprite *s
|
|||||||
|
|
||||||
bool8 do_heart_bubble(struct MapObject *mapObject, struct Sprite *sprite)
|
bool8 do_heart_bubble(struct MapObject *mapObject, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
FieldObjectGetLocalIdAndMap(mapObject, (u8 *)&gFieldEffectArguments[0], (u8 *)&gFieldEffectArguments[1], (u8 *)&gFieldEffectArguments[2]);
|
FieldObjectGetLocalIdAndMap(mapObject, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
|
||||||
FieldEffectStart(FLDEFF_HEART_ICON);
|
FieldEffectStart(FLDEFF_HEART_ICON);
|
||||||
sprite->data[2] = 1;
|
sprite->data[2] = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -2332,7 +2332,7 @@ bool8 ScrCmd_mossdeepgym4(struct ScriptContext *ctx)
|
|||||||
|
|
||||||
bool8 ScrCmd_cmdD8(struct ScriptContext *ctx)
|
bool8 ScrCmd_cmdD8(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
gSelectedMapObject = sub_80B47BC();
|
gSelectedMapObject = GetCurrentApproachingTrainerMapObjectId();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,24 +3,37 @@
|
|||||||
#include "battle_setup.h"
|
#include "battle_setup.h"
|
||||||
#include "pokemon.h"
|
#include "pokemon.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
|
#include "field_effect.h"
|
||||||
#include "field_map_obj.h"
|
#include "field_map_obj.h"
|
||||||
|
#include "field_player_avatar.h"
|
||||||
|
#include "map_obj_8097404.h"
|
||||||
#include "pokenav.h"
|
#include "pokenav.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
#include "util.h"
|
||||||
|
#include "script.h"
|
||||||
|
#include "event_data.h"
|
||||||
|
#include "script_movement.h"
|
||||||
|
|
||||||
extern u8 gApproachingTrainerId;
|
extern u8 gApproachingTrainerId;
|
||||||
extern u8 gNoOfApproachingTrainers;
|
extern u8 gNoOfApproachingTrainers;
|
||||||
extern u8 gUnknown_030060AC;
|
extern u8 gUnknown_030060AC;
|
||||||
extern u16 gUnknown_03006080;
|
extern u16 gUnknown_03006080;
|
||||||
|
extern u8 gUnknown_03006084[];
|
||||||
|
|
||||||
extern bool8 InBattlePyramid(void);
|
extern bool8 InBattlePyramid(void);
|
||||||
extern bool32 InTrainerHill(void);
|
extern bool32 InTrainerHill(void);
|
||||||
extern bool8 GetBattlePyramidTrainerFlag(u8 mapObjectId);
|
extern bool8 GetBattlePyramidTrainerFlag(u8 mapObjectId);
|
||||||
extern bool8 GetTrainerHillTrainerFlag(u8 mapObjectId);
|
extern bool8 GetTrainerHillTrainerFlag(u8 mapObjectId);
|
||||||
|
extern void sub_809BE48(u16 npcId);
|
||||||
|
|
||||||
// this file's functions
|
// this file's functions
|
||||||
static u8 CheckTrainer(u8 mapObjectId);
|
u8 CheckTrainer(u8 mapObjectId);
|
||||||
u8 GetTrainerApproachDistance(struct MapObject *trainerObj);
|
u8 GetTrainerApproachDistance(struct MapObject *trainerObj);
|
||||||
void TrainerApproachPlayer(struct MapObject *trainerObj, u8 radius);
|
void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range);
|
||||||
|
u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction);
|
||||||
|
void Task_RunTrainerSeeFuncList(u8 taskId);
|
||||||
|
void Task_DestroyTrainerApproachTask(u8 taskId);
|
||||||
|
void sub_80B46D8(struct Sprite *sprite, u16 a2, u8 a3);
|
||||||
|
|
||||||
u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
||||||
u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y);
|
||||||
@ -210,7 +223,7 @@ bool8 CheckForTrainersWantingBattle(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 CheckTrainer(u8 mapObjectId)
|
u8 CheckTrainer(u8 mapObjectId)
|
||||||
{
|
{
|
||||||
const u8 *scriptPtr;
|
const u8 *scriptPtr;
|
||||||
u8 ret = 1;
|
u8 ret = 1;
|
||||||
@ -263,7 +276,6 @@ static u8 CheckTrainer(u8 mapObjectId)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
u8 GetTrainerApproachDistance(struct MapObject *trainerObj)
|
u8 GetTrainerApproachDistance(struct MapObject *trainerObj)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
@ -274,17 +286,477 @@ u8 GetTrainerApproachDistance(struct MapObject *trainerObj)
|
|||||||
if (trainerObj->trainerType == 1) // can only see in one direction
|
if (trainerObj->trainerType == 1) // can only see in one direction
|
||||||
{
|
{
|
||||||
approachDistance = sDirectionalApproachDistanceFuncs[trainerObj->mapobj_unk_18 - 1](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
|
approachDistance = sDirectionalApproachDistanceFuncs[trainerObj->mapobj_unk_18 - 1](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
|
||||||
return CheckPathBetweenTrainerAndPlayer((struct MapObject2 *)trainerObj, approachDistance, trainerObj->mapobj_unk_18);
|
return CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, trainerObj->mapobj_unk_18);
|
||||||
}
|
}
|
||||||
else // can see in all directions
|
else // can see in all directions
|
||||||
{
|
{
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
approachDistance = sDirectionalApproachDistanceFuncs[i](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
|
approachDistance = sDirectionalApproachDistanceFuncs[i](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
|
||||||
if (CheckPathBetweenTrainerAndPlayer((struct MapObject2 *)trainerObj, approachDistance, i + 1)) // directions are 1-4 instead of 0-3. south north west east
|
if (CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, i + 1)) // directions are 1-4 instead of 0-3. south north west east
|
||||||
return approachDistance;
|
return approachDistance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
if (trainerObj->coords2.x == x
|
||||||
|
&& y > trainerObj->coords2.y
|
||||||
|
&& y <= trainerObj->coords2.y + range)
|
||||||
|
return (y - trainerObj->coords2.y);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
if (trainerObj->coords2.x == x
|
||||||
|
&& y < trainerObj->coords2.y
|
||||||
|
&& y >= trainerObj->coords2.y - range)
|
||||||
|
return (trainerObj->coords2.y - y);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
if (trainerObj->coords2.y == y
|
||||||
|
&& x < trainerObj->coords2.x
|
||||||
|
&& x >= trainerObj->coords2.x - range)
|
||||||
|
return (trainerObj->coords2.x - x);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
if (trainerObj->coords2.y == y
|
||||||
|
&& x > trainerObj->coords2.x
|
||||||
|
&& x <= trainerObj->coords2.x + range)
|
||||||
|
return (x - trainerObj->coords2.x);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define COLLISION_MASK (~1)
|
||||||
|
|
||||||
|
u8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction)
|
||||||
|
{
|
||||||
|
s16 x, y;
|
||||||
|
u8 unk19_temp;
|
||||||
|
u8 unk19b_temp;
|
||||||
|
u8 i;
|
||||||
|
u8 collision;
|
||||||
|
|
||||||
|
if (approachDistance == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
x = trainerObj->coords2.x;
|
||||||
|
y = trainerObj->coords2.y;
|
||||||
|
|
||||||
|
MoveCoords(direction, &x, &y);
|
||||||
|
for (i = 0; i < approachDistance - 1; i++, MoveCoords(direction, &x, &y))
|
||||||
|
{
|
||||||
|
collision = sub_8092C8C(trainerObj, x, y, direction);
|
||||||
|
if (collision != 0 && (collision & COLLISION_MASK))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// preserve mapobj_unk_19 before clearing.
|
||||||
|
unk19_temp = trainerObj->range.as_nybbles.x;
|
||||||
|
unk19b_temp = trainerObj->range.as_nybbles.y;
|
||||||
|
trainerObj->range.as_nybbles.x = 0;
|
||||||
|
trainerObj->range.as_nybbles.y = 0;
|
||||||
|
|
||||||
|
collision = npc_block_way(trainerObj, x, y, direction);
|
||||||
|
|
||||||
|
trainerObj->range.as_nybbles.x = unk19_temp;
|
||||||
|
trainerObj->range.as_nybbles.y = unk19b_temp;
|
||||||
|
if (collision == 4)
|
||||||
|
return approachDistance;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define tFuncId data[0]
|
||||||
|
#define tTrainerRange data[3]
|
||||||
|
#define tTrainerMapObjectId data[7]
|
||||||
|
|
||||||
|
void TrainerApproachPlayer(struct MapObject *trainerObj, u8 range)
|
||||||
|
{
|
||||||
|
struct Task *task;
|
||||||
|
|
||||||
|
gApproachingTrainers[gNoOfApproachingTrainers].taskId = CreateTask(Task_RunTrainerSeeFuncList, 0x50);
|
||||||
|
task = &gTasks[gApproachingTrainers[gNoOfApproachingTrainers].taskId];
|
||||||
|
task->tTrainerRange = range;
|
||||||
|
task->tTrainerMapObjectId = gApproachingTrainers[gNoOfApproachingTrainers].mapObjectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_80B40C8(TaskFunc followupFunc)
|
||||||
|
{
|
||||||
|
u8 taskId;
|
||||||
|
TaskFunc taskFunc;
|
||||||
|
|
||||||
|
if (gApproachingTrainerId == 0)
|
||||||
|
taskId = gApproachingTrainers[0].taskId;
|
||||||
|
else
|
||||||
|
taskId = gApproachingTrainers[1].taskId;
|
||||||
|
|
||||||
|
taskFunc = Task_RunTrainerSeeFuncList;
|
||||||
|
SetTaskFuncWithFollowupFunc(taskId, taskFunc, followupFunc);
|
||||||
|
gTasks[taskId].tFuncId = 1;
|
||||||
|
taskFunc(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Task_RunTrainerSeeFuncList(u8 taskId)
|
||||||
|
{
|
||||||
|
struct Task *task = &gTasks[taskId];
|
||||||
|
struct MapObject *trainerObj = &gMapObjects[task->tTrainerMapObjectId];
|
||||||
|
|
||||||
|
if (!trainerObj->active)
|
||||||
|
{
|
||||||
|
SwitchTaskToFollowupFunc(taskId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while (gTrainerSeeFuncList[task->tFuncId](taskId, task, trainerObj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B4178(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B417C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
u8 direction;
|
||||||
|
|
||||||
|
FieldObjectGetLocalIdAndMap(trainerObj, &gFieldEffectArguments[0], &gFieldEffectArguments[1], &gFieldEffectArguments[2]);
|
||||||
|
FieldEffectStart(FLDEFF_EXCLAMATION_MARK_ICON_1);
|
||||||
|
direction = GetFaceDirectionAnimId(trainerObj->mapobj_unk_18);
|
||||||
|
FieldObjectSetSpecialAnim(trainerObj, direction);
|
||||||
|
task->tFuncId++;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B41C0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (FieldEffectActiveListContains(0))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task->data[0]++;
|
||||||
|
if (trainerObj->animPattern == 57 || trainerObj->animPattern == 58)
|
||||||
|
task->data[0] = 6;
|
||||||
|
if (trainerObj->animPattern == 63)
|
||||||
|
task->data[0] = 8;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B4200(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (!(FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)) || FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
|
{
|
||||||
|
if (task->data[3])
|
||||||
|
{
|
||||||
|
FieldObjectSetSpecialAnim(trainerObj, GetGoSpeed0AnimId(trainerObj->mapobj_unk_18));
|
||||||
|
task->data[3]--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FieldObjectSetSpecialAnim(trainerObj, 0x3E);
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B425C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
struct MapObject *playerObj;
|
||||||
|
|
||||||
|
if (FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj) && !FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
npc_set_running_behaviour_etc(trainerObj, npc_running_behaviour_by_direction(trainerObj->mapobj_unk_18));
|
||||||
|
sub_808F23C(trainerObj, npc_running_behaviour_by_direction(trainerObj->mapobj_unk_18));
|
||||||
|
sub_808F208(trainerObj);
|
||||||
|
|
||||||
|
playerObj = &gMapObjects[gPlayerAvatar.mapObjectId];
|
||||||
|
if (FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(playerObj) && !FieldObjectClearAnimIfSpecialAnimFinished(playerObj))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
sub_808BCE8();
|
||||||
|
FieldObjectSetSpecialAnim(&gMapObjects[gPlayerAvatar.mapObjectId], GetFaceDirectionAnimId(GetOppositeDirection(trainerObj->mapobj_unk_18)));
|
||||||
|
task->data[0]++;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B4318(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
struct MapObject *playerObj = &gMapObjects[gPlayerAvatar.mapObjectId];
|
||||||
|
|
||||||
|
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(playerObj)
|
||||||
|
|| FieldObjectClearAnimIfSpecialAnimFinished(playerObj))
|
||||||
|
SwitchTaskToFollowupFunc(taskId);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B435C(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)
|
||||||
|
|| FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
|
{
|
||||||
|
FieldObjectSetSpecialAnim(trainerObj, 0x59);
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B4390(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
|
task->data[0] = 3;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B43AC(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (!FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(trainerObj)
|
||||||
|
|| FieldObjectClearAnimIfSpecialAnimFinished(trainerObj))
|
||||||
|
{
|
||||||
|
FieldObjectSetSpecialAnim(trainerObj, 0x3E);
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B43E0(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (FieldObjectCheckIfSpecialAnimFinishedOrInactive(trainerObj))
|
||||||
|
{
|
||||||
|
gFieldEffectArguments[0] = trainerObj->coords2.x;
|
||||||
|
gFieldEffectArguments[1] = trainerObj->coords2.y;
|
||||||
|
gFieldEffectArguments[2] = gSprites[trainerObj->spriteId].subpriority - 1;
|
||||||
|
gFieldEffectArguments[3] = 2;
|
||||||
|
task->data[4] = FieldEffectStart(FLDEFF_POP_OUT_OF_ASH);
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B4438(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
struct Sprite *sprite;
|
||||||
|
|
||||||
|
if (gSprites[task->data[4]].animCmdIndex == 2)
|
||||||
|
{
|
||||||
|
trainerObj->mapobj_bit_26 = 0;
|
||||||
|
trainerObj->mapobj_bit_2 = 1;
|
||||||
|
|
||||||
|
sprite = &gSprites[trainerObj->spriteId];
|
||||||
|
sprite->oam.priority = 2;
|
||||||
|
FieldObjectClearAnimIfSpecialAnimFinished(trainerObj);
|
||||||
|
FieldObjectSetSpecialAnim(trainerObj, sub_80934BC(trainerObj->mapobj_unk_18));
|
||||||
|
task->data[0]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 sub_80B44AC(u8 taskId, struct Task *task, struct MapObject *trainerObj)
|
||||||
|
{
|
||||||
|
if (!FieldEffectActiveListContains(49))
|
||||||
|
task->data[0] = 3;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_80B44C8(u8 taskId)
|
||||||
|
{
|
||||||
|
struct Task *task = &gTasks[taskId];
|
||||||
|
struct MapObject *mapObj;
|
||||||
|
|
||||||
|
// another mapObj loaded into by loadword?
|
||||||
|
LoadWordFromTwoHalfwords(&task->data[1], (u32 *)&mapObj);
|
||||||
|
if (!task->data[7])
|
||||||
|
{
|
||||||
|
FieldObjectClearAnim(mapObj);
|
||||||
|
task->data[7]++;
|
||||||
|
}
|
||||||
|
gTrainerSeeFuncList2[task->data[0]](taskId, task, mapObj);
|
||||||
|
if (task->data[0] == 3 && !FieldEffectActiveListContains(49))
|
||||||
|
{
|
||||||
|
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));
|
||||||
|
DestroyTask(taskId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mapObj->mapobj_bit_7 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_80B4578(struct MapObject *var)
|
||||||
|
{
|
||||||
|
StoreWordInTwoHalfwords(&gTasks[CreateTask(sub_80B44C8, 0)].data[1], (u32)var);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EndTrainerApproach(void)
|
||||||
|
{
|
||||||
|
sub_80B40C8(Task_DestroyTrainerApproachTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Task_DestroyTrainerApproachTask(u8 taskId)
|
||||||
|
{
|
||||||
|
DestroyTask(taskId);
|
||||||
|
EnableBothScriptContexts();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_80B45D0(void)
|
||||||
|
{
|
||||||
|
if (gNoOfApproachingTrainers == 2)
|
||||||
|
{
|
||||||
|
if (gApproachingTrainerId == 0)
|
||||||
|
{
|
||||||
|
gApproachingTrainerId++;
|
||||||
|
gSpecialVar_Result = 1;
|
||||||
|
UnfreezeMapObjects();
|
||||||
|
sub_80974D0(gApproachingTrainers[1].mapObjectId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gApproachingTrainerId = 0;
|
||||||
|
gSpecialVar_Result = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gSpecialVar_Result = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 FldEff_ExclamationMarkIcon1(void)
|
||||||
|
{
|
||||||
|
u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_85507B4, 0, 0, 0x53);
|
||||||
|
|
||||||
|
if (spriteId != MAX_SPRITES)
|
||||||
|
sub_80B46D8(&gSprites[spriteId], 0, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 FldEff_ExclamationMarkIcon2(void)
|
||||||
|
{
|
||||||
|
u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_85507B4, 0, 0, 0x52);
|
||||||
|
|
||||||
|
if (spriteId != MAX_SPRITES)
|
||||||
|
sub_80B46D8(&gSprites[spriteId], 33, 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 FldEff_HeartIcon(void)
|
||||||
|
{
|
||||||
|
u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_85507CC, 0, 0, 0x52);
|
||||||
|
|
||||||
|
if (spriteId != MAX_SPRITES)
|
||||||
|
{
|
||||||
|
struct Sprite *sprite = &gSprites[spriteId];
|
||||||
|
|
||||||
|
sub_80B46D8(sprite, 46, 0);
|
||||||
|
sprite->oam.paletteNum = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_80B46D8(struct Sprite *sprite, u16 a2, u8 a3)
|
||||||
|
{
|
||||||
|
sprite->oam.priority = 1;
|
||||||
|
sprite->coordOffsetEnabled = 1;
|
||||||
|
|
||||||
|
sprite->data[0] = gFieldEffectArguments[0];
|
||||||
|
sprite->data[1] = gFieldEffectArguments[1];
|
||||||
|
sprite->data[2] = gFieldEffectArguments[2];
|
||||||
|
sprite->data[3] = -5;
|
||||||
|
sprite->data[7] = a2;
|
||||||
|
|
||||||
|
StartSpriteAnim(sprite, a3);
|
||||||
|
}
|
||||||
|
|
||||||
|
void objc_exclamation_mark_probably(struct Sprite *sprite)
|
||||||
|
{
|
||||||
|
u8 mapObjId;
|
||||||
|
|
||||||
|
if (TryGetFieldObjectIdByLocalIdAndMap(sprite->data[0], sprite->data[1], sprite->data[2], &mapObjId)
|
||||||
|
|| sprite->animEnded)
|
||||||
|
{
|
||||||
|
FieldEffectStop(sprite, sprite->data[7]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
struct Sprite *mapObjSprite = &gSprites[gMapObjects[mapObjId].spriteId];
|
||||||
|
sprite->data[4] += sprite->data[3];
|
||||||
|
sprite->pos1.x = mapObjSprite->pos1.x;
|
||||||
|
sprite->pos1.y = mapObjSprite->pos1.y - 16;
|
||||||
|
sprite->pos2.x = mapObjSprite->pos2.x;
|
||||||
|
sprite->pos2.y = mapObjSprite->pos2.y + sprite->data[4];
|
||||||
|
if (sprite->data[4])
|
||||||
|
sprite->data[3]++;
|
||||||
|
else
|
||||||
|
sprite->data[3] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetCurrentApproachingTrainerMapObjectId(void)
|
||||||
|
{
|
||||||
|
if (gApproachingTrainerId == 0)
|
||||||
|
return gApproachingTrainers[0].mapObjectId;
|
||||||
|
else
|
||||||
|
return gApproachingTrainers[1].mapObjectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
u8 GetChosenApproachingTrainerMapObjectId(u8 arrayId)
|
||||||
|
{
|
||||||
|
if (arrayId >= ARRAY_COUNT(gApproachingTrainers))
|
||||||
|
return 0;
|
||||||
|
else if (arrayId == 0)
|
||||||
|
return gApproachingTrainers[0].mapObjectId;
|
||||||
|
else
|
||||||
|
return gApproachingTrainers[1].mapObjectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void sub_80B4808(void)
|
||||||
|
{
|
||||||
|
struct MapObject *trainerObj;
|
||||||
|
|
||||||
|
if (gUnknown_030060AC == 1)
|
||||||
|
{
|
||||||
|
trainerObj = &gMapObjects[gApproachingTrainers[gUnknown_03006080].mapObjectId];
|
||||||
|
gUnknown_03006084[0] = GetFaceDirectionAnimId(GetOppositeDirection(trainerObj->mapobj_unk_18));
|
||||||
|
gUnknown_03006084[1] = 0xFE;
|
||||||
|
ScriptMovement_StartObjectMovementScript(0xFF, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gUnknown_03006084);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trainerObj = &gMapObjects[gPlayerAvatar.mapObjectId];
|
||||||
|
gUnknown_03006084[0] = GetFaceDirectionAnimId(trainerObj->mapobj_unk_18);
|
||||||
|
gUnknown_03006084[1] = 0xFE;
|
||||||
|
ScriptMovement_StartObjectMovementScript(0xFF, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, gUnknown_03006084);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub_809BE48(0xFF);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user