summaryrefslogtreecommitdiff
path: root/engine/gfx
diff options
context:
space:
mode:
authormid-kid <esteve.varela@gmail.com>2018-03-14 13:28:36 +0100
committermid-kid <esteve.varela@gmail.com>2018-03-14 13:28:36 +0100
commit97c511cd2f271252cbc9e9746668081422231ca5 (patch)
tree35ef1cb72e871ef34e2b0011e514edae2b9cbcb7 /engine/gfx
parentbaa0dc5a963a79843b37888bcfe1d2dfe833ade9 (diff)
Organize the engine/ directory, take 2
Renamed `game` to `games` and `menu` to `menus`. Moved some functions from `engine/routines/` to their fitting subdirectories. Made two new subdirectories: * engine/rtc: Contains all RTC-related things. Menus, hardware, misc functions. * engine/items: Contains all item-related things. Pack, item effects, other item handlers.
Diffstat (limited to 'engine/gfx')
-rw-r--r--engine/gfx/drawkrispackgfx.asm20
-rw-r--r--engine/gfx/loadoverworldfont.asm17
-rw-r--r--engine/gfx/placegraphic.asm55
-rw-r--r--engine/gfx/trademonfrontpic.asm38
4 files changed, 130 insertions, 0 deletions
diff --git a/engine/gfx/drawkrispackgfx.asm b/engine/gfx/drawkrispackgfx.asm
new file mode 100644
index 000000000..54a21e447
--- /dev/null
+++ b/engine/gfx/drawkrispackgfx.asm
@@ -0,0 +1,20 @@
+DrawKrisPackGFX: ; 48e81
+ ld hl, PackFGFXPointers
+ add hl, de
+ add hl, de
+ ld a, [hli]
+ ld e, a
+ ld d, [hl]
+ ld hl, vTiles2 tile $50
+ lb bc, BANK(PackFGFX), 15
+ call Request2bpp
+ ret
+
+PackFGFXPointers: ; 48e93
+ dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET
+ dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET
+ dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET
+ dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET
+
+PackFGFX: ; 48e9b
+INCBIN "gfx/pack/pack_f.2bpp"
diff --git a/engine/gfx/loadoverworldfont.asm b/engine/gfx/loadoverworldfont.asm
new file mode 100644
index 000000000..f23f01c4e
--- /dev/null
+++ b/engine/gfx/loadoverworldfont.asm
@@ -0,0 +1,17 @@
+LoadOverworldFont:: ; 106594
+ ld de, .OverworldFontGFX
+ ld hl, vTiles1
+ lb bc, BANK(.OverworldFontGFX), $80
+ call Get2bpp
+ ld de, .OverworldFontSpaceGFX
+ ld hl, vTiles2 tile " "
+ lb bc, BANK(.OverworldFontSpaceGFX), 1
+ call Get2bpp
+ ret
+; 1065ad
+
+.OverworldFontGFX:
+INCBIN "gfx/font/overworld.2bpp"
+
+.OverworldFontSpaceGFX:
+INCBIN "gfx/font/overworld_space.2bpp"
diff --git a/engine/gfx/placegraphic.asm b/engine/gfx/placegraphic.asm
new file mode 100644
index 000000000..21b914950
--- /dev/null
+++ b/engine/gfx/placegraphic.asm
@@ -0,0 +1,55 @@
+PlaceGraphic: ; 2ef6e
+; Fill wBoxAlignment-aligned box width b height c
+; with iterating tile starting from hGraphicStartTile at hl.
+
+ ld de, SCREEN_WIDTH
+
+ ld a, [wBoxAlignment]
+ and a
+ jr nz, .right
+
+ ld a, [hGraphicStartTile]
+.x1
+ push bc
+ push hl
+
+.y1
+ ld [hl], a
+ add hl, de
+ inc a
+ dec c
+ jr nz, .y1
+
+ pop hl
+ inc hl
+ pop bc
+ dec b
+ jr nz, .x1
+ ret
+
+.right
+; Right-aligned.
+ push bc
+ ld b, 0
+ dec c
+ add hl, bc
+ pop bc
+
+ ld a, [hGraphicStartTile]
+.x2
+ push bc
+ push hl
+
+.y2
+ ld [hl], a
+ add hl, de
+ inc a
+ dec c
+ jr nz, .y2
+
+ pop hl
+ dec hl
+ pop bc
+ dec b
+ jr nz, .x2
+ ret
diff --git a/engine/gfx/trademonfrontpic.asm b/engine/gfx/trademonfrontpic.asm
new file mode 100644
index 000000000..d5f7b55de
--- /dev/null
+++ b/engine/gfx/trademonfrontpic.asm
@@ -0,0 +1,38 @@
+GetTrademonFrontpic: ; 4d7fd
+ ld a, [wOTTrademonSpecies]
+ ld hl, wOTTrademonDVs
+ ld de, vTiles2
+ push de
+ push af
+ predef GetUnownLetter
+ pop af
+ ld [wCurPartySpecies], a
+ ld [wCurSpecies], a
+ call GetBaseData
+ pop de
+ predef GetAnimatedFrontpic
+ ret
+
+AnimateTrademonFrontpic: ; 4d81e
+ ld a, [wOTTrademonSpecies]
+ call IsAPokemon
+ ret c
+ farcall ShowOTTrademonStats
+ ld a, [wOTTrademonSpecies]
+ ld [wCurPartySpecies], a
+ ld a, [wOTTrademonDVs]
+ ld [wTempMonDVs], a
+ ld a, [wOTTrademonDVs + 1]
+ ld [wTempMonDVs + 1], a
+ ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
+ call GetSGBLayout
+ ld a, %11100100 ; 3,2,1,0
+ call DmgToCgbBGPals
+ farcall TradeAnim_ShowGetmonFrontpic
+ ld a, [wOTTrademonSpecies]
+ ld [wCurPartySpecies], a
+ hlcoord 7, 2
+ ld d, $0
+ ld e, ANIM_MON_TRADE
+ predef AnimateFrontpic
+ ret