From a1db9b9b938163f09af46ba62163503e63daeafd Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Fri, 30 Jun 2017 16:35:14 -0700 Subject: [PATCH] Move vertical screen transition logic into engine/pinball_game/vertical_screen_transition.asm --- data/stage_base_gfx.asm | 307 +++++++++++ .../vertical_screen_transition.asm | 173 +++++++ main.asm | 481 +----------------- 3 files changed, 481 insertions(+), 480 deletions(-) create mode 100755 data/stage_base_gfx.asm create mode 100755 engine/pinball_game/vertical_screen_transition.asm diff --git a/data/stage_base_gfx.asm b/data/stage_base_gfx.asm new file mode 100755 index 0000000..41f18bd --- /dev/null +++ b/data/stage_base_gfx.asm @@ -0,0 +1,307 @@ +StageGfxPointers_GameBoy: ; 0xe6f7 + dw StageRedFieldTopGfx_GameBoy + dw StageRedFieldBottomGfx_GameBoy + dw VideoData_e896 + dw VideoData_e8bd + dw StageBlueFieldTopGfx_GameBoy + dw StageBlueFieldBottomGfx_GameBoy + dw StageGengarBonusGfx_GameBoy + dw StageGengarBonusGfx_GameBoy + dw StageMewtwoBonusGfx_GameBoy + dw StageMewtwoBonusGfx_GameBoy + dw StageMeowthBonusGfx_GameBoy + dw StageMeowthBonusGfx_GameBoy + dw StageDiglettBonusGfx_GameBoy + dw StageDiglettBonusGfx_GameBoy + dw StageSeelBonusGfx_GameBoy + dw StageSeelBonusGfx_GameBoy + +StageGfxPointers_GameBoyColor: ; 0xe717 + dw StageRedFieldTopGfx_GameBoyColor + dw StageRedFieldBottomGfx_GameBoyColor + dw VideoData_e8a6 + dw VideoData_e8d4 + dw StageBlueFieldTopGfx_GameBoyColor + dw StageBlueFieldBottomGfx_GameBoyColor + dw StageGengarBonusGfx_GameBoyColor + dw StageGengarBonusGfx_GameBoyColor + dw StageMewtwoBonusGfx_GameBoyColor + dw StageMewtwoBonusGfx_GameBoyColor + dw StageMeowthBonusGfx_GameBoyColor + dw StageMeowthBonusGfx_GameBoyColor + dw StageDiglettBonusGfx_GameBoyColor + dw StageDiglettBonusGfx_GameBoyColor + dw StageSeelBonusGfx_GameBoyColor + dw StageSeelBonusGfx_GameBoyColor + +StageRedFieldTopGfx_GameBoy: ; 0xe737 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageRedFieldTopGfx1, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 + VIDEO_DATA_TILES StageRedFieldTopGfx2, vTilesOB + $600, $200 + VIDEO_DATA_TILES StageRedFieldTopStatusBarSymbolsGfx_GameBoy, vTilesSH, $100 + VIDEO_DATA_TILES StageRedFieldTopGfx3, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES StageRedFieldTopBaseGameBoyGfx, vTilesSH + $2a0, $d60 + VIDEO_DATA_TILEMAP StageRedFieldTopTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageRedFieldTopGfx_GameBoyColor: ; 0xe771 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageRedFieldTopGfx1, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 + VIDEO_DATA_TILES StageRedFieldTopGfx2, vTilesOB + $600, $200 + VIDEO_DATA_TILES StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor, vTilesSH, $100 + VIDEO_DATA_TILES StageRedFieldTopGfx3, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES StageRedFieldTopBaseGameBoyColorGfx, vTilesSH + $2a0, $d60 + VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx4, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx5, vTilesOB, $200 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx, vTilesOB + $200, $400 + VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx2, vTilesSH + $100, $200 + VIDEO_DATA_TILES_BANK2 StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor, vTilesSH, $100 + VIDEO_DATA_TILEMAP StageRedFieldTopTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 StageRedFieldTopTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES StageRedFieldTopPalettes, $80 + VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx6, vTilesOB + $7c0, $40 + db $FF, $FF ; terminators + +StageRedFieldBottomGfx_GameBoy: ; 0xe7ea + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 + VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 + VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 + VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 + VIDEO_DATA_TILES StageRedFieldBottomBaseGameBoyGfx, vTilesSH, $1000 + VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 + VIDEO_DATA_TILEMAP StageRedFieldBottomTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageRedFieldBottomGfx_GameBoyColor: ; 0xe824 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 + VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 + VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 + VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 + VIDEO_DATA_TILES StageRedFieldBottomBaseGameBoyColorGfx, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 StageRedFieldBottomGfx5, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 + VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx, vTilesOB + $200, $400 + VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx2, vTilesSH + $100, $200 + VIDEO_DATA_TILES_BANK2 StageRedFieldBottomBaseGameBoyColorGfx, vTilesSH, $100 + VIDEO_DATA_TILEMAP StageRedFieldBottomTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 StageRedFieldBottomTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES StageRedFieldBottomPalettes, $80 + VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx6, vTilesOB + $7c0, $40 + db $FF, $FF ; terminators + +VideoData_e896: ; 0xe896 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 + db $FF, $FF ; terminators + +VideoData_e8a6: ; 0xe8a6 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + db $FF, $FF ; terminators + +VideoData_e8bd: ; 0xe8bd + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES PinballPokeballShakeGfx, vTilesOB + $380, $480 + VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 + db $FF, $FF ; terminators + +VideoData_e8d4: ; 0xe8d4 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES PinballPokeballShakeGfx, vTilesOB + $380, $480 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 + db $FF, $FF ; terminators + +StageBlueFieldTopGfx_GameBoy: ; 0xe8f2 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageBlueFieldTopGfx1, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 + VIDEO_DATA_TILES StageBlueFieldTopGfx2, vTilesOB + $600, $200 + VIDEO_DATA_TILES StageBlueFieldTopStatusBarSymbolsGfx_GameBoy, vTilesSH, $100 + VIDEO_DATA_TILES StageBlueFieldTopGfx3, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES StageBlueFieldTopBaseGameBoyGfx, vTilesSH + $2a0, $d60 + VIDEO_DATA_TILEMAP StageBlueFieldTopTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageBlueFieldTopGfx_GameBoyColor: ; 0xe92c + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageBlueFieldTopGfx1, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 + VIDEO_DATA_TILES StageBlueFieldTopGfx2, vTilesOB + $600, $200 + VIDEO_DATA_TILES StageBlueFieldTopStatusBarSymbolsGfx_GameBoyColor, vTilesSH, $100 + VIDEO_DATA_TILES StageBlueFieldTopGfx3, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES StageBlueFieldTopBaseGameBoyColorGfx, vTilesSH + $2a0, $d60 + VIDEO_DATA_TILES_BANK2 StageBlueFieldTopGfx4, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILEMAP StageBlueFieldTopTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 StageBlueFieldTopTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES StageBlueFieldTopPalettes, $80 + db $FF, $FF ; terminators + +StageBlueFieldBottomGfx_GameBoy: ; 0xe982 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 + VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 + VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 + VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 + VIDEO_DATA_TILES StageBlueFieldBottomBaseGameBoyGfx, vTilesSH, $1000 + VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 + VIDEO_DATA_TILEMAP StageBlueFieldBottomTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageBlueFieldBottomGfx_GameBoyColor: ; 0xe9bc + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 + VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 + VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 + VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 + VIDEO_DATA_TILES StageBlueFieldBottomBaseGameBoyColorGfx, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 StageBlueFieldBottomGfx1, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 + VIDEO_DATA_TILEMAP StageBlueFieldBottomTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 StageBlueFieldBottomTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES StageBlueFieldBottomPalettes, $80 + db $FF, $FF ; terminators + +StageGengarBonusGfx_GameBoy: ; 0xea12 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES GengarBonusBaseGameBoyGfx, vTilesSH, $1000 + VIDEO_DATA_TILES GengarBonusGastlyGfx, vTilesSH + $100, $180 + VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $180, Bank(GengarBonusHaunterGfx), vTilesSH + $280, $20 + VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $1a0, Bank(GengarBonusHaunterGfx), vTilesOB + $1a0, $100 + VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $2a0, Bank(GengarBonusGengarGfx), vTilesOB + $2a0, $160 + VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $400, Bank(GengarBonusGengarGfx), vTilesOB + $7a0, $60 + VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $460, Bank(GengarBonusGengarGfx), vTilesSH + $2a0, $2a0 + VIDEO_DATA_TILEMAP GengarBonusTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageGengarBonusGfx_GameBoyColor: ; 0xea5a + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 + VIDEO_DATA_TILES GengarBonusBaseGameBoyColorGfx, vTilesSH, $1000 + VIDEO_DATA_TILES GengarBonusGastlyGfx, vTilesSH + $100, $180 + VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $180, Bank(GengarBonusHaunterGfx), vTilesSH + $280, $20 + VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $1a0, Bank(GengarBonusHaunterGfx), vTilesOB + $1a0, $100 + VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $2a0, Bank(GengarBonusGengarGfx), vTilesOB + $2a0, $160 + VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $400, Bank(GengarBonusGengarGfx), vTilesOB + $7a0, $60 + VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $460, Bank(GengarBonusGengarGfx), vTilesSH + $2a0, $2a0 + VIDEO_DATA_TILES_BANK2 GengarBonus1Gfx, vTilesSH, $1000 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILEMAP GengarBonusBottomTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 GengarBonusBottomTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES GengarBonusPalettes, $80 + db $FF, $FF ; terminators + +StageMewtwoBonusGfx_GameBoy: ; 0xeabe + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES MewtwoBonus1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES MewtwoBonus2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES MewtwoBonusBaseGameBoyGfx, vTilesSH, $1000 + VIDEO_DATA_TILES MewtwoBonus3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES MewtwoBonus4Gfx, vTilesSH + $2a0, $2a0 + VIDEO_DATA_TILEMAP MewtwoBonusTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageMewtwoBonusGfx_GameBoyColor: ; 0xeaf8 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES MewtwoBonus1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES MewtwoBonus2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES MewtwoBonusBaseGameBoyColorGfx, vTilesSH, $1000 + VIDEO_DATA_TILES MewtwoBonus3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES MewtwoBonus4Gfx, vTilesSH + $2a0, $2a0 + ; Can't use a macro here because it's copying the tiles from VRAM, not ROM. + dw vTilesOB + db $20 ; This is an arbitrary bank, since the data is in VRAM, not ROM. + dw vTilesSH + dw $4002 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILEMAP MewtoBonusBottomTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 MewtoBonusBottomTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES MewtwoBonusPalettes, $80 + db $FF, $FF ; terminators + +StageMeowthBonusGfx_GameBoy: ; 0xeb4e + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES MeowthBonusMeowth1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES MeowthBonusMeowth2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES MeowthBonusBaseGameBoyGfx, vTilesSH, $a00 + VIDEO_DATA_TILES MeowthBonusMeowth3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES MeowthBonusMeowth4Gfx, vTilesSH + $2a0, $360 + VIDEO_DATA_TILEMAP MeowthBonusTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageMeowthBonusGfx_GameBoyColor: ; 0xeb88 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES MeowthBonusMeowth1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES MeowthBonusMeowth2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES MeowthBonusBaseGameBoyColorGfx, vTilesSH, $900 + VIDEO_DATA_TILES MeowthBonusMeowth3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES MeowthBonusMeowth4Gfx, vTilesSH + $2a0, $360 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILEMAP MeowthBonusTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 MeowthBonusTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES MeowthBonusPalettes, $80 + db $FF, $FF ; terminators + +StageDiglettBonusGfx_GameBoy: ; 0xebd7 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES DiglettBonusDugtrio1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES DiglettBonusDugtrio2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES DiglettBonusBaseGameBoyGfx, vTilesSH, $e00 ; $e00 is actually $100 too many bytes. Should only be $d00. This accidentally loads palette data after the tile graphics. + VIDEO_DATA_TILES DiglettBonusDugtrio3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES DiglettBonusDugtrio4Gfx, vTilesSH + $2a0, $280 + VIDEO_DATA_TILEMAP DiglettBonusTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageDiglettBonusGfx_GameBoyColor: ; 0xec11 + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES DiglettBonusDugtrio1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES DiglettBonusDugtrio2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES DiglettBonusBaseGameBoyColorGfx, vTilesSH, $e00 + VIDEO_DATA_TILES DiglettBonusDugtrio3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES DiglettBonusDugtrio4Gfx, vTilesSH + $2a0, $280 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILEMAP DiglettBonusTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 DiglettBonusTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES DiglettBonusPalettes, $80 + db $FF, $FF ; terminators + +StageSeelBonusGfx_GameBoy: ; 0xec60 + VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES SeelBonusSeel1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES SeelBonusSeel2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES SeelBonusBaseGameBoyGfx, vTilesSH, $d00 ; $d00 is actually $100 too many bytes. Should only be $c00. This accidentally loads palette data after the tile graphics. + VIDEO_DATA_TILES SeelBonusSeel3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES SeelBonusSeel4Gfx, vTilesSH + $2a0, $4a0 + VIDEO_DATA_TILEMAP SeelBonusTilemap_GameBoy, vBGMap, $400 + db $FF, $FF ; terminators + +StageSeelBonusGfx_GameBoyColor: ; 0xec9a + VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 + VIDEO_DATA_TILES SeelBonusSeel1Gfx, vTilesOB + $1a0, $260 + VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 + VIDEO_DATA_TILES SeelBonusSeel2Gfx, vTilesOB + $7a0, $60 + VIDEO_DATA_TILES SeelBonusBaseGameBoyColorGfx, vTilesSH, $b00 ; Should actually be $a00 bytes, not $b00 + VIDEO_DATA_TILES SeelBonusSeel3Gfx, vTilesSH + $100, $1a0 + VIDEO_DATA_TILES SeelBonusSeel4Gfx, vTilesSH + $2a0, $4a0 + VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 + VIDEO_DATA_TILEMAP SeelBonusTilemap_GameBoyColor, vBGMap, $400 + VIDEO_DATA_TILEMAP_BANK2 SeelBonusTilemap2_GameBoyColor, vBGMap, $400 + VIDEO_DATA_PALETTES SeelBonusPalettes, $80 + db $FF, $FF ; terminators diff --git a/engine/pinball_game/vertical_screen_transition.asm b/engine/pinball_game/vertical_screen_transition.asm new file mode 100755 index 0000000..81203d5 --- /dev/null +++ b/engine/pinball_game/vertical_screen_transition.asm @@ -0,0 +1,173 @@ +FieldVerticalTransition: ; 0xe674 + push af + ld a, [wd548] + push af + xor a + ld [wd548], a + ld [wd803], a + callba DrawSpritesForStage + call CleanOAMBuffer + pop af + ld [wd548], a + pop af + ld [wCurrentStage], a + xor a + ld [hBGP], a + ld [hOBP0], a + ld [hOBP1], a + rst AdvanceFrame + call Func_e5d + call Func_576 + call ClearOAMBuffer + call Func_1129 + call LoadStageCollisionAttributes + call LoadStageData + call Func_e5d + call Func_588 + ld a, $e4 + ld [hBGP], a + ld a, $e1 + ld [hOBP0], a + ld a, $e4 + ld [hOBP1], a + ret + +LoadStageData: ; 0xe6c2 +; Loads all stage data, such as graphics, collision attributes, etc. + ld a, [wCurrentStage] + bit 0, a + ld a, $86 + jr z, .asm_e6d5 + ld a, [wd5ca] + and a + ld a, $86 + jr nz, .asm_e6d5 + ld a, $90 +.asm_e6d5 + ld [hWY], a + ld hl, StageGfxPointers_GameBoy + ld a, [hGameBoyColorFlag] + and a + jr z, .loadData + ld hl, StageGfxPointers_GameBoyColor +.loadData + ld a, [wCurrentStage] + call LoadVideoData + xor a + ld [wd7f2], a + callba _LoadStageData + ret + +INCLUDE "data/stage_base_gfx.asm" + +CheckStageTransition: ; 0xece9 + call Func_ed5e + ld a, [wBallYPos + 1] + add $10 + cp $18 + jr c, .moving_up + cp $b8 + ret c + ld a, [wCurrentStage] + ld c, a + ld b, $0 + ld hl, BallMovingDownStageTransitions + add hl, bc + ld a, [hl] + cp $ff + jr z, .youLose + call FieldVerticalTransition + ld a, [wBallYPos + 1] + sub $88 + ld [wBallYPos + 1], a + ret + +.moving_up + ld a, [wCurrentStage] + ld c, a + ld b, $0 + ld hl, BallMovingUpStageTransitions + add hl, bc + ld a, [hl] + cp $ff + jr z, .youLose + call FieldVerticalTransition + ld a, [wBallYPos + 1] + add $88 + ld [wBallYPos + 1], a + ret + +.youLose + ld a, $1 + ld [wd4ae], a + callba HandleBallLoss + ret + +BallMovingUpStageTransitions: ; 0xed3e +; Maps the relationship between stages when +; the ball moves out of the screen upward. + db $FF ; STAGE_RED_FIELD_TOP + db STAGE_RED_FIELD_TOP ; STAGE_RED_FIELD_BOTTOM + db $FF + db $02 + db $FF ; STAGE_BLUE_FIELD_TOP + db STAGE_BLUE_FIELD_TOP ; STAGE_BLUE_FIELD_BOTTOM + db $FF ; STAGE_GENGAR_BONUS + db $FF ; STAGE_GENGAR_BONUS + db $FF ; STAGE_MEWTWO_BONUS + db $FF ; STAGE_MEWTWO_BONUS + db $FF ; STAGE_MEOWTH_BONUS + db $FF ; STAGE_MEOWTH_BONUS + db $FF ; STAGE_DIGLETT_BONUS + db $FF ; STAGE_DIGLETT_BONUS + db $FF ; STAGE_SEEL_BONUS + db $FF ; STAGE_SEEL_BONUS + +BallMovingDownStageTransitions: ; 0xed4e +; Maps the relationship between stages when +; the ball moves out of the screen downward. + db STAGE_RED_FIELD_BOTTOM ; STAGE_RED_FIELD_TOP + db $FF ; STAGE_RED_FIELD_BOTTOM + db $03 + db $FF + db STAGE_BLUE_FIELD_BOTTOM ; STAGE_BLUE_FIELD_TOP + db $FF ; STAGE_BLUE_FIELD_BOTTOM + db $FF ; STAGE_GENGAR_BONUS + db $FF ; STAGE_GENGAR_BONUS + db $FF ; STAGE_MEWTWO_BONUS + db $FF ; STAGE_MEWTWO_BONUS + db $FF ; STAGE_MEOWTH_BONUS + db $FF ; STAGE_MEOWTH_BONUS + db $FF ; STAGE_DIGLETT_BONUS + db $FF ; STAGE_DIGLETT_BONUS + db $FF ; STAGE_SEEL_BONUS + db $FF ; STAGE_SEEL_BONUS + +Func_ed5e: ; 0xed5e + ld hl, wSCX + ld a, [wd7ac] + and a + jr nz, .modify_scx_and_scy + ld a, [wBallXPos + 1] + cp $9a + ld a, 2 + jr nc, .okay1 + ld a, -2 +.okay1 + ld [wd7aa], a + add [hl] + cp $22 + jr z, .modify_scx_and_scy + bit 7, a + jr nz, .modify_scx_and_scy + ld [hl], a +.modify_scx_and_scy + ld a, [hl] + ld hl, wd79f + sub [hl] + ld [hSCX], a + xor a + ld hl, wd7a0 + sub [hl] + ld [hSCY], a + ret diff --git a/main.asm b/main.asm index 6d19f29..2af2e26 100755 --- a/main.asm +++ b/main.asm @@ -1898,486 +1898,7 @@ INCLUDE "engine/pinball_game/ball_loss/ball_loss_diglett_bonus.asm" INCLUDE "engine/pinball_game/ball_loss/ball_loss_seel_bonus.asm" INCLUDE "engine/pinball_game/flippers.asm" INCLUDE "engine/pinball_game/stage_collision_attributes.asm" - -FieldVerticalTransition: ; 0xe674 - push af - ld a, [wd548] - push af - xor a - ld [wd548], a - ld [wd803], a - callba DrawSpritesForStage - call CleanOAMBuffer - pop af - ld [wd548], a - pop af - ld [wCurrentStage], a - xor a - ld [hBGP], a - ld [hOBP0], a - ld [hOBP1], a - rst AdvanceFrame - call Func_e5d - call Func_576 - call ClearOAMBuffer - call Func_1129 - call LoadStageCollisionAttributes - call LoadStageData - call Func_e5d - call Func_588 - ld a, $e4 - ld [hBGP], a - ld a, $e1 - ld [hOBP0], a - ld a, $e4 - ld [hOBP1], a - ret - -LoadStageData: ; 0xe6c2 -; Loads all stage data, such as graphics, collision attributes, etc. - ld a, [wCurrentStage] - bit 0, a - ld a, $86 - jr z, .asm_e6d5 - ld a, [wd5ca] - and a - ld a, $86 - jr nz, .asm_e6d5 - ld a, $90 -.asm_e6d5 - ld [hWY], a - ld hl, StageGfxPointers_GameBoy - ld a, [hGameBoyColorFlag] - and a - jr z, .loadData - ld hl, StageGfxPointers_GameBoyColor -.loadData - ld a, [wCurrentStage] - call LoadVideoData - xor a - ld [wd7f2], a - callba _LoadStageData - ret - -StageGfxPointers_GameBoy: ; 0xe6f7 - dw StageRedFieldTopGfx_GameBoy - dw StageRedFieldBottomGfx_GameBoy - dw VideoData_e896 - dw VideoData_e8bd - dw StageBlueFieldTopGfx_GameBoy - dw StageBlueFieldBottomGfx_GameBoy - dw StageGengarBonusGfx_GameBoy - dw StageGengarBonusGfx_GameBoy - dw StageMewtwoBonusGfx_GameBoy - dw StageMewtwoBonusGfx_GameBoy - dw StageMeowthBonusGfx_GameBoy - dw StageMeowthBonusGfx_GameBoy - dw StageDiglettBonusGfx_GameBoy - dw StageDiglettBonusGfx_GameBoy - dw StageSeelBonusGfx_GameBoy - dw StageSeelBonusGfx_GameBoy - -StageGfxPointers_GameBoyColor: ; 0xe717 - dw StageRedFieldTopGfx_GameBoyColor - dw StageRedFieldBottomGfx_GameBoyColor - dw VideoData_e8a6 - dw VideoData_e8d4 - dw StageBlueFieldTopGfx_GameBoyColor - dw StageBlueFieldBottomGfx_GameBoyColor - dw StageGengarBonusGfx_GameBoyColor - dw StageGengarBonusGfx_GameBoyColor - dw StageMewtwoBonusGfx_GameBoyColor - dw StageMewtwoBonusGfx_GameBoyColor - dw StageMeowthBonusGfx_GameBoyColor - dw StageMeowthBonusGfx_GameBoyColor - dw StageDiglettBonusGfx_GameBoyColor - dw StageDiglettBonusGfx_GameBoyColor - dw StageSeelBonusGfx_GameBoyColor - dw StageSeelBonusGfx_GameBoyColor - -StageRedFieldTopGfx_GameBoy: ; 0xe737 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageRedFieldTopGfx1, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 - VIDEO_DATA_TILES StageRedFieldTopGfx2, vTilesOB + $600, $200 - VIDEO_DATA_TILES StageRedFieldTopStatusBarSymbolsGfx_GameBoy, vTilesSH, $100 - VIDEO_DATA_TILES StageRedFieldTopGfx3, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES StageRedFieldTopBaseGameBoyGfx, vTilesSH + $2a0, $d60 - VIDEO_DATA_TILEMAP StageRedFieldTopTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageRedFieldTopGfx_GameBoyColor: ; 0xe771 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageRedFieldTopGfx1, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 - VIDEO_DATA_TILES StageRedFieldTopGfx2, vTilesOB + $600, $200 - VIDEO_DATA_TILES StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor, vTilesSH, $100 - VIDEO_DATA_TILES StageRedFieldTopGfx3, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES StageRedFieldTopBaseGameBoyColorGfx, vTilesSH + $2a0, $d60 - VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx4, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx5, vTilesOB, $200 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx, vTilesOB + $200, $400 - VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx2, vTilesSH + $100, $200 - VIDEO_DATA_TILES_BANK2 StageRedFieldTopStatusBarSymbolsGfx_GameBoyColor, vTilesSH, $100 - VIDEO_DATA_TILEMAP StageRedFieldTopTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 StageRedFieldTopTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES StageRedFieldTopPalettes, $80 - VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx6, vTilesOB + $7c0, $40 - db $FF, $FF ; terminators - -StageRedFieldBottomGfx_GameBoy: ; 0xe7ea - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 - VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 - VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 - VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 - VIDEO_DATA_TILES StageRedFieldBottomBaseGameBoyGfx, vTilesSH, $1000 - VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 - VIDEO_DATA_TILEMAP StageRedFieldBottomTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageRedFieldBottomGfx_GameBoyColor: ; 0xe824 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 - VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 - VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 - VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 - VIDEO_DATA_TILES StageRedFieldBottomBaseGameBoyColorGfx, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 StageRedFieldBottomGfx5, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 - VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx, vTilesOB + $200, $400 - VIDEO_DATA_TILES_BANK2 StageRedJapaneseCharactersGfx2, vTilesSH + $100, $200 - VIDEO_DATA_TILES_BANK2 StageRedFieldBottomBaseGameBoyColorGfx, vTilesSH, $100 - VIDEO_DATA_TILEMAP StageRedFieldBottomTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 StageRedFieldBottomTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES StageRedFieldBottomPalettes, $80 - VIDEO_DATA_TILES_BANK2 StageRedFieldTopGfx6, vTilesOB + $7c0, $40 - db $FF, $FF ; terminators - -VideoData_e896: ; 0xe896 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 - db $FF, $FF ; terminators - -VideoData_e8a6: ; 0xe8a6 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - db $FF, $FF ; terminators - -VideoData_e8bd: ; 0xe8bd - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES PinballPokeballShakeGfx, vTilesOB + $380, $480 - VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 - db $FF, $FF ; terminators - -VideoData_e8d4: ; 0xe8d4 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES PinballPokeballShakeGfx, vTilesOB + $380, $480 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 - db $FF, $FF ; terminators - -StageBlueFieldTopGfx_GameBoy: ; 0xe8f2 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageBlueFieldTopGfx1, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 - VIDEO_DATA_TILES StageBlueFieldTopGfx2, vTilesOB + $600, $200 - VIDEO_DATA_TILES StageBlueFieldTopStatusBarSymbolsGfx_GameBoy, vTilesSH, $100 - VIDEO_DATA_TILES StageBlueFieldTopGfx3, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES StageBlueFieldTopBaseGameBoyGfx, vTilesSH + $2a0, $d60 - VIDEO_DATA_TILEMAP StageBlueFieldTopTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageBlueFieldTopGfx_GameBoyColor: ; 0xe92c - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageBlueFieldTopGfx1, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $200 - VIDEO_DATA_TILES StageBlueFieldTopGfx2, vTilesOB + $600, $200 - VIDEO_DATA_TILES StageBlueFieldTopStatusBarSymbolsGfx_GameBoyColor, vTilesSH, $100 - VIDEO_DATA_TILES StageBlueFieldTopGfx3, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES StageBlueFieldTopBaseGameBoyColorGfx, vTilesSH + $2a0, $d60 - VIDEO_DATA_TILES_BANK2 StageBlueFieldTopGfx4, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILEMAP StageBlueFieldTopTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 StageBlueFieldTopTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES StageBlueFieldTopPalettes, $80 - db $FF, $FF ; terminators - -StageBlueFieldBottomGfx_GameBoy: ; 0xe982 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 - VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 - VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 - VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 - VIDEO_DATA_TILES StageBlueFieldBottomBaseGameBoyGfx, vTilesSH, $1000 - VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 - VIDEO_DATA_TILEMAP StageBlueFieldBottomTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageBlueFieldBottomGfx_GameBoyColor: ; 0xe9bc - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageSharedBonusSlotGlowGfx, vTilesOB + $1a0, $160 - VIDEO_DATA_TILES StageSharedArrowsGfx, vTilesOB + $300, $80 - VIDEO_DATA_TILES StageSharedBonusSlotGlow2Gfx, vTilesOB + $380, $20 - VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 - VIDEO_DATA_TILES StageBlueFieldBottomBaseGameBoyColorGfx, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 StageBlueFieldBottomGfx1, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILES SaverTextOffGfx, vTilesSH + $2a0, $40 - VIDEO_DATA_TILEMAP StageBlueFieldBottomTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 StageBlueFieldBottomTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES StageBlueFieldBottomPalettes, $80 - db $FF, $FF ; terminators - -StageGengarBonusGfx_GameBoy: ; 0xea12 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES GengarBonusBaseGameBoyGfx, vTilesSH, $1000 - VIDEO_DATA_TILES GengarBonusGastlyGfx, vTilesSH + $100, $180 - VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $180, Bank(GengarBonusHaunterGfx), vTilesSH + $280, $20 - VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $1a0, Bank(GengarBonusHaunterGfx), vTilesOB + $1a0, $100 - VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $2a0, Bank(GengarBonusGengarGfx), vTilesOB + $2a0, $160 - VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $400, Bank(GengarBonusGengarGfx), vTilesOB + $7a0, $60 - VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $460, Bank(GengarBonusGengarGfx), vTilesSH + $2a0, $2a0 - VIDEO_DATA_TILEMAP GengarBonusTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageGengarBonusGfx_GameBoyColor: ; 0xea5a - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES StageSharedPikaBoltGfx, vTilesOB + $3c0, $440 - VIDEO_DATA_TILES GengarBonusBaseGameBoyColorGfx, vTilesSH, $1000 - VIDEO_DATA_TILES GengarBonusGastlyGfx, vTilesSH + $100, $180 - VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $180, Bank(GengarBonusHaunterGfx), vTilesSH + $280, $20 - VIDEO_DATA_TILES_BANK GengarBonusHaunterGfx + $1a0, Bank(GengarBonusHaunterGfx), vTilesOB + $1a0, $100 - VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $2a0, Bank(GengarBonusGengarGfx), vTilesOB + $2a0, $160 - VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $400, Bank(GengarBonusGengarGfx), vTilesOB + $7a0, $60 - VIDEO_DATA_TILES_BANK GengarBonusGengarGfx + $460, Bank(GengarBonusGengarGfx), vTilesSH + $2a0, $2a0 - VIDEO_DATA_TILES_BANK2 GengarBonus1Gfx, vTilesSH, $1000 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILEMAP GengarBonusBottomTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 GengarBonusBottomTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES GengarBonusPalettes, $80 - db $FF, $FF ; terminators - -StageMewtwoBonusGfx_GameBoy: ; 0xeabe - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES MewtwoBonus1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES MewtwoBonus2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES MewtwoBonusBaseGameBoyGfx, vTilesSH, $1000 - VIDEO_DATA_TILES MewtwoBonus3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES MewtwoBonus4Gfx, vTilesSH + $2a0, $2a0 - VIDEO_DATA_TILEMAP MewtwoBonusTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageMewtwoBonusGfx_GameBoyColor: ; 0xeaf8 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES MewtwoBonus1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES MewtwoBonus2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES MewtwoBonusBaseGameBoyColorGfx, vTilesSH, $1000 - VIDEO_DATA_TILES MewtwoBonus3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES MewtwoBonus4Gfx, vTilesSH + $2a0, $2a0 - ; Can't use a macro here because it's copying the tiles from VRAM, not ROM. - dw vTilesOB - db $20 ; This is an arbitrary bank, since the data is in VRAM, not ROM. - dw vTilesSH - dw $4002 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILEMAP MewtoBonusBottomTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 MewtoBonusBottomTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES MewtwoBonusPalettes, $80 - db $FF, $FF ; terminators - -StageMeowthBonusGfx_GameBoy: ; 0xeb4e - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES MeowthBonusMeowth1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES MeowthBonusMeowth2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES MeowthBonusBaseGameBoyGfx, vTilesSH, $a00 - VIDEO_DATA_TILES MeowthBonusMeowth3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES MeowthBonusMeowth4Gfx, vTilesSH + $2a0, $360 - VIDEO_DATA_TILEMAP MeowthBonusTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageMeowthBonusGfx_GameBoyColor: ; 0xeb88 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES MeowthBonusMeowth1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES MeowthBonusMeowth2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES MeowthBonusBaseGameBoyColorGfx, vTilesSH, $900 - VIDEO_DATA_TILES MeowthBonusMeowth3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES MeowthBonusMeowth4Gfx, vTilesSH + $2a0, $360 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILEMAP MeowthBonusTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 MeowthBonusTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES MeowthBonusPalettes, $80 - db $FF, $FF ; terminators - -StageDiglettBonusGfx_GameBoy: ; 0xebd7 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES DiglettBonusDugtrio1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES DiglettBonusDugtrio2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES DiglettBonusBaseGameBoyGfx, vTilesSH, $e00 ; $e00 is actually $100 too many bytes. Should only be $d00. This accidentally loads palette data after the tile graphics. - VIDEO_DATA_TILES DiglettBonusDugtrio3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES DiglettBonusDugtrio4Gfx, vTilesSH + $2a0, $280 - VIDEO_DATA_TILEMAP DiglettBonusTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageDiglettBonusGfx_GameBoyColor: ; 0xec11 - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES DiglettBonusDugtrio1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES DiglettBonusDugtrio2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES DiglettBonusBaseGameBoyColorGfx, vTilesSH, $e00 - VIDEO_DATA_TILES DiglettBonusDugtrio3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES DiglettBonusDugtrio4Gfx, vTilesSH + $2a0, $280 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILEMAP DiglettBonusTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 DiglettBonusTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES DiglettBonusPalettes, $80 - db $FF, $FF ; terminators - -StageSeelBonusGfx_GameBoy: ; 0xec60 - VIDEO_DATA_TILES Alphabet1Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES SeelBonusSeel1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES SeelBonusSeel2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES SeelBonusBaseGameBoyGfx, vTilesSH, $d00 ; $d00 is actually $100 too many bytes. Should only be $c00. This accidentally loads palette data after the tile graphics. - VIDEO_DATA_TILES SeelBonusSeel3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES SeelBonusSeel4Gfx, vTilesSH + $2a0, $4a0 - VIDEO_DATA_TILEMAP SeelBonusTilemap_GameBoy, vBGMap, $400 - db $FF, $FF ; terminators - -StageSeelBonusGfx_GameBoyColor: ; 0xec9a - VIDEO_DATA_TILES Alphabet2Gfx, vTilesOB, $1a0 - VIDEO_DATA_TILES SeelBonusSeel1Gfx, vTilesOB + $1a0, $260 - VIDEO_DATA_TILES PinballPokeballGfx, vTilesOB + $400, $320 - VIDEO_DATA_TILES SeelBonusSeel2Gfx, vTilesOB + $7a0, $60 - VIDEO_DATA_TILES SeelBonusBaseGameBoyColorGfx, vTilesSH, $b00 ; Should actually be $a00 bytes, not $b00 - VIDEO_DATA_TILES SeelBonusSeel3Gfx, vTilesSH + $100, $1a0 - VIDEO_DATA_TILES SeelBonusSeel4Gfx, vTilesSH + $2a0, $4a0 - VIDEO_DATA_TILES_BANK2 TimerDigitsGfx, vTilesOB + $600, $160 - VIDEO_DATA_TILEMAP SeelBonusTilemap_GameBoyColor, vBGMap, $400 - VIDEO_DATA_TILEMAP_BANK2 SeelBonusTilemap2_GameBoyColor, vBGMap, $400 - VIDEO_DATA_PALETTES SeelBonusPalettes, $80 - db $FF, $FF ; terminators - -CheckStageTransition: ; 0xece9 - call Func_ed5e - ld a, [wBallYPos + 1] - add $10 - cp $18 - jr c, .moving_up - cp $b8 - ret c - ld a, [wCurrentStage] - ld c, a - ld b, $0 - ld hl, BallMovingDownStageTransitions - add hl, bc - ld a, [hl] - cp $ff - jr z, .rip - call FieldVerticalTransition - ld a, [wBallYPos + 1] - sub $88 - ld [wBallYPos + 1], a - ret - -.moving_up - ld a, [wCurrentStage] - ld c, a - ld b, $0 - ld hl, BallMovingUpStageTransitions - add hl, bc - ld a, [hl] - cp $ff - jr z, .rip - call FieldVerticalTransition - ld a, [wBallYPos + 1] - add $88 - ld [wBallYPos + 1], a - ret - -.rip - ld a, $1 - ld [wd4ae], a - callba HandleBallLoss - ret - -BallMovingUpStageTransitions: ; 0xed3e -; Maps the relationship between stages when -; the ball moves out of the screen upward. - db $FF ; STAGE_RED_FIELD_TOP - db STAGE_RED_FIELD_TOP ; STAGE_RED_FIELD_BOTTOM - db $FF - db $02 - db $FF ; STAGE_BLUE_FIELD_TOP - db STAGE_BLUE_FIELD_TOP ; STAGE_BLUE_FIELD_BOTTOM - db $FF ; STAGE_GENGAR_BONUS - db $FF ; STAGE_GENGAR_BONUS - db $FF ; STAGE_MEWTWO_BONUS - db $FF ; STAGE_MEWTWO_BONUS - db $FF ; STAGE_MEOWTH_BONUS - db $FF ; STAGE_MEOWTH_BONUS - db $FF ; STAGE_DIGLETT_BONUS - db $FF ; STAGE_DIGLETT_BONUS - db $FF ; STAGE_SEEL_BONUS - db $FF ; STAGE_SEEL_BONUS - -BallMovingDownStageTransitions: ; 0xed4e -; Maps the relationship between stages when -; the ball moves out of the screen downward. - db STAGE_RED_FIELD_BOTTOM ; STAGE_RED_FIELD_TOP - db $FF ; STAGE_RED_FIELD_BOTTOM - db $03 - db $FF - db STAGE_BLUE_FIELD_BOTTOM ; STAGE_BLUE_FIELD_TOP - db $FF ; STAGE_BLUE_FIELD_BOTTOM - db $FF ; STAGE_GENGAR_BONUS - db $FF ; STAGE_GENGAR_BONUS - db $FF ; STAGE_MEWTWO_BONUS - db $FF ; STAGE_MEWTWO_BONUS - db $FF ; STAGE_MEOWTH_BONUS - db $FF ; STAGE_MEOWTH_BONUS - db $FF ; STAGE_DIGLETT_BONUS - db $FF ; STAGE_DIGLETT_BONUS - db $FF ; STAGE_SEEL_BONUS - db $FF ; STAGE_SEEL_BONUS - -Func_ed5e: ; 0xed5e - ld hl, wSCX - ld a, [wd7ac] - and a - jr nz, .modify_scx_and_scy - ld a, [wBallXPos + 1] - cp $9a - ld a, 2 - jr nc, .okay1 - ld a, -2 -.okay1 - ld [wd7aa], a - add [hl] - cp $22 - jr z, .modify_scx_and_scy - bit 7, a - jr nz, .modify_scx_and_scy - ld [hl], a -.modify_scx_and_scy - ld a, [hl] - ld hl, wd79f - sub [hl] - ld [hSCX], a - xor a - ld hl, wd7a0 - sub [hl] - ld [hSCY], a - ret +INCLUDE "engine/pinball_game/vertical_screen_transition.asm" Func_ed8e: ; 0xed8e xor a