summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-05-30 11:38:46 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-05-30 11:38:46 -0400
commit6e3581df4b9cbc8cf14fc7948df5df70002cc062 (patch)
tree8304b3a8a196cbc4ed999e0bca065162f09d65ff
parentb9df6fe86f1afa711727badee61a5bfa71030c35 (diff)
Mt Moon Pokemon Center
-rwxr-xr-xdata/mapObjects/mtmoonpokecenter.asm3
-rw-r--r--data/map_header_banks.asm2
-rw-r--r--data/map_header_pointers.asm2
-rw-r--r--engine/bank3c.asm4
-rw-r--r--home/text.asm8
-rw-r--r--macros.asm90
-rwxr-xr-xmain.asm13
-rwxr-xr-xscripts/mtmoonpokecenter.asm72
-rwxr-xr-xscripts/mtmoonpokecenter2.asm66
-rwxr-xr-xwram.asm6
10 files changed, 159 insertions, 107 deletions
diff --git a/data/mapObjects/mtmoonpokecenter.asm b/data/mapObjects/mtmoonpokecenter.asm
index d6cd35ba..935c4a40 100755
--- a/data/mapObjects/mtmoonpokecenter.asm
+++ b/data/mapObjects/mtmoonpokecenter.asm
@@ -7,13 +7,14 @@ MtMoonPokecenterObject: ; 0x49376 (size=56)
db $0 ; signs
- db $6 ; objects
+ db $7 ; objects
object SPRITE_NURSE, $3, $1, STAY, DOWN, $1 ; person
object SPRITE_BUG_CATCHER, $4, $3, STAY, UP, $2 ; person
object SPRITE_GENTLEMAN, $7, $3, STAY, UP, $3 ; person
object SPRITE_FAT_BALD_GUY, $a, $6, WALK, $2, $4 ; person
object SPRITE_CLIPBOARD, $7, $2, STAY, NONE, $5 ; person
object SPRITE_CABLE_CLUB_WOMAN, $b, $2, STAY, DOWN, $6 ; person
+ object SPRITE_CHANSEY, $4, $1, STAY, DOWN, $7 ; person
; warp-to
EVENT_DISP MT_MOON_POKECENTER_WIDTH, $7, $3
diff --git a/data/map_header_banks.asm b/data/map_header_banks.asm
index cbc4395c..ca060492 100644
--- a/data/map_header_banks.asm
+++ b/data/map_header_banks.asm
@@ -68,7 +68,7 @@ MapHeaderBanks:: ; fc3e4 (3f:43e4)
db BANK(CeruleanGym_h)
db BANK(BikeShop_h)
db BANK(CeruleanMart_h)
- db $12 ; db BANK(MtMoonPokecenter_h)
+ db BANK(MtMoonPokecenter_h)
db BANK(CeruleanHouseTrashed_h)
db $07 ; db BANK(Route5Gate_h)
db $17 ; db BANK(UndergroundPathEntranceRoute5_h)
diff --git a/data/map_header_pointers.asm b/data/map_header_pointers.asm
index 5131cf67..d2ecea33 100644
--- a/data/map_header_pointers.asm
+++ b/data/map_header_pointers.asm
@@ -68,7 +68,7 @@ MapHeaderPointers:: ; fc1f2 (3f:41f2)
dw CeruleanGym_h
dw BikeShop_h
dw CeruleanMart_h
- dw $52a9 ; dw MtMoonPokecenter_h
+ dw MtMoonPokecenter_h
dw CeruleanHouseTrashed_h ; copy
dw $5831 ; dw Route5Gate_h
dw $55a8 ; dw UndergroundPathEntranceRoute5_h
diff --git a/engine/bank3c.asm b/engine/bank3c.asm
index 5a18d55b..d176511c 100644
--- a/engine/bank3c.asm
+++ b/engine/bank3c.asm
@@ -485,7 +485,9 @@ CeladonMansion1Text_f1eee:
TX_FAR _CeladonMansion1Text12
db "@"
- dr $f1ef3, $f220e
+ dr $f1ef3, $f218c
+
+INCLUDE "scripts/mtmoonpokecenter2.asm"
INCLUDE "data/mapHeaders/beach_house.asm"
INCLUDE "scripts/beach_house.asm"
diff --git a/home/text.asm b/home/text.asm
index 437a5c79..a0e860d9 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -382,9 +382,9 @@ TextCommandProcessor:: ; 1919 (0:1919)
xor e
ld [wLetterPrintingDelayFlags], a
ld a, c
- ld [wUnusedCC3A], a
+ ld [wTextDestinationTileAddrBuffer], a
ld a, b
- ld [wUnusedCC3B], a
+ ld [wTextDestinationTileAddrBuffer + 1], a
NextTextCommand:: ; 192e (0:192e)
ld a, [hli]
@@ -493,10 +493,10 @@ TextCommand02:: ; 197e (0:197e)
TextCommand03:: ; 1990 (0:1990)
pop hl
ld a, [hli]
- ld [wUnusedCC3A], a
+ ld [wTextDestinationTileAddrBuffer], a
ld c, a
ld a, [hli]
- ld [wUnusedCC3B], a
+ ld [wTextDestinationTileAddrBuffer + 1], a
ld b, a
jp NextTextCommand
diff --git a/macros.asm b/macros.asm
index 6ee88391..ef0b9f01 100644
--- a/macros.asm
+++ b/macros.asm
@@ -153,44 +153,61 @@ bcd3: MACRO
coins equs "bcd2"
money equs "bcd3"
+validateCoords: MACRO
+ if \1 >= SCREEN_WIDTH
+ fail "x coord out of range"
+ endc
+ if \2 >= SCREEN_HEIGHT
+ fail "y coord out of range"
+ endc
+ endm
+
;\1 = r
;\2 = X
;\3 = Y
+;\4 = which tilemap (optional)
coord: MACRO
+ validateCoords \2, \3
if _NARG >= 4
- ld \1, \4 + 20 * \3 + \2
+ ld \1, \4 + SCREEN_WIDTH * \3 + \2
else
- ld \1, wTileMap + 20 * \3 + \2
+ ld \1, wTileMap + SCREEN_WIDTH * \3 + \2
endc
ENDM
;\1 = X
;\2 = Y
+;\3 = which tilemap (optional)
aCoord: MACRO
+ validateCoords \1, \2
if _NARG >= 3
- ld a, [\3 + 20 * \2 + \1]
+ ld a, [\3 + SCREEN_WIDTH * \2 + \1]
else
- ld a, [wTileMap + 20 * \2 + \1]
+ ld a, [wTileMap + SCREEN_WIDTH * \2 + \1]
endc
ENDM
;\1 = X
;\2 = Y
+;\3 = which tilemap (optional)
Coorda: MACRO
+ validateCoords \1, \2
if _NARG >= 3
- ld [\3 + 20 * \2 + \1], a
+ ld [\3 + SCREEN_WIDTH * \2 + \1], a
else
- ld [wTileMap + 20 * \2 + \1], a
+ ld [wTileMap + SCREEN_WIDTH * \2 + \1], a
endc
ENDM
;\1 = X
;\2 = Y
+;\3 = which tilemap (optional)
dwCoord: MACRO
+ validateCoords \1, \2
if _NARG >= 3
- dw \3 + 20 * \2 + \1
+ dw \3 + SCREEN_WIDTH * \2 + \1
else
- dw wTileMap + 20 * \2 + \1
+ dw wTileMap + SCREEN_WIDTH * \2 + \1
endc
ENDM
@@ -266,6 +283,15 @@ dba: MACRO
dbw BANK(\1), \1
ENDM
+dwb: MACRO
+ dw \1
+ db \2
+ ENDM
+
+dab: MACRO
+ dwb \1, BANK(\1)
+ ENDM
+
dbbw: MACRO
db \1, \2
dw \3
@@ -277,22 +303,6 @@ RGB: MACRO
ENDM
; text macros
-TX_NUM: MACRO
-; print a big-endian decimal number.
-; \1: address to read from
-; \2: number of bytes to read
-; \3: number of digits to display
- db $09
- dw \1
- db \2 << 4 | \3
- ENDM
-
-TX_FAR: MACRO
- db $17
- dw \1
- db BANK(\1)
- ENDM
-
; text engine command $1
TX_RAM: MACRO
; prints text to screen
@@ -307,12 +317,26 @@ TX_BCD: MACRO
db \2
ENDM
-TX_ASM: MACRO
- db $08
+TX_CURSOR: MACRO
+; Move cursor to (\1, \2)
+; \1: X coord (0 - 19)
+; \2: Y coord (0 - 17)
+ db $3
+ dwCoord \1, \2
ENDM
-TX_BUTTON_SOUND: MACRO
- db $06
+TX_LINE EQUS "db $05"
+TX_BUTTON_SOUND EQUS "db $06"
+TX_ASM EQUS "db $08"
+
+TX_NUM: MACRO
+; print a big-endian decimal number.
+; \1: address to read from
+; \2: number of bytes to read
+; \3: number of digits to display
+ db $09
+ dw \1
+ db \2 << 4 | \3
ENDM
TX_SFX_ITEM EQUS "db $0b"
@@ -320,6 +344,16 @@ TX_WAIT_BUTTON EQUS "db $0d"
TX_SFX_CONGRATS EQUS "db $10"
TX_SFX_KEY_ITEM EQUS "db $11"
+TX_FAR: MACRO
+; 17AAAABB (call text at BB:AAAA)
+ db $17
+ dab \1
+ ENDM
+
+
+TX_POKECENTER_PC EQUS "db $f6"
+TX_POKECENTER_NURSE EQUS "db $ff"
+
; Predef macro.
add_predef: MACRO
\1Predef::
diff --git a/main.asm b/main.asm
index f4f08f0c..58846267 100755
--- a/main.asm
+++ b/main.asm
@@ -765,7 +765,6 @@ LavenderPokecenterBlocks:
CeladonPokecenterBlocks:
FuchsiaPokecenterBlocks:
CinnabarPokecenterBlocks:
-MtMoonPokecenterBlocks:
RockTunnelPokecenterBlocks:
INCBIN "maps/viridianpokecenter.blk"
dr $440fb,$4410b
@@ -790,7 +789,9 @@ INCLUDE "data/mapHeaders/route7.asm"
INCLUDE "data/mapObjects/route7.asm"
Route7Blocks: ; 48051
INCBIN "maps/route7.blk"
- dr $480ab,$480eb
+MtMoonPokecenterBlocks:
+INCBIN "maps/mtmoonpokecenter.blk"
+ dr $480c7,$480eb
INCLUDE "scripts/route7.asm"
INCLUDE "data/mapHeaders/redshouse1f.asm"
@@ -798,7 +799,13 @@ INCLUDE "scripts/redshouse1f.asm"
INCLUDE "data/mapObjects/redshouse1f.asm"
RedsHouse1FBlocks:
INCBIN "maps/redshouse1f.blk"
- dr $48157,$49953
+ dr $48157,$492a9
+
+INCLUDE "data/mapHeaders/mtmoonpokecenter.asm"
+INCLUDE "scripts/mtmoonpokecenter.asm"
+INCLUDE "data/mapObjects/mtmoonpokecenter.asm"
+
+ dr $49330,$49953
INCLUDE "data/mapHeaders/mtmoon1.asm"
INCLUDE "scripts/mtmoon1.asm"
diff --git a/scripts/mtmoonpokecenter.asm b/scripts/mtmoonpokecenter.asm
index fd3e4e53..888cab4c 100755
--- a/scripts/mtmoonpokecenter.asm
+++ b/scripts/mtmoonpokecenter.asm
@@ -9,9 +9,10 @@ MtMoonPokecenterTextPointers: ; 492d5 (12:52d5)
dw MtMoonPokecenterText4
dw MtMoonPokecenterText5
dw MtMoonPokecenterText6
+ dw MtMoonPokecenterText7
MtMoonPokecenterText1: ; 492e1 (12:52e1)
- db $ff
+ TX_POKECENTER_NURSE
MtMoonPokecenterText2: ; 492e2 (12:52e2)
TX_FAR _MtMoonPokecenterText1
@@ -23,72 +24,17 @@ MtMoonPokecenterText3: ; 492e7 (12:52e7)
MtMoonPokecenterText4: ; 492ec (12:52ec)
TX_ASM
- CheckEvent EVENT_BOUGHT_MAGIKARP, 1
- jp c, .alreadyBoughtMagikarp
- ld hl, MtMoonPokecenterText_4935c
- call PrintText
- ld a, MONEY_BOX
- ld [wTextBoxID], a
- call DisplayTextBoxID
- call YesNoChoice
- ld a, [wCurrentMenuItem]
- and a
- jp nz, .choseNo
- ld [hMoney], a
- ld [hMoney + 2], a
- ld a, $5
- ld [hMoney + 1], a
- call HasEnoughMoney
- jr nc, .enoughMoney
- ld hl, MtMoonPokecenterText_49366
- jr .printText
-.enoughMoney
- lb bc, MAGIKARP, 5
- call GivePokemon
- jr nc, .done
- xor a
- ld [wPriceTemp], a
- ld [wPriceTemp + 2], a
- ld a, $5
- ld [wPriceTemp + 1], a
- ld hl, wPriceTemp + 2
- ld de, wPlayerMoney + 2
- ld c, $3
- predef SubBCDPredef
- ld a, MONEY_BOX
- ld [wTextBoxID], a
- call DisplayTextBoxID
- SetEvent EVENT_BOUGHT_MAGIKARP
- jr .done
-.choseNo
- ld hl, MtMoonPokecenterText_49361
- jr .printText
-.alreadyBoughtMagikarp
- ld hl, MtMoonPokecenterText_4936b
-.printText
- call PrintText
-.done
+ callab Func_f218c
jp TextScriptEnd
-MtMoonPokecenterText_4935c: ; 4935c (12:535c)
- TX_FAR _MtMoonPokecenterText_4935c
- db "@"
-
-MtMoonPokecenterText_49361: ; 49361 (12:5361)
- TX_FAR _MtMoonPokecenterText_49361
- db "@"
-
-MtMoonPokecenterText_49366: ; 49366 (12:5366)
- TX_FAR _MtMoonPokecenterText_49366
- db "@"
-
-MtMoonPokecenterText_4936b: ; 4936b (12:536b)
- TX_FAR _MtMoonPokecenterText_4936b
- db "@"
-
MtMoonPokecenterText5: ; 49370 (12:5370)
TX_FAR _MtMoonPokecenterText5
db "@"
MtMoonPokecenterText6: ; 49375 (12:5375)
- db $f6
+ TX_POKECENTER_PC
+
+MtMoonPokecenterText7:
+ TX_ASM
+ callab Func_f0f12
+ jp TextScriptEnd
diff --git a/scripts/mtmoonpokecenter2.asm b/scripts/mtmoonpokecenter2.asm
new file mode 100755
index 00000000..fa42f440
--- /dev/null
+++ b/scripts/mtmoonpokecenter2.asm
@@ -0,0 +1,66 @@
+Func_f218c:
+ CheckEvent EVENT_BOUGHT_MAGIKARP, 1
+ jp c, .alreadyBoughtMagikarp
+ ld hl, MtMoonPokecenterText_4935c
+ call PrintText
+ ld a, MONEY_BOX
+ ld [wTextBoxID], a
+ call DisplayTextBoxID
+ call YesNoChoice
+ ld a, [wCurrentMenuItem]
+ and a
+ jp nz, .choseNo
+ ; $000500
+ xor a
+ ld [hMoney], a
+ ld [hMoney + 2], a
+ ld a, $5
+ ld [hMoney + 1], a
+ call HasEnoughMoney
+ jr nc, .enoughMoney
+ ld hl, MtMoonPokecenterText_49366
+ jr .printText
+.enoughMoney
+ lb bc, MAGIKARP, 5
+ call GivePokemon
+ jr nc, .done
+ ; $000500
+ xor a
+ ld [wPriceTemp], a
+ ld [wPriceTemp + 2], a
+ ld a, $5
+ ld [wPriceTemp + 1], a
+ ld hl, wPriceTemp + 2
+ ld de, wPlayerMoney + 2
+ ld c, $3
+ predef SubBCDPredef
+ ld a, MONEY_BOX
+ ld [wTextBoxID], a
+ call DisplayTextBoxID
+ SetEvent EVENT_BOUGHT_MAGIKARP
+ jr .done
+.choseNo
+ ld hl, MtMoonPokecenterText_49361
+ jr .printText
+.alreadyBoughtMagikarp
+ ld hl, MtMoonPokecenterText_4936b
+.printText
+ call PrintText
+.done
+ ret
+
+MtMoonPokecenterText_4935c: ; 4935c (12:535c)
+ TX_FAR _MtMoonPokecenterText_4935c
+ db "@"
+
+MtMoonPokecenterText_49361: ; 49361 (12:5361)
+ TX_FAR _MtMoonPokecenterText_49361
+ db "@"
+
+MtMoonPokecenterText_49366: ; 49366 (12:5366)
+ TX_FAR _MtMoonPokecenterText_49366
+ db "@"
+
+MtMoonPokecenterText_4936b: ; 4936b (12:536b)
+ TX_FAR _MtMoonPokecenterText_4936b
+ db "@"
diff --git a/wram.asm b/wram.asm
index fbfcc288..610574da 100755
--- a/wram.asm
+++ b/wram.asm
@@ -386,11 +386,7 @@ wTradeCenterPointerTableIndex:: ; cc38
ds 1
-wUnusedCC3A:: ; cc3a
- ds 1
-
-wUnusedCC3B:: ; cc3b
- ds 1
+wTextDestinationTileAddrBuffer:: dw ; cc3a
wDoNotWaitForButtonPressAfterDisplayingText:: ; cc3c
; if non-zero, skip waiting for a button press after displaying text in DisplayTextID