From afb66b4d2b5fb4c1b463998619c6940f0ee3bcc1 Mon Sep 17 00:00:00 2001 From: RavePossum Date: Tue, 7 May 2024 23:58:29 -0400 Subject: [PATCH] preproc assets, move config to overworld config, add some antialiasing to graphics, consistency in naming gens --- graphics/map_popup/bw/black.pal | 10 +++--- graphics/map_popup/bw/bw_primary.png | Bin 9264 -> 9289 bytes graphics/map_popup/bw/bw_secondary.png | Bin 9265 -> 9295 bytes graphics/map_popup/bw/white.pal | 8 ++--- include/config/map_name_popup.h | 23 ------------- include/config/overworld.h | 18 +++++++++++ src/field_weather.c | 8 ++--- src/map_name_popup.c | 43 ++++++++++++++----------- src/menu.c | 8 ++--- 9 files changed, 60 insertions(+), 58 deletions(-) delete mode 100644 include/config/map_name_popup.h diff --git a/graphics/map_popup/bw/black.pal b/graphics/map_popup/bw/black.pal index 696191f6ba..ef4da4d29c 100644 --- a/graphics/map_popup/bw/black.pal +++ b/graphics/map_popup/bw/black.pal @@ -4,16 +4,16 @@ JASC-PAL 0 0 0 0 0 0 255 255 255 -41 49 90 +84 85 89 0 0 0 238 230 238 189 180 197 139 139 164 90 90 123 41 49 90 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +27 27 27 +40 40 40 +51 51 51 +62 62 62 0 0 0 0 0 0 diff --git a/graphics/map_popup/bw/bw_primary.png b/graphics/map_popup/bw/bw_primary.png index 72602052fe3e30f2d01371a5c526bc34e08f3fb0..9dd681ff0abbcafb3ab4ea60937ffee9ce3d07c5 100644 GIT binary patch delta 195 zcmV;!06hP&NXbaBbt5ZORapQ40Pg1Qy|l%Pi=CGd?~(00000 z003W#k`afg4s(jdkJQ55pb27L^37&}a2OHyT x!2xjdz(H{+Y8;9hhoZ)zR7i+J-CpJrozSEtk-7G81ON*F002ovPDHLkV1jH*RC@pb delta 169 zcmX@WS>PeN=&C-D&7Q7) JF6*2UngFEWMP2{^ diff --git a/graphics/map_popup/bw/bw_secondary.png b/graphics/map_popup/bw/bw_secondary.png index 39ad7d2e062cefcbb1adf1ef11717580a73546e9..b63ce95311a81d645d8c1d324a3aba32f6b90818 100644 GIT binary patch delta 201 zcmV;)05<=zNY6;Hbt5ZORapQ40Pg1Qy|l%Pi=CGd?~(00000 z003W# zP{&zbFOx6MBDD}b#fP8=c#B|m5zH=v*+nqB?SgNjVT=G$ZAhl KKbLh*2~7al%|#sm diff --git a/graphics/map_popup/bw/white.pal b/graphics/map_popup/bw/white.pal index 4b72f67ecb..8706c80d4e 100644 --- a/graphics/map_popup/bw/white.pal +++ b/graphics/map_popup/bw/white.pal @@ -11,9 +11,9 @@ JASC-PAL 139 139 164 90 90 123 41 49 90 -0 0 0 -0 0 0 -0 0 0 -0 0 0 +228 228 228 +215 215 215 +204 204 204 +193 193 193 0 0 0 0 0 0 diff --git a/include/config/map_name_popup.h b/include/config/map_name_popup.h deleted file mode 100644 index 5e5c3e3abf..0000000000 --- a/include/config/map_name_popup.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef GUARD_CONFIG_MAP_POPUP_H -#define GUARD_CONFIG_MAP_POPUP_H - -// General map pop-up config -#define MAP_POPUP_GENERATION GEN_3 // Different generations display location names in overworld pop-ups differently - // only current other choice is GEN_5, all others will default to gen 3 pop-ups - -// Gen 5 specific pop-up config -// Constants -#define MAP_POPUP_BW_TIME_NONE 0 // don't show the time -#define MAP_POPUP_BW_TIME_12_HR 1 // use 12 hour (AM/PM) time -#define MAP_POPUP_BW_TIME_24_HR 2 // use 24 hour time - -#define MAP_POPUP_BW_COLOR_BLACK 0 -#define MAP_POPUP_BW_COLOR_WHITE 1 - -// Configuration -#define MAP_POPUP_BW_COLOR MAP_POPUP_BW_COLOR_BLACK // Black 2 and White 2 use different colors for their map pop-ups -#define MAP_POPUP_BW_TIME_MODE MAP_POPUP_BW_TIME_NONE // determines what type of time is shown -#define MAP_POPUP_BW_ALPHA_BLEND FALSE // enables alpha blending/transparency for the pop-ups - // mostly intended to be used with the black color option - -#endif // GUARD_CONFIG_MAP_POPUP_H diff --git a/include/config/overworld.h b/include/config/overworld.h index ee1c1658dd..4b11ea2c91 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -53,4 +53,22 @@ #define BATTLE_PYRAMID_RANDOM_ENCOUNTERS FALSE // If set to TRUE, battle pyramid Pokemon will be generated randomly based on the round's challenge instead of hardcoded in src/data/battle_frontier/battle_pyramid_level_50_wild_mons.h (or open_level_wild_mons.h) +// Map pop-up config +#define OW_POPUP_GENERATION GEN_3 // Different generations display location names in overworld pop-ups differently. + // Only choies are currently GEN_3 and GEN_5, all others will default to Gen3 pop-ups. + +// Gen5 map pop-up config +// Constants +#define OW_POPUP_BW_TIME_NONE 0 // Don't show the time +#define OW_POPUP_BW_TIME_12_HR 1 // Use 12 hour (AM/PM) time +#define OW_POPUP_BW_TIME_24_HR 2 // Use 24 hour time + +#define OW_POPUP_BW_COLOR_BLACK 0 // Black pop-up from B2 +#define OW_POPUP_BW_COLOR_WHITE 1 // White pop-up from W2 + +// Configuration +#define OW_POPUP_BW_COLOR OW_POPUP_BW_COLOR_BLACK // B2W2 use different colors for their map pop-ups. +#define OW_POPUP_BW_TIME_MODE OW_POPUP_BW_TIME_NONE // Determines what type of time is shown. +#define OW_POPUP_BW_ALPHA_BLEND FALSE // Enables alpha blending/transparency for the pop-ups. Mainly intended to be used with the black color option. + #endif // GUARD_CONFIG_OVERWORLD_H diff --git a/src/field_weather.c b/src/field_weather.c index 0466ab4062..d1a0b531eb 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -1107,8 +1107,8 @@ void ResetPreservedPalettesInWeather(void) bool8 IsWeatherAlphaBlend(void) { - return gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL || - gWeatherPtr->currWeather == WEATHER_FOG_DIAGONAL || - gWeatherPtr->currWeather == WEATHER_UNDERWATER_BUBBLES || - gWeatherPtr->currWeather == WEATHER_UNDERWATER; + return (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) || + (gWeatherPtr->currWeather == WEATHER_FOG_DIAGONAL) || + (gWeatherPtr->currWeather == WEATHER_UNDERWATER_BUBBLES) || + (gWeatherPtr->currWeather == WEATHER_UNDERWATER); } diff --git a/src/map_name_popup.c b/src/map_name_popup.c index e690fabff6..8c8464164d 100644 --- a/src/map_name_popup.c +++ b/src/map_name_popup.c @@ -20,7 +20,7 @@ #include "constants/layouts.h" #include "constants/region_map_sections.h" #include "constants/weather.h" -#include "config/map_name_popup.h" +#include "config/overworld.h" #include "config.h" // enums @@ -188,11 +188,18 @@ static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping[] = [MAPSEC_TRAINER_HILL - KANTO_MAPSEC_COUNT] = MAPPOPUP_THEME_MARBLE }; -// gen 5 assets +#if OW_POPUP_GENERATION == GEN_5 +// Gen5 assets static const u8 sMapPopUpTilesPrimary_BW[] = INCBIN_U8("graphics/map_popup/bw/bw_primary.4bpp"); static const u8 sMapPopUpTilesSecondary_BW[] = INCBIN_U8("graphics/map_popup/bw/bw_secondary.4bpp"); static const u16 sMapPopUpTilesPalette_BW_Black[16] = INCBIN_U16("graphics/map_popup/bw/black.gbapal"); static const u16 sMapPopUpTilesPalette_BW_White[16] = INCBIN_U16("graphics/map_popup/bw/white.gbapal"); +#else +static const u8 sMapPopUpTilesPrimary_BW[] = {0}; +static const u8 sMapPopUpTilesSecondary_BW[] = {0}; +static const u16 sMapPopUpTilesPalette_BW_Black[] = {0}; +static const u16 sMapPopUpTilesPalette_BW_White[] = {0}; +#endif static const u8 sRegionMapSectionId_To_PopUpThemeIdMapping_BW[] = { @@ -341,7 +348,7 @@ enum { STATE_PRINT, // For some reason the first state is numerically last. }; -#define POPUP_OFFSCREEN_Y ((MAP_POPUP_GENERATION == GEN_5) ? 24 : 40) +#define POPUP_OFFSCREEN_Y ((OW_POPUP_GENERATION == GEN_5) ? 24 : 40) #define POPUP_SLIDE_SPEED 2 #define tState data[0] @@ -357,11 +364,11 @@ void ShowMapNamePopup(void) if (!FuncIsActiveTask(Task_MapNamePopUpWindow)) { // New pop up window - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) { gPopupTaskId = CreateTask(Task_MapNamePopUpWindow, 100); - if (MAP_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) + if (OW_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); } else @@ -397,7 +404,7 @@ static void Task_MapNamePopUpWindow(u8 taskId) task->tState = STATE_SLIDE_IN; task->tPrintTimer = 0; ShowMapNamePopUpWindow(); - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) { EnableInterrupts(INTR_FLAG_HBLANK); SetHBlankCallback(HBlankCB_DoublePopupWindow); @@ -445,7 +452,7 @@ static void Task_MapNamePopUpWindow(u8 taskId) break; case STATE_ERASE: ClearStdWindowAndFrame(GetMapNamePopUpWindowId(), TRUE); - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) ClearStdWindowAndFrame(GetSecondaryPopUpWindowId(), TRUE); task->tState = STATE_END; break; @@ -453,7 +460,7 @@ static void Task_MapNamePopUpWindow(u8 taskId) HideMapNamePopUpWindow(); return; } -if (MAP_POPUP_GENERATION != GEN_5) +if (OW_POPUP_GENERATION != GEN_5) SetGpuReg(REG_OFFSET_BG0VOFS, task->tYOffset); } @@ -469,7 +476,7 @@ void HideMapNamePopUpWindow(void) RemoveMapNamePopUpWindow(); } - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) { if (GetSecondaryPopUpWindowId() != WINDOW_NONE) { @@ -480,7 +487,7 @@ void HideMapNamePopUpWindow(void) DisableInterrupts(INTR_FLAG_HBLANK); SetHBlankCallback(NULL); - if (MAP_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) + if (OW_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) { SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ); SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_EFFECT_BLEND); @@ -521,9 +528,9 @@ static void ShowMapNamePopUpWindow(void) GetMapName(withoutPrefixPtr, gMapHeader.regionMapSectionId, 0); } - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) { - if (MAP_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) + if (OW_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) SetGpuRegBits(REG_OFFSET_WININ, WININ_WIN0_CLR); mapNamePopUpWindowId = AddMapNamePopUpWindow(); @@ -540,14 +547,14 @@ static void ShowMapNamePopUpWindow(void) mapDisplayHeader[1] = EXT_CTRL_CODE_HIGHLIGHT; mapDisplayHeader[2] = TEXT_COLOR_TRANSPARENT; - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) { AddTextPrinterParameterized(mapNamePopUpWindowId, FONT_SHORT, mapDisplayHeader, 8, 2, TEXT_SKIP_DRAW, NULL); - if (MAP_POPUP_BW_TIME_MODE != MAP_POPUP_BW_TIME_NONE) + if (OW_POPUP_BW_TIME_MODE != OW_POPUP_BW_TIME_NONE) { RtcCalcLocalTime(); - FormatDecimalTimeWithoutSeconds(withoutPrefixPtr, gLocalTime.hours, gLocalTime.minutes, MAP_POPUP_BW_TIME_MODE == MAP_POPUP_BW_TIME_24_HR); + FormatDecimalTimeWithoutSeconds(withoutPrefixPtr, gLocalTime.hours, gLocalTime.minutes, OW_POPUP_BW_TIME_MODE == OW_POPUP_BW_TIME_24_HR); AddTextPrinterParameterized(secondaryPopUpWindowId, FONT_SMALL, mapDisplayHeader, GetStringRightAlignXOffset(FONT_SMALL, mapDisplayHeader, DISPLAY_WIDTH) - 5, 8, TEXT_SKIP_DRAW, NULL); } @@ -601,7 +608,7 @@ static void LoadMapNamePopUpWindowBg(void) u16 regionMapSectionId = gMapHeader.regionMapSectionId; u8 secondaryPopUpWindowId; - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) secondaryPopUpWindowId = GetSecondaryPopUpWindowId(); if (regionMapSectionId >= KANTO_MAPSEC_START) @@ -612,14 +619,14 @@ static void LoadMapNamePopUpWindowBg(void) regionMapSectionId = 0; // Discard kanto region sections; } - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) { popUpThemeId = sRegionMapSectionId_To_PopUpThemeIdMapping_BW[regionMapSectionId]; switch (popUpThemeId) { // add additional gen 5-style pop-up themes as cases here case MAPPOPUP_THEME_BW_DEFAULT: - if (MAP_POPUP_BW_COLOR == MAP_POPUP_BW_COLOR_WHITE) + if (OW_POPUP_BW_COLOR == OW_POPUP_BW_COLOR_WHITE) LoadPalette(sMapPopUpTilesPalette_BW_White, BG_PLTT_ID(14), sizeof(sMapPopUpTilesPalette_BW_White)); else LoadPalette(sMapPopUpTilesPalette_BW_Black, BG_PLTT_ID(14), sizeof(sMapPopUpTilesPalette_BW_Black)); diff --git a/src/menu.c b/src/menu.c index da4bdaf589..ab149f1271 100644 --- a/src/menu.c +++ b/src/menu.c @@ -20,7 +20,7 @@ #include "task.h" #include "text_window.h" #include "window.h" -#include "config/map_name_popup.h" +#include "config/overworld.h" #include "constants/songs.h" #define DLG_WINDOW_PALETTE_NUM 15 @@ -149,7 +149,7 @@ void InitStandardTextBoxWindows(void) InitWindows(sStandardTextBox_WindowTemplates); sStartMenuWindowId = WINDOW_NONE; sMapNamePopupWindowId = WINDOW_NONE; - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) sSecondaryPopupWindowId = WINDOW_NONE; } @@ -528,7 +528,7 @@ u8 AddMapNamePopUpWindow(void) { if (sMapNamePopupWindowId == WINDOW_NONE) { - if (MAP_POPUP_GENERATION == GEN_5) + if (OW_POPUP_GENERATION == GEN_5) sMapNamePopupWindowId = AddWindowParameterized(0, 0, 0, 30, 3, 14, 0x107); else sMapNamePopupWindowId = AddWindowParameterized(0, 1, 1, 10, 3, 14, 0x107); @@ -2187,7 +2187,7 @@ void HBlankCB_DoublePopupWindow(void) if (scanline < 80 || scanline > 160) { REG_BG0VOFS = offset; - if(MAP_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) + if(OW_POPUP_BW_ALPHA_BLEND && !IsWeatherAlphaBlend()) REG_BLDALPHA = BLDALPHA_BLEND(15, 5); } else