diff --git a/berry_fix/payload/include/global.fieldmap.h b/berry_fix/payload/include/global.fieldmap.h index 2cf5156ab..8608e26a3 100644 --- a/berry_fix/payload/include/global.fieldmap.h +++ b/berry_fix/payload/include/global.fieldmap.h @@ -219,14 +219,14 @@ struct ObjectEventGraphicsInfo /*0x20*/ const union AffineAnimCmd *const *affineAnims; }; -#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << 0) -#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) -#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) -#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) -#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4) +#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << 0) +#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) +#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) +#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) +#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4) #define PLAYER_AVATAR_FLAG_CONTROLLABLE (1 << 5) -#define PLAYER_AVATAR_FLAG_FORCED (1 << 6) -#define PLAYER_AVATAR_FLAG_WATERING (1 << 7) +#define PLAYER_AVATAR_FLAG_FORCED (1 << 6) +#define PLAYER_AVATAR_FLAG_WATERING (1 << 7) enum { diff --git a/graphics/field_effects/unk_83C2CE0.pal b/graphics/weather/default.pal similarity index 100% rename from graphics/field_effects/unk_83C2CE0.pal rename to graphics/weather/default.pal diff --git a/include/constants/flags.h b/include/constants/flags.h index 83d9bf28b..9e76dd4de 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -1324,7 +1324,7 @@ #define FLAG_SYS_FLASH_ACTIVE (SYS_FLAGS + 0x6) #define FLAG_SYS_SPECIAL_WILD_BATTLE (SYS_FLAGS + 0x7) -#define FLAG_QL_DEPARTED (SYS_FLAGS + 0x8) +#define FLAG_SYS_QL_DEPARTED (SYS_FLAGS + 0x8) #define FLAG_0x809 (SYS_FLAGS + 0x9) #define FLAG_0x80A (SYS_FLAGS + 0xA) #define FLAG_0x80B (SYS_FLAGS + 0xB) diff --git a/include/constants/metatile_behaviors.h b/include/constants/metatile_behaviors.h index e26f79be0..77cd6de1b 100644 --- a/include/constants/metatile_behaviors.h +++ b/include/constants/metatile_behaviors.h @@ -107,11 +107,11 @@ #define MB_CUP 0x9B #define MB_PORTHOLE 0x9C #define MB_BLINKING_LIGHTS 0x9E -#define MB_9F 0x9F +#define MB_NEATLY_LINED_UP_TOOLS 0x9F #define MB_IMPRESSIVE_MACHINE 0xA0 #define MB_VIDEO_GAME 0xA1 #define MB_BURGLARY 0xA2 -#define MB_A3 0xA3 +#define MB_TRAINER_TOWER_MONITOR 0xA3 #define MB_CYCLING_ROAD_PULL_DOWN 0xD0 #define MB_CYCLING_ROAD_PULL_DOWN_GRASS 0xD1 diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index d58c51d72..737eed4d4 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -198,16 +198,16 @@ #define MON_FEMALE 0xFE #define MON_GENDERLESS 0xFF -#define FRIENDSHIP_EVENT_GROW_LEVEL 0x0 -#define FRIENDSHIP_EVENT_VITAMIN 0x1 -#define FRIENDSHIP_EVENT_BATTLE_ITEM 0x2 -#define FRIENDSHIP_EVENT_LEAGUE_BATTLE 0x3 -#define FRIENDSHIP_EVENT_LEARN_TMHM 0x4 -#define FRIENDSHIP_EVENT_WALKING 0x5 -#define FRIENDSHIP_EVENT_MASSAGE 0x6 -#define FRIENDSHIP_EVENT_FAINT_SMALL 0x7 -#define FRIENDSHIP_EVENT_FAINT_OUTSIDE_BATTLE 0x8 -#define FRIENDSHIP_EVENT_FAINT_LARGE 0x9 +#define FRIENDSHIP_EVENT_GROW_LEVEL 0 +#define FRIENDSHIP_EVENT_VITAMIN 1 +#define FRIENDSHIP_EVENT_BATTLE_ITEM 2 +#define FRIENDSHIP_EVENT_LEAGUE_BATTLE 3 +#define FRIENDSHIP_EVENT_LEARN_TMHM 4 +#define FRIENDSHIP_EVENT_WALKING 5 +#define FRIENDSHIP_EVENT_MASSAGE 6 +#define FRIENDSHIP_EVENT_FAINT_SMALL 7 +#define FRIENDSHIP_EVENT_FAINT_OUTSIDE_BATTLE 8 +#define FRIENDSHIP_EVENT_FAINT_LARGE 9 #define PARTY_SIZE 6 #define MAX_TOTAL_EVS 510 diff --git a/include/constants/vars.h b/include/constants/vars.h index e10a96bd0..468b9566e 100644 --- a/include/constants/vars.h +++ b/include/constants/vars.h @@ -122,7 +122,7 @@ #define VAR_EGG_BRAG_STATE 0x404A #define VAR_LINK_WIN_BRAG_STATE 0x404B #define VAR_POKELOT_RND2 0x404C -#define VAR_QL_ENTRANCE 0x404D +#define VAR_QL_ENTRANCE 0x404D #define VAR_0x404E 0x404E #define VAR_LOTAD_SIZE_RECORD 0x404F diff --git a/include/field_weather.h b/include/field_weather.h index c8921c1fe..334bc0863 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -35,8 +35,8 @@ struct Weather u8 fadeScreenCounter; bool8 readyForInit; u8 taskId; - u8 fade_in_active; - u8 fade_in_counter; + u8 fadeInActive; + u8 fadeInCounter; u16 initStep; u16 finishStep; u8 currWeather; diff --git a/include/metatile_behavior.h b/include/metatile_behavior.h index d00b4b4a5..9d29c31e9 100644 --- a/include/metatile_behavior.h +++ b/include/metatile_behavior.h @@ -146,7 +146,7 @@ bool8 MetatileBehavior_IsCup(u8 metatileBehavior); bool8 MetatileBehavior_IsPolishedWindow(u8 metatileBehavior); bool8 MetatileBehavior_IsBeautifulSkyWindow(u8 metatileBehavior); bool8 MetatileBehavior_IsBlinkingLights(u8 metatileBehavior); -bool8 MetatileBehavior_IsIsNeatlyLinedUpTools(u8 metatileBehavior); +bool8 MetatileBehavior_IsNeatlyLinedUpTools(u8 metatileBehavior); bool8 MetatileBehavior_IsImpressiveMachine(u8 metatileBehavior); bool8 MetatileBehavior_IsVideoGame(u8 metatileBehavior); bool8 MetatileBehavior_IsBurglary(u8 metatileBehavior); diff --git a/include/quest_log.h b/include/quest_log.h index 748b9c3da..295f942f2 100644 --- a/include/quest_log.h +++ b/include/quest_log.h @@ -6,6 +6,10 @@ #include "constants/quest_log.h" #include "field_control_avatar.h" +// Parameter to QuestLog_OnEscalatorWarp +#define QL_ESCALATOR_OUT 1 +#define QL_ESCALATOR_IN 2 + struct QuestLogEntry { // When command == 2, these fields have different meanings @@ -57,9 +61,6 @@ void SetQuestLogRecordAndPlaybackPointers(void *oldSave); void sub_811246C(struct Sprite *sprite); void QuestLogRecordNPCStep(u8 a0, u8 a1, u8 a2, u8 a3); bool8 sub_8111C2C(void); - -#define QL_ESCALATOR_OUT 1 -#define QL_ESCALATOR_IN 2 void QuestLog_OnEscalatorWarp(u8 direction); void QuestLogRecordPlayerAvatarGfxTransitionWithDuration(u8 movementActionId, u8 duration); void Special_UpdateTrainerFansAfterLinkBattle(void); diff --git a/src/bike.c b/src/bike.c index e31fd27a4..b1d39ca21 100644 --- a/src/bike.c +++ b/src/bike.c @@ -268,11 +268,11 @@ bool32 IsRunningDisallowed(u8 metatileBehavior) return TRUE; } -static bool8 MetatileBehaviorForbidsBiking(u8 r4) +static bool8 MetatileBehaviorForbidsBiking(u8 metatileBehavior) { - if (MetatileBehavior_IsMB0A(r4)) + if (MetatileBehavior_IsMB0A(metatileBehavior)) return TRUE; - if (!MetatileBehavior_ReturnFalse_9(r4)) + if (!MetatileBehavior_ReturnFalse_9(metatileBehavior)) return FALSE; if (PlayerGetZCoord() & 1) return FALSE; diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 64b448b01..ca5453d7d 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -567,7 +567,7 @@ static const u8 *GetInteractedMetatileScript(struct MapPosition *position, u8 me return EventScript_BeautifulSkyWindow; if (MetatileBehavior_IsBlinkingLights(metatileBehavior) == TRUE) return EventScript_BlinkingLights; - if (MetatileBehavior_IsIsNeatlyLinedUpTools(metatileBehavior) == TRUE) + if (MetatileBehavior_IsNeatlyLinedUpTools(metatileBehavior) == TRUE) return EventScript_NeatlyLinedUpTools; if (MetatileBehavior_IsPlayerFacingCableClubWirelessMonitor(metatileBehavior, direction) == TRUE) return CableClub_EventScript_ShowWirelessCommunicationScreen; diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 5680a1f33..a03add123 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -86,9 +86,9 @@ static bool8 MetatileAtCoordsIsWaterTile(s16 x, s16 y); static void HandleWarpArrowSpriteHideShow(struct ObjectEvent * playerObjEvent); static void StartStrengthAnim(u8 objectEventId, u8 direction); static void Task_BumpBoulder(u8 taskId); -static bool8 do_boulder_init(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj); -static bool8 do_boulder_dust(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj); -static bool8 do_boulder_finish(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj); +static bool8 DoBoulderInit(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj); +static bool8 DoBoulderDust(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj); +static bool8 DoBoulderFinish(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj); static void DoPlayerMatJump(void); static void DoPlayerAvatarSecretBaseMatJump(u8 taskId); static bool8 PlayerAvatar_DoSecretBaseMatJump(struct Task * task, struct ObjectEvent * playerObj); @@ -679,14 +679,14 @@ void SetPlayerAvatarTransitionFlags(u16 flags) } static void (*const sPlayerAvatarTransitionFuncs[])(struct ObjectEvent *) = { - [PLAYER_AVATAR_STATE_NORMAL] = PlayerAvatarTransition_Normal, - [PLAYER_AVATAR_STATE_MACH_BIKE] = PlayerAvatarTransition_Bike, - [PLAYER_AVATAR_STATE_ACRO_BIKE] = PlayerAvatarTransition_Bike, - [PLAYER_AVATAR_STATE_SURFING] = PlayerAvatarTransition_Surfing, - [PLAYER_AVATAR_STATE_UNDERWATER] = PlayerAvatarTransition_Underwater, + [PLAYER_AVATAR_STATE_NORMAL] = PlayerAvatarTransition_Normal, + [PLAYER_AVATAR_STATE_MACH_BIKE] = PlayerAvatarTransition_Bike, + [PLAYER_AVATAR_STATE_ACRO_BIKE] = PlayerAvatarTransition_Bike, + [PLAYER_AVATAR_STATE_SURFING] = PlayerAvatarTransition_Surfing, + [PLAYER_AVATAR_STATE_UNDERWATER] = PlayerAvatarTransition_Underwater, [PLAYER_AVATAR_STATE_CONTROLLABLE] = PlayerAvatarTransition_ReturnToField, - [PLAYER_AVATAR_STATE_FORCED] = PlayerAvatarTransition_Dummy, - [PLAYER_AVATAR_STATE_DASH] = PlayerAvatarTransition_Dummy + [PLAYER_AVATAR_STATE_FORCED] = PlayerAvatarTransition_Dummy, + [PLAYER_AVATAR_STATE_DASH] = PlayerAvatarTransition_Dummy }; static void DoPlayerAvatarTransition(void) @@ -1385,9 +1385,9 @@ static void HandleWarpArrowSpriteHideShow(struct ObjectEvent *objectEvent) } static bool8 (*const sBoulderTaskSteps[])(struct Task * task, struct ObjectEvent * playerObj, struct ObjectEvent * boulderObj) = { - do_boulder_init, - do_boulder_dust, - do_boulder_finish + DoBoulderInit, + DoBoulderDust, + DoBoulderFinish }; static void StartStrengthAnim(u8 a, u8 b) @@ -1407,7 +1407,7 @@ static void Task_BumpBoulder(u8 taskId) ; } -static bool8 do_boulder_init(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 DoBoulderInit(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; @@ -1415,7 +1415,7 @@ static bool8 do_boulder_init(struct Task *task, struct ObjectEvent *playerObject return FALSE; } -static bool8 do_boulder_dust(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 DoBoulderDust(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) { if (!ObjectEventIsMovementOverridden(playerObject) && !ObjectEventIsMovementOverridden(strengthObject)) @@ -1435,7 +1435,7 @@ static bool8 do_boulder_dust(struct Task *task, struct ObjectEvent *playerObject return FALSE; } -static bool8 do_boulder_finish(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 DoBoulderFinish(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) { if (ObjectEventCheckHeldMovementStatus(playerObject) && ObjectEventCheckHeldMovementStatus(strengthObject)) diff --git a/src/field_specials.c b/src/field_specials.c index 7bbe1f258..fdb26e9e7 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -1868,7 +1868,7 @@ void QuestLog_CheckDepartingIndoorsMap(void) if (VarGet(VAR_QL_ENTRANCE) != QL_LOCATION_ROCKET_HIDEOUT || i != QL_LOCATION_GAME_CORNER) { VarSet(VAR_QL_ENTRANCE, i); - FlagSet(FLAG_QL_DEPARTED); + FlagSet(FLAG_SYS_QL_DEPARTED); } break; } @@ -1887,7 +1887,7 @@ void QuestLog_TryRecordDepartedLocation(void) u16 ql_entrance_id = VarGet(VAR_QL_ENTRANCE); event_buffer.map_section_id = 0; event_buffer.entrance_id = 0; - if (FlagGet(FLAG_QL_DEPARTED)) + if (FlagGet(FLAG_SYS_QL_DEPARTED)) { if (ql_entrance_id == QL_LOCATION_VIRIDIAN_FOREST_1) { @@ -1899,7 +1899,7 @@ void QuestLog_TryRecordDepartedLocation(void) else event_buffer.entrance_id = ql_entrance_id + 1; SetQuestLogEvent(QL_EVENT_DEPARTED, (void *)&event_buffer); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); return; } } @@ -1913,7 +1913,7 @@ void QuestLog_TryRecordDepartedLocation(void) else event_buffer.entrance_id = ql_entrance_id + 1; SetQuestLogEvent(QL_EVENT_DEPARTED, (void *)&event_buffer); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); return; } } @@ -1934,11 +1934,11 @@ void QuestLog_TryRecordDepartedLocation(void) event_buffer.entrance_id++; } SetQuestLogEvent(QL_EVENT_DEPARTED, (void *)&event_buffer); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); if (ql_entrance_id == QL_LOCATION_ROCKET_HIDEOUT) { VarSet(VAR_QL_ENTRANCE, QL_LOCATION_GAME_CORNER); - FlagSet(FLAG_QL_DEPARTED); + FlagSet(FLAG_SYS_QL_DEPARTED); } } } diff --git a/src/field_weather.c b/src/field_weather.c index 249aad2b6..e36f1a23c 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -127,7 +127,7 @@ static const u8 sBasePaletteGammaTypes[32] = { GAMMA_NORMAL, }; -const u16 gDefaultWeatherSpritePalette[] = INCBIN_U16("graphics/field_effects/unk_83C2CE0.gbapal"); +const u16 gDefaultWeatherSpritePalette[] = INCBIN_U16("graphics/weather/default.gbapal"); const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); const u8 gWeatherFogDiagonalTiles[] = INCBIN_U8("graphics/weather/fog_diagonal.4bpp"); @@ -350,8 +350,8 @@ static void UpdateWeatherGammaShift(void) static void FadeInScreenWithWeather(void) { - if (++gWeatherPtr->fade_in_counter > 1) - gWeatherPtr->fade_in_active = 0; + if (++gWeatherPtr->fadeInCounter > 1) + gWeatherPtr->fadeInActive = 0; switch (gWeatherPtr->currWeather) { @@ -775,8 +775,8 @@ void FadeScreen(u8 mode, s8 delay) BeginNormalPaletteFade(0xFFFFFFFF, delay, 16, 0, fadeColor); gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN; - gWeatherPtr->fade_in_active = 1; - gWeatherPtr->fade_in_counter = 0; + gWeatherPtr->fadeInActive = 1; + gWeatherPtr->fadeInCounter = 0; Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB); gWeatherPtr->readyForInit = TRUE; } @@ -843,8 +843,8 @@ void FadeSelectedPals(u8 mode, s8 delay, u32 selectedPalettes) BeginNormalPaletteFade(selectedPalettes, delay, 16, 0, fadeColor); gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN; - gWeatherPtr->fade_in_active = 1; - gWeatherPtr->fade_in_counter = 0; + gWeatherPtr->fadeInActive = 1; + gWeatherPtr->fadeInCounter = 0; Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB); gWeatherPtr->readyForInit = TRUE; } @@ -864,7 +864,7 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex) switch (gWeatherPtr->palProcessingState) { case WEATHER_PAL_STATE_SCREEN_FADING_IN: - if (gWeatherPtr->fade_in_active != 0) + if (gWeatherPtr->fadeInActive != 0) { if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL) MarkFogSpritePalToLighten(paletteIndex); @@ -902,7 +902,7 @@ void ApplyWeatherGammaShiftToPal(u8 paletteIndex) static u8 IsWeatherFadingIn(void) { if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_SCREEN_FADING_IN) - return gWeatherPtr->fade_in_active; + return gWeatherPtr->fadeInActive; else return 0; } diff --git a/src/help_system.c b/src/help_system.c index 196053274..9ea196814 100644 --- a/src/help_system.c +++ b/src/help_system.c @@ -373,10 +373,6 @@ void sub_813C004(u8 a0, u8 mode) } } -#define HelpSystemHandleRenderGlyph(character) ({\ - do {DecompressAndRenderGlyph(font, character, &srcBlit, &destBlit, dest, x, y, width, height);} while (0); font;\ -}) - #ifdef NONMATCHING void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 width, u8 height) { @@ -402,16 +398,20 @@ void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 wid return; case PLACEHOLDER_BEGIN: curChar = *src++; - if (curChar == 1) { + if (curChar == PLACEHOLDER_ID_PLAYER) { for (i = 0; i < 10; i++) { if (gSaveBlock2Ptr->playerName[i] == EOS) break; - HelpSystemHandleRenderGlyph(gSaveBlock2Ptr->playerName[i]); - x += gGlyphInfo[0x80]; + DecompressAndRenderGlyph(font, gSaveBlock2Ptr->playerName[i], &srcBlit, &destBlit, dest, x, y, width, height); + // This is required to match a dummy [sp+#0x24] read here + if (font == 0) + x += gGlyphInfo[0x80]; + else + x += gGlyphInfo[0x80]; } } - else if (curChar == 2) + else if (curChar == PLACEHOLDER_ID_STRING_VAR_1) { for (i = 0; ; i++) { @@ -419,15 +419,18 @@ void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 wid { if (gString_Bill[i] == EOS) break; - HelpSystemHandleRenderGlyph(gString_Bill[i]); + DecompressAndRenderGlyph(font, gString_Bill[i], &srcBlit, &destBlit, dest, x, y, width, height); } else { if (gString_Someone[i] == EOS) break; - HelpSystemHandleRenderGlyph(gString_Someone[i]); + DecompressAndRenderGlyph(font, gString_Someone[i], &srcBlit, &destBlit, dest, x, y, width, height); } - x += gGlyphInfo[0x80]; + if (font == 0) + x += gGlyphInfo[0x80]; + else + x += gGlyphInfo[0x80]; } } break; @@ -441,47 +444,47 @@ void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 wid curChar = *src++; switch (curChar) { - case 4: + case EXT_CTRL_CODE_COLOR_HIGHLIGHT_SHADOW: src++; //fallthrough - case 11: - case 16: + case EXT_CTRL_CODE_PLAY_BGM: + case EXT_CTRL_CODE_PLAY_SE: src++; //fallthrough - case 1: - case 2: - case 3: - case 5: - case 6: - case 8: - case 12: - case 13: - case 14: + case EXT_CTRL_CODE_COLOR: + case EXT_CTRL_CODE_HIGHLIGHT: + case EXT_CTRL_CODE_SHADOW: + case EXT_CTRL_CODE_PALETTE: + case EXT_CTRL_CODE_FONT: + case EXT_CTRL_CODE_PAUSE: + case EXT_CTRL_CODE_ESCAPE: + case EXT_CTRL_CODE_SHIFT_RIGHT: + case EXT_CTRL_CODE_SHIFT_DOWN: src++; break; - case 19: + case EXT_CTRL_CODE_CLEAR_TO: clearPixels = *src + orig_x - x; if (clearPixels > 0) { destBlit.pixels = dest; destBlit.width = width * 8; destBlit.height = height * 8; - FillBitmapRect4Bit(&destBlit, x, y, clearPixels, GetFontAttribute(font, 1), 0); + FillBitmapRect4Bit(&destBlit, x, y, clearPixels, GetFontAttribute(font, FONTATTR_MAX_LETTER_HEIGHT), 0); x += clearPixels; } src++; break; - case 17: - case 18: - case 20: + case EXT_CTRL_CODE_CLEAR: + case EXT_CTRL_CODE_SKIP: + case EXT_CTRL_CODE_MIN_LETTER_SPACING: src++; break; - case 7: - case 9: - case 10: - case 15: - case 21: - case 22: + case EXT_CTRL_CODE_RESET_FONT: + case EXT_CTRL_CODE_WAIT_BUTTON: + case EXT_CTRL_CODE_WAIT_SE: + case EXT_CTRL_CODE_FILL_WINDOW: + case EXT_CTRL_CODE_JPN: + case EXT_CTRL_CODE_ENG: break; } break; @@ -509,8 +512,11 @@ void HelpSystemRenderText(u8 font, u8 * dest, const u8 * src, u8 x, u8 y, u8 wid } else { - HelpSystemHandleRenderGlyph(curChar); - x += gGlyphInfo[0x80]; + DecompressAndRenderGlyph(font, curChar, &srcBlit, &destBlit, dest, x, y, width, height); + if (font == 0) + x += gGlyphInfo[0x80]; + else + x += gGlyphInfo[0x80]; } break; } @@ -1068,7 +1074,7 @@ void sub_813C75C(void) void PrintListMenuItems(void) { - u8 glyphHeight = GetFontAttribute(2, 1) + 1; + u8 glyphHeight = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) + 1; s32 i; s32 r5 = gHelpSystemListMenu.itemsAbove; @@ -1083,7 +1089,7 @@ void PrintListMenuItems(void) void PlaceListMenuCursor(void) { - u8 glyphHeight = GetFontAttribute(2, 1) + 1; + u8 glyphHeight = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) + 1; u8 x = gHelpSystemListMenu.sub.left; u8 y = gHelpSystemListMenu.sub.top + glyphHeight * gHelpSystemListMenu.cursorPos; HelpSystem_PrintTextAt(gText_SelectorArrow2, x, y); @@ -1091,7 +1097,7 @@ void PlaceListMenuCursor(void) void sub_813C860(u8 i) { - u8 glyphHeight = GetFontAttribute(2, 1) + 1; + u8 glyphHeight = GetFontAttribute(2, FONTATTR_MAX_LETTER_HEIGHT) + 1; u8 x = gHelpSystemListMenu.sub.left; u8 y = gHelpSystemListMenu.sub.top + i * glyphHeight; HelpSystem_PrintTextAt(gString_HelpSystem_ClearTo8, x, y); diff --git a/src/metatile_behavior.c b/src/metatile_behavior.c index 235d0f5dc..4728ca05c 100644 --- a/src/metatile_behavior.c +++ b/src/metatile_behavior.c @@ -997,9 +997,9 @@ bool8 MetatileBehavior_IsBlinkingLights(u8 metatileBehavior) return FALSE; } -bool8 MetatileBehavior_IsIsNeatlyLinedUpTools(u8 metatileBehavior) +bool8 MetatileBehavior_IsNeatlyLinedUpTools(u8 metatileBehavior) { - if(metatileBehavior == MB_9F) + if(metatileBehavior == MB_NEATLY_LINED_UP_TOOLS) return TRUE; else return FALSE; @@ -1031,7 +1031,7 @@ bool8 MetatileBehavior_IsBurglary(u8 metatileBehavior) bool8 MetatileBehavior_IsTrainerTowerMonitor(u8 metatileBehavior) { - if(metatileBehavior == MB_A3) + if(metatileBehavior == MB_TRAINER_TOWER_MONITOR) return TRUE; else return FALSE; diff --git a/src/overworld.c b/src/overworld.c index 073295e8d..60e350590 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -292,7 +292,7 @@ void Overworld_ResetStateAfterFly(void) VarSet(VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 0); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_FLASH_ACTIVE); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); VarSet(VAR_QL_ENTRANCE, 0); } @@ -306,7 +306,7 @@ void Overworld_ResetStateAfterTeleport(void) VarSet(VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 0); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_FLASH_ACTIVE); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); VarSet(VAR_QL_ENTRANCE, 0); } @@ -320,7 +320,7 @@ void Overworld_ResetStateAfterDigEscRope(void) VarSet(VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 0); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_FLASH_ACTIVE); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); VarSet(VAR_QL_ENTRANCE, 0); } @@ -334,7 +334,7 @@ static void Overworld_ResetStateAfterWhitingOut(void) VarSet(VAR_MAP_SCENE_FUCHSIA_CITY_SAFARI_ZONE_ENTRANCE, 0); FlagClear(FLAG_SYS_USE_STRENGTH); FlagClear(FLAG_SYS_FLASH_ACTIVE); - FlagClear(FLAG_QL_DEPARTED); + FlagClear(FLAG_SYS_QL_DEPARTED); VarSet(VAR_QL_ENTRANCE, 0); } diff --git a/src/text.c b/src/text.c index 360b618bd..13acd195d 100644 --- a/src/text.c +++ b/src/text.c @@ -1042,7 +1042,7 @@ s32 GetStringWidth(u8 fontId, const u8 *str, s16 letterSpacing) width = lineWidth; lineWidth = 0; break; - case PLACEHOLDER_BEGIN: + case PLACEHOLDER_BEGIN: switch (*++str) { case PLACEHOLDER_ID_STRING_VAR_1: