Skip to content

Commit

Permalink
Merge pull request #200 from andwhyisit/misc-stuff
Browse files Browse the repository at this point in the history
Shop Bubble Text + Yen
  • Loading branch information
andwhyisit authored Jul 23, 2023
2 parents 6963a3b + e866a56 commit f663595
Show file tree
Hide file tree
Showing 15 changed files with 147 additions and 85 deletions.
74 changes: 74 additions & 0 deletions game/src/patch/yen.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
INCLUDE "game/src/common/constants.asm"
INCLUDE "game/src/common/macros.asm"

SECTION "Place Yen Symbol", ROM0[$2016]
PlaceYenSymbolShop::
; hl is the money tile mapping address for the least significant digit.
push bc
ld b, h
ld a, l
sub 5
ld c, a
xor a
ld [bc], a
inc c

.ext
call PlaceYenSymbol
ld h, b
ld l, c
pop bc
ret

PlaceYenSymbolShopAlt::
; hl is the mapping address for the tile before the money tile mapping address.
push bc
ld b, h
ld c, l
xor a
ld [bc], a
inc c
jr PlaceYenSymbolShop.ext

PlaceYenSymbol::
; bc is the money tile mapping address.
; Warning: This will cause an infinite loop if it can't find an empty tile to map to.
push bc
push de
ld a, c
add 3
jr .decccommon

.loop
di
rst $20
ld a, [bc]
ei
or a
jr z, .exit

.decc
ld a, c
dec a

.decccommon
and $1F
ld d, a
ld a, c
and $E0
add d
ld c, a
jr .loop

.exit
di
rst $20
ld a, $EC
ld [bc], a
ei
pop de
pop bc
ret

; Free space.
padend $2060
10 changes: 4 additions & 6 deletions game/src/pausemenu/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -552,14 +552,12 @@ PauseMenuDrawMoney::
jr z, .draw_00
ld bc, $120B
call $14ec
ld a, $e0
di
push af
rst $20
pop af
ld [hli], a
ld a, $e0
ld [hl], a
ei
ret
jp PlaceYenSymbolShop
.draw_00
ld bc, $120B
call $14ec
Expand All @@ -572,7 +570,7 @@ PauseMenuDrawMoney::
ei
ld bc, $110B
call $14ec
ld a, $00
ld a, $EC
di
push af
rst $20
Expand Down
38 changes: 16 additions & 22 deletions game/src/shop/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ ShopPrepareFadeInPlusDisplayMoneyAndSpritesState::
ld [$C103], a
ld a, $18
ld [$C104], a
ld a, 1
ld [$C0A0], a
ld a, 0
xor a
ld [$C0A1], a
inc a ; ld a, 1
ld [$C0A0], a
ld a, $B4
ld [$C0A2], a
ld a, 7
Expand All @@ -411,12 +411,12 @@ ShopPrepareFadeInPlusDisplayMoneyAndSpritesState::
ld [$C0A4], a
ld a, 1
ld [W_OAM_SpritesReady], a
ld a, 0
xor a
ld b, a
ld a, $36
ld de, $C0A0
call $33B2
ld a, 0
xor a
ld b, a
ld a, $84
ld de, $C100
Expand All @@ -432,7 +432,9 @@ ShopShopkeeperWelcomeMessageState::
add $DE
ld c, a
ld b, 0
ld a, 2
ld a, 1
ld [W_OAM_SpritesReady], a
inc a ; ld a, 2
call WrapMainScriptProcessor
ld a, [W_MainScriptExitMode]
or a
Expand Down Expand Up @@ -1000,13 +1002,11 @@ ShopBuyDisplayPartNamesPricesAndGenderState::
ld [hli], a
ei
ld hl, $98B2 ; Previously 98B1
ld a, $E0
di
push af
rst $20
pop af
ld [hli], a
ld [hl], $E0
ei
call PlaceYenSymbolShop
ld a, [$C54B]
ld hl, $98AB
call ShopMapHeartMaybe
Expand Down Expand Up @@ -1038,13 +1038,11 @@ ShopBuyDisplayPartNamesPricesAndGenderState::
ld [hli], a
ei
ld hl, $98F2 ; Previously 98F1
ld a, $E0
di
push af
rst $20
pop af
ld [hli], a
ld [hl], $E0
ei
call PlaceYenSymbolShop
ld a, [$C54B]
ld hl, $98EB
call ShopMapHeartMaybe
Expand Down Expand Up @@ -1076,13 +1074,11 @@ ShopBuyDisplayPartNamesPricesAndGenderState::
ld [hli], a
ei
ld hl, $9932 ; Previously 9931
ld a, $E0
di
push af
rst $20
pop af
ld [hli], a
ld [hl], $E0
ei
call PlaceYenSymbolShop
ld a, [$C54B]
ld hl, $992B
call ShopMapHeartMaybe
Expand Down Expand Up @@ -1114,13 +1110,11 @@ ShopBuyDisplayPartNamesPricesAndGenderState::
ld [hli], a
ei
ld hl, $9972 ; Previously 9971
ld a, $E0
di
push af
rst $20
pop af
ld [hli], a
ld [hl], $E0
ei
call PlaceYenSymbolShop
ld a, [$C54B]
ld hl, $996B
call ShopMapHeartMaybe
Expand Down
10 changes: 4 additions & 6 deletions game/src/shop/paint.asm
Original file line number Diff line number Diff line change
Expand Up @@ -705,21 +705,19 @@ PaintShopMapMoney::
add b
ld b, a
call $14EC
ld a, $E0
di
push af
rst $20
pop af
ld [hli], a
ld a, $E0
ld [hl], a
ei
ret
jp PlaceYenSymbolShop

