Move code out of gfx/ (close #474)

This commit is contained in:
Remy Oukaour 2018-01-15 11:06:17 -05:00
parent 9bb584798e
commit 9180362211
8 changed files with 167 additions and 166 deletions

View File

@ -80,7 +80,7 @@
; Actual characters (from other graphics files)
; needed for _LoadFontsExtra1 (see gfx/font.asm)
; needed for _LoadFontsExtra1 (see engine/load_font.asm)
charmap "<BLACK>", $60 ; gfx/font/black_arrow.2bpp
charmap "▲", $61 ; gfx/font/up_arrow.png
charmap "<PHONE>", $62 ; gfx/font/phone_icon.2bpp

View File

@ -24,7 +24,7 @@ dba_pic: MACRO ; dbw bank, address
ENDM
```
The offset is translated into a correct bank by `FixPicBank` in [gfx/load_pics.asm](/gfx/load_pics.asm):
The offset is translated into a correct bank by `FixPicBank` in [engine/load_pics.asm](/engine/load_pics.asm):
```asm
FixPicBank: ; 511c5
@ -106,7 +106,7 @@ ROMX $49
"Pics 2"
```
Two routines in [gfx/load_pics.asm](/gfx/load_pics.asm) make this assumption; `GetFrontpicPointer`:
Two routines in [engine/load_pics.asm](/engine/load_pics.asm) make this assumption; `GetFrontpicPointer`:
```asm
ld a, [CurPartySpecies]

156
engine/load_font.asm Normal file
View File

@ -0,0 +1,156 @@
INCLUDE "gfx/font.asm"
; This and the following two functions are unreferenced.
; Debug, perhaps?
Unreferenced_fb434:
db 0
Unreferenced_Functionfb435: ; 4b435
ld a, [Unreferenced_fb434]
and a
jp nz, Get1bpp_2
jp Get1bpp
; fb43f
Unreferenced_Functionfb43f: ; fb43f
ld a, [Unreferenced_fb434]
and a
jp nz, Get2bpp_2
jp Get2bpp
; End unreferenced block
; fb449
_LoadStandardFont:: ; fb449
ld de, Font
ld hl, vTiles1
lb bc, BANK(Font), 128 ; "A" to "9"
ld a, [rLCDC]
bit rLCDC_ENABLE, a
jp z, Copy1bpp
ld de, Font
ld hl, vTiles1
lb bc, BANK(Font), 32 ; "A" to "]"
call Get1bpp_2
ld de, Font + 32 * LEN_1BPP_TILE
ld hl, vTiles1 tile $20
lb bc, BANK(Font), 32 ; "a" to $bf
call Get1bpp_2
ld de, Font + 64 * LEN_1BPP_TILE
ld hl, vTiles1 tile $40
lb bc, BANK(Font), 32 ; "Ä" to "←"
call Get1bpp_2
ld de, Font + 96 * LEN_1BPP_TILE
ld hl, vTiles1 tile $60
lb bc, BANK(Font), 32 ; "'" to "9"
call Get1bpp_2
ret
; fb48a
_LoadFontsExtra1:: ; fb48a
ld de, FontsExtra_SolidBlackGFX
ld hl, vTiles2 tile "<BLACK>" ; $60
lb bc, BANK(FontsExtra_SolidBlackGFX), 1
call Get1bpp_2
ld de, PokegearPhoneIconGFX
ld hl, vTiles2 tile "<PHONE>" ; $62
lb bc, BANK(PokegearPhoneIconGFX), 1
call Get2bpp_2
ld de, FontExtra tile 3
ld hl, vTiles2 tile "<BOLD_D>"
lb bc, BANK(FontExtra), 22 ; "<BOLD_D>" to "ぉ"
call Get2bpp_2
jr LoadFrame
; fb4b0
_LoadFontsExtra2:: ; fb4b0
ld de, FontsExtra2_UpArrowGFX
ld hl, vTiles2 tile "▲" ; $61
ld b, BANK(FontsExtra2_UpArrowGFX)
ld c, 1
call Get2bpp_2
ret
; fb4be
_LoadFontsBattleExtra:: ; fb4be
ld de, FontBattleExtra
ld hl, vTiles2 tile $60
lb bc, BANK(FontBattleExtra), 25
call Get2bpp_2
jr LoadFrame
; fb4cc
LoadFrame: ; fb4cc
ld a, [TextBoxFrame]
maskbits NUM_FRAMES +- 1
ld bc, 6 * LEN_1BPP_TILE
ld hl, Frames
call AddNTimes
ld d, h
ld e, l
ld hl, vTiles2 tile "┌" ; $79
lb bc, BANK(Frames), 6 ; "┌" to "┘"
call Get1bpp_2
ld hl, vTiles2 tile " " ; $7f
ld de, TextBoxSpaceGFX
lb bc, BANK(TextBoxSpaceGFX), 1
call Get1bpp_2
ret
; fb4f2
LoadBattleFontsHPBar: ; fb4f2
ld de, FontBattleExtra
ld hl, vTiles2 tile $60
lb bc, BANK(FontBattleExtra), 12
call Get2bpp_2
ld hl, vTiles2 tile $70
ld de, FontBattleExtra tile 16
lb bc, BANK(FontBattleExtra), 3 ; "<ど>" to "『"
call Get2bpp_2
call LoadFrame
LoadHPBar: ; fb50d
ld de, EnemyHPBarBorderGFX
ld hl, vTiles2 tile $6c
lb bc, BANK(EnemyHPBarBorderGFX), 4
call Get1bpp_2
ld de, HPExpBarBorderGFX
ld hl, vTiles2 tile $73
lb bc, BANK(HPExpBarBorderGFX), 6
call Get1bpp_2
ld de, ExpBarGFX
ld hl, vTiles2 tile $55
lb bc, BANK(ExpBarGFX), 9
call Get2bpp_2
ld de, MobilePhoneTilesGFX tile 7 ; mobile phone icon
ld hl, vTiles2 tile $5e
lb bc, BANK(MobilePhoneTilesGFX), 2
call Get2bpp_2
ret
; fb53e
StatsScreen_LoadFont: ; fb53e
call _LoadFontsBattleExtra
ld de, EnemyHPBarBorderGFX
ld hl, vTiles2 tile $6c
lb bc, BANK(EnemyHPBarBorderGFX), 4
call Get1bpp_2
ld de, HPExpBarBorderGFX
ld hl, vTiles2 tile $78
lb bc, BANK(HPExpBarBorderGFX), 1
call Get1bpp_2
ld de, HPExpBarBorderGFX + 3 * LEN_1BPP_TILE
ld hl, vTiles2 tile $76
lb bc, BANK(HPExpBarBorderGFX), 2
call Get1bpp_2
ld de, ExpBarGFX
ld hl, vTiles2 tile $55
lb bc, BANK(ExpBarGFX), 8
call Get2bpp_2
LoadStatsScreenPageTilesGFX: ; fb571
ld de, StatsScreenPageTilesGFX
ld hl, vTiles2 tile $31
lb bc, BANK(StatsScreenPageTilesGFX), 17
call Get2bpp_2
ret
; fb57e

View File

@ -394,8 +394,8 @@ FixBackpicAlignment: ; 5127c
.got_dims
ld a, [hl]
ld b, $0
ld c, $8
ld b, 0
ld c, 8
.loop
rra
rl b
@ -483,10 +483,10 @@ LoadFrontpic: ; 512f2
inc de
ld b, a
xor a
rept 8
rept 8
rr b
rla
endr
endr
ld [hli], a
dec c
jr nz, .right_loop

View File

@ -80,158 +80,3 @@ INCBIN "gfx/font/up_arrow.2bpp"
Footprints: ; f9434
INCLUDE "gfx/footprints.asm"
; fb434
; This and the following two functions are unreferenced.
; Debug, perhaps?
Unreferenced_fb434:
db 0
Unreferenced_Functionfb435: ; 4b435
ld a, [Unreferenced_fb434]
and a
jp nz, Get1bpp_2
jp Get1bpp
; fb43f
Unreferenced_Functionfb43f: ; fb43f
ld a, [Unreferenced_fb434]
and a
jp nz, Get2bpp_2
jp Get2bpp
; End unreferenced block
; fb449
_LoadStandardFont:: ; fb449
ld de, Font
ld hl, vTiles1
lb bc, BANK(Font), 128 ; "A" to "9"
ld a, [rLCDC]
bit rLCDC_ENABLE, a
jp z, Copy1bpp
ld de, Font
ld hl, vTiles1
lb bc, BANK(Font), 32 ; "A" to "]"
call Get1bpp_2
ld de, Font + 32 * LEN_1BPP_TILE
ld hl, vTiles1 tile $20
lb bc, BANK(Font), 32 ; "a" to $bf
call Get1bpp_2
ld de, Font + 64 * LEN_1BPP_TILE
ld hl, vTiles1 tile $40
lb bc, BANK(Font), 32 ; "Ä" to "←"
call Get1bpp_2
ld de, Font + 96 * LEN_1BPP_TILE
ld hl, vTiles1 tile $60
lb bc, BANK(Font), 32 ; "'" to "9"
call Get1bpp_2
ret
; fb48a
_LoadFontsExtra1:: ; fb48a
ld de, FontsExtra_SolidBlackGFX
ld hl, vTiles2 tile "<BLACK>" ; $60
lb bc, BANK(FontsExtra_SolidBlackGFX), 1
call Get1bpp_2
ld de, PokegearPhoneIconGFX
ld hl, vTiles2 tile "<PHONE>" ; $62
lb bc, BANK(PokegearPhoneIconGFX), 1
call Get2bpp_2
ld de, FontExtra tile 3
ld hl, vTiles2 tile "<BOLD_D>"
lb bc, BANK(FontExtra), 22 ; "<BOLD_D>" to "ぉ"
call Get2bpp_2
jr LoadFrame
; fb4b0
_LoadFontsExtra2:: ; fb4b0
ld de, FontsExtra2_UpArrowGFX
ld hl, vTiles2 tile "▲" ; $61
ld b, BANK(FontsExtra2_UpArrowGFX)
ld c, 1
call Get2bpp_2
ret
; fb4be
_LoadFontsBattleExtra:: ; fb4be
ld de, FontBattleExtra
ld hl, vTiles2 tile $60
lb bc, BANK(FontBattleExtra), 25
call Get2bpp_2
jr LoadFrame
; fb4cc
LoadFrame: ; fb4cc
ld a, [TextBoxFrame]
maskbits NUM_FRAMES +- 1
ld bc, 6 * LEN_1BPP_TILE
ld hl, Frames
call AddNTimes
ld d, h
ld e, l
ld hl, vTiles2 tile "┌" ; $79
lb bc, BANK(Frames), 6 ; "┌" to "┘"
call Get1bpp_2
ld hl, vTiles2 tile " " ; $7f
ld de, TextBoxSpaceGFX
lb bc, BANK(TextBoxSpaceGFX), 1
call Get1bpp_2
ret
; fb4f2
LoadBattleFontsHPBar: ; fb4f2
ld de, FontBattleExtra
ld hl, vTiles2 tile $60
lb bc, BANK(FontBattleExtra), 12
call Get2bpp_2
ld hl, vTiles2 tile $70
ld de, FontBattleExtra tile 16
lb bc, BANK(FontBattleExtra), 3 ; "<ど>" to "『"
call Get2bpp_2
call LoadFrame
LoadHPBar: ; fb50d
ld de, EnemyHPBarBorderGFX
ld hl, vTiles2 tile $6c
lb bc, BANK(EnemyHPBarBorderGFX), 4
call Get1bpp_2
ld de, HPExpBarBorderGFX
ld hl, vTiles2 tile $73
lb bc, BANK(HPExpBarBorderGFX), 6
call Get1bpp_2
ld de, ExpBarGFX
ld hl, vTiles2 tile $55
lb bc, BANK(ExpBarGFX), 9
call Get2bpp_2
ld de, MobilePhoneTilesGFX tile 7 ; mobile phone icon
ld hl, vTiles2 tile $5e
lb bc, BANK(MobilePhoneTilesGFX), 2
call Get2bpp_2
ret
; fb53e
StatsScreen_LoadFont: ; fb53e
call _LoadFontsBattleExtra
ld de, EnemyHPBarBorderGFX
ld hl, vTiles2 tile $6c
lb bc, BANK(EnemyHPBarBorderGFX), 4
call Get1bpp_2
ld de, HPExpBarBorderGFX
ld hl, vTiles2 tile $78
lb bc, BANK(HPExpBarBorderGFX), 1
call Get1bpp_2
ld de, HPExpBarBorderGFX + 3 * LEN_1BPP_TILE
ld hl, vTiles2 tile $76
lb bc, BANK(HPExpBarBorderGFX), 2
call Get1bpp_2
ld de, ExpBarGFX
ld hl, vTiles2 tile $55
lb bc, BANK(ExpBarGFX), 8
call Get2bpp_2
LoadStatsScreenPageTilesGFX: ; fb571
ld de, StatsScreenPageTilesGFX
ld hl, vTiles2 tile $31
lb bc, BANK(StatsScreenPageTilesGFX), 17
call Get2bpp_2
ret
; fb57e

View File

@ -258,7 +258,7 @@ INCLUDE "engine/mon_stats.asm"
INCLUDE "engine/routines/initlist.asm"
INCLUDE "engine/experience.asm"
INCLUDE "engine/routines/switchpartymons.asm"
INCLUDE "gfx/load_pics.asm"
INCLUDE "engine/load_pics.asm"
INCLUDE "engine/move_mon_wo_mail.asm"
INCLUDE "data/pokemon/base_stats.asm"
INCLUDE "data/pokemon/names.asm"
@ -355,7 +355,7 @@ SECTION "bank2E", ROMX
INCLUDE "engine/events/map_name_sign.asm"
INCLUDE "engine/events/checkforhiddenitems.asm"
INCLUDE "engine/events/treemons.asm"
INCLUDE "gfx/fishing.asm"
INCLUDE "engine/events/loadfishinggfx.asm"
INCLUDE "engine/radio.asm"
INCLUDE "engine/mail_2.asm"
@ -447,7 +447,7 @@ INCLUDE "engine/crystal_intro.asm"
SECTION "bank3E", ROMX
INCLUDE "gfx/font.asm"
INCLUDE "engine/load_font.asm"
INCLUDE "engine/time_capsule.asm"
INCLUDE "engine/events/name_rater.asm"
INCLUDE "engine/routines/playslowcry.asm"
@ -477,7 +477,7 @@ INCLUDE "engine/warp_connection.asm"
INCLUDE "engine/mystery_gift.asm"
INCLUDE "engine/battle/used_move_text.asm"
INCLUDE "mobile/mobile_41.asm"
INCLUDE "gfx/overworld_font.asm"
INCLUDE "engine/routines/loadoverworldfont.asm"
SECTION "Mobile 42", ROMX