summaryrefslogtreecommitdiff
path: root/home/text_script.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/text_script.asm')
-rw-r--r--home/text_script.asm62
1 files changed, 28 insertions, 34 deletions
diff --git a/home/text_script.asm b/home/text_script.asm
index b9c3c8e4..1847e23b 100644
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -22,6 +22,7 @@ DisplayTextID::
ld [wSpriteIndex], a
dict TEXT_START_MENU, DisplayStartMenu
+ dict TEXT_PIKACHU_ANIM, DisplayPikachuEmotion
dict TEXT_SAFARI_GAME_OVER, DisplaySafariGameOverText
dict TEXT_MON_FAINTED, DisplayPokemonFaintedText
dict TEXT_BLACKED_OUT, DisplayPlayerBlackedOutText
@@ -36,20 +37,18 @@ DisplayTextID::
.spriteHandling
; get the text ID of the sprite
push hl
- push de
- push bc
- farcall UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction)
- pop bc
- pop de
+ ;push de
+ ;push bc
+ ;farcall UpdateSpriteFacingOffsetAndDelayMovement ; update the graphics of the sprite the player is talking to (to face the right direction)
+ ;pop bc
+ ;pop de
ld hl, wMapSpriteData ; NPC text entries
ldh a, [hSpriteIndexOrTextID]
dec a
add a
- add l
- ld l, a
- jr nc, .noCarry
- inc h
-.noCarry
+ ld e, a
+ ld d, $0
+ add hl, de
inc hl
ld a, [hl] ; a = text ID of the sprite
pop hl
@@ -57,7 +56,8 @@ DisplayTextID::
; look up the address of the text in the map's text entries
dec a
ld e, a
- sla e
+ ld d, $0
+ add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
@@ -122,9 +122,6 @@ CloseTextDisplay::
add hl, de
dec c
jr nz, .restoreSpriteFacingDirectionLoop
- ld a, BANK(InitMapSprites)
- ldh [hLoadedROMBank], a
- ld [MBC1RomBank], a
call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns)
ld hl, wFontLoaded
res 0, [hl]
@@ -133,8 +130,7 @@ CloseTextDisplay::
call z, LoadPlayerSpriteGraphics
call LoadCurrentMapView
pop af
- ldh [hLoadedROMBank], a
- ld [MBC1RomBank], a
+ call BankswitchCommon
jp UpdateSprites
DisplayPokemartDialogue::
@@ -146,15 +142,7 @@ DisplayPokemartDialogue::
call LoadItemList
ld a, PRICEDITEMLISTMENU
ld [wListMenuID], a
- ldh a, [hLoadedROMBank]
- push af
- ld a, BANK(DisplayPokemartDialogue_)
- ldh [hLoadedROMBank], a
- ld [MBC1RomBank], a
- call DisplayPokemartDialogue_
- pop af
- ldh [hLoadedROMBank], a
- ld [MBC1RomBank], a
+ homecall DisplayPokemartDialogue_
jp AfterDisplayingTextID
PokemartGreetingText::
@@ -185,15 +173,7 @@ DisplayPokemonCenterDialogue::
ldh [hItemPrice + 2], a
inc hl
- ldh a, [hLoadedROMBank]
- push af
- ld a, BANK(DisplayPokemonCenterDialogue_)
- ldh [hLoadedROMBank], a
- ld [MBC1RomBank], a
- call DisplayPokemonCenterDialogue_
- pop af
- ldh [hLoadedROMBank], a
- ld [MBC1RomBank], a
+ homecall DisplayPokemonCenterDialogue_
jp AfterDisplayingTextID
DisplaySafariGameOverText::
@@ -215,6 +195,16 @@ DisplayPlayerBlackedOutText::
ld a, [wd732]
res 5, a ; reset forced to use bike bit
ld [wd732], a
+ CheckEvent EVENT_IN_SAFARI_ZONE
+ jr z, .didnotblackoutinsafari
+ xor a
+ ld [wNumSafariBalls], a
+ ld [wSafariSteps], a
+ ld [wSafariSteps + 1], a
+ EventFlagAddressa EVENT_IN_SAFARI_ZONE
+ ld [wcf0d], a
+ ld [wSafariZoneGateCurScript], a
+.didnotblackoutinsafari
jp HoldTextDisplayOpen
PlayerBlackedOutText::
@@ -229,3 +219,7 @@ DisplayRepelWoreOffText::
RepelWoreOffText::
text_far _RepelWoreOffText
text_end
+
+DisplayPikachuEmotion::
+ callfar TalkToPikachu
+ jp CloseTextDisplay