ref: 3f4044cd4628c156e975971ce0655d3d51917b87
parent: 6d47be8d8c02317a963c6ff5266a50a8674d285d
author: PikalaxALT <[email protected]>
date: Wed Nov 18 08:01:55 EST 2015
engine/compose_mail.asm; ldpixel
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -85,8 +85,8 @@
SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18
-SCREEN_WIDTH_PX EQU 160
-SCREEN_HEIGHT_PX EQU 144
+SCREEN_WIDTH_PX EQU SCREEN_WIDTH * 8
+SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * 8
BG_MAP_WIDTH EQU 32
BG_MAP_HEIGHT EQU 32
--- /dev/null
+++ b/engine/compose_mail.asm
@@ -1,0 +1,498 @@
+ComposeMailMessage: ; 11e75 (mail?)
+ ld hl, wc6d0
+ ld [hl], e
+ inc hl
+ ld [hl], d
+ ld a, [hMapAnims]
+ push af
+ xor a
+ ld [hMapAnims], a
+ ld a, [hInMenu]
+ push af
+ ld a, $1
+ ld [hInMenu], a
+ call .InitBlankMail
+ call DelayFrame
+
+.loop
+ call .DoMailEntry
+ jr nc, .loop
+
+ pop af
+ ld [hInMenu], a
+ pop af
+ ld [hMapAnims], a
+ ret
+
+.InitBlankMail: ; 11e9a (4:5e9a)
+ call ClearBGPalettes
+ call DisableLCD
+ call Function11c51
+ ld de, VTiles0 tile $00
+ ld hl, .MailIcon
+ ld bc, 8 tiles
+ ld a, BANK(.MailIcon)
+ call FarCopyBytes
+ xor a
+ ld hl, wc300
+ ld [hli], a
+ ld [hl], a
+
+ ; init mail icon
+ depixel 3, 2
+ ld a, SPRITE_ANIM_INDEX_00
+ call _InitSpriteAnimStruct
+
+ ld hl, $2
+ add hl, bc
+ ld [hl], $0
+ call .InitCharset
+ ld a, $e3
+ ld [rLCDC], a
+ call .initwc6d3
+ ld b, SCGB_08
+ call GetSGBLayout
+ call WaitBGMap
+ call WaitTop
+ ld a, %11100100
+ call DmgToCgbBGPals
+ ld a, %11100100
+ call Functioncf8
+ call Function11be0
+ ld hl, wc6d0
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ ld hl, $10
+ add hl, de
+ ld [hl], $4e
+ ret
+; 11ef4 (4:5ef4)
+
+.MailIcon: ; 11ef4
+INCBIN "gfx/icon/mail2.2bpp"
+; 11f74
+
+.initwc6d3: ; 11f74 (4:5f74)
+ ld a, $21
+ ld [wc6d3], a
+ ret
+; 11f7a (4:5f7a)
+
+.Dummy: ; dummied out
+ db "メールを かいてね@"
+; 11f84
+
+.InitCharset: ; 11f84 (4:5f84)
+ call WaitTop
+ hlcoord 0, 0
+ ld bc, 6 * SCREEN_WIDTH
+ ld a, $60 ; border
+ call ByteFill
+ hlcoord 0, 6
+ ld bc, 12 * SCREEN_WIDTH
+ ld a, " "
+ call ByteFill
+ hlcoord 1, 1
+ lb bc, 4, SCREEN_WIDTH - 2
+ call ClearBox
+ ld de, MailEntry_Uppercase
+
+.PlaceMailCharset: ; 11fa9 (4:5fa9)
+ hlcoord 1, 7
+ ld b, 6
+.next
+ ld c, SCREEN_WIDTH - 1
+.loop_
+ ld a, [de]
+ ld [hli], a
+ inc de
+ dec c
+ jr nz, .loop_
+ push de
+ ld de, SCREEN_WIDTH + 1
+ add hl, de
+ pop de
+ dec b
+ jr nz, .next
+ ret
+
+.DoMailEntry: ; 11fc0 (4:5fc0)
+ call JoyTextDelay
+ ld a, [wJumptableIndex]
+ bit 7, a
+ jr nz, .exit_mail
+ call .DoJumptable
+ callba Function8cf62
+ call .Update
+ call DelayFrame
+ and a
+ ret
+.exit_mail
+ callab Function8cf53
+ call ClearSprites
+ xor a
+ ld [hSCX], a
+ ld [hSCY], a
+ scf
+ ret
+
+.Update: ; 11feb (4:5feb)
+ xor a
+ ld [hBGMapMode], a
+ hlcoord 1, 1
+ lb bc, 4, 18
+ call ClearBox
+ ld hl, wc6d0
+ ld e, [hl]
+ inc hl
+ ld d, [hl]
+ hlcoord 2, 2
+ call PlaceString
+ ld a, $1
+ ld [hBGMapMode], a
+ ret
+
+.DoJumptable: ; 12008 (4:6008)
+ ld a, [wJumptableIndex]
+ ld e, a
+ ld d, 0
+ ld hl, .Jumptable
+rept 2
+ add hl, de
+endr
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ jp [hl]
+
+.Jumptable: ; 12017 (4:6017)
+ dw .init_blinking_cursor
+ dw .process_joypad
+
+
+.init_blinking_cursor: ; 1201b (4:601b)
+ depixel 9, 2
+ ld a, SPRITE_ANIM_INDEX_09
+ call _InitSpriteAnimStruct
+ ld a, c
+ ld [wc6d5], a
+ ld a, b
+ ld [wc6d6], a
+ ld hl, $1
+ add hl, bc
+ ld a, [hl]
+ ld hl, $e
+ add hl, bc
+ ld [hl], a
+ ld hl, wJumptableIndex
+ inc [hl]
+ ret
+
+.process_joypad: ; 1203a (4:603a)
+ ld hl, hJoyPressed ; $ffa7
+ ld a, [hl]
+ and A_BUTTON
+ jr nz, .a
+ ld a, [hl]
+ and B_BUTTON
+ jr nz, .b
+ ld a, [hl]
+ and START
+ jr nz, .start
+ ld a, [hl]
+ and SELECT
+ jr nz, .select
+ ret
+
+.a
+ call Function12185
+ cp $1
+ jr z, .select
+ cp $2
+ jr z, .b
+ cp $3
+ jr z, .finished
+ call Function11c11
+ call Function121ac
+ jr c, .start
+ ld hl, wc6d2
+ ld a, [hl]
+ cp $10
+ ret nz
+ inc [hl]
+ call Function11bd0
+ ld [hl], $f2
+ dec hl
+ ld [hl], $4e
+ ret
+
+.start
+ ld hl, wc6d5
+ ld c, [hl]
+ inc hl
+ ld b, [hl]
+ ld hl, $c
+ add hl, bc
+ ld [hl], $9
+ ld hl, $d
+ add hl, bc
+ ld [hl], $5
+ ret
+
+.b
+ call Function11bbc
+ ld hl, wc6d2
+ ld a, [hl]
+ cp $10
+ ret nz
+ dec [hl]
+ call Function11bd0
+ ld [hl], $f2
+ inc hl
+ ld [hl], $4e
+ ret
+
+.finished
+ call Function11bf7
+ ld hl, wJumptableIndex
+ set 7, [hl]
+ ret
+
+.select
+ ld hl, wcf64
+ ld a, [hl]
+ xor $1
+ ld [hl], a
+ jr nz, .switch_to_lowercase
+ ld de, MailEntry_Uppercase
+ call .PlaceMailCharset
+ ret
+.switch_to_lowercase
+ ld de, MailEntry_Lowercase
+ call .PlaceMailCharset
+ ret
+
+Function120c1: ; 120c1 (4:60c1)
+ call Function1210c
+ ld hl, SpriteAnim1Sprite0d - SpriteAnim1
+ add hl, bc
+ ld a, [hl]
+ ld e, a
+ swap e
+ ld hl, SpriteAnim1YOffset - SpriteAnim1
+ add hl, bc
+ ld [hl], e
+ cp $5
+ ld de, Unknown_120f8
+ ld a, $0
+ jr nz, .asm_120df
+ ld de, Unknown_12102
+ ld a, $1
+.asm_120df
+ ld hl, SpriteAnim1Sprite0e - SpriteAnim1
+ add hl, bc
+ add [hl]
+ ld hl, SpriteAnim1Sprite01 - SpriteAnim1
+ add hl, bc
+ ld [hl], a
+ ld hl, SpriteAnim1Sprite0c - SpriteAnim1
+ add hl, bc
+ ld l, [hl]
+ ld h, SpriteAnim1Index - SpriteAnim1
+ add hl, de
+ ld a, [hl]
+ ld hl, SpriteAnim1XOffset - SpriteAnim1
+ add hl, bc
+ ld [hl], a
+ ret
+; 120f8 (4:60f8)
+
+Unknown_120f8: ; 120f8
+ db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90
+Unknown_12102: ; 12102
+ db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60
+; 1210c
+
+Function1210c: ; 1210c (4:610c)
+ ld hl, hJoyLast
+ ld a, [hl]
+ and D_UP
+ jr nz, .up
+ ld a, [hl]
+ and D_DOWN
+ jr nz, .down
+ ld a, [hl]
+ and D_LEFT
+ jr nz, .left
+ ld a, [hl]
+ and D_RIGHT
+ jr nz, .right
+ ret
+.right
+ call Function1218b
+ and a
+ jr nz, .asm_12138
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ cp $9
+ jr nc, .asm_12135
+ inc [hl]
+ ret
+.asm_12135
+ ld [hl], $0
+ ret
+.asm_12138
+ cp $3
+ jr nz, .asm_1213d
+ xor a
+.asm_1213d
+ ld e, a
+ add a
+ add e
+ ld hl, $c
+ add hl, bc
+ ld [hl], a
+ ret
+.left
+ call Function1218b
+ and a
+ jr nz, .asm_12159
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_12156
+ dec [hl]
+ ret
+.asm_12156
+ ld [hl], $9
+ ret
+.asm_12159
+ cp $1
+ jr nz, .asm_1215f
+ ld a, $4
+.asm_1215f
+rept 2
+ dec a
+endr
+ ld e, a
+ add a
+ add e
+ ld hl, $c
+ add hl, bc
+ ld [hl], a
+ ret
+.down
+ ld hl, $d
+ add hl, bc
+ ld a, [hl]
+ cp $5
+ jr nc, .asm_12175
+ inc [hl]
+ ret
+.asm_12175
+ ld [hl], $0
+ ret
+.up
+ ld hl, $d
+ add hl, bc
+ ld a, [hl]
+ and a
+ jr z, .asm_12182
+ dec [hl]
+ ret
+.asm_12182
+ ld [hl], $5
+ ret
+
+Function12185: ; 12185 (4:6185)
+ ld hl, wc6d5
+ ld c, [hl]
+ inc hl
+ ld b, [hl]
+
+Function1218b: ; 1218b (4:618b)
+ ld hl, $d
+ add hl, bc
+ ld a, [hl]
+ cp $5
+ jr nz, .asm_121aa
+ ld hl, $c
+ add hl, bc
+ ld a, [hl]
+ cp $3
+ jr c, .asm_121a4
+ cp $6
+ jr c, .asm_121a7
+ ld a, $3
+ ret
+.asm_121a4
+ ld a, $1
+ ret
+.asm_121a7
+ ld a, $2
+ ret
+.asm_121aa
+ xor a
+ ret
+
+Function121ac: ; 121ac (4:61ac)
+ ld a, [wc6d7]
+ jp Function11b17
+; 121b2 (4:61b2)
+
+Function121b2: ; unreferenced
+ ld a, [wc6d2]
+ and a
+ ret z
+ cp $11
+ jr nz, .asm_121c3
+ push hl
+ ld hl, wc6d2
+rept 2
+ dec [hl]
+endr
+ jr .asm_121c8
+
+.asm_121c3
+ push hl
+ ld hl, wc6d2
+ dec [hl]
+
+.asm_121c8
+ call Function11bd0
+ ld c, [hl]
+ pop hl
+.asm_121cd
+ ld a, [hli]
+ cp $ff
+ jp z, Function11b27
+ cp c
+ jr z, .asm_121d9
+ inc hl
+ jr .asm_121cd
+
+.asm_121d9
+ ld a, [hl]
+ jp Function11b23
+; 121dd
+
+MailEntry_Uppercase: ; 122dd
+ db "A B C D E F G H I J"
+ db "K L M N O P Q R S T"
+ db "U V W X Y Z , ? !"
+ db "1 2 3 4 5 6 7 8 9 0"
+ db "<PK> <MN> <PO> <KE> é ♂ ♀ ¥ … ×"
+ db "lower DEL END "
+; 1224f
+
+MailEntry_Lowercase: ; 1224f
+ db "a b c d e f g h i j"
+ db "k l m n o p q r s t"
+ db "u v w x y z . - /"
+ db "'d 'l 'm 'r 's 't 'v & ( )"
+ db "<``> <''> [ ] ' : ; "
+ db "UPPER DEL END "
+; 122c1
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -3080,7 +3080,7 @@
; 2961b
Function2961b: ; 2961b
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, $e
call _InitSpriteAnimStruct
call Function29114
@@ -3090,7 +3090,7 @@
; 2962c
Function2962c: ; 2962c
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, $e
call _InitSpriteAnimStruct
ld hl, $b
@@ -3106,7 +3106,7 @@
; 29649
Function29649: ; 29649
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, $f
call _InitSpriteAnimStruct
call Function29114
@@ -3120,7 +3120,7 @@
Function29660: ; 29660
ld a, $e4
call Functioncf8
- lb de, $28, $58
+ depixel 5, 11
ld a, $10
call _InitSpriteAnimStruct
call Function29114
--- a/engine/mail.asm
+++ b/engine/mail.asm
@@ -286,13 +286,13 @@
; 44781 (11:4781)
-Function44781: ; 44781
+IsAnyMonHoldingMail: ; 44781
ld a, [PartyCount]
and a
- jr z, .asm_4479e
+ jr z, .no_mons
ld e, a
ld hl, PartyMon1Item
-.asm_4478b
+.loop
ld d, [hl]
push hl
push de
@@ -303,9 +303,9 @@
ld bc, PARTYMON_STRUCT_LENGTH
add hl, bc
dec e
- jr nz, .asm_4478b
+ jr nz, .loop
-.asm_4479e
+.no_mons
and a
ret
; 447a0
@@ -327,21 +327,21 @@
db "@"
InitMail: ; 0x447b9
-; initialize wd0f2 and beyond with incrementing values, one per mail
+; initialize wMailboxCount and beyond with incrementing values, one per mail
; set z if no mail
ld a, BANK(sMailboxCount)
call GetSRAMBank
ld a, [sMailboxCount]
call CloseSRAM
- ld hl, wd0f2
+ ld hl, wMailboxCount
ld [hli], a
and a
jr z, .done ; if no mail, we're done
- ; load values in memory with incrementing values starting at wd0f2
+ ; load values in memory with incrementing values starting at wMailboxCount
ld b, a
- ld a, $1
+ ld a, 1
.loop
ld [hli], a
inc a
@@ -348,9 +348,9 @@
dec b
jr nz, .loop
.done
- ld [hl], $ff ; terminate
+ ld [hl], -1 ; terminate
- ld a, [wd0f2]
+ ld a, [wMailboxCount]
and a
ret
; 0x447da
@@ -385,7 +385,7 @@
xor a
ld [OBPals + 8 * 6], a
ld a, $1
- ld [wd0f1], a
+ ld [wCurMessageIndex], a
.loop
call InitMail
ld hl, MenuData4494c
@@ -394,7 +394,8 @@
ld [hBGMapMode], a
call InitScrollingMenu
call UpdateSprites
- ld a, [wd0f1]
+
+ ld a, [wCurMessageIndex]
ld [wMenuCursorBuffer], a
ld a, [OBPals + 8 * 6]
ld [wd0e4], a
@@ -402,7 +403,8 @@
ld a, [wd0e4]
ld [OBPals + 8 * 6], a
ld a, [MenuSelection2]
- ld [wd0f1], a
+ ld [wCurMessageIndex], a
+
ld a, [wcf73]
cp $2
jr z, .exit
@@ -558,7 +560,7 @@
MenuData4494c: ; 0x4494c
db %01000000 ; flags
db 1, 8 ; start coords
- db $a, $12 ; end coords
+ db 10, 18 ; end coords
dw .MenuData2
db 1 ; default option
@@ -566,7 +568,7 @@
db %00010000 ; flags
db 4, 0 ; rows/columns?
db 1 ; horizontal spacing?
- dbw 0,wd0f2 ; text pointer
+ dbw 0, wMailboxCount ; text pointer
dba Function447fb
dbw 0,0
dbw 0,0
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -173,7 +173,7 @@
ld hl, wc300
ld [hli], a
ld [hl], a
- lb de, $24, $20
+ depixel 4, 4, 4, 0
ld a, SPRITE_ANIM_INDEX_0A
call _InitSpriteAnimStruct
ld hl, $1
@@ -230,7 +230,7 @@
ld b, SPRITE_ANIM_INDEX_1E
.asm_11873
ld a, b
- lb de, $24, $20
+ depixel 4, 4, 4, 0
call _InitSpriteAnimStruct
ret
@@ -400,10 +400,10 @@
Function1197b: ; 1197b (4:597b)
- lb de, $50, $18
+ depixel 10, 3
call Function1189c
jr nz, .asm_11985
- ld d, $40
+ ld d, 8 * 8
.asm_11985
ld a, SPRITE_ANIM_INDEX_02
call _InitSpriteAnimStruct
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -149,7 +149,7 @@
; 90d32
Function90d32: ; 90d32 (24:4d32)
- lb de, $24, $10
+ depixel 4, 2, 4, 0
ld a, SPRITE_ANIM_INDEX_0D
call _InitSpriteAnimStruct
ld hl, $3
@@ -762,7 +762,7 @@
Function910f9: ; 910f9 (24:50f9)
call Function90da8
- lb de, $24, $54
+ depixel 4, 10, 4, 4
ld a, SPRITE_ANIM_INDEX_14
call _InitSpriteAnimStruct
ld hl, $3
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -1037,7 +1037,7 @@
call Function92fc0
push bc
push af
- lb de, $60, $68
+ depixel 12, 13
ld a, SPRITE_ANIM_INDEX_06
call _InitSpriteAnimStruct
ld hl, $e
@@ -1096,7 +1096,7 @@
add hl, bc
ld [hl], $0
push bc
- lb de, $60, $00
+ depixel 12, 0
ld a, SPRITE_ANIM_INDEX_07
call _InitSpriteAnimStruct
pop bc
@@ -2063,7 +2063,7 @@
add hl, bc
dec [hl]
push bc
- lb de, $60, $6c
+ depixel 12, 13, 0, 4
ld a, SPRITE_ANIM_INDEX_08
call _InitSpriteAnimStruct
pop bc
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -615,7 +615,7 @@
dw .nine
dw .ten
dw .eleven
- dw .twelve
+ dw .twelve ; blinking cursor
dw .thirteen
dw .fourteen
dw .fifteen
--- a/engine/startmenu.asm
+++ b/engine/startmenu.asm
@@ -1069,7 +1069,7 @@
Function12cfe: ; 12cfe (4:6cfe)
ld de, wd002
- callba Function11e75
+ callba ComposeMailMessage
ld hl, PlayerName
ld de, wd023
ld bc, NAME_LENGTH - 1
--- a/event/celebi.asm
+++ b/event/celebi.asm
@@ -5,7 +5,7 @@
xor a
ld [VramState], a
call LoadCelebiGFX
- lb de, $07, $50
+ depixel 0, 10, 7, 0
ld a, SPRITE_ANIM_INDEX_2C
call _InitSpriteAnimStruct
ld hl, $3
binary files /dev/null b/gfx/icon/mail2.2bpp differ
binary files a/gfx/unknown/011ef4.2bpp /dev/null differ
--- a/macros.asm
+++ b/macros.asm
@@ -211,3 +211,13 @@
ENDM
palettes EQUS "* 8"
+
+ldpixel: MACRO
+if _NARG == 5
+ lb \1, \2 * 8 + \4, \3 * 8 + \5
+else
+ lb \1, \2 * 8, \3 * 8
+endc
+ endm
+
+depixel EQUS "ldpixel de,"
--- a/main.asm
+++ b/main.asm
@@ -9795,29 +9795,29 @@
; e3fd
_BillsPC: ; e3fd
- call Functione40a
+ call .CheckCanUsePC
ret c
- call Functione41c
- call Functione443
- jp Functione43f
+ call .LogIn
+ call .UseBillsPC
+ jp .LogOut
-Functione40a: ; e40a (3:640a)
+.CheckCanUsePC: ; e40a (3:640a)
ld a, [PartyCount]
and a
ret nz
- ld hl, UnknownText_0xe417
+ ld hl, .Text_GottaHavePokemon
call MenuTextBoxBackup
scf
ret
; e417 (3:6417)
-UnknownText_0xe417: ; 0xe417
+.Text_GottaHavePokemon: ; 0xe417
; You gotta have #MON to call!
text_jump UnknownText_0x1c1006
db "@"
; 0xe41c
-Functione41c: ; e41c (3:641c)
+.LogIn: ; e41c (3:641c)
xor a
ld [hBGMapMode], a
call LoadStandardMenuDataHeader
@@ -9826,7 +9826,7 @@
ld a, [hl]
push af
set NO_TEXT_SCROLL, [hl]
- ld hl, UnknownText_0xe43a
+ ld hl, .Text_What
call PrintText
pop af
ld [Options], a
@@ -9834,17 +9834,17 @@
ret
; e43a (3:643a)
-UnknownText_0xe43a: ; 0xe43a
+.Text_What: ; 0xe43a
; What?
text_jump UnknownText_0x1c1024
db "@"
; 0xe43f
-Functione43f: ; e43f (3:643f)
+.LogOut: ; e43f (3:643f)
call ReturnToCallingMenu
ret
-Functione443: ; e443 (3:6443)
+.UseBillsPC: ; e443 (3:6443)
ld hl, .MenuDataHeader
call LoadMenuDataHeader
ld a, $1
@@ -9917,9 +9917,9 @@
BillsPC_MovePKMNMenu: ; e4cd
call LoadStandardMenuDataHeader
- callba Function44781
+ callba IsAnyMonHoldingMail
jr nc, .no_mail
- ld hl, UnknownText_0xe4f9
+ ld hl, .Text_MonHoldingMail
call PrintText
jr .quit
@@ -9936,7 +9936,7 @@
ret
; e4f9
-UnknownText_0xe4f9: ; 0xe4f9
+.Text_MonHoldingMail: ; 0xe4f9
; There is a #MON holding MAIL. Please remove the MAIL.
text_jump UnknownText_0x1c102b
db "@"
@@ -9955,32 +9955,32 @@
Functione512: ; unused
ld a, [PartyCount]
and a
- jr z, .asm_e51e
+ jr z, .no_pkmn
cp 2
- jr c, .asm_e526
+ jr c, .only_one_pkmn
and a
ret
-.asm_e51e
- ld hl, UnknownText_0xe52e
+.no_pkmn
+ ld hl, .Text_NoPKMN
call MenuTextBoxBackup
scf
ret
-.asm_e526
- ld hl, UnknownText_0xe533
+.only_one_pkmn
+ ld hl, .Text_ItsYourLastPKMN
call MenuTextBoxBackup
scf
ret
; e52e
-UnknownText_0xe52e: ; 0xe52e
+.Text_NoPKMN: ; 0xe52e
; You don't have a single #MON!
text_jump UnknownText_0x1c1062
db "@"
; 0xe533
-UnknownText_0xe533: ; 0xe533
+.Text_ItsYourLastPKMN: ; 0xe533
; You can't deposit your last #MON!
text_jump UnknownText_0x1c1080
db "@"
@@ -10407,507 +10407,11 @@
SECTION "bank4", ROMX, BANK[$4]
INCLUDE "engine/pack.asm"
-
INCLUDE "engine/time.asm"
-
INCLUDE "engine/tmhm.asm"
-
INCLUDE "engine/namingscreen.asm"
+INCLUDE "engine/compose_mail.asm"
-Function11e75: ; 11e75 (mail?)
- ld hl, wc6d0
- ld [hl], e
- inc hl
- ld [hl], d
- ld a, [hMapAnims]
- push af
- xor a
- ld [hMapAnims], a
- ld a, [hInMenu]
- push af
- ld a, $1
- ld [hInMenu], a
- call Function11e9a
- call DelayFrame
-.asm_11e8e
- call Function11fc0
- jr nc, .asm_11e8e
- pop af
- ld [hInMenu], a
- pop af
- ld [hMapAnims], a
- ret
-
-Function11e9a: ; 11e9a (4:5e9a)
- call ClearBGPalettes
- call DisableLCD
- call Function11c51
- ld de, VTiles0 tile $00
- ld hl, GFX_11ef4
- ld bc, $80
- ld a, BANK(GFX_11ef4)
- call FarCopyBytes
- xor a
- ld hl, wc300
- ld [hli], a
- ld [hl], a
- lb de, $18, $10
- ld a, SPRITE_ANIM_INDEX_00
- call _InitSpriteAnimStruct
- ld hl, $2
- add hl, bc
- ld [hl], $0
- call Function11f84
- ld a, $e3
- ld [rLCDC], a
- call Function11f74
- ld b, SCGB_08
- call GetSGBLayout
- call WaitBGMap
- call WaitTop
- ld a, %11100100
- call DmgToCgbBGPals
- ld a, %11100100
- call Functioncf8
- call Function11be0
- ld hl, wc6d0
- ld e, [hl]
- inc hl
- ld d, [hl]
- ld hl, $10
- add hl, de
- ld [hl], $4e
- ret
-; 11ef4 (4:5ef4)
-
-GFX_11ef4: ; 11ef4
-INCBIN "gfx/unknown/011ef4.2bpp"
-; 11f74
-
-Function11f74: ; 11f74 (4:5f74)
- ld a, $21
- ld [wc6d3], a
- ret
-; 11f7a (4:5f7a)
-
-String_11f7a: ; dummied out
- db "メールを かいてね@"
-; 11f84
-
-Function11f84: ; 11f84 (4:5f84)
- call WaitTop
- hlcoord 0, 0
- ld bc, 6 * SCREEN_WIDTH
- ld a, $60
- call ByteFill
- hlcoord 0, 6
- ld bc, 12 * SCREEN_WIDTH
- ld a, " "
- call ByteFill
- hlcoord 1, 1
- lb bc, 4, SCREEN_WIDTH - 2
- call ClearBox
- ld de, String_121dd
-
-Function11fa9: ; 11fa9 (4:5fa9)
- hlcoord 1, 7
- ld b, 6
-.next
- ld c, SCREEN_WIDTH - 1
-.loop
- ld a, [de]
- ld [hli], a
- inc de
- dec c
- jr nz, .loop
- push de
- ld de, 21
- add hl, de
- pop de
- dec b
- jr nz, .next
- ret
-
-Function11fc0: ; 11fc0 (4:5fc0)
- call JoyTextDelay
- ld a, [wJumptableIndex]
- bit 7, a
- jr nz, .asm_11fdb
- call Function12008
- callba Function8cf62
- call Function11feb
- call DelayFrame
- and a
- ret
-.asm_11fdb
- callab Function8cf53
- call ClearSprites
- xor a
- ld [hSCX], a
- ld [hSCY], a
- scf
- ret
-
-Function11feb: ; 11feb (4:5feb)
- xor a
- ld [hBGMapMode], a
- hlcoord 1, 1
- lb bc, 4, 18
- call ClearBox
- ld hl, wc6d0
- ld e, [hl]
- inc hl
- ld d, [hl]
- hlcoord 2, 2
- call PlaceString
- ld a, $1
- ld [hBGMapMode], a
- ret
-
-Function12008: ; 12008 (4:6008)
- ld a, [wJumptableIndex]
- ld e, a
- ld d, 0
- ld hl, Jumptable_12017
-rept 2
- add hl, de
-endr
- ld a, [hli]
- ld h, [hl]
- ld l, a
- jp [hl]
-
-Jumptable_12017: ; 12017 (4:6017)
- dw Function1201b
- dw Function1203a
-
-
-Function1201b: ; 1201b (4:601b)
- lb de, $48, $10
- ld a, SPRITE_ANIM_INDEX_09
- call _InitSpriteAnimStruct
- ld a, c
- ld [wc6d5], a
- ld a, b
- ld [wc6d6], a
- ld hl, $1
- add hl, bc
- ld a, [hl]
- ld hl, $e
- add hl, bc
- ld [hl], a
- ld hl, wJumptableIndex
- inc [hl]
- ret
-
-Function1203a: ; 1203a (4:603a)
- ld hl, hJoyPressed ; $ffa7
- ld a, [hl]
- and A_BUTTON
- jr nz, .a
- ld a, [hl]
- and B_BUTTON
- jr nz, .b
- ld a, [hl]
- and START
- jr nz, .start
- ld a, [hl]
- and SELECT
- jr nz, .select
- ret
-
-.a
- call Function12185
- cp $1
- jr z, .select
- cp $2
- jr z, .b
- cp $3
- jr z, .asm_120a1
- call Function11c11
- call Function121ac
- jr c, .start
- ld hl, wc6d2
- ld a, [hl]
- cp $10
- ret nz
- inc [hl]
- call Function11bd0
- ld [hl], $f2
- dec hl
- ld [hl], $4e
- ret
-
-.start
- ld hl, wc6d5
- ld c, [hl]
- inc hl
- ld b, [hl]
- ld hl, $c
- add hl, bc
- ld [hl], $9
- ld hl, $d
- add hl, bc
- ld [hl], $5
- ret
-
-.b
- call Function11bbc
- ld hl, wc6d2
- ld a, [hl]
- cp $10
- ret nz
- dec [hl]
- call Function11bd0
- ld [hl], $f2
- inc hl
- ld [hl], $4e
- ret
-
-.asm_120a1
- call Function11bf7
- ld hl, wJumptableIndex
- set 7, [hl]
- ret
-
-.select
- ld hl, wcf64
- ld a, [hl]
- xor $1
- ld [hl], a
- jr nz, .asm_120ba
- ld de, String_121dd
- call Function11fa9
- ret
-.asm_120ba
- ld de, String_1224f
- call Function11fa9
- ret
-
-Function120c1: ; 120c1 (4:60c1)
- call Function1210c
- ld hl, $d
- add hl, bc
- ld a, [hl]
- ld e, a
- swap e
- ld hl, $7
- add hl, bc
- ld [hl], e
- cp $5
- ld de, Unknown_120f8
- ld a, $0
- jr nz, .asm_120df
- ld de, Unknown_12102
- ld a, $1
-.asm_120df
- ld hl, $e
- add hl, bc
- add [hl]
- ld hl, $1
- add hl, bc
- ld [hl], a
- ld hl, $c
- add hl, bc
- ld l, [hl]
- ld h, $0
- add hl, de
- ld a, [hl]
- ld hl, $6
- add hl, bc
- ld [hl], a
- ret
-; 120f8 (4:60f8)
-
-Unknown_120f8: ; 120f8
- db $00, $10, $20, $30, $40, $50, $60, $70, $80, $90
-Unknown_12102: ; 12102
- db $00, $00, $00, $30, $30, $30, $60, $60, $60, $60
-; 1210c
-
-Function1210c: ; 1210c (4:610c)
- ld hl, hJoyLast
- ld a, [hl]
- and D_UP
- jr nz, .up
- ld a, [hl]
- and D_DOWN
- jr nz, .down
- ld a, [hl]
- and D_LEFT
- jr nz, .left
- ld a, [hl]
- and D_RIGHT
- jr nz, .right
- ret
-.right
- call Function1218b
- and a
- jr nz, .asm_12138
- ld hl, $c
- add hl, bc
- ld a, [hl]
- cp $9
- jr nc, .asm_12135
- inc [hl]
- ret
-.asm_12135
- ld [hl], $0
- ret
-.asm_12138
- cp $3
- jr nz, .asm_1213d
- xor a
-.asm_1213d
- ld e, a
- add a
- add e
- ld hl, $c
- add hl, bc
- ld [hl], a
- ret
-.left
- call Function1218b
- and a
- jr nz, .asm_12159
- ld hl, $c
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_12156
- dec [hl]
- ret
-.asm_12156
- ld [hl], $9
- ret
-.asm_12159
- cp $1
- jr nz, .asm_1215f
- ld a, $4
-.asm_1215f
-rept 2
- dec a
-endr
- ld e, a
- add a
- add e
- ld hl, $c
- add hl, bc
- ld [hl], a
- ret
-.down
- ld hl, $d
- add hl, bc
- ld a, [hl]
- cp $5
- jr nc, .asm_12175
- inc [hl]
- ret
-.asm_12175
- ld [hl], $0
- ret
-.up
- ld hl, $d
- add hl, bc
- ld a, [hl]
- and a
- jr z, .asm_12182
- dec [hl]
- ret
-.asm_12182
- ld [hl], $5
- ret
-
-Function12185: ; 12185 (4:6185)
- ld hl, wc6d5
- ld c, [hl]
- inc hl
- ld b, [hl]
-
-Function1218b: ; 1218b (4:618b)
- ld hl, $d
- add hl, bc
- ld a, [hl]
- cp $5
- jr nz, .asm_121aa
- ld hl, $c
- add hl, bc
- ld a, [hl]
- cp $3
- jr c, .asm_121a4
- cp $6
- jr c, .asm_121a7
- ld a, $3
- ret
-.asm_121a4
- ld a, $1
- ret
-.asm_121a7
- ld a, $2
- ret
-.asm_121aa
- xor a
- ret
-
-Function121ac: ; 121ac (4:61ac)
- ld a, [wc6d7]
- jp Function11b17
-; 121b2 (4:61b2)
-
-Function121b2: ; unreferenced
- ld a, [wc6d2]
- and a
- ret z
- cp $11
- jr nz, .asm_121c3
- push hl
- ld hl, wc6d2
-rept 2
- dec [hl]
-endr
- jr .asm_121c8
-
-.asm_121c3
- push hl
- ld hl, wc6d2
- dec [hl]
-
-.asm_121c8
- call Function11bd0
- ld c, [hl]
- pop hl
-.asm_121cd
- ld a, [hli]
- cp $ff
- jp z, Function11b27
- cp c
- jr z, .asm_121d9
- inc hl
- jr .asm_121cd
-
-.asm_121d9
- ld a, [hl]
- jp Function11b23
-; 121dd
-
-String_121dd: ; 122dd
- db "A B C D E F G H I J"
- db "K L M N O P Q R S T"
- db "U V W X Y Z , ? !"
- db "1 2 3 4 5 6 7 8 9 0"
- db "<PK> <MN> <PO> <KE> é ♂ ♀ ¥ … ×"
- db "lower DEL END "
-; 1224f
-
-String_1224f: ; 1224f
- db "a b c d e f g h i j"
- db "k l m n o p q r s t"
- db "u v w x y z . - /"
- db "'d 'l 'm 'r 's 't 'v & ( )"
- db "<``> <''> [ ] ' : ; "
- db "UPPER DEL END "
-; 122c1
-
Script_AbortBugContest: ; 0x122c1
checkflag ENGINE_BUG_CONTEST_TIMER
iffalse .finish
@@ -30083,7 +29587,7 @@
xor a
ld [VramState], a
call Function8cb9b
- lb de, $54, $50
+ depixel 10, 10, 4, 0
ld a, SPRITE_ANIM_INDEX_0A
call _InitSpriteAnimStruct
ld hl, $3
@@ -30117,7 +29621,7 @@
xor a
ld [VramState], a
call Function8cb9b
- lb de, $fc, $50
+ depixel 31, 10, 4, 0
ld a, SPRITE_ANIM_INDEX_0A
call _InitSpriteAnimStruct
ld hl, $3
@@ -32438,7 +31942,7 @@
ld [rSVBK], a
callba Function8cf53
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_03
call _InitSpriteAnimStruct
ld hl, $7
@@ -33118,7 +32622,7 @@
ld [hWY], a
call Functione5516
callba Function8cf53
- lb de, $6c, $d8
+ depixel 13, 27, 4, 0
ld a, SPRITE_ANIM_INDEX_26
call _InitSpriteAnimStruct
ld a, $f0
@@ -33206,7 +32710,7 @@
ret
.pichu
- lb de, $a9, $80
+ depixel 21, 16, 1, 0
ld a, SPRITE_ANIM_INDEX_27
call _InitSpriteAnimStruct
ld de, SFX_INTRO_PICHU
@@ -33214,7 +32718,7 @@
ret
.wooper
- lb de, $b0, $30
+ depixel 22, 6
ld a, SPRITE_ANIM_INDEX_28
call _InitSpriteAnimStruct
ld de, SFX_INTRO_PICHU
@@ -33392,7 +32896,7 @@
ld a, $90
ld [hWY], a
callba Function8cf53
- lb de, $6c, $58
+ depixel 13, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_26
call _InitSpriteAnimStruct
ld de, MUSIC_CRYSTAL_OPENING
@@ -33503,10 +33007,10 @@
ld [hWY], a
callba Function8cf53
call Functione549e
- lb de, $40, $28
+ depixel 8, 5
ld a, SPRITE_ANIM_INDEX_2A
call _InitSpriteAnimStruct
- lb de, $60, $00
+ depixel 12, 0
ld a, SPRITE_ANIM_INDEX_2B
call _InitSpriteAnimStruct
xor a
@@ -33655,7 +33159,7 @@
ld [hli], a
ld [hl], $7f
call Functione549e
- lb de, $60, $00
+ depixel 12, 0
ld a, SPRITE_ANIM_INDEX_2B
call _InitSpriteAnimStruct
xor a
--- a/misc/battle_tower_47.asm
+++ b/misc/battle_tower_47.asm
@@ -494,10 +494,10 @@
Function11c2e9: ; 11c2e9 (47:42e9)
- lb de, $1a, $0d
+ depixel 3, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
- lb de, $42, $0d
+ depixel 8, 1, 2, 5
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
@@ -504,7 +504,7 @@
add hl, bc
ld a, $1
ld [hl], a
- lb de, $4a, $10
+ depixel 9, 2, 2, 0
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
@@ -511,7 +511,7 @@
add hl, bc
ld a, $3
ld [hl], a
- lb de, $50, $80
+ depixel 10, 16
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
@@ -518,7 +518,7 @@
add hl, bc
ld a, $4
ld [hl], a
- lb de, $50, $20
+ depixel 10, 4
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
@@ -525,7 +525,7 @@
add hl, bc
ld a, $5
ld [hl], a
- lb de, $50, $10
+ depixel 10, 2
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
--- a/misc/mobile_42.asm
+++ b/misc/mobile_42.asm
@@ -492,7 +492,7 @@
ld c, $50
call DelayFrames
call Function108bec
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_20
call _InitSpriteAnimStruct
ld de, SFX_BALL_POOF
@@ -527,7 +527,7 @@
ld [hWX], a
ld a, $90
ld [hWY], a
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_21
call _InitSpriteAnimStruct
call Function108b45
@@ -627,7 +627,7 @@
ld c, $50
call DelayFrames
call Function108c2b
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_20
call _InitSpriteAnimStruct
ld de, SFX_BALL_POOF
@@ -671,7 +671,7 @@
ld [hWX], a
ld a, $90
ld [hWY], a
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_21
call _InitSpriteAnimStruct
call Function108b45
@@ -740,7 +740,7 @@
ld [hWX], a
ld a, $90
ld [hWY], a
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_21
call _InitSpriteAnimStruct
call Function108b45
@@ -927,7 +927,7 @@
ld [hSCX], a
cp $f8
jr nz, .asm_10878a
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_22
call _InitSpriteAnimStruct
@@ -953,7 +953,7 @@
jr .asm_1087c4
.asm_1087a9
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_22
call _InitSpriteAnimStruct
xor a
@@ -985,7 +985,7 @@
call Function1082f0
call Function108af4
call Function108b5a
- lb de, $4a, $50
+ depixel 9, 10, 2, 0
ld a, SPRITE_ANIM_INDEX_25
call _InitSpriteAnimStruct
ld de, SFX_FORESIGHT
@@ -994,7 +994,7 @@
call Function1082cc
xor a
ld [wcf64], a
- lb de, $4a, $50
+ depixel 9, 10, 2, 0
ld a, SPRITE_ANIM_INDEX_23
call _InitSpriteAnimStruct
.asm_1087fc
@@ -1021,7 +1021,7 @@
call PlaySFX
ld c, $3c
call Function1082cc
- lb de, $f2, $50
+ depixel 30, 10, 2, 0
ld a, SPRITE_ANIM_INDEX_24
call _InitSpriteAnimStruct
call Function1082b7
@@ -1044,7 +1044,7 @@
Function10884c: ; 10884c
ld c, 80
call DelayFrames
- lb de, $f2, $50
+ depixel 30, 10, 2, 0
ld a, SPRITE_ANIM_INDEX_24
call _InitSpriteAnimStruct
call Function1082b7
@@ -1068,7 +1068,7 @@
.asm_108879
callba Function8d03d
- lb de, $4a, $50
+ depixel 9, 10, 2, 0
ld a, SPRITE_ANIM_INDEX_25
call _InitSpriteAnimStruct
ld de, SFX_GLASS_TING_2
@@ -1105,13 +1105,13 @@
jr .asm_1088e7
.asm_1088c5
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_22
call _InitSpriteAnimStruct
jr .asm_1088e7
.asm_1088cf
- lb de, $54, $58
+ depixel 10, 11, 4, 0
ld a, SPRITE_ANIM_INDEX_22
call _InitSpriteAnimStruct
xor a
--- a/misc/mobile_45.asm
+++ b/misc/mobile_45.asm
@@ -7757,7 +7757,7 @@
Function117738: ; 117738 (45:7738)
callba Function171ccd
- lb de, $30, $18
+ depixel 6, 3
ld a, $1d
call _InitSpriteAnimStruct
ld hl, $c
@@ -7764,7 +7764,7 @@
add hl, bc
ld a, $6
ld [hl], a
- lb de, $48, $20
+ depixel 9, 4
ld a, $1d
call _InitSpriteAnimStruct
ld hl, $c
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -1859,7 +1859,7 @@
jr Function171b42
Function171b4b: ; 171b4b (5c:5b4b)
- lb de, $40, $10
+ depixel 8, 2
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
@@ -1866,7 +1866,7 @@
add hl, bc
ld a, $8
ld [hl], a
- lb de, $40, $98
+ depixel 8, 19
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
@@ -1873,7 +1873,7 @@
add hl, bc
ld a, $9
ld [hl], a
- lb de, $8a, $70
+ depixel 17, 14, 2, 0
ld a, SPRITE_ANIM_INDEX_1D
call _InitSpriteAnimStruct
ld hl, $c
--- a/wram.asm
+++ b/wram.asm
@@ -387,18 +387,22 @@
wSpriteAnimationStructs::
sprite_anim_struct: MACRO
-\1Index:: ds 1
- ds 1
-\1AnimSeqID:: ds 1
-\1TileID:: ds 1
-\1XCoord:: ds 1
-\1YCoord:: ds 1
-\1XOffset:: ds 1
-\1YOffset:: ds 1
-\1FrameTimer:: ds 1
- ds 1
-\1FrameIndex:: ds 1
- ds 5
+\1Index:: ds 1 ; 0
+\1Sprite01:: ds 1 ; 1
+\1AnimSeqID:: ds 1 ; 2
+\1TileID:: ds 1 ; 3
+\1XCoord:: ds 1 ; 4
+\1YCoord:: ds 1 ; 5
+\1XOffset:: ds 1 ; 6
+\1YOffset:: ds 1 ; 7
+\1FrameTimer:: ds 1 ; 8
+\1Sprite09:: ds 1 ; 9
+\1FrameIndex:: ds 1 ; a
+\1Sprite0b:: ds 1
+\1Sprite0c:: ds 1
+\1Sprite0d:: ds 1
+\1Sprite0e:: ds 1
+\1Sprite0f:: ds 1
ENDM
; Field 0: Index
@@ -1658,15 +1662,19 @@
wBattleResult:: ds 1
wd0ef:: ds 1
-wd0f0::
-CurMart:: ; d0f0
- ; ds 16
- ds 1
-wd0f1:: ds 1
-wd0f2:: ds 14
+CurMart:: ds 16
+ ds CurMart - @
+wd0f0:: ds 1
+wd0f1::
+wCurMessageIndex:: ds 1
+wd0f2::
+wMailboxCount:: ds 1
+wMailboxItems:: ds MAILBOX_CAPACITY
+wMailboxEnd:: ds 1 ; d1fe
+ ds 2
CurMartEnd::
-wd100:: ds 1
+wd100:: ds 1
wd101:: ds 1
wd102:: ds 1
wd103:: ds 1