summaryrefslogtreecommitdiff
path: root/engine/hidden_object_functions7.asm
diff options
context:
space:
mode:
Diffstat (limited to 'engine/hidden_object_functions7.asm')
-rwxr-xr-xengine/hidden_object_functions7.asm375
1 files changed, 186 insertions, 189 deletions
diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm
index f97190de..f04c1deb 100755
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -1,149 +1,146 @@
-PrintNewBikeText: ; 1e94b (7:694b)
+PrintNewBikeText:
call EnableAutoTextBoxDrawing
- ld a, $39
- jp PrintPredefTextID
+ tx_pre_jump NewBicycleText
-NewBicycleText: ; 1e953 (7:6953)
+NewBicycleText:
TX_FAR _NewBicycleText
db "@"
-DisplayOakLabLeftPoster: ; 1e958 (7:6958)
+DisplayOakLabLeftPoster:
call EnableAutoTextBoxDrawing
- ld a, $05 ; PushStartText
- jp PrintPredefTextID
+ tx_pre_jump PushStartText
-PushStartText: ; 1e960 (7:6960)
+PushStartText:
TX_FAR _PushStartText
db "@"
-DisplayOakLabRightPoster: ; 1e965 (7:6965)
+DisplayOakLabRightPoster:
call EnableAutoTextBoxDrawing
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
- ld a, [wd11e]
- cp $2
- ld a, $6 ; SaveOptionText
- jr c, .asm_1e97b
- ld a, $7 ; StrengthsAndWeaknessesText
-.asm_1e97b
+ ld a, [wNumSetBits]
+ cp 2
+ tx_pre_id SaveOptionText
+ jr c, .ownLessThanTwo
+ ; own two or more mon
+ tx_pre_id StrengthsAndWeaknessesText
+.ownLessThanTwo
jp PrintPredefTextID
-SaveOptionText: ; 1e97e (7:697e)
+SaveOptionText:
TX_FAR _SaveOptionText
db "@"
-StrengthsAndWeaknessesText: ; 1e983 (7:6983)
+StrengthsAndWeaknessesText:
TX_FAR _StrengthsAndWeaknessesText
db "@"
-SafariZoneCheck: ; 1e988 (7:6988)
- ld hl, wd790
- bit 7, [hl]
- jr z, asm_1e9ab
- ld a, [W_NUMSAFARIBALLS] ; W_NUMSAFARIBALLS
+SafariZoneCheck:
+ CheckEventHL EVENT_IN_SAFARI_ZONE ; if we are not in the Safari Zone,
+ jr z, SafariZoneGameStillGoing ; don't bother printing game over text
+ ld a, [wNumSafariBalls]
and a
- jr z, asm_1e9b0
- jr asm_1e9ab
+ jr z, SafariZoneGameOver
+ jr SafariZoneGameStillGoing
-SafariZoneCheckSteps: ; 1e997 (7:6997)
- ld a, [wSafariSteps] ; wd70d
+SafariZoneCheckSteps:
+ ld a, [wSafariSteps]
ld b, a
- ld a, [wSafariSteps + 1] ; wd70e
+ ld a, [wSafariSteps + 1]
ld c, a
or b
- jr z, asm_1e9b0
+ jr z, SafariZoneGameOver
dec bc
ld a, b
- ld [wSafariSteps], a ; wd70d
+ ld [wSafariSteps], a
ld a, c
- ld [wSafariSteps + 1], a ; wd70e
-asm_1e9ab: ; 1e9ab (7:69ab)
+ ld [wSafariSteps + 1], a
+SafariZoneGameStillGoing:
xor a
ld [wSafariZoneGameOver], a
ret
-asm_1e9b0: ; 1e9b0 (7:69b0)
+
+SafariZoneGameOver:
call EnableAutoTextBoxDrawing
xor a
- ld [wMusicHeaderPointer], a
+ ld [wAudioFadeOutControl], a
dec a
call PlaySound
- ld c, BANK(SFX_02_5f)
- ld a, (SFX_02_5f - SFX_Headers_02) / 3
+ ld c, BANK(SFX_Safari_Zone_PA)
+ ld a, SFX_SAFARI_ZONE_PA
call PlayMusic
-.asm_1e9c2
- ld a, [wc02a]
- cp $b9
- jr nz, .asm_1e9c2
- ld a, $d3
- ld [H_DOWNARROWBLINKCNT2], a ; $ff8c
+.waitForMusicToPlay
+ ld a, [wChannelSoundIDs + Ch4]
+ cp SFX_SAFARI_ZONE_PA
+ jr nz, .waitForMusicToPlay
+ ld a, TEXT_SAFARI_GAME_OVER
+ ld [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [wd528], a
+ ld [wPlayerMovingDirection], a
ld a, SAFARI_ZONE_ENTRANCE
- ld [H_DOWNARROWBLINKCNT1], a ; $ff8b
+ ld [hWarpDestinationMap], a
ld a, $3
ld [wDestinationWarpID], a
ld a, $5
- ld [W_SAFARIZONEENTRANCECURSCRIPT], a
- ld hl, wd790
- set 6, [hl]
- ld a, $1
+ ld [wSafariZoneEntranceCurScript], a
+ SetEvent EVENT_SAFARI_GAME_OVER
+ ld a, 1
ld [wSafariZoneGameOver], a
ret
-PrintSafariGameOverText: ; 1e9ed (7:69ed)
+PrintSafariGameOverText:
xor a
ld [wJoyIgnore], a
ld hl, SafariGameOverText
jp PrintText
-SafariGameOverText: ; 1e9f7 (7:69f7)
- db $08 ; asm
- ld a, [W_NUMSAFARIBALLS] ; W_NUMSAFARIBALLS
+SafariGameOverText:
+ TX_ASM
+ ld a, [wNumSafariBalls]
and a
- jr z, .asm_1ea04
+ jr z, .noMoreSafariBalls
ld hl, TimesUpText
call PrintText
-.asm_1ea04
+.noMoreSafariBalls
ld hl, GameOverText
call PrintText
jp TextScriptEnd
-TimesUpText: ; 1ea0d (7:6a0d)
+TimesUpText:
TX_FAR _TimesUpText
db "@"
-GameOverText: ; 1ea12 (7:6a12)
+GameOverText:
TX_FAR _GameOverText
db "@"
-PrintCinnabarQuiz: ; 1ea17 (7:6a17)
+PrintCinnabarQuiz:
ld a, [wSpriteStateData1 + 9]
- cp $4
+ cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
- ld a, $31
- jp PrintPredefTextID
+ tx_pre_jump CinnabarGymQuiz
-CinnabarGymQuiz: ; 1ea25 (7:6a25)
- db $08 ; asm
+CinnabarGymQuiz:
+ TX_ASM
xor a
- ld [wda38], a
- ld a, [wWhichTrade] ; wWhichTrade
+ ld [wOpponentAfterWrongAnswer], a
+ ld a, [wHiddenObjectFunctionArgument]
push af
and $f
- ld [$ffdb], a
+ ld [hGymGateIndex], a
pop af
and $f0
swap a
ld [$ffdc], a
ld hl, CinnabarGymQuizIntroText
call PrintText
- ld a, [$ffdb]
+ ld a, [hGymGateIndex]
dec a
add a
- ld d, $0
+ ld d, 0
ld e, a
ld hl, CinnabarQuizQuestions
add hl, de
@@ -151,16 +148,16 @@ CinnabarGymQuiz: ; 1ea25 (7:6a25)
ld h, [hl]
ld l, a
call PrintText
- ld a, $1
+ ld a, 1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call CinnabarGymQuiz_1ea92
jp TextScriptEnd
-CinnabarGymQuizIntroText: ; 1ea5b (7:6a5b)
+CinnabarGymQuizIntroText:
TX_FAR _CinnabarGymQuizIntroText
db "@"
-CinnabarQuizQuestions: ; 1ea60 (7:6a60)
+CinnabarQuizQuestions:
dw CinnabarQuizQuestionsText1
dw CinnabarQuizQuestionsText2
dw CinnabarQuizQuestionsText3
@@ -168,136 +165,143 @@ CinnabarQuizQuestions: ; 1ea60 (7:6a60)
dw CinnabarQuizQuestionsText5
dw CinnabarQuizQuestionsText6
-CinnabarQuizQuestionsText1: ; 1ea6c (7:6a6c)
+CinnabarQuizQuestionsText1:
TX_FAR _CinnabarQuizQuestionsText1
db "@"
-CinnabarQuizQuestionsText2: ; 1ea71 (7:6a71)
+CinnabarQuizQuestionsText2:
TX_FAR _CinnabarQuizQuestionsText2
db "@"
-CinnabarQuizQuestionsText3: ; 1ea76 (7:6a76)
+CinnabarQuizQuestionsText3:
TX_FAR _CinnabarQuizQuestionsText3
db "@"
-CinnabarQuizQuestionsText4: ; 1ea7b (7:6a7b)
+CinnabarQuizQuestionsText4:
TX_FAR _CinnabarQuizQuestionsText4
db "@"
-CinnabarQuizQuestionsText5: ; 1ea80 (7:6a80)
+CinnabarQuizQuestionsText5:
TX_FAR _CinnabarQuizQuestionsText5
db "@"
-CinnabarQuizQuestionsText6: ; 1ea85 (7:6a85)
+CinnabarQuizQuestionsText6:
TX_FAR _CinnabarQuizQuestionsText6
db "@"
-CinnabarGymQuiz_1ea8a: ; 1ea8a (7:6a8a)
- ld hl, wd79c
+CinnabarGymGateFlagAction:
+ EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
predef_jump FlagActionPredef
-CinnabarGymQuiz_1ea92: ; 1ea92 (7:6a92)
+CinnabarGymQuiz_1ea92:
call YesNoChoice
ld a, [$ffdc]
ld c, a
- ld a, [wCurrentMenuItem] ; wCurrentMenuItem
+ ld a, [wCurrentMenuItem]
cp c
- jr nz, .asm_1eab8
- ld hl, wd126
+ jr nz, .wrongAnswer
+ ld hl, wCurrentMapScriptFlags
set 5, [hl]
- ld a, [$ffdb]
+ ld a, [hGymGateIndex]
ld [$ffe0], a
ld hl, CinnabarGymQuizCorrectText
call PrintText
ld a, [$ffe0]
+ AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
- ld b, $1
- call CinnabarGymQuiz_1ea8a
- jp CinnabarGymQuiz_1eb0a
-.asm_1eab8
+ ld b, FLAG_SET
+ call CinnabarGymGateFlagAction
+ jp UpdateCinnabarGymGateTileBlocks_
+.wrongAnswer
call WaitForSoundToFinish
- ld a, (SFX_02_51 - SFX_Headers_02) / 3
+ ld a, SFX_DENIED
call PlaySound
call WaitForSoundToFinish
ld hl, CinnabarGymQuizIncorrectText
call PrintText
- ld a, [$ffdb]
+ ld a, [hGymGateIndex]
add $2
+ AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
- ld b, $2
- ld hl, wd79a
+ ld b, FLAG_TEST
+ EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
predef FlagActionPredef
ld a, c
and a
ret nz
- ld a, [$ffdb]
+ ld a, [hGymGateIndex]
add $2
- ld [wda38], a
+ ld [wOpponentAfterWrongAnswer], a
ret
-CinnabarGymQuizCorrectText: ; 1eae3 (7:6ae3)
- db $0b
+CinnabarGymQuizCorrectText:
+ TX_SFX_ITEM_1
TX_FAR _CinnabarGymQuizCorrectText
- db $06,$08
+ TX_BLINK
+ TX_ASM
ld a, [$ffe0]
+ AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
- ld b, $2
- call CinnabarGymQuiz_1ea8a
+ ld b, FLAG_TEST
+ call CinnabarGymGateFlagAction
ld a, c
and a
jp nz, TextScriptEnd
call WaitForSoundToFinish
- ld a, (SFX_02_57 - SFX_Headers_02) / 3
+ ld a, SFX_GO_INSIDE
call PlaySound
call WaitForSoundToFinish
jp TextScriptEnd
-CinnabarGymQuizIncorrectText: ; 1eb05 (7:6b05)
+CinnabarGymQuizIncorrectText:
TX_FAR _CinnabarGymQuizIncorrectText
db "@"
-CinnabarGymQuiz_1eb0a: ; 1eb0a (7:6b0a)
- ld a, $6
- ld [$ffdb], a
-.asm_1eb0e
- ld a, [$ffdb]
+UpdateCinnabarGymGateTileBlocks_:
+; Update the overworld map with open floor blocks or locked gate blocks
+; depending on event flags.
+ ld a, 6
+ ld [hGymGateIndex], a
+.loop
+ ld a, [hGymGateIndex]
dec a
add a
add a
- ld d, $0
+ ld d, 0
ld e, a
- ld hl, CinnabarGymGateCoords ; $6b48
+ ld hl, CinnabarGymGateCoords
add hl, de
ld a, [hli]
ld b, [hl]
ld c, a
inc hl
ld a, [hl]
- ld [wd12f], a
+ ld [wGymGateTileBlock], a
push bc
- ld a, [$ffdb]
+ ld a, [hGymGateIndex]
ld [$ffe0], a
+ AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
- ld b, $2
- call CinnabarGymQuiz_1ea8a
+ ld b, FLAG_TEST
+ call CinnabarGymGateFlagAction
ld a, c
and a
- jr nz, .asm_1eb36
- ld a, [wd12f]
- jr .asm_1eb38
-.asm_1eb36
+ jr nz, .unlocked
+ ld a, [wGymGateTileBlock]
+ jr .next
+.unlocked
ld a, $e
-.asm_1eb38
+.next
pop bc
- ld [wd09f], a
+ ld [wNewTileBlockID], a
predef ReplaceTileBlock
- ld hl, $ffdb
+ ld hl, hGymGateIndex
dec [hl]
- jr nz, .asm_1eb0e
+ jr nz, .loop
ret
-CinnabarGymGateCoords: ; 1eb48 (7:6b48)
+CinnabarGymGateCoords:
; format: x-coord, y-coord, direction, padding
; direction: $54 = horizontal gate, $5f = vertical gate
db $09,$03,$54,$00
@@ -307,164 +311,157 @@ CinnabarGymGateCoords: ; 1eb48 (7:6b48)
db $02,$06,$54,$00
db $02,$03,$54,$00
-PrintMagazinesText: ; 1eb60 (7:6b60)
+PrintMagazinesText:
call EnableAutoTextBoxDrawing
- ld a, $30
- call PrintPredefTextID
+ tx_pre MagazinesText
ret
-MagazinesText: ; 1eb69 (7:6b69)
+MagazinesText:
TX_FAR _MagazinesText
db "@"
-BillsHousePC: ; 1eb6e (7:6b6e)
+BillsHousePC:
call EnableAutoTextBoxDrawing
ld a, [wSpriteStateData1 + 9]
- cp $4
+ cp SPRITE_FACING_UP
ret nz
- ld a, [wd7f2]
- bit 7, a
- jr nz, .asm_1ebd2
- bit 3, a
- jr nz, .asm_1eb86
- bit 6, a
- jr nz, .asm_1eb8b
-.asm_1eb86
- ld a, $2d
- jp PrintPredefTextID
-.asm_1eb8b
+ CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING
+ jr nz, .displayBillsHousePokemonList
+ CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL
+ jr nz, .displayBillsHouseMonitorText
+ CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR
+ jr nz, .doCellSeparator
+.displayBillsHouseMonitorText
+ tx_pre_jump BillsHouseMonitorText
+.doCellSeparator
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- ld a, $2e
- call PrintPredefTextID
- ld c, $20
+ tx_pre BillsHouseInitiatedText
+ ld c, 32
call DelayFrames
- ld a, (SFX_02_3c - SFX_Headers_02) / 3
+ ld a, SFX_TINK
call PlaySound
call WaitForSoundToFinish
- ld c, $50
+ ld c, 80
call DelayFrames
- ld a, (SFX_02_48 - SFX_Headers_02) / 3
+ ld a, SFX_SHRINK
call PlaySound
call WaitForSoundToFinish
- ld c, $30
+ ld c, 48
call DelayFrames
- ld a, (SFX_02_3c - SFX_Headers_02) / 3
+ ld a, SFX_TINK
call PlaySound
call WaitForSoundToFinish
- ld c, $20
+ ld c, 32
call DelayFrames
- ld a, (SFX_02_3a - SFX_Headers_02) / 3
+ ld a, SFX_GET_ITEM_1
call PlaySound
call WaitForSoundToFinish
call PlayDefaultMusic
- ld hl, wd7f2
- set 3, [hl]
+ SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL
ret
-.asm_1ebd2
+.displayBillsHousePokemonList
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
- ld a, $2f
- call PrintPredefTextID
+ tx_pre BillsHousePokemonList
ret
-BillsHouseMonitorText: ; 1ebdd (7:6bdd)
+BillsHouseMonitorText:
TX_FAR _BillsHouseMonitorText
db "@"
-BillsHouseInitiatedText: ; 1ebe2 (7:6be2)
+BillsHouseInitiatedText:
TX_FAR _BillsHouseInitiatedText
- db $06
- db $08 ; asm
+ TX_BLINK
+ TX_ASM
ld a, $ff
- ld [wc0ee], a
+ ld [wNewSoundID], a
call PlaySound
- ld c, $10
+ ld c, 16
call DelayFrames
- ld a, (SFX_02_49 - SFX_Headers_02) / 3
+ ld a, SFX_SWITCH
call PlaySound
call WaitForSoundToFinish
- ld c, $3c
+ ld c, 60
call DelayFrames
jp TextScriptEnd
-BillsHousePokemonList: ; 1ec05 (7:6c05)
- db $08 ; asm
+BillsHousePokemonList:
+ TX_ASM
call SaveScreenTilesToBuffer1
ld hl, BillsHousePokemonListText1
call PrintText
xor a
- ld [W_ANIMATIONID], a
+ ld [wMenuItemOffset], a ; not used
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld a, $3
+ ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
- ld a, $4
+ ld a, 4
ld [wMaxMenuItem], a
- ld a, $2
+ ld a, 2
ld [wTopMenuItemY], a
- ld a, $1
+ ld a, 1
ld [wTopMenuItemX], a
-.asm_1ec2d
+.billsPokemonLoop
ld hl, wd730
set 6, [hl]
- ld hl, wTileMap
- ld b, $a
- ld c, $9
+ coord hl, 0, 0
+ ld b, 10
+ ld c, 9
call TextBoxBorder
- ld hl, wTileMap + $2a
+ coord hl, 2, 2
ld de, BillsMonListText
call PlaceString
ld hl, BillsHousePokemonListText2
call PrintText
call SaveScreenTilesToBuffer2
call HandleMenuInput
- bit 1, a
- jr nz, .asm_1ec74
+ bit 1, a ; pressed b
+ jr nz, .cancel
ld a, [wCurrentMenuItem]
add EEVEE
cp EEVEE
- jr z, .asm_1ec6c
+ jr z, .displayPokedex
cp FLAREON
- jr z, .asm_1ec6c
+ jr z, .displayPokedex
cp JOLTEON
- jr z, .asm_1ec6c
+ jr z, .displayPokedex
cp VAPOREON
- jr z, .asm_1ec6c
- jr .asm_1ec74
-.asm_1ec6c
+ jr z, .displayPokedex
+ jr .cancel
+.displayPokedex
call DisplayPokedex
call LoadScreenTilesFromBuffer2
- jr .asm_1ec2d
-.asm_1ec74
+ jr .billsPokemonLoop
+.cancel
ld hl, wd730
res 6, [hl]
call LoadScreenTilesFromBuffer2
jp TextScriptEnd
-BillsHousePokemonListText1: ; 1ec7f (7:6c7f)
+BillsHousePokemonListText1:
TX_FAR _BillsHousePokemonListText1
db "@"
-BillsMonListText: ; 1ec84 (7:6c84)
+BillsMonListText:
db "EEVEE"
next "FLAREON"
next "JOLTEON"
next "VAPOREON"
next "CANCEL@"
-BillsHousePokemonListText2: ; 1ecaa (7:6caa)
+BillsHousePokemonListText2:
TX_FAR _BillsHousePokemonListText2
db "@"
-DisplayOakLabEmailText: ; 1ecaf (7:6caf)
+DisplayOakLabEmailText:
ld a, [wSpriteStateData1 + 9]
- cp $4
+ cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
- ld a, $8 ; OakLabEmailText
- jp PrintPredefTextID
+ tx_pre_jump OakLabEmailText
-OakLabEmailText: ; 1ecbd (7:6cbd)
+OakLabEmailText:
TX_FAR _OakLabEmailText
db "@"