summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-11-07 14:48:11 -0500
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-11-07 14:48:11 -0500
commit32ba300e6c18c1f52603111777aa41efea0550d0 (patch)
tree713bb132c04ece266d5dd7bab36137e3b7631e22
parentb5d907aede88eea92556b31ca48db36534ee21ed (diff)
engine/overworld/pokecenter.asm
-rw-r--r--engine/bank3f/main.asm4
-rwxr-xr-xengine/overworld/pokecenter.asm113
-rwxr-xr-xyellow/main.asm39
3 files changed, 135 insertions, 21 deletions
diff --git a/engine/bank3f/main.asm b/engine/bank3f/main.asm
index 72942405..c0ff4b21 100644
--- a/engine/bank3f/main.asm
+++ b/engine/bank3f/main.asm
@@ -1730,7 +1730,9 @@ Func_fd001:: ; fd001 (3f:5001)
Func_fd004:: ; fd004 (3f:5004)
dr $fd004,$fd0d0
Func_fd0d0:: ; fd0d0 (3f:50d0)
- dr $fd0d0,$fd2a1
+ dr $fd0d0,$fd252
+Func_fd252: ; fd252 (3f:5252)
+ dr $fd252,$fd2a1
Func_fd2a1:: ; fd2a1 (3f:52a1)
dr $fd2a1,$fe66f
diff --git a/engine/overworld/pokecenter.asm b/engine/overworld/pokecenter.asm
index f302d994..657013e6 100755
--- a/engine/overworld/pokecenter.asm
+++ b/engine/overworld/pokecenter.asm
@@ -1,4 +1,13 @@
-DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
+DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
+ ld a, [wCurMap]
+ cp PEWTER_POKECENTER
+ jr nz, .regularCenter
+ call Func_154a
+ jr z, .regularCenter
+ ld hl, LooksContentText ; if pikachu is sleeping, don't heal
+ call PrintText
+ ret
+.regularCenter
call SaveScreenTilesToBuffer1 ; save screen
ld hl, PokemonCenterWelcomeText
call PrintText
@@ -11,18 +20,36 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
call PrintText
.skipShallWeHealYourPokemon
call YesNoChoicePokeCenter ; yes/no menu
+ call UpdateSprites
ld a, [wCurrentMenuItem]
and a
- jr nz, .declinedHealing ; if the player chose No
+ jp nz, .declinedHealing ; if the player chose No
call SetLastBlackoutMap
- call LoadScreenTilesFromBuffer1 ; restore screen
+ callab IsPikachuInOurParty
+ jr nc, .notHealingPlayerPikachu
+ call Func_154a
+ jr nz, .notHealingPlayerPikachu
+ call LoadCurrentMapView
+ call Delay3
+ call UpdateSprites
+ callab Func_fd252 ; todo
+.notHealingPlayerPikachu
ld hl, NeedYourPokemonText
call PrintText
- ld a, $18
- ld [wSpriteStateData1 + $12], a ; make the nurse turn to face the machine
- call Delay3
- predef HealParty
+ ld c, 64
+ call DelayFrames
+ call Func_154a
+ jr nz, .playerPikachuNotOnScreen
+ call Func_152d
+ callab IsPikachuInOurParty
+ call c, Func_6eaa
+.playerPikachuNotOnScreen
+ lb bc, 1, 8
+ call Func_6ebb
+ ld c, 30
+ call DelayFrames
callba AnimateHealingMachine ; do the healing machine animation
+ predef HealParty
xor a
ld [wAudioFadeOutControl], a
ld a, [wAudioSavedROMBank]
@@ -31,38 +58,92 @@ DisplayPokemonCenterDialogue_: ; 6fe6 (1:6fe6)
ld [wLastMusicSoundID], a
ld [wNewSoundID], a
call PlaySound
+ call Func_154a
+ jr nz, .doNotReturnPikachu
+ callab IsPikachuInOurParty
+ call c, Func_6eaa
+ ld a, $5
+ ld [wd431], a
+ call Func_1525
+.doNotReturnPikachu
+ lb bc, 1, 0
+ call Func_6ebb
ld hl, PokemonFightingFitText
call PrintText
- ld a, $14
- ld [wSpriteStateData1 + $12], a ; make the nurse bow
- ld c, a
+ callab IsPikachuInOurParty
+ jr nc, .notInParty
+ lb bc, 15, 0
+ call Func_6ebb
+.notInParty
+ call LoadCurrentMapView
+ call Delay3
+ call UpdateSprites
+ callab Func_140d2
+ ld a, $1
+ ld [H_SPRITEINDEX], a
+ ld a, $1
+ ld [hSpriteImageIndex], a
+ call SpriteFunc_34a1
+ ld c, 40
call DelayFrames
+ call UpdateSprites
+ call LoadFontTilePatterns
jr .done
.declinedHealing
call LoadScreenTilesFromBuffer1 ; restore screen
.done
ld hl, PokemonCenterFarewellText
call PrintText
- jp UpdateSprites
+ call UpdateSprites
+ ret
-PokemonCenterWelcomeText: ; 705d (1:705d)
+Func_6eaa: ; 6eaa (1:6eaa)
+ ld a, $1
+ ld [H_SPRITEINDEX], a
+ ld a, $4
+ ld [hSpriteImageIndex], a
+ call SpriteFunc_34a1
+ ld c, 64
+ call DelayFrames
+ ret
+
+Func_6ebb: ; 6ebb (1:6ebb)
+ ld a, b
+ ld [H_SPRITEINDEX], a
+ ld a, c
+ ld [hSpriteImageIndex], a
+ push bc
+ call SetSpriteFacingDirectionAndDelay
+ pop bc
+ ld a, b
+ ld [H_SPRITEINDEX], a
+ ld a, c
+ ld [hSpriteImageIndex], a
+ call SpriteFunc_34a1
+ ret
+
+PokemonCenterWelcomeText: ; 6de0 (1:6de0)
TX_FAR _PokemonCenterWelcomeText
db "@"
-ShallWeHealYourPokemonText: ; 7062 (1:7062)
+ShallWeHealYourPokemonText: ; 6de5 (1:6de5)
db $a
TX_FAR _ShallWeHealYourPokemonText
db "@"
-NeedYourPokemonText: ; 7068 (1:7068)
+NeedYourPokemonText: ; 6deb (1:6deb)
TX_FAR _NeedYourPokemonText
db "@"
-PokemonFightingFitText: ; 706d (1:706d)
+PokemonFightingFitText: ; 6ee0 (1:6ee0)
TX_FAR _PokemonFightingFitText
db "@"
-PokemonCenterFarewellText: ; 7072 (1:7072)
+PokemonCenterFarewellText: ; 6ee5 (1:6ee5)
db $a
TX_FAR _PokemonCenterFarewellText
db "@"
+
+LooksContentText: ; 6eeb (1:6eeb)
+ TX_FAR _LooksContentText
+ db "@" \ No newline at end of file
diff --git a/yellow/main.asm b/yellow/main.asm
index 5ceee28e..bca6d671 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -890,10 +890,39 @@ HandleItemListSwapping: ; 68c9 (1:68c9)
jp DisplayListMenuIDLoop
INCLUDE "engine/overworld/pokemart.asm"
-
INCLUDE "engine/learn_move.asm"
-DisplayPokemonCenterDialogue_: ; 6d97 (1:6d97)
- dr $6d97,$6f0e
+INCLUDE "engine/overworld/pokecenter.asm"
+
+SetLastBlackoutMap: ; 6ef0 (1:6ef0)
+; Set the map to return to when
+; blacking out or using Teleport or Dig.
+; Safari rest houses don't count.
+
+ push hl
+ ld hl, SafariZoneRestHouses
+ ld a, [wCurMap]
+ ld b, a
+.loop
+ ld a, [hli]
+ cp -1
+ jr z, .notresthouse
+ cp b
+ jr nz, .loop
+ jr .done
+
+.notresthouse
+ ld a, [wLastMap]
+ ld [wLastBlackoutMap], a
+.done
+ pop hl
+ ret
+
+SafariZoneRestHouses: ; 6f0a (1:6f0a)
+ db SAFARI_ZONE_REST_HOUSE_2
+ db SAFARI_ZONE_REST_HOUSE_3
+ db SAFARI_ZONE_REST_HOUSE_4
+ db -1
+
DisplayTextIDInit: ; 6f0e (1:6f0e)
dr $6f0e,$6f80
DrawStartMenu: ; 6f80 (1:6f80)
@@ -3297,7 +3326,9 @@ SECTION "NPC Sprites 2", ROMX, BANK[NPC_SPRITES_2]
dr $14000,$1401b
_InitMapSprites: ; 1401b (5:401b)
- dr $1401b,$143f1
+ dr $1401b,$140d2
+Func_140d2: ; 140d2 (5:40d2)
+ dr $140d2,$143f1
RedCyclingSprite: INCBIN "gfx/sprites/cycling.2bpp"
RedSprite: INCBIN "gfx/sprites/red.2bpp"