From abc333ca813addf1e17071584a57cae1d8bda333 Mon Sep 17 00:00:00 2001 From: Capucine Meyer Date: Sat, 15 Apr 2023 20:10:39 +0200 Subject: [PATCH] omega battle works --- constants/hide_show_constants.asm | 2 +- data/maps/hide_show_data.asm | 1 + scripts/SilphCo11F.asm | 102 ++++++++++++++++++++++-------- 3 files changed, 79 insertions(+), 26 deletions(-) diff --git a/constants/hide_show_constants.asm b/constants/hide_show_constants.asm index b30ca967..a6972654 100644 --- a/constants/hide_show_constants.asm +++ b/constants/hide_show_constants.asm @@ -195,6 +195,7 @@ DEF SHOW EQU $15 const HS_SILPH_CO_11F_1 ; B7 const HS_SILPH_CO_11F_2 ; B8 const HS_SILPH_CO_11F_3 ; B9 + const HS_OMEGA const HS_UNUSED_MAP_F4_1 ; BA XXX sprite doesn't exist const HS_POKEMON_MANSION_2F_ITEM ; BB X const HS_POKEMON_MANSION_3F_ITEM_1 ; BC X @@ -240,7 +241,6 @@ DEF SHOW EQU $15 const HS_WUGTRIO ; E4 const HS_MEW ; E5 const HS_MOLTRES ; E6 - ; const HS_OMEGA ; E7 X const HS_OLD_SEA_CHART ; E8 const HS_POKEMON_MANSION_B2F_ITEM_1 ; E9 const HS_POKEMON_MANSION_B2F_ITEM_2 ; EA diff --git a/data/maps/hide_show_data.asm b/data/maps/hide_show_data.asm index 2522a700..21cb58e7 100644 --- a/data/maps/hide_show_data.asm +++ b/data/maps/hide_show_data.asm @@ -509,6 +509,7 @@ SilphCo11FHS: db SILPH_CO_11F, $03, SHOW db SILPH_CO_11F, $04, SHOW db SILPH_CO_11F, $05, SHOW + db SILPH_CO_11F, $06, SHOW BillsGardenHS: ; could be used for the dragonite boss fight, so not removing this part of UNUSED_MAP_F4 db BILLS_GARDEN, $02, SHOW CinnabarVolcanoHS: diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 285c58f7..4a790e48 100644 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -8,6 +8,16 @@ SilphCo11F_Script: ld [wSilphCo11FCurScript], a ret +SilphCo11F_ScriptPointers: + dw SilphCo11Script0 + dw DisplayEnemyTrainerTextAndStartBattle + dw EndTrainerBattle + dw SilphCo11Script3 + dw SilphCo11Script4 + dw SilphCo11Script5 + dw SilphCo11Script6 + dw SilphCo11Script7 + SilphCo11Script_62110: ld hl, wCurrentMapScriptFlags bit 5, [hl] @@ -68,23 +78,75 @@ SilphCo11Script_62163: ; This is altered to have Omega rush you once the door is and a ret z SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR - ld a, $6 ldh [hSpriteIndex], a - ld de, .OmegaMovement1 - call MoveSprite + call MoveOmegaSprite + ld a, $6 + ld [wSilphCo11FCurScript], a + ret - ld a, [wXCoord] ; compare x coord before moving - cp 6 - ld a, NPC_MOVEMENT_RIGHT - - jp OmegaText +SilphCo11Script6: + ld a, [wd730] + bit 0, a + ret nz + ld [wJoyIgnore], a + ld a, $6 + ldh [hSpriteIndexOrTextID], a + call DisplayTextID + ld a, OMEGA + ld [wCurOpponent], a + ld a, 45 + ld [wCurEnemyLVL], a + ld a, 0 + ld [wIsTrainerBattle], a + ld a, HS_OMEGA + ld [wMissableObjectIndex], a + predef HideObject + call UpdateSprites + ld a, $7 + ld [wSilphCo11FCurScript], a + ld [wCurMapScript], a + ret -.OmegaMovement1: +SilphCo11Script7: + ld a, [wIsInBattle] + cp $ff + jp z, SilphCo11Script_50ece + ld a, $3 + ld [wSilphCo11FCurScript], a + ret + +SilphCo11Script_50ed6: + ld a, 0 + ld [wTrainerNo], a + ld a, 1 + ld [wIsTrainerBattle], a + ret + +OmegaMovementData: db NPC_MOVEMENT_DOWN db NPC_MOVEMENT_DOWN db -1 ; end +MoveOmegaSprite: + ld de, OmegaMovementData + call MoveSprite + ld a, SPRITE_FACING_DOWN + ldh [hSpriteFacingDirection], a + jp SetSpriteFacingDirectionAndDelay + ret + +.asm_50ef1 + call MoveSprite + ld a, SPRITE_FACING_RIGHT + ldh [hSpriteFacingDirection], a + jp SetSpriteFacingDirectionAndDelay + +SilphCo11Script_50ece: + xor a + ld [wJoyIgnore], a + ld [wSilphCo11FCurScript], a + SilphCo11Script_6216d: ld hl, MissableObjectIDs_6219b .asm_62170 @@ -170,13 +232,7 @@ SilphCo11Script_621c8: ld [wCurMapScript], a ret -SilphCo11F_ScriptPointers: - dw SilphCo11Script0 - dw DisplayEnemyTrainerTextAndStartBattle - dw EndTrainerBattle - dw SilphCo11Script3 - dw SilphCo11Script4 - dw SilphCo11Script5 + SilphCo11Script0: CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI @@ -303,10 +359,12 @@ SilphCo11TrainerHeader0: trainer EVENT_BEAT_SILPH_CO_11F_TRAINER_0, 4, SilphCo11BattleText1, SilphCo11EndBattleText1, SilphCo11AfterBattleText1 SilphCo11TrainerHeader1: trainer EVENT_BEAT_SILPH_CO_11F_TRAINER_1, 3, SilphCo11BattleText2, SilphCo11EndBattleText2, SilphCo11AfterBattleText2 -OmegaTrainerHeader: - trainer EVENT_BEAT_OMEGA, 0, OmegaBattleText, OmegaBattleText, OmegaBattleText db -1 ; end +OmegaText: + text_far _OmegaBattleText + text_end + SilphCo11Text1: text_asm CheckEvent EVENT_GOT_MASTER_BALL @@ -420,10 +478,4 @@ OmegaBattleText: call WaitForSoundToFinish jp TextScriptEnd -OmegaText: - call Delay3 - text_asm - ld hl, OmegaTrainerHeader - call TalkToTrainer - ld [wJoyIgnore], a - jp TextScriptEnd +