mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
Merge branch 'master' into doc-overworld
This commit is contained in:
commit
4a42e2a710
@ -12,16 +12,16 @@
|
||||
|
||||
.align 2
|
||||
gBattleAI_ScriptsTable:: @ 82DBEF8
|
||||
.4byte AI_CheckBadMove
|
||||
.4byte AI_TryToFaint
|
||||
.4byte AI_CheckViability
|
||||
.4byte AI_SetupFirstTurn
|
||||
.4byte AI_Risky
|
||||
.4byte AI_PreferStrongestMove
|
||||
.4byte AI_PreferBatonPass
|
||||
.4byte AI_DoubleBattle
|
||||
.4byte AI_HPAware
|
||||
.4byte AI_Unknown
|
||||
.4byte AI_CheckBadMove @ AI_SCRIPT_CHECK_BAD_MOVE
|
||||
.4byte AI_TryToFaint @ AI_SCRIPT_TRY_TO_FAINT
|
||||
.4byte AI_CheckViability @ AI_SCRIPT_CHECK_VIABILITY
|
||||
.4byte AI_SetupFirstTurn @ AI_SCRIPT_SETUP_FIRST_TURN
|
||||
.4byte AI_Risky @ AI_SCRIPT_RISKY
|
||||
.4byte AI_PreferStrongestMove @ AI_SCRIPT_PREFER_STRONGEST_MOVE
|
||||
.4byte AI_PreferBatonPass @ AI_SCRIPT_PREFER_BATON_PASS
|
||||
.4byte AI_DoubleBattle @ AI_SCRIPT_DOUBLE_BATTLE
|
||||
.4byte AI_HPAware @ AI_SCRIPT_HP_AWARE
|
||||
.4byte AI_Unknown @ AI_SCRIPT_UNKNOWN
|
||||
.4byte AI_Ret
|
||||
.4byte AI_Ret
|
||||
.4byte AI_Ret
|
||||
@ -41,9 +41,9 @@ gBattleAI_ScriptsTable:: @ 82DBEF8
|
||||
.4byte AI_Ret
|
||||
.4byte AI_Ret
|
||||
.4byte AI_Ret
|
||||
.4byte AI_Roaming
|
||||
.4byte AI_Safari
|
||||
.4byte AI_FirstBattle
|
||||
.4byte AI_Roaming @ AI_SCRIPT_ROAMING
|
||||
.4byte AI_Safari @ AI_SCRIPT_SAFARI
|
||||
.4byte AI_FirstBattle @ AI_SCRIPT_FIRST_BATTLE
|
||||
|
||||
AI_CheckBadMove:
|
||||
if_target_is_ally AI_Ret
|
||||
|
@ -8,24 +8,24 @@ FarawayIsland_Interior_MapScripts:: @ 8267CFA
|
||||
.byte 0
|
||||
|
||||
FarawayIsland_Interior_OnReturnToField: @ 8267D0F
|
||||
call_if_set FLAG_SYS_CTRL_OBJ_DELETE, FarawayIsland_Interior_EventScript_267D19
|
||||
call_if_set FLAG_SYS_CTRL_OBJ_DELETE, FarawayIsland_Interior_EventScript_TrySetMewAboveGrass
|
||||
end
|
||||
|
||||
FarawayIsland_Interior_EventScript_267D19:: @ 8267D19
|
||||
FarawayIsland_Interior_EventScript_TrySetMewAboveGrass:: @ 8267D19
|
||||
specialvar VAR_RESULT, GetBattleOutcome
|
||||
compare VAR_RESULT, B_OUTCOME_WON
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_267D4B
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_SetMewAboveGrass
|
||||
compare VAR_RESULT, B_OUTCOME_RAN
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_267D4B
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_SetMewAboveGrass
|
||||
compare VAR_RESULT, B_OUTCOME_PLAYER_TELEPORTED
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_267D4B
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_SetMewAboveGrass
|
||||
compare VAR_RESULT, B_OUTCOME_MON_TELEPORTED
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_267D4B
|
||||
goto_if_eq FarawayIsland_Interior_EventScript_SetMewAboveGrass
|
||||
return
|
||||
|
||||
FarawayIsland_Interior_EventScript_267D4B:: @ 8267D4B
|
||||
FarawayIsland_Interior_EventScript_SetMewAboveGrass:: @ 8267D4B
|
||||
setvar VAR_0x8004, 1
|
||||
special sub_81D4A90
|
||||
special SetMewAboveGrass
|
||||
return
|
||||
|
||||
FarawayIsland_Interior_OnResume: @ 8267D54
|
||||
@ -81,7 +81,7 @@ FarawayIsland_Interior_Movement_MewAppear: @ 8267DD4
|
||||
set_visible
|
||||
step_end
|
||||
|
||||
FarawayIsland_Interior_Movement_MewHideDown: @ 8267DD6
|
||||
FarawayIsland_Interior_Movement_MewFloatUpNorth: @ 8267DD6
|
||||
lock_facing_direction
|
||||
walk_fast_up
|
||||
walk_fast_up
|
||||
@ -90,7 +90,7 @@ FarawayIsland_Interior_Movement_MewHideDown: @ 8267DD6
|
||||
walk_in_place_down
|
||||
step_end
|
||||
|
||||
FarawayIsland_Interior_Movement_MewHideUp: @ 8267DDD
|
||||
FarawayIsland_Interior_Movement_MewFloatUpSouth: @ 8267DDD
|
||||
lock_facing_direction
|
||||
walk_fast_up
|
||||
walk_fast_up
|
||||
@ -99,7 +99,7 @@ FarawayIsland_Interior_Movement_MewHideUp: @ 8267DDD
|
||||
walk_in_place_up
|
||||
step_end
|
||||
|
||||
FarawayIsland_Interior_Movement_MewHideRight: @ 8267DE4
|
||||
FarawayIsland_Interior_Movement_MewFloatUpWest: @ 8267DE4
|
||||
lock_facing_direction
|
||||
walk_fast_up
|
||||
walk_fast_up
|
||||
@ -108,7 +108,7 @@ FarawayIsland_Interior_Movement_MewHideRight: @ 8267DE4
|
||||
walk_in_place_right
|
||||
step_end
|
||||
|
||||
FarawayIsland_Interior_Movement_MewHideLeft: @ 8267DEB
|
||||
FarawayIsland_Interior_Movement_MewFloatUpEast: @ 8267DEB
|
||||
lock_facing_direction
|
||||
walk_fast_up
|
||||
walk_fast_up
|
||||
@ -123,19 +123,19 @@ FarawayIsland_Interior_EventScript_Mew:: @ 8267DF2
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewAppear
|
||||
waitmovement 0
|
||||
setvar VAR_0x8004, 0
|
||||
special sub_81D4A90
|
||||
special SetMewAboveGrass
|
||||
message FarawayIsland_Interior_Text_Mew
|
||||
waitse
|
||||
playmoncry SPECIES_MEW, 2
|
||||
compare VAR_FACING, DIR_NORTH
|
||||
call_if_eq FarawayIsland_Interior_EventScript_MewHideDown
|
||||
call_if_eq FarawayIsland_Interior_EventScript_FoundMewNorth
|
||||
compare VAR_FACING, DIR_SOUTH
|
||||
call_if_eq FarawayIsland_Interior_EventScript_MewHideUp
|
||||
call_if_eq FarawayIsland_Interior_EventScript_FoundMewSouth
|
||||
compare VAR_FACING, DIR_WEST
|
||||
call_if_eq FarawayIsland_Interior_EventScript_MewHideRight
|
||||
call_if_eq FarawayIsland_Interior_EventScript_FoundMewWest
|
||||
compare VAR_FACING, DIR_EAST
|
||||
call_if_eq FarawayIsland_Interior_EventScript_MewHideLeft
|
||||
special sub_81D4BEC
|
||||
call_if_eq FarawayIsland_Interior_EventScript_FoundMewEast
|
||||
special DestroyMewEmergingGrassSprite
|
||||
delay 40
|
||||
waitmoncry
|
||||
setvar VAR_0x8004, SPECIES_MEW
|
||||
@ -170,23 +170,23 @@ FarawayIsland_Interior_EventScript_PlayerOrMewRan:: @ 8267EA4
|
||||
goto Common_EventScript_LegendaryFlewAway
|
||||
end
|
||||
|
||||
FarawayIsland_Interior_EventScript_MewHideDown:: @ 8267EAF
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideDown
|
||||
FarawayIsland_Interior_EventScript_FoundMewNorth:: @ 8267EAF
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewFloatUpNorth
|
||||
waitmovement 0
|
||||
return
|
||||
|
||||
FarawayIsland_Interior_EventScript_MewHideUp:: @ 8267EBA
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideUp
|
||||
FarawayIsland_Interior_EventScript_FoundMewSouth:: @ 8267EBA
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewFloatUpSouth
|
||||
waitmovement 0
|
||||
return
|
||||
|
||||
FarawayIsland_Interior_EventScript_MewHideRight:: @ 8267EC5
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideRight
|
||||
FarawayIsland_Interior_EventScript_FoundMewWest:: @ 8267EC5
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewFloatUpWest
|
||||
waitmovement 0
|
||||
return
|
||||
|
||||
FarawayIsland_Interior_EventScript_MewHideLeft:: @ 8267ED0
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewHideLeft
|
||||
FarawayIsland_Interior_EventScript_FoundMewEast:: @ 8267ED0
|
||||
applymovement LOCALID_MEW, FarawayIsland_Interior_Movement_MewFloatUpEast
|
||||
waitmovement 0
|
||||
return
|
||||
|
||||
|
@ -28,12 +28,12 @@ LavaridgeTown_HerbShop_EventScript_ExpertM:: @ 81FE4FC
|
||||
LavaridgeTown_HerbShop_EventScript_OldMan:: @ 81FE505
|
||||
lock
|
||||
faceplayer
|
||||
goto_if_set FLFLAG_RECEIVED_CHARCOAL, LavaridgeTown_HerbShop_EventScript_ExplainCharcoal
|
||||
goto_if_set FLAG_RECEIVED_CHARCOAL, LavaridgeTown_HerbShop_EventScript_ExplainCharcoal
|
||||
msgbox LavaridgeTown_HerbShop_Text_YouveComeToLookAtHerbalMedicine, MSGBOX_DEFAULT
|
||||
giveitem ITEM_CHARCOAL
|
||||
compare VAR_RESULT, FALSE
|
||||
goto_if_eq Common_EventScript_ShowBagIsFull
|
||||
setflag FLFLAG_RECEIVED_CHARCOAL
|
||||
setflag FLAG_RECEIVED_CHARCOAL
|
||||
release
|
||||
end
|
||||
|
||||
|
@ -511,14 +511,14 @@ gSpecials:: @ 81DBA64
|
||||
def_special ScriptMenu_CreateLilycoveSSTidalMultichoice
|
||||
def_special GetLilycoveSSTidalSelection
|
||||
def_special TurnOnTVScreen
|
||||
def_special sub_81D4A90
|
||||
def_special SetMewAboveGrass
|
||||
def_special ShouldDistributeEonTicket
|
||||
def_special LinkRetireStatusWithBattleTowerPartner
|
||||
def_special sub_813B534
|
||||
def_special CallTrainerHillFunction
|
||||
def_special Script_DoRayquazaScene @ Listed twice
|
||||
def_special LoopWingFlapSE
|
||||
def_special sub_81D4BEC
|
||||
def_special DestroyMewEmergingGrassSprite
|
||||
def_special ShowBerryCrushRankings
|
||||
def_special TryBufferWaldaPhrase
|
||||
def_special DoWaldaNamingScreen
|
||||
|
@ -275,7 +275,7 @@
|
||||
#define FLAG_RECEIVED_DURIN_BERRY 0xFB
|
||||
#define FLAG_RECEIVED_BELUE_BERRY 0xFC
|
||||
#define FLAG_ENABLE_RIVAL_MATCH_CALL 0xFD
|
||||
#define FLFLAG_RECEIVED_CHARCOAL 0xFE
|
||||
#define FLAG_RECEIVED_CHARCOAL 0xFE
|
||||
#define FLAG_LATIOS_OR_LATIAS_ROAMING 0xFF
|
||||
#define FLAG_RECEIVED_REPEAT_BALL 0x100
|
||||
#define FLAG_RECEIVED_OLD_ROD 0x101
|
||||
@ -1077,9 +1077,7 @@
|
||||
#define FLAG_ITEM_ROUTE_120_NUGGET 0x406
|
||||
#define FLAG_ITEM_ROUTE_120_FULL_HEAL 0x407
|
||||
#define FLAG_ITEM_ROUTE_123_CALCIUM 0x408
|
||||
|
||||
#define FLAG_UNUSED_0x409 0x409 // Unused Flag
|
||||
|
||||
#define FLAG_ITEM_ROUTE_123_RARE_CANDY 0x409 // Unused Flag, leftover from R/S. In Emerald this is a hidden item and uses a different flag
|
||||
#define FLAG_ITEM_ROUTE_127_ZINC 0x40A
|
||||
#define FLAG_ITEM_ROUTE_127_CARBOS 0x40B
|
||||
#define FLAG_ITEM_ROUTE_132_RARE_CANDY 0x40C
|
||||
@ -1171,37 +1169,27 @@
|
||||
#define FLAG_ITEM_NEW_MAUVILLE_FULL_HEAL 0x462
|
||||
#define FLAG_ITEM_NEW_MAUVILLE_PARALYZE_HEAL 0x463
|
||||
#define FLAG_ITEM_AQUA_HIDEOUT_B1F_MASTER_BALL 0x464
|
||||
|
||||
#define FLAG_UNUSED_0x465 0x465 // Unused Flag
|
||||
#define FLAG_UNUSED_0x466 0x466 // Unused Flag
|
||||
#define FLAG_UNUSED_0x467 0x467 // Unused Flag
|
||||
#define FLAG_ITEM_OLD_MAGMA_HIDEOUT_B1F_MASTER_BALL 0x465 // Unused Flag, leftover from the Ruby Magma hideout
|
||||
#define FLAG_ITEM_OLD_MAGMA_HIDEOUT_B1F_MAX_ELIXIR 0x466 // Unused Flag, leftover from the Ruby Magma hideout
|
||||
#define FLAG_ITEM_OLD_MAGMA_HIDEOUT_B2F_NEST_BALL 0x467 // Unused Flag, leftover from the Ruby Magma hideout
|
||||
#define FLAG_UNUSED_0x468 0x468 // Unused Flag
|
||||
|
||||
#define FLAG_ITEM_MT_PYRE_2F_ULTRA_BALL 0x469
|
||||
#define FLAG_ITEM_MT_PYRE_4F_SEA_INCENSE 0x46A
|
||||
#define FLAG_ITEM_SAFARI_ZONE_SOUTH_WEST_MAX_REVIVE 0x46B
|
||||
#define FLAG_ITEM_AQUA_HIDEOUT_B1F_NUGGET 0x46C
|
||||
|
||||
#define FLAG_UNUSED_0x46D 0x46D // Unused Flag
|
||||
|
||||
#define FLAG_ITEM_MOSSDEEP_STEVENS_HOUSE_HM08 0x46D // Unused Flag, leftover from R/S. HM08 is given to the player directly in Emerald
|
||||
#define FLAG_ITEM_ROUTE_119_NUGGET 0x46E
|
||||
#define FLAG_ITEM_ROUTE_104_POTION 0x46F
|
||||
|
||||
#define FLAG_UNUSED_0x470 0x470 // Unused Flag
|
||||
|
||||
#define FLAG_ITEM_ROUTE_103_PP_UP 0x471
|
||||
|
||||
#define FLAG_UNUSED_0x472 0x472 // Unused Flag
|
||||
|
||||
#define FLAG_ITEM_ROUTE_108_STAR_PIECE 0x473
|
||||
#define FLAG_ITEM_ROUTE_109_POTION 0x474
|
||||
#define FLAG_ITEM_ROUTE_110_ELIXIR 0x475
|
||||
#define FLAG_ITEM_ROUTE_111_ELIXIR 0x476
|
||||
#define FLAG_ITEM_ROUTE_113_HYPER_POTION 0x477
|
||||
#define FLAG_ITEM_ROUTE_115_HEAL_POWDER 0x478
|
||||
|
||||
#define FLAG_UNUSED_0x479 0x479 // Unused Flag
|
||||
|
||||
#define FLAG_ITEM_ROUTE_116_POTION 0x47A
|
||||
#define FLAG_ITEM_ROUTE_119_ELIXIR_2 0x47B
|
||||
#define FLAG_ITEM_ROUTE_120_REVIVE 0x47C
|
||||
@ -1356,7 +1344,7 @@
|
||||
#define FLAG_SYS_POKEMON_GET (SYSTEM_FLAGS + 0x0) // FLAG_0x860
|
||||
#define FLAG_SYS_POKEDEX_GET (SYSTEM_FLAGS + 0x1)
|
||||
#define FLAG_SYS_POKENAV_GET (SYSTEM_FLAGS + 0x2)
|
||||
#define FLAG_UNUSED_0x863 (SYSTEM_FLAGS + 0x3)
|
||||
#define FLAG_UNUSED_0x863 (SYSTEM_FLAGS + 0x3) // Unused Flag
|
||||
#define FLAG_SYS_GAME_CLEAR (SYSTEM_FLAGS + 0x4)
|
||||
#define FLAG_SYS_CHAT_USED (SYSTEM_FLAGS + 0x5)
|
||||
#define FLAG_SYS_HIPSTER_MEET (SYSTEM_FLAGS + 0x6)
|
||||
@ -1373,7 +1361,7 @@
|
||||
#define NUM_BADGES (1 + FLAG_BADGE08_GET - FLAG_BADGE01_GET)
|
||||
|
||||
// Towns and Cities
|
||||
#define FLAG_VISITED_LITTLEROOT_TOWN (SYSTEM_FLAGS + 0xF)
|
||||
#define FLAG_VISITED_LITTLEROOT_TOWN (SYSTEM_FLAGS + 0xF)
|
||||
#define FLAG_VISITED_OLDALE_TOWN (SYSTEM_FLAGS + 0x10)
|
||||
#define FLAG_VISITED_DEWFORD_TOWN (SYSTEM_FLAGS + 0x11)
|
||||
#define FLAG_VISITED_LAVARIDGE_TOWN (SYSTEM_FLAGS + 0x12)
|
||||
@ -1418,9 +1406,9 @@
|
||||
#define FLAG_SYS_MIX_RECORD (SYSTEM_FLAGS + 0x34)
|
||||
#define FLAG_SYS_CLOCK_SET (SYSTEM_FLAGS + 0x35)
|
||||
#define FLAG_SYS_NATIONAL_DEX (SYSTEM_FLAGS + 0x36)
|
||||
#define FLAG_SYS_UNUSED_CAVE_SHIP (SYSTEM_FLAGS + 0x37) // Unused Flag?
|
||||
#define FLAG_SYS_UNUSED_CAVE_WONDER (SYSTEM_FLAGS + 0x38) // Unused Flag?
|
||||
#define FLAG_SYS_UNUSED_CAVE_BATTLE (SYSTEM_FLAGS + 0x39) // Unused Flag?
|
||||
#define FLAG_SYS_CAVE_SHIP (SYSTEM_FLAGS + 0x37) // Unused Flag, leftover from R/S debug, presumably used by Emerald's debug too
|
||||
#define FLAG_SYS_CAVE_WONDER (SYSTEM_FLAGS + 0x38) // Unused Flag, same as above
|
||||
#define FLAG_SYS_CAVE_BATTLE (SYSTEM_FLAGS + 0x39) // Unused Flag, same as above
|
||||
#define FLAG_SYS_SHOAL_TIDE (SYSTEM_FLAGS + 0x3A)
|
||||
#define FLAG_SYS_RIBBON_GET (SYSTEM_FLAGS + 0x3B)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define GUARD_FARAWAY_ISLAND_H
|
||||
|
||||
u32 GetMewMoveDirection(void);
|
||||
bool8 sub_81D4A58(struct ObjectEvent*);
|
||||
bool8 ShouldMewShakeGrass(struct ObjectEvent*);
|
||||
void UpdateFarawayIslandStepCounter(void);
|
||||
bool8 ObjectEventIsFarawayIslandMew(struct ObjectEvent *);
|
||||
bool8 IsMewPlayingHideAndSeek(void);
|
||||
|
@ -127,7 +127,8 @@ void SetReadFlash1(u16 *dest)
|
||||
}
|
||||
}
|
||||
|
||||
void ReadFlash_Core(u8 *src, u8 *dest, u32 size)
|
||||
// Using volatile here to make sure the flash memory will ONLY be read as bytes, to prevent any compiler optimizations.
|
||||
void ReadFlash_Core(vu8 *src, u8 *dest, u32 size)
|
||||
{
|
||||
while (size-- != 0)
|
||||
{
|
||||
@ -142,7 +143,7 @@ void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size)
|
||||
u16 readFlash_Core_Buffer[0x40];
|
||||
u16 *funcSrc;
|
||||
u16 *funcDest;
|
||||
void (*readFlash_Core)(u8 *, u8 *, u32);
|
||||
void (*readFlash_Core)(vu8 *, u8 *, u32);
|
||||
|
||||
REG_WAITCNT = (REG_WAITCNT & ~WAITCNT_SRAM_MASK) | WAITCNT_SRAM_8;
|
||||
|
||||
@ -164,7 +165,7 @@ void ReadFlash(u16 sectorNum, u32 offset, u8 *dest, u32 size)
|
||||
i--;
|
||||
}
|
||||
|
||||
readFlash_Core = (void (*)(u8 *, u8 *, u32))((s32)readFlash_Core_Buffer + 1);
|
||||
readFlash_Core = (void (*)(vu8 *, u8 *, u32))((s32)readFlash_Core_Buffer + 1);
|
||||
|
||||
src = FLASH_BASE + (sectorNum << gFlash->sector.shift) + offset;
|
||||
|
||||
|
@ -624,98 +624,24 @@ void AnimTask_RotateAuroraRingColors(u8 taskId)
|
||||
gTasks[taskId].func = AnimTask_RotateAuroraRingColors_Step;
|
||||
}
|
||||
|
||||
#ifdef NONMATCHING
|
||||
static void AnimTask_RotateAuroraRingColors_Step(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
u16 palIndex;
|
||||
u16 *palPtr1;
|
||||
u16 *palPtr2;
|
||||
u16 rgbBuffer;
|
||||
|
||||
if (++gTasks[taskId].data[10] == 3)
|
||||
{
|
||||
u16 tempPlt;
|
||||
gTasks[taskId].data[10] = 0;
|
||||
palIndex = gTasks[taskId].data[2] + 1;
|
||||
palPtr1 = &gPlttBufferFaded[palIndex];
|
||||
rgbBuffer = *palPtr1;
|
||||
palPtr2 = &palPtr1[1];
|
||||
for (i = 0; i < 7; i++)
|
||||
palPtr1[i] = palPtr2[i];
|
||||
gPlttBufferFaded[palIndex + 7] = rgbBuffer;
|
||||
tempPlt = gPlttBufferFaded[palIndex];
|
||||
for (i = 1; i < 8; i++)
|
||||
gPlttBufferFaded[palIndex + i - 1] = gPlttBufferFaded[palIndex + i];
|
||||
gPlttBufferFaded[palIndex + 7] = tempPlt;
|
||||
}
|
||||
if (++gTasks[taskId].data[11] == gTasks[taskId].data[0])
|
||||
DestroyAnimVisualTask(taskId);
|
||||
}
|
||||
#else
|
||||
NAKED
|
||||
static void AnimTask_RotateAuroraRingColors_Step(u8 taskId)
|
||||
{
|
||||
asm_unified("push {r4-r7,lr}\n\
|
||||
lsls r0, 24\n\
|
||||
lsrs r4, r0, 24\n\
|
||||
ldr r1, =gTasks\n\
|
||||
lsls r0, r4, 2\n\
|
||||
adds r0, r4\n\
|
||||
lsls r0, 3\n\
|
||||
adds r2, r0, r1\n\
|
||||
ldrh r0, [r2, 0x1C]\n\
|
||||
adds r0, 0x1\n\
|
||||
strh r0, [r2, 0x1C]\n\
|
||||
lsls r0, 16\n\
|
||||
asrs r0, 16\n\
|
||||
mov r12, r1\n\
|
||||
cmp r0, 0x3\n\
|
||||
bne _081075BE\n\
|
||||
movs r0, 0\n\
|
||||
strh r0, [r2, 0x1C]\n\
|
||||
ldrh r0, [r2, 0xC]\n\
|
||||
adds r0, 0x1\n\
|
||||
lsls r0, 16\n\
|
||||
lsrs r5, r0, 16\n\
|
||||
ldr r1, =gPlttBufferFaded\n\
|
||||
lsls r0, r5, 1\n\
|
||||
adds r0, r1\n\
|
||||
ldrh r6, [r0]\n\
|
||||
adds r7, r1, 0\n\
|
||||
adds r3, r0, 0x2\n\
|
||||
movs r1, 0x6\n\
|
||||
adds r2, r0, 0\n\
|
||||
_081075A8:\n\
|
||||
ldrh r0, [r3]\n\
|
||||
strh r0, [r2]\n\
|
||||
adds r3, 0x2\n\
|
||||
adds r2, 0x2\n\
|
||||
subs r1, 0x1\n\
|
||||
cmp r1, 0\n\
|
||||
bge _081075A8\n\
|
||||
adds r0, r5, 0x7\n\
|
||||
lsls r0, 1\n\
|
||||
adds r0, r7\n\
|
||||
strh r6, [r0]\n\
|
||||
_081075BE:\n\
|
||||
lsls r0, r4, 2\n\
|
||||
adds r0, r4\n\
|
||||
lsls r0, 3\n\
|
||||
add r0, r12\n\
|
||||
ldrh r1, [r0, 0x1E]\n\
|
||||
adds r1, 0x1\n\
|
||||
strh r1, [r0, 0x1E]\n\
|
||||
lsls r1, 16\n\
|
||||
asrs r1, 16\n\
|
||||
movs r2, 0x8\n\
|
||||
ldrsh r0, [r0, r2]\n\
|
||||
cmp r1, r0\n\
|
||||
bne _081075DE\n\
|
||||
adds r0, r4, 0\n\
|
||||
bl DestroyAnimVisualTask\n\
|
||||
_081075DE:\n\
|
||||
pop {r4-r7}\n\
|
||||
pop {r0}\n\
|
||||
bx r0\n\
|
||||
.pool\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
// For animating undulating beam attacks (e.g. Flamethrower, Hydro Pump, Signal Beam)
|
||||
static void AnimToTargetInSinWave(struct Sprite *sprite)
|
||||
@ -822,6 +748,7 @@ static void AnimHydroCannonBeam(struct Sprite *sprite)
|
||||
if (GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_PLAYER_LEFT || GetBattlerPosition(gBattleAnimAttacker) == B_POSITION_OPPONENT_LEFT)
|
||||
gBattleAnimArgs[0] *= -1;
|
||||
}
|
||||
|
||||
if ((gBattleAnimArgs[5] & 0xFF00) == 0)
|
||||
animType = TRUE;
|
||||
else
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -8127,7 +8127,7 @@ static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite *
|
||||
{
|
||||
u8 i;
|
||||
|
||||
if (ObjectEventIsFarawayIslandMew(objEvent) == TRUE && !sub_81D4A58(objEvent))
|
||||
if (ObjectEventIsFarawayIslandMew(objEvent) == TRUE && !ShouldMewShakeGrass(objEvent))
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sGroundEffectFuncs); i++, flags >>= 1)
|
||||
|
@ -10,15 +10,15 @@
|
||||
#include "constants/maps.h"
|
||||
#include "constants/metatile_behaviors.h"
|
||||
|
||||
static u8 sub_81D4890(u8);
|
||||
static bool8 sub_81D4C14(struct ObjectEvent*, u8);
|
||||
static u8 sub_81D4C9C(struct ObjectEvent*, u8);
|
||||
static u8 sub_81D4C58(struct ObjectEvent*, u8);
|
||||
static u8 sub_81D4CE0(struct ObjectEvent*, u8);
|
||||
static u8 sub_81D4D24(u8);
|
||||
static bool8 CanMewWalkToCoords(s16, s16);
|
||||
static u8 GetValidMewMoveDirection(u8);
|
||||
static bool8 ShouldMewMoveNorth(struct ObjectEvent*, u8);
|
||||
static bool8 ShouldMewMoveSouth(struct ObjectEvent*, u8);
|
||||
static bool8 ShouldMewMoveEast(struct ObjectEvent*, u8);
|
||||
static bool8 ShouldMewMoveWest(struct ObjectEvent*, u8);
|
||||
static u8 GetRandomMewDirectionCandidate(u8);
|
||||
static bool8 CanMewMoveToCoords(s16, s16);
|
||||
|
||||
static EWRAM_DATA u8 sUnknown_0203CF50 = 0;
|
||||
static EWRAM_DATA u8 sGrassSpriteId = 0;
|
||||
|
||||
static s16 sPlayerToMewDeltaX;
|
||||
static s16 sPlayerToMewDeltaY;
|
||||
@ -29,10 +29,10 @@ extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[];
|
||||
|
||||
static const s16 sFarawayIslandRockCoords[4][2] =
|
||||
{
|
||||
{21, 16},
|
||||
{25, 16},
|
||||
{16, 17},
|
||||
{20, 20},
|
||||
{14 + 7, 9 + 7},
|
||||
{18 + 7, 9 + 7},
|
||||
{ 9 + 7, 10 + 7},
|
||||
{13 + 7, 13 + 7},
|
||||
};
|
||||
|
||||
static u8 GetMewObjectEventId(void)
|
||||
@ -42,10 +42,12 @@ static u8 GetMewObjectEventId(void)
|
||||
return objectEventId;
|
||||
}
|
||||
|
||||
// When the player enters Faraway Island interior it begins a "hide and seek" minigame where Mew disappears into the grass
|
||||
// This function returns the direction Mew will take a step, and is run every time the player takes a step
|
||||
u32 GetMewMoveDirection(void)
|
||||
{
|
||||
u8 i;
|
||||
int skip;
|
||||
int mewSafeFromTrap;
|
||||
struct ObjectEvent *mew = &gObjectEvents[GetMewObjectEventId()];
|
||||
|
||||
sPlayerToMewDeltaX = gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.x - mew->currentCoords.x;
|
||||
@ -53,43 +55,47 @@ u32 GetMewMoveDirection(void)
|
||||
for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++)
|
||||
sMewDirectionCandidates[i] = DIR_NONE;
|
||||
|
||||
// Player hasn't moved (just facing new direction), don't move
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.x == gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x
|
||||
&& gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.y == gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y)
|
||||
{
|
||||
return DIR_NONE;
|
||||
}
|
||||
|
||||
// Mew is invisible except for every 8th step
|
||||
if (VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % 8 == 0)
|
||||
mew->invisible = 0;
|
||||
mew->invisible = FALSE;
|
||||
else
|
||||
mew->invisible = 1;
|
||||
mew->invisible = TRUE;
|
||||
|
||||
// Mew will stay in place for 1 step after its visible
|
||||
if (VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % 9 == 0)
|
||||
return DIR_NONE;
|
||||
|
||||
// Below loop is for Mew to try to avoid getting trapped between the player and a rock
|
||||
for (i = 0; i < ARRAY_COUNT(sFarawayIslandRockCoords); i++)
|
||||
{
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.x == sFarawayIslandRockCoords[i][0])
|
||||
{
|
||||
skip = 0;
|
||||
mewSafeFromTrap = FALSE;
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.y < sFarawayIslandRockCoords[i][1])
|
||||
{
|
||||
if (mew->currentCoords.y <= sFarawayIslandRockCoords[i][1])
|
||||
skip = 1;
|
||||
mewSafeFromTrap = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mew->currentCoords.y >= sFarawayIslandRockCoords[i][1])
|
||||
skip = 1;
|
||||
mewSafeFromTrap = TRUE;
|
||||
}
|
||||
|
||||
if (!skip)
|
||||
if (!mewSafeFromTrap)
|
||||
{
|
||||
if (sPlayerToMewDeltaX > 0)
|
||||
{
|
||||
if (mew->currentCoords.x + 1 == gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.x)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
return DIR_EAST;
|
||||
}
|
||||
}
|
||||
@ -97,7 +103,7 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (mew->currentCoords.x - 1 == gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.x)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
return DIR_WEST;
|
||||
}
|
||||
}
|
||||
@ -106,12 +112,12 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (sPlayerToMewDeltaY > 0)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
return DIR_NORTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
return DIR_SOUTH;
|
||||
}
|
||||
}
|
||||
@ -120,25 +126,25 @@ u32 GetMewMoveDirection(void)
|
||||
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.y == sFarawayIslandRockCoords[i][1])
|
||||
{
|
||||
skip = 0;
|
||||
mewSafeFromTrap = FALSE;
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.x < sFarawayIslandRockCoords[i][0])
|
||||
{
|
||||
if (mew->currentCoords.x <= sFarawayIslandRockCoords[i][0])
|
||||
skip = 1;
|
||||
mewSafeFromTrap = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mew->currentCoords.x >= sFarawayIslandRockCoords[i][0])
|
||||
skip = 1;
|
||||
mewSafeFromTrap = TRUE;
|
||||
}
|
||||
|
||||
if (!skip)
|
||||
if (!mewSafeFromTrap)
|
||||
{
|
||||
if (sPlayerToMewDeltaY > 0)
|
||||
{
|
||||
if (mew->currentCoords.y + 1 == gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.y)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
return DIR_SOUTH;
|
||||
}
|
||||
}
|
||||
@ -146,7 +152,7 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (mew->currentCoords.y - 1 == gObjectEvents[gPlayerAvatar.objectEventId].previousCoords.y)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
return DIR_NORTH;
|
||||
}
|
||||
}
|
||||
@ -155,12 +161,12 @@ u32 GetMewMoveDirection(void)
|
||||
{
|
||||
if (sPlayerToMewDeltaX > 0)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
return DIR_WEST;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
return DIR_EAST;
|
||||
}
|
||||
}
|
||||
@ -168,92 +174,101 @@ u32 GetMewMoveDirection(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (sub_81D4C14(mew, 0))
|
||||
// Check if Mew can move in any direction without getting closer to the player
|
||||
// If so load into sMewDirectionCandidates
|
||||
// If Mew can move in two of the checked directions, choose one randomly
|
||||
if (ShouldMewMoveNorth(mew, 0))
|
||||
{
|
||||
if (sub_81D4C58(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
else if (sub_81D4CE0(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
if (ShouldMewMoveEast(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else if (ShouldMewMoveWest(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_NORTH;
|
||||
}
|
||||
|
||||
if (sub_81D4C9C(mew, 0))
|
||||
if (ShouldMewMoveSouth(mew, 0))
|
||||
{
|
||||
if (sub_81D4C58(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
else if (sub_81D4CE0(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
if (ShouldMewMoveEast(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else if (ShouldMewMoveWest(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_SOUTH;
|
||||
}
|
||||
|
||||
if (sub_81D4C58(mew, 0))
|
||||
if (ShouldMewMoveEast(mew, 0))
|
||||
{
|
||||
if (sub_81D4C14(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
else if (sub_81D4C9C(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
if (ShouldMewMoveNorth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else if (ShouldMewMoveSouth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_EAST;
|
||||
}
|
||||
|
||||
if (sub_81D4CE0(mew, 0))
|
||||
if (ShouldMewMoveWest(mew, 0))
|
||||
{
|
||||
if (sub_81D4C14(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
else if (sub_81D4C9C(mew, 1))
|
||||
return sub_81D4D24(2);
|
||||
if (ShouldMewMoveNorth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else if (ShouldMewMoveSouth(mew, 1))
|
||||
return GetRandomMewDirectionCandidate(2);
|
||||
else
|
||||
return DIR_WEST;
|
||||
}
|
||||
|
||||
// If this point is reached, Mew cannot move without getting closer to the player
|
||||
|
||||
// Avoid player on same Y, try move North/South
|
||||
if (sPlayerToMewDeltaY == 0)
|
||||
{
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y > mew->currentCoords.y)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
return DIR_NORTH;
|
||||
}
|
||||
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y < mew->currentCoords.y)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
return DIR_SOUTH;
|
||||
}
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
return DIR_NORTH;
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
return DIR_SOUTH;
|
||||
}
|
||||
|
||||
// Avoid player on same X, try move West/East
|
||||
if (sPlayerToMewDeltaX == 0)
|
||||
{
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x > mew->currentCoords.x)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
return DIR_WEST;
|
||||
}
|
||||
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x < mew->currentCoords.x)
|
||||
{
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
return DIR_EAST;
|
||||
}
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
return DIR_EAST;
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
return DIR_WEST;
|
||||
}
|
||||
|
||||
return sub_81D4890(DIR_NONE);
|
||||
// Can't avoid player on axis, move any valid direction
|
||||
return GetValidMewMoveDirection(DIR_NONE);
|
||||
}
|
||||
|
||||
static bool8 CanMewWalkToCoords(s16 x, s16 y)
|
||||
// Mew can move to any Tall/Long Grass metatile the player isn't currently on
|
||||
static bool8 CanMewMoveToCoords(s16 x, s16 y)
|
||||
{
|
||||
if (gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x == x
|
||||
&& gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y == y)
|
||||
@ -264,7 +279,8 @@ static bool8 CanMewWalkToCoords(s16 x, s16 y)
|
||||
return MetatileBehavior_IsPokeGrass(MapGridGetMetatileBehaviorAt(x, y));
|
||||
}
|
||||
|
||||
static u8 sub_81D4890(u8 ignoredDir)
|
||||
// Last ditch effort to move, clear move candidates and try all directions again
|
||||
static u8 GetValidMewMoveDirection(u8 ignoredDir)
|
||||
{
|
||||
u8 i;
|
||||
u8 count = 0;
|
||||
@ -273,25 +289,25 @@ static u8 sub_81D4890(u8 ignoredDir)
|
||||
for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++)
|
||||
sMewDirectionCandidates[i] = DIR_NONE;
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH)
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH)
|
||||
{
|
||||
sMewDirectionCandidates[count] = DIR_NORTH;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST)
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST)
|
||||
{
|
||||
sMewDirectionCandidates[count] = DIR_EAST;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH)
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH)
|
||||
{
|
||||
sMewDirectionCandidates[count] = DIR_SOUTH;
|
||||
count++;
|
||||
}
|
||||
|
||||
if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST)
|
||||
if (CanMewMoveToCoords(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST)
|
||||
{
|
||||
sMewDirectionCandidates[count] = DIR_WEST;
|
||||
count++;
|
||||
@ -341,7 +357,9 @@ bool8 IsMewPlayingHideAndSeek(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_81D4A58(struct ObjectEvent *objectEvent)
|
||||
// Every 4th step Mew will shake the grass it steps into
|
||||
// Otherwise its movement leaves grass undisturbed
|
||||
bool8 ShouldMewShakeGrass(struct ObjectEvent *objectEvent)
|
||||
{
|
||||
if (VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) != 0xFFFF
|
||||
&& VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % 4 == 0)
|
||||
@ -350,22 +368,25 @@ bool8 sub_81D4A58(struct ObjectEvent *objectEvent)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_81D4A90(void)
|
||||
void SetMewAboveGrass(void)
|
||||
{
|
||||
s16 x;
|
||||
s16 y;
|
||||
u8 spriteId;
|
||||
struct ObjectEvent *mew = &gObjectEvents[GetMewObjectEventId()];
|
||||
|
||||
mew->invisible = 0;
|
||||
mew->invisible = FALSE;
|
||||
if (gSpecialVar_0x8004 == 1)
|
||||
{
|
||||
// For after battle where Mew should still be present (e.g. if ran from battle)
|
||||
mew->fixedPriority = 1;
|
||||
gSprites[mew->spriteId].subspriteMode = SUBSPRITES_IGNORE_PRIORITY;
|
||||
gSprites[mew->spriteId].subpriority = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mew emerging from grass when found
|
||||
// Also do field effect for grass shaking as it emerges
|
||||
VarSet(VAR_FARAWAY_ISLAND_STEP_COUNTER, 0xFFFF);
|
||||
mew->fixedPriority = 1;
|
||||
gSprites[mew->spriteId].subspriteMode = SUBSPRITES_IGNORE_PRIORITY;
|
||||
@ -378,10 +399,10 @@ void sub_81D4A90(void)
|
||||
x = mew->currentCoords.x;
|
||||
y = mew->currentCoords.y;
|
||||
SetSpritePosToOffsetMapCoords(&x, &y, 8, 8);
|
||||
sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_LONG_GRASS], x, y, gSprites[mew->spriteId].subpriority - 1);
|
||||
if (sUnknown_0203CF50 != MAX_SPRITES)
|
||||
sGrassSpriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[FLDEFFOBJ_LONG_GRASS], x, y, gSprites[mew->spriteId].subpriority - 1);
|
||||
if (sGrassSpriteId != MAX_SPRITES)
|
||||
{
|
||||
struct Sprite *sprite = &gSprites[sUnknown_0203CF50];
|
||||
struct Sprite *sprite = &gSprites[sGrassSpriteId];
|
||||
sprite->coordOffsetEnabled = 1;
|
||||
sprite->oam.priority = 2;
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
@ -389,15 +410,15 @@ void sub_81D4A90(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_81D4BEC(void)
|
||||
void DestroyMewEmergingGrassSprite(void)
|
||||
{
|
||||
if (sUnknown_0203CF50 != MAX_SPRITES)
|
||||
DestroySprite(&gSprites[sUnknown_0203CF50]);
|
||||
if (sGrassSpriteId != MAX_SPRITES)
|
||||
DestroySprite(&gSprites[sGrassSpriteId]);
|
||||
}
|
||||
|
||||
static bool8 sub_81D4C14(struct ObjectEvent *mew, u8 index)
|
||||
static bool8 ShouldMewMoveNorth(struct ObjectEvent *mew, u8 index)
|
||||
{
|
||||
if (sPlayerToMewDeltaY > 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
if (sPlayerToMewDeltaY > 0 && CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y - 1))
|
||||
{
|
||||
sMewDirectionCandidates[index] = DIR_NORTH;
|
||||
return TRUE;
|
||||
@ -406,9 +427,9 @@ static bool8 sub_81D4C14(struct ObjectEvent *mew, u8 index)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 sub_81D4C58(struct ObjectEvent *mew, u8 index)
|
||||
static bool8 ShouldMewMoveEast(struct ObjectEvent *mew, u8 index)
|
||||
{
|
||||
if (sPlayerToMewDeltaX < 0 && CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
if (sPlayerToMewDeltaX < 0 && CanMewMoveToCoords(mew->currentCoords.x + 1, mew->currentCoords.y))
|
||||
{
|
||||
sMewDirectionCandidates[index] = DIR_EAST;
|
||||
return TRUE;
|
||||
@ -417,9 +438,9 @@ static u8 sub_81D4C58(struct ObjectEvent *mew, u8 index)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 sub_81D4C9C(struct ObjectEvent *mew, u8 index)
|
||||
static bool8 ShouldMewMoveSouth(struct ObjectEvent *mew, u8 index)
|
||||
{
|
||||
if (sPlayerToMewDeltaY < 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
if (sPlayerToMewDeltaY < 0 && CanMewMoveToCoords(mew->currentCoords.x, mew->currentCoords.y + 1))
|
||||
{
|
||||
sMewDirectionCandidates[index] = DIR_SOUTH;
|
||||
return TRUE;
|
||||
@ -428,9 +449,9 @@ static u8 sub_81D4C9C(struct ObjectEvent *mew, u8 index)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 sub_81D4CE0(struct ObjectEvent *mew, u8 index)
|
||||
static bool8 ShouldMewMoveWest(struct ObjectEvent *mew, u8 index)
|
||||
{
|
||||
if (sPlayerToMewDeltaX > 0 && CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
if (sPlayerToMewDeltaX > 0 && CanMewMoveToCoords(mew->currentCoords.x - 1, mew->currentCoords.y))
|
||||
{
|
||||
sMewDirectionCandidates[index] = DIR_WEST;
|
||||
return TRUE;
|
||||
@ -439,7 +460,7 @@ static u8 sub_81D4CE0(struct ObjectEvent *mew, u8 index)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static u8 sub_81D4D24(u8 mod)
|
||||
static u8 GetRandomMewDirectionCandidate(u8 numDirections)
|
||||
{
|
||||
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod];
|
||||
return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % numDirections];
|
||||
}
|
||||
|
@ -77,11 +77,9 @@ static void DrawTextOption(void);
|
||||
static void DrawOptionMenuTexts(void);
|
||||
static void sub_80BB154(void);
|
||||
|
||||
// EWRAM vars
|
||||
EWRAM_DATA static bool8 sArrowPressed = FALSE;
|
||||
|
||||
// const rom data
|
||||
static const u16 sUnknown_0855C604[] = INCBIN_U16("graphics/misc/option_menu_text.gbapal");
|
||||
static const u16 sOptionMenuText_Pal[] = INCBIN_U16("graphics/misc/option_menu_text.gbapal");
|
||||
// note: this is only used in the Japanese release
|
||||
static const u8 sEqualSignGfx[] = INCBIN_U8("graphics/misc/option_menu_equals_sign.4bpp");
|
||||
|
||||
@ -141,7 +139,7 @@ static const struct BgTemplate sOptionMenuBgTemplates[] =
|
||||
}
|
||||
};
|
||||
|
||||
static const u16 sUnknown_0855C6A0[] = {0x7E51};
|
||||
static const u16 sOptionMenuBg_Pal[] = {RGB(17, 18, 31)};
|
||||
|
||||
// code
|
||||
static void MainCB2(void)
|
||||
@ -209,12 +207,12 @@ void CB2_InitOptionMenu(void)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 4:
|
||||
LoadPalette(sUnknown_0855C6A0, 0, sizeof(sUnknown_0855C6A0));
|
||||
LoadPalette(sOptionMenuBg_Pal, 0, sizeof(sOptionMenuBg_Pal));
|
||||
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, 0x70, 0x20);
|
||||
gMain.state++;
|
||||
break;
|
||||
case 5:
|
||||
LoadPalette(sUnknown_0855C604, 0x10, sizeof(sUnknown_0855C604));
|
||||
LoadPalette(sOptionMenuText_Pal, 16, sizeof(sOptionMenuText_Pal));
|
||||
gMain.state++;
|
||||
break;
|
||||
case 6:
|
||||
|
@ -128,7 +128,7 @@ struct PokemonStorageSystemData
|
||||
u16 field_B0[528 / 2];
|
||||
u16 field_2C0;
|
||||
u16 field_2C2;
|
||||
u8 field_2C4;
|
||||
u8 field_2C4; // Unused
|
||||
u8 field_2C5;
|
||||
u8 showPartyMenuState;
|
||||
u8 unk_02C7;
|
||||
@ -136,21 +136,21 @@ struct PokemonStorageSystemData
|
||||
bool8 unk_02C9;
|
||||
s16 newCurrBoxId;
|
||||
u16 bg2_X;
|
||||
s16 field_2CE;
|
||||
s16 wallpaperScrollSpeed;
|
||||
u16 field_2D0;
|
||||
u8 field_2D2;
|
||||
u8 field_2D3;
|
||||
u8 field_2D4;
|
||||
u16 field_2D6;
|
||||
s16 field_2D8;
|
||||
u16 field_2DA;
|
||||
u16 field_2DC;
|
||||
u16 field_2DE;
|
||||
u16 field_2E0;
|
||||
u8 field_2D3; // Written to, but never read.
|
||||
u8 field_2D4; // Written to, but never read.
|
||||
u16 field_2D6; // Written to, but never read.
|
||||
s16 field_2D8; // Written to, but never read.
|
||||
u16 field_2DA; // Written to, but never read.
|
||||
u16 field_2DC; // Written to, but never read.
|
||||
u16 field_2DE; // Written to, but never read.
|
||||
u16 field_2E0; // Written to, but never read.
|
||||
u8 filler[22];
|
||||
u8 field_2F8[1024];
|
||||
u8 field_6F8;
|
||||
u8 field_6F9;
|
||||
u8 field_6F9; // Written to, but never read.
|
||||
u8 field_6FA;
|
||||
s8 field_6FB;
|
||||
u16 field_6FC[16];
|
||||
@ -160,14 +160,14 @@ struct PokemonStorageSystemData
|
||||
struct Sprite *field_728[2];
|
||||
struct Sprite *field_730[2];
|
||||
u32 field_738;
|
||||
u8 field_73C[80];
|
||||
u16 field_78C;
|
||||
u8 field_73C[80]; // Unused
|
||||
u16 field_78C; // Written to, but never read.
|
||||
s16 wallpaperSetId;
|
||||
s16 wallpaperId;
|
||||
u16 field_792[360];
|
||||
u8 wallpaperChangeState;
|
||||
u8 field_A63;
|
||||
u8 field_A64;
|
||||
u8 boxScrollDestination;
|
||||
s8 field_A65;
|
||||
u8 *wallpaperTiles;
|
||||
struct Sprite *movingMonSprite;
|
||||
@ -189,12 +189,12 @@ struct PokemonStorageSystemData
|
||||
u8 field_C68;
|
||||
s8 field_C69;
|
||||
u8 field_C6A;
|
||||
u8 field_C6B;
|
||||
u8 field_C6B; // Written to, but never read.
|
||||
struct WindowTemplate menuWindow;
|
||||
struct StorageMenu menuItems[7];
|
||||
u8 menuItemsCount;
|
||||
u8 menuWidth;
|
||||
u8 field_CAE;
|
||||
u8 field_CAE; // Written to, but never read.
|
||||
u16 field_CB0;
|
||||
struct Sprite *field_CB4;
|
||||
struct Sprite *field_CB8;
|
||||
@ -247,7 +247,7 @@ struct PokemonStorageSystemData
|
||||
u16 field_2176[8];
|
||||
u8 field_2186;
|
||||
u8 field_2187;
|
||||
u8 field_2188;
|
||||
u8 pokemonSummaryScreenMode;
|
||||
union
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
@ -262,13 +262,13 @@ struct PokemonStorageSystemData
|
||||
struct UnkStorageStruct field_2204[3];
|
||||
u16 movingItem;
|
||||
u16 field_2236;
|
||||
u8 field_2238;
|
||||
u8 field_2238; // Unused
|
||||
u16 field_223A;
|
||||
u16 *field_223C;
|
||||
struct Sprite *cursorMonSprite;
|
||||
u16 field_2244[0x40];
|
||||
u8 field_22C4[0x800];
|
||||
u8 field_2AC4[0x1800];
|
||||
u8 field_2AC4[0x1800]; // Unused
|
||||
u8 field_42C4[0x800];
|
||||
u8 field_4AC4[0x1000];
|
||||
u8 field_5AC4[0x800];
|
||||
@ -658,7 +658,7 @@ static void SetBoxSpeciesAndPersonalities(u8 boxId);
|
||||
static void sub_80CB9D0(struct Sprite *sprite, u16 partyId);
|
||||
static void sub_80CC370(u8 taskId);
|
||||
static void sub_80CCB50(u8 boxId);
|
||||
static s8 sub_80CC644(u8 boxId);
|
||||
static s8 DetermineBoxScrollDirection(u8 boxId);
|
||||
static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2);
|
||||
static s16 sub_80CD00C(const u8 *string);
|
||||
static bool8 MonPlaceChange_Shift(void);
|
||||
@ -3879,7 +3879,7 @@ static void Cb_ChangeScreen(u8 taskId)
|
||||
boxMons = sPSSData->field_218C.box;
|
||||
monIndex = sPSSData->field_2187;
|
||||
maxMonIndex = sPSSData->field_2186;
|
||||
mode = sPSSData->field_2188;
|
||||
mode = sPSSData->pokemonSummaryScreenMode;
|
||||
FreePSSData();
|
||||
if (mode == PSS_MODE_NORMAL && boxMons == &gUnknown_02039D14.box)
|
||||
ShowPokemonSummaryScreenSet40EF(mode, boxMons, monIndex, maxMonIndex, Cb2_ReturnToPSS);
|
||||
@ -5276,9 +5276,9 @@ static void sub_80CC370(u8 taskId)
|
||||
|
||||
static void SetUpScrollToBox(u8 boxId)
|
||||
{
|
||||
s8 direction = sub_80CC644(boxId);
|
||||
s8 direction = DetermineBoxScrollDirection(boxId);
|
||||
|
||||
sPSSData->field_2CE = (direction > 0) ? 6 : -6;
|
||||
sPSSData->wallpaperScrollSpeed = (direction > 0) ? 6 : -6;
|
||||
sPSSData->field_2D3 = (direction > 0) ? 1 : 2;
|
||||
sPSSData->field_2D0 = 32;
|
||||
sPSSData->field_2D4 = boxId;
|
||||
@ -5288,7 +5288,7 @@ static void SetUpScrollToBox(u8 boxId)
|
||||
sPSSData->field_2DC = (direction <= 0) ? 5 : 0;
|
||||
sPSSData->field_2DE = 0;
|
||||
sPSSData->field_2E0 = 2;
|
||||
sPSSData->field_A64 = boxId;
|
||||
sPSSData->boxScrollDestination = boxId;
|
||||
sPSSData->field_A65 = direction;
|
||||
sPSSData->field_A63 = 0;
|
||||
}
|
||||
@ -5300,21 +5300,21 @@ static bool8 ScrollToBox(void)
|
||||
switch (sPSSData->field_A63)
|
||||
{
|
||||
case 0:
|
||||
LoadWallpaperGfx(sPSSData->field_A64, sPSSData->field_A65);
|
||||
LoadWallpaperGfx(sPSSData->boxScrollDestination, sPSSData->field_A65);
|
||||
sPSSData->field_A63++;
|
||||
case 1:
|
||||
if (!WaitForWallpaperGfxLoad())
|
||||
return TRUE;
|
||||
|
||||
sub_80CB4CC(sPSSData->field_A64, sPSSData->field_A65);
|
||||
sub_80CCCFC(sPSSData->field_A64, sPSSData->field_A65);
|
||||
sub_80CB4CC(sPSSData->boxScrollDestination, sPSSData->field_A65);
|
||||
sub_80CCCFC(sPSSData->boxScrollDestination, sPSSData->field_A65);
|
||||
sub_80CD0B8(sPSSData->field_A65);
|
||||
break;
|
||||
case 2:
|
||||
var = sub_80CB584();
|
||||
if (sPSSData->field_2D0 != 0)
|
||||
{
|
||||
sPSSData->bg2_X += sPSSData->field_2CE;
|
||||
sPSSData->bg2_X += sPSSData->wallpaperScrollSpeed;
|
||||
if (--sPSSData->field_2D0 != 0)
|
||||
return TRUE;
|
||||
sub_80CCEE0();
|
||||
@ -5327,7 +5327,7 @@ static bool8 ScrollToBox(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static s8 sub_80CC644(u8 boxId)
|
||||
static s8 DetermineBoxScrollDirection(u8 boxId)
|
||||
{
|
||||
u8 i;
|
||||
u8 currentBox = StorageGetCurrentBox();
|
||||
@ -5735,7 +5735,7 @@ static void sub_80CD210(struct Sprite *sprite)
|
||||
sprite->data[0] = 3;
|
||||
break;
|
||||
case 3:
|
||||
sprite->pos1.x -= sPSSData->field_2CE;
|
||||
sprite->pos1.x -= sPSSData->wallpaperScrollSpeed;
|
||||
if (sprite->pos1.x < 73 || sprite->pos1.x > 247)
|
||||
sprite->invisible = TRUE;
|
||||
if (--sprite->data[1] == 0)
|
||||
@ -5746,7 +5746,7 @@ static void sub_80CD210(struct Sprite *sprite)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
sprite->pos1.x -= sPSSData->field_2CE;
|
||||
sprite->pos1.x -= sPSSData->wallpaperScrollSpeed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -6632,21 +6632,21 @@ static void sub_80CE7E8(void)
|
||||
sPSSData->field_218C.mon = &gUnknown_02039D14;
|
||||
sPSSData->field_2187 = 0;
|
||||
sPSSData->field_2186 = 0;
|
||||
sPSSData->field_2188 = 0;
|
||||
sPSSData->pokemonSummaryScreenMode = PSS_MODE_NORMAL;
|
||||
}
|
||||
else if (sBoxCursorArea == CURSOR_AREA_IN_PARTY)
|
||||
{
|
||||
sPSSData->field_218C.mon = gPlayerParty;
|
||||
sPSSData->field_2187 = sBoxCursorPosition;
|
||||
sPSSData->field_2186 = CountPartyMons() - 1;
|
||||
sPSSData->field_2188 = 0;
|
||||
sPSSData->pokemonSummaryScreenMode = PSS_MODE_NORMAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
sPSSData->field_218C.box = GetBoxedMonPtr(StorageGetCurrentBox(), 0);
|
||||
sPSSData->field_2187 = sBoxCursorPosition;
|
||||
sPSSData->field_2186 = IN_BOX_COUNT - 1;
|
||||
sPSSData->field_2188 = 2;
|
||||
sPSSData->pokemonSummaryScreenMode = PSS_MODE_BOX;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user