From 46a3969f69994e092b3ecc48fd46036b9625763d Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Sat, 2 Feb 2019 00:25:43 -0600 Subject: [PATCH] Add constants for flags and vars --- src/berry_blender.c | 2 +- src/braille_puzzles.c | 16 ++++++++-------- src/decoration.c | 8 ++++---- src/field_special_scene.c | 10 +++++----- src/tv.c | 10 +++++----- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/berry_blender.c b/src/berry_blender.c index ea9c6c4ff0..f2e3c7d14a 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -1438,7 +1438,7 @@ static void Blender_SetOpponentsBerryData(u16 playerBerryItemId, u8 playersNum, { opponentBerryId = sOpponentBerrySets[opponentSetId][i]; var = playerBerryItemId - 163; - if (!FlagGet(0x340) && gSpecialVar_0x8004 == 1) + if (!FlagGet(FLAG_HIDE_LILYCOVE_CONTEST_HALL_BLEND_MASTER_ONLOOKERS) && gSpecialVar_0x8004 == 1) { opponentSetId %= 5; opponentBerryId = sSpecialOpponentBerrySets[opponentSetId]; diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index b17ffad33c..6be8ba4a44 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -447,25 +447,25 @@ bool8 ShouldDoBrailleRegicePuzzle(void) if (i < 16) { - u16 val = VarGet(0x403B); + u16 val = VarGet(VAR_0x403B); val |= 1 << i; - VarSet(0x403B, val); + VarSet(VAR_0x403B, val); } else if (i < 32) { - u16 val = VarGet(0x403C); + u16 val = VarGet(VAR_0x403C); val |= 1 << (i - 16); - VarSet(0x403C, val); + VarSet(VAR_0x403C, val); } else { - u16 val = VarGet(0x403D); + u16 val = VarGet(VAR_0x403D); val |= 1 << (i - 32); - VarSet(0x403D, val); + VarSet(VAR_0x403D, val); } - varValue = VarGet(0x403B); - if (varValue != 0xFFFF || VarGet(0x403C) != varValue || VarGet(0x403D) != 0xF) + varValue = VarGet(VAR_0x403B); + if (varValue != 0xFFFF || VarGet(VAR_0x403C) != varValue || VarGet(VAR_0x403D) != 0xF) return FALSE; if (gSaveBlock1Ptr->pos.x == 8 && gSaveBlock1Ptr->pos.y == 21) diff --git a/src/decoration.c b/src/decoration.c index c4c3d61713..36d9ba5f9a 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1244,17 +1244,17 @@ void sub_8127E18(void) for (i = 0; i < 14; i ++) { - if (FlagGet(0xAE + i) == TRUE) + if (FlagGet(FLAG_DECORATION_1 + i) == TRUE) { - FlagClear(0xAE + i); + FlagClear(FLAG_DECORATION_1 + i); for (j = 0; j < gMapHeader.events->eventObjectCount; j ++) { - if (gMapHeader.events->eventObjects[j].flagId == 0xAE + i) + if (gMapHeader.events->eventObjects[j].flagId == FLAG_DECORATION_1 + i) { break; } } - VarSet(0x3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]); + VarSet(VAR_0x3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]); gSpecialVar_0x8005 = gMapHeader.events->eventObjects[j].localId; gSpecialVar_0x8006 = sCurDecorMapX; gSpecialVar_0x8007 = sCurDecorMapY; diff --git a/src/field_special_scene.c b/src/field_special_scene.c index 579188f369..2b518808b0 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -300,8 +300,8 @@ void Task_HandlePorthole(u8 taskId) } break; case EXIT_PORTHOLE: // exit porthole. - FlagClear(0x4001); - FlagClear(0x4000); + FlagClear(FLAG_SPECIAL_FLAG_0x4001); + FlagClear(FLAG_SPECIAL_FLAG_0x4000); SetWarpDestinationToDynamicWarp(0); DoDiveWarp(); DestroyTask(taskId); @@ -315,7 +315,7 @@ void sub_80FB6EC(void) gSprites[spriteId].coordOffsetEnabled = FALSE; - if (VarGet(0x40B4) == 2) + if (VarGet(VAR_PORTHOLE_STATE) == 2) { StartSpriteAnim(&gSprites[spriteId], GetFaceDirectionAnimNum(4)); } @@ -337,8 +337,8 @@ void sub_80FB768(void) void sub_80FB7A4(void) { FlagSet(FLAG_SYS_CRUISE_MODE); - FlagSet(0x4001); - FlagSet(0x4000); + FlagSet(FLAG_SPECIAL_FLAG_0x4001); + FlagSet(FLAG_SPECIAL_FLAG_0x4000); SetDynamicWarp(0, gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1); sub_80FB59C(); sub_80AF8B8(); diff --git a/src/tv.c b/src/tv.c index dfb4a3a64b..f46bfa0c4a 100644 --- a/src/tv.c +++ b/src/tv.c @@ -972,7 +972,7 @@ void GabbyAndTyBeforeInterview(void) TakeTVShowInSearchOfTrainersOffTheAir(); if (gSaveBlock1Ptr->gabbyAndTyData.lastMove == MOVE_NONE) { - FlagSet(0x0001); + FlagSet(FLAG_TEMP_1); } } @@ -2564,13 +2564,13 @@ void sub_80EEA70(void) show->secretBaseSecrets.kind = TVSHOW_SECRET_BASE_SECRETS; show->secretBaseSecrets.active = FALSE; StringCopy(show->secretBaseSecrets.playerName, gSaveBlock2Ptr->playerName); - show->secretBaseSecrets.stepsInBase = VarGet(0x40ec); + show->secretBaseSecrets.stepsInBase = VarGet(VAR_0x40EC); sub_80E980C(); StringCopy(strbuf, gStringVar1); StripExtCtrlCodes(strbuf); StringCopy(show->secretBaseSecrets.baseOwnersName, strbuf); - show->secretBaseSecrets.item = VarGet(0x40ed); - show->secretBaseSecrets.flags = VarGet(0x40ee) + (VarGet(0x40ef) << 16); + show->secretBaseSecrets.item = VarGet(VAR_0x40ED); + show->secretBaseSecrets.flags = VarGet(VAR_0x40EE) + (VarGet(VAR_0x40EF) << 16); tv_store_id_3x(show); show->secretBaseSecrets.language = gGameLanguage; if (show->secretBaseSecrets.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].language == LANGUAGE_JAPANESE) @@ -3604,7 +3604,7 @@ void sub_80F01B8(void) { VarSet(VAR_0x40BC, 0); RemoveEventObjectByLocalIdAndMap(5, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); - FlagSet(0x396); + FlagSet(FLAG_HIDE_BATTLE_TOWER_REPORTER); } void ReceiveTvShowsData(void *src, u32 size, u8 masterIdx)