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.asm109
1 files changed, 76 insertions, 33 deletions
diff --git a/engine/hidden_object_functions7.asm b/engine/hidden_object_functions7.asm
index 9b1532bc..691d05f2 100755
--- a/engine/hidden_object_functions7.asm
+++ b/engine/hidden_object_functions7.asm
@@ -65,15 +65,14 @@ SafariZoneGameOver:
call EnableAutoTextBoxDrawing
xor a
ld [wAudioFadeOutControl], a
- dec a
- call PlaySound
+ call StopAllMusic
ld c, BANK(SFX_Safari_Zone_PA)
ld a, SFX_SAFARI_ZONE_PA
call PlayMusic
-.asm_1e9c2
+.waitForMusicToPlay
ld a, [wChannelSoundIDs + CH4]
- cp $b9
- jr nz, .asm_1e9c2
+ cp SFX_SAFARI_ZONE_PA
+ jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER
ld [hSpriteIndexOrTextID], a
call DisplayTextID
@@ -86,7 +85,7 @@ SafariZoneGameOver:
ld a, $5
ld [wSafariZoneEntranceCurScript], a
SetEvent EVENT_SAFARI_GAME_OVER
- ld a, 1
+ ld a, $1
ld [wSafariZoneGameOver], a
ret
@@ -100,10 +99,10 @@ 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
@@ -117,7 +116,7 @@ GameOverText:
db "@"
PrintCinnabarQuiz:
- ld a, [wSpriteStateData1 + 9]
+ ld a, [wPlayerFacingDirection]
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
@@ -127,6 +126,8 @@ CinnabarGymQuiz:
TX_ASM
xor a
ld [wOpponentAfterWrongAnswer], a
+ ld hl, wd475
+ res 7, [hl]
ld a, [wHiddenObjectFunctionArgument]
push af
and $f
@@ -135,7 +136,12 @@ CinnabarGymQuiz:
and $f0
swap a
ld [$ffdc], a
+ ld a, [hGymGateIndex]
ld hl, CinnabarGymQuizIntroText
+ cp $1
+ jr z, .onFirstQuestion
+ ld hl, CinnabarGymQuizShortIntroText
+.onFirstQuestion
call PrintText
ld a, [hGymGateIndex]
dec a
@@ -148,15 +154,23 @@ CinnabarGymQuiz:
ld h, [hl]
ld l, a
call PrintText
- ld a, 1
+ ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
call CinnabarGymQuiz_1ea92
jp TextScriptEnd
+CinnabarGymQuizDummyIntroText:
+ TX_FAR _CinnabarGymQuizDummyIntroText
+ db "@"
+
CinnabarGymQuizIntroText:
TX_FAR _CinnabarGymQuizIntroText
db "@"
+CinnabarGymQuizShortIntroText:
+ TX_FAR _CinnabarGymQuizShortIntroText
+ db "@"
+
CinnabarQuizQuestions:
dw CinnabarQuizQuestionsText1
dw CinnabarQuizQuestionsText2
@@ -189,10 +203,6 @@ CinnabarQuizQuestionsText6:
TX_FAR _CinnabarQuizQuestionsText6
db "@"
-CinnabarGymGateFlagAction:
- EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
- predef_jump FlagActionPredef
-
CinnabarGymQuiz_1ea92:
call YesNoChoice
ld a, [$ffdc]
@@ -232,6 +242,8 @@ CinnabarGymQuiz_1ea92:
ld a, [hGymGateIndex]
add $2
ld [wOpponentAfterWrongAnswer], a
+ ld hl, wd475
+ set 7, [hl]
ret
CinnabarGymQuizCorrectText:
@@ -258,6 +270,10 @@ CinnabarGymQuizIncorrectText:
TX_FAR _CinnabarGymQuizIncorrectText
db "@"
+CinnabarGymGateFlagAction:
+ EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
+ predef_jump FlagActionPredef
+
UpdateCinnabarGymGateTileBlocks_:
; Update the overworld map with open floor blocks or locked gate blocks
; depending on event flags.
@@ -295,10 +311,11 @@ UpdateCinnabarGymGateTileBlocks_:
.next
pop bc
ld [wNewTileBlockID], a
- predef ReplaceTileBlock
+ call CinnabarGym_ReplaceTileBlock
ld hl, hGymGateIndex
dec [hl]
jr nz, .loop
+ callab RedrawMapView
ret
CinnabarGymGateCoords:
@@ -311,6 +328,34 @@ CinnabarGymGateCoords:
db $02,$06,$54,$00
db $02,$03,$54,$00
+
+CinnabarGym_ReplaceTileBlock:
+; basically a copy of the first half of ReplaceTileBlock
+; before checking if it is necessary to redraw the map view
+ ld hl, wOverworldMap
+ ld a, [wCurMapWidth]
+ add $6
+ ld e, a
+ ld d, $0
+ add hl, de
+ add hl, de
+ add hl, de
+ ld e, $3
+ add hl, de
+ ld e, a
+ ld a, b
+ and a
+ jr z, .addX
+.addWidthYTimesLoop
+ add hl, de
+ dec b
+ jr nz, .addWidthYTimesLoop
+.addX
+ add hl, bc
+ ld a, [wNewTileBlockID]
+ ld [hl], a
+ ret
+
PrintMagazinesText:
call EnableAutoTextBoxDrawing
tx_pre MagazinesText
@@ -322,18 +367,18 @@ MagazinesText:
BillsHousePC:
call EnableAutoTextBoxDrawing
- ld a, [wSpriteStateData1 + 9]
+ ld a, [wPlayerFacingDirection]
cp SPRITE_FACING_UP
ret nz
CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING
- jr nz, .asm_1ebd2
+ jr nz, .displayBillsHousePokemonList
CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL
- jr nz, .asm_1eb86
+ jr nz, .displayBillsHouseMonitorText
CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR
- jr nz, .asm_1eb8b
-.asm_1eb86
+ jr nz, .doCellSeparator
+.displayBillsHouseMonitorText
tx_pre_jump BillsHouseMonitorText
-.asm_1eb8b
+.doCellSeparator
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
tx_pre BillsHouseInitiatedText
@@ -360,7 +405,7 @@ BillsHousePC:
call PlayDefaultMusic
SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL
ret
-.asm_1ebd2
+.displayBillsHousePokemonList
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
tx_pre BillsHousePokemonList
@@ -374,9 +419,7 @@ BillsHouseInitiatedText:
TX_FAR _BillsHouseInitiatedText
db $06
TX_ASM
- ld a, $ff
- ld [wNewSoundID], a
- call PlaySound
+ call StopAllMusic
ld c, 16
call DelayFrames
ld a, SFX_SWITCH
@@ -392,23 +435,22 @@ BillsHousePokemonList:
ld hl, BillsHousePokemonListText1
call PrintText
xor a
- ld [wMenuItemOffset], a ; not used
+ ld [wMenuItemOffset], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
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
.billsPokemonLoop
ld hl, wd730
set 6, [hl]
coord hl, 0, 0
- ld b, 10
- ld c, 9
+ lb bc, 10, 9
call TextBoxBorder
coord hl, 2, 2
ld de, BillsMonListText
@@ -456,11 +498,12 @@ BillsHousePokemonListText2:
db "@"
DisplayOakLabEmailText:
- ld a, [wSpriteStateData1 + 9]
+ ld a, [wPlayerFacingDirection]
cp SPRITE_FACING_UP
ret nz
call EnableAutoTextBoxDrawing
- tx_pre_jump OakLabEmailText
+ tx_pre OakLabEmailText
+ ret
OakLabEmailText:
TX_FAR _OakLabEmailText