diff options
author | Slawter666 <38655737+Slawter666@users.noreply.github.com> | 2018-10-17 01:14:19 +0100 |
---|---|---|
committer | Slawter666 <38655737+Slawter666@users.noreply.github.com> | 2018-10-17 01:14:19 +0100 |
commit | 9e3e6173760ebdbe58eda2986b9f21d31f774f16 (patch) | |
tree | 7cd8e0730639da41d63040bacf738a764f4322ed /src | |
parent | 09b8f4c09e69a2359cdf5e4497b97aca3746b8b1 (diff) |
Begin synchronising with pokeemerald
Diffstat (limited to 'src')
-rw-r--r-- | src/event_object_movement.c | 8 | ||||
-rw-r--r-- | src/field_effect.c | 54 | ||||
-rw-r--r-- | src/field_effect_helpers.c | 14 | ||||
-rw-r--r-- | src/field_player_avatar.c | 24 | ||||
-rw-r--r-- | src/field_poison.c | 6 | ||||
-rw-r--r-- | src/field_tasks.c | 2 | ||||
-rw-r--r-- | src/fieldmap.c | 6 | ||||
-rw-r--r-- | src/overworld.c | 42 | ||||
-rw-r--r-- | src/rom6.c | 12 |
9 files changed, 93 insertions, 75 deletions
diff --git a/src/event_object_movement.c b/src/event_object_movement.c index c8685bb49..21351434a 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1594,7 +1594,7 @@ void SetPlayerAvatarEventObjectIdAndObjectId(u8 eventObjectId, u8 spriteId) SetPlayerAvatarExtraStateTransition(gEventObjects[eventObjectId].graphicsId, 0x20); } -void sub_805B980(struct EventObject *eventObject, u8 graphicsId) +void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId) { const struct EventObjectGraphicsInfo *gfxInfo; struct Sprite *sprite; @@ -1627,7 +1627,7 @@ void unref_sub_805BA80(u8 localId, u8 mapNum, u8 mapGroup, u8 graphicsId) u8 eventObjectId; if (!TryGetEventObjectIdByLocalIdAndMap(localId, mapNum, mapGroup, &eventObjectId)) - sub_805B980(&gEventObjects[eventObjectId], graphicsId); + EventObjectSetGraphicsId(&gEventObjects[eventObjectId], graphicsId); } void EventObjectTurn(struct EventObject *eventObject, u8 direction) @@ -1669,7 +1669,7 @@ void get_berry_tree_graphics(struct EventObject *eventObject, struct Sprite *spr treeStage--; if (treeId > 0x2B) treeId = 0; - sub_805B980(eventObject, gBerryTreeGraphicsIdTablePointers[treeId][treeStage]); + EventObjectSetGraphicsId(eventObject, gBerryTreeGraphicsIdTablePointers[treeId][treeStage]); sprite->images = gBerryTreePicTablePointers[treeId]; sprite->oam.paletteNum = gBerryTreePaletteSlotTablePointers[treeId][treeStage]; StartSpriteAnim(sprite, treeStage); @@ -1910,7 +1910,7 @@ void UpdateEventObjectCoordsForCameraUpdate(void) s16 deltaX; s16 deltaY; - if (gCamera.field_0) + if (gCamera.active) { deltaX = gCamera.x; deltaY = gCamera.y; diff --git a/src/field_effect.c b/src/field_effect.c index cc5f9252a..bc2704a4a 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -1,29 +1,29 @@ #include "global.h" #include "data2.h" -#include "script.h" -#include "trig.h" -#include "main.h" -#include "field_effect_helpers.h" -#include "field_weather.h" #include "decompress.h" -#include "sprite.h" -#include "menu.h" -#include "palette.h" -#include "text.h" -#include "overworld.h" -#include "task.h" -#include "sound.h" #include "decoration.h" -#include "field_player_avatar.h" #include "event_object_movement.h" -#include "metatile_behavior.h" #include "field_camera.h" #include "field_control_avatar.h" #include "field_effect.h" +#include "field_effect_helpers.h" #include "field_fadetransition.h" +#include "field_player_avatar.h" +#include "field_weather.h" #include "fieldmap.h" -#include "util.h" +#include "main.h" +#include "menu.h" +#include "metatile_behavior.h" +#include "overworld.h" +#include "palette.h" #include "pokemon_storage_system.h" +#include "script.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "text.h" +#include "trig.h" +#include "util.h" #include "constants/event_object_movement_constants.h" #include "constants/field_effects.h" #include "constants/songs.h" @@ -2064,7 +2064,7 @@ void sub_8087AA4(struct Task *task) void sub_8087AC8(struct Task *task) { - u8 unknown_0839F380[5] = {1, 3, 4, 2, 1}; + u8 spinDirections[5] = {1, 3, 4, 2, 1}; struct EventObject *eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; if (task->data[1] == 0 || (--task->data[1]) == 0) { @@ -2080,7 +2080,7 @@ void sub_8087AC8(struct Task *task) DestroyTask(FindTaskIdByFunc(sub_8087A74)); return; } - EventObjectSetHeldMovement(eventObject, GetFaceDirectionMovementAction(unknown_0839F380[eventObject->facingDirection])); + EventObjectSetHeldMovement(eventObject, GetFaceDirectionMovementAction(spinDirections[eventObject->facingDirection])); if (task->data[2] < 32) { task->data[2]++; @@ -2229,7 +2229,7 @@ void sub_8087E4C(struct Task *task) void sub_8087ED8(struct Task *task) { - u8 unknown_0839F380[5] = {1, 3, 4, 2, 1}; + u8 spinDirections[5] = {1, 3, 4, 2, 1}; struct EventObject *eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; struct Sprite *sprite = &gSprites[gPlayerAvatar.spriteId]; if ((sprite->pos2.y += task->data[1]) >= -8) @@ -2255,7 +2255,7 @@ void sub_8087ED8(struct Task *task) if ((--task->data[2]) == 0) { task->data[2] = 4; - EventObjectTurn(eventObject, unknown_0839F380[eventObject->facingDirection]); + EventObjectTurn(eventObject, spinDirections[eventObject->facingDirection]); } if (sprite->pos2.y >= 0) { @@ -2268,11 +2268,11 @@ void sub_8087ED8(struct Task *task) void sub_8087FDC(struct Task *task) { - u8 unknown_0839F380[5] = {1, 3, 4, 2, 1}; + u8 spinDirections[5] = {1, 3, 4, 2, 1}; struct EventObject *eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; if ((--task->data[1]) == 0) { - EventObjectTurn(eventObject, unknown_0839F380[eventObject->facingDirection]); + EventObjectTurn(eventObject, spinDirections[eventObject->facingDirection]); task->data[1] = 8; if ((++task->data[2]) > 4 && task->data[14] == eventObject->facingDirection) { @@ -2474,7 +2474,7 @@ void sub_808843C(u16 offs) u16 i; u16 *dest; dest = (u16 *)(VRAM + 0x140 + offs); - for (i=0; i<0x140; i++, dest++) + for (i = 0; i < 0x140; i++, dest++) { *dest = gFieldMoveStreaksTilemap[i] | 0xf000; } @@ -2810,7 +2810,7 @@ u8 FldEff_UseSurf(void) taskId = CreateTask(sub_8088954, 0xff); gTasks[taskId].data[15] = gFieldEffectArguments[0]; Overworld_ClearSavedMusic(); - Overworld_ChangeMusicTo(0x016d); + Overworld_ChangeMusicTo(MUS_NAMINORI); return FALSE; } @@ -2868,7 +2868,7 @@ void sub_8088A78(struct Task *task) if (!FieldEffectActiveListContains(FLDEFF_FIELD_MOVE_SHOW_MON)) { eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; - sub_805B980(eventObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); + EventObjectSetGraphicsId(eventObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); EventObjectClearHeldMovementIfFinished(eventObject); EventObjectSetHeldMovement(eventObject, GetJumpSpecialMovementAction(eventObject->movementDirection)); gFieldEffectArguments[0] = task->data[1]; @@ -3039,7 +3039,7 @@ void sub_8088E2C(struct Task *task) if ((++task->data[2]) >= 8) { eventObject = &gEventObjects[gPlayerAvatar.eventObjectId]; - sub_805B980(eventObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); + EventObjectSetGraphicsId(eventObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); StartSpriteAnim(&gSprites[eventObject->spriteId], 0x16); eventObject->inanimate = 1; EventObjectSetHeldMovement(eventObject, MOVEMENT_ACTION_JUMP_IN_PLACE_LEFT); @@ -3279,7 +3279,7 @@ void sub_80892A0(struct Task *task) { sub_8127ED0(eventObject->fieldEffectSpriteId, 0); } - sub_805B980(eventObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); + EventObjectSetGraphicsId(eventObject, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); CameraObjectReset2(); EventObjectTurn(eventObject, DIR_WEST); StartSpriteAnim(&gSprites[eventObject->spriteId], 0x16); @@ -3389,7 +3389,7 @@ void fishE(struct Task *task) state = PLAYER_AVATAR_STATE_SURFING; sub_8127ED0(eventObject->fieldEffectSpriteId, 1); } - sub_805B980(eventObject, GetPlayerAvatarGraphicsIdByStateId(state)); + EventObjectSetGraphicsId(eventObject, GetPlayerAvatarGraphicsIdByStateId(state)); EventObjectTurn(eventObject, DIR_SOUTH); gPlayerAvatar.flags = task->data[15]; gPlayerAvatar.preventStep = FALSE; diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 84f340b35..641cbad8f 100644 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -1,13 +1,13 @@ #include "global.h" -#include "sprite.h" -#include "fieldmap.h" -#include "metatile_behavior.h" -#include "sound.h" #include "event_object_movement.h" #include "field_camera.h" -#include "field_weather.h" #include "field_effect.h" #include "field_effect_helpers.h" +#include "field_weather.h" +#include "fieldmap.h" +#include "metatile_behavior.h" +#include "sound.h" +#include "sprite.h" #include "constants/field_effects.h" #include "constants/songs.h" @@ -297,7 +297,7 @@ void UpdateTallGrassFieldEffect(struct Sprite *sprite) mapNum = sprite->data[5] >> 8; mapGroup = sprite->data[5]; - if (gCamera.field_0 && (gSaveBlock1.location.mapNum != mapNum || gSaveBlock1.location.mapGroup != mapGroup)) + if (gCamera.active && (gSaveBlock1.location.mapNum != mapNum || gSaveBlock1.location.mapGroup != mapGroup)) { sprite->data[1] -= gCamera.x; sprite->data[2] -= gCamera.y; @@ -403,7 +403,7 @@ void UpdateLongGrassFieldEffect(struct Sprite *sprite) mapNum = sprite->data[5] >> 8; mapGroup = sprite->data[5]; - if (gCamera.field_0 && (gSaveBlock1.location.mapNum != mapNum || gSaveBlock1.location.mapGroup != mapGroup)) + if (gCamera.active && (gSaveBlock1.location.mapNum != mapNum || gSaveBlock1.location.mapGroup != mapGroup)) { sprite->data[1] -= gCamera.x; sprite->data[2] -= gCamera.y; diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 47f43858b..5ce6a6339 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -648,14 +648,14 @@ void nullsub_49(struct EventObject *eventObj) void PlayerAvatarTransition_Normal(struct EventObject *eventObj) { - sub_805B980(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); EventObjectTurn(eventObj, eventObj->movementDirection); SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT); } void PlayerAvatarTransition_MachBike(struct EventObject *eventObj) { - sub_805B980(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_MACH_BIKE)); + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_MACH_BIKE)); EventObjectTurn(eventObj, eventObj->movementDirection); SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_MACH_BIKE); BikeClearState(0, 0); @@ -663,7 +663,7 @@ void PlayerAvatarTransition_MachBike(struct EventObject *eventObj) void PlayerAvatarTransition_AcroBike(struct EventObject *eventObj) { - sub_805B980(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE)); + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE)); EventObjectTurn(eventObj, eventObj->movementDirection); SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ACRO_BIKE); BikeClearState(0, 0); @@ -674,7 +674,7 @@ void PlayerAvatarTransition_Surfing(struct EventObject *eventObj) { u8 unk; - sub_805B980(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); EventObjectTurn(eventObj, eventObj->movementDirection); SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING); gFieldEffectArguments[0] = eventObj->currentCoords.x; @@ -687,7 +687,7 @@ void PlayerAvatarTransition_Surfing(struct EventObject *eventObj) void PlayerAvatarTransition_Underwater(struct EventObject *eventObj) { - sub_805B980(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_UNDERWATER)); + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_UNDERWATER)); EventObjectTurn(eventObj, eventObj->movementDirection); SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_UNDERWATER); eventObj->fieldEffectSpriteId = sub_8128124(eventObj->spriteId); @@ -1163,26 +1163,26 @@ void sub_8059B88(u8 a) void sub_8059BF4(void) { - sub_805B980(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FIELD_MOVE)); + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FIELD_MOVE)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 0); } void sub_8059C3C(u8 direction) { - sub_805B980(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FISHING)); + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FISHING)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingDirectionAnimNum(direction)); } void sub_8059C94(u8 direction) { - sub_805B980(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE)); + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetAcroWheelieDirectionAnimNum(direction)); SeekSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 1); } void sub_8059D08(u8 direction) { - sub_805B980(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_WATERING)); + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_WATERING)); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFaceDirectionAnimNum(direction)); } @@ -1419,7 +1419,7 @@ static void sub_805A2D0(u8 taskId) if (EventObjectClearHeldMovementIfFinished(playerEventObj)) { - sub_805B980(playerEventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); + EventObjectSetGraphicsId(playerEventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); EventObjectSetHeldMovement(playerEventObj, GetFaceDirectionMovementAction(playerEventObj->facingDirection)); gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); @@ -1657,7 +1657,7 @@ u8 Fishing11(struct Task *task) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; - sub_805B980(playerEventObj, task->tPlayerGfxId); + EventObjectSetGraphicsId(playerEventObj, task->tPlayerGfxId); EventObjectTurn(playerEventObj, playerEventObj->movementDirection); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8127F28(gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId, 0, 0); @@ -1716,7 +1716,7 @@ u8 Fishing15(struct Task *task) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; - sub_805B980(playerEventObj, task->tPlayerGfxId); + EventObjectSetGraphicsId(playerEventObj, task->tPlayerGfxId); EventObjectTurn(playerEventObj, playerEventObj->movementDirection); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8127F28(gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId, 0, 0); diff --git a/src/field_poison.c b/src/field_poison.c index dd7500d22..596bc6e89 100644 --- a/src/field_poison.c +++ b/src/field_poison.c @@ -138,10 +138,16 @@ s32 DoPoisonFieldEffect(void) mon++; } if (numFainting != 0 || numPoisoned != 0) + { FldeffPoison_Start(); + } if (numFainting != 0) + { return 2; + } if (numPoisoned != 0) + { return 1; + } return 0; } diff --git a/src/field_tasks.c b/src/field_tasks.c index 8b736c949..12167eb85 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -847,7 +847,7 @@ void Task_MuddySlope(u8 taskId) break; } - if (gCamera.field_0 && mapIndices != data[0]) + if (gCamera.active && mapIndices != data[0]) { data[0] = mapIndices; x2 = gCamera.x; diff --git a/src/fieldmap.c b/src/fieldmap.c index abb46fd35..4b5149878 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -715,7 +715,7 @@ bool8 CameraMove(int x, int y) unsigned int direction; struct MapConnection *connection; int old_x, old_y; - gCamera.field_0 = FALSE; + gCamera.active = FALSE; direction = GetPostCameraMoveMapBorderId(x, y); if (direction + 1 <= 1) { @@ -730,14 +730,14 @@ bool8 CameraMove(int x, int y) connection = sub_8056A64(direction, gSaveBlock1.pos.x, gSaveBlock1.pos.y); sub_8056918(connection, direction, x, y); sub_80538F0(connection->mapGroup, connection->mapNum); - gCamera.field_0 = TRUE; + gCamera.active = TRUE; gCamera.x = old_x - gSaveBlock1.pos.x; gCamera.y = old_y - gSaveBlock1.pos.y; gSaveBlock1.pos.x += x; gSaveBlock1.pos.y += y; sub_80566F0(direction); } - return gCamera.field_0; + return gCamera.active; } struct MapConnection *sub_8056A64(u8 direction, int x, int y) diff --git a/src/overworld.c b/src/overworld.c index a7a203ca2..65f262f33 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -107,7 +107,18 @@ static u8 GetAdjustedInitialTransitionFlags(struct InitialPlayerAvatarState*, u1 static u8 GetAdjustedInitialDirection(struct InitialPlayerAvatarState*, u8, u16, u8); static bool32 sub_805483C(u8*); static void c2_80567AC(void); +static void Overworld_ResetStateAfterWhiteOut(void); static void InitOverworldGraphicsRegisters(void); +static void ChooseAmbientCrySpecies(void); +static void SetFieldVBlankCallback(void); +static void VBlankCB_Field(void); +static void SpawnLinkPlayerEventObject(u8, s16, s16, u8); +static void InitLinkPlayerEventObjectPos(struct EventObject *, s16, s16); +static u8 GetLinkPlayerIdAt(s16, s16); +static u8 npc_something3(u8, u8); +static u8 LinkPlayerDetectCollision(u8, u8, s16, s16); +static void CreateLinkPlayerSprite(u8); +static void SpriteCB_LinkPlayer(struct Sprite *); static const struct WarpData sDummyWarpData = { @@ -232,7 +243,7 @@ void Overworld_ResetStateAfterDigEscRope(void) FlagClear(FLAG_SYS_USE_FLASH); } -void Overworld_ResetStateAfterWhiteOut(void) +static void Overworld_ResetStateAfterWhiteOut(void) { ResetInitialPlayerAvatarState(); FlagClear(FLAG_SYS_CYCLING_ROAD); @@ -541,11 +552,11 @@ void gpu_sync_bg_hide() gSaveBlock1.warp1 = gSaveBlock1.warp2; } -struct MapConnection *GetMapConnection(u8 dir) +const struct MapConnection *GetMapConnection(u8 dir) { s32 i; s32 count = gMapHeader.connections->count; - struct MapConnection *connection = gMapHeader.connections->connections; + const struct MapConnection *connection = gMapHeader.connections->connections; if (connection == NULL) return NULL; @@ -559,7 +570,8 @@ struct MapConnection *GetMapConnection(u8 dir) static bool8 SetDiveWarp(u8 direction, u16 x, u16 y) { - struct MapConnection *connection = GetMapConnection(direction); + const struct MapConnection *connection = GetMapConnection(direction); + if (connection != NULL) { Overworld_SetWarpDestination(connection->mapGroup, connection->mapNum, -1, x, y); @@ -947,7 +959,7 @@ void Overworld_ChangeMusicTo(u16 newMusic) u8 GetMapMusicFadeoutSpeed(void) { - struct MapHeader *mapHeader = GetDestinationWarpMapHeader(); + const struct MapHeader *mapHeader = GetDestinationWarpMapHeader(); if (Overworld_MapTypeIsIndoors(mapHeader->mapType) == TRUE) return 2; else @@ -1020,7 +1032,7 @@ void UpdateAmbientCry(s16 *state, u16 *delayCounter) } } -void ChooseAmbientCrySpecies(void) +static void ChooseAmbientCrySpecies(void) { if ((gSaveBlock1.location.mapGroup == MAP_GROUP(ROUTE130) && gSaveBlock1.location.mapNum == MAP_NUM(ROUTE130)) @@ -1490,12 +1502,12 @@ void FieldClearVBlankHBlankCallbacks(void) SetHBlankCallback(NULL); } -void SetFieldVBlankCallback(void) +static void SetFieldVBlankCallback(void) { SetVBlankCallback(VBlankCB_Field); } -void VBlankCB_Field(void) +static void VBlankCB_Field(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -2486,7 +2498,7 @@ static void ClearEventObject(struct EventObject *eventObj) memset(eventObj, 0, sizeof(struct EventObject)); } -void SpawnLinkPlayerEventObject(u8 linkPlayerId, s16 x, s16 y, u8 a4) +static void SpawnLinkPlayerEventObject(u8 linkPlayerId, s16 x, s16 y, u8 a4) { u8 eventObjId = GetFirstInactiveEventObjectId(); struct LinkPlayerEventObject *linkPlayerEventObj = &gLinkPlayerEventObjects[linkPlayerId]; @@ -2508,7 +2520,7 @@ void SpawnLinkPlayerEventObject(u8 linkPlayerId, s16 x, s16 y, u8 a4) InitLinkPlayerEventObjectPos(eventObj, x, y); } -void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s16 y) +static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s16 y) { eventObj->currentCoords.x = x; eventObj->currentCoords.y = y; @@ -2576,7 +2588,7 @@ s32 unref_sub_8055B74(u8 linkPlayerId) return 16 - (s8)eventObj->directionSequenceIndex; } -u8 GetLinkPlayerIdAt(s16 x, s16 y) +static u8 GetLinkPlayerIdAt(s16 x, s16 y) { u8 i; for (i = 0; i < 4; i++) @@ -2670,7 +2682,7 @@ static void sub_8055D38(struct LinkPlayerEventObject *linkPlayerEventObj, struct } } -u8 npc_something3(u8 a1, u8 a2) +static u8 npc_something3(u8 a1, u8 a2) { switch (a1 - 1) { @@ -2690,7 +2702,7 @@ u8 npc_something3(u8 a1, u8 a2) return a2; } -u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y) +static u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y) { u8 i; for (i = 0; i < 16; i++) @@ -2707,7 +2719,7 @@ u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y) return MapGridIsImpassableAt(x, y); } -void CreateLinkPlayerSprite(u8 linkPlayerId) +static void CreateLinkPlayerSprite(u8 linkPlayerId) { struct LinkPlayerEventObject *linkPlayerEventObj = &gLinkPlayerEventObjects[linkPlayerId]; u8 eventObjId = linkPlayerEventObj->eventObjId; @@ -2725,7 +2737,7 @@ void CreateLinkPlayerSprite(u8 linkPlayerId) } } -void SpriteCB_LinkPlayer(struct Sprite *sprite) +static void SpriteCB_LinkPlayer(struct Sprite *sprite) { struct LinkPlayerEventObject *linkPlayerEventObj = &gLinkPlayerEventObjects[sprite->data[0]]; struct EventObject *eventObj = &gEventObjects[linkPlayerEventObj->eventObjId]; diff --git a/src/rom6.c b/src/rom6.c index 6efb1802e..ea529aaa9 100644 --- a/src/rom6.c +++ b/src/rom6.c @@ -1,21 +1,21 @@ #include "global.h" -#include "constants/event_objects.h" -#include "constants/songs.h" -#include "rom6.h" #include "braille_puzzles.h" -#include "field_effect.h" #include "event_object_movement.h" +#include "field_effect.h" #include "field_player_avatar.h" #include "item_use.h" -#include "pokemon_menu.h" #include "overworld.h" +#include "pokemon_menu.h" +#include "rom6.h" #include "script.h" #include "sound.h" #include "sprite.h" #include "task.h" #include "constants/event_object_movement_constants.h" +#include "constants/event_objects.h" #include "constants/field_effects.h" #include "constants/map_types.h" +#include "constants/songs.h" extern u16 gSpecialVar_LastTalked; extern void (*gFieldCallback)(void); @@ -104,7 +104,7 @@ static void sub_810B428(u8 taskId) gFieldEffectArguments[2] = 2; if (gFieldEffectArguments[1] == 4) gFieldEffectArguments[2] = 3; - sub_805B980(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByCurrentState()); + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByCurrentState()); StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], gFieldEffectArguments[2]); FieldEffectActiveListRemove(6); gTasks[taskId].func = sub_810B4CC; |