From 282902b3a4699e445e926c4df9d4140e62a8a3f9 Mon Sep 17 00:00:00 2001 From: vulcandth Date: Sun, 16 Jun 2024 18:41:43 -0500 Subject: [PATCH] Fix daycare mon palettes --- data/pokemon/menu_icon_pals.asm | 10 ++++++++ engine/overworld/overworld.asm | 43 +++++++++++++++++++++++++++++++++ maps/Route34.asm | 4 +-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/data/pokemon/menu_icon_pals.asm b/data/pokemon/menu_icon_pals.asm index f6af027a7..932420090 100644 --- a/data/pokemon/menu_icon_pals.asm +++ b/data/pokemon/menu_icon_pals.asm @@ -261,3 +261,13 @@ MonMenuIconPals: icon_pals RED, RED ; unused icon_pals RED, RED ; EGG assert_table_length EGG + +MonMenuIconPalToNPCPalTable: + db PAL_OW_RED + db PAL_OW_BLUE + db PAL_OW_GREEN + db PAL_OW_BROWN + db PAL_OW_PINK + db PAL_OW_GRAY + db PAL_OW_YELLOW + db PAL_OW_PURPLE diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm index b4f504073..3e7a8fa06 100644 --- a/engine/overworld/overworld.asm +++ b/engine/overworld/overworld.asm @@ -274,6 +274,10 @@ _DoesSpriteHaveFacings:: _GetSpritePalette:: ld a, c + cp SPRITE_DAY_CARE_MON_1 + jr z, .is_breedmon + cp SPRITE_DAY_CARE_MON_2 + jr z, .is_breedmon call GetMonSprite jr c, .is_pokemon @@ -291,6 +295,45 @@ _GetSpritePalette:: ld c, a ret +.is_breedmon + push de + cp SPRITE_DAY_CARE_MON_1 + ld a, [wBreedMon1Species] + jr z, .got_species + ld a, [wBreedMon2Species] +.got_species + dec a + ld h, 0 + ld l, a + ld de, MonMenuIconPals + add hl, de + ld a, BANK(MonMenuIconPals) + call GetFarByte + ld d, a + ld a, c + cp SPRITE_DAY_CARE_MON_1 + ld bc, wBreedMon1DVs + jr z, .check_shiny + ld bc, wBreedMon2DVs +.check_shiny + farcall CheckShininess + ld a, d + pop de + jr c, .shiny + swap a +.shiny + and $f + push de + ld de, MonMenuIconPalToNPCPalTable + ld h, 0 + ld l, a + add hl, de + ld a, BANK(MonMenuIconPalToNPCPalTable) + call GetFarByte + pop de + ld c, a + ret + AddSpriteGFX: ; Add any new sprite ids to a list of graphics to be loaded. ; Return carry if the list is full. diff --git a/maps/Route34.asm b/maps/Route34.asm index 829ec18f1..357a3d93f 100644 --- a/maps/Route34.asm +++ b/maps/Route34.asm @@ -926,8 +926,8 @@ Route34_MapEvents: object_event 9, 11, SPRITE_OFFICER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, OfficerKeithScript, -1 object_event 18, 28, SPRITE_POKEFAN_M, SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 3, TrainerPokefanmBrandon, -1 object_event 15, 16, SPRITE_GRAMPS, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DayCareManScript_Outside, EVENT_DAY_CARE_MAN_ON_ROUTE_34 - object_event 14, 18, SPRITE_DAY_CARE_MON_1, SPRITEMOVEDATA_POKEMON, 2, 2, -1, -1, PAL_NPC_PINK, OBJECTTYPE_SCRIPT, 0, DayCareMon1Script, EVENT_DAY_CARE_MON_1 - object_event 17, 19, SPRITE_DAY_CARE_MON_2, SPRITEMOVEDATA_POKEMON, 2, 2, -1, -1, PAL_NPC_ROCK, OBJECTTYPE_SCRIPT, 0, DayCareMon2Script, EVENT_DAY_CARE_MON_2 + object_event 14, 18, SPRITE_DAY_CARE_MON_1, SPRITEMOVEDATA_POKEMON, 2, 2, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DayCareMon1Script, EVENT_DAY_CARE_MON_1 + object_event 17, 19, SPRITE_DAY_CARE_MON_2, SPRITEMOVEDATA_POKEMON, 2, 2, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DayCareMon2Script, EVENT_DAY_CARE_MON_2 object_event 11, 48, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 5, TrainerCooltrainerfIrene, -1 object_event 3, 48, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 3, TrainerCooltrainerfJenn, -1 object_event 6, 51, SPRITE_COOLTRAINER_F, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, PAL_NPC_RED, OBJECTTYPE_TRAINER, 2, TrainerCooltrainerfKate, -1