diff options
Diffstat (limited to 'src/field')
-rw-r--r-- | src/field/bard_music.c | 174 | ||||
-rw-r--r-- | src/field/field_map_obj.c | 38 | ||||
-rw-r--r-- | src/field/overworld.c | 26 | ||||
-rw-r--r-- | src/field/trainer_see.c | 96 |
4 files changed, 265 insertions, 69 deletions
diff --git a/src/field/bard_music.c b/src/field/bard_music.c index daf003233..5c48749cf 100644 --- a/src/field/bard_music.c +++ b/src/field/bard_music.c @@ -11,29 +11,185 @@ struct BardSound /*0x06*/ u16 var06; }; -extern const struct BardSound (*const gBardMusicTable[])[][6]; -extern s16 *gUnknown_08417068[]; -extern u32 gUnknown_084170F4[]; +static const s16 Unknown_8416F08[] = {-768, 6144}; +static const s16 Unknown_8416F0C[] = {2304, 6144}; +static const s16 Unknown_8416F10[] = {256, 6144}; +static const s16 Unknown_8416F14[] = {1024, 6144}; +static const s16 Unknown_8416F18[] = {2816, 6144}; +static const s16 Unknown_8416F1C[] = {-768, -256, 6144}; +static const s16 Unknown_8416F22[] = {-768, 512, 6144}; +static const s16 Unknown_8416F28[] = {512, 1024, 6144}; +static const s16 Unknown_8416F2E[] = {1536, 2048, 6144}; +static const s16 Unknown_8416F34[] = {2304, 2048, 6144}; +static const s16 Unknown_8416F3A[] = {-768, -256, -768, 6144}; +static const s16 Unknown_8416F42[] = {1024, -768, 1024, 6144}; +static const s16 Unknown_8416F4A[] = {2304, 2048, 1536, 6144}; +static const s16 Unknown_8416F52[] = {256, 512, 1024, 6144}; +static const s16 Unknown_8416F5A[] = {1536, 4096, 3328, 6144}; +static const s16 Unknown_8416F62[] = {1024, 2304, 1024, 2304, 6144}; +static const s16 Unknown_8416F6C[] = {2304, 1024, 3328, 1024, 6144}; +static const s16 Unknown_8416F76[] = {256, 512, 1024, 1536, 6144}; +static const s16 Unknown_8416F80[] = {2048, 1536, 1024, 512, 6144}; +static const s16 Unknown_8416F8A[] = {3840, 3328, 2816, 2560, 6144}; +static const s16 Unknown_8416F94[] = {-768, -256, 256, 512, 1024, 6144}; +static const s16 Unknown_8416FA0[] = {2304, 2048, 1536, 1024, 512, 6144}; +static const s16 Unknown_8416FAC[] = {256, 1024, 2304, 1024, 256, 6144}; +static const s16 Unknown_8416FB8[] = {2304, 1024, 2304, 1024, -768, 6144}; +static const s16 Unknown_8416FC4[] = {2816, 2048, 1024, 1024, 1536, 6144}; +static const s16 Unknown_8416FD0[] = {-768, -256, 256, 512, 1024, 1536, 6144}; +static const s16 Unknown_8416FDE[] = {2048, 1536, 1024, 512, 256, -256, 6144}; +static const s16 Unknown_8416FEC[] = {256, 512, 1024, 256, 512, 4096, 6144}; +static const s16 Unknown_8416FFA[] = {1024, -768, 2304, 1024, 2304, 1024, 6144}; +static const s16 Unknown_8417008[] = {2048, 2304, 2048, 2304, 2048, 2304, 6144}; +static const s16 Unknown_8417016[] = {512, 256, 512, 256, 512, 1024, 512, 6144}; +static const s16 Unknown_8417026[] = {256, 256, -256, -256, -768, 1024, -768, 6144}; +static const s16 Unknown_8417036[] = {2048, 2304, 2816, 3328, 3584, 3328, 2816, 6144}; +static const s16 Unknown_8417046[] = {2048, 1536, 1024, 512, 3328, 2816, 2304, 6144}; +static const s16 Unknown_8417056[] = {768, 1024, 1536, 2048, 1792, 2048, 1024, 6144}; + +static const s16 *const sWordPitches[] = { + Unknown_8416F08, + Unknown_8416F0C, + Unknown_8416F10, + Unknown_8416F14, + Unknown_8416F18, + Unknown_8416F1C, + Unknown_8416F22, + Unknown_8416F28, + Unknown_8416F2E, + Unknown_8416F34, + Unknown_8416F3A, + Unknown_8416F42, + Unknown_8416F4A, + Unknown_8416F52, + Unknown_8416F5A, + Unknown_8416F62, + Unknown_8416F6C, + Unknown_8416F76, + Unknown_8416F80, + Unknown_8416F8A, + Unknown_8416F94, + Unknown_8416FA0, + Unknown_8416FAC, + Unknown_8416FB8, + Unknown_8416FC4, + Unknown_8416FD0, + Unknown_8416FDE, + Unknown_8416FEC, + Unknown_8416FFA, + Unknown_8417008, + Unknown_8417016, + Unknown_8417026, + Unknown_8417036, + Unknown_8417046, + Unknown_8417056 +}; + +static const u32 sBardSoundLengthDeltas[] = { + 9, + 22, + 15, + 16, + 39, + 21, + 9, + 30, + 24, + 15, + 25, + 12, + 22, + 45, + 24, + 15, + 40, + 9, + 21, + 42, + 18, + 9, + 22, + 15, + 27, + 48, + 18, + 27, + 33, + 24, + 25, + 39, + 19, + 16, + 54, + 18, + 9, + 45, + 15, + 12, + 39, + 23, + 5, + 45, + 12, + 21, + 48, + 12, + 21, + 69, + 18, + 15 +}; + +#if ENGLISH +#include "../src/data/bard_music_en.h" +#elif GERMAN +#include "../src/data/bard_music_de.h" +#endif // ENGLISH/GERMAN + +static const struct BardSound (*const gBardMusicTable[])[6] = { + BardMusic_POKEMON, + BardMusic_TRAINER, + BardMusic_STATUS, + BardMusic_BATTLE, + BardMusic_GREETINGS, + BardMusic_PEOPLE, + BardMusic_VOICES, + BardMusic_SPEECH, + BardMusic_ENDINGS, + BardMusic_FEELINGS, + BardMusic_CONDITIONS, + BardMusic_ACTIONS, + BardMusic_LIFESTYLE, + BardMusic_HOBBIES, + BardMusic_TIME, + BardMusic_MISC, + BardMusic_ADJECTIVES, + BardMusic_EVENTS, + BardMusic_MOVE_1, + BardMusic_MOVE_2, + BardMusic_TRENDY_SAYING, + BardMusic_POKEMON_2 +}; static s16 CalcWordPitch(u32 arg0, u32 songPos) { - return gUnknown_08417068[arg0][songPos]; + return sWordPitches[arg0][songPos]; } #if ENGLISH const struct BardSound *GetWordSounds(u16 group, u16 word) { - const struct BardSound (*sounds)[][6] = gBardMusicTable[group]; + const struct BardSound (*sounds)[6] = gBardMusicTable[group]; - return (*sounds)[word]; + return sounds[word]; } #elif GERMAN const struct BardSound *GetWordSounds(u16 group, u16 word) { - const struct BardSound (*sounds)[][6] = gBardMusicTable[group]; + const struct BardSound (*sounds)[6] = gBardMusicTable[group]; u32 index = de_sub_80EB748(group, word); - return (*sounds)[index]; + return sounds[index]; } #endif @@ -48,7 +204,7 @@ s32 GetWordPhonemes(struct BardSong *song, const struct BardSound *src, u16 arg2 song->phonemes[i].sound = src[i].var00; if (src[i].var00 != 0xFF) { - s32 length = src[i].var01 + gUnknown_084170F4[src[i].var00]; + s32 length = src[i].var01 + sBardSoundLengthDeltas[src[i].var00]; song->phonemes[i].length = length; song->phonemes[i].volume = src[i].volume; diff --git a/src/field/field_map_obj.c b/src/field/field_map_obj.c index 81c0c5854..ba7c3d68e 100644 --- a/src/field/field_map_obj.c +++ b/src/field/field_map_obj.c @@ -2020,7 +2020,7 @@ u8 GetFieldObjectIdByLocalId(u8 localId) #ifdef NONMATCHING u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 b, u8 c) { - struct MapObject2 *mapObj; //TODO: resolve the mapobj_unk_19b weirdness + struct MapObject *mapObj; //TODO: resolve the mapobj_unk_19b weirdness u8 var; u16 r3; u16 r2; @@ -2029,8 +2029,8 @@ u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 b, u8 if (GetAvailableFieldObjectSlot(template->localId, b, c, &var) != 0) return 16; //_0805ACCE - mapObj = (struct MapObject2 *)&gMapObjects[var]; - npc_clear_ids_and_state((struct MapObject *)mapObj); + mapObj = &gMapObjects[var]; + npc_clear_ids_and_state(mapObj); r3 = template->x + 7; r2 = template->y + 7; mapObj->active = TRUE; @@ -2048,8 +2048,8 @@ u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 b, u8 mapObj->coords3.y = r2; mapObj->mapobj_unk_0B_0 = template->elevation; mapObj->elevation = template->elevation; - mapObj->mapobj_unk_19 = template->unkA_0; - mapObj->mapobj_unk_19b = template->unkA_4; + mapObj->range.as_nybbles.x = template->unkA_0; + mapObj->range.as_nybbles.y = template->unkA_4; mapObj->trainerType = template->unkC; mapObj->trainerRange_berryTreeId = template->unkE; mapObj->mapobj_unk_20 = gUnknown_0836DC09[template->movementType]; @@ -2058,10 +2058,10 @@ u8 InitFieldObjectStateFromTemplate(struct MapObjectTemplate *template, u8 b, u8 //asm("":::"r5","r6"); if (gUnknown_0836DBBC[mapObj->animPattern] != 0) { - if (mapObj->mapobj_unk_19 == 0) - mapObj->mapobj_unk_19++; - if (mapObj->mapobj_unk_19b == 0) - mapObj->mapobj_unk_19b++; + if (mapObj->range.as_nybbles.x == 0) + mapObj->range.as_nybbles.x++; + if (mapObj->range.as_nybbles.y == 0) + mapObj->range.as_nybbles.y++; } return var; } @@ -5464,7 +5464,7 @@ u8 sub_805FF20(struct MapObject *mapObject, u8 direction) return npc_block_way(mapObject, x, y, direction); } -bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, s16 y); +bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject *mapObject, s16 x, s16 y); static bool8 DoesObjectCollideWithObjectAt(struct MapObject *mapObject, s16 x, s16 y); bool8 IsMetatileDirectionallyImpassable(struct MapObject *mapObject, s16 x, s16 y, u8 direction); @@ -5472,7 +5472,7 @@ u8 npc_block_way(struct MapObject *mapObject, s16 x, s16 y, u32 dirn) { u8 direction; direction = dirn; - if (IsCoordOutsideFieldObjectMovementRect((struct MapObject2 *)mapObject, x, y)) + if (IsCoordOutsideFieldObjectMovementRect(mapObject, x, y)) return 1; else if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(mapObject, x, y, direction)) return 2; @@ -5489,7 +5489,7 @@ u8 sub_8060024(struct MapObject *mapObject, s16 x, s16 y, u8 direction) { u8 flags = 0; - if (IsCoordOutsideFieldObjectMovementRect((struct MapObject2 *)mapObject, x, y)) + if (IsCoordOutsideFieldObjectMovementRect(mapObject, x, y)) flags |= 1; if (MapGridIsImpassableAt(x, y) || GetMapBorderIdAt(x, y) == -1 || IsMetatileDirectionallyImpassable(mapObject, x, y, direction) || (mapObject->mapobj_bit_15 && !CanCameraMoveInDirection(direction))) flags |= 2; @@ -5500,22 +5500,22 @@ u8 sub_8060024(struct MapObject *mapObject, s16 x, s16 y, u8 direction) return flags; } -bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject2 *mapObject, s16 x, s16 y) +bool8 IsCoordOutsideFieldObjectMovementRect(struct MapObject *mapObject, s16 x, s16 y) { s16 minv; s16 maxv; - if (mapObject->mapobj_unk_19 != 0) + if (mapObject->range.as_nybbles.x != 0) { - minv = mapObject->coords1.x - (mapObject->mapobj_unk_19); - maxv = mapObject->coords1.x + (mapObject->mapobj_unk_19); + minv = mapObject->coords1.x - (mapObject->range.as_nybbles.x); + maxv = mapObject->coords1.x + (mapObject->range.as_nybbles.x); if (minv > x || maxv < x) return TRUE; } - if (mapObject->mapobj_unk_19b != 0) + if (mapObject->range.as_nybbles.y != 0) { - minv = mapObject->coords1.y - (mapObject->mapobj_unk_19b); - maxv = mapObject->coords1.y + (mapObject->mapobj_unk_19b); + minv = mapObject->coords1.y - (mapObject->range.as_nybbles.y); + maxv = mapObject->coords1.y + (mapObject->range.as_nybbles.y); if (minv > y || maxv < y) return TRUE; } diff --git a/src/field/overworld.c b/src/field/overworld.c index 834a2afa4..0a1a3d008 100644 --- a/src/field/overworld.c +++ b/src/field/overworld.c @@ -287,7 +287,7 @@ void LoadMapObjTemplatesFromHeader(void) { // Clear map object templates CpuFill32(0, gSaveBlock1.mapObjectTemplates, sizeof(gSaveBlock1.mapObjectTemplates)); - + // Copy map header events to save block CpuCopy32(gMapHeader.events->mapObjects, gSaveBlock1.mapObjectTemplates, @@ -981,7 +981,7 @@ static void PlayAmbientCry(void) s16 x, y; s8 pan; s8 volume; - + PlayerGetDestCoords(&x, &y); if (sIsAmbientCryWaterMon == TRUE && !MetatileBehavior_IsSurfableWaterOrUnderwater(MapGridGetMetatileBehaviorAt(x, y))) @@ -1158,7 +1158,7 @@ void OverworldBasic(void) sub_8072EDC(); } -// This CB2 is used when starting +// This CB2 is used when starting void CB2_OverworldBasic(void) { OverworldBasic(); @@ -2430,7 +2430,7 @@ void SpawnLinkPlayerMapObject(u8 linkPlayerId, s16 x, s16 y, u8 a4) mapObj->active = 1; mapObj->mapobj_bit_1 = a4; - mapObj->mapobj_unk_19 = 2; + mapObj->range.as_byte = 2; mapObj->spriteId = 64; InitLinkPlayerMapObjectPos(mapObj, x, y); @@ -2453,7 +2453,7 @@ void unref_sub_8055A6C(u8 linkPlayerId, u8 a2) { u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId; struct MapObject *mapObj = &gMapObjects[mapObjId]; - mapObj->mapobj_unk_19 = a2; + mapObj->range.as_byte = a2; } } @@ -2487,7 +2487,7 @@ u8 sub_8055B30(u8 linkPlayerId) { u8 mapObjId = gLinkPlayerMapObjects[linkPlayerId].mapObjId; struct MapObject *mapObj = &gMapObjects[mapObjId]; - return mapObj->mapobj_unk_19; + return mapObj->range.as_byte; } u8 sub_8055B50(u8 linkPlayerId) @@ -2559,10 +2559,10 @@ static u8 sub_8055CB0(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapOb { s16 x, y; - mapObj->mapobj_unk_19 = npc_something3(a3, mapObj->mapobj_unk_19); - FieldObjectMoveDestCoords(mapObj, mapObj->mapobj_unk_19, &x, &y); + mapObj->range.as_byte = npc_something3(a3, mapObj->range.as_byte); + FieldObjectMoveDestCoords(mapObj, mapObj->range.as_byte, &x, &y); - if (LinkPlayerDetectCollision(linkPlayerMapObj->mapObjId, mapObj->mapobj_unk_19, x, y)) + if (LinkPlayerDetectCollision(linkPlayerMapObj->mapObjId, mapObj->range.as_byte, x, y)) { return 0; } @@ -2577,7 +2577,7 @@ static u8 sub_8055CB0(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapOb static u8 sub_8055D18(struct LinkPlayerMapObject *linkPlayerMapObj, struct MapObject *mapObj, u8 a3) { - mapObj->mapobj_unk_19 = npc_something3(a3, mapObj->mapobj_unk_19); + mapObj->range.as_byte = npc_something3(a3, mapObj->range.as_byte); return 0; } @@ -2590,7 +2590,7 @@ static void sub_8055D38(struct LinkPlayerMapObject *linkPlayerMapObj, struct Map { mapObj->mapobj_unk_21--; linkPlayerMapObj->mode = 1; - MoveCoords(mapObj->mapobj_unk_19, &mapObj->coords1.x, &mapObj->coords1.y); + MoveCoords(mapObj->range.as_byte, &mapObj->coords1.x, &mapObj->coords1.y); if (!mapObj->mapobj_unk_21) { npc_coords_shift_still(mapObj); @@ -2662,9 +2662,9 @@ void SpriteCB_LinkPlayer(struct Sprite *sprite) SetObjectSubpriorityByZCoord(mapObj->elevation, sprite, 1); sprite->oam.priority = ZCoordToPriority(mapObj->elevation); if (!linkPlayerMapObj->mode) - StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObj->mapobj_unk_19)); + StartSpriteAnim(sprite, FieldObjectDirectionToImageAnimId(mapObj->range.as_byte)); else - StartSpriteAnimIfDifferent(sprite, get_go_image_anim_num(mapObj->mapobj_unk_19)); + StartSpriteAnimIfDifferent(sprite, get_go_image_anim_num(mapObj->range.as_byte)); sub_806487C(sprite, 0); if (mapObj->mapobj_bit_2) { diff --git a/src/field/trainer_see.c b/src/field/trainer_see.c index 38bc6971c..3034b2b65 100644 --- a/src/field/trainer_see.c +++ b/src/field/trainer_see.c @@ -9,14 +9,22 @@ #include "task.h" #include "util.h" +static bool8 CheckTrainer(u8); +static void sub_8084894(struct Sprite *sprite, u16 a2, u8 a3); +static void objc_exclamation_mark_probably(struct Sprite *sprite); +static bool8 TrainerCanApproachPlayer(struct MapObject *); +static void sub_80842C8(struct MapObject *, u8); +static bool8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction); +static void RunTrainerSeeFuncList(u8 taskId); + const u8 gSpriteImage_839B308[] = INCBIN_U8("graphics/unknown_sprites/839B4E0/0.4bpp"); const u8 gSpriteImage_839B388[] = INCBIN_U8("graphics/unknown_sprites/839B4E0/1.4bpp"); const u8 gSpriteImage_839B408[] = INCBIN_U8("graphics/unknown_sprites/839B408.4bpp"); -u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y); -u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y); -u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y); -u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y); +static u8 GetTrainerApproachDistanceSouth(struct MapObject *trainerObj, s16 range, s16 x, s16 y); +static u8 GetTrainerApproachDistanceNorth(struct MapObject *trainerObj, s16 range, s16 x, s16 y); +static u8 GetTrainerApproachDistanceWest(struct MapObject *trainerObj, s16 range, s16 x, s16 y); +static u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x, s16 y); static u8 (*const sDirectionalApproachDistanceFuncs[])(struct MapObject *, s16, s16, s16) = { @@ -26,9 +34,6 @@ static u8 (*const sDirectionalApproachDistanceFuncs[])(struct MapObject *, s16, GetTrainerApproachDistanceEast, }; -extern struct SpriteTemplate gSpriteTemplate_839B510; -extern struct SpriteTemplate gSpriteTemplate_839B528; - bool8 CheckTrainers(void) { u8 mapObjId; @@ -43,7 +48,7 @@ bool8 CheckTrainers(void) return FALSE; } -bool8 CheckTrainer(u8 mapObjId) +static bool8 CheckTrainer(u8 mapObjId) { u8 *scriptPtr = GetFieldObjectScriptPointerByFieldObjectId(mapObjId); @@ -69,7 +74,7 @@ bool8 CheckTrainer(u8 mapObjId) } } -bool8 TrainerCanApproachPlayer(struct MapObject *trainerObj) +static bool8 TrainerCanApproachPlayer(struct MapObject *trainerObj) { s16 x, y; u8 i; @@ -79,14 +84,14 @@ bool8 TrainerCanApproachPlayer(struct MapObject *trainerObj) if (trainerObj->trainerType == 1) // can only see in one direction { 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 { for (i = 0; i < 4; i++) { 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; } } @@ -94,7 +99,7 @@ bool8 TrainerCanApproachPlayer(struct MapObject *trainerObj) } // 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 && y > trainerObj->coords2.y @@ -105,7 +110,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. -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 && y < trainerObj->coords2.y @@ -116,7 +121,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. -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 && x < trainerObj->coords2.x @@ -127,7 +132,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. -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 && x > trainerObj->coords2.x @@ -143,7 +148,7 @@ u8 GetTrainerApproachDistanceEast(struct MapObject *trainerObj, s16 range, s16 x #define COLLISION_MASK 1 #endif -bool8 CheckPathBetweenTrainerAndPlayer(struct MapObject2 *trainerObj, u8 approachDistance, u8 direction) +static bool8 CheckPathBetweenTrainerAndPlayer(struct MapObject *trainerObj, u8 approachDistance, u8 direction) { s16 x, y; u8 unk19_temp; @@ -159,21 +164,21 @@ bool8 CheckPathBetweenTrainerAndPlayer(struct MapObject2 *trainerObj, u8 approac for (i = 0; i <= approachDistance - 1; i++, MoveCoords(direction, &x, &y)) { - collision = sub_8060024((struct MapObject *)trainerObj, x, y, direction); + collision = sub_8060024(trainerObj, x, y, direction); if (collision != 0 && (collision & COLLISION_MASK)) return FALSE; } // preserve mapobj_unk_19 before clearing. - unk19_temp = trainerObj->mapobj_unk_19; - unk19b_temp = trainerObj->mapobj_unk_19b; - trainerObj->mapobj_unk_19 = 0; - trainerObj->mapobj_unk_19b = 0; + 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((struct MapObject *)trainerObj, x, y, direction); - trainerObj->mapobj_unk_19 = unk19_temp; - trainerObj->mapobj_unk_19b = unk19b_temp; + trainerObj->range.as_nybbles.x = unk19_temp; + trainerObj->range.as_nybbles.y = unk19b_temp; if (collision == 4) return approachDistance; @@ -183,7 +188,7 @@ bool8 CheckPathBetweenTrainerAndPlayer(struct MapObject2 *trainerObj, u8 approac #define tTrainerObjHi data[1] #define tTrainerObjLo data[2] -void sub_80842C8(struct MapObject *trainerObj, u8 b) +static void sub_80842C8(struct MapObject *trainerObj, u8 b) { u8 taskId = CreateTask(RunTrainerSeeFuncList, 0x50); struct Task *task = &gTasks[taskId]; @@ -193,7 +198,7 @@ void sub_80842C8(struct MapObject *trainerObj, u8 b) task->data[3] = b; } -void sub_80842FC(TaskFunc followupFunc) +static void sub_80842FC(TaskFunc followupFunc) { TaskFunc taskFunc = RunTrainerSeeFuncList; u8 taskId = FindTaskIdByFunc(taskFunc); @@ -232,7 +237,7 @@ static bool8 (*const gTrainerSeeFuncList[])(u8 taskId, struct Task *task, struct sub_80846C8, }; -void RunTrainerSeeFuncList(u8 taskId) +static void RunTrainerSeeFuncList(u8 taskId) { struct Task *task = &gTasks[taskId]; struct MapObject *trainerObj = (struct MapObject *)((task->tTrainerObjHi << 16) | (task->tTrainerObjLo)); @@ -450,6 +455,41 @@ static void Task_DestroyTrainerApproachTask(u8 taskId) EnableBothScriptContexts(); } +static const struct OamData gOamData_839B4D8 = { + .size = 1, .priority = 1 +}; + +static const struct SpriteFrameImage gSpriteImageTable_839B4E0[] = { + { gSpriteImage_839B308, sizeof gSpriteImage_839B308 }, + { gSpriteImage_839B388, sizeof gSpriteImage_839B388 } +}; + +static const struct SpriteFrameImage gSpriteImageTable_839B4F0[] = { + { gSpriteImage_839B408, sizeof gSpriteImage_839B408 } +}; + +static const union AnimCmd gSpriteAnim_839B4F8[] = { + ANIMCMD_FRAME(0, 60), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_839B500[] = { + ANIMCMD_FRAME(1, 60), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_839B508[] = { + gSpriteAnim_839B4F8, + gSpriteAnim_839B500 +}; + +static const struct SpriteTemplate gSpriteTemplate_839B510 = { + 0xffff, 0xffff, &gOamData_839B4D8, gSpriteAnimTable_839B508, gSpriteImageTable_839B4E0, gDummySpriteAffineAnimTable, objc_exclamation_mark_probably +}; +static const struct SpriteTemplate gSpriteTemplate_839B528 = { + 0xffff, 4100, &gOamData_839B4D8, gSpriteAnimTable_839B508, gSpriteImageTable_839B4F0, gDummySpriteAffineAnimTable, objc_exclamation_mark_probably +}; + u8 FldEff_ExclamationMarkIcon1(void) { u8 spriteId = CreateSpriteAtEnd(&gSpriteTemplate_839B510, 0, 0, 0x53); @@ -480,7 +520,7 @@ u8 FldEff_HeartIcon(void) return 0; } -void sub_8084894(struct Sprite *sprite, u16 a2, u8 a3) +static void sub_8084894(struct Sprite *sprite, u16 a2, u8 a3) { sprite->oam.priority = 1; sprite->coordOffsetEnabled = 1; @@ -494,7 +534,7 @@ void sub_8084894(struct Sprite *sprite, u16 a2, u8 a3) StartSpriteAnim(sprite, a3); } -void objc_exclamation_mark_probably(struct Sprite *sprite) +static void objc_exclamation_mark_probably(struct Sprite *sprite) { u8 mapObjId; |