.noMoney
ld a, 3
add b
ld b, a
call $14EC
ld a, 0
ld a, $EC
di
push af
rst $20
Expand Down
12 changes: 7 additions & 5 deletions game/src/shop/paint_core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ PaintShopMappingState::
PaintShopDisplayMoneyAndSpritesState::
ld a, 1
ld [$C0E0], a
ld a, 0
xor a
ld [$C0E1], a
ld a, $B4
ld [$C0E2], a
Expand All @@ -132,20 +132,20 @@ PaintShopDisplayMoneyAndSpritesState::
ld [$C101], a
ld a, $A3
ld [$C102], a
ld a, 0
xor a
ld [$C105], a
ld a, $58 ; Previously $59
ld [$C103], a
ld a, $18
ld [$C104], a
ld a, 1
ld [W_OAM_SpritesReady], a
ld a, 0
xor a
ld b, a
ld a, $36
ld de, $C0E0
call $33B2
ld a, 0
xor a
ld b, a
ld a, $9E
ld de, $C100
Expand All @@ -158,7 +158,9 @@ PaintShopDisplayMoneyAndSpritesState::

PaintShopPrintOpeningMessageState::
ld bc, $A0
ld a, 2
ld a, 1
ld [W_OAM_SpritesReady], a
inc a ; ld a, 2
call WrapMainScriptProcessor
ld a, [W_MainScriptExitMode]
or a
Expand Down
37 changes: 18 additions & 19 deletions game/src/shop/shop.asm
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,19 @@ ShopMapMoney::
add b
ld b, a
call $14EC
ld a, $E0
di
push af
rst $20
pop af
ld [hli], a
ld a, $E0
ld [hl], a
ei
ret
jp PlaceYenSymbolShop

.noMoney
ld a, 3
add b
ld b, a
call $14EC
ld a, 0
ld a, $EC
di
push af
rst $20
Expand Down Expand Up @@ -229,28 +227,31 @@ ShopBuyMapSelectionPrice::
pop af
ld [hli], a
ei
ld hl, $99CA ; Previously 99c9
ld a, $E0
push hl
di
push af
rst $20
pop af
ld a, $E0
ld [hli], a
ei
ld hl, $99C6 ; Previously 99c5
ld a, 0
xor a
di
push af
rst $20
pop af
ld [hli], a
ld [hld], a
ei
ld hl, $99C5 ; Previously 99c4
call ShopMapThreeDigitNumber
ret
pop hl
jp PlaceYenSymbolShop

ShopMapSelectionPriceDashes::
ld hl, $99C7 ; previously 99c6
ld hl, $99C5
di
rst $20
xor a
ld [hli], a
ei
ld a, 5
ld b, a
call ShopMapDashes
Expand Down Expand Up @@ -693,11 +694,9 @@ ShopMapPartPrice::
push hl
push hl
inc hl
xor a
di
push af
rst $20
pop af
xor a
ld [hli], a
ei
di
Expand Down Expand Up @@ -731,7 +730,7 @@ ShopMapPartPrice::
pop bc
pop hl
call ShopMapThreeDigitNumber
ret
jp PlaceYenSymbolShopAlt

ShopGetPartPriceAndStatus::
ld a, [W_ShopPartTypeSelectionIndex]
Expand Down
3 changes: 0 additions & 3 deletions game/src/text/main_script.asm
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,6 @@ ControlCodeD2_changePortrait::
.table
db 0,$C,$26,$44

; Free space.
padend $2060

SECTION "Main Script Helper Functions 1", ROM0[$2112]
MainScriptProgressXChars::
ld a, [W_MainScriptPointerLocationOffset + 1]
Expand Down
Loading

0 comments on commit f663595

Please sign in to comment.