diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 891c7fd4ed..559573f544 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -1800,9 +1800,11 @@ @ Equivalent to fadescreen but copies gPlttBufferUnfaded to gDecompressionBuffer on the fade out @ and the reverse on the fade in, in effect saving gPlttBufferUnfaded to restore it. - .macro fadescreenswapbuffers mode:req + @ If nowait set, does not wait for the fade to complete + .macro fadescreenswapbuffers mode:req, nowait=0 .byte 0xdc .byte \mode + .byte \nowait .endm @ Buffers the specified trainer's class name to the given string var. diff --git a/data/event_scripts.s b/data/event_scripts.s index d4393ac9d4..cf74133329 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -752,12 +752,12 @@ Common_EventScript_PlayGymBadgeFanfare:: return Common_EventScript_OutOfCenterPartyHeal:: - fadescreen FADE_TO_BLACK + fadescreenswapbuffers FADE_TO_BLACK playfanfare MUS_HEAL waitfanfare special HealPlayerParty callnative UpdateFollowingPokemon - fadescreen FADE_FROM_BLACK + fadescreenswapbuffers FADE_FROM_BLACK return EventScript_RegionMap:: diff --git a/data/layouts/LavaridgeTown/map.bin b/data/layouts/LavaridgeTown/map.bin index 604ad5f3f8..a001f8cd38 100644 --- a/data/layouts/LavaridgeTown/map.bin +++ b/data/layouts/LavaridgeTown/map.bin @@ -1,3 +1,3 @@ -qqqq{ttttt|qqqqqqq66{tttzq2񭀬񭀬xttttttttr{2t2|qqqNKLOq6rr񋍐񋉖JHIMyy0123rr2332PQRS2289:;򷠶rr񠫞򘄨XYZ[󩅍`ABC򷠶rr`abc550 1"1044rr򑺐񚢠򎰬0 1"10000 1"1000rr񚠀񚠀220 1"1000 1"1000rr燘燘00 1!11111!1!1111rr22200(1)1)1)1)1)1)1)1)1)1)1rr񠙁񣝹񣞃000000000000rr0000 0 0 +qqqq{ttttt|qqqqqqq66{tttzq2񭀬񭀬xttttttttr{2t2|qqqNKLOq6rr񋍐񋉖JHIMyy0123rr򔾖񋍆PQRS2289:;򷠶rr񠫞򘄨XYZ[󩅍`ABC򷠶rr`abc550 1"1044rr򑺐񚢠򎰬0 1"10000 1"1000rr񚠀񚠀220 1"1000 1"1000rr燘燘00 1!11111!1!1111rr22200(1)1)1)1)1)1)1)1)1)1)1rr񠙁񣝹񣞃000000000000rr0000 0 0 00 0 0 00rr0000rr000  4rr򼯽000 !" !"4rr000000000000400004m000000000000000򷠶qqrm0000000000000044qqllllllllllllllll \ No newline at end of file diff --git a/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc b/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc index 6279cacf27..edede9d737 100644 --- a/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc +++ b/data/maps/BattleFrontier_BattleDomeBattleRoom/scripts.inc @@ -476,6 +476,7 @@ BattleFrontier_BattleDomeBattleRoom_EventScript_SetUpObjects:: call BattleFrontier_EventScript_SetBrainObjectGfx setobjectxyperm LOCALID_OPPONENT, 13, 9 removeobject LOCALID_OPPONENT + delay 1 addobject LOCALID_OPPONENT applymovement LOCALID_OPPONENT, BattleFrontier_BattleDomeBattleRoom_Movement_SetInvisibleFacingUp BattleFrontier_BattleDomeBattleRoom_EventScript_EndSetUpObjects:: diff --git a/data/maps/DewfordTown/map.json b/data/maps/DewfordTown/map.json index f073a74368..114dc72995 100644 --- a/data/maps/DewfordTown/map.json +++ b/data/maps/DewfordTown/map.json @@ -89,6 +89,19 @@ "trainer_sight_or_berry_tree_id": "0", "script": "DewfordTown_EventScript_TrendyPhraseBoy", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 4, + "y": 10, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/EverGrandeCity/map.json b/data/maps/EverGrandeCity/map.json index 58978b7ff8..80b681021e 100644 --- a/data/maps/EverGrandeCity/map.json +++ b/data/maps/EverGrandeCity/map.json @@ -19,7 +19,21 @@ "direction": "left" } ], - "object_events": [], + "object_events": [ + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 29, + "y": 48, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" + } + ], "warp_events": [ { "x": 18, diff --git a/data/maps/LavaridgeTown/map.json b/data/maps/LavaridgeTown/map.json index ecf7c5b9f1..a70ec8b545 100644 --- a/data/maps/LavaridgeTown/map.json +++ b/data/maps/LavaridgeTown/map.json @@ -77,7 +77,7 @@ "x": 4, "y": 4, "elevation": 3, - "movement_type": "MOVEMENT_TYPE_FACE_DOWN_AND_RIGHT", + "movement_type": "MOVEMENT_TYPE_FACE_DOWN_AND_LEFT", "movement_range_x": 0, "movement_range_y": 0, "trainer_type": "TRAINER_TYPE_NONE", diff --git a/data/maps/LilycoveCity/map.json b/data/maps/LilycoveCity/map.json index 0b829ea09e..72cbce4553 100644 --- a/data/maps/LilycoveCity/map.json +++ b/data/maps/LilycoveCity/map.json @@ -310,6 +310,19 @@ "trainer_sight_or_berry_tree_id": "0", "script": "LilycoveCity_EventScript_FatMan", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 26, + "y": 14, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/MauvilleCity/map.json b/data/maps/MauvilleCity/map.json index 0d193e4022..b2a3238d1b 100644 --- a/data/maps/MauvilleCity/map.json +++ b/data/maps/MauvilleCity/map.json @@ -177,6 +177,32 @@ "trainer_sight_or_berry_tree_id": "0", "script": "0x0", "flag": "FLAG_HIDE_MAUVILLE_CITY_SCOTT" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 24, + "y": 5, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 25, + "y": 14, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "2", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/MossdeepCity/map.json b/data/maps/MossdeepCity/map.json index a7ec32d7b1..9574ab4398 100644 --- a/data/maps/MossdeepCity/map.json +++ b/data/maps/MossdeepCity/map.json @@ -250,6 +250,32 @@ "trainer_sight_or_berry_tree_id": "0", "script": "MossdeepCity_EventScript_BlackBelt", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 30, + "y": 16, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 39, + "y": 18, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "2", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/MtChimney/scripts.inc b/data/maps/MtChimney/scripts.inc index b4becfabee..6b37e32356 100644 --- a/data/maps/MtChimney/scripts.inc +++ b/data/maps/MtChimney/scripts.inc @@ -54,13 +54,13 @@ MtChimney_EventScript_Maxie:: msgbox MtChimney_Text_MaxieYouHaventSeenLastOfMagma, MSGBOX_DEFAULT closemessage delay 30 - fadescreen FADE_TO_BLACK + fadescreenswapbuffers FADE_TO_BLACK removeobject LOCALID_MAXIE removeobject LOCALID_MAGMA_GRUNT_1 removeobject LOCALID_TABITHA removeobject LOCALID_MAGMA_GRUNT_2 setflag FLAG_HIDE_MT_CHIMNEY_TEAM_MAGMA - fadescreen FADE_FROM_BLACK + fadescreenswapbuffers FADE_FROM_BLACK setobjectxyperm LOCALID_ARCHIE, 10, 12 addobject LOCALID_ARCHIE call_if_eq VAR_FACING, DIR_EAST, MtChimney_EventScript_ArchieApproachPlayerEast diff --git a/data/maps/MtPyre_Summit/scripts.inc b/data/maps/MtPyre_Summit/scripts.inc index 3de60df3f2..5a6d23797a 100644 --- a/data/maps/MtPyre_Summit/scripts.inc +++ b/data/maps/MtPyre_Summit/scripts.inc @@ -49,7 +49,7 @@ MtPyre_Summit_EventScript_TeamAquaExits:: call_if_eq VAR_0x8008, 2, MtPyre_Summit_EventScript_ArchieFacePlayer2 msgbox MtPyre_Summit_Text_ArchieWeGotTheOrbLetsGo, MSGBOX_DEFAULT closemessage - fadescreen FADE_TO_BLACK + fadescreenswapbuffers FADE_TO_BLACK removeobject LOCALID_ARCHIE removeobject LOCALID_GRUNT_1 removeobject LOCALID_GRUNT_2 @@ -58,7 +58,7 @@ MtPyre_Summit_EventScript_TeamAquaExits:: setflag FLAG_HIDE_MT_PYRE_SUMMIT_ARCHIE setflag FLAG_HIDE_MT_PYRE_SUMMIT_TEAM_AQUA fadedefaultbgm - fadescreen FADE_FROM_BLACK + fadescreenswapbuffers FADE_FROM_BLACK delay 20 setvar VAR_MT_PYRE_STATE, 1 call_if_eq VAR_0x8008, 0, MtPyre_Summit_EventScript_OldLadyApproachPlayer0 @@ -622,4 +622,3 @@ MtPyre_Summit_Text_HoennTrioTale: .string "becalmed the two enraged POK茅MON.\p" .string "Then, its duty done, the green POK茅MON\n" .string "flew off into the wild blue yonder鈥$" - diff --git a/data/maps/PacifidlogTown/map.json b/data/maps/PacifidlogTown/map.json index 37cfe8ad08..e6a1d06c73 100644 --- a/data/maps/PacifidlogTown/map.json +++ b/data/maps/PacifidlogTown/map.json @@ -63,6 +63,19 @@ "trainer_sight_or_berry_tree_id": "0", "script": "PacifidlogTown_EventScript_NinjaBoy", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 10, + "y": 15, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" } ], "warp_events": [ @@ -109,7 +122,9 @@ "dest_warp_id": "0" } ], - "coord_events": [], + "coord_events": [ + + ], "bg_events": [ { "type": "sign", diff --git a/data/maps/PetalburgCity/map.json b/data/maps/PetalburgCity/map.json index 7aaca8145c..902f53bce4 100644 --- a/data/maps/PetalburgCity/map.json +++ b/data/maps/PetalburgCity/map.json @@ -141,6 +141,32 @@ "trainer_sight_or_berry_tree_id": "0", "script": "0x0", "flag": "FLAG_HIDE_PETALBURG_CITY_SCOTT" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 22, + "y": 16, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 27, + "y": 12, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "2", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/Route102/map.json b/data/maps/Route102/map.json index 8ad17aae4d..8e3d206c76 100644 --- a/data/maps/Route102/map.json +++ b/data/maps/Route102/map.json @@ -141,10 +141,27 @@ "trainer_sight_or_berry_tree_id": "3", "script": "Route102_EventScript_Allen", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": -3, + "y": 2, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "2", + "script": "NULL", + "flag": "0" } ], - "warp_events": [], - "coord_events": [], + "warp_events": [ + + ], + "coord_events": [ + + ], "bg_events": [ { "type": "sign", diff --git a/data/maps/RustboroCity/map.json b/data/maps/RustboroCity/map.json index 9a987ab284..40d4f6f8fa 100644 --- a/data/maps/RustboroCity/map.json +++ b/data/maps/RustboroCity/map.json @@ -237,6 +237,227 @@ "trainer_sight_or_berry_tree_id": "0", "script": "RustboroCity_EventScript_Boy1", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 19, + "y": 37, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 22, + "y": 37, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 19, + "y": 30, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 22, + "y": 30, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 19, + "y": 23, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 22, + "y": 23, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 22, + "y": 44, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 19, + "y": 44, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 29, + "y": 48, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 14, + "y": 19, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 15, + "y": 17, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 9, + "y": 19, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 8, + "y": 17, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 19, + "y": 15, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 22, + "y": 15, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 14, + "y": 54, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 17, + "y": 54, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "0", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/SlateportCity/map.json b/data/maps/SlateportCity/map.json index 972b51447e..7b002d2d9e 100644 --- a/data/maps/SlateportCity/map.json +++ b/data/maps/SlateportCity/map.json @@ -484,6 +484,32 @@ "trainer_sight_or_berry_tree_id": "0", "script": "0x0", "flag": "FLAG_HIDE_SLATEPORT_CITY_SCOTT" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 21, + "y": 19, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 15, + "y": 26, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "2", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc b/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc index 53514bb5e9..fd6567cb65 100644 --- a/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc +++ b/data/maps/SlateportCity_BattleTentBattleRoom/scripts.inc @@ -48,6 +48,7 @@ SlateportCity_BattleTentBattleRoom_EventScript_EnterRoom:: factory_setopponentgfx setobjectxyperm LOCALID_OPPONENT, 5, 1 removeobject LOCALID_OPPONENT + delay 1 addobject LOCALID_OPPONENT applymovement LOCALID_OPPONENT, SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter waitmovement 0 @@ -102,4 +103,3 @@ SlateportCity_BattleTentBattleRoom_Movement_OpponentEnter: walk_down walk_in_place_faster_left step_end - diff --git a/data/maps/VerdanturfTown/map.json b/data/maps/VerdanturfTown/map.json index ae40730c0e..6e0b81cd7a 100644 --- a/data/maps/VerdanturfTown/map.json +++ b/data/maps/VerdanturfTown/map.json @@ -76,6 +76,32 @@ "trainer_sight_or_berry_tree_id": "0", "script": "VerdanturfTown_EventScript_Camper", "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 18, + "y": 3, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "1", + "script": "NULL", + "flag": "0" + }, + { + "graphics_id": "OBJ_EVENT_GFX_LIGHT_SPRITE", + "x": 14, + "y": 3, + "elevation": 3, + "movement_type": "MOVEMENT_TYPE_NONE", + "movement_range_x": 0, + "movement_range_y": 0, + "trainer_type": "TRAINER_TYPE_NONE", + "trainer_sight_or_berry_tree_id": "2", + "script": "NULL", + "flag": "0" } ], "warp_events": [ diff --git a/data/tilesets/primary/general/metatile_attributes.bin b/data/tilesets/primary/general/metatile_attributes.bin index d9cd29016d..552dafb603 100644 Binary files a/data/tilesets/primary/general/metatile_attributes.bin and b/data/tilesets/primary/general/metatile_attributes.bin differ diff --git a/data/tilesets/primary/general/metatiles.bin b/data/tilesets/primary/general/metatiles.bin index af899bcc5e..813543f580 100644 Binary files a/data/tilesets/primary/general/metatiles.bin and b/data/tilesets/primary/general/metatiles.bin differ diff --git a/data/tilesets/primary/general/palettes/04.pal b/data/tilesets/primary/general/palettes/04.pal index d8051b7bac..313337d6da 100644 --- a/data/tilesets/primary/general/palettes/04.pal +++ b/data/tilesets/primary/general/palettes/04.pal @@ -1,14 +1,14 @@ JASC-PAL 0100 16 -24 41 82 -255 255 255 +0 0 0 +216 224 232 222 230 238 -255 0 255 -255 0 255 -255 0 255 +184 200 224 +152 176 216 +112 184 240 156 164 189 -82 106 213 +80 104 208 65 90 189 57 82 156 41 65 139 @@ -16,4 +16,4 @@ JASC-PAL 139 164 222 106 131 213 82 106 213 -115 197 164 +96 168 232 diff --git a/data/tilesets/primary/general/palettes/04.pla b/data/tilesets/primary/general/palettes/04.pla new file mode 100644 index 0000000000..5f08f88f35 --- /dev/null +++ b/data/tilesets/primary/general/palettes/04.pla @@ -0,0 +1,6 @@ +# Color indices to set high bit +1 +3 +4 +5 +15 \ No newline at end of file diff --git a/data/tilesets/primary/general/palettes/13.pal b/data/tilesets/primary/general/palettes/13.pal index 4b0812f094..73fec5261a 100644 --- a/data/tilesets/primary/general/palettes/13.pal +++ b/data/tilesets/primary/general/palettes/13.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +232 0 128 +232 228 216 +222 230 238 +224 214 184 +216 200 152 +244 226 171 +156 164 189 +80 104 208 +65 90 189 +57 82 156 +41 65 139 +172 197 230 +139 164 222 +106 131 213 +82 106 213 +221 205 143 diff --git a/data/tilesets/primary/general/tiles.png b/data/tilesets/primary/general/tiles.png index 17426ab80e..b22b3f1fcb 100644 Binary files a/data/tilesets/primary/general/tiles.png and b/data/tilesets/primary/general/tiles.png differ diff --git a/data/tilesets/secondary/dewford/metatile_attributes.bin b/data/tilesets/secondary/dewford/metatile_attributes.bin index 67ee25d405..158238664f 100644 Binary files a/data/tilesets/secondary/dewford/metatile_attributes.bin and b/data/tilesets/secondary/dewford/metatile_attributes.bin differ diff --git a/data/tilesets/secondary/dewford/metatiles.bin b/data/tilesets/secondary/dewford/metatiles.bin index 728d5b6325..9e1f54e174 100644 Binary files a/data/tilesets/secondary/dewford/metatiles.bin and b/data/tilesets/secondary/dewford/metatiles.bin differ diff --git a/data/tilesets/secondary/dewford/tiles.png b/data/tilesets/secondary/dewford/tiles.png index 33e61b435d..2af1303c27 100644 Binary files a/data/tilesets/secondary/dewford/tiles.png and b/data/tilesets/secondary/dewford/tiles.png differ diff --git a/data/tilesets/secondary/ever_grande/palettes/01.pal b/data/tilesets/secondary/ever_grande/palettes/01.pal index 3c6e40c2e9..2c02767613 100644 --- a/data/tilesets/secondary/ever_grande/palettes/01.pal +++ b/data/tilesets/secondary/ever_grande/palettes/01.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -24 41 82 -255 255 255 -222 230 238 -189 205 230 -156 180 222 +0 197 0 +246 197 123 +238 156 90 +205 115 41 +164 90 49 131 131 139 98 98 123 65 74 106 41 49 90 -115 189 246 -98 172 238 -255 189 131 -238 148 115 -222 106 98 -205 65 82 -115 197 164 +224 226 171 +216 200 152 +255 255 238 +222 222 197 +197 197 164 +164 172 123 +255 255 115 diff --git a/data/tilesets/secondary/ever_grande/palettes/08.pal b/data/tilesets/secondary/ever_grande/palettes/08.pal index 083dd5080a..fcd13d7723 100644 --- a/data/tilesets/secondary/ever_grande/palettes/08.pal +++ b/data/tilesets/secondary/ever_grande/palettes/08.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -24 41 82 +0 0 0 246 197 123 238 156 90 205 115 41 diff --git a/data/tilesets/secondary/ever_grande/palettes/08.pla b/data/tilesets/secondary/ever_grande/palettes/08.pla new file mode 100644 index 0000000000..5eb702de80 --- /dev/null +++ b/data/tilesets/secondary/ever_grande/palettes/08.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/fallarbor/palettes/00.pal b/data/tilesets/secondary/fallarbor/palettes/00.pal index ede0c60a19..87f9999aef 100644 --- a/data/tilesets/secondary/fallarbor/palettes/00.pal +++ b/data/tilesets/secondary/fallarbor/palettes/00.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -115 197 164 -255 255 255 -222 230 238 -189 205 230 -156 180 222 +0 192 0 +222 230 164 +180 197 115 +148 156 82 +123 131 65 131 131 139 98 98 123 65 74 106 -189 189 131 -115 189 246 -98 172 238 -115 189 246 -98 164 222 -82 139 197 -74 115 172 -115 197 164 +88 168 168 +221 205 143 +244 226 171 +255 205 82 +230 156 49 +222 123 32 +156 98 41 +128 192 216 diff --git a/data/tilesets/secondary/fallarbor/palettes/07.pal b/data/tilesets/secondary/fallarbor/palettes/07.pal index 724a8f09db..6cb1ea50e7 100644 --- a/data/tilesets/secondary/fallarbor/palettes/07.pal +++ b/data/tilesets/secondary/fallarbor/palettes/07.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -24 41 82 +0 0 0 222 230 164 180 197 115 148 156 82 @@ -9,11 +9,11 @@ JASC-PAL 131 131 139 98 98 123 65 74 106 -41 49 90 +88 168 168 90 172 172 131 197 222 255 205 82 230 156 49 222 123 32 156 98 41 -115 197 164 +128 192 216 diff --git a/data/tilesets/secondary/fallarbor/palettes/07.pla b/data/tilesets/secondary/fallarbor/palettes/07.pla new file mode 100644 index 0000000000..5eb702de80 --- /dev/null +++ b/data/tilesets/secondary/fallarbor/palettes/07.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/fallarbor/tiles.png b/data/tilesets/secondary/fallarbor/tiles.png index 3582d1d030..06b86ff956 100644 Binary files a/data/tilesets/secondary/fallarbor/tiles.png and b/data/tilesets/secondary/fallarbor/tiles.png differ diff --git a/data/tilesets/secondary/fortree/metatiles.bin b/data/tilesets/secondary/fortree/metatiles.bin index ecc00d7e70..1b0958cbd1 100644 Binary files a/data/tilesets/secondary/fortree/metatiles.bin and b/data/tilesets/secondary/fortree/metatiles.bin differ diff --git a/data/tilesets/secondary/fortree/palettes/08.pal b/data/tilesets/secondary/fortree/palettes/08.pal index 40b922e287..1d8a56f8e7 100644 --- a/data/tilesets/secondary/fortree/palettes/08.pal +++ b/data/tilesets/secondary/fortree/palettes/08.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -255 255 255 +176 184 200 255 255 255 246 238 189 230 213 172 @@ -16,4 +16,4 @@ JASC-PAL 0 0 0 172 180 197 123 123 123 -115 197 164 +176 184 200 diff --git a/data/tilesets/secondary/fortree/palettes/08.pla b/data/tilesets/secondary/fortree/palettes/08.pla new file mode 100644 index 0000000000..69488b50cb --- /dev/null +++ b/data/tilesets/secondary/fortree/palettes/08.pla @@ -0,0 +1,6 @@ +# Color indices to set high bit +0 +8 +9 +11 +15 \ No newline at end of file diff --git a/data/tilesets/secondary/fortree/tiles.png b/data/tilesets/secondary/fortree/tiles.png index 9cd688c5ed..2da9fcbfab 100644 Binary files a/data/tilesets/secondary/fortree/tiles.png and b/data/tilesets/secondary/fortree/tiles.png differ diff --git a/data/tilesets/secondary/lavaridge/metatiles.bin b/data/tilesets/secondary/lavaridge/metatiles.bin index fd0314ed78..c9bc71442a 100644 Binary files a/data/tilesets/secondary/lavaridge/metatiles.bin and b/data/tilesets/secondary/lavaridge/metatiles.bin differ diff --git a/data/tilesets/secondary/lavaridge/palettes/06.pal b/data/tilesets/secondary/lavaridge/palettes/06.pal index 00e1478a73..3ea0c42542 100644 --- a/data/tilesets/secondary/lavaridge/palettes/06.pal +++ b/data/tilesets/secondary/lavaridge/palettes/06.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -0 0 0 -65 74 106 -197 205 0 -230 238 238 -255 255 255 -255 115 65 -230 115 65 -180 98 90 -164 82 82 -205 49 0 -148 49 0 -246 24 24 -246 148 0 -148 164 65 -106 123 139 -222 222 0 +224 40 0 +64 72 104 +192 200 0 +224 232 232 +248 248 248 +248 112 64 +224 112 64 +176 96 88 +160 80 80 +200 48 0 +144 48 0 +240 24 24 +240 144 0 +144 160 64 +104 120 136 +224 40 0 diff --git a/data/tilesets/secondary/lavaridge/palettes/06.pla b/data/tilesets/secondary/lavaridge/palettes/06.pla new file mode 100644 index 0000000000..26f59249a8 --- /dev/null +++ b/data/tilesets/secondary/lavaridge/palettes/06.pla @@ -0,0 +1,7 @@ +# Color indices to set high bit +0 +9 +10 +11 +12 +15 \ No newline at end of file diff --git a/data/tilesets/secondary/lavaridge/tiles.png b/data/tilesets/secondary/lavaridge/tiles.png index 2f6898a0f7..03c832c37a 100644 Binary files a/data/tilesets/secondary/lavaridge/tiles.png and b/data/tilesets/secondary/lavaridge/tiles.png differ diff --git a/data/tilesets/secondary/lilycove/metatile_attributes.bin b/data/tilesets/secondary/lilycove/metatile_attributes.bin index 0f4e01b923..f31cc9a047 100644 Binary files a/data/tilesets/secondary/lilycove/metatile_attributes.bin and b/data/tilesets/secondary/lilycove/metatile_attributes.bin differ diff --git a/data/tilesets/secondary/lilycove/metatiles.bin b/data/tilesets/secondary/lilycove/metatiles.bin index 6018ac8ec3..f82bdff5c6 100644 Binary files a/data/tilesets/secondary/lilycove/metatiles.bin and b/data/tilesets/secondary/lilycove/metatiles.bin differ diff --git a/data/tilesets/secondary/lilycove/palettes/06.pal b/data/tilesets/secondary/lilycove/palettes/06.pal index 4b0812f094..a40ff7909c 100644 --- a/data/tilesets/secondary/lilycove/palettes/06.pal +++ b/data/tilesets/secondary/lilycove/palettes/06.pal @@ -2,17 +2,17 @@ JASC-PAL 0100 16 0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +168 184 240 +112 144 208 +115 148 213 +90 115 189 +131 131 139 +216 208 216 +65 74 106 +222 213 222 +112 144 208 +131 197 213 +248 248 248 0 0 0 0 0 0 0 0 0 diff --git a/data/tilesets/secondary/lilycove/palettes/06.pla b/data/tilesets/secondary/lilycove/palettes/06.pla new file mode 100644 index 0000000000..77b77f073c --- /dev/null +++ b/data/tilesets/secondary/lilycove/palettes/06.pla @@ -0,0 +1,6 @@ +# Color indices to set high bit +1 +2 +6 +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/lilycove/palettes/15.pal b/data/tilesets/secondary/lilycove/palettes/15.pal index e7717d74ea..41c4142bb9 100644 --- a/data/tilesets/secondary/lilycove/palettes/15.pal +++ b/data/tilesets/secondary/lilycove/palettes/15.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -115 197 164 -255 213 180 -255 197 148 -222 148 115 -123 65 65 -57 74 123 -41 57 98 -24 41 82 -16 32 57 -222 230 238 -255 197 90 -189 156 90 -255 98 90 -197 65 65 -255 255 255 +24 200 0 +244 226 171 +221 205 143 +115 148 213 +90 115 189 +131 131 139 +232 228 216 +65 74 106 +222 213 222 +221 205 143 +244 226 171 +248 248 248 +0 0 0 +0 0 0 +0 0 0 0 0 0 diff --git a/data/tilesets/secondary/lilycove/tiles.png b/data/tilesets/secondary/lilycove/tiles.png index 44111c4487..56be3ab4dc 100644 Binary files a/data/tilesets/secondary/lilycove/tiles.png and b/data/tilesets/secondary/lilycove/tiles.png differ diff --git a/data/tilesets/secondary/mauville/metatiles.bin b/data/tilesets/secondary/mauville/metatiles.bin index a71ead8e57..148991e52e 100644 Binary files a/data/tilesets/secondary/mauville/metatiles.bin and b/data/tilesets/secondary/mauville/metatiles.bin differ diff --git a/data/tilesets/secondary/mauville/palettes/07.pal b/data/tilesets/secondary/mauville/palettes/07.pal index fa1dbd2962..f3618ff714 100644 --- a/data/tilesets/secondary/mauville/palettes/07.pal +++ b/data/tilesets/secondary/mauville/palettes/07.pal @@ -9,11 +9,11 @@ JASC-PAL 131 131 139 98 98 123 65 74 106 -41 49 90 +40 48 88 213 213 213 164 164 172 230 197 246 213 139 222 197 115 164 148 98 106 -172 205 230 +168 200 224 diff --git a/data/tilesets/secondary/mauville/palettes/07.pla b/data/tilesets/secondary/mauville/palettes/07.pla new file mode 100644 index 0000000000..5e51fe661a --- /dev/null +++ b/data/tilesets/secondary/mauville/palettes/07.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +1 +15 \ No newline at end of file diff --git a/data/tilesets/secondary/mauville/palettes/08.pal b/data/tilesets/secondary/mauville/palettes/08.pal index bc7cb5c883..3742cfd9ba 100644 --- a/data/tilesets/secondary/mauville/palettes/08.pal +++ b/data/tilesets/secondary/mauville/palettes/08.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 123 180 189 -115 189 246 +0 248 0 131 197 98 57 139 49 57 82 0 255 255 98 255 255 255 222 230 238 -189 205 230 +0 248 0 255 172 222 230 131 180 213 90 139 -164 213 197 +0 248 0 115 197 164 -65 180 131 -24 164 106 +0 248 0 +0 248 0 diff --git a/data/tilesets/secondary/mauville/palettes/09.pal b/data/tilesets/secondary/mauville/palettes/09.pal index 9c37027c3d..312bb1aac7 100644 --- a/data/tilesets/secondary/mauville/palettes/09.pal +++ b/data/tilesets/secondary/mauville/palettes/09.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 123 180 189 -255 255 255 +248 0 248 131 197 98 57 139 49 57 82 0 255 255 98 172 197 230 -139 164 222 -106 131 213 +248 0 248 +248 0 248 255 230 148 238 197 115 -230 172 82 +248 0 248 164 213 197 115 197 164 -65 180 131 -24 164 106 +248 0 248 +248 0 248 diff --git a/data/tilesets/secondary/mauville/palettes/10.pal b/data/tilesets/secondary/mauville/palettes/10.pal index a2e1cdc176..b0d6736e5e 100644 --- a/data/tilesets/secondary/mauville/palettes/10.pal +++ b/data/tilesets/secondary/mauville/palettes/10.pal @@ -9,9 +9,9 @@ JASC-PAL 131 131 139 98 98 123 65 74 106 -41 49 90 +144 216 248 246 197 98 -148 222 255 +144 216 248 230 172 238 213 139 222 197 115 164 diff --git a/data/tilesets/secondary/mauville/palettes/10.pla b/data/tilesets/secondary/mauville/palettes/10.pla new file mode 100644 index 0000000000..24701d55f5 --- /dev/null +++ b/data/tilesets/secondary/mauville/palettes/10.pla @@ -0,0 +1,4 @@ +# Color indices to set high bit +1 +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/mauville/palettes/11.pal b/data/tilesets/secondary/mauville/palettes/11.pal index c73ec2fe82..a48424b133 100644 --- a/data/tilesets/secondary/mauville/palettes/11.pal +++ b/data/tilesets/secondary/mauville/palettes/11.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -172 180 139 +123 180 189 255 255 255 222 230 238 164 180 197 diff --git a/data/tilesets/secondary/mauville/palettes/11.pla b/data/tilesets/secondary/mauville/palettes/11.pla new file mode 100644 index 0000000000..0dcbee2087 --- /dev/null +++ b/data/tilesets/secondary/mauville/palettes/11.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +7 +8 \ No newline at end of file diff --git a/data/tilesets/secondary/mauville/tiles.png b/data/tilesets/secondary/mauville/tiles.png index 208a052c53..09bab36577 100644 Binary files a/data/tilesets/secondary/mauville/tiles.png and b/data/tilesets/secondary/mauville/tiles.png differ diff --git a/data/tilesets/secondary/mossdeep/metatiles.bin b/data/tilesets/secondary/mossdeep/metatiles.bin index 5fc527d0ff..1fe4faf9c5 100644 Binary files a/data/tilesets/secondary/mossdeep/metatiles.bin and b/data/tilesets/secondary/mossdeep/metatiles.bin differ diff --git a/data/tilesets/secondary/mossdeep/palettes/01.pal b/data/tilesets/secondary/mossdeep/palettes/01.pal index 1d09f740d5..e845b832bc 100644 --- a/data/tilesets/secondary/mossdeep/palettes/01.pal +++ b/data/tilesets/secondary/mossdeep/palettes/01.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -131 197 98 +0 192 0 255 255 255 -222 230 238 -189 205 230 -156 180 222 -131 131 139 +205 205 197 +180 180 164 +180 189 222 +139 139 148 98 98 123 65 74 106 41 49 90 -115 189 246 -98 172 238 -255 189 131 -238 148 115 -222 106 98 -205 65 82 -115 197 164 +255 248 180 +224 217 159 +255 213 49 +238 148 16 +205 213 131 +148 148 74 +90 82 8 diff --git a/data/tilesets/secondary/mossdeep/palettes/02.pal b/data/tilesets/secondary/mossdeep/palettes/02.pal index 4c41030f66..14fb4a9897 100644 --- a/data/tilesets/secondary/mossdeep/palettes/02.pal +++ b/data/tilesets/secondary/mossdeep/palettes/02.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -24 41 82 -180 255 131 -131 197 98 -57 139 49 -57 82 0 -222 148 115 -106 90 90 -164 98 90 -65 57 49 -255 197 148 -222 106 98 -205 65 82 -164 213 197 -115 197 164 -65 180 131 -24 164 106 +0 32 0 +248 248 248 +248 0 248 +224 0 232 +64 128 96 +120 120 144 +96 96 120 +64 72 104 +255 227 148 +184 184 192 +160 160 152 +240 216 152 +208 144 112 +184 80 80 +128 56 64 +240 144 48 diff --git a/data/tilesets/secondary/mossdeep/palettes/08.pal b/data/tilesets/secondary/mossdeep/palettes/08.pal index 07d79210a7..5b086f0511 100644 --- a/data/tilesets/secondary/mossdeep/palettes/08.pal +++ b/data/tilesets/secondary/mossdeep/palettes/08.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -131 197 98 +0 0 0 255 255 255 205 205 197 180 180 164 diff --git a/data/tilesets/secondary/mossdeep/palettes/08.pla b/data/tilesets/secondary/mossdeep/palettes/08.pla new file mode 100644 index 0000000000..5eb702de80 --- /dev/null +++ b/data/tilesets/secondary/mossdeep/palettes/08.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/mossdeep/palettes/09.pal b/data/tilesets/secondary/mossdeep/palettes/09.pal index cee575bae6..0883321166 100644 --- a/data/tilesets/secondary/mossdeep/palettes/09.pal +++ b/data/tilesets/secondary/mossdeep/palettes/09.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -131 197 98 -255 255 255 -139 205 123 -98 172 98 -65 131 98 -123 123 148 -98 98 123 -65 74 106 -41 49 90 -189 189 197 -164 164 156 -246 222 156 -213 148 115 -189 82 82 -131 57 65 -246 148 49 +0 32 0 +248 248 248 +248 0 248 +224 0 232 +64 128 96 +120 120 144 +96 96 120 +64 72 104 +80 72 104 +184 184 192 +160 160 152 +240 216 152 +208 144 112 +184 80 80 +128 56 64 +240 144 48 diff --git a/data/tilesets/secondary/mossdeep/tiles.png b/data/tilesets/secondary/mossdeep/tiles.png index cc4591f880..6c1bb1d396 100644 Binary files a/data/tilesets/secondary/mossdeep/tiles.png and b/data/tilesets/secondary/mossdeep/tiles.png differ diff --git a/data/tilesets/secondary/pacifidlog/palettes/02.pal b/data/tilesets/secondary/pacifidlog/palettes/02.pal index 4c41030f66..9ea109ce00 100644 --- a/data/tilesets/secondary/pacifidlog/palettes/02.pal +++ b/data/tilesets/secondary/pacifidlog/palettes/02.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -24 41 82 -180 255 131 -131 197 98 -57 139 49 -57 82 0 -222 148 115 -106 90 90 -164 98 90 -65 57 49 -255 197 148 -222 106 98 -205 65 82 -164 213 197 -115 197 164 -65 180 131 -24 164 106 +0 0 128 +222 230 164 +180 189 123 +156 164 98 +131 139 74 +90 98 41 +98 98 123 +65 74 106 +32 32 82 +238 230 164 +238 197 98 +205 156 57 +164 123 24 +131 82 49 +131 131 139 +244 226 171 diff --git a/data/tilesets/secondary/pacifidlog/palettes/09.pal b/data/tilesets/secondary/pacifidlog/palettes/09.pal index 780f5b0ab6..653ffdfb3e 100644 --- a/data/tilesets/secondary/pacifidlog/palettes/09.pal +++ b/data/tilesets/secondary/pacifidlog/palettes/09.pal @@ -16,4 +16,4 @@ JASC-PAL 164 123 24 131 82 49 131 131 139 -82 106 213 +64 72 104 diff --git a/data/tilesets/secondary/pacifidlog/palettes/09.pla b/data/tilesets/secondary/pacifidlog/palettes/09.pla new file mode 100644 index 0000000000..321117092b --- /dev/null +++ b/data/tilesets/secondary/pacifidlog/palettes/09.pla @@ -0,0 +1,2 @@ +# Color indices to set high bit +15 \ No newline at end of file diff --git a/data/tilesets/secondary/pacifidlog/tiles.png b/data/tilesets/secondary/pacifidlog/tiles.png index 9fe620e1ef..31f78891d4 100644 Binary files a/data/tilesets/secondary/pacifidlog/tiles.png and b/data/tilesets/secondary/pacifidlog/tiles.png differ diff --git a/data/tilesets/secondary/petalburg/metatiles.bin b/data/tilesets/secondary/petalburg/metatiles.bin index 3711f4aeef..3ca46efec7 100644 Binary files a/data/tilesets/secondary/petalburg/metatiles.bin and b/data/tilesets/secondary/petalburg/metatiles.bin differ diff --git a/data/tilesets/secondary/petalburg/palettes/02.pal b/data/tilesets/secondary/petalburg/palettes/02.pal index 4c41030f66..4897614451 100644 --- a/data/tilesets/secondary/petalburg/palettes/02.pal +++ b/data/tilesets/secondary/petalburg/palettes/02.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -24 41 82 -180 255 131 -131 197 98 -57 139 49 -57 82 0 -222 148 115 -106 90 90 -164 98 90 -65 57 49 -255 197 148 -222 106 98 -205 65 82 -164 213 197 -115 197 164 -65 180 131 -24 164 106 +0 192 0 +232 224 200 +208 200 144 +200 176 120 +168 136 120 +128 128 136 +96 96 120 +64 72 104 +40 48 88 +244 226 171 +221 205 143 +248 224 176 +248 184 168 +240 160 128 +200 136 104 +248 192 32 diff --git a/data/tilesets/secondary/petalburg/palettes/06.pal b/data/tilesets/secondary/petalburg/palettes/06.pal index b893aa09e4..f4190e865c 100644 --- a/data/tilesets/secondary/petalburg/palettes/06.pal +++ b/data/tilesets/secondary/petalburg/palettes/06.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -24 41 82 +0 0 0 255 255 255 230 222 222 213 213 197 @@ -16,4 +16,4 @@ JASC-PAL 205 197 123 180 164 123 164 139 98 -115 197 164 +248 224 120 diff --git a/data/tilesets/secondary/petalburg/palettes/06.pla b/data/tilesets/secondary/petalburg/palettes/06.pla new file mode 100644 index 0000000000..5eb702de80 --- /dev/null +++ b/data/tilesets/secondary/petalburg/palettes/06.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/petalburg/palettes/07.pal b/data/tilesets/secondary/petalburg/palettes/07.pal index 4b0812f094..41d1339942 100644 --- a/data/tilesets/secondary/petalburg/palettes/07.pal +++ b/data/tilesets/secondary/petalburg/palettes/07.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 0 0 0 +213 222 172 0 0 0 +189 189 131 +164 172 123 +131 131 139 +98 106 123 +65 74 106 0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +164 213 230 +106 189 197 +112 192 160 +205 213 238 +156 156 180 +115 172 57 +248 224 120 diff --git a/data/tilesets/secondary/petalburg/palettes/07.pla b/data/tilesets/secondary/petalburg/palettes/07.pla new file mode 100644 index 0000000000..5eb702de80 --- /dev/null +++ b/data/tilesets/secondary/petalburg/palettes/07.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/petalburg/palettes/09.pal b/data/tilesets/secondary/petalburg/palettes/09.pal index c4a6e250af..4d052b9c30 100644 --- a/data/tilesets/secondary/petalburg/palettes/09.pal +++ b/data/tilesets/secondary/petalburg/palettes/09.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -24 41 82 -238 230 205 -213 205 148 -205 180 123 -172 139 123 -131 131 139 -98 98 123 -65 74 106 -41 49 90 -156 205 246 -98 156 238 -255 230 180 -255 189 172 -246 164 131 -205 139 106 -115 197 164 +0 0 0 +232 224 200 +208 200 144 +200 176 120 +168 136 120 +128 128 136 +96 96 120 +64 72 104 +40 48 88 +152 200 240 +120 152 232 +248 224 176 +248 184 168 +240 160 128 +200 136 104 +248 192 32 diff --git a/data/tilesets/secondary/petalburg/palettes/09.pla b/data/tilesets/secondary/petalburg/palettes/09.pla new file mode 100644 index 0000000000..5eb702de80 --- /dev/null +++ b/data/tilesets/secondary/petalburg/palettes/09.pla @@ -0,0 +1,3 @@ +# Color indices to set high bit +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/petalburg/tiles.png b/data/tilesets/secondary/petalburg/tiles.png index 00d6d94a4e..c3ae46ad7c 100644 Binary files a/data/tilesets/secondary/petalburg/tiles.png and b/data/tilesets/secondary/petalburg/tiles.png differ diff --git a/data/tilesets/secondary/rustboro/metatiles.bin b/data/tilesets/secondary/rustboro/metatiles.bin index 5a0d1b0d14..649b09fac9 100644 Binary files a/data/tilesets/secondary/rustboro/metatiles.bin and b/data/tilesets/secondary/rustboro/metatiles.bin differ diff --git a/data/tilesets/secondary/rustboro/palettes/06.pal b/data/tilesets/secondary/rustboro/palettes/06.pal index 955b1d21a8..1a3e98a28e 100644 --- a/data/tilesets/secondary/rustboro/palettes/06.pal +++ b/data/tilesets/secondary/rustboro/palettes/06.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 115 197 164 +255 255 255 +216 224 232 +184 200 224 +136 144 152 +131 131 139 +98 98 123 +64 72 104 +40 48 88 +205 213 230 +139 180 213 +128 128 136 +216 224 232 0 0 0 0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +248 224 120 diff --git a/data/tilesets/secondary/rustboro/palettes/06.pla b/data/tilesets/secondary/rustboro/palettes/06.pla new file mode 100644 index 0000000000..7fe6c388e7 --- /dev/null +++ b/data/tilesets/secondary/rustboro/palettes/06.pla @@ -0,0 +1,7 @@ +# Colors in palette to set high (alpha) bit +2 +3 +4 +5 +9 +10 \ No newline at end of file diff --git a/data/tilesets/secondary/rustboro/palettes/10.pal b/data/tilesets/secondary/rustboro/palettes/10.pal index 6f0bfa7ee9..d68d54ce9a 100644 --- a/data/tilesets/secondary/rustboro/palettes/10.pal +++ b/data/tilesets/secondary/rustboro/palettes/10.pal @@ -5,7 +5,7 @@ JASC-PAL 255 255 255 222 222 222 172 180 189 -139 148 156 +136 144 152 131 131 139 98 98 123 65 74 106 diff --git a/data/tilesets/secondary/rustboro/tiles.png b/data/tilesets/secondary/rustboro/tiles.png index c3a3bfbab4..1cf8473a20 100644 Binary files a/data/tilesets/secondary/rustboro/tiles.png and b/data/tilesets/secondary/rustboro/tiles.png differ diff --git a/data/tilesets/secondary/slateport/metatile_attributes.bin b/data/tilesets/secondary/slateport/metatile_attributes.bin index d4894828bb..0f311a694f 100644 Binary files a/data/tilesets/secondary/slateport/metatile_attributes.bin and b/data/tilesets/secondary/slateport/metatile_attributes.bin differ diff --git a/data/tilesets/secondary/slateport/metatiles.bin b/data/tilesets/secondary/slateport/metatiles.bin index 72f671f71d..81c28bc3c6 100644 Binary files a/data/tilesets/secondary/slateport/metatiles.bin and b/data/tilesets/secondary/slateport/metatiles.bin differ diff --git a/data/tilesets/secondary/slateport/palettes/06.pal b/data/tilesets/secondary/slateport/palettes/06.pal index 0c2d8d3ca3..1e7d9a8220 100644 --- a/data/tilesets/secondary/slateport/palettes/06.pal +++ b/data/tilesets/secondary/slateport/palettes/06.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -24 41 82 +0 0 0 255 255 255 230 230 238 205 205 222 @@ -16,4 +16,4 @@ JASC-PAL 197 180 189 164 156 164 131 106 172 -115 197 164 +112 192 160 diff --git a/data/tilesets/secondary/slateport/palettes/06.pla b/data/tilesets/secondary/slateport/palettes/06.pla new file mode 100644 index 0000000000..07f021d4b4 --- /dev/null +++ b/data/tilesets/secondary/slateport/palettes/06.pla @@ -0,0 +1,2 @@ +# Color indices to set high bit +8 \ No newline at end of file diff --git a/data/tilesets/secondary/slateport/palettes/12.pal b/data/tilesets/secondary/slateport/palettes/12.pal index 4b0812f094..7ef1f4f2db 100644 --- a/data/tilesets/secondary/slateport/palettes/12.pal +++ b/data/tilesets/secondary/slateport/palettes/12.pal @@ -2,18 +2,18 @@ JASC-PAL 0100 16 0 0 0 +222 205 148 +184 168 80 +168 224 200 +216 216 176 +148 148 156 +98 98 123 +64 72 104 +184 184 152 +0 0 0 +148 205 255 +184 224 216 0 0 0 0 0 0 0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +248 224 120 diff --git a/data/tilesets/secondary/slateport/palettes/12.pla b/data/tilesets/secondary/slateport/palettes/12.pla new file mode 100644 index 0000000000..27f716b90d --- /dev/null +++ b/data/tilesets/secondary/slateport/palettes/12.pla @@ -0,0 +1,6 @@ +# Color indices to set high bit +3 +4 +8 +10 +11 \ No newline at end of file diff --git a/data/tilesets/secondary/slateport/palettes/15.pal b/data/tilesets/secondary/slateport/palettes/15.pal index e7717d74ea..25b623a269 100644 --- a/data/tilesets/secondary/slateport/palettes/15.pal +++ b/data/tilesets/secondary/slateport/palettes/15.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -115 197 164 -255 213 180 -255 197 148 -222 148 115 -123 65 65 -57 74 123 -41 57 98 -24 41 82 -16 32 57 -222 230 238 -255 197 90 -189 156 90 -255 98 90 -197 65 65 +0 32 0 255 255 255 -0 0 0 +230 230 238 +205 205 222 +197 180 222 +123 131 156 +98 98 123 +65 74 106 +255 231 138 +205 205 148 +172 148 90 +222 213 238 +197 180 189 +164 156 164 +131 106 172 +112 192 160 diff --git a/data/tilesets/secondary/slateport/tiles.png b/data/tilesets/secondary/slateport/tiles.png index ff7588d2dd..c5f01eb1d0 100644 Binary files a/data/tilesets/secondary/slateport/tiles.png and b/data/tilesets/secondary/slateport/tiles.png differ diff --git a/data/tilesets/secondary/sootopolis/palettes/06.pal b/data/tilesets/secondary/sootopolis/palettes/06.pal index b9e93fa5f0..44cd60931b 100644 --- a/data/tilesets/secondary/sootopolis/palettes/06.pal +++ b/data/tilesets/secondary/sootopolis/palettes/06.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -115 197 164 +248 240 176 255 255 255 238 238 213 222 222 180 @@ -10,10 +10,10 @@ JASC-PAL 98 98 123 65 74 106 41 49 90 -0 0 0 -0 0 0 +64 72 104 +80 88 80 156 164 156 123 131 123 98 106 98 82 90 82 -0 0 0 +248 240 176 diff --git a/data/tilesets/secondary/sootopolis/palettes/06.pla b/data/tilesets/secondary/sootopolis/palettes/06.pla new file mode 100644 index 0000000000..82b8d1306f --- /dev/null +++ b/data/tilesets/secondary/sootopolis/palettes/06.pla @@ -0,0 +1,5 @@ +# Color indices to set high bit +0 +9 +10 +15 \ No newline at end of file diff --git a/data/tilesets/secondary/sootopolis/palettes/10.pal b/data/tilesets/secondary/sootopolis/palettes/10.pal index 6ca963250f..01d065e528 100644 --- a/data/tilesets/secondary/sootopolis/palettes/10.pal +++ b/data/tilesets/secondary/sootopolis/palettes/10.pal @@ -1,7 +1,7 @@ JASC-PAL 0100 16 -115 197 164 +246 74 65 139 115 106 115 90 82 90 65 65 @@ -16,4 +16,4 @@ JASC-PAL 148 74 41 82 139 197 74 115 172 -0 0 0 +246 74 65 diff --git a/data/tilesets/secondary/sootopolis/palettes/10.pla b/data/tilesets/secondary/sootopolis/palettes/10.pla new file mode 100644 index 0000000000..2b4c8a150e --- /dev/null +++ b/data/tilesets/secondary/sootopolis/palettes/10.pla @@ -0,0 +1,8 @@ +# Color indices to set high bit +0 +8 +9 +10 +11 +12 +15 \ No newline at end of file diff --git a/data/tilesets/secondary/sootopolis/palettes/15.pal b/data/tilesets/secondary/sootopolis/palettes/15.pal index e7717d74ea..ee115befc9 100644 --- a/data/tilesets/secondary/sootopolis/palettes/15.pal +++ b/data/tilesets/secondary/sootopolis/palettes/15.pal @@ -1,19 +1,19 @@ JASC-PAL 0100 16 -115 197 164 -255 213 180 -255 197 148 -222 148 115 -123 65 65 -57 74 123 -41 57 98 -24 41 82 -16 32 57 -222 230 238 -255 197 90 -189 156 90 -255 98 90 -197 65 65 +0 192 0 255 255 255 -0 0 0 +238 238 213 +222 222 180 +180 180 148 +131 131 139 +98 98 123 +65 74 106 +41 49 90 +244 226 171 +221 205 143 +156 164 156 +123 131 123 +98 106 98 +82 90 82 +248 240 176 diff --git a/data/tilesets/secondary/sootopolis/tiles.png b/data/tilesets/secondary/sootopolis/tiles.png index d27c817f00..f9a6be2154 100644 Binary files a/data/tilesets/secondary/sootopolis/tiles.png and b/data/tilesets/secondary/sootopolis/tiles.png differ diff --git a/dev_scripts/followers/follower_emotions.py b/dev_scripts/followers/follower_emotions.py index 5226348031..ff04b048a0 100644 --- a/dev_scripts/followers/follower_emotions.py +++ b/dev_scripts/followers/follower_emotions.py @@ -47,4 +47,4 @@ def export_messages(infile, outfile, n=None, indent=0, start=0): if __name__ == '__main__': - export_messages('emotions.txt', 'emotions.h', n=1, start=7) + export_messages('emotions.txt', 'emotions.h', n=4, start=42) diff --git a/gflib/sprite.c b/gflib/sprite.c index 9ba1662c9d..7e0d61a7f0 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -1463,7 +1463,7 @@ u16 LoadSpriteSheet(const struct SpriteSheet *sheet) } // Like LoadSpriteSheet, but checks if already loaded, and uses template image frames -u16 LoadSpriteSheetByTemplate(const struct SpriteTemplate *template, u32 frame, s32 offset) +u16 LoadSpriteSheetByTemplateWithOffset(const struct SpriteTemplate *template, u32 frame, s32 offset) { u16 tileStart; struct SpriteSheet sheet; @@ -1477,6 +1477,20 @@ u16 LoadSpriteSheetByTemplate(const struct SpriteTemplate *template, u32 frame, sheet.tag = template->tileTag; return LoadSpriteSheetWithOffset(&sheet, offset); } +// Like LoadSpriteSheet, but checks if already, and uses template image frames +u16 LoadSpriteSheetByTemplate(const struct SpriteTemplate *template, u8 frame) { + u16 tileStart; + struct SpriteSheet tempSheet; + // error if template is null or tile tag or images not set + if (!template || template->tileTag == TAG_NONE || !template->images) + return 0xFFFF; + if ((tileStart = GetSpriteTileStartByTag(template->tileTag)) != 0xFFFF) // return if already loaded + return tileStart; + tempSheet.data = template->images[frame].data; + tempSheet.size = template->images[frame].size; + tempSheet.tag = template->tileTag; + return LoadSpriteSheet(&tempSheet); +} void LoadSpriteSheets(const struct SpriteSheet *sheets) { @@ -1594,9 +1608,16 @@ void LoadSpritePalettes(const struct SpritePalette *palettes) break; } +u8 LoadSpritePaletteInSlot(const struct SpritePalette *palette, u8 paletteNum) { + paletteNum = min(15, paletteNum); + sSpritePaletteTags[paletteNum] = palette->tag; + DoLoadSpritePalette(palette->data, paletteNum * 16); + return paletteNum; +} + void DoLoadSpritePalette(const u16 *src, u16 paletteOffset) { - LoadPalette(src, OBJ_PLTT_OFFSET + paletteOffset, PLTT_SIZE_4BPP); + LoadPaletteFast(src, paletteOffset + OBJ_PLTT_OFFSET, PLTT_SIZE_4BPP); } u8 AllocSpritePalette(u16 tag) diff --git a/gflib/sprite.h b/gflib/sprite.h index 937ed42ced..553fdb2b83 100644 --- a/gflib/sprite.h +++ b/gflib/sprite.h @@ -302,7 +302,8 @@ void FreeOamMatrix(u8 matrixNum); void InitSpriteAffineAnim(struct Sprite *sprite); void SetOamMatrixRotationScaling(u8 matrixNum, s16 xScale, s16 yScale, u16 rotation); u16 LoadSpriteSheet(const struct SpriteSheet *sheet); -u16 LoadSpriteSheetByTemplate(const struct SpriteTemplate *template, u32 frame, s32 offset); +u16 LoadSpriteSheetByTemplateWithOffset(const struct SpriteTemplate *template, u32 frame, s32 offset); +u16 LoadSpriteSheetByTemplate(const struct SpriteTemplate *template, u8 frame); void LoadSpriteSheets(const struct SpriteSheet *sheets); s16 AllocSpriteTiles(u16 tileCount); u16 AllocTilesForSpriteSheet(struct SpriteSheet *sheet); @@ -317,6 +318,7 @@ void RequestSpriteSheetCopy(const struct SpriteSheet *sheet); u16 LoadSpriteSheetDeferred(const struct SpriteSheet *sheet); void FreeAllSpritePalettes(void); u8 LoadSpritePalette(const struct SpritePalette *palette); +u8 LoadSpritePaletteInSlot(const struct SpritePalette *palette, u8 paletteNum); void LoadSpritePalettes(const struct SpritePalette *palettes); u8 AllocSpritePalette(u16 tag); u8 IndexOfSpritePaletteTag(u16 tag); diff --git a/graphics/object_events/palettes/light.pal b/graphics/object_events/palettes/light.pal new file mode 100644 index 0000000000..92a4477f76 --- /dev/null +++ b/graphics/object_events/palettes/light.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +110 198 165 +64 61 42 +77 73 50 +85 81 58 +100 94 66 +111 105 75 +119 112 77 +140 131 92 +154 145 103 +171 159 111 +186 174 123 +197 183 128 +209 195 139 +224 209 146 +234 219 155 +249 232 161 diff --git a/graphics/object_events/palettes/light2.pal b/graphics/object_events/palettes/light2.pal new file mode 100644 index 0000000000..3d61a3020d --- /dev/null +++ b/graphics/object_events/palettes/light2.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +106 202 166 +58 54 31 +67 62 33 +96 89 53 +110 102 57 +121 111 67 +128 119 66 +156 143 82 +166 155 96 +185 169 100 +199 183 112 +211 192 113 +223 203 123 +237 218 129 +247 227 137 +255 237 147 diff --git a/graphics/object_events/palettes/neon_light.pal b/graphics/object_events/palettes/neon_light.pal new file mode 100644 index 0000000000..dd287fc645 --- /dev/null +++ b/graphics/object_events/palettes/neon_light.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +104 203 168 +19 48 64 +35 87 115 +58 132 140 +69 156 166 +77 193 254 +106 239 254 +27 68 89 +64 22 19 +115 39 34 +166 57 49 +191 66 57 +222 77 67 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/object_events/pics/misc/light.png b/graphics/object_events/pics/misc/light.png index d1a0402d10..22687a7c00 100644 Binary files a/graphics/object_events/pics/misc/light.png and b/graphics/object_events/pics/misc/light.png differ diff --git a/graphics/object_events/pics/misc/mart_light.png b/graphics/object_events/pics/misc/mart_light.png new file mode 100644 index 0000000000..7ec1a434ea Binary files /dev/null and b/graphics/object_events/pics/misc/mart_light.png differ diff --git a/graphics/object_events/pics/misc/poke_center_light.png b/graphics/object_events/pics/misc/poke_center_light.png new file mode 100644 index 0000000000..42d19f51c6 Binary files /dev/null and b/graphics/object_events/pics/misc/poke_center_light.png differ diff --git a/graphics/pokemon/ampharos/normal.pla b/graphics/pokemon/ampharos/normal.pla new file mode 100644 index 0000000000..88043ac888 --- /dev/null +++ b/graphics/pokemon/ampharos/normal.pla @@ -0,0 +1,7 @@ +# Color indices to set high bit +0 +6 +11 +12 +13 +14 \ No newline at end of file diff --git a/graphics/pokemon/ampharos/shiny.pla b/graphics/pokemon/ampharos/shiny.pla new file mode 100644 index 0000000000..88043ac888 --- /dev/null +++ b/graphics/pokemon/ampharos/shiny.pla @@ -0,0 +1,7 @@ +# Color indices to set high bit +0 +6 +11 +12 +13 +14 \ No newline at end of file diff --git a/include/constants/event_objects.h b/include/constants/event_objects.h index fccc206638..bfc6fe37bc 100644 --- a/include/constants/event_objects.h +++ b/include/constants/event_objects.h @@ -242,6 +242,7 @@ #define OBJ_EVENT_GFX_HOOH 238 #define OBJ_EVENT_GFX_POKE_BALL 239 #define OBJ_EVENT_GFX_OW_MON 240 +#define OBJ_EVENT_GFX_LIGHT_SPRITE OBJ_EVENT_GFX_QUINTY_PLUMP // NOTE: The maximum amount of object events has been expanded from 255 to 65535. // Since dynamic graphics ids still require at least 16 free values, the actual limit @@ -302,6 +303,9 @@ #define OBJ_KIND_CLONE 255 // Exclusive to FRLG // Special object event local ids +// Used for link player OWs in CreateLinkPlayerSprite +#define OBJ_EVENT_ID_DYNAMIC_BASE 0xF0 + #define OBJ_EVENT_ID_PLAYER 0xFF #define OBJ_EVENT_ID_CAMERA 0x7F #define OBJ_EVENT_ID_FOLLOWER 0xFE @@ -412,7 +416,10 @@ #endif //OW_FOLLOWERS_POKEBALLS // Used as a placeholder follower graphic #define OBJ_EVENT_PAL_TAG_SUBSTITUTE 0x7611 -#define OBJ_EVENT_PAL_TAG_EMOTES 0x8002 +#define OBJ_EVENT_PAL_TAG_LIGHT 0x8001 +#define OBJ_EVENT_PAL_TAG_LIGHT_2 0x8002 +#define OBJ_EVENT_PAL_TAG_EMOTES 0x8003 +#define OBJ_EVENT_PAL_TAG_NEON_LIGHT 0x8004 // Not a real OW palette tag; used for the white flash applied to followers #define OBJ_EVENT_PAL_TAG_WHITE (OBJ_EVENT_PAL_TAG_NONE - 1) #define OBJ_EVENT_PAL_TAG_NONE 0x11FF diff --git a/include/constants/field_effects.h b/include/constants/field_effects.h index f6e6106d90..5df5a7f876 100644 --- a/include/constants/field_effects.h +++ b/include/constants/field_effects.h @@ -129,5 +129,12 @@ #define FLDEFF_PAL_TAG_SMALL_SPARKLE 0x100F #define FLDEFF_PAL_TAG_HOF_MONITOR 0x1010 #define FLDEFF_PAL_TAG_UNKNOWN 0x1011 +#define FLDEFF_PAL_TAG_FIELD_MOVE_MON 0x8400 + +// tile tags, for field effects that may have many copies on screen at once +#define FLDEFF_TILE_TAG_SHADOW_SMALL 0x1400 +#define FLDEFF_TILE_TAG_SHADOW_MEDIUM 0x1401 +#define FLDEFF_TILE_TAG_SHADOW_LARGE 0x1402 +#define FLDEFF_TILE_TAG_SHADOW_EXTRA_LARGE 0x1403 #endif // GUARD_FIELD_EFFECT_CONSTANTS_H diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 2906789b37..fdc8db48b7 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -142,13 +142,17 @@ struct Pokemon *GetFirstLiveMon(void); void UpdateFollowingPokemon(void); void RemoveFollowingPokemon(void); struct ObjectEvent *GetFollowerObject(void); +u8 GetDirectionToFace(s16, s16, s16, s16); +void UpdateLightSprite(struct Sprite *); void TrySpawnObjectEvents(s16 cameraX, s16 cameraY); +u8 CreateObjectGraphicsSpriteWithTag(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u16 paletteTag); u8 CreateObjectGraphicsSprite(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subpriority); u8 TrySpawnObjectEvent(u8 localId, u8 mapNum, u8 mapGroup); u8 SpawnSpecialObjectEventParameterized(u16 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 elevation); u8 SpawnSpecialObjectEvent(struct ObjectEventTemplate *); void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY); void CameraObjectReset(void); +u8 LoadObjectEventPalette(u16); u8 UpdateSpritePaletteByTemplate(const struct SpriteTemplate *, struct Sprite *); void ObjectEventSetGraphicsId(struct ObjectEvent *, u16 graphicsId); void ObjectEventTurn(struct ObjectEvent *, u8 direction); diff --git a/include/field_weather.h b/include/field_weather.h index 9805dc491d..edf9ced965 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -47,7 +47,8 @@ struct Weather s8 targetColorMapIndex; u8 colorMapStepDelay; u8 colorMapStepCounter; - u16 fadeDestColor; + u16 fadeDestColor:15; + u16 noShadows:1; // Certain weathers require blend coeffs that do not work nice with shadows u8 palProcessingState; u8 fadeScreenCounter; bool8 readyForInit; @@ -152,8 +153,9 @@ void ApplyWeatherColorMapIfIdle(s8 colorMapIndex); void ApplyWeatherColorMapIfIdle_Gradual(u8 colorMapIndex, u8 targetColorMapIndex, u8 colorMapStepDelay); void FadeScreen(u8 mode, s8 delay); bool8 IsWeatherNotFadingIn(void); -void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex); +void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex, bool8 allowFog); void ApplyWeatherColorMapToPal(u8 paletteIndex); +void ApplyWeatherColorMapToPals(u8 startPalIndex, u8 numPalettes); void LoadCustomWeatherSpritePalette(const u16 *palette); void ResetDroughtWeatherPaletteLoading(void); bool8 LoadDroughtWeatherPalettes(void); @@ -194,6 +196,7 @@ void Thunderstorm_Main(void); void Thunderstorm_InitAll(void); bool8 Thunderstorm_Finish(void); void FogHorizontal_InitVars(void); +u8 UpdateShadowColor(u16 color); void FogHorizontal_Main(void); void FogHorizontal_InitAll(void); bool8 FogHorizontal_Finish(void); diff --git a/include/fieldmap.h b/include/fieldmap.h index ecb1e49c4d..318e916039 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -45,7 +45,7 @@ void InitTrainerHillMap(void); void InitBattlePyramidMap(bool8 setPlayerPosition); void CopyMapTilesetsToVram(struct MapLayout const *mapLayout); void LoadMapTilesetPalettes(struct MapLayout const *mapLayout); -void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout); +void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout, bool8 skipFaded); void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout); void CopyPrimaryTilesetToVram(const struct MapLayout *); void CopySecondaryTilesetToVram(const struct MapLayout *); diff --git a/include/follower_helper.h b/include/follower_helper.h index 27bf1f700e..a909313112 100644 --- a/include/follower_helper.h +++ b/include/follower_helper.h @@ -111,6 +111,8 @@ enum { COND_MSG_LEAVES, COND_MSG_ICE, COND_MSG_BURN, + COND_MSG_DAY, + COND_MSG_NIGHT, COND_MSG_COUNT, }; diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 29249712b6..36abeeb2a2 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -37,8 +37,11 @@ typedef void (*TilesetCB)(void); struct Tileset { - /*0x00*/ bool8 isCompressed; + /*0x00*/ u8 isCompressed:1; + /*0x00*/ u8 swapPalettes:7; // bitmask determining whether palette has an alternate, night-time palette /*0x01*/ bool8 isSecondary; + /*0x02*/ u8 lightPalettes; // Bitmask determining whether a palette should be time-blended as a light + /*0x03*/ u8 customLightColor; // Bitmask determining which light palettes have custom light colors (color 15) /*0x04*/ const u32 *tiles; /*0x08*/ const u16 (*palettes)[16]; /*0x0C*/ const u16 *metatiles; @@ -188,7 +191,7 @@ struct ObjectEvent u32 inShallowFlowingWater:1; u32 inSandPile:1; u32 inHotSprings:1; - u32 hasShadow:1; + u32 noShadow:1; u32 spriteAnimPausedBackup:1; /*0x03*/ u32 spriteAffineAnimPausedBackup:1; u32 disableJumpLandingGroundEffect:1; diff --git a/include/global.h b/include/global.h index f5ada78360..88892bd60e 100644 --- a/include/global.h +++ b/include/global.h @@ -927,7 +927,7 @@ struct MysteryGiftSave struct WonderCardMetadata cardMetadata; u16 questionnaireWords[NUM_QUESTIONNAIRE_WORDS]; struct WonderNewsMetadata newsMetadata; - u32 trainerIds[2][5]; // Saved ids for 10 trainers, 5 each for battles and trades + u32 trainerIds[2][5]; // Saved ids for 10 trainers, 5 each for battles and trades }; // 0x36C 0x3598 // For external event data storage. The majority of these may have never been used. diff --git a/include/overworld.h b/include/overworld.h index bda2046ec7..0cc0ab5dce 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -40,6 +40,15 @@ struct LinkPlayerObjectEvent u8 movementMode; }; +struct __attribute__((packed)) TimeBlendSettings { + u16 weight:9; + u16 time1:3; + u16 time0:3; + u16 unused:1; + u16 altWeight; +}; + +// Exported RAM declarations extern struct WarpData gLastUsedWarp; extern struct LinkPlayerObjectEvent gLinkPlayerObjectEvents[4]; @@ -51,6 +60,10 @@ extern void (*gFieldCallback)(void); extern bool8 (*gFieldCallback2)(void); extern u8 gLocalLinkPlayerId; extern u8 gFieldLinkPlayerCount; +extern u8 gTimeOfDay; +extern u16 gTimeUpdateCounter; + +extern struct TimeBlendSettings currentTimeBlend; extern const struct UCoords32 gDirectionToVectors[]; @@ -128,6 +141,10 @@ void CleanupOverworldWindowsAndTilemaps(void); bool32 IsOverworldLinkActive(void); void CB1_Overworld(void); void CB2_OverworldBasic(void); +u8 UpdateTimeOfDay(void); +bool8 MapHasNaturalLight(u8 mapType); +void UpdateAltBgPalettes(u16 palettes); +void UpdatePalettesWithTime(u32); void CB2_Overworld(void); void SetMainCallback1(void (*cb)(void)); void SetUnusedCallback(void *func); diff --git a/include/palette.h b/include/palette.h index 13c06b0078..92735dff12 100644 --- a/include/palette.h +++ b/include/palette.h @@ -14,6 +14,8 @@ #define PALETTE_FADE_STATUS_LOADING 0xFF #define PALETTES_BG 0x0000FFFF +// like PALETTES_BG but excludes UI pals [13, 15] +#define PALETTES_MAP 0x00001FFF #define PALETTES_OBJECTS 0xFFFF0000 #define PALETTES_ALL (PALETTES_BG | PALETTES_OBJECTS) @@ -24,6 +26,11 @@ #define OBJ_PLTT_ID(n) (OBJ_PLTT_OFFSET + PLTT_ID(n)) #define OBJ_PLTT_ID2(n) (PLTT_ID((n) + 16)) +// Used to determine whether a sprite palette tag +// should be excluded from time (and weather) blending +#define BLEND_IMMUNE_FLAG (1 << 15) +#define IS_BLEND_IMMUNE_TAG(tag) ((tag) & BLEND_IMMUNE_FLAG) + enum { FAST_FADE_IN_FROM_WHITE, @@ -32,9 +39,19 @@ enum FAST_FADE_OUT_TO_BLACK, }; +struct BlendSettings { + u32 blendColor:24; + u32 isTint:1; + u32 coeff:5; +}; + struct PaletteFadeControl { - u32 multipurpose1; + u32 multipurpose1; // This field needs to exist or errors will occur + // These three are only used for TOD blending + struct BlendSettings *bld0; + struct BlendSettings *bld1; + u16 weight:9; // [0, 256], so must be 9 bits u8 delayCounter:6; u16 y:5; // blend coefficient u16 targetY:5; // target blend coefficient @@ -52,6 +69,8 @@ struct PaletteFadeControl u8 deltaY:4; // rate of change of blend coefficient }; +extern const struct BlendSettings gTimeOfDayBlend[]; + extern struct PaletteFadeControl gPaletteFade; extern u32 gPlttBufferTransferPending; extern u16 ALIGNED(4) gPlttBufferUnfaded[PLTT_BUFFER_SIZE]; @@ -59,11 +78,14 @@ extern u16 ALIGNED(4) gPlttBufferFaded[PLTT_BUFFER_SIZE]; void LoadCompressedPalette(const u32 *src, u32 offset, u32 size); void LoadPalette(const void *src, u32 offset, u32 size); +void LoadPaletteFast(const void *src, u32 offset, u32 size); void FillPalette(u32 value, u32 offset, u32 size); void TransferPlttBuffer(void); u32 UpdatePaletteFade(void); void ResetPaletteFade(void); bool32 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targetY, u32 blendColor); +bool32 BeginTimeOfDayPaletteFade(u32, s8, u8, u8, struct BlendSettings *, struct BlendSettings *, u32, u32); +void PaletteStruct_ResetById(u32 id); void ResetPaletteFadeControl(void); void InvertPlttBuffer(u32 selectedPalettes); void TintPlttBuffer(u32 selectedPalettes, s8 r, s8 g, s8 b); @@ -71,8 +93,13 @@ void UnfadePlttBuffer(u32 selectedPalettes); void BeginFastPaletteFade(u32 submode); void BeginHardwarePaletteFade(u32 blendCnt, u32 delay, u32 y, u32 targetY, u32 shouldResetBlendRegisters); void BlendPalettes(u32 selectedPalettes, u8 coeff, u32 color); +void BlendPalettesFine(u32 palettes, u16 *src, u16 *dst, u32 coeff, u32 color); void BlendPalettesUnfaded(u32 selectedPalettes, u8 coeff, u32 color); void BlendPalettesGradually(u32 selectedPalettes, s8 delay, u8 coeff, u8 coeffTarget, u16 color, u8 priority, u8 id); +void TimeBlendPalette(u16 palOffset, u32 coeff, u32 blendColor); +void TintPalette_RGB_Copy(u16 palOffset, u32 blendColor); +void TimeMixPalettes(u32, u16 *, u16 *, struct BlendSettings *, struct BlendSettings *, u16); +void AvgPaletteWeighted(u16 *src0, u16 *src1, u16 *dst, u16 weight0); void TintPalette_GrayScale(u16 *palette, u32 count); void TintPalette_GrayScale2(u16 *palette, u32 count); void TintPalette_SepiaTone(u16 *palette, u32 count); diff --git a/src/battle_transition.c b/src/battle_transition.c index b2b295e16e..d2177070f2 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1355,6 +1355,7 @@ static void InitPatternWeaveTransition(struct Task *task) sTransitionData->WIN0V = DISPLAY_HEIGHT; sTransitionData->BLDCNT = BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL; sTransitionData->BLDALPHA = BLDALPHA_BLEND(task->tBlendTarget2, task->tBlendTarget1); + UpdateShadowColor(0x3DEF); // force shadows to gray for (i = 0; i < DISPLAY_HEIGHT; i++) gScanlineEffectRegBuffers[1][i] = DISPLAY_WIDTH; @@ -3881,6 +3882,8 @@ static void VBlankCB_AngledWipes(void) #define tFadeFromGrayIncrement data[5] #define tDelayTimer data[6] #define tBlend data[7] +#define tBldCntSaved data[8] +#define tShadowColor data[9] static void CreateIntroTask(s16 fadeToGrayDelay, s16 fadeFromGrayDelay, s16 numFades, s16 fadeToGrayIncrement, s16 fadeFromGrayIncrement) { @@ -3908,17 +3911,29 @@ void Task_BattleTransition_Intro(u8 taskId) static bool8 TransitionIntro_FadeToGray(struct Task *task) { + u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START); + u16 index = (paletteNum+16)*16+9; // SHADOW_COLOR_INDEX if (task->tDelayTimer == 0 || --task->tDelayTimer == 0) { + task->tDelayTimer = task->tFadeToGrayDelay; task->tBlend += task->tFadeToGrayIncrement; if (task->tBlend > 16) task->tBlend = 16; + if (paletteNum < 16) + task->tShadowColor = gPlttBufferFaded[index]; BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11)); + if (paletteNum < 16) + gPlttBufferFaded[index] = task->tShadowColor; } if (task->tBlend >= 16) { // Fade to gray complete, start fade back + // Save BLDCNT and turn off targets temporarily + task->tBldCntSaved = GetGpuReg(REG_OFFSET_BLDCNT); + SetGpuReg(REG_OFFSET_BLDCNT, task->tBldCntSaved & ~BLDCNT_TGT2_BG_ALL); + if (paletteNum < 16) + gPlttBufferFaded[index] = RGB(11, 11, 11); task->tState++; task->tDelayTimer = task->tFadeFromGrayDelay; } @@ -3929,11 +3944,18 @@ static bool8 TransitionIntro_FadeFromGray(struct Task *task) { if (task->tDelayTimer == 0 || --task->tDelayTimer == 0) { + u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START); task->tDelayTimer = task->tFadeFromGrayDelay; task->tBlend -= task->tFadeFromGrayIncrement; if (task->tBlend < 0) task->tBlend = 0; BlendPalettes(PALETTES_ALL, task->tBlend, RGB(11, 11, 11)); + // Restore BLDCNT + SetGpuReg(REG_OFFSET_BLDCNT, task->tBldCntSaved); + if (paletteNum < 16) { + u16 index = (paletteNum+16)*16+9; // SHADOW_COLOR_INDEX + gPlttBufferFaded[index] = task->tShadowColor; + } } if (task->tBlend == 0) { @@ -4226,6 +4248,7 @@ static bool8 FrontierLogoWave_Init(struct Task *task) LZ77UnCompVram(sFrontierLogo_Tileset, tileset); LoadPalette(sFrontierLogo_Palette, BG_PLTT_ID(15), sizeof(sFrontierLogo_Palette)); sTransitionData->cameraY = 0; + UpdateShadowColor(0x3DEF); // force shadows to gray task->tState++; return FALSE; diff --git a/src/data/field_effects/field_effect_object_template_pointers.h b/src/data/field_effects/field_effect_object_template_pointers.h index 14113d3a43..6c1b3a3946 100755 --- a/src/data/field_effects/field_effect_object_template_pointers.h +++ b/src/data/field_effects/field_effect_object_template_pointers.h @@ -35,6 +35,7 @@ extern const struct SpriteTemplate gFieldEffectObjectTemplate_AshLaunch; extern const struct SpriteTemplate gFieldEffectObjectTemplate_Bubbles; extern const struct SpriteTemplate gFieldEffectObjectTemplate_SmallSparkle; extern const struct SpriteTemplate gFieldEffectObjectTemplate_Rayquaza; +extern const struct SpriteTemplate gFieldEffectObjectTemplate_BallLight; extern const struct SpriteTemplate gFieldEffectObjectTemplate_SlitherTracks; extern const struct SpriteTemplate gFieldEffectObjectTemplate_BugTracks; extern const struct SpriteTemplate gFieldEffectObjectTemplate_SpotTracks; diff --git a/src/data/field_effects/field_effect_objects.h b/src/data/field_effects/field_effect_objects.h old mode 100755 new mode 100644 index 3b9dafd2cb..afd0ca2eab --- a/src/data/field_effects/field_effect_objects.h +++ b/src/data/field_effects/field_effect_objects.h @@ -28,8 +28,48 @@ static const struct SpriteFrameImage sPicTable_ShadowExtraLarge[] = { obj_frame_tiles(gFieldEffectObjectPic_ShadowExtraLarge), }; -const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowSmall = { +const struct SpriteFrameImage gFieldEffectObjectPicTable_BallLight[] = { + obj_frame_tiles(gFieldEffectObjectPic_BallLight), +}; + +const struct SpriteFrameImage gFieldEffectObjectPicTable_PokeCenterLight[] = { + obj_frame_tiles(gFieldEffectObjectPic_PokeCenterLight), +}; + +const struct SpriteFrameImage gFieldEffectObjectPicTable_MartLight[] = { + obj_frame_tiles(gFieldEffectObjectPic_MartLight), +}; + +const struct SpriteTemplate gFieldEffectObjectTemplate_BallLight = {OBJ_EVENT_PAL_TAG_LIGHT, OBJ_EVENT_PAL_TAG_LIGHT, &gObjectEventBaseOam_32x32, sAnimTable_Inanimate, gFieldEffectObjectPicTable_BallLight, gDummySpriteAffineAnimTable, UpdateLightSprite}; + +const struct SpriteTemplate gFieldEffectObjectTemplate_PokeCenterLight = { .tileTag = TAG_NONE, + .paletteTag = OBJ_EVENT_PAL_TAG_NEON_LIGHT, + .oam = &gObjectEventBaseOam_16x16, + .anims = sAnimTable_Inanimate, + .images = gFieldEffectObjectPicTable_PokeCenterLight, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = UpdateLightSprite, +}; + +const struct SpriteTemplate gFieldEffectObjectTemplate_MartLight = { + .tileTag = TAG_NONE, + .paletteTag = OBJ_EVENT_PAL_TAG_NEON_LIGHT, + .oam = &gObjectEventBaseOam_16x16, + .anims = sAnimTable_Inanimate, + .images = gFieldEffectObjectPicTable_MartLight, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = UpdateLightSprite, +}; + +const struct SpriteTemplate *const gFieldEffectLightTemplates[] = { + &gFieldEffectObjectTemplate_BallLight, + &gFieldEffectObjectTemplate_PokeCenterLight, + &gFieldEffectObjectTemplate_MartLight, +}; + +const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowSmall = { + .tileTag = FLDEFF_TILE_TAG_SHADOW_SMALL, .paletteTag = TAG_WEATHER_START, .oam = &gObjectEventBaseOam_8x8, .anims = sAnimTable_Shadow, @@ -39,7 +79,7 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowSmall = { }; const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowMedium = { - .tileTag = TAG_NONE, + .tileTag = FLDEFF_TILE_TAG_SHADOW_MEDIUM, .paletteTag = TAG_WEATHER_START, .oam = &gObjectEventBaseOam_16x8, .anims = sAnimTable_Shadow, @@ -49,7 +89,7 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowMedium = { }; const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowLarge = { - .tileTag = TAG_NONE, + .tileTag = FLDEFF_TILE_TAG_SHADOW_LARGE, .paletteTag = TAG_WEATHER_START, .oam = &gObjectEventBaseOam_32x8, .anims = sAnimTable_Shadow, @@ -59,7 +99,7 @@ const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowLarge = { }; const struct SpriteTemplate gFieldEffectObjectTemplate_ShadowExtraLarge = { - .tileTag = TAG_NONE, + .tileTag = FLDEFF_TILE_TAG_SHADOW_EXTRA_LARGE, .paletteTag = TAG_WEATHER_START, .oam = &gObjectEventBaseOam_64x32, .anims = sAnimTable_Shadow, diff --git a/src/data/object_events/object_event_graphics.h b/src/data/object_events/object_event_graphics.h old mode 100755 new mode 100644 index 1f08b77599..2d0da76d2d --- a/src/data/object_events/object_event_graphics.h +++ b/src/data/object_events/object_event_graphics.h @@ -293,6 +293,9 @@ const u32 gFieldEffectObjectPic_ShadowSmall[] = INCBIN_U32("graphics/field_effec const u32 gFieldEffectObjectPic_ShadowMedium[] = INCBIN_U32("graphics/field_effects/pics/shadow_medium.4bpp"); const u32 gFieldEffectObjectPic_ShadowLarge[] = INCBIN_U32("graphics/field_effects/pics/shadow_large.4bpp"); const u32 gFieldEffectObjectPic_ShadowExtraLarge[] = INCBIN_U32("graphics/field_effects/pics/shadow_extra_large.4bpp"); +const u32 gFieldEffectObjectPic_BallLight[] = INCBIN_U32("graphics/object_events/pics/misc/light.4bpp"); +const u32 gFieldEffectObjectPic_PokeCenterLight[] = INCBIN_U32("graphics/object_events/pics/misc/poke_center_light.4bpp"); +const u32 gFieldEffectObjectPic_MartLight[] = INCBIN_U32("graphics/object_events/pics/misc/mart_light.4bpp"); static const u32 sFiller[0x48] = {}; const u8 gFieldEffectPic_CutGrass[] = INCBIN_U8("graphics/field_effects/pics/cut_grass.4bpp"); const u32 gFieldEffectPic_CutGrass_Copy[] = INCBIN_U32("graphics/field_effects/pics/cut_grass.4bpp"); @@ -380,9 +383,12 @@ const u32 gObjectEventPic_RayquazaCutscene[] = INCBIN_U32("graphics/object_event const u16 gObjectEventPal_HoOh[] = INCBIN_U16("graphics/object_events/palettes/ho_oh.gbapal"); const u16 gObjectEventPal_Lugia[] = INCBIN_U16("graphics/object_events/palettes/lugia.gbapal"); -const u16 gObjectEventPal_Substitute[] = INCBIN_U16("graphics/pokemon/question_mark/overworld.gbapal"); +const u16 gObjectEventPaletteLight[] = INCBIN_U16("graphics/object_events/palettes/light.gbapal"); +const u16 gObjectEventPaletteLight2[] = INCBIN_U16("graphics/object_events/palettes/light2.gbapal"); +const u16 gObjectEventPal_Substitute[] = INCBIN_U16("graphics/object_events/pics/pokemon_old/substitute.gbapal"); const u16 gObjectEventPaletteEmotes[] = INCBIN_U16("graphics/misc/emotes.gbapal"); +const u16 gObjectEventPaletteNeonLight[] = INCBIN_U16("graphics/object_events/palettes/neon_light.gbapal"); #if OW_FOLLOWERS_POKEBALLS const u32 gObjectEventPic_MasterBall[] = INCBIN_U32("graphics/object_events/pics/misc/ball_master.4bpp"); diff --git a/src/data/object_events/object_event_graphics_info.h b/src/data/object_events/object_event_graphics_info.h old mode 100755 new mode 100644 index 5b8f971a49..37fe3edaff --- a/src/data/object_events/object_event_graphics_info.h +++ b/src/data/object_events/object_event_graphics_info.h @@ -4671,3 +4671,22 @@ const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Follower = { .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, }; + +const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BallLight = { + .tileTag = TAG_NONE, + .paletteTag = OBJ_EVENT_PAL_TAG_LIGHT, + .reflectionPaletteTag = OBJ_EVENT_PAL_TAG_LIGHT_2, + .size = 512, + .width = 32, + .height = 32, + .paletteSlot = PALSLOT_NPC_1, + .shadowSize = SHADOW_SIZE_NONE, + .inanimate = TRUE, + .compressed = FALSE, + .tracks = TRACKS_NONE, + .oam = &gObjectEventBaseOam_32x32, + .subspriteTables = sOamTables_32x32, + .anims = sAnimTable_Inanimate, + .images = gFieldEffectObjectPicTable_BallLight, + .affineAnims = gDummySpriteAffineAnimTable, +}; diff --git a/src/data/object_events/object_event_graphics_info_pointers.h b/src/data/object_events/object_event_graphics_info_pointers.h old mode 100755 new mode 100644 index 60dc6997db..02ea26e402 --- a/src/data/object_events/object_event_graphics_info_pointers.h +++ b/src/data/object_events/object_event_graphics_info_pointers.h @@ -239,6 +239,7 @@ extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_HoOh; // Begin pokemon event objects extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_PokeBall; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Follower; +extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_BallLight; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Bard; extern const struct ObjectEventGraphicsInfo gObjectEventGraphicsInfo_Hipster; @@ -253,7 +254,7 @@ const struct ObjectEventGraphicsInfo *const gObjectEventGraphicsInfoPointers[NUM [OBJ_EVENT_GFX_BRENDAN_MACH_BIKE] = &gObjectEventGraphicsInfo_BrendanMachBike, [OBJ_EVENT_GFX_BRENDAN_SURFING] = &gObjectEventGraphicsInfo_BrendanSurfing, [OBJ_EVENT_GFX_BRENDAN_FIELD_MOVE] = &gObjectEventGraphicsInfo_BrendanFieldMove, - [OBJ_EVENT_GFX_QUINTY_PLUMP] = &gObjectEventGraphicsInfo_QuintyPlump, + // [OBJ_EVENT_GFX_QUINTY_PLUMP] = &gObjectEventGraphicsInfo_QuintyPlump, [OBJ_EVENT_GFX_NINJA_BOY] = &gObjectEventGraphicsInfo_NinjaBoy, [OBJ_EVENT_GFX_TWIN] = &gObjectEventGraphicsInfo_Twin, [OBJ_EVENT_GFX_BOY_1] = &gObjectEventGraphicsInfo_Boy1, @@ -490,6 +491,7 @@ const struct ObjectEventGraphicsInfo *const gObjectEventGraphicsInfoPointers[NUM [OBJ_EVENT_GFX_HOOH] = &gObjectEventGraphicsInfo_HoOh, [OBJ_EVENT_GFX_POKE_BALL] = &gObjectEventGraphicsInfo_PokeBall, [OBJ_EVENT_GFX_OW_MON] = &gObjectEventGraphicsInfo_Follower, + [OBJ_EVENT_GFX_LIGHT_SPRITE] = &gObjectEventGraphicsInfo_BallLight, }; const struct ObjectEventGraphicsInfo *const gMauvilleOldManGraphicsInfoPointers[] = { diff --git a/src/data/object_events/object_event_pic_tables.h b/src/data/object_events/object_event_pic_tables.h old mode 100755 new mode 100644 index 1fdfc6d492..c1f8fd6f1c --- a/src/data/object_events/object_event_pic_tables.h +++ b/src/data/object_events/object_event_pic_tables.h @@ -1117,8 +1117,9 @@ static const struct SpriteFrameImage sPicTable_PokeBall[] = { overworld_frame(gObjectEventPic_PokeBall, 2, 4, 0), }; -#if OW_FOLLOWERS_POKEBALLS +extern const struct SpriteFrameImage gFieldEffectObjectPicTable_BallLight[]; +#if OW_FOLLOWERS_POKEBALLS #define POKEBALL_PIC_FRAMES(name) \ overworld_frame(gObjectEventPic_##name##Ball, 2, 4, 0), \ overworld_frame(gObjectEventPic_##name##Ball, 2, 4, 1), \ diff --git a/src/data/tilesets/graphics.h b/src/data/tilesets/graphics.h index 2fdc28d213..a6ca2746bf 100644 --- a/src/data/tilesets/graphics.h +++ b/src/data/tilesets/graphics.h @@ -1,6 +1,6 @@ const u32 gTilesetTiles_Petalburg[] = INCBIN_U32("data/tilesets/secondary/petalburg/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Petalburg[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Petalburg[][16] = { INCBIN_U16("data/tilesets/secondary/petalburg/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/petalburg/palettes/01.gbapal"), @@ -22,7 +22,7 @@ const u16 gTilesetPalettes_Petalburg[][16] = const u32 gTilesetTiles_Rustboro[] = INCBIN_U32("data/tilesets/secondary/rustboro/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Rustboro[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Rustboro[][16] = { INCBIN_U16("data/tilesets/secondary/rustboro/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/rustboro/palettes/01.gbapal"), @@ -44,7 +44,7 @@ const u16 gTilesetPalettes_Rustboro[][16] = const u32 gTilesetTiles_Dewford[] = INCBIN_U32("data/tilesets/secondary/dewford/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Dewford[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Dewford[][16] = { INCBIN_U16("data/tilesets/secondary/dewford/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/dewford/palettes/01.gbapal"), @@ -66,7 +66,7 @@ const u16 gTilesetPalettes_Dewford[][16] = const u32 gTilesetTiles_Slateport[] = INCBIN_U32("data/tilesets/secondary/slateport/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Slateport[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Slateport[][16] = { INCBIN_U16("data/tilesets/secondary/slateport/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/slateport/palettes/01.gbapal"), @@ -88,7 +88,7 @@ const u16 gTilesetPalettes_Slateport[][16] = const u32 gTilesetTiles_Mauville[] = INCBIN_U32("data/tilesets/secondary/mauville/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Mauville[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Mauville[][16] = { INCBIN_U16("data/tilesets/secondary/mauville/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mauville/palettes/01.gbapal"), @@ -110,7 +110,7 @@ const u16 gTilesetPalettes_Mauville[][16] = const u32 gTilesetTiles_Lavaridge[] = INCBIN_U32("data/tilesets/secondary/lavaridge/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Lavaridge[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Lavaridge[][16] = { INCBIN_U16("data/tilesets/secondary/lavaridge/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/lavaridge/palettes/01.gbapal"), @@ -132,7 +132,7 @@ const u16 gTilesetPalettes_Lavaridge[][16] = const u32 gTilesetTiles_Fallarbor[] = INCBIN_U32("data/tilesets/secondary/fallarbor/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Fallarbor[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Fallarbor[][16] = { INCBIN_U16("data/tilesets/secondary/fallarbor/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/fallarbor/palettes/01.gbapal"), @@ -154,7 +154,7 @@ const u16 gTilesetPalettes_Fallarbor[][16] = const u32 gTilesetTiles_Fortree[] = INCBIN_U32("data/tilesets/secondary/fortree/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Fortree[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Fortree[][16] = { INCBIN_U16("data/tilesets/secondary/fortree/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/fortree/palettes/01.gbapal"), @@ -176,7 +176,7 @@ const u16 gTilesetPalettes_Fortree[][16] = const u32 gTilesetTiles_Lilycove[] = INCBIN_U32("data/tilesets/secondary/lilycove/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Lilycove[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Lilycove[][16] = { INCBIN_U16("data/tilesets/secondary/lilycove/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/lilycove/palettes/01.gbapal"), @@ -198,7 +198,7 @@ const u16 gTilesetPalettes_Lilycove[][16] = const u32 gTilesetTiles_Mossdeep[] = INCBIN_U32("data/tilesets/secondary/mossdeep/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Mossdeep[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Mossdeep[][16] = { INCBIN_U16("data/tilesets/secondary/mossdeep/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mossdeep/palettes/01.gbapal"), @@ -220,7 +220,7 @@ const u16 gTilesetPalettes_Mossdeep[][16] = const u32 gTilesetTiles_EverGrande[] = INCBIN_U32("data/tilesets/secondary/ever_grande/tiles.4bpp.lz"); -const u16 gTilesetPalettes_EverGrande[][16] = +const u16 ALIGNED(4) gTilesetPalettes_EverGrande[][16] = { INCBIN_U16("data/tilesets/secondary/ever_grande/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/ever_grande/palettes/01.gbapal"), @@ -242,7 +242,7 @@ const u16 gTilesetPalettes_EverGrande[][16] = const u32 gTilesetTiles_Pacifidlog[] = INCBIN_U32("data/tilesets/secondary/pacifidlog/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Pacifidlog[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Pacifidlog[][16] = { INCBIN_U16("data/tilesets/secondary/pacifidlog/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/pacifidlog/palettes/01.gbapal"), @@ -264,7 +264,7 @@ const u16 gTilesetPalettes_Pacifidlog[][16] = const u32 gTilesetTiles_Sootopolis[] = INCBIN_U32("data/tilesets/secondary/sootopolis/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Sootopolis[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Sootopolis[][16] = { INCBIN_U16("data/tilesets/secondary/sootopolis/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/sootopolis/palettes/01.gbapal"), @@ -286,7 +286,7 @@ const u16 gTilesetPalettes_Sootopolis[][16] = const u32 gTilesetTiles_BattleFrontierOutsideWest[] = INCBIN_U32("data/tilesets/secondary/battle_frontier_outside_west/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleFrontierOutsideWest[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleFrontierOutsideWest[][16] = { INCBIN_U16("data/tilesets/secondary/battle_frontier_outside_west/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_frontier_outside_west/palettes/01.gbapal"), @@ -308,7 +308,7 @@ const u16 gTilesetPalettes_BattleFrontierOutsideWest[][16] = const u32 gTilesetTiles_BattleFrontierOutsideEast[] = INCBIN_U32("data/tilesets/secondary/battle_frontier_outside_east/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleFrontierOutsideEast[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleFrontierOutsideEast[][16] = { INCBIN_U16("data/tilesets/secondary/battle_frontier_outside_east/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_frontier_outside_east/palettes/01.gbapal"), @@ -330,7 +330,7 @@ const u16 gTilesetPalettes_BattleFrontierOutsideEast[][16] = const u32 gTilesetTiles_InsideBuilding[] = INCBIN_U32("data/tilesets/primary/building/tiles.4bpp.lz"); -const u16 gTilesetPalettes_InsideBuilding[][16] = +const u16 ALIGNED(4) gTilesetPalettes_InsideBuilding[][16] = { INCBIN_U16("data/tilesets/primary/building/palettes/00.gbapal"), INCBIN_U16("data/tilesets/primary/building/palettes/01.gbapal"), @@ -352,7 +352,7 @@ const u16 gTilesetPalettes_InsideBuilding[][16] = const u32 gTilesetTiles_Shop[] = INCBIN_U32("data/tilesets/secondary/shop/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Shop[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Shop[][16] = { INCBIN_U16("data/tilesets/secondary/shop/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/shop/palettes/01.gbapal"), @@ -374,7 +374,7 @@ const u16 gTilesetPalettes_Shop[][16] = const u32 gTilesetTiles_PokemonCenter[] = INCBIN_U32("data/tilesets/secondary/pokemon_center/tiles.4bpp.lz"); -const u16 gTilesetPalettes_PokemonCenter[][16] = +const u16 ALIGNED(4) gTilesetPalettes_PokemonCenter[][16] = { INCBIN_U16("data/tilesets/secondary/pokemon_center/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/pokemon_center/palettes/01.gbapal"), @@ -396,7 +396,7 @@ const u16 gTilesetPalettes_PokemonCenter[][16] = const u32 gTilesetTiles_Cave[] = INCBIN_U32("data/tilesets/secondary/cave/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Cave[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Cave[][16] = { INCBIN_U16("data/tilesets/secondary/cave/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/cave/palettes/01.gbapal"), @@ -418,7 +418,7 @@ const u16 gTilesetPalettes_Cave[][16] = const u32 gTilesetTiles_PokemonSchool[] = INCBIN_U32("data/tilesets/secondary/pokemon_school/tiles.4bpp.lz"); -const u16 gTilesetPalettes_PokemonSchool[][16] = +const u16 ALIGNED(4) gTilesetPalettes_PokemonSchool[][16] = { INCBIN_U16("data/tilesets/secondary/pokemon_school/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/pokemon_school/palettes/01.gbapal"), @@ -440,7 +440,7 @@ const u16 gTilesetPalettes_PokemonSchool[][16] = const u32 gTilesetTiles_PokemonFanClub[] = INCBIN_U32("data/tilesets/secondary/pokemon_fan_club/tiles.4bpp.lz"); -const u16 gTilesetPalettes_PokemonFanClub[][16] = +const u16 ALIGNED(4) gTilesetPalettes_PokemonFanClub[][16] = { INCBIN_U16("data/tilesets/secondary/pokemon_fan_club/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/pokemon_fan_club/palettes/01.gbapal"), @@ -462,7 +462,7 @@ const u16 gTilesetPalettes_PokemonFanClub[][16] = const u32 gTilesetTiles_Unused1[] = INCBIN_U32("data/tilesets/secondary/unused_1/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Unused1[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Unused1[][16] = { INCBIN_U16("data/tilesets/secondary/unused_1/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/unused_1/palettes/01.gbapal"), @@ -484,7 +484,7 @@ const u16 gTilesetPalettes_Unused1[][16] = const u32 gTilesetTiles_MeteorFalls[] = INCBIN_U32("data/tilesets/secondary/meteor_falls/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MeteorFalls[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MeteorFalls[][16] = { INCBIN_U16("data/tilesets/secondary/meteor_falls/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/meteor_falls/palettes/01.gbapal"), @@ -506,7 +506,7 @@ const u16 gTilesetPalettes_MeteorFalls[][16] = const u32 gTilesetTiles_OceanicMuseum[] = INCBIN_U32("data/tilesets/secondary/oceanic_museum/tiles.4bpp.lz"); -const u16 gTilesetPalettes_OceanicMuseum[][16] = +const u16 ALIGNED(4) gTilesetPalettes_OceanicMuseum[][16] = { INCBIN_U16("data/tilesets/secondary/oceanic_museum/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/oceanic_museum/palettes/01.gbapal"), @@ -529,7 +529,7 @@ const u16 gTilesetPalettes_OceanicMuseum[][16] = const u32 gTilesetTiles_CableClub[] = INCBIN_U32("data/tilesets/secondary/cable_club/tiles.4bpp"); const u32 gTilesetTiles_UnknownCableClub[] = INCBIN_U32("data/tilesets/secondary/cable_club/unknown_tiles.4bpp"); -const u16 gTilesetPalettes_CableClub[][16] = +const u16 ALIGNED(4) gTilesetPalettes_CableClub[][16] = { INCBIN_U16("data/tilesets/secondary/cable_club/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/cable_club/palettes/01.gbapal"), @@ -551,7 +551,7 @@ const u16 gTilesetPalettes_CableClub[][16] = const u32 gTilesetTiles_SeashoreHouse[] = INCBIN_U32("data/tilesets/secondary/seashore_house/tiles.4bpp.lz"); -const u16 gTilesetPalettes_SeashoreHouse[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SeashoreHouse[][16] = { INCBIN_U16("data/tilesets/secondary/seashore_house/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/seashore_house/palettes/01.gbapal"), @@ -573,7 +573,7 @@ const u16 gTilesetPalettes_SeashoreHouse[][16] = const u32 gTilesetTiles_PrettyPetalFlowerShop[] = INCBIN_U32("data/tilesets/secondary/pretty_petal_flower_shop/tiles.4bpp.lz"); -const u16 gTilesetPalettes_PrettyPetalFlowerShop[][16] = +const u16 ALIGNED(4) gTilesetPalettes_PrettyPetalFlowerShop[][16] = { INCBIN_U16("data/tilesets/secondary/pretty_petal_flower_shop/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/pretty_petal_flower_shop/palettes/01.gbapal"), @@ -595,7 +595,7 @@ const u16 gTilesetPalettes_PrettyPetalFlowerShop[][16] = const u32 gTilesetTiles_PokemonDayCare[] = INCBIN_U32("data/tilesets/secondary/pokemon_day_care/tiles.4bpp.lz"); -const u16 gTilesetPalettes_PokemonDayCare[][16] = +const u16 ALIGNED(4) gTilesetPalettes_PokemonDayCare[][16] = { INCBIN_U16("data/tilesets/secondary/pokemon_day_care/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/pokemon_day_care/palettes/01.gbapal"), @@ -617,7 +617,7 @@ const u16 gTilesetPalettes_PokemonDayCare[][16] = const u32 gTilesetTiles_Facility[] = INCBIN_U32("data/tilesets/secondary/facility/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Facility[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Facility[][16] = { INCBIN_U16("data/tilesets/secondary/facility/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/facility/palettes/01.gbapal"), @@ -639,7 +639,7 @@ const u16 gTilesetPalettes_Facility[][16] = const u32 gTilesetTiles_BikeShop[] = INCBIN_U32("data/tilesets/secondary/bike_shop/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BikeShop[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BikeShop[][16] = { INCBIN_U16("data/tilesets/secondary/bike_shop/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/bike_shop/palettes/01.gbapal"), @@ -661,7 +661,7 @@ const u16 gTilesetPalettes_BikeShop[][16] = const u32 gTilesetTiles_RusturfTunnel[] = INCBIN_U32("data/tilesets/secondary/rusturf_tunnel/tiles.4bpp.lz"); -const u16 gTilesetPalettes_RusturfTunnel[][16] = +const u16 ALIGNED(4) gTilesetPalettes_RusturfTunnel[][16] = { INCBIN_U16("data/tilesets/secondary/rusturf_tunnel/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/rusturf_tunnel/palettes/01.gbapal"), @@ -683,7 +683,7 @@ const u16 gTilesetPalettes_RusturfTunnel[][16] = const u32 gTilesetTiles_SecretBaseBrownCaveCompressed[] = INCBIN_U32("data/tilesets/secondary/secret_base/brown_cave/unused_tiles.4bpp.lz"); -const u16 gTilesetPalettes_SecretBaseBrownCave[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBaseBrownCave[][16] = { INCBIN_U16("data/tilesets/secondary/secret_base/brown_cave/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/secret_base/brown_cave/palettes/01.gbapal"), @@ -705,7 +705,7 @@ const u16 gTilesetPalettes_SecretBaseBrownCave[][16] = const u32 gTilesetTiles_SecretBaseTreeCompressed[] = INCBIN_U32("data/tilesets/secondary/secret_base/tree/unused_tiles.4bpp.lz"); -const u16 gTilesetPalettes_SecretBaseTree[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBaseTree[][16] = { INCBIN_U16("data/tilesets/secondary/secret_base/tree/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/secret_base/tree/palettes/01.gbapal"), @@ -727,7 +727,7 @@ const u16 gTilesetPalettes_SecretBaseTree[][16] = const u32 gTilesetTiles_SecretBaseShrubCompressed[] = INCBIN_U32("data/tilesets/secondary/secret_base/shrub/unused_tiles.4bpp.lz"); -const u16 gTilesetPalettes_SecretBaseShrub[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBaseShrub[][16] = { INCBIN_U16("data/tilesets/secondary/secret_base/shrub/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/secret_base/shrub/palettes/01.gbapal"), @@ -749,7 +749,7 @@ const u16 gTilesetPalettes_SecretBaseShrub[][16] = const u32 gTilesetTiles_SecretBaseBlueCaveCompressed[] = INCBIN_U32("data/tilesets/secondary/secret_base/blue_cave/unused_tiles.4bpp.lz"); -const u16 gTilesetPalettes_SecretBaseBlueCave[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBaseBlueCave[][16] = { INCBIN_U16("data/tilesets/secondary/secret_base/blue_cave/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/secret_base/blue_cave/palettes/01.gbapal"), @@ -771,7 +771,7 @@ const u16 gTilesetPalettes_SecretBaseBlueCave[][16] = const u32 gTilesetTiles_SecretBaseYellowCaveCompressed[] = INCBIN_U32("data/tilesets/secondary/secret_base/yellow_cave/unused_tiles.4bpp.lz"); -const u16 gTilesetPalettes_SecretBaseYellowCave[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBaseYellowCave[][16] = { INCBIN_U16("data/tilesets/secondary/secret_base/yellow_cave/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/secret_base/yellow_cave/palettes/01.gbapal"), @@ -793,7 +793,7 @@ const u16 gTilesetPalettes_SecretBaseYellowCave[][16] = const u32 gTilesetTiles_SecretBaseRedCaveCompressed[] = INCBIN_U32("data/tilesets/secondary/secret_base/red_cave/unused_tiles.4bpp.lz"); -const u16 gTilesetPalettes_SecretBaseRedCave[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBaseRedCave[][16] = { INCBIN_U16("data/tilesets/secondary/secret_base/red_cave/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/secret_base/red_cave/palettes/01.gbapal"), @@ -822,7 +822,7 @@ const u32 gTilesetTiles_SecretBaseRedCave[] = INCBIN_U32("data/tilesets/secondar const u32 gTilesetTiles_InsideOfTruck[] = INCBIN_U32("data/tilesets/secondary/inside_of_truck/tiles.4bpp.lz"); -const u16 gTilesetPalettes_InsideOfTruck[][16] = +const u16 ALIGNED(4) gTilesetPalettes_InsideOfTruck[][16] = { INCBIN_U16("data/tilesets/secondary/inside_of_truck/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/inside_of_truck/palettes/01.gbapal"), @@ -844,7 +844,7 @@ const u16 gTilesetPalettes_InsideOfTruck[][16] = const u32 gTilesetTiles_Contest[] = INCBIN_U32("data/tilesets/secondary/contest/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Contest[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Contest[][16] = { INCBIN_U16("data/tilesets/secondary/contest/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/contest/palettes/01.gbapal"), @@ -866,7 +866,7 @@ const u16 gTilesetPalettes_Contest[][16] = const u32 gTilesetTiles_LilycoveMuseum[] = INCBIN_U32("data/tilesets/secondary/lilycove_museum/tiles.4bpp.lz"); -const u16 gTilesetPalettes_LilycoveMuseum[][16] = +const u16 ALIGNED(4) gTilesetPalettes_LilycoveMuseum[][16] = { INCBIN_U16("data/tilesets/secondary/lilycove_museum/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/lilycove_museum/palettes/01.gbapal"), @@ -888,7 +888,7 @@ const u16 gTilesetPalettes_LilycoveMuseum[][16] = const u32 gTilesetTiles_BrendansMaysHouse[] = INCBIN_U32("data/tilesets/secondary/brendans_mays_house/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BrendansMaysHouse[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BrendansMaysHouse[][16] = { INCBIN_U16("data/tilesets/secondary/brendans_mays_house/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/brendans_mays_house/palettes/01.gbapal"), @@ -910,7 +910,7 @@ const u16 gTilesetPalettes_BrendansMaysHouse[][16] = const u32 gTilesetTiles_Lab[] = INCBIN_U32("data/tilesets/secondary/lab/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Lab[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Lab[][16] = { INCBIN_U16("data/tilesets/secondary/lab/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/lab/palettes/01.gbapal"), @@ -932,7 +932,7 @@ const u16 gTilesetPalettes_Lab[][16] = const u32 gTilesetTiles_Underwater[] = INCBIN_U32("data/tilesets/secondary/underwater/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Underwater[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Underwater[][16] = { INCBIN_U16("data/tilesets/secondary/underwater/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/underwater/palettes/01.gbapal"), @@ -954,7 +954,7 @@ const u16 gTilesetPalettes_Underwater[][16] = const u32 gTilesetTiles_GenericBuilding[] = INCBIN_U32("data/tilesets/secondary/generic_building/tiles.4bpp.lz"); -const u16 gTilesetPalettes_GenericBuilding[][16] = +const u16 ALIGNED(4) gTilesetPalettes_GenericBuilding[][16] = { INCBIN_U16("data/tilesets/secondary/generic_building/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/generic_building/palettes/01.gbapal"), @@ -976,7 +976,7 @@ const u16 gTilesetPalettes_GenericBuilding[][16] = const u32 gTilesetTiles_MauvilleGameCorner[] = INCBIN_U32("data/tilesets/secondary/mauville_game_corner/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MauvilleGameCorner[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MauvilleGameCorner[][16] = { INCBIN_U16("data/tilesets/secondary/mauville_game_corner/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mauville_game_corner/palettes/01.gbapal"), @@ -998,7 +998,7 @@ const u16 gTilesetPalettes_MauvilleGameCorner[][16] = const u32 gTilesetTiles_Unused2[] = INCBIN_U32("data/tilesets/secondary/unused_2/tiles.4bpp.lz"); -const u16 gTilesetPalettes_Unused2[][16] = +const u16 ALIGNED(4) gTilesetPalettes_Unused2[][16] = { INCBIN_U16("data/tilesets/secondary/unused_2/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/unused_2/palettes/01.gbapal"), @@ -1020,7 +1020,7 @@ const u16 gTilesetPalettes_Unused2[][16] = const u32 gTilesetTiles_RustboroGym[] = INCBIN_U32("data/tilesets/secondary/rustboro_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_RustboroGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_RustboroGym[][16] = { INCBIN_U16("data/tilesets/secondary/rustboro_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/rustboro_gym/palettes/01.gbapal"), @@ -1042,7 +1042,7 @@ const u16 gTilesetPalettes_RustboroGym[][16] = const u32 gTilesetTiles_DewfordGym[] = INCBIN_U32("data/tilesets/secondary/dewford_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_DewfordGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_DewfordGym[][16] = { INCBIN_U16("data/tilesets/secondary/dewford_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/dewford_gym/palettes/01.gbapal"), @@ -1064,7 +1064,7 @@ const u16 gTilesetPalettes_DewfordGym[][16] = const u32 gTilesetTiles_MauvilleGym[] = INCBIN_U32("data/tilesets/secondary/mauville_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MauvilleGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MauvilleGym[][16] = { INCBIN_U16("data/tilesets/secondary/mauville_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mauville_gym/palettes/01.gbapal"), @@ -1086,7 +1086,7 @@ const u16 gTilesetPalettes_MauvilleGym[][16] = const u32 gTilesetTiles_LavaridgeGym[] = INCBIN_U32("data/tilesets/secondary/lavaridge_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_LavaridgeGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_LavaridgeGym[][16] = { INCBIN_U16("data/tilesets/secondary/lavaridge_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/lavaridge_gym/palettes/01.gbapal"), @@ -1108,7 +1108,7 @@ const u16 gTilesetPalettes_LavaridgeGym[][16] = const u32 gTilesetTiles_PetalburgGym[] = INCBIN_U32("data/tilesets/secondary/petalburg_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_PetalburgGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_PetalburgGym[][16] = { INCBIN_U16("data/tilesets/secondary/petalburg_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/petalburg_gym/palettes/01.gbapal"), @@ -1130,7 +1130,7 @@ const u16 gTilesetPalettes_PetalburgGym[][16] = const u32 gTilesetTiles_FortreeGym[] = INCBIN_U32("data/tilesets/secondary/fortree_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_FortreeGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_FortreeGym[][16] = { INCBIN_U16("data/tilesets/secondary/fortree_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/fortree_gym/palettes/01.gbapal"), @@ -1152,7 +1152,7 @@ const u16 gTilesetPalettes_FortreeGym[][16] = const u32 gTilesetTiles_MossdeepGym[] = INCBIN_U32("data/tilesets/secondary/mossdeep_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MossdeepGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MossdeepGym[][16] = { INCBIN_U16("data/tilesets/secondary/mossdeep_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mossdeep_gym/palettes/01.gbapal"), @@ -1174,7 +1174,7 @@ const u16 gTilesetPalettes_MossdeepGym[][16] = const u32 gTilesetTiles_SootopolisGym[] = INCBIN_U32("data/tilesets/secondary/sootopolis_gym/tiles.4bpp.lz"); -const u16 gTilesetPalettes_SootopolisGym[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SootopolisGym[][16] = { INCBIN_U16("data/tilesets/secondary/sootopolis_gym/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/sootopolis_gym/palettes/01.gbapal"), @@ -1196,7 +1196,7 @@ const u16 gTilesetPalettes_SootopolisGym[][16] = const u32 gTilesetTiles_TrickHousePuzzle[] = INCBIN_U32("data/tilesets/secondary/trick_house_puzzle/tiles.4bpp.lz"); -const u16 gTilesetPalettes_TrickHousePuzzle[][16] = +const u16 ALIGNED(4) gTilesetPalettes_TrickHousePuzzle[][16] = { INCBIN_U16("data/tilesets/secondary/trick_house_puzzle/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/trick_house_puzzle/palettes/01.gbapal"), @@ -1218,7 +1218,7 @@ const u16 gTilesetPalettes_TrickHousePuzzle[][16] = const u32 gTilesetTiles_InsideShip[] = INCBIN_U32("data/tilesets/secondary/inside_ship/tiles.4bpp.lz"); -const u16 gTilesetPalettes_InsideShip[][16] = +const u16 ALIGNED(4) gTilesetPalettes_InsideShip[][16] = { INCBIN_U16("data/tilesets/secondary/inside_ship/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/inside_ship/palettes/01.gbapal"), @@ -1241,7 +1241,7 @@ const u16 gTilesetPalettes_InsideShip[][16] = const u32 gTilesetTiles_SecretBase[] = INCBIN_U32("data/tilesets/primary/secret_base/tiles.4bpp"); const u32 gTilesetTiles_UnknownSecretBase[] = INCBIN_U32("data/tilesets/primary/secret_base/unknown_tiles.4bpp"); -const u16 gTilesetPalettes_SecretBase[][16] = +const u16 ALIGNED(4) gTilesetPalettes_SecretBase[][16] = { INCBIN_U16("data/tilesets/primary/secret_base/palettes/00.gbapal"), INCBIN_U16("data/tilesets/primary/secret_base/palettes/01.gbapal"), @@ -1263,7 +1263,7 @@ const u16 gTilesetPalettes_SecretBase[][16] = const u32 gTilesetTiles_EliteFour[] = INCBIN_U32("data/tilesets/secondary/elite_four/tiles.4bpp.lz"); -const u16 gTilesetPalettes_EliteFour[][16] = +const u16 ALIGNED(4) gTilesetPalettes_EliteFour[][16] = { INCBIN_U16("data/tilesets/secondary/elite_four/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/elite_four/palettes/01.gbapal"), @@ -1285,7 +1285,7 @@ const u16 gTilesetPalettes_EliteFour[][16] = const u32 gTilesetTiles_BattleFrontier[] = INCBIN_U32("data/tilesets/secondary/battle_frontier/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleFrontier[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleFrontier[][16] = { INCBIN_U16("data/tilesets/secondary/battle_frontier/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_frontier/palettes/01.gbapal"), @@ -1307,7 +1307,7 @@ const u16 gTilesetPalettes_BattleFrontier[][16] = const u32 gTilesetTiles_BattlePalace[] = INCBIN_U32("data/tilesets/secondary/battle_palace/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattlePalace[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattlePalace[][16] = { INCBIN_U16("data/tilesets/secondary/battle_palace/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_palace/palettes/01.gbapal"), @@ -1329,7 +1329,7 @@ const u16 gTilesetPalettes_BattlePalace[][16] = const u32 gTilesetTiles_BattleDome[] = INCBIN_U32("data/tilesets/secondary/battle_dome/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleDome[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleDome[][16] = { INCBIN_U16("data/tilesets/secondary/battle_dome/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_dome/palettes/01.gbapal"), @@ -1351,7 +1351,7 @@ const u16 gTilesetPalettes_BattleDome[][16] = const u32 gTilesetTiles_BattleFactory[] = INCBIN_U32("data/tilesets/secondary/battle_factory/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleFactory[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleFactory[][16] = { INCBIN_U16("data/tilesets/secondary/battle_factory/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_factory/palettes/01.gbapal"), @@ -1373,7 +1373,7 @@ const u16 gTilesetPalettes_BattleFactory[][16] = const u32 gTilesetTiles_BattlePike[] = INCBIN_U32("data/tilesets/secondary/battle_pike/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattlePike[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattlePike[][16] = { INCBIN_U16("data/tilesets/secondary/battle_pike/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_pike/palettes/01.gbapal"), @@ -1395,7 +1395,7 @@ const u16 gTilesetPalettes_BattlePike[][16] = const u32 gTilesetTiles_BattleArena[] = INCBIN_U32("data/tilesets/secondary/battle_arena/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleArena[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleArena[][16] = { INCBIN_U16("data/tilesets/secondary/battle_arena/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_arena/palettes/01.gbapal"), @@ -1417,7 +1417,7 @@ const u16 gTilesetPalettes_BattleArena[][16] = const u32 gTilesetTiles_BattlePyramid[] = INCBIN_U32("data/tilesets/secondary/battle_pyramid/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattlePyramid[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattlePyramid[][16] = { INCBIN_U16("data/tilesets/secondary/battle_pyramid/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_pyramid/palettes/01.gbapal"), @@ -1439,7 +1439,7 @@ const u16 gTilesetPalettes_BattlePyramid[][16] = const u32 gTilesetTiles_MirageTower[] = INCBIN_U32("data/tilesets/secondary/mirage_tower/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MirageTower[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MirageTower[][16] = { INCBIN_U16("data/tilesets/secondary/mirage_tower/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mirage_tower/palettes/01.gbapal"), @@ -1461,7 +1461,7 @@ const u16 gTilesetPalettes_MirageTower[][16] = const u32 gTilesetTiles_MossdeepGameCorner[] = INCBIN_U32("data/tilesets/secondary/mossdeep_game_corner/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MossdeepGameCorner[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MossdeepGameCorner[][16] = { INCBIN_U16("data/tilesets/secondary/mossdeep_game_corner/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mossdeep_game_corner/palettes/01.gbapal"), @@ -1483,7 +1483,7 @@ const u16 gTilesetPalettes_MossdeepGameCorner[][16] = const u32 gTilesetTiles_IslandHarbor[] = INCBIN_U32("data/tilesets/secondary/island_harbor/tiles.4bpp.lz"); -const u16 gTilesetPalettes_IslandHarbor[][16] = +const u16 ALIGNED(4) gTilesetPalettes_IslandHarbor[][16] = { INCBIN_U16("data/tilesets/secondary/island_harbor/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/island_harbor/palettes/01.gbapal"), @@ -1505,7 +1505,7 @@ const u16 gTilesetPalettes_IslandHarbor[][16] = const u32 gTilesetTiles_TrainerHill[] = INCBIN_U32("data/tilesets/secondary/trainer_hill/tiles.4bpp.lz"); -const u16 gTilesetPalettes_TrainerHill[][16] = +const u16 ALIGNED(4) gTilesetPalettes_TrainerHill[][16] = { INCBIN_U16("data/tilesets/secondary/trainer_hill/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/trainer_hill/palettes/01.gbapal"), @@ -1527,7 +1527,7 @@ const u16 gTilesetPalettes_TrainerHill[][16] = const u32 gTilesetTiles_NavelRock[] = INCBIN_U32("data/tilesets/secondary/navel_rock/tiles.4bpp.lz"); -const u16 gTilesetPalettes_NavelRock[][16] = +const u16 ALIGNED(4) gTilesetPalettes_NavelRock[][16] = { INCBIN_U16("data/tilesets/secondary/navel_rock/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/navel_rock/palettes/01.gbapal"), @@ -1549,7 +1549,7 @@ const u16 gTilesetPalettes_NavelRock[][16] = const u32 gTilesetTiles_BattleFrontierRankingHall[] = INCBIN_U32("data/tilesets/secondary/battle_frontier_ranking_hall/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleFrontierRankingHall[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleFrontierRankingHall[][16] = { INCBIN_U16("data/tilesets/secondary/battle_frontier_ranking_hall/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_frontier_ranking_hall/palettes/01.gbapal"), @@ -1571,7 +1571,7 @@ const u16 gTilesetPalettes_BattleFrontierRankingHall[][16] = const u32 gTilesetTiles_BattleTent[] = INCBIN_U32("data/tilesets/secondary/battle_tent/tiles.4bpp.lz"); -const u16 gTilesetPalettes_BattleTent[][16] = +const u16 ALIGNED(4) gTilesetPalettes_BattleTent[][16] = { INCBIN_U16("data/tilesets/secondary/battle_tent/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/battle_tent/palettes/01.gbapal"), @@ -1593,7 +1593,7 @@ const u16 gTilesetPalettes_BattleTent[][16] = const u32 gTilesetTiles_MysteryEventsHouse[] = INCBIN_U32("data/tilesets/secondary/mystery_events_house/tiles.4bpp.lz"); -const u16 gTilesetPalettes_MysteryEventsHouse[][16] = +const u16 ALIGNED(4) gTilesetPalettes_MysteryEventsHouse[][16] = { INCBIN_U16("data/tilesets/secondary/mystery_events_house/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/mystery_events_house/palettes/01.gbapal"), @@ -1613,7 +1613,7 @@ const u16 gTilesetPalettes_MysteryEventsHouse[][16] = INCBIN_U16("data/tilesets/secondary/mystery_events_house/palettes/15.gbapal"), }; -const u16 gTilesetPalettes_UnionRoom[][16] = +const u16 ALIGNED(4) gTilesetPalettes_UnionRoom[][16] = { INCBIN_U16("data/tilesets/secondary/union_room/palettes/00.gbapal"), INCBIN_U16("data/tilesets/secondary/union_room/palettes/01.gbapal"), diff --git a/src/data/tilesets/headers.h b/src/data/tilesets/headers.h index 2eae1be1ea..4144369af8 100644 --- a/src/data/tilesets/headers.h +++ b/src/data/tilesets/headers.h @@ -1,6 +1,22 @@ +#include "fieldmap.h" + +// Whether a palette has a night version, located at ((x + 9) % 16).pal +#define SWAP_PAL(x) ((x) < NUM_PALS_IN_PRIMARY ? 1 << (x) : 1 << ((x) - NUM_PALS_IN_PRIMARY)) + +// NOTE: Instead of using LIGHT_PAL, +// consider taking a look at the .pla files +// to mark colors as lights, instead. +// The old method *should* still work, however. +// See the README for details. + +// Whether a palette has lights +// the color indices to blend are stored in the palette's color 0 +#define LIGHT_PAL(x) ((x) < NUM_PALS_IN_PRIMARY ? 1 << (x) : 1 << ((x) - NUM_PALS_IN_PRIMARY)) + const struct Tileset gTileset_General = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(4), .isSecondary = FALSE, .tiles = gTilesetTiles_General, .palettes = gTilesetPalettes_General, @@ -12,6 +28,7 @@ const struct Tileset gTileset_General = const struct Tileset gTileset_Petalburg = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(9), .isSecondary = TRUE, .tiles = gTilesetTiles_Petalburg, .palettes = gTilesetPalettes_Petalburg, @@ -45,6 +62,7 @@ const struct Tileset gTileset_Dewford = const struct Tileset gTileset_Slateport = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(6), .isSecondary = TRUE, .tiles = gTilesetTiles_Slateport, .palettes = gTilesetPalettes_Slateport, @@ -78,6 +96,7 @@ const struct Tileset gTileset_Lavaridge = const struct Tileset gTileset_Fallarbor = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(7), .isSecondary = TRUE, .tiles = gTilesetTiles_Fallarbor, .palettes = gTilesetPalettes_Fallarbor, @@ -100,6 +119,7 @@ const struct Tileset gTileset_Fortree = const struct Tileset gTileset_Lilycove = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(6), .isSecondary = TRUE, .tiles = gTilesetTiles_Lilycove, .palettes = gTilesetPalettes_Lilycove, @@ -111,6 +131,7 @@ const struct Tileset gTileset_Lilycove = const struct Tileset gTileset_Mossdeep = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(8), .isSecondary = TRUE, .tiles = gTilesetTiles_Mossdeep, .palettes = gTilesetPalettes_Mossdeep, @@ -128,11 +149,13 @@ const struct Tileset gTileset_EverGrande = .metatiles = gMetatiles_EverGrande, .metatileAttributes = gMetatileAttributes_EverGrande, .callback = InitTilesetAnim_EverGrande, + .swapPalettes = SWAP_PAL(8), }; const struct Tileset gTileset_Pacifidlog = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(9), .isSecondary = TRUE, .tiles = gTilesetTiles_Pacifidlog, .palettes = gTilesetPalettes_Pacifidlog, @@ -144,6 +167,7 @@ const struct Tileset gTileset_Pacifidlog = const struct Tileset gTileset_Sootopolis = { .isCompressed = TRUE, + .swapPalettes = SWAP_PAL(6), .isSecondary = TRUE, .tiles = gTilesetTiles_Sootopolis, .palettes = gTilesetPalettes_Sootopolis, diff --git a/src/decoration.c b/src/decoration.c index d450ad7dfb..75f6224d78 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -2132,7 +2132,7 @@ static u8 AddDecorationIconObjectFromObjectEvent(u16 tilesTag, u16 paletteTag, u } else { - spriteId = CreateObjectGraphicsSprite(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1); + spriteId = CreateObjectGraphicsSpriteWithTag(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0], SpriteCallbackDummy, 0, 0, 1, paletteTag); } return spriteId; } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 1edc986c9b..42cf55521e 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -539,7 +539,10 @@ static const struct SpritePalette sObjectEventSpritePalettes[] = { #endif //ITEM_STRANGE_BALL #endif //OW_FOLLOWERS_POKEBALLS {gObjectEventPal_Substitute, OBJ_EVENT_PAL_TAG_SUBSTITUTE}, + {gObjectEventPaletteLight, OBJ_EVENT_PAL_TAG_LIGHT}, + {gObjectEventPaletteLight2, OBJ_EVENT_PAL_TAG_LIGHT_2}, {gObjectEventPaletteEmotes, OBJ_EVENT_PAL_TAG_EMOTES}, + {gObjectEventPaletteNeonLight, OBJ_EVENT_PAL_TAG_NEON_LIGHT}, #ifdef BUGFIX {NULL, OBJ_EVENT_PAL_TAG_NONE}, #else @@ -1259,7 +1262,7 @@ u8 GetFirstInactiveObjectEventId(void) u8 GetObjectEventIdByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroupId) { - if (localId < OBJ_EVENT_ID_FOLLOWER) + if (localId < OBJ_EVENT_ID_DYNAMIC_BASE) return GetObjectEventIdByLocalIdAndMapInternal(localId, mapNum, mapGroupId); return GetObjectEventIdByLocalId(localId); @@ -1760,8 +1763,20 @@ static u8 LoadDynamicFollowerPaletteFromGraphicsId(u16 graphicsId, bool8 shiny, return paletteNum; } +// Like LoadObjectEventPalette, but overwrites the palette tag that is loaded +static u8 LoadObjectEventPaletteWithTag(u16 paletteTag, u16 overTag) { + u32 i = FindObjectEventPaletteIndexByTag(paletteTag); + struct SpritePalette spritePalette; + if (i == 0xFF) + return i; + spritePalette = sObjectEventSpritePalettes[i]; + if (overTag != TAG_NONE) + spritePalette.tag = overTag; // overwrite palette tag + return LoadSpritePaletteIfTagExists(&spritePalette); +} + // Used to create a sprite using a graphicsId associated with object events. -u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority) +u8 CreateObjectGraphicsSpriteWithTag(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority, u16 paletteTag) { struct SpriteTemplate *spriteTemplate; const struct SubspriteTable *subspriteTables; @@ -1780,11 +1795,17 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), { u32 paletteNum = LoadDynamicFollowerPaletteFromGraphicsId(graphicsId, isShiny, spriteTemplate); spriteTemplate->paletteTag = GetSpritePaletteTagByPaletteNum(paletteNum); - } - else if (spriteTemplate->paletteTag != TAG_NONE) + } + else if (spriteTemplate->paletteTag != TAG_NONE) { - LoadObjectEventPalette(spriteTemplate->paletteTag); - } + if (paletteTag == TAG_NONE) + LoadObjectEventPalette(spriteTemplate->paletteTag); + else + { + LoadObjectEventPaletteWithTag(spriteTemplate->paletteTag, paletteTag); + spriteTemplate->paletteTag = paletteTag; + } + } if (OW_GFX_COMPRESS) { @@ -1808,6 +1829,10 @@ u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), return spriteId; } +u8 CreateObjectGraphicsSprite(u16 graphicsId, void (*callback)(struct Sprite *), s16 x, s16 y, u8 subpriority) { + return CreateObjectGraphicsSpriteWithTag(graphicsId, callback, x, y, subpriority, TAG_NONE); +} + #define sVirtualObjId data[0] #define sVirtualObjElev data[1] @@ -1951,7 +1976,8 @@ static u8 LoadDynamicFollowerPalette(u16 species, u8 form, bool32 shiny) } if (gWeatherPtr->currWeather != WEATHER_FOG_HORIZONTAL) // don't want to weather blend in fog - UpdateSpritePaletteWithWeather(paletteNum); + UpdateSpritePaletteWithWeather(paletteNum, FALSE); + return paletteNum; } @@ -1974,7 +2000,7 @@ static void FollowerSetGraphics(struct ObjectEvent *objEvent, u16 species, u8 fo } else if (gWeatherPtr->currWeather != WEATHER_FOG_HORIZONTAL) // don't want to weather blend in fog { - UpdateSpritePaletteWithWeather(gSprites[objEvent->spriteId].oam.paletteNum); + UpdateSpritePaletteWithWeather(gSprites[objEvent->spriteId].oam.paletteNum, FALSE); } } @@ -2020,7 +2046,7 @@ static void RefreshFollowerGraphics(struct ObjectEvent *objEvent) { UpdateSpritePalette(&sObjectEventSpritePalettes[i], sprite); if (gWeatherPtr->currWeather != WEATHER_FOG_HORIZONTAL) // don't want to weather blend in fog - UpdateSpritePaletteWithWeather(sprite->oam.paletteNum); + UpdateSpritePaletteWithWeather(sprite->oam.paletteNum, FALSE); } } @@ -2229,9 +2255,10 @@ bool32 CheckMsgCondition(const struct MsgCondition *cond, struct Pokemon *mon, u return (multi == cond->data.bytes[0] || multi == cond->data.bytes[1]); case MSG_COND_MUSIC: return (cond->data.raw == GetCurrentMapMusic()); - // Added on `lighting` branch - // case MSG_COND_TIME_OF_DAY: - // break; + case MSG_COND_TIME_OF_DAY: + // Must match time of day, have natural light on the map, + // and not have weather that obscures the sky + return (cond->data.raw == gTimeOfDay && MapHasNaturalLight(gMapHeader.mapType) && GetCurrentWeather() < WEATHER_RAIN); case MSG_COND_NEAR_MB: multi = FindMetatileBehaviorWithinRange(obj->currentCoords.x, obj->currentCoords.y, @@ -2451,6 +2478,126 @@ void GetFollowerAction(struct ScriptContext *ctx) // Essentially a big switch fo gFollowerBasicMessages[emotion].script); } +// Sprite callback for light sprites +void UpdateLightSprite(struct Sprite *sprite) { + s16 left = gSaveBlock1Ptr->pos.x - 2; + s16 right = gSaveBlock1Ptr->pos.x + 17; + s16 top = gSaveBlock1Ptr->pos.y; + s16 bottom = gSaveBlock1Ptr->pos.y + 15; + s16 x = sprite->data[6]; + s16 y = sprite->data[7]; + u16 sheetTileStart; + u32 paletteNum; + // Ripped from RemoveObjectEventIfOutsideView + if (!(x >= left && x <= right && y >= top && y <= bottom)) { + sheetTileStart = sprite->sheetTileStart; + paletteNum = sprite->oam.paletteNum; + DestroySprite(sprite); + FieldEffectFreeTilesIfUnused(sheetTileStart); + FieldEffectFreePaletteIfUnused(paletteNum); + Weather_SetBlendCoeffs(7, 12); // TODO: Restore original blend coeffs at dawn + return; + } + + if (gTimeOfDay != TIME_OF_DAY_NIGHT) { + sprite->invisible = TRUE; + return; + } + + switch (sprite->data[5]) { // lightType + case 0: + if (gPaletteFade.active) { // if palette fade is active, don't flicker since the timer won't be updated + Weather_SetBlendCoeffs(7, 12); + sprite->invisible = FALSE; + } else if (gPlayerAvatar.tileTransitionState) { + Weather_SetBlendCoeffs(7, 12); // As long as the second coefficient stays 12, shadows will not change + sprite->invisible = FALSE; + if (GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum) == OBJ_EVENT_PAL_TAG_LIGHT_2) + LoadSpritePaletteInSlot(&sObjectEventSpritePalettes[FindObjectEventPaletteIndexByTag(OBJ_EVENT_PAL_TAG_LIGHT)], sprite->oam.paletteNum); + } else if ((sprite->invisible = gTimeUpdateCounter & 1)) { + Weather_SetBlendCoeffs(12, 12); + if (GetSpritePaletteTagByPaletteNum(sprite->oam.paletteNum) == OBJ_EVENT_PAL_TAG_LIGHT) + LoadSpritePaletteInSlot(&sObjectEventSpritePalettes[FindObjectEventPaletteIndexByTag(OBJ_EVENT_PAL_TAG_LIGHT_2)], sprite->oam.paletteNum); + } + break; + case 1 ... 2: + Weather_SetBlendCoeffs(12, 12); + sprite->invisible = FALSE; + break; + } +} + +// Spawn a light at a map coordinate +static void SpawnLightSprite(s16 x, s16 y, s16 camX, s16 camY, u32 lightType) { + struct Sprite *sprite; + const struct SpriteTemplate *template; + u8 i; + for (i = 0; i < MAX_SPRITES; i++) { + sprite = &gSprites[i]; + if (sprite->inUse && sprite->callback == UpdateLightSprite && sprite->data[6] == x && sprite->data[7] == y) + return; + } + lightType = min(lightType, ARRAY_COUNT(gFieldEffectLightTemplates) - 1); // bounds checking + template = gFieldEffectLightTemplates[lightType]; + LoadSpriteSheetByTemplate(template, 0); + sprite = &gSprites[CreateSprite(template, 0, 0, 0)]; + if (lightType == 0 && (i = IndexOfSpritePaletteTag(template->paletteTag + 1)) < 16) + sprite->oam.paletteNum = i; + else + UpdateSpritePaletteByTemplate(template, sprite); + GetMapCoordsFromSpritePos(x + camX, y + camY, &sprite->x, &sprite->y); + sprite->data[5] = lightType; + sprite->data[6] = x; + sprite->data[7] = y; + sprite->affineAnims = gDummySpriteAffineAnimTable; + sprite->affineAnimBeginning = TRUE; + sprite->coordOffsetEnabled = TRUE; + switch (lightType) { + case 0: // Rustboro lanterns + sprite->centerToCornerVecX = -(32 >> 1); + sprite->centerToCornerVecY = -(32 >> 1); + sprite->oam.priority = 1; + sprite->oam.objMode = 1; // BLEND + sprite->oam.affineMode = ST_OAM_AFFINE_NORMAL; + sprite->x += 8; + sprite->y += 22 + sprite->centerToCornerVecY; + break; + case 1 ... 2: // Pokemon Center & mart + sprite->centerToCornerVecX = -(16 >> 1); + sprite->centerToCornerVecY = -(16 >> 1); + sprite->oam.priority = 2; + sprite->subpriority = 0xFF; + sprite->oam.objMode = 1; // BLEND + } +} + +void TrySpawnLightSprites(s16 camX, s16 camY) { + u8 i; + u8 objectCount; + s16 left = gSaveBlock1Ptr->pos.x - 2; + s16 right = gSaveBlock1Ptr->pos.x + MAP_OFFSET_W + 2; + s16 top = gSaveBlock1Ptr->pos.y; + s16 bottom = gSaveBlock1Ptr->pos.y + MAP_OFFSET_H + 2; + if (gMapHeader.events == NULL) + return; + + if (InBattlePyramid()) + objectCount = GetNumBattlePyramidObjectEvents(); + else if (InTrainerHill()) + objectCount = 2; + else + objectCount = gMapHeader.events->objectEventCount; + + for (i = 0; i < objectCount; i++) { + struct ObjectEventTemplate *template = &gSaveBlock1Ptr->objectEventTemplates[i]; + s16 npcX = template->x + MAP_OFFSET; + s16 npcY = template->y + MAP_OFFSET; + if (top <= npcY && bottom >= npcY && left <= npcX && right >= npcX && !FlagGet(template->flagId)) + if (template->graphicsId == OBJ_EVENT_GFX_LIGHT_SPRITE) // event is light sprite instead + SpawnLightSprite(npcX, npcY, camX, camY, template->trainerRange_berryTreeId); + } +} + void TrySpawnObjectEvents(s16 cameraX, s16 cameraY) { u8 i; @@ -2476,9 +2623,12 @@ void TrySpawnObjectEvents(s16 cameraX, s16 cameraY) s16 npcX = template->x + MAP_OFFSET; s16 npcY = template->y + MAP_OFFSET; - if (top <= npcY && bottom >= npcY && left <= npcX && right >= npcX - && !FlagGet(template->flagId)) - TrySpawnObjectEventTemplate(template, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY); + if (top <= npcY && bottom >= npcY && left <= npcX && right >= npcX && !FlagGet(template->flagId)) { + if (template->graphicsId == OBJ_EVENT_GFX_LIGHT_SPRITE) { // light sprite instead + SpawnLightSprite(npcX, npcY, cameraX, cameraY, template->trainerRange_berryTreeId); + } else + TrySpawnObjectEventTemplate(template, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, cameraX, cameraY); + } } } } @@ -2534,6 +2684,7 @@ void SpawnObjectEventsOnReturnToField(s16 x, s16 y) SpawnObjectEventOnReturnToField(i, x, y); } CreateReflectionEffectSprites(); + TrySpawnLightSprites(x, y); } static void SpawnObjectEventOnReturnToField(u8 objectEventId, s16 x, s16 y) @@ -2601,7 +2752,7 @@ static void ResetObjectEventFldEffData(struct ObjectEvent *objectEvent) { objectEvent->singleMovementActive = FALSE; objectEvent->triggerGroundEffectsOnMove = TRUE; - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; objectEvent->hasReflection = FALSE; objectEvent->inShortGrass = FALSE; objectEvent->inShallowFlowingWater = FALSE; @@ -2625,7 +2776,14 @@ static u8 UpdateSpritePalette(const struct SpritePalette *spritePalette, struct sprite->inUse = FALSE; FieldEffectFreePaletteIfUnused(sprite->oam.paletteNum); sprite->inUse = TRUE; - return sprite->oam.paletteNum = LoadSpritePalette(spritePalette); + if (IndexOfSpritePaletteTag(spritePalette->tag) == 0xFF) { + sprite->oam.paletteNum = LoadSpritePalette(spritePalette); + UpdateSpritePaletteWithWeather(sprite->oam.paletteNum, FALSE); + } else { + sprite->oam.paletteNum = LoadSpritePalette(spritePalette); + } + + return sprite->oam.paletteNum; } // Find and update based on template's paletteTag @@ -2893,12 +3051,15 @@ static void UNUSED LoadObjectEventPaletteSet(u16 *paletteTags) LoadObjectEventPalette(paletteTags[i]); } +// Really just loads the palette and applies weather fade static u8 LoadSpritePaletteIfTagExists(const struct SpritePalette *spritePalette) { u8 paletteNum = IndexOfSpritePaletteTag(spritePalette->tag); if (paletteNum != 0xFF) // don't load twice; return return paletteNum; paletteNum = LoadSpritePalette(spritePalette); + if (paletteNum != 0xFF) + UpdateSpritePaletteWithWeather(paletteNum, FALSE); return paletteNum; } @@ -6831,7 +6992,7 @@ bool8 MovementAction_Jump2Down_Step1(struct ObjectEvent *objectEvent, struct Spr { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -6848,7 +7009,7 @@ bool8 MovementAction_Jump2Up_Step1(struct ObjectEvent *objectEvent, struct Sprit { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -6865,7 +7026,7 @@ bool8 MovementAction_Jump2Left_Step1(struct ObjectEvent *objectEvent, struct Spr { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -6882,7 +7043,7 @@ bool8 MovementAction_Jump2Right_Step1(struct ObjectEvent *objectEvent, struct Sp { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -7732,7 +7893,7 @@ bool8 MovementAction_JumpDown_Step1(struct ObjectEvent *objectEvent, struct Spri { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7749,7 +7910,7 @@ bool8 MovementAction_JumpUp_Step1(struct ObjectEvent *objectEvent, struct Sprite { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7766,7 +7927,7 @@ bool8 MovementAction_JumpLeft_Step1(struct ObjectEvent *objectEvent, struct Spri { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7783,7 +7944,7 @@ bool8 MovementAction_JumpRight_Step1(struct ObjectEvent *objectEvent, struct Spr { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7800,7 +7961,7 @@ bool8 MovementAction_JumpInPlaceDown_Step1(struct ObjectEvent *objectEvent, stru { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7817,7 +7978,7 @@ bool8 MovementAction_JumpInPlaceUp_Step1(struct ObjectEvent *objectEvent, struct { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7834,7 +7995,7 @@ bool8 MovementAction_JumpInPlaceLeft_Step1(struct ObjectEvent *objectEvent, stru { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7851,7 +8012,7 @@ bool8 MovementAction_JumpInPlaceRight_Step1(struct ObjectEvent *objectEvent, str { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7868,7 +8029,7 @@ bool8 MovementAction_JumpInPlaceDownUp_Step1(struct ObjectEvent *objectEvent, st { if (DoJumpInPlaceAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7885,7 +8046,7 @@ bool8 MovementAction_JumpInPlaceUpDown_Step1(struct ObjectEvent *objectEvent, st { if (DoJumpInPlaceAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7902,7 +8063,7 @@ bool8 MovementAction_JumpInPlaceLeftRight_Step1(struct ObjectEvent *objectEvent, { if (DoJumpInPlaceAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -7919,7 +8080,7 @@ bool8 MovementAction_JumpInPlaceRightLeft_Step1(struct ObjectEvent *objectEvent, { if (DoJumpInPlaceAnim(objectEvent, sprite)) { - objectEvent->hasShadow = 0; + objectEvent->noShadow = 0; sprite->sActionFuncId = 2; return TRUE; } @@ -8364,7 +8525,7 @@ bool8 MovementAction_AcroWheelieHopFaceDown_Step1(struct ObjectEvent *objectEven { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8381,7 +8542,7 @@ bool8 MovementAction_AcroWheelieHopFaceUp_Step1(struct ObjectEvent *objectEvent, { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8398,7 +8559,7 @@ bool8 MovementAction_AcroWheelieHopFaceLeft_Step1(struct ObjectEvent *objectEven { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8415,7 +8576,7 @@ bool8 MovementAction_AcroWheelieHopFaceRight_Step1(struct ObjectEvent *objectEve { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8432,7 +8593,7 @@ bool8 MovementAction_AcroWheelieHopDown_Step1(struct ObjectEvent *objectEvent, s { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8449,7 +8610,7 @@ bool8 MovementAction_AcroWheelieHopUp_Step1(struct ObjectEvent *objectEvent, str { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8466,7 +8627,7 @@ bool8 MovementAction_AcroWheelieHopLeft_Step1(struct ObjectEvent *objectEvent, s { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8483,7 +8644,7 @@ bool8 MovementAction_AcroWheelieHopRight_Step1(struct ObjectEvent *objectEvent, { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8500,7 +8661,7 @@ bool8 MovementAction_AcroWheelieJumpDown_Step1(struct ObjectEvent *objectEvent, { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8517,7 +8678,7 @@ bool8 MovementAction_AcroWheelieJumpUp_Step1(struct ObjectEvent *objectEvent, st { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8534,7 +8695,7 @@ bool8 MovementAction_AcroWheelieJumpLeft_Step1(struct ObjectEvent *objectEvent, { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -8551,7 +8712,7 @@ bool8 MovementAction_AcroWheelieJumpRight_Step1(struct ObjectEvent *objectEvent, { if (DoJumpAnim(objectEvent, sprite)) { - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = FALSE; sprite->sActionFuncId = 2; return TRUE; } @@ -9634,16 +9795,22 @@ static void (*const sGroundEffectFuncs[])(struct ObjectEvent *objEvent, struct S GroundEffect_Seaweed // GROUND_EFFECT_FLAG_SEAWEED }; +static void GroundEffect_Shadow(struct ObjectEvent *objEvent, struct Sprite *sprite) +{ + SetUpShadow(objEvent, sprite); +} + static void DoFlaggedGroundEffects(struct ObjectEvent *objEvent, struct Sprite *sprite, u32 flags) { u8 i; - if (ObjectEventIsFarawayIslandMew(objEvent) == TRUE && !ShouldMewShakeGrass(objEvent)) return; for (i = 0; i < ARRAY_COUNT(sGroundEffectFuncs); i++, flags >>= 1) if (flags & 1) sGroundEffectFuncs[i](objEvent, sprite); + if (!(gWeatherPtr->noShadows || objEvent->inHotSprings || objEvent->inSandPile || MetatileBehavior_IsPuddle(objEvent->currentMetatileBehavior))) + GroundEffect_Shadow(objEvent, sprite); } void filters_out_some_ground_effects(struct ObjectEvent *objEvent, u32 *flags) @@ -10383,9 +10550,9 @@ u32 StartFieldEffectForObjectEvent(u8 fieldEffectId, struct ObjectEvent *objectE static void DoShadowFieldEffect(struct ObjectEvent *objectEvent) { - if (!objectEvent->hasShadow) + if (objectEvent->noShadow) { - objectEvent->hasShadow = TRUE; + objectEvent->noShadow = FALSE; StartFieldEffectForObjectEvent(FLDEFF_SHADOW, objectEvent); } } diff --git a/src/faraway_island.c b/src/faraway_island.c index 4f34cf30e6..68be69d267 100755 --- a/src/faraway_island.c +++ b/src/faraway_island.c @@ -392,7 +392,7 @@ void SetMewAboveGrass(void) gSprites[mew->spriteId].subpriority = 1; LoadSpritePalette(&gSpritePalette_GeneralFieldEffect1); - UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(gSpritePalette_GeneralFieldEffect1.tag)); + UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(gSpritePalette_GeneralFieldEffect1.tag), FALSE); x = mew->currentCoords.x; y = mew->currentCoords.y; diff --git a/src/field_effect.c b/src/field_effect.c index 898f19c291..ed5286218f 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -788,7 +788,7 @@ void FieldEffectScript_LoadFadedPalette(u8 **script) { struct SpritePalette *palette = (struct SpritePalette *)FieldEffectScript_ReadWord(script); LoadSpritePalette(palette); - UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(palette->tag)); + UpdateSpritePaletteWithWeather(IndexOfSpritePaletteTag(palette->tag), TRUE); (*script) += 4; } @@ -918,6 +918,7 @@ u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority) return CreateSprite(&sSpriteTemplate_NewGameBirch, x, y, subpriority); } + u8 CreateMonSprite_PicBox(u16 species, s16 x, s16 y, u8 subpriority) { s32 spriteId = CreateMonPicSprite(species, FALSE, 0x8000, TRUE, x, y, 0, species); @@ -1609,6 +1610,7 @@ static bool8 EscalatorWarpOut_WaitForPlayer(struct Task *task) if (!ObjectEventIsMovementOverridden(objectEvent) || ObjectEventClearHeldMovementIfFinished(objectEvent)) { ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(GetPlayerFacingDirection())); + objectEvent->noShadow = TRUE; // hide shadow for cleaner movement task->tState++; task->data[2] = 0; task->data[3] = 0; @@ -1730,6 +1732,7 @@ static bool8 EscalatorWarpIn_Init(struct Task *task) u8 behavior; CameraObjectFreeze(); objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + objectEvent->noShadow = TRUE; ObjectEventSetHeldMovement(objectEvent, GetFaceDirectionMovementAction(DIR_EAST)); PlayerGetDestCoords(&x, &y); behavior = MapGridGetMetatileBehaviorAt(x, y); @@ -1826,6 +1829,7 @@ static bool8 EscalatorWarpIn_End(struct Task *task) { struct ObjectEvent *objectEvent; objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + objectEvent->noShadow = FALSE; if (ObjectEventClearHeldMovementIfFinished(objectEvent)) { CameraObjectReset(); @@ -1978,6 +1982,7 @@ static bool8 LavaridgeGymB1FWarpEffect_Init(struct Task *task, struct ObjectEven SetCameraPanningCallback(NULL); gPlayerAvatar.preventStep = TRUE; objectEvent->fixedPriority = 1; + objectEvent->noShadow = TRUE; task->data[1] = 1; task->data[0]++; if (objectEvent->localId == OBJ_EVENT_ID_PLAYER) // Hide follower before warping @@ -2172,6 +2177,7 @@ static bool8 LavaridgeGym1FWarpEffect_Init(struct Task *task, struct ObjectEvent CameraObjectFreeze(); gPlayerAvatar.preventStep = TRUE; objectEvent->fixedPriority = 1; + objectEvent->noShadow = TRUE; task->data[0]++; if (objectEvent->localId == OBJ_EVENT_ID_PLAYER) // Hide follower before warping HideFollowerForFieldEffect(); @@ -3292,7 +3298,7 @@ static void FlyOutFieldEffect_FlyOffWithBird(struct Task *task) struct ObjectEvent *objectEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; ObjectEventClearHeldMovementIfActive(objectEvent); objectEvent->inanimate = FALSE; - objectEvent->hasShadow = FALSE; + objectEvent->noShadow = TRUE; // TODO: Make shadow smaller instead of disappearing completely ? SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, objectEvent->spriteId); CameraObjectFreeze(); task->tState++; @@ -3513,6 +3519,7 @@ static void FlyInFieldEffect_BirdSwoopDown(struct Task *task) ObjectEventTurn(objectEvent, DIR_WEST); StartSpriteAnim(&gSprites[objectEvent->spriteId], ANIM_GET_ON_OFF_POKEMON_WEST); objectEvent->invisible = FALSE; + objectEvent->noShadow = TRUE; task->tBirdSpriteId = CreateFlyBirdSprite(); StartFlyBirdSwoopDown(task->tBirdSpriteId); SetFlyBirdPlayerSpriteId(task->tBirdSpriteId, objectEvent->spriteId); diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c old mode 100755 new mode 100644 index 1991892a50..df676bb540 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -112,17 +112,16 @@ static void LoadObjectReflectionPalette(struct ObjectEvent *objectEvent, struct } // Apply a blue tint effect to a palette -static void ApplyPondFilter(u8 paletteNum, u16 *dest) -{ - u32 i, r, g, b; - // CpuCopy16(gPlttBufferUnfaded + 0x100 + paletteNum * 16, dest, 32); +static void ApplyPondFilter(u8 paletteNum, u16 *dest) { + u32 i; + s32 r, g, b; u16 *src = gPlttBufferUnfaded + OBJ_PLTT_ID(paletteNum); *dest++ = *src++; // copy transparency - for (i = 0; i < 16 - 1; i++) - { - r = GET_R(src[i]); - g = GET_G(src[i]); - b = GET_B(src[i]); + for (i = 0; i < 16 - 1; i++) { + u32 color = *src++; + r = (color << 27) >> 27; + g = (color << 22) >> 27; + b = (color << 17) >> 27; b += 10; if (b > 31) b = 31; @@ -131,23 +130,22 @@ static void ApplyPondFilter(u8 paletteNum, u16 *dest) } // Apply a ice tint effect to a palette -static void ApplyIceFilter(u8 paletteNum, u16 *dest) -{ - u32 i, r, g, b; - // CpuCopy16(gPlttBufferUnfaded + 0x100 + paletteNum * 16, dest, 32); +static void ApplyIceFilter(u8 paletteNum, u16 *dest) { + u32 i; + s32 r, g, b; u16 *src = gPlttBufferUnfaded + OBJ_PLTT_ID(paletteNum); *dest++ = *src++; // copy transparency - for (i = 0; i < 16 - 1; i++) - { - r = GET_R(src[i]); + for (i = 0; i < 16 - 1; i++) { + u32 color = *src++; + r = (color << 27) >> 27; + g = (color << 22) >> 27; + b = (color << 17) >> 27; r -= 5; - if (r > 31) + if (r < 0) r = 0; - g = GET_G(src[i]); g += 3; if (g > 31) g = 31; - b = GET_B(src[i]); b += 16; if (b > 31) b = 31; @@ -171,7 +169,7 @@ static void LoadObjectRegularReflectionPalette(struct ObjectEvent *objectEvent, else ApplyIceFilter(mainSprite->oam.paletteNum, filteredData); paletteNum = LoadSpritePalette(&filteredPal); - UpdateSpritePaletteWithWeather(paletteNum); + UpdateSpritePaletteWithWeather(paletteNum, TRUE); } sprite->oam.paletteNum = paletteNum; sprite->oam.objMode = ST_OAM_OBJ_BLEND; @@ -185,7 +183,7 @@ static void LoadObjectHighBridgeReflectionPalette(struct ObjectEvent *objectEven struct SpritePalette bluePalette = {.tag = HIGH_BRIDGE_PAL_TAG, .data = blueData}; CpuFill16(0x55C9, blueData, PLTT_SIZE_4BPP); sprite->oam.paletteNum = LoadSpritePalette(&bluePalette); - UpdateSpritePaletteWithWeather(sprite->oam.paletteNum); + UpdateSpritePaletteWithWeather(sprite->oam.paletteNum, TRUE); } static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) @@ -221,7 +219,7 @@ static void UpdateObjectReflectionSprite(struct Sprite *reflectionSprite) else ApplyIceFilter(mainSprite->oam.paletteNum, filteredData); paletteNum = LoadSpritePalette(&filteredPal); - UpdateSpritePaletteWithWeather(paletteNum); + UpdateSpritePaletteWithWeather(paletteNum, TRUE); } reflectionSprite->oam.paletteNum = paletteNum; } @@ -333,9 +331,8 @@ u32 FldEff_Shadow(void) u8 objectEventId; const struct ObjectEventGraphicsInfo *graphicsInfo; u8 spriteId; - u8 i; - for (i = 0; i < MAX_SPRITES; i++) - { + s32 i; + for (i = MAX_SPRITES - 1; i > -1; i--) { // Search backwards, because of CreateSpriteAtEnd // Return early if a shadow sprite already exists if (gSprites[i].data[0] == gFieldEffectArguments[0] && gSprites[i].callback == UpdateShadowFieldEffect) return 0; @@ -344,7 +341,8 @@ u32 FldEff_Shadow(void) graphicsInfo = GetObjectEventGraphicsInfo(gObjectEvents[objectEventId].graphicsId); if (graphicsInfo->shadowSize == SHADOW_SIZE_NONE) // don't create a shadow at all return 0; - spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[sShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0, 0, 0x94); + LoadSpriteSheetByTemplate(gFieldEffectObjectTemplatePointers[sShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0); + spriteId = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[sShadowEffectTemplateIds[graphicsInfo->shadowSize]], 0, 0, 0x94 + 1); // higher = farther back; shadows should be behind object events if (spriteId != MAX_SPRITES) { // SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 12)); @@ -383,8 +381,13 @@ void UpdateShadowFieldEffect(struct Sprite *sprite) sprite->y = linkedSprite->y + sprite->sYOffset; #endif sprite->invisible = linkedSprite->invisible; - if (!objectEvent->active || !objectEvent->hasShadow + if (!objectEvent->active + || objectEvent->noShadow + || objectEvent->inHotSprings + || objectEvent->inSandPile + || gWeatherPtr->noShadows || MetatileBehavior_IsPokeGrass(objectEvent->currentMetatileBehavior) + || MetatileBehavior_IsPuddle(objectEvent->currentMetatileBehavior) || MetatileBehavior_IsSurfableWaterOrUnderwater(objectEvent->currentMetatileBehavior) || MetatileBehavior_IsSurfableWaterOrUnderwater(objectEvent->previousMetatileBehavior)) { @@ -1513,7 +1516,7 @@ static u32 ShowDisguiseFieldEffect(u8 fldEff, u8 fldEffObj, u8 paletteNum) if (spriteId != MAX_SPRITES) { struct Sprite *sprite = &gSprites[spriteId]; - UpdateSpritePaletteByTemplate(gFieldEffectObjectTemplatePointers[fldEffObj], sprite); + sprite->oam.paletteNum = LoadObjectEventPalette(gFieldEffectObjectTemplatePointers[fldEffObj]->paletteTag); sprite->coordOffsetEnabled ++; sprite->sFldEff = fldEff; sprite->sLocalId = gFieldEffectArguments[0]; diff --git a/src/field_screen_effect.c b/src/field_screen_effect.c index e39a0c6c1f..fa4a4e8276 100644 --- a/src/field_screen_effect.c +++ b/src/field_screen_effect.c @@ -1144,6 +1144,7 @@ static void Task_OrbEffect(u8 taskId) ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON); SetGpuRegBits(REG_OFFSET_BLDCNT, gOrbEffectBackgroundLayerFlags[0]); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7)); + UpdateShadowColor(0x2109); // force shadows to gray SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ); SetBgTilemapPalette(0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF); @@ -1211,6 +1212,7 @@ static void Task_OrbEffect(u8 taskId) SetGpuReg(REG_OFFSET_DISPCNT, tDispCnt); SetGpuReg(REG_OFFSET_BLDCNT, tBldCnt); SetGpuReg(REG_OFFSET_BLDALPHA, tBldAlpha); + UpdateShadowColor(RGB_BLACK); // force shadows to gray SetGpuReg(REG_OFFSET_WININ, tWinIn); SetGpuReg(REG_OFFSET_WINOUT, tWinOut); ScriptContext_Enable(); diff --git a/src/field_specials.c b/src/field_specials.c index e00aa03803..a31b02dd48 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -67,6 +67,7 @@ #include "constants/battle_frontier.h" #include "constants/weather.h" #include "constants/metatile_labels.h" +#include "constants/rgb.h" #include "palette.h" #include "battle_util.h" @@ -3268,6 +3269,7 @@ static void ChangeDeoxysRockLevel(u8 rockLevel) { u8 paletteNum = IndexOfSpritePaletteTag(OBJ_EVENT_PAL_TAG_BIRTH_ISLAND_STONE); LoadPalette(&sDeoxysRockPalettes[rockLevel], OBJ_PLTT_ID(paletteNum), PLTT_SIZEOF(4)); + UpdateSpritePaletteWithWeather(paletteNum, FALSE); if (rockLevel == 0) PlaySE(SE_M_CONFUSE_RAY); // Failure sound @@ -3319,7 +3321,7 @@ void SetDeoxysRockPalette(void) u32 paletteNum = IndexOfSpritePaletteTag(OBJ_EVENT_PAL_TAG_BIRTH_ISLAND_STONE); LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], OBJ_PLTT_ID(paletteNum), PLTT_SIZEOF(4)); // Set faded to all black, weather blending handled during fade-in - CpuFill16(0, &gPlttBufferFaded[OBJ_PLTT_ID(paletteNum)], 32); + CpuFill16(RGB_BLACK, &gPlttBufferFaded[OBJ_PLTT_ID(paletteNum)], PLTT_SIZE_4BPP); } void SetPCBoxToSendMon(u8 boxId) diff --git a/src/field_weather.c b/src/field_weather.c index 3c9f642faf..73e83bcc98 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -3,6 +3,7 @@ #include "constants/weather.h" #include "constants/rgb.h" #include "util.h" +#include "decompress.h" #include "event_object_movement.h" #include "field_weather.h" #include "main.h" @@ -17,6 +18,7 @@ #include "trig.h" #include "gpu_regs.h" #include "field_camera.h" +#include "overworld.h" #define DROUGHT_COLOR_INDEX(color) ((((color) >> 1) & 0xF) | (((color) >> 2) & 0xF0) | (((color) >> 3) & 0xF00)) @@ -160,7 +162,7 @@ void StartWeather(void) CpuCopy32(gFogPalette, &gPlttBufferUnfaded[OBJ_PLTT_ID(index)], PLTT_SIZE_4BPP); BuildColorMaps(); gWeatherPtr->contrastColorMapSpritePalIndex = index; - gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(PALTAG_WEATHER_2); + gWeatherPtr->weatherPicSpritePalIndex = 0xFF; // defer allocation until needed gWeatherPtr->rainSpriteCount = 0; gWeatherPtr->curRainSpriteIndex = 0; gWeatherPtr->cloudSpritesCreated = 0; @@ -252,6 +254,7 @@ static void Task_WeatherMain(u8 taskId) static void None_Init(void) { Weather_SetBlendCoeffs(8, 12); // Indoor shadows + gWeatherPtr->noShadows = FALSE; gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 0; } @@ -468,18 +471,31 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex) if (colorMapIndex > 0) { + // Create the palette mask + u32 palettes = PALETTES_ALL; + numPalettes += startPalIndex; + palettes = (palettes >> startPalIndex) << startPalIndex; + palettes = (palettes << (32-numPalettes)) >> (32-numPalettes); + numPalettes -= startPalIndex; colorMapIndex--; palOffset = PLTT_ID(startPalIndex); + UpdateAltBgPalettes(palettes & PALETTES_BG); + // Thunder gamma-shift looks bad on night-blended palettes, so ignore time blending in some situations + if (!(colorMapIndex > 3) && MapHasNaturalLight(gMapHeader.mapType)) + UpdatePalettesWithTime(palettes); + else + CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, PLTT_SIZE_4BPP * numPalettes); numPalettes += startPalIndex; curPalIndex = startPalIndex; // Loop through the specified palette range and apply necessary color maps. while (curPalIndex < numPalettes) { - if (sPaletteColorMapTypes[curPalIndex] == COLOR_MAP_NONE) + // don't blend special palettes immune to blending + if (sPaletteColorMapTypes[curPalIndex] == COLOR_MAP_NONE || + (curPalIndex >= 16 && IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(curPalIndex - 16)))) { // No palette change. - CpuFastCopy(&gPlttBufferUnfaded[palOffset], &gPlttBufferFaded[palOffset], PLTT_SIZE_4BPP); palOffset += 16; } else @@ -494,7 +510,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex) for (i = 0; i < 16; i++) { // Apply color map to the original color. - struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; + struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferFaded[palOffset]; r = colorMap[baseColor.r]; g = colorMap[baseColor.g]; b = colorMap[baseColor.b]; @@ -535,8 +551,13 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex) } else { - // No palette blending. - CpuFastCopy(&gPlttBufferUnfaded[PLTT_ID(startPalIndex)], &gPlttBufferFaded[PLTT_ID(startPalIndex)], numPalettes * PLTT_SIZE_4BPP); + if (MapHasNaturalLight(gMapHeader.mapType)) { // Time-blend + u32 palettes = ((1 << numPalettes) - 1) << startPalIndex; + UpdateAltBgPalettes(palettes & PALETTES_BG); + UpdatePalettesWithTime(palettes); + } else { // copy + CpuFastCopy(&gPlttBufferUnfaded[PLTT_ID(startPalIndex)], &gPlttBufferFaded[PLTT_ID(startPalIndex)], numPalettes * PLTT_SIZE_4BPP); + } } } @@ -557,10 +578,13 @@ static void ApplyColorMapWithBlend(u8 startPalIndex, u8 numPalettes, s8 colorMap while (curPalIndex < numPalettes) { + UpdateAltBgPalettes((1 << (palOffset >> 4)) & PALETTES_BG); + CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16)); + UpdatePalettesWithTime(1 << (palOffset >> 4)); // Apply TOD blend if (sPaletteColorMapTypes[curPalIndex] == COLOR_MAP_NONE) { // No color map. Simply blend the colors. - BlendPalette(palOffset, 16, blendCoeff, blendColor); + BlendPalettesFine(1, gPlttBufferFaded + palOffset, gPlttBufferFaded + palOffset, blendCoeff, blendColor); palOffset += 16; } else @@ -574,7 +598,7 @@ static void ApplyColorMapWithBlend(u8 startPalIndex, u8 numPalettes, s8 colorMap for (i = 0; i < 16; i++) { - struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; + struct RGBColor baseColor = *(struct RGBColor *)&gPlttBufferFaded[palOffset]; u8 r = colorMap[baseColor.r]; u8 g = colorMap[baseColor.g]; u8 b = colorMap[baseColor.b]; @@ -646,51 +670,27 @@ static void ApplyDroughtColorMapWithBlend(s8 colorMapIndex, u8 blendCoeff, u32 b } } +// This is only called during fade-in/fade-out in fog +// blendCoeff & blendColor are the *fade* colors, not fog colors static void ApplyFogBlend(u8 blendCoeff, u32 blendColor) { - struct RGBColor color; - u8 rBlend; - u8 gBlend; - u8 bBlend; - u16 curPalIndex; + u32 curPalIndex; + u16 fogCoeff = min((gTimeOfDay + 1) * 4, 12); - BlendPalette(BG_PLTT_ID(0), 16 * 16, blendCoeff, blendColor); - color = *(struct RGBColor *)&blendColor; - rBlend = color.r; - gBlend = color.g; - bBlend = color.b; + // First blend all palettes with time + UpdateAltBgPalettes(PALETTES_BG); + CpuFastCopy(gPlttBufferUnfaded, gPlttBufferFaded, PLTT_BUFFER_SIZE * 2); + UpdatePalettesWithTime(PALETTES_ALL); + // Then blend tile palettes [0, 12] faded->faded with fadeIn color + BlendPalettesFine(PALETTES_MAP, gPlttBufferFaded, gPlttBufferFaded, blendCoeff, blendColor); - for (curPalIndex = 16; curPalIndex < 32; curPalIndex++) - { + // Do fog blending on marked sprite palettes + for (curPalIndex = 16; curPalIndex < 32; curPalIndex++) { if (LightenSpritePaletteInFog(curPalIndex)) - { - u16 palEnd = PLTT_ID(curPalIndex + 1); - u16 palOffset = PLTT_ID(curPalIndex); - - while (palOffset < palEnd) - { - struct RGBColor color = *(struct RGBColor *)&gPlttBufferUnfaded[palOffset]; - u8 r = color.r; - u8 g = color.g; - u8 b = color.b; - - r += ((28 - r) * 3) >> 2; - g += ((31 - g) * 3) >> 2; - b += ((28 - b) * 3) >> 2; - - r += ((rBlend - r) * blendCoeff) >> 4; - g += ((gBlend - g) * blendCoeff) >> 4; - b += ((bBlend - b) * blendCoeff) >> 4; - - gPlttBufferFaded[palOffset] = RGB2(r, g, b); - palOffset++; - } - } - else - { - BlendPalette(PLTT_ID(curPalIndex), 16, blendCoeff, blendColor); - } + BlendPalettesFine(1, gPlttBufferFaded + PLTT_ID(curPalIndex), gPlttBufferFaded + PLTT_ID(curPalIndex), fogCoeff, RGB(28, 31, 28)); } + // Finally blend all sprite palettes faded->faded with fadeIn color + BlendPalettesFine(PALETTES_OBJECTS, gPlttBufferFaded, gPlttBufferFaded, blendCoeff, blendColor); } static void MarkFogSpritePalToLighten(u8 paletteIndex) @@ -706,6 +706,9 @@ static bool8 LightenSpritePaletteInFog(u8 paletteIndex) { u16 i; + if (paletteIndex >= 16 && IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(paletteIndex - 16))) + return FALSE; + for (i = 0; i < gWeatherPtr->lightenedFogSpritePalsCount; i++) { if (gWeatherPtr->lightenedFogSpritePals[i] == paletteIndex) @@ -782,8 +785,10 @@ void FadeScreen(u8 mode, s8 delay) if (fadeOut) { - if (useWeatherPal) - CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE); + // Note: Copying faded -> unfaded like this works fine, except if the screen is faded back in + // without transitioning to a different screen + // For cases like that, use fadescreenswapbuffers + CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2); BeginNormalPaletteFade(PALETTES_ALL, delay, 0, 16, fadeColor); gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT; @@ -791,10 +796,20 @@ void FadeScreen(u8 mode, s8 delay) else { gWeatherPtr->fadeDestColor = fadeColor; + UpdateTimeOfDay(); if (useWeatherPal) - gWeatherPtr->fadeScreenCounter = 0; - else + gWeatherPtr->fadeScreenCounter = 0; // Triggers gamma-shift-based fade-in + else { + if (MapHasNaturalLight(gMapHeader.mapType)) { + UpdateAltBgPalettes(PALETTES_BG); + BeginTimeOfDayPaletteFade(PALETTES_ALL, delay, 16, 0, + (struct BlendSettings *)&gTimeOfDayBlend[currentTimeBlend.time0], + (struct BlendSettings *)&gTimeOfDayBlend[currentTimeBlend.time1], + currentTimeBlend.weight, fadeColor); + } else { BeginNormalPaletteFade(PALETTES_ALL, delay, 16, 0, fadeColor); + } + } gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN; gWeatherPtr->fadeInFirstFrame = TRUE; @@ -809,11 +824,10 @@ bool8 IsWeatherNotFadingIn(void) return (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_IN); } -void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex) +void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex, bool8 allowFog) { u16 paletteIndex = 16 + spritePaletteIndex; u16 i; - switch (gWeatherPtr->palProcessingState) { case WEATHER_PAL_STATE_SCREEN_FADING_IN: @@ -834,24 +848,46 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex) // WEATHER_PAL_STATE_CHANGING_WEATHER // WEATHER_PAL_STATE_CHANGING_IDLE default: - if (gWeatherPtr->currWeather != WEATHER_FOG_HORIZONTAL) - { - ApplyColorMap(paletteIndex, 1, gWeatherPtr->colorMapIndex); - } - else - { - paletteIndex = PLTT_ID(paletteIndex); - BlendPalette(paletteIndex, 16, 12, RGB(28, 31, 28)); + if (gWeatherPtr->currWeather != WEATHER_FOG_HORIZONTAL) { + if (gWeatherPtr->colorMapIndex) + ApplyColorMap(paletteIndex, 1, gWeatherPtr->colorMapIndex); + else + UpdateSpritePaletteWithTime(spritePaletteIndex); + } else { // In horizontal fog, only specific palettes should be fog-blended + if (allowFog) { + i = min((gTimeOfDay + 1) * 4, 12); // fog coeff, highest in day and lowest at night + paletteIndex = PLTT_ID(paletteIndex); + // First blend with time + CpuFastCopy(gPlttBufferUnfaded + paletteIndex, gPlttBufferFaded + paletteIndex, PLTT_SIZE_4BPP); + UpdateSpritePaletteWithTime(spritePaletteIndex); + // Then blend faded->faded with fog coeff + BlendPalettesFine(1, gPlttBufferFaded + paletteIndex, gPlttBufferFaded + paletteIndex, i, RGB(28, 31, 28)); + } else { // Otherwise, just time-blend the palette + UpdateSpritePaletteWithTime(spritePaletteIndex); + } } break; } + // If faded out, i.e due to fadescreenswapbuffers, + // Copy unfaded palette to pal decomp buffer + // so it will be restored on fade-in + if (gPaletteFade.y == 16) + CpuFastCopy( + gPlttBufferUnfaded + OBJ_PLTT_ID(spritePaletteIndex), + gDecompressionBuffer + 2*OBJ_PLTT_ID(spritePaletteIndex), + PLTT_SIZE_4BPP + ); } -void ApplyWeatherColorMapToPal(u8 paletteIndex) +void ApplyWeatherColorMapToPal(u8 paletteIndex) // now unused / obselete { ApplyColorMap(paletteIndex, 1, gWeatherPtr->colorMapIndex); } +void ApplyWeatherColorMapToPals(u8 startPalIndex, u8 numPalettes) { + ApplyColorMap(startPalIndex, numPalettes, gWeatherPtr->colorMapIndex); +} + static bool8 UNUSED IsFirstFrameOfWeatherFadeIn(void) { if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_SCREEN_FADING_IN) @@ -862,8 +898,11 @@ static bool8 UNUSED IsFirstFrameOfWeatherFadeIn(void) void LoadCustomWeatherSpritePalette(const u16 *palette) { + if (gWeatherPtr->weatherPicSpritePalIndex > 16) // haven't allocated palette yet + if ((gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(PALTAG_WEATHER_2)) > 16) + return; LoadPalette(palette, OBJ_PLTT_ID(gWeatherPtr->weatherPicSpritePalIndex), PLTT_SIZE_4BPP); - UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex); + UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex, TRUE); } static void LoadDroughtWeatherPalette(u8 *palsIndex, u8 *palsOffset) diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index cf31e862c3..efd80a7178 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -8,11 +8,13 @@ #include "script.h" #include "constants/weather.h" #include "constants/songs.h" +#include "constants/rgb.h" #include "sound.h" #include "sprite.h" #include "task.h" #include "trig.h" #include "gpu_regs.h" +#include "palette.h" EWRAM_DATA static u8 sCurrentAbnormalWeather = 0; EWRAM_DATA static u16 sUnusedWeatherRelated = 0; @@ -94,6 +96,7 @@ static const struct SpriteTemplate sCloudSpriteTemplate = void Clouds_InitVars(void) { + gWeatherPtr->noShadows = FALSE; gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; @@ -155,6 +158,7 @@ void Sunny_InitVars(void) gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 20; Weather_SetBlendCoeffs(8, 12); + gWeatherPtr->noShadows = FALSE; } void Sunny_InitAll(void) @@ -238,6 +242,7 @@ void Drought_InitVars(void) gWeatherPtr->weatherGfxLoaded = FALSE; gWeatherPtr->targetColorMapIndex = 0; gWeatherPtr->colorMapStepDelay = 0; + gWeatherPtr->noShadows = FALSE; } void Drought_InitAll(void) @@ -480,6 +485,8 @@ void Rain_InitVars(void) gWeatherPtr->targetColorMapIndex = 3; gWeatherPtr->colorMapStepDelay = 20; SetRainStrengthFromSoundEffect(SE_RAIN); + Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + gWeatherPtr->noShadows = FALSE; } void Rain_InitAll(void) @@ -773,6 +780,8 @@ void Snow_InitVars(void) gWeatherPtr->colorMapStepDelay = 20; gWeatherPtr->targetSnowflakeSpriteCount = NUM_SNOWFLAKE_SPRITES; gWeatherPtr->snowflakeVisibleCounter = 0; + Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + gWeatherPtr->noShadows = FALSE; } void Snow_InitAll(void) @@ -1020,6 +1029,8 @@ void Thunderstorm_InitVars(void) gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment gWeatherPtr->thunderEnqueued = FALSE; SetRainStrengthFromSoundEffect(SE_THUNDERSTORM); + Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + gWeatherPtr->noShadows = FALSE; } void Thunderstorm_InitAll(void) @@ -1048,6 +1059,8 @@ void Downpour_InitVars(void) gWeatherPtr->colorMapStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment SetRainStrengthFromSoundEffect(SE_DOWNPOUR); + Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + gWeatherPtr->noShadows = FALSE; } void Downpour_InitAll(void) @@ -1340,6 +1353,27 @@ void FogHorizontal_Main(void); static void CreateFogHorizontalSprites(void); static void DestroyFogHorizontalSprites(void); +// Within the weather palette, shadow sprites' color index +#define SHADOW_COLOR_INDEX 9 + +// Updates just the color of shadows to match special weather blending +u8 UpdateShadowColor(u16 color) { + u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START); + u16 ALIGNED(4) tempBuffer[16]; + u16 blendedColor; + if (paletteNum < 16) { + u16 index = OBJ_PLTT_ID(paletteNum)+SHADOW_COLOR_INDEX; + gPlttBufferUnfaded[index] = gPlttBufferFaded[index] = color; + // Copy to temporary buffer, blend, and keep just the shadow color index + CpuFastCopy(&gPlttBufferFaded[index-SHADOW_COLOR_INDEX], tempBuffer, PLTT_SIZE_4BPP); + UpdateSpritePaletteWithTime(paletteNum); + blendedColor = gPlttBufferFaded[index]; + CpuFastCopy(tempBuffer, &gPlttBufferFaded[index-SHADOW_COLOR_INDEX], PLTT_SIZE_4BPP); + gPlttBufferFaded[index] = blendedColor; + } + return paletteNum; +} + void FogHorizontal_InitVars(void) { gWeatherPtr->initStep = 0; @@ -1353,6 +1387,7 @@ void FogHorizontal_InitVars(void) gWeatherPtr->fogHScrollPosX = 0; Weather_SetBlendCoeffs(0, 16); } + gWeatherPtr->noShadows = FALSE; } void FogHorizontal_InitAll(void) @@ -1374,9 +1409,11 @@ void FogHorizontal_Main(void) { case 0: CreateFogHorizontalSprites(); - if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) - Weather_SetTargetBlendCoeffs(12, 8, 3); - else + if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) { + u8 paletteNum = IndexOfSpritePaletteTag(TAG_WEATHER_START); + Weather_SetTargetBlendCoeffs(12, 8, 3); + UpdateShadowColor(0x3DEF); // Gray + } else Weather_SetTargetBlendCoeffs(4, 16, 0); gWeatherPtr->initStep++; break; @@ -1414,6 +1451,7 @@ bool8 FogHorizontal_Finish(void) gWeatherPtr->finishStep++; break; default: + UpdateShadowColor(RGB_BLACK); return FALSE; } return TRUE; @@ -1504,9 +1542,10 @@ void Ash_InitVars(void) gWeatherPtr->ashUnused = 20; // Never read if (!gWeatherPtr->ashSpritesCreated) { - Weather_SetBlendCoeffs(0, 16); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // These aren't valid blend coefficients! + Weather_SetBlendCoeffs(0, 12); + // SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // These aren't valid blend coefficients! } + gWeatherPtr->noShadows = FALSE; } void Ash_InitAll(void) @@ -1532,7 +1571,7 @@ void Ash_Main(void) if (!gWeatherPtr->ashSpritesCreated) CreateAshSprites(); - Weather_SetTargetBlendCoeffs(16, 0, 1); + Weather_SetTargetBlendCoeffs(10, 12, 1); gWeatherPtr->initStep++; break; case 2: @@ -1553,7 +1592,7 @@ bool8 Ash_Finish(void) switch (gWeatherPtr->finishStep) { case 0: - Weather_SetTargetBlendCoeffs(0, 16, 1); + Weather_SetTargetBlendCoeffs(0, 12, 1); gWeatherPtr->finishStep++; break; case 1: @@ -1723,6 +1762,7 @@ void FogDiagonal_InitVars(void) gWeatherPtr->fogDPosY = 0; Weather_SetBlendCoeffs(0, 16); } + gWeatherPtr->noShadows = TRUE; } void FogDiagonal_InitAll(void) @@ -1936,6 +1976,7 @@ void Sandstorm_InitVars(void) Weather_SetBlendCoeffs(0, 16); } + gWeatherPtr->noShadows = FALSE; } void Sandstorm_InitAll(void) @@ -1960,7 +2001,8 @@ void Sandstorm_Main(void) gWeatherPtr->initStep++; break; case 1: - Weather_SetTargetBlendCoeffs(16, 0, 0); + Weather_SetTargetBlendCoeffs(16, 2, 0); + UpdateShadowColor(0x3DEF); gWeatherPtr->initStep++; break; case 2: @@ -1986,9 +2028,12 @@ bool8 Sandstorm_Finish(void) case 1: if (Weather_UpdateBlend()) gWeatherPtr->finishStep++; + if (gWeatherPtr->currBlendEVB == 12) + UpdateShadowColor(RGB_BLACK); break; case 2: DestroySandstormSprites(); + UpdateShadowColor(RGB_BLACK); gWeatherPtr->finishStep++; break; default: @@ -2222,6 +2267,8 @@ void Shade_InitVars(void) gWeatherPtr->initStep = 0; gWeatherPtr->targetColorMapIndex = 3; gWeatherPtr->colorMapStepDelay = 20; + Weather_SetBlendCoeffs(8, 12); // preserve shadow darkness + gWeatherPtr->noShadows = FALSE; } void Shade_InitAll(void) @@ -2283,6 +2330,7 @@ void Bubbles_InitVars(void) gWeatherPtr->bubblesCoordsIndex = 0; gWeatherPtr->bubblesSpriteCount = 0; } + gWeatherPtr->noShadows = TRUE; } void Bubbles_InitAll(void) diff --git a/src/fieldmap.c b/src/fieldmap.c index 7c40c755c4..17e3f2843f 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -878,28 +878,55 @@ static void UNUSED ApplyGlobalTintToPaletteSlot(u8 slot, u8 count) } -static void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size) +static void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size, bool8 skipFaded) { - u16 black = RGB_BLACK; + u32 low = 0; + u32 high = 0; if (tileset) { if (tileset->isSecondary == FALSE) { - LoadPalette(&black, destOffset, PLTT_SIZEOF(1)); - LoadPalette(tileset->palettes[0] + 1, destOffset + 1, size - PLTT_SIZEOF(1)); - ApplyGlobalTintToPaletteEntries(destOffset + 1, (size - PLTT_SIZEOF(1)) >> 1); + // LoadPalette(&black, destOffset, 2); + if (skipFaded) + CpuFastCopy(tileset->palettes, &gPlttBufferUnfaded[destOffset], size); + else + LoadPaletteFast(tileset->palettes, destOffset, size); + gPlttBufferFaded[destOffset] = gPlttBufferUnfaded[destOffset] = RGB_BLACK; // why does it have to be black? + ApplyGlobalTintToPaletteEntries(destOffset + 1, (size - 2) >> 1); + low = 0; + high = NUM_PALS_IN_PRIMARY; } else if (tileset->isSecondary == TRUE) { - LoadPalette(tileset->palettes[NUM_PALS_IN_PRIMARY], destOffset, size); - ApplyGlobalTintToPaletteEntries(destOffset, size >> 1); + // (void*) is to silence 'source potentially unaligned' error + // All 'gTilesetPalettes_' arrays should have ALIGNED(4) in them + if (skipFaded) + CpuFastCopy((void*)tileset->palettes[NUM_PALS_IN_PRIMARY], &gPlttBufferUnfaded[destOffset], size); + else + LoadPaletteFast(tileset->palettes[NUM_PALS_IN_PRIMARY], destOffset, size); + low = NUM_PALS_IN_PRIMARY; + high = NUM_PALS_TOTAL; } else { LoadCompressedPalette((const u32 *)tileset->palettes, destOffset, size); ApplyGlobalTintToPaletteEntries(destOffset, size >> 1); } + // convert legacy light palette system to current + if (tileset->lightPalettes) { + u32 i, j, color; + for (i = low; i < high; i++) { + if (tileset->lightPalettes & (1 << (i - low))) { // Mark light colors + for (j = 1, color = gPlttBufferUnfaded[PLTT_ID(i)]; j < 16 && color; j++, color >>= 1) { + if (color & 1) + gPlttBufferFaded[PLTT_ID(i)+j] = gPlttBufferUnfaded[PLTT_ID(i)+j] |= RGB_ALPHA; + } + if (tileset->customLightColor & (1 << (i - low))) // Copy old custom light color to index 0 + gPlttBufferFaded[PLTT_ID(i)] = gPlttBufferUnfaded[PLTT_ID(i)] = gPlttBufferUnfaded[PLTT_ID(i)+15] | RGB_ALPHA; + } + } + } } } @@ -920,12 +947,12 @@ void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout) static void LoadPrimaryTilesetPalette(struct MapLayout const *mapLayout) { - LoadTilesetPalette(mapLayout->primaryTileset, BG_PLTT_ID(0), NUM_PALS_IN_PRIMARY * PLTT_SIZE_4BPP); + LoadTilesetPalette(mapLayout->primaryTileset, 0, NUM_PALS_IN_PRIMARY * PLTT_SIZE_4BPP, FALSE); } -void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout) +void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout, bool8 skipFaded) { - LoadTilesetPalette(mapLayout->secondaryTileset, BG_PLTT_ID(NUM_PALS_IN_PRIMARY), (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * PLTT_SIZE_4BPP); + LoadTilesetPalette(mapLayout->secondaryTileset, NUM_PALS_IN_PRIMARY * 16, (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * PLTT_SIZE_4BPP, skipFaded); } void CopyMapTilesetsToVram(struct MapLayout const *mapLayout) @@ -942,6 +969,6 @@ void LoadMapTilesetPalettes(struct MapLayout const *mapLayout) if (mapLayout) { LoadPrimaryTilesetPalette(mapLayout); - LoadSecondaryTilesetPalette(mapLayout); + LoadSecondaryTilesetPalette(mapLayout, FALSE); } } diff --git a/src/follower_helper.c b/src/follower_helper.c index 02b39902eb..f1a365532f 100644 --- a/src/follower_helper.c +++ b/src/follower_helper.c @@ -2,6 +2,7 @@ #include "data.h" #include "event_scripts.h" #include "follower_helper.h" +#include "overworld.h" #include "constants/battle.h" #include "constants/followers.h" #include "constants/metatile_behaviors.h" @@ -66,6 +67,12 @@ static const u8 sCondMsg40[] = _("{STR_VAR_1} is gnawing at the ice."); static const u8 sCondMsg41[] = _("{STR_VAR_1} is touching the ice."); static const u8* const sIceTexts[] = {sCondMsg26, sCondMsg40, sCondMsg41, NULL}; static const u8 sCondMsg42[] = _("{STR_VAR_1}'s burn looks painful!"); +static const u8 sCondMsg43[] = _("{STR_VAR_1} is happy to see what's\noutdoors!"); +static const u8 sCondMsg44[] = _("{STR_VAR_1} is looking up at the\nsky."); +static const u8* const sDayTexts[] = {sCondMsg43, sCondMsg44, NULL}; +static const u8 sCondMsg45[] = _("Your POK茅MON is staring spellbound\nat the night sky!"); +static const u8 sCondMsg46[] = _("Your POK茅MON is happily gazing at\nthe beautiful, starry sky!"); +static const u8* const sNightTexts[] = {sCondMsg45, sCondMsg46, NULL}; // See the struct definition in follower_helper.h for more info const struct FollowerMsgInfoExtended gFollowerConditionalMessages[COND_MSG_COUNT] = @@ -350,6 +357,20 @@ const struct FollowerMsgInfoExtended gFollowerConditionalMessages[COND_MSG_COUNT MATCH_STATUS(STATUS1_BURN), }, }, + [COND_MSG_DAY] = + { + .text = (u8*)sDayTexts, + .textSpread = 1, + .emotion = FOLLOWER_EMOTION_MUSIC, + .conditions = {MATCH_TIME_OF_DAY(TIME_OF_DAY_DAY)}, + }, + [COND_MSG_NIGHT] = + { + .text = (u8*)sNightTexts, + .textSpread = 1, + .emotion = FOLLOWER_EMOTION_MUSIC, + .conditions = {MATCH_TIME_OF_DAY(TIME_OF_DAY_NIGHT)}, + }, }; // Pool of "unconditional" follower messages diff --git a/src/graphics.c b/src/graphics.c index 8df7055bd8..bf87c7536d 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1959,7 +1959,7 @@ const u32 gUnionRoomChat_Keyboard_Gfx[] = INCBIN_U32("graphics/union_room_chat/k const u32 gUnionRoomChat_Keyboard_Tilemap[] = INCBIN_U32("graphics/union_room_chat/keyboard.bin.lz"); const u32 gUnionRoomChat_RButtonLabels[] = INCBIN_U32("graphics/union_room_chat/r_button_labels.4bpp.lz"); -const u16 gTilesetPalettes_General[][16] = +const u16 ALIGNED(4) gTilesetPalettes_General[][16] = { INCBIN_U16("data/tilesets/primary/general/palettes/00.gbapal"), INCBIN_U16("data/tilesets/primary/general/palettes/01.gbapal"), diff --git a/src/overworld.c b/src/overworld.c index babdfad7b6..371c1797cc 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -12,6 +12,7 @@ #include "field_camera.h" #include "field_control_avatar.h" #include "field_effect.h" +#include "field_effect_helpers.h" #include "field_message_box.h" #include "field_player_avatar.h" #include "field_screen_effect.h" @@ -62,6 +63,7 @@ #include "vs_seeker.h" #include "frontier_util.h" #include "constants/abilities.h" +#include "constants/event_objects.h" #include "constants/layouts.h" #include "constants/map_types.h" #include "constants/region_map_sections.h" @@ -191,6 +193,11 @@ bool8 (*gFieldCallback2)(void); u8 gLocalLinkPlayerId; // This is our player id in a multiplayer mode. u8 gFieldLinkPlayerCount; +u8 gTimeOfDay; +struct TimeBlendSettings currentTimeBlend; +u16 gTimeUpdateCounter; // playTimeVBlanks will eventually overflow, so this is used to update TOD + +// EWRAM vars EWRAM_DATA static u8 sObjectEventLoadFlag = 0; EWRAM_DATA struct WarpData gLastUsedWarp = {0}; EWRAM_DATA static struct WarpData sWarpDestination = {0}; // new warp position @@ -850,10 +857,9 @@ if (I_VS_SEEKER_CHARGING != 0) RunOnTransitionMapScript(); InitMap(); CopySecondaryTilesetToVramUsingHeap(gMapHeader.mapLayout); - LoadSecondaryTilesetPalette(gMapHeader.mapLayout); + LoadSecondaryTilesetPalette(gMapHeader.mapLayout, TRUE); // skip copying to Faded, gamma shift will take care of it - for (paletteIndex = NUM_PALS_IN_PRIMARY; paletteIndex < NUM_PALS_TOTAL; paletteIndex++) - ApplyWeatherColorMapToPal(paletteIndex); + ApplyWeatherColorMapToPals(NUM_PALS_IN_PRIMARY, NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY); // palettes [6,12] InitSecondaryTilesetAnimation(); UpdateLocationHistoryForRoamer(); @@ -1520,6 +1526,132 @@ void CB1_Overworld(void) DoCB1_Overworld(gMain.newKeys, gMain.heldKeys); } +#define TINT_NIGHT Q_8_8(0.456) | Q_8_8(0.456) << 8 | Q_8_8(0.615) << 16 + +const struct BlendSettings gTimeOfDayBlend[] = +{ + [TIME_OF_DAY_NIGHT] = {.coeff = 10, .blendColor = TINT_NIGHT, .isTint = TRUE}, + [TIME_OF_DAY_TWILIGHT] = {.coeff = 4, .blendColor = 0xA8B0E0, .isTint = TRUE}, + [TIME_OF_DAY_DAY] = {.coeff = 0, .blendColor = 0}, +}; + +u8 UpdateTimeOfDay(void) { + s32 hours, minutes; + RtcCalcLocalTime(); + hours = gLocalTime.hours; + minutes = gLocalTime.minutes; + if (hours < 4) { // night + currentTimeBlend.weight = 256; + currentTimeBlend.altWeight = 0; + gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_NIGHT; + } else if (hours < 7) { // night->twilight + currentTimeBlend.time0 = TIME_OF_DAY_NIGHT; + currentTimeBlend.time1 = TIME_OF_DAY_TWILIGHT; + currentTimeBlend.weight = 256 - 256 * ((hours - 4) * 60 + minutes) / ((7-4)*60); + currentTimeBlend.altWeight = (256 - currentTimeBlend.weight) / 2; + gTimeOfDay = TIME_OF_DAY_DAY; + } else if (hours < 10) { // twilight->day + currentTimeBlend.time0 = TIME_OF_DAY_TWILIGHT; + currentTimeBlend.time1 = TIME_OF_DAY_DAY; + currentTimeBlend.weight = 256 - 256 * ((hours - 7) * 60 + minutes) / ((10-7)*60); + currentTimeBlend.altWeight = (256 - currentTimeBlend.weight) / 2 + 128; + gTimeOfDay = TIME_OF_DAY_DAY; + } else if (hours < 18) { // day + currentTimeBlend.weight = currentTimeBlend.altWeight = 256; + gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_DAY; + } else if (hours < 20) { // day->twilight + currentTimeBlend.time0 = TIME_OF_DAY_DAY; + currentTimeBlend.time1 = TIME_OF_DAY_TWILIGHT; + currentTimeBlend.weight = 256 - 256 * ((hours - 18) * 60 + minutes) / ((20-18)*60); + currentTimeBlend.altWeight = currentTimeBlend.weight / 2 + 128; + gTimeOfDay = TIME_OF_DAY_TWILIGHT; + } else if (hours < 22) { // twilight->night + currentTimeBlend.time0 = TIME_OF_DAY_TWILIGHT; + currentTimeBlend.time1 = TIME_OF_DAY_NIGHT; + currentTimeBlend.weight = 256 - 256 * ((hours - 20) * 60 + minutes) / ((22-20)*60); + currentTimeBlend.altWeight = currentTimeBlend.weight / 2; + gTimeOfDay = TIME_OF_DAY_NIGHT; + } else { // 22-24, night + currentTimeBlend.weight = 256; + currentTimeBlend.altWeight = 0; + gTimeOfDay = currentTimeBlend.time0 = currentTimeBlend.time1 = TIME_OF_DAY_NIGHT; + } + return gTimeOfDay; +} + +bool8 MapHasNaturalLight(u8 mapType) { // Whether a map type is naturally lit/outside + return ( + mapType == MAP_TYPE_TOWN + || mapType == MAP_TYPE_CITY + || mapType == MAP_TYPE_ROUTE + || mapType == MAP_TYPE_OCEAN_ROUTE + ); +} + +// Update & mix day / night bg palettes (into unfaded) +void UpdateAltBgPalettes(u16 palettes) { + const struct Tileset *primary = gMapHeader.mapLayout->primaryTileset; + const struct Tileset *secondary = gMapHeader.mapLayout->secondaryTileset; + u32 i = 1; + if (!MapHasNaturalLight(gMapHeader.mapType)) + return; + palettes &= ~((1 << NUM_PALS_IN_PRIMARY) - 1) | primary->swapPalettes; + palettes &= ((1 << NUM_PALS_IN_PRIMARY) - 1) | (secondary->swapPalettes << NUM_PALS_IN_PRIMARY); + palettes &= PALETTES_MAP ^ (1 << 0); // don't blend palette 0, [13,15] + palettes >>= 1; // start at palette 1 + if (!palettes) + return; + while (palettes) { + if (palettes & 1) { + if (i < NUM_PALS_IN_PRIMARY) + AvgPaletteWeighted(&((u16*)primary->palettes)[i*16], &((u16*)primary->palettes)[((i+9)%16)*16], gPlttBufferUnfaded + i * 16, currentTimeBlend.altWeight); + else + AvgPaletteWeighted(&((u16*)secondary->palettes)[i*16], &((u16*)secondary->palettes)[((i+9)%16)*16], gPlttBufferUnfaded + i * 16, currentTimeBlend.altWeight); + } + i++; + palettes >>= 1; + } +} + +void UpdatePalettesWithTime(u32 palettes) { + if (MapHasNaturalLight(gMapHeader.mapType)) { + u32 i; + u32 mask = 1 << 16; + if (palettes >= (1 << 16)) + for (i = 0; i < 16; i++, mask <<= 1) + if (IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(i))) + palettes &= ~(mask); + + palettes &= PALETTES_MAP | PALETTES_OBJECTS; // Don't blend UI pals + if (!palettes) + return; + TimeMixPalettes( + palettes, + gPlttBufferUnfaded, + gPlttBufferFaded, + (struct BlendSettings *)&gTimeOfDayBlend[currentTimeBlend.time0], + (struct BlendSettings *)&gTimeOfDayBlend[currentTimeBlend.time1], + currentTimeBlend.weight + ); + } +} + +u8 UpdateSpritePaletteWithTime(u8 paletteNum) { + if (MapHasNaturalLight(gMapHeader.mapType)) { + if (IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(paletteNum))) + return paletteNum; + TimeMixPalettes( + 1, + &gPlttBufferUnfaded[OBJ_PLTT_ID(paletteNum)], + &gPlttBufferFaded[OBJ_PLTT_ID(paletteNum)], + (struct BlendSettings *)&gTimeOfDayBlend[currentTimeBlend.time0], + (struct BlendSettings *)&gTimeOfDayBlend[currentTimeBlend.time1], + currentTimeBlend.weight + ); + } + return paletteNum; +} + static void OverworldBasic(void) { ScriptContext_RunScript(); @@ -1531,6 +1663,23 @@ static void OverworldBasic(void) UpdatePaletteFade(); UpdateTilesetAnimations(); DoScheduledBgTilemapCopiesToVram(); + // Every minute if no palette fade is active, update TOD blending as needed + if (!gPaletteFade.active && ++gTimeUpdateCounter >= 3600) { + struct TimeBlendSettings cachedBlend = { + .time0 = currentTimeBlend.time0, + .time1 = currentTimeBlend.time1, + .weight = currentTimeBlend.weight, + }; + gTimeUpdateCounter = 0; + UpdateTimeOfDay(); + if (cachedBlend.time0 != currentTimeBlend.time0 + || cachedBlend.time1 != currentTimeBlend.time1 + || cachedBlend.weight != currentTimeBlend.weight) + { + UpdateAltBgPalettes(PALETTES_BG); + UpdatePalettesWithTime(PALETTES_ALL); + } + } } // This CB2 is used when starting @@ -3266,6 +3415,8 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion) sprite->coordOffsetEnabled = TRUE; sprite->data[0] = linkPlayerId; objEvent->triggerGroundEffectsOnMove = FALSE; + objEvent->localId = OBJ_EVENT_ID_DYNAMIC_BASE + linkPlayerId; + SetUpShadow(objEvent, sprite); } } diff --git a/src/palette.c b/src/palette.c index 2526479ca8..867b96ddfb 100644 --- a/src/palette.c +++ b/src/palette.c @@ -11,11 +11,13 @@ enum NORMAL_FADE, FAST_FADE, HARDWARE_FADE, + TIME_OF_DAY_FADE, }; static u32 UpdateNormalPaletteFade(void); static void BeginFastPaletteFadeInternal(u32); static u32 UpdateFastPaletteFade(void); +static u8 UpdateTimeOfDayPaletteFade(void); static u32 UpdateHardwarePaletteFade(void); static void UpdateBlendRegisters(void); static bool32 IsSoftwarePaletteFadeFinishing(void); @@ -51,6 +53,16 @@ void LoadPalette(const void *src, u32 offset, u32 size) CpuCopy16(src, &gPlttBufferFaded[offset], size); } +// Drop in replacement for LoadPalette, uses CpuFastCopy, size must be 0 % 32 +void LoadPaletteFast(const void *src, u32 offset, u32 size) +{ + if ((u32)src & 3) // In case palette is not 4 byte aligned + return LoadPalette(src, offset, size); + CpuFastCopy(src, &gPlttBufferUnfaded[offset], size); + // Copying from EWRAM->EWRAM is faster than ROM->EWRAM + CpuFastCopy(&gPlttBufferUnfaded[offset], &gPlttBufferFaded[offset], size); +} + void FillPalette(u32 value, u32 offset, u32 size) { CpuFill16(value, &gPlttBufferUnfaded[offset], size); @@ -81,6 +93,8 @@ u32 UpdatePaletteFade(void) result = UpdateNormalPaletteFade(); else if (gPaletteFade.mode == FAST_FADE) result = UpdateFastPaletteFade(); + else if (gPaletteFade.mode == TIME_OF_DAY_FADE) + result = UpdateTimeOfDayPaletteFade(); else result = UpdateHardwarePaletteFade(); @@ -139,6 +153,56 @@ bool32 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targ } } +// Like normal palette fade but respects sprite/tile palettes immune to time of day fading +bool32 BeginTimeOfDayPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targetY, struct BlendSettings *bld0, struct BlendSettings *bld1, u32 weight, u32 color) +{ + u8 temp; + + if (gPaletteFade.active) + { + return FALSE; + } + else + { + gPaletteFade.deltaY = 2; + + if (delay < 0) + { + gPaletteFade.deltaY += (delay * -1); + delay = 0; + } + + gPaletteFade_selectedPalettes = selectedPalettes; + gPaletteFade.delayCounter = delay; + gPaletteFade_delay = delay; + gPaletteFade.y = startY; + gPaletteFade.targetY = targetY; + gPaletteFade.active = 1; + gPaletteFade.mode = TIME_OF_DAY_FADE; + + gPaletteFade.blendColor = color; + gPaletteFade.bld0 = bld0; + gPaletteFade.bld1 = bld1; + gPaletteFade.weight = weight; + + if (startY < targetY) + gPaletteFade.yDec = 0; + else + gPaletteFade.yDec = 1; + + UpdatePaletteFade(); + + temp = gPaletteFade.bufferTransferDisabled; + gPaletteFade.bufferTransferDisabled = 0; + CpuCopy32(gPlttBufferFaded, (void *)PLTT, PLTT_SIZE); + sPlttBufferTransferPending = 0; + if (gPaletteFade.mode == HARDWARE_FADE && gPaletteFade.active) + UpdateBlendRegisters(); + gPaletteFade.bufferTransferDisabled = temp; + return TRUE; + } +} + void ResetPaletteFadeControl(void) { gPaletteFade.multipurpose1 = 0; @@ -159,6 +223,114 @@ void ResetPaletteFadeControl(void) gPaletteFade.deltaY = 2; } +// Like normal palette fade, but respects sprite/tile palettes immune to time of day fading +static u8 UpdateTimeOfDayPaletteFade(void) +{ + u8 paletteNum; + u16 paletteOffset; + u16 selectedPalettes; + u16 timePalettes = 0; // palettes passed to the time-blender + u16 copyPalettes; + u16 * src; + u16 * dst; + + if (!gPaletteFade.active) + return PALETTE_FADE_STATUS_DONE; + + if (IsSoftwarePaletteFadeFinishing()) + return gPaletteFade.active ? PALETTE_FADE_STATUS_ACTIVE : PALETTE_FADE_STATUS_DONE; + + if (!gPaletteFade.objPaletteToggle) + { + if (gPaletteFade.delayCounter < gPaletteFade_delay) + { + gPaletteFade.delayCounter++; + return 2; + } + gPaletteFade.delayCounter = 0; + } + + paletteOffset = 0; + + if (!gPaletteFade.objPaletteToggle) + { + selectedPalettes = gPaletteFade_selectedPalettes; + } + else + { + selectedPalettes = gPaletteFade_selectedPalettes >> 16; + paletteOffset = 256; + } + + src = gPlttBufferUnfaded + paletteOffset; + dst = gPlttBufferFaded + paletteOffset; + + // First pply TOD blend to relevant subset of palettes + if (gPaletteFade.objPaletteToggle) { // Sprite palettes, don't blend those with tags + u32 i; + u32 j = 1; + for (i = 0; i < 16; i++, j <<= 1) { // Mask out palettes that should not be light blended + if ((selectedPalettes & j) && !IS_BLEND_IMMUNE_TAG(GetSpritePaletteTagByPaletteNum(i))) + timePalettes |= j; + } + } else { // tile palettes, don't blend [13, 15] + timePalettes = selectedPalettes & PALETTES_MAP; + } + TimeMixPalettes(timePalettes, src, dst, gPaletteFade.bld0, gPaletteFade.bld1, gPaletteFade.weight); + + // palettes that were not blended above must be copied through + if ((copyPalettes = ~timePalettes)) { + u16 * src1 = src; + u16 * dst1 = dst; + while (copyPalettes) { + if (copyPalettes & 1) + CpuFastCopy(src1, dst1, 32); + copyPalettes >>= 1; + src1 += 16; + dst1 += 16; + } + } + + // Then, blend from faded->faded with native BlendPalettes + BlendPalettesFine(selectedPalettes, dst, dst, gPaletteFade.y, gPaletteFade.blendColor); + + gPaletteFade.objPaletteToggle ^= 1; + + if (!gPaletteFade.objPaletteToggle) + { + if ((gPaletteFade.yDec && gPaletteFade.y == 0) || (!gPaletteFade.yDec && gPaletteFade.y == gPaletteFade.targetY)) + { + gPaletteFade_selectedPalettes = 0; + gPaletteFade.softwareFadeFinishing = 1; + } + else + { + s8 val; + + if (!gPaletteFade.yDec) + { + val = gPaletteFade.y; + val += gPaletteFade.deltaY; + if (val > gPaletteFade.targetY) + val = gPaletteFade.targetY; + gPaletteFade.y = val; + } + else + { + val = gPaletteFade.y; + val -= gPaletteFade.deltaY; + if (val < 0) + val = 0; + gPaletteFade.y = val; + } + } + } + + // gPaletteFade.active cannot change since the last time it was checked. So this + // is equivalent to `return PALETTE_FADE_STATUS_ACTIVE;` + return PALETTE_FADE_STATUS_ACTIVE; +} + static u32 UpdateNormalPaletteFade(void) { u16 paletteOffset; @@ -583,15 +755,234 @@ static bool32 IsSoftwarePaletteFadeFinishing(void) } } -void BlendPalettes(u32 selectedPalettes, u8 coeff, u32 color) -{ - u16 paletteOffset; +// optimized based on lucktyphlosion's BlendPalettesFine +void BlendPalettesFine(u32 palettes, u16 *src, u16 *dst, u32 coeff, u32 color) { + s32 newR, newG, newB; - for (paletteOffset = 0; selectedPalettes; paletteOffset += 16) - { - if (selectedPalettes & 1) - BlendPalette(paletteOffset, 16, coeff, color); - selectedPalettes >>= 1; + if (!palettes) + return; + + coeff *= 2; + newR = (color << 27) >> 27; + newG = (color << 22) >> 27; + newB = (color << 17) >> 27; + + do { + if (palettes & 1) { + u16 *srcEnd = src + 16; + while (src != srcEnd) { // Transparency is blended (for backdrop reasons) + u32 srcColor = *src; + s32 r = (srcColor << 27) >> 27; + s32 g = (srcColor << 22) >> 27; + s32 b = (srcColor << 16) >> 26; + + *dst++ = ((r + (((newR - r) * (s32)coeff) >> 5)) << 0) + | ((g + (((newG - g) * (s32)coeff) >> 5)) << 5) + | ((b + (((newB - (b & 31)) * (s32)coeff) >> 5)) << 10); + src++; + } + } else { + src += 16; + dst += 16; + } + palettes >>= 1; + } while (palettes); +} + +void BlendPalettes(u32 selectedPalettes, u8 coeff, u32 color) { + BlendPalettesFine(selectedPalettes, gPlttBufferUnfaded, gPlttBufferFaded, coeff, color); +} + +#define DEFAULT_LIGHT_COLOR 0x3f9f + +// Like BlendPalette, but ignores blendColor if the transparency high bit is set +// Optimization help by lucktyphlosion +void TimeBlendPalette(u16 palOffset, u32 coeff, u32 blendColor) { + s32 newR, newG, newB, defR, defG, defB; + u16 * src = gPlttBufferUnfaded + palOffset; + u16 * dst = gPlttBufferFaded + palOffset; + u32 defaultBlendColor = DEFAULT_LIGHT_COLOR; + u16 *srcEnd = src + 16; + u32 altBlendColor = *dst++ = *src++; // color 0 is copied through unchanged + + coeff *= 2; + newR = (blendColor << 27) >> 27; + newG = (blendColor << 22) >> 27; + newB = (blendColor << 17) >> 27; + + if (altBlendColor >> 15) { // Transparency high bit set; alt blend color + defR = (altBlendColor << 27) >> 27; + defG = (altBlendColor << 22) >> 27; + defB = (altBlendColor << 17) >> 27; + } else { + defR = (defaultBlendColor << 27) >> 27; + defG = (defaultBlendColor << 22) >> 27; + defB = (defaultBlendColor << 17) >> 27; + altBlendColor = 0; + } + while (src != srcEnd) { + u32 srcColor = *src; + s32 r = (srcColor << 27) >> 27; + s32 g = (srcColor << 22) >> 27; + s32 b = (srcColor << 16) >> 26; + + if (srcColor >> 15) { + *dst = ((r + (((defR - r) * (s32)coeff) >> 5)) << 0) + | ((g + (((defG - g) * (s32)coeff) >> 5)) << 5) + | ((b + (((defB - (b & 31)) * (s32)coeff) >> 5)) << 10); + } else { // Use provided blend color + *dst = ((r + (((newR - r) * (s32)coeff) >> 5)) << 0) + | ((g + (((newG - g) * (s32)coeff) >> 5)) << 5) + | ((b + (((newB - (b & 31)) * (s32)coeff) >> 5)) << 10); + } + src++; + dst++; + } +} + +// Blends a weighted average of two blend parameters +// Parameters can be either blended (as in BlendPalettes) or tinted (as in TintPaletteRGB_Copy) +void TimeMixPalettes(u32 palettes, u16 *src, u16 *dst, struct BlendSettings *blend0, struct BlendSettings *blend1, u16 weight0) { + s32 r0, g0, b0, r1, g1, b1, defR, defG, defB, altR, altG, altB; + u32 color0, coeff0, color1, coeff1; + bool8 tint0, tint1; + u32 defaultColor = DEFAULT_LIGHT_COLOR; + + if (!palettes) + return; + + color0 = blend0->blendColor; + tint0 = blend0->isTint; + coeff0 = tint0 ? 8*2 : blend0->coeff*2; + color1 = blend1->blendColor; + tint1 = blend1->isTint; + coeff1 = tint1 ? 8*2 : blend1->coeff*2; + + if (tint0) { + r0 = (color0 << 24) >> 24; + g0 = (color0 << 16) >> 24; + b0 = (color0 << 8) >> 24; + } else { + r0 = (color0 << 27) >> 27; + g0 = (color0 << 22) >> 27; + b0 = (color0 << 17) >> 27; + } + if (tint1) { + r1 = (color1 << 24) >> 24; + g1 = (color1 << 16) >> 24; + b1 = (color1 << 8) >> 24; + } else { + r1 = (color1 << 27) >> 27; + g1 = (color1 << 22) >> 27; + b1 = (color1 << 17) >> 27; + } + defR = (defaultColor << 27) >> 27; + defG = (defaultColor << 22) >> 27; + defB = (defaultColor << 17) >> 27; + + do { + if (palettes & 1) { + u16 *srcEnd = src + 16; + u32 altBlendColor = *dst++ = *src++; // color 0 is copied through + if (altBlendColor >> 15) { // Transparency high bit set; alt blend color + altR = (altBlendColor << 27) >> 27; + altG = (altBlendColor << 22) >> 27; + altB = (altBlendColor << 17) >> 27; + } else { + altBlendColor = 0; + } + while (src != srcEnd) { + u32 srcColor = *src; + s32 r = (srcColor << 27) >> 27; + s32 g = (srcColor << 22) >> 27; + s32 b = (srcColor << 17) >> 27; + s32 r2, g2, b2; + + if (srcColor >> 15) { + if (altBlendColor) { // Use alternate blend color + r2 = r + (((altR - r) * (s32)coeff1) >> 5); + g2 = g + (((altG - g) * (s32)coeff1) >> 5); + b2 = b + (((altB - b) * (s32)coeff1) >> 5); + r = r + (((altR - r) * (s32)coeff0) >> 5); + g = g + (((altG - g) * (s32)coeff0) >> 5); + b = b + (((altB - b) * (s32)coeff0) >> 5); + } else { // Use default blend color + r2 = r + (((defR - r) * (s32)coeff1) >> 5); + g2 = g + (((defG - g) * (s32)coeff1) >> 5); + b2 = b + (((defB - b) * (s32)coeff1) >> 5); + r = r + (((defR - r) * (s32)coeff0) >> 5); + g = g + (((defG - g) * (s32)coeff0) >> 5); + b = b + (((defB - b) * (s32)coeff0) >> 5); + } + } else { // Use provided blend colors + if (!tint1) { // blend-based + r2 = (r + (((r1 - r) * (s32)coeff1) >> 5)); + g2 = (g + (((g1 - g) * (s32)coeff1) >> 5)); + b2 = (b + (((b1 - b) * (s32)coeff1) >> 5)); + } else { // tint-based + r2 = (u16)((r1 * r)) >> 8; + g2 = (u16)((g1 * g)) >> 8; + b2 = (u16)((b1 * b)) >> 8; + if (r2 > 31) + r2 = 31; + if (g2 > 31) + g2 = 31; + if (b2 > 31) + b2 = 31; + } + if (!tint0) { // blend-based + r = (r + (((r0 - r) * (s32)coeff0) >> 5)); + g = (g + (((g0 - g) * (s32)coeff0) >> 5)); + b = (b + (((b0 - b) * (s32)coeff0) >> 5)); + } else { // tint-based + r = (u16)((r0 * r)) >> 8; + g = (u16)((g0 * g)) >> 8; + b = (u16)((b0 * b)) >> 8; + if (r > 31) + r = 31; + if (g > 31) + g = 31; + if (b > 31) + b = 31; + } + } + r = r2 + (((r - r2) * (s32)weight0) >> 8); + g = g2 + (((g - g2) * (s32)weight0) >> 8); + b = b2 + (((b - b2) * (s32)weight0) >> 8); + *dst++ = RGB2(r, g, b); + // *dst++ = RGB2(r, g, b) | (srcColor >> 15) << 15; + src++; + } + } else { + src += 16; + dst += 16; + } + palettes >>= 1; + } while (palettes); +} + +// Apply weighted average to palettes, preserving high bits of dst throughout +void AvgPaletteWeighted(u16 *src0, u16 *src1, u16 *dst, u16 weight0) { + u16 *srcEnd = src0 + 16; + src0++; + src1++; + dst++; // leave dst transparency unchanged + while (src0 != srcEnd) { + u32 src0Color = *src0++; + s32 r0 = (src0Color << 27) >> 27; + s32 g0 = (src0Color << 22) >> 27; + s32 b0 = (src0Color << 17) >> 27; + u32 src1Color = *src1++; + s32 r1 = (src1Color << 27) >> 27; + s32 g1 = (src1Color << 22) >> 27; + s32 b1 = (src1Color << 17) >> 27; + + // Average and bitwise-OR + r0 = r1 + (((r0 - r1) * weight0) >> 8); + g0 = g1 + (((g0 - g1) * weight0) >> 8); + b0 = b1 + (((b0 - b1) * weight0) >> 8); + *dst = (*dst & RGB_ALPHA) | RGB2(r0, g0, b0); // preserve high bit of dst + dst++; } } @@ -694,6 +1085,63 @@ void TintPalette_CustomTone(u16 *palette, u32 count, u16 rTone, u16 gTone, u16 b } } +// Tints from Unfaded to Faded, using a 15-bit GBA color +void TintPalette_RGB_Copy(u16 palOffset, u32 blendColor) { + s32 newR, newG, newB, rTone = 0, gTone = 0, bTone = 0; + u16 * src = gPlttBufferUnfaded + palOffset; + u16 * dst = gPlttBufferFaded + palOffset; + u32 defaultBlendColor = DEFAULT_LIGHT_COLOR; + u16 *srcEnd = src + 16; + u16 altBlendIndices = *dst++ = *src++; // color 0 is copied through unchanged + u32 altBlendColor; + + newR = ((blendColor << 27) >> 27) << 3; + newG = ((blendColor << 22) >> 27) << 3; + newB = ((blendColor << 17) >> 27) << 3; + + if (altBlendIndices >> 15) { // High bit set; bitmask of which colors to alt-blend + // Note that bit 0 of altBlendIndices specifies color 1 + altBlendColor = src[14]; // color 15 + if (altBlendColor >> 15) { // Set alternate blend color + rTone = ((altBlendColor << 27) >> 27) << 3; + gTone = ((altBlendColor << 22) >> 27) << 3; + bTone = ((altBlendColor << 17) >> 27) << 3; + } else { // Set default blend color + rTone = ((defaultBlendColor << 27) >> 27) << 3; + gTone = ((defaultBlendColor << 22) >> 27) << 3; + bTone = ((defaultBlendColor << 17) >> 27) << 3; + } + } else { + altBlendIndices = 0; + } + + while (src != srcEnd) { + u32 srcColor = *src; + s32 r = (srcColor << 27) >> 27; + s32 g = (srcColor << 22) >> 27; + s32 b = (srcColor << 17) >> 27; + + if (altBlendIndices & 1) { + r = (u16)((rTone * r)) >> 8; + g = (u16)((gTone * g)) >> 8; + b = (u16)((bTone * b)) >> 8; + } else { // Use provided blend color + r = (u16)((newR * r)) >> 8; + g = (u16)((newG * g)) >> 8; + b = (u16)((newB * b)) >> 8; + } + if (r > 31) + r = 31; + if (g > 31) + g = 31; + if (b > 31) + b = 31; + src++; + *dst++ = RGB2(r, g, b); + altBlendIndices >>= 1; + } +} + #define tCoeff data[0] #define tCoeffTarget data[1] #define tCoeffDelta data[2] diff --git a/src/palette_util.c b/src/palette_util.c index d24321d580..54549ffcce 100644 --- a/src/palette_util.c +++ b/src/palette_util.c @@ -2,6 +2,7 @@ #include "palette.h" #include "palette_util.h" #include "util.h" +#include "overworld.h" // "RouletteFlash" is more accurately a general flashing/fading util // this file handles fading the palettes for the color/icon selections on the Roulette wheel @@ -384,7 +385,11 @@ void UpdatePulseBlend(struct PulseBlend *pulseBlend) if (--pulseBlendPalette->delayCounter == 0xFF) { pulseBlendPalette->delayCounter = pulseBlendPalette->pulseBlendSettings.delay; - BlendPalette(pulseBlendPalette->pulseBlendSettings.paletteOffset, pulseBlendPalette->pulseBlendSettings.numColors, pulseBlendPalette->blendCoeff, pulseBlendPalette->pulseBlendSettings.blendColor); + CpuFastCopy(gPlttBufferUnfaded + pulseBlendPalette->pulseBlendSettings.paletteOffset, gPlttBufferFaded + pulseBlendPalette->pulseBlendSettings.paletteOffset, PLTT_SIZE_4BPP); + UpdatePalettesWithTime(1 << (pulseBlendPalette->pulseBlendSettings.paletteOffset >> 4)); + // pulseBlendSettings has a numColors field, but it is only ever set to 16 (for mirage tower) + // So, it's ok to use the fine blending here which blends the entire palette + BlendPalettesFine(1, gPlttBufferFaded + pulseBlendPalette->pulseBlendSettings.paletteOffset, gPlttBufferFaded + pulseBlendPalette->pulseBlendSettings.paletteOffset, pulseBlendPalette->blendCoeff, pulseBlendPalette->pulseBlendSettings.blendColor); switch (pulseBlendPalette->pulseBlendSettings.fadeType) { case 0: // Fade all the way to the max blend amount, then wrap around diff --git a/src/rotating_gate.c b/src/rotating_gate.c index 57cb9fa7eb..796c64cecb 100644 --- a/src/rotating_gate.c +++ b/src/rotating_gate.c @@ -740,7 +740,7 @@ static u8 RotatingGate_CreateGate(u8 gateId, s16 deltaX, s16 deltaY) template.tileTag = gate->shape + ROTATING_GATE_TILE_TAG; - spriteId = CreateSprite(&template, 0, 0, 0x93); + spriteId = CreateSprite(&template, 0, 0, 0x93); // 0x93 is above shadows (0x94) if (spriteId == MAX_SPRITES) return MAX_SPRITES; diff --git a/src/scrcmd.c b/src/scrcmd.c index 319e667566..d8b2643f43 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -631,6 +631,12 @@ static bool8 IsPaletteNotActive(void) return FALSE; } +// pauses script until palette fade inactive +bool8 ScrFunc_WaitPaletteNotActive(struct ScriptContext *ctx) { + SetupNativeScript(ctx, IsPaletteNotActive); + return TRUE; +} + bool8 ScrCmd_fadescreen(struct ScriptContext *ctx) { FadeScreen(ScriptReadByte(ctx), 0); @@ -651,6 +657,7 @@ bool8 ScrCmd_fadescreenspeed(struct ScriptContext *ctx) bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx) { u8 mode = ScriptReadByte(ctx); + u8 nowait = ScriptReadByte(ctx); switch (mode) { @@ -667,6 +674,8 @@ bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx) break; } + if (nowait) + return FALSE; SetupNativeScript(ctx, IsPaletteNotActive); return TRUE; } diff --git a/src/shop.c b/src/shop.c index 77f2039e3b..bf298f5f01 100644 --- a/src/shop.c +++ b/src/shop.c @@ -41,7 +41,7 @@ #include "constants/songs.h" #define TAG_SCROLL_ARROW 2100 -#define TAG_ITEM_ICON_BASE 2110 +#define TAG_ITEM_ICON_BASE 9110 // immune to time blending #define MAX_ITEMS_SHOWN 8 diff --git a/src/trainer_see.c b/src/trainer_see.c index 67ab2ebe1d..9a2b04d1b8 100644 --- a/src/trainer_see.c +++ b/src/trainer_see.c @@ -321,6 +321,10 @@ static const union AnimCmd *const sSpriteAnimTable_Emotes[] = sSpriteAnim_Emotes10, }; +// TODO: Move these declarations into even_object_movement.h +#define OBJ_EVENT_PAL_TAG_MAY 0x1110 +#define OBJ_EVENT_PAL_TAG_EMOTES 0x8003 + static const struct SpriteTemplate sSpriteTemplate_ExclamationQuestionMark = { .tileTag = TAG_NONE, diff --git a/src/util.c b/src/util.c index 002b2fabf0..1d9db59160 100644 --- a/src/util.c +++ b/src/util.c @@ -228,6 +228,7 @@ u32 CalcByteArraySum(const u8 *data, u32 length) void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u32 blendColor) { u16 i; + struct PlttData *data2 = (struct PlttData *)&blendColor; for (i = 0; i < numEntries; i++) { u16 index = i + palOffset; @@ -235,7 +236,7 @@ void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u32 blendColor) s8 r = data1->r; s8 g = data1->g; s8 b = data1->b; - struct PlttData *data2 = (struct PlttData *)&blendColor; + gPlttBufferFaded[index] = RGB(r + (((data2->r - r) * coeff) >> 4), g + (((data2->g - g) * coeff) >> 4), b + (((data2->b - b) * coeff) >> 4)); diff --git a/tools/gbagfx/gfx.c b/tools/gbagfx/gfx.c index 1dfc38e2d0..c413e4b0f0 100644 --- a/tools/gbagfx/gfx.c +++ b/tools/gbagfx/gfx.c @@ -14,6 +14,7 @@ #define GET_GBA_PAL_BLUE(x) (((x) >> 10) & 0x1F) #define SET_GBA_PAL(r, g, b) (((b) << 10) | ((g) << 5) | (r)) +#define SET_GBA_PAL_RGBA(r, g, b, a) (((a) << 15) | ((b) << 10) | ((g) << 5) | (r)) #define UPCONVERT_BIT_DEPTH(x) (((x) * 255) / 31) @@ -578,8 +579,9 @@ void WriteGbaPalette(char *path, struct Palette *palette) unsigned char red = DOWNCONVERT_BIT_DEPTH(palette->colors[i].red); unsigned char green = DOWNCONVERT_BIT_DEPTH(palette->colors[i].green); unsigned char blue = DOWNCONVERT_BIT_DEPTH(palette->colors[i].blue); + bool alpha = palette->colors[i].alpha; - uint16_t paletteEntry = SET_GBA_PAL(red, green, blue); + uint16_t paletteEntry = SET_GBA_PAL_RGBA(red, green, blue, alpha); fputc(paletteEntry & 0xFF, fp); fputc(paletteEntry >> 8, fp); diff --git a/tools/gbagfx/gfx.h b/tools/gbagfx/gfx.h index 1797d84dfd..30bbfeb8df 100644 --- a/tools/gbagfx/gfx.h +++ b/tools/gbagfx/gfx.h @@ -10,6 +10,7 @@ struct Color { unsigned char red; unsigned char green; unsigned char blue; + bool alpha; }; struct Palette { diff --git a/tools/gbagfx/jasc_pal.c b/tools/gbagfx/jasc_pal.c index 8d4bb137d5..732db08a1b 100644 --- a/tools/gbagfx/jasc_pal.c +++ b/tools/gbagfx/jasc_pal.c @@ -22,7 +22,7 @@ // Blue - "0 0 255\r\n" // Brown - "150 75 0\r\n" -#define MAX_LINE_LENGTH 11 +#define MAX_LINE_LENGTH 64 void ReadJascPaletteLine(FILE *fp, char *line) { @@ -156,6 +156,43 @@ void ReadJascPalette(char *path, struct Palette *palette) FATAL_ERROR("Garbage after color data.\n"); fclose(fp); + + // Try to parse alpha/high bit info for colors from auxiliary .pla file + char *dot = strrchr(path, '.'); + if (strcmp(dot, ".pal") != 0) + return; + strcpy(dot, ".pla"); // replace .pal with .pla + fp = fopen(path, "rb"); + + if (fp == NULL) + return; + // fprintf(stderr, "Opened auxiliary .pla file for reading: %s\n", path); + + int i = 0; + // Keep reading lines until number of colors is reached or we run out + while (i < palette->numColors && fgets(line, MAX_LINE_LENGTH, fp) != NULL) + { + if (line[0] == '#') // comment line; ignore + continue; + + char *s = line; + char *end; + int colorIndex; + + if (!ParseNumber(s, &end, 10, &colorIndex)) + FATAL_ERROR("Failed to parse aux color index.\n"); + + s = end; + + if (colorIndex >= palette->numColors) + FATAL_ERROR("Aux color index %d out of bounds.\n", colorIndex); + + palette->colors[colorIndex].alpha = 1; // set alpha color + // fprintf(stderr, "Color index: %d\n", colorIndex); + i++; + } + + fclose(fp); } void WriteJascPalette(char *path, struct Palette *palette) diff --git a/tools/gbagfx/main.c b/tools/gbagfx/main.c index 98a1a1edf9..bb1691c59a 100644 --- a/tools/gbagfx/main.c +++ b/tools/gbagfx/main.c @@ -291,7 +291,7 @@ void HandlePngToGbaCommand(char *inputPath, char *outputPath, int argc, char **a void HandlePngToJascPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED) { - struct Palette palette = {}; + struct Palette palette = {0}; ReadPngPalette(inputPath, &palette); WriteJascPalette(outputPath, &palette); @@ -299,7 +299,7 @@ void HandlePngToJascPaletteCommand(char *inputPath, char *outputPath, int argc U void HandlePngToGbaPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED) { - struct Palette palette = {}; + struct Palette palette = {0}; ReadPngPalette(inputPath, &palette); WriteGbaPalette(outputPath, &palette); @@ -307,7 +307,7 @@ void HandlePngToGbaPaletteCommand(char *inputPath, char *outputPath, int argc UN void HandleGbaToJascPaletteCommand(char *inputPath, char *outputPath, int argc UNUSED, char **argv UNUSED) { - struct Palette palette = {}; + struct Palette palette = {0}; ReadGbaPalette(inputPath, &palette); WriteJascPalette(outputPath, &palette); @@ -340,7 +340,7 @@ void HandleJascToGbaPaletteCommand(char *inputPath, char *outputPath, int argc, } } - struct Palette palette = {}; + struct Palette palette = {0}; ReadJascPalette(inputPath, &palette);