From b29e5ee203b6fa4592180ef6cca732462cca9af6 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 11:51:00 -0400 Subject: Add subdirectories to data/ similar to pokecrystal Top level text/ is now solely for the former text/maps/ files, and other files are in their respective subdirectories in data/. --- data/moves/animation_special_effect_pointers.asm | 81 + data/moves/animation_special_effects.asm | 75 + data/moves/animations.asm | 3628 ++++++++++++++++++++++ data/moves/effects_pointers.asm | 87 + data/moves/grammar.asm | 14 + data/moves/hm_moves.asm | 7 + data/moves/moves.asm | 178 ++ data/moves/names.asm | 167 + data/moves/sfx.asm | 168 + data/moves/tmhm_moves.asm | 56 + 10 files changed, 4461 insertions(+) create mode 100644 data/moves/animation_special_effect_pointers.asm create mode 100644 data/moves/animation_special_effects.asm create mode 100755 data/moves/animations.asm create mode 100644 data/moves/effects_pointers.asm create mode 100644 data/moves/grammar.asm create mode 100644 data/moves/hm_moves.asm create mode 100755 data/moves/moves.asm create mode 100644 data/moves/names.asm create mode 100644 data/moves/sfx.asm create mode 100755 data/moves/tmhm_moves.asm (limited to 'data/moves') diff --git a/data/moves/animation_special_effect_pointers.asm b/data/moves/animation_special_effect_pointers.asm new file mode 100644 index 00000000..ba607141 --- /dev/null +++ b/data/moves/animation_special_effect_pointers.asm @@ -0,0 +1,81 @@ +; Format: Special Effect ID (1 byte), Address (2 bytes) +SpecialEffectPointers: + db SE_DARK_SCREEN_FLASH ; $FE + dw AnimationFlashScreen + db SE_DARK_SCREEN_PALETTE ; $FD + dw AnimationDarkScreenPalette + db SE_RESET_SCREEN_PALETTE ; $FC + dw AnimationResetScreenPalette + db SE_SHAKE_SCREEN ; $FB + dw AnimationShakeScreen + db SE_WATER_DROPLETS_EVERYWHERE ; $FA + dw AnimationWaterDropletsEverywhere + db SE_DARKEN_MON_PALETTE ; $F9 + dw AnimationDarkenMonPalette + db SE_FLASH_SCREEN_LONG ; $F8 + dw AnimationFlashScreenLong + db SE_SLIDE_MON_UP ; $F7 + dw AnimationSlideMonUp + db SE_SLIDE_MON_DOWN ; $F6 + dw AnimationSlideMonDown + db SE_FLASH_MON_PIC ; $F5 + dw AnimationFlashMonPic + db SE_SLIDE_MON_OFF ; $F4 + dw AnimationSlideMonOff + db SE_BLINK_MON ; $F3 + dw AnimationBlinkMon + db SE_MOVE_MON_HORIZONTALLY ; $F2 + dw AnimationMoveMonHorizontally + db SE_RESET_MON_POSITION ; $F1 + dw AnimationResetMonPosition + db SE_LIGHT_SCREEN_PALETTE ; $F0 + dw AnimationLightScreenPalette + db SE_HIDE_MON_PIC ; $EF + dw AnimationHideMonPic + db SE_SQUISH_MON_PIC ; $EE + dw AnimationSquishMonPic + db SE_SHOOT_BALLS_UPWARD ; $ED + dw AnimationShootBallsUpward + db SE_SHOOT_MANY_BALLS_UPWARD ; $EC + dw AnimationShootManyBallsUpward + db SE_BOUNCE_UP_AND_DOWN ; $EB + dw AnimationBoundUpAndDown + db SE_MINIMIZE_MON ; $EA + dw AnimationMinimizeMon + db SE_SLIDE_MON_DOWN_AND_HIDE ; $E9 + dw AnimationSlideMonDownAndHide + db SE_TRANSFORM_MON ; $E8 + dw AnimationTransformMon + db SE_LEAVES_FALLING ; $E7 + dw AnimationLeavesFalling + db SE_PETALS_FALLING ; $E6 + dw AnimationPetalsFalling + db SE_SLIDE_MON_HALF_OFF ; $E5 + dw AnimationSlideMonHalfOff + db SE_SHAKE_ENEMY_HUD ; $E4 + dw AnimationShakeEnemyHUD + db SE_SHAKE_ENEMY_HUD_2 ; unused--same pointer as SE_SHAKE_ENEMY_HUD ($E4) + dw AnimationShakeEnemyHUD + db SE_SPIRAL_BALLS_INWARD ; $E2 + dw AnimationSpiralBallsInward + db SE_DELAY_ANIMATION_10 ; $E1 + dw AnimationDelay10 + db SE_FLASH_ENEMY_MON_PIC ; unused--same as SE_FLASH_MON_PIC ($F5), but for the enemy mon + dw AnimationFlashEnemyMonPic + db SE_HIDE_ENEMY_MON_PIC ; $DF + dw AnimationHideEnemyMonPic + db SE_BLINK_ENEMY_MON ; $DE + dw AnimationBlinkEnemyMon + db SE_SHOW_MON_PIC ; $DD + dw AnimationShowMonPic + db SE_SHOW_ENEMY_MON_PIC ; $DC + dw AnimationShowEnemyMonPic + db SE_SLIDE_ENEMY_MON_OFF ; $DB + dw AnimationSlideEnemyMonOff + db SE_SHAKE_BACK_AND_FORTH ; $DA + dw AnimationShakeBackAndForth + db SE_SUBSTITUTE_MON ; $D9 + dw AnimationSubstitute + db SE_WAVY_SCREEN ; $D8 + dw AnimationWavyScreen + db $FF diff --git a/data/moves/animation_special_effects.asm b/data/moves/animation_special_effects.asm new file mode 100644 index 00000000..9dfb5645 --- /dev/null +++ b/data/moves/animation_special_effects.asm @@ -0,0 +1,75 @@ +; Format: Animation ID (1 byte), Address (2 bytes) +AnimationIdSpecialEffects: + db MEGA_PUNCH + dw AnimationFlashScreen + + db GUILLOTINE + dw AnimationFlashScreen + + db MEGA_KICK + dw AnimationFlashScreen + + db HEADBUTT + dw AnimationFlashScreen + + db TAIL_WHIP + dw TailWhipAnimationUnused + + db GROWL + dw DoGrowlSpecialEffects + + db DISABLE + dw AnimationFlashScreen + + db BLIZZARD + dw DoBlizzardSpecialEffects + + db BUBBLEBEAM + dw AnimationFlashScreen + + db HYPER_BEAM + dw FlashScreenEveryFourFrameBlocks + + db THUNDERBOLT + dw FlashScreenEveryEightFrameBlocks + + db REFLECT + dw AnimationFlashScreen + + db SELFDESTRUCT + dw DoExplodeSpecialEffects + + db SPORE + dw AnimationFlashScreen + + db EXPLOSION + dw DoExplodeSpecialEffects + + db ROCK_SLIDE + dw DoRockSlideSpecialEffects + + db TRADE_BALL_DROP_ANIM + dw TradeHidePokemon + + db TRADE_BALL_SHAKE_ANIM + dw TradeShakePokeball + + db TRADE_BALL_TILT_ANIM + dw TradeJumpPokeball + + db TOSS_ANIM + dw DoBallTossSpecialEffects + + db SHAKE_ANIM + dw DoBallShakeSpecialEffects + + db POOF_ANIM + dw DoPoofSpecialEffects + + db GREATTOSS_ANIM + dw DoBallTossSpecialEffects + + db ULTRATOSS_ANIM + dw DoBallTossSpecialEffects + + db $FF ; terminator diff --git a/data/moves/animations.asm b/data/moves/animations.asm new file mode 100755 index 00000000..8c388afd --- /dev/null +++ b/data/moves/animations.asm @@ -0,0 +1,3628 @@ +AttackAnimationPointers: + dw PoundAnim + dw KarateChopAnim + dw DoubleSlapAnim + dw CometPunchAnim + dw MegaPunchAnim + dw PayDayAnim + dw FirePunchAnim + dw IcePunchAnim + dw ThunderPunchAnim + dw ScratchAnim + dw VicegripAnim + dw GuillotineAnim + dw RazorWindAnim + dw SwordsDanceAnim + dw CutAnim + dw GustAnim + dw WingAttackAnim + dw WhirlwindAnim + dw FlyAnim + dw BindAnim + dw SlamAnim + dw VineWhipAnim + dw StompAnim + dw DoubleKickAnim + dw MegaKickAnim + dw JumpKickAnim + dw RollingKickAnim + dw SandAttackAnim + dw HeatButtAnim + dw HornAttackAnim + dw FuryAttackAnim + dw HornDrillAnim + dw TackleAnim + dw BodySlamAnim + dw WrapAnim + dw TakeDownAnim + dw ThrashAnim + dw DoubleEdgeAnim + dw TailWhipAnim + dw PoisonStingAnim + dw TwineedleAnim + dw PinMissileAnim + dw LeerAnim + dw BiteAnim + dw GrowlAnim + dw RoarAnim + dw SingAnim + dw SupersonicAnim + dw SonicBoomAnim + dw DisableAnim + dw AcidAnim + dw EmberAnim + dw FlamethrowerAnim + dw MistAnim + dw WaterGunAnim + dw HydroPumpAnim + dw SurfAnim + dw IceBeamAnim + dw BlizzardAnim + dw PsyBeamAnim + dw BubbleBeamAnim + dw AuroraBeamAnim + dw HyperBeamAnim + dw PeckAnim + dw DrillPeckAnim + dw SubmissionAnim + dw LowKickAnim + dw CounterAnim + dw SeismicTossAnim + dw StrengthAnim + dw AbsorbAnim + dw MegaDrainAnim + dw LeechSeedAnim + dw GrowthAnim + dw RazorLeafAnim + dw SolarBeamAnim + dw PoisonPowderAnim + dw StunSporeAnim + dw SleepPowderAnim + dw PedalDanceAnim + dw StringShotAnim + dw DragonRageAnim + dw FireSpinAnim + dw ThunderShockAnim + dw ThunderBoltAnim + dw ThunderWaveAnim + dw ThunderAnim + dw RockThrowAnim + dw EarthquakeAnim + dw FissureAnim + dw DigAnim + dw ToxicAnim + dw ConfusionAnim + dw PsychicAnim + dw HypnosisAnim + dw MeditateAnim + dw AgilityAnim + dw QuickAttackAnim + dw RageAnim + dw TeleportAnim + dw NightShadeAnim + dw MimicAnim + dw ScreechAnim + dw DoubleTeamAnim + dw RecoverAnim + dw HardenAnim + dw MinimizeAnim + dw SmokeScreenAnim + dw ConfuseRayAnim + dw WithdrawAnim + dw DefenseCurlAnim + dw BarrierAnim + dw LightScreenAnim + dw HazeAnim + dw ReflectAnim + dw FocusEnergyAnim + dw BideAnim + dw MetronomeAnim + dw MirrorMoveAnim + dw SelfdestructAnim + dw EggBombAnim + dw LickAnim + dw SmogAnim + dw SludgeAnim + dw BoneClubAnim + dw FireBlastAnim + dw WaterfallAnim + dw ClampAnim + dw SwiftAnim + dw SkullBashAnim + dw SpikeCannonAnim + dw ConstrictAnim + dw AmnesiaAnim + dw KinesisAnim + dw SoftboiledAnim + dw HiJumpKickAnim + dw GlareAnim + dw DreamEaterAnim + dw PoisonGasAnim + dw BarrageAnim + dw LeechLifeAnim + dw LovelyKissAnim + dw SkyAttackAnim + dw TransformAnim + dw BubbleAnim + dw DizzyPunchAnim + dw SporeAnim + dw FlashAnim + dw PsywaveAnim + dw SplashAnim + dw AcidArmorAnim + dw CrabHammerAnim + dw ExplosionAnim + dw FurySwipesAnim + dw BonemerangAnim + dw RestAnim + dw RockSlideAnim + dw HyperFangAnim + dw SharpenAnim + dw ConversionAnim + dw TriAttackAnim + dw SuperFangAnim + dw SlashAnim + dw SubstituteAnim + dw StruggleAnim + dw ShowPicAnim + dw EnemyFlashAnim + dw PlayerFlashAnim + dw EnemyHUDShakeAnim + dw TradeBallDropAnim + dw TradeBallAppear1Anim + dw TradeBallAppear2Anim + dw TradeBallPoofAnim + dw XStatItemAnim + dw XStatItemAnim + dw ShrinkingSquareAnim + dw ShrinkingSquareAnim + dw XStatItemBlackAnim + dw XStatItemBlackAnim + dw ShrinkingSquareBlackAnim + dw ShrinkingSquareBlackAnim + dw UnusedAnim + dw UnusedAnim + dw ParalyzeAnim + dw ParalyzeAnim + dw PoisonAnim + dw PoisonAnim + dw SleepPlayerAnim + dw SleepEnemyAnim + dw ConfusedPlayerAnim + dw ConfusedEnemyAnim + dw FaintAnim + dw BallTossAnim + dw BallShakeAnim + dw BallPoofAnim + dw BallBlockAnim + dw GreatTossAnim + dw UltraTossAnim + dw ShakeScreenAnim + dw HidePicAnim + dw ThrowRockAnim + dw ThrowBaitAnim + dw ZigZagScreenAnim + +; each animation is a list of subanimations and special effects +; if first byte < $56 +; db tileset_and_delay, sound_id, subanimation_id +; if first byte >= $D8 +; db special_effect_id, sound_id +; $FF terminated +ZigZagScreenAnim: + db SE_WAVY_SCREEN, $FF + db $FF + +PoundAnim: +StruggleAnim: + db $08,$00,$01 + db $FF + +KarateChopAnim: + db $08,$01,$03 + db $FF + +DoubleSlapAnim: + db $05,$02,$01 + db $05,$02,$01 + db $FF + +CometPunchAnim: + db $04,$03,$02 + db $04,$03,$02 + db $FF + +MegaPunchAnim: + db $46,$04,$04 + db $FF + +PayDayAnim: + db $08,$00,$01 + db $04,$05,$52 + db $FF + +FirePunchAnim: + db $06,$06,$02 + db $46,$FF,$11 + db $FF + +IcePunchAnim: + db $06,$07,$02 + db $10,$FF,$2F + db $FF + +ThunderPunchAnim: + db $06,$08,$02 + db SE_DARK_SCREEN_PALETTE, $FF + db $46,$FF,$2B + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ScratchAnim: + db $06,$09,$0F + db $FF + +VicegripAnim: + db $08,$0A,$2A + db $FF + +GuillotineAnim: + db $06,$0B,$2A + db $FF + +RazorWindAnim: + db $04,$0C,$16 + db $FF + +SwordsDanceAnim: + db $46,$0D,$18 + db $46,$0D,$18 + db $46,$0D,$18 + db $FF + +CutAnim: + db SE_DARK_SCREEN_FLASH, $0E + db $04,$FF,$16 + db $FF + +GustAnim: + db $46,$0F,$10 + db $06,$FF,$02 + db $FF + +WingAttackAnim: + db $46,$10,$04 + db $FF + +WhirlwindAnim: + db $46,$11,$10 + db SE_SLIDE_ENEMY_MON_OFF, $FF + db $FF + +FlyAnim: + db $46,$12,$04 + db SE_SHOW_MON_PIC, $FF + db $FF + +BindAnim: + db $04,$13,$23 + db $04,$13,$23 + db $FF + +SlamAnim: + db $06,$14,$02 + db $FF + +VineWhipAnim: + db $01,$15,$16 + db $08,$FF,$01 + db $FF + +StompAnim: + db $48,$16,$05 + db $FF + +DoubleKickAnim: + db $08,$17,$01 + db $08,$17,$01 + db $FF + +MegaKickAnim: + db $46,$18,$04 + db $FF + +JumpKickAnim: + db $46,$19,$04 + db $FF + +RollingKickAnim: + db SE_DARK_SCREEN_FLASH, $1A + db $46,$FF,$04 + db $FF + +SandAttackAnim: + db $46,$1B,$28 + db $FF + +HeatButtAnim: + db $46,$1C,$05 + db $FF + +HornAttackAnim: + db $06,$1D,$45 + db $46,$FF,$05 + db $FF + +FuryAttackAnim: + db $02,$1E,$46 + db $02,$FF,$46 + db $FF + +HornDrillAnim: + db $42,$1F,$05 + db $42,$FF,$05 + db $42,$FF,$05 + db $42,$FF,$05 + db $42,$FF,$05 + db $FF + +TackleAnim: + db SE_MOVE_MON_HORIZONTALLY, $48 + db SE_RESET_MON_POSITION, $FF + db $FF + +BodySlamAnim: + db SE_MOVE_MON_HORIZONTALLY, $48 + db SE_DARK_SCREEN_FLASH, $FF + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_MON_POSITION, $FF + db $FF + +WrapAnim: + db $04,$22,$23 + db $04,$22,$23 + db $04,$22,$23 + db $FF + +TakeDownAnim: + db SE_MOVE_MON_HORIZONTALLY, $48 + db SE_DARK_SCREEN_FLASH, $23 + db SE_RESET_MON_POSITION, $FF + db $FF + +ThrashAnim: + db $46,$24,$04 + db $FF + +DoubleEdgeAnim: + db SE_LIGHT_SCREEN_PALETTE, $48 + db $06,$FF,$2D + db SE_RESET_SCREEN_PALETTE, $FF + db SE_MOVE_MON_HORIZONTALLY, $FF + db SE_DARK_SCREEN_FLASH, $25 + db SE_RESET_MON_POSITION, $FF + db $FF + +TailWhipAnim: + db SE_MOVE_MON_HORIZONTALLY, $84 + db SE_DELAY_ANIMATION_10, $FF + db SE_RESET_MON_POSITION, $84 + db SE_DELAY_ANIMATION_10, $FF + db SE_MOVE_MON_HORIZONTALLY, $84 + db SE_DELAY_ANIMATION_10, $FF + db SE_RESET_MON_POSITION, $84 + db $FF + +PoisonStingAnim: + db $06,$27,$00 + db $FF + +TwineedleAnim: + db $05,$28,$01 + db $05,$28,$01 + db $FF + +PinMissileAnim: + db $03,$29,$01 + db $FF + +LeerAnim: + db SE_DARK_SCREEN_PALETTE, $48 + db SE_DARK_SCREEN_FLASH, $2A + db SE_DARK_SCREEN_FLASH, $2A + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +BiteAnim: + db $08,$2B,$02 + db $FF + +GrowlAnim: + db $46,$2C,$12 + db $FF + +RoarAnim: + db $46,$2D,$15 + db $46,$2D,$15 + db $46,$2D,$15 + db $FF + +SingAnim: + db $46,$2E,$12 + db $50,$FF,$40 + db $50,$FF,$40 + db $FF + +SupersonicAnim: + db $06,$2F,$31 + db $FF + +SonicBoomAnim: + db $46,$2D,$15 + db $46,$2D,$15 + db $46,$0F,$10 + db $46,$FF,$05 + db $FF + +DisableAnim: + db SE_DARK_SCREEN_PALETTE, $48 + db SE_DARK_SCREEN_FLASH, $2A + db SE_DARK_SCREEN_FLASH, $2A + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +AcidAnim: + db $46,$32,$13 + db $46,$32,$14 + db $FF + +EmberAnim: + db $46,$33,$11 + db $FF + +FlamethrowerAnim: + db $46,$34,$1F + db $46,$34,$0C + db $46,$34,$0D + db $FF + +MistAnim: + db SE_LIGHT_SCREEN_PALETTE, $FF + db SE_WATER_DROPLETS_EVERYWHERE, $38 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +WaterGunAnim: + db $06,$36,$2C + db $FF + +HydroPumpAnim: + db $06,$37,$1A + db $06,$37,$1A + db $FF + +SurfAnim: + db SE_WATER_DROPLETS_EVERYWHERE, $38 + db $06,$37,$1A + db $FF + +IceBeamAnim: + db $03,$39,$2E + db $10,$FF,$2F + db $FF + +BlizzardAnim: + db $04,$3A,$38 + db $04,$37,$38 + db $FF + +PsyBeamAnim: + db $03,$3B,$2E + db SE_FLASH_SCREEN_LONG, $FF + db $FF + +BubbleBeamAnim: + db $12,$3C,$35 + db $FF + +AuroraBeamAnim: + db $03,$3D,$2E + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db $FF + +HyperBeamAnim: + db SE_DARK_SCREEN_PALETTE, $48 + db SE_SPIRAL_BALLS_INWARD, $FF + db $02,$3E,$2E + db SE_DARK_SCREEN_FLASH, $FF + db SE_DARK_SCREEN_FLASH, $FF + db $46,$04,$04 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +PeckAnim: + db $08,$3F,$01 + db $FF + +DrillPeckAnim: + db $46,$40,$04 + db $FF + +SubmissionAnim: + db SE_SLIDE_MON_OFF, $41 + db $06,$FF,$01 + db SE_SHOW_MON_PIC, $FF + db $FF + +LowKickAnim: + db SE_SLIDE_MON_OFF, $42 + db $46,$FF,$04 + db SE_SHOW_MON_PIC, $FF + db $FF + +CounterAnim: + db SE_SLIDE_MON_OFF, $43 + db $46,$FF,$04 + db SE_SHOW_MON_PIC, $FF + db $FF + +SeismicTossAnim: + db SE_BLINK_ENEMY_MON, $FF + db $41,$8B,$4E + db SE_HIDE_ENEMY_MON_PIC, $FF + db SE_SLIDE_MON_OFF, $FF + db $42,$44,$4F + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_SHOW_MON_PIC, $FF + db $41,$44,$50 + db SE_SHOW_ENEMY_MON_PIC, $FF + db SE_SHAKE_SCREEN, $FF + db $FF + +StrengthAnim: + db SE_MOVE_MON_HORIZONTALLY, $48 + db SE_RESET_MON_POSITION, $FF + db $46,$06,$04 + db $FF + +AbsorbAnim: + db SE_LIGHT_SCREEN_PALETTE, $46 + db $06,$FF,$21 + db $06,$FF,$22 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +MegaDrainAnim: + db SE_LIGHT_SCREEN_PALETTE, $47 + db SE_DARK_SCREEN_FLASH, $FF + db $06,$FF,$21 + db $06,$FF,$22 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +LeechSeedAnim: + db $46,$48,$1B + db $55,$4D,$1C + db $FF + +GrowthAnim: + db SE_LIGHT_SCREEN_PALETTE, $49 + db SE_SPIRAL_BALLS_INWARD, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +RazorLeafAnim: + db SE_LEAVES_FALLING, $4A + db $41,$80,$44 + db $01,$0C,$16 + db $FF + +SolarBeamAnim: + db $06,$4B,$2E + db $06,$FF,$01 + db $FF + +PoisonPowderAnim: + db $06,$4C,$36 + db $FF + +StunSporeAnim: + db $06,$4D,$36 + db $FF + +SleepPowderAnim: + db $06,$4E,$36 + db $FF + +PedalDanceAnim: + db SE_LIGHT_SCREEN_PALETTE, $4F + db SE_PETALS_FALLING, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +StringShotAnim: + db $08,$50,$37 + db $FF + +DragonRageAnim: + db $46,$51,$1F + db $46,$FF,$0C + db $46,$FF,$0D + db $46,$FF,$0E + db $FF + +FireSpinAnim: + db $46,$52,$0C + db $46,$FF,$0D + db $46,$FF,$0E + db $FF + +ThunderShockAnim: + db $42,$53,$29 + db $FF + +ThunderBoltAnim: + db $41,$54,$29 + db $41,$54,$29 + db $FF + +ThunderWaveAnim: + db $42,$55,$29 + db $02,$FF,$23 + db $04,$FF,$23 + db $FF + +ThunderAnim: + db SE_DARK_SCREEN_PALETTE, $56 + db SE_DARK_SCREEN_FLASH, $FF + db $46,$FF,$2B + db SE_DARK_SCREEN_FLASH, $FF + db $42,$54,$29 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +RockThrowAnim: + db $04,$57,$30 + db $FF + +EarthquakeAnim: + db SE_SHAKE_SCREEN, $58 + db SE_SHAKE_SCREEN, $58 + db $FF + +FissureAnim: + db SE_DARK_SCREEN_FLASH, $59 + db SE_SHAKE_SCREEN, $FF + db SE_DARK_SCREEN_FLASH, $59 + db SE_SHAKE_SCREEN, $FF + db $FF + +DigAnim: + db $46,$5A,$04 + db SE_SLIDE_MON_UP, $FF + db $FF + +ToxicAnim: + db SE_WATER_DROPLETS_EVERYWHERE, $38 + db $46,$5B,$14 + db $FF + +ConfusionAnim: + db SE_FLASH_SCREEN_LONG, $5C + db $FF + +PsychicAnim: + db SE_FLASH_SCREEN_LONG, $5D + db SE_WAVY_SCREEN, $FF + db $FF + +HypnosisAnim: + db SE_FLASH_SCREEN_LONG, $5E + db $FF + +MeditateAnim: + db SE_LIGHT_SCREEN_PALETTE, $5F + db $46,$FF,$43 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +AgilityAnim: + db SE_LIGHT_SCREEN_PALETTE, $60 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +QuickAttackAnim: + db SE_SLIDE_MON_OFF, $61 + db $46,$FF,$04 + db SE_SHOW_MON_PIC, $FF + db $FF + +RageAnim: + db $06,$62,$01 + db $FF + +TeleportAnim: + db SE_SQUISH_MON_PIC, $63 + db SE_SHOOT_BALLS_UPWARD, $FF + db $FF + +NightShadeAnim: + db SE_FLASH_SCREEN_LONG, $5C + db SE_WAVY_SCREEN, $FF + db $FF + +MimicAnim: + db $46,$65,$21 + db $46,$65,$22 + db $FF + +ScreechAnim: + db $46,$66,$12 + db $FF + +DoubleTeamAnim: + db SE_DARK_SCREEN_PALETTE, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DARK_SCREEN_FLASH, $FF + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db SE_SHAKE_BACK_AND_FORTH, $67 + db SE_SHOW_MON_PIC, $FF + db $46,$6F,$33 + db $FF + +RecoverAnim: + db SE_BLINK_MON, $68 + db SE_LIGHT_SCREEN_PALETTE, $FF + db SE_SPIRAL_BALLS_INWARD, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +HardenAnim: + db SE_LIGHT_SCREEN_PALETTE, $69 + db $46,$FF,$43 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +MinimizeAnim: + db SE_LIGHT_SCREEN_PALETTE, $6A + db SE_SPIRAL_BALLS_INWARD, $FF + db SE_MINIMIZE_MON, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +SmokeScreenAnim: + db $46,$6B,$28 + db $04,$FF,$0A + db SE_DARKEN_MON_PALETTE, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DARK_SCREEN_PALETTE, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_DARKEN_MON_PALETTE, $FF + db SE_DELAY_ANIMATION_10, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ConfuseRayAnim: + db SE_DARK_SCREEN_PALETTE, $6C + db $46,$FF,$3E + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +WithdrawAnim: + db SE_LIGHT_SCREEN_PALETTE, $6E + db SE_SLIDE_MON_DOWN, $FF + db $06,$FF,$51 + db SE_RESET_SCREEN_PALETTE, $FF + db SE_SHOW_MON_PIC, $FF + db $FF + +DefenseCurlAnim: + db SE_LIGHT_SCREEN_PALETTE, $6E + db $06,$FF,$43 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +BarrierAnim: + db $46,$6F,$33 + db $46,$6F,$33 + db $FF + +LightScreenAnim: + db SE_LIGHT_SCREEN_PALETTE, $FF + db $46,$70,$33 + db $46,$70,$33 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +HazeAnim: + db SE_DARKEN_MON_PALETTE, $FF + db SE_WATER_DROPLETS_EVERYWHERE, $38 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ReflectAnim: + db SE_DARK_SCREEN_PALETTE, $FF + db $46,$72,$33 + db $46,$72,$33 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +FocusEnergyAnim: + db SE_SPIRAL_BALLS_INWARD, $73 + db $FF + +BideAnim: + db $46,$74,$04 + db $FF + +MetronomeAnim: + db SE_MOVE_MON_HORIZONTALLY, $84 + db SE_DELAY_ANIMATION_10, $FF + db SE_RESET_MON_POSITION, $84 + db SE_DELAY_ANIMATION_10, $FF + db SE_MOVE_MON_HORIZONTALLY, $84 + db SE_DELAY_ANIMATION_10, $FF + db SE_RESET_MON_POSITION, $84 + db $FF + +MirrorMoveAnim: + db $08,$76,$01 + db $FF + +SelfdestructAnim: + db $43,$77,$34 + db $FF + +EggBombAnim: + db $44,$78,$41 + db $44,$78,$42 + db $FF + +LickAnim: + db $46,$7B,$14 + db $FF + +SmogAnim: + db SE_DARKEN_MON_PALETTE, $48 + db $46,$7A,$19 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +SludgeAnim: + db $46,$7B,$13 + db $46,$7B,$14 + db $FF + +BoneClubAnim: + db $08,$7C,$02 + db $FF + +FireBlastAnim: + db $46,$7D,$1F + db $46,$FF,$20 + db $46,$FF,$20 + db $46,$FF,$0C + db $46,$FF,$0D + db $FF + +WaterfallAnim: + db SE_SLIDE_MON_DOWN, $48 + db $06,$37,$1A + db $08,$FF,$02 + db SE_SLIDE_MON_UP, $FF + db $FF + +ClampAnim: + db $08,$7F,$2A + db $06,$83,$23 + db $06,$83,$23 + db $FF + +SwiftAnim: + db $43,$80,$3F + db $FF + +SkullBashAnim: + db $46,$81,$05 + db $FF + +SpikeCannonAnim: + db $44,$82,$04 + db $FF + +ConstrictAnim: + db $06,$83,$23 + db $06,$83,$23 + db $06,$83,$23 + db $FF + +AmnesiaAnim: + db $08,$84,$25 + db $08,$84,$25 + db $FF + +KinesisAnim: + db $08,$85,$01 + db $FF + +SoftboiledAnim: + db SE_SLIDE_MON_HALF_OFF, $48 + db $08,$86,$4C + db SE_LIGHT_SCREEN_PALETTE, $FF + db SE_SPIRAL_BALLS_INWARD, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db SE_SHOW_MON_PIC, $FF + db $FF + +HiJumpKickAnim: + db $46,$87,$04 + db $FF + +GlareAnim: + db SE_DARK_SCREEN_PALETTE, $48 + db SE_DARK_SCREEN_FLASH, $88 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +DreamEaterAnim: + db SE_FLASH_SCREEN_LONG, $89 + db SE_DARK_SCREEN_PALETTE, $89 + db $08,$89,$02 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +PoisonGasAnim: + db $46,$8A,$19 + db $FF + +BarrageAnim: + db $43,$8B,$41 + db $05,$FF,$55 + db $FF + +LeechLifeAnim: + db $08,$8C,$02 + db SE_DARK_SCREEN_FLASH, $FF + db $06,$FF,$21 + db $06,$FF,$22 + db SE_DARK_SCREEN_FLASH, $FF + db $FF + +LovelyKissAnim: + db $06,$8D,$12 + db $FF + +SkyAttackAnim: + db SE_SQUISH_MON_PIC, $8E + db SE_SHOOT_BALLS_UPWARD, $FF + db $46,$87,$04 + db SE_SHOW_MON_PIC, $FF + db $FF + +TransformAnim: + db $46,$8F,$21 + db $44,$8F,$22 + db $08,$FF,$47 + db SE_TRANSFORM_MON, $FF + db $FF + +BubbleAnim: + db $16,$90,$35 + db $FF + +DizzyPunchAnim: + db $06,$91,$17 + db $06,$91,$17 + db $06,$91,$17 + db $06,$02,$02 + db $FF + +SporeAnim: + db $06,$92,$36 + db $FF + +FlashAnim: + db SE_LIGHT_SCREEN_PALETTE, $48 + db SE_DARK_SCREEN_FLASH, $88 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +PsywaveAnim: + db $06,$2F,$31 + db SE_WAVY_SCREEN, $5C + db $FF + +SplashAnim: + db SE_BOUNCE_UP_AND_DOWN, $95 + db $FF + +AcidArmorAnim: + db SE_SLIDE_MON_DOWN_AND_HIDE, $96 + db $FF + +CrabHammerAnim: + db $46,$97,$05 + db $06,$FF,$2A + db $FF + +ExplosionAnim: + db $43,$98,$34 + db $FF + +FurySwipesAnim: + db $04,$99,$0F + db $FF + +BonemerangAnim: + db $06,$9A,$02 + db $FF + +RestAnim: + db $10,$9B,$3A + db $10,$9B,$3A + db $FF + +RockSlideAnim: + db $04,$9C,$1D + db $03,$9C,$1E + db $46,$9D,$04 + db $FF + +HyperFangAnim: + db $06,$9D,$02 + db $FF + +SharpenAnim: + db SE_LIGHT_SCREEN_PALETTE, $9E + db $46,$FF,$43 + db SE_DARK_SCREEN_FLASH, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ConversionAnim: + db SE_DARK_SCREEN_FLASH, $9F + db $46,$FF,$21 + db $46,$FF,$22 + db SE_DARK_SCREEN_FLASH, $FF + db $FF + +TriAttackAnim: + db SE_DARK_SCREEN_FLASH, $A0 + db $46,$FF,$4D + db SE_DARK_SCREEN_FLASH, $FF + db $FF + +SuperFangAnim: + db SE_DARK_SCREEN_PALETTE, $48 + db $46,$A1,$04 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +SlashAnim: + db $06,$A2,$0F + db $FF + +SubstituteAnim: + db SE_SLIDE_MON_OFF, $A3 + db $08,$FF,$47 + db SE_SUBSTITUTE_MON, $FF + db $FF + +BallTossAnim: + db $03,$FF,$06 + db $FF + +GreatTossAnim: + db $03,$FF,$07 + db $FF + +UltraTossAnim: + db $02,$FF,$08 + db $FF + +BallShakeAnim: + db $04,$FF,$09 + db $FF + +BallPoofAnim: + db $04,$FF,$0A + db $FF + +ShowPicAnim: + db SE_SHOW_ENEMY_MON_PIC, $FF + db $FF + +HidePicAnim: + db SE_HIDE_ENEMY_MON_PIC, $FF + db $FF + +EnemyFlashAnim: + db SE_SHOW_MON_PIC, $FF + db $FF + +PlayerFlashAnim: + db SE_FLASH_MON_PIC, $FF + db $FF + +EnemyHUDShakeAnim: + db SE_SHAKE_ENEMY_HUD, $FF + db $FF + +TradeBallDropAnim: + db $86,$FF,$48 + db $FF + +TradeBallAppear1Anim: + db $84,$FF,$49 + db $FF + +TradeBallAppear2Anim: + db $86,$FF,$4A + db $FF + +TradeBallPoofAnim: + db $86,$FF,$4B + db $FF + +XStatItemAnim: + db SE_LIGHT_SCREEN_PALETTE, $FF + db SE_SPIRAL_BALLS_INWARD, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ShrinkingSquareAnim: + db SE_LIGHT_SCREEN_PALETTE, $FF + db $46,$FF,$43 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +XStatItemBlackAnim: + db SE_DARKEN_MON_PALETTE, $FF + db SE_SPIRAL_BALLS_INWARD, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ShrinkingSquareBlackAnim: + db SE_DARKEN_MON_PALETTE, $FF + db $46,$FF,$43 + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +UnusedAnim: + db SE_LIGHT_SCREEN_PALETTE, $FF + db SE_SHOOT_MANY_BALLS_UPWARD, $FF + db SE_RESET_SCREEN_PALETTE, $FF + db $FF + +ParalyzeAnim: + db $04,$13,$24 + db $04,$13,$24 + db $FF + +PoisonAnim: + db $08,$13,$27 + db $08,$13,$27 + db $FF + +SleepPlayerAnim: + db $10,$9B,$3A + db $10,$9B,$3A + db $FF + +SleepEnemyAnim: + db $10,$9B,$3B + db $10,$9B,$3B + db $FF + +ConfusedPlayerAnim: + db $08,$84,$25 + db $08,$84,$25 + db $FF + +ConfusedEnemyAnim: + db $08,$84,$26 + db $08,$84,$26 + db $FF + +BallBlockAnim: + db $03,$FF,$0B + db $FF + +FaintAnim: + db SE_SLIDE_MON_DOWN, $5A + db $FF + +ShakeScreenAnim: + db SE_SHAKE_SCREEN, $FF + db $FF + +ThrowRockAnim: + db $03,$8B,$53 + db $FF + +ThrowBaitAnim: + db $03,$8B,$54 + db $FF + +SubanimationPointers: + dw Subanimation00 + dw Subanimation01 + dw Subanimation02 + dw Subanimation03 + dw Subanimation04 + dw Subanimation05 + dw Subanimation06 + dw Subanimation07 + dw Subanimation08 + dw Subanimation09 + dw Subanimation0a + dw Subanimation0b + dw Subanimation0c + dw Subanimation0d + dw Subanimation0e + dw Subanimation0f + dw Subanimation10 + dw Subanimation11 + dw Subanimation12 + dw Subanimation13 + dw Subanimation14 + dw Subanimation15 + dw Subanimation16 + dw Subanimation17 + dw Subanimation18 + dw Subanimation19 + dw Subanimation1a + dw Subanimation1b + dw Subanimation1c + dw Subanimation1d + dw Subanimation1e + dw Subanimation1f + dw Subanimation20 + dw Subanimation21 + dw Subanimation22 + dw Subanimation23 + dw Subanimation24 + dw Subanimation25 + dw Subanimation26 + dw Subanimation27 + dw Subanimation28 + dw Subanimation29 + dw Subanimation2a + dw Subanimation2b + dw Subanimation2c + dw Subanimation2d + dw Subanimation2e + dw Subanimation2f + dw Subanimation30 + dw Subanimation31 + dw Subanimation32 + dw Subanimation33 + dw Subanimation34 + dw Subanimation35 + dw Subanimation36 + dw Subanimation37 + dw Subanimation38 + dw Subanimation39 + dw Subanimation3a + dw Subanimation3b + dw Subanimation3c + dw Subanimation3d + dw Subanimation3e + dw Subanimation3f + dw Subanimation40 + dw Subanimation41 + dw Subanimation42 + dw Subanimation43 + dw Subanimation44 + dw Subanimation45 + dw Subanimation46 + dw Subanimation47 + dw Subanimation48 + dw Subanimation49 + dw Subanimation4a + dw Subanimation4b + dw Subanimation4c + dw Subanimation4d + dw Subanimation4e + dw Subanimation4f + dw Subanimation50 + dw Subanimation51 + dw Subanimation52 + dw Subanimation53 + dw Subanimation54 + dw Subanimation55 + +Subanimation04: + db $43 + db $02,$1a,$00 + db $02,$10,$00 + db $02,$03,$00 + +Subanimation05: + db $41 + db $02,$10,$00 + +Subanimation08: + db $0b + db $03,$30,$00 + db $03,$44,$00 + db $03,$94,$00 + db $03,$60,$00 + db $03,$76,$00 + db $03,$9f,$00 + db $03,$8d,$00 + db $03,$a0,$00 + db $03,$1a,$00 + db $03,$a1,$00 + db $03,$34,$00 + +Subanimation07: + db $0b + db $03,$30,$00 + db $03,$a2,$00 + db $03,$31,$00 + db $03,$a3,$00 + db $03,$32,$00 + db $03,$a4,$00 + db $03,$92,$00 + db $03,$a5,$00 + db $03,$15,$00 + db $03,$a6,$00 + db $03,$34,$00 + +Subanimation06: + db $0b + db $03,$30,$00 + db $03,$a2,$00 + db $03,$93,$00 + db $03,$61,$00 + db $03,$73,$00 + db $03,$a7,$00 + db $03,$33,$00 + db $03,$a8,$00 + db $03,$0e,$00 + db $03,$a9,$00 + db $03,$34,$00 + +Subanimation09: + db $04 + db $03,$21,$04 + db $04,$21,$04 + db $03,$21,$04 + db $05,$21,$04 + +Subanimation0a: + db $46 + db $06,$1b,$00 + db $07,$1b,$00 + db $08,$36,$00 + db $09,$36,$00 + db $0a,$15,$00 + db $0a,$15,$00 + +Subanimation0b: + db $04 + db $01,$2d,$00 + db $03,$2f,$00 + db $03,$35,$00 + db $03,$4d,$00 + +Subanimation55: + db $41 + db $01,$9d,$00 + +Subanimation11: + db $4c + db $0b,$26,$00 + db $0c,$26,$00 + db $0b,$26,$00 + db $0c,$26,$00 + db $0b,$28,$00 + db $0c,$28,$00 + db $0b,$28,$00 + db $0c,$28,$00 + db $0b,$27,$00 + db $0c,$27,$00 + db $0b,$27,$00 + db $0c,$27,$00 + +Subanimation2b: + db $4b + db $0d,$03,$03 + db $0e,$03,$03 + db $0f,$03,$00 + db $0d,$11,$00 + db $0d,$11,$00 + db $0d,$37,$00 + db $0d,$37,$00 + db $10,$21,$00 + db $10,$21,$00 + db $11,$1b,$00 + db $11,$1b,$00 + +Subanimation2c: + db $4c + db $12,$01,$00 + db $12,$0f,$00 + db $12,$1b,$00 + db $12,$25,$00 + db $13,$38,$00 + db $13,$38,$02 + db $14,$38,$00 + db $14,$38,$02 + db $15,$38,$00 + db $15,$38,$00 + db $16,$38,$00 + db $16,$38,$00 + +Subanimation12: + db $69 + db $17,$30,$00 + db $17,$39,$00 + db $17,$3a,$00 + db $17,$3b,$00 + db $17,$3c,$00 + db $17,$3d,$00 + db $17,$3e,$00 + db $17,$3f,$00 + db $17,$1f,$00 + +Subanimation00: + db $41 + db $01,$17,$00 + +Subanimation01: + db $42 + db $01,$0f,$00 + db $01,$1d,$00 + +Subanimation02: + db $43 + db $01,$12,$00 + db $01,$15,$00 + db $01,$1c,$00 + +Subanimation03: + db $44 + db $01,$0b,$00 + db $01,$11,$00 + db $01,$18,$00 + db $01,$1d,$00 + +Subanimation0c: + db $43 + db $0c,$20,$00 + db $0c,$21,$00 + db $0c,$23,$00 + +Subanimation0d: + db $46 + db $0c,$20,$02 + db $0c,$15,$00 + db $0c,$21,$02 + db $0c,$17,$00 + db $0c,$23,$02 + db $0c,$19,$00 + +Subanimation0e: + db $49 + db $0c,$20,$02 + db $0c,$15,$02 + db $0c,$07,$00 + db $0c,$21,$02 + db $0c,$17,$02 + db $0c,$09,$00 + db $0c,$23,$02 + db $0c,$19,$02 + db $0c,$0c,$00 + +Subanimation1f: + db $85 + db $0c,$30,$03 + db $0c,$40,$03 + db $0c,$41,$03 + db $0c,$42,$03 + db $0c,$21,$00 + +Subanimation2e: + db $2e + db $18,$43,$02 + db $75,$52,$04 + db $19,$43,$02 + db $75,$63,$04 + db $1a,$43,$02 + db $75,$4d,$04 + db $1b,$43,$02 + db $75,$97,$04 + db $1c,$43,$02 + db $75,$98,$04 + db $1d,$43,$02 + db $75,$58,$04 + db $1e,$43,$02 + db $75,$1b,$00 + +Subanimation2f: + db $44 + db $1f,$24,$00 + db $20,$20,$00 + db $21,$1a,$00 + db $22,$15,$00 + +Subanimation30: + db $52 + db $23,$00,$02 + db $23,$02,$02 + db $23,$04,$00 + db $23,$07,$02 + db $23,$02,$02 + db $23,$04,$00 + db $23,$0e,$02 + db $23,$02,$02 + db $23,$0c,$00 + db $25,$07,$00 + db $25,$0e,$00 + db $25,$15,$00 + db $24,$24,$02 + db $23,$1c,$02 + db $23,$23,$00 + db $23,$21,$02 + db $24,$28,$00 + db $24,$28,$00 + +Subanimation0f: + db $4c + db $26,$0e,$02 + db $26,$16,$02 + db $26,$1c,$00 + db $27,$0e,$02 + db $27,$16,$02 + db $27,$1c,$00 + db $28,$0e,$02 + db $28,$16,$02 + db $28,$1c,$00 + db $29,$0e,$02 + db $29,$16,$02 + db $29,$1c,$00 + +Subanimation16: + db $4c + db $2a,$05,$00 + db $2b,$05,$02 + db $2b,$0c,$02 + db $2a,$11,$04 + db $2b,$11,$02 + db $2b,$17,$02 + db $2a,$1b,$04 + db $2b,$1b,$02 + db $2b,$20,$02 + db $2a,$2f,$04 + db $2c,$00,$02 + db $2c,$00,$00 + +Subanimation10: + db $88 + db $2d,$44,$00 + db $2e,$45,$00 + db $2d,$46,$00 + db $2e,$47,$00 + db $2d,$48,$00 + db $2e,$49,$00 + db $2d,$2f,$00 + db $2e,$1a,$00 + +Subanimation31: + db $2a + db $2f,$46,$00 + db $2f,$4a,$00 + db $2f,$4b,$00 + db $2f,$4c,$00 + db $2f,$4d,$00 + db $2f,$4e,$00 + db $2f,$4f,$00 + db $2f,$50,$00 + db $2f,$2e,$00 + db $2f,$51,$00 + +Subanimation13: + db $86 + db $30,$31,$00 + db $30,$32,$00 + db $30,$92,$00 + db $30,$0e,$00 + db $30,$0f,$00 + db $30,$10,$00 + +Subanimation14: + db $49 + db $30,$10,$00 + db $30,$10,$03 + db $31,$1c,$04 + db $31,$21,$04 + db $31,$26,$00 + db $30,$10,$02 + db $31,$1d,$04 + db $31,$22,$04 + db $31,$27,$00 + +Subanimation41: + db $85 + db $03,$31,$00 + db $03,$32,$00 + db $03,$92,$00 + db $03,$0e,$00 + db $03,$10,$00 + +Subanimation42: + db $43 + db $48,$08,$00 + db $49,$08,$00 + db $5a,$08,$00 + +Subanimation15: + db $22 + db $35,$52,$00 + db $35,$53,$00 + +Subanimation17: + db $44 + db $36,$54,$00 + db $36,$55,$00 + db $37,$56,$00 + db $37,$57,$00 + +Subanimation18: + db $a4 + db $36,$54,$00 + db $36,$55,$00 + db $37,$56,$00 + db $37,$57,$00 + +Subanimation40: + db $46 + db $17,$54,$00 + db $17,$55,$00 + db $17,$0e,$00 + db $17,$56,$00 + db $17,$57,$00 + db $17,$13,$00 + +Subanimation19: + db $8c + db $38,$31,$00 + db $39,$31,$00 + db $38,$32,$00 + db $39,$32,$00 + db $38,$92,$00 + db $39,$92,$00 + db $38,$0e,$00 + db $39,$0e,$00 + db $38,$0f,$00 + db $39,$0f,$00 + db $38,$10,$00 + db $39,$10,$00 + +Subanimation1a: + db $50 + db $3a,$08,$00 + db $3b,$08,$00 + db $3c,$08,$00 + db $3d,$08,$00 + db $3e,$08,$00 + db $3f,$08,$00 + db $3e,$08,$00 + db $3f,$08,$00 + db $3a,$0b,$00 + db $3b,$0b,$00 + db $3c,$0b,$00 + db $3d,$0b,$00 + db $3e,$0b,$00 + db $3f,$0b,$00 + db $3e,$0b,$00 + db $3f,$0b,$00 + +Subanimation1b: + db $84 + db $40,$31,$00 + db $40,$32,$00 + db $40,$92,$00 + db $40,$15,$00 + +Subanimation1c: + db $43 + db $41,$58,$00 + db $41,$59,$00 + db $41,$21,$00 + +Subanimation1d: + db $af + db $24,$9a,$00 + db $23,$1b,$02 + db $24,$22,$00 + db $23,$16,$02 + db $23,$1d,$02 + db $24,$98,$00 + db $25,$2c,$04 + db $25,$2a,$04 + db $25,$99,$04 + db $25,$62,$04 + db $25,$99,$04 + db $25,$62,$04 + db $25,$99,$04 + db $25,$62,$04 + db $25,$99,$03 + +Subanimation1e: + db $01 + db $25,$75,$00 + +Subanimation20: + db $42 + db $42,$07,$00 + db $43,$07,$00 + +Subanimation21: + db $43 + db $44,$00,$00 + db $45,$08,$00 + db $46,$10,$02 + +Subanimation22: + db $8b + db $47,$10,$00 + db $47,$56,$00 + db $47,$07,$00 + db $47,$aa,$00 + db $47,$ab,$00 + db $47,$ac,$00 + db $47,$ad,$00 + db $47,$ae,$00 + db $47,$af,$00 + db $47,$89,$00 + db $47,$b0,$00 + +Subanimation2d: + db $66 + db $44,$64,$00 + db $45,$65,$00 + db $46,$66,$00 + db $47,$66,$00 + db $47,$66,$00 + db $47,$66,$00 + +Subanimation39: + db $61 + db $47,$67,$00 + +Subanimation4e: + db $41 + db $71,$0f,$03 + +Subanimation4f: + db $47 + db $71,$0f,$00 + db $71,$08,$00 + db $71,$01,$00 + db $71,$95,$00 + db $72,$95,$00 + db $73,$95,$00 + db $74,$95,$00 + +Subanimation50: + db $48 + db $74,$95,$00 + db $73,$95,$00 + db $72,$95,$00 + db $71,$95,$00 + db $71,$01,$00 + db $71,$08,$00 + db $71,$0f,$00 + db $71,$16,$00 + +Subanimation29: + db $5d + db $48,$0f,$00 + db $4a,$68,$03 + db $4b,$2a,$03 + db $49,$0f,$00 + db $4a,$68,$03 + db $4b,$2a,$00 + db $4c,$6a,$03 + db $4d,$69,$03 + db $49,$6b,$00 + db $4c,$6a,$03 + db $4d,$69,$00 + db $4a,$68,$03 + db $4b,$2a,$03 + db $49,$6c,$00 + db $4a,$68,$03 + db $4b,$2a,$00 + db $4c,$6a,$03 + db $4d,$69,$03 + db $49,$6d,$00 + db $4c,$6a,$03 + db $4d,$2a,$00 + db $4a,$68,$03 + db $4b,$2a,$03 + db $49,$0f,$00 + db $4a,$68,$03 + db $4b,$2a,$00 + db $4c,$6a,$03 + db $4d,$2a,$03 + db $49,$6b,$00 + +Subanimation2a: + db $44 + db $4e,$2b,$00 + db $4f,$2b,$00 + db $50,$2b,$00 + db $50,$2b,$00 + +Subanimation23: + db $42 + db $51,$2d,$00 + db $51,$6e,$00 + +Subanimation24: + db $a2 + db $51,$2d,$00 + db $51,$6e,$00 + +Subanimation25: + db $62 + db $52,$71,$00 + db $52,$72,$00 + +Subanimation26: + db $02 + db $52,$01,$00 + db $52,$2c,$00 + +Subanimation3a: + db $63 + db $53,$71,$00 + db $53,$7f,$00 + db $53,$81,$00 + +Subanimation3b: + db $03 + db $53,$01,$00 + db $53,$15,$00 + db $53,$2c,$00 + +Subanimation27: + db $a2 + db $54,$01,$00 + db $54,$2c,$00 + +Subanimation28: + db $23 + db $55,$73,$03 + db $56,$73,$03 + db $57,$73,$00 + +Subanimation32: + db $63 + db $47,$74,$00 + db $47,$43,$00 + db $47,$75,$00 + +Subanimation33: + db $26 + db $58,$76,$00 + db $34,$76,$00 + db $58,$76,$00 + db $34,$76,$00 + db $58,$76,$00 + db $34,$76,$00 + +Subanimation3c: + db $67 + db $59,$79,$03 + db $59,$7b,$03 + db $59,$77,$03 + db $59,$7a,$03 + db $59,$78,$03 + db $59,$7c,$03 + db $59,$76,$00 + +Subanimation3d: + db $08 + db $3a,$4d,$00 + db $3b,$4d,$00 + db $3c,$4d,$00 + db $3d,$4d,$00 + db $3e,$4d,$00 + db $3f,$4d,$00 + db $3e,$4d,$00 + db $3f,$4d,$00 + +Subanimation34: + db $35 + db $48,$7d,$00 + db $49,$7d,$00 + db $5a,$7d,$00 + db $48,$30,$00 + db $49,$30,$00 + db $5a,$30,$00 + db $48,$7e,$00 + db $49,$7e,$00 + db $5a,$7e,$00 + db $48,$7f,$00 + db $49,$7f,$00 + db $5a,$7f,$00 + db $48,$80,$00 + db $49,$80,$00 + db $5a,$80,$00 + db $48,$81,$00 + db $49,$81,$00 + db $5a,$81,$00 + db $48,$82,$00 + db $49,$82,$00 + db $5a,$82,$00 + +Subanimation35: + db $24 + db $5b,$83,$03 + db $5c,$84,$03 + db $5d,$85,$03 + db $5e,$09,$00 + +Subanimation36: + db $48 + db $5f,$2a,$00 + db $5f,$00,$00 + db $60,$2a,$00 + db $60,$00,$00 + db $61,$2a,$00 + db $61,$00,$00 + db $62,$2a,$00 + db $62,$00,$00 + +Subanimation37: + db $2a + db $63,$89,$00 + db $64,$75,$00 + db $63,$76,$00 + db $65,$0d,$00 + db $65,$86,$00 + db $65,$12,$00 + db $65,$87,$00 + db $65,$17,$00 + db $65,$88,$00 + db $65,$1a,$00 + +Subanimation38: + db $50 + db $66,$8a,$00 + db $66,$33,$00 + db $66,$2e,$00 + db $67,$24,$03 + db $66,$01,$04 + db $66,$10,$04 + db $66,$1d,$04 + db $67,$28,$03 + db $66,$2a,$04 + db $66,$0e,$04 + db $66,$1b,$04 + db $67,$26,$03 + db $66,$03,$04 + db $66,$12,$04 + db $66,$1e,$04 + db $67,$29,$00 + +Subanimation3e: + db $92 + db $02,$31,$00 + db $34,$31,$00 + db $02,$31,$00 + db $02,$32,$00 + db $34,$32,$00 + db $02,$32,$00 + db $02,$92,$00 + db $34,$92,$00 + db $02,$92,$00 + db $02,$0e,$00 + db $34,$0e,$00 + db $02,$0e,$00 + db $02,$0f,$00 + db $34,$0f,$00 + db $02,$0f,$00 + db $02,$10,$00 + db $34,$10,$00 + db $02,$10,$00 + +Subanimation3f: + db $72 + db $68,$4b,$00 + db $68,$8c,$00 + db $68,$20,$00 + db $68,$1c,$00 + db $68,$19,$00 + db $68,$14,$00 + db $68,$76,$00 + db $68,$8d,$00 + db $68,$15,$00 + db $68,$10,$00 + db $68,$0c,$00 + db $68,$06,$00 + db $68,$8e,$00 + db $68,$8f,$00 + db $68,$90,$00 + db $68,$26,$00 + db $68,$23,$00 + db $68,$1f,$00 + +Subanimation44: + db $2c + db $69,$4b,$00 + db $69,$8c,$00 + db $69,$20,$00 + db $69,$1c,$00 + db $69,$19,$00 + db $69,$14,$00 + db $69,$76,$00 + db $69,$8d,$00 + db $69,$15,$00 + db $69,$10,$00 + db $69,$0c,$00 + db $69,$06,$00 + +Subanimation43: + db $a3 + db $6a,$07,$00 + db $6b,$0f,$00 + db $6c,$17,$00 + +Subanimation45: + db $24 + db $6d,$8b,$00 + db $6d,$84,$00 + db $6d,$63,$00 + db $6d,$8c,$00 + +Subanimation46: + db $26 + db $6d,$8b,$00 + db $6d,$84,$00 + db $6d,$63,$00 + db $6d,$8c,$00 + db $6d,$0a,$00 + db $6d,$89,$00 + +Subanimation47: + db $23 + db $06,$82,$00 + db $07,$82,$00 + db $08,$96,$00 + +Subanimation48: + db $06 + db $03,$41,$04 + db $03,$48,$04 + db $04,$48,$04 + db $03,$48,$04 + db $05,$48,$04 + db $03,$48,$03 + +Subanimation49: + db $04 + db $04,$48,$04 + db $03,$48,$04 + db $05,$48,$04 + db $03,$48,$03 + +Subanimation4a: + db $01 + db $04,$84,$03 + +Subanimation4b: + db $03 + db $06,$72,$00 + db $07,$72,$00 + db $08,$72,$00 + +Subanimation4c: + db $68 + db $6f,$30,$00 + db $6e,$30,$00 + db $70,$30,$00 + db $6e,$30,$00 + db $6f,$30,$00 + db $6e,$30,$00 + db $70,$30,$00 + db $6e,$30,$00 + +Subanimation4d: + db $26 + db $32,$4b,$00 + db $33,$4f,$00 + db $32,$20,$00 + db $33,$16,$00 + db $32,$19,$00 + db $33,$0d,$00 + +Subanimation51: + db $a6 + db $76,$1b,$00 + db $34,$1b,$00 + db $76,$1b,$00 + db $34,$1b,$00 + db $76,$1b,$00 + db $34,$1b,$00 + +Subanimation52: + db $47 + db $77,$25,$00 + db $77,$9b,$00 + db $77,$1a,$00 + db $77,$9c,$00 + db $77,$2f,$00 + db $77,$50,$00 + db $77,$8c,$00 + +Subanimation53: + db $0c + db $78,$30,$00 + db $78,$a2,$00 + db $78,$93,$00 + db $78,$61,$00 + db $78,$73,$00 + db $78,$a7,$00 + db $78,$33,$00 + db $78,$a8,$00 + db $78,$0e,$00 + db $78,$a9,$00 + db $78,$34,$00 + db $01,$9e,$00 + +Subanimation54: + db $0b + db $79,$30,$00 + db $79,$a2,$00 + db $79,$93,$00 + db $79,$61,$00 + db $79,$73,$00 + db $79,$a7,$00 + db $79,$33,$00 + db $79,$a8,$00 + db $79,$0e,$00 + db $79,$a9,$00 + db $79,$34,$00 + +FrameBlockPointers: + dw FrameBlock00 + dw FrameBlock01 + dw FrameBlock02 + dw FrameBlock03 + dw FrameBlock04 + dw FrameBlock05 + dw FrameBlock06 + dw FrameBlock07 + dw FrameBlock08 + dw FrameBlock09 + dw FrameBlock0a + dw FrameBlock0b + dw FrameBlock0c + dw FrameBlock0d + dw FrameBlock0e + dw FrameBlock0f + dw FrameBlock10 + dw FrameBlock11 + dw FrameBlock12 + dw FrameBlock13 + dw FrameBlock14 + dw FrameBlock15 + dw FrameBlock16 + dw FrameBlock17 + dw FrameBlock18 + dw FrameBlock19 + dw FrameBlock1a + dw FrameBlock1b + dw FrameBlock1c + dw FrameBlock1d + dw FrameBlock1e + dw FrameBlock1f + dw FrameBlock20 + dw FrameBlock21 + dw FrameBlock22 + dw FrameBlock23 + dw FrameBlock24 + dw FrameBlock25 + dw FrameBlock26 + dw FrameBlock27 + dw FrameBlock28 + dw FrameBlock29 + dw FrameBlock2a + dw FrameBlock2b + dw FrameBlock2c + dw FrameBlock2d + dw FrameBlock2e + dw FrameBlock2f + dw FrameBlock30 + dw FrameBlock31 + dw FrameBlock32 + dw FrameBlock33 + dw FrameBlock34 + dw FrameBlock35 + dw FrameBlock36 + dw FrameBlock37 + dw FrameBlock38 + dw FrameBlock39 + dw FrameBlock3a + dw FrameBlock3b + dw FrameBlock3c + dw FrameBlock3d + dw FrameBlock3e + dw FrameBlock3f + dw FrameBlock40 + dw FrameBlock41 + dw FrameBlock42 + dw FrameBlock43 + dw FrameBlock44 + dw FrameBlock45 + dw FrameBlock46 + dw FrameBlock47 + dw SmallBlackCircleFrameBlock + dw LargeBlockCircleFrameBlock + dw FrameBlock4a + dw FrameBlock4b + dw FrameBlock4c + dw FrameBlock4d + dw FrameBlock4e + dw FrameBlock4f + dw FrameBlock50 + dw FrameBlock51 + dw FrameBlock52 + dw FrameBlock53 + dw FrameBlock54 + dw FrameBlock55 + dw FrameBlock56 + dw FrameBlock57 + dw FrameBlock58 + dw FrameBlock59 + dw FrameBlock5a + dw FrameBlock5b + dw FrameBlock5c + dw FrameBlock5d + dw FrameBlock5e + dw FrameBlock5f + dw FrameBlock60 + dw FrameBlock61 + dw FrameBlock62 + dw FrameBlock63 + dw FrameBlock64 + dw FrameBlock65 + dw FrameBlock66 + dw FrameBlock67 + dw FrameBlock68 + dw FrameBlock69 + dw FrameBlock6a + dw FrameBlock6b + dw FrameBlock6c + dw FrameBlock6d + dw FrameBlock6e + dw FrameBlock6f + dw FrameBlock70 + dw FrameBlock71 + dw FrameBlock72 + dw FrameBlock73 + dw FrameBlock74 + dw FrameBlock75 + dw FrameBlock76 + dw FrameBlock77 + dw FrameBlock78 + dw FrameBlock79 + +; FrameBlock format is as follows: +; first byte = number of tiles in FrameBlock +; +; Next, each group of 4 bytes describes a tile in the FrameBlock +; first byte = y offset +; second byte = x offset +; third byte = tile id (it's actually tile id - $31) +; fourth byte = tile properties (xflip/yflip/etc.) +FrameBlock01: + db $09 + db $00,$00,$2c,$00 + db $00,$08,$2d,$00 + db $00,$10,$2c,$20 + db $08,$00,$3c,$00 + db $08,$08,$3d,$00 + db $08,$10,$3c,$20 + db $10,$00,$2c,$40 + db $10,$08,$2d,$40 + db $10,$10,$2c,$60 + +FrameBlock02: + db $10 + db $00,$00,$20,$00 + db $00,$08,$21,$00 + db $00,$10,$21,$20 + db $00,$18,$20,$20 + db $08,$00,$30,$00 + db $08,$08,$31,$00 + db $08,$10,$31,$20 + db $08,$18,$30,$20 + db $10,$00,$30,$40 + db $10,$08,$31,$40 + db $10,$10,$31,$60 + db $10,$18,$30,$60 + db $18,$00,$20,$40 + db $18,$08,$21,$40 + db $18,$10,$21,$60 + db $18,$18,$20,$60 + +FrameBlock03: + db $04 + db $00,$00,$02,$00 + db $00,$08,$02,$20 + db $08,$00,$12,$00 + db $08,$08,$12,$20 + +FrameBlock04: + db $04 + db $00,$00,$06,$00 + db $00,$08,$07,$00 + db $08,$00,$16,$00 + db $08,$08,$17,$00 + +FrameBlock05: + db $04 + db $00,$00,$07,$20 + db $00,$08,$06,$20 + db $08,$00,$17,$20 + db $08,$08,$16,$20 + +FrameBlock06: + db $0c + db $00,$08,$23,$00 + db $08,$00,$32,$00 + db $08,$08,$33,$00 + db $00,$10,$23,$20 + db $08,$10,$33,$20 + db $08,$18,$32,$20 + db $10,$00,$32,$40 + db $10,$08,$33,$40 + db $18,$08,$23,$40 + db $10,$10,$33,$60 + db $10,$18,$32,$60 + db $18,$10,$23,$60 + +FrameBlock07: + db $10 + db $00,$00,$20,$00 + db $00,$08,$21,$00 + db $08,$00,$30,$00 + db $08,$08,$31,$00 + db $00,$10,$21,$20 + db $00,$18,$20,$20 + db $08,$10,$31,$20 + db $08,$18,$30,$20 + db $10,$00,$30,$40 + db $10,$08,$31,$40 + db $18,$00,$20,$40 + db $18,$08,$21,$40 + db $10,$10,$31,$60 + db $10,$18,$30,$60 + db $18,$10,$21,$60 + db $18,$18,$20,$60 + +FrameBlock08: + db $10 + db $00,$00,$20,$00 + db $00,$08,$21,$00 + db $08,$00,$30,$00 + db $08,$08,$31,$00 + db $00,$18,$21,$20 + db $00,$20,$20,$20 + db $08,$18,$31,$20 + db $08,$20,$30,$20 + db $18,$00,$30,$40 + db $18,$08,$31,$40 + db $20,$00,$20,$40 + db $20,$08,$21,$40 + db $18,$18,$31,$60 + db $18,$20,$30,$60 + db $20,$18,$21,$60 + db $20,$20,$20,$60 + +FrameBlock09: + db $0c + db $00,$00,$24,$00 + db $00,$08,$25,$00 + db $08,$00,$34,$00 + db $00,$18,$25,$20 + db $00,$20,$24,$20 + db $08,$20,$34,$20 + db $18,$00,$34,$40 + db $20,$00,$24,$40 + db $20,$08,$25,$40 + db $18,$20,$34,$60 + db $20,$18,$25,$60 + db $20,$20,$24,$60 + +FrameBlock0a: + db $0c + db $00,$00,$24,$00 + db $00,$08,$25,$00 + db $08,$00,$34,$00 + db $00,$20,$25,$20 + db $00,$28,$24,$20 + db $08,$28,$34,$20 + db $20,$00,$34,$40 + db $28,$00,$24,$40 + db $28,$08,$25,$40 + db $20,$28,$34,$60 + db $28,$20,$25,$60 + db $28,$28,$24,$60 + +FrameBlock0b: + db $04 + db $00,$00,$05,$00 + db $00,$08,$05,$20 + db $08,$00,$15,$00 + db $08,$08,$15,$20 + +FrameBlock0c: + db $04 + db $00,$00,$04,$00 + db $00,$08,$04,$20 + db $08,$00,$14,$00 + db $08,$08,$14,$20 + +FrameBlock0d: + db $08 + db $00,$00,$0c,$00 + db $00,$08,$0d,$00 + db $08,$00,$1c,$00 + db $08,$08,$1d,$00 + db $10,$00,$1d,$60 + db $10,$08,$1c,$60 + db $18,$00,$0d,$60 + db $18,$08,$0c,$60 + +FrameBlock0e: + db $04 + db $20,$00,$0c,$00 + db $20,$08,$0d,$00 + db $28,$00,$1c,$00 + db $28,$08,$1d,$00 + +FrameBlock0f: + db $04 + db $30,$00,$1d,$60 + db $30,$08,$1c,$60 + db $38,$00,$0d,$60 + db $38,$08,$0c,$60 + +FrameBlock10: + db $08 + db $00,$00,$0e,$00 + db $00,$08,$0f,$00 + db $08,$00,$1e,$00 + db $08,$08,$1f,$00 + db $00,$10,$0f,$20 + db $00,$18,$0e,$20 + db $08,$10,$1f,$20 + db $08,$18,$1e,$20 + +FrameBlock11: + db $08 + db $00,$00,$0e,$00 + db $00,$08,$0f,$00 + db $08,$00,$1e,$00 + db $08,$08,$1f,$00 + db $00,$20,$0f,$20 + db $00,$28,$0e,$20 + db $08,$20,$1f,$20 + db $08,$28,$1e,$20 + +FrameBlock12: + db $03 + db $00,$00,$37,$00 + db $08,$10,$37,$00 + db $00,$20,$37,$00 + +FrameBlock13: + db $04 + db $00,$00,$36,$00 + db $00,$08,$36,$20 + db $08,$00,$36,$40 + db $08,$08,$36,$60 + +FrameBlock14: + db $08 + db $00,$10,$28,$00 + db $00,$18,$28,$20 + db $08,$10,$38,$00 + db $08,$18,$38,$20 + db $00,$20,$36,$00 + db $00,$28,$36,$20 + db $08,$20,$36,$40 + db $08,$28,$36,$60 + +FrameBlock15: + db $0c + db $00,$00,$28,$00 + db $00,$08,$28,$20 + db $08,$00,$38,$00 + db $08,$08,$38,$20 + db $00,$10,$29,$00 + db $00,$18,$29,$20 + db $08,$10,$39,$00 + db $08,$18,$39,$20 + db $00,$20,$28,$00 + db $00,$28,$28,$20 + db $08,$20,$38,$00 + db $08,$28,$38,$20 + +FrameBlock16: + db $08 + db $00,$00,$29,$00 + db $00,$08,$29,$20 + db $08,$00,$39,$00 + db $08,$08,$39,$20 + db $00,$20,$29,$00 + db $00,$28,$29,$20 + db $08,$20,$39,$00 + db $08,$28,$39,$20 + +FrameBlock17: + db $04 + db $00,$00,$08,$00 + db $00,$08,$09,$00 + db $08,$00,$18,$00 + db $08,$08,$19,$00 + +FrameBlock18: + db $01 + db $18,$00,$45,$60 + +FrameBlock19: + db $02 + db $18,$08,$45,$00 + db $10,$08,$46,$60 + +FrameBlock1a: + db $02 + db $10,$10,$45,$60 + db $18,$10,$46,$00 + +FrameBlock1b: + db $02 + db $10,$18,$45,$00 + db $08,$18,$46,$60 + +FrameBlock1c: + db $02 + db $08,$20,$45,$60 + db $10,$20,$46,$00 + +FrameBlock1d: + db $02 + db $08,$28,$45,$00 + db $00,$28,$46,$60 + +FrameBlock1e: + db $02 + db $00,$30,$45,$60 + db $08,$30,$46,$00 + +FrameBlock75: + db $04 + db $00,$00,$43,$00 + db $00,$08,$43,$20 + db $08,$00,$22,$00 + db $08,$08,$43,$60 + +FrameBlock1f: + db $02 + db $00,$00,$03,$00 + db $00,$30,$03,$20 + +FrameBlock20: + db $06 + db $00,$00,$03,$00 + db $00,$30,$03,$20 + db $08,$08,$03,$00 + db $08,$28,$03,$20 + db $08,$00,$13,$00 + db $08,$30,$13,$20 + +FrameBlock21: + db $0c + db $00,$00,$03,$00 + db $00,$30,$03,$20 + db $08,$08,$03,$00 + db $08,$28,$03,$20 + db $08,$00,$13,$00 + db $08,$30,$13,$20 + db $10,$10,$03,$00 + db $10,$20,$03,$20 + db $10,$08,$13,$00 + db $10,$28,$13,$20 + db $10,$00,$03,$00 + db $10,$30,$03,$20 + +FrameBlock22: + db $13 + db $00,$00,$03,$00 + db $08,$00,$13,$00 + db $10,$00,$03,$00 + db $18,$00,$13,$00 + db $08,$08,$03,$00 + db $10,$08,$13,$00 + db $18,$08,$03,$00 + db $10,$10,$03,$00 + db $18,$10,$13,$00 + db $18,$18,$03,$00 + db $10,$20,$03,$20 + db $18,$20,$13,$20 + db $08,$28,$03,$20 + db $10,$28,$13,$20 + db $18,$28,$03,$20 + db $00,$30,$03,$20 + db $08,$30,$13,$20 + db $10,$30,$03,$20 + db $18,$30,$13,$20 + +FrameBlock23: + db $04 + db $00,$00,$0a,$00 + db $00,$08,$0b,$00 + db $08,$00,$1a,$00 + db $08,$08,$1b,$00 + +FrameBlock24: + db $02 + db $08,$00,$0a,$00 + db $08,$08,$0b,$00 + +FrameBlock25: + db $0c + db $10,$00,$0a,$00 + db $10,$08,$0b,$00 + db $18,$00,$1a,$00 + db $18,$08,$1b,$00 + db $00,$10,$0a,$00 + db $00,$18,$0b,$00 + db $08,$10,$1a,$00 + db $08,$18,$1b,$00 + db $08,$20,$0a,$00 + db $08,$28,$0b,$00 + db $10,$20,$1a,$00 + db $10,$28,$1b,$00 + +FrameBlock26: + db $04 + db $00,$10,$44,$00 + db $00,$18,$44,$20 + db $08,$10,$44,$40 + db $08,$18,$44,$60 + +FrameBlock27: + db $05 + db $08,$08,$44,$00 + db $08,$10,$44,$20 + db $10,$08,$44,$40 + db $10,$10,$44,$60 + db $00,$18,$47,$00 + +FrameBlock28: + db $06 + db $10,$00,$44,$00 + db $10,$08,$44,$20 + db $18,$00,$44,$40 + db $18,$08,$44,$60 + db $08,$10,$47,$00 + db $02,$16,$47,$00 + +FrameBlock29: + db $04 + db $18,$00,$47,$00 + db $12,$06,$47,$00 + db $0c,$0c,$47,$00 + db $06,$12,$47,$00 + +FrameBlock2a: + db $04 + db $00,$00,$44,$00 + db $00,$08,$44,$20 + db $08,$00,$44,$40 + db $08,$08,$44,$60 + +FrameBlock2b: + db $02 + db $06,$02,$47,$00 + db $00,$08,$47,$00 + +FrameBlock2c: + db $01 + db $a0,$00,$4d,$00 + +FrameBlock2d: + db $08 + db $00,$00,$26,$00 + db $00,$08,$27,$00 + db $08,$00,$36,$00 + db $08,$08,$37,$00 + db $10,$00,$28,$00 + db $10,$08,$29,$00 + db $18,$00,$38,$00 + db $18,$08,$39,$00 + +FrameBlock2e: + db $08 + db $00,$00,$27,$20 + db $00,$08,$26,$20 + db $08,$00,$37,$20 + db $08,$08,$36,$20 + db $10,$00,$29,$20 + db $10,$08,$28,$20 + db $18,$00,$39,$20 + db $18,$08,$38,$20 + +FrameBlock2f: + db $04 + db $00,$00,$0c,$00 + db $00,$08,$0d,$00 + db $08,$00,$0c,$40 + db $08,$08,$0d,$40 + +FrameBlock30: + db $04 + db $00,$00,$44,$00 + db $00,$08,$44,$20 + db $08,$00,$44,$40 + db $08,$08,$44,$60 + +FrameBlock31: + db $01 + db $00,$00,$45,$00 + +FrameBlock32: + db $07 + db $00,$00,$4d,$00 + db $00,$08,$2f,$00 + db $00,$10,$4d,$20 + db $08,$00,$4e,$00 + db $08,$08,$07,$00 + db $08,$10,$4e,$20 + db $10,$08,$3f,$00 + +FrameBlock33: + db $07 + db $00,$08,$3f,$40 + db $08,$00,$4e,$40 + db $08,$08,$07,$40 + db $08,$10,$4e,$60 + db $10,$00,$4d,$40 + db $10,$08,$2f,$40 + db $10,$10,$4d,$60 + +FrameBlock34: + db $01 + db $a0,$00,$00,$10 + +FrameBlock35: + db $06 + db $00,$00,$2a,$00 + db $00,$08,$2b,$00 + db $08,$00,$3a,$00 + db $10,$00,$3a,$40 + db $18,$00,$2a,$40 + db $18,$08,$2b,$40 + +FrameBlock36: + db $04 + db $00,$00,$00,$00 + db $00,$08,$01,$00 + db $08,$00,$10,$00 + db $08,$08,$11,$00 + +FrameBlock37: + db $04 + db $00,$00,$01,$a0 + db $00,$08,$00,$a0 + db $08,$00,$11,$a0 + db $08,$08,$10,$a0 + +FrameBlock38: + db $04 + db $00,$00,$0a,$00 + db $00,$08,$0b,$00 + db $08,$00,$1a,$00 + db $08,$08,$1b,$00 + +FrameBlock39: + db $04 + db $00,$00,$0b,$20 + db $00,$08,$0a,$20 + db $08,$00,$1b,$20 + db $08,$08,$1a,$20 + +FrameBlock3a: + db $04 + db $20,$00,$05,$00 + db $20,$08,$05,$20 + db $28,$00,$15,$00 + db $28,$08,$15,$20 + +FrameBlock3b: + db $05 + db $18,$00,$04,$00 + db $18,$08,$04,$20 + db $20,$00,$14,$00 + db $20,$08,$14,$20 + db $28,$04,$41,$00 + +FrameBlock3c: + db $06 + db $10,$00,$05,$00 + db $10,$08,$05,$20 + db $18,$00,$15,$00 + db $18,$08,$15,$20 + db $20,$04,$42,$00 + db $28,$04,$42,$00 + +FrameBlock3d: + db $07 + db $08,$00,$04,$00 + db $08,$08,$04,$20 + db $10,$00,$14,$00 + db $10,$08,$14,$20 + db $18,$04,$41,$00 + db $20,$04,$41,$00 + db $28,$04,$41,$00 + +FrameBlock3e: + db $08 + db $00,$00,$05,$00 + db $00,$08,$05,$20 + db $08,$00,$15,$00 + db $08,$08,$15,$20 + db $10,$04,$42,$00 + db $18,$04,$42,$00 + db $20,$04,$42,$00 + db $28,$04,$42,$00 + +FrameBlock3f: + db $08 + db $00,$00,$04,$00 + db $00,$08,$04,$20 + db $08,$00,$14,$00 + db $08,$08,$14,$20 + db $10,$04,$41,$00 + db $18,$04,$41,$00 + db $20,$04,$41,$00 + db $28,$04,$41,$00 + +FrameBlock40: + db $03 + db $00,$00,$3d,$00 + db $00,$08,$3d,$00 + db $08,$08,$3d,$00 + +FrameBlock41: + db $04 + db $00,$00,$06,$00 + db $00,$08,$06,$20 + db $08,$00,$16,$00 + db $08,$08,$17,$00 + +FrameBlock42: + db $0b + db $00,$10,$42,$00 + db $08,$00,$42,$00 + db $08,$08,$42,$00 + db $08,$10,$42,$00 + db $08,$18,$42,$00 + db $08,$20,$42,$00 + db $10,$10,$42,$00 + db $18,$08,$42,$00 + db $18,$18,$42,$00 + db $20,$00,$42,$00 + db $20,$20,$42,$00 + +FrameBlock43: + db $0b + db $00,$10,$41,$00 + db $08,$00,$41,$00 + db $08,$08,$41,$00 + db $08,$10,$41,$00 + db $08,$18,$41,$00 + db $08,$20,$41,$00 + db $10,$10,$41,$00 + db $18,$08,$41,$00 + db $18,$18,$41,$00 + db $20,$00,$41,$00 + db $20,$20,$41,$00 + +FrameBlock44: + db $04 + db $00,$00,$49,$00 + db $00,$28,$49,$00 + db $28,$00,$49,$00 + db $28,$28,$49,$00 + +FrameBlock45: + db $04 + db $00,$00,$49,$00 + db $00,$18,$49,$00 + db $18,$00,$49,$00 + db $18,$18,$49,$00 + +FrameBlock46: + db $04 + db $00,$00,$49,$00 + db $00,$08,$49,$00 + db $08,$00,$49,$00 + db $08,$08,$49,$00 + +FrameBlock47: + db $04 + db $00,$00,$43,$00 + db $00,$08,$43,$20 + db $08,$00,$43,$40 + db $08,$08,$43,$60 + +SmallBlackCircleFrameBlock: + db $04 + db $08,$08,$33,$00 + db $08,$10,$33,$20 + db $10,$08,$33,$40 + db $10,$10,$33,$60 + +LargeBlockCircleFrameBlock: + db $10 + db $00,$00,$22,$00 + db $00,$08,$23,$00 + db $00,$10,$23,$20 + db $00,$18,$22,$20 + db $08,$00,$32,$00 + db $08,$08,$43,$00 + db $08,$10,$43,$20 + db $08,$18,$32,$20 + db $10,$00,$32,$40 + db $10,$08,$43,$40 + db $10,$10,$43,$60 + db $10,$18,$32,$60 + db $18,$00,$22,$40 + db $18,$08,$23,$40 + db $18,$10,$23,$60 + db $18,$18,$22,$60 + +FrameBlock71: + db $10 + db $00,$00,$22,$00 + db $00,$08,$3b,$00 + db $00,$10,$23,$20 + db $00,$18,$22,$20 + db $08,$00,$32,$00 + db $08,$08,$43,$00 + db $08,$10,$43,$20 + db $08,$18,$32,$20 + db $10,$00,$32,$40 + db $10,$08,$43,$40 + db $10,$10,$43,$60 + db $10,$18,$32,$60 + db $18,$00,$22,$40 + db $18,$08,$23,$40 + db $18,$10,$23,$60 + db $18,$18,$22,$60 + +FrameBlock72: + db $0c + db $00,$00,$32,$00 + db $00,$08,$43,$00 + db $00,$10,$43,$20 + db $00,$18,$32,$20 + db $08,$00,$32,$40 + db $08,$08,$43,$40 + db $08,$10,$43,$60 + db $08,$18,$32,$60 + db $10,$00,$22,$40 + db $10,$08,$23,$40 + db $10,$10,$23,$60 + db $10,$18,$22,$60 + +FrameBlock73: + db $08 + db $00,$00,$32,$40 + db $00,$08,$43,$40 + db $00,$10,$43,$60 + db $00,$18,$32,$60 + db $08,$00,$22,$40 + db $08,$08,$23,$40 + db $08,$10,$23,$60 + db $08,$18,$22,$60 + +FrameBlock74: + db $04 + db $00,$00,$22,$40 + db $00,$08,$23,$40 + db $00,$10,$23,$60 + db $00,$18,$22,$60 + +FrameBlock4a: + db $04 + db $08,$18,$4c,$20 + db $20,$08,$4b,$00 + db $30,$20,$4c,$00 + db $18,$30,$4b,$40 + +FrameBlock4b: + db $04 + db $00,$18,$4c,$00 + db $20,$00,$4b,$40 + db $38,$20,$4c,$20 + db $18,$38,$4b,$00 + +FrameBlock4c: + db $04 + db $10,$08,$4a,$40 + db $30,$10,$4a,$00 + db $28,$30,$4a,$20 + db $08,$28,$4a,$60 + +FrameBlock4d: + db $04 + db $08,$00,$4a,$20 + db $38,$08,$4a,$60 + db $30,$38,$4a,$40 + db $00,$30,$4a,$00 + +FrameBlock4e: + db $08 + db $00,$30,$44,$00 + db $00,$38,$44,$20 + db $08,$30,$44,$40 + db $08,$38,$44,$60 + db $26,$0a,$44,$00 + db $26,$12,$44,$20 + db $2e,$0a,$44,$40 + db $2e,$12,$44,$60 + +FrameBlock4f: + db $0c + db $0e,$22,$44,$00 + db $0e,$2a,$44,$20 + db $16,$22,$44,$40 + db $16,$2a,$44,$60 + db $06,$32,$47,$00 + db $00,$38,$47,$00 + db $1a,$16,$44,$00 + db $1a,$1e,$44,$20 + db $22,$16,$44,$40 + db $22,$1e,$44,$60 + db $30,$08,$47,$00 + db $2a,$0e,$47,$00 + +FrameBlock50: + db $08 + db $06,$32,$47,$00 + db $00,$38,$47,$00 + db $12,$26,$47,$00 + db $0c,$2c,$47,$00 + db $1e,$1a,$47,$00 + db $18,$20,$47,$00 + db $2a,$0e,$47,$00 + db $24,$14,$47,$00 + +FrameBlock51: + db $08 + db $00,$00,$35,$20 + db $08,$00,$35,$40 + db $10,$00,$35,$00 + db $18,$00,$35,$60 + db $00,$40,$35,$00 + db $08,$40,$35,$60 + db $10,$40,$35,$20 + db $18,$40,$35,$40 + +FrameBlock52: + db $04 + db $00,$00,$2a,$00 + db $00,$08,$2b,$00 + db $08,$00,$3a,$00 + db $08,$08,$3b,$00 + +FrameBlock53: + db $03 + db $00,$00,$3f,$00 + db $00,$08,$3f,$00 + db $08,$06,$3f,$00 + +FrameBlock54: + db $04 + db $00,$00,$0e,$00 + db $00,$08,$0e,$20 + db $08,$00,$0f,$00 + db $08,$08,$0f,$20 + +FrameBlock55: + db $03 + db $10,$00,$2c,$00 + db $10,$08,$3c,$00 + db $10,$10,$2d,$00 + +FrameBlock56: + db $06 + db $10,$10,$31,$00 + db $10,$18,$31,$00 + db $08,$10,$2c,$00 + db $08,$18,$3c,$00 + db $08,$20,$2d,$00 + db $10,$20,$2d,$00 + +FrameBlock57: + db $09 + db $08,$20,$31,$00 + db $10,$20,$31,$00 + db $08,$28,$31,$00 + db $10,$28,$31,$00 + db $00,$20,$2c,$00 + db $00,$28,$3c,$00 + db $00,$30,$2d,$00 + db $08,$30,$2d,$00 + db $10,$30,$2d,$00 + +FrameBlock58: + db $07 + db $00,$00,$46,$00 + db $08,$02,$47,$00 + db $10,$03,$48,$00 + db $18,$04,$48,$00 + db $20,$05,$48,$00 + db $28,$05,$48,$00 + db $30,$05,$48,$00 + +FrameBlock59: + db $01 + db $00,$00,$42,$00 + +FrameBlock5a: + db $0c + db $00,$00,$24,$00 + db $00,$08,$25,$00 + db $08,$00,$34,$00 + db $00,$10,$25,$20 + db $00,$18,$24,$20 + db $08,$18,$34,$20 + db $10,$00,$34,$40 + db $18,$00,$24,$40 + db $18,$08,$25,$40 + db $10,$18,$34,$60 + db $18,$10,$25,$60 + db $18,$18,$24,$60 + +FrameBlock5b: + db $04 + db $00,$00,$43,$00 + db $00,$08,$43,$20 + db $08,$00,$43,$40 + db $08,$08,$43,$60 + +FrameBlock5c: + db $08 + db $00,$00,$49,$00 + db $02,$08,$49,$00 + db $18,$00,$49,$00 + db $10,$10,$49,$00 + db $08,$00,$43,$00 + db $08,$08,$43,$20 + db $10,$00,$43,$40 + db $10,$08,$43,$60 + +FrameBlock5d: + db $0b + db $00,$00,$49,$00 + db $18,$02,$49,$00 + db $14,$10,$49,$00 + db $08,$00,$43,$00 + db $00,$08,$43,$20 + db $10,$00,$43,$40 + db $10,$08,$43,$60 + db $04,$08,$43,$00 + db $04,$10,$43,$20 + db $0c,$08,$43,$40 + db $0c,$10,$43,$60 + +FrameBlock5e: + db $0f + db $00,$08,$49,$00 + db $08,$10,$49,$00 + db $20,$00,$49,$00 + db $08,$00,$43,$00 + db $08,$08,$43,$20 + db $10,$00,$43,$40 + db $10,$08,$43,$60 + db $10,$10,$43,$00 + db $10,$18,$43,$20 + db $18,$10,$43,$40 + db $18,$18,$43,$60 + db $20,$08,$43,$00 + db $20,$10,$43,$20 + db $28,$08,$43,$40 + db $28,$10,$43,$60 + +FrameBlock5f: + db $04 + db $00,$00,$49,$00 + db $00,$10,$49,$00 + db $00,$20,$49,$00 + db $00,$30,$49,$00 + +FrameBlock60: + db $08 + db $00,$00,$49,$00 + db $00,$10,$49,$00 + db $00,$20,$49,$00 + db $00,$30,$49,$00 + db $08,$08,$49,$00 + db $08,$18,$49,$00 + db $08,$28,$49,$00 + db $08,$38,$49,$00 + +FrameBlock61: + db $0c + db $00,$00,$49,$00 + db $00,$10,$49,$00 + db $00,$20,$49,$00 + db $00,$30,$49,$00 + db $08,$08,$49,$00 + db $08,$18,$49,$00 + db $08,$28,$49,$00 + db $08,$38,$49,$00 + db $10,$00,$49,$00 + db $10,$10,$49,$00 + db $10,$20,$49,$00 + db $10,$30,$49,$00 + +FrameBlock62: + db $0f + db $00,$00,$49,$00 + db $00,$10,$49,$00 + db $00,$20,$49,$00 + db $00,$30,$49,$00 + db $08,$08,$49,$00 + db $08,$18,$49,$00 + db $08,$28,$49,$00 + db $08,$38,$49,$00 + db $10,$00,$49,$00 + db $10,$10,$49,$00 + db $10,$20,$49,$00 + db $10,$30,$49,$00 + db $18,$08,$49,$00 + db $18,$18,$49,$00 + db $18,$28,$49,$00 + db $18,$38,$49,$00 ; unused + +FrameBlock63: + db $06 + db $10,$00,$26,$00 + db $10,$08,$27,$00 + db $08,$10,$26,$00 + db $08,$18,$27,$00 + db $00,$20,$26,$00 + db $00,$28,$27,$00 + +FrameBlock64: + db $06 + db $18,$00,$27,$00 + db $10,$08,$26,$00 + db $10,$10,$27,$00 + db $08,$18,$26,$00 + db $08,$20,$27,$00 + db $00,$28,$26,$00 + +FrameBlock65: + db $06 + db $00,$00,$1c,$00 + db $00,$08,$1d,$00 + db $10,$00,$1c,$00 + db $10,$08,$1d,$00 + db $20,$00,$1c,$00 + db $20,$08,$1d,$00 + +FrameBlock66: + db $02 + db $00,$00,$03,$00 + db $08,$00,$13,$00 + +FrameBlock67: + db $01 + db $00,$00,$03,$00 + +FrameBlock68: + db $04 + db $00,$00,$03,$00 + db $00,$08,$03,$20 + db $08,$00,$13,$00 + db $08,$08,$13,$20 + +FrameBlock69: + db $01 + db $00,$00,$06,$00 + +FrameBlock6a: + db $08 + db $00,$00,$2e,$00 + db $00,$30,$2e,$20 + db $30,$00,$2e,$40 + db $30,$30,$2e,$60 + db $00,$18,$2f,$00 + db $30,$18,$2f,$40 + db $18,$00,$3e,$00 + db $18,$30,$3e,$20 + +FrameBlock6b: + db $08 + db $00,$00,$2e,$00 + db $00,$20,$2e,$20 + db $20,$00,$2e,$40 + db $20,$20,$2e,$60 + db $00,$10,$2f,$00 + db $20,$10,$2f,$40 + db $10,$00,$3e,$00 + db $10,$20,$3e,$20 + +FrameBlock6c: + db $08 + db $00,$00,$2e,$00 + db $00,$10,$2e,$20 + db $10,$00,$2e,$40 + db $10,$10,$2e,$60 + db $00,$08,$2f,$00 + db $10,$08,$2f,$40 + db $08,$00,$3e,$00 + db $08,$10,$3e,$20 + +FrameBlock6d: + db $02 + db $00,$00,$1e,$00 + db $00,$08,$1f,$00 + +FrameBlock6e: + db $04 + db $00,$00,$48,$00 + db $00,$08,$48,$20 + db $08,$00,$12,$00 + db $08,$08,$12,$20 + +FrameBlock6f: + db $04 + db $00,$00,$4a,$00 + db $00,$08,$07,$00 + db $08,$00,$16,$00 + db $08,$08,$17,$00 + +FrameBlock70: + db $04 + db $00,$00,$07,$20 + db $00,$08,$4a,$20 + db $08,$00,$17,$20 + db $08,$08,$16,$20 + +FrameBlock76: + db $07 + db $00,$10,$2f,$00 + db $01,$08,$2f,$00 + db $01,$18,$2f,$00 + db $02,$00,$2e,$00 + db $02,$20,$2e,$20 + db $0a,$00,$3e,$00 + db $0a,$20,$3e,$20 + +FrameBlock77: + db $04 + db $00,$02,$4b,$00 + db $00,$0a,$4c,$00 + db $08,$00,$4c,$60 + db $08,$08,$4b,$60 + +FrameBlock78: + db $01 + db $00,$00,$4d,$00 + +FrameBlock79: + db $01 + db $00,$00,$4e,$00 + +FrameBlockBaseCoords: + db $10,$68 + db $10,$70 + db $10,$78 + db $10,$80 + db $10,$88 + db $10,$90 + db $10,$98 + db $18,$68 + db $18,$70 + db $18,$78 + db $34,$28 + db $18,$80 + db $18,$88 + db $18,$98 + db $20,$68 + db $20,$70 + db $20,$78 + db $20,$80 + db $20,$88 + db $20,$90 + db $20,$98 + db $28,$68 + db $28,$70 + db $28,$78 + db $28,$80 + db $28,$88 + db $30,$68 + db $30,$70 + db $30,$78 + db $30,$80 + db $30,$90 + db $30,$98 + db $38,$68 + db $38,$78 + db $38,$80 + db $38,$88 + db $40,$68 + db $40,$70 + db $40,$78 + db $40,$80 + db $40,$88 + db $40,$98 + db $10,$60 + db $18,$60 + db $20,$60 + db $28,$60 + db $30,$60 + db $40,$60 + db $58,$28 + db $43,$38 + db $33,$48 + db $20,$58 + db $32,$78 + db $58,$58 + db $2C,$6C + db $34,$80 + db $48,$70 + db $42,$36 + db $38,$44 + db $40,$52 + db $48,$60 + db $3E,$6E + db $28,$7C + db $28,$8A + db $50,$3C + db $48,$50 + db $40,$64 + db $38,$38 + db $50,$30 + db $50,$38 + db $50,$40 + db $50,$48 + db $50,$50 + db $48,$58 + db $50,$44 + db $48,$48 + db $48,$4C + db $40,$50 + db $40,$54 + db $38,$58 + db $38,$5C + db $30,$64 + db $48,$40 + db $48,$39 + db $24,$88 + db $24,$70 + db $1C,$70 + db $1C,$88 + db $34,$68 + db $34,$88 + db $68,$50 + db $60,$50 + db $68,$60 + db $58,$50 + db $60,$60 + db $68,$40 + db $40,$40 + db $38,$40 + db $0B,$60 + db $44,$48 + db $40,$14 + db $48,$1C + db $50,$24 + db $4C,$24 + db $10,$62 + db $12,$62 + db $12,$60 + db $20,$72 + db $22,$72 + db $22,$70 + db $28,$62 + db $50,$0A + db $52,$0A + db $38,$30 + db $40,$48 + db $30,$48 + db $40,$30 + db $30,$40 + db $38,$48 + db $40,$4A + db $48,$4B + db $50,$4C + db $58,$4D + db $60,$4D + db $68,$4D + db $38,$10 + db $50,$10 + db $38,$28 + db $48,$18 + db $40,$20 + db $48,$20 + db $40,$3C + db $38,$50 + db $28,$64 + db $1C,$90 + db $24,$80 + db $2C,$70 + db $30,$38 + db $10,$50 + db $3C,$40 + db $40,$58 + db $30,$58 + db $58,$48 + db $50,$58 + db $48,$68 + db $40,$18 + db $28,$58 + db $40,$38 + db $48,$38 + db $08,$70 + db $44,$1C + db $3C,$58 + db $38,$60 + db $08,$60 + db $38,$70 + db $38,$6C + db $38,$64 + db $1C,$74 + db $2E,$74 + db $34,$50 + db $2F,$60 + db $31,$70 + db $4C,$30 + db $3B,$40 + db $2D,$50 + db $26,$60 + db $2D,$70 + db $28,$50 + db $1E,$60 + db $29,$70 + db $16,$60 + db $14,$58 + db $12,$54 + db $14,$50 + db $18,$4C + db $1C,$48 + db $48,$28 + +FrameBlock00: + db $00,$00 diff --git a/data/moves/effects_pointers.asm b/data/moves/effects_pointers.asm new file mode 100644 index 00000000..0d36e887 --- /dev/null +++ b/data/moves/effects_pointers.asm @@ -0,0 +1,87 @@ +MoveEffectPointerTable: + dw SleepEffect ; unused effect + dw PoisonEffect ; POISON_SIDE_EFFECT1 + dw DrainHPEffect ; DRAIN_HP_EFFECT + dw FreezeBurnParalyzeEffect ; BURN_SIDE_EFFECT1 + dw FreezeBurnParalyzeEffect ; FREEZE_SIDE_EFFECT + dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1 + dw ExplodeEffect ; EXPLODE_EFFECT + dw DrainHPEffect ; DREAM_EATER_EFFECT + dw $0000 ; MIRROR_MOVE_EFFECT + dw StatModifierUpEffect ; ATTACK_UP1_EFFECT + dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT + dw StatModifierUpEffect ; SPEED_UP1_EFFECT + dw StatModifierUpEffect ; SPECIAL_UP1_EFFECT + dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT + dw StatModifierUpEffect ; EVASION_UP1_EFFECT + dw PayDayEffect ; PAY_DAY_EFFECT + dw $0000 ; SWIFT_EFFECT + dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT + dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT + dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT + dw StatModifierDownEffect ; SPECIAL_DOWN1_EFFECT + dw StatModifierDownEffect ; ACCURACY_DOWN1_EFFECT + dw StatModifierDownEffect ; EVASION_DOWN1_EFFECT + dw ConversionEffect ; CONVERSION_EFFECT + dw HazeEffect ; HAZE_EFFECT + dw BideEffect ; BIDE_EFFECT + dw ThrashPetalDanceEffect ; THRASH_PETAL_DANCE_EFFECT + dw SwitchAndTeleportEffect ; SWITCH_AND_TELEPORT_EFFECT + dw TwoToFiveAttacksEffect ; TWO_TO_FIVE_ATTACKS_EFFECT + dw TwoToFiveAttacksEffect ; unused effect + dw FlinchSideEffect ; FLINCH_SIDE_EFFECT1 + dw SleepEffect ; SLEEP_EFFECT + dw PoisonEffect ; POISON_SIDE_EFFECT2 + dw FreezeBurnParalyzeEffect ; BURN_SIDE_EFFECT2 + dw FreezeBurnParalyzeEffect ; unused effect + dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT2 + dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2 + dw OneHitKOEffect ; OHKO_EFFECT + dw ChargeEffect ; CHARGE_EFFECT + dw $0000 ; SUPER_FANG_EFFECT + dw $0000 ; SPECIAL_DAMAGE_EFFECT + dw TrappingEffect ; TRAPPING_EFFECT + dw ChargeEffect ; FLY_EFFECT + dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT + dw $0000 ; JUMP_KICK_EFFECT + dw MistEffect ; MIST_EFFECT + dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT + dw RecoilEffect ; RECOIL_EFFECT + dw ConfusionEffect ; CONFUSION_EFFECT + dw StatModifierUpEffect ; ATTACK_UP2_EFFECT + dw StatModifierUpEffect ; DEFENSE_UP2_EFFECT + dw StatModifierUpEffect ; SPEED_UP2_EFFECT + dw StatModifierUpEffect ; SPECIAL_UP2_EFFECT + dw StatModifierUpEffect ; ACCURACY_UP2_EFFECT + dw StatModifierUpEffect ; EVASION_UP2_EFFECT + dw HealEffect ; HEAL_EFFECT + dw TransformEffect ; TRANSFORM_EFFECT + dw StatModifierDownEffect ; ATTACK_DOWN2_EFFECT + dw StatModifierDownEffect ; DEFENSE_DOWN2_EFFECT + dw StatModifierDownEffect ; SPEED_DOWN2_EFFECT + dw StatModifierDownEffect ; SPECIAL_DOWN2_EFFECT + dw StatModifierDownEffect ; ACCURACY_DOWN2_EFFECT + dw StatModifierDownEffect ; EVASION_DOWN2_EFFECT + dw ReflectLightScreenEffect ; LIGHT_SCREEN_EFFECT + dw ReflectLightScreenEffect ; REFLECT_EFFECT + dw PoisonEffect ; POISON_EFFECT + dw ParalyzeEffect ; PARALYZE_EFFECT + dw StatModifierDownEffect ; ATTACK_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; DEFENSE_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; SPEED_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; SPECIAL_DOWN_SIDE_EFFECT + dw StatModifierDownEffect ; unused effect + dw StatModifierDownEffect ; unused effect + dw StatModifierDownEffect ; unused effect + dw StatModifierDownEffect ; unused effect + dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT + dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT + dw $0000 ; unused effect + dw SubstituteEffect ; SUBSTITUTE_EFFECT + dw HyperBeamEffect ; HYPER_BEAM_EFFECT + dw RageEffect ; RAGE_EFFECT + dw MimicEffect ; MIMIC_EFFECT + dw $0000 ; METRONOME_EFFECT + dw LeechSeedEffect ; LEECH_SEED_EFFECT + dw SplashEffect ; SPLASH_EFFECT + dw DisableEffect ; DISABLE_EFFECT diff --git a/data/moves/grammar.asm b/data/moves/grammar.asm new file mode 100644 index 00000000..8113ab7c --- /dev/null +++ b/data/moves/grammar.asm @@ -0,0 +1,14 @@ +ExclamationPointMoveSets: + db SWORDS_DANCE, GROWTH + db $00 + db RECOVER, BIDE, SELFDESTRUCT, AMNESIA + db $00 + db MEDITATE, AGILITY, TELEPORT, MIMIC, DOUBLE_TEAM, BARRAGE + db $00 + db POUND, SCRATCH, VICEGRIP, WING_ATTACK, FLY, BIND, SLAM, HORN_ATTACK, BODY_SLAM + db WRAP, THRASH, TAIL_WHIP, LEER, BITE, GROWL, ROAR, SING, PECK, COUNTER + db STRENGTH, ABSORB, STRING_SHOT, EARTHQUAKE, FISSURE, DIG, TOXIC, SCREECH, HARDEN + db MINIMIZE, WITHDRAW, DEFENSE_CURL, METRONOME, LICK, CLAMP, CONSTRICT, POISON_GAS + db LEECH_LIFE, BUBBLE, FLASH, SPLASH, ACID_ARMOR, FURY_SWIPES, REST, SHARPEN, SLASH, SUBSTITUTE + db $00 + db $FF ; terminator diff --git a/data/moves/hm_moves.asm b/data/moves/hm_moves.asm new file mode 100644 index 00000000..d72eddfe --- /dev/null +++ b/data/moves/hm_moves.asm @@ -0,0 +1,7 @@ +HMMoveArray: + db CUT + db FLY + db SURF + db STRENGTH + db FLASH + db -1 diff --git a/data/moves/moves.asm b/data/moves/moves.asm new file mode 100755 index 00000000..44859681 --- /dev/null +++ b/data/moves/moves.asm @@ -0,0 +1,178 @@ +Moves: +; Characteristics of each move. + +move: macro + db \1 ; animation (interchangeable with move id) + db \2 ; effect + db \3 ; power + db \4 ; type + db \5 percent ; accuracy + db \6 ; pp +endm + + move POUND, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 +MoveEnd: + move KARATE_CHOP, NO_ADDITIONAL_EFFECT, 50, NORMAL, 100, 25 + move DOUBLESLAP, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 10 + move COMET_PUNCH, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 85, 15 + move MEGA_PUNCH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 85, 20 + move PAY_DAY, PAY_DAY_EFFECT, 40, NORMAL, 100, 20 + move FIRE_PUNCH, BURN_SIDE_EFFECT1, 75, FIRE, 100, 15 + move ICE_PUNCH, FREEZE_SIDE_EFFECT, 75, ICE, 100, 15 + move THUNDERPUNCH, PARALYZE_SIDE_EFFECT1, 75, ELECTRIC, 100, 15 + move SCRATCH, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 + move VICEGRIP, NO_ADDITIONAL_EFFECT, 55, NORMAL, 100, 30 + move GUILLOTINE, OHKO_EFFECT, 1, NORMAL, 30, 5 + move RAZOR_WIND, CHARGE_EFFECT, 80, NORMAL, 75, 10 + move SWORDS_DANCE, ATTACK_UP2_EFFECT, 0, NORMAL, 100, 30 + move CUT, NO_ADDITIONAL_EFFECT, 50, NORMAL, 95, 30 + move GUST, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 + move WING_ATTACK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35 + move WHIRLWIND, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 85, 20 + move FLY, FLY_EFFECT, 70, FLYING, 95, 15 + move BIND, TRAPPING_EFFECT, 15, NORMAL, 75, 20 + move SLAM, NO_ADDITIONAL_EFFECT, 80, NORMAL, 75, 20 + move VINE_WHIP, NO_ADDITIONAL_EFFECT, 35, GRASS, 100, 10 + move STOMP, FLINCH_SIDE_EFFECT2, 65, NORMAL, 100, 20 + move DOUBLE_KICK, ATTACK_TWICE_EFFECT, 30, FIGHTING, 100, 30 + move MEGA_KICK, NO_ADDITIONAL_EFFECT, 120, NORMAL, 75, 5 + move JUMP_KICK, JUMP_KICK_EFFECT, 70, FIGHTING, 95, 25 + move ROLLING_KICK, FLINCH_SIDE_EFFECT2, 60, FIGHTING, 85, 15 + move SAND_ATTACK, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 15 + move HEADBUTT, FLINCH_SIDE_EFFECT2, 70, NORMAL, 100, 15 + move HORN_ATTACK, NO_ADDITIONAL_EFFECT, 65, NORMAL, 100, 25 + move FURY_ATTACK, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20 + move HORN_DRILL, OHKO_EFFECT, 1, NORMAL, 30, 5 + move TACKLE, NO_ADDITIONAL_EFFECT, 35, NORMAL, 95, 35 + move BODY_SLAM, PARALYZE_SIDE_EFFECT2, 85, NORMAL, 100, 15 + move WRAP, TRAPPING_EFFECT, 15, NORMAL, 85, 20 + move TAKE_DOWN, RECOIL_EFFECT, 90, NORMAL, 85, 20 + move THRASH, THRASH_PETAL_DANCE_EFFECT, 90, NORMAL, 100, 20 + move DOUBLE_EDGE, RECOIL_EFFECT, 100, NORMAL, 100, 15 + move TAIL_WHIP, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30 + move POISON_STING, POISON_SIDE_EFFECT1, 15, POISON, 100, 35 + move TWINEEDLE, TWINEEDLE_EFFECT, 25, BUG, 100, 20 + move PIN_MISSILE, TWO_TO_FIVE_ATTACKS_EFFECT, 14, BUG, 85, 20 + move LEER, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30 + move BITE, FLINCH_SIDE_EFFECT1, 60, NORMAL, 100, 25 + move GROWL, ATTACK_DOWN1_EFFECT, 0, NORMAL, 100, 40 + move ROAR, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 100, 20 + move SING, SLEEP_EFFECT, 0, NORMAL, 55, 15 + move SUPERSONIC, CONFUSION_EFFECT, 0, NORMAL, 55, 20 + move SONICBOOM, SPECIAL_DAMAGE_EFFECT, 1, NORMAL, 90, 20 + move DISABLE, DISABLE_EFFECT, 0, NORMAL, 55, 20 + move ACID, DEFENSE_DOWN_SIDE_EFFECT, 40, POISON, 100, 30 + move EMBER, BURN_SIDE_EFFECT1, 40, FIRE, 100, 25 + move FLAMETHROWER, BURN_SIDE_EFFECT1, 95, FIRE, 100, 15 + move MIST, MIST_EFFECT, 0, ICE, 100, 30 + move WATER_GUN, NO_ADDITIONAL_EFFECT, 40, WATER, 100, 25 + move HYDRO_PUMP, NO_ADDITIONAL_EFFECT, 120, WATER, 80, 5 + move SURF, NO_ADDITIONAL_EFFECT, 95, WATER, 100, 15 + move ICE_BEAM, FREEZE_SIDE_EFFECT, 95, ICE, 100, 10 + move BLIZZARD, FREEZE_SIDE_EFFECT, 120, ICE, 90, 5 + move PSYBEAM, CONFUSION_SIDE_EFFECT, 65, PSYCHIC, 100, 20 + move BUBBLEBEAM, SPEED_DOWN_SIDE_EFFECT, 65, WATER, 100, 20 + move AURORA_BEAM, ATTACK_DOWN_SIDE_EFFECT, 65, ICE, 100, 20 + move HYPER_BEAM, HYPER_BEAM_EFFECT, 150, NORMAL, 90, 5 + move PECK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35 + move DRILL_PECK, NO_ADDITIONAL_EFFECT, 80, FLYING, 100, 20 + move SUBMISSION, RECOIL_EFFECT, 80, FIGHTING, 80, 25 + move LOW_KICK, FLINCH_SIDE_EFFECT2, 50, FIGHTING, 90, 20 + move COUNTER, NO_ADDITIONAL_EFFECT, 1, FIGHTING, 100, 20 + move SEISMIC_TOSS, SPECIAL_DAMAGE_EFFECT, 1, FIGHTING, 100, 20 + move STRENGTH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 15 + move ABSORB, DRAIN_HP_EFFECT, 20, GRASS, 100, 20 + move MEGA_DRAIN, DRAIN_HP_EFFECT, 40, GRASS, 100, 10 + move LEECH_SEED, LEECH_SEED_EFFECT, 0, GRASS, 90, 10 + move GROWTH, SPECIAL_UP1_EFFECT, 0, NORMAL, 100, 40 + move RAZOR_LEAF, NO_ADDITIONAL_EFFECT, 55, GRASS, 95, 25 + move SOLARBEAM, CHARGE_EFFECT, 120, GRASS, 100, 10 + move POISONPOWDER, POISON_EFFECT, 0, POISON, 75, 35 + move STUN_SPORE, PARALYZE_EFFECT, 0, GRASS, 75, 30 + move SLEEP_POWDER, SLEEP_EFFECT, 0, GRASS, 75, 15 + move PETAL_DANCE, THRASH_PETAL_DANCE_EFFECT, 70, GRASS, 100, 20 + move STRING_SHOT, SPEED_DOWN1_EFFECT, 0, BUG, 95, 40 + move DRAGON_RAGE, SPECIAL_DAMAGE_EFFECT, 1, DRAGON, 100, 10 + move FIRE_SPIN, TRAPPING_EFFECT, 15, FIRE, 70, 15 + move THUNDERSHOCK, PARALYZE_SIDE_EFFECT1, 40, ELECTRIC, 100, 30 + move THUNDERBOLT, PARALYZE_SIDE_EFFECT1, 95, ELECTRIC, 100, 15 + move THUNDER_WAVE, PARALYZE_EFFECT, 0, ELECTRIC, 100, 20 + move THUNDER, PARALYZE_SIDE_EFFECT1, 120, ELECTRIC, 70, 10 + move ROCK_THROW, NO_ADDITIONAL_EFFECT, 50, ROCK, 65, 15 + move EARTHQUAKE, NO_ADDITIONAL_EFFECT, 100, GROUND, 100, 10 + move FISSURE, OHKO_EFFECT, 1, GROUND, 30, 5 + move DIG, CHARGE_EFFECT, 100, GROUND, 100, 10 + move TOXIC, POISON_EFFECT, 0, POISON, 85, 10 + move CONFUSION, CONFUSION_SIDE_EFFECT, 50, PSYCHIC, 100, 25 + move PSYCHIC_M, SPECIAL_DOWN_SIDE_EFFECT, 90, PSYCHIC, 100, 10 + move HYPNOSIS, SLEEP_EFFECT, 0, PSYCHIC, 60, 20 + move MEDITATE, ATTACK_UP1_EFFECT, 0, PSYCHIC, 100, 40 + move AGILITY, SPEED_UP2_EFFECT, 0, PSYCHIC, 100, 30 + move QUICK_ATTACK, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 30 + move RAGE, RAGE_EFFECT, 20, NORMAL, 100, 20 + move TELEPORT, SWITCH_AND_TELEPORT_EFFECT, 0, PSYCHIC, 100, 20 + move NIGHT_SHADE, SPECIAL_DAMAGE_EFFECT, 0, GHOST, 100, 15 + move MIMIC, MIMIC_EFFECT, 0, NORMAL, 100, 10 + move SCREECH, DEFENSE_DOWN2_EFFECT, 0, NORMAL, 85, 40 + move DOUBLE_TEAM, EVASION_UP1_EFFECT, 0, NORMAL, 100, 15 + move RECOVER, HEAL_EFFECT, 0, NORMAL, 100, 20 + move HARDEN, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 30 + move MINIMIZE, EVASION_UP1_EFFECT, 0, NORMAL, 100, 20 + move SMOKESCREEN, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 20 + move CONFUSE_RAY, CONFUSION_EFFECT, 0, GHOST, 100, 10 + move WITHDRAW, DEFENSE_UP1_EFFECT, 0, WATER, 100, 40 + move DEFENSE_CURL, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 40 + move BARRIER, DEFENSE_UP2_EFFECT, 0, PSYCHIC, 100, 30 + move LIGHT_SCREEN, LIGHT_SCREEN_EFFECT, 0, PSYCHIC, 100, 30 + move HAZE, HAZE_EFFECT, 0, ICE, 100, 30 + move REFLECT, REFLECT_EFFECT, 0, PSYCHIC, 100, 20 + move FOCUS_ENERGY, FOCUS_ENERGY_EFFECT, 0, NORMAL, 100, 30 + move BIDE, BIDE_EFFECT, 0, NORMAL, 100, 10 + move METRONOME, METRONOME_EFFECT, 0, NORMAL, 100, 10 + move MIRROR_MOVE, MIRROR_MOVE_EFFECT, 0, FLYING, 100, 20 + move SELFDESTRUCT, EXPLODE_EFFECT, 130, NORMAL, 100, 5 + move EGG_BOMB, NO_ADDITIONAL_EFFECT, 100, NORMAL, 75, 10 + move LICK, PARALYZE_SIDE_EFFECT2, 20, GHOST, 100, 30 + move SMOG, POISON_SIDE_EFFECT2, 20, POISON, 70, 20 + move SLUDGE, POISON_SIDE_EFFECT2, 65, POISON, 100, 20 + move BONE_CLUB, FLINCH_SIDE_EFFECT1, 65, GROUND, 85, 20 + move FIRE_BLAST, BURN_SIDE_EFFECT2, 120, FIRE, 85, 5 + move WATERFALL, NO_ADDITIONAL_EFFECT, 80, WATER, 100, 15 + move CLAMP, TRAPPING_EFFECT, 35, WATER, 75, 10 + move SWIFT, SWIFT_EFFECT, 60, NORMAL, 100, 20 + move SKULL_BASH, CHARGE_EFFECT, 100, NORMAL, 100, 15 + move SPIKE_CANNON, TWO_TO_FIVE_ATTACKS_EFFECT, 20, NORMAL, 100, 15 + move CONSTRICT, SPEED_DOWN_SIDE_EFFECT, 10, NORMAL, 100, 35 + move AMNESIA, SPECIAL_UP2_EFFECT, 0, PSYCHIC, 100, 20 + move KINESIS, ACCURACY_DOWN1_EFFECT, 0, PSYCHIC, 80, 15 + move SOFTBOILED, HEAL_EFFECT, 0, NORMAL, 100, 10 + move HI_JUMP_KICK, JUMP_KICK_EFFECT, 85, FIGHTING, 90, 20 + move GLARE, PARALYZE_EFFECT, 0, NORMAL, 75, 30 + move DREAM_EATER, DREAM_EATER_EFFECT, 100, PSYCHIC, 100, 15 + move POISON_GAS, POISON_EFFECT, 0, POISON, 55, 40 + move BARRAGE, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20 + move LEECH_LIFE, DRAIN_HP_EFFECT, 20, BUG, 100, 15 + move LOVELY_KISS, SLEEP_EFFECT, 0, NORMAL, 75, 10 + move SKY_ATTACK, CHARGE_EFFECT, 140, FLYING, 90, 5 + move TRANSFORM, TRANSFORM_EFFECT, 0, NORMAL, 100, 10 + move BUBBLE, SPEED_DOWN_SIDE_EFFECT, 20, WATER, 100, 30 + move DIZZY_PUNCH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 10 + move SPORE, SLEEP_EFFECT, 0, GRASS, 100, 15 + move FLASH, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 70, 20 + move PSYWAVE, SPECIAL_DAMAGE_EFFECT, 1, PSYCHIC, 80, 15 + move SPLASH, SPLASH_EFFECT, 0, NORMAL, 100, 40 + move ACID_ARMOR, DEFENSE_UP2_EFFECT, 0, POISON, 100, 40 + move CRABHAMMER, NO_ADDITIONAL_EFFECT, 90, WATER, 85, 10 + move EXPLOSION, EXPLODE_EFFECT, 170, NORMAL, 100, 5 + move FURY_SWIPES, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 80, 15 + move BONEMERANG, ATTACK_TWICE_EFFECT, 50, GROUND, 90, 10 + move REST, HEAL_EFFECT, 0, PSYCHIC, 100, 10 + move ROCK_SLIDE, NO_ADDITIONAL_EFFECT, 75, ROCK, 90, 10 + move HYPER_FANG, FLINCH_SIDE_EFFECT1, 80, NORMAL, 90, 15 + move SHARPEN, ATTACK_UP1_EFFECT, 0, NORMAL, 100, 30 + move CONVERSION, CONVERSION_EFFECT, 0, NORMAL, 100, 30 + move TRI_ATTACK, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 10 + move SUPER_FANG, SUPER_FANG_EFFECT, 1, NORMAL, 90, 10 + move SLASH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 20 + move SUBSTITUTE, SUBSTITUTE_EFFECT, 0, NORMAL, 100, 10 + move STRUGGLE, RECOIL_EFFECT, 50, NORMAL, 100, 10 diff --git a/data/moves/names.asm b/data/moves/names.asm new file mode 100644 index 00000000..f8706ee3 --- /dev/null +++ b/data/moves/names.asm @@ -0,0 +1,167 @@ +MoveNames:: + db "POUND@" + db "KARATE CHOP@" + db "DOUBLESLAP@" + db "COMET PUNCH@" + db "MEGA PUNCH@" + db "PAY DAY@" + db "FIRE PUNCH@" + db "ICE PUNCH@" + db "THUNDERPUNCH@" + db "SCRATCH@" + db "VICEGRIP@" + db "GUILLOTINE@" + db "RAZOR WIND@" + db "SWORDS DANCE@" + db "CUT@" + db "GUST@" + db "WING ATTACK@" + db "WHIRLWIND@" + db "FLY@" + db "BIND@" + db "SLAM@" + db "VINE WHIP@" + db "STOMP@" + db "DOUBLE KICK@" + db "MEGA KICK@" + db "JUMP KICK@" + db "ROLLING KICK@" + db "SAND-ATTACK@" + db "HEADBUTT@" + db "HORN ATTACK@" + db "FURY ATTACK@" + db "HORN DRILL@" + db "TACKLE@" + db "BODY SLAM@" + db "WRAP@" + db "TAKE DOWN@" + db "THRASH@" + db "DOUBLE-EDGE@" + db "TAIL WHIP@" + db "POISON STING@" + db "TWINEEDLE@" + db "PIN MISSILE@" + db "LEER@" + db "BITE@" + db "GROWL@" + db "ROAR@" + db "SING@" + db "SUPERSONIC@" + db "SONICBOOM@" + db "DISABLE@" + db "ACID@" + db "EMBER@" + db "FLAMETHROWER@" + db "MIST@" + db "WATER GUN@" + db "HYDRO PUMP@" + db "SURF@" + db "ICE BEAM@" + db "BLIZZARD@" + db "PSYBEAM@" + db "BUBBLEBEAM@" + db "AURORA BEAM@" + db "HYPER BEAM@" + db "PECK@" + db "DRILL PECK@" + db "SUBMISSION@" + db "LOW KICK@" + db "COUNTER@" + db "SEISMIC TOSS@" + db "STRENGTH@" + db "ABSORB@" + db "MEGA DRAIN@" + db "LEECH SEED@" + db "GROWTH@" + db "RAZOR LEAF@" + db "SOLARBEAM@" + db "POISONPOWDER@" + db "STUN SPORE@" + db "SLEEP POWDER@" + db "PETAL DANCE@" + db "STRING SHOT@" + db "DRAGON RAGE@" + db "FIRE SPIN@" + db "THUNDERSHOCK@" + db "THUNDERBOLT@" + db "THUNDER WAVE@" + db "THUNDER@" + db "ROCK THROW@" + db "EARTHQUAKE@" + db "FISSURE@" + db "DIG@" + db "TOXIC@" + db "CONFUSION@" + db "PSYCHIC@" + db "HYPNOSIS@" + db "MEDITATE@" + db "AGILITY@" + db "QUICK ATTACK@" + db "RAGE@" + db "TELEPORT@" + db "NIGHT SHADE@" + db "MIMIC@" + db "SCREECH@" + db "DOUBLE TEAM@" + db "RECOVER@" + db "HARDEN@" + db "MINIMIZE@" + db "SMOKESCREEN@" + db "CONFUSE RAY@" + db "WITHDRAW@" + db "DEFENSE CURL@" + db "BARRIER@" + db "LIGHT SCREEN@" + db "HAZE@" + db "REFLECT@" + db "FOCUS ENERGY@" + db "BIDE@" + db "METRONOME@" + db "MIRROR MOVE@" + db "SELFDESTRUCT@" + db "EGG BOMB@" + db "LICK@" + db "SMOG@" + db "SLUDGE@" + db "BONE CLUB@" + db "FIRE BLAST@" + db "WATERFALL@" + db "CLAMP@" + db "SWIFT@" + db "SKULL BASH@" + db "SPIKE CANNON@" + db "CONSTRICT@" + db "AMNESIA@" + db "KINESIS@" + db "SOFTBOILED@" + db "HI JUMP KICK@" + db "GLARE@" + db "DREAM EATER@" + db "POISON GAS@" + db "BARRAGE@" + db "LEECH LIFE@" + db "LOVELY KISS@" + db "SKY ATTACK@" + db "TRANSFORM@" + db "BUBBLE@" + db "DIZZY PUNCH@" + db "SPORE@" + db "FLASH@" + db "PSYWAVE@" + db "SPLASH@" + db "ACID ARMOR@" + db "CRABHAMMER@" + db "EXPLOSION@" + db "FURY SWIPES@" + db "BONEMERANG@" + db "REST@" + db "ROCK SLIDE@" + db "HYPER FANG@" + db "SHARPEN@" + db "CONVERSION@" + db "TRI ATTACK@" + db "SUPER FANG@" + db "SLASH@" + db "SUBSTITUTE@" + db "STRUGGLE@" + diff --git a/data/moves/sfx.asm b/data/moves/sfx.asm new file mode 100644 index 00000000..28ad0b63 --- /dev/null +++ b/data/moves/sfx.asm @@ -0,0 +1,168 @@ +MoveSoundTable: + ; ID, pitch mod, tempo mod + db SFX_POUND, $00,$80 ; POUND + db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP + db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP + db SFX_BATTLE_0B, $01,$80 ; COMET_PUNCH + db SFX_BATTLE_0D, $00,$40 ; MEGA_PUNCH + db SFX_SILPH_SCOPE, $00,$ff ; PAY_DAY + db SFX_BATTLE_0D, $10,$60 ; FIRE_PUNCH + db SFX_BATTLE_0D, $20,$80 ; ICE_PUNCH + db SFX_BATTLE_0D, $00,$a0 ; THUNDERPUNCH + db SFX_DAMAGE, $00,$80 ; SCRATCH + db SFX_BATTLE_0F, $20,$40 ; VICEGRIP + db SFX_BATTLE_0F, $00,$80 ; GUILLOTINE + db SFX_BATTLE_0E, $00,$a0 ; RAZOR_WIND + db SFX_NOT_VERY_EFFECTIVE,$10,$c0 ; SWORDS_DANCE + db SFX_NOT_VERY_EFFECTIVE,$00,$a0 ; CUT + db SFX_BATTLE_12, $00,$c0 ; GUST + db SFX_BATTLE_12, $10,$a0 ; WING_ATTACK + db SFX_BATTLE_13, $00,$e0 ; WHIRLWIND + db SFX_NOT_VERY_EFFECTIVE,$20,$c0 ; FLY + db SFX_BATTLE_14, $00,$80 ; BIND + db SFX_BATTLE_22, $00,$80 ; SLAM + db SFX_VINE_WHIP, $01,$80 ; VINE_WHIP + db SFX_BATTLE_20, $00,$80 ; STOMP + db SFX_BATTLE_17, $f0,$40 ; DOUBLE_KICK + db SFX_SUPER_EFFECTIVE, $00,$80 ; MEGA_KICK + db SFX_BATTLE_17, $00,$80 ; JUMP_KICK + db SFX_BATTLE_21, $10,$80 ; ROLLING_KICK + db SFX_BATTLE_1B, $01,$a0 ; SAND_ATTACK + db SFX_BATTLE_18, $00,$80 ; HEADBUTT + db SFX_BATTLE_1E, $00,$60 ; HORN_ATTACK + db SFX_BATTLE_1E, $01,$40 ; FURY_ATTACK + db SFX_HORN_DRILL, $00,$a0 ; HORN_DRILL + db SFX_SUPER_EFFECTIVE, $10,$a0 ; TACKLE + db SFX_BATTLE_20, $00,$c0 ; BODY_SLAM + db SFX_BATTLE_14, $10,$60 ; WRAP + db SFX_SUPER_EFFECTIVE, $00,$a0 ; TAKE_DOWN + db SFX_BATTLE_22, $11,$c0 ; THRASH + db SFX_SUPER_EFFECTIVE, $20,$c0 ; DOUBLE_EDGE + db SFX_BATTLE_21, $00,$80 ; TAIL_WHIP + db SFX_BATTLE_1B, $00,$80 ; POISON_STING + db SFX_BATTLE_1B, $20,$c0 ; TWINEEDLE + db SFX_BATTLE_19, $00,$80 ; PIN_MISSILE + db SFX_BATTLE_31, $ff,$40 ; LEER + db SFX_BATTLE_1E, $00,$80 ; BITE + db SFX_BATTLE_0B, $00,$c0 ; GROWL + db SFX_BATTLE_0B, $00,$40 ; ROAR + db SFX_BATTLE_35, $00,$80 ; SING + db SFX_BATTLE_27, $40,$60 ; SUPERSONIC + db SFX_BATTLE_27, $00,$80 ; SONICBOOM + db SFX_BATTLE_27, $ff,$40 ; DISABLE + db SFX_BATTLE_2A, $80,$c0 ; ACID + db SFX_BATTLE_19, $10,$a0 ; EMBER + db SFX_BATTLE_19, $21,$e0 ; FLAMETHROWER + db SFX_BATTLE_29, $00,$80 ; MIST + db SFX_BATTLE_24, $20,$60 ; WATER_GUN + db SFX_BATTLE_2A, $00,$80 ; HYDRO_PUMP + db SFX_BATTLE_2C, $00,$80 ; SURF + db SFX_BATTLE_28, $40,$80 ; ICE_BEAM + db SFX_BATTLE_29, $f0,$e0 ; BLIZZARD + db SFX_PSYBEAM, $00,$80 ; PSYBEAM + db SFX_BATTLE_2A, $f0,$60 ; BUBBLEBEAM + db SFX_BATTLE_28, $00,$80 ; AURORA_BEAM + db SFX_BATTLE_36, $00,$80 ; HYPER_BEAM + db SFX_PECK, $01,$a0 ; PECK + db SFX_BATTLE_13, $f0,$20 ; DRILL_PECK + db SFX_BATTLE_23, $01,$c0 ; SUBMISSION + db SFX_BATTLE_23, $00,$80 ; LOW_KICK + db SFX_SUPER_EFFECTIVE, $00,$e0 ; COUNTER + db SFX_BATTLE_26, $01,$60 ; SEISMIC_TOSS + db SFX_BATTLE_26, $20,$40 ; STRENGTH + db SFX_BATTLE_24, $00,$80 ; ABSORB + db SFX_BATTLE_24, $40,$c0 ; MEGA_DRAIN + db SFX_BATTLE_1B, $03,$60 ; LEECH_SEED + db SFX_BATTLE_25, $11,$e0 ; GROWTH + db SFX_BATTLE_12, $20,$e0 ; RAZOR_LEAF + db SFX_BATTLE_2E, $00,$80 ; SOLARBEAM + db SFX_BATTLE_1C, $00,$80 ; POISONPOWDER + db SFX_BATTLE_1C, $11,$a0 ; STUN_SPORE + db SFX_BATTLE_1C, $01,$c0 ; SLEEP_POWDER + db SFX_BATTLE_13, $14,$c0 ; PETAL_DANCE + db SFX_BATTLE_1B, $02,$a0 ; STRING_SHOT + db SFX_BATTLE_29, $f0,$80 ; DRAGON_RAGE + db SFX_BATTLE_29, $20,$c0 ; FIRE_SPIN + db SFX_BATTLE_2F, $00,$20 ; THUNDERSHOCK + db SFX_BATTLE_2F, $20,$80 ; THUNDERBOLT + db SFX_BATTLE_2E, $12,$60 ; THUNDER_WAVE + db SFX_BATTLE_26, $00,$80 ; THUNDER + db SFX_BATTLE_14, $01,$e0 ; ROCK_THROW + db SFX_BATTLE_29, $0f,$e0 ; EARTHQUAKE + db SFX_BATTLE_29, $11,$20 ; FISSURE + db SFX_DAMAGE, $10,$40 ; DIG + db SFX_BATTLE_0F, $10,$c0 ; TOXIC + db SFX_BATTLE_14, $00,$20 ; CONFUSION + db SFX_PSYCHIC_M, $00,$80 ; PSYCHIC_M + db SFX_BATTLE_35, $11,$18 ; HYPNOSIS + db SFX_BATTLE_09, $20,$c0 ; MEDITATE + db SFX_FAINT_FALL, $20,$c0 ; AGILITY + db SFX_BATTLE_25, $00,$10 ; QUICK_ATTACK + db SFX_BATTLE_26, $f0,$20 ; RAGE + db SFX_BATTLE_33, $f0,$c0 ; TELEPORT + db SFX_NOT_VERY_EFFECTIVE,$f0,$e0 ; NIGHT_SHADE + db SFX_BATTLE_09, $f0,$40 ; MIMIC + db SFX_BATTLE_31, $00,$80 ; SCREECH + db SFX_BATTLE_33, $80,$40 ; DOUBLE_TEAM + db SFX_BATTLE_33, $00,$80 ; RECOVER + db SFX_BATTLE_14, $11,$20 ; HARDEN + db SFX_BATTLE_14, $22,$10 ; MINIMIZE + db SFX_BATTLE_1B, $f1,$ff ; SMOKESCREEN + db SFX_BATTLE_13, $f1,$ff ; CONFUSE_RAY + db SFX_BATTLE_14, $33,$30 ; WITHDRAW + db SFX_BATTLE_32, $40,$c0 ; DEFENSE_CURL + db SFX_BATTLE_0E, $20,$20 ; BARRIER + db SFX_BATTLE_0E, $f0,$10 ; LIGHT_SCREEN + db SFX_BATTLE_0F, $f8,$10 ; HAZE + db SFX_NOT_VERY_EFFECTIVE,$f0,$10 ; REFLECT + db SFX_BATTLE_25, $00,$80 ; FOCUS_ENERGY + db SFX_BATTLE_18, $00,$c0 ; BIDE + db SFX_BATTLE_32, $c0,$ff ; METRONOME + db SFX_BATTLE_09, $f2,$20 ; MIRROR_MOVE + db SFX_BATTLE_34, $00,$80 ; SELFDESTRUCT + db SFX_BATTLE_34, $00,$40 ; EGG_BOMB + db SFX_BATTLE_09, $00,$40 ; LICK + db SFX_NOT_VERY_EFFECTIVE,$10,$ff ; SMOG + db SFX_BATTLE_2A, $20,$20 ; SLUDGE + db SFX_BATTLE_32, $00,$80 ; BONE_CLUB + db SFX_BATTLE_29, $1f,$20 ; FIRE_BLAST + db SFX_BATTLE_25, $2f,$80 ; WATERFALL + db SFX_BATTLE_0F, $1f,$ff ; CLAMP + db SFX_BATTLE_2B, $1f,$60 ; SWIFT + db SFX_BATTLE_26, $1e,$20 ; SKULL_BASH + db SFX_BATTLE_26, $1f,$18 ; SPIKE_CANNON + db SFX_BATTLE_14, $0f,$80 ; CONSTRICT + db SFX_BATTLE_09, $f8,$10 ; AMNESIA + db SFX_FAINT_FALL, $18,$20 ; KINESIS + db SFX_BATTLE_32, $08,$40 ; SOFTBOILED + db SFX_BATTLE_17, $01,$e0 ; HI_JUMP_KICK + db SFX_NOT_VERY_EFFECTIVE,$09,$ff ; GLARE + db SFX_BATTLE_35, $42,$01 ; DREAM_EATER + db SFX_BATTLE_1C, $00,$ff ; POISON_GAS + db SFX_BATTLE_32, $08,$e0 ; BARRAGE + db SFX_BATTLE_24, $00,$80 ; LEECH_LIFE + db SFX_BATTLE_09, $88,$10 ; LOVELY_KISS + db SFX_BATTLE_25, $48,$ff ; SKY_ATTACK + db SFX_FAINT_FALL, $ff,$ff ; TRANSFORM + db SFX_BATTLE_24, $ff,$10 ; BUBBLE + db SFX_FAINT_FALL, $ff,$04 ; DIZZY_PUNCH + db SFX_BATTLE_1C, $01,$ff ; SPORE + db SFX_BATTLE_13, $f8,$ff ; FLASH + db SFX_BATTLE_0C, $f0,$f0 ; PSYWAVE + db SFX_BATTLE_0F, $08,$10 ; SPLASH + db SFX_BATTLE_0D, $f0,$ff ; ACID_ARMOR + db SFX_SUPER_EFFECTIVE, $f0,$ff ; CRABHAMMER + db SFX_BATTLE_34, $10,$ff ; EXPLOSION + db SFX_BATTLE_0E, $f0,$20 ; FURY_SWIPES + db SFX_BATTLE_2B, $f0,$60 ; BONEMERANG + db SFX_BATTLE_21, $12,$10 ; REST + db SFX_BATTLE_36, $f0,$20 ; ROCK_SLIDE + db SFX_BATTLE_1E, $12,$ff ; HYPER_FANG + db SFX_BATTLE_31, $80,$04 ; SHARPEN + db SFX_BATTLE_33, $f0,$10 ; CONVERSION + db SFX_BATTLE_29, $f8,$ff ; TRI_ATTACK + db SFX_BATTLE_26, $f0,$ff ; SUPER_FANG + db SFX_NOT_VERY_EFFECTIVE,$01,$ff ; SLASH + db SFX_BATTLE_2C, $d8,$04 ; SUBSTITUTE + db SFX_BATTLE_0B, $00,$80 ; STRUGGLE + db SFX_BATTLE_0B, $00,$80 diff --git a/data/moves/tmhm_moves.asm b/data/moves/tmhm_moves.asm new file mode 100755 index 00000000..23c1685e --- /dev/null +++ b/data/moves/tmhm_moves.asm @@ -0,0 +1,56 @@ +TechnicalMachines: + db MEGA_PUNCH + db RAZOR_WIND + db SWORDS_DANCE + db WHIRLWIND + db MEGA_KICK + db TOXIC + db HORN_DRILL + db BODY_SLAM + db TAKE_DOWN + db DOUBLE_EDGE + db BUBBLEBEAM + db WATER_GUN + db ICE_BEAM + db BLIZZARD + db HYPER_BEAM + db PAY_DAY + db SUBMISSION + db COUNTER + db SEISMIC_TOSS + db RAGE + db MEGA_DRAIN + db SOLARBEAM + db DRAGON_RAGE + db THUNDERBOLT + db THUNDER + db EARTHQUAKE + db FISSURE + db DIG + db PSYCHIC_M + db TELEPORT + db MIMIC + db DOUBLE_TEAM + db REFLECT + db BIDE + db METRONOME + db SELFDESTRUCT + db EGG_BOMB + db FIRE_BLAST + db SWIFT + db SKULL_BASH + db SOFTBOILED + db DREAM_EATER + db SKY_ATTACK + db REST + db THUNDER_WAVE + db PSYWAVE + db EXPLOSION + db ROCK_SLIDE + db TRI_ATTACK + db SUBSTITUTE + db CUT + db FLY + db SURF + db STRENGTH + db FLASH -- cgit v1.3.1-sl0p From 053afc46349952688c0ce2116cc76f8d4733895e Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 22:57:43 -0400 Subject: Move more code from home.asm to home/ --- data/moves/hm_moves.asm | 7 +- data/predef_pointers.asm | 6 + data/text_predef_pointers.asm | 71 + engine/pokemon/bills_pc.asm | 1 + home.asm | 3091 ++--------------------------------------- home/bankswitch.asm | 35 + home/list_menu.asm | 526 +++++++ home/move_mon.asm | 242 ++++ home/names.asm | 141 ++ home/names2.asm | 93 ++ home/overworld_text.asm | 31 + home/pokemon.asm | 464 +++++++ home/predef_text.asm | 237 ++++ home/print_bcd.asm | 77 + home/print_num.asm | 217 +++ home/trainers.asm | 436 ++++++ home/uncompress.asm | 196 +++ home/yes_no.asm | 40 + macros/predef.asm | 25 +- 19 files changed, 2959 insertions(+), 2977 deletions(-) create mode 100644 data/text_predef_pointers.asm create mode 100644 home/bankswitch.asm create mode 100644 home/list_menu.asm create mode 100644 home/move_mon.asm create mode 100644 home/names.asm create mode 100644 home/names2.asm create mode 100644 home/overworld_text.asm create mode 100644 home/pokemon.asm create mode 100644 home/predef_text.asm create mode 100644 home/print_bcd.asm create mode 100644 home/print_num.asm create mode 100644 home/trainers.asm create mode 100644 home/uncompress.asm create mode 100644 home/yes_no.asm (limited to 'data/moves') diff --git a/data/moves/hm_moves.asm b/data/moves/hm_moves.asm index d72eddfe..4f14b8df 100644 --- a/data/moves/hm_moves.asm +++ b/data/moves/hm_moves.asm @@ -1,7 +1,10 @@ -HMMoveArray: +; This file is INCLUDEd twice: +; - for HMMoves in home/names.asm +; - for HMMoveArray in engine/pokemon/bills_pc.asm + db CUT db FLY db SURF db STRENGTH db FLASH - db -1 + db -1 ; end diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index 5ce797e0..9d206a48 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -1,3 +1,9 @@ +add_predef: MACRO +\1Predef:: + db BANK(\1) + dw \1 +ENDM + PredefPointers:: ; these are pointers to ASM routines. ; they appear to be used in overworld map scripts. diff --git a/data/text_predef_pointers.asm b/data/text_predef_pointers.asm new file mode 100644 index 00000000..bbe9c8d8 --- /dev/null +++ b/data/text_predef_pointers.asm @@ -0,0 +1,71 @@ +add_tx_pre: MACRO +\1_id:: dw \1 +ENDM + +TextPredefs:: + add_tx_pre CardKeySuccessText ; 01 + add_tx_pre CardKeyFailText ; 02 + add_tx_pre RedBedroomPCText ; 03 + add_tx_pre RedBedroomSNESText ; 04 + add_tx_pre PushStartText ; 05 + add_tx_pre SaveOptionText ; 06 + add_tx_pre StrengthsAndWeaknessesText ; 07 + add_tx_pre OakLabEmailText ; 08 + add_tx_pre AerodactylFossilText ; 09 + add_tx_pre Route15UpstairsBinocularsText ; 0A + add_tx_pre KabutopsFossilText ; 0B + add_tx_pre GymStatueText1 ; 0C + add_tx_pre GymStatueText2 ; 0D + add_tx_pre BookcaseText ; 0E + add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F + add_tx_pre PewterCityPokecenterBenchGuyText ; 10 + add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 + add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 + add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 + add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 + add_tx_pre CeladonCityHotelText ; 15 + add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 + add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 + add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 + add_tx_pre MtMoonPokecenterBenchGuyText ; 19 + add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A + add_tx_pre UnusedBenchGuyText1 ; 1B XXX unused + add_tx_pre UnusedBenchGuyText2 ; 1C XXX unused + add_tx_pre UnusedBenchGuyText3 ; 1D XXX unused + add_tx_pre UnusedPredefText ; 1E XXX unused + add_tx_pre PokemonCenterPCText ; 1F + add_tx_pre ViridianSchoolNotebook ; 20 + add_tx_pre ViridianSchoolBlackboard ; 21 + add_tx_pre JustAMomentText ; 22 + add_tx_pre OpenBillsPCText ; 23 + add_tx_pre FoundHiddenItemText ; 24 + add_tx_pre HiddenItemBagFullText ; 25 XXX unused + add_tx_pre VermilionGymTrashText ; 26 + add_tx_pre IndigoPlateauHQText ; 27 + add_tx_pre GameCornerOutOfOrderText ; 28 + add_tx_pre GameCornerOutToLunchText ; 29 + add_tx_pre GameCornerSomeonesKeysText ; 2A + add_tx_pre FoundHiddenCoinsText ; 2B + add_tx_pre DroppedHiddenCoinsText ; 2C + add_tx_pre BillsHouseMonitorText ; 2D + add_tx_pre BillsHouseInitiatedText ; 2E + add_tx_pre BillsHousePokemonList ; 2F + add_tx_pre MagazinesText ; 30 + add_tx_pre CinnabarGymQuiz ; 31 + add_tx_pre GameCornerNoCoinsText ; 32 + add_tx_pre GameCornerCoinCaseText ; 33 + add_tx_pre LinkCableHelp ; 34 + add_tx_pre TMNotebook ; 35 + add_tx_pre FightingDojoText ; 36 + add_tx_pre EnemiesOnEverySideText ; 37 + add_tx_pre WhatGoesAroundComesAroundText ; 38 + add_tx_pre NewBicycleText ; 39 + add_tx_pre IndigoPlateauStatues ; 3A + add_tx_pre VermilionGymTrashSuccessText1 ; 3B + add_tx_pre VermilionGymTrashSuccessText2 ; 3C XXX unused + add_tx_pre VermilionGymTrashSuccessText3 ; 3D + add_tx_pre VermilionGymTrashFailText ; 3E + add_tx_pre TownMapText ; 3F + add_tx_pre BookOrSculptureText ; 40 + add_tx_pre ElevatorText ; 41 + add_tx_pre PokemonStuffText ; 42 diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 1a97caf0..d9a329f5 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -376,6 +376,7 @@ KnowsHMMove:: and a ret +HMMoveArray: INCLUDE "data/moves/hm_moves.asm" DisplayDepositWithdrawMenu: diff --git a/home.asm b/home.asm index 2c58d0e6..7f743312 100644 --- a/home.asm +++ b/home.asm @@ -72,1123 +72,113 @@ LoadDestinationWarpPosition:: ld [MBC1RomBank], a ret +INCLUDE "home/pokemon.asm" +INCLUDE "home/print_bcd.asm" +INCLUDE "home/uncompress.asm" +INCLUDE "data/tilesets/collision_tile_ids.asm" +INCLUDE "home/copy2.asm" +INCLUDE "home/text.asm" +INCLUDE "home/vcopy.asm" +INCLUDE "home/init.asm" +INCLUDE "home/vblank.asm" +INCLUDE "home/fade.asm" +INCLUDE "home/serial.asm" +INCLUDE "home/timer.asm" +INCLUDE "home/audio.asm" -DrawHPBar:: -; Draw an HP bar d tiles long, and fill it to e pixels. -; If c is nonzero, show at least a sliver regardless. -; The right end of the bar changes with [wHPBarType]. - - push hl - push de - push bc - - ; Left - ld a, $71 ; "HP:" - ld [hli], a - ld a, $62 - ld [hli], a - - push hl - - ; Middle - ld a, $63 ; empty -.draw - ld [hli], a - dec d - jr nz, .draw - - ; Right - ld a, [wHPBarType] +UpdateSprites:: + ld a, [wUpdateSpritesEnabled] dec a - ld a, $6d ; status screen and battle - jr z, .ok - dec a ; pokemon menu -.ok - ld [hl], a - - pop hl - - ld a, e - and a - jr nz, .fill - - ; If c is nonzero, draw a pixel anyway. - ld a, c - and a - jr z, .done - ld e, 1 - -.fill - ld a, e - sub 8 - jr c, .partial - ld e, a - ld a, $6b ; full - ld [hli], a - ld a, e - and a - jr z, .done - jr .fill - -.partial - ; Fill remaining pixels at the end if necessary. - ld a, $63 ; empty - add e - ld [hl], a -.done - pop bc - pop de - pop hl - ret - - -; loads pokemon data from one of multiple sources to wLoadedMon -; loads base stats to wMonHeader -; INPUT: -; [wWhichPokemon] = index of pokemon within party/box -; [wMonDataLocation] = source -; 00: player's party -; 01: enemy's party -; 02: current box -; 03: daycare -; OUTPUT: -; [wcf91] = pokemon ID -; wLoadedMon = base address of pokemon data -; wMonHeader = base address of base stats -LoadMonData:: - jpab LoadMonData_ - -OverwritewMoves:: -; Write c to [wMoves + b]. Unused. - ld hl, wMoves - ld e, b - ld d, 0 - add hl, de - ld a, c - ld [hl], a - ret - -LoadFlippedFrontSpriteByMonIndex:: - ld a, 1 - ld [wSpriteFlipped], a - -LoadFrontSpriteByMonIndex:: - push hl - ld a, [wd11e] - push af - ld a, [wcf91] - ld [wd11e], a - predef IndexToPokedex - ld hl, wd11e - ld a, [hl] - pop bc - ld [hl], b - and a - pop hl - jr z, .invalidDexNumber ; dex #0 invalid - cp NUM_POKEMON + 1 - jr c, .validDexNumber ; dex >#151 invalid -.invalidDexNumber - ld a, RHYDON ; $1 - ld [wcf91], a - ret -.validDexNumber - push hl - ld de, vFrontPic - call LoadMonFrontSprite - pop hl + ret nz ld a, [hLoadedROMBank] push af - ld a, BANK(CopyUncompressedPicToHL) + ld a, BANK(_UpdateSprites) ld [hLoadedROMBank], a ld [MBC1RomBank], a - xor a - ld [hStartTileID], a - call CopyUncompressedPicToHL - xor a - ld [wSpriteFlipped], a + call _UpdateSprites pop af ld [hLoadedROMBank], a ld [MBC1RomBank], a ret +INCLUDE "data/items/marts.asm" +INCLUDE "home/overworld_text.asm" +INCLUDE "home/pic.asm" -PlayCry:: -; Play monster a's cry. - call GetCryData - call PlaySound - jp WaitForSoundToFinish - -GetCryData:: -; Load cry data for monster a. - dec a - ld c, a - ld b, 0 - ld hl, CryData - add hl, bc - add hl, bc - add hl, bc - - ld a, BANK(CryData) - call BankswitchHome - ld a, [hli] - ld b, a ; cry id - ld a, [hli] - ld [wFrequencyModifier], a - ld a, [hl] - ld [wTempoModifier], a - call BankswitchBack - - ; Cry headers have 3 channels, - ; and start from index CRY_SFX_START, - ; so add 3 times the cry id. - ld a, b - ld c, CRY_SFX_START - rlca ; * 2 - add b - add c +ResetPlayerSpriteData:: + ld hl, wSpriteStateData1 + call ResetPlayerSpriteData_ClearSpriteData + ld hl, wSpriteStateData2 + call ResetPlayerSpriteData_ClearSpriteData + ld a, $1 + ld [wSpriteStateData1], a + ld [wSpriteStateData2 + $0e], a + ld hl, wSpriteStateData1 + 4 + ld [hl], $3c ; set Y screen pos + inc hl + inc hl + ld [hl], $40 ; set X screen pos ret -DisplayPartyMenu:: - ld a, [hTilesetType] - push af - xor a - ld [hTilesetType], a - call GBPalWhiteOutWithDelay3 - call ClearSprites - call PartyMenuInit - call DrawPartyMenu - jp HandlePartyMenuInput - -GoBackToPartyMenu:: - ld a, [hTilesetType] - push af +; overwrites sprite data with zeroes +ResetPlayerSpriteData_ClearSpriteData:: + ld bc, $10 xor a - ld [hTilesetType], a - call PartyMenuInit - call RedrawPartyMenu - jp HandlePartyMenuInput + jp FillMemory -PartyMenuInit:: - ld a, 1 ; hardcoded bank - call BankswitchHome - call LoadHpBarAndStatusTilePatterns - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay - xor a ; PLAYER_PARTY_DATA - ld [wMonDataLocation], a - ld [wMenuWatchMovingOutOfBounds], a - ld hl, wTopMenuItemY - inc a - ld [hli], a ; top menu item Y - xor a - ld [hli], a ; top menu item X - ld a, [wPartyAndBillsPCSavedMenuItem] - push af - ld [hli], a ; current menu item ID - inc hl - ld a, [wPartyCount] - and a ; are there more than 0 pokemon in the party? - jr z, .storeMaxMenuItemID - dec a -; if party is not empty, the max menu item ID is ([wPartyCount] - 1) -; otherwise, it is 0 -.storeMaxMenuItemID - ld [hli], a ; max menu item ID - ld a, [wForcePlayerToChooseMon] +FadeOutAudio:: + ld a, [wAudioFadeOutControl] + and a ; currently fading out audio? + jr nz, .fadingOut + ld a, [wd72c] + bit 1, a + ret nz + ld a, $77 + ld [rNR50], a + ret +.fadingOut + ld a, [wAudioFadeOutCounter] and a - ld a, A_BUTTON | B_BUTTON - jr z, .next - xor a - ld [wForcePlayerToChooseMon], a - inc a ; a = A_BUTTON -.next - ld [hli], a ; menu watched keys - pop af - ld [hl], a ; old menu item ID + jr z, .counterReachedZero + dec a + ld [wAudioFadeOutCounter], a ret - -HandlePartyMenuInput:: - ld a, 1 - ld [wMenuWrappingEnabled], a - ld a, $40 - ld [wPartyMenuAnimMonEnabled], a - call HandleMenuInput_ - call PlaceUnfilledArrowMenuCursor +.counterReachedZero + ld a, [wAudioFadeOutCounterReloadValue] + ld [wAudioFadeOutCounter], a + ld a, [rNR50] + and a ; has the volume reached 0? + jr z, .fadeOutComplete ld b, a - xor a - ld [wPartyMenuAnimMonEnabled], a - ld a, [wCurrentMenuItem] - ld [wPartyAndBillsPCSavedMenuItem], a - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay - ld a, [wMenuItemToSwap] - and a - jp nz, .swappingPokemon - pop af - ld [hTilesetType], a - bit 1, b - jr nz, .noPokemonChosen - ld a, [wPartyCount] - and a - jr z, .noPokemonChosen - ld a, [wCurrentMenuItem] - ld [wWhichPokemon], a - ld hl, wPartySpecies - ld b, 0 + and $f + dec a ld c, a - add hl, bc - ld a, [hl] - ld [wcf91], a - ld [wBattleMonSpecies2], a - call BankswitchBack - and a - ret -.noPokemonChosen - call BankswitchBack - scf + ld a, b + and $f0 + swap a + dec a + swap a + or c + ld [rNR50], a ret -.swappingPokemon - bit 1, b ; was the B button pressed? - jr z, .handleSwap ; if not, handle swapping the pokemon -.cancelSwap ; if the B button was pressed - callba ErasePartyMenuCursors - xor a - ld [wMenuItemToSwap], a - ld [wPartyMenuTypeOrMessageID], a - call RedrawPartyMenu - jr HandlePartyMenuInput -.handleSwap - ld a, [wCurrentMenuItem] - ld [wWhichPokemon], a - callba SwitchPartyMon - jr HandlePartyMenuInput - -DrawPartyMenu:: - ld hl, DrawPartyMenu_ - jr DrawPartyMenuCommon - -RedrawPartyMenu:: - ld hl, RedrawPartyMenu_ - -DrawPartyMenuCommon:: - ld b, BANK(RedrawPartyMenu_) - jp Bankswitch - -; prints a pokemon's status condition -; INPUT: -; de = address of status condition -; hl = destination address -PrintStatusCondition:: - push de - dec de - dec de ; de = address of current HP - ld a, [de] +.fadeOutComplete + ld a, [wAudioFadeOutControl] ld b, a - dec de - ld a, [de] - or b ; is the pokemon's HP zero? - pop de - jr nz, PrintStatusConditionNotFainted -; if the pokemon's HP is 0, print "FNT" - ld a, "F" - ld [hli], a - ld a, "N" - ld [hli], a - ld [hl], "T" - and a - ret - -PrintStatusConditionNotFainted:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(PrintStatusAilment) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call PrintStatusAilment ; print status condition - pop bc + xor a + ld [wAudioFadeOutControl], a + ld a, SFX_STOP_ALL_MUSIC + ld [wNewSoundID], a + call PlaySound + ld a, [wAudioSavedROMBank] + ld [wAudioROMBank], a ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; function to print pokemon level, leaving off the ":L" if the level is at least 100 -; INPUT: -; hl = destination address -; [wLoadedMonLevel] = level -PrintLevel:: - ld a, $6e ; ":L" tile ID - ld [hli], a - ld c, 2 ; number of digits - ld a, [wLoadedMonLevel] ; level - cp 100 - jr c, PrintLevelCommon -; if level at least 100, write over the ":L" tile - dec hl - inc c ; increment number of digits to 3 - jr PrintLevelCommon - -; prints the level without leaving off ":L" regardless of level -; INPUT: -; hl = destination address -; [wLoadedMonLevel] = level -PrintLevelFull:: - ld a, $6e ; ":L" tile ID - ld [hli], a - ld c, 3 ; number of digits - ld a, [wLoadedMonLevel] ; level - -PrintLevelCommon:: - ld [wd11e], a - ld de, wd11e - ld b, LEFT_ALIGN | 1 ; 1 byte - jp PrintNumber + ld [wNewSoundID], a + jp PlaySound -GetwMoves:: -; Unused. Returns the move at index a from wMoves in a - ld hl, wMoves - ld c, a - ld b, 0 - add hl, bc - ld a, [hl] - ret +INCLUDE "home/predef_text.asm" +INCLUDE "home/start_menu.asm" -; copies the base stat data of a pokemon to wMonHeader -; INPUT: -; [wd0b5] = pokemon ID -GetMonHeader:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(BaseStats) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - push bc - push de - push hl - ld a, [wd11e] - push af - ld a, [wd0b5] - ld [wd11e], a - ld de, FossilKabutopsPic - ld b, $66 ; size of Kabutops fossil and Ghost sprites - cp FOSSIL_KABUTOPS ; Kabutops fossil - jr z, .specialID - ld de, GhostPic - cp MON_GHOST ; Ghost - jr z, .specialID - ld de, FossilAerodactylPic - ld b, $77 ; size of Aerodactyl fossil sprite - cp FOSSIL_AERODACTYL ; Aerodactyl fossil - jr z, .specialID - cp MEW - jr z, .mew - predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number - ld a, [wd11e] - dec a - ld bc, MonBaseStatsEnd - MonBaseStats - ld hl, BaseStats - call AddNTimes - ld de, wMonHeader - ld bc, MonBaseStatsEnd - MonBaseStats - call CopyData - jr .done -.specialID - ld hl, wMonHSpriteDim - ld [hl], b ; write sprite dimensions - inc hl - ld [hl], e ; write front sprite pointer - inc hl - ld [hl], d - jr .done -.mew - ld hl, MewBaseStats - ld de, wMonHeader - ld bc, MonBaseStatsEnd - MonBaseStats - ld a, BANK(MewBaseStats) - call FarCopyData -.done - ld a, [wd0b5] - ld [wMonHIndex], a - pop af - ld [wd11e], a - pop hl - pop de - pop bc - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; copy party pokemon's name to wcd6d -GetPartyMonName2:: - ld a, [wWhichPokemon] ; index within party - ld hl, wPartyMonNicks - -; this is called more often -GetPartyMonName:: - push hl - push bc - call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times - ld de, wcd6d - push de - ld bc, NAME_LENGTH - call CopyData - pop de - pop bc - pop hl - ret - -; function to print a BCD (Binary-coded decimal) number -; de = address of BCD number -; hl = destination address -; c = flags and length -; bit 7: if set, do not print leading zeroes -; if unset, print leading zeroes -; bit 6: if set, left-align the string (do not pad empty digits with spaces) -; if unset, right-align the string -; bit 5: if set, print currency symbol at the beginning of the string -; if unset, do not print the currency symbol -; bits 0-4: length of BCD number in bytes -; Note that bits 5 and 7 are modified during execution. The above reflects -; their meaning at the beginning of the functions's execution. -PrintBCDNumber:: - ld b, c ; save flags in b - res 7, c - res 6, c - res 5, c ; c now holds the length - bit 5, b - jr z, .loop - bit 7, b - jr nz, .loop - ld [hl], "¥" - inc hl -.loop - ld a, [de] - swap a - call PrintBCDDigit ; print upper digit - ld a, [de] - call PrintBCDDigit ; print lower digit - inc de - dec c - jr nz, .loop - bit 7, b ; were any non-zero digits printed? - jr z, .done ; if so, we are done -.numberEqualsZero ; if every digit of the BCD number is zero - bit 6, b ; left or right alignment? - jr nz, .skipRightAlignmentAdjustment - dec hl ; if the string is right-aligned, it needs to be moved back one space -.skipRightAlignmentAdjustment - bit 5, b - jr z, .skipCurrencySymbol - ld [hl], "¥" - inc hl -.skipCurrencySymbol - ld [hl], "0" - call PrintLetterDelay - inc hl -.done - ret - -PrintBCDDigit:: - and $f - and a - jr z, .zeroDigit -.nonzeroDigit - bit 7, b ; have any non-space characters been printed? - jr z, .outputDigit -; if bit 7 is set, then no numbers have been printed yet - bit 5, b ; print the currency symbol? - jr z, .skipCurrencySymbol - ld [hl], "¥" - inc hl - res 5, b -.skipCurrencySymbol - res 7, b ; unset 7 to indicate that a nonzero digit has been reached -.outputDigit - add "0" - ld [hli], a - jp PrintLetterDelay -.zeroDigit - bit 7, b ; either printing leading zeroes or already reached a nonzero digit? - jr z, .outputDigit ; if so, print a zero digit - bit 6, b ; left or right alignment? - ret nz - inc hl ; if right-aligned, "print" a space by advancing the pointer - ret - -; uncompresses the front or back sprite of the specified mon -; assumes the corresponding mon header is already loaded -; hl contains offset to sprite pointer ($b for front or $d for back) -UncompressMonSprite:: - ld bc, wMonHeader - add hl, bc - ld a, [hli] - ld [wSpriteInputPtr], a ; fetch sprite input pointer - ld a, [hl] - ld [wSpriteInputPtr+1], a -; define (by index number) the bank that a pokemon's image is in -; index = Mew, bank 1 -; index = Kabutops fossil, bank $B -; index < $1F, bank 9 -; $1F ≤ index < $4A, bank $A -; $4A ≤ index < $74, bank $B -; $74 ≤ index < $99, bank $C -; $99 ≤ index, bank $D - ld a, [wcf91] ; XXX name for this ram location - ld b, a - cp MEW - ld a, BANK(MewPicFront) - jr z, .GotBank - ld a, b - cp FOSSIL_KABUTOPS - ld a, BANK(FossilKabutopsPic) - jr z, .GotBank - ld a, b - cp TANGELA + 1 - ld a, BANK(TangelaPicFront) - jr c, .GotBank - ld a, b - cp MOLTRES + 1 - ld a, BANK(MoltresPicFront) - jr c, .GotBank - ld a, b - cp BEEDRILL + 2 - ld a, BANK(BeedrillPicFront) - jr c, .GotBank - ld a, b - cp STARMIE + 1 - ld a, BANK(StarmiePicFront) - jr c, .GotBank - ld a, BANK(VictreebelPicFront) -.GotBank - jp UncompressSpriteData - -; de: destination location -LoadMonFrontSprite:: - push de - ld hl, wMonHFrontSprite - wMonHeader - call UncompressMonSprite - ld hl, wMonHSpriteDim - ld a, [hli] - ld c, a - pop de - ; fall through - -; postprocesses uncompressed sprite chunks to a 2bpp sprite and loads it into video ram -; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers -; de: destination location -; a,c: sprite dimensions (in tiles of 8x8 each) -LoadUncompressedSpriteData:: - push de - and $f - ld [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width - ld b, a - ld a, $7 - sub b ; 7-w - inc a ; 8-w - srl a ; (8-w)/2 ; horizontal center (in tiles, rounded up) - ld b, a - add a - add a - add a - sub b ; 7*((8-w)/2) ; skip for horizontal center (in tiles) - ld [hSpriteOffset], a - ld a, c - swap a - and $f - ld b, a - add a - add a - add a ; 8*tiles is height in bytes - ld [hSpriteHeight], a - ld a, $7 - sub b ; 7-h ; skip for vertical center (in tiles, relative to current column) - ld b, a - ld a, [hSpriteOffset] - add b ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles) - add a - add a - add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) - ld [hSpriteOffset], a - xor a - ld [$4000], a - ld hl, sSpriteBuffer0 - call ZeroSpriteBuffer ; zero buffer 0 - ld de, sSpriteBuffer1 - ld hl, sSpriteBuffer0 - call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite) - ld hl, sSpriteBuffer1 - call ZeroSpriteBuffer ; zero buffer 1 - ld de, sSpriteBuffer2 - ld hl, sSpriteBuffer1 - call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) - pop de - jp InterlaceMergeSpriteBuffers - -; copies and aligns the sprite data properly inside the sprite buffer -; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area -AlignSpriteDataCentered:: - ld a, [hSpriteOffset] - ld b, $0 - ld c, a - add hl, bc - ld a, [hSpriteWidth] -.columnLoop - push af - push hl - ld a, [hSpriteHeight] - ld c, a -.columnInnerLoop - ld a, [de] - inc de - ld [hli], a - dec c - jr nz, .columnInnerLoop - pop hl - ld bc, 7*8 ; 7 tiles - add hl, bc ; advance one full column - pop af - dec a - jr nz, .columnLoop - ret - -; fills the sprite buffer (pointed to in hl) with zeros -ZeroSpriteBuffer:: - ld bc, SPRITEBUFFERSIZE -.nextByteLoop - xor a - ld [hli], a - dec bc - ld a, b - or c - jr nz, .nextByteLoop - ret - -; combines the (7*7 tiles, 1bpp) sprite chunks in buffer 0 and 1 into a 2bpp sprite located in buffer 1 through 2 -; in the resulting sprite, the rows of the two source sprites are interlaced -; de: output address -InterlaceMergeSpriteBuffers:: - xor a - ld [$4000], a - push de - ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 - ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 - ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 - ld a, SPRITEBUFFERSIZE/2 ; $c4 - ld [hSpriteInterlaceCounter], a -.interlaceLoop - ld a, [de] - dec de - ld [hld], a ; write byte of source 2 - ld a, [bc] - dec bc - ld [hld], a ; write byte of source 1 - ld a, [de] - dec de - ld [hld], a ; write byte of source 2 - ld a, [bc] - dec bc - ld [hld], a ; write byte of source 1 - ld a, [hSpriteInterlaceCounter] - dec a - ld [hSpriteInterlaceCounter], a - jr nz, .interlaceLoop - ld a, [wSpriteFlipped] - and a - jr z, .notFlipped - ld bc, 2*SPRITEBUFFERSIZE - ld hl, sSpriteBuffer1 -.swapLoop - swap [hl] ; if flipped swap nybbles in all bytes - inc hl - dec bc - ld a, b - or c - jr nz, .swapLoop -.notFlipped - pop hl - ld de, sSpriteBuffer1 - ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied - ld a, [hLoadedROMBank] - ld b, a - jp CopyVideoData - - -INCLUDE "data/tilesets/collision_tile_ids.asm" -INCLUDE "home/copy2.asm" -INCLUDE "home/text.asm" -INCLUDE "home/vcopy.asm" -INCLUDE "home/init.asm" -INCLUDE "home/vblank.asm" -INCLUDE "home/fade.asm" -INCLUDE "home/serial.asm" -INCLUDE "home/timer.asm" -INCLUDE "home/audio.asm" - - -UpdateSprites:: - ld a, [wUpdateSpritesEnabled] - dec a - ret nz - ld a, [hLoadedROMBank] - push af - ld a, BANK(_UpdateSprites) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call _UpdateSprites - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -INCLUDE "data/items/marts.asm" - -TextScriptEndingChar:: - db "@" -TextScriptEnd:: - ld hl, TextScriptEndingChar - ret - -ExclamationText:: - TX_FAR _ExclamationText - db "@" - -GroundRoseText:: - TX_FAR _GroundRoseText - db "@" - -BoulderText:: - TX_FAR _BoulderText - db "@" - -MartSignText:: - TX_FAR _MartSignText - db "@" - -PokeCenterSignText:: - TX_FAR _PokeCenterSignText - db "@" - -PickUpItemText:: - TX_ASM - predef PickUpItem - jp TextScriptEnd - - -INCLUDE "home/pic.asm" - - -ResetPlayerSpriteData:: - ld hl, wSpriteStateData1 - call ResetPlayerSpriteData_ClearSpriteData - ld hl, wSpriteStateData2 - call ResetPlayerSpriteData_ClearSpriteData - ld a, $1 - ld [wSpriteStateData1], a - ld [wSpriteStateData2 + $0e], a - ld hl, wSpriteStateData1 + 4 - ld [hl], $3c ; set Y screen pos - inc hl - inc hl - ld [hl], $40 ; set X screen pos - ret - -; overwrites sprite data with zeroes -ResetPlayerSpriteData_ClearSpriteData:: - ld bc, $10 - xor a - jp FillMemory - -FadeOutAudio:: - ld a, [wAudioFadeOutControl] - and a ; currently fading out audio? - jr nz, .fadingOut - ld a, [wd72c] - bit 1, a - ret nz - ld a, $77 - ld [rNR50], a - ret -.fadingOut - ld a, [wAudioFadeOutCounter] - and a - jr z, .counterReachedZero - dec a - ld [wAudioFadeOutCounter], a - ret -.counterReachedZero - ld a, [wAudioFadeOutCounterReloadValue] - ld [wAudioFadeOutCounter], a - ld a, [rNR50] - and a ; has the volume reached 0? - jr z, .fadeOutComplete - ld b, a - and $f - dec a - ld c, a - ld a, b - and $f0 - swap a - dec a - swap a - or c - ld [rNR50], a - ret -.fadeOutComplete - ld a, [wAudioFadeOutControl] - ld b, a - xor a - ld [wAudioFadeOutControl], a - ld a, SFX_STOP_ALL_MUSIC - ld [wNewSoundID], a - call PlaySound - ld a, [wAudioSavedROMBank] - ld [wAudioROMBank], a - ld a, b - ld [wNewSoundID], a - jp PlaySound - -; this function is used to display sign messages, sprite dialog, etc. -; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID -DisplayTextID:: - ld a, [hLoadedROMBank] - push af - callba DisplayTextIDInit ; initialization - ld hl, wTextPredefFlag - bit 0, [hl] - res 0, [hl] - jr nz, .skipSwitchToMapBank - ld a, [wCurMap] - call SwitchToMapRomBank -.skipSwitchToMapBank - ld a, 30 ; half a second - ld [hFrameCounter], a ; used as joypad poll timer - ld hl, wMapTextPtr - ld a, [hli] - ld h, [hl] - ld l, a ; hl = map text pointer - ld d, $00 - ld a, [hSpriteIndexOrTextID] ; text ID - ld [wSpriteIndex], a - and a - jp z, DisplayStartMenu - cp TEXT_SAFARI_GAME_OVER - jp z, DisplaySafariGameOverText - cp TEXT_MON_FAINTED - jp z, DisplayPokemonFaintedText - cp TEXT_BLACKED_OUT - jp z, DisplayPlayerBlackedOutText - cp TEXT_REPEL_WORE_OFF - jp z, DisplayRepelWoreOffText - ld a, [wNumSprites] - ld e, a - ld a, [hSpriteIndexOrTextID] ; sprite ID - cp e - jr z, .spriteHandling - jr nc, .skipSpriteHandling -.spriteHandling -; get the text ID of the sprite - push hl - push de - push bc - callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) - pop bc - pop de - ld hl, wMapSpriteData ; NPC text entries - ld a, [hSpriteIndexOrTextID] - dec a - add a - add l - ld l, a - jr nc, .noCarry - inc h -.noCarry - inc hl - ld a, [hl] ; a = text ID of the sprite - pop hl -.skipSpriteHandling -; look up the address of the text in the map's text entries - dec a - ld e, a - sla e - add hl, de - ld a, [hli] - ld h, [hl] - ld l, a ; hl = address of the text - ld a, [hl] ; a = first byte of text -; check first byte of text for special cases - cp $fe ; Pokemart NPC - jp z, DisplayPokemartDialogue - cp $ff ; Pokemon Center NPC - jp z, DisplayPokemonCenterDialogue - cp $fc ; Item Storage PC - jp z, FuncTX_ItemStoragePC - cp $fd ; Bill's PC - jp z, FuncTX_BillsPC - cp $f9 ; Pokemon Center PC - jp z, FuncTX_PokemonCenterPC - cp $f5 ; Vending Machine - jr nz, .notVendingMachine - callba VendingMachineMenu ; jump banks to vending machine routine - jr AfterDisplayingTextID -.notVendingMachine - cp $f7 ; prize menu - jp z, FuncTX_GameCornerPrizeMenu - cp $f6 ; cable connection NPC in Pokemon Center - jr nz, .notSpecialCase - callab CableClubNPC - jr AfterDisplayingTextID -.notSpecialCase - call PrintText_NoCreatingTextBox ; display the text - ld a, [wDoNotWaitForButtonPressAfterDisplayingText] - and a - jr nz, HoldTextDisplayOpen - -AfterDisplayingTextID:: - ld a, [wEnteringCableClub] - and a - jr nz, HoldTextDisplayOpen - call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text - -; loop to hold the dialogue box open as long as the player keeps holding down the A button -HoldTextDisplayOpen:: - call Joypad - ld a, [hJoyHeld] - bit 0, a ; is the A button being pressed? - jr nz, HoldTextDisplayOpen - -CloseTextDisplay:: - ld a, [wCurMap] - call SwitchToMapRomBank - ld a, $90 - ld [hWY], a ; move the window off the screen - call DelayFrame - call LoadGBPal - xor a - ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank -; loop to make sprites face the directions they originally faced before the dialogue - ld hl, wSpriteStateData2 + $19 - ld c, $0f - ld de, $0010 -.restoreSpriteFacingDirectionLoop - ld a, [hl] - dec h - ld [hl], a - inc h - add hl, de - dec c - jr nz, .restoreSpriteFacingDirectionLoop - ld a, BANK(InitMapSprites) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) - ld hl, wFontLoaded - res 0, [hl] - ld a, [wd732] - bit 3, a ; used fly warp - call z, LoadPlayerSpriteGraphics - call LoadCurrentMapView - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - jp UpdateSprites - -DisplayPokemartDialogue:: - push hl - ld hl, PokemartGreetingText - call PrintText - pop hl - inc hl - call LoadItemList - ld a, PRICEDITEMLISTMENU - ld [wListMenuID], a - ld a, [hLoadedROMBank] - push af - ld a, BANK(DisplayPokemartDialogue_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call DisplayPokemartDialogue_ - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - jp AfterDisplayingTextID - -PokemartGreetingText:: - TX_FAR _PokemartGreetingText - db "@" - -LoadItemList:: - ld a, 1 - ld [wUpdateSpritesEnabled], a - ld a, h - ld [wItemListPointer], a - ld a, l - ld [wItemListPointer + 1], a - ld de, wItemList -.loop - ld a, [hli] - ld [de], a - inc de - cp $ff - jr nz, .loop - ret - -DisplayPokemonCenterDialogue:: -; zeroing these doesn't appear to serve any purpose - xor a - ld [hItemPrice], a - ld [hItemPrice + 1], a - ld [hItemPrice + 2], a - - inc hl - ld a, [hLoadedROMBank] - push af - ld a, BANK(DisplayPokemonCenterDialogue_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call DisplayPokemonCenterDialogue_ - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - jp AfterDisplayingTextID - -DisplaySafariGameOverText:: - callab PrintSafariGameOverText - jp AfterDisplayingTextID - -DisplayPokemonFaintedText:: - ld hl, PokemonFaintedText - call PrintText - jp AfterDisplayingTextID - -PokemonFaintedText:: - TX_FAR _PokemonFaintedText - db "@" - -DisplayPlayerBlackedOutText:: - ld hl, PlayerBlackedOutText - call PrintText - ld a, [wd732] - res 5, a ; reset forced to use bike bit - ld [wd732], a - jp HoldTextDisplayOpen - -PlayerBlackedOutText:: - TX_FAR _PlayerBlackedOutText - db "@" - -DisplayRepelWoreOffText:: - ld hl, RepelWoreOffText - call PrintText - jp AfterDisplayingTextID - -RepelWoreOffText:: - TX_FAR _RepelWoreOffText - db "@" - -INCLUDE "home/start_menu.asm" - -; function to count how many bits are set in a string of bytes +; function to count how many bits are set in a string of bytes ; INPUT: ; hl = address of string of bytes ; b = length of string of bytes @@ -1204,740 +194,73 @@ CountSetBits:: srl e ld a, 0 adc c - ld c, a - dec d - jr nz, .innerLoop - dec b - jr nz, .loop - ld a, c - ld [wNumSetBits], a - ret - -; subtracts the amount the player paid from their money -; OUTPUT: carry = 0(success) or 1(fail because there is not enough money) -SubtractAmountPaidFromMoney:: - jpba SubtractAmountPaidFromMoney_ - -; adds the amount the player sold to their money -AddAmountSoldToMoney:: - ld de, wPlayerMoney + 2 - ld hl, hMoney + 2 ; total price of items - ld c, 3 ; length of money in bytes - predef AddBCDPredef ; add total price to money - ld a, MONEY_BOX - ld [wTextBoxID], a - call DisplayTextBoxID ; redraw money text box - ld a, SFX_PURCHASE - call PlaySoundWaitForCurrent - jp WaitForSoundToFinish - -; function to remove an item (in varying quantities) from the player's bag or PC box -; INPUT: -; HL = address of inventory (either wNumBagItems or wNumBoxItems) -; [wWhichPokemon] = index (within the inventory) of the item to remove -; [wItemQuantity] = quantity to remove -RemoveItemFromInventory:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(RemoveItemFromInventory_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call RemoveItemFromInventory_ - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; function to add an item (in varying quantities) to the player's bag or PC box -; INPUT: -; HL = address of inventory (either wNumBagItems or wNumBoxItems) -; [wcf91] = item ID -; [wItemQuantity] = item quantity -; sets carry flag if successful, unsets carry flag if unsuccessful -AddItemToInventory:: - push bc - ld a, [hLoadedROMBank] - push af - ld a, BANK(AddItemToInventory_) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call AddItemToInventory_ - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - pop bc - ret - -; INPUT: -; [wListMenuID] = list menu ID -; [wListPointer] = address of the list (2 bytes) -DisplayListMenuID:: - xor a - ld [hAutoBGTransferEnabled], a ; disable auto-transfer - ld a, 1 - ld [hJoy7], a ; joypad state update flag - ld a, [wBattleType] - and a ; is it the Old Man battle? - jr nz, .specialBattleType - ld a, $01 ; hardcoded bank - jr .bankswitch -.specialBattleType ; Old Man battle - ld a, BANK(DisplayBattleMenu) -.bankswitch - call BankswitchHome - ld hl, wd730 - set 6, [hl] ; turn off letter printing delay - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - ld [wListCount], a - ld a, [wListPointer] - ld l, a - ld a, [wListPointer + 1] - ld h, a ; hl = address of the list - ld a, [hl] ; the first byte is the number of entries in the list - ld [wListCount], a - ld a, LIST_MENU_BOX - ld [wTextBoxID], a - call DisplayTextBoxID ; draw the menu text box - call UpdateSprites ; disable sprites behind the text box -; the code up to .skipMovingSprites appears to be useless - coord hl, 4, 2 ; coordinates of upper left corner of menu text box - lb de, 9, 14 ; height and width of menu text box - ld a, [wListMenuID] - and a ; is it a PC pokemon list? - jr nz, .skipMovingSprites - call UpdateSprites -.skipMovingSprites - ld a, 1 ; max menu item ID is 1 if the list has less than 2 entries - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wListCount] - cp 2 ; does the list have less than 2 entries? - jr c, .setMenuVariables - ld a, 2 ; max menu item ID is 2 if the list has at least 2 entries -.setMenuVariables - ld [wMaxMenuItem], a - ld a, 4 - ld [wTopMenuItemY], a - ld a, 5 - ld [wTopMenuItemX], a - ld a, A_BUTTON | B_BUTTON | SELECT - ld [wMenuWatchedKeys], a - ld c, 10 - call DelayFrames - -DisplayListMenuIDLoop:: - xor a - ld [hAutoBGTransferEnabled], a ; disable transfer - call PrintListMenuEntries - ld a, 1 - ld [hAutoBGTransferEnabled], a ; enable transfer - call Delay3 - ld a, [wBattleType] - and a ; is it the Old Man battle? - jr z, .notOldManBattle -.oldManBattle - ld a, "▶" - Coorda 5, 4 ; place menu cursor in front of first menu entry - ld c, 80 - call DelayFrames - xor a - ld [wCurrentMenuItem], a - coord hl, 5, 4 - ld a, l - ld [wMenuCursorLocation], a - ld a, h - ld [wMenuCursorLocation + 1], a - jr .buttonAPressed -.notOldManBattle - call LoadGBPal - call HandleMenuInput - push af - call PlaceMenuCursor - pop af - bit 0, a ; was the A button pressed? - jp z, .checkOtherKeys -.buttonAPressed - ld a, [wCurrentMenuItem] - call PlaceUnfilledArrowMenuCursor - -; pointless because both values are overwritten before they are read - ld a, $01 - ld [wMenuExitMethod], a - ld [wChosenMenuItem], a - - xor a - ld [wMenuWatchMovingOutOfBounds], a - ld a, [wCurrentMenuItem] - ld c, a - ld a, [wListScrollOffset] - add c - ld c, a - ld a, [wListCount] - and a ; is the list empty? - jp z, ExitListMenu ; if so, exit the menu - dec a - cp c ; did the player select Cancel? - jp c, ExitListMenu ; if so, exit the menu - ld a, c - ld [wWhichPokemon], a - ld a, [wListMenuID] - cp ITEMLISTMENU - jr nz, .skipMultiplying -; if it's an item menu - sla c ; item entries are 2 bytes long, so multiply by 2 -.skipMultiplying - ld a, [wListPointer] - ld l, a - ld a, [wListPointer + 1] - ld h, a - inc hl ; hl = beginning of list entries - ld b, 0 - add hl, bc - ld a, [hl] - ld [wcf91], a - ld a, [wListMenuID] - and a ; is it a PC pokemon list? - jr z, .pokemonList - push hl - call GetItemPrice - pop hl - ld a, [wListMenuID] - cp ITEMLISTMENU - jr nz, .skipGettingQuantity -; if it's an item menu - inc hl - ld a, [hl] ; a = item quantity - ld [wMaxItemQuantity], a -.skipGettingQuantity - ld a, [wcf91] - ld [wd0b5], a - ld a, BANK(ItemNames) - ld [wPredefBank], a - call GetName - jr .storeChosenEntry -.pokemonList - ld hl, wPartyCount - ld a, [wListPointer] - cp l ; is it a list of party pokemon or box pokemon? - ld hl, wPartyMonNicks - jr z, .getPokemonName - ld hl, wBoxMonNicks ; box pokemon names -.getPokemonName - ld a, [wWhichPokemon] - call GetPartyMonName -.storeChosenEntry ; store the menu entry that the player chose and return - ld de, wcd6d - call CopyStringToCF4B ; copy name to wcf4b - ld a, CHOSE_MENU_ITEM - ld [wMenuExitMethod], a - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - xor a - ld [hJoy7], a ; joypad state update flag - ld hl, wd730 - res 6, [hl] ; turn on letter printing delay - jp BankswitchBack -.checkOtherKeys ; check B, SELECT, Up, and Down keys - bit 1, a ; was the B button pressed? - jp nz, ExitListMenu ; if so, exit the menu - bit 2, a ; was the select button pressed? - jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries - ld b, a - bit 7, b ; was Down pressed? - ld hl, wListScrollOffset - jr z, .upPressed -.downPressed - ld a, [hl] - add 3 - ld b, a - ld a, [wListCount] - cp b ; will going down scroll past the Cancel button? - jp c, DisplayListMenuIDLoop - inc [hl] ; if not, go down - jp DisplayListMenuIDLoop -.upPressed - ld a, [hl] - and a - jp z, DisplayListMenuIDLoop - dec [hl] - jp DisplayListMenuIDLoop - -DisplayChooseQuantityMenu:: -; text box dimensions/coordinates for just quantity - coord hl, 15, 9 - ld b, 1 ; height - ld c, 3 ; width - ld a, [wListMenuID] - cp PRICEDITEMLISTMENU - jr nz, .drawTextBox -; text box dimensions/coordinates for quantity and price - coord hl, 7, 9 - ld b, 1 ; height - ld c, 11 ; width -.drawTextBox - call TextBoxBorder - coord hl, 16, 10 - ld a, [wListMenuID] - cp PRICEDITEMLISTMENU - jr nz, .printInitialQuantity - coord hl, 8, 10 -.printInitialQuantity - ld de, InitialQuantityText - call PlaceString - xor a - ld [wItemQuantity], a ; initialize current quantity to 0 - jp .incrementQuantity -.waitForKeyPressLoop - call JoypadLowSensitivity - ld a, [hJoyPressed] ; newly pressed buttons - bit 0, a ; was the A button pressed? - jp nz, .buttonAPressed - bit 1, a ; was the B button pressed? - jp nz, .buttonBPressed - bit 6, a ; was Up pressed? - jr nz, .incrementQuantity - bit 7, a ; was Down pressed? - jr nz, .decrementQuantity - jr .waitForKeyPressLoop -.incrementQuantity - ld a, [wMaxItemQuantity] - inc a - ld b, a - ld hl, wItemQuantity ; current quantity - inc [hl] - ld a, [hl] - cp b - jr nz, .handleNewQuantity -; wrap to 1 if the player goes above the max quantity - ld a, 1 - ld [hl], a - jr .handleNewQuantity -.decrementQuantity - ld hl, wItemQuantity ; current quantity - dec [hl] - jr nz, .handleNewQuantity -; wrap to the max quantity if the player goes below 1 - ld a, [wMaxItemQuantity] - ld [hl], a -.handleNewQuantity - coord hl, 17, 10 - ld a, [wListMenuID] - cp PRICEDITEMLISTMENU - jr nz, .printQuantity -.printPrice - ld c, $03 - ld a, [wItemQuantity] - ld b, a - ld hl, hMoney ; total price -; initialize total price to 0 - xor a - ld [hli], a - ld [hli], a - ld [hl], a -.addLoop ; loop to multiply the individual price by the quantity to get the total price - ld de, hMoney + 2 - ld hl, hItemPrice + 2 - push bc - predef AddBCDPredef ; add the individual price to the current sum - pop bc - dec b - jr nz, .addLoop - ld a, [hHalveItemPrices] - and a ; should the price be halved (for selling items)? - jr z, .skipHalvingPrice - xor a - ld [hDivideBCDDivisor], a - ld [hDivideBCDDivisor + 1], a - ld a, $02 - ld [hDivideBCDDivisor + 2], a - predef DivideBCDPredef3 ; halves the price -; store the halved price - ld a, [hDivideBCDQuotient] - ld [hMoney], a - ld a, [hDivideBCDQuotient + 1] - ld [hMoney + 1], a - ld a, [hDivideBCDQuotient + 2] - ld [hMoney + 2], a -.skipHalvingPrice - coord hl, 12, 10 - ld de, SpacesBetweenQuantityAndPriceText - call PlaceString - ld de, hMoney ; total price - ld c, $a3 - call PrintBCDNumber - coord hl, 9, 10 -.printQuantity - ld de, wItemQuantity ; current quantity - lb bc, LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits - call PrintNumber - jp .waitForKeyPressLoop -.buttonAPressed ; the player chose to make the transaction - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - ret -.buttonBPressed ; the player chose to cancel the transaction - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - ld a, $ff - ret - -InitialQuantityText:: - db "×01@" - -SpacesBetweenQuantityAndPriceText:: - db " @" - -ExitListMenu:: - ld a, [wCurrentMenuItem] - ld [wChosenMenuItem], a - ld a, CANCELLED_MENU - ld [wMenuExitMethod], a - ld [wMenuWatchMovingOutOfBounds], a - xor a - ld [hJoy7], a - ld hl, wd730 - res 6, [hl] - call BankswitchBack - xor a - ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped - scf - ret - -PrintListMenuEntries:: - coord hl, 5, 3 - ld b, 9 - ld c, 14 - call ClearScreenArea - ld a, [wListPointer] - ld e, a - ld a, [wListPointer + 1] - ld d, a - inc de ; de = beginning of list entries - ld a, [wListScrollOffset] - ld c, a - ld a, [wListMenuID] - cp ITEMLISTMENU - ld a, c - jr nz, .skipMultiplying -; if it's an item menu -; item entries are 2 bytes long, so multiply by 2 - sla a - sla c -.skipMultiplying - add e - ld e, a - jr nc, .noCarry - inc d -.noCarry - coord hl, 6, 4 ; coordinates of first list entry name - ld b, 4 ; print 4 names -.loop - ld a, b - ld [wWhichPokemon], a - ld a, [de] - ld [wd11e], a - cp $ff - jp z, .printCancelMenuItem - push bc - push de - push hl - push hl - push de - ld a, [wListMenuID] - and a - jr z, .pokemonPCMenu - cp MOVESLISTMENU - jr z, .movesMenu -.itemMenu - call GetItemName - jr .placeNameString -.pokemonPCMenu - push hl - ld hl, wPartyCount - ld a, [wListPointer] - cp l ; is it a list of party pokemon or box pokemon? - ld hl, wPartyMonNicks - jr z, .getPokemonName - ld hl, wBoxMonNicks ; box pokemon names -.getPokemonName - ld a, [wWhichPokemon] - ld b, a - ld a, 4 - sub b - ld b, a - ld a, [wListScrollOffset] - add b - call GetPartyMonName - pop hl - jr .placeNameString -.movesMenu - call GetMoveName -.placeNameString - call PlaceString - pop de - pop hl - ld a, [wPrintItemPrices] - and a ; should prices be printed? - jr z, .skipPrintingItemPrice -.printItemPrice - push hl - ld a, [de] - ld de, ItemPrices - ld [wcf91], a - call GetItemPrice ; get price - pop hl - ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right - add hl, bc - ld c, $a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes - call PrintBCDNumber -.skipPrintingItemPrice - ld a, [wListMenuID] - and a - jr nz, .skipPrintingPokemonLevel -.printPokemonLevel - ld a, [wd11e] - push af - push hl - ld hl, wPartyCount - ld a, [wListPointer] - cp l ; is it a list of party pokemon or box pokemon? - ld a, PLAYER_PARTY_DATA - jr z, .next - ld a, BOX_DATA -.next - ld [wMonDataLocation], a - ld hl, wWhichPokemon - ld a, [hl] - ld b, a - ld a, $04 - sub b - ld b, a - ld a, [wListScrollOffset] - add b - ld [hl], a - call LoadMonData - ld a, [wMonDataLocation] - and a ; is it a list of party pokemon or box pokemon? - jr z, .skipCopyingLevel -.copyLevel - ld a, [wLoadedMonBoxLevel] - ld [wLoadedMonLevel], a -.skipCopyingLevel - pop hl - ld bc, $001c - add hl, bc - call PrintLevel - pop af - ld [wd11e], a -.skipPrintingPokemonLevel - pop hl - pop de - inc de - ld a, [wListMenuID] - cp ITEMLISTMENU - jr nz, .nextListEntry -.printItemQuantity - ld a, [wd11e] - ld [wcf91], a - call IsKeyItem ; check if item is unsellable - ld a, [wIsKeyItem] - and a ; is the item unsellable? - jr nz, .skipPrintingItemQuantity ; if so, don't print the quantity - push hl - ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right - add hl, bc - ld a, "×" - ld [hli], a - ld a, [wd11e] - push af - ld a, [de] - ld [wMaxItemQuantity], a - push de - ld de, wd11e - ld [de], a - lb bc, 1, 2 - call PrintNumber - pop de - pop af - ld [wd11e], a - pop hl -.skipPrintingItemQuantity - inc de - pop bc - inc c - push bc - inc c - ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) - and a ; is an item being swapped? - jr z, .nextListEntry - sla a - cp c ; is it this item? - jr nz, .nextListEntry - dec hl - ld a, $ec ; unfilled right arrow menu cursor to indicate an item being swapped - ld [hli], a -.nextListEntry - ld bc, 2 * SCREEN_WIDTH ; 2 rows - add hl, bc - pop bc - inc c + ld c, a + dec d + jr nz, .innerLoop dec b - jp nz, .loop - ld bc, -8 - add hl, bc - ld a, "▼" - ld [hl], a + jr nz, .loop + ld a, c + ld [wNumSetBits], a ret -.printCancelMenuItem - ld de, ListMenuCancelText - jp PlaceString -ListMenuCancelText:: - db "CANCEL@" +; subtracts the amount the player paid from their money +; OUTPUT: carry = 0(success) or 1(fail because there is not enough money) +SubtractAmountPaidFromMoney:: + jpba SubtractAmountPaidFromMoney_ -GetMonName:: - push hl +; adds the amount the player sold to their money +AddAmountSoldToMoney:: + ld de, wPlayerMoney + 2 + ld hl, hMoney + 2 ; total price of items + ld c, 3 ; length of money in bytes + predef AddBCDPredef ; add total price to money + ld a, MONEY_BOX + ld [wTextBoxID], a + call DisplayTextBoxID ; redraw money text box + ld a, SFX_PURCHASE + call PlaySoundWaitForCurrent + jp WaitForSoundToFinish + +; function to remove an item (in varying quantities) from the player's bag or PC box +; INPUT: +; HL = address of inventory (either wNumBagItems or wNumBoxItems) +; [wWhichPokemon] = index (within the inventory) of the item to remove +; [wItemQuantity] = quantity to remove +RemoveItemFromInventory:: ld a, [hLoadedROMBank] push af - ld a, BANK(MonsterNames) + ld a, BANK(RemoveItemFromInventory_) ld [hLoadedROMBank], a ld [MBC1RomBank], a - ld a, [wd11e] - dec a - ld hl, MonsterNames - ld c, 10 - ld b, 0 - call AddNTimes - ld de, wcd6d - push de - ld bc, 10 - call CopyData - ld hl, wcd6d + 10 - ld [hl], "@" - pop de + call RemoveItemFromInventory_ pop af ld [hLoadedROMBank], a ld [MBC1RomBank], a - pop hl - ret - -GetItemName:: -; given an item ID at [wd11e], store the name of the item into a string -; starting at wcd6d - push hl - push bc - ld a, [wd11e] - cp HM_01 ; is this a TM/HM? - jr nc, .Machine - - ld [wd0b5], a - ld a, ITEM_NAME - ld [wNameListType], a - ld a, BANK(ItemNames) - ld [wPredefBank], a - call GetName - jr .Finish - -.Machine - call GetMachineName -.Finish - ld de, wcd6d ; pointer to where item name is stored in RAM - pop bc - pop hl ret -GetMachineName:: -; copies the name of the TM/HM in [wd11e] to wcd6d - push hl - push de +; function to add an item (in varying quantities) to the player's bag or PC box +; INPUT: +; HL = address of inventory (either wNumBagItems or wNumBoxItems) +; [wcf91] = item ID +; [wItemQuantity] = item quantity +; sets carry flag if successful, unsets carry flag if unsuccessful +AddItemToInventory:: push bc - ld a, [wd11e] - push af - cp TM_01 ; is this a TM? [not HM] - jr nc, .WriteTM -; if HM, then write "HM" and add 5 to the item ID, so we can reuse the -; TM printing code - add 5 - ld [wd11e], a - ld hl, HiddenPrefix ; points to "HM" - ld bc, 2 - jr .WriteMachinePrefix -.WriteTM - ld hl, TechnicalPrefix ; points to "TM" - ld bc, 2 -.WriteMachinePrefix - ld de, wcd6d - call CopyData - -; now get the machine number and convert it to text - ld a, [wd11e] - sub TM_01 - 1 - ld b, "0" -.FirstDigit - sub 10 - jr c, .SecondDigit - inc b - jr .FirstDigit -.SecondDigit - add 10 + ld a, [hLoadedROMBank] push af + ld a, BANK(AddItemToInventory_) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call AddItemToInventory_ + pop bc ld a, b - ld [de], a - inc de - pop af - ld b, "0" - add b - ld [de], a - inc de - ld a, "@" - ld [de], a - pop af - ld [wd11e], a + ld [hLoadedROMBank], a + ld [MBC1RomBank], a pop bc - pop de - pop hl - ret - -TechnicalPrefix:: - db "TM" -HiddenPrefix:: - db "HM" - -; sets carry if item is HM, clears carry if item is not HM -; Input: a = item ID -IsItemHM:: - cp HM_01 - jr c, .notHM - cp TM_01 - ret -.notHM - and a ret -; sets carry if move is an HM, clears carry if move is not an HM -; Input: a = move ID -IsMoveHM:: - ld hl, HMMoves - ld de, 1 - jp IsInArray - -HMMoves:: - db CUT,FLY,SURF,STRENGTH,FLASH - db $ff ; terminator - -GetMoveName:: - push hl - ld a, MOVE_NAME - ld [wNameListType], a - ld a, [wd11e] - ld [wd0b5], a - ld a, BANK(MoveNames) - ld [wPredefBank], a - call GetName - ld de, wcd6d ; pointer to where move name is stored in RAM - pop hl - ret +INCLUDE "home/list_menu.asm" +INCLUDE "home/names.asm" ; reloads text box tile patterns, current map view, and tileset tile patterns ReloadMapData:: @@ -2103,442 +426,7 @@ EndNPCMovementScript:: EmptyFunc2:: ret -; stores hl in [wTrainerHeaderPtr] -StoreTrainerHeaderPointer:: - ld a, h - ld [wTrainerHeaderPtr], a - ld a, l - ld [wTrainerHeaderPtr+1], a - ret - -; executes the current map script from the function pointer array provided in hl. -; a: map script index to execute (unless overridden by [wd733] bit 4) -ExecuteCurMapScriptInTable:: - push af - push de - call StoreTrainerHeaderPointer - pop hl - pop af - push hl - ld hl, wFlags_D733 - bit 4, [hl] - res 4, [hl] - jr z, .useProvidedIndex ; test if map script index was overridden manually - ld a, [wCurMapScript] -.useProvidedIndex - pop hl - ld [wCurMapScript], a - call CallFunctionInTable - ld a, [wCurMapScript] - ret - -LoadGymLeaderAndCityName:: - push de - ld de, wGymCityName - ld bc, $11 - call CopyData ; load city name - pop hl - ld de, wGymLeaderName - ld bc, NAME_LENGTH - jp CopyData ; load gym leader name - -; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) -; a: offset in header data -; 0 -> flag's bit (into wTrainerHeaderFlagBit) -; 2 -> flag's byte ptr (into hl) -; 4 -> before battle text (into hl) -; 6 -> after battle text (into hl) -; 8 -> end battle text (into hl) -ReadTrainerHeaderInfo:: - push de - push af - ld d, $0 - ld e, a - ld hl, wTrainerHeaderPtr - ld a, [hli] - ld l, [hl] - ld h, a - add hl, de - pop af - and a - jr nz, .nonZeroOffset - ld a, [hl] - ld [wTrainerHeaderFlagBit], a ; store flag's bit - jr .done -.nonZeroOffset - cp $2 - jr z, .readPointer ; read flag's byte ptr - cp $4 - jr z, .readPointer ; read before battle text - cp $6 - jr z, .readPointer ; read after battle text - cp $8 - jr z, .readPointer ; read end battle text - cp $a - jr nz, .done - ld a, [hli] ; read end battle text (2) but override the result afterwards (XXX why, bug?) - ld d, [hl] - ld e, a - jr .done -.readPointer - ld a, [hli] - ld h, [hl] - ld l, a -.done - pop de - ret - -TrainerFlagAction:: - predef_jump FlagActionPredef - -TalkToTrainer:: - call StoreTrainerHeaderPointer - xor a - call ReadTrainerHeaderInfo ; read flag's bit - ld a, $2 - call ReadTrainerHeaderInfo ; read flag's byte ptr - ld a, [wTrainerHeaderFlagBit] - ld c, a - ld b, FLAG_TEST - call TrainerFlagAction ; read trainer's flag - ld a, c - and a - jr z, .trainerNotYetFought ; test trainer's flag - ld a, $6 - call ReadTrainerHeaderInfo ; print after battle text - jp PrintText -.trainerNotYetFought - ld a, $4 - call ReadTrainerHeaderInfo ; print before battle text - call PrintText - ld a, $a - call ReadTrainerHeaderInfo ; (?) does nothing apparently (maybe bug in ReadTrainerHeaderInfo) - push de - ld a, $8 - call ReadTrainerHeaderInfo ; read end battle text - pop de - call SaveEndBattleTextPointers - ld hl, wFlags_D733 - set 4, [hl] ; activate map script index override (index is set below) - ld hl, wFlags_0xcd60 - bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) - ret nz -; if the player talked to the trainer of his own volition - call EngageMapTrainer - ld hl, wCurMapScript - inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle) - jp StartTrainerBattle - -; checks if any trainers are seeing the player and wanting to fight -CheckFightingMapTrainers:: - call CheckForEngagingTrainers - ld a, [wSpriteIndex] - cp $ff - jr nz, .trainerEngaging - xor a - ld [wSpriteIndex], a - ld [wTrainerHeaderFlagBit], a - ret -.trainerEngaging - ld hl, wFlags_D733 - set 3, [hl] - ld [wEmotionBubbleSpriteIndex], a - xor a ; EXCLAMATION_BUBBLE - ld [wWhichEmotionBubble], a - predef EmotionBubble - ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN - ld [wJoyIgnore], a - xor a - ld [hJoyHeld], a - call TrainerWalkUpToPlayer_Bank0 - ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) - ret - -; display the before battle text after the enemy trainer has walked up to the player's sprite -DisplayEnemyTrainerTextAndStartBattle:: - ld a, [wd730] - and $1 - ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite - ld [wJoyIgnore], a - ld a, [wSpriteIndex] - ld [hSpriteIndexOrTextID], a - call DisplayTextID - ; fall through - -StartTrainerBattle:: - xor a - ld [wJoyIgnore], a - call InitBattleEnemyParameters - ld hl, wd72d - set 6, [hl] - set 7, [hl] - ld hl, wd72e - set 1, [hl] - ld hl, wCurMapScript - inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) - ret - -EndTrainerBattle:: - ld hl, wCurrentMapScriptFlags - set 5, [hl] - set 6, [hl] - ld hl, wd72d - res 7, [hl] - ld hl, wFlags_0xcd60 - res 0, [hl] ; player is no longer engaged by any trainer - ld a, [wIsInBattle] - cp $ff - jp z, ResetButtonPressedAndMapScript - ld a, $2 - call ReadTrainerHeaderInfo - ld a, [wTrainerHeaderFlagBit] - ld c, a - ld b, FLAG_SET - call TrainerFlagAction ; flag trainer as fought - ld a, [wEnemyMonOrTrainerClass] - cp OPP_ID_OFFSET - jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) - ld hl, wMissableObjectList - ld de, $2 - ld a, [wSpriteIndex] - call IsInArray ; search for sprite ID - inc hl - ld a, [hl] - ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it - predef HideObject -.skipRemoveSprite - ld hl, wd730 - bit 4, [hl] - res 4, [hl] - ret nz - -ResetButtonPressedAndMapScript:: - xor a - ld [wJoyIgnore], a - ld [hJoyHeld], a - ld [hJoyPressed], a - ld [hJoyReleased], a - ld [wCurMapScript], a ; reset battle status - ret - -; calls TrainerWalkUpToPlayer -TrainerWalkUpToPlayer_Bank0:: - jpba TrainerWalkUpToPlayer - -; sets opponent type and mon set/lvl based on the engaging trainer data -InitBattleEnemyParameters:: - ld a, [wEngagedTrainerClass] - ld [wCurOpponent], a - ld [wEnemyMonOrTrainerClass], a - cp OPP_ID_OFFSET - ld a, [wEngagedTrainerSet] - jr c, .noTrainer - ld [wTrainerNo], a - ret -.noTrainer - ld [wCurEnemyLVL], a - ret - -GetSpritePosition1:: - ld hl, _GetSpritePosition1 - jr SpritePositionBankswitch - -GetSpritePosition2:: - ld hl, _GetSpritePosition2 - jr SpritePositionBankswitch - -SetSpritePosition1:: - ld hl, _SetSpritePosition1 - jr SpritePositionBankswitch - -SetSpritePosition2:: - ld hl, _SetSpritePosition2 -SpritePositionBankswitch:: - ld b, BANK(_GetSpritePosition1) ; BANK(_GetSpritePosition2), BANK(_SetSpritePosition1), BANK(_SetSpritePosition2) - jp Bankswitch ; indirect jump to one of the four functions - -CheckForEngagingTrainers:: - xor a - call ReadTrainerHeaderInfo ; read trainer flag's bit (unused) - ld d, h ; store trainer header address in de - ld e, l -.trainerLoop - call StoreTrainerHeaderPointer ; set trainer header pointer to current trainer - ld a, [de] - ld [wSpriteIndex], a ; store trainer flag's bit - ld [wTrainerHeaderFlagBit], a - cp $ff - ret z - ld a, $2 - call ReadTrainerHeaderInfo ; read trainer flag's byte ptr - ld b, FLAG_TEST - ld a, [wTrainerHeaderFlagBit] - ld c, a - call TrainerFlagAction ; read trainer flag - ld a, c - and a ; has the trainer already been defeated? - jr nz, .continue - push hl - push de - push hl - xor a - call ReadTrainerHeaderInfo ; get trainer header pointer - inc hl - ld a, [hl] ; read trainer engage distance - pop hl - ld [wTrainerEngageDistance], a - ld a, [wSpriteIndex] - swap a - ld [wTrainerSpriteOffset], a - predef TrainerEngage - pop de - pop hl - ld a, [wTrainerSpriteOffset] - and a - ret nz ; break if the trainer is engaging -.continue - ld hl, $c - add hl, de - ld d, h - ld e, l - jr .trainerLoop - -; hl = text if the player wins -; de = text if the player loses -SaveEndBattleTextPointers:: - ld a, [hLoadedROMBank] - ld [wEndBattleTextRomBank], a - ld a, h - ld [wEndBattleWinTextPointer], a - ld a, l - ld [wEndBattleWinTextPointer + 1], a - ld a, d - ld [wEndBattleLoseTextPointer], a - ld a, e - ld [wEndBattleLoseTextPointer + 1], a - ret - -; loads data of some trainer on the current map and plays pre-battle music -; [wSpriteIndex]: sprite ID of trainer who is engaged -EngageMapTrainer:: - ld hl, wMapSpriteExtraData - ld d, $0 - ld a, [wSpriteIndex] - dec a - add a - ld e, a - add hl, de ; seek to engaged trainer data - ld a, [hli] ; load trainer class - ld [wEngagedTrainerClass], a - ld a, [hl] ; load trainer mon set - ld [wEngagedTrainerSet], a - jp PlayTrainerMusic - -PrintEndBattleText:: - push hl - ld hl, wd72d - bit 7, [hl] - res 7, [hl] - pop hl - ret z - ld a, [hLoadedROMBank] - push af - ld a, [wEndBattleTextRomBank] - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - push hl - callba SaveTrainerName - ld hl, TrainerEndBattleText - call PrintText - pop hl - pop af - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - callba FreezeEnemyTrainerSprite - jp WaitForSoundToFinish - -GetSavedEndBattleTextPointer:: - ld a, [wBattleResult] - and a -; won battle - jr nz, .lostBattle - ld a, [wEndBattleWinTextPointer] - ld h, a - ld a, [wEndBattleWinTextPointer + 1] - ld l, a - ret -.lostBattle - ld a, [wEndBattleLoseTextPointer] - ld h, a - ld a, [wEndBattleLoseTextPointer + 1] - ld l, a - ret - -TrainerEndBattleText:: - TX_FAR _TrainerNameText - TX_ASM - call GetSavedEndBattleTextPointer - call TextCommandProcessor - jp TextScriptEnd - -; only engage withe trainer if the player is not already -; engaged with another trainer -; XXX unused? -CheckIfAlreadyEngaged:: - ld a, [wFlags_0xcd60] - bit 0, a - ret nz - call EngageMapTrainer - xor a - ret - -PlayTrainerMusic:: - ld a, [wEngagedTrainerClass] - cp OPP_SONY1 - ret z - cp OPP_SONY2 - ret z - cp OPP_SONY3 - ret z - ld a, [wGymLeaderNo] - and a - ret nz - xor a - ld [wAudioFadeOutControl], a - ld a, SFX_STOP_ALL_MUSIC - call PlaySound - ld a, BANK(Music_MeetEvilTrainer) - ld [wAudioROMBank], a - ld [wAudioSavedROMBank], a - ld a, [wEngagedTrainerClass] - ld b, a - ld hl, EvilTrainerList -.evilTrainerListLoop - ld a, [hli] - cp $ff - jr z, .noEvilTrainer - cp b - jr nz, .evilTrainerListLoop - ld a, MUSIC_MEET_EVIL_TRAINER - jr .PlaySound -.noEvilTrainer - ld hl, FemaleTrainerList -.femaleTrainerListLoop - ld a, [hli] - cp $ff - jr z, .maleTrainer - cp b - jr nz, .femaleTrainerListLoop - ld a, MUSIC_MEET_FEMALE_TRAINER - jr .PlaySound -.maleTrainer - ld a, MUSIC_MEET_MALE_TRAINER -.PlaySound - ld [wNewSoundID], a - jp PlaySound - -INCLUDE "data/trainers/encounter_types.asm" +INCLUDE "home/trainers.asm" ; checks if the player's coordinates match an arrow movement tile's coordinates ; and if so, decodes the RLE movement data @@ -2841,83 +729,8 @@ HasEnoughCoins:: ld c, 2 jp StringCmp - -BankswitchHome:: -; switches to bank # in a -; Only use this when in the home bank! - ld [wBankswitchHomeTemp], a - ld a, [hLoadedROMBank] - ld [wBankswitchHomeSavedROMBank], a - ld a, [wBankswitchHomeTemp] - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -BankswitchBack:: -; returns from BankswitchHome - ld a, [wBankswitchHomeSavedROMBank] - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -Bankswitch:: -; self-contained bankswitch, use this when not in the home bank -; switches to the bank in b - ld a, [hLoadedROMBank] - push af - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ld bc, .Return - push bc - jp hl -.Return - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -; displays yes/no choice -; yes -> set carry -YesNoChoice:: - call SaveScreenTilesToBuffer1 - call InitYesNoTextBoxParameters - jr DisplayYesNoChoice - -Func_35f4:: - ld a, TWO_OPTION_MENU - ld [wTextBoxID], a - call InitYesNoTextBoxParameters - jp DisplayTextBoxID - -InitYesNoTextBoxParameters:: - xor a ; YES_NO_MENU - ld [wTwoOptionMenuID], a - coord hl, 14, 7 - ld bc, $80f - ret - -YesNoChoicePokeCenter:: - call SaveScreenTilesToBuffer1 - ld a, HEAL_CANCEL_MENU - ld [wTwoOptionMenuID], a - coord hl, 11, 6 - lb bc, 8, 12 - jr DisplayYesNoChoice - -WideYesNoChoice:: ; unused - call SaveScreenTilesToBuffer1 - ld a, WIDE_YES_NO_MENU - ld [wTwoOptionMenuID], a - coord hl, 12, 7 - lb bc, 8, 13 - -DisplayYesNoChoice:: - ld a, TWO_OPTION_MENU - ld [wTextBoxID], a - call DisplayTextBoxID - jp LoadScreenTilesFromBuffer1 +INCLUDE "home/bankswitch.asm" +INCLUDE "home/yes_no.asm" ; calculates the difference |a-b|, setting carry flag if a999) - cp 999 / $100 + 1 - jr nc, .overflow - cp 999 / $100 - jr c, .noOverflow - ld a, [hMultiplicand+2] - cp 999 % $100 + 1 - jr c, .noOverflow -.overflow - ld a, 999 / $100 ; overflow: cap at 999 - ld [hMultiplicand+1], a - ld a, 999 % $100 - ld [hMultiplicand+2], a -.noOverflow - pop bc - pop de - pop hl - ret - -AddEnemyMonToPlayerParty:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(_AddEnemyMonToPlayerParty) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call _AddEnemyMonToPlayerParty - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret - -MoveMon:: - ld a, [hLoadedROMBank] - push af - ld a, BANK(_MoveMon) - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - call _MoveMon - pop bc - ld a, b - ld [hLoadedROMBank], a - ld [MBC1RomBank], a - ret +INCLUDE "home/move_mon.asm" ; skips a text entries, each of size NAME_LENGTH (like trainer name, OT name, rival name, ...) ; hl: base pointer, will be incremented by NAME_LENGTH * a @@ -4091,225 +1568,7 @@ PrintText_NoCreatingTextBox:: coord bc, 1, 14 jp TextCommandProcessor - -PrintNumber:: -; Print the c-digit, b-byte value at de. -; Allows 2 to 7 digits. For 1-digit numbers, add -; the value to char "0" instead of calling PrintNumber. -; Flags LEADING_ZEROES and LEFT_ALIGN can be given -; in bits 7 and 6 of b respectively. - push bc - xor a - ld [hPastLeadingZeros], a - ld [hNumToPrint], a - ld [hNumToPrint + 1], a - ld a, b - and $f - cp 1 - jr z, .byte - cp 2 - jr z, .word -.long - ld a, [de] - ld [hNumToPrint], a - inc de - ld a, [de] - ld [hNumToPrint + 1], a - inc de - ld a, [de] - ld [hNumToPrint + 2], a - jr .start - -.word - ld a, [de] - ld [hNumToPrint + 1], a - inc de - ld a, [de] - ld [hNumToPrint + 2], a - jr .start - -.byte - ld a, [de] - ld [hNumToPrint + 2], a - -.start - push de - - ld d, b - ld a, c - ld b, a - xor a - ld c, a - ld a, b - - cp 2 - jr z, .tens - cp 3 - jr z, .hundreds - cp 4 - jr z, .thousands - cp 5 - jr z, .ten_thousands - cp 6 - jr z, .hundred_thousands - -print_digit: macro - -if (\1) / $10000 - ld a, \1 / $10000 % $100 -else xor a -endc - ld [hPowerOf10 + 0], a - -if (\1) / $100 - ld a, \1 / $100 % $100 -else xor a -endc - ld [hPowerOf10 + 1], a - - ld a, \1 / $1 % $100 - ld [hPowerOf10 + 2], a - - call .PrintDigit - call .NextDigit -endm - -.millions print_digit 1000000 -.hundred_thousands print_digit 100000 -.ten_thousands print_digit 10000 -.thousands print_digit 1000 -.hundreds print_digit 100 - -.tens - ld c, 0 - ld a, [hNumToPrint + 2] -.mod - cp 10 - jr c, .ok - sub 10 - inc c - jr .mod -.ok - - ld b, a - ld a, [hPastLeadingZeros] - or c - ld [hPastLeadingZeros], a - jr nz, .past - call .PrintLeadingZero - jr .next -.past - ld a, "0" - add c - ld [hl], a -.next - - call .NextDigit -.ones - ld a, "0" - add b - ld [hli], a - pop de - dec de - pop bc - ret - -.PrintDigit: -; Divide by the current decimal place. -; Print the quotient, and keep the modulus. - ld c, 0 -.loop - ld a, [hPowerOf10] - ld b, a - ld a, [hNumToPrint] - ld [hSavedNumToPrint], a - cp b - jr c, .underflow0 - sub b - ld [hNumToPrint], a - ld a, [hPowerOf10 + 1] - ld b, a - ld a, [hNumToPrint + 1] - ld [hSavedNumToPrint + 1], a - cp b - jr nc, .noborrow1 - - ld a, [hNumToPrint] - or 0 - jr z, .underflow1 - dec a - ld [hNumToPrint], a - ld a, [hNumToPrint + 1] -.noborrow1 - - sub b - ld [hNumToPrint + 1], a - ld a, [hPowerOf10 + 2] - ld b, a - ld a, [hNumToPrint + 2] - ld [hSavedNumToPrint + 2], a - cp b - jr nc, .noborrow2 - - ld a, [hNumToPrint + 1] - and a - jr nz, .borrowed - - ld a, [hNumToPrint] - and a - jr z, .underflow2 - dec a - ld [hNumToPrint], a - xor a -.borrowed - - dec a - ld [hNumToPrint + 1], a - ld a, [hNumToPrint + 2] -.noborrow2 - sub b - ld [hNumToPrint + 2], a - inc c - jr .loop - -.underflow2 - ld a, [hSavedNumToPrint + 1] - ld [hNumToPrint + 1], a -.underflow1 - ld a, [hSavedNumToPrint] - ld [hNumToPrint], a -.underflow0 - ld a, [hPastLeadingZeros] - or c - jr z, .PrintLeadingZero - - ld a, "0" - add c - ld [hl], a - ld [hPastLeadingZeros], a - ret - -.PrintLeadingZero: - bit BIT_LEADING_ZEROES, d - ret z - ld [hl], "0" - ret - -.NextDigit: -; Increment unless the number is left-aligned, -; leading zeroes are not printed, and no digits -; have been printed yet. - bit BIT_LEADING_ZEROES, d - jr nz, .inc - bit BIT_LEFT_ALIGN, d - jr z, .inc - ld a, [hPastLeadingZeros] - and a - ret z -.inc - inc hl - ret - +INCLUDE "home/print_num.asm" CallFunctionInTable:: ; Call function a in jumptable hl. @@ -4333,7 +1592,6 @@ CallFunctionInTable:: pop hl ret - IsInArray:: ; Search an array at hl for the value in a. ; Entry size is de bytes. @@ -4360,7 +1618,6 @@ IsInRestOfArray:: scf ret - RestoreScreenTilesAndReloadTilePatterns:: call ClearSprites ld a, $1 @@ -4371,7 +1628,6 @@ RestoreScreenTilesAndReloadTilePatterns:: call RunDefaultPaletteCommand jr Delay3 - GBPalWhiteOutWithDelay3:: call GBPalWhiteOut @@ -4397,7 +1653,6 @@ GBPalWhiteOut:: ld [rOBP1], a ret - RunDefaultPaletteCommand:: ld b, $ff RunPaletteCommand:: @@ -4441,7 +1696,6 @@ ReloadMapSpriteTilePatterns:: call LoadFontTilePatterns jp UpdateSprites - GiveItem:: ; Give player quantity c of item b, ; and copy the item's name to wcf4b. @@ -4469,7 +1723,6 @@ GivePokemon:: ld [wMonDataLocation], a jpba _GivePokemon - Random:: ; Return a random number in a. ; For battles, use BattleRandom. @@ -4483,10 +1736,8 @@ Random:: pop hl ret - INCLUDE "home/predef.asm" - UpdateCinnabarGymGateTileBlocks:: jpba UpdateCinnabarGymGateTileBlocks_ @@ -4554,72 +1805,4 @@ SetMapTextPointer:: ld [wMapTextPtr + 1], a ret -TextPredefs:: -const_value = 1 - - add_tx_pre CardKeySuccessText ; 01 - add_tx_pre CardKeyFailText ; 02 - add_tx_pre RedBedroomPCText ; 03 - add_tx_pre RedBedroomSNESText ; 04 - add_tx_pre PushStartText ; 05 - add_tx_pre SaveOptionText ; 06 - add_tx_pre StrengthsAndWeaknessesText ; 07 - add_tx_pre OakLabEmailText ; 08 - add_tx_pre AerodactylFossilText ; 09 - add_tx_pre Route15UpstairsBinocularsText ; 0A - add_tx_pre KabutopsFossilText ; 0B - add_tx_pre GymStatueText1 ; 0C - add_tx_pre GymStatueText2 ; 0D - add_tx_pre BookcaseText ; 0E - add_tx_pre ViridianCityPokecenterBenchGuyText ; 0F - add_tx_pre PewterCityPokecenterBenchGuyText ; 10 - add_tx_pre CeruleanCityPokecenterBenchGuyText ; 11 - add_tx_pre LavenderCityPokecenterBenchGuyText ; 12 - add_tx_pre VermilionCityPokecenterBenchGuyText ; 13 - add_tx_pre CeladonCityPokecenterBenchGuyText ; 14 - add_tx_pre CeladonCityHotelText ; 15 - add_tx_pre FuchsiaCityPokecenterBenchGuyText ; 16 - add_tx_pre CinnabarIslandPokecenterBenchGuyText ; 17 - add_tx_pre SaffronCityPokecenterBenchGuyText ; 18 - add_tx_pre MtMoonPokecenterBenchGuyText ; 19 - add_tx_pre RockTunnelPokecenterBenchGuyText ; 1A - add_tx_pre UnusedBenchGuyText1 ; 1B XXX unused - add_tx_pre UnusedBenchGuyText2 ; 1C XXX unused - add_tx_pre UnusedBenchGuyText3 ; 1D XXX unused - add_tx_pre UnusedPredefText ; 1E XXX unused - add_tx_pre PokemonCenterPCText ; 1F - add_tx_pre ViridianSchoolNotebook ; 20 - add_tx_pre ViridianSchoolBlackboard ; 21 - add_tx_pre JustAMomentText ; 22 - add_tx_pre OpenBillsPCText ; 23 - add_tx_pre FoundHiddenItemText ; 24 - add_tx_pre HiddenItemBagFullText ; 25 XXX unused - add_tx_pre VermilionGymTrashText ; 26 - add_tx_pre IndigoPlateauHQText ; 27 - add_tx_pre GameCornerOutOfOrderText ; 28 - add_tx_pre GameCornerOutToLunchText ; 29 - add_tx_pre GameCornerSomeonesKeysText ; 2A - add_tx_pre FoundHiddenCoinsText ; 2B - add_tx_pre DroppedHiddenCoinsText ; 2C - add_tx_pre BillsHouseMonitorText ; 2D - add_tx_pre BillsHouseInitiatedText ; 2E - add_tx_pre BillsHousePokemonList ; 2F - add_tx_pre MagazinesText ; 30 - add_tx_pre CinnabarGymQuiz ; 31 - add_tx_pre GameCornerNoCoinsText ; 32 - add_tx_pre GameCornerCoinCaseText ; 33 - add_tx_pre LinkCableHelp ; 34 - add_tx_pre TMNotebook ; 35 - add_tx_pre FightingDojoText ; 36 - add_tx_pre EnemiesOnEverySideText ; 37 - add_tx_pre WhatGoesAroundComesAroundText ; 38 - add_tx_pre NewBicycleText ; 39 - add_tx_pre IndigoPlateauStatues ; 3A - add_tx_pre VermilionGymTrashSuccessText1 ; 3B - add_tx_pre VermilionGymTrashSuccessText2 ; 3C XXX unused - add_tx_pre VermilionGymTrashSuccessText3 ; 3D - add_tx_pre VermilionGymTrashFailText ; 3E - add_tx_pre TownMapText ; 3F - add_tx_pre BookOrSculptureText ; 40 - add_tx_pre ElevatorText ; 41 - add_tx_pre PokemonStuffText ; 42 +INCLUDE "data/text_predef_pointers.asm" diff --git a/home/bankswitch.asm b/home/bankswitch.asm new file mode 100644 index 00000000..086ca2f3 --- /dev/null +++ b/home/bankswitch.asm @@ -0,0 +1,35 @@ +BankswitchHome:: +; switches to bank # in a +; Only use this when in the home bank! + ld [wBankswitchHomeTemp], a + ld a, [hLoadedROMBank] + ld [wBankswitchHomeSavedROMBank], a + ld a, [wBankswitchHomeTemp] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +BankswitchBack:: +; returns from BankswitchHome + ld a, [wBankswitchHomeSavedROMBank] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +Bankswitch:: +; self-contained bankswitch, use this when not in the home bank +; switches to the bank in b + ld a, [hLoadedROMBank] + push af + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ld bc, .Return + push bc + jp hl +.Return + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret diff --git a/home/list_menu.asm b/home/list_menu.asm new file mode 100644 index 00000000..68335ed5 --- /dev/null +++ b/home/list_menu.asm @@ -0,0 +1,526 @@ +; INPUT: +; [wListMenuID] = list menu ID +; [wListPointer] = address of the list (2 bytes) +DisplayListMenuID:: + xor a + ld [hAutoBGTransferEnabled], a ; disable auto-transfer + ld a, 1 + ld [hJoy7], a ; joypad state update flag + ld a, [wBattleType] + and a ; is it the Old Man battle? + jr nz, .specialBattleType + ld a, $01 ; hardcoded bank + jr .bankswitch +.specialBattleType ; Old Man battle + ld a, BANK(DisplayBattleMenu) +.bankswitch + call BankswitchHome + ld hl, wd730 + set 6, [hl] ; turn off letter printing delay + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ld [wListCount], a + ld a, [wListPointer] + ld l, a + ld a, [wListPointer + 1] + ld h, a ; hl = address of the list + ld a, [hl] ; the first byte is the number of entries in the list + ld [wListCount], a + ld a, LIST_MENU_BOX + ld [wTextBoxID], a + call DisplayTextBoxID ; draw the menu text box + call UpdateSprites ; disable sprites behind the text box +; the code up to .skipMovingSprites appears to be useless + coord hl, 4, 2 ; coordinates of upper left corner of menu text box + lb de, 9, 14 ; height and width of menu text box + ld a, [wListMenuID] + and a ; is it a PC pokemon list? + jr nz, .skipMovingSprites + call UpdateSprites +.skipMovingSprites + ld a, 1 ; max menu item ID is 1 if the list has less than 2 entries + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wListCount] + cp 2 ; does the list have less than 2 entries? + jr c, .setMenuVariables + ld a, 2 ; max menu item ID is 2 if the list has at least 2 entries +.setMenuVariables + ld [wMaxMenuItem], a + ld a, 4 + ld [wTopMenuItemY], a + ld a, 5 + ld [wTopMenuItemX], a + ld a, A_BUTTON | B_BUTTON | SELECT + ld [wMenuWatchedKeys], a + ld c, 10 + call DelayFrames + +DisplayListMenuIDLoop:: + xor a + ld [hAutoBGTransferEnabled], a ; disable transfer + call PrintListMenuEntries + ld a, 1 + ld [hAutoBGTransferEnabled], a ; enable transfer + call Delay3 + ld a, [wBattleType] + and a ; is it the Old Man battle? + jr z, .notOldManBattle +.oldManBattle + ld a, "▶" + Coorda 5, 4 ; place menu cursor in front of first menu entry + ld c, 80 + call DelayFrames + xor a + ld [wCurrentMenuItem], a + coord hl, 5, 4 + ld a, l + ld [wMenuCursorLocation], a + ld a, h + ld [wMenuCursorLocation + 1], a + jr .buttonAPressed +.notOldManBattle + call LoadGBPal + call HandleMenuInput + push af + call PlaceMenuCursor + pop af + bit 0, a ; was the A button pressed? + jp z, .checkOtherKeys +.buttonAPressed + ld a, [wCurrentMenuItem] + call PlaceUnfilledArrowMenuCursor + +; pointless because both values are overwritten before they are read + ld a, $01 + ld [wMenuExitMethod], a + ld [wChosenMenuItem], a + + xor a + ld [wMenuWatchMovingOutOfBounds], a + ld a, [wCurrentMenuItem] + ld c, a + ld a, [wListScrollOffset] + add c + ld c, a + ld a, [wListCount] + and a ; is the list empty? + jp z, ExitListMenu ; if so, exit the menu + dec a + cp c ; did the player select Cancel? + jp c, ExitListMenu ; if so, exit the menu + ld a, c + ld [wWhichPokemon], a + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .skipMultiplying +; if it's an item menu + sla c ; item entries are 2 bytes long, so multiply by 2 +.skipMultiplying + ld a, [wListPointer] + ld l, a + ld a, [wListPointer + 1] + ld h, a + inc hl ; hl = beginning of list entries + ld b, 0 + add hl, bc + ld a, [hl] + ld [wcf91], a + ld a, [wListMenuID] + and a ; is it a PC pokemon list? + jr z, .pokemonList + push hl + call GetItemPrice + pop hl + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .skipGettingQuantity +; if it's an item menu + inc hl + ld a, [hl] ; a = item quantity + ld [wMaxItemQuantity], a +.skipGettingQuantity + ld a, [wcf91] + ld [wd0b5], a + ld a, BANK(ItemNames) + ld [wPredefBank], a + call GetName + jr .storeChosenEntry +.pokemonList + ld hl, wPartyCount + ld a, [wListPointer] + cp l ; is it a list of party pokemon or box pokemon? + ld hl, wPartyMonNicks + jr z, .getPokemonName + ld hl, wBoxMonNicks ; box pokemon names +.getPokemonName + ld a, [wWhichPokemon] + call GetPartyMonName +.storeChosenEntry ; store the menu entry that the player chose and return + ld de, wcd6d + call CopyStringToCF4B ; copy name to wcf4b + ld a, CHOSE_MENU_ITEM + ld [wMenuExitMethod], a + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + xor a + ld [hJoy7], a ; joypad state update flag + ld hl, wd730 + res 6, [hl] ; turn on letter printing delay + jp BankswitchBack +.checkOtherKeys ; check B, SELECT, Up, and Down keys + bit 1, a ; was the B button pressed? + jp nz, ExitListMenu ; if so, exit the menu + bit 2, a ; was the select button pressed? + jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries + ld b, a + bit 7, b ; was Down pressed? + ld hl, wListScrollOffset + jr z, .upPressed +.downPressed + ld a, [hl] + add 3 + ld b, a + ld a, [wListCount] + cp b ; will going down scroll past the Cancel button? + jp c, DisplayListMenuIDLoop + inc [hl] ; if not, go down + jp DisplayListMenuIDLoop +.upPressed + ld a, [hl] + and a + jp z, DisplayListMenuIDLoop + dec [hl] + jp DisplayListMenuIDLoop + +DisplayChooseQuantityMenu:: +; text box dimensions/coordinates for just quantity + coord hl, 15, 9 + ld b, 1 ; height + ld c, 3 ; width + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .drawTextBox +; text box dimensions/coordinates for quantity and price + coord hl, 7, 9 + ld b, 1 ; height + ld c, 11 ; width +.drawTextBox + call TextBoxBorder + coord hl, 16, 10 + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .printInitialQuantity + coord hl, 8, 10 +.printInitialQuantity + ld de, InitialQuantityText + call PlaceString + xor a + ld [wItemQuantity], a ; initialize current quantity to 0 + jp .incrementQuantity +.waitForKeyPressLoop + call JoypadLowSensitivity + ld a, [hJoyPressed] ; newly pressed buttons + bit 0, a ; was the A button pressed? + jp nz, .buttonAPressed + bit 1, a ; was the B button pressed? + jp nz, .buttonBPressed + bit 6, a ; was Up pressed? + jr nz, .incrementQuantity + bit 7, a ; was Down pressed? + jr nz, .decrementQuantity + jr .waitForKeyPressLoop +.incrementQuantity + ld a, [wMaxItemQuantity] + inc a + ld b, a + ld hl, wItemQuantity ; current quantity + inc [hl] + ld a, [hl] + cp b + jr nz, .handleNewQuantity +; wrap to 1 if the player goes above the max quantity + ld a, 1 + ld [hl], a + jr .handleNewQuantity +.decrementQuantity + ld hl, wItemQuantity ; current quantity + dec [hl] + jr nz, .handleNewQuantity +; wrap to the max quantity if the player goes below 1 + ld a, [wMaxItemQuantity] + ld [hl], a +.handleNewQuantity + coord hl, 17, 10 + ld a, [wListMenuID] + cp PRICEDITEMLISTMENU + jr nz, .printQuantity +.printPrice + ld c, $03 + ld a, [wItemQuantity] + ld b, a + ld hl, hMoney ; total price +; initialize total price to 0 + xor a + ld [hli], a + ld [hli], a + ld [hl], a +.addLoop ; loop to multiply the individual price by the quantity to get the total price + ld de, hMoney + 2 + ld hl, hItemPrice + 2 + push bc + predef AddBCDPredef ; add the individual price to the current sum + pop bc + dec b + jr nz, .addLoop + ld a, [hHalveItemPrices] + and a ; should the price be halved (for selling items)? + jr z, .skipHalvingPrice + xor a + ld [hDivideBCDDivisor], a + ld [hDivideBCDDivisor + 1], a + ld a, $02 + ld [hDivideBCDDivisor + 2], a + predef DivideBCDPredef3 ; halves the price +; store the halved price + ld a, [hDivideBCDQuotient] + ld [hMoney], a + ld a, [hDivideBCDQuotient + 1] + ld [hMoney + 1], a + ld a, [hDivideBCDQuotient + 2] + ld [hMoney + 2], a +.skipHalvingPrice + coord hl, 12, 10 + ld de, SpacesBetweenQuantityAndPriceText + call PlaceString + ld de, hMoney ; total price + ld c, $a3 + call PrintBCDNumber + coord hl, 9, 10 +.printQuantity + ld de, wItemQuantity ; current quantity + lb bc, LEADING_ZEROES | 1, 2 ; 1 byte, 2 digits + call PrintNumber + jp .waitForKeyPressLoop +.buttonAPressed ; the player chose to make the transaction + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ret +.buttonBPressed ; the player chose to cancel the transaction + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + ld a, $ff + ret + +InitialQuantityText:: + db "×01@" + +SpacesBetweenQuantityAndPriceText:: + db " @" + +ExitListMenu:: + ld a, [wCurrentMenuItem] + ld [wChosenMenuItem], a + ld a, CANCELLED_MENU + ld [wMenuExitMethod], a + ld [wMenuWatchMovingOutOfBounds], a + xor a + ld [hJoy7], a + ld hl, wd730 + res 6, [hl] + call BankswitchBack + xor a + ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped + scf + ret + +PrintListMenuEntries:: + coord hl, 5, 3 + ld b, 9 + ld c, 14 + call ClearScreenArea + ld a, [wListPointer] + ld e, a + ld a, [wListPointer + 1] + ld d, a + inc de ; de = beginning of list entries + ld a, [wListScrollOffset] + ld c, a + ld a, [wListMenuID] + cp ITEMLISTMENU + ld a, c + jr nz, .skipMultiplying +; if it's an item menu +; item entries are 2 bytes long, so multiply by 2 + sla a + sla c +.skipMultiplying + add e + ld e, a + jr nc, .noCarry + inc d +.noCarry + coord hl, 6, 4 ; coordinates of first list entry name + ld b, 4 ; print 4 names +.loop + ld a, b + ld [wWhichPokemon], a + ld a, [de] + ld [wd11e], a + cp $ff + jp z, .printCancelMenuItem + push bc + push de + push hl + push hl + push de + ld a, [wListMenuID] + and a + jr z, .pokemonPCMenu + cp MOVESLISTMENU + jr z, .movesMenu +.itemMenu + call GetItemName + jr .placeNameString +.pokemonPCMenu + push hl + ld hl, wPartyCount + ld a, [wListPointer] + cp l ; is it a list of party pokemon or box pokemon? + ld hl, wPartyMonNicks + jr z, .getPokemonName + ld hl, wBoxMonNicks ; box pokemon names +.getPokemonName + ld a, [wWhichPokemon] + ld b, a + ld a, 4 + sub b + ld b, a + ld a, [wListScrollOffset] + add b + call GetPartyMonName + pop hl + jr .placeNameString +.movesMenu + call GetMoveName +.placeNameString + call PlaceString + pop de + pop hl + ld a, [wPrintItemPrices] + and a ; should prices be printed? + jr z, .skipPrintingItemPrice +.printItemPrice + push hl + ld a, [de] + ld de, ItemPrices + ld [wcf91], a + call GetItemPrice ; get price + pop hl + ld bc, SCREEN_WIDTH + 5 ; 1 row down and 5 columns right + add hl, bc + ld c, $a3 ; no leading zeroes, right-aligned, print currency symbol, 3 bytes + call PrintBCDNumber +.skipPrintingItemPrice + ld a, [wListMenuID] + and a + jr nz, .skipPrintingPokemonLevel +.printPokemonLevel + ld a, [wd11e] + push af + push hl + ld hl, wPartyCount + ld a, [wListPointer] + cp l ; is it a list of party pokemon or box pokemon? + ld a, PLAYER_PARTY_DATA + jr z, .next + ld a, BOX_DATA +.next + ld [wMonDataLocation], a + ld hl, wWhichPokemon + ld a, [hl] + ld b, a + ld a, $04 + sub b + ld b, a + ld a, [wListScrollOffset] + add b + ld [hl], a + call LoadMonData + ld a, [wMonDataLocation] + and a ; is it a list of party pokemon or box pokemon? + jr z, .skipCopyingLevel +.copyLevel + ld a, [wLoadedMonBoxLevel] + ld [wLoadedMonLevel], a +.skipCopyingLevel + pop hl + ld bc, $001c + add hl, bc + call PrintLevel + pop af + ld [wd11e], a +.skipPrintingPokemonLevel + pop hl + pop de + inc de + ld a, [wListMenuID] + cp ITEMLISTMENU + jr nz, .nextListEntry +.printItemQuantity + ld a, [wd11e] + ld [wcf91], a + call IsKeyItem ; check if item is unsellable + ld a, [wIsKeyItem] + and a ; is the item unsellable? + jr nz, .skipPrintingItemQuantity ; if so, don't print the quantity + push hl + ld bc, SCREEN_WIDTH + 8 ; 1 row down and 8 columns right + add hl, bc + ld a, "×" + ld [hli], a + ld a, [wd11e] + push af + ld a, [de] + ld [wMaxItemQuantity], a + push de + ld de, wd11e + ld [de], a + lb bc, 1, 2 + call PrintNumber + pop de + pop af + ld [wd11e], a + pop hl +.skipPrintingItemQuantity + inc de + pop bc + inc c + push bc + inc c + ld a, [wMenuItemToSwap] ; ID of item chosen for swapping (counts from 1) + and a ; is an item being swapped? + jr z, .nextListEntry + sla a + cp c ; is it this item? + jr nz, .nextListEntry + dec hl + ld a, $ec ; unfilled right arrow menu cursor to indicate an item being swapped + ld [hli], a +.nextListEntry + ld bc, 2 * SCREEN_WIDTH ; 2 rows + add hl, bc + pop bc + inc c + dec b + jp nz, .loop + ld bc, -8 + add hl, bc + ld a, "▼" + ld [hl], a + ret +.printCancelMenuItem + ld de, ListMenuCancelText + jp PlaceString + +ListMenuCancelText:: + db "CANCEL@" diff --git a/home/move_mon.asm b/home/move_mon.asm new file mode 100644 index 00000000..e13ebf4e --- /dev/null +++ b/home/move_mon.asm @@ -0,0 +1,242 @@ +; Function to remove a pokemon from the party or the current box. +; wWhichPokemon determines the pokemon. +; [wRemoveMonFromBox] == 0 specifies the party. +; [wRemoveMonFromBox] != 0 specifies the current box. +RemovePokemon:: + jpab _RemovePokemon + +AddPartyMon:: + push hl + push de + push bc + callba _AddPartyMon + pop bc + pop de + pop hl + ret + +; calculates all 5 stats of current mon and writes them to [de] +CalcStats:: + ld c, $0 +.statsLoop + inc c + call CalcStat + ld a, [hMultiplicand+1] + ld [de], a + inc de + ld a, [hMultiplicand+2] + ld [de], a + inc de + ld a, c + cp NUM_STATS + jr nz, .statsLoop + ret + +; calculates stat c of current mon +; c: stat to calc (HP=1,Atk=2,Def=3,Spd=4,Spc=5) +; b: consider stat exp? +; hl: base ptr to stat exp values ([hl + 2*c - 1] and [hl + 2*c]) +CalcStat:: + push hl + push de + push bc + ld a, b + ld d, a + push hl + ld hl, wMonHeader + ld b, $0 + add hl, bc + ld a, [hl] ; read base value of stat + ld e, a + pop hl + push hl + sla c + ld a, d + and a + jr z, .statExpDone ; consider stat exp? + add hl, bc ; skip to corresponding stat exp value +.statExpLoop ; calculates ceil(Sqrt(stat exp)) in b + xor a + ld [hMultiplicand], a + ld [hMultiplicand+1], a + inc b ; increment current stat exp bonus + ld a, b + cp $ff + jr z, .statExpDone + ld [hMultiplicand+2], a + ld [hMultiplier], a + call Multiply + ld a, [hld] + ld d, a + ld a, [hProduct + 3] + sub d + ld a, [hli] + ld d, a + ld a, [hProduct + 2] + sbc d ; test if (current stat exp bonus)^2 < stat exp + jr c, .statExpLoop +.statExpDone + srl c + pop hl + push bc + ld bc, wPartyMon1DVs - (wPartyMon1HPExp - 1) ; also wEnemyMonDVs - wEnemyMonHP + add hl, bc + pop bc + ld a, c + cp $2 + jr z, .getAttackIV + cp $3 + jr z, .getDefenseIV + cp $4 + jr z, .getSpeedIV + cp $5 + jr z, .getSpecialIV +.getHpIV + push bc + ld a, [hl] ; Atk IV + swap a + and $1 + sla a + sla a + sla a + ld b, a + ld a, [hli] ; Def IV + and $1 + sla a + sla a + add b + ld b, a + ld a, [hl] ; Spd IV + swap a + and $1 + sla a + add b + ld b, a + ld a, [hl] ; Spc IV + and $1 + add b ; HP IV: LSB of the other 4 IVs + pop bc + jr .calcStatFromIV +.getAttackIV + ld a, [hl] + swap a + and $f + jr .calcStatFromIV +.getDefenseIV + ld a, [hl] + and $f + jr .calcStatFromIV +.getSpeedIV + inc hl + ld a, [hl] + swap a + and $f + jr .calcStatFromIV +.getSpecialIV + inc hl + ld a, [hl] + and $f +.calcStatFromIV + ld d, $0 + add e + ld e, a + jr nc, .noCarry + inc d ; de = Base + IV +.noCarry + sla e + rl d ; de = (Base + IV) * 2 + srl b + srl b ; b = ceil(Sqrt(stat exp)) / 4 + ld a, b + add e + jr nc, .noCarry2 + inc d ; de = (Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4 +.noCarry2 + ld [hMultiplicand+2], a + ld a, d + ld [hMultiplicand+1], a + xor a + ld [hMultiplicand], a + ld a, [wCurEnemyLVL] + ld [hMultiplier], a + call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level + ld a, [hMultiplicand] + ld [hDividend], a + ld a, [hMultiplicand+1] + ld [hDividend+1], a + ld a, [hMultiplicand+2] + ld [hDividend+2], a + ld a, $64 + ld [hDivisor], a + ld a, $3 + ld b, a + call Divide ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + ld a, c + cp $1 + ld a, 5 ; + 5 for non-HP stat + jr nz, .notHPStat + ld a, [wCurEnemyLVL] + ld b, a + ld a, [hMultiplicand+2] + add b + ld [hMultiplicand+2], a + jr nc, .noCarry3 + ld a, [hMultiplicand+1] + inc a + ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level +.noCarry3 + ld a, 10 ; +10 for HP stat +.notHPStat + ld b, a + ld a, [hMultiplicand+2] + add b + ld [hMultiplicand+2], a + jr nc, .noCarry4 + ld a, [hMultiplicand+1] + inc a ; non-HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + 5 + ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10 +.noCarry4 + ld a, [hMultiplicand+1] ; check for overflow (>999) + cp 999 / $100 + 1 + jr nc, .overflow + cp 999 / $100 + jr c, .noOverflow + ld a, [hMultiplicand+2] + cp 999 % $100 + 1 + jr c, .noOverflow +.overflow + ld a, 999 / $100 ; overflow: cap at 999 + ld [hMultiplicand+1], a + ld a, 999 % $100 + ld [hMultiplicand+2], a +.noOverflow + pop bc + pop de + pop hl + ret + +AddEnemyMonToPlayerParty:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(_AddEnemyMonToPlayerParty) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call _AddEnemyMonToPlayerParty + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +MoveMon:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(_MoveMon) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call _MoveMon + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret diff --git a/home/names.asm b/home/names.asm new file mode 100644 index 00000000..cbc8910b --- /dev/null +++ b/home/names.asm @@ -0,0 +1,141 @@ +GetMonName:: + push hl + ld a, [hLoadedROMBank] + push af + ld a, BANK(MonsterNames) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ld a, [wd11e] + dec a + ld hl, MonsterNames + ld c, 10 + ld b, 0 + call AddNTimes + ld de, wcd6d + push de + ld bc, 10 + call CopyData + ld hl, wcd6d + 10 + ld [hl], "@" + pop de + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + pop hl + ret + +GetItemName:: +; given an item ID at [wd11e], store the name of the item into a string +; starting at wcd6d + push hl + push bc + ld a, [wd11e] + cp HM_01 ; is this a TM/HM? + jr nc, .Machine + + ld [wd0b5], a + ld a, ITEM_NAME + ld [wNameListType], a + ld a, BANK(ItemNames) + ld [wPredefBank], a + call GetName + jr .Finish + +.Machine + call GetMachineName +.Finish + ld de, wcd6d ; pointer to where item name is stored in RAM + pop bc + pop hl + ret + +GetMachineName:: +; copies the name of the TM/HM in [wd11e] to wcd6d + push hl + push de + push bc + ld a, [wd11e] + push af + cp TM_01 ; is this a TM? [not HM] + jr nc, .WriteTM +; if HM, then write "HM" and add 5 to the item ID, so we can reuse the +; TM printing code + add 5 + ld [wd11e], a + ld hl, HiddenPrefix ; points to "HM" + ld bc, 2 + jr .WriteMachinePrefix +.WriteTM + ld hl, TechnicalPrefix ; points to "TM" + ld bc, 2 +.WriteMachinePrefix + ld de, wcd6d + call CopyData + +; now get the machine number and convert it to text + ld a, [wd11e] + sub TM_01 - 1 + ld b, "0" +.FirstDigit + sub 10 + jr c, .SecondDigit + inc b + jr .FirstDigit +.SecondDigit + add 10 + push af + ld a, b + ld [de], a + inc de + pop af + ld b, "0" + add b + ld [de], a + inc de + ld a, "@" + ld [de], a + pop af + ld [wd11e], a + pop bc + pop de + pop hl + ret + +TechnicalPrefix:: + db "TM" +HiddenPrefix:: + db "HM" + +; sets carry if item is HM, clears carry if item is not HM +; Input: a = item ID +IsItemHM:: + cp HM_01 + jr c, .notHM + cp TM_01 + ret +.notHM + and a + ret + +; sets carry if move is an HM, clears carry if move is not an HM +; Input: a = move ID +IsMoveHM:: + ld hl, HMMoves + ld de, 1 + jp IsInArray + +HMMoves:: +INCLUDE "data/moves/hm_moves.asm" + +GetMoveName:: + push hl + ld a, MOVE_NAME + ld [wNameListType], a + ld a, [wd11e] + ld [wd0b5], a + ld a, BANK(MoveNames) + ld [wPredefBank], a + call GetName + ld de, wcd6d ; pointer to where move name is stored in RAM + pop hl + ret diff --git a/home/names2.asm b/home/names2.asm new file mode 100644 index 00000000..178a0780 --- /dev/null +++ b/home/names2.asm @@ -0,0 +1,93 @@ +NamePointers:: + dw MonsterNames + dw MoveNames + dw UnusedNames + dw ItemNames + dw wPartyMonOT ; player's OT names list + dw wEnemyMonOT ; enemy's OT names list + dw TrainerNames + +GetName:: +; arguments: +; [wd0b5] = which name +; [wNameListType] = which list +; [wPredefBank] = bank of list +; +; returns pointer to name in de + ld a, [wd0b5] + ld [wd11e], a + + ; TM names are separate from item names. + ; BUG: This applies to all names instead of just items. + cp HM_01 + jp nc, GetMachineName + + ld a, [hLoadedROMBank] + push af + push hl + push bc + push de + ld a, [wNameListType] ;List3759_entrySelector + dec a + jr nz, .otherEntries + ;1 = MON_NAMES + call GetMonName + ld hl, NAME_LENGTH + add hl, de + ld e, l + ld d, h + jr .gotPtr +.otherEntries + ;2-7 = OTHER ENTRIES + ld a, [wPredefBank] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ld a, [wNameListType] ;VariousNames' entryID + dec a + add a + ld d, 0 + ld e, a + jr nc, .skip + inc d +.skip + ld hl, NamePointers + add hl, de + ld a, [hli] + ld [hSwapTemp + 1], a + ld a, [hl] + ld [hSwapTemp], a + ld a, [hSwapTemp] + ld h, a + ld a, [hSwapTemp + 1] + ld l, a + ld a, [wd0b5] + ld b, a + ld c, 0 +.nextName + ld d, h + ld e, l +.nextChar + ld a, [hli] + cp "@" + jr nz, .nextChar + inc c ;entry counter + ld a, b ;wanted entry + cp c + jr nz, .nextName + ld h, d + ld l, e + ld de, wcd6d + ld bc, $0014 + call CopyData +.gotPtr + ld a, e + ld [wUnusedCF8D], a + ld a, d + ld [wUnusedCF8D + 1], a + pop de + pop bc + pop hl + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret diff --git a/home/overworld_text.asm b/home/overworld_text.asm new file mode 100644 index 00000000..b32335f7 --- /dev/null +++ b/home/overworld_text.asm @@ -0,0 +1,31 @@ +TextScriptEndingChar:: + db "@" + +TextScriptEnd:: + ld hl, TextScriptEndingChar + ret + +ExclamationText:: + TX_FAR _ExclamationText + db "@" + +GroundRoseText:: + TX_FAR _GroundRoseText + db "@" + +BoulderText:: + TX_FAR _BoulderText + db "@" + +MartSignText:: + TX_FAR _MartSignText + db "@" + +PokeCenterSignText:: + TX_FAR _PokeCenterSignText + db "@" + +PickUpItemText:: + TX_ASM + predef PickUpItem + jp TextScriptEnd diff --git a/home/pokemon.asm b/home/pokemon.asm new file mode 100644 index 00000000..141baa65 --- /dev/null +++ b/home/pokemon.asm @@ -0,0 +1,464 @@ +DrawHPBar:: +; Draw an HP bar d tiles long, and fill it to e pixels. +; If c is nonzero, show at least a sliver regardless. +; The right end of the bar changes with [wHPBarType]. + + push hl + push de + push bc + + ; Left + ld a, $71 ; "HP:" + ld [hli], a + ld a, $62 + ld [hli], a + + push hl + + ; Middle + ld a, $63 ; empty +.draw + ld [hli], a + dec d + jr nz, .draw + + ; Right + ld a, [wHPBarType] + dec a + ld a, $6d ; status screen and battle + jr z, .ok + dec a ; pokemon menu +.ok + ld [hl], a + + pop hl + + ld a, e + and a + jr nz, .fill + + ; If c is nonzero, draw a pixel anyway. + ld a, c + and a + jr z, .done + ld e, 1 + +.fill + ld a, e + sub 8 + jr c, .partial + ld e, a + ld a, $6b ; full + ld [hli], a + ld a, e + and a + jr z, .done + jr .fill + +.partial + ; Fill remaining pixels at the end if necessary. + ld a, $63 ; empty + add e + ld [hl], a +.done + pop bc + pop de + pop hl + ret + + +; loads pokemon data from one of multiple sources to wLoadedMon +; loads base stats to wMonHeader +; INPUT: +; [wWhichPokemon] = index of pokemon within party/box +; [wMonDataLocation] = source +; 00: player's party +; 01: enemy's party +; 02: current box +; 03: daycare +; OUTPUT: +; [wcf91] = pokemon ID +; wLoadedMon = base address of pokemon data +; wMonHeader = base address of base stats +LoadMonData:: + jpab LoadMonData_ + +OverwritewMoves:: +; Write c to [wMoves + b]. Unused. + ld hl, wMoves + ld e, b + ld d, 0 + add hl, de + ld a, c + ld [hl], a + ret + +LoadFlippedFrontSpriteByMonIndex:: + ld a, 1 + ld [wSpriteFlipped], a + +LoadFrontSpriteByMonIndex:: + push hl + ld a, [wd11e] + push af + ld a, [wcf91] + ld [wd11e], a + predef IndexToPokedex + ld hl, wd11e + ld a, [hl] + pop bc + ld [hl], b + and a + pop hl + jr z, .invalidDexNumber ; dex #0 invalid + cp NUM_POKEMON + 1 + jr c, .validDexNumber ; dex >#151 invalid +.invalidDexNumber + ld a, RHYDON ; $1 + ld [wcf91], a + ret +.validDexNumber + push hl + ld de, vFrontPic + call LoadMonFrontSprite + pop hl + ld a, [hLoadedROMBank] + push af + ld a, BANK(CopyUncompressedPicToHL) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + xor a + ld [hStartTileID], a + call CopyUncompressedPicToHL + xor a + ld [wSpriteFlipped], a + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + + +PlayCry:: +; Play monster a's cry. + call GetCryData + call PlaySound + jp WaitForSoundToFinish + +GetCryData:: +; Load cry data for monster a. + dec a + ld c, a + ld b, 0 + ld hl, CryData + add hl, bc + add hl, bc + add hl, bc + + ld a, BANK(CryData) + call BankswitchHome + ld a, [hli] + ld b, a ; cry id + ld a, [hli] + ld [wFrequencyModifier], a + ld a, [hl] + ld [wTempoModifier], a + call BankswitchBack + + ; Cry headers have 3 channels, + ; and start from index CRY_SFX_START, + ; so add 3 times the cry id. + ld a, b + ld c, CRY_SFX_START + rlca ; * 2 + add b + add c + ret + +DisplayPartyMenu:: + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + call GBPalWhiteOutWithDelay3 + call ClearSprites + call PartyMenuInit + call DrawPartyMenu + jp HandlePartyMenuInput + +GoBackToPartyMenu:: + ld a, [hTilesetType] + push af + xor a + ld [hTilesetType], a + call PartyMenuInit + call RedrawPartyMenu + jp HandlePartyMenuInput + +PartyMenuInit:: + ld a, 1 ; hardcoded bank + call BankswitchHome + call LoadHpBarAndStatusTilePatterns + ld hl, wd730 + set 6, [hl] ; turn off letter printing delay + xor a ; PLAYER_PARTY_DATA + ld [wMonDataLocation], a + ld [wMenuWatchMovingOutOfBounds], a + ld hl, wTopMenuItemY + inc a + ld [hli], a ; top menu item Y + xor a + ld [hli], a ; top menu item X + ld a, [wPartyAndBillsPCSavedMenuItem] + push af + ld [hli], a ; current menu item ID + inc hl + ld a, [wPartyCount] + and a ; are there more than 0 pokemon in the party? + jr z, .storeMaxMenuItemID + dec a +; if party is not empty, the max menu item ID is ([wPartyCount] - 1) +; otherwise, it is 0 +.storeMaxMenuItemID + ld [hli], a ; max menu item ID + ld a, [wForcePlayerToChooseMon] + and a + ld a, A_BUTTON | B_BUTTON + jr z, .next + xor a + ld [wForcePlayerToChooseMon], a + inc a ; a = A_BUTTON +.next + ld [hli], a ; menu watched keys + pop af + ld [hl], a ; old menu item ID + ret + +HandlePartyMenuInput:: + ld a, 1 + ld [wMenuWrappingEnabled], a + ld a, $40 + ld [wPartyMenuAnimMonEnabled], a + call HandleMenuInput_ + call PlaceUnfilledArrowMenuCursor + ld b, a + xor a + ld [wPartyMenuAnimMonEnabled], a + ld a, [wCurrentMenuItem] + ld [wPartyAndBillsPCSavedMenuItem], a + ld hl, wd730 + res 6, [hl] ; turn on letter printing delay + ld a, [wMenuItemToSwap] + and a + jp nz, .swappingPokemon + pop af + ld [hTilesetType], a + bit 1, b + jr nz, .noPokemonChosen + ld a, [wPartyCount] + and a + jr z, .noPokemonChosen + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + ld hl, wPartySpecies + ld b, 0 + ld c, a + add hl, bc + ld a, [hl] + ld [wcf91], a + ld [wBattleMonSpecies2], a + call BankswitchBack + and a + ret +.noPokemonChosen + call BankswitchBack + scf + ret +.swappingPokemon + bit 1, b ; was the B button pressed? + jr z, .handleSwap ; if not, handle swapping the pokemon +.cancelSwap ; if the B button was pressed + callba ErasePartyMenuCursors + xor a + ld [wMenuItemToSwap], a + ld [wPartyMenuTypeOrMessageID], a + call RedrawPartyMenu + jr HandlePartyMenuInput +.handleSwap + ld a, [wCurrentMenuItem] + ld [wWhichPokemon], a + callba SwitchPartyMon + jr HandlePartyMenuInput + +DrawPartyMenu:: + ld hl, DrawPartyMenu_ + jr DrawPartyMenuCommon + +RedrawPartyMenu:: + ld hl, RedrawPartyMenu_ + +DrawPartyMenuCommon:: + ld b, BANK(RedrawPartyMenu_) + jp Bankswitch + +; prints a pokemon's status condition +; INPUT: +; de = address of status condition +; hl = destination address +PrintStatusCondition:: + push de + dec de + dec de ; de = address of current HP + ld a, [de] + ld b, a + dec de + ld a, [de] + or b ; is the pokemon's HP zero? + pop de + jr nz, PrintStatusConditionNotFainted +; if the pokemon's HP is 0, print "FNT" + ld a, "F" + ld [hli], a + ld a, "N" + ld [hli], a + ld [hl], "T" + and a + ret + +PrintStatusConditionNotFainted:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(PrintStatusAilment) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call PrintStatusAilment ; print status condition + pop bc + ld a, b + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +; function to print pokemon level, leaving off the ":L" if the level is at least 100 +; INPUT: +; hl = destination address +; [wLoadedMonLevel] = level +PrintLevel:: + ld a, $6e ; ":L" tile ID + ld [hli], a + ld c, 2 ; number of digits + ld a, [wLoadedMonLevel] ; level + cp 100 + jr c, PrintLevelCommon +; if level at least 100, write over the ":L" tile + dec hl + inc c ; increment number of digits to 3 + jr PrintLevelCommon + +; prints the level without leaving off ":L" regardless of level +; INPUT: +; hl = destination address +; [wLoadedMonLevel] = level +PrintLevelFull:: + ld a, $6e ; ":L" tile ID + ld [hli], a + ld c, 3 ; number of digits + ld a, [wLoadedMonLevel] ; level + +PrintLevelCommon:: + ld [wd11e], a + ld de, wd11e + ld b, LEFT_ALIGN | 1 ; 1 byte + jp PrintNumber + +GetwMoves:: +; Unused. Returns the move at index a from wMoves in a + ld hl, wMoves + ld c, a + ld b, 0 + add hl, bc + ld a, [hl] + ret + +; copies the base stat data of a pokemon to wMonHeader +; INPUT: +; [wd0b5] = pokemon ID +GetMonHeader:: + ld a, [hLoadedROMBank] + push af + ld a, BANK(BaseStats) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + push bc + push de + push hl + ld a, [wd11e] + push af + ld a, [wd0b5] + ld [wd11e], a + ld de, FossilKabutopsPic + ld b, $66 ; size of Kabutops fossil and Ghost sprites + cp FOSSIL_KABUTOPS ; Kabutops fossil + jr z, .specialID + ld de, GhostPic + cp MON_GHOST ; Ghost + jr z, .specialID + ld de, FossilAerodactylPic + ld b, $77 ; size of Aerodactyl fossil sprite + cp FOSSIL_AERODACTYL ; Aerodactyl fossil + jr z, .specialID + cp MEW + jr z, .mew + predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number + ld a, [wd11e] + dec a + ld bc, MonBaseStatsEnd - MonBaseStats + ld hl, BaseStats + call AddNTimes + ld de, wMonHeader + ld bc, MonBaseStatsEnd - MonBaseStats + call CopyData + jr .done +.specialID + ld hl, wMonHSpriteDim + ld [hl], b ; write sprite dimensions + inc hl + ld [hl], e ; write front sprite pointer + inc hl + ld [hl], d + jr .done +.mew + ld hl, MewBaseStats + ld de, wMonHeader + ld bc, MonBaseStatsEnd - MonBaseStats + ld a, BANK(MewBaseStats) + call FarCopyData +.done + ld a, [wd0b5] + ld [wMonHIndex], a + pop af + ld [wd11e], a + pop hl + pop de + pop bc + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + ret + +; copy party pokemon's name to wcd6d +GetPartyMonName2:: + ld a, [wWhichPokemon] ; index within party + ld hl, wPartyMonNicks + +; this is called more often +GetPartyMonName:: + push hl + push bc + call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times + ld de, wcd6d + push de + ld bc, NAME_LENGTH + call CopyData + pop de + pop bc + pop hl + ret diff --git a/home/predef_text.asm b/home/predef_text.asm new file mode 100644 index 00000000..24001c24 --- /dev/null +++ b/home/predef_text.asm @@ -0,0 +1,237 @@ +; this function is used to display sign messages, sprite dialog, etc. +; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID +DisplayTextID:: + ld a, [hLoadedROMBank] + push af + callba DisplayTextIDInit ; initialization + ld hl, wTextPredefFlag + bit 0, [hl] + res 0, [hl] + jr nz, .skipSwitchToMapBank + ld a, [wCurMap] + call SwitchToMapRomBank +.skipSwitchToMapBank + ld a, 30 ; half a second + ld [hFrameCounter], a ; used as joypad poll timer + ld hl, wMapTextPtr + ld a, [hli] + ld h, [hl] + ld l, a ; hl = map text pointer + ld d, $00 + ld a, [hSpriteIndexOrTextID] ; text ID + ld [wSpriteIndex], a + and a + jp z, DisplayStartMenu + cp TEXT_SAFARI_GAME_OVER + jp z, DisplaySafariGameOverText + cp TEXT_MON_FAINTED + jp z, DisplayPokemonFaintedText + cp TEXT_BLACKED_OUT + jp z, DisplayPlayerBlackedOutText + cp TEXT_REPEL_WORE_OFF + jp z, DisplayRepelWoreOffText + ld a, [wNumSprites] + ld e, a + ld a, [hSpriteIndexOrTextID] ; sprite ID + cp e + jr z, .spriteHandling + jr nc, .skipSpriteHandling +.spriteHandling +; get the text ID of the sprite + push hl + push de + push bc + callba UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction) + pop bc + pop de + ld hl, wMapSpriteData ; NPC text entries + ld a, [hSpriteIndexOrTextID] + dec a + add a + add l + ld l, a + jr nc, .noCarry + inc h +.noCarry + inc hl + ld a, [hl] ; a = text ID of the sprite + pop hl +.skipSpriteHandling +; look up the address of the text in the map's text entries + dec a + ld e, a + sla e + add hl, de + ld a, [hli] + ld h, [hl] + ld l, a ; hl = address of the text + ld a, [hl] ; a = first byte of text +; check first byte of text for special cases + cp $fe ; Pokemart NPC + jp z, DisplayPokemartDialogue + cp $ff ; Pokemon Center NPC + jp z, DisplayPokemonCenterDialogue + cp $fc ; Item Storage PC + jp z, FuncTX_ItemStoragePC + cp $fd ; Bill's PC + jp z, FuncTX_BillsPC + cp $f9 ; Pokemon Center PC + jp z, FuncTX_PokemonCenterPC + cp $f5 ; Vending Machine + jr nz, .notVendingMachine + callba VendingMachineMenu ; jump banks to vending machine routine + jr AfterDisplayingTextID +.notVendingMachine + cp $f7 ; prize menu + jp z, FuncTX_GameCornerPrizeMenu + cp $f6 ; cable connection NPC in Pokemon Center + jr nz, .notSpecialCase + callab CableClubNPC + jr AfterDisplayingTextID +.notSpecialCase + call PrintText_NoCreatingTextBox ; display the text + ld a, [wDoNotWaitForButtonPressAfterDisplayingText] + and a + jr nz, HoldTextDisplayOpen + +AfterDisplayingTextID:: + ld a, [wEnteringCableClub] + and a + jr nz, HoldTextDisplayOpen + call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text + +; loop to hold the dialogue box open as long as the player keeps holding down the A button +HoldTextDisplayOpen:: + call Joypad + ld a, [hJoyHeld] + bit 0, a ; is the A button being pressed? + jr nz, HoldTextDisplayOpen + +CloseTextDisplay:: + ld a, [wCurMap] + call SwitchToMapRomBank + ld a, $90 + ld [hWY], a ; move the window off the screen + call DelayFrame + call LoadGBPal + xor a + ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank +; loop to make sprites face the directions they originally faced before the dialogue + ld hl, wSpriteStateData2 + $19 + ld c, $0f + ld de, $0010 +.restoreSpriteFacingDirectionLoop + ld a, [hl] + dec h + ld [hl], a + inc h + add hl, de + dec c + jr nz, .restoreSpriteFacingDirectionLoop + ld a, BANK(InitMapSprites) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns) + ld hl, wFontLoaded + res 0, [hl] + ld a, [wd732] + bit 3, a ; used fly warp + call z, LoadPlayerSpriteGraphics + call LoadCurrentMapView + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + jp UpdateSprites + +DisplayPokemartDialogue:: + push hl + ld hl, PokemartGreetingText + call PrintText + pop hl + inc hl + call LoadItemList + ld a, PRICEDITEMLISTMENU + ld [wListMenuID], a + ld a, [hLoadedROMBank] + push af + ld a, BANK(DisplayPokemartDialogue_) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call DisplayPokemartDialogue_ + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + jp AfterDisplayingTextID + +PokemartGreetingText:: + TX_FAR _PokemartGreetingText + db "@" + +LoadItemList:: + ld a, 1 + ld [wUpdateSpritesEnabled], a + ld a, h + ld [wItemListPointer], a + ld a, l + ld [wItemListPointer + 1], a + ld de, wItemList +.loop + ld a, [hli] + ld [de], a + inc de + cp $ff + jr nz, .loop + ret + +DisplayPokemonCenterDialogue:: +; zeroing these doesn't appear to serve any purpose + xor a + ld [hItemPrice], a + ld [hItemPrice + 1], a + ld [hItemPrice + 2], a + + inc hl + ld a, [hLoadedROMBank] + push af + ld a, BANK(DisplayPokemonCenterDialogue_) + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + call DisplayPokemonCenterDialogue_ + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + jp AfterDisplayingTextID + +DisplaySafariGameOverText:: + callab PrintSafariGameOverText + jp AfterDisplayingTextID + +DisplayPokemonFaintedText:: + ld hl, PokemonFaintedText + call PrintText + jp AfterDisplayingTextID + +PokemonFaintedText:: + TX_FAR _PokemonFaintedText + db "@" + +DisplayPlayerBlackedOutText:: + ld hl, PlayerBlackedOutText + call PrintText + ld a, [wd732] + res 5, a ; reset forced to use bike bit + ld [wd732], a + jp HoldTextDisplayOpen + +PlayerBlackedOutText:: + TX_FAR _PlayerBlackedOutText + db "@" + +DisplayRepelWoreOffText:: + ld hl, RepelWoreOffText + call PrintText + jp AfterDisplayingTextID + +RepelWoreOffText:: + TX_FAR _RepelWoreOffText + db "@" diff --git a/home/print_bcd.asm b/home/print_bcd.asm new file mode 100644 index 00000000..38aedd3c --- /dev/null +++ b/home/print_bcd.asm @@ -0,0 +1,77 @@ +; function to print a BCD (Binary-coded decimal) number +; de = address of BCD number +; hl = destination address +; c = flags and length +; bit 7: if set, do not print leading zeroes +; if unset, print leading zeroes +; bit 6: if set, left-align the string (do not pad empty digits with spaces) +; if unset, right-align the string +; bit 5: if set, print currency symbol at the beginning of the string +; if unset, do not print the currency symbol +; bits 0-4: length of BCD number in bytes +; Note that bits 5 and 7 are modified during execution. The above reflects +; their meaning at the beginning of the functions's execution. +PrintBCDNumber:: + ld b, c ; save flags in b + res 7, c + res 6, c + res 5, c ; c now holds the length + bit 5, b + jr z, .loop + bit 7, b + jr nz, .loop + ld [hl], "¥" + inc hl +.loop + ld a, [de] + swap a + call PrintBCDDigit ; print upper digit + ld a, [de] + call PrintBCDDigit ; print lower digit + inc de + dec c + jr nz, .loop + bit 7, b ; were any non-zero digits printed? + jr z, .done ; if so, we are done +.numberEqualsZero ; if every digit of the BCD number is zero + bit 6, b ; left or right alignment? + jr nz, .skipRightAlignmentAdjustment + dec hl ; if the string is right-aligned, it needs to be moved back one space +.skipRightAlignmentAdjustment + bit 5, b + jr z, .skipCurrencySymbol + ld [hl], "¥" + inc hl +.skipCurrencySymbol + ld [hl], "0" + call PrintLetterDelay + inc hl +.done + ret + +PrintBCDDigit:: + and $f + and a + jr z, .zeroDigit +.nonzeroDigit + bit 7, b ; have any non-space characters been printed? + jr z, .outputDigit +; if bit 7 is set, then no numbers have been printed yet + bit 5, b ; print the currency symbol? + jr z, .skipCurrencySymbol + ld [hl], "¥" + inc hl + res 5, b +.skipCurrencySymbol + res 7, b ; unset 7 to indicate that a nonzero digit has been reached +.outputDigit + add "0" + ld [hli], a + jp PrintLetterDelay +.zeroDigit + bit 7, b ; either printing leading zeroes or already reached a nonzero digit? + jr z, .outputDigit ; if so, print a zero digit + bit 6, b ; left or right alignment? + ret nz + inc hl ; if right-aligned, "print" a space by advancing the pointer + ret diff --git a/home/print_num.asm b/home/print_num.asm new file mode 100644 index 00000000..5155977b --- /dev/null +++ b/home/print_num.asm @@ -0,0 +1,217 @@ +PrintNumber:: +; Print the c-digit, b-byte value at de. +; Allows 2 to 7 digits. For 1-digit numbers, add +; the value to char "0" instead of calling PrintNumber. +; Flags LEADING_ZEROES and LEFT_ALIGN can be given +; in bits 7 and 6 of b respectively. + push bc + xor a + ld [hPastLeadingZeros], a + ld [hNumToPrint], a + ld [hNumToPrint + 1], a + ld a, b + and $f + cp 1 + jr z, .byte + cp 2 + jr z, .word +.long + ld a, [de] + ld [hNumToPrint], a + inc de + ld a, [de] + ld [hNumToPrint + 1], a + inc de + ld a, [de] + ld [hNumToPrint + 2], a + jr .start + +.word + ld a, [de] + ld [hNumToPrint + 1], a + inc de + ld a, [de] + ld [hNumToPrint + 2], a + jr .start + +.byte + ld a, [de] + ld [hNumToPrint + 2], a + +.start + push de + + ld d, b + ld a, c + ld b, a + xor a + ld c, a + ld a, b + + cp 2 + jr z, .tens + cp 3 + jr z, .hundreds + cp 4 + jr z, .thousands + cp 5 + jr z, .ten_thousands + cp 6 + jr z, .hundred_thousands + +print_digit: macro + +if (\1) / $10000 + ld a, \1 / $10000 % $100 +else xor a +endc + ld [hPowerOf10 + 0], a + +if (\1) / $100 + ld a, \1 / $100 % $100 +else xor a +endc + ld [hPowerOf10 + 1], a + + ld a, \1 / $1 % $100 + ld [hPowerOf10 + 2], a + + call .PrintDigit + call .NextDigit +endm + +.millions print_digit 1000000 +.hundred_thousands print_digit 100000 +.ten_thousands print_digit 10000 +.thousands print_digit 1000 +.hundreds print_digit 100 + +.tens + ld c, 0 + ld a, [hNumToPrint + 2] +.mod + cp 10 + jr c, .ok + sub 10 + inc c + jr .mod +.ok + + ld b, a + ld a, [hPastLeadingZeros] + or c + ld [hPastLeadingZeros], a + jr nz, .past + call .PrintLeadingZero + jr .next +.past + ld a, "0" + add c + ld [hl], a +.next + + call .NextDigit +.ones + ld a, "0" + add b + ld [hli], a + pop de + dec de + pop bc + ret + +.PrintDigit: +; Divide by the current decimal place. +; Print the quotient, and keep the modulus. + ld c, 0 +.loop + ld a, [hPowerOf10] + ld b, a + ld a, [hNumToPrint] + ld [hSavedNumToPrint], a + cp b + jr c, .underflow0 + sub b + ld [hNumToPrint], a + ld a, [hPowerOf10 + 1] + ld b, a + ld a, [hNumToPrint + 1] + ld [hSavedNumToPrint + 1], a + cp b + jr nc, .noborrow1 + + ld a, [hNumToPrint] + or 0 + jr z, .underflow1 + dec a + ld [hNumToPrint], a + ld a, [hNumToPrint + 1] +.noborrow1 + + sub b + ld [hNumToPrint + 1], a + ld a, [hPowerOf10 + 2] + ld b, a + ld a, [hNumToPrint + 2] + ld [hSavedNumToPrint + 2], a + cp b + jr nc, .noborrow2 + + ld a, [hNumToPrint + 1] + and a + jr nz, .borrowed + + ld a, [hNumToPrint] + and a + jr z, .underflow2 + dec a + ld [hNumToPrint], a + xor a +.borrowed + + dec a + ld [hNumToPrint + 1], a + ld a, [hNumToPrint + 2] +.noborrow2 + sub b + ld [hNumToPrint + 2], a + inc c + jr .loop + +.underflow2 + ld a, [hSavedNumToPrint + 1] + ld [hNumToPrint + 1], a +.underflow1 + ld a, [hSavedNumToPrint] + ld [hNumToPrint], a +.underflow0 + ld a, [hPastLeadingZeros] + or c + jr z, .PrintLeadingZero + + ld a, "0" + add c + ld [hl], a + ld [hPastLeadingZeros], a + ret + +.PrintLeadingZero: + bit BIT_LEADING_ZEROES, d + ret z + ld [hl], "0" + ret + +.NextDigit: +; Increment unless the number is left-aligned, +; leading zeroes are not printed, and no digits +; have been printed yet. + bit BIT_LEADING_ZEROES, d + jr nz, .inc + bit BIT_LEFT_ALIGN, d + jr z, .inc + ld a, [hPastLeadingZeros] + and a + ret z +.inc + inc hl + ret diff --git a/home/trainers.asm b/home/trainers.asm new file mode 100644 index 00000000..9c3519a2 --- /dev/null +++ b/home/trainers.asm @@ -0,0 +1,436 @@ +; stores hl in [wTrainerHeaderPtr] +StoreTrainerHeaderPointer:: + ld a, h + ld [wTrainerHeaderPtr], a + ld a, l + ld [wTrainerHeaderPtr+1], a + ret + +; executes the current map script from the function pointer array provided in hl. +; a: map script index to execute (unless overridden by [wd733] bit 4) +ExecuteCurMapScriptInTable:: + push af + push de + call StoreTrainerHeaderPointer + pop hl + pop af + push hl + ld hl, wFlags_D733 + bit 4, [hl] + res 4, [hl] + jr z, .useProvidedIndex ; test if map script index was overridden manually + ld a, [wCurMapScript] +.useProvidedIndex + pop hl + ld [wCurMapScript], a + call CallFunctionInTable + ld a, [wCurMapScript] + ret + +LoadGymLeaderAndCityName:: + push de + ld de, wGymCityName + ld bc, $11 + call CopyData ; load city name + pop hl + ld de, wGymLeaderName + ld bc, NAME_LENGTH + jp CopyData ; load gym leader name + +; reads specific information from trainer header (pointed to at wTrainerHeaderPtr) +; a: offset in header data +; 0 -> flag's bit (into wTrainerHeaderFlagBit) +; 2 -> flag's byte ptr (into hl) +; 4 -> before battle text (into hl) +; 6 -> after battle text (into hl) +; 8 -> end battle text (into hl) +ReadTrainerHeaderInfo:: + push de + push af + ld d, $0 + ld e, a + ld hl, wTrainerHeaderPtr + ld a, [hli] + ld l, [hl] + ld h, a + add hl, de + pop af + and a + jr nz, .nonZeroOffset + ld a, [hl] + ld [wTrainerHeaderFlagBit], a ; store flag's bit + jr .done +.nonZeroOffset + cp $2 + jr z, .readPointer ; read flag's byte ptr + cp $4 + jr z, .readPointer ; read before battle text + cp $6 + jr z, .readPointer ; read after battle text + cp $8 + jr z, .readPointer ; read end battle text + cp $a + jr nz, .done + ld a, [hli] ; read end battle text (2) but override the result afterwards (XXX why, bug?) + ld d, [hl] + ld e, a + jr .done +.readPointer + ld a, [hli] + ld h, [hl] + ld l, a +.done + pop de + ret + +TrainerFlagAction:: + predef_jump FlagActionPredef + +TalkToTrainer:: + call StoreTrainerHeaderPointer + xor a + call ReadTrainerHeaderInfo ; read flag's bit + ld a, $2 + call ReadTrainerHeaderInfo ; read flag's byte ptr + ld a, [wTrainerHeaderFlagBit] + ld c, a + ld b, FLAG_TEST + call TrainerFlagAction ; read trainer's flag + ld a, c + and a + jr z, .trainerNotYetFought ; test trainer's flag + ld a, $6 + call ReadTrainerHeaderInfo ; print after battle text + jp PrintText +.trainerNotYetFought + ld a, $4 + call ReadTrainerHeaderInfo ; print before battle text + call PrintText + ld a, $a + call ReadTrainerHeaderInfo ; (?) does nothing apparently (maybe bug in ReadTrainerHeaderInfo) + push de + ld a, $8 + call ReadTrainerHeaderInfo ; read end battle text + pop de + call SaveEndBattleTextPointers + ld hl, wFlags_D733 + set 4, [hl] ; activate map script index override (index is set below) + ld hl, wFlags_0xcd60 + bit 0, [hl] ; test if player is already engaging the trainer (because the trainer saw the player) + ret nz +; if the player talked to the trainer of his own volition + call EngageMapTrainer + ld hl, wCurMapScript + inc [hl] ; increment map script index before StartTrainerBattle increments it again (next script function is usually EndTrainerBattle) + jp StartTrainerBattle + +; checks if any trainers are seeing the player and wanting to fight +CheckFightingMapTrainers:: + call CheckForEngagingTrainers + ld a, [wSpriteIndex] + cp $ff + jr nz, .trainerEngaging + xor a + ld [wSpriteIndex], a + ld [wTrainerHeaderFlagBit], a + ret +.trainerEngaging + ld hl, wFlags_D733 + set 3, [hl] + ld [wEmotionBubbleSpriteIndex], a + xor a ; EXCLAMATION_BUBBLE + ld [wWhichEmotionBubble], a + predef EmotionBubble + ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN + ld [wJoyIgnore], a + xor a + ld [hJoyHeld], a + call TrainerWalkUpToPlayer_Bank0 + ld hl, wCurMapScript + inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle) + ret + +; display the before battle text after the enemy trainer has walked up to the player's sprite +DisplayEnemyTrainerTextAndStartBattle:: + ld a, [wd730] + and $1 + ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite + ld [wJoyIgnore], a + ld a, [wSpriteIndex] + ld [hSpriteIndexOrTextID], a + call DisplayTextID + ; fall through + +StartTrainerBattle:: + xor a + ld [wJoyIgnore], a + call InitBattleEnemyParameters + ld hl, wd72d + set 6, [hl] + set 7, [hl] + ld hl, wd72e + set 1, [hl] + ld hl, wCurMapScript + inc [hl] ; increment map script index (next script function is usually EndTrainerBattle) + ret + +EndTrainerBattle:: + ld hl, wCurrentMapScriptFlags + set 5, [hl] + set 6, [hl] + ld hl, wd72d + res 7, [hl] + ld hl, wFlags_0xcd60 + res 0, [hl] ; player is no longer engaged by any trainer + ld a, [wIsInBattle] + cp $ff + jp z, ResetButtonPressedAndMapScript + ld a, $2 + call ReadTrainerHeaderInfo + ld a, [wTrainerHeaderFlagBit] + ld c, a + ld b, FLAG_SET + call TrainerFlagAction ; flag trainer as fought + ld a, [wEnemyMonOrTrainerClass] + cp OPP_ID_OFFSET + jr nc, .skipRemoveSprite ; test if trainer was fought (in that case skip removing the corresponding sprite) + ld hl, wMissableObjectList + ld de, $2 + ld a, [wSpriteIndex] + call IsInArray ; search for sprite ID + inc hl + ld a, [hl] + ld [wMissableObjectIndex], a ; load corresponding missable object index and remove it + predef HideObject +.skipRemoveSprite + ld hl, wd730 + bit 4, [hl] + res 4, [hl] + ret nz + +ResetButtonPressedAndMapScript:: + xor a + ld [wJoyIgnore], a + ld [hJoyHeld], a + ld [hJoyPressed], a + ld [hJoyReleased], a + ld [wCurMapScript], a ; reset battle status + ret + +; calls TrainerWalkUpToPlayer +TrainerWalkUpToPlayer_Bank0:: + jpba TrainerWalkUpToPlayer + +; sets opponent type and mon set/lvl based on the engaging trainer data +InitBattleEnemyParameters:: + ld a, [wEngagedTrainerClass] + ld [wCurOpponent], a + ld [wEnemyMonOrTrainerClass], a + cp OPP_ID_OFFSET + ld a, [wEngagedTrainerSet] + jr c, .noTrainer + ld [wTrainerNo], a + ret +.noTrainer + ld [wCurEnemyLVL], a + ret + +GetSpritePosition1:: + ld hl, _GetSpritePosition1 + jr SpritePositionBankswitch + +GetSpritePosition2:: + ld hl, _GetSpritePosition2 + jr SpritePositionBankswitch + +SetSpritePosition1:: + ld hl, _SetSpritePosition1 + jr SpritePositionBankswitch + +SetSpritePosition2:: + ld hl, _SetSpritePosition2 +SpritePositionBankswitch:: + ld b, BANK(_GetSpritePosition1) ; BANK(_GetSpritePosition2), BANK(_SetSpritePosition1), BANK(_SetSpritePosition2) + jp Bankswitch ; indirect jump to one of the four functions + +CheckForEngagingTrainers:: + xor a + call ReadTrainerHeaderInfo ; read trainer flag's bit (unused) + ld d, h ; store trainer header address in de + ld e, l +.trainerLoop + call StoreTrainerHeaderPointer ; set trainer header pointer to current trainer + ld a, [de] + ld [wSpriteIndex], a ; store trainer flag's bit + ld [wTrainerHeaderFlagBit], a + cp $ff + ret z + ld a, $2 + call ReadTrainerHeaderInfo ; read trainer flag's byte ptr + ld b, FLAG_TEST + ld a, [wTrainerHeaderFlagBit] + ld c, a + call TrainerFlagAction ; read trainer flag + ld a, c + and a ; has the trainer already been defeated? + jr nz, .continue + push hl + push de + push hl + xor a + call ReadTrainerHeaderInfo ; get trainer header pointer + inc hl + ld a, [hl] ; read trainer engage distance + pop hl + ld [wTrainerEngageDistance], a + ld a, [wSpriteIndex] + swap a + ld [wTrainerSpriteOffset], a + predef TrainerEngage + pop de + pop hl + ld a, [wTrainerSpriteOffset] + and a + ret nz ; break if the trainer is engaging +.continue + ld hl, $c + add hl, de + ld d, h + ld e, l + jr .trainerLoop + +; hl = text if the player wins +; de = text if the player loses +SaveEndBattleTextPointers:: + ld a, [hLoadedROMBank] + ld [wEndBattleTextRomBank], a + ld a, h + ld [wEndBattleWinTextPointer], a + ld a, l + ld [wEndBattleWinTextPointer + 1], a + ld a, d + ld [wEndBattleLoseTextPointer], a + ld a, e + ld [wEndBattleLoseTextPointer + 1], a + ret + +; loads data of some trainer on the current map and plays pre-battle music +; [wSpriteIndex]: sprite ID of trainer who is engaged +EngageMapTrainer:: + ld hl, wMapSpriteExtraData + ld d, $0 + ld a, [wSpriteIndex] + dec a + add a + ld e, a + add hl, de ; seek to engaged trainer data + ld a, [hli] ; load trainer class + ld [wEngagedTrainerClass], a + ld a, [hl] ; load trainer mon set + ld [wEngagedTrainerSet], a + jp PlayTrainerMusic + +PrintEndBattleText:: + push hl + ld hl, wd72d + bit 7, [hl] + res 7, [hl] + pop hl + ret z + ld a, [hLoadedROMBank] + push af + ld a, [wEndBattleTextRomBank] + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + push hl + callba SaveTrainerName + ld hl, TrainerEndBattleText + call PrintText + pop hl + pop af + ld [hLoadedROMBank], a + ld [MBC1RomBank], a + callba FreezeEnemyTrainerSprite + jp WaitForSoundToFinish + +GetSavedEndBattleTextPointer:: + ld a, [wBattleResult] + and a +; won battle + jr nz, .lostBattle + ld a, [wEndBattleWinTextPointer] + ld h, a + ld a, [wEndBattleWinTextPointer + 1] + ld l, a + ret +.lostBattle + ld a, [wEndBattleLoseTextPointer] + ld h, a + ld a, [wEndBattleLoseTextPointer + 1] + ld l, a + ret + +TrainerEndBattleText:: + TX_FAR _TrainerNameText + TX_ASM + call GetSavedEndBattleTextPointer + call TextCommandProcessor + jp TextScriptEnd + +; only engage with the trainer if the player is not already +; engaged with another trainer +; XXX unused? +CheckIfAlreadyEngaged:: + ld a, [wFlags_0xcd60] + bit 0, a + ret nz + call EngageMapTrainer + xor a + ret + +PlayTrainerMusic:: + ld a, [wEngagedTrainerClass] + cp OPP_SONY1 + ret z + cp OPP_SONY2 + ret z + cp OPP_SONY3 + ret z + ld a, [wGymLeaderNo] + and a + ret nz + xor a + ld [wAudioFadeOutControl], a + ld a, SFX_STOP_ALL_MUSIC + call PlaySound + ld a, BANK(Music_MeetEvilTrainer) + ld [wAudioROMBank], a + ld [wAudioSavedROMBank], a + ld a, [wEngagedTrainerClass] + ld b, a + ld hl, EvilTrainerList +.evilTrainerListLoop + ld a, [hli] + cp $ff + jr z, .noEvilTrainer + cp b + jr nz, .evilTrainerListLoop + ld a, MUSIC_MEET_EVIL_TRAINER + jr .PlaySound +.noEvilTrainer + ld hl, FemaleTrainerList +.femaleTrainerListLoop + ld a, [hli] + cp $ff + jr z, .maleTrainer + cp b + jr nz, .femaleTrainerListLoop + ld a, MUSIC_MEET_FEMALE_TRAINER + jr .PlaySound +.maleTrainer + ld a, MUSIC_MEET_MALE_TRAINER +.PlaySound + ld [wNewSoundID], a + jp PlaySound + +INCLUDE "data/trainers/encounter_types.asm" diff --git a/home/uncompress.asm b/home/uncompress.asm new file mode 100644 index 00000000..02683db7 --- /dev/null +++ b/home/uncompress.asm @@ -0,0 +1,196 @@ +; uncompresses the front or back sprite of the specified mon +; assumes the corresponding mon header is already loaded +; hl contains offset to sprite pointer ($b for front or $d for back) +UncompressMonSprite:: + ld bc, wMonHeader + add hl, bc + ld a, [hli] + ld [wSpriteInputPtr], a ; fetch sprite input pointer + ld a, [hl] + ld [wSpriteInputPtr+1], a +; define (by index number) the bank that a pokemon's image is in +; index = Mew, bank 1 +; index = Kabutops fossil, bank $B +; index < $1F, bank 9 +; $1F ≤ index < $4A, bank $A +; $4A ≤ index < $74, bank $B +; $74 ≤ index < $99, bank $C +; $99 ≤ index, bank $D + ld a, [wcf91] ; XXX name for this ram location + ld b, a + cp MEW + ld a, BANK(MewPicFront) + jr z, .GotBank + ld a, b + cp FOSSIL_KABUTOPS + ld a, BANK(FossilKabutopsPic) + jr z, .GotBank + ld a, b + cp TANGELA + 1 + ld a, BANK(TangelaPicFront) + jr c, .GotBank + ld a, b + cp MOLTRES + 1 + ld a, BANK(MoltresPicFront) + jr c, .GotBank + ld a, b + cp BEEDRILL + 2 + ld a, BANK(BeedrillPicFront) + jr c, .GotBank + ld a, b + cp STARMIE + 1 + ld a, BANK(StarmiePicFront) + jr c, .GotBank + ld a, BANK(VictreebelPicFront) +.GotBank + jp UncompressSpriteData + +; de: destination location +LoadMonFrontSprite:: + push de + ld hl, wMonHFrontSprite - wMonHeader + call UncompressMonSprite + ld hl, wMonHSpriteDim + ld a, [hli] + ld c, a + pop de + ; fall through + +; postprocesses uncompressed sprite chunks to a 2bpp sprite and loads it into video ram +; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers +; de: destination location +; a,c: sprite dimensions (in tiles of 8x8 each) +LoadUncompressedSpriteData:: + push de + and $f + ld [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width + ld b, a + ld a, $7 + sub b ; 7-w + inc a ; 8-w + srl a ; (8-w)/2 ; horizontal center (in tiles, rounded up) + ld b, a + add a + add a + add a + sub b ; 7*((8-w)/2) ; skip for horizontal center (in tiles) + ld [hSpriteOffset], a + ld a, c + swap a + and $f + ld b, a + add a + add a + add a ; 8*tiles is height in bytes + ld [hSpriteHeight], a + ld a, $7 + sub b ; 7-h ; skip for vertical center (in tiles, relative to current column) + ld b, a + ld a, [hSpriteOffset] + add b ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles) + add a + add a + add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) + ld [hSpriteOffset], a + xor a + ld [$4000], a + ld hl, sSpriteBuffer0 + call ZeroSpriteBuffer ; zero buffer 0 + ld de, sSpriteBuffer1 + ld hl, sSpriteBuffer0 + call AlignSpriteDataCentered ; copy and align buffer 1 to 0 (containing the MSB of the 2bpp sprite) + ld hl, sSpriteBuffer1 + call ZeroSpriteBuffer ; zero buffer 1 + ld de, sSpriteBuffer2 + ld hl, sSpriteBuffer1 + call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) + pop de + jp InterlaceMergeSpriteBuffers + +; copies and aligns the sprite data properly inside the sprite buffer +; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area +AlignSpriteDataCentered:: + ld a, [hSpriteOffset] + ld b, $0 + ld c, a + add hl, bc + ld a, [hSpriteWidth] +.columnLoop + push af + push hl + ld a, [hSpriteHeight] + ld c, a +.columnInnerLoop + ld a, [de] + inc de + ld [hli], a + dec c + jr nz, .columnInnerLoop + pop hl + ld bc, 7*8 ; 7 tiles + add hl, bc ; advance one full column + pop af + dec a + jr nz, .columnLoop + ret + +; fills the sprite buffer (pointed to in hl) with zeros +ZeroSpriteBuffer:: + ld bc, SPRITEBUFFERSIZE +.nextByteLoop + xor a + ld [hli], a + dec bc + ld a, b + or c + jr nz, .nextByteLoop + ret + +; combines the (7*7 tiles, 1bpp) sprite chunks in buffer 0 and 1 into a 2bpp sprite located in buffer 1 through 2 +; in the resulting sprite, the rows of the two source sprites are interlaced +; de: output address +InterlaceMergeSpriteBuffers:: + xor a + ld [$4000], a + push de + ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 + ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 + ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0 + ld a, SPRITEBUFFERSIZE/2 ; $c4 + ld [hSpriteInterlaceCounter], a +.interlaceLoop + ld a, [de] + dec de + ld [hld], a ; write byte of source 2 + ld a, [bc] + dec bc + ld [hld], a ; write byte of source 1 + ld a, [de] + dec de + ld [hld], a ; write byte of source 2 + ld a, [bc] + dec bc + ld [hld], a ; write byte of source 1 + ld a, [hSpriteInterlaceCounter] + dec a + ld [hSpriteInterlaceCounter], a + jr nz, .interlaceLoop + ld a, [wSpriteFlipped] + and a + jr z, .notFlipped + ld bc, 2*SPRITEBUFFERSIZE + ld hl, sSpriteBuffer1 +.swapLoop + swap [hl] ; if flipped swap nybbles in all bytes + inc hl + dec bc + ld a, b + or c + jr nz, .swapLoop +.notFlipped + pop hl + ld de, sSpriteBuffer1 + ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied + ld a, [hLoadedROMBank] + ld b, a + jp CopyVideoData diff --git a/home/yes_no.asm b/home/yes_no.asm new file mode 100644 index 00000000..61aa1390 --- /dev/null +++ b/home/yes_no.asm @@ -0,0 +1,40 @@ +; displays yes/no choice +; yes -> set carry +YesNoChoice:: + call SaveScreenTilesToBuffer1 + call InitYesNoTextBoxParameters + jr DisplayYesNoChoice + +Func_35f4:: + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a + call InitYesNoTextBoxParameters + jp DisplayTextBoxID + +InitYesNoTextBoxParameters:: + xor a ; YES_NO_MENU + ld [wTwoOptionMenuID], a + coord hl, 14, 7 + ld bc, $80f + ret + +YesNoChoicePokeCenter:: + call SaveScreenTilesToBuffer1 + ld a, HEAL_CANCEL_MENU + ld [wTwoOptionMenuID], a + coord hl, 11, 6 + lb bc, 8, 12 + jr DisplayYesNoChoice + +WideYesNoChoice:: ; unused + call SaveScreenTilesToBuffer1 + ld a, WIDE_YES_NO_MENU + ld [wTwoOptionMenuID], a + coord hl, 12, 7 + lb bc, 8, 13 + +DisplayYesNoChoice:: + ld a, TWO_OPTION_MENU + ld [wTextBoxID], a + call DisplayTextBoxID + jp LoadScreenTilesFromBuffer1 diff --git a/macros/predef.asm b/macros/predef.asm index fda42004..d86582d1 100644 --- a/macros/predef.asm +++ b/macros/predef.asm @@ -1,13 +1,3 @@ -predef_const: MACRO - const \1PredefID -ENDM - -add_predef: MACRO -\1Predef:: - db BANK(\1) - dw \1 -ENDM - predef_id: MACRO ld a, (\1Predef - PredefPointers) / 3 ENDM @@ -22,17 +12,6 @@ predef_jump: MACRO jp Predef ENDM -tx_pre_const: MACRO - const \1_id -ENDM - -add_tx_pre: MACRO -\1_id:: dw \1 -ENDM - -db_tx_pre: MACRO - db (\1_id - TextPredefs) / 2 + 1 -ENDM tx_pre_id: MACRO ld a, (\1_id - TextPredefs) / 2 + 1 @@ -47,3 +26,7 @@ tx_pre_jump: MACRO tx_pre_id \1 jp PrintPredefTextID ENDM + +db_tx_pre: MACRO + db (\1_id - TextPredefs) / 2 + 1 +ENDM -- cgit v1.3.1-sl0p From e4e0af4d6713161d46cc0a1d580645ca40d6fa81 Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 4 Jul 2020 01:00:45 -0400 Subject: Remove remaining raw $xxxx values, and replace "+ -1" with "- 1" (supported by rgbds 0.4.0) --- constants/hardware_constants.asm | 13 +++++ constants/move_constants.asm | 2 +- constants/pokedex_constants.asm | 2 +- constants/pokemon_constants.asm | 2 +- data/moves/effects_pointers.asm | 14 +++--- engine/battle/animations.asm | 6 +-- engine/battle/core.asm | 12 ++--- engine/battle/trainer_ai.asm | 2 +- engine/events/diploma.asm | 2 +- engine/events/prize_menu.asm | 4 +- engine/menus/display_text_id_init.asm | 4 +- engine/menus/save.asm | 4 +- engine/menus/start_sub_menus.asm | 10 ++-- engine/movie/title.asm | 2 +- engine/overworld/map_sprites.asm | 3 +- engine/overworld/wild_mons.asm | 6 +-- engine/pokemon/status_screen.asm | 4 +- engine/slots/slot_machine.asm | 2 +- home/init.asm | 12 ++--- home/list_menu.asm | 2 +- home/names2.asm | 2 +- home/overworld.asm | 12 ++--- home/pics.asm | 4 +- home/predef_text.asm | 2 +- macros/scripts/events.asm | 12 ++--- macros/wram.asm | 92 ++++++++++++++++++++++++++++++++++ scripts/OaksLab.asm | 2 +- scripts/VermilionDock.asm | 2 +- wram.asm | 94 ++--------------------------------- 29 files changed, 172 insertions(+), 158 deletions(-) create mode 100644 macros/wram.asm (limited to 'data/moves') diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 59ec6170..993a02f5 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -2,6 +2,19 @@ GBC EQU $11 +; memory map +VRAM_Begin EQU $8000 +VRAM_End EQU $a000 +SRAM_Begin EQU $a000 +SRAM_End EQU $c000 +WRAM0_Begin EQU $c000 +WRAM0_End EQU $d000 +WRAM1_Begin EQU $d000 +WRAM1_End EQU $e000 +; hardware registers $ff00-$ff80 (see below) +HRAM_Begin EQU $ff80 +HRAM_End EQU $ffff + ; MBC1 MBC1SRamEnable EQU $0000 MBC1RomBank EQU $2000 diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 850662de..5dd06a41 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -165,7 +165,7 @@ const SLASH ; a3 const SUBSTITUTE ; a4 -NUM_ATTACKS EQU const_value + -1 +NUM_ATTACKS EQU const_value - 1 const STRUGGLE ; a5 diff --git a/constants/pokedex_constants.asm b/constants/pokedex_constants.asm index c8605852..e462586e 100644 --- a/constants/pokedex_constants.asm +++ b/constants/pokedex_constants.asm @@ -151,4 +151,4 @@ const DEX_MEWTWO ; 150 const DEX_MEW ; 151 -NUM_POKEMON EQU const_value + -1 +NUM_POKEMON EQU const_value - 1 diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index 5484a65d..7abdd4d3 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -191,4 +191,4 @@ const WEEPINBELL ; $BD const VICTREEBEL ; $BE -NUM_POKEMON_INDEXES EQU const_value + -1 +NUM_POKEMON_INDEXES EQU const_value - 1 diff --git a/data/moves/effects_pointers.asm b/data/moves/effects_pointers.asm index 0d36e887..02f6e5c6 100644 --- a/data/moves/effects_pointers.asm +++ b/data/moves/effects_pointers.asm @@ -7,7 +7,7 @@ MoveEffectPointerTable: dw FreezeBurnParalyzeEffect ; PARALYZE_SIDE_EFFECT1 dw ExplodeEffect ; EXPLODE_EFFECT dw DrainHPEffect ; DREAM_EATER_EFFECT - dw $0000 ; MIRROR_MOVE_EFFECT + dw NULL ; MIRROR_MOVE_EFFECT dw StatModifierUpEffect ; ATTACK_UP1_EFFECT dw StatModifierUpEffect ; DEFENSE_UP1_EFFECT dw StatModifierUpEffect ; SPEED_UP1_EFFECT @@ -15,7 +15,7 @@ MoveEffectPointerTable: dw StatModifierUpEffect ; ACCURACY_UP1_EFFECT dw StatModifierUpEffect ; EVASION_UP1_EFFECT dw PayDayEffect ; PAY_DAY_EFFECT - dw $0000 ; SWIFT_EFFECT + dw NULL ; SWIFT_EFFECT dw StatModifierDownEffect ; ATTACK_DOWN1_EFFECT dw StatModifierDownEffect ; DEFENSE_DOWN1_EFFECT dw StatModifierDownEffect ; SPEED_DOWN1_EFFECT @@ -38,12 +38,12 @@ MoveEffectPointerTable: dw FlinchSideEffect ; FLINCH_SIDE_EFFECT2 dw OneHitKOEffect ; OHKO_EFFECT dw ChargeEffect ; CHARGE_EFFECT - dw $0000 ; SUPER_FANG_EFFECT - dw $0000 ; SPECIAL_DAMAGE_EFFECT + dw NULL ; SUPER_FANG_EFFECT + dw NULL ; SPECIAL_DAMAGE_EFFECT dw TrappingEffect ; TRAPPING_EFFECT dw ChargeEffect ; FLY_EFFECT dw TwoToFiveAttacksEffect ; ATTACK_TWICE_EFFECT - dw $0000 ; JUMP_KICK_EFFECT + dw NULL ; JUMP_KICK_EFFECT dw MistEffect ; MIST_EFFECT dw FocusEnergyEffect ; FOCUS_ENERGY_EFFECT dw RecoilEffect ; RECOIL_EFFECT @@ -76,12 +76,12 @@ MoveEffectPointerTable: dw StatModifierDownEffect ; unused effect dw ConfusionSideEffect ; CONFUSION_SIDE_EFFECT dw TwoToFiveAttacksEffect ; TWINEEDLE_EFFECT - dw $0000 ; unused effect + dw NULL ; unused effect dw SubstituteEffect ; SUBSTITUTE_EFFECT dw HyperBeamEffect ; HYPER_BEAM_EFFECT dw RageEffect ; RAGE_EFFECT dw MimicEffect ; MIMIC_EFFECT - dw $0000 ; METRONOME_EFFECT + dw NULL ; METRONOME_EFFECT dw LeechSeedEffect ; LEECH_SEED_EFFECT dw SplashEffect ; SPLASH_EFFECT dw DisableEffect ; DISABLE_EFFECT diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index d858e066..ee476ce9 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -1735,7 +1735,7 @@ AnimationSlideMonDownAndHide: jr nz, .loop call AnimationHideMonPic ld hl, wTempPic - ld bc, $0310 + ld bc, $310 xor a call FillMemory jp CopyTempPicToMonPic @@ -1896,7 +1896,7 @@ AnimationSubstitute: ; Changes the pokemon's sprite to the mini sprite ld hl, wTempPic xor a - ld bc, $0310 + ld bc, $310 call FillMemory ld a, [hWhoseTurn] and a @@ -1932,7 +1932,7 @@ AnimationSubstitute: jp AnimationShowMonPic CopySlowbroSpriteData: - ld bc, $0010 + ld bc, $10 ld a, BANK(SlowbroSprite) jp FarCopyData2 diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 00852b2b..6881aef5 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -582,7 +582,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP: ld a, [de] ; increment toxic counter inc a ld [de], a - ld hl, $0000 + ld hl, 0 .toxicTicksLoop add hl, bc dec a @@ -5345,8 +5345,8 @@ MoveHitTest: ret z ; Swift never misses (interestingly, Azure Heights lists this is a myth, but it appears to be true) call CheckTargetSubstitute ; substitute check (note that this overwrites a) jr z, .checkForDigOrFlyStatus -; this code is buggy. it's supposed to prevent HP draining moves from working on substitutes. -; since $7b79 overwrites a with either $00 or $01, it never works. +; This code is buggy. It's supposed to prevent HP draining moves from working on substitutes. +; Since CheckTargetSubstitute overwrites a with either $00 or $01, it never works. cp DRAIN_HP_EFFECT jp z, .moveMissed cp DREAM_EATER_EFFECT @@ -6335,9 +6335,9 @@ LoadPlayerBackPic: ld de, vBackPic call InterlaceMergeSpriteBuffers ld a, $a - ld [$0], a + ld [MBC1SRamEnable], a xor a - ld [$4000], a + ld [MBC1SRamBank], a ld hl, vSprites ld de, sSpriteBuffer1 ld a, [hLoadedROMBank] @@ -6345,7 +6345,7 @@ LoadPlayerBackPic: ld c, 7 * 7 call CopyVideoData xor a - ld [$0], a + ld [MBC1SRamEnable], a ld a, $31 ld [hStartTileID], a coord hl, 1, 5 diff --git a/engine/battle/trainer_ai.asm b/engine/battle/trainer_ai.asm index 2178be38..d61b44f8 100644 --- a/engine/battle/trainer_ai.asm +++ b/engine/battle/trainer_ai.asm @@ -134,7 +134,7 @@ AIMoveChoiceModification1: push de push bc ld hl, StatusAilmentMoveEffects - ld de, $0001 + ld de, 1 call IsInArray pop bc pop de diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index 24bd2f22..53d78e57 100755 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -9,7 +9,7 @@ DisplayDiploma:: call DisableLCD ld hl, CircleTile ld de, vChars2 + $700 - ld bc, $0010 + ld bc, $10 ld a, BANK(CircleTile) call FarCopyData2 coord hl, 0, 0 diff --git a/engine/events/prize_menu.asm b/engine/events/prize_menu.asm index aa86f828..5a00a89e 100755 --- a/engine/events/prize_menu.asm +++ b/engine/events/prize_menu.asm @@ -131,10 +131,8 @@ GetPrizeMenuId: coord hl, 13, 5 ; reg. c: ; [low nybble] number of bytes -; [bit 765 = %100] space-padding (not zero-padding) +; [bits 765 = %100] space-padding (not zero-padding) ld c, (1 << 7 | 2) -; Function $15CD displays BCD value (same routine -; used by text-command $02) call PrintBCDNumber ld de, wPrize2Price coord hl, 13, 7 diff --git a/engine/menus/display_text_id_init.asm b/engine/menus/display_text_id_init.asm index e1f6c678..45c76f9c 100644 --- a/engine/menus/display_text_id_init.asm +++ b/engine/menus/display_text_id_init.asm @@ -43,7 +43,7 @@ DisplayTextIDInit:: ; the original direction they were facing must be restored after the dialogue is over ld hl, wSpriteStateData1 + $19 ld c, $0f - ld de, $0010 + ld de, $10 .spriteFacingDirectionCopyLoop ld a, [hl] inc h @@ -55,7 +55,7 @@ DisplayTextIDInit:: ; loop to force all the sprites in the middle of animation to stand still ; (so that they don't like they're frozen mid-step during the dialogue) ld hl, wSpriteStateData1 + 2 - ld de, $0010 + ld de, $10 ld c, e .spriteStandStillLoop ld a, [hl] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index f2ecc3aa..ee73c850 100755 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -702,7 +702,7 @@ ClearSAV: PadSRAM_FF: ld [MBC1SRamBank], a - ld hl, $a000 ; start of SRAM - ld bc, $2000 ; size of SRAM + ld hl, SRAM_Begin + ld bc, SRAM_End - SRAM_Begin ld a, $ff jp FillMemory diff --git a/engine/menus/start_sub_menus.asm b/engine/menus/start_sub_menus.asm index 43c767e2..526540df 100755 --- a/engine/menus/start_sub_menus.asm +++ b/engine/menus/start_sub_menus.asm @@ -491,12 +491,12 @@ DrawTrainerInfo: call CopyData ld hl, TrainerInfoTextBoxTileGraphics ; trainer info text box tile patterns ld de, vChars2 + $770 - ld bc, $0080 + ld bc, $80 push bc call TrainerInfo_FarCopyData ld hl, BlankLeaderNames ld de, vChars2 + $600 - ld bc, $0170 + ld bc, $170 call TrainerInfo_FarCopyData pop bc ld hl, BadgeNumbersTileGraphics ; badge number tile patterns @@ -504,14 +504,14 @@ DrawTrainerInfo: call TrainerInfo_FarCopyData ld hl, GymLeaderFaceAndBadgeTileGraphics ; gym leader face and badge tile patterns ld de, vChars2 + $200 - ld bc, $0400 + ld bc, $400 ld a, $03 call FarCopyData2 ld hl, TextBoxGraphics - ld de, $00d0 + ld de, $d0 add hl, de ; hl = colon tile pattern ld de, vChars1 + $560 - ld bc, $0010 + ld bc, $10 ld a, $04 push bc call FarCopyData2 diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 1a2d16a0..9cbe5494 100755 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -317,7 +317,7 @@ DrawPlayerCharacter: xor a ld [wPlayerCharacterOAMTile], a ld hl, wOAMBuffer - ld de, $605a + lb de, $60, $5a ld b, 7 .loop push de diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index eb8edb10..904e9b04 100755 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -133,8 +133,7 @@ LoadMapSpriteTilePatterns: jr nc, .fourTileSpriteVRAMAddr ld d, a dec d -; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM -; slot and adding the result to $8000 (the VRAM base address). +; vSprites += [hVRAMSlot] * $C0 (the number of bytes in 12 tiles) .calculateVRAMAddrLoop add hl, bc dec d diff --git a/engine/overworld/wild_mons.asm b/engine/overworld/wild_mons.asm index 24dc7681..2593e0ec 100644 --- a/engine/overworld/wild_mons.asm +++ b/engine/overworld/wild_mons.asm @@ -16,10 +16,10 @@ LoadWildData:: jr z, .NoGrassData ; if no grass data, skip to surfing data push hl ld de, wGrassMons ; otherwise, load grass data - ld bc, $0014 + ld bc, $14 call CopyData pop hl - ld bc, $0014 + ld bc, $14 add hl, bc .NoGrassData ld a, [hli] @@ -27,7 +27,7 @@ LoadWildData:: and a ret z ; if no water data, we're done ld de, wWaterMons ; otherwise, load surfing data - ld bc, $0014 + ld bc, $14 jp CopyData INCLUDE "data/wild/grass_water.asm" diff --git a/engine/pokemon/status_screen.asm b/engine/pokemon/status_screen.asm index f66cdf5a..b262a8b7 100755 --- a/engine/pokemon/status_screen.asm +++ b/engine/pokemon/status_screen.asm @@ -254,7 +254,7 @@ PrintStatsBox: ld c, 8 call TextBoxBorder ; Draws the box coord hl, 1, 9 ; Start printing stats from here - ld bc, $0019 ; Number offset + ld bc, $19 ; Number offset jr .PrintStats .DifferentBox coord hl, 9, 2 @@ -262,7 +262,7 @@ PrintStatsBox: ld c, 9 call TextBoxBorder coord hl, 11, 3 - ld bc, $0018 + ld bc, $18 .PrintStats push bc push hl diff --git a/engine/slots/slot_machine.asm b/engine/slots/slot_machine.asm index 16696713..c3de5dd2 100755 --- a/engine/slots/slot_machine.asm +++ b/engine/slots/slot_machine.asm @@ -31,7 +31,7 @@ PromptUserToPlaySlots: xor a ld [wSlotMachineAllowMatchesCounter], a ld hl, wStoppingWhichSlotMachineWheel - ld bc, $0014 + ld bc, $14 call FillMemory call MainSlotMachineLoop ld hl, wd730 diff --git a/home/init.asm b/home/init.asm index 48294fa6..83238bad 100644 --- a/home/init.asm +++ b/home/init.asm @@ -41,8 +41,8 @@ rLCDC_DEFAULT EQU %11100011 ld sp, wStack - ld hl, $c000 ; start of WRAM - ld bc, $2000 ; size of WRAM + ld hl, WRAM0_Begin + ld bc, WRAM1_End - WRAM0_Begin .loop ld [hl], 0 inc hl @@ -53,8 +53,8 @@ rLCDC_DEFAULT EQU %11100011 call ClearVram - ld hl, $ff80 ; start of HRAM - ld bc, $ffff - $ff80 ; size of HRAM + ld hl, HRAM_Begin + ld bc, HRAM_End - HRAM_Begin call FillMemory call ClearSprites @@ -119,8 +119,8 @@ rLCDC_DEFAULT EQU %11100011 jp SetDefaultNamesBeforeTitlescreen ClearVram:: - ld hl, $8000 - ld bc, $2000 + ld hl, VRAM_Begin + ld bc, VRAM_End - VRAM_Begin xor a jp FillMemory diff --git a/home/list_menu.asm b/home/list_menu.asm index 68335ed5..4ce973b2 100644 --- a/home/list_menu.asm +++ b/home/list_menu.asm @@ -454,7 +454,7 @@ PrintListMenuEntries:: ld [wLoadedMonLevel], a .skipCopyingLevel pop hl - ld bc, $001c + ld bc, $1c add hl, bc call PrintLevel pop af diff --git a/home/names2.asm b/home/names2.asm index 178a0780..319febd3 100644 --- a/home/names2.asm +++ b/home/names2.asm @@ -77,7 +77,7 @@ GetName:: ld h, d ld l, e ld de, wcd6d - ld bc, $0014 + ld bc, $14 call CopyData .gotPtr ld a, e diff --git a/home/overworld.asm b/home/overworld.asm index c959beb6..79e4ea97 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1424,18 +1424,18 @@ LoadCurrentMapView:: dec b jr nz, .rowLoop ld hl, wTileMapBackup - ld bc, $0000 + ld bc, $0 .adjustForYCoordWithinTileBlock ld a, [wYBlockCoord] and a jr z, .adjustForXCoordWithinTileBlock - ld bc, $0030 + ld bc, $30 add hl, bc .adjustForXCoordWithinTileBlock ld a, [wXBlockCoord] and a jr z, .copyToVisibleAreaBuffer - ld bc, $0002 + ld bc, $2 add hl, bc .copyToVisibleAreaBuffer coord de, 0, 0 ; base address for the tiles that are directly transferred to VRAM during V-blank @@ -1739,7 +1739,7 @@ ScheduleSouthRowRedraw:: ld l, a ld a, [wMapViewVRAMPointer + 1] ld h, a - ld bc, $0200 + ld bc, $200 add hl, bc ld a, h and $03 @@ -1835,7 +1835,7 @@ DrawTileBlock:: ld a, [de] ld [hl], a inc de - ld bc, $0015 + ld bc, $15 add hl, bc pop bc dec c @@ -2180,7 +2180,7 @@ LoadMapHeader:: jr nz, .zeroSpriteDataLoop ; initialize all C100-C1FF sprite entries to disabled (other than player's) ld hl, wSpriteStateData1 + $12 - ld de, $0010 + ld de, $10 ld c, $0f .disableSpriteEntriesLoop ld [hl], $ff diff --git a/home/pics.asm b/home/pics.asm index 02683db7..c6d99cbb 100644 --- a/home/pics.asm +++ b/home/pics.asm @@ -93,7 +93,7 @@ LoadUncompressedSpriteData:: add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes) ld [hSpriteOffset], a xor a - ld [$4000], a + ld [MBC1SRamBank], a ld hl, sSpriteBuffer0 call ZeroSpriteBuffer ; zero buffer 0 ld de, sSpriteBuffer1 @@ -151,7 +151,7 @@ ZeroSpriteBuffer:: ; de: output address InterlaceMergeSpriteBuffers:: xor a - ld [$4000], a + ld [MBC1SRamBank], a push de ld hl, sSpriteBuffer2 + (SPRITEBUFFERSIZE - 1) ; destination: end of buffer 2 ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1 diff --git a/home/predef_text.asm b/home/predef_text.asm index 24001c24..059e23ab 100644 --- a/home/predef_text.asm +++ b/home/predef_text.asm @@ -119,7 +119,7 @@ CloseTextDisplay:: ; loop to make sprites face the directions they originally faced before the dialogue ld hl, wSpriteStateData2 + $19 ld c, $0f - ld de, $0010 + ld de, $10 .restoreSpriteFacingDirectionLoop ld a, [hl] dec h diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index 9be354e3..c5f90107 100755 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -183,7 +183,7 @@ ENDM ;\3, \4, ... = additional (optional) event indices SetEvents: MACRO SetEvent \1 - rept (_NARG + -1) + rept _NARG - 1 SetEventReuseHL \2 shift endr @@ -235,7 +235,7 @@ ENDM ;\3 = event index (optional) ResetEvents: MACRO ResetEvent \1 - rept (_NARG + -1) + rept _NARG - 1 ResetEventReuseHL \2 shift endr @@ -283,7 +283,7 @@ event_fill_start = event_start_byte + 1 event_fill_count = event_end_byte - event_start_byte - 1 IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 +event_fill_start = event_fill_start - 1 event_fill_count = event_fill_count + 1 ELSE ld a, [wEventFlags + event_start_byte] @@ -304,7 +304,7 @@ event_fill_count = event_fill_count + 1 ld a, $ff ld hl, wEventFlags + event_fill_start - REPT event_fill_count + -1 + REPT event_fill_count - 1 ld [hli], a ENDR @@ -345,7 +345,7 @@ event_fill_start = event_start_byte + 1 event_fill_count = event_end_byte - event_start_byte - 1 IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 +event_fill_start = event_fill_start - 1 event_fill_count = event_fill_count + 1 ELSE ld a, [wEventFlags + event_start_byte] @@ -370,7 +370,7 @@ event_fill_count = event_fill_count + 1 xor a ENDC - REPT event_fill_count + -1 + REPT event_fill_count - 1 ld [hli], a ENDR diff --git a/macros/wram.asm b/macros/wram.asm new file mode 100644 index 00000000..7a9b4a6a --- /dev/null +++ b/macros/wram.asm @@ -0,0 +1,92 @@ +; Used in wram.asm + +flag_array: MACRO + ds ((\1) + 7) / 8 +ENDM + +BOX_STRUCT_LENGTH EQU 25 + NUM_MOVES * 2 + +box_struct: MACRO +\1Species:: db +\1HP:: dw +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1OTID:: dw +\1Exp:: ds 3 +\1HPExp:: dw +\1AttackExp:: dw +\1DefenseExp:: dw +\1SpeedExp:: dw +\1SpecialExp:: dw +\1DVs:: ds 2 +\1PP:: ds NUM_MOVES +ENDM + +party_struct: MACRO + box_struct \1 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +ENDM + +battle_struct: MACRO +\1Species:: db +\1HP:: dw +\1PartyPos:: +\1BoxLevel:: db +\1Status:: db +\1Type:: +\1Type1:: db +\1Type2:: db +\1CatchRate:: db +\1Moves:: ds NUM_MOVES +\1DVs:: ds 2 +\1Level:: db +\1Stats:: +\1MaxHP:: dw +\1Attack:: dw +\1Defense:: dw +\1Speed:: dw +\1Special:: dw +\1PP:: ds NUM_MOVES +ENDM + +spritestatedata1: MACRO +\1PictureID:: db +\1MovementStatus:: db +\1ImageIndex:: db +\1YStepVector:: db +\1YPixels:: db +\1XStepVector:: db +\1XPixels:: db +\1IntraAnimFrameCounter:: db +\1AnimFrameCounter:: db +\1FacingDirection:: db + ds 6 +\1End:: +ENDM + +spritestatedata2: MACRO +\1WalkAnimationCounter:: db + ds 1 +\1YDisplacement:: db +\1XDisplacement:: db +\1MapY:: db +\1MapX:: db +\1MovementByte1:: db +\1GrassPriority:: db +\1MovementDelay:: db + ds 5 +\1ImageBaseOffset:: db + ds 1 +\1End:: +ENDM diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 9bb84923..b3347849 100755 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -652,7 +652,7 @@ OaksLabScript18: OaksLabScript_RemoveParcel: ld hl, wBagItems - ld bc, $0000 + ld bc, 0 .loop ld a, [hli] cp $ff diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 4b0cf439..90fef6b2 100755 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -78,7 +78,7 @@ VermilionDock_1db9b: ld d, $0 ld e, $8 .asm_1dbfa - ld hl, $0002 + ld hl, $2 add hl, bc ld a, l ld [wMapViewVRAMPointer], a diff --git a/wram.asm b/wram.asm index 9c37b3db..e2fa05a6 100755 --- a/wram.asm +++ b/wram.asm @@ -1,63 +1,6 @@ INCLUDE "constants.asm" -flag_array: MACRO - ds ((\1) + 7) / 8 -ENDM - -box_struct_length EQU 25 + NUM_MOVES * 2 -box_struct: MACRO -\1Species:: db -\1HP:: dw -\1BoxLevel:: db -\1Status:: db -\1Type:: -\1Type1:: db -\1Type2:: db -\1CatchRate:: db -\1Moves:: ds NUM_MOVES -\1OTID:: dw -\1Exp:: ds 3 -\1HPExp:: dw -\1AttackExp:: dw -\1DefenseExp:: dw -\1SpeedExp:: dw -\1SpecialExp:: dw -\1DVs:: ds 2 -\1PP:: ds NUM_MOVES -ENDM - -party_struct: MACRO - box_struct \1 -\1Level:: db -\1Stats:: -\1MaxHP:: dw -\1Attack:: dw -\1Defense:: dw -\1Speed:: dw -\1Special:: dw -ENDM - -battle_struct: MACRO -\1Species:: db -\1HP:: dw -\1PartyPos:: -\1BoxLevel:: db -\1Status:: db -\1Type:: -\1Type1:: db -\1Type2:: db -\1CatchRate:: db -\1Moves:: ds NUM_MOVES -\1DVs:: ds 2 -\1Level:: db -\1Stats:: -\1MaxHP:: dw -\1Attack:: dw -\1Defense:: dw -\1Speed:: dw -\1Special:: dw -\1PP:: ds NUM_MOVES -ENDM +INCLUDE "macros/wram.asm" SECTION "WRAM Bank 0", WRAM0 @@ -228,21 +171,6 @@ wSpriteStateData1:: ; C1xD ; C1xE ; C1xF -spritestatedata1: MACRO -\1PictureID:: db -\1MovementStatus:: db -\1ImageIndex:: db -\1YStepVector:: db -\1YPixels:: db -\1XStepVector:: db -\1XPixels:: db -\1IntraAnimFrameCounter:: db -\1AnimFrameCounter:: db -\1FacingDirection:: db - ds 6 -\1End:: -endm - wSpritePlayerStateData1:: spritestatedata1 wSpritePlayerStateData1 wSprite01StateData1:: spritestatedata1 wSprite01StateData1 wSprite02StateData1:: spritestatedata1 wSprite02StateData1 @@ -280,22 +208,6 @@ wSpriteStateData2:: ; C2xD ; C2xE: sprite image base offset (in video ram, player always has value 1, used to compute c1x2) ; C2xF -spritestatedata2: MACRO -\1WalkAnimationCounter:: db - ds 1 -\1YDisplacement:: db -\1XDisplacement:: db -\1MapY:: db -\1MapX:: db -\1MovementByte1:: db -\1GrassPriority:: db -\1MovementDelay:: db - ds 5 -\1ImageBaseOffset:: db - ds 1 -\1End:: -endm - wSpritePlayerStateData2:: spritestatedata2 wSpritePlayerStateData2 wSprite01StateData2:: spritestatedata2 wSprite01StateData2 wSprite02StateData2:: spritestatedata2 wSprite02StateData2 @@ -1050,7 +962,7 @@ wOptionsCancelCursorX:: ds 1 wDayCarePerLevelCost:: -; 2-byte BCD number (always set to $0100) +; 2-byte BCD number (always set to $100) wHoFTeamIndex2:: @@ -3185,7 +3097,7 @@ wBoxSpecies:: ds MONS_PER_BOX + 1 wBoxMons:: wBoxMon1:: box_struct wBoxMon1 -wBoxMon2:: ds box_struct_length * (MONS_PER_BOX + -1) +wBoxMon2:: ds BOX_STRUCT_LENGTH * (MONS_PER_BOX - 1) wBoxMonOT:: ds NAME_LENGTH * MONS_PER_BOX wBoxMonNicks:: ds NAME_LENGTH * MONS_PER_BOX -- cgit v1.3.1-sl0p