diff options
Diffstat (limited to 'src/field')
31 files changed, 307 insertions, 307 deletions
diff --git a/src/field/battle_tower.c b/src/field/battle_tower.c index db822f71b..6b6064c16 100644 --- a/src/field/battle_tower.c +++ b/src/field/battle_tower.c @@ -350,7 +350,7 @@ bool8 ShouldBattleEReaderTrainer(u8 levelType, u16 winStreak) ValidateEReaderTrainer(); - if (gScriptResult != 0 || gSaveBlock2.battleTower.ereaderTrainer.winStreak != winStreak) + if (gSpecialVar_Result != 0 || gSaveBlock2.battleTower.ereaderTrainer.winStreak != winStreak) { return FALSE; } @@ -1516,7 +1516,7 @@ void CheckPartyBattleTowerBanlist(void) level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); hp = GetMonData(&gPlayerParty[i], MON_DATA_HP); - CheckMonBattleTowerBanlist(species2, heldItem, hp, gScriptResult, level, validPartySpecies, validPartyHeldItems, &counter); + CheckMonBattleTowerBanlist(species2, heldItem, hp, gSpecialVar_Result, level, validPartySpecies, validPartyHeldItems, &counter); } if (counter < 3) @@ -1549,7 +1549,7 @@ void CheckPartyBattleTowerBanlist(void) else { gSpecialVar_0x8004 = 0; - gSaveBlock2.battleTower.battleTowerLevelType = gScriptResult; + gSaveBlock2.battleTower.battleTowerLevelType = gSpecialVar_Result; } } @@ -1700,7 +1700,7 @@ void sub_8135668(void) gSaveBlock2.battleTower.curChallengeBattleNum[battleTowerLevelType]++; sub_8135A3C(); - gScriptResult = gSaveBlock2.battleTower.curChallengeBattleNum[battleTowerLevelType]; + gSpecialVar_Result = gSaveBlock2.battleTower.curChallengeBattleNum[battleTowerLevelType]; gStringVar1[0] = gSaveBlock2.battleTower.curChallengeBattleNum[battleTowerLevelType] + 0xA1; gStringVar1[1] = 0xFF; @@ -1712,7 +1712,7 @@ void sub_8135668(void) } sub_8135A3C(); - gScriptResult = gSaveBlock2.battleTower.curStreakChallengesNum[battleTowerLevelType]; + gSpecialVar_Result = gSaveBlock2.battleTower.curStreakChallengesNum[battleTowerLevelType]; break; case 8: gSaveBlock2.battleTower.unk_554 = gSpecialVar_0x8005; @@ -1747,29 +1747,29 @@ void sub_81358A4(void) switch (gSpecialVar_0x8004) { case 0: - gScriptResult = gSaveBlock2.battleTower.var_4AE[battleTowerLevelType]; + gSpecialVar_Result = gSaveBlock2.battleTower.var_4AE[battleTowerLevelType]; break; case 1: - gScriptResult = gSaveBlock2.battleTower.battleTowerLevelType; + gSpecialVar_Result = gSaveBlock2.battleTower.battleTowerLevelType; break; case 2: - gScriptResult = gSaveBlock2.battleTower.curChallengeBattleNum[battleTowerLevelType]; + gSpecialVar_Result = gSaveBlock2.battleTower.curChallengeBattleNum[battleTowerLevelType]; break; case 3: - gScriptResult = gSaveBlock2.battleTower.curStreakChallengesNum[battleTowerLevelType]; + gSpecialVar_Result = gSaveBlock2.battleTower.curStreakChallengesNum[battleTowerLevelType]; break; case 4: - gScriptResult = gSaveBlock2.battleTower.battleTowerTrainerId; + gSpecialVar_Result = gSaveBlock2.battleTower.battleTowerTrainerId; break; case 5: case 6: case 7: break; case 8: - gScriptResult = gSaveBlock2.battleTower.unk_554; + gSpecialVar_Result = gSaveBlock2.battleTower.unk_554; break; case 9: - gScriptResult = GetCurrentBattleTowerWinStreak(battleTowerLevelType); + gSpecialVar_Result = GetCurrentBattleTowerWinStreak(battleTowerLevelType); break; case 10: SetGameStat(GAME_STAT_BATTLE_TOWER_BEST_STREAK, gSaveBlock2.battleTower.bestBattleTowerWinStreak); @@ -2149,11 +2149,11 @@ void GiveBattleTowerPrize(void) if (AddBagItem(gSaveBlock2.battleTower.prizeItem, 1) == TRUE) { CopyItemName(gSaveBlock2.battleTower.prizeItem, gStringVar1); - gScriptResult = 1; + gSpecialVar_Result = 1; } else { - gScriptResult = 0; + gSpecialVar_Result = 0; gSaveBlock2.battleTower.var_4AE[battleTowerLevelType] = 6; } } @@ -2172,7 +2172,7 @@ void AwardBattleTowerRibbons(void) ribbonType = MON_DATA_VICTORY_RIBBON; } - gScriptResult = 0; + gSpecialVar_Result = 0; if (GetCurrentBattleTowerWinStreak(battleTowerLevelType) > 55) { @@ -2182,13 +2182,13 @@ void AwardBattleTowerRibbons(void) pokemon = &gPlayerParty[partyIndex]; if (!GetMonData(pokemon, ribbonType)) { - gScriptResult = 1; - SetMonData(pokemon, ribbonType, &gScriptResult); + gSpecialVar_Result = 1; + SetMonData(pokemon, ribbonType, &gSpecialVar_Result); } } } - if (gScriptResult != 0) + if (gSpecialVar_Result != 0) { IncrementGameStat(GAME_STAT_RECEIVED_RIBBONS); } @@ -2266,7 +2266,7 @@ void ValidateEReaderTrainer(void) u32 checksum; struct BattleTowerEReaderTrainer *ereaderTrainer; - gScriptResult = 0; + gSpecialVar_Result = 0; ereaderTrainer = &gSaveBlock2.battleTower.ereaderTrainer; checksum = 0; @@ -2277,7 +2277,7 @@ void ValidateEReaderTrainer(void) if (checksum == 0) { - gScriptResult = 1; + gSpecialVar_Result = 1; return; } @@ -2290,7 +2290,7 @@ void ValidateEReaderTrainer(void) if (gSaveBlock2.battleTower.ereaderTrainer.checksum != checksum) { ClearEReaderTrainer(&gSaveBlock2.battleTower.ereaderTrainer); - gScriptResult = 1; + gSpecialVar_Result = 1; } } diff --git a/src/field/berry.c b/src/field/berry.c index 874a60aa7..088267ad0 100644 --- a/src/field/berry.c +++ b/src/field/berry.c @@ -981,7 +981,7 @@ const struct Berry gBerries[] = static const struct BerryTree gBlankBerryTree = {0}; extern u8 S_BerryTree[]; -extern u16 gScriptLastTalked; +extern u16 gSpecialVar_LastTalked; extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; extern u16 gSpecialVar_0x8006; @@ -1368,7 +1368,7 @@ void FieldObjectInteractionGetBerryTreeData(void) id = FieldObjectGetBerryTreeId(gSelectedMapObject); berry = GetBerryTypeByBerryTreeId(id); ResetBerryTreeSparkleFlag(id); - localId = gScriptLastTalked; + localId = gSpecialVar_LastTalked; num = gSaveBlock1.location.mapNum; group = gSaveBlock1.location.mapGroup; if (IsBerryTreeSparkling(localId, num, group)) @@ -1392,7 +1392,7 @@ void Berry_FadeAndGoToBerryBagMenu(void) void FieldObjectInteractionPlantBerryTree(void) { - u8 berry = ItemIdToBerryType(gScriptItemId); + u8 berry = ItemIdToBerryType(gSpecialVar_ItemId); PlantBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject), berry, 1, TRUE); FieldObjectInteractionGetBerryTreeData(); @@ -1409,7 +1409,7 @@ void FieldObjectInteractionPickBerryTree(void) void FieldObjectInteractionRemoveBerryTree(void) { RemoveBerryTree(FieldObjectGetBerryTreeId(gSelectedMapObject)); - sub_8060288(gScriptLastTalked, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); + sub_8060288(gSpecialVar_LastTalked, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); } bool8 PlayerHasBerries(void) diff --git a/src/field/berry_tag_screen.c b/src/field/berry_tag_screen.c index 694599680..2abbac287 100644 --- a/src/field/berry_tag_screen.c +++ b/src/field/berry_tag_screen.c @@ -133,12 +133,12 @@ static bool8 sub_8146058(void) gMain.state += 1; break; case 8: - berry = gScriptItemId + OFFSET_7B; + berry = gSpecialVar_ItemId + OFFSET_7B; gUnknown_0203932C = CreateBerrySprite(berry, 56, 64); gMain.state += 1; break; case 9: - sub_8146600(gScriptItemId + OFFSET_7B); + sub_8146600(gSpecialVar_ItemId + OFFSET_7B); gMain.state += 1; break; case 10: @@ -277,9 +277,9 @@ static void sub_81464E4(void) u8 buffer[16]; #endif - berryInfo = GetBerryInfo(gScriptItemId + OFFSET_7B + 1); + berryInfo = GetBerryInfo(gSpecialVar_ItemId + OFFSET_7B + 1); - ConvertIntToDecimalStringN(gStringVar1, gScriptItemId - FIRST_BERRY + 1, STR_CONV_MODE_LEADING_ZEROS, 2); + ConvertIntToDecimalStringN(gStringVar1, gSpecialVar_ItemId - FIRST_BERRY + 1, STR_CONV_MODE_LEADING_ZEROS, 2); MenuPrint(gStringVar1, 12, 4); #if ENGLISH @@ -437,7 +437,7 @@ static void sub_8146810(s8 berry) gBagPocketScrollStates[berryPocket].cursorPos += berry; } } - gScriptItemId = gCurrentBagPocketItemSlots[gBagPocketScrollStates[berryPocket].scrollTop + gBagPocketScrollStates[berryPocket].cursorPos].itemId; + gSpecialVar_ItemId = gCurrentBagPocketItemSlots[gBagPocketScrollStates[berryPocket].scrollTop + gBagPocketScrollStates[berryPocket].cursorPos].itemId; DestroySprite(&gSprites[gUnknown_0203932C]); sub_81466A0(); sub_80A7DD4(); @@ -449,7 +449,7 @@ static void sub_81468BC(void) sub_81464E4(); // center of berry sprite - gUnknown_0203932C = CreateBerrySprite(gScriptItemId + OFFSET_7B, 56, 64); + gUnknown_0203932C = CreateBerrySprite(gSpecialVar_ItemId + OFFSET_7B, 56, 64); - sub_8146600(gScriptItemId + OFFSET_7B); + sub_8146600(gSpecialVar_ItemId + OFFSET_7B); } diff --git a/src/field/daycare.c b/src/field/daycare.c index 9ac63b3c7..c28bc65ca 100644 --- a/src/field/daycare.c +++ b/src/field/daycare.c @@ -1758,7 +1758,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId) { HandleDestroyMenuCursors(); PlaySE(SE_SELECT); - gLastFieldPokeMenuOpened = gScriptResult = gTasks[taskId].data[0]; + gLastFieldPokeMenuOpened = gSpecialVar_Result = gTasks[taskId].data[0]; DestroyTask(taskId); MenuZeroFillWindowRect(15, 6, 29, 13); EnableBothScriptContexts(); @@ -1766,7 +1766,7 @@ static void HandleDaycareLevelMenuInput(u8 taskId) else if (gMain.newKeys & B_BUTTON) { HandleDestroyMenuCursors(); - gLastFieldPokeMenuOpened = gScriptResult = 2; + gLastFieldPokeMenuOpened = gSpecialVar_Result = 2; DestroyTask(taskId); MenuZeroFillWindowRect(15, 6, 29, 13); EnableBothScriptContexts(); diff --git a/src/field/decoration.c b/src/field/decoration.c index c36c10a08..8b774afc3 100644 --- a/src/field/decoration.c +++ b/src/field/decoration.c @@ -3647,10 +3647,10 @@ void sub_8100A7C(void) { u16 i; gSpecialVar_0x8005 = 0; - gScriptResult = 0; + gSpecialVar_Result = 0; if (gSpecialVar_0x8004 == gUnknown_02039234) { - gScriptResult = 1; + gSpecialVar_Result = 1; } else if (gDecorations[ewram_1f000.items[gUnknown_020391B4[gSpecialVar_0x8004].decorId]].permission == DECORPERM_SOLID_MAT) { gSpecialVar_0x8005 = gUnknown_020391B4[gSpecialVar_0x8004].flagId; diff --git a/src/field/dewford_trend.c b/src/field/dewford_trend.c index b36459655..b67f3a2bd 100644 --- a/src/field/dewford_trend.c +++ b/src/field/dewford_trend.c @@ -8,7 +8,7 @@ #include "text.h" #include "ewram.h" -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u16 gSpecialVar_0x8004; static void sub_80FA46C(struct EasyChatPair *s, u16 b, u8 c); @@ -219,12 +219,12 @@ void sub_80FA5E4(void) if (!gSaveBlock1.easyChatPairs[0].unk1_6 && gSaveBlock1.easyChatPairs[1].unk1_6) result = 1; } - gScriptResult = result; + gSpecialVar_Result = result; } void sub_80FA648(void) { - gScriptResult = (gSaveBlock1.easyChatPairs[0].words[0] + gSaveBlock1.easyChatPairs[0].words[1]) & 7; + gSpecialVar_Result = (gSaveBlock1.easyChatPairs[0].words[0] + gSaveBlock1.easyChatPairs[0].words[1]) & 7; } static bool8 sub_80FA670(struct EasyChatPair *a, struct EasyChatPair *b, u8 c) diff --git a/src/field/event_data.c b/src/field/event_data.c index 3b3ac7bca..587da8138 100644 --- a/src/field/event_data.c +++ b/src/field/event_data.c @@ -18,9 +18,9 @@ EWRAM_DATA u16 gSpecialVar_0x8008 = 0; EWRAM_DATA u16 gSpecialVar_0x8009 = 0; EWRAM_DATA u16 gSpecialVar_0x800A = 0; EWRAM_DATA u16 gSpecialVar_0x800B = 0; -EWRAM_DATA u16 gScriptResult = 0; -EWRAM_DATA u16 gScriptLastTalked = 0; -EWRAM_DATA u16 gScriptFacing = 0; +EWRAM_DATA u16 gSpecialVar_Result = 0; +EWRAM_DATA u16 gSpecialVar_LastTalked = 0; +EWRAM_DATA u16 gSpecialVar_Facing = 0; EWRAM_DATA u8 gUnknown_0202E8E2[16] = {0}; extern u16 *gSpecialVars[]; diff --git a/src/field/field_control_avatar.c b/src/field/field_control_avatar.c index dd29e9df5..cd7d3a2e2 100644 --- a/src/field/field_control_avatar.c +++ b/src/field/field_control_avatar.c @@ -30,8 +30,8 @@ struct Coords32 s32 y; }; -extern u16 gScriptLastTalked; -extern u16 gScriptFacing; +extern u16 gSpecialVar_LastTalked; +extern u16 gSpecialVar_Facing; extern struct LinkPlayerMapObject gLinkPlayerMapObjects[]; extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; @@ -295,8 +295,8 @@ u8 *sub_80682A8(struct MapPosition *position, u8 unused, u8 c) return NULL; } gSelectedMapObject = r3; - gScriptLastTalked = gMapObjects[r3].localId; - gScriptFacing = c; + gSpecialVar_LastTalked = gMapObjects[r3].localId; + gSpecialVar_Facing = c; return GetFieldObjectScriptPointerByFieldObjectId(r3); } @@ -316,10 +316,10 @@ static u8 *sub_8068364(struct MapPosition *position, u8 b, u8 c) } //_080683E8 gSelectedMapObject = r3; - gScriptLastTalked = gMapObjects[r3].localId; - gScriptFacing = c; + gSpecialVar_LastTalked = gMapObjects[r3].localId; + gSpecialVar_Facing = c; script = GetFieldObjectScriptPointerByFieldObjectId(r3); - script = GetRamScript(gScriptLastTalked, script); + script = GetRamScript(gSpecialVar_LastTalked, script); return script; } diff --git a/src/field/field_poison.c b/src/field/field_poison.c index 74d70cb36..49678f269 100644 --- a/src/field/field_poison.c +++ b/src/field/field_poison.c @@ -9,7 +9,7 @@ #include "task.h" #include "text.h" -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u8 fieldPoisonText_PokemonFainted[]; bool32 CheckMonIsValid(struct Pokemon *pkmn) @@ -93,9 +93,9 @@ void Task_WhiteOut(u8 taskId) break; case 2: //Done checking Pokemon if (AllMonsFainted()) - gScriptResult = 1; + gSpecialVar_Result = 1; else - gScriptResult = 0; + gSpecialVar_Result = 0; EnableBothScriptContexts(); DestroyTask(taskId); break; diff --git a/src/field/field_screen_effect.c b/src/field/field_screen_effect.c index a18190809..a472d5a9c 100644 --- a/src/field/field_screen_effect.c +++ b/src/field/field_screen_effect.c @@ -283,17 +283,17 @@ void sub_80818A4(void) u8 taskId = CreateTask(sub_80816A8, 80); s16 *data = gTasks[taskId].data; - if (gScriptResult == 0) + if (gSpecialVar_Result == 0) { data[1] = 0; data[2] = 104; } - else if (gScriptResult == 1) + else if (gSpecialVar_Result == 1) { data[1] = 1; data[2] = 104; } - else if (gScriptResult == 2) + else if (gSpecialVar_Result == 2) { data[1] = 0; data[2] = 120; diff --git a/src/field/field_specials.c b/src/field/field_specials.c index 78c60c94e..87a9e2d5d 100644 --- a/src/field/field_specials.c +++ b/src/field/field_specials.c @@ -46,7 +46,7 @@ extern struct WarpData gUnknown_020297F0; extern u8 gBattleOutcome; extern u16 gSpecialVar_0x8004; extern u16 gSpecialVar_0x8005; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u8 *const gUnknown_083D1464[3]; @@ -169,7 +169,7 @@ static void DetermineCyclingRoadResults(u32 arg0, u8 arg1) } - gScriptResult = result; + gSpecialVar_Result = result; } void FinishCyclingRoadChallenge(void) { @@ -1112,17 +1112,17 @@ void sub_810E984(u8 taskId) saved_warp2_set_2(0, gUnknown_03000760[gUnknown_0203925B].var1, gUnknown_03000760[gUnknown_0203925B].var2, -1, 2, 1); if (gSpecialVar_0x8005 == gUnknown_0203925B) { - gScriptResult = 0; + gSpecialVar_Result = 0; PlaySE(SE_SELECT); MenuZeroFillWindowRect(0, 0, 29, 12); sub_810EC9C(taskId); } else { - gScriptResult = 1; + gSpecialVar_Result = 1; gSpecialVar_0x8005 = gUnknown_0203925B; sub_810EBEC(); - FieldObjectTurnByLocalIdAndMap(gScriptLastTalked, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, DIR_SOUTH); + FieldObjectTurnByLocalIdAndMap(gSpecialVar_LastTalked, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, DIR_SOUTH); sub_810EEDC(); MenuZeroFillScreen(); DestroyTask(taskId); @@ -1130,7 +1130,7 @@ void sub_810E984(u8 taskId) } else if (gMain.newKeys & B_BUTTON) { - gScriptResult = 0; + gSpecialVar_Result = 0; PlaySE(SE_SELECT); sub_810EEDC(); MenuZeroFillWindowRect(0, 0, 29, 12); @@ -1516,12 +1516,12 @@ void IsGrassTypeInParty(void) species = GetMonData(pokemon, MON_DATA_SPECIES); if (gBaseStats[species].type1 == TYPE_GRASS || gBaseStats[species].type2 == TYPE_GRASS) { - gScriptResult = TRUE; + gSpecialVar_Result = TRUE; return; } } } - gScriptResult = FALSE; + gSpecialVar_Result = FALSE; } const u8 *const gUnknown_083F83C0[] = { @@ -1579,7 +1579,7 @@ void sub_810F118(u8 taskId) if (gMain.newKeys & A_BUTTON) { HandleDestroyMenuCursors(); - gScriptResult = gUnknown_0203925B; + gSpecialVar_Result = gUnknown_0203925B; PlaySE(SE_SELECT); sub_810EEDC(); MenuZeroFillWindowRect(0, 0, 29, 12); @@ -1588,7 +1588,7 @@ void sub_810F118(u8 taskId) if (gMain.newKeys & B_BUTTON) { HandleDestroyMenuCursors(); - gScriptResult = 0x7f; + gSpecialVar_Result = 0x7f; PlaySE(SE_SELECT); sub_810EEDC(); MenuZeroFillWindowRect(0, 0, 29, 12); @@ -2077,27 +2077,27 @@ bool8 sub_810F96C(void) void sub_810F9AC(void) { - if (gScriptResult >= 10000) + if (gSpecialVar_Result >= 10000) { - sub_80BF088(0, gScriptResult); + sub_80BF088(0, gSpecialVar_Result); } - else if (gScriptResult >= 1000) + else if (gSpecialVar_Result >= 1000) { gStringVar1[0] = CHAR_0; - ConvertIntToDecimalStringN(gStringVar1 + 1, gScriptResult, 0, sub_80BF0B8(gScriptResult)); + ConvertIntToDecimalStringN(gStringVar1 + 1, gSpecialVar_Result, 0, sub_80BF0B8(gSpecialVar_Result)); } - else if (gScriptResult >= 100) + else if (gSpecialVar_Result >= 100) { gStringVar1[0] = CHAR_0; gStringVar1[1] = CHAR_0; - ConvertIntToDecimalStringN(gStringVar1 + 2, gScriptResult, 0, sub_80BF0B8(gScriptResult)); + ConvertIntToDecimalStringN(gStringVar1 + 2, gSpecialVar_Result, 0, sub_80BF0B8(gSpecialVar_Result)); } - else if (gScriptResult >= 10) + else if (gSpecialVar_Result >= 10) { gStringVar1[0] = CHAR_0; gStringVar1[1] = CHAR_0; gStringVar1[2] = CHAR_0; - ConvertIntToDecimalStringN(gStringVar1 + 3, gScriptResult, 0, sub_80BF0B8(gScriptResult)); + ConvertIntToDecimalStringN(gStringVar1 + 3, gSpecialVar_Result, 0, sub_80BF0B8(gSpecialVar_Result)); } else { @@ -2105,7 +2105,7 @@ void sub_810F9AC(void) gStringVar1[1] = CHAR_0; gStringVar1[2] = CHAR_0; gStringVar1[3] = CHAR_0; - ConvertIntToDecimalStringN(gStringVar1 + 4, gScriptResult, 0, sub_80BF0B8(gScriptResult)); + ConvertIntToDecimalStringN(gStringVar1 + 4, gSpecialVar_Result, 0, sub_80BF0B8(gSpecialVar_Result)); } } diff --git a/src/field/fldeff_decoration.c b/src/field/fldeff_decoration.c index 7c8ff44db..37f024b9f 100644 --- a/src/field/fldeff_decoration.c +++ b/src/field/fldeff_decoration.c @@ -344,21 +344,21 @@ void GetShieldToyTVDecorationInfo(void) case 822: ConvertIntToDecimalStringN(gStringVar1, 100, STR_CONV_MODE_LEFT_ALIGN, 3); StringCopy(gStringVar2, gSecretBaseText_GoldRank); - gScriptResult = 0; + gSpecialVar_Result = 0; break; case 734: ConvertIntToDecimalStringN(gStringVar1, 50, STR_CONV_MODE_LEFT_ALIGN, 2); StringCopy(gStringVar2, gSecretBaseText_SilverRank); - gScriptResult = 0; + gSpecialVar_Result = 0; break; case 756: - gScriptResult = 1; + gSpecialVar_Result = 1; break; case 757: - gScriptResult = 2; + gSpecialVar_Result = 2; break; case 758: - gScriptResult = 3; + gSpecialVar_Result = 3; break; } } diff --git a/src/field/fldeff_secretpower.c b/src/field/fldeff_secretpower.c index 9bcfaa8c4..bf8e98403 100644 --- a/src/field/fldeff_secretpower.c +++ b/src/field/fldeff_secretpower.c @@ -249,7 +249,7 @@ bool8 SetUpFieldMove_SecretPower(void) sub_80BB63C(); - if (gScriptResult == 1 || player_get_direction_lower_nybble() != DIR_NORTH) + if (gSpecialVar_Result == 1 || player_get_direction_lower_nybble() != DIR_NORTH) return FALSE; GetXYCoordsOneStepInFrontOfPlayer(&gUnknown_0203923C.x, &gUnknown_0203923C.y); diff --git a/src/field/fldeff_strength.c b/src/field/fldeff_strength.c index d9603d094..565ac1651 100644 --- a/src/field/fldeff_strength.c +++ b/src/field/fldeff_strength.c @@ -14,7 +14,7 @@ static void sub_811AA38(void); static void sub_811AA9C(void); extern u8 gLastFieldPokeMenuOpened; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern void (*gFieldCallback)(void); extern void (*gUnknown_03005CE4)(void); @@ -24,7 +24,7 @@ bool8 SetUpFieldMove_Strength(void) { if (ShouldDoBrailleStrengthEffect()) { - gScriptResult = gLastFieldPokeMenuOpened; + gSpecialVar_Result = gLastFieldPokeMenuOpened; gFieldCallback = FieldCallback_Teleport; gUnknown_03005CE4 = sub_811AA38; } @@ -32,7 +32,7 @@ bool8 SetUpFieldMove_Strength(void) { if (npc_before_player_of_type(87) != TRUE) return 0; - gScriptResult = gLastFieldPokeMenuOpened; + gSpecialVar_Result = gLastFieldPokeMenuOpened; gFieldCallback = FieldCallback_Teleport; gUnknown_03005CE4 = sub_811AA18; } diff --git a/src/field/item_menu.c b/src/field/item_menu.c index 8f7cb3d90..4e283ffe9 100644 --- a/src/field/item_menu.c +++ b/src/field/item_menu.c @@ -138,7 +138,7 @@ EWRAM_DATA static s8 sCurrentBagPocket = 0; EWRAM_DATA static u8 gUnknown_0203855A = 0; EWRAM_DATA static s8 gUnknown_0203855B = 0; EWRAM_DATA static s8 gUnknown_0203855C = 0; -EWRAM_DATA u16 gScriptItemId = 0; +EWRAM_DATA u16 gSpecialVar_ItemId = 0; EWRAM_DATA u8 gUnknown_02038560 = 0; EWRAM_DATA u8 gUnknown_02038561 = 0; EWRAM_DATA static u8 gUnknown_02038562 = 0; @@ -1662,7 +1662,7 @@ static void sub_80A4BF0(u16 *a) const u8 *text; if (i == 0) - text = sub_80A4B90(gScriptItemId); + text = sub_80A4B90(gSpecialVar_ItemId); else text = sItemPopupMenuActions[sPopupMenuActionList[i]].text; MenuPrint(text, 1 + (i / 2) * 6, 8 + (i % 2) * 2); @@ -1849,7 +1849,7 @@ static void sub_80A50C8(u8 taskId) { if (r5[10] == 0) { - gScriptItemId = 0; + gSpecialVar_ItemId = 0; gUnknown_083C16BC[sReturnLocation].onBagClose(taskId); } else @@ -1864,7 +1864,7 @@ static void sub_80A50C8(u8 taskId) { PlaySE(SE_SELECT); gUnknown_02038560 = gBagPocketScrollStates[sCurrentBagPocket].scrollTop + gBagPocketScrollStates[sCurrentBagPocket].cursorPos; - gScriptItemId = gCurrentBagPocketItemSlots[gUnknown_02038560].itemId; + gSpecialVar_ItemId = gCurrentBagPocketItemSlots[gUnknown_02038560].itemId; gUnknown_083C16BC[sReturnLocation].onItemSelect(taskId); sub_80F98A4(0); sub_80F98A4(1); @@ -1887,7 +1887,7 @@ static void sub_80A50C8(u8 taskId) { if (sReturnLocation != RETURN_TO_FIELD_5) { - gScriptItemId = 0; + gSpecialVar_ItemId = 0; gUnknown_083C16BC[sReturnLocation].onBagClose(taskId); } } @@ -2527,7 +2527,7 @@ static void sub_80A57C4(void) gUnknown_02038564 = 1; r5 = 9; } - else if (sub_80F92F4(gScriptItemId) == 0) + else if (sub_80F92F4(gSpecialVar_ItemId) == 0) { sPopupMenuActionList = gUnknown_083C16AE[4]; gUnknown_02038564 = 1; @@ -2654,10 +2654,10 @@ void sub_80A5B40(void) static void HandlePopupMenuAction_UseOnField(u8 taskId) { - if (ItemId_GetFieldFunc(gScriptItemId) != NULL) + if (ItemId_GetFieldFunc(gSpecialVar_ItemId) != NULL) { PlaySE(SE_SELECT); - if (CalculatePlayerPartyCount() == 0 && ItemId_GetType(gScriptItemId) == 1) + if (CalculatePlayerPartyCount() == 0 && ItemId_GetType(gSpecialVar_ItemId) == 1) { sub_80A5BF8(taskId); } @@ -2665,7 +2665,7 @@ static void HandlePopupMenuAction_UseOnField(u8 taskId) { gTasks[taskId].data[2] = 0; if (sCurrentBagPocket != BAG_POCKET_BERRIES) - ItemId_GetFieldFunc(gScriptItemId)(taskId); + ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); else sub_80C9C7C(taskId); } @@ -2793,7 +2793,7 @@ static void sub_80A5EA0(u8 taskId) if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); - sub_80A5DA0(gScriptItemId, gTasks[taskId].data[1]); + sub_80A5DA0(gSpecialVar_ItemId, gTasks[taskId].data[1]); DoYesNoFuncWithChoice(taskId, &gUnknown_083C16F4); } else if (gMain.newKeys & B_BUTTON) @@ -2827,7 +2827,7 @@ static void sub_80A5F80(u8 taskId) static void HandlePopupMenuAction_Register(u8 taskId) { PlaySE(SE_SELECT); - if (gSaveBlock1.registeredItem == gScriptItemId) + if (gSaveBlock1.registeredItem == gSpecialVar_ItemId) { // Un-register the registered item RemoveSelectIconFromRegisteredItem(); @@ -2836,7 +2836,7 @@ static void HandlePopupMenuAction_Register(u8 taskId) else { AddSelectIconToRegisteredItem(); - gSaveBlock1.registeredItem = gScriptItemId; + gSaveBlock1.registeredItem = gSpecialVar_ItemId; } sub_80A7528(0); sub_80A41D4(taskId); @@ -2865,7 +2865,7 @@ static void sub_80A6024(u8 taskId) static void DisplayCannotBeHeldMessage(u8 taskId) { sub_80A73FC(); - CopyItemName(gScriptItemId, gStringVar1); + CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gOtherText_CantBeHeld); sub_80A7590(); DisplayCannotUseItemMessage(taskId, gStringVar4, sub_80A6024, 1); @@ -2874,13 +2874,13 @@ static void DisplayCannotBeHeldMessage(u8 taskId) static void HandlePopupMenuAction_Give(u8 taskId) { PlaySE(SE_SELECT); - if (sub_80F931C(gScriptItemId) == 0) + if (sub_80F931C(gSpecialVar_ItemId) == 0) { sub_80A73FC(); sub_80A7590(); DisplayCannotUseItemMessage(taskId, gOtherText_CantWriteMail, sub_80A6024, 1); } - else if (ItemId_GetImportance(gScriptItemId) == 0) + else if (ItemId_GetImportance(gSpecialVar_ItemId) == 0) { if (CalculatePlayerPartyCount() == 0) { @@ -2931,21 +2931,21 @@ static void OnItemSelect_PkmnList(u8 taskId) { u8 r6 = sCurrentBagPocket + 1; - if (sub_80F931C(gScriptItemId) == 0) + if (sub_80F931C(gSpecialVar_ItemId) == 0) { sub_80A73FC(); sub_80A7590(); DisplayCannotUseItemMessage(taskId, gOtherText_CantWriteMail, sub_80A6024, 1); } - else if (sub_80F92F4(gScriptItemId) == 0) + else if (sub_80F92F4(gSpecialVar_ItemId) == 0) { sub_80A73FC(); - CopyItemName(gScriptItemId, gStringVar1); + CopyItemName(gSpecialVar_ItemId, gStringVar1); StringExpandPlaceholders(gStringVar4, gOtherText_CantBeHeldHere); sub_80A7590(); DisplayCannotUseItemMessage(taskId, gStringVar4, sub_80A6024, 1); } - else if (r6 != 5 && ItemId_GetImportance(gScriptItemId) == 0) + else if (r6 != 5 && ItemId_GetImportance(gSpecialVar_ItemId) == 0) { gTasks[taskId].data[8] = (u32)sub_808A3F8 >> 16; gTasks[taskId].data[9] = (u32)sub_808A3F8; @@ -2983,8 +2983,8 @@ static void OnItemSelect_Shop(u8 taskId) gTasks[taskId].data[10] = gBagPocketScrollStates[sCurrentBagPocket].scrollTop + gBagPocketScrollStates[sCurrentBagPocket].cursorPos + 1; sub_80A48E8(taskId, gBagPocketScrollStates[sCurrentBagPocket].cursorPos, gBagPocketScrollStates[sCurrentBagPocket].cursorPos); sub_80A73FC(); - CopyItemName(gScriptItemId, gStringVar2); - if (ItemId_GetPrice(gScriptItemId) == 0) + CopyItemName(gSpecialVar_ItemId, gStringVar2); + if (ItemId_GetPrice(gSpecialVar_ItemId) == 0) { StringExpandPlaceholders(gStringVar4, gOtherText_CantBuyThat); DisplayCannotUseItemMessage(taskId, gStringVar4, sub_80A6444, 1); @@ -3025,7 +3025,7 @@ static void sub_80A648C(u8 taskId) sub_80A418C(1, 1, 1, 11, 3); else sub_80A418C(1, 1, 1, 11, 2); - BuyMenuDisplayMessage(gScriptItemId, 1); + BuyMenuDisplayMessage(gSpecialVar_ItemId, 1); sub_80A683C(); } @@ -3047,7 +3047,7 @@ static void sub_80A6548(u8 taskId) static void sub_80A6574(u8 taskId) { PlaySE(SE_REGI); - sub_80A6870(gScriptItemId, gTasks[taskId].data[1]); + sub_80A6870(gSpecialVar_ItemId, gTasks[taskId].data[1]); gTasks[taskId].func = sub_80A6548; } @@ -3055,7 +3055,7 @@ static void sub_80A65AC(u8 taskId) { MenuZeroFillWindowRect(7, 6, 13, 12); sub_80A36B8(gBGTilemapBuffers[1], 7, 6, 6, 6); - CopyItemName(gScriptItemId, gStringVar2); + CopyItemName(gSpecialVar_ItemId, gStringVar2); StringExpandPlaceholders(gStringVar4, gOtherText_SoldItem); DisplayCannotUseItemMessage(taskId, gStringVar4, sub_80A6574, 1); sub_80A3D5C(taskId); @@ -3079,14 +3079,14 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId) if (sub_80A5350(taskId) == TRUE) { MenuZeroFillWindowRect(6, 11, 12, 11); - BuyMenuDisplayMessage(gScriptItemId, gTasks[taskId].data[1]); + BuyMenuDisplayMessage(gSpecialVar_ItemId, gTasks[taskId].data[1]); } else if (gMain.newKeys & A_BUTTON) { PlaySE(SE_SELECT); MenuZeroFillWindowRect(0, 10, 13, 13); sub_80A36B8(gBGTilemapBuffers[1], 0, 10, 13, 3); - ConvertIntToDecimalStringN(gStringVar1, ItemId_GetPrice(gScriptItemId) / 2 * gTasks[taskId].data[1], STR_CONV_MODE_LEFT_ALIGN, 6); + ConvertIntToDecimalStringN(gStringVar1, ItemId_GetPrice(gSpecialVar_ItemId) / 2 * gTasks[taskId].data[1], STR_CONV_MODE_LEFT_ALIGN, 6); StringExpandPlaceholders(gStringVar4, gOtherText_CanPay); DisplayCannotUseItemMessage(taskId, gStringVar4, sub_80A6650, 1); } @@ -3227,7 +3227,7 @@ static void sub_80A6A84(u8 taskId) s16 *taskData = gTasks[taskId].data; sub_80A4DA4(gBGTilemapBuffers[1]); - CopyItemName(gScriptItemId, gStringVar1); + CopyItemName(gSpecialVar_ItemId, gStringVar1); ConvertIntToDecimalStringN(gStringVar2, taskData[1], STR_CONV_MODE_LEFT_ALIGN, 3); MenuZeroFillWindowRect(7, 6, 11, 13); sub_80A7528(7); @@ -3250,14 +3250,14 @@ static void sub_80A6B64(u8 taskId) { s16 *taskData = gTasks[taskId].data; - if (ItemId_GetImportance(gScriptItemId) == 2) + if (ItemId_GetImportance(gSpecialVar_ItemId) == 2) { gTasks[taskId].func = sub_80A6B00; sub_80A7528(9); } else { - if (AddPCItem(gScriptItemId, taskData[1]) == TRUE) + if (AddPCItem(gSpecialVar_ItemId, taskData[1]) == TRUE) { sub_80A6A84(taskId); } @@ -3325,7 +3325,7 @@ bool32 sub_80A6D1C(void) FreezeMapObjects(); sub_80594C0(); sub_80597F4(); - gScriptItemId = gSaveBlock1.registeredItem; + gSpecialVar_ItemId = gSaveBlock1.registeredItem; taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1.registeredItem), 8); gTasks[taskId].data[2] = 1; return TRUE; @@ -3415,7 +3415,7 @@ static const u8 gUnknown_083C170A[] = {5, 0}; static void sub_80A6FDC(void) { - if (ItemId_GetBattleUsage(gScriptItemId) != 0) + if (ItemId_GetBattleUsage(gSpecialVar_ItemId) != 0) { sPopupMenuActionList = gUnknown_083C1708; gUnknown_02038564 = 2; @@ -3454,10 +3454,10 @@ static void OnBagClose_Battle(u8 taskId) static void HandlePopupMenuAction_UseInBattle(u8 taskId) { - if (ItemId_GetBattleFunc(gScriptItemId) != NULL) + if (ItemId_GetBattleFunc(gSpecialVar_ItemId) != NULL) { PlaySE(SE_SELECT); - ItemId_GetBattleFunc(gScriptItemId)(taskId); + ItemId_GetBattleFunc(gSpecialVar_ItemId)(taskId); } } @@ -3525,7 +3525,7 @@ static void sub_80A7230(u8 taskId) PlaySE(SE_SELECT); sub_80F98A4(2); sub_80F98A4(3); - gScriptItemId = ITEM_POKE_BALL; + gSpecialVar_ItemId = ITEM_POKE_BALL; sPopupMenuActionList = gUnknown_083C1708; gUnknown_02038564 = 2; gTasks[taskId].data[10] = gBagPocketScrollStates[sCurrentBagPocket].scrollTop + gBagPocketScrollStates[sCurrentBagPocket].cursorPos + 1; @@ -3824,7 +3824,7 @@ static void sub_80A7768(void) int var; if (r4->unk1 == 1) - text = sub_80A4B90(gScriptItemId); + text = sub_80A4B90(gSpecialVar_ItemId); else text = sItemPopupMenuActions[sPopupMenuActionList[r4->unk1 - 1]].text; var = r4->unk1 - 1; diff --git a/src/field/item_use.c b/src/field/item_use.c index c2e71070c..37cd8ba78 100644 --- a/src/field/item_use.c +++ b/src/field/item_use.c @@ -80,10 +80,10 @@ void ExecuteSwitchToOverworldFromItemUse(u8 taskId) { u8 taskData; - if (gScriptItemId == 0xAF) + if (gSpecialVar_ItemId == 0xAF) taskData = gTasks[taskId].data[15] - 1; else - taskData = ItemId_GetType(gScriptItemId) - 1; + taskData = ItemId_GetType(gSpecialVar_ItemId) - 1; gTasks[taskId].data[8] = (u32)gExitToOverworldFuncList[taskData] >> 16; gTasks[taskId].data[9] = (u32)gExitToOverworldFuncList[taskData]; @@ -157,7 +157,7 @@ void ItemMenu_ReadMail(u8 taskId) if (!gPaletteFade.active) { - mailStruct.itemId = gScriptItemId; + mailStruct.itemId = gSpecialVar_ItemId; HandleReadMail(&mailStruct, sub_80A5D04, 0); DestroyTask(taskId); } @@ -199,9 +199,9 @@ void ItemUseOutOfBattle_Bike(u8 taskId) void ItemUseOnFieldCB_Bike(u8 taskId) { - if (ItemId_GetSecondaryId(gScriptItemId) == 0) + if (ItemId_GetSecondaryId(gSpecialVar_ItemId) == 0) GetOnOffBike(2); - if (ItemId_GetSecondaryId(gScriptItemId) == 1) + if (ItemId_GetSecondaryId(gSpecialVar_ItemId) == 1) GetOnOffBike(4); sub_8064E2C(); @@ -252,7 +252,7 @@ void ItemUseOutOfBattle_Rod(u8 taskId) void ItemUseOnFieldCB_Rod(u8 taskId) { - StartFishing(ItemId_GetSecondaryId(gScriptItemId)); + StartFishing(ItemId_GetSecondaryId(gSpecialVar_ItemId)); DestroyTask(taskId); } @@ -770,11 +770,11 @@ void ItemUseOutOfBattle_SSTicket(u8 taskId) if (gTasks[taskId].data[2] == 0) { MenuZeroFillWindowRect(0, 0xD, 0xD, 0x14); - DisplayItemMessageOnField(taskId, gUnknown_083D61DC[ItemId_GetSecondaryId(gScriptItemId)], sub_80C9BB8, 1); + DisplayItemMessageOnField(taskId, gUnknown_083D61DC[ItemId_GetSecondaryId(gSpecialVar_ItemId)], sub_80C9BB8, 1); } else { - DisplayItemMessageOnField(taskId, gUnknown_083D61DC[ItemId_GetSecondaryId(gScriptItemId)], sub_80C9BD8, 0); + DisplayItemMessageOnField(taskId, gUnknown_083D61DC[ItemId_GetSecondaryId(gSpecialVar_ItemId)], sub_80C9BD8, 0); } } @@ -791,13 +791,13 @@ void sub_80C9C7C(u8 taskId) } else { - ItemId_GetFieldFunc(gScriptItemId)(taskId); + ItemId_GetFieldFunc(gSpecialVar_ItemId)(taskId); } } void sub_80C9D00(u8 taskId) { - RemoveBagItem(gScriptItemId, 1); + RemoveBagItem(gSpecialVar_ItemId, 1); ScriptContext2_Enable(); ScriptContext1_SetupScript(gUnknown_081A1654); DestroyTask(taskId); @@ -876,7 +876,7 @@ void ItemUseOutOfBattle_TMHM(u8 taskId) { MenuZeroFillWindowRect(0, 0xD, 0xD, 0x14); - if (gScriptItemId >= ITEM_HM01) + if (gSpecialVar_ItemId >= ITEM_HM01) DisplayItemMessageOnField(taskId, gOtherText_BootedHM, sub_80C9EE4, 1); // HM else DisplayItemMessageOnField(taskId, gOtherText_BootedTM, sub_80C9EE4, 1); // TM @@ -892,7 +892,7 @@ void sub_80C9F10(u8 taskId) { if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON) { - StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gScriptItemId)]); + StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]); StringExpandPlaceholders(gStringVar4, gOtherText_ContainsMove); DisplayItemMessageOnField(taskId, gStringVar4, sub_80C9F80, 1); } @@ -913,9 +913,9 @@ void sub_80C9FC0(u8 var) static void PrepareItemUseMessage(void) { - RemoveBagItem(gScriptItemId, 1); + RemoveBagItem(gSpecialVar_ItemId, 1); sub_80A3E0C(); - CopyItemName(gScriptItemId, gStringVar2); + CopyItemName(gSpecialVar_ItemId, gStringVar2); StringExpandPlaceholders(gStringVar4, gOtherText_UsedItem); } @@ -923,7 +923,7 @@ void ItemUseOutOfBattle_Repel(u8 var) { if (VarGet(VAR_REPEL_STEP_COUNT) == FALSE) { - VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gScriptItemId)); + VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId)); PrepareItemUseMessage(); DisplayItemMessageOnField(var, gStringVar4, CleanUpItemMenuMessage, 1); } @@ -936,7 +936,7 @@ void ItemUseOutOfBattle_Repel(u8 var) void sub_80CA07C(void) { sub_80A3E0C(); - CopyItemName(gScriptItemId, gStringVar2); + CopyItemName(gSpecialVar_ItemId, gStringVar2); } void sub_80CA098(u8 taskId) @@ -950,7 +950,7 @@ void sub_80CA098(u8 taskId) void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId) { - if (gScriptItemId == ITEM_WHITE_FLUTE) + if (gSpecialVar_ItemId == ITEM_WHITE_FLUTE) { FlagSet(FLAG_SYS_ENC_UP_ITEM); FlagClear(FLAG_SYS_ENC_DOWN_ITEM); @@ -959,7 +959,7 @@ void ItemUseOutOfBattle_BlackWhiteFlute(u8 taskId) gTasks[taskId].func = sub_80CA098; gTasks[taskId].data[15] = 0; } - else if (gScriptItemId == ITEM_BLACK_FLUTE) + else if (gSpecialVar_ItemId == ITEM_BLACK_FLUTE) { FlagSet(FLAG_SYS_ENC_DOWN_ITEM); FlagClear(FLAG_SYS_ENC_UP_ITEM); @@ -1016,7 +1016,7 @@ void ItemUseInBattle_PokeBall(u8 var) { if (PlayerPartyAndPokemonStorageFull() == FALSE) // have room for mon? { - RemoveBagItem(gScriptItemId, 1); + RemoveBagItem(gSpecialVar_ItemId, 1); sub_80A7094(var); } else @@ -1037,8 +1037,8 @@ void sub_80CA2BC(u8 taskId) if(++gTasks[taskId].data[15] > 7) { PlaySE(SE_KAIFUKU); - RemoveBagItem(gScriptItemId, 1); - DisplayItemMessageOnField(taskId, sub_803F378(gScriptItemId), sub_80CA294, 1); + RemoveBagItem(gSpecialVar_ItemId, 1); + DisplayItemMessageOnField(taskId, sub_803F378(gSpecialVar_ItemId), sub_80CA294, 1); } } @@ -1048,7 +1048,7 @@ void ItemUseInBattle_StatIncrease(u8 taskId) MenuZeroFillWindowRect(0, 0xD, 0xD, 0x14); - if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gScriptItemId, partyId, 0) != FALSE) + if (ExecuteTableBasedItemEffect_(&gPlayerParty[partyId], gSpecialVar_ItemId, partyId, 0) != FALSE) { DisplayItemMessageOnField(taskId, gOtherText_WontHaveAnyEffect, CleanUpItemMenuMessage, 1); } @@ -1097,9 +1097,9 @@ void unref_sub_80CA448(u8 var) { MenuZeroFillWindowRect(0, 0xD, 0xD, 0x14); - if (ExecuteTableBasedItemEffect__(0, gScriptItemId, 0) == FALSE) + if (ExecuteTableBasedItemEffect__(0, gSpecialVar_ItemId, 0) == FALSE) { - RemoveBagItem(gScriptItemId, 1); + RemoveBagItem(gSpecialVar_ItemId, 1); GetMonNickname(&gPlayerParty[0], gStringVar1); StringExpandPlaceholders(gStringVar4, gOtherText_SnapConfusion); DisplayItemMessageOnField(var, gStringVar4, sub_80A7094, 1); @@ -1127,7 +1127,7 @@ void ItemUseInBattle_Escape(u8 taskId) void ItemUseOutOfBattle_EnigmaBerry(u8 taskId) { - switch (GetItemEffectType(gScriptItemId) - 1) + switch (GetItemEffectType(gSpecialVar_ItemId) - 1) { case 1: case 2: @@ -1170,7 +1170,7 @@ void ItemUseOutOfBattle_EnigmaBerry(u8 taskId) void ItemUseInBattle_EnigmaBerry(u8 taskId) { - switch (GetItemEffectType(gScriptItemId)) + switch (GetItemEffectType(gSpecialVar_ItemId)) { case 0: ItemUseInBattle_StatIncrease(taskId); diff --git a/src/field/lottery_corner.c b/src/field/lottery_corner.c index 2cfdb7f88..83febc56e 100644 --- a/src/field/lottery_corner.c +++ b/src/field/lottery_corner.c @@ -7,7 +7,7 @@ #include "string_util.h" #include "text.h" -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u16 gSpecialVar_0x8004; extern struct PokemonStorage gPokemonStorage; extern u16 gSpecialVar_0x8005; @@ -46,7 +46,7 @@ void SetRandomLotteryNumber(u16 i) void RetrieveLotteryNumber(void) { u16 lottoNumber = GetLotteryNumber(); - gScriptResult = lottoNumber; + gSpecialVar_Result = lottoNumber; } void PickLotteryCornerTicket(void) @@ -70,7 +70,7 @@ void PickLotteryCornerTicket(void) if (!GetMonData(pkmn, MON_DATA_IS_EGG)) { u32 otId = GetMonData(pkmn, MON_DATA_OT_ID); - u8 numMatchingDigits = GetMatchingDigits(gScriptResult, otId); + u8 numMatchingDigits = GetMatchingDigits(gSpecialVar_Result, otId); if (numMatchingDigits > gSpecialVar_0x8004 && numMatchingDigits > 1) { @@ -97,7 +97,7 @@ void PickLotteryCornerTicket(void) !GetBoxMonData(pkmn, MON_DATA_IS_EGG)) { u32 otId = GetBoxMonData(pkmn, MON_DATA_OT_ID); - u8 numMatchingDigits = GetMatchingDigits(gScriptResult, otId); + u8 numMatchingDigits = GetMatchingDigits(gSpecialVar_Result, otId); if (numMatchingDigits > gSpecialVar_0x8004 && numMatchingDigits > 1) { diff --git a/src/field/map_obj_lock.c b/src/field/map_obj_lock.c index 91feaf177..954fcb446 100644 --- a/src/field/map_obj_lock.c +++ b/src/field/map_obj_lock.c @@ -6,7 +6,7 @@ #include "script_movement.h" #include "task.h" -extern u16 gScriptFacing; +extern u16 gSpecialVar_Facing; bool8 walkrun_is_standing_still(void) { @@ -109,7 +109,7 @@ void unref_sub_8064E5C(void) void sub_8064EAC(void) { - FieldObjectFaceOppositeDirection(&gMapObjects[gSelectedMapObject], gScriptFacing); + FieldObjectFaceOppositeDirection(&gMapObjects[gSelectedMapObject], gSpecialVar_Facing); } void sub_8064ED4(void) diff --git a/src/field/mauville_man.c b/src/field/mauville_man.c index fad6674db..30f6f5233 100644 --- a/src/field/mauville_man.c +++ b/src/field/mauville_man.c @@ -21,7 +21,7 @@ extern struct MusicPlayerInfo gMPlay_SE2; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u16 gSpecialVar_0x8004; extern const u8 gTextStoryteller_Story1Title[]; @@ -258,12 +258,12 @@ static u8 GetCurrentMauvilleOldMan(void) void ScrSpecial_GetCurrentMauvilleMan(void) { - gScriptResult = GetCurrentMauvilleOldMan(); + gSpecialVar_Result = GetCurrentMauvilleOldMan(); } void ScrSpecial_HasBardSongBeenChanged(void) { - u16 *scriptResult = &gScriptResult; // why?? + u16 *scriptResult = &gSpecialVar_Result; // why?? struct MauvilleManBard *bard = &gSaveBlock1.mauvilleMan.bard; *scriptResult = bard->hasChangedSong; @@ -350,7 +350,7 @@ void ScrSpecial_PlayBardSong(void) void ScrSpecial_GetHipsterSpokenFlag(void) { - u16 *scriptResult = &gScriptResult; // again?? + u16 *scriptResult = &gSpecialVar_Result; // again?? struct MauvilleManHipster *hipster = &gSaveBlock1.mauvilleMan.hipster; *scriptResult = hipster->alreadySpoken; @@ -369,12 +369,12 @@ void ScrSpecial_HipsterTeachWord(void) if (var == 0xFFFF) { - gScriptResult = FALSE; + gSpecialVar_Result = FALSE; } else { EasyChat_GetWordText(gStringVar1, var); - gScriptResult = TRUE; + gSpecialVar_Result = TRUE; } } @@ -384,12 +384,12 @@ void ScrSpecial_GiddyShouldTellAnotherTale(void) if (giddy->taleCounter == 10) { - gScriptResult = FALSE; + gSpecialVar_Result = FALSE; giddy->taleCounter = 0; } else { - gScriptResult = TRUE; + gSpecialVar_Result = TRUE; } } @@ -421,7 +421,7 @@ void ScrSpecial_GenerateGiddyLine(void) else giddy->taleCounter++; - gScriptResult = TRUE; + gSpecialVar_Result = TRUE; } #ifdef NONMATCHING @@ -1251,11 +1251,11 @@ static void Task_StoryListMenu(u8 taskId) break; if (selection == -1 || selection == GetFreeStorySlot()) { - gScriptResult = 0; + gSpecialVar_Result = 0; } else { - gScriptResult = 1; + gSpecialVar_Result = 1; gUnknown_03000748 = selection; } HandleDestroyMenuCursors(); @@ -1266,7 +1266,7 @@ static void Task_StoryListMenu(u8 taskId) } } -// Sets gScriptResult to TRUE if player selected a story +// Sets gSpecialVar_Result to TRUE if player selected a story void ScrSpecial_StorytellerStoryListMenu(void) { CreateTask(Task_StoryListMenu, 0x50); diff --git a/src/field/party_menu.c b/src/field/party_menu.c index 7d21c365a..089f93f9e 100644 --- a/src/field/party_menu.c +++ b/src/field/party_menu.c @@ -4314,7 +4314,7 @@ void TaughtMove(u8 taskId) u16 r4; gTasks[taskId].func = TaskDummy; - sub_806E8D0(taskId, gScriptItemId, sub_808B508); + sub_806E8D0(taskId, gSpecialVar_ItemId, sub_808B508); moveIndex = sub_809FA30(); r4 = GetMonData(ewram1C000.pokemon, MON_DATA_MOVE1 + moveIndex); GetMonNickname(ewram1C000.pokemon, gStringVar1); @@ -4340,7 +4340,7 @@ void StopTryingToTeachMove_806F588(u8 taskId) if (!gPaletteFade.active) { gTasks[taskId].func = TaskDummy; - sub_806E8D0(taskId, gScriptItemId, sub_808B508); + sub_806E8D0(taskId, gSpecialVar_ItemId, sub_808B508); StringCopy(gStringVar2, gMoveNames[ewram1C000.unk8]); StringExpandPlaceholders(gStringVar4, gOtherText_StopTryingTo); sub_806E834(gStringVar4, 1); diff --git a/src/field/pokeblock.c b/src/field/pokeblock.c index 3b70e7d76..4a904fbb1 100644 --- a/src/field/pokeblock.c +++ b/src/field/pokeblock.c @@ -664,7 +664,7 @@ static void sub_810BF7C(u8 taskId) PlaySE(SE_SELECT); if (gUnknown_02039248.unk1 + gUnknown_02039248.unk0 == gUnknown_02039248.unk2) { - gScriptResult = 0xffff; + gSpecialVar_Result = 0xffff; sub_810C31C(taskId); } else @@ -675,7 +675,7 @@ static void sub_810BF7C(u8 taskId) else if (gMain.newKeys & B_BUTTON) { PlaySE(SE_SELECT); - gScriptResult = 0xffff; + gSpecialVar_Result = 0xffff; sub_810C31C(taskId); } } @@ -800,7 +800,7 @@ static void sub_810C31C(u8 taskId) BeginNormalPaletteFade(-1, 0, 0, 16, 0); if (gUnknown_02039244 > 1) { - gScriptItemId = ITEM_NONE; + gSpecialVar_ItemId = ITEM_NONE; } gTasks[taskId].func = sub_810C2C8; } @@ -816,7 +816,7 @@ static void sub_810C368(u8 taskId) MenuDrawTextWindow(7, v0 + 4, 13, 11); PrintMenuItemsReordered(8, v0 + 5, gUnknown_0203924C, gUnknown_083F7EF4, gUnknown_03000758); InitMenu(0, 8, v0 + 5, gUnknown_0203924C, 0, 5); - gScriptItemId = gUnknown_02039248.unk0 + gUnknown_02039248.unk1; + gSpecialVar_ItemId = gUnknown_02039248.unk0 + gUnknown_02039248.unk1; gTasks[taskId].func = sub_810C40C; } @@ -855,7 +855,7 @@ static void sub_810C4C4(u8 taskId) if (!gPaletteFade.active) { sub_810C2B0(); - sub_8136130(&gSaveBlock1.pokeblocks[gScriptItemId], sub_810B96C); + sub_8136130(&gSaveBlock1.pokeblocks[gSpecialVar_ItemId], sub_810B96C); DestroyTask(taskId); } } @@ -939,21 +939,21 @@ static void sub_810C748(u8 taskId) static void sub_810C788(u8 taskId) { - s16 v0 = PokeblockGetGain(GetNature(&gEnemyParty[0]), &gSaveBlock1.pokeblocks[gScriptItemId]); - StringCopy(gBattleTextBuff1, gPokeblockNames[gSaveBlock1.pokeblocks[gScriptItemId].color]); - PokeblockClearIfExists(gScriptItemId); - gScriptItemId = gSaveBlock1.pokeblocks[gScriptItemId].color << 8; + s16 v0 = PokeblockGetGain(GetNature(&gEnemyParty[0]), &gSaveBlock1.pokeblocks[gSpecialVar_ItemId]); + StringCopy(gBattleTextBuff1, gPokeblockNames[gSaveBlock1.pokeblocks[gSpecialVar_ItemId].color]); + PokeblockClearIfExists(gSpecialVar_ItemId); + gSpecialVar_ItemId = gSaveBlock1.pokeblocks[gSpecialVar_ItemId].color << 8; if (v0 == 0) { - gScriptItemId += 1; + gSpecialVar_ItemId += 1; } if (v0 > 0) { - gScriptItemId += 2; + gSpecialVar_ItemId += 2; } if (v0 < 0) { - gScriptItemId += 3; + gSpecialVar_ItemId += 3; } BeginNormalPaletteFade(-1, 0, 0, 16, 0); gTasks[taskId].func = sub_810C2C8; @@ -961,10 +961,10 @@ static void sub_810C788(u8 taskId) static void sub_810C854(u8 taskId) { - SafariZoneActivatePokeblockFeeder(gScriptItemId); - StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1.pokeblocks[gScriptItemId].color]); - gScriptResult = gScriptItemId; - PokeblockClearIfExists(gScriptItemId); + SafariZoneActivatePokeblockFeeder(gSpecialVar_ItemId); + StringCopy(gStringVar1, gPokeblockNames[gSaveBlock1.pokeblocks[gSpecialVar_ItemId].color]); + gSpecialVar_Result = gSpecialVar_ItemId; + PokeblockClearIfExists(gSpecialVar_ItemId); BeginNormalPaletteFade(-1, 0, 0, 16, 0); gTasks[taskId].func = sub_810C2C8; } diff --git a/src/field/safari_zone.c b/src/field/safari_zone.c index 73fb01f3e..e9ca3a9f9 100644 --- a/src/field/safari_zone.c +++ b/src/field/safari_zone.c @@ -37,7 +37,7 @@ extern u8 gUnknown_081C3448; extern u8 gUnknown_081C3459; extern u8 *gPokeblockNames[]; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; bool32 GetSafariZoneFlag(void) { @@ -137,13 +137,13 @@ void SafariZoneGetPokeblockNameInFeeder(void) && gPokeblockFeeders[i].x == x && gPokeblockFeeders[i].y == y) { - gScriptResult = i; + gSpecialVar_Result = i; StringCopy(gStringVar1, gPokeblockNames[gPokeblockFeeders[i].pokeblock.color]); return; } } - gScriptResult = -1; + gSpecialVar_Result = -1; } static void GetPokeblockFeederWithinRange(void) @@ -166,23 +166,23 @@ static void GetPokeblockFeederWithinRange(void) y *= -1; if ((x + y) <= 5) { - gScriptResult = i; + gSpecialVar_Result = i; return; } } } - gScriptResult = -1; + gSpecialVar_Result = -1; } struct Pokeblock *unref_sub_80C8418(void) { SafariZoneGetPokeblockNameInFeeder(); - if (gScriptResult == 0xFFFF) + if (gSpecialVar_Result == 0xFFFF) return NULL; else - return &gPokeblockFeeders[gScriptResult].pokeblock; + return &gPokeblockFeeders[gSpecialVar_Result].pokeblock; } @@ -190,10 +190,10 @@ struct Pokeblock *SafariZoneGetActivePokeblock(void) { GetPokeblockFeederWithinRange(); - if (gScriptResult == 0xFFFF) + if (gSpecialVar_Result == 0xFFFF) return NULL; else - return &gPokeblockFeeders[gScriptResult].pokeblock; + return &gPokeblockFeeders[gSpecialVar_Result].pokeblock; } @@ -240,13 +240,13 @@ bool8 unref_sub_80C853C(void) { SafariZoneGetPokeblockNameInFeeder(); - if (gScriptResult == 0xFFFF) + if (gSpecialVar_Result == 0xFFFF) { return FALSE; } ConvertIntToDecimalStringN(gStringVar2, - gPokeblockFeeders[gScriptResult].stepCounter, + gPokeblockFeeders[gSpecialVar_Result].stepCounter, STR_CONV_MODE_LEADING_ZEROS, 3); return TRUE; diff --git a/src/field/scrcmd.c b/src/field/scrcmd.c index f0cafcf1a..d5fc56e8d 100644 --- a/src/field/scrcmd.c +++ b/src/field/scrcmd.c @@ -61,9 +61,9 @@ extern u16 gSpecialVar_0x8001; extern u16 gSpecialVar_0x8002; extern u16 gSpecialVar_0x8004; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; -extern u16 gScriptContestCategory; +extern u16 gSpecialVar_ContestCategory; extern SpecialFunc gSpecials[]; extern u8 *gStdScripts[]; @@ -479,7 +479,7 @@ bool8 ScrCmd_random(struct ScriptContext *ctx) { u16 max = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = Random() % max; + gSpecialVar_Result = Random() % max; return FALSE; } @@ -488,7 +488,7 @@ bool8 ScrCmd_giveitem(struct ScriptContext *ctx) u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = AddBagItem(itemId, (u8)quantity); + gSpecialVar_Result = AddBagItem(itemId, (u8)quantity); return FALSE; } @@ -497,7 +497,7 @@ bool8 ScrCmd_takeitem(struct ScriptContext *ctx) u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = RemoveBagItem(itemId, (u8)quantity); + gSpecialVar_Result = RemoveBagItem(itemId, (u8)quantity); return FALSE; } @@ -506,7 +506,7 @@ bool8 ScrCmd_checkitemspace(struct ScriptContext *ctx) u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = CheckBagHasSpace(itemId, (u8)quantity); + gSpecialVar_Result = CheckBagHasSpace(itemId, (u8)quantity); return FALSE; } @@ -515,7 +515,7 @@ bool8 ScrCmd_checkitem(struct ScriptContext *ctx) u16 itemId = VarGet(ScriptReadHalfword(ctx)); u32 quantity = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = CheckBagHasItem(itemId, (u8)quantity); + gSpecialVar_Result = CheckBagHasItem(itemId, (u8)quantity); return FALSE; } @@ -523,7 +523,7 @@ bool8 ScrCmd_checkitemtype(struct ScriptContext *ctx) { u16 itemId = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = GetPocketByItemId(itemId); + gSpecialVar_Result = GetPocketByItemId(itemId); return FALSE; } @@ -532,7 +532,7 @@ bool8 ScrCmd_givepcitem(struct ScriptContext *ctx) u16 itemId = VarGet(ScriptReadHalfword(ctx)); u16 quantity = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = AddPCItem(itemId, quantity); + gSpecialVar_Result = AddPCItem(itemId, quantity); return FALSE; } @@ -541,7 +541,7 @@ bool8 ScrCmd_checkpcitem(struct ScriptContext *ctx) u16 itemId = VarGet(ScriptReadHalfword(ctx)); u16 quantity = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = CheckPCHasItem(itemId, quantity); + gSpecialVar_Result = CheckPCHasItem(itemId, quantity); return FALSE; } @@ -549,7 +549,7 @@ bool8 ScrCmd_givedecoration(struct ScriptContext *ctx) { u32 decoration = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = IsThereStorageSpaceForDecoration(decoration); + gSpecialVar_Result = IsThereStorageSpaceForDecoration(decoration); return FALSE; } @@ -557,7 +557,7 @@ bool8 ScrCmd_takedecoration(struct ScriptContext *ctx) { u32 decoration = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = sub_81340A8(decoration); + gSpecialVar_Result = sub_81340A8(decoration); return FALSE; } @@ -565,7 +565,7 @@ bool8 ScrCmd_checkdecorspace(struct ScriptContext *ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = sub_8134074(decorId); + gSpecialVar_Result = sub_8134074(decorId); return FALSE; } @@ -573,7 +573,7 @@ bool8 ScrCmd_checkdecor(struct ScriptContext *ctx) { u32 decorId = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = sub_8133FE4(decorId); + gSpecialVar_Result = sub_8133FE4(decorId); return FALSE; } @@ -641,7 +641,7 @@ bool8 ScrCmd_fadescreenspeed(struct ScriptContext *ctx) return TRUE; } -bool8 s28_pause_asm() +bool8 RunPauseTimer() { sPauseCounter--; @@ -654,7 +654,7 @@ bool8 s28_pause_asm() bool8 ScrCmd_delay(struct ScriptContext *ctx) { sPauseCounter = ScriptReadHalfword(ctx); - SetupNativeScript(ctx, s28_pause_asm); + SetupNativeScript(ctx, RunPauseTimer); return TRUE; } @@ -861,7 +861,7 @@ bool8 ScrCmd_getplayerxy(struct ScriptContext *ctx) bool8 ScrCmd_getpartysize(struct ScriptContext *ctx) { - gScriptResult = CalculatePlayerPartyCount(); + gSpecialVar_Result = CalculatePlayerPartyCount(); return FALSE; } @@ -871,7 +871,7 @@ bool8 ScrCmd_playse(struct ScriptContext *ctx) return FALSE; } -static bool8 WaitForSoundEffectFinish() +static bool8 WaitForSoundEffectFinish(void) { if (!IsSEPlaying()) return TRUE; @@ -891,7 +891,7 @@ bool8 ScrCmd_playfanfare(struct ScriptContext *ctx) return FALSE; } -static bool8 WaitForFanfareFinish() +static bool8 WaitForFanfareFinish(void) { return IsFanfareTaskInactive(); } @@ -1554,7 +1554,7 @@ bool8 ScrCmd_givemon(struct ScriptContext *ctx) u32 unkParam2 = ScriptReadWord(ctx); u8 unkParam3 = ScriptReadByte(ctx); - gScriptResult = ScriptGiveMon(species, level, item, unkParam1, unkParam2, unkParam3); + gSpecialVar_Result = ScriptGiveMon(species, level, item, unkParam1, unkParam2, unkParam3); return FALSE; } @@ -1562,7 +1562,7 @@ bool8 ScrCmd_giveegg(struct ScriptContext *ctx) { u16 species = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = ScriptGiveEgg(species); + gSpecialVar_Result = ScriptGiveEgg(species); return FALSE; } @@ -1581,7 +1581,7 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx) u8 i; u16 moveId = ScriptReadHalfword(ctx); - gScriptResult = 6; + gSpecialVar_Result = 6; for (i = 0; i < PARTY_SIZE; i++) { u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL); @@ -1590,7 +1590,7 @@ bool8 ScrCmd_checkpartymove(struct ScriptContext *ctx) // UB: GetMonData() arguments don't match function definition if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && pokemon_has_move(&gPlayerParty[i], moveId) == TRUE) { - gScriptResult = i; + gSpecialVar_Result = i; gSpecialVar_0x8004 = species; break; } @@ -1624,7 +1624,7 @@ bool8 ScrCmd_checkmoney(struct ScriptContext *ctx) u8 ignore = ScriptReadByte(ctx); if (!ignore) - gScriptResult = IsEnoughMoney(gSaveBlock1.money, amount); + gSpecialVar_Result = IsEnoughMoney(gSaveBlock1.money, amount); return FALSE; } @@ -1804,7 +1804,7 @@ bool8 ScrCmd_getpricereduction(struct ScriptContext *ctx) { u16 value = VarGet(ScriptReadHalfword(ctx)); - gScriptResult = GetPriceReduction(value); + gSpecialVar_Result = GetPriceReduction(value); return FALSE; } @@ -1831,7 +1831,7 @@ bool8 ScrCmd_showcontestresults(struct ScriptContext *ctx) bool8 ScrCmd_contestlinktransfer(struct ScriptContext *ctx) { - sub_80C4980(gScriptContestCategory); + sub_80C4980(gSpecialVar_ContestCategory); ScriptContext1_Stop(); return TRUE; } @@ -1878,7 +1878,7 @@ bool8 ScrCmd_setrespawn(struct ScriptContext *ctx) bool8 ScrCmd_checkplayergender(struct ScriptContext *ctx) { - gScriptResult = gSaveBlock2.playerGender; + gSpecialVar_Result = gSaveBlock2.playerGender; return FALSE; } @@ -2002,9 +2002,9 @@ bool8 ScrCmd_givecoins(struct ScriptContext *ctx) u16 coins = VarGet(ScriptReadHalfword(ctx)); if (GiveCoins(coins) == TRUE) - gScriptResult = 0; + gSpecialVar_Result = 0; else - gScriptResult = 1; + gSpecialVar_Result = 1; return FALSE; } @@ -2013,8 +2013,8 @@ bool8 ScrCmd_takecoins(struct ScriptContext *ctx) u16 coins = VarGet(ScriptReadHalfword(ctx)); if (TakeCoins(coins) == TRUE) - gScriptResult = 0; + gSpecialVar_Result = 0; else - gScriptResult = 1; + gSpecialVar_Result = 1; return FALSE; } diff --git a/src/field/script_menu.c b/src/field/script_menu.c index 1f8c2c45e..9f3ab75cc 100644 --- a/src/field/script_menu.c +++ b/src/field/script_menu.c @@ -580,7 +580,7 @@ const u8 *const gUnknown_083CE048[] = extern u8 gPCText_WhichPCShouldBeAccessed[]; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; static void Task_HandleMultichoiceInput(u8); static void Task_HandleYesNoInput(u8); @@ -599,7 +599,7 @@ bool8 ScriptMenu_Multichoice(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress) } else { - gScriptResult = 0xFF; + gSpecialVar_Result = 0xFF; DrawMultichoiceMenu(left, top, gMultichoiceLists[multichoiceId].count, gMultichoiceLists[multichoiceId].list, ignoreBPress, 0); return TRUE; } @@ -613,7 +613,7 @@ bool8 ScriptMenu_MultichoiceWithDefault(u8 left, u8 top, u8 multichoiceId, u8 ig } else { - gScriptResult = 0xFF; + gSpecialVar_Result = 0xFF; DrawMultichoiceMenu(left, top, gMultichoiceLists[multichoiceId].count, gMultichoiceLists[multichoiceId].list, ignoreBPress, defaultChoice); return TRUE; } @@ -698,11 +698,11 @@ static void Task_HandleMultichoiceInput(u8 taskId) if (gTasks[taskId].tIgnoreBPress) return; PlaySE(SE_SELECT); - gScriptResult = 127; + gSpecialVar_Result = 127; } else { - gScriptResult = selection; + gSpecialVar_Result = selection; } HandleDestroyMenuCursors(); MenuZeroFillWindowRect(gTasks[taskId].tLeft, gTasks[taskId].tTop, gTasks[taskId].tRight, gTasks[taskId].tBottom); @@ -720,7 +720,7 @@ bool8 Multichoice(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress) } else { - gScriptResult = 0xFF; + gSpecialVar_Result = 0xFF; sub_80B53B4(left, top, gMultichoiceLists[multichoiceId].count, gMultichoiceLists[multichoiceId].list, ignoreBPress); return TRUE; } @@ -760,7 +760,7 @@ bool8 ScriptMenu_YesNo(u8 left, u8 top) } else { - gScriptResult = 0xFF; + gSpecialVar_Result = 0xFF; DisplayYesNoMenu(left, top, 1); taskId = CreateTask(Task_HandleYesNoInput, 0x50); gTasks[taskId].tLeft = left; @@ -772,7 +772,7 @@ bool8 ScriptMenu_YesNo(u8 left, u8 top) // unused bool8 IsScriptActive(void) { - if (gScriptResult == 0xFF) + if (gSpecialVar_Result == 0xFF) return FALSE; else return TRUE; @@ -795,10 +795,10 @@ static void Task_HandleYesNoInput(u8 taskId) case -1: case 1: PlaySE(SE_SELECT); - gScriptResult = 0; + gSpecialVar_Result = 0; break; case 0: - gScriptResult = 1; + gSpecialVar_Result = 1; break; } @@ -823,7 +823,7 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr u8 taskId; u8 width; - gScriptResult = 0xFF; + gSpecialVar_Result = 0xFF; sub_807274C(left, top, gMultichoiceLists[multichoiceId].count, 0, gMultichoiceLists[multichoiceId].list, columnCount, 0); @@ -860,11 +860,11 @@ static void Task_HandleMultichoiceGridInput(u8 taskId) if (gTasks[taskId].tIgnoreBPress) return; PlaySE(SE_SELECT); - gScriptResult = 127; + gSpecialVar_Result = 127; } else { - gScriptResult = selection; + gSpecialVar_Result = selection; } HandleDestroyMenuCursors(); MenuZeroFillWindowRect(gTasks[taskId].tLeft, gTasks[taskId].tTop, gTasks[taskId].tRight, gTasks[taskId].tBottom); @@ -888,7 +888,7 @@ bool8 ScrSpecial_CreatePCMenu(void) } else { - gScriptResult = 0xFF; + gSpecialVar_Result = 0xFF; ScriptMenu_CreatePCMenu(); return TRUE; } diff --git a/src/field/secret_base.c b/src/field/secret_base.c index bb7716190..7589ab1e3 100644 --- a/src/field/secret_base.c +++ b/src/field/secret_base.c @@ -175,11 +175,11 @@ void sub_80BB5D0(void) void sub_80BB5E4(void) { u16 i; - gScriptResult = 0; + gSpecialVar_Result = 0; for (i = 0; i < MAX_SECRET_BASES; i++) { if (gUnknown_020387DC != gSaveBlock1.secretBases[i].secretBaseId) continue; - gScriptResult = 1; + gSpecialVar_Result = 1; VarSet(VAR_0x4054, i); break; } @@ -188,9 +188,9 @@ void sub_80BB5E4(void) void sub_80BB63C(void) // 80bb63c { if (gSaveBlock1.secretBases[0].secretBaseId) - gScriptResult = 1; + gSpecialVar_Result = 1; else - gScriptResult = 0; + gSpecialVar_Result = 0; } u8 sub_80BB66C(void) // 80bb66c @@ -462,13 +462,13 @@ void sub_80BBDD0(void) gSpecialVar_0x8007 = roomdecorpos[decidx] & 0xF; metatile = MapGridGetMetatileBehaviorAt(gSpecialVar_0x8006 + 7, gSpecialVar_0x8007 + 7); if (sub_80572D8(metatile) == TRUE || sub_80572EC(metatile) == TRUE) { - gScriptResult = gMapHeader.events->mapObjects[objid].graphicsId + VAR_0x3F20; - VarSet(gScriptResult, gDecorations[roomdecor[decidx]].tiles[0]); - gScriptResult = gMapHeader.events->mapObjects[objid].localId; + gSpecialVar_Result = gMapHeader.events->mapObjects[objid].graphicsId + VAR_0x3F20; + VarSet(gSpecialVar_Result, gDecorations[roomdecor[decidx]].tiles[0]); + gSpecialVar_Result = gMapHeader.events->mapObjects[objid].localId; FlagClear(gSpecialVar_0x8004 + 0xAE); - show_sprite(gScriptResult, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); - sub_805C0F8(gScriptResult, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); - sub_805C78C(gScriptResult, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); + show_sprite(gSpecialVar_Result, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); + sub_805C0F8(gSpecialVar_Result, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup, gSpecialVar_0x8006, gSpecialVar_0x8007); + sub_805C78C(gSpecialVar_Result, gSaveBlock1.location.mapNum, gSaveBlock1.location.mapGroup); gSpecialVar_0x8004 ++; } } @@ -504,7 +504,7 @@ bool8 sub_80BC050(void) { sub_80BB5D0(); sub_80BB5E4(); - if (gScriptResult == 1) + if (gSpecialVar_Result == 1) return FALSE; return TRUE; } @@ -539,9 +539,9 @@ void sub_80BC0F8(void) { void sub_80BC114(void) { if (gSaveBlock1.secretBases[0].secretBaseId != gUnknown_020387DC) - gScriptResult = 1; + gSpecialVar_Result = 1; else - gScriptResult = 0; + gSpecialVar_Result = 0; } u8 sub_80BC14C(u8 sbid) @@ -862,15 +862,15 @@ void sub_80BC56C(void) u8 secretBaseIndex = sub_80BC14C(gUnknown_020387DC); if (sub_80BC268(secretBaseIndex) == TRUE) { - gScriptResult = 1; + gSpecialVar_Result = 1; } else if (sub_80BC538() > 9) { - gScriptResult = 2; + gSpecialVar_Result = 2; } else { - gScriptResult = 0; + gSpecialVar_Result = 0; } } @@ -1237,7 +1237,7 @@ void sub_80BCE1C(void) void sub_80BCE4C() { - gSaveBlock1.secretBases[VarGet(VAR_0x4054)].sbr_field_1_5 = gScriptResult; + gSaveBlock1.secretBases[VarGet(VAR_0x4054)].sbr_field_1_5 = gSpecialVar_Result; } void sub_80BCE90() @@ -1257,7 +1257,7 @@ void sub_80BCE90() } gSpecialVar_0x8004 = sub_80BCCA4(curBaseIndex); - gScriptResult = gSaveBlock1.secretBases[curBaseIndex].sbr_field_1_5; + gSpecialVar_Result = gSaveBlock1.secretBases[curBaseIndex].sbr_field_1_5; } void sub_80BCF1C(u8 taskId) diff --git a/src/field/start_menu.c b/src/field/start_menu.c index 9f4eacd09..dccf1714e 100644 --- a/src/field/start_menu.c +++ b/src/field/start_menu.c @@ -50,7 +50,7 @@ static bool8 savingComplete; extern bool8 gDifferentSaveFile; extern u16 gSaveFileStatus; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u8 gUnknown_03004860; @@ -528,10 +528,10 @@ static void Task_SaveDialog(u8 taskId) { case SAVE_CANCELED: case SAVE_ERROR: - gScriptResult = 0; + gSpecialVar_Result = 0; break; case SAVE_SUCCESS: - gScriptResult = status; + gSpecialVar_Result = status; break; case SAVE_IN_PROGRESS: return; diff --git a/src/field/starter_choose.c b/src/field/starter_choose.c index 149eaa03d..701d4087a 100644 --- a/src/field/starter_choose.c +++ b/src/field/starter_choose.c @@ -16,7 +16,7 @@ #include "trig.h" #include "unknown_task.h" -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern struct SpriteTemplate gUnknown_02024E8C; //-------------------------------------------------- @@ -439,7 +439,7 @@ static void Task_StarterChoose5(u8 taskId) { case 0: // YES //Return the starter choice and exit. - gScriptResult = gTasks[taskId].tStarterSelection; + gSpecialVar_Result = gTasks[taskId].tStarterSelection; SetMainCallback2(gMain.savedCallback); break; case 1: // NO diff --git a/src/field/trader.c b/src/field/trader.c index c4fe73ba1..61cb0b4a2 100644 --- a/src/field/trader.c +++ b/src/field/trader.c @@ -179,7 +179,7 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) void ScrSpecial_GetTraderTradedFlag(void) { struct MauvilleManTrader *trader = &gSaveBlock1.mauvilleMan.trader; - gScriptResult = trader->alreadyTraded; + gSpecialVar_Result = trader->alreadyTraded; } void ScrSpecial_DoesPlayerHaveNoDecorations(void) @@ -190,21 +190,21 @@ void ScrSpecial_DoesPlayerHaveNoDecorations(void) { if (sub_8134194(i)) { - gScriptResult = FALSE; + gSpecialVar_Result = FALSE; return; } } - gScriptResult = TRUE; + gSpecialVar_Result = TRUE; } void ScrSpecial_IsDecorationFull(void) { - gScriptResult = FALSE; + gSpecialVar_Result = FALSE; if (gDecorations[gSpecialVar_0x8004].category != gDecorations[gSpecialVar_0x8006].category && sub_8133F9C(gDecorations[gSpecialVar_0x8004].category) == -1) { sub_80FE7D4(gStringVar2, gDecorations[gSpecialVar_0x8004].category); - gScriptResult = TRUE; + gSpecialVar_Result = TRUE; } } diff --git a/src/field/tv.c b/src/field/tv.c index db96775e3..1d5bf929c 100644 --- a/src/field/tv.c +++ b/src/field/tv.c @@ -68,10 +68,10 @@ extern struct TVSaleItem gUnknown_02038724[3]; struct UnkTvStruct gUnknown_03005D38; -extern u16 gScriptLastTalked; +extern u16 gSpecialVar_LastTalked; -extern u8 gScriptContestCategory; -extern u8 gScriptContestRank; +extern u8 gSpecialVar_ContestCategory; +extern u8 gSpecialVar_ContestRank; extern u8 gUnknown_03004316[11]; extern u8 gBattleOutcome; @@ -447,8 +447,8 @@ void ClearTVShowData(void) bool8 sub_80BF1B4(u8); void sub_80BF20C(void); -extern u8 gScriptContestCategory; -extern u8 gScriptContestRank; +extern u8 gSpecialVar_ContestCategory; +extern u8 gSpecialVar_ContestRank; extern u8 gUnknown_03004316[11]; extern u8 gBattleOutcome; @@ -983,8 +983,8 @@ void sub_80BE284(u8 a0) if (gUnknown_03005D38.var0 != -1) { bravoTrainer->contestResult = a0; - bravoTrainer->contestCategory = gScriptContestCategory; - bravoTrainer->contestRank = gScriptContestRank; + bravoTrainer->contestCategory = gSpecialVar_ContestCategory; + bravoTrainer->contestRank = gSpecialVar_ContestRank; bravoTrainer->species = GetMonData(&gPlayerParty[gUnknown_02038694], MON_DATA_SPECIES, NULL); GetMonData(&gPlayerParty[gUnknown_02038694], MON_DATA_NICKNAME, bravoTrainer->pokemonNickname); } @@ -1047,7 +1047,7 @@ void sub_80BE3BC(void) void sub_80BE478(void) { sub_80BF478(); - if (gScriptResult == 1) + if (gSpecialVar_Result == 1) return; GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar1); @@ -1414,7 +1414,7 @@ void sub_80BECE8(void) arg0 = sub_80BECA0(); if (arg0 == 0xff) { - gScriptResult = 0; + gSpecialVar_Result = 0; return; } if (gSaveBlock1.unknown_2ABC[arg0].val2 == 0) @@ -1433,7 +1433,7 @@ void sub_80BECE8(void) gSaveBlock1.unknown_2ABC[arg0].val1 = 0; ShowFieldMessage(gTVNewsTextGroup1[gSaveBlock1.unknown_2ABC[arg0].val0]); } - gScriptResult = 1; + gSpecialVar_Result = 1; } bool8 GetPriceReduction(u8 arg0) @@ -1462,7 +1462,7 @@ bool8 IsPriceDiscounted(u8 arg0) case 1: if (gSaveBlock1.location.mapGroup == MAP_GROUP(SLATEPORT_CITY) && gSaveBlock1.location.mapNum == MAP_NUM(SLATEPORT_CITY) - && gScriptLastTalked == 0x1a) + && gSpecialVar_LastTalked == 0x1a) return TRUE; else return FALSE; @@ -1660,7 +1660,7 @@ void sub_80BF25C(u8 showType) { if(gSaveBlock1.tvShows[i].common.var01 == 1) { - gScriptResult = 1; + gSpecialVar_Result = 1; } else { @@ -1676,7 +1676,7 @@ void sub_80BF25C(u8 showType) void sub_80BF2C4(void) { - gScriptResult = 0; + gSpecialVar_Result = 0; switch (gSpecialVar_0x8005) { case TVSHOW_FAN_CLUB_LETTER: @@ -1708,7 +1708,7 @@ void sub_80BF334(void) struct TVShowFanClubLetter *fanclubLetter; sub_80BF25C(TVSHOW_FAN_CLUB_LETTER); - if (gScriptResult == 0) + if (gSpecialVar_Result == 0) { StringCopy(gStringVar1, gSpeciesNames[GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, 0)]); fanclubLetter = &gSaveBlock1.tvShows[gUnknown_03005D38.var0].fanclubLetter; @@ -1721,7 +1721,7 @@ void sub_80BF3A4(void) struct TVShowRecentHappenings *recentHappenings; sub_80BF25C(TVSHOW_RECENT_HAPPENINGS); - if (gScriptResult == 0) + if (gSpecialVar_Result == 0) { recentHappenings = &gSaveBlock1.tvShows[gUnknown_03005D38.var0].recentHappenings; sub_80EB6FC(recentHappenings->var04, 6); @@ -1733,7 +1733,7 @@ void sub_80BF3DC(void) struct TVShowFanclubOpinions *fanclubOpinions; sub_80BF25C(TVSHOW_PKMN_FAN_CLUB_OPINIONS); - if (gScriptResult == 0) + if (gSpecialVar_Result == 0) { StringCopy(gStringVar1, gSpeciesNames[GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, 0)]); GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME, gStringVar2); @@ -1745,7 +1745,7 @@ void sub_80BF3DC(void) void sub_80BF46C(void) { - gScriptResult = 1; + gSpecialVar_Result = 1; } void sub_80BF478(void) @@ -1758,7 +1758,7 @@ void sub_80BF484(void) struct TVShowBravoTrainerPokemonProfiles *bravoTrainer; sub_80BF25C(TVSHOW_BRAVO_TRAINER_POKEMON_PROFILE); - if (gScriptResult == 0) + if (gSpecialVar_Result == 0) { bravoTrainer = &gSaveBlock1.tvShows[gUnknown_03005D38.var0].bravoTrainer; sub_80EB6FC(bravoTrainer->var04, 2); @@ -1770,7 +1770,7 @@ void sub_80BF4BC(void) struct TVShowBravoTrainerBattleTowerSpotlight *bravoTrainerTower; sub_80BF25C(TVSHOW_BRAVO_TRAINER_BATTLE_TOWER_PROFILE); - if (gScriptResult == 0) + if (gSpecialVar_Result == 0) { bravoTrainerTower = &gSaveBlock1.tvShows[gUnknown_03005D38.var0].bravoTrainerTower; sub_80EB6FC(bravoTrainerTower->var18, 1); // wrong struct ident, fix later @@ -1898,9 +1898,9 @@ void sub_80BF6D8(void) gUnknown_03005D38.var0 = sub_80BF720(gSaveBlock1.tvShows); gSpecialVar_0x8006 = gUnknown_03005D38.var0; if (gUnknown_03005D38.var0 == -1) - gScriptResult = 1; + gSpecialVar_Result = 1; else - gScriptResult = 0; + gSpecialVar_Result = 0; } s8 sub_80BF720(TVShow tvShow[]) @@ -2095,9 +2095,9 @@ void sub_80BFAE0(void) void sub_80BFB10(void) { if (GetPlayerTrainerId() == GetMonData(&(gPlayerParty[gSpecialVar_0x8004]), MON_DATA_OT_ID, 0)) - gScriptResult = 0; + gSpecialVar_Result = 0; else - gScriptResult = 1; + gSpecialVar_Result = 1; } u8 sub_80BFB54(u8 arg0) @@ -2869,7 +2869,7 @@ void DoTVShowBravoTrainerPokemonProfile(void) struct TVShowBravoTrainerPokemonProfiles *bravoTrainer = &gSaveBlock1.tvShows[gSpecialVar_0x8004].bravoTrainer; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch(state) { @@ -2940,7 +2940,7 @@ void DoTVShowBravoTrainerBattleTowerProfile(void) struct TVShowBravoTrainerBattleTowerSpotlight *bravoTrainerTower = &gSaveBlock1.tvShows[gSpecialVar_0x8004].bravoTrainerTower; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch(state) { @@ -3029,7 +3029,7 @@ void DoTVShowTodaysSmartShopper(void) struct TVShowSmartShopper *smartShopper = &gSaveBlock1.tvShows[gSpecialVar_0x8004].smartshopperShow; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch(state) { @@ -3117,7 +3117,7 @@ void DoTVShowTheNameRaterShow(void) struct TVShowNameRaterShow *nameRaterShow = &gSaveBlock1.tvShows[gSpecialVar_0x8004].nameRaterShow; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3213,7 +3213,7 @@ void DoTVShowPokemonTodaySuccessfulCapture(void) struct TVShowPokemonToday *pokemonToday = &gSaveBlock1.tvShows[gSpecialVar_0x8004].pokemonToday; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3282,7 +3282,7 @@ void DoTVShowPokemonTodayFailedCapture(void) struct TVShowPokemonTodayFailed *pokemonTodayFailed = &gSaveBlock1.tvShows[gSpecialVar_0x8004].pokemonTodayFailed; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3327,7 +3327,7 @@ void DoTVShowPokemonFanClubLetter(void) u8 state; u16 rval; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3379,7 +3379,7 @@ void DoTVShowRecentHappenings(void) struct TVShowRecentHappenings *recentHappenings = &gSaveBlock1.tvShows[gSpecialVar_0x8004].recentHappenings; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3413,7 +3413,7 @@ void DoTVShowPokemonFanClubOpinions(void) struct TVShowFanclubOpinions *fanclubOpinions = &gSaveBlock1.tvShows[gSpecialVar_0x8004].fanclubOpinions; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3459,7 +3459,7 @@ void DoTVShowInSearchOfTrainers(void) { u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3501,7 +3501,7 @@ void DoTVShowInSearchOfTrainers(void) EasyChat_GetWordText(gStringVar1, gSaveBlock1.gabbyAndTyData.quote); StringCopy(gStringVar2, gSpeciesNames[gSaveBlock1.gabbyAndTyData.mon1]); StringCopy(gStringVar3, gSpeciesNames[gSaveBlock1.gabbyAndTyData.mon2]); - gScriptResult = 1; + gSpecialVar_Result = 1; gUnknown_020387E8 = 0;; TakeTVShowInSearchOfTrainersOffTheAir(); break; @@ -3514,7 +3514,7 @@ void DoTVShowPokemonAngler(void) struct TVShowPokemonAngler *pokemonAngler = &gSaveBlock1.tvShows[gSpecialVar_0x8004].pokemonAngler; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; if (pokemonAngler->var02 < pokemonAngler->var03) gUnknown_020387E8 = 0; else @@ -3543,7 +3543,7 @@ void DoTVShowTheWorldOfMasters(void) struct TVShowWorldOfMasters *worldOfMasters = &gSaveBlock1.tvShows[gSpecialVar_0x8004].worldOfMasters; u8 state; - gScriptResult = 0; + gSpecialVar_Result = 0; state = gUnknown_020387E8; switch (state) { @@ -3571,7 +3571,7 @@ void DoTVShowTheWorldOfMasters(void) void TVShowDone(void) { - gScriptResult = 1; + gSpecialVar_Result = 1; gUnknown_020387E8 = 0; gSaveBlock1.tvShows[gSpecialVar_0x8004].common.var01 = 0; } diff --git a/src/field/use_pokeblock.c b/src/field/use_pokeblock.c index 8155b4216..7253ac901 100644 --- a/src/field/use_pokeblock.c +++ b/src/field/use_pokeblock.c @@ -105,7 +105,7 @@ EWRAM_DATA u8 gPokeblockMonID = 0; EWRAM_DATA s16 gPokeblockGain = 0; extern u16 gKeyRepeatStartDelay; -extern u16 gScriptItemId; // FIXME: remove after merge of #349 Pokeblock +extern u16 gSpecialVar_ItemId; // FIXME: remove after merge of #349 Pokeblock static void launch_c3_walk_stairs_and_run_once(void (*const)(void)); static void sub_81361E4(void); @@ -574,7 +574,7 @@ static void sub_81369CC(void) case 5: if (gMain.newKeys & (A_BUTTON | B_BUTTON) && !sub_8136D00()) { - PokeblockClearIfExists((u8)gScriptItemId); + PokeblockClearIfExists((u8)gSpecialVar_ItemId); launch_c3_walk_stairs_and_run_once(sub_8136B44); } break; diff --git a/src/field/wild_encounter.c b/src/field/wild_encounter.c index cc4468728..4bf83cad8 100644 --- a/src/field/wild_encounter.c +++ b/src/field/wild_encounter.c @@ -3695,7 +3695,7 @@ const u16 gRoute119WaterTileData[] = 0x5C, 0x8B, 0x12A, }; -extern u16 gScriptResult; +extern u16 gSpecialVar_Result; extern u8 S_RepelWoreOff[]; EWRAM_DATA static u8 sWildEncountersDisabled = 0; @@ -4167,18 +4167,18 @@ void ScrSpecial_RockSmashWildEncounter(void) if (wildPokemonInfo == NULL) { - gScriptResult = 0; + gSpecialVar_Result = 0; return; } else if (DoWildEncounterTest(wildPokemonInfo->encounterRate, 1) == TRUE && GenerateWildMon(wildPokemonInfo, 2, TRUE) == TRUE) { BattleSetup_StartWildBattle(); - gScriptResult = 1; + gSpecialVar_Result = 1; return; } } - gScriptResult = 0; + gSpecialVar_Result = 0; return; } |