mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 23:55:24 +13:00
Merge branch 'master' of https://github.com/pret/pokered
This commit is contained in:
commit
e8dd755e18
3702 changed files with 163333 additions and 159040 deletions
98
engine/events/hidden_objects/bench_guys.asm
Normal file
98
engine/events/hidden_objects/bench_guys.asm
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
PrintBenchGuyText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld hl, BenchGuyTextPointers
|
||||
ld a, [wCurMap]
|
||||
ld b, a
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp -1
|
||||
ret z
|
||||
cp b
|
||||
jr z, .match
|
||||
inc hl
|
||||
inc hl
|
||||
jr .loop
|
||||
.match
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp b
|
||||
jr nz, .loop ; player isn't facing the bench guy
|
||||
ld a, [hl]
|
||||
jp PrintPredefTextID
|
||||
|
||||
INCLUDE "data/events/bench_guys.asm"
|
||||
|
||||
ViridianCityPokecenterBenchGuyText::
|
||||
text_far _ViridianCityPokecenterGuyText
|
||||
text_end
|
||||
|
||||
PewterCityPokecenterBenchGuyText::
|
||||
text_far _PewterCityPokecenterGuyText
|
||||
text_end
|
||||
|
||||
CeruleanCityPokecenterBenchGuyText::
|
||||
text_far _CeruleanPokecenterGuyText
|
||||
text_end
|
||||
|
||||
LavenderCityPokecenterBenchGuyText::
|
||||
text_far _LavenderPokecenterGuyText
|
||||
text_end
|
||||
|
||||
MtMoonPokecenterBenchGuyText::
|
||||
text_far _MtMoonPokecenterBenchGuyText
|
||||
text_end
|
||||
|
||||
RockTunnelPokecenterBenchGuyText::
|
||||
text_far _RockTunnelPokecenterGuyText
|
||||
text_end
|
||||
|
||||
UnusedBenchGuyText1::
|
||||
text_far _UnusedBenchGuyText1
|
||||
text_end
|
||||
|
||||
UnusedBenchGuyText2::
|
||||
text_far _UnusedBenchGuyText2
|
||||
text_end
|
||||
|
||||
UnusedBenchGuyText3::
|
||||
text_far _UnusedBenchGuyText3
|
||||
text_end
|
||||
|
||||
VermilionCityPokecenterBenchGuyText::
|
||||
text_far _VermilionPokecenterGuyText
|
||||
text_end
|
||||
|
||||
CeladonCityPokecenterBenchGuyText::
|
||||
text_far _CeladonCityPokecenterGuyText
|
||||
text_end
|
||||
|
||||
FuchsiaCityPokecenterBenchGuyText::
|
||||
text_far _FuchsiaCityPokecenterGuyText
|
||||
text_end
|
||||
|
||||
CinnabarIslandPokecenterBenchGuyText::
|
||||
text_far _CinnabarPokecenterGuyText
|
||||
text_end
|
||||
|
||||
SaffronCityPokecenterBenchGuyText::
|
||||
text_asm
|
||||
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
|
||||
ld hl, SaffronCityPokecenterBenchGuyText2
|
||||
jr nz, .asm_624f2
|
||||
ld hl, SaffronCityPokecenterBenchGuyText1
|
||||
.asm_624f2
|
||||
call PrintText
|
||||
jp TextScriptEnd
|
||||
|
||||
SaffronCityPokecenterBenchGuyText1:
|
||||
text_far _SaffronCityPokecenterGuyText1
|
||||
text_end
|
||||
|
||||
SaffronCityPokecenterBenchGuyText2:
|
||||
text_far _SaffronCityPokecenterGuyText2
|
||||
text_end
|
||||
|
||||
CeladonCityHotelText::
|
||||
text_far _CeladonCityHotelText
|
||||
text_end
|
||||
134
engine/events/hidden_objects/bills_house_pc.asm
Normal file
134
engine/events/hidden_objects/bills_house_pc.asm
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
BillsHousePC:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
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
|
||||
tx_pre BillsHouseInitiatedText
|
||||
ld c, 32
|
||||
call DelayFrames
|
||||
ld a, SFX_TINK
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
ld c, 80
|
||||
call DelayFrames
|
||||
ld a, SFX_SHRINK
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
ld c, 48
|
||||
call DelayFrames
|
||||
ld a, SFX_TINK
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
ld c, 32
|
||||
call DelayFrames
|
||||
ld a, SFX_GET_ITEM_1
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
call PlayDefaultMusic
|
||||
SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL
|
||||
ret
|
||||
.displayBillsHousePokemonList
|
||||
ld a, $1
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
tx_pre BillsHousePokemonList
|
||||
ret
|
||||
|
||||
BillsHouseMonitorText::
|
||||
text_far _BillsHouseMonitorText
|
||||
text_end
|
||||
|
||||
BillsHouseInitiatedText::
|
||||
text_far _BillsHouseInitiatedText
|
||||
text_promptbutton
|
||||
text_asm
|
||||
ld a, SFX_STOP_ALL_MUSIC
|
||||
ld [wNewSoundID], a
|
||||
call PlaySound
|
||||
ld c, 16
|
||||
call DelayFrames
|
||||
ld a, SFX_SWITCH
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
ld c, 60
|
||||
call DelayFrames
|
||||
jp TextScriptEnd
|
||||
|
||||
BillsHousePokemonList::
|
||||
text_asm
|
||||
call SaveScreenTilesToBuffer1
|
||||
ld hl, BillsHousePokemonListText1
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wMenuItemOffset], a ; not used
|
||||
ld [wCurrentMenuItem], a
|
||||
ld [wLastMenuItem], a
|
||||
ld a, A_BUTTON | B_BUTTON
|
||||
ld [wMenuWatchedKeys], a
|
||||
ld a, 4
|
||||
ld [wMaxMenuItem], a
|
||||
ld a, 2
|
||||
ld [wTopMenuItemY], a
|
||||
ld a, 1
|
||||
ld [wTopMenuItemX], a
|
||||
.billsPokemonLoop
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
hlcoord 0, 0
|
||||
ld b, 10
|
||||
ld c, 9
|
||||
call TextBoxBorder
|
||||
hlcoord 2, 2
|
||||
ld de, BillsMonListText
|
||||
call PlaceString
|
||||
ld hl, BillsHousePokemonListText2
|
||||
call PrintText
|
||||
call SaveScreenTilesToBuffer2
|
||||
call HandleMenuInput
|
||||
bit 1, a ; pressed b
|
||||
jr nz, .cancel
|
||||
ld a, [wCurrentMenuItem]
|
||||
add EEVEE
|
||||
cp EEVEE
|
||||
jr z, .displayPokedex
|
||||
cp FLAREON
|
||||
jr z, .displayPokedex
|
||||
cp JOLTEON
|
||||
jr z, .displayPokedex
|
||||
cp VAPOREON
|
||||
jr z, .displayPokedex
|
||||
jr .cancel
|
||||
.displayPokedex
|
||||
call DisplayPokedex
|
||||
call LoadScreenTilesFromBuffer2
|
||||
jr .billsPokemonLoop
|
||||
.cancel
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
call LoadScreenTilesFromBuffer2
|
||||
jp TextScriptEnd
|
||||
|
||||
BillsHousePokemonListText1:
|
||||
text_far _BillsHousePokemonListText1
|
||||
text_end
|
||||
|
||||
BillsMonListText:
|
||||
db "EEVEE"
|
||||
next "FLAREON"
|
||||
next "JOLTEON"
|
||||
next "VAPOREON"
|
||||
next "CANCEL@"
|
||||
|
||||
BillsHousePokemonListText2:
|
||||
text_far _BillsHousePokemonListText2
|
||||
text_end
|
||||
13
engine/events/hidden_objects/blues_room.asm
Normal file
13
engine/events/hidden_objects/blues_room.asm
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
ret ; unused
|
||||
|
||||
UnusedPredefText::
|
||||
db "@"
|
||||
|
||||
PrintBookcaseText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump BookcaseText
|
||||
|
||||
BookcaseText::
|
||||
text_far _BookcaseText
|
||||
text_end
|
||||
21
engine/events/hidden_objects/book_or_sculpture.asm
Normal file
21
engine/events/hidden_objects/book_or_sculpture.asm
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
BookOrSculptureText::
|
||||
text_asm
|
||||
ld hl, PokemonBooksText
|
||||
ld a, [wCurMapTileset]
|
||||
cp MANSION ; Celadon Mansion tileset
|
||||
jr nz, .ok
|
||||
lda_coord 8, 6
|
||||
cp $38
|
||||
jr nz, .ok
|
||||
ld hl, DiglettSculptureText
|
||||
.ok
|
||||
call PrintText
|
||||
jp TextScriptEnd
|
||||
|
||||
PokemonBooksText:
|
||||
text_far _PokemonBooksText
|
||||
text_end
|
||||
|
||||
DiglettSculptureText:
|
||||
text_far _DiglettSculptureText
|
||||
text_end
|
||||
39
engine/events/hidden_objects/bookshelves.asm
Normal file
39
engine/events/hidden_objects/bookshelves.asm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
; prints text for bookshelves in buildings without sign events
|
||||
PrintBookshelfText::
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
jr nz, .noMatch
|
||||
; facing up
|
||||
ld a, [wCurMapTileset]
|
||||
ld b, a
|
||||
lda_coord 8, 7
|
||||
ld c, a
|
||||
ld hl, BookshelfTileIDs
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
jr z, .noMatch
|
||||
cp b
|
||||
jr nz, .nextBookshelfEntry1
|
||||
ld a, [hli]
|
||||
cp c
|
||||
jr nz, .nextBookshelfEntry2
|
||||
ld a, [hl]
|
||||
push af
|
||||
call EnableAutoTextBoxDrawing
|
||||
pop af
|
||||
call PrintPredefTextID
|
||||
xor a
|
||||
ldh [hFFDB], a
|
||||
ret
|
||||
.nextBookshelfEntry1
|
||||
inc hl
|
||||
.nextBookshelfEntry2
|
||||
inc hl
|
||||
jr .loop
|
||||
.noMatch
|
||||
ld a, $ff
|
||||
ldh [hFFDB], a
|
||||
farjp PrintCardKeyText
|
||||
|
||||
INCLUDE "data/tilesets/bookshelf_tile_ids.asm"
|
||||
200
engine/events/hidden_objects/cinnabar_gym_quiz.asm
Normal file
200
engine/events/hidden_objects/cinnabar_gym_quiz.asm
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
PrintCinnabarQuiz:
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump CinnabarGymQuiz
|
||||
|
||||
CinnabarGymQuiz::
|
||||
text_asm
|
||||
xor a
|
||||
ld [wOpponentAfterWrongAnswer], a
|
||||
ld a, [wHiddenObjectFunctionArgument]
|
||||
push af
|
||||
and $f
|
||||
ldh [hGymGateIndex], a
|
||||
pop af
|
||||
and $f0
|
||||
swap a
|
||||
ldh [hGymGateAnswer], a
|
||||
ld hl, CinnabarGymQuizIntroText
|
||||
call PrintText
|
||||
ldh a, [hGymGateIndex]
|
||||
dec a
|
||||
add a
|
||||
ld d, 0
|
||||
ld e, a
|
||||
ld hl, CinnabarQuizQuestions
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
call PrintText
|
||||
ld a, 1
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
call CinnabarGymQuiz_1ea92
|
||||
jp TextScriptEnd
|
||||
|
||||
CinnabarGymQuizIntroText:
|
||||
text_far _CinnabarGymQuizIntroText
|
||||
text_end
|
||||
|
||||
CinnabarQuizQuestions:
|
||||
dw CinnabarQuizQuestionsText1
|
||||
dw CinnabarQuizQuestionsText2
|
||||
dw CinnabarQuizQuestionsText3
|
||||
dw CinnabarQuizQuestionsText4
|
||||
dw CinnabarQuizQuestionsText5
|
||||
dw CinnabarQuizQuestionsText6
|
||||
|
||||
CinnabarQuizQuestionsText1:
|
||||
text_far _CinnabarQuizQuestionsText1
|
||||
text_end
|
||||
|
||||
CinnabarQuizQuestionsText2:
|
||||
text_far _CinnabarQuizQuestionsText2
|
||||
text_end
|
||||
|
||||
CinnabarQuizQuestionsText3:
|
||||
text_far _CinnabarQuizQuestionsText3
|
||||
text_end
|
||||
|
||||
CinnabarQuizQuestionsText4:
|
||||
text_far _CinnabarQuizQuestionsText4
|
||||
text_end
|
||||
|
||||
CinnabarQuizQuestionsText5:
|
||||
text_far _CinnabarQuizQuestionsText5
|
||||
text_end
|
||||
|
||||
CinnabarQuizQuestionsText6:
|
||||
text_far _CinnabarQuizQuestionsText6
|
||||
text_end
|
||||
|
||||
CinnabarGymGateFlagAction:
|
||||
EventFlagAddress hl, EVENT_CINNABAR_GYM_GATE0_UNLOCKED
|
||||
predef_jump FlagActionPredef
|
||||
|
||||
CinnabarGymQuiz_1ea92:
|
||||
call YesNoChoice
|
||||
ldh a, [hGymGateAnswer]
|
||||
ld c, a
|
||||
ld a, [wCurrentMenuItem]
|
||||
cp c
|
||||
jr nz, .wrongAnswer
|
||||
ld hl, wCurrentMapScriptFlags
|
||||
set 5, [hl]
|
||||
ldh a, [hGymGateIndex]
|
||||
ldh [hBackupGymGateIndex], a
|
||||
ld hl, CinnabarGymQuizCorrectText
|
||||
call PrintText
|
||||
ldh a, [hBackupGymGateIndex]
|
||||
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
|
||||
ld c, a
|
||||
ld b, FLAG_SET
|
||||
call CinnabarGymGateFlagAction
|
||||
jp UpdateCinnabarGymGateTileBlocks_
|
||||
.wrongAnswer
|
||||
call WaitForSoundToFinish
|
||||
ld a, SFX_DENIED
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
ld hl, CinnabarGymQuizIncorrectText
|
||||
call PrintText
|
||||
ldh a, [hGymGateIndex]
|
||||
add $2
|
||||
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
|
||||
ld c, a
|
||||
ld b, FLAG_TEST
|
||||
EventFlagAddress hl, EVENT_BEAT_CINNABAR_GYM_TRAINER_0
|
||||
predef FlagActionPredef
|
||||
ld a, c
|
||||
and a
|
||||
ret nz
|
||||
ldh a, [hGymGateIndex]
|
||||
add $2
|
||||
ld [wOpponentAfterWrongAnswer], a
|
||||
ret
|
||||
|
||||
CinnabarGymQuizCorrectText:
|
||||
sound_get_item_1
|
||||
text_far _CinnabarGymQuizCorrectText
|
||||
text_promptbutton
|
||||
text_asm
|
||||
|
||||
ldh a, [hBackupGymGateIndex]
|
||||
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
|
||||
ld c, a
|
||||
ld b, FLAG_TEST
|
||||
call CinnabarGymGateFlagAction
|
||||
ld a, c
|
||||
and a
|
||||
jp nz, TextScriptEnd
|
||||
call WaitForSoundToFinish
|
||||
ld a, SFX_GO_INSIDE
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
jp TextScriptEnd
|
||||
|
||||
CinnabarGymQuizIncorrectText:
|
||||
text_far _CinnabarGymQuizIncorrectText
|
||||
text_end
|
||||
|
||||
UpdateCinnabarGymGateTileBlocks_::
|
||||
; Update the overworld map with open floor blocks or locked gate blocks
|
||||
; depending on event flags.
|
||||
ld a, 6
|
||||
ldh [hGymGateIndex], a
|
||||
.loop
|
||||
ldh a, [hGymGateIndex]
|
||||
dec a
|
||||
add a
|
||||
add a
|
||||
ld d, 0
|
||||
ld e, a
|
||||
ld hl, CinnabarGymGateCoords
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld b, [hl]
|
||||
ld c, a
|
||||
inc hl
|
||||
ld a, [hl]
|
||||
ld [wGymGateTileBlock], a
|
||||
push bc
|
||||
ldh a, [hGymGateIndex]
|
||||
ldh [hBackupGymGateIndex], a
|
||||
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
|
||||
ld c, a
|
||||
ld b, FLAG_TEST
|
||||
call CinnabarGymGateFlagAction
|
||||
ld a, c
|
||||
and a
|
||||
jr nz, .unlocked
|
||||
ld a, [wGymGateTileBlock]
|
||||
jr .next
|
||||
.unlocked
|
||||
ld a, $e
|
||||
.next
|
||||
pop bc
|
||||
ld [wNewTileBlockID], a
|
||||
predef ReplaceTileBlock
|
||||
ld hl, hGymGateIndex
|
||||
dec [hl]
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
gym_gate_coord: MACRO
|
||||
db \1, \2, \3, 0
|
||||
ENDM
|
||||
|
||||
HORIZONTAL_GATE_BLOCK EQU $54
|
||||
VERTICAL_GATE_BLOCK EQU $5f
|
||||
|
||||
CinnabarGymGateCoords:
|
||||
; x coord, y coord, block id
|
||||
gym_gate_coord 9, 3, HORIZONTAL_GATE_BLOCK
|
||||
gym_gate_coord 6, 3, HORIZONTAL_GATE_BLOCK
|
||||
gym_gate_coord 6, 6, HORIZONTAL_GATE_BLOCK
|
||||
gym_gate_coord 3, 8, VERTICAL_GATE_BLOCK
|
||||
gym_gate_coord 2, 6, HORIZONTAL_GATE_BLOCK
|
||||
gym_gate_coord 2, 3, HORIZONTAL_GATE_BLOCK
|
||||
3
engine/events/hidden_objects/elevator.asm
Normal file
3
engine/events/hidden_objects/elevator.asm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
ElevatorText::
|
||||
text_far _ElevatorText
|
||||
text_end
|
||||
23
engine/events/hidden_objects/fighting_dojo.asm
Normal file
23
engine/events/hidden_objects/fighting_dojo.asm
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
PrintFightingDojoText2:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump EnemiesOnEverySideText
|
||||
|
||||
EnemiesOnEverySideText::
|
||||
text_far _EnemiesOnEverySideText
|
||||
text_end
|
||||
|
||||
PrintFightingDojoText3:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump WhatGoesAroundComesAroundText
|
||||
|
||||
WhatGoesAroundComesAroundText::
|
||||
text_far _WhatGoesAroundComesAroundText
|
||||
text_end
|
||||
|
||||
PrintFightingDojoText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump FightingDojoText
|
||||
|
||||
FightingDojoText::
|
||||
text_far _FightingDojoText
|
||||
text_end
|
||||
39
engine/events/hidden_objects/gym_statues.asm
Normal file
39
engine/events/hidden_objects/gym_statues.asm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
GymStatues:
|
||||
; if in a gym and have the corresponding badge, a = GymStatueText2_id and jp PrintPredefTextID
|
||||
; if in a gym and don't have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID
|
||||
; else ret
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
ld hl, MapBadgeFlags
|
||||
ld a, [wCurMap]
|
||||
ld b, a
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
ret z
|
||||
cp b
|
||||
jr z, .match
|
||||
inc hl
|
||||
jr .loop
|
||||
.match
|
||||
ld b, [hl]
|
||||
ld a, [wBeatGymFlags]
|
||||
and b
|
||||
cp b
|
||||
tx_pre_id GymStatueText2
|
||||
jr z, .haveBadge
|
||||
tx_pre_id GymStatueText1
|
||||
.haveBadge
|
||||
jp PrintPredefTextID
|
||||
|
||||
INCLUDE "data/maps/badge_maps.asm"
|
||||
|
||||
GymStatueText1::
|
||||
text_far _GymStatueText1
|
||||
text_end
|
||||
|
||||
GymStatueText2::
|
||||
text_far _GymStatueText2
|
||||
text_end
|
||||
10
engine/events/hidden_objects/indigo_plateau_hq.asm
Normal file
10
engine/events/hidden_objects/indigo_plateau_hq.asm
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
PrintIndigoPlateauHQText:
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump IndigoPlateauHQText
|
||||
|
||||
IndigoPlateauHQText::
|
||||
text_far _IndigoPlateauHQText
|
||||
text_end
|
||||
24
engine/events/hidden_objects/indigo_plateau_statues.asm
Normal file
24
engine/events/hidden_objects/indigo_plateau_statues.asm
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
IndigoPlateauStatues::
|
||||
text_asm
|
||||
ld hl, IndigoPlateauStatuesText1
|
||||
call PrintText
|
||||
ld a, [wXCoord]
|
||||
bit 0, a
|
||||
ld hl, IndigoPlateauStatuesText2
|
||||
jr nz, .ok
|
||||
ld hl, IndigoPlateauStatuesText3
|
||||
.ok
|
||||
call PrintText
|
||||
jp TextScriptEnd
|
||||
|
||||
IndigoPlateauStatuesText1:
|
||||
text_far _IndigoPlateauStatuesText1
|
||||
text_end
|
||||
|
||||
IndigoPlateauStatuesText2:
|
||||
text_far _IndigoPlateauStatuesText2
|
||||
text_end
|
||||
|
||||
IndigoPlateauStatuesText3:
|
||||
text_far _IndigoPlateauStatuesText3
|
||||
text_end
|
||||
8
engine/events/hidden_objects/magazines.asm
Normal file
8
engine/events/hidden_objects/magazines.asm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
PrintMagazinesText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre MagazinesText
|
||||
ret
|
||||
|
||||
MagazinesText::
|
||||
text_far _MagazinesText
|
||||
text_end
|
||||
52
engine/events/hidden_objects/museum_fossils.asm
Normal file
52
engine/events/hidden_objects/museum_fossils.asm
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
AerodactylFossil:
|
||||
ld a, FOSSIL_AERODACTYL
|
||||
ld [wcf91], a
|
||||
call DisplayMonFrontSpriteInBox
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre AerodactylFossilText
|
||||
ret
|
||||
|
||||
AerodactylFossilText::
|
||||
text_far _AerodactylFossilText
|
||||
text_end
|
||||
|
||||
KabutopsFossil:
|
||||
ld a, FOSSIL_KABUTOPS
|
||||
ld [wcf91], a
|
||||
call DisplayMonFrontSpriteInBox
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre KabutopsFossilText
|
||||
ret
|
||||
|
||||
KabutopsFossilText::
|
||||
text_far _KabutopsFossilText
|
||||
text_end
|
||||
|
||||
DisplayMonFrontSpriteInBox:
|
||||
; Displays a pokemon's front sprite in a pop-up window.
|
||||
; [wcf91] = pokemon internal id number
|
||||
ld a, 1
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ldh [hWY], a
|
||||
call SaveScreenTilesToBuffer1
|
||||
ld a, MON_SPRITE_POPUP
|
||||
ld [wTextBoxID], a
|
||||
call DisplayTextBoxID
|
||||
call UpdateSprites
|
||||
ld a, [wcf91]
|
||||
ld [wd0b5], a
|
||||
call GetMonHeader
|
||||
ld de, vChars1 tile $31
|
||||
call LoadMonFrontSprite
|
||||
ld a, $80
|
||||
ldh [hStartTileID], a
|
||||
hlcoord 10, 11
|
||||
predef AnimateSendingOutMon
|
||||
call WaitForTextScrollButtonPress
|
||||
call LoadScreenTilesFromBuffer1
|
||||
call Delay3
|
||||
ld a, $90
|
||||
ldh [hWY], a
|
||||
ret
|
||||
7
engine/events/hidden_objects/new_bike.asm
Normal file
7
engine/events/hidden_objects/new_bike.asm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
PrintNewBikeText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump NewBicycleText
|
||||
|
||||
NewBicycleText::
|
||||
text_far _NewBicycleText
|
||||
text_end
|
||||
10
engine/events/hidden_objects/oaks_lab_email.asm
Normal file
10
engine/events/hidden_objects/oaks_lab_email.asm
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
DisplayOakLabEmailText:
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump OakLabEmailText
|
||||
|
||||
OakLabEmailText::
|
||||
text_far _OakLabEmailText
|
||||
text_end
|
||||
29
engine/events/hidden_objects/oaks_lab_posters.asm
Normal file
29
engine/events/hidden_objects/oaks_lab_posters.asm
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
DisplayOakLabLeftPoster:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump PushStartText
|
||||
|
||||
PushStartText::
|
||||
text_far _PushStartText
|
||||
text_end
|
||||
|
||||
DisplayOakLabRightPoster:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld hl, wPokedexOwned
|
||||
ld b, wPokedexOwnedEnd - wPokedexOwned
|
||||
call CountSetBits
|
||||
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::
|
||||
text_far _SaveOptionText
|
||||
text_end
|
||||
|
||||
StrengthsAndWeaknessesText::
|
||||
text_far _StrengthsAndWeaknessesText
|
||||
text_end
|
||||
11
engine/events/hidden_objects/pokecenter_pc.asm
Normal file
11
engine/events/hidden_objects/pokecenter_pc.asm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
OpenPokemonCenterPC:
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, TRUE
|
||||
ld [wAutoTextBoxDrawingControl], a
|
||||
tx_pre_jump PokemonCenterPCText
|
||||
|
||||
PokemonCenterPCText::
|
||||
script_pokecenter_pc
|
||||
3
engine/events/hidden_objects/pokemon_stuff.asm
Normal file
3
engine/events/hidden_objects/pokemon_stuff.asm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
PokemonStuffText::
|
||||
text_far _PokemonStuffText
|
||||
text_end
|
||||
14
engine/events/hidden_objects/reds_room.asm
Normal file
14
engine/events/hidden_objects/reds_room.asm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
PrintRedSNESText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump RedBedroomSNESText
|
||||
|
||||
RedBedroomSNESText::
|
||||
text_far _RedBedroomSNESText
|
||||
text_end
|
||||
|
||||
OpenRedsPC:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump RedBedroomPCText
|
||||
|
||||
RedBedroomPCText::
|
||||
script_players_pc
|
||||
14
engine/events/hidden_objects/route_15_binoculars.asm
Normal file
14
engine/events/hidden_objects/route_15_binoculars.asm
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
Route15GateLeftBinoculars:
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
cp SPRITE_FACING_UP
|
||||
ret nz
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre Route15UpstairsBinocularsText
|
||||
ld a, ARTICUNO
|
||||
ld [wcf91], a
|
||||
call PlayCry
|
||||
jp DisplayMonFrontSpriteInBox
|
||||
|
||||
Route15UpstairsBinocularsText::
|
||||
text_far _Route15UpstairsBinocularsText
|
||||
text_end
|
||||
81
engine/events/hidden_objects/safari_game.asm
Normal file
81
engine/events/hidden_objects/safari_game.asm
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
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, SafariZoneGameOver
|
||||
jr SafariZoneGameStillGoing
|
||||
|
||||
SafariZoneCheckSteps::
|
||||
IF DEF(_DEBUG)
|
||||
call DebugPressedOrHeldB
|
||||
ret nz
|
||||
ENDC
|
||||
ld a, [wSafariSteps]
|
||||
ld b, a
|
||||
ld a, [wSafariSteps + 1]
|
||||
ld c, a
|
||||
or b
|
||||
jr z, SafariZoneGameOver
|
||||
dec bc
|
||||
ld a, b
|
||||
ld [wSafariSteps], a
|
||||
ld a, c
|
||||
ld [wSafariSteps + 1], a
|
||||
SafariZoneGameStillGoing:
|
||||
xor a
|
||||
ld [wSafariZoneGameOver], a
|
||||
ret
|
||||
|
||||
SafariZoneGameOver:
|
||||
call EnableAutoTextBoxDrawing
|
||||
xor a
|
||||
ld [wAudioFadeOutControl], a
|
||||
dec a ; SFX_STOP_ALL_MUSIC
|
||||
call PlaySound
|
||||
ld c, 0 ; BANK(SFX_Safari_Zone_PA)
|
||||
ld a, SFX_SAFARI_ZONE_PA
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
|
||||
ld a, TEXT_SAFARI_GAME_OVER
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
call DisplayTextID
|
||||
xor a
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SAFARI_ZONE_GATE
|
||||
ldh [hWarpDestinationMap], a
|
||||
ld a, $3
|
||||
ld [wDestinationWarpID], a
|
||||
ld a, $5
|
||||
ld [wSafariZoneGateCurScript], a
|
||||
SetEvent EVENT_SAFARI_GAME_OVER
|
||||
ld a, 1
|
||||
ld [wSafariZoneGameOver], a
|
||||
ret
|
||||
|
||||
PrintSafariGameOverText::
|
||||
xor a
|
||||
ld [wJoyIgnore], a
|
||||
ld hl, SafariGameOverText
|
||||
jp PrintText
|
||||
|
||||
SafariGameOverText:
|
||||
text_asm
|
||||
ld a, [wNumSafariBalls]
|
||||
and a
|
||||
jr z, .noMoreSafariBalls
|
||||
ld hl, TimesUpText
|
||||
call PrintText
|
||||
.noMoreSafariBalls
|
||||
ld hl, GameOverText
|
||||
call PrintText
|
||||
jp TextScriptEnd
|
||||
|
||||
TimesUpText:
|
||||
text_far _TimesUpText
|
||||
text_end
|
||||
|
||||
GameOverText:
|
||||
text_far _GameOverText
|
||||
text_end
|
||||
224
engine/events/hidden_objects/school_blackboard.asm
Normal file
224
engine/events/hidden_objects/school_blackboard.asm
Normal file
|
|
@ -0,0 +1,224 @@
|
|||
PrintBlackboardLinkCableText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, $1
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
ld a, [wHiddenObjectFunctionArgument]
|
||||
call PrintPredefTextID
|
||||
ret
|
||||
|
||||
LinkCableHelp::
|
||||
text_asm
|
||||
call SaveScreenTilesToBuffer1
|
||||
ld hl, LinkCableHelpText1
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wMenuItemOffset], a ; not used
|
||||
ld [wCurrentMenuItem], a
|
||||
ld [wLastMenuItem], a
|
||||
ld a, A_BUTTON | B_BUTTON
|
||||
ld [wMenuWatchedKeys], a
|
||||
ld a, 3
|
||||
ld [wMaxMenuItem], a
|
||||
ld a, 2
|
||||
ld [wTopMenuItemY], a
|
||||
ld a, 1
|
||||
ld [wTopMenuItemX], a
|
||||
.linkHelpLoop
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
hlcoord 0, 0
|
||||
ld b, 8
|
||||
ld c, 13
|
||||
call TextBoxBorder
|
||||
hlcoord 2, 2
|
||||
ld de, HowToLinkText
|
||||
call PlaceString
|
||||
ld hl, LinkCableHelpText2
|
||||
call PrintText
|
||||
call HandleMenuInput
|
||||
bit 1, a ; pressed b
|
||||
jr nz, .exit
|
||||
ld a, [wCurrentMenuItem]
|
||||
cp 3 ; pressed a on "STOP READING"
|
||||
jr z, .exit
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
ld hl, LinkCableInfoTexts
|
||||
add a
|
||||
ld d, 0
|
||||
ld e, a
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
call PrintText
|
||||
jp .linkHelpLoop
|
||||
.exit
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
call LoadScreenTilesFromBuffer1
|
||||
jp TextScriptEnd
|
||||
|
||||
LinkCableHelpText1:
|
||||
text_far _LinkCableHelpText1
|
||||
text_end
|
||||
|
||||
LinkCableHelpText2:
|
||||
text_far _LinkCableHelpText2
|
||||
text_end
|
||||
|
||||
HowToLinkText:
|
||||
db "HOW TO LINK"
|
||||
next "COLOSSEUM"
|
||||
next "TRADE CENTER"
|
||||
next "STOP READING@"
|
||||
|
||||
LinkCableInfoTexts:
|
||||
dw LinkCableInfoText1
|
||||
dw LinkCableInfoText2
|
||||
dw LinkCableInfoText3
|
||||
|
||||
LinkCableInfoText1:
|
||||
text_far _LinkCableInfoText1
|
||||
text_end
|
||||
|
||||
LinkCableInfoText2:
|
||||
text_far _LinkCableInfoText2
|
||||
text_end
|
||||
|
||||
LinkCableInfoText3:
|
||||
text_far _LinkCableInfoText3
|
||||
text_end
|
||||
|
||||
ViridianSchoolBlackboard::
|
||||
text_asm
|
||||
call SaveScreenTilesToBuffer1
|
||||
ld hl, ViridianSchoolBlackboardText1
|
||||
call PrintText
|
||||
xor a
|
||||
ld [wMenuItemOffset], a
|
||||
ld [wCurrentMenuItem], a
|
||||
ld [wLastMenuItem], a
|
||||
ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON
|
||||
ld [wMenuWatchedKeys], a
|
||||
ld a, 2
|
||||
ld [wMaxMenuItem], a
|
||||
ld a, 2
|
||||
ld [wTopMenuItemY], a
|
||||
ld a, 1
|
||||
ld [wTopMenuItemX], a
|
||||
.blackboardLoop
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
hlcoord 0, 0
|
||||
lb bc, 6, 10
|
||||
call TextBoxBorder
|
||||
hlcoord 1, 2
|
||||
ld de, StatusAilmentText1
|
||||
call PlaceString
|
||||
hlcoord 6, 2
|
||||
ld de, StatusAilmentText2
|
||||
call PlaceString
|
||||
ld hl, ViridianSchoolBlackboardText2
|
||||
call PrintText
|
||||
call HandleMenuInput ; pressing up and down is handled in here
|
||||
bit 1, a ; pressed b
|
||||
jr nz, .exitBlackboard
|
||||
bit 4, a ; pressed right
|
||||
jr z, .didNotPressRight
|
||||
; move cursor to right column
|
||||
ld a, 2
|
||||
ld [wMaxMenuItem], a
|
||||
ld a, 2
|
||||
ld [wTopMenuItemY], a
|
||||
ld a, 6
|
||||
ld [wTopMenuItemX], a
|
||||
ld a, 3 ; in the the right column, use an offset to prevent overlap
|
||||
ld [wMenuItemOffset], a
|
||||
jr .blackboardLoop
|
||||
.didNotPressRight
|
||||
bit 5, a ; pressed left
|
||||
jr z, .didNotPressLeftOrRight
|
||||
; move cursor to left column
|
||||
ld a, 2
|
||||
ld [wMaxMenuItem], a
|
||||
ld a, 2
|
||||
ld [wTopMenuItemY], a
|
||||
ld a, 1
|
||||
ld [wTopMenuItemX], a
|
||||
xor a
|
||||
ld [wMenuItemOffset], a
|
||||
jr .blackboardLoop
|
||||
.didNotPressLeftOrRight
|
||||
ld a, [wCurrentMenuItem]
|
||||
ld b, a
|
||||
ld a, [wMenuItemOffset]
|
||||
add b
|
||||
cp 5 ; cursor is pointing to "QUIT"
|
||||
jr z, .exitBlackboard
|
||||
; we must have pressed a on a status condition
|
||||
; so print the text
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
ld hl, ViridianBlackboardStatusPointers
|
||||
add a
|
||||
ld d, 0
|
||||
ld e, a
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
call PrintText
|
||||
jp .blackboardLoop
|
||||
.exitBlackboard
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
call LoadScreenTilesFromBuffer1
|
||||
jp TextScriptEnd
|
||||
|
||||
ViridianSchoolBlackboardText1:
|
||||
text_far _ViridianSchoolBlackboardText1
|
||||
text_end
|
||||
|
||||
ViridianSchoolBlackboardText2:
|
||||
text_far _ViridianSchoolBlackboardText2
|
||||
text_end
|
||||
|
||||
StatusAilmentText1:
|
||||
db " SLP"
|
||||
next " PSN"
|
||||
next " PAR@"
|
||||
|
||||
StatusAilmentText2:
|
||||
db " BRN"
|
||||
next " FRZ"
|
||||
next " QUIT@"
|
||||
|
||||
db "@" ; unused
|
||||
|
||||
ViridianBlackboardStatusPointers:
|
||||
dw ViridianBlackboardSleepText
|
||||
dw ViridianBlackboardPoisonText
|
||||
dw ViridianBlackboardPrlzText
|
||||
dw ViridianBlackboardBurnText
|
||||
dw ViridianBlackboardFrozenText
|
||||
|
||||
ViridianBlackboardSleepText:
|
||||
text_far _ViridianBlackboardSleepText
|
||||
text_end
|
||||
|
||||
ViridianBlackboardPoisonText:
|
||||
text_far _ViridianBlackboardPoisonText
|
||||
text_end
|
||||
|
||||
ViridianBlackboardPrlzText:
|
||||
text_far _ViridianBlackboardPrlzText
|
||||
text_end
|
||||
|
||||
ViridianBlackboardBurnText:
|
||||
text_far _ViridianBlackboardBurnText
|
||||
text_end
|
||||
|
||||
ViridianBlackboardFrozenText:
|
||||
text_far _ViridianBlackboardFrozenText
|
||||
text_end
|
||||
65
engine/events/hidden_objects/school_notebooks.asm
Normal file
65
engine/events/hidden_objects/school_notebooks.asm
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
PrintNotebookText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, $1
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
ld a, [wHiddenObjectFunctionArgument]
|
||||
jp PrintPredefTextID
|
||||
|
||||
TMNotebook::
|
||||
text_far TMNotebookText
|
||||
text_waitbutton
|
||||
text_end
|
||||
|
||||
ViridianSchoolNotebook::
|
||||
text_asm
|
||||
ld hl, ViridianSchoolNotebookText1
|
||||
call PrintText
|
||||
call TurnPageSchoolNotebook
|
||||
jr nz, .doneReading
|
||||
ld hl, ViridianSchoolNotebookText2
|
||||
call PrintText
|
||||
call TurnPageSchoolNotebook
|
||||
jr nz, .doneReading
|
||||
ld hl, ViridianSchoolNotebookText3
|
||||
call PrintText
|
||||
call TurnPageSchoolNotebook
|
||||
jr nz, .doneReading
|
||||
ld hl, ViridianSchoolNotebookText4
|
||||
call PrintText
|
||||
ld hl, ViridianSchoolNotebookText5
|
||||
call PrintText
|
||||
.doneReading
|
||||
jp TextScriptEnd
|
||||
|
||||
TurnPageSchoolNotebook:
|
||||
ld hl, TurnPageText
|
||||
call PrintText
|
||||
call YesNoChoice
|
||||
ld a, [wCurrentMenuItem]
|
||||
and a
|
||||
ret
|
||||
|
||||
TurnPageText:
|
||||
text_far _TurnPageText
|
||||
text_end
|
||||
|
||||
ViridianSchoolNotebookText5:
|
||||
text_far _ViridianSchoolNotebookText5
|
||||
text_waitbutton
|
||||
text_end
|
||||
|
||||
ViridianSchoolNotebookText1:
|
||||
text_far _ViridianSchoolNotebookText1
|
||||
text_end
|
||||
|
||||
ViridianSchoolNotebookText2:
|
||||
text_far _ViridianSchoolNotebookText2
|
||||
text_end
|
||||
|
||||
ViridianSchoolNotebookText3:
|
||||
text_far _ViridianSchoolNotebookText3
|
||||
text_end
|
||||
|
||||
ViridianSchoolNotebookText4:
|
||||
text_far _ViridianSchoolNotebookText4
|
||||
text_end
|
||||
22
engine/events/hidden_objects/town_map.asm
Normal file
22
engine/events/hidden_objects/town_map.asm
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
TownMapText::
|
||||
text_far _TownMapText
|
||||
text_promptbutton
|
||||
text_asm
|
||||
ld a, $1
|
||||
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
call GBPalWhiteOutWithDelay3
|
||||
xor a
|
||||
ldh [hWY], a
|
||||
inc a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call LoadFontTilePatterns
|
||||
farcall DisplayTownMap
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
ld de, TextScriptEnd
|
||||
push de
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
jp CloseTextDisplay
|
||||
176
engine/events/hidden_objects/vermilion_gym_trash.asm
Normal file
176
engine/events/hidden_objects/vermilion_gym_trash.asm
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
PrintTrashText:
|
||||
call EnableAutoTextBoxDrawing
|
||||
tx_pre_jump VermilionGymTrashText
|
||||
|
||||
VermilionGymTrashText::
|
||||
text_far _VermilionGymTrashText
|
||||
text_end
|
||||
|
||||
GymTrashScript:
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, [wHiddenObjectFunctionArgument]
|
||||
ld [wGymTrashCanIndex], a
|
||||
|
||||
; Don't do the trash can puzzle if it's already been done.
|
||||
CheckEvent EVENT_2ND_LOCK_OPENED
|
||||
jr z, .ok
|
||||
|
||||
tx_pre_jump VermilionGymTrashText
|
||||
|
||||
.ok
|
||||
CheckEventReuseA EVENT_1ST_LOCK_OPENED
|
||||
jr nz, .trySecondLock
|
||||
|
||||
ld a, [wFirstLockTrashCanIndex]
|
||||
ld b, a
|
||||
ld a, [wGymTrashCanIndex]
|
||||
cp b
|
||||
jr z, .openFirstLock
|
||||
|
||||
tx_pre_id VermilionGymTrashText
|
||||
jr .done
|
||||
|
||||
.openFirstLock
|
||||
; Next can is trying for the second switch.
|
||||
SetEvent EVENT_1ST_LOCK_OPENED
|
||||
|
||||
ld hl, GymTrashCans
|
||||
ld a, [wGymTrashCanIndex]
|
||||
; * 5
|
||||
ld b, a
|
||||
add a
|
||||
add a
|
||||
add b
|
||||
|
||||
ld d, 0
|
||||
ld e, a
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
|
||||
; There is a bug in this code. It should calculate a value in the range [0, 3]
|
||||
; but if the mask and random number don't have any 1 bits in common, then
|
||||
; the result of the AND will be 0. When 1 is subtracted from that, the value
|
||||
; will become $ff. This will result in 255 being added to hl, which will cause
|
||||
; hl to point to one of the zero bytes that pad the end of the ROM bank.
|
||||
; Trash can 0 was intended to be able to have the second lock only when the
|
||||
; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can
|
||||
; have the second lock regardless of which trash can had the first lock.
|
||||
|
||||
ldh [hGymTrashCanRandNumMask], a
|
||||
push hl
|
||||
call Random
|
||||
swap a
|
||||
ld b, a
|
||||
ldh a, [hGymTrashCanRandNumMask]
|
||||
and b
|
||||
dec a
|
||||
pop hl
|
||||
|
||||
ld d, 0
|
||||
ld e, a
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
and $f
|
||||
ld [wSecondLockTrashCanIndex], a
|
||||
|
||||
tx_pre_id VermilionGymTrashSuccessText1
|
||||
jr .done
|
||||
|
||||
.trySecondLock
|
||||
ld a, [wSecondLockTrashCanIndex]
|
||||
ld b, a
|
||||
ld a, [wGymTrashCanIndex]
|
||||
cp b
|
||||
jr z, .openSecondLock
|
||||
|
||||
; Reset the cans.
|
||||
ResetEvent EVENT_1ST_LOCK_OPENED
|
||||
call Random
|
||||
|
||||
and $e
|
||||
ld [wFirstLockTrashCanIndex], a
|
||||
|
||||
tx_pre_id VermilionGymTrashFailText
|
||||
jr .done
|
||||
|
||||
.openSecondLock
|
||||
; Completed the trash can puzzle.
|
||||
SetEvent EVENT_2ND_LOCK_OPENED
|
||||
ld hl, wCurrentMapScriptFlags
|
||||
set 6, [hl]
|
||||
|
||||
tx_pre_id VermilionGymTrashSuccessText3
|
||||
|
||||
.done
|
||||
jp PrintPredefTextID
|
||||
|
||||
GymTrashCans:
|
||||
; byte 0: mask for random number
|
||||
; bytes 1-4: indices of the trash cans that can have the second lock
|
||||
; (but see the comment above explaining a bug regarding this)
|
||||
; Note that the mask is simply the number of valid trash can indices that
|
||||
; follow. The remaining bytes are filled with 0 to pad the length of each entry
|
||||
; to 5 bytes.
|
||||
db 2, 1, 3, 0, 0 ; 0
|
||||
db 3, 0, 2, 4, 0 ; 1
|
||||
db 2, 1, 5, 0, 0 ; 2
|
||||
db 3, 0, 4, 6, 0 ; 3
|
||||
db 4, 1, 3, 5, 7 ; 4
|
||||
db 3, 2, 4, 8, 0 ; 5
|
||||
db 3, 3, 7, 9, 0 ; 6
|
||||
db 4, 4, 6, 8, 10 ; 7
|
||||
db 3, 5, 7, 11, 0 ; 8
|
||||
db 3, 6, 10, 12, 0 ; 9
|
||||
db 4, 7, 9, 11, 13 ; 10
|
||||
db 3, 8, 10, 14, 0 ; 11
|
||||
db 2, 9, 13, 0, 0 ; 12
|
||||
db 3, 10, 12, 14, 0 ; 13
|
||||
db 2, 11, 13, 0, 0 ; 14
|
||||
|
||||
VermilionGymTrashSuccessText1::
|
||||
text_far _VermilionGymTrashSuccessText1
|
||||
text_asm
|
||||
call WaitForSoundToFinish
|
||||
ld a, SFX_SWITCH
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
jp TextScriptEnd
|
||||
|
||||
; unused
|
||||
VermilionGymTrashSuccessText2::
|
||||
text_far _VermilionGymTrashSuccessText2
|
||||
text_end
|
||||
|
||||
; unused
|
||||
VermilionGymTrashSuccesPlaySfx:
|
||||
text_asm
|
||||
call WaitForSoundToFinish
|
||||
ld a, SFX_SWITCH
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
jp TextScriptEnd
|
||||
|
||||
VermilionGymTrashSuccessText3::
|
||||
text_far _VermilionGymTrashSuccessText3
|
||||
text_asm
|
||||
call WaitForSoundToFinish
|
||||
ld a, SFX_GO_INSIDE
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
jp TextScriptEnd
|
||||
|
||||
VermilionGymTrashFailText::
|
||||
text_far _VermilionGymTrashFailText
|
||||
text_asm
|
||||
call WaitForSoundToFinish
|
||||
ld a, SFX_DENIED
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
jp TextScriptEnd
|
||||
|
||||
; Trash cans are broken and can read the 255th entry sometimes for
|
||||
; the second can.
|
||||
; rgblink was placing stuff here, so the behavior was different from
|
||||
; original Red. This is the simplest non-code fix: allocate zeroes as
|
||||
; far as the broken code could reach.
|
||||
ds 255
|
||||
Loading…
Add table
Add a link
Reference in a new issue