diff --git a/constants/scgb_constants.asm b/constants/scgb_constants.asm index e90c518..0a092ae 100644 --- a/constants/scgb_constants.asm +++ b/constants/scgb_constants.asm @@ -23,6 +23,7 @@ const SCGB_MAGNET_TRAIN const SCGB_PACKPALS const SCGB_TRAINER_CARD + const SCGB_TRAINER_CARD_KANTO const SCGB_POKEDEX_UNOWN_MODE const SCGB_BILLS_PC const SCGB_UNOWN_PUZZLE diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 506c75a..6437d17 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -213,7 +213,7 @@ DEF MOM_ACTIVE_F EQU 7 DEF MOM_SAVING_MONEY_MASK EQU (1 << MOM_SAVING_SOME_MONEY_F) | (1 << MOM_SAVING_HALF_MONEY_F) | (1 << MOM_SAVING_ALL_MONEY_F) ; wSweetHoneyEnabled -SWEET_HONEY_F EQU 0 +DEF SWEET_HONEY_F EQU 0 ; wJohtoBadges:: const_def diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm index ba1534f..b7c6f89 100644 --- a/engine/gfx/cgb_layouts.asm +++ b/engine/gfx/cgb_layouts.asm @@ -52,6 +52,7 @@ CGBLayoutJumptable: dw _CGB_MagnetTrain dw _CGB_PackPals dw _CGB_TrainerCard + dw _CGB_TrainerCardKanto dw _CGB_PokedexUnownMode dw _CGB_BillsPC dw _CGB_UnownPuzzle @@ -868,6 +869,126 @@ _CGB_TrainerCard: ldh [hCGBPalUpdate], a ret +_CGB_TrainerCardKanto: + ld a, [wOptions2] + and 1 << MENU_ACCOUNT + ld de, wBGPals1 + xor a ; CHRIS & MISTY + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, FALKNER ; KRIS + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, BLAINE + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, LT_SURGE ; ERIKA + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, TOPAZ ;JANINE + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, SABRINA + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, JASMINE ; BROCK + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, BLUE + call GetTrainerPalettePointer + call LoadPalette_White_Col1_Col2_Black + ld a, PREDEFPAL_CGB_BADGE + call GetPredefPal + call LoadHLPaletteIntoDE + + ; fill screen with gender-based palette for the card border + hlcoord 0, 0, wAttrmap + ld bc, SCREEN_WIDTH * SCREEN_HEIGHT + ld a, [wPlayerGender] + and a + jr z, .male + dec a + jr z, .female + ld a, $6 ; dark magenta for enby + jr .got_gender +.male + ld a, $1 ; blue for chris + jr .got_gender +.female + ld a, $0 ; red for kris +.got_gender + call ByteFill + ; fill trainer sprite area with same-gender palette + hlcoord 14, 1, wAttrmap + lb bc, 7, 5 + ld a, [wPlayerGender] + and a + jr z, .male2 + dec a + jr z, .female2 + ld a, $4 ; enby + jr .got_gender2 + .male2 + ld a, $0 ; chris + jr .got_gender2 + .female2 + ld a, $1 ; kris +.got_gender2 + call FillBoxCGB + hlcoord 2, 11, wAttrmap + lb bc, 2, 4 + ld a, $6 ; brock + call FillBoxCGB + hlcoord 6, 11, wAttrmap + lb bc, 2, 4 + ld a, $0 ; misty + call FillBoxCGB + hlcoord 10, 11, wAttrmap + lb bc, 2, 4 + ld a, $3 ; lt.surge + call FillBoxCGB + hlcoord 14, 11, wAttrmap + lb bc, 2, 4 + ld a, $3 ; erika + call FillBoxCGB + hlcoord 2, 14, wAttrmap + lb bc, 2, 4 + ld a, $4 ; janine + call FillBoxCGB + hlcoord 6, 14, wAttrmap + lb bc, 2, 4 + ld a, $5 ; sabrina + call FillBoxCGB + hlcoord 10, 14, wAttrmap + lb bc, 2, 4 + ld a, $2 ; blaine + call FillBoxCGB + hlcoord 14, 14, wAttrmap + lb bc, 2, 4 + ld a, $7 ; blue + call FillBoxCGB + ; top-right corner still uses the border's palette + ld a, [wPlayerGender] + and a + jr z, .male3 + dec a + jr z, .female3 + ld a, $6 ; dark magenta for enby + jr .got_gender3 +.male3 + ld a, $1 ; blue for chris + jr .got_gender3 +.female3 + ld a, $0 ; red for kris +.got_gender3 + hlcoord 18, 1, wAttrmap + ld [hl], a + call ApplyAttrmap + call ApplyPals + ld a, TRUE + ldh [hCGBPalUpdate], a + ret + _CGB_MoveList: ld de, wBGPals1 ld a, PREDEFPAL_GOLDENROD diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm index 0af7cff..6297366 100644 --- a/engine/gfx/sgb_layouts.asm +++ b/engine/gfx/sgb_layouts.asm @@ -45,6 +45,7 @@ SGBLayoutJumptable: dw .SGB_MagnetTrain dw .SGB_PackPals dw .SGB_TrainerCard + dw .SGB_TrainerCardKanto dw .SGB_PokedexUnownMode dw .SGB_BillsPC dw .SGB_UnownPuzzle @@ -401,6 +402,7 @@ endr .SGB_Unused0D: .SGB_TrainerCard: +.SGB_TrainerCardKanto: ld hl, PalPacket_Diploma ld de, BlkPacket_AllPal0 ret diff --git a/engine/menus/trainer_card.asm b/engine/menus/trainer_card.asm index b1b83eb..35328e8 100644 --- a/engine/menus/trainer_card.asm +++ b/engine/menus/trainer_card.asm @@ -107,6 +107,10 @@ TrainerCard_Page1_LoadGFX: ld d, 6 call TrainerCard_InitBorder call WaitBGMap + ld b, SCGB_TRAINER_CARD + call GetSGBLayout + call SetPalettes + call WaitBGMap ld de, CardStatusGFX ld hl, vTiles2 tile $29 lb bc, BANK(CardStatusGFX), 86 @@ -128,13 +132,13 @@ TrainerCard_Page1_Joypad: ld [wJumptableIndex], a ret -.KantoBadgeCheck: ; unreferenced - ld a, [wKantoBadges] - and a - ret z - ld a, TRAINERCARDSTATE_PAGE3_LOADGFX - ld [wJumptableIndex], a - ret +;.KantoBadgeCheck: ; unreferenced +; ld a, [wKantoBadges] +; and a +; ret z +; ld a, TRAINERCARDSTATE_PAGE3_LOADGFX +; ld [wJumptableIndex], a +; ret TrainerCard_Page2_LoadGFX: call ClearSprites @@ -142,6 +146,10 @@ TrainerCard_Page2_LoadGFX: ld d, 6 call TrainerCard_InitBorder call WaitBGMap + ld b, SCGB_TRAINER_CARD + call GetSGBLayout + call SetPalettes + call WaitBGMap ld de, LeaderGFX ld hl, vTiles2 tile $29 lb bc, BANK(LeaderGFX), 86 @@ -150,6 +158,7 @@ TrainerCard_Page2_LoadGFX: ld hl, vTiles0 tile $00 lb bc, BANK(BadgeGFX), 44 call Request2bpp + ld hl, TrainerCard_JohtoBadgesOAM call TrainerCard_Page2_3_InitObjectsAndStrings call TrainerCard_IncrementJumptable ret @@ -159,22 +168,34 @@ TrainerCard_Page2_Joypad: call TrainerCard_Page2_3_AnimateBadges ld hl, hJoyLast ld a, [hl] + and D_LEFT + jr nz, .pressed_left + ld a, [wKantoBadges] + and a + jr nz, .has_kanto_badges + ld a, [hl] and A_BUTTON jr nz, .Quit +; ld a, [hl] +; and D_LEFT +; jr nz, .d_left + ret +.has_kanto_badges ld a, [hl] - and D_LEFT - jr nz, .d_left + and D_RIGHT | A_BUTTON + jr nz, .pressed_right_a ret -.d_left +.pressed_left ld a, TRAINERCARDSTATE_PAGE1_LOADGFX ld [wJumptableIndex], a ret -.KantoBadgeCheck: ; unreferenced - ld a, [wKantoBadges] - and a - ret z +;.KantoBadgeCheck: ; unreferenced +; ld a, [wKantoBadges] +; and a +; ret z +.pressed_right_a ld a, TRAINERCARDSTATE_PAGE3_LOADGFX ld [wJumptableIndex], a ret @@ -190,6 +211,10 @@ TrainerCard_Page3_LoadGFX: ld d, 6 call TrainerCard_InitBorder call WaitBGMap + ld b, SCGB_TRAINER_CARD_KANTO + call GetSGBLayout + call SetPalettes + call WaitBGMap ld de, LeaderGFX2 ld hl, vTiles2 tile $29 lb bc, BANK(LeaderGFX2), 86 @@ -198,29 +223,34 @@ TrainerCard_Page3_LoadGFX: ld hl, vTiles0 tile $00 lb bc, BANK(BadgeGFX2), 44 call Request2bpp + ld hl, TrainerCard_KantoBadgesOAM call TrainerCard_Page2_3_InitObjectsAndStrings call TrainerCard_IncrementJumptable ret TrainerCard_Page3_Joypad: - ld hl, TrainerCard_JohtoBadgesOAM + ld hl, TrainerCard_KantoBadgesOAM call TrainerCard_Page2_3_AnimateBadges ld hl, hJoyLast ld a, [hl] and D_LEFT - jr nz, .left + jr nz, .pressed_left ld a, [hl] - and D_RIGHT - jr nz, .right +; and D_RIGHT +; jr nz, .right + and A_BUTTON + jr nz, .pressed_a ret -.left +.pressed_left ld a, TRAINERCARDSTATE_PAGE2_LOADGFX ld [wJumptableIndex], a ret -.right - ld a, TRAINERCARDSTATE_PAGE1_LOADGFX +;.right +; ld a, TRAINERCARDSTATE_PAGE1_LOADGFX +.pressed_a + ld a, TRAINERCARDSTATE_QUIT ld [wJumptableIndex], a ret @@ -313,6 +343,7 @@ TrainerCard_Page1_PrintDexCaught_GameTime: db $29, $2a, $2b, $2c, $2d, -1 TrainerCard_Page2_3_InitObjectsAndStrings: + push hl hlcoord 2, 8 ld de, .BadgesTilemap call TrainerCardSetup_PlaceTilemapString @@ -338,7 +369,8 @@ endr jr nz, .loop2 xor a ld [wTrainerCardBadgeFrameCounter], a - ld hl, TrainerCard_JohtoBadgesOAM + ;ld hl, TrainerCard_JohtoBadgesOAM + pop hl call TrainerCard_Page2_3_OAMUpdate ret @@ -616,11 +648,61 @@ TrainerCard_JohtoBadgesOAM: db $1c, $20, $24, $20 | (1 << 7) db $1c | (1 << 7), $20, $24, $20 | (1 << 7) +TrainerCard_KantoBadgesOAM: +; Template OAM data for Kanto badges on the trainer card. +; Format: + ; y, x, palette + ; cycle 1: face tile, in1 tile, in2 tile, in3 tile + ; cycle 2: face tile, in1 tile, in2 tile, in3 tile + + dw wKantoBadges + + ; Boulderbadge + db $68, $18, 0 + db $00, $20 | (1 << 7), $24, $20 + db $00, $20 | (1 << 7), $24, $20 + + ; Cascadebadge + db $68, $38, 0 + db $04, $20 | (1 << 7), $24, $20 + db $04, $20 | (1 << 7), $24, $20 + + ; Thunderbadge + db $68, $58, 0 + db $08, $20 | (1 << 7), $24, $20 + db $08, $20 | (1 << 7), $24, $20 + + ; Rainbowbadge + db $68, $78, 0 + db $0c, $20 | (1 << 7), $24, $20 + db $0c, $20 | (1 << 7), $24, $20 + + ; Soulbadge + db $80, $18, 0 + db $10, $20 | (1 << 7), $24, $20 + db $10, $20 | (1 << 7), $24, $20 + + ; Marshbadge + db $80, $38, 0 + db $14, $20 | (1 << 7), $24, $20 + db $14, $20 | (1 << 7), $24, $20 + + ; Volcanobadge + db $80, $58, 0 + db $18, $20 | (1 << 7), $24, $20 + db $18, $20 | (1 << 7), $24, $20 + + ; Earthbadge + ; X-flips on alternate cycles. + db $80, $78, 0 + db $1c, $20 | (1 << 7), $24, $20 + db $1c | (1 << 7), $20 | (1 << 7), $24, $20 + CardStatusGFX: INCBIN "gfx/trainer_card/card_status.2bpp" LeaderGFX: INCBIN "gfx/trainer_card/leaders.2bpp" -LeaderGFX2: INCBIN "gfx/trainer_card/leaders.2bpp" +LeaderGFX2: INCBIN "gfx/trainer_card/kanto_leaders.2bpp" BadgeGFX: INCBIN "gfx/trainer_card/badges.2bpp" -BadgeGFX2: INCBIN "gfx/trainer_card/badges.2bpp" +BadgeGFX2: INCBIN "gfx/trainer_card/kanto_badges.2bpp" CardRightCornerGFX: INCBIN "gfx/trainer_card/card_right_corner.2bpp"