diff --git a/data/text/common_2.asm b/data/text/common_2.asm index 22810ff..b0fafff 100644 --- a/data/text/common_2.asm +++ b/data/text/common_2.asm @@ -1323,27 +1323,6 @@ _OakPCText4:: line "OAK's PC closed." done -_TrainerRankingExplanationText:: ; unreferenced - text "Triple-theme" - line "trainer ranking!" - - para "The SAVE file you" - line "just sent might" - cont "make the rankings!" - - para "" - done - -_TrainerRankingNoDataText:: ; unreferenced - text "There is no" - line "ranking data." - - para "Link to obtain" - line "ranking data." - - para "" - done - _MemoryGameYeahText:: text " , yeah!" done diff --git a/engine/games/memory_game.asm b/engine/games/memory_game.asm index 8be4e51..a06bbb8 100644 --- a/engine/games/memory_game.asm +++ b/engine/games/memory_game.asm @@ -1,4 +1,21 @@ +; MemoryMinigame.Jumptable indices + const_def + const MEMORYGAME_RESTART_GAME + const MEMORYGAME_RESTART_BOARD + const MEMORYGAME_INIT_BOARD_AND_CURSOR + const MEMORYGAME_CHECK_TRIES_REMAINING + const MEMORYGAME_PICK_CARD_1 + const MEMORYGAME_PICK_CARD_2 + const MEMORYGAME_DELAY_PICK_AGAIN + const MEMORYGAME_REVEAL_ALL + const MEMORYGAME_ASK_PLAY_AGAIN +DEF MEMORYGAME_END_LOOP_F EQU 7 + _MemoryGame: +; Always start off with 256 coins +;IF DEF(_DEBUG) +; givecoins 256 +;endc call .LoadGFXAndPals call DelayFrame .loop @@ -11,28 +28,38 @@ _MemoryGame: ld b, SCGB_DIPLOMA call GetSGBLayout callfar ClearSpriteAnims - ld hl, MemoryGameLZ + ld hl, MemoryGameTiles ld de, vTiles2 tile $00 call Decompress + ld hl, MemoryGameGFX ld de, vTiles0 tile $00 ld bc, 4 tiles ld a, BANK(MemoryGameGFX) call FarCopyBytes - ld a, SPRITE_ANIM_DICT_ARROW_CURSOR + + ld a, SPRITE_ANIM_INDEX_MEMORY_GAME_CURSOR + ld hl, MemoryGameGloveGFX + ld de, vTiles0 + ld bc, $4 tiles + ld a, BANK(MemoryGameGloveGFX) + call FarCopyBytes + ld hl, wSpriteAnimDict ld [hli], a - ld [hl], $00 + ld [hl], 0 + hlcoord 0, 0 - ld bc, SCREEN_HEIGHT * SCREEN_WIDTH + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT xor a call ByteFill + xor a ldh [hSCY], a ldh [hSCX], a ldh [rWY], a ld [wJumptableIndex], a - ld a, $1 + ld a, 1 ldh [hBGMapMode], a ld a, LCDC_DEFAULT ldh [rLCDC], a @@ -44,7 +71,7 @@ _MemoryGame: .JumptableLoop: ld a, [wJumptableIndex] - bit 7, a + bit MEMORYGAME_END_LOOP_F, a jr nz, .quit call .ExecuteJumptable callfar PlaySpriteAnimations @@ -80,7 +107,7 @@ _MemoryGame: call UnusedCursor_InterpretJoypad_AnimateCursor jr nc, .proceed ld hl, wJumptableIndex - set 7, [hl] + set MEMORYGAME_END_LOOP_F, [hl] ret .proceed @@ -95,6 +122,7 @@ rept 4 endr ld [hl], a ld [wMemoryGameNumCardsMatched], a + .InitBoardTilemapAndCursorObject: ld hl, wMemoryGameCounter ld a, [hl] @@ -126,7 +154,7 @@ endr ld a, [hl] and a jr nz, .next_try - ld a, $7 + ld a, MEMORYGAME_REVEAL_ALL ld [wJumptableIndex], a ret @@ -136,6 +164,7 @@ endr ld [wMemoryGameCardChoice], a ld hl, wJumptableIndex inc [hl] + .PickCard1: ld a, [wMemoryGameCardChoice] and a @@ -185,6 +214,7 @@ endr ld [wMemoryGameCounter], a ld hl, wJumptableIndex inc [hl] + .DelayPickAgain: ld hl, wMemoryGameCounter ld a, [hl] @@ -195,7 +225,7 @@ endr .PickAgain: call MemoryGame_CheckMatch - ld a, $3 + ld a, MEMORYGAME_CHECK_TRIES_REMAINING ld [wJumptableIndex], a ret @@ -205,6 +235,7 @@ endr ret z xor a ld [wMemoryGameCounter], a + .RevelationLoop: ld hl, wMemoryGameCounter ld a, [hl] @@ -231,11 +262,12 @@ endr call WaitPressAorB_BlinkCursor ld hl, wJumptableIndex inc [hl] + .AskPlayAgain: call UnusedCursor_InterpretJoypad_AnimateCursor jr nc, .restart ld hl, wJumptableIndex - set 7, [hl] + set MEMORYGAME_END_LOOP_F, [hl] ret .restart @@ -304,29 +336,29 @@ MemoryGame_CheckMatch: call MemoryGame_Card2Coord call MemoryGame_PlaceCard - ld hl, MemoryGameDarnText + ld hl, .DarnText call PrintText ret .VictoryText: - text_asm + start_asm push bc hlcoord 2, 13 call MemoryGame_PlaceCard - ld hl, MemoryGameYeahText + ld hl, .YeahText pop bc inc bc inc bc inc bc ret -MemoryGameYeahText: - text_far _MemoryGameYeahText - text_end +.YeahText: + text "Yeah!" + done -MemoryGameDarnText: - text_far _MemoryGameDarnText - text_end +.DarnText: + text "Darn<...>" + done MemoryGame_InitBoard: ld hl, wMemoryGameCards @@ -377,6 +409,7 @@ MemoryGame_InitBoard: jr nz, .loop ret + MemoryGame_SampleTilePlacement: push hl ld de, wMemoryGameCards @@ -434,7 +467,7 @@ MemoryGame_PlaceCard: ret MemoryGame_DeleteCard: - ld a, $1 + ld a, 1 ld [hli], a ld [hld], a ld bc, SCREEN_WIDTH @@ -448,13 +481,13 @@ MemoryGame_DeleteCard: MemoryGame_InitStrings: hlcoord 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT - ld a, $1 + ld a, 1 call ByteFill hlcoord 0, 0 - ld de, .japstr1 + ld de, .str1 call PlaceString hlcoord 15, 0 - ld de, .japstr2 + ld de, .str2 call PlaceString ld hl, .dummy_text call PrintText @@ -462,10 +495,10 @@ MemoryGame_InitStrings: .dummy_text db "@" -.japstr1 - db "とったもの@" -.japstr2 - db "あと かい@" +.str1 + db "SCORE@" +.str2 + db "TURNS@" MemoryGame_Card2Coord: ld d, 0 @@ -493,9 +526,9 @@ MemoryGame_Card2Coord: add hl, de ret -MemoryGame_InterpretJoypad_AnimateCursor: +MemoryGame_InterpretJoypad_AnimateCursor: ; Called from sprite animation routine? ld a, [wJumptableIndex] - cp $7 + cp MEMORYGAME_REVEAL_ALL jr nc, .quit call JoyTextDelay ld hl, hJoypadPressed @@ -519,7 +552,7 @@ MemoryGame_InterpretJoypad_AnimateCursor: .quit ld hl, SPRITEANIMSTRUCT_INDEX add hl, bc - ld [hl], $0 + ld [hl], 0 ret .pressed_a @@ -582,9 +615,14 @@ MemoryGame_InterpretJoypad_AnimateCursor: ld hl, SPRITEANIMSTRUCT_VAR1 add hl, bc ld a, [hl] - add 9 + add a, 9 ld [hl], a ret -MemoryGameLZ: -INCBIN "gfx/memory_game/memory_game.2bpp.lz" +MemoryGameTiles: INCBIN "gfx/memory_game/memory_game.2bpp.lz" + +MemoryGameGloveGFX:: INCBIN "gfx/memory_game/glove.2bpp" + +MemoryWantToPlayText: + text "Want to play?" + done diff --git a/gfx/memory_game/glove.png b/gfx/memory_game/glove.png new file mode 100644 index 0000000..9669b5c Binary files /dev/null and b/gfx/memory_game/glove.png differ diff --git a/maps/DebugRoom.asm b/maps/DebugRoom.asm index d97fb1b..04d0954 100644 --- a/maps/DebugRoom.asm +++ b/maps/DebugRoom.asm @@ -195,6 +195,8 @@ DebugItemScript: giveitem DOME_FOSSIL, 2 giveitem HELIX_FOSSIL, 2 giveitem OLD_AMBER, 2 + giveitem COIN_CASE + givecoins 2500 closetext end @@ -364,6 +366,12 @@ DebugDollShopAlreadyBoughtText: line "that!" done +MemoryGameScript: + refreshscreen + special UnusedMemoryGame + closetext + end + DebugRoom_MapEvents: db 0, 0 ; filler @@ -396,3 +404,4 @@ DebugRoom_MapEvents: object_event 19, 13, SPRITE_NURSE, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_OW_PURPLE, OBJECTTYPE_SCRIPT, 0, DebugItemScript, -1 object_event 18, 13, SPRITE_SAFARI_ZONE_WORKER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, TrainerTestScript, -1 object_event 20, 13, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugDollShopScript, -1 + object_event 25, 15, SPRITE_WILL, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, MemoryGameScript, -1 diff --git a/ram/hram.asm b/ram/hram.asm index e8b59ac..2292587 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -1,5 +1,7 @@ SECTION "HRAM", HRAM +hScriptVar:: db ; Used in the finished Shinkai port from Pokeprism. + hROMBankBackup:: db hFarByte:: hTempBank:: db @@ -11,7 +13,7 @@ hRTCHours:: db hRTCMinutes:: db hRTCSeconds:: db - ds 2 + ds 1 hHours:: db ds 1