summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/maps/roofs.asm46
-rw-r--r--engine/events/catch_tutorial.asm81
-rw-r--r--engine/menus/main_menu.asm4
-rw-r--r--engine/rtc/restart_clock.asm236
-rw-r--r--engine/tilesets/mapgroup_roofs.asm18
-rw-r--r--gfx/tilesets/roofs/azalea.2bppbin0 -> 144 bytes
-rw-r--r--gfx/tilesets/roofs/azalea.pngbin0 -> 143 bytes
-rw-r--r--gfx/tilesets/roofs/goldenrod.2bppbin0 -> 144 bytes
-rw-r--r--gfx/tilesets/roofs/goldenrod.pngbin0 -> 112 bytes
-rw-r--r--gfx/tilesets/roofs/new_bark.2bppbin0 -> 144 bytes
-rw-r--r--gfx/tilesets/roofs/new_bark.pngbin0 -> 102 bytes
-rw-r--r--gfx/tilesets/roofs/olivine.2bppbin0 -> 144 bytes
-rw-r--r--gfx/tilesets/roofs/olivine.pngbin0 -> 97 bytes
-rw-r--r--gfx/tilesets/roofs/violet.2bppbin0 -> 144 bytes
-rw-r--r--gfx/tilesets/roofs/violet.pngbin0 -> 103 bytes
-rw-r--r--main.asm11
16 files changed, 386 insertions, 10 deletions
diff --git a/data/maps/roofs.asm b/data/maps/roofs.asm
new file mode 100644
index 00000000..ac1ea556
--- /dev/null
+++ b/data/maps/roofs.asm
@@ -0,0 +1,46 @@
+; MapGroupRoofs values; Roofs indexes
+ const_def
+ const ROOF_NEW_BARK ; 0
+ const ROOF_VIOLET ; 1
+ const ROOF_AZALEA ; 2
+ const ROOF_OLIVINE ; 3
+ const ROOF_GOLDENROD ; 4
+
+MapGroupRoofs:
+; entries correspond to map groups
+; values are indexes for Roofs (see below)
+ db -1 ; 0
+ db ROOF_OLIVINE ; 1 (Olivine)
+ db ROOF_AZALEA ; 2 (Mahogany)
+ db -1 ; 3
+ db ROOF_VIOLET ; 4 (Ecruteak)
+ db ROOF_AZALEA ; 5 (Blackthorn)
+ db -1 ; 6
+ db -1 ; 7
+ db ROOF_AZALEA ; 8 (Azalea)
+ db ROOF_AZALEA ; 9 (Lake of Rage)
+ db ROOF_VIOLET ; 10 (Violet)
+ db ROOF_GOLDENROD ; 11 (Goldenrod)
+ db -1 ; 12
+ db -1 ; 13
+ db -1 ; 14
+ db -1 ; 15
+ db -1 ; 16
+ db -1 ; 17
+ db -1 ; 18
+ db ROOF_NEW_BARK ; 19 (Silver Cave)
+ db -1 ; 20
+ db -1 ; 21
+ db ROOF_OLIVINE ; 22 (Cianwood)
+ db -1 ; 23
+ db ROOF_NEW_BARK ; 24 (New Bark)
+ db -1 ; 25
+ db ROOF_NEW_BARK ; 26 (Cherrygrove)
+
+Roofs:
+; entries correspond to ROOF_* constants
+INCBIN "gfx/tilesets/roofs/new_bark.2bpp"
+INCBIN "gfx/tilesets/roofs/violet.2bpp"
+INCBIN "gfx/tilesets/roofs/azalea.2bpp"
+INCBIN "gfx/tilesets/roofs/olivine.2bpp"
+INCBIN "gfx/tilesets/roofs/goldenrod.2bpp"
diff --git a/engine/events/catch_tutorial.asm b/engine/events/catch_tutorial.asm
new file mode 100644
index 00000000..5c12a02f
--- /dev/null
+++ b/engine/events/catch_tutorial.asm
@@ -0,0 +1,81 @@
+CatchTutorial::
+ ld a, [wBattleType]
+ dec a
+ ld c, a
+ ld hl, .dw
+ ld b, 0
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp hl
+
+.dw
+ dw .DudeTutorial
+ dw .DudeTutorial
+ dw .DudeTutorial
+
+.DudeTutorial:
+; Back up your name to your Mom's name.
+ ld hl, wPlayerName
+ ld de, wMomsName
+ ld bc, NAME_LENGTH
+ call CopyBytes
+; Copy Dude's name to your name
+ ld hl, .Dude
+ ld de, wPlayerName
+ ld bc, NAME_LENGTH
+ call CopyBytes
+
+ call .LoadDudeData
+
+ xor a
+ ldh [hJoyDown], a
+ ldh [hJoyPressed], a
+ ld a, [wOptions]
+ push af
+ and $ff ^ TEXT_DELAY_MASK
+ add TEXT_DELAY_MED
+ ld [wOptions], a
+ ld hl, .AutoInput
+ ld a, BANK(.AutoInput)
+ call StartAutoInput
+ callfar StartBattle
+ call StopAutoInput
+ pop af
+
+ ld [wOptions], a
+ ld hl, wMomsName
+ ld de, wPlayerName
+ ld bc, NAME_LENGTH
+ call CopyBytes
+ ret
+
+.LoadDudeData:
+ ld hl, wDudeNumItems
+ ld [hl], 1
+ inc hl
+ ld [hl], POTION
+ inc hl
+ ld [hl], 1
+ inc hl
+ ld [hl], -1
+ ld hl, wDudeNumKeyItems
+ ld [hl], 0
+ inc hl
+ ld [hl], -1
+ ld hl, wDudeNumBalls
+ ld a, 1
+ ld [hli], a
+ ld a, POKE_BALL
+ ld [hli], a
+ ld [hli], a
+ ld [hl], -1
+ ret
+
+.Dude:
+ db "DUDE@"
+
+.AutoInput:
+ db NO_INPUT, $ff ; end
diff --git a/engine/menus/main_menu.asm b/engine/menus/main_menu.asm
index 4e9113a8..5907324d 100644
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -176,7 +176,7 @@ MainMenu_PrintCurrentTimeAndDay:
call GetWeekday
ld b, a
decoord 1, 14
- call .PlaceCurrentDay
+ call PrintDayOfWeek
decoord 4, 16
ldh a, [hHours]
ld c, a
@@ -205,7 +205,7 @@ MainMenu_PrintCurrentTimeAndDay:
text_far _MainMenuTimeUnknownText
text_end
-.PlaceCurrentDay:
+PrintDayOfWeek:
push de
ld hl, .Days
ld a, b
diff --git a/engine/rtc/restart_clock.asm b/engine/rtc/restart_clock.asm
new file mode 100644
index 00000000..5dc98718
--- /dev/null
+++ b/engine/rtc/restart_clock.asm
@@ -0,0 +1,236 @@
+RestartClock_GetWraparoundTime:
+ push hl
+ dec a
+ ld e, a
+ ld d, 0
+ ld hl, .WrapAroundTimes
+rept 4
+ add hl, de
+endr
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ inc hl
+ ld b, [hl]
+ inc hl
+ ld c, [hl]
+ pop hl
+ ret
+
+.WrapAroundTimes:
+ dw wBuffer4
+ db 7, 4
+
+ dw wBuffer5
+ db 24, 12
+
+ dw wBuffer6
+ db 60, 15
+
+RestartClock:
+; If we're here, we had an RTC overflow.
+ ld hl, .ClockTimeMayBeWrongText
+ call PrintText
+ ld hl, wOptions
+ ld a, [hl]
+ push af
+ set NO_TEXT_SCROLL, [hl]
+ call LoadStandardMenuHeader
+ call ClearTilemap
+ ld hl, .ClockSetWithControlPadText
+ call PrintText
+ call .SetClock
+ call ExitMenu
+ pop bc
+ ld hl, wOptions
+ ld [hl], b
+ ld c, a
+ ret
+
+.ClockTimeMayBeWrongText:
+ text_far _ClockTimeMayBeWrongText
+ text_end
+
+.ClockSetWithControlPadText:
+ text_far _ClockSetWithControlPadText
+ text_end
+
+.SetClock:
+ ld a, 1
+ ld [wBuffer1], a ; which digit
+ ld [wBuffer2], a
+ ld a, 8
+ ld [wBuffer3], a
+ call UpdateTime
+ call GetWeekday
+ ld [wBuffer4], a
+ ldh a, [hHours]
+ ld [wBuffer5], a
+ ldh a, [hMinutes]
+ ld [wBuffer6], a
+
+.loop
+ call .joy_loop
+ jr nc, .loop
+ and a
+ ret nz
+ call .PrintTime
+ ld hl, .ClockIsThisOKText
+ call PrintText
+ call YesNoBox
+ jr c, .cancel
+ ld a, [wBuffer4]
+ ld [wStringBuffer2], a
+ ld a, [wBuffer5]
+ ld [wStringBuffer2 + 1], a
+ ld a, [wBuffer6]
+ ld [wStringBuffer2 + 2], a
+ xor a
+ ld [wStringBuffer2 + 3], a
+ call InitTime
+ call .PrintTime
+ ld hl, .ClockHasResetText
+ call PrintText
+ call WaitPressAorB_BlinkCursor
+ xor a
+ ret
+
+.cancel
+ ld a, $1
+ ret
+
+.ClockIsThisOKText:
+ text_far _ClockIsThisOKText
+ text_end
+
+.ClockHasResetText:
+ text_far _ClockHasResetText
+ text_end
+
+.joy_loop
+ call JoyTextDelay_ForcehJoyDown
+ ld c, a
+ push af
+ call .PrintTime
+ pop af
+ bit 0, a
+ jr nz, .press_A
+ bit 1, a
+ jr nz, .press_B
+ bit 6, a
+ jr nz, .pressed_up
+ bit 7, a
+ jr nz, .pressed_down
+ bit 5, a
+ jr nz, .pressed_left
+ bit 4, a
+ jr nz, .pressed_right
+ jr .joy_loop
+
+.press_A
+ ld a, $0
+ scf
+ ret
+
+.press_B
+ ld a, $1
+ scf
+ ret
+
+.pressed_up
+ ld a, [wBuffer1]
+ call RestartClock_GetWraparoundTime
+ ld a, [de]
+ inc a
+ ld [de], a
+ cp b
+ jr c, .done_scroll
+ ld a, $0
+ ld [de], a
+ jr .done_scroll
+
+.pressed_down
+ ld a, [wBuffer1]
+ call RestartClock_GetWraparoundTime
+ ld a, [de]
+ dec a
+ ld [de], a
+ cp -1
+ jr nz, .done_scroll
+ ld a, b
+ dec a
+ ld [de], a
+ jr .done_scroll
+
+.pressed_left
+ ld hl, wBuffer1
+ dec [hl]
+ jr nz, .done_scroll
+ ld [hl], $3
+ jr .done_scroll
+
+.pressed_right
+ ld hl, wBuffer1
+ inc [hl]
+ ld a, [hl]
+ cp $4
+ jr c, .done_scroll
+ ld [hl], $1
+
+.done_scroll
+ xor a
+ ret
+
+.PrintTime:
+ hlcoord 0, 5
+ ld b, 5
+ ld c, 18
+ call Textbox
+ decoord 1, 8
+ ld a, [wBuffer4]
+ ld b, a
+ farcall PrintDayOfWeek
+ ld a, [wBuffer5]
+ ld b, a
+ ld a, [wBuffer6]
+ ld c, a
+ decoord 11, 8
+ farcall PrintHoursMins
+ ld a, [wBuffer2]
+ lb de, " ", " "
+ call .PlaceChars
+ ld a, [wBuffer1]
+ lb de, "▲", "▼"
+ call .PlaceChars
+ ld a, [wBuffer1]
+ ld [wBuffer2], a
+ ret
+
+.unreferenced
+; unused
+ ld a, [wBuffer3]
+ ld b, a
+ call Coord2Tile
+ ret
+
+.PlaceChars:
+ push de
+ call RestartClock_GetWraparoundTime
+ ld a, [wBuffer3]
+ dec a
+ ld b, a
+ call Coord2Tile
+ pop de
+ ld [hl], d
+ ld bc, 2 * SCREEN_WIDTH
+ add hl, bc
+ ld [hl], e
+ ret
+
+UnreferencedString_HourJP:
+; unused
+ db "じ@" ; HR
+
+UnreferencedString_MinuteJP:
+; unused
+ db "ふん@" ; MIN
diff --git a/engine/tilesets/mapgroup_roofs.asm b/engine/tilesets/mapgroup_roofs.asm
new file mode 100644
index 00000000..b269e527
--- /dev/null
+++ b/engine/tilesets/mapgroup_roofs.asm
@@ -0,0 +1,18 @@
+LoadMapGroupRoof::
+ ld a, [wMapGroup]
+ ld e, a
+ ld d, 0
+ ld hl, MapGroupRoofs
+ add hl, de
+ ld a, [hl]
+ cp -1
+ ret z
+ ld hl, Roofs
+ ld bc, 9 tiles
+ call AddNTimes
+ ld de, vTiles2 tile $0a
+ ld bc, 9 tiles
+ call CopyBytes
+ ret
+
+INCLUDE "data/maps/roofs.asm"
diff --git a/gfx/tilesets/roofs/azalea.2bpp b/gfx/tilesets/roofs/azalea.2bpp
new file mode 100644
index 00000000..67db7f99
--- /dev/null
+++ b/gfx/tilesets/roofs/azalea.2bpp
Binary files differ
diff --git a/gfx/tilesets/roofs/azalea.png b/gfx/tilesets/roofs/azalea.png
new file mode 100644
index 00000000..b97b8787
--- /dev/null
+++ b/gfx/tilesets/roofs/azalea.png
Binary files differ
diff --git a/gfx/tilesets/roofs/goldenrod.2bpp b/gfx/tilesets/roofs/goldenrod.2bpp
new file mode 100644
index 00000000..87590db9
--- /dev/null
+++ b/gfx/tilesets/roofs/goldenrod.2bpp
Binary files differ
diff --git a/gfx/tilesets/roofs/goldenrod.png b/gfx/tilesets/roofs/goldenrod.png
new file mode 100644
index 00000000..25bf7104
--- /dev/null
+++ b/gfx/tilesets/roofs/goldenrod.png
Binary files differ
diff --git a/gfx/tilesets/roofs/new_bark.2bpp b/gfx/tilesets/roofs/new_bark.2bpp
new file mode 100644
index 00000000..51650e2e
--- /dev/null
+++ b/gfx/tilesets/roofs/new_bark.2bpp
Binary files differ
diff --git a/gfx/tilesets/roofs/new_bark.png b/gfx/tilesets/roofs/new_bark.png
new file mode 100644
index 00000000..1aa48fb8
--- /dev/null
+++ b/gfx/tilesets/roofs/new_bark.png
Binary files differ
diff --git a/gfx/tilesets/roofs/olivine.2bpp b/gfx/tilesets/roofs/olivine.2bpp
new file mode 100644
index 00000000..1d88fac5
--- /dev/null
+++ b/gfx/tilesets/roofs/olivine.2bpp
Binary files differ
diff --git a/gfx/tilesets/roofs/olivine.png b/gfx/tilesets/roofs/olivine.png
new file mode 100644
index 00000000..14bc411a
--- /dev/null
+++ b/gfx/tilesets/roofs/olivine.png
Binary files differ
diff --git a/gfx/tilesets/roofs/violet.2bpp b/gfx/tilesets/roofs/violet.2bpp
new file mode 100644
index 00000000..eea01d2f
--- /dev/null
+++ b/gfx/tilesets/roofs/violet.2bpp
Binary files differ
diff --git a/gfx/tilesets/roofs/violet.png b/gfx/tilesets/roofs/violet.png
new file mode 100644
index 00000000..1d68754f
--- /dev/null
+++ b/gfx/tilesets/roofs/violet.png
Binary files differ
diff --git a/main.asm b/main.asm
index 68e370d0..bed3299f 100644
--- a/main.asm
+++ b/main.asm
@@ -102,22 +102,17 @@ INCLUDE "engine/pokemon/breeding.asm"
SECTION "Roofs", ROMX
-LoadMapGroupRoof::
- dr $1c000, $1c30c
+INCLUDE "engine/tilesets/mapgroup_roofs.asm"
SECTION "Clock Reset", ROMX
-RestartClock_GetWraparoundTime::
- dr $20000, $20021
-RestartClock::
- dr $20021, $20181
+INCLUDE "engine/rtc/restart_clock.asm"
SECTION "Catch Tutorial", ROMX
-CatchTutorial::
- dr $23971, $239fe
+INCLUDE "engine/events/catch_tutorial.asm"
SECTION "bank9", ROMX