diff --git a/constants/radio_constants.asm b/constants/radio_constants.asm index ee9cd6ce6..92aa39adc 100644 --- a/constants/radio_constants.asm +++ b/constants/radio_constants.asm @@ -88,6 +88,17 @@ const POKEDEX_SHOW_7 ; $56 const POKEDEX_SHOW_8 ; $57 + const_def + const MAPRADIO_POKEMON_CHANNEL + const MAPRADIO_OAKS_MON_TALK + const MAPRADIO_POKEDEX_SHOW + const MAPRADIO_PKMN_MUSIC + const MAPRADIO_LUCKY_CHANNEL + const MAPRADIO_UNOWN + const MAPRADIO_PLACES_PEOPLE + const MAPRADIO_LETS_ALL_SING + const MAPRADIO_ROCKET + const_def const BUENA_MON const BUENA_ITEM diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index 90fc6b691..3d0c3919a 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -349,22 +349,22 @@ MAX_OUTDOOR_SPRITES EQU 23 const FACING_1F const_def - const SPRITEANIMSTRUCT_INDEX - const SPRITEANIMSTRUCT_FRAMESET_ID - const SPRITEANIMSTRUCT_ANIM_SEQ_ID - const SPRITEANIMSTRUCT_TILE_ID - const SPRITEANIMSTRUCT_XCOORD - const SPRITEANIMSTRUCT_YCOORD - const SPRITEANIMSTRUCT_XOFFSET - const SPRITEANIMSTRUCT_YOFFSET - const SPRITEANIMSTRUCT_DURATION - const SPRITEANIMSTRUCT_DURATIONOFFSET - const SPRITEANIMSTRUCT_FRAME - const SPRITEANIMSTRUCT_0B - const SPRITEANIMSTRUCT_0C - const SPRITEANIMSTRUCT_0D - const SPRITEANIMSTRUCT_0E - const SPRITEANIMSTRUCT_0F + const SPRITEANIMSTRUCT_INDEX ; 0 + const SPRITEANIMSTRUCT_FRAMESET_ID ; 1 + const SPRITEANIMSTRUCT_ANIM_SEQ_ID ; 2 + const SPRITEANIMSTRUCT_TILE_ID ; 3 + const SPRITEANIMSTRUCT_XCOORD ; 4 + const SPRITEANIMSTRUCT_YCOORD ; 5 + const SPRITEANIMSTRUCT_XOFFSET ; 6 + const SPRITEANIMSTRUCT_YOFFSET ; 7 + const SPRITEANIMSTRUCT_DURATION ; 8 + const SPRITEANIMSTRUCT_DURATIONOFFSET ; 9 + const SPRITEANIMSTRUCT_FRAME ; a + const SPRITEANIMSTRUCT_0B ; b + const SPRITEANIMSTRUCT_0C ; c + const SPRITEANIMSTRUCT_0D ; d + const SPRITEANIMSTRUCT_0E ; e + const SPRITEANIMSTRUCT_0F ; f const_def const SPRITE_ANIM_FRAMESET_00 diff --git a/engine/dummy_game.asm b/engine/dummy_game.asm index e10633c88..4e2e189da 100755 --- a/engine/dummy_game.asm +++ b/engine/dummy_game.asm @@ -1,12 +1,12 @@ _DummyGame: ; e1e5b (38:5e5b) - call Functione1e67 + call .LoadGFXAndPals call DelayFrame -.asm_e1e61 - call Functione1ebb - jr nc, .asm_e1e61 +.loop + call .JumptableLoop + jr nc, .loop ret -Functione1e67: ; e1e67 (38:5e67) +.LoadGFXAndPals call DisableLCD ld b, SCGB_08 call GetSGBLayout @@ -16,7 +16,7 @@ Functione1e67: ; e1e67 (38:5e67) call Decompress ld hl, Unknown_e00ed ld de, VTiles0 tile $00 - ld bc, $40 + ld bc, 4 tiles ld a, BANK(Unknown_e00ed) call FarCopyBytes ld a, $8 @@ -42,403 +42,397 @@ Functione1e67: ; e1e67 (38:5e67) call DmgToCgbObjPal0 ret -Functione1ebb: ; e1ebb (38:5ebb) +.JumptableLoop ld a, [wJumptableIndex] bit 7, a - jr nz, .asm_e1ed0 - call Functione1ed2 + jr nz, .quit + call .ExecuteJumptable callab PlaySpriteAnimations call DelayFrame and a ret -.asm_e1ed0 + +.quit scf ret -Functione1ed2: ; e1ed2 (38:5ed2) - ld a, [wJumptableIndex] - ld e, a - ld d, 0 - ld hl, Jumptable_e1ee1 -rept 2 - add hl, de -endr - ld a, [hli] - ld h, [hl] - ld l, a - jp [hl] -; e1ee1 (38:5ee1) +.ExecuteJumptable + jumptable .Jumptable, wJumptableIndex -Jumptable_e1ee1: ; e1ee1 - dw Functione1ef3 - dw Functione1efb - dw Functione1f1c - dw Functione1f42 - dw Functione1f61 - dw Functione1f8b - dw Functione1fba - dw Functione1fcc - dw Functione2000 -; e1ef3 +.Jumptable + dw .RestartGame + dw .ResetBoard + dw .InitBoardTilemapAndCursorObject + dw .CheckTriesRemaining + dw .PickCard1 + dw .PickCard2 + dw .DelayPickAgain + dw .RevealAll + dw .AskPlayAgain -Functione1ef3: ; e1ef3 - call Functione2152 +.RestartGame + call DummyGame_InitStrings ld hl, wJumptableIndex inc [hl] ret -; e1efb -Functione1efb: ; e1efb +.ResetBoard call ret_e00ed - jr nc, .asm_e1f06 + jr nc, .proceed ld hl, wJumptableIndex set 7, [hl] ret -.asm_e1f06 - call Functione209d +.proceed + call DummyGame_InitBoard ld hl, wJumptableIndex inc [hl] xor a - ld [wc708], a - ld hl, wc703 + ld [wDummyGameCounter], a + ld hl, wDummyGameLastMatches rept 4 ld [hli], a endr ld [hl], a - ld [wc709], a - -Functione1f1c: ; e1f1c - ld hl, wc708 + ld [wDummyGameNumCardsMatched], a +.InitBoardTilemapAndCursorObject + ld hl, wDummyGameCounter ld a, [hl] - cp $2d - jr nc, .asm_e1f30 + cp 45 + jr nc, .spawn_object inc [hl] - call Functione2183 + call DummyGame_Card2Coord xor a - ld [wc6fd], a - call Functione2128 + ld [wDummyGameLastCardPicked], a + call DummyGame_PlaceCard ret -.asm_e1f30 - ld de, $341c - ld a, $c +.spawn_object + depixel 6, 3, 4, 4 + ld a, SPRITE_ANIM_INDEX_0C call _InitSpriteAnimStruct - ld a, $5 - ld [wc702], a + ld a, 5 + ld [wDummyGameNumberTriesRemaining], a ld hl, wJumptableIndex inc [hl] ret -; e1f42 -Functione1f42: ; e1f42 - ld a, [wc702] +.CheckTriesRemaining + ld a, [wDummyGameNumberTriesRemaining] hlcoord 17, 0 - add $f6 + add "0" ld [hl], a - ld hl, wc702 + ld hl, wDummyGameNumberTriesRemaining ld a, [hl] and a - jr nz, .asm_e1f58 + jr nz, .next_try ld a, $7 ld [wJumptableIndex], a ret -.asm_e1f58 +.next_try dec [hl] xor a ld [wcf64], a ld hl, wJumptableIndex inc [hl] - -Functione1f61: ; e1f61 +.PickCard1 ld a, [wcf64] and a ret z dec a ld e, a - ld d, $0 - ld hl, wc6d0 + ld d, 0 + ld hl, wDummyGameCards add hl, de ld a, [hl] - cp $ff + cp -1 ret z - ld [wc6fd], a - ld [wPlayerMinimized], a + ld [wDummyGameLastCardPicked], a + ld [wDummyGameCard1], a ld a, e - ld [EnemyScreens], a - call Functione2183 - call Functione2128 + ld [wDummyGameCard1Location], a + call DummyGame_Card2Coord + call DummyGame_PlaceCard xor a ld [wcf64], a ld hl, wJumptableIndex inc [hl] ret -; e1f8b -Functione1f8b: ; e1f8b +.PickCard2 ld a, [wcf64] and a ret z dec a - ld hl, EnemyScreens + ld hl, wDummyGameCard1Location cp [hl] ret z ld e, a - ld d, $0 - ld hl, wc6d0 + ld d, 0 + ld hl, wDummyGameCards add hl, de ld a, [hl] - cp $ff + cp -1 ret z - ld [wc6fd], a - ld [PlayerScreens], a + ld [wDummyGameLastCardPicked], a + ld [wDummyGameCard2], a ld a, e - ld [wc701], a - call Functione2183 - call Functione2128 - ld a, $40 - ld [wc708], a + ld [wDummyGameCard2Location], a + call DummyGame_Card2Coord + call DummyGame_PlaceCard + ld a, 64 + ld [wDummyGameCounter], a ld hl, wJumptableIndex inc [hl] - -Functione1fba: ; e1fba - ld hl, wc708 +.DelayPickAgain + ld hl, wDummyGameCounter ld a, [hl] and a - jr z, .asm_e1fc3 + jr z, .PickAgain dec [hl] ret -.asm_e1fc3 - call Functione2010 +.PickAgain + call DummyGame_CheckMatch ld a, $3 ld [wJumptableIndex], a ret -; e1fcc -Functione1fcc: ; e1fcc +.RevealAll ld a, [hJoypadPressed] and A_BUTTON ret z xor a - ld [wc708], a -.asm_e1fd5 - ld hl, wc708 + ld [wDummyGameCounter], a +.RevelationLoop + ld hl, wDummyGameCounter ld a, [hl] - cp $2d - jr nc, .asm_e1ff9 + cp 45 + jr nc, .finish_round inc [hl] push af - call Functione2183 + call DummyGame_Card2Coord pop af push hl ld e, a ld d, $0 - ld hl, wc6d0 + ld hl, wDummyGameCards add hl, de ld a, [hl] pop hl - cp $ff - jr z, .asm_e1fd5 - ld [wc6fd], a - call Functione2128 - jr .asm_e1fd5 + cp -1 + jr z, .RevelationLoop + ld [wDummyGameLastCardPicked], a + call DummyGame_PlaceCard + jr .RevelationLoop -.asm_e1ff9 +.finish_round call WaitPressAorB_BlinkCursor ld hl, wJumptableIndex inc [hl] - -Functione2000: ; e2000 +.AskPlayAgain call ret_e00ed - jr nc, .asm_e200b + jr nc, .restart ld hl, wJumptableIndex set 7, [hl] ret -.asm_e200b +.restart xor a ld [wJumptableIndex], a ret + ; e2010 -Functione2010: ; e2010 - ld hl, wPlayerMinimized +DummyGame_CheckMatch: ; e2010 + ld hl, wDummyGameCard1 ld a, [hli] cp [hl] - jr nz, .asm_e2066 - ld a, [EnemyScreens] - call Functione2183 - call Functione2142 - ld a, [wc701] - call Functione2183 - call Functione2142 - ld a, [EnemyScreens] + jr nz, .no_match + + ld a, [wDummyGameCard1Location] + call DummyGame_Card2Coord + call DummyGame_DeleteCard + + ld a, [wDummyGameCard2Location] + call DummyGame_Card2Coord + call DummyGame_DeleteCard + + ld a, [wDummyGameCard1Location] ld e, a ld d, $0 - ld hl, wc6d0 + ld hl, wDummyGameCards add hl, de - ld [hl], $ff - ld a, [wc701] + ld [hl], -1 + + ld a, [wDummyGameCard2Location] ld e, a - ld d, $0 - ld hl, wc6d0 + ld d, 0 + ld hl, wDummyGameCards add hl, de - ld [hl], $ff - ld hl, wc703 -.asm_e2044 + ld [hl], -1 + + ld hl, wDummyGameLastMatches +.find_empty_slot ld a, [hli] and a - jr nz, .asm_e2044 + jr nz, .find_empty_slot dec hl - ld a, [wPlayerMinimized] + ld a, [wDummyGameCard1] ld [hl], a - ld [wc6fd], a - ld hl, wc709 + ld [wDummyGameLastCardPicked], a + ld hl, wDummyGameNumCardsMatched ld e, [hl] -rept 2 inc [hl] -endr - ld d, $0 + inc [hl] + ld d, 0 hlcoord 5, 0 add hl, de - call Functione2128 - ld hl, UnknownText_0xe2083 + call DummyGame_PlaceCard + ld hl, .VictoryText call PrintText ret -.asm_e2066 +.no_match xor a - ld [wc6fd], a - ld a, [EnemyScreens] - call Functione2183 - call Functione2128 - ld a, [wc701] - call Functione2183 - call Functione2128 - ld hl, UnknownText_0xe2098 + ld [wDummyGameLastCardPicked], a + + ld a, [wDummyGameCard1Location] + call DummyGame_Card2Coord + call DummyGame_PlaceCard + + ld a, [wDummyGameCard2Location] + call DummyGame_Card2Coord + call DummyGame_PlaceCard + + ld hl, DummyGameText_Darn call PrintText ret -; e2083 -UnknownText_0xe2083: ; 0xe2083 +.VictoryText start_asm -; 0xe2084 - -Functione2084: ; e2084 push bc hlcoord 2, 13 - call Functione2128 - ld hl, UnknownText_0xe2093 + call DummyGame_PlaceCard + ld hl, DummyGameText_Yeah pop bc -rept 3 inc bc -endr + inc bc + inc bc ret + ; e2093 -UnknownText_0xe2093: ; 0xe2093 +DummyGameText_Yeah: ; 0xe2093 ; , yeah! text_jump UnknownText_0x1c1a5b db "@" ; 0xe2098 -UnknownText_0xe2098: ; 0xe2098 +DummyGameText_Darn: ; 0xe2098 ; Darn… text_jump UnknownText_0x1c1a65 db "@" ; 0xe209d -Functione209d: ; e209d - ld hl, wc6d0 - ld bc, $2d +DummyGame_InitBoard: ; e209d + ld hl, wDummyGameCards + ld bc, wDummyGameCardsEnd - wDummyGameCards xor a call ByteFill - call Functione2101 - ld c, $2 + call DummyGame_GetDistributionOfTiles + + ld c, 2 ld b, [hl] - call Functione20e5 - ld c, $8 + call DummyGame_SampleTilePlacement + + ld c, 8 ld b, [hl] - call Functione20e5 - ld c, $4 + call DummyGame_SampleTilePlacement + + ld c, 4 ld b, [hl] - call Functione20e5 - ld c, $7 + call DummyGame_SampleTilePlacement + + ld c, 7 ld b, [hl] - call Functione20e5 - ld c, $3 + call DummyGame_SampleTilePlacement + + ld c, 3 ld b, [hl] - call Functione20e5 - ld c, $6 + call DummyGame_SampleTilePlacement + + ld c, 6 ld b, [hl] - call Functione20e5 - ld c, $1 + call DummyGame_SampleTilePlacement + + ld c, 1 ld b, [hl] - call Functione20e5 - ld c, $5 - ld hl, wc6d0 - ld b, $2d -.asm_e20db + call DummyGame_SampleTilePlacement + + ld c, 5 + ld hl, wDummyGameCards + ld b, wDummyGameCardsEnd - wDummyGameCards +.loop ld a, [hl] and a - jr nz, .asm_e20e0 + jr nz, .no_load ld [hl], c - -.asm_e20e0 +.no_load inc hl dec b - jr nz, .asm_e20db + jr nz, .loop ret + ; e20e5 -Functione20e5: ; e20e5 +DummyGame_SampleTilePlacement: ; e20e5 push hl - ld de, wc6d0 -.asm_e20e9 + ld de, wDummyGameCards +.loop call Random - and $3f - cp $2d - jr nc, .asm_e20e9 + and %00111111 + cp 45 + jr nc, .loop ld l, a - ld h, $0 + ld h, 0 add hl, de ld a, [hl] and a - jr nz, .asm_e20e9 + jr nz, .loop ld [hl], c dec b - jr nz, .asm_e20e9 + jr nz, .loop pop hl inc hl ret + ; e2101 -Functione2101: ; e2101 +DummyGame_GetDistributionOfTiles: ; e2101 ld a, [wMenuCursorY] dec a ld l, a ld h, 0 -rept 3 add hl, hl -endr - ld de, Unknown_e2110 + add hl, hl + add hl, hl + ld de, .distributions add hl, de ret -; e2110 -Unknown_e2110: ; e2110 +.distributions db $02, $03, $06, $06, $06, $08, $08, $06 db $02, $02, $04, $06, $06, $08, $08, $09 db $02, $02, $02, $04, $07, $08, $08, $0c ; e2128 -Functione2128: ; e2128 - ld a, [wc6fd] +DummyGame_PlaceCard: ; e2128 + ld a, [wDummyGameLastCardPicked] sla a sla a - add $4 + add 4 ld [hli], a inc a ld [hld], a @@ -451,9 +445,10 @@ Functione2128: ; e2128 ld c, 3 call DelayFrames ret + ; e2142 -Functione2142: ; e2142 +DummyGame_DeleteCard: ; e2142 ld a, $1 ld [hli], a ld [hld], a @@ -464,60 +459,61 @@ Functione2142: ; e2142 ld c, 3 call DelayFrames ret + ; e2152 -Functione2152: ; e2152 +DummyGame_InitStrings: ; e2152 hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT ld a, $1 call ByteFill hlcoord 0, 0 - ld de, String_e2177 + ld de, .japstr1 call PlaceString hlcoord 15, 0 - ld de, String_e217d + ld de, .japstr2 call PlaceString - ld hl, UnknownText_0xe2176 + ld hl, .dummy_text call PrintText ret -; e2176 -UnknownText_0xe2176: ; 0xe2176 +.dummy_text db "@" -; 0xe2177 - -String_e2177: db "とったもの@" -String_e217d: db "あと かい@" +.japstr1 + db "とったもの@" +.japstr2 + db "あと かい@" ; e2183 -Functione2183: ; e2183 - ld d, $0 -.asm_e2185 - sub $9 - jr c, .asm_e218c +DummyGame_Card2Coord: ; e2183 + ld d, 0 +.find_row + sub 9 + jr c, .found_row inc d - jr .asm_e2185 + jr .find_row -.asm_e218c - add $9 +.found_row + add 9 ld e, a hlcoord 1, 2 - ld bc, $28 -.asm_e2195 + ld bc, 2 * SCREEN_WIDTH +.loop2 ld a, d and a - jr z, .asm_e219d + jr z, .done add hl, bc dec d - jr .asm_e2195 + jr .loop2 -.asm_e219d +.done sla e add hl, de ret + ; e21a1 -Functione21a1: ; e21a1 (38:61a1) +DummyGame_InterpretJoypad_AnimateCursor: ; e21a1 (38:61a1) ld a, [wJumptableIndex] cp $7 jr nc, .quit @@ -541,13 +537,13 @@ Functione21a1: ; e21a1 (38:61a1) ret .quit - ld hl, 0 + ld hl, SPRITEANIMSTRUCT_INDEX add hl, bc ld [hl], $0 ret .pressed_a - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] inc a @@ -555,60 +551,61 @@ Functione21a1: ; e21a1 (38:61a1) ret .pressed_left - ld hl, $6 + ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] and a ret z - sub $10 + sub 1 tiles ld [hl], a - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc dec [hl] ret .pressed_right - ld hl, $6 + ld hl, SPRITEANIMSTRUCT_XOFFSET add hl, bc ld a, [hl] - cp $80 + cp (9 - 1) tiles ret z - add $10 + add 1 tiles ld [hl], a - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc inc [hl] ret .pressed_up - ld hl, $7 + ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] and a ret z - sub $10 + sub 1 tiles ld [hl], a - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] - sub $9 + sub 9 ld [hl], a ret .pressed_down - ld hl, $7 + ld hl, SPRITEANIMSTRUCT_YOFFSET add hl, bc ld a, [hl] - cp $40 + cp (5 - 1) tiles ret z - add $10 + add 1 tiles ld [hl], a - ld hl, $c + ld hl, SPRITEANIMSTRUCT_0C add hl, bc ld a, [hl] - add $9 + add 9 ld [hl], a ret + ; e2221 (38:6221) LZ_e2221: ; e2221 diff --git a/engine/mail.asm b/engine/mail.asm index 0ca814c80..ab07e937e 100755 --- a/engine/mail.asm +++ b/engine/mail.asm @@ -27,7 +27,7 @@ SendMailToPC: ; 4456e call ByteFill ld a, MON_ITEM call GetPartyParamLocation - ld [hl], $0 + ld [hl], 0 ld hl, sMailboxCount inc [hl] call CloseSRAM @@ -355,7 +355,7 @@ InitMail: ; 0x447b9 ret ; 0x447da -Function447da: ; 0x447da +MailboxPC_GetMailAuthor: ; 0x447da dec a ld hl, sMailbox1Author ld bc, MAIL_STRUCT_LENGTH @@ -373,10 +373,10 @@ Function447da: ; 0x447da ret ; 0x447fb -Function447fb: ; 0x447fb +MailboxPC_PrintMailAuthor: ; 0x447fb push de ld a, [MenuSelection] - call Function447da + call MailboxPC_GetMailAuthor pop hl jp PlaceString ; 0x44806 @@ -384,11 +384,11 @@ Function447fb: ; 0x447fb MailboxPC: ; 0x44806 xor a ld [OBPals + 8 * 6], a - ld a, $1 + ld a, 1 ld [wCurMessageIndex], a .loop call InitMail - ld hl, MenuData4494c + ld hl, .TopMenuDataHeader call CopyMenuDataHeader xor a ld [hBGMapMode], a @@ -406,9 +406,9 @@ MailboxPC: ; 0x44806 ld [wCurMessageIndex], a ld a, [wMenuJoypad] - cp $2 + cp B_BUTTON jr z, .exit - call Function4484a + call .Submenu jr .loop .exit @@ -416,18 +416,18 @@ MailboxPC: ; 0x44806 ret ; 0x4484a -Function4484a: ; 0x4484a - ld hl, MenuData44964 +.Submenu: ; 0x4484a + ld hl, .SubMenuDataHeader call LoadMenuDataHeader call VerticalMenu call ExitMenu - jr c, .exit + jr c, .subexit ld a, [wMenuCursorY] dec a ld hl, .JumpTable rst JumpTable -.exit +.subexit ret ; 0x44861 @@ -455,7 +455,7 @@ Function4484a: ; 0x4484a ld a, [MenuSelection] dec a call .GetMailType - ld a, $1 + ld a, 1 ld [wItemQuantityChangeBuffer], a ld hl, NumItems call ReceiveItem @@ -557,30 +557,30 @@ Function4484a: ; 0x4484a .Cancel ret -MenuData4494c: ; 0x4494c +.TopMenuDataHeader: ; 0x4494c db %01000000 ; flags db 1, 8 ; start coords db 10, 18 ; end coords - dw .MenuData2 + dw .TopMenuData2 db 1 ; default option -.MenuData2 +.TopMenuData2 db %00010000 ; flags db 4, 0 ; rows/columns? db 1 ; horizontal spacing? dbw 0, wMailboxCount ; text pointer - dba Function447fb - dbw 0,0 - dbw 0,0 + dba MailboxPC_PrintMailAuthor + dba NULL + dba NULL -MenuData44964: ; 0x44964 +.SubMenuDataHeader: ; 0x44964 db %01000000 ; flags - db 0, 0 ; start coords - db 9, $d ; end coords - dw .MenuData2 + db 0, 0 ; start coords + db 9, 13 ; end coords + dw .SubMenuData2 db 1 ; default option -.MenuData2 +.SubMenuData2 db %10000000 ; flags db 4 ; items db "READ MAIL@" diff --git a/engine/sprite_anims.asm b/engine/sprite_anims.asm index 790027bd6..827626114 100755 --- a/engine/sprite_anims.asm +++ b/engine/sprite_anims.asm @@ -413,7 +413,7 @@ DoAnimFrame: ; 8d24b ret .fourteen: ; 8d47c (23:547c) - callab Functione21a1 + callab DummyGame_InterpretJoypad_AnimateCursor ret .sixteen: ; 8d483 (23:5483) diff --git a/engine/std_scripts.asm b/engine/std_scripts.asm index 7970b9c13..7baa90eea 100644 --- a/engine/std_scripts.asm +++ b/engine/std_scripts.asm @@ -202,7 +202,7 @@ HomepageScript: Radio1Script: opentext - writebyte $0 + writebyte MAPRADIO_POKEMON_CHANNEL special MapRadio closetext end @@ -210,7 +210,7 @@ Radio1Script: Radio2Script: ; Lucky Channel opentext - writebyte $4 + writebyte MAPRADIO_LUCKY_CHANNEL special MapRadio closetext end @@ -1807,59 +1807,59 @@ GameCornerCoinVendorScript: ; 0xbcdcd CoinVendor_IntroScript: ; 0xbcde0 farwritetext CoinVendor_IntroText -CoinVendor_SellCoinsMenuScript: ; 0xbcde4 +.loop: ; 0xbcde4 special Special_DisplayMoneyAndCoinBalance - loadmenudata CoinVendor_MenuDataHeader + loadmenudata .MenuDataHeader verticalmenu closewindow - if_equal $1, CoinVendor_Buy50CoinsScript - if_equal $2, CoinVendor_Buy500CoinsScript - jump CoinVendor_CancelScript + if_equal $1, .Buy50 + if_equal $2, .Buy500 + jump .Cancel ; 0xbcdf7 -CoinVendor_Buy50CoinsScript: ; 0xbcdf7 +.Buy50: ; 0xbcdf7 checkcoins 9949 - if_equal $0, CoinVendor_CoinCaseFullScript + if_equal $0, .CoinCaseFull checkmoney $0, 1000 - if_equal $2, CoinVendor_NotEnoughMoneyScript + if_equal $2, .NotEnoughMoney givecoins 50 takemoney $0, 1000 waitsfx playsound SFX_TRANSACTION farwritetext CoinVendor_Buy50CoinsText waitbutton - jump CoinVendor_SellCoinsMenuScript + jump .loop ; 0xbce1b -CoinVendor_Buy500CoinsScript: ; 0xbce1b +.Buy500: ; 0xbce1b checkcoins 9499 - if_equal $0, CoinVendor_CoinCaseFullScript + if_equal $0, .CoinCaseFull checkmoney $0, 10000 - if_equal $2, CoinVendor_NotEnoughMoneyScript + if_equal $2, .NotEnoughMoney givecoins 500 takemoney $0, 10000 waitsfx playsound SFX_TRANSACTION farwritetext CoinVendor_Buy500CoinsText waitbutton - jump CoinVendor_SellCoinsMenuScript + jump .loop ; 0xbce3f -CoinVendor_NotEnoughMoneyScript: ; 0xbce3f +.NotEnoughMoney: ; 0xbce3f farwritetext CoinVendor_NotEnoughMoneyText waitbutton closetext end ; 0xbce46 -CoinVendor_CoinCaseFullScript: ; 0xbce46 +.CoinCaseFull: ; 0xbce46 farwritetext CoinVendor_CoinCaseFullText waitbutton closetext end ; 0xbce4d -CoinVendor_CancelScript: ; 0xbce4d +.Cancel: ; 0xbce4d farwritetext CoinVendor_CancelText waitbutton closetext @@ -1867,15 +1867,14 @@ CoinVendor_CancelScript: ; 0xbce4d ; 0xbce54 -CoinVendor_MenuDataHeader: ; 0xbce54 +.MenuDataHeader db $40 ; flags db 04, 00 ; start coords db 11, 15 ; end coords - dw CoinVendor_MenuData2 + dw .MenuData2 db 1 ; default option -; 0xbce5c -CoinVendor_MenuData2: ; 0xbce5c +.MenuData2 db $80 ; flags db 3 ; items db " 50 : ¥1000@" diff --git a/home.asm b/home.asm index 9e35cd11c..c000fb3d1 100644 --- a/home.asm +++ b/home.asm @@ -1984,173 +1984,3 @@ ReinitSpriteAnimFrame:: ; 3b3c INCLUDE "home/audio.asm" INCLUDE "home/mobile.asm" - -Function3eea:: ; 3eea - push hl - push bc - ld de, AttrMap - TileMap - add hl, de - inc b - inc b - inc c - inc c - call Function3f35 - pop bc - pop hl - call Function3f47 - ret -; 3efd - -Function3efd:: ; 3efd - push hl - hlcoord 0, 12 - ld b, 4 - ld c, 18 - call Function3f0d - pop hl - call PrintTextBoxText - ret -; 3f0d - -Function3f0d:: ; 3f0d - push hl - push bc - ld de, AttrMap - TileMap - add hl, de - inc b - inc b - inc c - inc c - call Function3f35 - pop bc - pop hl - call TextBoxBorder - ret -; 3f20 - -Function3f20:: ; 3f20 - hlcoord 0, 0, AttrMap - ld b, $6 - ld c, $14 - call Function3f35 - hlcoord 0, 0 - ld b, $4 - ld c, $12 - call Function3f47 - ret -; 3f35 - -Function3f35:: ; 3f35 - ld a, $6 - ld de, $0014 -.asm_3f3a - push bc - push hl -.asm_3f3c - ld [hli], a - dec c - jr nz, .asm_3f3c - pop hl - add hl, de - pop bc - dec b - jr nz, .asm_3f3a - ret -; 3f47 - -Function3f47:: ; 3f47 - push bc - call Function3f58 - pop bc -.asm_3f4c - push bc - call Function3f68 - pop bc - dec b - jr nz, .asm_3f4c - call Function3f60 - ret -; 3f58 - -Function3f58:: ; 3f58 - ld a, $63 - ld d, $62 - ld e, $64 - jr Function3f6e - -Function3f60:: ; 3f60 - ld a, $68 - ld d, $67 - ld e, $69 - jr Function3f6e - -Function3f68:: ; 3f68 - ld a, $7f - ld d, $65 - ld e, $66 - -Function3f6e:: ; 3f6e - push hl - ld [hl], d - inc hl -.asm_3f71 - ld [hli], a - dec c - jr nz, .asm_3f71 - ld [hl], e - pop hl - ld de, $0014 - add hl, de - ret -; 3f7c - -Function3f7c:: ; 3f7c - call MenuBoxCoord2Tile - call GetMenuBoxDims - dec b - dec c - call Function3eea - ret -; 3f88 - -Function3f88:: ; 3f88 - ld hl, wDecompressScratch - ld b, $0 -.asm_3f8d - push bc - ld c, $8 -.asm_3f90 - ld a, [de] - inc de - cpl - ld [hl], $0 - inc hl - ld [hli], a - dec c - jr nz, .asm_3f90 - pop bc - dec c - jr nz, .asm_3f8d - ret -; 3f9f - -Function3f9f:: ; 3f9f - ld hl, wDecompressScratch -.asm_3fa2 - push bc - ld c, $8 -.asm_3fa5 - ld a, [de] - inc de - inc de - cpl - ld [hl], $0 - inc hl - ld [hli], a - dec c - jr nz, .asm_3fa5 - pop bc - dec c - jr nz, .asm_3fa2 - ret -; 3fb5 diff --git a/home/mobile.asm b/home/mobile.asm index de95cb2d7..6faecfbff 100644 --- a/home/mobile.asm +++ b/home/mobile.asm @@ -92,26 +92,26 @@ Timer:: ; 3e93 ld a, [$c822] bit 1, a - jr nz, .skip_Function1118de + jr nz, .skip_Timer ld a, [rSC] and 1 << rSC_ON - jr nz, .skip_Function1118de + jr nz, .skip_Timer ld a, [hROMBank] push af - ld a, BANK(Function1118de) + ld a, BANK(_Timer) ld [$c981], a rst Bankswitch - call Function1118de + call _Timer pop bc ld a, b ld [$c981], a rst Bankswitch -.skip_Function1118de +.skip_Timer ld a, [rTMA] ld [rTIMA], a @@ -142,3 +142,174 @@ Function3ed7:: ; 3ed7 ld a, [wdc02] ret ; 3eea + +Function3eea:: ; 3eea + push hl + push bc + ld de, AttrMap - TileMap + add hl, de + inc b + inc b + inc c + inc c + call Function3f35 + pop bc + pop hl + call MobileHome_PlaceBox + ret +; 3efd + +Function3efd:: ; 3efd +; unreferenced + push hl + hlcoord 0, 12 + ld b, 4 + ld c, 18 + call .fill_attr + pop hl + call PrintTextBoxText + ret +; 3f0d + +.fill_attr + push hl + push bc + ld de, AttrMap - TileMap + add hl, de + inc b + inc b + inc c + inc c + call Function3f35 + pop bc + pop hl + call TextBoxBorder + ret +; 3f20 + +Function3f20:: ; 3f20 + hlcoord 0, 0, AttrMap + ld b, 6 + ld c, 20 + call Function3f35 + hlcoord 0, 0 + ld b, 4 + ld c, 18 + call MobileHome_PlaceBox + ret +; 3f35 + +Function3f35:: ; 3f35 + ld a, 6 + ld de, SCREEN_WIDTH +.row + push bc + push hl +.col + ld [hli], a + dec c + jr nz, .col + pop hl + add hl, de + pop bc + dec b + jr nz, .row + ret +; 3f47 + +MobileHome_PlaceBox: ; 3f47 + push bc + call .FillTop + pop bc +.RowLoop + push bc + call .FillMiddle + pop bc + dec b + jr nz, .RowLoop + call .FillBottom + ret +; 3f58 + +.FillTop + ld a, $63 + ld d, $62 + ld e, $64 + jr .FillRow + +.FillBottom + ld a, $68 + ld d, $67 + ld e, $69 + jr .FillRow + +.FillMiddle + ld a, $7f + ld d, $65 + ld e, $66 + +.FillRow + push hl + ld [hl], d + inc hl +.FillLoop + ld [hli], a + dec c + jr nz, .FillLoop + ld [hl], e + pop hl + ld de, SCREEN_WIDTH + add hl, de + ret +; 3f7c + +Function3f7c:: ; 3f7c + call MenuBoxCoord2Tile + call GetMenuBoxDims + dec b + dec c + call Function3eea + ret +; 3f88 + +Function3f88:: ; 3f88 + ld hl, wDecompressScratch + ld b, 0 +.row + push bc + ld c, 1 tiles / 2 +.col + ld a, [de] + inc de + cpl + ld [hl], 0 + inc hl + ld [hli], a + dec c + jr nz, .col + pop bc + dec c + jr nz, .row + ret +; 3f9f + +Function3f9f:: ; 3f9f + ld hl, wDecompressScratch +.row + push bc + ld c, 1 tiles / 2 +.col + ld a, [de] + inc de + inc de + cpl + ld [hl], $0 + inc hl + ld [hli], a + dec c + jr nz, .col + pop bc + dec c + jr nz, .row + ret +; 3fb5 diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index 3c7066938..d30ba5190 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -3859,7 +3859,7 @@ Function1118c2: ; 1118c2 (44:58c2) inc [hl] ret -Function1118de:: ; 1118de (44:58de) +_Timer:: ; 1118de (44:58de) ld a, [$c80b] cp $4 call z, Function111b3c diff --git a/main.asm b/main.asm index c1a1568f1..df1b80eee 100644 --- a/main.asm +++ b/main.asm @@ -13177,6 +13177,7 @@ Unknown_e00ed: ; game were meant to be here. ret_e00ed: ; e00ed (38:40ed) +; How many coins? ret ; e00ee (38:40ee) diff --git a/misc/battle_tower_5c.asm b/misc/battle_tower_5c.asm index a7eb38eb4..c975f4901 100755 --- a/misc/battle_tower_5c.asm +++ b/misc/battle_tower_5c.asm @@ -1,4 +1,5 @@ Function1700b0: ; 1700b0 +; special call InitBattleTowerChallengeRAM callba Function118121 ret diff --git a/misc/mobile_41.asm b/misc/mobile_41.asm index e27d9a01e..525bd7b80 100755 --- a/misc/mobile_41.asm +++ b/misc/mobile_41.asm @@ -1004,7 +1004,7 @@ Function106464:: ; 106464 Function10649b: ; 10649b ld a, [TextBoxFrame] and $7 - ld bc, $30 + ld bc, 3 tiles ld hl, Frames call AddNTimes ld d, h diff --git a/misc/mobile_46.asm b/misc/mobile_46.asm index de5539eaa..fb1519908 100755 --- a/misc/mobile_46.asm +++ b/misc/mobile_46.asm @@ -142,7 +142,6 @@ Function11811a: ; 11811a Function118121: ; 118121 xor a ld [wcd38], a - Function118125: ; 118125 call Function1183cb ld a, $3 @@ -155,16 +154,15 @@ Function118125: ; 118125 push af ld a, $3 ld [rSVBK], a -.asm_11813e +.loop call JoyTextDelay call Function118473 ld a, [wcf66] cp $f - jr c, .asm_118151 + jr c, .skip ld a, [wcd34] ld [wcf66], a - -.asm_118151 +.skip call Function11854d call Function11a8fa callba Function115dd3 @@ -173,7 +171,7 @@ Function118125: ; 118125 ld a, [wcf66] ld hl, wcd33 cp [hl] - jr nz, .asm_11813e + jr nz, .loop xor a ld [w3_d000], a pop af @@ -552,12 +550,12 @@ Function118473: ; 118473 inc a ld [wcd68], a cp 99 - jr z, .asm_1184a0 + jr z, .ninety_nine xor a ld [wcd67], a ret -.asm_1184a0 +.ninety_nine xor a ld [wcd65], a ret diff --git a/misc/mobile_5f.asm b/misc/mobile_5f.asm index 204ea7371..a83c7a925 100644 --- a/misc/mobile_5f.asm +++ b/misc/mobile_5f.asm @@ -4631,7 +4631,9 @@ Function17f53d: ; 17f53d push af ld a, $1 ld [rSVBK], a + call Function17f555 + pop af ld [rSVBK], a call ExitAllMenus @@ -4639,21 +4641,20 @@ Function17f53d: ; 17f53d ; 17f555 Function17f555: ; 17f555 -.asm_17f555 +.loop call JoyTextDelay - call Function17f5ae + call .RunJumptable ld a, [wc303] bit 7, a - jr nz, .asm_17f56a + jr nz, .quit callba Function104000 - jr .asm_17f555 + jr .loop -.asm_17f56a - call Function17f56e +.quit + call .deinit ret -; 17f56e -Function17f56e: ; 17f56e +.deinit ld a, [wc300] cp $22 jr z, .asm_17f597 @@ -4695,11 +4696,11 @@ Function17f56e: ; 17f56e ret ; 17f5ae -Function17f5ae: ; 17f5ae - jumptable Table17f5bd, wc303 +.RunJumptable: ; 17f5ae + jumptable .Jumptable, wc303 ; 17f5bd -Table17f5bd: ; 17f5bd +.Jumptable: ; 17f5bd dw Function17f5c3 dw Function17ff23 dw Function17f5d2 @@ -4858,26 +4859,26 @@ Palette_17f6af: ; 17f6af Function17f6b7: ; 17f6b7 ld a, [wc300] - call Function17f6cd + call .bcd_two_digits inc hl ld a, [wc302] and $f - call Function17f6d8 + call .bcd_digit ld a, [wc301] - call Function17f6cd + call .bcd_two_digits ret ; 17f6cd -Function17f6cd: ; 17f6cd +.bcd_two_digits: ; 17f6cd ld c, a and $f0 swap a - call Function17f6d8 + call .bcd_digit ld a, c and $f -Function17f6d8: ; 17f6d8 - add $f6 +.bcd_digit: ; 17f6d8 + add "0" ld [hli], a ret ; 17f6dc diff --git a/wram.asm b/wram.asm index 386a0925a..cdb18a6d1 100644 --- a/wram.asm +++ b/wram.asm @@ -787,8 +787,8 @@ PlayerSAtkLevel:: ; c6cf ds 1 trademon: MACRO -\1Species:: ds 1 ; wc6d0 | wc702 -\1SpeciesName:: ds PKMN_NAME_LENGTH ; wc6d1 | wc703 +\1Species:: ds 1 ; wc6d0 | wDummyGameNumberTriesRemaining +\1SpeciesName:: ds PKMN_NAME_LENGTH ; wc6d1 | wDummyGameLastMatches \1Nickname:: ds PKMN_NAME_LENGTH ; wc6dc | wc70e \1SenderName:: ds NAME_LENGTH ; wc6e7 | wc719 \1OTName:: ds NAME_LENGTH ; wc6f2 | wc724 @@ -858,6 +858,22 @@ wDiscardPileEnd:: wCardFlipEnd:: ds wCardFlip - @ +; Dummy Game +; c6d0 +wDummyGame:: +wDummyGameCards:: ds 9 * 5 +wDummyGameCardsEnd:: +wDummyGameLastCardPicked:: ds 1 ; c6fd +wDummyGameCard1:: ds 1 ; c6fe +wDummyGameCard2:: ds 1 ; c6ff +wDummyGameCard1Location:: ds 1 ; c700 +wDummyGameCard2Location:: ds 1 ; c701 +wDummyGameNumberTriesRemaining:: ds 1 ; c702 +wDummyGameLastMatches:: ds 5 ; c703 +wDummyGameCounter:: ds 1 ; c708 +wDummyGameNumCardsMatched:: ds 1 ; c709 +wDummyGameEnd:: + ds wDummyGame - @ ; Unown Puzzle wUnownPuzzle:: wPuzzlePieces::