diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/battle_script_commands.c | 2 | ||||
-rw-r--r-- | src/battle_setup.c | 2 | ||||
-rw-r--r-- | src/clock.c | 2 | ||||
-rw-r--r-- | src/credits.c | 2 | ||||
-rw-r--r-- | src/data/heal_locations.h | 25 | ||||
-rw-r--r-- | src/data/text/move_descriptions.h | 714 | ||||
-rw-r--r-- | src/data/text/move_names.h | 3 | ||||
-rw-r--r-- | src/field_region_map.c | 2 | ||||
-rw-r--r-- | src/field_special_scene.c | 2 | ||||
-rw-r--r-- | src/field_specials.c | 4329 | ||||
-rw-r--r-- | src/heal_location.c | 74 | ||||
-rw-r--r-- | src/main_menu.c | 2 | ||||
-rw-r--r-- | src/match_call.c | 4 | ||||
-rw-r--r-- | src/menu.c | 3 | ||||
-rw-r--r-- | src/overworld.c | 6 | ||||
-rw-r--r-- | src/pokemon.c | 6 | ||||
-rw-r--r-- | src/pokemon_summary_screen.c | 5 | ||||
-rw-r--r-- | src/region_map.c | 112 | ||||
-rw-r--r-- | src/rotating_gate.c | 6 | ||||
-rw-r--r-- | src/scrcmd.c | 2 | ||||
-rw-r--r-- | src/wallclock.c | 4 |
21 files changed, 5164 insertions, 143 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5c0b78240..7f5a4fb48 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -7230,7 +7230,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr) PREPARE_STAT_BUFFER(gBattleTextBuff1, statId) - if ((statValue << 0x18) < 0) // stat decrease + if (statValue <= -1) // Stat decrease. { if (gSideTimers[GET_BATTLER_SIDE(gActiveBattler)].mistTimer && !certain && gCurrentMove != MOVE_CURSE) diff --git a/src/battle_setup.c b/src/battle_setup.c index e478af936..2955a33fc 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -900,7 +900,7 @@ static void CB2_GiveStarter(void) { u16 starterMon; - *GetVarPointer(VAR_FIRST_POKE) = gSpecialVar_Result; + *GetVarPointer(VAR_STARTER_MON) = gSpecialVar_Result; starterMon = GetStarterPokemon(gSpecialVar_Result); ScriptGiveMon(starterMon, 5, 0, 0, 0, 0); ResetTasks(); diff --git a/src/clock.c b/src/clock.c index ccbb0c24b..91eb5f16d 100644 --- a/src/clock.c +++ b/src/clock.c @@ -88,6 +88,6 @@ static void ReturnFromStartWallClock(void) void StartWallClock(void) { - SetMainCallback2(Cb2_StartWallClock); + SetMainCallback2(CB2_StartWallClock); gMain.savedCallback = ReturnFromStartWallClock; } diff --git a/src/credits.c b/src/credits.c index 168f3e8a3..a88e4b549 100644 --- a/src/credits.c +++ b/src/credits.c @@ -2285,7 +2285,7 @@ static void sub_81772B8(struct Sprite *sprite) static void sub_8177388(void) { - u16 starter = SpeciesToNationalPokedexNum(GetStarterPokemon(VarGet(VAR_FIRST_POKE))); + u16 starter = SpeciesToNationalPokedexNum(GetStarterPokemon(VarGet(VAR_STARTER_MON))); u16 page; u16 dexNum; u16 j; diff --git a/src/data/heal_locations.h b/src/data/heal_locations.h new file mode 100644 index 000000000..613bcebe8 --- /dev/null +++ b/src/data/heal_locations.h @@ -0,0 +1,25 @@ +static const struct HealLocation sHealLocations[] = +{ + {MAP_GROUP(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), MAP_NUM(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F), 4, 2}, + {MAP_GROUP(LITTLEROOT_TOWN_MAYS_HOUSE_2F), MAP_NUM(LITTLEROOT_TOWN_MAYS_HOUSE_2F), 4, 2}, + {MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), 20, 17}, + {MAP_GROUP(SLATEPORT_CITY), MAP_NUM(SLATEPORT_CITY), 19, 20}, + {MAP_GROUP(MAUVILLE_CITY), MAP_NUM(MAUVILLE_CITY), 22, 6}, + {MAP_GROUP(RUSTBORO_CITY), MAP_NUM(RUSTBORO_CITY), 16, 39}, + {MAP_GROUP(FORTREE_CITY), MAP_NUM(FORTREE_CITY), 5, 7}, + {MAP_GROUP(LILYCOVE_CITY), MAP_NUM(LILYCOVE_CITY), 24, 15}, + {MAP_GROUP(MOSSDEEP_CITY), MAP_NUM(MOSSDEEP_CITY), 28, 17}, + {MAP_GROUP(SOOTOPOLIS_CITY), MAP_NUM(SOOTOPOLIS_CITY), 43, 32}, + {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 27, 49}, + {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), 5, 9}, + {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), 14, 9}, + {MAP_GROUP(OLDALE_TOWN), MAP_NUM(OLDALE_TOWN), 6, 17}, + {MAP_GROUP(DEWFORD_TOWN), MAP_NUM(DEWFORD_TOWN), 2, 11}, + {MAP_GROUP(LAVARIDGE_TOWN), MAP_NUM(LAVARIDGE_TOWN), 9, 7}, + {MAP_GROUP(FALLARBOR_TOWN), MAP_NUM(FALLARBOR_TOWN), 14, 8}, + {MAP_GROUP(VERDANTURF_TOWN), MAP_NUM(VERDANTURF_TOWN), 16, 4}, + {MAP_GROUP(PACIFIDLOG_TOWN), MAP_NUM(PACIFIDLOG_TOWN), 8, 16}, + {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 18, 6}, + {MAP_GROUP(SOUTHERN_ISLAND_EXTERIOR), MAP_NUM(SOUTHERN_ISLAND_EXTERIOR), 15, 20}, + {MAP_GROUP(BATTLE_FRONTIER_OUTSIDE_EAST), MAP_NUM(BATTLE_FRONTIER_OUTSIDE_EAST), 3, 52}, +}; diff --git a/src/data/text/move_descriptions.h b/src/data/text/move_descriptions.h new file mode 100644 index 000000000..f8830c593 --- /dev/null +++ b/src/data/text/move_descriptions.h @@ -0,0 +1,714 @@ +static const u8 sNullMoveDescription[] = _(""); +static const u8 sPoundMoveDescription[] = _("Pounds the foe with\nforelegs or tail."); +static const u8 sKarateChopMoveDescription[] = _("A chopping attack with a\nhigh critical-hit ratio."); +static const u8 sDoubleSlapMoveDescription[] = _("Repeatedly slaps the foe\n2 to 5 times."); +static const u8 sCometPunchMoveDescription[] = _("Repeatedly punches the foe\n2 to 5 times."); +static const u8 sMegaPunchMoveDescription[] = _("A strong punch thrown with\nincredible power."); +static const u8 sPayDayMoveDescription[] = _("Throws coins at the foe.\nMoney is recovered after."); +static const u8 sFirePunchMoveDescription[] = _("A fiery punch that may burn\nthe foe."); +static const u8 sIcePunchMoveDescription[] = _("An icy punch that may\nfreeze the foe."); +static const u8 sThunderPunchMoveDescription[] = _("An electrified punch that\nmay paralyze the foe."); +static const u8 sScratchMoveDescription[] = _("Scratches the foe with\nsharp claws."); +static const u8 sViceGripMoveDescription[] = _("Grips the foe with large and\npowerful pincers."); +static const u8 sGuillotineMoveDescription[] = _("A powerful pincer attack\nthat may cause fainting."); +static const u8 sRazorWindMoveDescription[] = _("A 2-turn move that strikes\nthe foe on the 2nd turn."); +static const u8 sSwordsDanceMoveDescription[] = _("A fighting dance that\nsharply raises ATTACK."); +static const u8 sCutMoveDescription[] = _("Cuts the foe with sharp\nscythes, claws, etc."); +static const u8 sGustMoveDescription[] = _("Strikes the foe with a gust\nof wind whipped up by wings."); +static const u8 sWingAttackMoveDescription[] = _("Strikes the foe with wings\nspread wide."); +static const u8 sWhirlwindMoveDescription[] = _("Blows away the foe with\nwind and ends the battle."); +static const u8 sFlyMoveDescription[] = _("Flies up on the first turn,\nthen strikes the next turn."); +static const u8 sBindMoveDescription[] = _("Binds and squeezes the foe\nfor 2 to 5 turns."); +static const u8 sSlamMoveDescription[] = _("Slams the foe with a long\ntail, vine, etc."); +static const u8 sVineWhipMoveDescription[] = _("Strikes the foe with\nslender, whiplike vines."); +static const u8 sStompMoveDescription[] = _("Stomps the enemy with a big\nfoot. May cause flinching."); +static const u8 sDoubleKickMoveDescription[] = _("A double-kicking attack\nthat strikes the foe twice."); +static const u8 sMegaKickMoveDescription[] = _("An extremely powerful kick\nwith intense force."); +static const u8 sJumpKickMoveDescription[] = _("A strong jumping kick. May\nmiss and hurt the kicker."); +static const u8 sRollingKickMoveDescription[] = _("A fast kick delivered from\na rapid spin."); +static const u8 sSandAttackMoveDescription[] = _("Reduces the foe’s accuracy\nby hurling sand in its face."); +static const u8 sHeadbuttMoveDescription[] = _("A ramming attack that may\ncause flinching."); +static const u8 sHornAttackMoveDescription[] = _("Jabs the foe with sharp\nhorns."); +static const u8 sFuryAttackMoveDescription[] = _("Jabs the foe 2 to 5 times\nwith sharp horns, etc."); +static const u8 sHornDrillMoveDescription[] = _("A one-hit KO attack that\nuses a horn like a drill."); +static const u8 sTackleMoveDescription[] = _("Charges the foe with a full-\nbody tackle."); +static const u8 sBodySlamMoveDescription[] = _("A full-body slam that may\ncause paralysis."); +static const u8 sWrapMoveDescription[] = _("Wraps and squeezes the foe\n2 to 5 times with vines, etc."); +static const u8 sTakeDownMoveDescription[] = _("A reckless charge attack\nthat also hurts the user."); +static const u8 sThrashMoveDescription[] = _("A rampage of 2 to 3 turns\nthat confuses the user."); +static const u8 sDoubleEdgeMoveDescription[] = _("A life-risking tackle that\nalso hurts the user."); +static const u8 sTailWhipMoveDescription[] = _("Wags the tail to lower the\nfoe’s DEFENSE."); +static const u8 sPoisonStingMoveDescription[] = _("A toxic attack with barbs,\netc., that may poison."); +static const u8 sTwineedleMoveDescription[] = _("Stingers on the forelegs\njab the foe twice."); +static const u8 sPinMissileMoveDescription[] = _("Sharp pins are fired to\nstrike 2 to 5 times."); +static const u8 sLeerMoveDescription[] = _("Frightens the foe with a\nleer to lower DEFENSE."); +static const u8 sBiteMoveDescription[] = _("Bites with vicious fangs.\nMay cause flinching."); +static const u8 sGrowlMoveDescription[] = _("Growls cutely to reduce the\nfoe’s ATTACK."); +static const u8 sRoarMoveDescription[] = _("Makes the foe flee to end\nthe battle."); +static const u8 sSingMoveDescription[] = _("A soothing song lulls the\nfoe into a deep slumber."); +static const u8 sSupersonicMoveDescription[] = _("Emits bizarre sound waves\nthat may confuse the foe."); +static const u8 sSonicBoomMoveDescription[] = _("Launches shock waves that\nalways inflict 20 HP damage."); +static const u8 sDisableMoveDescription[] = _("Psychically disables one of\nthe foe’s moves."); +static const u8 sAcidMoveDescription[] = _("Sprays a hide-melting acid.\nMay lower DEFENSE."); +static const u8 sEmberMoveDescription[] = _("A weak fire attack that may\ninflict a burn."); +static const u8 sFlamethrowerMoveDescription[] = _("A powerful fire attack that\nmay inflict a burn."); +static const u8 sMistMoveDescription[] = _("Creates a mist that stops\nreduction of abilities."); +static const u8 sWaterGunMoveDescription[] = _("Squirts water to attack\nthe foe."); +static const u8 sHydroPumpMoveDescription[] = _("Blasts water at high power\nto strike the foe."); +static const u8 sSurfMoveDescription[] = _("Creates a huge wave, then\ncrashes it down on the foe."); +static const u8 sIceBeamMoveDescription[] = _("Blasts the foe with an icy\nbeam that may freeze it."); +static const u8 sBlizzardMoveDescription[] = _("Hits the foe with an icy\nstorm that may freeze it."); +static const u8 sPsybeamMoveDescription[] = _("Fires a peculiar ray that\nmay confuse the foe."); +static const u8 sBubbleBeamMoveDescription[] = _("Forcefully sprays bubbles\nthat may lower SPEED."); +static const u8 sAuroraBeamMoveDescription[] = _("Fires a rainbow-colored\nbeam that may lower ATTACK."); +static const u8 sHyperBeamMoveDescription[] = _("Powerful, but leaves the\nuser immobile the next turn."); +static const u8 sPeckMoveDescription[] = _("Attacks the foe with a\njabbing beak, etc."); +static const u8 sDrillPeckMoveDescription[] = _("A corkscrewing attack with\nthe beak acting as a drill."); +static const u8 sSubmissionMoveDescription[] = _("A reckless body slam that\nalso hurts the user."); +static const u8 sLowKickMoveDescription[] = _("A kick that inflicts more\ndamage on heavier foes."); +static const u8 sCounterMoveDescription[] = _("Retaliates any physical hit\nwith double the power."); +static const u8 sSeismicTossMoveDescription[] = _("Inflicts damage identical\nto the user’s level."); +static const u8 sStrengthMoveDescription[] = _("Builds enormous power,\nthen slams the foe."); +static const u8 sAbsorbMoveDescription[] = _("An attack that absorbs\nhalf the damage inflicted."); +static const u8 sMegaDrainMoveDescription[] = _("An attack that absorbs\nhalf the damage inflicted."); +static const u8 sLeechSeedMoveDescription[] = _("Plants a seed on the foe to\nsteal HP on every turn."); +static const u8 sGrowthMoveDescription[] = _("Forces the body to grow\nand heightens SP. ATK."); +static const u8 sRazorLeafMoveDescription[] = _("Cuts the enemy with leaves.\nHigh critical-hit ratio."); +static const u8 sSolarBeamMoveDescription[] = _("Absorbs light in one turn,\nthen attacks next turn."); +static const u8 sPoisonPowderMoveDescription[] = _("Scatters a toxic powder\nthat may poison the foe."); +static const u8 sStunSporeMoveDescription[] = _("Scatters a powder that may\nparalyze the foe."); +static const u8 sSleepPowderMoveDescription[] = _("Scatters a powder that may\ncause the foe to sleep."); +static const u8 sPetalDanceMoveDescription[] = _("A rampage of 2 to 3 turns\nthat confuses the user."); +static const u8 sStringShotMoveDescription[] = _("Binds the foe with string\nto reduce its SPEED."); +static const u8 sDragonRageMoveDescription[] = _("Launches shock waves that\nalways inflict 40 HP damage."); +static const u8 sFireSpinMoveDescription[] = _("Traps the foe in a ring of\nfire for 2 to 5 turns."); +static const u8 sThunderShockMoveDescription[] = _("An electrical attack that\nmay paralyze the foe."); +static const u8 sThunderboltMoveDescription[] = _("A strong electrical attack\nthat may paralyze the foe."); +static const u8 sThunderWaveMoveDescription[] = _("A weak jolt of electricity\nthat paralyzes the foe."); +static const u8 sThunderMoveDescription[] = _("A lightning attack that may\ncause paralysis."); +static const u8 sRockThrowMoveDescription[] = _("Throws small rocks to\nstrike the foe."); +static const u8 sEarthquakeMoveDescription[] = _("A powerful quake, but has\nno effect on flying foes."); +static const u8 sFissureMoveDescription[] = _("A one-hit KO move that\ndrops the foe in a fissure."); +static const u8 sDigMoveDescription[] = _("Digs underground the first\nturn and strikes next turn."); +static const u8 sToxicMoveDescription[] = _("Poisons the foe with an\nintensifying toxin."); +static const u8 sConfusionMoveDescription[] = _("A psychic attack that may\ncause confusion."); +static const u8 sPsychicMoveDescription[] = _("A powerful psychic attack\nthat may lower SP. DEF."); +static const u8 sHypnosisMoveDescription[] = _("A hypnotizing move that\nmay induce sleep."); +static const u8 sMeditateMoveDescription[] = _("Meditates in a peaceful\nfashion to raise ATTACK."); +static const u8 sAgilityMoveDescription[] = _("Relaxes the body to sharply\nboost SPEED."); +static const u8 sQuickAttackMoveDescription[] = _("An extremely fast attack\nthat always strikes first."); +static const u8 sRageMoveDescription[] = _("Raises the user’s ATTACK\nevery time it is hit."); +static const u8 sTeleportMoveDescription[] = _("A psychic move for fleeing\nfrom battle instantly."); +static const u8 sNightShadeMoveDescription[] = _("Inflicts damage identical\nto the user’s level."); +static const u8 sMimicMoveDescription[] = _("Copies a move used by the\nfoe during one battle."); +static const u8 sScreechMoveDescription[] = _("Emits a screech to sharply\nreduce the foe’s DEFENSE."); +static const u8 sDoubleTeamMoveDescription[] = _("Creates illusory copies to\nraise evasiveness."); +static const u8 sRecoverMoveDescription[] = _("Recovers up to half the\nuser’s maximum HP."); +static const u8 sHardenMoveDescription[] = _("Stiffens the body’s \nmuscles to raise DEFENSE."); +static const u8 sMinimizeMoveDescription[] = _("Minimizes the user’s size\nto raise evasiveness."); +static const u8 sSmokescreenMoveDescription[] = _("Lowers the foe’s accuracy\nusing smoke, ink, etc."); +static const u8 sConfuseRayMoveDescription[] = _("A sinister ray that\nconfuses the foe."); +static const u8 sWithdrawMoveDescription[] = _("Withdraws the body into its\nhard shell to raise DEFENSE."); +static const u8 sDefenseCurlMoveDescription[] = _("Curls up to conceal weak\nspots and raise DEFENSE."); +static const u8 sBarrierMoveDescription[] = _("Creates a barrier that\nsharply raises DEFENSE."); +static const u8 sLightScreenMoveDescription[] = _("Creates a wall of light that\nlowers SP. ATK damage."); +static const u8 sHazeMoveDescription[] = _("Creates a black haze that\neliminates all stat changes."); +static const u8 sReflectMoveDescription[] = _("Creates a wall of light that\nweakens physical attacks."); +static const u8 sFocusEnergyMoveDescription[] = _("Focuses power to raise the\ncritical-hit ratio."); +static const u8 sBideMoveDescription[] = _("Endures attack for 2\nturns to retaliate double."); +static const u8 sMetronomeMoveDescription[] = _("Waggles a finger to use any\nPOKéMON move at random."); +static const u8 sMirrorMoveMoveDescription[] = _("Counters the foe’s attack\nwith the same move."); +static const u8 sSelfDestructMoveDescription[] = _("Inflicts severe damage but\nmakes the user faint."); +static const u8 sEggBombMoveDescription[] = _("An egg is forcibly hurled at\nthe foe."); +static const u8 sLickMoveDescription[] = _("Licks with a long tongue to\ninjure. May also paralyze."); +static const u8 sSmogMoveDescription[] = _("An exhaust-gas attack\nthat may also poison."); +static const u8 sSludgeMoveDescription[] = _("Sludge is hurled to inflict\ndamage. May also poison."); +static const u8 sBoneClubMoveDescription[] = _("Clubs the foe with a bone.\nMay cause flinching."); +static const u8 sFireBlastMoveDescription[] = _("Incinerates everything it\nstrikes. May cause a burn."); +static const u8 sWaterfallMoveDescription[] = _("Charges the foe with speed\nto climb waterfalls."); +static const u8 sClampMoveDescription[] = _("Traps and squeezes the\nfoe for 2 to 5 turns."); +static const u8 sSwiftMoveDescription[] = _("Sprays star-shaped rays\nthat never miss."); +static const u8 sSkullBashMoveDescription[] = _("Tucks in the head, then\nattacks on the next turn."); +static const u8 sSpikeCannonMoveDescription[] = _("Launches sharp spikes that\nstrike 2 to 5 times."); +static const u8 sConstrictMoveDescription[] = _("Constricts to inflict pain.\nMay lower SPEED."); +static const u8 sAmnesiaMoveDescription[] = _("Forgets about something\nand sharply raises SP. DEF."); +static const u8 sKinesisMoveDescription[] = _("Distracts the foe.\nMay lower accuracy."); +static const u8 sSoftBoiledMoveDescription[] = _("Recovers up to half the\nuser’s maximum HP."); +static const u8 sHiJumpKickMoveDescription[] = _("A jumping knee kick. If it\nmisses, the user is hurt."); +static const u8 sGlareMoveDescription[] = _("Intimidates and frightens\nthe foe into paralysis."); +static const u8 sDreamEaterMoveDescription[] = _("Takes one half the damage\ninflicted on a sleeping foe."); +static const u8 sPoisonGasMoveDescription[] = _("Envelops the foe in a toxic\ngas that may poison."); +static const u8 sBarrageMoveDescription[] = _("Hurls round objects at the\nfoe 2 to 5 times."); +static const u8 sLeechLifeMoveDescription[] = _("An attack that steals half\nthe damage inflicted."); +static const u8 sLovelyKissMoveDescription[] = _("Demands a kiss with a scary\nface that induces sleep."); +static const u8 sSkyAttackMoveDescription[] = _("Searches out weak spots,\nthen strikes the next turn."); +static const u8 sTransformMoveDescription[] = _("Alters the user’s cells to\nbecome a copy of the foe."); +static const u8 sBubbleMoveDescription[] = _("An attack using bubbles.\nMay lower the foe’s SPEED."); +static const u8 sDizzyPunchMoveDescription[] = _("A rhythmic punch that may\nconfuse the foe."); +static const u8 sSporeMoveDescription[] = _("Scatters a cloud of spores\nthat always induce sleep."); +static const u8 sFlashMoveDescription[] = _("Looses a powerful blast of\nlight that cuts accuracy."); +static const u8 sPsywaveMoveDescription[] = _("Attacks with a psychic\nwave of varying intensity."); +static const u8 sSplashMoveDescription[] = _("It’s just a splash...\nHas no effect whatsoever."); +static const u8 sAcidArmorMoveDescription[] = _("Liquifies the user’s body\nto sharply raise DEFENSE."); +static const u8 sCrabhammerMoveDescription[] = _("Hammers with a pincer. Has a\nhigh critical-hit ratio."); +static const u8 sExplosionMoveDescription[] = _("Inflicts severe damage but\nmakes the user faint."); +static const u8 sFurySwipesMoveDescription[] = _("Rakes the foe with sharp\nclaws, etc., 2 to 5 times."); +static const u8 sBonemerangMoveDescription[] = _("Throws a bone boomerang\nthat strikes twice."); +static const u8 sRestMoveDescription[] = _("The user sleeps for 2 turns,\nrestoring HP and status."); +static const u8 sRockSlideMoveDescription[] = _("Large boulders are hurled.\nMay cause flinching."); +static const u8 sHyperFangMoveDescription[] = _("Attacks with sharp fangs.\nMay cause flinching."); +static const u8 sSharpenMoveDescription[] = _("Reduces the polygon count\nand raises ATTACK."); +static const u8 sConversionMoveDescription[] = _("Changes the user’s type\ninto a known move’s type."); +static const u8 sTriAttackMoveDescription[] = _("Fires three types of beams\nat the same time."); +static const u8 sSuperFangMoveDescription[] = _("Attacks with sharp fangs\nand cuts half the foe’s HP."); +static const u8 sSlashMoveDescription[] = _("Slashes with claws, etc. Has\na high critical-hit ratio."); +static const u8 sSubstituteMoveDescription[] = _("Creates a decoy using 1/4\nof the user’s maximum HP."); +static const u8 sStruggleMoveDescription[] = _("Used only if all PP are gone.\nAlso hurts the user a little."); +static const u8 sSketchMoveDescription[] = _("Copies the foe’s last move\npermanently."); +static const u8 sTripleKickMoveDescription[] = _("Kicks the foe 3 times in a\nrow with rising intensity."); +static const u8 sThiefMoveDescription[] = _("While attacking, it may\nsteal the foe’s held item."); +static const u8 sSpiderWebMoveDescription[] = _("Ensnares the foe to stop it\nfrom fleeing or switching."); +static const u8 sMindReaderMoveDescription[] = _("Senses the foe’s action to\nensure the next move’s hit."); +static const u8 sNightmareMoveDescription[] = _("Inflicts 1/4 damage on a\nsleeping foe every turn."); +static const u8 sFlameWheelMoveDescription[] = _("A fiery charge attack that\nmay inflict a burn."); +static const u8 sSnoreMoveDescription[] = _("A loud attack that can be\nused only while asleep."); +static const u8 sCurseMoveDescription[] = _("A move that functions\ndifferently for GHOSTS."); +static const u8 sFlailMoveDescription[] = _("Inflicts more damage when\nthe user’s HP is down."); +static const u8 sConversion2MoveDescription[] = _("Makes the user resistant\nto the last attack’s type."); +static const u8 sAeroblastMoveDescription[] = _("Launches a vacuumed blast.\nHigh critical-hit ratio."); +static const u8 sCottonSporeMoveDescription[] = _("Spores cling to the foe,\nsharply reducing SPEED."); +static const u8 sReversalMoveDescription[] = _("Inflicts more damage when\nthe user’s HP is down."); +static const u8 sSpiteMoveDescription[] = _("Spitefully cuts the PP\nof the foe’s last move."); +static const u8 sPowderSnowMoveDescription[] = _("Blasts the foe with a snowy\ngust. May cause freezing."); +static const u8 sProtectMoveDescription[] = _("Evades attack, but may fail\nif used in succession."); +static const u8 sMachPunchMoveDescription[] = _("A punch is thrown at wicked\nspeed to strike first."); +static const u8 sScaryFaceMoveDescription[] = _("Frightens with a scary face\nto sharply reduce SPEED."); +static const u8 sFaintAttackMoveDescription[] = _("Draws the foe close, then\nstrikes without fail."); +static const u8 sSweetKissMoveDescription[] = _("Demands a kiss with a cute\nlook. May cause confusion."); +static const u8 sBellyDrumMoveDescription[] = _("Maximizes ATTACK while\nsacrificing HP."); +static const u8 sSludgeBombMoveDescription[] = _("Sludge is hurled to inflict\ndamage. May also poison."); +static const u8 sMudSlapMoveDescription[] = _("Hurls mud in the foe’s face\nto reduce its accuracy."); +static const u8 sOctazookaMoveDescription[] = _("Fires a lump of ink to\ndamage and cut accuracy."); +static const u8 sSpikesMoveDescription[] = _("Sets spikes that hurt a \nfoe switching in."); +static const u8 sZapCannonMoveDescription[] = _("Powerful and sure to cause\nparalysis, but inaccurate."); +static const u8 sForesightMoveDescription[] = _("Negates the foe’s efforts\nto heighten evasiveness."); +static const u8 sDestinyBondMoveDescription[] = _("If the user faints, the foe\nis also made to faint."); +static const u8 sPerishSongMoveDescription[] = _("Any POKéMON hearing this\nsong faints in 3 turns."); +static const u8 sIcyWindMoveDescription[] = _("A chilling attack that\nlowers the foe’s SPEED."); +static const u8 sDetectMoveDescription[] = _("Evades attack, but may fail\nif used in succession."); +static const u8 sBoneRushMoveDescription[] = _("Strikes the foe with a bone\nin hand 2 to 5 times."); +static const u8 sLockOnMoveDescription[] = _("Locks on to the foe to\nensure the next move hits."); +static const u8 sOutrageMoveDescription[] = _("A rampage of 2 to 3 turns\nthat confuses the user."); +static const u8 sSandstormMoveDescription[] = _("Causes a sandstorm that\nrages for several turns."); +static const u8 sGigaDrainMoveDescription[] = _("An attack that steals half\nthe damage inflicted."); +static const u8 sEndureMoveDescription[] = _("Endures any attack for\n1 turn, leaving at least 1HP."); +static const u8 sCharmMoveDescription[] = _("Charms the foe and sharply\nreduces its ATTACK."); +static const u8 sRolloutMoveDescription[] = _("An attack lasting 5 turns\nwith rising intensity."); +static const u8 sFalseSwipeMoveDescription[] = _("An attack that leaves the\nfoe with at least 1 HP."); +static const u8 sSwaggerMoveDescription[] = _("Confuses the foe, but also\nsharply raises ATTACK."); +static const u8 sMilkDrinkMoveDescription[] = _("Recovers up to half the\nuser’s maximum HP."); +static const u8 sSparkMoveDescription[] = _("An electrified tackle that\nmay paralyze the foe."); +static const u8 sFuryCutterMoveDescription[] = _("An attack that intensifies\non each successive hit."); +static const u8 sSteelWingMoveDescription[] = _("Strikes the foe with hard\nwings spread wide."); +static const u8 sMeanLookMoveDescription[] = _("Fixes the foe with a mean\nlook that prevents escape."); +static const u8 sAttractMoveDescription[] = _("Makes the opposite gender\nless likely to attack."); +static const u8 sSleepTalkMoveDescription[] = _("Uses an available move\nrandomly while asleep."); +static const u8 sHealBellMoveDescription[] = _("Chimes soothingly to heal\nall status abnormalities."); +static const u8 sReturnMoveDescription[] = _("An attack that increases\nin power with friendship."); +static const u8 sPresentMoveDescription[] = _("A gift in the form of a\nbomb. May restore HP."); +static const u8 sFrustrationMoveDescription[] = _("An attack that is stronger\nif the TRAINER is disliked."); +static const u8 sSafeguardMoveDescription[] = _("A mystical force prevents\nall status problems."); +static const u8 sPainSplitMoveDescription[] = _("Adds the user and foe’s HP,\nthen shares them equally."); +static const u8 sSacredFireMoveDescription[] = _("A mystical fire attack that\nmay inflict a burn."); +static const u8 sMagnitudeMoveDescription[] = _("A ground-shaking attack\nof random intensity."); +static const u8 sDynamicPunchMoveDescription[] = _("Powerful and sure to cause\nconfusion, but inaccurate."); +static const u8 sMegahornMoveDescription[] = _("A brutal ramming attack\nusing out-thrust horns."); +static const u8 sDragonBreathMoveDescription[] = _("Strikes the foe with an\nincredible blast of breath."); +static const u8 sBatonPassMoveDescription[] = _("Switches out the user while\nkeeping effects in play."); +static const u8 sEncoreMoveDescription[] = _("Makes the foe repeat its\nlast move over 2 to 6 turns."); +static const u8 sPursuitMoveDescription[] = _("Inflicts bad damage if used\non a foe switching out."); +static const u8 sRapidSpinMoveDescription[] = _("Spins the body at high\nspeed to strike the foe."); +static const u8 sSweetScentMoveDescription[] = _("Allures the foe to reduce\nevasiveness."); +static const u8 sIronTailMoveDescription[] = _("Attacks with a rock-hard\ntail. May lower DEFENSE."); +static const u8 sMetalClawMoveDescription[] = _("A claw attack that may\nraise the user’s ATTACK."); +static const u8 sVitalThrowMoveDescription[] = _("Makes the user’s move last,\nbut it never misses."); +static const u8 sMorningSunMoveDescription[] = _("Restores HP. The amount\nvaries with the weather."); +static const u8 sSynthesisMoveDescription[] = _("Restores HP. The amount\nvaries with the weather."); +static const u8 sMoonlightMoveDescription[] = _("Restores HP. The amount\nvaries with the weather."); +static const u8 sHiddenPowerMoveDescription[] = _("The effectiveness varies\nwith the user."); +static const u8 sCrossChopMoveDescription[] = _("A double-chopping attack.\nHigh critical-hit ratio."); +static const u8 sTwisterMoveDescription[] = _("Whips up a vicious twister\nto tear at the foe."); +static const u8 sRainDanceMoveDescription[] = _("Boosts the power of WATER-\ntype moves for 5 turns."); +static const u8 sSunnyDayMoveDescription[] = _("Boosts the power of FIRE-\ntype moves for 5 turns."); +static const u8 sCrunchMoveDescription[] = _("Crunches with sharp fangs.\nMay lower SP. DEF."); +static const u8 sMirrorCoatMoveDescription[] = _("Counters the foe’s special\nattack at double the power."); +static const u8 sPsychUpMoveDescription[] = _("Copies the foe’s effect(s)\nand gives to the user."); +static const u8 sExtremeSpeedMoveDescription[] = _("An extremely fast and\npowerful attack."); +static const u8 sAncientPowerMoveDescription[] = _("An attack that may raise\nall stats."); +static const u8 sShadowBallMoveDescription[] = _("Hurls a black blob that may\nlower the foe’s SP. DEF."); +static const u8 sFutureSightMoveDescription[] = _("Heightens inner power to\nstrike 2 turns later."); +static const u8 sRockSmashMoveDescription[] = _("A rock-crushing attack\nthat may lower DEFENSE."); +static const u8 sWhirlpoolMoveDescription[] = _("Traps and hurts the foe in\na whirlpool for 2 to 5 turns."); +static const u8 sBeatUpMoveDescription[] = _("Summons party POKéMON to\njoin in the attack."); +static const u8 sFakeOutMoveDescription[] = _("A 1st-turn, 1st-strike move\nthat causes flinching."); +static const u8 sUproarMoveDescription[] = _("Causes an uproar for 2 to 5\nturns and prevents sleep."); +static const u8 sStockpileMoveDescription[] = _("Charges up power for up to\n3 turns."); +static const u8 sSpitUpMoveDescription[] = _("Releases stockpiled power\n(the more the better)."); +static const u8 sSwallowMoveDescription[] = _("Absorbs stockpiled power\nand restores HP."); +static const u8 sHeatWaveMoveDescription[] = _("Exhales a hot breath on the\nfoe. May inflict a burn."); +static const u8 sHailMoveDescription[] = _("Summons a hailstorm that\nstrikes every turn."); +static const u8 sTormentMoveDescription[] = _("Torments the foe and stops\nsuccessive use of a move."); +static const u8 sFlatterMoveDescription[] = _("Confuses the foe, but\nraises its SP. ATK."); +static const u8 sWillOWispMoveDescription[] = _("Inflicts a burn on the foe\nwith intense fire."); +static const u8 sMementoMoveDescription[] = _("The user faints and lowers\nthe foe’s abilities."); +static const u8 sFacadeMoveDescription[] = _("Boosts ATTACK when burned,\nparalyzed, or poisoned."); +static const u8 sFocusPunchMoveDescription[] = _("A powerful loyalty attack.\nThe user flinches if hit."); +static const u8 sSmellingSaltMoveDescription[] = _("Powerful against paralyzed\nfoes, but also heals them."); +static const u8 sFollowMeMoveDescription[] = _("Draws attention to make\nfoes attack only the user."); +static const u8 sNaturePowerMoveDescription[] = _("The type of attack varies\ndepending on the location."); +static const u8 sChargeMoveDescription[] = _("Charges power to boost the\nelectric move used next."); +static const u8 sTauntMoveDescription[] = _("Taunts the foe into only\nusing attack moves."); +static const u8 sHelpingHandMoveDescription[] = _("Boosts the power of the\nrecipient’s moves."); +static const u8 sTrickMoveDescription[] = _("Tricks the foe into trading\nheld items."); +static const u8 sRolePlayMoveDescription[] = _("Mimics the target and\ncopies its special ability."); +static const u8 sWishMoveDescription[] = _("A wish that restores HP.\nIt takes time to work."); +static const u8 sAssistMoveDescription[] = _("Attacks randomly with one\nof the partner’s moves."); +static const u8 sIngrainMoveDescription[] = _("Lays roots that restore HP.\nThe user can’t switch out."); +static const u8 sSuperpowerMoveDescription[] = _("Boosts strength sharply,\nbut lowers abilities."); +static const u8 sMagicCoatMoveDescription[] = _("Reflects special effects\nback to the attacker."); +static const u8 sRecycleMoveDescription[] = _("Recycles a used item for\none more use."); +static const u8 sRevengeMoveDescription[] = _("An attack that gains power\nif injured by the foe."); +static const u8 sBrickBreakMoveDescription[] = _("Destroys barriers such as\nREFLECT and causes damage."); +static const u8 sYawnMoveDescription[] = _("Lulls the foe into yawning,\nthen sleeping next turn."); +static const u8 sKnockOffMoveDescription[] = _("Knocks down the foe’s held\nitem to prevent its use."); +static const u8 sEndeavorMoveDescription[] = _("Gains power if the user’s HP\nis lower than the foe’s HP."); +static const u8 sEruptionMoveDescription[] = _("The higher the user’s HP,\nthe more damage caused."); +static const u8 sSkillSwapMoveDescription[] = _("The user swaps special\nabilities with the target."); +static const u8 sImprisonMoveDescription[] = _("Prevents foes from using\nmoves known by the user."); +static const u8 sRefreshMoveDescription[] = _("Heals poisoning, paralysis,\nor a burn."); +static const u8 sGrudgeMoveDescription[] = _("If the user faints, deletes\nall PP of foe’s last move."); +static const u8 sSnatchMoveDescription[] = _("Steals the effects of the\nmove the target uses next."); +static const u8 sSecretPowerMoveDescription[] = _("An attack with effects\nthat vary by location."); +static const u8 sDiveMoveDescription[] = _("Dives underwater the first\nturn and strikes next turn."); +static const u8 sArmThrustMoveDescription[] = _("Straight-arm punches that\nstrike the foe 2 to 5 times."); +static const u8 sCamouflageMoveDescription[] = _("Alters the POKéMON’s type\ndepending on the location."); +static const u8 sTailGlowMoveDescription[] = _("Flashes a light that sharply\nraises SP. ATK."); +static const u8 sLusterPurgeMoveDescription[] = _("Attacks with a burst of\nlight. May lower SP. DEF."); +static const u8 sMistBallMoveDescription[] = _("Attacks with a flurry of\ndown. May lower SP. ATK."); +static const u8 sFeatherDanceMoveDescription[] = _("Envelops the foe with down\nto sharply reduce ATTACK."); +static const u8 sTeeterDanceMoveDescription[] = _("Confuses all POKéMON on\nthe scene."); +static const u8 sBlazeKickMoveDescription[] = _("A kick with a high critical-\nhit ratio. May cause a burn."); +static const u8 sMudSportMoveDescription[] = _("Covers the user in mud to\nraise electrical resistance."); +static const u8 sIceBallMoveDescription[] = _("A 5-turn attack that gains\npower on successive hits."); +static const u8 sNeedleArmMoveDescription[] = _("Attacks with thorny arms.\nMay cause flinching."); +static const u8 sSlackOffMoveDescription[] = _("Slacks off and restores\nhalf the maximum HP."); +static const u8 sHyperVoiceMoveDescription[] = _("A loud attack that uses\nsound waves to injure."); +static const u8 sPoisonFangMoveDescription[] = _("A sharp-fanged attack.\nMay badly poison the foe."); +static const u8 sCrushClawMoveDescription[] = _("Tears at the foe with sharp\nclaws. May lower DEFENSE."); +static const u8 sBlastBurnMoveDescription[] = _("Powerful, but leaves the\nuser immobile the next turn."); +static const u8 sHydroCannonMoveDescription[] = _("Powerful, but leaves the\nuser immobile the next turn."); +static const u8 sMeteorMashMoveDescription[] = _("Fires a meteor-like punch.\nMay raise ATTACK."); +static const u8 sAstonishMoveDescription[] = _("An attack that may shock\nthe foe into flinching."); +static const u8 sWeatherBallMoveDescription[] = _("The move’s type and power\nchange with the weather."); +static const u8 sAromatherapyMoveDescription[] = _("Heals all status problems\nwith a soothing scent."); +static const u8 sFakeTearsMoveDescription[] = _("Feigns crying to sharply\nlower the foe’s SP. DEF."); +static const u8 sAirCutterMoveDescription[] = _("Hacks with razorlike wind.\nHigh critical-hit ratio."); +static const u8 sOverheatMoveDescription[] = _("Allows a full-power attack,\nbut sharply lowers SP. ATK."); +static const u8 sOdorSleuthMoveDescription[] = _("Negates the foe’s efforts\nto heighten evasiveness."); +static const u8 sRockTombMoveDescription[] = _("Stops the foe from moving\nwith rocks and cuts SPEED."); +static const u8 sSilverWindMoveDescription[] = _("A powdery attack that may\nraise abilities."); +static const u8 sMetalSoundMoveDescription[] = _("Emits a horrible screech\nthat sharply lowers SP. DEF."); +static const u8 sGrassWhistleMoveDescription[] = _("Lulls the foe into sleep\nwith a pleasant melody."); +static const u8 sTickleMoveDescription[] = _("Makes the foe laugh to\nlower ATTACK and DEFENSE."); +static const u8 sCosmicPowerMoveDescription[] = _("Raises DEFENSE and SP. DEF\nwith a mystic power."); +static const u8 sWaterSpoutMoveDescription[] = _("Inflicts more damage if the\nuser’s HP is high."); +static const u8 sSignalBeamMoveDescription[] = _("A strange beam attack that\nmay confuse the foe."); +static const u8 sShadowPunchMoveDescription[] = _("An unavoidable punch that\nis thrown from shadows."); +static const u8 sExtrasensoryMoveDescription[] = _("Attacks with a peculiar\npower. May cause flinching."); +static const u8 sSkyUppercutMoveDescription[] = _("An uppercut thrown as if\nleaping into the sky."); +static const u8 sSandTombMoveDescription[] = _("Traps and hurts the foe in\nquicksand for 2 to 5 turns."); +static const u8 sSheerColdMoveDescription[] = _("A chilling attack that\ncauses fainting if it hits."); +static const u8 sMuddyWaterMoveDescription[] = _("Attacks with muddy water.\nMay lower accuracy."); +static const u8 sBulletSeedMoveDescription[] = _("Shoots 2 to 5 seeds in a row\nto strike the foe."); +static const u8 sAerialAceMoveDescription[] = _("An extremely speedy and\nunavoidable attack."); +static const u8 sIcicleSpearMoveDescription[] = _("Attacks the foe by firing\n2 to 5 icicles in a row."); +static const u8 sIronDefenseMoveDescription[] = _("Hardens the body’s surface\nto sharply raise DEFENSE."); +static const u8 sBlockMoveDescription[] = _("Blocks the foe’s way to\nprevent escape."); +static const u8 sHowlMoveDescription[] = _("Howls to raise the spirit\nand boosts ATTACK."); +static const u8 sDragonClawMoveDescription[] = _("Slashes the foe with sharp\nclaws."); +static const u8 sFrenzyPlantMoveDescription[] = _("Powerful, but leaves the\nuser immobile the next turn."); +static const u8 sBulkUpMoveDescription[] = _("Bulks up the body to boost\nboth ATTACK and DEFENSE."); +static const u8 sBounceMoveDescription[] = _("Bounces up, then down the\nnext turn. May paralyze."); +static const u8 sMudShotMoveDescription[] = _("Hurls mud at the foe and\nreduces SPEED."); +static const u8 sPoisonTailMoveDescription[] = _("Has a high critical-hit\nratio. May also poison."); +static const u8 sCovetMoveDescription[] = _("Cutely begs to obtain an\nitem held by the foe."); +static const u8 sVoltTackleMoveDescription[] = _("A life-risking tackle that\nslightly hurts the user."); +static const u8 sMagicalLeafMoveDescription[] = _("Attacks with a strange leaf\nthat cannot be evaded."); +static const u8 sWaterSportMoveDescription[] = _("The user becomes soaked to\nraise resistance to fire."); +static const u8 sCalmMindMoveDescription[] = _("Raises SP. ATK and SP. DEF\nby focusing the mind."); +static const u8 sLeafBladeMoveDescription[] = _("Slashes with a sharp leaf.\nHigh critical-hit ratio."); +static const u8 sDragonDanceMoveDescription[] = _("A mystical dance that ups\nATTACK and SPEED."); +static const u8 sRockBlastMoveDescription[] = _("Hurls boulders at the foe\n2 to 5 times in a row."); +static const u8 sShockWaveMoveDescription[] = _("A fast and unavoidable\nelectric attack."); +static const u8 sWaterPulseMoveDescription[] = _("Attacks with ultrasonic\nwaves. May confuse the foe."); +static const u8 sDoomDesireMoveDescription[] = _("Summons strong sunlight to\nattack 2 turns later."); +static const u8 sPsychoBoostMoveDescription[] = _("Allows a full-power attack,\nbut sharply lowers SP. ATK."); + +// MOVE_NONE is ignored in this table. Make sure to always subtract 1 before getting the right pointer. +const u8 *const gMoveDescriptionPointers[MOVES_COUNT - 1] = +{ + [MOVE_POUND - 1] = sPoundMoveDescription, + [MOVE_KARATE_CHOP - 1] = sKarateChopMoveDescription, + [MOVE_DOUBLE_SLAP - 1] = sDoubleSlapMoveDescription, + [MOVE_COMET_PUNCH - 1] = sCometPunchMoveDescription, + [MOVE_MEGA_PUNCH - 1] = sMegaPunchMoveDescription, + [MOVE_PAY_DAY - 1] = sPayDayMoveDescription, + [MOVE_FIRE_PUNCH - 1] = sFirePunchMoveDescription, + [MOVE_ICE_PUNCH - 1] = sIcePunchMoveDescription, + [MOVE_THUNDER_PUNCH - 1] = sThunderPunchMoveDescription, + [MOVE_SCRATCH - 1] = sScratchMoveDescription, + [MOVE_VICE_GRIP - 1] = sViceGripMoveDescription, + [MOVE_GUILLOTINE - 1] = sGuillotineMoveDescription, + [MOVE_RAZOR_WIND - 1] = sRazorWindMoveDescription, + [MOVE_SWORDS_DANCE - 1] = sSwordsDanceMoveDescription, + [MOVE_CUT - 1] = sCutMoveDescription, + [MOVE_GUST - 1] = sGustMoveDescription, + [MOVE_WING_ATTACK - 1] = sWingAttackMoveDescription, + [MOVE_WHIRLWIND - 1] = sWhirlwindMoveDescription, + [MOVE_FLY - 1] = sFlyMoveDescription, + [MOVE_BIND - 1] = sBindMoveDescription, + [MOVE_SLAM - 1] = sSlamMoveDescription, + [MOVE_VINE_WHIP - 1] = sVineWhipMoveDescription, + [MOVE_STOMP - 1] = sStompMoveDescription, + [MOVE_DOUBLE_KICK - 1] = sDoubleKickMoveDescription, + [MOVE_MEGA_KICK - 1] = sMegaKickMoveDescription, + [MOVE_JUMP_KICK - 1] = sJumpKickMoveDescription, + [MOVE_ROLLING_KICK - 1] = sRollingKickMoveDescription, + [MOVE_SAND_ATTACK - 1] = sSandAttackMoveDescription, + [MOVE_HEADBUTT - 1] = sHeadbuttMoveDescription, + [MOVE_HORN_ATTACK - 1] = sHornAttackMoveDescription, + [MOVE_FURY_ATTACK - 1] = sFuryAttackMoveDescription, + [MOVE_HORN_DRILL - 1] = sHornDrillMoveDescription, + [MOVE_TACKLE - 1] = sTackleMoveDescription, + [MOVE_BODY_SLAM - 1] = sBodySlamMoveDescription, + [MOVE_WRAP - 1] = sWrapMoveDescription, + [MOVE_TAKE_DOWN - 1] = sTakeDownMoveDescription, + [MOVE_THRASH - 1] = sThrashMoveDescription, + [MOVE_DOUBLE_EDGE - 1] = sDoubleEdgeMoveDescription, + [MOVE_TAIL_WHIP - 1] = sTailWhipMoveDescription, + [MOVE_POISON_STING - 1] = sPoisonStingMoveDescription, + [MOVE_TWINEEDLE - 1] = sTwineedleMoveDescription, + [MOVE_PIN_MISSILE - 1] = sPinMissileMoveDescription, + [MOVE_LEER - 1] = sLeerMoveDescription, + [MOVE_BITE - 1] = sBiteMoveDescription, + [MOVE_GROWL - 1] = sGrowlMoveDescription, + [MOVE_ROAR - 1] = sRoarMoveDescription, + [MOVE_SING - 1] = sSingMoveDescription, + [MOVE_SUPERSONIC - 1] = sSupersonicMoveDescription, + [MOVE_SONIC_BOOM - 1] = sSonicBoomMoveDescription, + [MOVE_DISABLE - 1] = sDisableMoveDescription, + [MOVE_ACID - 1] = sAcidMoveDescription, + [MOVE_EMBER - 1] = sEmberMoveDescription, + [MOVE_FLAMETHROWER - 1] = sFlamethrowerMoveDescription, + [MOVE_MIST - 1] = sMistMoveDescription, + [MOVE_WATER_GUN - 1] = sWaterGunMoveDescription, + [MOVE_HYDRO_PUMP - 1] = sHydroPumpMoveDescription, + [MOVE_SURF - 1] = sSurfMoveDescription, + [MOVE_ICE_BEAM - 1] = sIceBeamMoveDescription, + [MOVE_BLIZZARD - 1] = sBlizzardMoveDescription, + [MOVE_PSYBEAM - 1] = sPsybeamMoveDescription, + [MOVE_BUBBLE_BEAM - 1] = sBubbleBeamMoveDescription, + [MOVE_AURORA_BEAM - 1] = sAuroraBeamMoveDescription, + [MOVE_HYPER_BEAM - 1] = sHyperBeamMoveDescription, + [MOVE_PECK - 1] = sPeckMoveDescription, + [MOVE_DRILL_PECK - 1] = sDrillPeckMoveDescription, + [MOVE_SUBMISSION - 1] = sSubmissionMoveDescription, + [MOVE_LOW_KICK - 1] = sLowKickMoveDescription, + [MOVE_COUNTER - 1] = sCounterMoveDescription, + [MOVE_SEISMIC_TOSS - 1] = sSeismicTossMoveDescription, + [MOVE_STRENGTH - 1] = sStrengthMoveDescription, + [MOVE_ABSORB - 1] = sAbsorbMoveDescription, + [MOVE_MEGA_DRAIN - 1] = sMegaDrainMoveDescription, + [MOVE_LEECH_SEED - 1] = sLeechSeedMoveDescription, + [MOVE_GROWTH - 1] = sGrowthMoveDescription, + [MOVE_RAZOR_LEAF - 1] = sRazorLeafMoveDescription, + [MOVE_SOLAR_BEAM - 1] = sSolarBeamMoveDescription, + [MOVE_POISON_POWDER - 1] = sPoisonPowderMoveDescription, + [MOVE_STUN_SPORE - 1] = sStunSporeMoveDescription, + [MOVE_SLEEP_POWDER - 1] = sSleepPowderMoveDescription, + [MOVE_PETAL_DANCE - 1] = sPetalDanceMoveDescription, + [MOVE_STRING_SHOT - 1] = sStringShotMoveDescription, + [MOVE_DRAGON_RAGE - 1] = sDragonRageMoveDescription, + [MOVE_FIRE_SPIN - 1] = sFireSpinMoveDescription, + [MOVE_THUNDER_SHOCK - 1] = sThunderShockMoveDescription, + [MOVE_THUNDERBOLT - 1] = sThunderboltMoveDescription, + [MOVE_THUNDER_WAVE - 1] = sThunderWaveMoveDescription, + [MOVE_THUNDER - 1] = sThunderMoveDescription, + [MOVE_ROCK_THROW - 1] = sRockThrowMoveDescription, + [MOVE_EARTHQUAKE - 1] = sEarthquakeMoveDescription, + [MOVE_FISSURE - 1] = sFissureMoveDescription, + [MOVE_DIG - 1] = sDigMoveDescription, + [MOVE_TOXIC - 1] = sToxicMoveDescription, + [MOVE_CONFUSION - 1] = sConfusionMoveDescription, + [MOVE_PSYCHIC - 1] = sPsychicMoveDescription, + [MOVE_HYPNOSIS - 1] = sHypnosisMoveDescription, + [MOVE_MEDITATE - 1] = sMeditateMoveDescription, + [MOVE_AGILITY - 1] = sAgilityMoveDescription, + [MOVE_QUICK_ATTACK - 1] = sQuickAttackMoveDescription, + [MOVE_RAGE - 1] = sRageMoveDescription, + [MOVE_TELEPORT - 1] = sTeleportMoveDescription, + [MOVE_NIGHT_SHADE - 1] = sNightShadeMoveDescription, + [MOVE_MIMIC - 1] = sMimicMoveDescription, + [MOVE_SCREECH - 1] = sScreechMoveDescription, + [MOVE_DOUBLE_TEAM - 1] = sDoubleTeamMoveDescription, + [MOVE_RECOVER - 1] = sRecoverMoveDescription, + [MOVE_HARDEN - 1] = sHardenMoveDescription, + [MOVE_MINIMIZE - 1] = sMinimizeMoveDescription, + [MOVE_SMOKESCREEN - 1] = sSmokescreenMoveDescription, + [MOVE_CONFUSE_RAY - 1] = sConfuseRayMoveDescription, + [MOVE_WITHDRAW - 1] = sWithdrawMoveDescription, + [MOVE_DEFENSE_CURL - 1] = sDefenseCurlMoveDescription, + [MOVE_BARRIER - 1] = sBarrierMoveDescription, + [MOVE_LIGHT_SCREEN - 1] = sLightScreenMoveDescription, + [MOVE_HAZE - 1] = sHazeMoveDescription, + [MOVE_REFLECT - 1] = sReflectMoveDescription, + [MOVE_FOCUS_ENERGY - 1] = sFocusEnergyMoveDescription, + [MOVE_BIDE - 1] = sBideMoveDescription, + [MOVE_METRONOME - 1] = sMetronomeMoveDescription, + [MOVE_MIRROR_MOVE - 1] = sMirrorMoveMoveDescription, + [MOVE_SELF_DESTRUCT - 1] = sSelfDestructMoveDescription, + [MOVE_EGG_BOMB - 1] = sEggBombMoveDescription, + [MOVE_LICK - 1] = sLickMoveDescription, + [MOVE_SMOG - 1] = sSmogMoveDescription, + [MOVE_SLUDGE - 1] = sSludgeMoveDescription, + [MOVE_BONE_CLUB - 1] = sBoneClubMoveDescription, + [MOVE_FIRE_BLAST - 1] = sFireBlastMoveDescription, + [MOVE_WATERFALL - 1] = sWaterfallMoveDescription, + [MOVE_CLAMP - 1] = sClampMoveDescription, + [MOVE_SWIFT - 1] = sSwiftMoveDescription, + [MOVE_SKULL_BASH - 1] = sSkullBashMoveDescription, + [MOVE_SPIKE_CANNON - 1] = sSpikeCannonMoveDescription, + [MOVE_CONSTRICT - 1] = sConstrictMoveDescription, + [MOVE_AMNESIA - 1] = sAmnesiaMoveDescription, + [MOVE_KINESIS - 1] = sKinesisMoveDescription, + [MOVE_SOFT_BOILED - 1] = sSoftBoiledMoveDescription, + [MOVE_HI_JUMP_KICK - 1] = sHiJumpKickMoveDescription, + [MOVE_GLARE - 1] = sGlareMoveDescription, + [MOVE_DREAM_EATER - 1] = sDreamEaterMoveDescription, + [MOVE_POISON_GAS - 1] = sPoisonGasMoveDescription, + [MOVE_BARRAGE - 1] = sBarrageMoveDescription, + [MOVE_LEECH_LIFE - 1] = sLeechLifeMoveDescription, + [MOVE_LOVELY_KISS - 1] = sLovelyKissMoveDescription, + [MOVE_SKY_ATTACK - 1] = sSkyAttackMoveDescription, + [MOVE_TRANSFORM - 1] = sTransformMoveDescription, + [MOVE_BUBBLE - 1] = sBubbleMoveDescription, + [MOVE_DIZZY_PUNCH - 1] = sDizzyPunchMoveDescription, + [MOVE_SPORE - 1] = sSporeMoveDescription, + [MOVE_FLASH - 1] = sFlashMoveDescription, + [MOVE_PSYWAVE - 1] = sPsywaveMoveDescription, + [MOVE_SPLASH - 1] = sSplashMoveDescription, + [MOVE_ACID_ARMOR - 1] = sAcidArmorMoveDescription, + [MOVE_CRABHAMMER - 1] = sCrabhammerMoveDescription, + [MOVE_EXPLOSION - 1] = sExplosionMoveDescription, + [MOVE_FURY_SWIPES - 1] = sFurySwipesMoveDescription, + [MOVE_BONEMERANG - 1] = sBonemerangMoveDescription, + [MOVE_REST - 1] = sRestMoveDescription, + [MOVE_ROCK_SLIDE - 1] = sRockSlideMoveDescription, + [MOVE_HYPER_FANG - 1] = sHyperFangMoveDescription, + [MOVE_SHARPEN - 1] = sSharpenMoveDescription, + [MOVE_CONVERSION - 1] = sConversionMoveDescription, + [MOVE_TRI_ATTACK - 1] = sTriAttackMoveDescription, + [MOVE_SUPER_FANG - 1] = sSuperFangMoveDescription, + [MOVE_SLASH - 1] = sSlashMoveDescription, + [MOVE_SUBSTITUTE - 1] = sSubstituteMoveDescription, + [MOVE_STRUGGLE - 1] = sStruggleMoveDescription, + [MOVE_SKETCH - 1] = sSketchMoveDescription, + [MOVE_TRIPLE_KICK - 1] = sTripleKickMoveDescription, + [MOVE_THIEF - 1] = sThiefMoveDescription, + [MOVE_SPIDER_WEB - 1] = sSpiderWebMoveDescription, + [MOVE_MIND_READER - 1] = sMindReaderMoveDescription, + [MOVE_NIGHTMARE - 1] = sNightmareMoveDescription, + [MOVE_FLAME_WHEEL - 1] = sFlameWheelMoveDescription, + [MOVE_SNORE - 1] = sSnoreMoveDescription, + [MOVE_CURSE - 1] = sCurseMoveDescription, + [MOVE_FLAIL - 1] = sFlailMoveDescription, + [MOVE_CONVERSION_2 - 1] = sConversion2MoveDescription, + [MOVE_AEROBLAST - 1] = sAeroblastMoveDescription, + [MOVE_COTTON_SPORE - 1] = sCottonSporeMoveDescription, + [MOVE_REVERSAL - 1] = sReversalMoveDescription, + [MOVE_SPITE - 1] = sSpiteMoveDescription, + [MOVE_POWDER_SNOW - 1] = sPowderSnowMoveDescription, + [MOVE_PROTECT - 1] = sProtectMoveDescription, + [MOVE_MACH_PUNCH - 1] = sMachPunchMoveDescription, + [MOVE_SCARY_FACE - 1] = sScaryFaceMoveDescription, + [MOVE_FAINT_ATTACK - 1] = sFaintAttackMoveDescription, + [MOVE_SWEET_KISS - 1] = sSweetKissMoveDescription, + [MOVE_BELLY_DRUM - 1] = sBellyDrumMoveDescription, + [MOVE_SLUDGE_BOMB - 1] = sSludgeBombMoveDescription, + [MOVE_MUD_SLAP - 1] = sMudSlapMoveDescription, + [MOVE_OCTAZOOKA - 1] = sOctazookaMoveDescription, + [MOVE_SPIKES - 1] = sSpikesMoveDescription, + [MOVE_ZAP_CANNON - 1] = sZapCannonMoveDescription, + [MOVE_FORESIGHT - 1] = sForesightMoveDescription, + [MOVE_DESTINY_BOND - 1] = sDestinyBondMoveDescription, + [MOVE_PERISH_SONG - 1] = sPerishSongMoveDescription, + [MOVE_ICY_WIND - 1] = sIcyWindMoveDescription, + [MOVE_DETECT - 1] = sDetectMoveDescription, + [MOVE_BONE_RUSH - 1] = sBoneRushMoveDescription, + [MOVE_LOCK_ON - 1] = sLockOnMoveDescription, + [MOVE_OUTRAGE - 1] = sOutrageMoveDescription, + [MOVE_SANDSTORM - 1] = sSandstormMoveDescription, + [MOVE_GIGA_DRAIN - 1] = sGigaDrainMoveDescription, + [MOVE_ENDURE - 1] = sEndureMoveDescription, + [MOVE_CHARM - 1] = sCharmMoveDescription, + [MOVE_ROLLOUT - 1] = sRolloutMoveDescription, + [MOVE_FALSE_SWIPE - 1] = sFalseSwipeMoveDescription, + [MOVE_SWAGGER - 1] = sSwaggerMoveDescription, + [MOVE_MILK_DRINK - 1] = sMilkDrinkMoveDescription, + [MOVE_SPARK - 1] = sSparkMoveDescription, + [MOVE_FURY_CUTTER - 1] = sFuryCutterMoveDescription, + [MOVE_STEEL_WING - 1] = sSteelWingMoveDescription, + [MOVE_MEAN_LOOK - 1] = sMeanLookMoveDescription, + [MOVE_ATTRACT - 1] = sAttractMoveDescription, + [MOVE_SLEEP_TALK - 1] = sSleepTalkMoveDescription, + [MOVE_HEAL_BELL - 1] = sHealBellMoveDescription, + [MOVE_RETURN - 1] = sReturnMoveDescription, + [MOVE_PRESENT - 1] = sPresentMoveDescription, + [MOVE_FRUSTRATION - 1] = sFrustrationMoveDescription, + [MOVE_SAFEGUARD - 1] = sSafeguardMoveDescription, + [MOVE_PAIN_SPLIT - 1] = sPainSplitMoveDescription, + [MOVE_SACRED_FIRE - 1] = sSacredFireMoveDescription, + [MOVE_MAGNITUDE - 1] = sMagnitudeMoveDescription, + [MOVE_DYNAMIC_PUNCH - 1] = sDynamicPunchMoveDescription, + [MOVE_MEGAHORN - 1] = sMegahornMoveDescription, + [MOVE_DRAGON_BREATH - 1] = sDragonBreathMoveDescription, + [MOVE_BATON_PASS - 1] = sBatonPassMoveDescription, + [MOVE_ENCORE - 1] = sEncoreMoveDescription, + [MOVE_PURSUIT - 1] = sPursuitMoveDescription, + [MOVE_RAPID_SPIN - 1] = sRapidSpinMoveDescription, + [MOVE_SWEET_SCENT - 1] = sSweetScentMoveDescription, + [MOVE_IRON_TAIL - 1] = sIronTailMoveDescription, + [MOVE_METAL_CLAW - 1] = sMetalClawMoveDescription, + [MOVE_VITAL_THROW - 1] = sVitalThrowMoveDescription, + [MOVE_MORNING_SUN - 1] = sMorningSunMoveDescription, + [MOVE_SYNTHESIS - 1] = sSynthesisMoveDescription, + [MOVE_MOONLIGHT - 1] = sMoonlightMoveDescription, + [MOVE_HIDDEN_POWER - 1] = sHiddenPowerMoveDescription, + [MOVE_CROSS_CHOP - 1] = sCrossChopMoveDescription, + [MOVE_TWISTER - 1] = sTwisterMoveDescription, + [MOVE_RAIN_DANCE - 1] = sRainDanceMoveDescription, + [MOVE_SUNNY_DAY - 1] = sSunnyDayMoveDescription, + [MOVE_CRUNCH - 1] = sCrunchMoveDescription, + [MOVE_MIRROR_COAT - 1] = sMirrorCoatMoveDescription, + [MOVE_PSYCH_UP - 1] = sPsychUpMoveDescription, + [MOVE_EXTREME_SPEED - 1] = sExtremeSpeedMoveDescription, + [MOVE_ANCIENT_POWER - 1] = sAncientPowerMoveDescription, + [MOVE_SHADOW_BALL - 1] = sShadowBallMoveDescription, + [MOVE_FUTURE_SIGHT - 1] = sFutureSightMoveDescription, + [MOVE_ROCK_SMASH - 1] = sRockSmashMoveDescription, + [MOVE_WHIRLPOOL - 1] = sWhirlpoolMoveDescription, + [MOVE_BEAT_UP - 1] = sBeatUpMoveDescription, + [MOVE_FAKE_OUT - 1] = sFakeOutMoveDescription, + [MOVE_UPROAR - 1] = sUproarMoveDescription, + [MOVE_STOCKPILE - 1] = sStockpileMoveDescription, + [MOVE_SPIT_UP - 1] = sSpitUpMoveDescription, + [MOVE_SWALLOW - 1] = sSwallowMoveDescription, + [MOVE_HEAT_WAVE - 1] = sHeatWaveMoveDescription, + [MOVE_HAIL - 1] = sHailMoveDescription, + [MOVE_TORMENT - 1] = sTormentMoveDescription, + [MOVE_FLATTER - 1] = sFlatterMoveDescription, + [MOVE_WILL_O_WISP - 1] = sWillOWispMoveDescription, + [MOVE_MEMENTO - 1] = sMementoMoveDescription, + [MOVE_FACADE - 1] = sFacadeMoveDescription, + [MOVE_FOCUS_PUNCH - 1] = sFocusPunchMoveDescription, + [MOVE_SMELLING_SALT - 1] = sSmellingSaltMoveDescription, + [MOVE_FOLLOW_ME - 1] = sFollowMeMoveDescription, + [MOVE_NATURE_POWER - 1] = sNaturePowerMoveDescription, + [MOVE_CHARGE - 1] = sChargeMoveDescription, + [MOVE_TAUNT - 1] = sTauntMoveDescription, + [MOVE_HELPING_HAND - 1] = sHelpingHandMoveDescription, + [MOVE_TRICK - 1] = sTrickMoveDescription, + [MOVE_ROLE_PLAY - 1] = sRolePlayMoveDescription, + [MOVE_WISH - 1] = sWishMoveDescription, + [MOVE_ASSIST - 1] = sAssistMoveDescription, + [MOVE_INGRAIN - 1] = sIngrainMoveDescription, + [MOVE_SUPERPOWER - 1] = sSuperpowerMoveDescription, + [MOVE_MAGIC_COAT - 1] = sMagicCoatMoveDescription, + [MOVE_RECYCLE - 1] = sRecycleMoveDescription, + [MOVE_REVENGE - 1] = sRevengeMoveDescription, + [MOVE_BRICK_BREAK - 1] = sBrickBreakMoveDescription, + [MOVE_YAWN - 1] = sYawnMoveDescription, + [MOVE_KNOCK_OFF - 1] = sKnockOffMoveDescription, + [MOVE_ENDEAVOR - 1] = sEndeavorMoveDescription, + [MOVE_ERUPTION - 1] = sEruptionMoveDescription, + [MOVE_SKILL_SWAP - 1] = sSkillSwapMoveDescription, + [MOVE_IMPRISON - 1] = sImprisonMoveDescription, + [MOVE_REFRESH - 1] = sRefreshMoveDescription, + [MOVE_GRUDGE - 1] = sGrudgeMoveDescription, + [MOVE_SNATCH - 1] = sSnatchMoveDescription, + [MOVE_SECRET_POWER - 1] = sSecretPowerMoveDescription, + [MOVE_DIVE - 1] = sDiveMoveDescription, + [MOVE_ARM_THRUST - 1] = sArmThrustMoveDescription, + [MOVE_CAMOUFLAGE - 1] = sCamouflageMoveDescription, + [MOVE_TAIL_GLOW - 1] = sTailGlowMoveDescription, + [MOVE_LUSTER_PURGE - 1] = sLusterPurgeMoveDescription, + [MOVE_MIST_BALL - 1] = sMistBallMoveDescription, + [MOVE_FEATHER_DANCE - 1] = sFeatherDanceMoveDescription, + [MOVE_TEETER_DANCE - 1] = sTeeterDanceMoveDescription, + [MOVE_BLAZE_KICK - 1] = sBlazeKickMoveDescription, + [MOVE_MUD_SPORT - 1] = sMudSportMoveDescription, + [MOVE_ICE_BALL - 1] = sIceBallMoveDescription, + [MOVE_NEEDLE_ARM - 1] = sNeedleArmMoveDescription, + [MOVE_SLACK_OFF - 1] = sSlackOffMoveDescription, + [MOVE_HYPER_VOICE - 1] = sHyperVoiceMoveDescription, + [MOVE_POISON_FANG - 1] = sPoisonFangMoveDescription, + [MOVE_CRUSH_CLAW - 1] = sCrushClawMoveDescription, + [MOVE_BLAST_BURN - 1] = sBlastBurnMoveDescription, + [MOVE_HYDRO_CANNON - 1] = sHydroCannonMoveDescription, + [MOVE_METEOR_MASH - 1] = sMeteorMashMoveDescription, + [MOVE_ASTONISH - 1] = sAstonishMoveDescription, + [MOVE_WEATHER_BALL - 1] = sWeatherBallMoveDescription, + [MOVE_AROMATHERAPY - 1] = sAromatherapyMoveDescription, + [MOVE_FAKE_TEARS - 1] = sFakeTearsMoveDescription, + [MOVE_AIR_CUTTER - 1] = sAirCutterMoveDescription, + [MOVE_OVERHEAT - 1] = sOverheatMoveDescription, + [MOVE_ODOR_SLEUTH - 1] = sOdorSleuthMoveDescription, + [MOVE_ROCK_TOMB - 1] = sRockTombMoveDescription, + [MOVE_SILVER_WIND - 1] = sSilverWindMoveDescription, + [MOVE_METAL_SOUND - 1] = sMetalSoundMoveDescription, + [MOVE_GRASS_WHISTLE - 1] = sGrassWhistleMoveDescription, + [MOVE_TICKLE - 1] = sTickleMoveDescription, + [MOVE_COSMIC_POWER - 1] = sCosmicPowerMoveDescription, + [MOVE_WATER_SPOUT - 1] = sWaterSpoutMoveDescription, + [MOVE_SIGNAL_BEAM - 1] = sSignalBeamMoveDescription, + [MOVE_SHADOW_PUNCH - 1] = sShadowPunchMoveDescription, + [MOVE_EXTRASENSORY - 1] = sExtrasensoryMoveDescription, + [MOVE_SKY_UPPERCUT - 1] = sSkyUppercutMoveDescription, + [MOVE_SAND_TOMB - 1] = sSandTombMoveDescription, + [MOVE_SHEER_COLD - 1] = sSheerColdMoveDescription, + [MOVE_MUDDY_WATER - 1] = sMuddyWaterMoveDescription, + [MOVE_BULLET_SEED - 1] = sBulletSeedMoveDescription, + [MOVE_AERIAL_ACE - 1] = sAerialAceMoveDescription, + [MOVE_ICICLE_SPEAR - 1] = sIcicleSpearMoveDescription, + [MOVE_IRON_DEFENSE - 1] = sIronDefenseMoveDescription, + [MOVE_BLOCK - 1] = sBlockMoveDescription, + [MOVE_HOWL - 1] = sHowlMoveDescription, + [MOVE_DRAGON_CLAW - 1] = sDragonClawMoveDescription, + [MOVE_FRENZY_PLANT - 1] = sFrenzyPlantMoveDescription, + [MOVE_BULK_UP - 1] = sBulkUpMoveDescription, + [MOVE_BOUNCE - 1] = sBounceMoveDescription, + [MOVE_MUD_SHOT - 1] = sMudShotMoveDescription, + [MOVE_POISON_TAIL - 1] = sPoisonTailMoveDescription, + [MOVE_COVET - 1] = sCovetMoveDescription, + [MOVE_VOLT_TACKLE - 1] = sVoltTackleMoveDescription, + [MOVE_MAGICAL_LEAF - 1] = sMagicalLeafMoveDescription, + [MOVE_WATER_SPORT - 1] = sWaterSportMoveDescription, + [MOVE_CALM_MIND - 1] = sCalmMindMoveDescription, + [MOVE_LEAF_BLADE - 1] = sLeafBladeMoveDescription, + [MOVE_DRAGON_DANCE - 1] = sDragonDanceMoveDescription, + [MOVE_ROCK_BLAST - 1] = sRockBlastMoveDescription, + [MOVE_SHOCK_WAVE - 1] = sShockWaveMoveDescription, + [MOVE_WATER_PULSE - 1] = sWaterPulseMoveDescription, + [MOVE_DOOM_DESIRE - 1] = sDoomDesireMoveDescription, + [MOVE_PSYCHO_BOOST - 1] = sPsychoBoostMoveDescription, +}; diff --git a/src/data/text/move_names.h b/src/data/text/move_names.h index 3df7c886b..9f540f1d6 100644 --- a/src/data/text/move_names.h +++ b/src/data/text/move_names.h @@ -1,4 +1,5 @@ -const u8 gMoveNames[][13] = { +const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] = +{ [MOVE_NONE] = _("-"), [MOVE_POUND] = _("POUND"), [MOVE_KARATE_CHOP] = _("KARATE CHOP"), diff --git a/src/field_region_map.c b/src/field_region_map.c index 34b6089df..f56548068 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -63,7 +63,7 @@ static const struct WindowTemplate gUnknown_085E5070[] = { // .text -void sub_817018C(MainCallback callback) +void FieldInitRegionMap(MainCallback callback) { SetVBlankCallback(NULL); sFieldRegionMapHandler = malloc(sizeof(*sFieldRegionMapHandler)); diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 39977808f..6f33b2c9b 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -272,7 +272,7 @@ bool8 sub_80FB59C(void) void Task_HandlePorthole(u8 taskId) { s16 *data = gTasks[taskId].data; - u16 *var = GetVarPointer(VAR_PORTHOLE); + u16 *var = GetVarPointer(VAR_PORTHOLE_STATE); struct WarpData *location = &gSaveBlock1Ptr->location; switch (data[0]) diff --git a/src/field_specials.c b/src/field_specials.c new file mode 100644 index 000000000..897bcc8d7 --- /dev/null +++ b/src/field_specials.c @@ -0,0 +1,4329 @@ +#include "global.h" +#include "main.h" +#include "battle.h" +#include "battle_tower.h" +#include "cable_club.h" +#include "data2.h" +#include "decoration.h" +#include "diploma.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "fieldmap.h" +#include "field_camera.h" +#include "field_effect.h" +#include "field_message_box.h" +#include "field_player_avatar.h" +#include "field_region_map.h" +#include "field_screen.h" +#include "field_specials.h" +#include "field_weather.h" +#include "international_string_util.h" +#include "item_icon.h" +#include "link.h" +#include "list_menu.h" +#include "malloc.h" +#include "match_call.h" +#include "menu.h" +#include "overworld.h" +#include "party_menu.h" +#include "pokeblock.h" +#include "pokemon.h" +#include "pokemon_storage_system.h" +#include "random.h" +#include "rayquaza_scene.h" +#include "region_map.h" +#include "rom_8011DC0.h" +#include "rtc.h" +#include "script.h" +#include "script_menu.h" +#include "sound.h" +#include "starter_choose.h" +#include "string_util.h" +#include "strings.h" +#include "task.h" +#include "text.h" +#include "tv.h" +#include "wallclock.h" +#include "window.h" +#include "constants/event_objects.h" +#include "constants/items.h" +#include "constants/maps.h" +#include "constants/songs.h" +#include "constants/species.h" +#include "constants/moves.h" +#include "constants/vars.h" + +EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE; +EWRAM_DATA u8 gBikeCollisions = 0; +EWRAM_DATA u32 gBikeCyclingTimer = 0; +EWRAM_DATA u8 gUnknown_0203AB5C = 0; +EWRAM_DATA u8 gUnknown_0203AB5D = 0; +EWRAM_DATA u8 gUnknown_0203AB5E = 0; +EWRAM_DATA u16 gUnknown_0203AB60 = 0; +EWRAM_DATA u16 gUnknown_0203AB62 = 0; +EWRAM_DATA struct ListMenuItem *gUnknown_0203AB64 = NULL; +EWRAM_DATA u16 gUnknown_0203AB68 = 0; +EWRAM_DATA u16 gUnknown_0203AB6A = 0; +EWRAM_DATA u8 gUnknown_0203AB6C = 0; +EWRAM_DATA u8 gUnknown_0203AB6D = 0; +EWRAM_DATA u8 gUnknown_0203AB6E = 0; +EWRAM_DATA u8 gUnknown_0203AB6F = 0; +EWRAM_DATA u32 gUnknown_0203AB70 = 0; + +struct ListMenuTemplate gUnknown_030061D0; + +extern const u16 gEventObjectPalette8[]; +extern const u16 gEventObjectPalette17[]; +extern const u16 gEventObjectPalette33[]; +extern const u16 gEventObjectPalette34[]; + +extern void LoadPalette(const void *src, u32 offset, u16 size); // incorrect signature, needed to match +extern void BlendPalettes(u32, u8, u16); + +void UpdateMovedLilycoveFanClubMembers(void); +void sub_813BF60(void); +u16 GetNumMovedLilycoveFanClubMembers(void); + +static void RecordCyclingRoadResults(u32, u8); +static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum); +static void Task_PetalburgGym(u8); +static void PetalburgGymFunc(u8, u16); +static void Task_PCTurnOnEffect(u8); +static void PCTurnOnEffect_0(struct Task *); +static void PCTurnOnEffect_1(s16, s8, s8); +static void PCTurnOffEffect(void); +static void Task_LotteryCornerComputerEffect(u8); +static void LotteryCornerComputerEffect(struct Task *); +static void sub_81395BC(u8 taskId); +static void sub_8139620(u8 taskId); +static void sub_8139AF4(u8 taskId); +static void sub_8139C2C(u16 a1, u8 a2); +static void sub_8139C80(u8 taskId); +static void sub_813A2DC(u8 taskId); +static void sub_813AA60(u16 a0, u16 a1); +static void sub_813ACE8(u8 a0, u16 a1); +static void sub_813A42C(void); +static void sub_813A4EC(u8 taskId); +static void sub_813A694(u8 taskId); +static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list); +static void sub_813AC44(u16 a0, u16 a1); +static void sub_813AD34(u8 a0, u16 a1); +static void sub_813A570(u8 taskId); +static void sub_813A738(u8 taskId); +static void sub_813A600(u8 taskId); +static void sub_813A664(u8 taskId); +static void sub_813ABD4(u16 a0); +static void task_deoxys_sound(u8 taskId); +static void sub_813B0B4(u8 a0); +static void sub_813B160(u8 taskId); +static void sub_813B57C(u8 taskId); +static void sub_813B824(u8 taskId); +static void _fwalk(u8 taskId); +static u8 sub_813BF44(void); +static void sub_813BD84(void); +static u16 sub_813BB74(void); +static void sub_813BE30(struct LinkBattleRecords *linkRecords, u8 a, u8 b); + +void Special_ShowDiploma(void) +{ + SetMainCallback2(CB2_ShowDiploma); + ScriptContext2_Enable(); +} + +void Special_ViewWallClock(void) +{ + gMain.savedCallback = CB2_ReturnToField; + SetMainCallback2(CB2_ViewWallClock); + ScriptContext2_Enable(); +} + +void ResetCyclingRoadChallengeData(void) +{ + gBikeCyclingChallenge = FALSE; + gBikeCollisions = 0; + gBikeCyclingTimer = 0; +} + +void Special_BeginCyclingRoadChallenge(void) +{ + gBikeCyclingChallenge = TRUE; + gBikeCollisions = 0; + gBikeCyclingTimer = gMain.vblankCounter1; +} + +u16 GetPlayerAvatarBike(void) +{ + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE)) + return 1; + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE)) + return 2; + return 0; +} + +static void DetermineCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) +{ + u8 result; + + if (numBikeCollisions < 100) + { + ConvertIntToDecimalStringN(gStringVar1, numBikeCollisions, STR_CONV_MODE_LEFT_ALIGN, 2); + StringAppend(gStringVar1, gText_SpaceTimes); + } + else + { + StringCopy(gStringVar1, gText_99TimesPlus); + } + + if (numFrames < 3600) + { + ConvertIntToDecimalStringN(gStringVar2, numFrames / 60, STR_CONV_MODE_RIGHT_ALIGN, 2); + gStringVar2[2] = CHAR_PERIOD; + ConvertIntToDecimalStringN(&gStringVar2[3], ((numFrames % 60) * 100) / 60, STR_CONV_MODE_LEADING_ZEROS, 2); + StringAppend(gStringVar2, gText_SpaceSeconds); + } + else + { + StringCopy(gStringVar2, gText_1MinutePlus); + } + + result = 0; + if (numBikeCollisions == 0) + { + result = 5; + } + else if (numBikeCollisions < 4) + { + result = 4; + } + else if (numBikeCollisions < 10) + { + result = 3; + } + else if (numBikeCollisions < 20) + { + result = 2; + } + else if (numBikeCollisions < 100) + { + result = 1; + } + + if (numFrames / 60 <= 10) + { + result += 5; + } + else if (numFrames / 60 <= 15) + { + result += 4; + } + else if (numFrames / 60 <= 20) + { + result += 3; + } + else if (numFrames / 60 <= 40) + { + result += 2; + } + else if (numFrames / 60 < 60) + { + result += 1; + } + + + gSpecialVar_Result = result; +} + +void FinishCyclingRoadChallenge(void) { + const u32 numFrames = gMain.vblankCounter1 - gBikeCyclingTimer; + + DetermineCyclingRoadResults(numFrames, gBikeCollisions); + RecordCyclingRoadResults(numFrames, gBikeCollisions); +} + +static void RecordCyclingRoadResults(u32 numFrames, u8 numBikeCollisions) { + u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L); + u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H); + u32 framesRecord = low + (high << 16); + + if (framesRecord > numFrames || framesRecord == 0) + { + VarSet(VAR_CYCLING_ROAD_RECORD_TIME_L, numFrames); + VarSet(VAR_CYCLING_ROAD_RECORD_TIME_H, numFrames >> 16); + VarSet(VAR_CYCLING_ROAD_RECORD_COLLISIONS, numBikeCollisions); + } +} + +u16 GetRecordedCyclingRoadResults(void) { + u16 low = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_L); + u16 high = VarGet(VAR_CYCLING_ROAD_RECORD_TIME_H); + u32 framesRecord = low + (high << 16); + + if (framesRecord == 0) + { + return FALSE; + } + + DetermineCyclingRoadResults(framesRecord, VarGet(VAR_CYCLING_ROAD_RECORD_COLLISIONS)); + return TRUE; +} + +void UpdateCyclingRoadState(void) { + if (gUnknown_020322DC.mapNum == MAP_NUM(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE) && gUnknown_020322DC.mapGroup == MAP_GROUP(ROUTE110_SEASIDE_CYCLING_ROAD_SOUTH_ENTRANCE)) + { + return; + } + + if (VarGet(VAR_CYCLING_CHALLENGE_STATE) == 2 || VarGet(VAR_CYCLING_CHALLENGE_STATE) == 3) + { + VarSet(VAR_CYCLING_CHALLENGE_STATE, 0); + Overworld_SetSavedMusic(MUS_DUMMY); + } +} + +void SetSSTidalFlag(void) +{ + FlagSet(FLAG_SYS_CRUISE_MODE); + *GetVarPointer(VAR_CRUISE_STEP_COUNT) = 0; +} + +void ResetSSTidalFlag(void) +{ + FlagClear(FLAG_SYS_CRUISE_MODE); +} + +bool32 CountSSTidalStep(u16 delta) +{ + if (!FlagGet(FLAG_SYS_CRUISE_MODE) || (*GetVarPointer(VAR_CRUISE_STEP_COUNT) += delta) <= 0xcc) + { + return FALSE; + } + return TRUE; +} + +u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y) +{ + u16 *varCruiseStepCount = GetVarPointer(VAR_CRUISE_STEP_COUNT); + switch (*GetVarPointer(VAR_PORTHOLE_STATE)) + { + case 1: + case 8: + return 1; + case 3: + case 9: + return 4; + case 4: + case 5: + return 2; + case 6: + case 10: + return 3; + case 2: + if (*varCruiseStepCount < 60) + { + *mapNum = MAP_NUM(ROUTE134); + *x = *varCruiseStepCount + 19; + } + else if (*varCruiseStepCount < 140) + { + *mapNum = MAP_NUM(ROUTE133); + *x = *varCruiseStepCount - 60; + } + else + { + *mapNum = MAP_NUM(ROUTE132); + *x = *varCruiseStepCount - 140; + } + break; + case 7: + if (*varCruiseStepCount < 66) + { + *mapNum = MAP_NUM(ROUTE132); + *x = 65 - *varCruiseStepCount; + } + else if (*varCruiseStepCount < 146) { + *mapNum = MAP_NUM(ROUTE133); + *x = 145 - *varCruiseStepCount; + } + else + { + *mapNum = MAP_NUM(ROUTE134); + *x = 224 - *varCruiseStepCount; + } + break; + } + *mapGroup = MAP_GROUP(ROUTE132); + *y = 20; + return 0; +} + +bool32 is_tile_that_overrides_player_control(void) +{ + if (FlagGet(FLAG_0x088)) + { + switch (gMapHeader.mapType) + { + case 1: + case 2: + case 3: + case 6: + if (++(*GetVarPointer(VAR_0x40F2)) < 0xFA) + { + return FALSE; + } + break; + default: + return FALSE; + } + } + else + { + return FALSE; + } + + return TRUE; +} + +bool32 sub_8138120(void) +{ + if (FlagGet(FLAG_0x08A)) + { + switch (gMapHeader.mapType) + { + case 1: + case 2: + case 3: + case 6: + if (++(*GetVarPointer(VAR_0x40F3)) < 0xA) + { + return FALSE; + } + break; + default: + return FALSE; + } + } + else + { + return FALSE; + } + + return TRUE; +} + +bool32 sub_8138168(void) +{ + if (FlagGet(FLAG_0x072)) + { + switch (gMapHeader.mapType) + { + case 1: + case 2: + case 3: + case 6: + if (++(*GetVarPointer(VAR_0x40F5)) < 0xA) + { + return FALSE; + } + break; + default: + return FALSE; + } + } + else + { + return FALSE; + } + + return TRUE; +} + +bool32 sub_81381B0(void) +{ + if (FlagGet(FLAG_0x080)) + { + switch (gMapHeader.mapType) + { + case 1: + case 2: + case 3: + case 6: + if (++(*GetVarPointer(VAR_0x40F4)) < 0xFA) + { + return FALSE; + } + break; + default: + return FALSE; + } + } + else + { + return FALSE; + } + + return TRUE; +} + +bool32 sub_81381F8(void) +{ + if (FlagGet(FLAG_0x075)) + { + switch (gMapHeader.mapType) + { + case 1: + case 2: + case 3: + case 6: + if (++(*GetVarPointer(VAR_0x40F6)) < 0xFA) + { + return FALSE; + } + break; + default: + return FALSE; + } + } + else + { + return FALSE; + } + + return TRUE; +} + +u8 GetLinkPartnerNames(void) +{ + u8 i; + u8 j = 0; + u8 myLinkPlayerNumber = GetMultiplayerId(); + u8 nLinkPlayers = GetLinkPlayerCount(); + for (i = 0; i < nLinkPlayers; i++) + { + if (myLinkPlayerNumber != i) + { + StringCopy(gTVStringVarPtrs[j], gLinkPlayers[i].name); + j++; + } + } + return nLinkPlayers; +} + +void SpawnLinkPartnerEventObject(void) +{ + u8 j = 0; + s16 x = 0; + s16 y = 0; + u8 gUnknown_085B2B5C[] = {7, 9, 8, 10}; + s8 gUnknown_085B2B60[][2] = { + { 0, 1}, + { 1, 0}, + { 0, -1}, + {-1, 0} + }; + u8 myLinkPlayerNumber; + u8 playerFacingDirection; + u8 linkSpriteId; + u8 i; + + myLinkPlayerNumber = GetMultiplayerId(); + playerFacingDirection = GetPlayerFacingDirection(); + switch (playerFacingDirection) + { + case DIR_WEST: + j = 2; + x = gSaveBlock1Ptr->pos.x - 1; + y = gSaveBlock1Ptr->pos.y; + break; + case DIR_NORTH: + j = 1; + x = gSaveBlock1Ptr->pos.x; + y = gSaveBlock1Ptr->pos.y - 1; + break; + case DIR_EAST: + x = gSaveBlock1Ptr->pos.x + 1; + y = gSaveBlock1Ptr->pos.y; + break; + case DIR_SOUTH: + j = 3; + x = gSaveBlock1Ptr->pos.x; + y = gSaveBlock1Ptr->pos.y + 1; + } + for (i = 0; i < gSpecialVar_0x8004; i++) + { + if (myLinkPlayerNumber != i) + { + switch ((u8)gLinkPlayers[i].version) + { + case VERSION_RUBY: + case VERSION_SAPPHIRE: + if (gLinkPlayers[i].gender == 0) + linkSpriteId = EVENT_OBJ_GFX_LINK_RS_BRENDAN; + else + linkSpriteId = EVENT_OBJ_GFX_LINK_RS_MAY; + break; + case VERSION_EMERALD: + if (gLinkPlayers[i].gender == 0) + linkSpriteId = EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL; + else + linkSpriteId = EVENT_OBJ_GFX_RIVAL_MAY_NORMAL; + break; + default: + if (gLinkPlayers[i].gender == 0) + linkSpriteId = EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL; + else + linkSpriteId = EVENT_OBJ_GFX_RIVAL_MAY_NORMAL; + break; + } + SpawnSpecialEventObjectParameterized(linkSpriteId, gUnknown_085B2B5C[j], 0xf0 - i, gUnknown_085B2B60[j][0] + x + 7, gUnknown_085B2B60[j][1] + y + 7, 0); + LoadLinkPartnerEventObjectSpritePalette(linkSpriteId, 0xf0 - i, i); + j++; + if (j == 4) + { + j = 0; + } + } + } +} + +static void LoadLinkPartnerEventObjectSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum) +{ + paletteNum += 6; + if (graphicsId == EVENT_OBJ_GFX_LINK_RS_BRENDAN || + graphicsId == EVENT_OBJ_GFX_LINK_RS_MAY || + graphicsId == EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL || + graphicsId == EVENT_OBJ_GFX_RIVAL_MAY_NORMAL) + { + u8 obj = GetEventObjectIdByLocalIdAndMap(localEventId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); + if (obj != NUM_EVENT_OBJECTS) + { + u8 spriteId = gEventObjects[obj].spriteId; + struct Sprite *sprite = &gSprites[spriteId]; + sprite->oam.paletteNum = paletteNum; + + switch (graphicsId) + { + case EVENT_OBJ_GFX_LINK_RS_BRENDAN: + LoadPalette(gEventObjectPalette33, 0x100 + paletteNum * 16, 0x20); + break; + case EVENT_OBJ_GFX_LINK_RS_MAY: + LoadPalette(gEventObjectPalette34, 0x100 + paletteNum * 16, 0x20); + break; + case EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL: + LoadPalette(gEventObjectPalette8, 0x100 + paletteNum * 16, 0x20); + break; + case EVENT_OBJ_GFX_RIVAL_MAY_NORMAL: + LoadPalette(gEventObjectPalette17, 0x100 + paletteNum * 16, 0x20); + break; + } + } + } +} + +static const struct UCoords8 gUnknown_085B2B68[] = { + { 7, 22}, + {11, 19}, + {10, 16}, + {15, 16} +}; + +void MauvilleGymSpecial1(void) +{ + u8 i; + for (i = 0; i < ARRAY_COUNT(gUnknown_085B2B68); i++) + { + if (i == gSpecialVar_0x8004) + { + MapGridSetMetatileIdAt(gUnknown_085B2B68[i].x, gUnknown_085B2B68[i].y, 0x206); + } + else + { + MapGridSetMetatileIdAt(gUnknown_085B2B68[i].x, gUnknown_085B2B68[i].y, 0x205); + } + } +} + +void MauvilleGymSpecial2(void) +{ + int x, y; + for (y = 12; y < 24; y++) + { + for (x = 7; x < 16; x++) + { + switch (MapGridGetMetatileIdAt(x, y)) + { + case 0x220: + MapGridSetMetatileIdAt(x, y, 0x230); + break; + case 0x221: + MapGridSetMetatileIdAt(x, y, 0x231); + break; + case 0x228: + MapGridSetMetatileIdAt(x, y, 0x238); + break; + case 0x229: + MapGridSetMetatileIdAt(x, y, 0x239); + break; + case 0x230: + MapGridSetMetatileIdAt(x, y, 0x220); + break; + case 0x231: + MapGridSetMetatileIdAt(x, y, 0x221); + break; + case 0x238: + MapGridSetMetatileIdAt(x, y, 0xe28); + break; + case 0x239: + MapGridSetMetatileIdAt(x, y, 0xe29); + break; + case 0x222: + MapGridSetMetatileIdAt(x, y, 0x232); + break; + case 0x223: + MapGridSetMetatileIdAt(x, y, 0x233); + break; + case 0x22a: + MapGridSetMetatileIdAt(x, y, 0x23a); + break; + case 0x22b: + MapGridSetMetatileIdAt(x, y, 0x23b); + break; + case 0x232: + MapGridSetMetatileIdAt(x, y, 0x222); + break; + case 0x233: + MapGridSetMetatileIdAt(x, y, 0x223); + break; + case 0x23a: + MapGridSetMetatileIdAt(x, y, 0xe2a); + break; + case 0x23b: + MapGridSetMetatileIdAt(x, y, 0xe2b); + break; + case 0x240: + MapGridSetMetatileIdAt(x, y, 0xe42); + break; + case 0x248: + MapGridSetMetatileIdAt(x, y, 0x21a); + break; + case 0x241: + MapGridSetMetatileIdAt(x, y, 0xe43); + break; + case 0x249: + MapGridSetMetatileIdAt(x, y, 0x21a); + break; + case 0x242: + MapGridSetMetatileIdAt(x, y, 0xe40); + break; + case 0x21a: + if (MapGridGetMetatileIdAt(x, y - 1) == 0x240) + { + MapGridSetMetatileIdAt(x, y, 0xe48); + } + else + { + MapGridSetMetatileIdAt(x, y, 0xe49); + } + break; + case 0x243: + MapGridSetMetatileIdAt(x, y, 0xe41); + break; + case 0x251: + MapGridSetMetatileIdAt(x, y, 0xe50); + break; + case 0x250: + MapGridSetMetatileIdAt(x, y, 0x251); + break; + } + } + } +} + +void MauvilleGymSpecial3(void) +{ + int i, x, y; + const struct UCoords8 *switchCoords = gUnknown_085B2B68; + for (i = ARRAY_COUNT(gUnknown_085B2B68) - 1; i >= 0; i--) + { + MapGridSetMetatileIdAt(switchCoords->x, switchCoords->y, 0x206); + switchCoords++; + } + for (y = 12; y < 24; y++) + { + for (x = 7; x < 16; x++) + { + switch (MapGridGetMetatileIdAt(x, y)) + { + case 0x220: + MapGridSetMetatileIdAt(x, y, 0x230); + break; + case 0x221: + MapGridSetMetatileIdAt(x, y, 0x231); + break; + case 0x228: + MapGridSetMetatileIdAt(x, y, 0x238); + break; + case 0x229: + MapGridSetMetatileIdAt(x, y, 0x239); + break; + case 0x222: + MapGridSetMetatileIdAt(x, y, 0x232); + break; + case 0x223: + MapGridSetMetatileIdAt(x, y, 0x233); + break; + case 0x22a: + MapGridSetMetatileIdAt(x, y, 0x23a); + break; + case 0x22b: + MapGridSetMetatileIdAt(x, y, 0x23b); + break; + case 0x240: + MapGridSetMetatileIdAt(x, y, 0xe42); + break; + case 0x241: + MapGridSetMetatileIdAt(x, y, 0xe43); + break; + case 0x248: + case 0x249: + MapGridSetMetatileIdAt(x, y, 0x21a); + break; + case 0x250: + MapGridSetMetatileIdAt(x, y, 0x251); + break; + } + } + } +} + +static const u8 gUnknown_085B2B78[] = {0, 1, 1, 1, 1}; +static const u16 gUnknown_085B2B7E[] = {0x218, 0x219, 0x21a, 0x21b, 0x21c}; + +void PetalburgGymSpecial1(void) +{ + gUnknown_0203AB5C = 0; + gUnknown_0203AB5D = 0; + PlaySE(SE_KI_GASYAN); + CreateTask(Task_PetalburgGym, 8); +} + +static void Task_PetalburgGym(u8 taskId) +{ + if (gUnknown_085B2B78[gUnknown_0203AB5D] == gUnknown_0203AB5C) + { + PetalburgGymFunc(gSpecialVar_0x8004, gUnknown_085B2B7E[gUnknown_0203AB5D]); + gUnknown_0203AB5C = 0; + if ((++gUnknown_0203AB5D) == 5) + { + DestroyTask(taskId); + EnableBothScriptContexts(); + } + } + else + { + gUnknown_0203AB5C++; + } +} + +static void PetalburgGymFunc(u8 a0, u16 a1) +{ + u16 x[4]; + u16 y[4]; + u8 i; + u8 nDoors = 0; + switch (a0) + { + case 1: + nDoors = 2; + x[0] = 1; + x[1] = 7; + y[0] = 0x68; + y[1] = 0x68; + break; + case 2: + nDoors = 2; + x[0] = 1; + x[1] = 7; + y[0] = 0x4e; + y[1] = 0x4e; + break; + case 3: + nDoors = 2; + x[0] = 1; + x[1] = 7; + y[0] = 0x5b; + y[1] = 0x5b; + break; + case 4: + nDoors = 1; + x[0] = 7; + y[0] = 0x27; + break; + case 5: + nDoors = 2; + x[0] = 1; + x[1] = 7; + y[0] = 0x34; + y[1] = 0x34; + break; + case 6: + nDoors = 1; + x[0] = 1; + y[0] = 0x41; + break; + case 7: + nDoors = 1; + x[0] = 7; + y[0] = 0xd; + break; + case 8: + nDoors = 1; + x[0] = 1; + y[0] = 0x1a; + break; + } + for (i = 0; i < nDoors; i++) + { + MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | 0xc00); + MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | 0xc00); + } + DrawWholeMapView(); +} + +void PetalburgGymSpecial2(void) +{ + PetalburgGymFunc(gSpecialVar_0x8004, gUnknown_085B2B7E[4]); +} + +void ShowFieldMessageStringVar4(void) +{ + ShowFieldMessage(gStringVar4); +} + +void StorePlayerCoordsInVars(void) +{ + gSpecialVar_0x8004 = gSaveBlock1Ptr->pos.x; + gSpecialVar_0x8005 = gSaveBlock1Ptr->pos.y; +} + +u8 GetPlayerTrainerIdOnesDigit(void) +{ + return (u16)((gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]) % 10; +} + +void GetPlayerBigGuyGirlString(void) +{ + if (gSaveBlock2Ptr->playerGender == MALE) + { + StringCopy(gStringVar1, gText_BigGuy); + } + else + { + StringCopy(gStringVar1, gText_BigGirl); + } +} + +void GetRivalSonDaughterString(void) +{ + if (gSaveBlock2Ptr->playerGender == MALE) + { + StringCopy(gStringVar1, gText_Daughter); + } + else + { + StringCopy(gStringVar1, gText_Son); + } +} + +u8 GetBattleOutcome(void) +{ + return gBattleOutcome; +} + +void CableCarWarp(void) +{ + if (gSpecialVar_0x8004 != 0) + { + Overworld_SetWarpDestination(MAP_GROUP(ROUTE112_CABLE_CAR_STATION), MAP_NUM(ROUTE112_CABLE_CAR_STATION), -1, 6, 4); + } + else + { + Overworld_SetWarpDestination(MAP_GROUP(MT_CHIMNEY_CABLE_CAR_STATION), MAP_NUM(MT_CHIMNEY_CABLE_CAR_STATION), -1, 6, 4); + } +} + +void SetFlagInVar(void) +{ + FlagSet(gSpecialVar_0x8004); +} + +u16 GetWeekCount(void) +{ + u16 weekCount = gLocalTime.days / 7; + if (weekCount > 9999) + { + weekCount = 9999; + } + return weekCount; +} + +u8 GetLeadMonFriendshipScore(void) +{ + struct Pokemon *pokemon = &gPlayerParty[GetLeadMonIndex()]; + if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) == 255) + { + return 6; + } + if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 200) + { + return 5; + } + if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 150) + { + return 4; + } + if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 100) + { + return 3; + } + if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 50) + { + return 2; + } + if (GetMonData(pokemon, MON_DATA_FRIENDSHIP) >= 1) + { + return 1; + } + return 0; +} + +static void CB2_FieldShowRegionMap(void) +{ + FieldInitRegionMap(CB2_ReturnToFieldContinueScriptPlayMapMusic); +} + +void FieldShowRegionMap(void) +{ + SetMainCallback2(CB2_FieldShowRegionMap); +} + +void DoPCTurnOnEffect(void) +{ + if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE) + { + u8 taskId = CreateTask(Task_PCTurnOnEffect, 8); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = taskId; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + } +} + +static void Task_PCTurnOnEffect(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + if (task->data[0] == 0) + { + PCTurnOnEffect_0(task); + } +} + +static void PCTurnOnEffect_0(struct Task *task) +{ + u8 playerDirection; + s8 dx = 0; + s8 dy = 0; + if (task->data[3] == 6) + { + task->data[3] = 0; + playerDirection = GetPlayerFacingDirection(); + switch (playerDirection) + { + case DIR_NORTH: + dx = 0; + dy = -1; + break; + case DIR_WEST: + dx = -1; + dy = -1; + break; + case DIR_EAST: + dx = 1; + dy = -1; + break; + } + PCTurnOnEffect_1(task->data[4], dx, dy); + DrawWholeMapView(); + task->data[4] ^= 1; + if ((++task->data[2]) == 5) + { + DestroyTask(task->data[1]); + } + } + task->data[3]++; +} + +static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy) +{ + u16 tileId = 0; + if (flag != 0) + { + if (gSpecialVar_0x8004 == 0) + { + tileId = 0x4; + } + else if (gSpecialVar_0x8004 == 1) + { + tileId = 0x25a; + } + else if (gSpecialVar_0x8004 == 2) + { + tileId = 0x259; + } + } + else + { + if (gSpecialVar_0x8004 == 0) + { + tileId = 0x5; + } + else if (gSpecialVar_0x8004 == 1) + { + tileId = 0x27f; + } + else if (gSpecialVar_0x8004 == 2) + { + tileId = 0x27e; + } + } + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00); +} + +void DoPCTurnOffEffect(void) +{ + PCTurnOffEffect(); +} + +static void PCTurnOffEffect(void) +{ + s8 dx = 0; + s8 dy = 0; + u16 tileId = 0; + u8 playerDirection = GetPlayerFacingDirection(); + switch (playerDirection) + { + case DIR_NORTH: + dx = 0; + dy = -1; + break; + case DIR_WEST: + dx = -1; + dy = -1; + break; + case DIR_EAST: + dx = 1; + dy = -1; + break; + } + if (gSpecialVar_0x8004 == 0) + { + tileId = 0x4; + } + else if (gSpecialVar_0x8004 == 1) + { + tileId = 0x25a; + } + else if (gSpecialVar_0x8004 == 2) + { + tileId = 0x259; + } + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00); + DrawWholeMapView(); +} + +void DoLotteryCornerComputerEffect(void) +{ + if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE) + { + u8 taskId = CreateTask(Task_LotteryCornerComputerEffect, 8); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = taskId; + gTasks[taskId].data[2] = 0; + gTasks[taskId].data[3] = 0; + gTasks[taskId].data[4] = 0; + } +} + +static void Task_LotteryCornerComputerEffect(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + if (task->data[0] == 0) + { + LotteryCornerComputerEffect(task); + } +} + +static void LotteryCornerComputerEffect(struct Task *task) +{ + if (task->data[3] == 6) + { + task->data[3] = 0; + if (task->data[4] != 0) + { + MapGridSetMetatileIdAt(18, 8, 0xe9d); + MapGridSetMetatileIdAt(18, 9, 0xea5); + } + else + { + MapGridSetMetatileIdAt(18, 8, 0xe58); + MapGridSetMetatileIdAt(18, 9, 0xe60); + } + DrawWholeMapView(); + task->data[4] ^= 1; + if ((++task->data[2]) == 5) + { + DestroyTask(task->data[1]); + } + } + task->data[3]++; +} + +void EndLotteryCornerComputerEffect(void) +{ + MapGridSetMetatileIdAt(18, 8, 0xe9d); + MapGridSetMetatileIdAt(18, 9, 0xea5); + DrawWholeMapView(); +} + +void SetTrickHouseEndRoomFlag(void) +{ + u16 *specVar = &gSpecialVar_0x8004; + u16 flag = FLAG_0x1F5; + *specVar = flag; + FlagSet(flag); +} + +void ResetTrickHouseEndRoomFlag(void) +{ + u16 *specVar = &gSpecialVar_0x8004; + u16 flag = FLAG_0x1F5; + *specVar = flag; + FlagClear(flag); +} + +bool8 CheckLeadMonCool(void) +{ + if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_COOL) < 200) + { + return FALSE; + } + return TRUE; +} + +bool8 CheckLeadMonBeauty(void) +{ + if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_BEAUTY) < 200) + { + return FALSE; + } + return TRUE; +} + +bool8 CheckLeadMonCute(void) +{ + if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_CUTE) < 200) + { + return FALSE; + } + return TRUE; +} + +bool8 CheckLeadMonSmart(void) +{ + if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SMART) < 200) + { + return FALSE; + } + return TRUE; +} + +bool8 CheckLeadMonTough(void) +{ + if (GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_TOUGH) < 200) + { + return FALSE; + } + return TRUE; +} + +void IsGrassTypeInParty(void) +{ + u8 i; + u16 species; + struct Pokemon *pokemon; + for (i = 0; i < PARTY_SIZE; i++) + { + pokemon = &gPlayerParty[i]; + if (GetMonData(pokemon, MON_DATA_SANITY_BIT2) && !GetMonData(pokemon, MON_DATA_IS_EGG)) + { + species = GetMonData(pokemon, MON_DATA_SPECIES); + if (gBaseStats[species].type1 == TYPE_GRASS || gBaseStats[species].type2 == TYPE_GRASS) + { + gSpecialVar_Result = TRUE; + return; + } + } + } + gSpecialVar_Result = FALSE; +} + +void SpawnScriptEventObject(void) +{ + u8 obj = SpawnSpecialEventObjectParameterized(EVENT_OBJ_GFX_BOY_1, 8, 0x7F, gSaveBlock1Ptr->pos.x + 7, gSaveBlock1Ptr->pos.y + 7, 3); + gEventObjects[obj].invisible = TRUE; + CameraObjectSetFollowedObjectId(gEventObjects[obj].spriteId); +} + +void RemoveScriptEventObject(void) +{ + CameraObjectSetFollowedObjectId(GetPlayerAvatarObjectId()); + RemoveEventObjectByLocalIdAndMap(0x7F, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); +} + +u8 GetPokeblockNameByMonNature(void) +{ + return CopyMonFavoritePokeblockName(GetNature(&gPlayerParty[GetLeadMonIndex()]), gStringVar1); +} + +void GetSecretBaseNearbyMapName(void) +{ + GetMapName(gStringVar1, VarGet(VAR_SECRET_BASE_MAP), 0); +} + +u16 GetBestBattleTowerStreak(void) +{ + return GetGameStat(GAME_STAT_BATTLE_TOWER_BEST_STREAK); +} + +void BufferEReaderTrainerName(void) +{ + GetEreaderTrainerName(gStringVar1); +} + +u16 GetSlotMachineId(void) +{ + static const u8 gUnknown_085B2B88[] = {12, 2, 4, 5, 1, 8, 7, 11, 3, 10, 9, 6}; + static const u8 gUnknown_085B2B94[] = {0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 5}; + static const u8 gUnknown_085B2BA0[] = {3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5}; + + u32 v0 = gSaveBlock1Ptr->easyChatPairs[0].unk0_0 + gSaveBlock1Ptr->easyChatPairs[0].unk2 + gUnknown_085B2B88[gSpecialVar_0x8004]; + if (GetPriceReduction(2)) + { + return gUnknown_085B2BA0[v0 % 12]; + } + return gUnknown_085B2B94[v0 % 12]; +} + +bool8 FoundAbandonedShipRoom1Key(void) +{ + u16 *specVar = &gSpecialVar_0x8004; + u16 flag = FLAG_HIDDEN_ITEM_1F; + *specVar = flag; + if (!FlagGet(flag)) + { + return FALSE; + } + return TRUE; +} + +bool8 FoundAbandonedShipRoom2Key(void) +{ + u16 *specVar = &gSpecialVar_0x8004; + u16 flag = FLAG_HIDDEN_ITEM_20; + *specVar = flag; + if (!FlagGet(flag)) + { + return FALSE; + } + return TRUE; +} + +bool8 FoundAbandonedShipRoom4Key(void) +{ + u16 *specVar = &gSpecialVar_0x8004; + u16 flag = FLAG_HIDDEN_ITEM_21; + *specVar = flag; + if (!FlagGet(flag)) + { + return FALSE; + } + return TRUE; +} + +bool8 FoundAbandonedShipRoom6Key(void) +{ + u16 *specVar = &gSpecialVar_0x8004; + u16 flag = FLAG_HIDDEN_ITEM_22; + *specVar = flag; + if (!FlagGet(flag)) + { + return FALSE; + } + return TRUE; +} + +bool8 LeadMonHasEffortRibbon(void) +{ + return GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_EFFORT_RIBBON, NULL); +} + +void GiveLeadMonEffortRibbon(void) +{ + bool8 ribbonSet; + struct Pokemon *leadMon; + IncrementGameStat(GAME_STAT_RECEIVED_RIBBONS); + FlagSet(FLAG_SYS_RIBBON_GET); + ribbonSet = TRUE; + leadMon = &gPlayerParty[GetLeadMonIndex()]; + SetMonData(leadMon, MON_DATA_EFFORT_RIBBON, &ribbonSet); + if (GetRibbonCount(leadMon) > 4) + { + sub_80EE4DC(leadMon, 0x47); + } +} + +bool8 Special_AreLeadMonEVsMaxedOut(void) +{ + if (GetMonEVCount(&gPlayerParty[GetLeadMonIndex()]) >= 510) + { + return TRUE; + } + return FALSE; +} + +u8 TryUpdateRusturfTunnelState(void) +{ + if (!FlagGet(FLAG_RUSTURF_TUNNEL_OPENED) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(RUSTURF_TUNNEL) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(RUSTURF_TUNNEL)) + { + if (FlagGet(FLAG_HIDE_RUSTURF_TUNNEL_ROCK_1)) + { + VarSet(VAR_RUSTURF_TUNNEL_STATE, 4); + return TRUE; + } + else if (FlagGet(FLAG_HIDE_RUSTURF_TUNNEL_ROCK_2)) + { + VarSet(VAR_RUSTURF_TUNNEL_STATE, 5); + return TRUE; + } + } + return FALSE; +} + +void SetShoalItemFlag(u16 v0) +{ + FlagSet(FLAG_SYS_SHOAL_ITEM); +} + +void PutZigzagoonInPlayerParty(void) +{ + u16 monData; + CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, 0x20, FALSE, 0, FALSE, 0); + monData = TRUE; + SetMonData(&gPlayerParty[0], MON_DATA_ALT_ABILITY, &monData); + monData = MOVE_TACKLE; + SetMonData(&gPlayerParty[0], MON_DATA_MOVE1, &monData); + monData = MOVE_NONE; + SetMonData(&gPlayerParty[0], MON_DATA_MOVE2, &monData); + SetMonData(&gPlayerParty[0], MON_DATA_MOVE3, &monData); + SetMonData(&gPlayerParty[0], MON_DATA_MOVE4, &monData); +} + +bool8 IsStarterInParty(void) +{ + u8 i; + u16 starter = GetStarterPokemon(VarGet(VAR_STARTER_MON)); + u8 partyCount = CalculatePlayerPartyCount(); + for (i = 0; i < partyCount; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) == starter) + { + return TRUE; + } + } + return FALSE; +} + +bool8 ScriptCheckFreePokemonStorageSpace(void) +{ + return CheckFreePokemonStorageSpace(); +} + +bool8 IsPokerusInParty(void) +{ + if (!CheckPartyPokerus(gPlayerParty, 0x3f)) + { + return FALSE; + } + return TRUE; +} + +void sub_8139560(void) +{ + u8 taskId = CreateTask(sub_81395BC, 9); + gTasks[taskId].data[0] = gSpecialVar_0x8005; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = gSpecialVar_0x8006; + gTasks[taskId].data[3] = gSpecialVar_0x8007; + gTasks[taskId].data[4] = gSpecialVar_0x8004; + SetCameraPanningCallback(NULL); + PlaySE(SE_W070); +} + +static void sub_81395BC(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + data[1]++; + if (data[1] % data[3] == 0) + { + data[1] = 0; + data[2]--; + data[0] = -data[0]; + data[4] = -data[4]; + SetCameraPanning(data[0], data[4]); + if (data[2] == 0) + { + sub_8139620(taskId); + InstallCameraPanAheadCallback(); + } + } +} + +static void sub_8139620(u8 taskId) +{ + DestroyTask(taskId); + EnableBothScriptContexts(); +} + +bool8 FoundBlackGlasses(void) +{ + return FlagGet(FLAG_HIDDEN_ITEM_BLACK_GLASSES); +} + +void SetRoute119Weather(void) +{ + if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE) + { + SetSav1Weather(20); + } +} + +void SetRoute123Weather(void) +{ + if (is_map_type_1_2_3_5_or_6(get_map_light_from_warp0()) != TRUE) + { + SetSav1Weather(21); + } +} + +u8 GetLeadMonIndex(void) +{ + u8 i; + u8 partyCount = CalculatePlayerPartyCount(); + for (i = 0; i < partyCount; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0) + { + return i; + } + } + return 0; +} + +u16 ScriptGetPartyMonSpecies(void) +{ + return GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES2, NULL); +} + +void nullsub_54(void) +{ + +} + +u16 GetDaysUntilPacifidlogTMAvailable(void) +{ + u16 tmReceivedDay = VarGet(VAR_PACIFIDLOG_TM_RECEIVED_DAY); + if (gLocalTime.days - tmReceivedDay >= 7) + { + return 0; + } + else if (gLocalTime.days < 0) + { + return 8; + } + return 7 - (gLocalTime.days - tmReceivedDay); +} + +u16 SetPacifidlogTMReceivedDay(void) +{ + VarSet(VAR_PACIFIDLOG_TM_RECEIVED_DAY, gLocalTime.days); + return gLocalTime.days; +} + +bool8 MonOTNameMatchesPlayer(void) +{ + if (GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_LANGUAGE) != GAME_LANGUAGE) + { + return TRUE; // huh? + } + + GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_OT_NAME, gStringVar1); + if (!StringCompare(gSaveBlock2Ptr->playerName, gStringVar1)) + { + return FALSE; + } + return TRUE; +} + +void BufferLottoTicketNumber(void) +{ + if (gSpecialVar_Result >= 10000) + { + TV_PrintIntToStringVar(0, gSpecialVar_Result); + } + else if (gSpecialVar_Result >= 1000) + { + gStringVar1[0] = CHAR_0; + ConvertIntToDecimalStringN(gStringVar1 + 1, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result)); + } + else if (gSpecialVar_Result >= 100) + { + gStringVar1[0] = CHAR_0; + gStringVar1[1] = CHAR_0; + ConvertIntToDecimalStringN(gStringVar1 + 2, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result)); + } + else if (gSpecialVar_Result >= 10) + { + gStringVar1[0] = CHAR_0; + gStringVar1[1] = CHAR_0; + gStringVar1[2] = CHAR_0; + ConvertIntToDecimalStringN(gStringVar1 + 3, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result)); + } + else + { + gStringVar1[0] = CHAR_0; + gStringVar1[1] = CHAR_0; + gStringVar1[2] = CHAR_0; + gStringVar1[3] = CHAR_0; + ConvertIntToDecimalStringN(gStringVar1 + 4, gSpecialVar_Result, 0, CountDigits(gSpecialVar_Result)); + } +} + +u16 sub_813986C(void) +{ + switch (gSpecialVar_Result) + { + case 0: + return mevent_081445C0(3); + case 1: + return mevent_081445C0(4); + case 2: + return mevent_081445C0(0); + case 3: + return mevent_081445C0(1); + case 4: + return mevent_081445C0(2); + default: + return 0; + } +} + +bool8 sub_81398C0(void) +{ + if (gSpecialVar_0x8004 >= ITEM_TM01 && gSpecialVar_0x8004 <= ITEM_HM08) + { + StringCopy(gStringVar2, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_0x8004)]); + return TRUE; + } + + return FALSE; +} + +bool8 sub_813990C(void) +{ + u8 partyCount = CalculatePlayerPartyCount(); + u8 i; + + for (i = 0; i < partyCount; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SANITY_BIT1) == 1) + return TRUE; + } + + return FALSE; +} + +bool8 InMultiBattleRoom(void) +{ + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BATTLE_FRONTIER_BATTLE_TOWER_MULTI_BATTLE_ROOM) + && gSaveBlock1Ptr->location.mapNum == MAP_NUM(BATTLE_FRONTIER_BATTLE_TOWER_MULTI_BATTLE_ROOM) && + VarGet(VAR_0x40CE) == 2) + return TRUE; + return FALSE; +} + +void sub_8139980(void) +{ + SetCameraPanningCallback(NULL); + SetCameraPanning(8, 0); +} + +const struct WindowTemplate gUnknown_085B2BAC = { + .priority = 0, + .tilemapLeft = 21, + .tilemapTop = 1, + .width = 8, + .height = 4, + .paletteNum = 15, + .baseBlock = 8, +}; + +const u8 *const gElevatorFloorsTable[] = { + gText_B4F, + gText_B3F, + gText_B2F, + gText_B1F, + gText_1F, + gText_2F, + gText_3F, + gText_4F, + gText_5F, + gText_6F, + gText_7F, + gText_8F, + gText_9F, + gText_10F, + gText_11F, + gText_Rooftop +}; + +const u16 gUnknown_085B2BF4[] = { 0x0329, 0x032a, 0x032b, 0x0331, 0x0332, 0x0333, 0x0339, 0x033a, 0x033b }; +const u16 gUnknown_085B2C06[] = { 0x0329, 0x032b, 0x032a, 0x0331, 0x0333, 0x0332, 0x0339, 0x033b, 0x033a }; + +void SetDepartmentStoreFloorVar(void) +{ + u8 deptStoreFloor; + switch (gSaveBlock1Ptr->warp2.mapNum) + { + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): + deptStoreFloor = 4; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): + deptStoreFloor = 5; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): + deptStoreFloor = 6; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): + deptStoreFloor = 7; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): + deptStoreFloor = 8; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_ROOFTOP): + deptStoreFloor = 15; + break; + default: + deptStoreFloor = 4; + break; + } + VarSet(VAR_DEPT_STORE_FLOOR, deptStoreFloor); +} + +u16 sub_81399F4(void) +{ + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 0; + + if (gSaveBlock1Ptr->warp2.mapGroup == 13) + { + switch (gSaveBlock1Ptr->warp2.mapNum) + { + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_5F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 0; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_4F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 1; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_3F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 2; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_2F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 3; + break; + case MAP_NUM(LILYCOVE_CITY_DEPARTMENT_STORE_1F): + gUnknown_0203AB60 = 0; + gUnknown_0203AB62 = 4; + break; + } + } + + return gUnknown_0203AB62; +} + +void ShakeScreenInElevator(void) +{ + static const u8 gUnknown_085B2C18[] = { 0x08, 0x10, 0x18, 0x20, 0x26, 0x2e, 0x34, 0x38, 0x39 }; + + s16 *data = gTasks[CreateTask(sub_8139AF4, 9)].data; + u16 floorDelta; + + data[1] = 0; + data[2] = 0; + data[4] = 1; + + if (gSpecialVar_0x8005 > gSpecialVar_0x8006) + { + floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006; + data[6] = 1; + } + else + { + floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005; + data[6] = 0; + } + + if (floorDelta > 8) + floorDelta = 8; + + data[5] = gUnknown_085B2C18[floorDelta]; + + SetCameraPanningCallback(NULL); + sub_8139C2C(floorDelta, data[6]); + PlaySE(SE_ELEBETA); +} + +static void sub_8139AF4(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + data[1]++; + if (data[1] % 3 == 0) + { + data[1] = 0; + data[2]++; + data[4] = -data[4]; + SetCameraPanning(0, data[4]); + if (data[2] == data[5]) + { + PlaySE(SE_PINPON); + DestroyTask(taskId); + EnableBothScriptContexts(); + InstallCameraPanAheadCallback(); + } + } +} + +void sub_8139B60(void) +{ + int xPos; + + gUnknown_0203AB5E = AddWindow(&gUnknown_085B2BAC); + SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + + xPos = GetStringCenterAlignXOffset(1, gText_ElevatorNowOn, 64); + PrintTextOnWindow(gUnknown_0203AB5E, 1, gText_ElevatorNowOn, xPos, 1, TEXT_SPEED_FF, NULL); + + xPos = GetStringCenterAlignXOffset(1, gElevatorFloorsTable[gSpecialVar_0x8005], 64); + PrintTextOnWindow(gUnknown_0203AB5E, 1, gElevatorFloorsTable[gSpecialVar_0x8005], xPos, 17, TEXT_SPEED_FF, NULL); + + PutWindowTilemap(gUnknown_0203AB5E); + CopyWindowToVram(gUnknown_0203AB5E, 3); +} + +void sub_8139C10(void) +{ + sub_8198070(gUnknown_0203AB5E, TRUE); + RemoveWindow(gUnknown_0203AB5E); +} + +static void sub_8139C2C(u16 a1, u8 a2) +{ + static const u8 gUnknown_085B2C21[] = { 0x03, 0x06, 0x09, 0x0c, 0x0f, 0x12, 0x15, 0x18, 0x1b }; + + if (FuncIsActiveTask(sub_8139C80) != TRUE) + { + u8 taskId = CreateTask(sub_8139C80, 8); + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = a2; + gTasks[taskId].data[3] = gUnknown_085B2C21[a1]; + } +} + +// Annoyingly close but compiler wants to add all the parts of the index into the arrays +// first and then shift by one, whereas we need each individual part to shift and then be added. +#ifdef NONMATCHING +static void sub_8139C80(u8 taskId) +{ + u8 x, y; + s16 *data = gTasks[taskId].data; + + if (data[1] == 6) + { + data[0]++; + if (data[2] == 0) + { + for (y = 0; y < 3; y++) + { + for (x = 0; x < 3; x++) + { + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y * 3 + data[0] % 3] | 0xC00); + } + } + } + else + { + for (y = 0; y < 3; y++) + { + for (x = 0; x < 3; x++) + { + MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y * 3 + data[0] % 3] | 0xC00); + } + } + } + DrawWholeMapView(); + data[1] = 0; + if (data[0] == data[3]) + { + DestroyTask(taskId); + } + } + data[1]++; +} +#else +NAKED +static void sub_8139C80(u8 taskId) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x4\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp]\n\ + lsls r0, 2\n\ + ldr r1, [sp]\n\ + adds r0, r1\n\ + lsls r0, 3\n\ + ldr r1, =gTasks + 0x8\n\ + adds r6, r0, r1\n\ + movs r2, 0x2\n\ + ldrsh r0, [r6, r2]\n\ + cmp r0, 0x6\n\ + bne _08139D7C\n\ + ldrh r0, [r6]\n\ + adds r0, 0x1\n\ + strh r0, [r6]\n\ + movs r1, 0x4\n\ + ldrsh r0, [r6, r1]\n\ + cmp r0, 0\n\ + bne _08139D10\n\ + movs r1, 0\n\ + ldr r2, =gUnknown_085B2BF4\n\ + mov r10, r2\n\ +_08139CBA:\n\ + movs r5, 0\n\ + adds r7, r1, 0x7\n\ + lsls r0, r1, 1\n\ + adds r2, r1, 0x1\n\ + mov r8, r2\n\ + adds r0, r1\n\ + lsls r0, 1\n\ + mov r9, r0\n\ +_08139CCA:\n\ + adds r4, r5, 0\n\ + adds r4, 0x8\n\ + movs r1, 0\n\ + ldrsh r0, [r6, r1]\n\ + movs r1, 0x3\n\ + bl __modsi3\n\ + lsls r0, 16\n\ + asrs r0, 15\n\ + add r0, r9\n\ + add r0, r10\n\ + ldrh r0, [r0]\n\ + movs r1, 0xC0\n\ + lsls r1, 4\n\ + adds r2, r1, 0\n\ + orrs r2, r0\n\ + adds r0, r4, 0\n\ + adds r1, r7, 0\n\ + bl MapGridSetMetatileIdAt\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x2\n\ + bls _08139CCA\n\ + mov r2, r8\n\ + lsls r0, r2, 24\n\ + lsrs r1, r0, 24\n\ + cmp r1, 0x2\n\ + bls _08139CBA\n\ + b _08139D62\n\ + .pool\n\ +_08139D10:\n\ + movs r1, 0\n\ + ldr r0, =gUnknown_085B2C06\n\ + mov r10, r0\n\ +_08139D16:\n\ + movs r5, 0\n\ + adds r7, r1, 0x7\n\ + lsls r0, r1, 1\n\ + adds r2, r1, 0x1\n\ + mov r8, r2\n\ + adds r0, r1\n\ + lsls r0, 1\n\ + mov r9, r0\n\ +_08139D26:\n\ + adds r4, r5, 0\n\ + adds r4, 0x8\n\ + movs r1, 0\n\ + ldrsh r0, [r6, r1]\n\ + movs r1, 0x3\n\ + bl __modsi3\n\ + lsls r0, 16\n\ + asrs r0, 15\n\ + add r0, r9\n\ + add r0, r10\n\ + ldrh r0, [r0]\n\ + movs r1, 0xC0\n\ + lsls r1, 4\n\ + adds r2, r1, 0\n\ + orrs r2, r0\n\ + adds r0, r4, 0\n\ + adds r1, r7, 0\n\ + bl MapGridSetMetatileIdAt\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x2\n\ + bls _08139D26\n\ + mov r2, r8\n\ + lsls r0, r2, 24\n\ + lsrs r1, r0, 24\n\ + cmp r1, 0x2\n\ + bls _08139D16\n\ +_08139D62:\n\ + bl DrawWholeMapView\n\ + movs r0, 0\n\ + strh r0, [r6, 0x2]\n\ + movs r0, 0\n\ + ldrsh r1, [r6, r0]\n\ + movs r2, 0x6\n\ + ldrsh r0, [r6, r2]\n\ + cmp r1, r0\n\ + bne _08139D7C\n\ + ldr r0, [sp]\n\ + bl DestroyTask\n\ +_08139D7C:\n\ + ldrh r0, [r6, 0x2]\n\ + adds r0, 0x1\n\ + strh r0, [r6, 0x2]\n\ + add sp, 0x4\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NAKED + +void sub_8139D98(void) +{ + u8 i; + u32 ivStorage[6]; + + ivStorage[0] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV); + ivStorage[1] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV); + ivStorage[2] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV); + ivStorage[3] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV); + ivStorage[4] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV); + ivStorage[5] = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV); + + gSpecialVar_0x8005 = 0; + + for (i = 0; i < ARRAY_COUNT(ivStorage); i++) + { + gSpecialVar_0x8005 += ivStorage[i]; + } + + gSpecialVar_0x8006 = 0; + gSpecialVar_0x8007 = ivStorage[0]; // HP IV + + for (i = 1; i < 6; i++) + { + if (ivStorage[gSpecialVar_0x8006] < ivStorage[i]) + { + gSpecialVar_0x8006 = i; + gSpecialVar_0x8007 = ivStorage[i]; + } + else if (ivStorage[gSpecialVar_0x8006] == ivStorage[i]) + { + u16 randomNumber = Random(); + if ((randomNumber & 1) != 0) + { + gSpecialVar_0x8006 = i; + gSpecialVar_0x8007 = ivStorage[i]; + } + } + } +} + +bool32 warp0_in_pokecenter(void) +{ + static const u16 gUnknown_085B2C2A[] = { 0x0202, 0x0301, 0x0405, 0x0504, 0x0604, 0x0700, 0x0804, 0x090b, 0x0a05, 0x0b05, 0x0c02, 0x0d06, 0x0e03, 0x0f02, 0x100c, 0x100a, 0x1a35, 0x193c, 0xffff }; + + int i; + u16 map = (gUnknown_020322DC.mapGroup << 8) + gUnknown_020322DC.mapNum; + + for (i = 0; gUnknown_085B2C2A[i] != 0xFFFF; i++) + { + if (gUnknown_085B2C2A[i] == map) + return TRUE; + } + + return FALSE; +} + +bool32 sub_8139ED0(void) +{ + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(TRAINER_HILL_ENTRANCE) && gSaveBlock1Ptr->location.mapNum == MAP_NUM(TRAINER_HILL_ENTRANCE)) + { + return FALSE; + } + return TRUE; +} + +void UpdateFrontierManiac(u16 a0) +{ + u16 *var = GetVarPointer(VAR_FRONTIER_MANIAC_FACILITY); + *var += a0; + *var %= 10; +} + +void sub_8139F20(void) +{ + static const u8 *const gUnknown_085B2C50[][3] = { + { BattleFrontier_Lounge2_Text_260971, BattleFrontier_Lounge2_Text_260A1E, BattleFrontier_Lounge2_Text_260AE7 }, + { BattleFrontier_Lounge2_Text_2619AC, BattleFrontier_Lounge2_Text_261A91, BattleFrontier_Lounge2_Text_261B0C }, + { BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95, BattleFrontier_Lounge2_Text_261B95 }, + { BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A, BattleFrontier_Lounge2_Text_261C1A }, + { BattleFrontier_Lounge2_Text_260BC4, BattleFrontier_Lounge2_Text_260C6D, BattleFrontier_Lounge2_Text_260D3A }, + { BattleFrontier_Lounge2_Text_260E1E, BattleFrontier_Lounge2_Text_260EC7, BattleFrontier_Lounge2_Text_260F74 }, + { BattleFrontier_Lounge2_Text_2614E6, BattleFrontier_Lounge2_Text_261591, BattleFrontier_Lounge2_Text_26166F }, + { BattleFrontier_Lounge2_Text_261282, BattleFrontier_Lounge2_Text_261329, BattleFrontier_Lounge2_Text_261403 }, + { BattleFrontier_Lounge2_Text_261026, BattleFrontier_Lounge2_Text_2610CC, BattleFrontier_Lounge2_Text_261194 }, + { BattleFrontier_Lounge2_Text_26174D, BattleFrontier_Lounge2_Text_2617F9, BattleFrontier_Lounge2_Text_2618C4 }, + }; + + static const u8 gUnknown_085B2CC8[][2] = { + { 0x15, 0x38 }, + { 0x15, 0x23 }, + { 0xff, 0xff }, + { 0xff, 0xff }, + { 0x02, 0x04 }, + { 0x07, 0x15 }, + { 0x07, 0x15 }, + { 0x0e, 0x1c }, + { 0x0d, 0x70 }, + { 0x07, 0x38 } + }; + + u8 i; + u16 unk = 0; + u16 var = VarGet(VAR_FRONTIER_MANIAC_FACILITY); + switch (var) + { + case 0: + case 1: + case 2: + case 3: + if (gSaveBlock2Ptr->frontier.field_CE0[var][0] >= gSaveBlock2Ptr->frontier.field_CE0[var][1]) + { + unk = gSaveBlock2Ptr->frontier.field_CE0[var][0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_CE0[var][1]; + } + break; + case 4: + if (gSaveBlock2Ptr->frontier.field_D0C[0] >= gSaveBlock2Ptr->frontier.field_D0C[1]) + { + unk = gSaveBlock2Ptr->frontier.field_D0C[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_D0C[1]; + } + break; + case 5: + if (gSaveBlock2Ptr->frontier.field_DE2[0] >= gSaveBlock2Ptr->frontier.field_DE2[1]) + { + unk = gSaveBlock2Ptr->frontier.field_DE2[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_DE2[1]; + } + break; + case 6: + if (gSaveBlock2Ptr->frontier.field_DC8[0] >= gSaveBlock2Ptr->frontier.field_DC8[1]) + { + unk = gSaveBlock2Ptr->frontier.field_DC8[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_DC8[1]; + } + break; + case 7: + if (gSaveBlock2Ptr->frontier.field_DDA[0] >= gSaveBlock2Ptr->frontier.field_DDA[1]) + { + unk = gSaveBlock2Ptr->frontier.field_DDA[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_DDA[1]; + } + break; + case 8: + if (gSaveBlock2Ptr->frontier.field_E04[0] >= gSaveBlock2Ptr->frontier.field_E04[1]) + { + unk = gSaveBlock2Ptr->frontier.field_E04[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_E04[1]; + } + break; + case 9: + if (gSaveBlock2Ptr->frontier.field_E1A[0] >= gSaveBlock2Ptr->frontier.field_E1A[1]) + { + unk = gSaveBlock2Ptr->frontier.field_E1A[0]; + } + else + { + unk = gSaveBlock2Ptr->frontier.field_E1A[1]; + } + break; + } + + for (i = 0; i < 2 && gUnknown_085B2CC8[var][i] < unk; i++); + + ShowFieldMessage(gUnknown_085B2C50[var][i]); +} + +void sub_813A080(void) +{ + static const u16 gUnknown_085B2CDC[] = { + 0x0007, 0x000e, 0x0015, 0x001c, 0x0023, 0x0031, 0x003f, 0x004d, 0x005b, 0x0000 + }; + + u8 i; + u16 var = VarGet(VAR_0x40CE); + u8 chosenLevel = gSaveBlock2Ptr->frontier.chosenLvl; + + if (var == 2 && !FlagGet(FLAG_0x152)) + { + gSpecialVar_0x8005 = 5; + gSpecialVar_0x8006 = 4; + return; + } + + for (i = 0; i < 9; i++) + { + if (gUnknown_085B2CDC[i] > gSaveBlock2Ptr->frontier.field_CE0[var][chosenLevel]) + { + gSpecialVar_0x8005 = 4; + gSpecialVar_0x8006 = i + 5; + return; + } + } + + gSpecialVar_0x8005 = 4; + gSpecialVar_0x8006 = 12; +} + +void sub_813A128(void) +{ + u8 taskId = CreateTask(sub_813A2DC, 8); + struct Task *task = &gTasks[taskId]; + task->data[11] = gSpecialVar_0x8004; + + switch (gSpecialVar_0x8004) + { + case 0: + task->data[0] = 1; + task->data[1] = 1; + task->data[2] = 1; + task->data[3] = 1; + task->data[4] = 1; + task->data[5] = 1; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 1: + task->data[0] = 5; + task->data[1] = 8; + task->data[2] = 1; + task->data[3] = 1; + task->data[4] = 9; + task->data[5] = 10; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 2: + task->data[0] = 6; + task->data[1] = 12; + task->data[2] = 1; + task->data[3] = 1; + task->data[4] = 7; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 3: + task->data[0] = 6; + task->data[1] = 11; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 4: + task->data[0] = 6; + task->data[1] = 6; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 5: + task->data[0] = 6; + task->data[1] = 7; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 6: + task->data[0] = 6; + task->data[1] = 10; + task->data[2] = 14; + task->data[3] = 1; + task->data[4] = 15; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 7: + task->data[0] = 6; + task->data[1] = 12; + task->data[2] = 15; + task->data[3] = 1; + task->data[4] = 14; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 8: + task->data[0] = 6; + task->data[1] = 10; + task->data[2] = 17; + task->data[3] = 1; + task->data[4] = 11; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 9: + case 10: + task->data[0] = 6; + task->data[1] = 11; + task->data[2] = 15; + task->data[3] = 1; + task->data[4] = 14; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 11: + task->data[0] = 6; + task->data[1] = 7; + task->data[2] = 19; + task->data[3] = 1; + task->data[4] = 10; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + case 12: + task->data[0] = 6; + task->data[1] = 7; + task->data[2] = 17; + task->data[3] = 1; + task->data[4] = 12; + task->data[5] = 12; + task->data[6] = 0; + task->data[15] = taskId; + break; + default: + gSpecialVar_Result = 0x7F; + DestroyTask(taskId); + break; + } +} + +static const u8 *const gUnknown_085B2CF0[][16] = { + { + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_BlueFlute, + gText_YellowFlute, + gText_RedFlute, + gText_WhiteFlute, + gText_BlackFlute, + gText_PrettyChair, + gText_PrettyDesk, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_0Pts, + gText_10Pts, + gText_20Pts, + gText_30Pts, + gText_40Pts, + gText_50Pts, + gText_60Pts, + gText_70Pts, + gText_80Pts, + gText_90Pts, + gText_100Pts, + gText_QuestionMark, + NULL, + NULL, + NULL, + NULL + }, + { + gText_KissPoster16BP, + gText_KissCushion32BP, + gText_SmoochumDoll32BP, + gText_TogepiDoll48BP, + gText_MeowthDoll48BP, + gText_ClefairyDoll48BP, + gText_DittoDoll48BP, + gText_CyndaquilDoll80BP, + gText_ChikoritaDoll80BP, + gText_TotodileDoll80BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_LaprasDoll128BP, + gText_SnorlaxDoll128BP, + gText_VenusaurDoll256BP, + gText_CharizardDoll256BP, + gText_BlastoiseDoll256BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_Protein1BP, + gText_Calcium1BP, + gText_Iron1BP, + gText_Zinc1BP, + gText_Carbos1BP, + gText_HpUp1BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_Leftovers48BP, + gText_WhiteHerb48BP, + gText_QuickClaw48BP, + gText_MentalHerb48BP, + gText_BrightPowder64BP, + gText_ChoiceBand64BP, + gText_KingsRock64BP, + gText_FocusBand64BP, + gText_ScopeLens64BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_EnergyPowder50, + gText_EnergyRoot80, + gText_HealPowder50, + gText_RevivalHerb300, + gText_Protein1000, + gText_Iron1000, + gText_Carbos1000, + gText_Calcium1000, + gText_Zinc1000, + gText_HPUp1000, + gText_PPUp3000, + gText_Exit, + NULL, + NULL, + NULL, + NULL + }, + { + gText_BattleTower2, + gText_BattleDome, + gText_BattlePalace, + gText_BattleArena, + gText_BattleFactory, + gText_BattlePike, + gText_BattlePyramid, + gText_RankingHall, + gText_ExchangeService, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_Softboiled16BP, + gText_SeismicToss24BP, + gText_DreamEater24BP, + gText_MegaPunch24BP, + gText_MegaKick48BP, + gText_BodySlam48BP, + gText_RockSlide48BP, + gText_Counter48BP, + gText_ThunderWave48BP, + gText_SwordsDance48BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_DefenseCurl16BP, + gText_Snore24BP, + gText_MudSlap24BP, + gText_Swift24BP, + gText_IcyWind24BP, + gText_Endure48BP, + gText_PsychUp48BP, + gText_IcePunch48BP, + gText_ThunderPunch48BP, + gText_FirePunch48BP, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_SlateportCity, + gText_BattleFrontier, + gText_SouthernIsland, + gText_NavelRock, + gText_BirthIsland, + gText_FarawayIsland, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + }, + { + gText_BattleTrainers, + gText_BattleBasics, + gText_PokemonNature, + gText_PokemonMoves, + gText_Underpowered, + gText_WhenInDanger, + gText_Exit, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL + } +}; + +static void sub_813A2DC(u8 taskId) +{ + u32 unk1; + u8 i, windowId; + struct WindowTemplate template; + struct Task *task = &gTasks[taskId]; + + ScriptContext2_Enable(); + gUnknown_0203AB68 = 0; + gUnknown_0203AB6C = 0x40; + sub_813AA60(task->data[11], 0); + sub_813ACE8(task->data[11], 0); + gUnknown_0203AB64 = AllocZeroed(task->data[1] * 8); + gUnknown_0203AB6A = 0; + sub_813A42C(); + + for (unk1 = 0, i = 0; i < task->data[1]; i++) + { + const u8 *text = gUnknown_085B2CF0[gSpecialVar_0x8004][i]; + gUnknown_0203AB64[i].name = text; + gUnknown_0203AB64[i].id = i; + unk1 = display_text_and_get_width(text, unk1); + } + + task->data[4] = convert_pixel_width_to_tile_width(unk1); + + if (task->data[2] + task->data[4] > 0x1D) + { + int unk2 = 0x1D - task->data[4]; + if (unk2 < 0) + { + task->data[2] = 0; + } + else + { + task->data[2] = unk2; + } + } + + template = CreateWindowTemplate(0, task->data[2], task->data[3], task->data[4], task->data[5], 0xF, 0x64); + windowId = AddWindow(&template); + task->data[13] = windowId; + SetStandardWindowBorderStyle(windowId, 0); + + gUnknown_030061D0.totalItems = task->data[1]; + gUnknown_030061D0.maxShowed = task->data[0]; + gUnknown_030061D0.windowId = task->data[13]; + + sub_813A694(taskId); + task->data[14] = ListMenuInit(&gUnknown_030061D0, task->data[7], task->data[8]); + schedule_bg_copy_tilemap_to_vram(0); + gTasks[taskId].func = sub_813A4EC; +} + +static void sub_813A42C(void) +{ + gUnknown_030061D0.items = gUnknown_0203AB64; + gUnknown_030061D0.moveCursorFunc = sub_813A46C; + gUnknown_030061D0.itemPrintFunc = NULL; + gUnknown_030061D0.totalItems = 1; + gUnknown_030061D0.maxShowed = 1; + gUnknown_030061D0.windowId = 0; + gUnknown_030061D0.header_X = 0; + gUnknown_030061D0.item_X = 8; + gUnknown_030061D0.cursor_X = 0; + gUnknown_030061D0.upText_Y = 1; + gUnknown_030061D0.cursorPal = 2; + gUnknown_030061D0.fillValue = 1; + gUnknown_030061D0.cursorShadowPal = 3; + gUnknown_030061D0.lettersSpacing = 0; + gUnknown_030061D0.itemVerticalPadding = 0; + gUnknown_030061D0.scrollMultiple = 0; + gUnknown_030061D0.fontId = 1; + gUnknown_030061D0.cursorKind = 0; +} + +static void sub_813A46C(s32 itemIndex, bool8 onInit, struct ListMenu *list) +{ + u8 taskId; + PlaySE(SE_SELECT); + taskId = FindTaskIdByFunc(sub_813A4EC); + if (taskId != 0xFF) + { + u16 misc; + struct Task *task = &gTasks[taskId]; + ListMenuGetScrollAndRow(task->data[14], &misc, NULL); + gUnknown_0203AB68 = misc; + ListMenuGetCurrentItemArrayId(task->data[14], &misc); + sub_813AC44(task->data[11], gUnknown_0203AB6A); + sub_813AA60(task->data[11], misc); + sub_813AD34(task->data[11], misc); + gUnknown_0203AB6A = misc; + } +} + +// stupid r5<->r6 swap +#ifdef NONMATCHING +static void sub_813A4EC(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + s32 itemId = ListMenuHandleInputGetItemId(task->data[14]); + + switch (itemId) + { + case LIST_NOTHING_CHOSEN: + break; + case LIST_B_PRESSED: + gSpecialVar_Result = 0x7F; + PlaySE(SE_SELECT); + sub_813A570(taskId); + break; + default: + gSpecialVar_Result = itemId; + PlaySE(SE_SELECT); + if (!task->data[6] || itemId == task->data[1] - 1) + { + sub_813A570(taskId); + } + else + { + sub_813A738(taskId); + task->func = sub_813A600; + EnableBothScriptContexts(); + } + break; + } +} +#else +NAKED +static void sub_813A4EC(u8 taskId) +{ + asm_unified("push {r4-r6,lr}\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + lsls r0, r5, 2\n\ + adds r0, r5\n\ + lsls r0, 3\n\ + ldr r1, =gTasks\n\ + adds r6, r0, r1\n\ + ldrh r0, [r6, 0x24]\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + bl ListMenuHandleInputGetItemId\n\ + adds r4, r0, 0\n\ + movs r0, 0x2\n\ + negs r0, r0\n\ + cmp r4, r0\n\ + beq _0813A51C\n\ + adds r0, 0x1\n\ + cmp r4, r0\n\ + bne _0813A530\n\ + b _0813A566\n\ + .pool\n\ +_0813A51C:\n\ + ldr r1, =gSpecialVar_Result\n\ + movs r0, 0x7F\n\ + strh r0, [r1]\n\ + movs r0, 0x5\n\ + bl PlaySE\n\ + b _0813A54C\n\ + .pool\n\ +_0813A530:\n\ + ldr r0, =gSpecialVar_Result\n\ + strh r4, [r0]\n\ + movs r0, 0x5\n\ + bl PlaySE\n\ + movs r1, 0x14\n\ + ldrsh r0, [r6, r1]\n\ + cmp r0, 0\n\ + beq _0813A54C\n\ + movs r1, 0xA\n\ + ldrsh r0, [r6, r1]\n\ + subs r0, 0x1\n\ + cmp r4, r0\n\ + bne _0813A558\n\ +_0813A54C:\n\ + adds r0, r5, 0\n\ + bl sub_813A570\n\ + b _0813A566\n\ + .pool\n\ +_0813A558:\n\ + adds r0, r5, 0\n\ + bl sub_813A738\n\ + ldr r0, =sub_813A600\n\ + str r0, [r6]\n\ + bl EnableBothScriptContexts\n\ +_0813A566:\n\ + pop {r4-r6}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +static void sub_813A570(u8 taskId) +{ + u16 array; + struct Task *task = &gTasks[taskId]; + ListMenuGetCurrentItemArrayId(task->data[14], &array); + sub_813AC44(task->data[11], array); + sub_813A738(taskId); + DestroyListMenuTask(task->data[14], NULL, NULL); + Free(gUnknown_0203AB64); + sub_8198070(task->data[13], 1); + FillWindowPixelBuffer(task->data[13], 0); + CopyWindowToVram(task->data[13], 2); + RemoveWindow(task->data[13]); + DestroyTask(taskId); + EnableBothScriptContexts(); +} + +static void sub_813A600(u8 taskId) +{ + switch (gTasks[taskId].data[6]) + { + case 1: + default: + break; + case 2: + gTasks[taskId].data[6] = 1; + gTasks[taskId].func = sub_813A664; + break; + } +} + +void sub_813A630(void) +{ + u8 taskId = FindTaskIdByFunc(sub_813A600); + if (taskId == 0xFF) + { + EnableBothScriptContexts(); + } + else + { + gTasks[taskId].data[6]++; + } +} + +static void sub_813A664(u8 taskId) +{ + ScriptContext2_Enable(); + sub_813A694(taskId); + gTasks[taskId].func = sub_813A4EC; +} + +static void sub_813A694(u8 taskId) +{ + static const struct ScrollArrowsTemplate gUnknown_085B3030 = { + .firstArrowType = 2, + .firstX = 0, + .firstY = 0, + .secondArrowType = 3, + .secondX = 0, + .secondY = 0, + .fullyUpThreshold = 0, + .fullyDownThreshold = 0, + .tileTag = 2000, + .palTag = 100, + .palNum = 0 + }; + + struct Task *task = &gTasks[taskId]; + struct ScrollArrowsTemplate template = gUnknown_085B3030; + if (task->data[0] != task->data[1]) + { + template.firstX = (task->data[4] / 2) * 8 + 12 + (task->data[2] - 1) * 8; + template.firstY = 8; + template.secondX = (task->data[4] / 2) * 8 + 12 + (task->data[2] - 1) * 8; + template.secondY = task->data[5] * 8 + 10; + template.fullyUpThreshold = 0; + template.fullyDownThreshold = task->data[1] - task->data[0]; + task->data[12] = AddScrollIndicatorArrowPair(&template, &gUnknown_0203AB68); + } +} + +static void sub_813A738(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; + if (task->data[0] != task->data[1]) + { + RemoveScrollIndicatorArrowPair(task->data[12]); + } +} + +void nullsub_55(void) +{ + +} + +void sub_813A76C(void) +{ + u8 i; + for (i = 0; i < 2; i++) + { + if (gLinkPlayers[i].gender == MALE) + { + VarSet(VAR_OBJ_GFX_ID_F - i, EVENT_OBJ_GFX_BRENDAN_NORMAL); + } + else + { + VarSet(VAR_OBJ_GFX_ID_F - i, EVENT_OBJ_GFX_RIVAL_MAY_NORMAL); + } + } +} + +void sub_813A7B8(void) +{ + static const u8 *const gUnknown_085B3040[] = { + BattleFrontier_Lounge5_Text_26468D, + BattleFrontier_Lounge5_Text_2646E5, + BattleFrontier_Lounge5_Text_264741, + BattleFrontier_Lounge5_Text_2647A4, + BattleFrontier_Lounge5_Text_2647FC, + BattleFrontier_Lounge5_Text_264858, + BattleFrontier_Lounge5_Text_2648BE, + BattleFrontier_Lounge5_Text_264916, + BattleFrontier_Lounge5_Text_264972, + BattleFrontier_Lounge5_Text_2649D5, + BattleFrontier_Lounge5_Text_264A3F, + BattleFrontier_Lounge5_Text_264A9B, + BattleFrontier_Lounge5_Text_264AF3, + BattleFrontier_Lounge5_Text_264B5D, + BattleFrontier_Lounge5_Text_2648BE, + BattleFrontier_Lounge5_Text_264BC3, + BattleFrontier_Lounge5_Text_264C36, + BattleFrontier_Lounge5_Text_2648BE, + BattleFrontier_Lounge5_Text_264C95, + BattleFrontier_Lounge5_Text_264D01, + BattleFrontier_Lounge5_Text_264D6B, + BattleFrontier_Lounge5_Text_264DD7, + BattleFrontier_Lounge5_Text_264E33, + BattleFrontier_Lounge5_Text_264E8F, + BattleFrontier_Lounge5_Text_2648BE, + }; + + u8 nature; + + if (gSpecialVar_0x8004 >= PARTY_SIZE) + { + gSpecialVar_0x8004 = 0; + } + + nature = GetNature(&gPlayerParty[gSpecialVar_0x8004]); + ShowFieldMessage(gUnknown_085B3040[nature]); +} + +void UpdateFrontierGambler(u16 a0) +{ + u16 *var = GetVarPointer(VAR_FRONTIER_GAMBLER_FACILITY); + *var += a0; + *var %= 12; +} + +void sub_813A820(void) +{ + static const u8 *const gUnknown_085B30A4[] = { + BattleFrontier_Lounge3_Text_262261, + BattleFrontier_Lounge3_Text_26230D, + BattleFrontier_Lounge3_Text_2623B9, + BattleFrontier_Lounge3_Text_262464, + BattleFrontier_Lounge3_Text_26250E, + BattleFrontier_Lounge3_Text_2625B8, + BattleFrontier_Lounge3_Text_26266A, + BattleFrontier_Lounge3_Text_26271C, + BattleFrontier_Lounge3_Text_2627C9, + BattleFrontier_Lounge3_Text_262876, + BattleFrontier_Lounge3_Text_26291A, + BattleFrontier_Lounge3_Text_2629BC, + }; + + u16 var = VarGet(VAR_FRONTIER_GAMBLER_FACILITY); + ShowFieldMessage(gUnknown_085B30A4[var]); + VarSet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F, var); +} + +void sub_813A854(void) +{ + static const u8 *const gUnknown_085B30D4[] = { + BattleFrontier_Lounge3_Text_262C04, + BattleFrontier_Lounge3_Text_262C90, + BattleFrontier_Lounge3_Text_262D1C, + BattleFrontier_Lounge3_Text_262DA7, + BattleFrontier_Lounge3_Text_262E34, + BattleFrontier_Lounge3_Text_262EC1, + BattleFrontier_Lounge3_Text_262F56, + BattleFrontier_Lounge3_Text_262FEB, + BattleFrontier_Lounge3_Text_263078, + BattleFrontier_Lounge3_Text_263105, + BattleFrontier_Lounge3_Text_26318C, + BattleFrontier_Lounge3_Text_263211, + }; + + ShowFieldMessage(gUnknown_085B30D4[VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F)]); +} + +void sub_813A878(u8 a0) +{ + static const u16 gUnknown_085B3104[] = {0x0000, 0x0001, 0x0002, 0x0100, 0x0101, 0x0400, 0x0401, 0x0200, 0x0201, 0x0300, 0x0500, 0x0600}; + + u16 var1 = VarGet(VAR_0x40CE); + u16 var2 = VarGet(VAR_FRONTIER_GAMBLER_SET_FACILITY_F); + u16 var3 = VarGet(VAR_FRONTIER_FACILITY); + + if (VarGet(VAR_FRONTIER_GAMBLER_PLACED_BET_F) == 1) + { + if (gUnknown_085B3104[var2] == (var3 << 8) + var1) + { + if (a0 != 0) + { + VarSet(VAR_FRONTIER_GAMBLER_PLACED_BET_F, 2); + } + else + { + VarSet(VAR_FRONTIER_GAMBLER_PLACED_BET_F, 3); + } + } + } +} + +void sub_813A8FC(void) +{ + u8 string[32]; + u32 x; + StringCopy(ConvertIntToDecimalStringN(string, gSaveBlock2Ptr->frontier.frontierBattlePoints, STR_CONV_MODE_RIGHT_ALIGN, 4), gText_BP); + x = GetStringRightAlignXOffset(1, string, 48); + PrintTextOnWindow(gUnknown_0203AB6D, 1, string, x, 1, 0, NULL); +} + +void sub_813A958(void) +{ + static const struct WindowTemplate gUnknown_085B311C = { + .priority = 0, + .tilemapLeft = 1, + .tilemapTop = 1, + .width = 6, + .height = 2, + .paletteNum = 15, + .baseBlock = 8, + }; + + gUnknown_0203AB6D = AddWindow(&gUnknown_085B311C); + SetStandardWindowBorderStyle(gUnknown_0203AB6D, 0); + sub_813A8FC(); + CopyWindowToVram(gUnknown_0203AB6D, 2); +} + +void sub_813A988(void) +{ + sub_8198070(gUnknown_0203AB6D, TRUE); + RemoveWindow(gUnknown_0203AB6D); +} + +void sub_813A9A4(void) +{ + if (gSaveBlock2Ptr->frontier.frontierBattlePoints < gSpecialVar_0x8004) + { + gSaveBlock2Ptr->frontier.frontierBattlePoints = 0; + } + else + { + gSaveBlock2Ptr->frontier.frontierBattlePoints -= gSpecialVar_0x8004; + } +} + +void sub_813A9D0(void) +{ + if (gSaveBlock2Ptr->frontier.frontierBattlePoints + gSpecialVar_0x8004 > 0x270F) + { + gSaveBlock2Ptr->frontier.frontierBattlePoints = 0x270f; + } + else + { + gSaveBlock2Ptr->frontier.frontierBattlePoints = gSaveBlock2Ptr->frontier.frontierBattlePoints + gSpecialVar_0x8004; + } +} + +u16 sub_813AA04(void) +{ + return gSaveBlock2Ptr->frontier.frontierBattlePoints; +} + +void sub_813AA18(void) +{ + static const struct WindowTemplate gUnknown_085B3124 = { + .priority = 0, + .tilemapLeft = 2, + .tilemapTop = 9, + .width = 4, + .height = 4, + .paletteNum = 15, + .baseBlock = 20, + }; + + gUnknown_0203AB6E = AddWindow(&gUnknown_085B3124); + SetStandardWindowBorderStyle(gUnknown_0203AB6E, 0); + CopyWindowToVram(gUnknown_0203AB6E, 2); +} + +void sub_813AA44(void) +{ + sub_8198070(gUnknown_0203AB6E, TRUE); + RemoveWindow(gUnknown_0203AB6E); +} + +static void sub_813AA60(u16 a0, u16 a1) +{ + static const u16 gUnknown_085B312C[] = { 0x004b, 0x0067, 0x0057, 0x004f, 0x0054, 0x0055, 0x0056, 0x0050, 0x0051, 0x0052, 0xffff }; + static const u16 gUnknown_085B3142[] = { 0x0071, 0x006f, 0x0072, 0x0073, 0x0074, 0xffff }; + static const u16 gUnknown_085B314E[] = { 0x0040, 0x0043, 0x0041, 0x0046, 0x0042, 0x003f, 0xffff }; + static const u16 gUnknown_085B315C[] = { 0x00c8, 0x00b4, 0x00b7, 0x00b9, 0x00b3, 0x00ba, 0x00bb, 0x00c4, 0x00c6, 0xffff }; + + static const u8 *const gUnknown_085B3170[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_2601AA, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2601D0, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260201, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26022F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26025B, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260287, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2602B5, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2602E0, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26030F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26033E, + gText_Exit, + }; + + static const u8 *const gUnknown_085B319C[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26036C, + gText_Exit + }; + + static const u8 *const gUnknown_085B31B4[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_260397, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2603BE, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2603E6, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26040E, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260436, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26045C, + gText_Exit + }; + + static const u8 *const gUnknown_085B31D0[] = { + BattleFrontier_BattlePointExchangeServiceCorner_Text_26047A, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2604AC, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2604D8, + BattleFrontier_BattlePointExchangeServiceCorner_Text_26050F, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260542, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260575, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2605A8, + BattleFrontier_BattlePointExchangeServiceCorner_Text_2605E2, + BattleFrontier_BattlePointExchangeServiceCorner_Text_260613, + gText_Exit + }; + + if (a0 > 2 && a0 < 7) + { + FillWindowPixelRect(0, 0x11, 0, 0, 216, 32); + switch (a0) + { + case 3: + AddTextPrinterParameterized(0, 1, gUnknown_085B3170[a1], 0, NULL, 2, 1, 3); + if (gUnknown_085B312C[a1] == 0xFFFF) + { + sub_813ABD4(gUnknown_085B312C[a1]); + } + else + { + FreeSpriteTilesByTag(5500); + FreeSpritePaletteByTag(5500); + gUnknown_0203AB6C = AddDecorationIconObject(gUnknown_085B312C[a1], 33, 88, 0, 5500, 5500); + } + break; + case 4: + AddTextPrinterParameterized(0, 1, gUnknown_085B319C[a1], 0, NULL, 2, 1, 3); + if (gUnknown_085B3142[a1] == 0xFFFF) + { + sub_813ABD4(gUnknown_085B3142[a1]); + } + else + { + FreeSpriteTilesByTag(5500); + FreeSpritePaletteByTag(5500); + gUnknown_0203AB6C = AddDecorationIconObject(gUnknown_085B3142[a1], 33, 88, 0, 5500, 5500); + } + break; + case 5: + AddTextPrinterParameterized(0, 1, gUnknown_085B31B4[a1], 0, NULL, 2, 1, 3); + sub_813ABD4(gUnknown_085B314E[a1]); + break; + case 6: + AddTextPrinterParameterized(0, 1, gUnknown_085B31D0[a1], 0, NULL, 2, 1, 3); + sub_813ABD4(gUnknown_085B315C[a1]); + break; + } + } +} + +static void sub_813ABD4(u16 a0) +{ + FreeSpriteTilesByTag(5500); + FreeSpritePaletteByTag(5500); + gUnknown_0203AB6C = AddItemIconSprite(5500, 5500, a0); + + if (gUnknown_0203AB6C != MAX_SPRITES) + { + gSprites[gUnknown_0203AB6C].oam.priority = 0; + gSprites[gUnknown_0203AB6C].pos1.x = 36; + gSprites[gUnknown_0203AB6C].pos1.y = 92; + } +} + +static void sub_813AC44(u16 a0, u16 unused) +{ + if (gUnknown_0203AB6C != MAX_SPRITES) + { + switch (a0) + { + case 3 ... 6: + DestroySpriteAndFreeResources(&gSprites[gUnknown_0203AB6C]); + break; + } + gUnknown_0203AB6C = MAX_SPRITES; + } +} + +static const u16 gUnknown_085B31F8[] = { 0x0087, 0x0045, 0x008a, 0x0005, 0x0019, 0x0022, 0x009d, 0x0044, 0x0056, 0x000e }; +static const u16 gUnknown_085B320C[] = { 0x006f, 0x00ad, 0x00bd, 0x0081, 0x00c4, 0x00cb, 0x00f4, 0x0008, 0x0009, 0x0007 }; + +void sub_813AC7C(void) +{ + if (gSpecialVar_0x8005 != 0) + { + StringCopy(gStringVar1, gMoveNames[gUnknown_085B320C[gSpecialVar_0x8004]]); + } + else + { + StringCopy(gStringVar1, gMoveNames[gUnknown_085B31F8[gSpecialVar_0x8004]]); + } +} + +static void sub_813ACE8(u8 a0, u16 a1) +{ + static const struct WindowTemplate gUnknown_085B3220 = { + .priority = 0, + .tilemapLeft = 1, + .tilemapTop = 7, + .width = 12, + .height = 6, + .paletteNum = 15, + .baseBlock = 28, + }; + + if (a0 == 9 || a0 == 10) + { + if (gSpecialVar_0x8006 == 0) + { + gUnknown_0203AB5E = AddWindow(&gUnknown_085B3220); + SetStandardWindowBorderStyle(gUnknown_0203AB5E, 0); + } + sub_813AD34(a0, a1); + } +} + +static void sub_813AD34(u8 a0, u16 a1) +{ + static const u8 *const gUnknown_085B3228[] = { + BattleFrontier_Lounge7_Text_265E30, + BattleFrontier_Lounge7_Text_265E5B, + BattleFrontier_Lounge7_Text_265E8A, + BattleFrontier_Lounge7_Text_265EC0, + BattleFrontier_Lounge7_Text_265EED, + BattleFrontier_Lounge7_Text_265F1C, + BattleFrontier_Lounge7_Text_265F47, + BattleFrontier_Lounge7_Text_265F77, + BattleFrontier_Lounge7_Text_265FAA, + BattleFrontier_Lounge7_Text_265FDD, + gText_Exit, + }; + + static const u8 *const gUnknown_085B3254[] = { + BattleFrontier_Lounge7_Text_26600A, + BattleFrontier_Lounge7_Text_26603E, + BattleFrontier_Lounge7_Text_266070, + BattleFrontier_Lounge7_Text_2660A6, + BattleFrontier_Lounge7_Text_2660D0, + BattleFrontier_Lounge7_Text_2660FF, + BattleFrontier_Lounge7_Text_26612D, + BattleFrontier_Lounge7_Text_26615F, + BattleFrontier_Lounge7_Text_266185, + BattleFrontier_Lounge7_Text_2661B5, + gText_Exit, + }; + + if (a0 == 9 || a0 == 10) + { + FillWindowPixelRect(gUnknown_0203AB5E, 0x11, 0, 0, 96, 48); + if (a0 == 10) + { + PrintTextOnWindow(gUnknown_0203AB5E, 1, gUnknown_085B3254[a1], 0, 1, 0, NULL); + } + else + { + PrintTextOnWindow(gUnknown_0203AB5E, 1, gUnknown_085B3228[a1], 0, 1, 0, NULL); + } + } +} + +void sub_813ADB8(void) +{ + sub_8198070(gUnknown_0203AB5E, TRUE); + RemoveWindow(gUnknown_0203AB5E); +} + +void sub_813ADD4(void) +{ + u16 scrollOffset, selectedRow; + u8 i; + u8 taskId = FindTaskIdByFunc(sub_813A600); + if (taskId != 0xFF) + { + struct Task *task = &gTasks[taskId]; + ListMenuGetScrollAndRow(task->data[14], &scrollOffset, &selectedRow); + SetStandardWindowBorderStyle(task->data[13], 0); + + for (i = 0; i < 6; i++) + { + sub_8199F74(task->data[13], 1, gUnknown_085B2CF0[gSpecialVar_0x8004][scrollOffset + i], 10, i * 16, TEXT_SPEED_FF, NULL, 0, 0); + } + + PrintTextOnWindow(task->data[13], 1, gText_SelectorArrow, 0, selectedRow * 16, TEXT_SPEED_FF, NULL); + PutWindowTilemap(task->data[13]); + CopyWindowToVram(task->data[13], 3); + } +} + +void sub_813AEB4(void) +{ + u8 i; + u16 temp1 = 0; + u16 temp2 = 0; + gSpecialVar_0x8005 = 0; + + temp1 = VarGet(VAR_TEMP_E); + temp2 = VarGet(VAR_TEMP_D); + + if (temp1 != 0) + { + i = 0; + do + { + if (gUnknown_0861500C[i] == gUnknown_085B320C[temp2]) + { + gSpecialVar_0x8005 = i; + break; + } + i++; + } while (i < 30); + } + else + { + i = 0; + do + { + if (gUnknown_0861500C[i] == gUnknown_085B31F8[temp2]) + { + gSpecialVar_0x8005 = i; + break; + } + i++; + } while (i < 30); + } +} + +void sub_813AF48(void) +{ + u8 taskId = FindTaskIdByFunc(sub_813A600); + if (taskId != 0xFF) + { + struct Task *task = &gTasks[taskId]; + DestroyListMenuTask(task->data[14], NULL, NULL); + Free(gUnknown_0203AB64); + sub_8198070(task->data[13], TRUE); + FillWindowPixelBuffer(task->data[13], 0); + ClearWindowTilemap(task->data[13]); + CopyWindowToVram(task->data[13], 2); + RemoveWindow(task->data[13]); + DestroyTask(taskId); + } +} + +void sub_813AFC8(void) +{ + CreateTask(task_deoxys_sound, 8); +} + +static const u16 gUnknown_085B3280[][16] = { + INCBIN_U16("graphics/misc/deoxys1.gbapal"), + INCBIN_U16("graphics/misc/deoxys2.gbapal"), + INCBIN_U16("graphics/misc/deoxys3.gbapal"), + INCBIN_U16("graphics/misc/deoxys4.gbapal"), + INCBIN_U16("graphics/misc/deoxys5.gbapal"), + INCBIN_U16("graphics/misc/deoxys6.gbapal"), + INCBIN_U16("graphics/misc/deoxys7.gbapal"), + INCBIN_U16("graphics/misc/deoxys8.gbapal"), + INCBIN_U16("graphics/misc/deoxys9.gbapal"), + INCBIN_U16("graphics/misc/deoxys10.gbapal"), + INCBIN_U16("graphics/misc/deoxys11.gbapal"), +}; + +static const u8 gUnknown_085B33E0[][2] = { + { 0x0f, 0x0c }, + { 0x0b, 0x0e }, + { 0x0f, 0x08 }, + { 0x13, 0x0e }, + { 0x0c, 0x0b }, + { 0x12, 0x0b }, + { 0x0f, 0x0e }, + { 0x0b, 0x0e }, + { 0x13, 0x0e }, + { 0x0f, 0x0f }, + { 0x0f, 0x0a }, +}; + +static void task_deoxys_sound(u8 taskId) +{ + static const u8 gUnknown_085B33F6[] = { 0x04, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x06, 0x03, 0x03 }; + + if (FlagGet(FLAG_0x8D4) == TRUE) + { + gSpecialVar_Result = 3; + EnableBothScriptContexts(); + DestroyTask(taskId); + } + else + { + u16 temp1 = VarGet(VAR_0x4035); + u16 temp2 = VarGet(VAR_0x4034); + + VarSet(VAR_0x4034, 0); + if (temp1 != 0 && gUnknown_085B33F6[temp1 - 1] < temp2) + { + sub_813B0B4(0); + VarSet(VAR_0x4035, 0); + gSpecialVar_Result = 0; + DestroyTask(taskId); + } + else if (temp1 == 10) + { + FlagSet(FLAG_0x8D4); + gSpecialVar_Result = 2; + EnableBothScriptContexts(); + DestroyTask(taskId); + } + else + { + temp1++; + sub_813B0B4(temp1); + VarSet(VAR_0x4035, temp1); + gSpecialVar_Result = 1; + DestroyTask(taskId); + } + } +} + +static void sub_813B0B4(u8 a0) +{ + u8 eventObjectId; + LoadPalette(&gUnknown_085B3280[a0], 0x1A0, 8); + TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId); + + if (a0 == 0) + { + PlaySE(SE_W109); + } + else + { + PlaySE(SE_RG_DEOMOV); + } + + CreateTask(sub_813B160, 8); + + gFieldEffectArguments[0] = 1; + gFieldEffectArguments[1] = 58; + gFieldEffectArguments[2] = 26; + gFieldEffectArguments[3] = gUnknown_085B33E0[a0][0]; + gFieldEffectArguments[4] = gUnknown_085B33E0[a0][1]; + + if (a0 == 0) + { + gFieldEffectArguments[5] = 60; + } + else + { + gFieldEffectArguments[5] = 5; + } + + FieldEffectStart(FLDEFF_66); + Overworld_SetEventObjTemplateCoords(1, gUnknown_085B33E0[a0][0], gUnknown_085B33E0[a0][1]); +} + +static void sub_813B160(u8 taskId) +{ + if (FieldEffectActiveListContains(FLDEFF_66) == FALSE) + { + EnableBothScriptContexts(); + DestroyTask(taskId); + } +} + +void increment_var_x4026_on_birth_island_modulo_100(void) +{ + u16 var = VarGet(VAR_0x4034); + if (gSaveBlock1Ptr->location.mapNum == MAP_NUM(BIRTH_ISLAND_EXTERIOR) && gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(BIRTH_ISLAND_EXTERIOR)) + { + var++; + if (var > 99) + { + VarSet(VAR_0x4034, 0); + } + else + { + VarSet(VAR_0x4034, var); + } + } +} + +void sub_813B1D0(void) +{ + LoadPalette(&gUnknown_085B3280[(u8)VarGet(VAR_0x4035)], 0x1A0, 8); + BlendPalettes(0x04000000, 16, 0); +} + +void set_unknown_box_id(u8 id) +{ + gUnknown_0203AB6F = id; +} + +u16 get_unknown_box_id(void) +{ + return gUnknown_0203AB6F; +} + +bool32 sub_813B21C(void) +{ + if (FlagGet(FLAG_SYS_STORAGE_UNKNOWN_FLAG) == FALSE) + { + if (StorageGetCurrentBox() != VarGet(VAR_STORAGE_UNKNOWN)) + { + FlagSet(FLAG_SYS_STORAGE_UNKNOWN_FLAG); + return TRUE; + } + } + return FALSE; +} + +bool8 sub_813B260(void) +{ + int box; + int i; + set_unknown_box_id(VarGet(VAR_STORAGE_UNKNOWN)); + box = StorageGetCurrentBox(); + do + { + for (i = 0; i < IN_BOX_COUNT; i++) + { + if (GetBoxMonData(GetBoxedMonPtr(box, i), MON_DATA_SPECIES, 0) == 0) + { + if (get_unknown_box_id() != box) + { + FlagClear(FLAG_SYS_STORAGE_UNKNOWN_FLAG); + } + VarSet(VAR_STORAGE_UNKNOWN, box); + return sub_813B21C(); + } + } + + if (++box == TOTAL_BOXES_COUNT) + { + box = 0; + } + } while (box != StorageGetCurrentBox()); + return FALSE; +} + +void sub_813B2E4(void) +{ + u16 randomValue = Random(); + VarSet(VAR_0x4038, 0); + + if (FlagGet(FLAG_0x1BE) == TRUE) + { + VarSet(VAR_0x4037, (randomValue & 7) + 1); + } + else if (FlagGet(FLAG_0x1BF) == TRUE) + { + VarSet(VAR_0x4037, (randomValue & 7) + 9); + } + else if ((randomValue & 1) == 0) + { + randomValue = Random(); + VarSet(VAR_0x4037, (randomValue & 7) + 1); + } + else + { + randomValue = Random(); + VarSet(VAR_0x4037, (randomValue & 7) + 9); + } +} + +bool32 sub_813B374(void) +{ + static const u8 gUnknown_085B3400[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; + + u16 var = VarGet(VAR_0x4037); + + GetMapName(gStringVar1, gUnknown_085B3400[var - 1], 0); + + if (var < 9) + { + return FALSE; + } + else + { + return TRUE; + } +} + +bool32 sub_813B3B0(void) +{ + static const u8 gUnknown_085B3410[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; + + u16 var1 = VarGet(VAR_0x4038); + u16 var2 = VarGet(VAR_0x4037); + + if (!var2) + { + return FALSE; + } + + if (++var1 > 999) + { + VarSet(VAR_0x4038, 0); + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE)) + { + switch (gSaveBlock1Ptr->location.mapNum) + { + case MAP_NUM(UNDERWATER_MARINE_CAVE): + case MAP_NUM(MARINE_CAVE_ENTRANCE): + case MAP_NUM(MARINE_CAVE_END): + case MAP_NUM(TERRA_CAVE_ENTRANCE): + case MAP_NUM(TERRA_CAVE_END): + VarSet(VAR_0x4039, 1); + return FALSE; + default: + break; + } + } + + if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER3)) + { + switch (gSaveBlock1Ptr->location.mapNum) + { + case MAP_NUM(UNDERWATER3): + case MAP_NUM(UNDERWATER5): + case MAP_NUM(UNDERWATER6): + case MAP_NUM(UNDERWATER7): + VarSet(VAR_0x4039, 1); + return FALSE; + default: + break; + } + } + + if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3410[var2 - 1] && + gSaveBlock1Ptr->location.mapGroup == 0) + { + return TRUE; + } + else + { + VarSet(VAR_0x4037, 0); + return FALSE; + } + } + else + { + VarSet(VAR_0x4038, var1); + return FALSE; + } +} + +void sub_813B484(void) +{ + sub_80AB104(2); +} + +bool32 sub_813B490(void) +{ + static const u8 gUnknown_085B3420[][3] = { + { 0x02, 0x04, 0x01 }, + { 0x04, 0x04, 0x01 }, + { 0x05, 0x00, 0x01 }, + { 0x06, 0x03, 0x01 }, + { 0x08, 0x06, 0x01 }, + { 0x09, 0x0d, 0x01 }, + { 0x0a, 0x07, 0x01 }, + { 0x0b, 0x07, 0x01 }, + { 0x0c, 0x04, 0x01 }, + { 0x0e, 0x05, 0x01 }, + { 0x0f, 0x04, 0x01 }, + { 0x1a, 0x37, 0x01 } + }; + + u8 i; + for (i = 0; i < 12; i++) + { + if (gSaveBlock1Ptr->location.mapGroup == gUnknown_085B3420[i][0]) + { + if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3420[i][1]) + { + return gUnknown_085B3420[i][2]; + } + } + } + return TRUE; +} + +bool32 sub_813B4E0(void) +{ + int index = GetRematchIdxByTrainerIdx(gSpecialVar_0x8004); + if (index >= 0) + { + if (FlagGet(FLAG_MATCH_CALL_REGISTERED + index) == TRUE) + return TRUE; + } + return FALSE; +} + +bool32 sub_813B514(void) +{ + if (!VarGet(VAR_0x403F)) + { + return FALSE; + } + return TRUE; +} + +void sub_813B534(void) +{ + gUnknown_0203AB70 = gBattleTypeFlags; + gBattleTypeFlags = 0; + if (!gReceivedRemoteLinkPlayers) + { + CreateTask(sub_80B3AF8, 5); + } +} + +void sub_813B568(void) +{ + CreateTask(sub_813B57C, 5); +} + +static void sub_813B57C(u8 taskId) +{ + switch (gTasks[taskId].data[0]) + { + case 0: + if (!FuncIsActiveTask(sub_80B3AF8)) + { + gTasks[taskId].data[0]++; + } + break; + case 1: + if (sub_800A520() == TRUE) + { + if (GetMultiplayerId() == 0) + { + gTasks[taskId].data[0]++; + } + else + { + SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_0x8004, 2); + gTasks[taskId].data[0]++; + } + } + break; + case 2: + if ((GetBlockReceivedStatus() & 2) != 0) + { + if (GetMultiplayerId() == 0) + { + gSpecialVar_0x8005 = gBlockRecvBuffer[1][0]; + ResetBlockReceivedFlag(1); + if (gSpecialVar_0x8004 == 1 && gSpecialVar_0x8005 == 1) + { + gSpecialVar_Result = 1; + } + else if (gSpecialVar_0x8004 == 0 && gSpecialVar_0x8005 == 1) + { + gSpecialVar_Result = 2; + } + else if (gSpecialVar_0x8004 == 1 && gSpecialVar_0x8005 == 0) + { + gSpecialVar_Result = 3; + } + else + { + gSpecialVar_Result = 0; + } + } + gTasks[taskId].data[0]++; + } + break; + case 3: + if (sub_800A520() == TRUE) + { + if (GetMultiplayerId() != 0) + { + gTasks[taskId].data[0]++; + } + else + { + SendBlock(bitmask_all_link_players_but_self(), &gSpecialVar_Result, 2); + gTasks[taskId].data[0]++; + } + } + break; + case 4: + if ((GetBlockReceivedStatus() & 1) != 0) + { + if (GetMultiplayerId() != 0) + { + gSpecialVar_Result = gBlockRecvBuffer[0][0]; + ResetBlockReceivedFlag(0); + gTasks[taskId].data[0]++; + } + else + { + gTasks[taskId].data[0]++; + } + } + break; + case 5: + if (GetMultiplayerId() == 0) + { + if (gSpecialVar_Result == 2) + { + ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + } + } + else + { + if (gSpecialVar_Result == 3) + { + ShowFieldAutoScrollMessage(gText_YourPartnerHasRetired); + } + } + gTasks[taskId].data[0]++; + break; + case 6: + if (!IsTextPrinterActive(0)) + { + gTasks[taskId].data[0]++; + } + break; + case 7: + if (sub_800A520() == 1) + { + sub_800ADF8(); + gTasks[taskId].data[0]++; + } + break; + case 8: + if (sub_800A520() == 1) + { + gTasks[taskId].data[0]++; + } + break; + case 9: + if (gWirelessCommType == 0) + { + sub_800AC34(); + } + gBattleTypeFlags = gUnknown_0203AB70; + EnableBothScriptContexts(); + DestroyTask(taskId); + break; + } +} + +void sub_813B7D8(void) +{ + if (gSpecialVar_0x8004 == 0) + { + DoRayquazaScene(0, TRUE, CB2_ReturnToFieldContinueScriptPlayMapMusic); + } + else + { + DoRayquazaScene(1, FALSE, CB2_ReturnToFieldContinueScriptPlayMapMusic); + } +} + +void sub_813B80C(void) +{ + CreateTask(sub_813B824, 8); + PlaySE(SE_W017); +} + +static void sub_813B824(u8 taskId) +{ + s16 *data = gTasks[taskId].data; + + data[1]++; + if (data[1] == gSpecialVar_0x8005) + { + data[0]++; + data[1] = 0; + PlaySE(SE_W017); + } + + if (data[0] == gSpecialVar_0x8004 - 1) + { + DestroyTask(taskId); + } +} + +void sub_813B880(void) +{ + u8 taskId = CreateTask(_fwalk, 8); + gTasks[taskId].data[0] = 4; + gTasks[taskId].data[1] = 4; + gTasks[taskId].data[2] = 4; + gTasks[taskId].data[3] = 0; +} + +static void _fwalk(u8 taskId) +{ + u8 x, y; + s16 *data = gTasks[taskId].data; + + data[data[3]]--; + if (data[data[3]] == 0) + { + for (y = 0; y < 4; y++) + { + for (x = 0; x < 3; x++) + { + MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + x + 6, gSaveBlock1Ptr->pos.y + y + 4, x + 0x201 + y * 8 + data[3] * 32); + } + } + DrawWholeMapView(); + data[3]++; + if (data[3] == 3) + { + DestroyTask(taskId); + EnableBothScriptContexts(); + } + } +} + +void sub_813B968(void) +{ + gSpecialVar_Result = gSpecialVar_0x8004 / 7; + gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20; +} + +void sub_813B9A0(void) +{ + if (gSaveBlock1Ptr->lastHealLocation.mapGroup == MAP_GROUP(DEWFORD_TOWN) && gSaveBlock1Ptr->lastHealLocation.mapNum == MAP_NUM(DEWFORD_TOWN)) + { + Overworld_SetHealLocationWarp(3); + } +} + +bool32 sub_813B9C0(void) +{ + static const u16 gUnknown_085B3444[] = { + MAP_OLDALE_TOWN_POKEMON_CENTER_1F, + MAP_DEWFORD_TOWN_POKEMON_CENTER_1F, + MAP_LAVARIDGE_TOWN_POKEMON_CENTER_1F, + MAP_FALLARBOR_TOWN_POKEMON_CENTER_1F, + MAP_VERDANTURF_TOWN_POKEMON_CENTER_1F, + MAP_PACIFIDLOG_TOWN_POKEMON_CENTER_1F, + MAP_PETALBURG_CITY_POKEMON_CENTER_1F, + MAP_SLATEPORT_CITY_POKEMON_CENTER_1F, + MAP_MAUVILLE_CITY_POKEMON_CENTER_1F, + MAP_RUSTBORO_CITY_POKEMON_CENTER_1F, + MAP_FORTREE_CITY_POKEMON_CENTER_1F, + MAP_LILYCOVE_CITY_POKEMON_CENTER_1F, + MAP_MOSSDEEP_CITY_POKEMON_CENTER_1F, + MAP_SOOTOPOLIS_CITY_POKEMON_CENTER_1F, + MAP_EVER_GRANDE_CITY_POKEMON_CENTER_1F, + MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F, + MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F, + MAP_SINGLE_BATTLE_COLOSSEUM, + MAP_TRADE_CENTER, + MAP_RECORD_CORNER, + MAP_DOUBLE_BATTLE_COLOSSEUM, + 0xffff + }; + + int i; + u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum; + + for (i = 0; gUnknown_085B3444[i] != 0xFFFF; i++) + { + if (gUnknown_085B3444[i] == map) + { + return TRUE; + } + } + return FALSE; +} + +void ResetFanClub(void) +{ + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] = 0; + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = 0; +} + +void sub_813BA30(void) +{ + if (sub_813BF44() != 0) + { + UpdateMovedLilycoveFanClubMembers(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = gSaveBlock2Ptr->playTimeHours; + } +} + +void sub_813BA60(void) +{ + if (!((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> 7) & 1)) + { + sub_813BF60(); + sub_813BD84(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = gSaveBlock2Ptr->playTimeHours; + FlagClear(FLAG_HIDE_FANCLUB_OLD_LADY); + FlagClear(FLAG_HIDE_FANCLUB_BOY); + FlagClear(FLAG_HIDE_FANCLUB_LITTLE_BOY); + FlagClear(FLAG_HIDE_FANCLUB_LADY); + FlagClear(FLAG_0x2DA); + VarSet(VAR_LILYCOVE_FAN_CLUB_STATE, 1); + } +} + +u8 sub_813BADC(u8 a0) +{ + static const u8 gUnknown_085B3470[] = { 0x02, 0x01, 0x02, 0x01 }; + + if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2) + { + if ((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] & 0x7F) + gUnknown_085B3470[a0] > 19) + { + if (GetNumMovedLilycoveFanClubMembers() < 3) + { + sub_813BB74(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] &= 0xFF80; + } + else + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] = (gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] & 0xFF80) | 0x14; + } + } + else + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] += gUnknown_085B3470[a0]; + } + } + + return gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] & 0x7F; +} + +static u16 sub_813BB74(void) +{ + static const u8 gUnknown_085B3474[] = { 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; + + u8 i; + u8 retVal = 0; + + for (i = 0; i < 8; i++) + { + if (!((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gUnknown_085B3474[i]) & 1)) + { + retVal = i; + if ((Random() & 1) != 0) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 1 << gUnknown_085B3474[retVal]; + return retVal; + } + } + } + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 1 << gUnknown_085B3474[retVal]; + return retVal; +} + +static u16 sub_813BC00(void) +{ + static const u8 gUnknown_085B347C[] = { 0x08, 0x0d, 0x0e, 0x0b, 0x0a, 0x0c, 0x0f, 0x09 }; + + u8 i; + u8 retVal = 0; + + if (GetNumMovedLilycoveFanClubMembers() == 1) + { + return 0; + } + + for (i = 0; i < 8; i++) + { + if (((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gUnknown_085B347C[i]) & 1) != 0) + { + retVal = i; + if ((Random() & 1) != 0) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] ^= 1 << gUnknown_085B347C[retVal]; + return retVal; + } + } + } + + if (((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gUnknown_085B347C[retVal]) & 1)) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] ^= 1 << gUnknown_085B347C[retVal]; + } + + return retVal; +} + +u16 GetNumMovedLilycoveFanClubMembers(void) +{ + u8 i; + u8 retVal = 0; + + for (i = 0; i < 8; i++) + { + if (((gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> (i + 8)) & 1) != 0) + { + retVal++; + } + } + + return retVal; +} + +void UpdateMovedLilycoveFanClubMembers(void) +{ + u8 i = 0; + if (gSaveBlock2Ptr->playTimeHours < 999) + { + while (TRUE) + { + if (GetNumMovedLilycoveFanClubMembers() < 5) + { + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] = gSaveBlock2Ptr->playTimeHours; + break; + } + else if (i == 8) + { + break; + } + else if (gSaveBlock2Ptr->playTimeHours - gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] < 12) + { + return; + } + sub_813BC00(); + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_2 - VARS_START] += 12; + i++; + } + } +} + +bool8 ShouldMoveLilycoveFanClubMember(void) +{ + return (gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> gSpecialVar_0x8004) & 1; +} + +static void sub_813BD84(void) +{ + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x2000; + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x100; + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x400; +} + +void BufferStreakTrainerText(void) +{ + u8 a = 0; + u8 b = 0; + switch (gSpecialVar_0x8004) + { + case 8: + break; + case 9: + break; + case 10: + a = 0; + b = 3; + break; + case 11: + a = 0; + b = 1; + break; + case 12: + a = 1; + b = 0; + break; + case 13: + a = 0; + b = 4; + break; + case 14: + a = 1; + b = 5; + break; + case 15: + break; + } + sub_813BE30(&gSaveBlock1Ptr->linkBattleRecords, a, b); +} + +static void sub_813BE30(struct LinkBattleRecords *linkRecords, u8 a, u8 b) +{ + struct LinkBattleRecord *record = &linkRecords->entries[a]; + if (record->name[0] == EOS) + { + switch (b) + { + case 0: + StringCopy(gStringVar1, gText_Wallace); + break; + case 1: + StringCopy(gStringVar1, gText_Steven); + break; + case 2: + StringCopy(gStringVar1, gText_Brawly); + break; + case 3: + StringCopy(gStringVar1, gText_Winona); + break; + case 4: + StringCopy(gStringVar1, gText_Phoebe); + break; + case 5: + StringCopy(gStringVar1, gText_Glacia); + break; + default: + StringCopy(gStringVar1, gText_Wallace); + break; + } + } + else + { + StringCopyN(gStringVar1, record->name, 7); + gStringVar1[7] = EOS; + ConvertInternationalString(gStringVar1, linkRecords->languages[a]); + } +} + +void sub_813BF10(void) +{ + if (VarGet(VAR_LILYCOVE_FAN_CLUB_STATE) == 2) + { + sub_813BA30(); + if (gBattleOutcome == 1) + { + sub_813BB74(); + } + else + { + sub_813BC00(); + } + } +} + +static bool8 sub_813BF44(void) +{ + return (gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] >> 7) & 1; +} + +void sub_813BF60(void) +{ + gSaveBlock1Ptr->vars[VAR_FANCLUB_UNKNOWN_1 - VARS_START] |= 0x80; +} + +u8 sub_813BF7C(void) +{ + return sub_813BADC(gSpecialVar_0x8004); +} diff --git a/src/heal_location.c b/src/heal_location.c index aa90fe1ae..b378e8e8c 100644 --- a/src/heal_location.c +++ b/src/heal_location.c @@ -1,83 +1,37 @@ - -// Includes #include "global.h" -#include "constants/maps.h" #include "heal_location.h" +#include "constants/maps.h" -#define HEAL_LOCATION(map, x, y) {MAP_GROUP(map), MAP_NUM(map), x, y} - -// Static type declarations - -// Static RAM declarations - -// Static ROM declarations - -// .rodata - -static const struct HealLocation sHealLocations[] = { - HEAL_LOCATION(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F, 4, 2), - HEAL_LOCATION(LITTLEROOT_TOWN_MAYS_HOUSE_2F, 4, 2), - HEAL_LOCATION(PETALBURG_CITY, 20, 17), - HEAL_LOCATION(SLATEPORT_CITY, 19, 20), - HEAL_LOCATION(MAUVILLE_CITY, 22, 6), - HEAL_LOCATION(RUSTBORO_CITY, 16, 39), - HEAL_LOCATION(FORTREE_CITY, 5, 7), - HEAL_LOCATION(LILYCOVE_CITY, 24, 15), - HEAL_LOCATION(MOSSDEEP_CITY, 28, 17), - HEAL_LOCATION(SOOTOPOLIS_CITY, 43, 32), - HEAL_LOCATION(EVER_GRANDE_CITY, 27, 49), - HEAL_LOCATION(LITTLEROOT_TOWN, 5, 9), - HEAL_LOCATION(LITTLEROOT_TOWN, 14, 9), - HEAL_LOCATION(OLDALE_TOWN, 6, 17), - HEAL_LOCATION(DEWFORD_TOWN, 2, 11), - HEAL_LOCATION(LAVARIDGE_TOWN, 9, 7), - HEAL_LOCATION(FALLARBOR_TOWN, 14, 8), - HEAL_LOCATION(VERDANTURF_TOWN, 16, 4), - HEAL_LOCATION(PACIFIDLOG_TOWN, 8, 16), - HEAL_LOCATION(EVER_GRANDE_CITY, 18, 6), - HEAL_LOCATION(SOUTHERN_ISLAND_EXTERIOR, 15, 20), - HEAL_LOCATION(BATTLE_FRONTIER_OUTSIDE_EAST, 3, 52) -}; - -#define NUM_HEAL_LOCATIONS (ARRAY_COUNT(sHealLocations)) - -// .text +#include "data/heal_locations.h" -static u32 GetHealLocationIndexFromMapGroupAndNum(u16 mapGroup, u16 mapNum) +u32 GetHealLocationIndexByMap(u16 mapGroup, u16 mapNum) { u32 i; - for (i = 0; i < NUM_HEAL_LOCATIONS; i++) + for (i = 0; i < ARRAY_COUNT(sHealLocations); i++) { if (sHealLocations[i].group == mapGroup && sHealLocations[i].map == mapNum) - { return i + 1; - } } return 0; } -const struct HealLocation *GetHealLocationPointerFromMapGroupAndNum(u16 mapGroup, u16 mapNum) +const struct HealLocation *GetHealLocationByMap(u16 mapGroup, u16 mapNum) { - u32 loc; + u32 index = GetHealLocationIndexByMap(mapGroup, mapNum); - loc = GetHealLocationIndexFromMapGroupAndNum(mapGroup, mapNum); - if (loc == 0) - { + if (index == 0) return NULL; - } - return &sHealLocations[loc - 1]; + else + return &sHealLocations[index - 1]; } -const struct HealLocation *GetHealLocationPointer(u32 loc) +const struct HealLocation *GetHealLocation(u32 index) { - if (loc == 0) - { + if (index == 0) return NULL; - } - if (loc > NUM_HEAL_LOCATIONS) - { + else if (index > ARRAY_COUNT(sHealLocations)) return NULL; - } - return &sHealLocations[loc - 1]; + else + return &sHealLocations[index - 1]; } diff --git a/src/main_menu.c b/src/main_menu.c index 87673c9b2..3afe1abe5 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1965,7 +1965,7 @@ void sub_80323CC(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f) { struct WindowTemplate sp; - sp = sub_8198A50(0, a + 1, b + 1, 5, 4, f, d); + sp = CreateWindowTemplate(0, a + 1, b + 1, 5, 4, f, d); CreateYesNoMenu(&sp, c, e, 0); } diff --git a/src/match_call.c b/src/match_call.c index aa6945161..99eb6d65a 100644 --- a/src/match_call.c +++ b/src/match_call.c @@ -360,7 +360,7 @@ MATCHCALLDEF(sMomMatchCallHeader, 0, 0, FLAG_0x0D8, gMomMatchCallDesc, gMomMatch static const match_call_text_data_t sStevenTextScripts[] = { { gText_Steven_Pokenav_2B5B95, 0xffff, 0xffff }, - { gText_Steven_Pokenav_2B5C53, FLAG_0x0C7, 0xffff }, + { gText_Steven_Pokenav_2B5C53, FLAG_RUSTURF_TUNNEL_OPENED, 0xffff }, { gText_Steven_Pokenav_2B5CC9, FLAG_0x0D4, 0xffff }, { gText_Steven_Pokenav_2B5DB4, FLAG_0x070, 0xffff }, { gText_Steven_Pokenav_2B5E26, FLAG_0x4F6, 0xffff }, @@ -415,7 +415,7 @@ MATCHCALLDEF(sBrendanMatchCallHeader, 4, FEMALE, FLAG_0x0FD, gMayBrendanMatchCal static const match_call_text_data_t sWallyTextScripts[] = { { gText_Wally_Pokenav_2B4DE2, 0xFFFF, 0xFFFF }, - { gText_Wally_Pokenav_2B4E57, FLAG_0x0C7, 0xFFFF }, + { gText_Wally_Pokenav_2B4E57, FLAG_RUSTURF_TUNNEL_OPENED, 0xFFFF }, { gText_Wally_Pokenav_2B4EA5, FLAG_0x4F3, 0xFFFF }, { gText_Wally_Pokenav_2B4F41, FLAG_0x097, 0xFFFF }, { gText_Wally_Pokenav_2B4FF3, FLAG_0x06F, 0xFFFF }, diff --git a/src/menu.c b/src/menu.c index 96dda3075..f4ffec023 100644 --- a/src/menu.c +++ b/src/menu.c @@ -120,7 +120,6 @@ extern void DrawWindowBorder(u8, u8, u8, u8, u8, u8); extern void sub_81980A8(u8, u8, u8, u8, u8, u8); extern u8 MoveMenuCursor(s8); extern u8 sub_8199134(s8, s8); -extern void sub_8199F74(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 letterSpacing, u8 lineSpacing); extern void sub_8198C78(void); extern void task_free_buf_after_copying_tile_data_to_vram(u8 taskId); @@ -1143,7 +1142,7 @@ void SetWindowTemplateFields(struct WindowTemplate *template, u8 bg, u8 left, u8 template->baseBlock = baseBlock; } -struct WindowTemplate sub_8198A50(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) +struct WindowTemplate CreateWindowTemplate(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16 baseBlock) { struct WindowTemplate template; SetWindowTemplateFields(&template, bg, left, top, width, height, paletteNum, baseBlock); diff --git a/src/overworld.c b/src/overworld.c index 772f8a057..d85af9e4d 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -689,7 +689,7 @@ void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused) void sub_8084CCC(u8 a1) { - const struct HealLocation *warp = GetHealLocationPointer(a1); + const struct HealLocation *warp = GetHealLocation(a1); if (warp) Overworld_SetWarpDestination(warp->group, warp->map, -1, warp->x, warp->y); @@ -702,7 +702,7 @@ void Overworld_SetWarpDestToLastHealLoc(void) void Overworld_SetHealLocationWarp(u8 healLocationId) { - const struct HealLocation *healLocation = GetHealLocationPointer(healLocationId); + const struct HealLocation *healLocation = GetHealLocation(healLocationId); if (healLocation != NULL) SetWarpData(&gSaveBlock1Ptr->lastHealLocation, healLocation->group, healLocation->map, -1, healLocation->x, healLocation->y); @@ -761,7 +761,7 @@ void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y) void sub_8084F6C(u8 a1) { - const struct HealLocation *warp = GetHealLocationPointer(a1); + const struct HealLocation *warp = GetHealLocation(a1); if (warp) SetWarpData(&gSaveBlock1Ptr->warp1, warp->group, warp->map, -1, warp->x, warp->y); } diff --git a/src/pokemon.c b/src/pokemon.c index cd7e45758..7c010cd39 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2089,7 +2089,7 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) s32 level = GetLevelFromBoxMonExp(boxMon); s32 i; - for (i = 0; gLevelUpLearnsets[species][i] != (u16)-1; i++) + for (i = 0; gLevelUpLearnsets[species][i] != LEVEL_UP_END; i++) { u16 moveLevel; u16 move; @@ -2101,7 +2101,7 @@ void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) move = (gLevelUpLearnsets[species][i] & 0x1FF); - if (GiveMoveToBoxMon(boxMon, move) == (u16)-1) + if (GiveMoveToBoxMon(boxMon, move) == 0xFFFF) DeleteFirstMoveAndGiveMoveToBoxMon(boxMon, move); } } @@ -2123,7 +2123,7 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove) while ((gLevelUpLearnsets[species][sLearningMoveTableID] & 0xFE00) != (level << 9)) { sLearningMoveTableID++; - if (gLevelUpLearnsets[species][sLearningMoveTableID] == 0xFFFF) + if (gLevelUpLearnsets[species][sLearningMoveTableID] == LEVEL_UP_END) return 0; } } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index 32d2bde4f..728b887f8 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -57,7 +57,6 @@ extern u8 gUnknown_0861CE7B[]; extern struct WindowTemplate gUnknown_0861CCEC; extern struct WindowTemplate gUnknown_0861CD14; extern const u8 *const gContestEffectDescriptionPointers[]; -extern const u8 *const gMoveDescriptionPointers[]; void sub_81C488C(u8 a); extern u8 sub_81221EC(); @@ -342,6 +341,10 @@ struct UnkSummaryStruct u8 unk_filler4[6]; }; +// const rom data +#include "data/text/move_descriptions.h" + +// code void sub_81BF8EC(u8 a, void *b, u8 c, u8 d, void *e) { u8 byte; diff --git a/src/region_map.c b/src/region_map.c index 5176d4996..3214ae185 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -22,6 +22,8 @@ #include "field_effect.h" #include "region_map.h" #include "constants/region_map_sections.h" +#include "heal_location.h" +#include "constants/heal_locations.h" #define MAP_WIDTH 28 #define MAP_HEIGHT 15 @@ -52,7 +54,7 @@ static EWRAM_DATA struct { /*0x88c*/ u8 unk_88c[0x1c0]; /*0xa4c*/ u8 unk_a4c[0x26]; /*0xa72*/ bool8 unk_a72; -} *gUnknown_0203A148 = NULL; // a74 +} *sFlyMap = NULL; // a74 static bool32 gUnknown_03001180; static bool32 gUnknown_03001184; @@ -242,23 +244,23 @@ static const u16 Unknown_085A1D48[] = INCBIN_U16("graphics/pokenav/fly_target_ic static const u8 sUnknown_085A1D68[] = INCBIN_U8("graphics/pokenav/fly_target_icons.4bpp.lz"); -static const u8 sUnknown_085A1E3C[][3] = { - {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), 1}, - {MAP_GROUP(OLDALE_TOWN), MAP_NUM(OLDALE_TOWN), 14}, - {MAP_GROUP(DEWFORD_TOWN), MAP_NUM(DEWFORD_TOWN), 15}, - {MAP_GROUP(LAVARIDGE_TOWN), MAP_NUM(LAVARIDGE_TOWN), 16}, - {MAP_GROUP(FALLARBOR_TOWN), MAP_NUM(FALLARBOR_TOWN), 17}, - {MAP_GROUP(VERDANTURF_TOWN), MAP_NUM(VERDANTURF_TOWN), 18}, - {MAP_GROUP(PACIFIDLOG_TOWN), MAP_NUM(PACIFIDLOG_TOWN), 19}, - {MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), 3}, - {MAP_GROUP(SLATEPORT_CITY), MAP_NUM(SLATEPORT_CITY), 4}, - {MAP_GROUP(MAUVILLE_CITY), MAP_NUM(MAUVILLE_CITY), 5}, - {MAP_GROUP(RUSTBORO_CITY), MAP_NUM(RUSTBORO_CITY), 6}, - {MAP_GROUP(FORTREE_CITY), MAP_NUM(FORTREE_CITY), 7}, - {MAP_GROUP(LILYCOVE_CITY), MAP_NUM(LILYCOVE_CITY), 8}, - {MAP_GROUP(MOSSDEEP_CITY), MAP_NUM(MOSSDEEP_CITY), 9}, - {MAP_GROUP(SOOTOPOLIS_CITY), MAP_NUM(SOOTOPOLIS_CITY), 10}, - {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), 11}, +static const u8 sMapHealLocations[][3] = { + {MAP_GROUP(LITTLEROOT_TOWN), MAP_NUM(LITTLEROOT_TOWN), HEAL_LOCATION_LITTLEROOT_TOWN_BRENDANS_HOUSE_2F}, + {MAP_GROUP(OLDALE_TOWN), MAP_NUM(OLDALE_TOWN), HEAL_LOCATION_OLDALE_TOWN}, + {MAP_GROUP(DEWFORD_TOWN), MAP_NUM(DEWFORD_TOWN), HEAL_LOCATION_DEWFORD_TOWN}, + {MAP_GROUP(LAVARIDGE_TOWN), MAP_NUM(LAVARIDGE_TOWN), HEAL_LOCATION_LAVARIDGE_TOWN}, + {MAP_GROUP(FALLARBOR_TOWN), MAP_NUM(FALLARBOR_TOWN), HEAL_LOCATION_FALLARBOR_TOWN}, + {MAP_GROUP(VERDANTURF_TOWN), MAP_NUM(VERDANTURF_TOWN), HEAL_LOCATION_VERDANTURF_TOWN}, + {MAP_GROUP(PACIFIDLOG_TOWN), MAP_NUM(PACIFIDLOG_TOWN), HEAL_LOCATION_PACIFIDLOG_TOWN}, + {MAP_GROUP(PETALBURG_CITY), MAP_NUM(PETALBURG_CITY), HEAL_LOCATION_PETALBURG_CITY}, + {MAP_GROUP(SLATEPORT_CITY), MAP_NUM(SLATEPORT_CITY), HEAL_LOCATION_SLATEPORT_CITY}, + {MAP_GROUP(MAUVILLE_CITY), MAP_NUM(MAUVILLE_CITY), HEAL_LOCATION_MAUVILLE_CITY}, + {MAP_GROUP(RUSTBORO_CITY), MAP_NUM(RUSTBORO_CITY), HEAL_LOCATION_RUSTBORO_CITY}, + {MAP_GROUP(FORTREE_CITY), MAP_NUM(FORTREE_CITY), HEAL_LOCATION_FORTREE_CITY}, + {MAP_GROUP(LILYCOVE_CITY), MAP_NUM(LILYCOVE_CITY), HEAL_LOCATION_LILYCOVE_CITY}, + {MAP_GROUP(MOSSDEEP_CITY), MAP_NUM(MOSSDEEP_CITY), HEAL_LOCATION_MOSSDEEP_CITY}, + {MAP_GROUP(SOOTOPOLIS_CITY), MAP_NUM(SOOTOPOLIS_CITY), HEAL_LOCATION_SOOTOPOLIS_CITY}, + {MAP_GROUP(EVER_GRANDE_CITY), MAP_NUM(EVER_GRANDE_CITY), HEAL_LOCATION_EVER_GRANDE_CITY_1}, {MAP_GROUP(ROUTE101), MAP_NUM(ROUTE101), 0}, {MAP_GROUP(ROUTE102), MAP_NUM(ROUTE102), 0}, {MAP_GROUP(ROUTE103), MAP_NUM(ROUTE103), 0}, @@ -1578,8 +1580,8 @@ void MCB2_FlyMap(void) SetGpuReg(REG_OFFSET_BG2HOFS, 0); SetGpuReg(REG_OFFSET_BG3HOFS, 0); SetGpuReg(REG_OFFSET_BG3VOFS, 0); - gUnknown_0203A148 = malloc(sizeof(*gUnknown_0203A148)); - if (gUnknown_0203A148 == NULL) + sFlyMap = malloc(sizeof(*sFlyMap)); + if (sFlyMap == NULL) { SetMainCallback2(CB2_ReturnToFieldWithOpenMenu); } @@ -1608,11 +1610,11 @@ void MCB2_FlyMap(void) gMain.state++; break; case 4: - InitRegionMap(&gUnknown_0203A148->regionMap, FALSE); + InitRegionMap(&sFlyMap->regionMap, FALSE); CreateRegionMapCursor(0, 0); CreateRegionMapPlayerIcon(1, 1); - gUnknown_0203A148->mapSecId = gUnknown_0203A148->regionMap.mapSecId; - StringFill(gUnknown_0203A148->unk_a4c, CHAR_SPACE, 16); + sFlyMap->mapSecId = sFlyMap->regionMap.mapSecId; + StringFill(sFlyMap->unk_a4c, CHAR_SPACE, 16); gUnknown_03001180 = TRUE; sub_8124904(); gMain.state++; @@ -1664,7 +1666,7 @@ static void sub_81248C0(void) static void sub_81248D4(void) { - gUnknown_0203A148->unk_000(); + sFlyMap->unk_000(); AnimateSprites(); BuildOamBuffer(); do_scheduled_bg_tilemap_copies_to_vram(); @@ -1672,8 +1674,8 @@ static void sub_81248D4(void) static void sub_81248F4(void callback(void)) { - gUnknown_0203A148->unk_000 = callback; - gUnknown_0203A148->unk_004 = 0; + sFlyMap->unk_000 = callback; + sFlyMap->unk_004 = 0; } static void sub_8124904(void) @@ -1682,21 +1684,21 @@ static void sub_8124904(void) bool32 flag; const u8 *name; - if (gUnknown_0203A148->regionMap.iconDrawType > MAPSECTYPE_NONE && gUnknown_0203A148->regionMap.iconDrawType <= MAPSECTYPE_BATTLE_FRONTIER) + if (sFlyMap->regionMap.iconDrawType > MAPSECTYPE_NONE && sFlyMap->regionMap.iconDrawType <= MAPSECTYPE_BATTLE_FRONTIER) { flag = FALSE; for (i = 0; i < 1; i++) { - if (gUnknown_0203A148->regionMap.mapSecId == gUnknown_085A1EDC[i].mapSecId) + if (sFlyMap->regionMap.mapSecId == gUnknown_085A1EDC[i].mapSecId) { if (FlagGet(gUnknown_085A1EDC[i].flag)) { - StringLength(gUnknown_085A1EDC[i].name[gUnknown_0203A148->regionMap.posWithinMapSec]); + StringLength(gUnknown_085A1EDC[i].name[sFlyMap->regionMap.posWithinMapSec]); flag = TRUE; sub_8198070(0, FALSE); SetWindowBorderStyle(1, FALSE, 0x65, 0x0d); - PrintTextOnWindow(1, 1, gUnknown_0203A148->regionMap.mapSecName, 0, 1, 0, NULL); - name = gUnknown_085A1EDC[i].name[gUnknown_0203A148->regionMap.posWithinMapSec]; + PrintTextOnWindow(1, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); + name = gUnknown_085A1EDC[i].name[sFlyMap->regionMap.posWithinMapSec]; PrintTextOnWindow(1, 1, name, GetStringRightAlignXOffset(1, name, 0x60), 0x11, 0, NULL); schedule_bg_copy_tilemap_to_vram(0); gUnknown_03001180 = TRUE; @@ -1715,7 +1717,7 @@ static void sub_8124904(void) { FillWindowPixelBuffer(0, 0x11); } - PrintTextOnWindow(0, 1, gUnknown_0203A148->regionMap.mapSecName, 0, 1, 0, NULL); + PrintTextOnWindow(0, 1, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL); schedule_bg_copy_tilemap_to_vram(0); gUnknown_03001180 = FALSE; } @@ -1739,8 +1741,8 @@ static void sub_8124A70(void) { struct SpriteSheet sheet; - LZ77UnCompWram(sUnknown_085A1D68, gUnknown_0203A148->unk_88c); - sheet.data = gUnknown_0203A148->unk_88c; + LZ77UnCompWram(sUnknown_085A1D68, sFlyMap->unk_88c); + sheet.data = sFlyMap->unk_88c; sheet.size = 0x1c0; sheet.tag = 2; LoadSpriteSheet(&sheet); @@ -1829,7 +1831,7 @@ static void sub_8124BE4(void) static void sub_8124CBC(struct Sprite *sprite) { - if (gUnknown_0203A148->regionMap.mapSecId == sprite->data[0]) + if (sFlyMap->regionMap.mapSecId == sprite->data[0]) { if (++sprite->data[1] > 16) { @@ -1846,11 +1848,11 @@ static void sub_8124CBC(struct Sprite *sprite) static void sub_8124D14(void) { - switch (gUnknown_0203A148->unk_004) + switch (sFlyMap->unk_004) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); - gUnknown_0203A148->unk_004++; + sFlyMap->unk_004++; break; case 1: if (!UpdatePaletteFade()) @@ -1863,7 +1865,7 @@ static void sub_8124D14(void) static void sub_8124D64(void) { - if (gUnknown_0203A148->unk_004 == 0) + if (sFlyMap->unk_004 == 0) { switch (sub_81230AC()) { @@ -1875,16 +1877,16 @@ static void sub_8124D64(void) sub_8124904(); break; case INPUT_EVENT_A_BUTTON: - if (gUnknown_0203A148->regionMap.iconDrawType == MAPSECTYPE_CITY_CANFLY || gUnknown_0203A148->regionMap.iconDrawType == MAPSECTYPE_BATTLE_FRONTIER) + if (sFlyMap->regionMap.iconDrawType == MAPSECTYPE_CITY_CANFLY || sFlyMap->regionMap.iconDrawType == MAPSECTYPE_BATTLE_FRONTIER) { m4aSongNumStart(SE_SELECT); - gUnknown_0203A148->unk_a72 = TRUE; + sFlyMap->unk_a72 = TRUE; sub_81248F4(sub_8124E0C); } break; case INPUT_EVENT_B_BUTTON: m4aSongNumStart(SE_SELECT); - gUnknown_0203A148->unk_a72 = FALSE; + sFlyMap->unk_a72 = FALSE; sub_81248F4(sub_8124E0C); break; } @@ -1893,40 +1895,40 @@ static void sub_8124D64(void) static void sub_8124E0C(void) { - switch (gUnknown_0203A148->unk_004) + switch (sFlyMap->unk_004) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); - gUnknown_0203A148->unk_004++; + sFlyMap->unk_004++; break; case 1: if (!UpdatePaletteFade()) { FreeRegionMapIconResources(); - if (gUnknown_0203A148->unk_a72) + if (sFlyMap->unk_a72) { - switch (gUnknown_0203A148->regionMap.mapSecId) + switch (sFlyMap->regionMap.mapSecId) { case MAPSEC_SOUTHERN_ISLAND: - sub_8084CCC(0x15); + sub_8084CCC(HEAL_LOCATION_SOUTHERN_ISLAND_EXTERIOR); break; case MAPSEC_BATTLE_FRONTIER: - sub_8084CCC(0x16); + sub_8084CCC(HEAL_LOCATION_BATTLE_FRONTIER_OUTSIDE_EAST); break; case MAPSEC_LITTLEROOT_TOWN: - sub_8084CCC(gSaveBlock2Ptr->playerGender == MALE ? 0x0C : 0x0D); + sub_8084CCC(gSaveBlock2Ptr->playerGender == MALE ? HEAL_LOCATION_LITTLEROOT_TOWN_1 : HEAL_LOCATION_LITTLEROOT_TOWN_2); break; case MAPSEC_EVER_GRANDE_CITY: - sub_8084CCC(FlagGet(FLAG_LANDMARK_POKEMON_LEAGUE) && gUnknown_0203A148->regionMap.posWithinMapSec == 0 ? 0x14 : 0x0B); + sub_8084CCC(FlagGet(FLAG_LANDMARK_POKEMON_LEAGUE) && sFlyMap->regionMap.posWithinMapSec == 0 ? HEAL_LOCATION_EVER_GRANDE_CITY_2 : HEAL_LOCATION_EVER_GRANDE_CITY_1); break; default: - if (sUnknown_085A1E3C[gUnknown_0203A148->regionMap.mapSecId][2] != 0) + if (sMapHealLocations[sFlyMap->regionMap.mapSecId][2] != 0) { - sub_8084CCC(sUnknown_085A1E3C[gUnknown_0203A148->regionMap.mapSecId][2]); + sub_8084CCC(sMapHealLocations[sFlyMap->regionMap.mapSecId][2]); } else { - warp1_set_2(sUnknown_085A1E3C[gUnknown_0203A148->regionMap.mapSecId][0], sUnknown_085A1E3C[gUnknown_0203A148->regionMap.mapSecId][1], -1); + warp1_set_2(sMapHealLocations[sFlyMap->regionMap.mapSecId][0], sMapHealLocations[sFlyMap->regionMap.mapSecId][1], -1); } break; } @@ -1936,10 +1938,10 @@ static void sub_8124E0C(void) { SetMainCallback2(sub_81B58A8); } - if (gUnknown_0203A148 != NULL) + if (sFlyMap != NULL) { - free(gUnknown_0203A148); - gUnknown_0203A148 = NULL; + free(sFlyMap); + sFlyMap = NULL; } FreeAllWindowBuffers(); } diff --git a/src/rotating_gate.c b/src/rotating_gate.c index 1f5ef165f..fcced6c8c 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -189,12 +189,6 @@ struct RotatingGatePuzzle u8 orientation; }; -struct Coords8 -{ - s8 deltaX; - s8 deltaY; -}; - // .rodata // Fortree static const struct RotatingGatePuzzle sRotatingGate_FortreePuzzleConfig[] = diff --git a/src/scrcmd.c b/src/scrcmd.c index a15ad666c..01d04704a 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1515,7 +1515,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) xText = (xWindow - xText - 1) * 8 + 3; yText = (yText - yWindow - 1) * 8; - winTemplate = sub_8198A50(0, xWindow, yWindow + 1, width, height, 0xF, 0x1); + winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1); gUnknown_03000F30 = AddWindow(&winTemplate); LoadUserWindowBorderGfx(gUnknown_03000F30, 0x214, 0xE0); NewMenuHelpers_DrawStdWindowFrame(gUnknown_03000F30, 0); diff --git a/src/wallclock.c b/src/wallclock.c index 9b96d416c..3d95d75ac 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -602,7 +602,7 @@ static void WallClockInit(void) ShowBg(3); } -void Cb2_StartWallClock(void) +void CB2_StartWallClock(void) { u8 taskId; u8 spriteId; @@ -644,7 +644,7 @@ void Cb2_StartWallClock(void) schedule_bg_copy_tilemap_to_vram(2); } -void Cb2_ViewWallClock(void) +void CB2_ViewWallClock(void) { u8 taskId; u8 spriteId; |