More minor fixes

This commit is contained in:
Phlosioneer 2019-03-01 01:49:11 -05:00
parent 99bfd8c80f
commit a7e5852f1d
15 changed files with 99 additions and 65 deletions

View File

@ -16,7 +16,7 @@ SecretBase_RedCave1_MapScript1_23B4A2: @ 823B4A2
end end
SecretBase_RedCave1_MapScript2_23B4AE: @ 823B4AE SecretBase_RedCave1_MapScript2_23B4AE: @ 823B4AE
map_script_2 VAR_SECRET_BASE_SHOULD_BE_INIT, 0, SecretBase_RedCave1_EventScript_275B81 map_script_2 VAR_INIT_SECRET_BASE, 0, SecretBase_RedCave1_EventScript_275B81
.2byte 0 .2byte 0
SecretBase_RedCave1_MapScript1_23B4B8: @ 823B4B8 SecretBase_RedCave1_MapScript1_23B4B8: @ 823B4B8

View File

@ -430,7 +430,7 @@ EventScript_275B4D:: @ 8275B4D
EventScript_275B5B:: @ 8275B5B EventScript_275B5B:: @ 8275B5B
closemessage closemessage
playse SE_KAIDAN playse SE_KAIDAN
setvar VAR_SECRET_BASE_SHOULD_BE_INIT, 0 setvar VAR_INIT_SECRET_BASE, 0
setflag FLAG_DECORATION_0 setflag FLAG_DECORATION_0
special sub_80E8E18 special sub_80E8E18
special sub_80E9068 special sub_80E9068
@ -444,7 +444,7 @@ EventScript_275B5B:: @ 8275B5B
SecretBase_RedCave1_EventScript_275B81:: @ 8275B81 SecretBase_RedCave1_EventScript_275B81:: @ 8275B81
applymovement EVENT_OBJ_ID_PLAYER, SecretBase_RedCave1_Movement_275BB4 applymovement EVENT_OBJ_ID_PLAYER, SecretBase_RedCave1_Movement_275BB4
waitmovement 0 waitmovement 0
setvar VAR_SECRET_BASE_SHOULD_BE_INIT, 1 setvar VAR_INIT_SECRET_BASE, 1
msgbox SecretBase_RedCave1_Text_23B759, MSGBOX_YESNO msgbox SecretBase_RedCave1_Text_23B759, MSGBOX_YESNO
compare VAR_RESULT, 1 compare VAR_RESULT, 1
goto_if_eq SecretBase_RedCave1_EventScript_275BAB goto_if_eq SecretBase_RedCave1_EventScript_275BAB
@ -467,7 +467,7 @@ SecretBase_RedCave1_Movement_275BB4: @ 8275BB4
EventScript_275BB7:: @ 8275BB7 EventScript_275BB7:: @ 8275BB7
lockall lockall
setvar VAR_SECRET_BASE_SHOULD_BE_INIT, 1 setvar VAR_INIT_SECRET_BASE, 1
playse SE_KAIDAN playse SE_KAIDAN
special sub_80E9744 special sub_80E9744
compare VAR_RESULT, 0 compare VAR_RESULT, 0

View File

@ -167,7 +167,7 @@
#define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094 #define VAR_LILYCOVE_MUSEUM_2F_STATE 0x4094
#define VAR_LILYCOVE_FAN_CLUB_STATE 0x4095 #define VAR_LILYCOVE_FAN_CLUB_STATE 0x4095
#define VAR_BRINEY_LOCATION 0x4096 #define VAR_BRINEY_LOCATION 0x4096
#define VAR_SECRET_BASE_SHOULD_BE_INIT 0x4097 #define VAR_INIT_SECRET_BASE 0x4097
#define VAR_PETALBURG_WOODS_STATE 0x4098 #define VAR_PETALBURG_WOODS_STATE 0x4098
#define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099 #define VAR_LILYCOVE_CONTEST_LOBBY_STATE 0x4099
#define VAR_RUSTURF_TUNNEL_STATE 0x409A #define VAR_RUSTURF_TUNNEL_STATE 0x409A

View File

@ -61,8 +61,8 @@ void SetHBlankCallback(IntrCallback callback);
void SetVCountCallback(IntrCallback callback); void SetVCountCallback(IntrCallback callback);
void SetSerialCallback(IntrCallback callback); void SetSerialCallback(IntrCallback callback);
void InitFlashTimer(void); void InitFlashTimer(void);
void SetVBlankCounterPointer(u32 *var); void SetTrainerHillVBlankCounter(u32 *var);
void ClearVBlankCounterPointer(void); void ClearTrainerHillVBlankCounter(void);
void DoSoftReset(void); void DoSoftReset(void);
void ClearPokemonCrySongs(void); void ClearPokemonCrySongs(void);
void RestoreSerialTimer3IntrHandlers(void); void RestoreSerialTimer3IntrHandlers(void);

View File

@ -96,7 +96,7 @@ u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
u8 GetMapTypeByWarpData(struct WarpData *warp); u8 GetMapTypeByWarpData(struct WarpData *warp);
u8 GetCurrentMapType(void); u8 GetCurrentMapType(void);
u8 GetLastUsedWarpMapType(void); u8 GetLastUsedWarpMapType(void);
bool8 IsMapTypeOutside(u8 mapType); bool8 IsMapTypeOutdoors(u8 mapType);
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType); bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
bool8 Overworld_MapTypeIsIndoors(u8 mapType); bool8 Overworld_MapTypeIsIndoors(u8 mapType);
u8 GetSavedWarpRegionMapSectionId(void); u8 GetSavedWarpRegionMapSectionId(void);

View File

@ -1,7 +1,7 @@
#ifndef GUARD_TRAINER_HILL_H #ifndef GUARD_TRAINER_HILL_H
#define GUARD_TRAINER_HILL_H #define GUARD_TRAINER_HILL_H
extern u32 *gVBlankCounterPointer; extern u32 *gTrainerHillVBlankCounter;
void CallTrainerHillFunction(void); void CallTrainerHillFunction(void);
void ResetTrainerHillResults(void); void ResetTrainerHillResults(void);

View File

@ -2443,7 +2443,7 @@ static void sub_80B8410(struct Task *task)
bool8 FldEff_FieldMoveShowMon(void) bool8 FldEff_FieldMoveShowMon(void)
{ {
u8 taskId; u8 taskId;
if (IsMapTypeOutside(GetCurrentMapType()) == TRUE) if (IsMapTypeOutdoors(GetCurrentMapType()) == TRUE)
{ {
taskId = CreateTask(sub_80B8554, 0xff); taskId = CreateTask(sub_80B8554, 0xff);
} else } else

View File

@ -370,7 +370,7 @@ bool32 ShouldDoWallyCall(void)
case MAP_TYPE_CITY: case MAP_TYPE_CITY:
case MAP_TYPE_ROUTE: case MAP_TYPE_ROUTE:
case MAP_TYPE_OCEAN_ROUTE: case MAP_TYPE_OCEAN_ROUTE:
if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 0xFA) if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250)
{ {
return FALSE; return FALSE;
} }
@ -451,7 +451,7 @@ bool32 ShouldDoRoxanneCall(void)
case 2: case 2:
case 3: case 3:
case 6: case 6:
if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 0xFA) if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 250)
{ {
return FALSE; return FALSE;
} }
@ -478,7 +478,7 @@ bool32 ShouldDoRivalRayquazaCall(void)
case 2: case 2:
case 3: case 3:
case 6: case 6:
if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 0xFA) if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 250)
{ {
return FALSE; return FALSE;
} }
@ -1516,7 +1516,7 @@ bool8 FoundBlackGlasses(void)
void SetRoute119Weather(void) void SetRoute119Weather(void)
{ {
if (IsMapTypeOutside(GetLastUsedWarpMapType()) != TRUE) if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE)
{ {
SetSav1Weather(20); SetSav1Weather(20);
} }
@ -1524,7 +1524,7 @@ void SetRoute119Weather(void)
void SetRoute123Weather(void) void SetRoute123Weather(void)
{ {
if (IsMapTypeOutside(GetLastUsedWarpMapType()) != TRUE) if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE)
{ {
SetSav1Weather(21); SetSav1Weather(21);
} }
@ -3428,21 +3428,21 @@ void CreateUnusualWeatherEvent(void)
if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE) if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
{ {
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
} }
else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE) else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE)
{ {
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
} }
else if ((randomValue & 1) == 0) else if ((randomValue & 1) == 0)
{ {
randomValue = Random(); randomValue = Random();
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
} }
else else
{ {
randomValue = Random(); randomValue = Random();
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue & (UNUSUAL_WEATHER_COUNT_PER_LEGENDARY - 1)) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START); VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
} }
} }
@ -3450,7 +3450,24 @@ void CreateUnusualWeatherEvent(void)
// returns TRUE if the weather is for Kyogre, and FALSE if it's for Groudon. // returns TRUE if the weather is for Kyogre, and FALSE if it's for Groudon.
bool32 GetUnusualWeatherMapNameAndType(void) bool32 GetUnusualWeatherMapNameAndType(void)
{ {
static const u8 sUnusualWeatherMapNumbers[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; static const u8 sUnusualWeatherMapNumbers[] = {
MAP_NUM(ROUTE114),
MAP_NUM(ROUTE114),
MAP_NUM(ROUTE115),
MAP_NUM(ROUTE115),
MAP_NUM(ROUTE116),
MAP_NUM(ROUTE116),
MAP_NUM(ROUTE118),
MAP_NUM(ROUTE118),
MAP_NUM(ROUTE105),
MAP_NUM(ROUTE105),
MAP_NUM(ROUTE125),
MAP_NUM(ROUTE125),
MAP_NUM(ROUTE127),
MAP_NUM(ROUTE127),
MAP_NUM(ROUTE129),
MAP_NUM(ROUTE129)
};
u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION); u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
@ -3469,7 +3486,24 @@ bool32 GetUnusualWeatherMapNameAndType(void)
bool8 UnusualWeatherHasExpired(void) bool8 UnusualWeatherHasExpired(void)
{ {
// Duplicate array. // Duplicate array.
static const u8 sUnusualWeatherMapNumbers_2[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c }; static const u8 sUnusualWeatherMapNumbers_2[] = {
MAP_NUM(ROUTE114),
MAP_NUM(ROUTE114),
MAP_NUM(ROUTE115),
MAP_NUM(ROUTE115),
MAP_NUM(ROUTE116),
MAP_NUM(ROUTE116),
MAP_NUM(ROUTE118),
MAP_NUM(ROUTE118),
MAP_NUM(ROUTE105),
MAP_NUM(ROUTE105),
MAP_NUM(ROUTE125),
MAP_NUM(ROUTE125),
MAP_NUM(ROUTE127),
MAP_NUM(ROUTE127),
MAP_NUM(ROUTE129),
MAP_NUM(ROUTE129)
};
u16 steps = VarGet(VAR_UNUSUAL_WEATHER_STEP_COUNTER); u16 steps = VarGet(VAR_UNUSUAL_WEATHER_STEP_COUNTER);
u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION); u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);

View File

@ -99,7 +99,7 @@ void MoveSaveBlocks_ResetHeap(void)
hblankCB = gMain.hblankCallback; hblankCB = gMain.hblankCallback;
gMain.vblankCallback = NULL; gMain.vblankCallback = NULL;
gMain.hblankCallback = NULL; gMain.hblankCallback = NULL;
gVBlankCounterPointer = NULL; gTrainerHillVBlankCounter = NULL;
saveBlock2Copy = (struct SaveBlock2 *)(gHeap); saveBlock2Copy = (struct SaveBlock2 *)(gHeap);
saveBlock1Copy = (struct SaveBlock1 *)(gHeap + sizeof(struct SaveBlock2)); saveBlock1Copy = (struct SaveBlock1 *)(gHeap + sizeof(struct SaveBlock2));

View File

@ -163,7 +163,7 @@ static void UpdateLinkAndCallCallbacks(void)
static void InitMainCallbacks(void) static void InitMainCallbacks(void)
{ {
gMain.vblankCounter1 = 0; gMain.vblankCounter1 = 0;
gVBlankCounterPointer = NULL; gTrainerHillVBlankCounter = NULL;
gMain.vblankCounter2 = 0; gMain.vblankCounter2 = 0;
gMain.callback1 = NULL; gMain.callback1 = NULL;
SetMainCallback2(CB2_InitCopyrightScreenAfterBootup); SetMainCallback2(CB2_InitCopyrightScreenAfterBootup);
@ -324,8 +324,8 @@ static void VBlankIntr(void)
gMain.vblankCounter1++; gMain.vblankCounter1++;
if (gVBlankCounterPointer && *gVBlankCounterPointer < 0xFFFFFFFF) if (gTrainerHillVBlankCounter && *gTrainerHillVBlankCounter < 0xFFFFFFFF)
(*gVBlankCounterPointer)++; (*gTrainerHillVBlankCounter)++;
if (gMain.vblankCallback) if (gMain.vblankCallback)
gMain.vblankCallback(); gMain.vblankCallback();
@ -393,14 +393,14 @@ static void WaitForVBlank(void)
; ;
} }
void SetVBlankCounterPointer(u32 *var) void SetTrainerHillVBlankCounter(u32 *counter)
{ {
gVBlankCounterPointer = var; gTrainerHillVBlankCounter = counter;
} }
void ClearVBlankCounterPointer(void) void ClearTrainerHillVBlankCounter(void)
{ {
gVBlankCounterPointer = NULL; gTrainerHillVBlankCounter = NULL;
} }
void DoSoftReset(void) void DoSoftReset(void)

View File

@ -678,7 +678,7 @@ void UpdateEscapeWarp(s16 x, s16 y)
{ {
u8 currMapType = GetCurrentMapType(); u8 currMapType = GetCurrentMapType();
u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum); u8 destMapType = GetMapTypeByGroupAndId(sWarpDestination.mapGroup, sWarpDestination.mapNum);
if (IsMapTypeOutside(currMapType) && IsMapTypeOutside(destMapType) != TRUE) if (IsMapTypeOutdoors(currMapType) && IsMapTypeOutdoors(destMapType) != TRUE)
SetEscapeWarp(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x - 7, y - 6); SetEscapeWarp(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, x - 7, y - 6);
} }
@ -823,8 +823,8 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
static void mli0_load_map(u32 a1) static void mli0_load_map(u32 a1)
{ {
bool8 v2; bool8 isOutdoors;
bool8 indoors; bool8 isIndoors;
LoadCurrentMapData(); LoadCurrentMapData();
if (!(sUnknown_020322D8 & 1)) if (!(sUnknown_020322D8 & 1))
@ -837,8 +837,8 @@ static void mli0_load_map(u32 a1)
LoadEventObjTemplatesFromHeader(); LoadEventObjTemplatesFromHeader();
} }
v2 = IsMapTypeOutside(gMapHeader.mapType); isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType);
indoors = Overworld_MapTypeIsIndoors(gMapHeader.mapType); isIndoors = Overworld_MapTypeIsIndoors(gMapHeader.mapType);
sub_80EB218(); sub_80EB218();
TrySetMapSaveWarpStatus(); TrySetMapSaveWarpStatus();
@ -850,7 +850,7 @@ static void mli0_load_map(u32 a1)
DoTimeBasedEvents(); DoTimeBasedEvents();
SetSav1WeatherFromCurrMapHeader(); SetSav1WeatherFromCurrMapHeader();
ChooseAmbientCrySpecies(); ChooseAmbientCrySpecies();
if (v2) if (isOutdoors)
FlagClear(FLAG_SYS_USE_FLASH); FlagClear(FLAG_SYS_USE_FLASH);
SetDefaultFlashLevel(); SetDefaultFlashLevel();
Overworld_ClearSavedMusic(); Overworld_ClearSavedMusic();
@ -864,7 +864,7 @@ static void mli0_load_map(u32 a1)
else else
InitMap(); InitMap();
if (a1 != 1 && indoors) if (a1 != 1 && isIndoors)
{ {
UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height); UpdateTVScreensOnMap(gBackupMapLayout.width, gBackupMapLayout.height);
sub_80E9238(1); sub_80E9238(1);
@ -1330,7 +1330,7 @@ u8 GetLastUsedWarpMapType(void)
return GetMapTypeByWarpData(&gLastUsedWarp); return GetMapTypeByWarpData(&gLastUsedWarp);
} }
bool8 IsMapTypeOutside(u8 mapType) bool8 IsMapTypeOutdoors(u8 mapType)
{ {
if (mapType == MAP_TYPE_ROUTE if (mapType == MAP_TYPE_ROUTE
|| mapType == MAP_TYPE_TOWN || mapType == MAP_TYPE_TOWN

View File

@ -659,10 +659,10 @@ static void UpdateSaveAddresses(void)
u8 HandleSavingData(u8 saveType) u8 HandleSavingData(u8 saveType)
{ {
u8 i; u8 i;
u32 *backupVar = gVBlankCounterPointer; u32 *backupVar = gTrainerHillVBlankCounter;
u8 *tempAddr; u8 *tempAddr;
gVBlankCounterPointer = NULL; gTrainerHillVBlankCounter = NULL;
UpdateSaveAddresses(); UpdateSaveAddresses();
switch (saveType) switch (saveType)
{ {
@ -705,7 +705,7 @@ u8 HandleSavingData(u8 saveType)
save_write_to_flash(0xFFFF, gRamSaveSectionLocations); save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
break; break;
} }
gVBlankCounterPointer = backupVar; gTrainerHillVBlankCounter = backupVar;
return 0; return 0;
} }

View File

@ -60,7 +60,7 @@ struct SecretBaseRecordMixer {
// Static RAM declarations // Static RAM declarations
EWRAM_DATA u8 sCurSecretBaseId = 0; EWRAM_DATA u8 sCurSecretBaseId = 0;
EWRAM_DATA bool8 gIsInSecretBase = FALSE; EWRAM_DATA bool8 gInFriendSecretBase = FALSE;
EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL; EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
// Static ROM declarations // Static ROM declarations
@ -407,7 +407,7 @@ void sub_80E9068(void)
bool8 sub_80E909C(void) bool8 sub_80E909C(void)
{ {
if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_SECRET_BASE_SHOULD_BE_INIT) == 0) if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_INIT_SECRET_BASE) == 0)
{ {
return FALSE; return FALSE;
} }
@ -1186,11 +1186,11 @@ void SecretBasePerStepCallback(u8 taskId)
case 0: case 0:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0) if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{ {
gIsInSecretBase = TRUE; gInFriendSecretBase = TRUE;
} }
else else
{ {
gIsInSecretBase = FALSE; gInFriendSecretBase = FALSE;
} }
PlayerGetDestCoords(&data[2], &data[3]); PlayerGetDestCoords(&data[2], &data[3]);
data[1] = 1; data[1] = 1;
@ -1206,35 +1206,35 @@ void SecretBasePerStepCallback(u8 taskId)
tileId = MapGridGetMetatileIdAt(x, y); tileId = MapGridGetMetatileIdAt(x, y);
if (tileId == 0x234 || tileId == 0x23C) if (tileId == 0x234 || tileId == 0x23C)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x20); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x20);
} }
} }
else if (tileId == 0x2b8 || tileId == 0x2b9 || tileId == 0x2ba || tileId == 0x2c0 || tileId == 0x2c1 || tileId == 0x2c2 || tileId == 0x2c8 || tileId == 0x2c9 || tileId == 0x2ca) else if (tileId == 0x2b8 || tileId == 0x2b9 || tileId == 0x2ba || tileId == 0x2c0 || tileId == 0x2c1 || tileId == 0x2c2 || tileId == 0x2c8 || tileId == 0x2c9 || tileId == 0x2ca)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x01); VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x01);
} }
} }
else if (tileId == 0x239 || tileId == 0x241 || tileId == 0x251 || tileId == 0x259) else if (tileId == 0x239 || tileId == 0x241 || tileId == 0x251 || tileId == 0x259)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x04); VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x04);
} }
} }
else if ((behavior == 0x34 && tileId == 0x26d) || (behavior == 0x35 && MapGridGetMetatileIdAt(x, y) == 0x26a)) else if ((behavior == 0x34 && tileId == 0x26d) || (behavior == 0x35 && MapGridGetMetatileIdAt(x, y) == 0x26a))
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x200); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x200);
} }
} }
else if (behavior == 0xc1 && tileId == 0x23d) else if (behavior == 0xc1 && tileId == 0x23d)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x1000); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x1000);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x2000); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x2000);
@ -1242,7 +1242,7 @@ void SecretBasePerStepCallback(u8 taskId)
} }
else if (behavior == 0x47 && tileId == 0x23e) else if (behavior == 0x47 && tileId == 0x23e)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x1000); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x1000);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x2000); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ 0x2000);
@ -1250,7 +1250,7 @@ void SecretBasePerStepCallback(u8 taskId)
} }
else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE) else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x80); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x80);
} }
@ -1258,7 +1258,7 @@ void SecretBasePerStepCallback(u8 taskId)
else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE) else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE)
{ {
PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y); PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y);
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
switch ((int)MapGridGetMetatileIdAt(x, y)) switch ((int)MapGridGetMetatileIdAt(x, y))
{ {
@ -1275,27 +1275,27 @@ void SecretBasePerStepCallback(u8 taskId)
} }
else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE) else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x400); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x400);
} }
ShatterSecretBaseBreakableDoor(x, y); ShatterSecretBaseBreakableDoor(x, y);
} }
else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){ else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){
if (gIsInSecretBase == TRUE) { if (gInFriendSecretBase == TRUE) {
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8000); VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8000);
} }
} }
else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE) else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4000); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4000);
} }
} }
else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE) else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE)
{ {
if (gIsInSecretBase == TRUE) if (gInFriendSecretBase == TRUE)
{ {
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x02); VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x02);
} }
@ -1792,15 +1792,15 @@ void sub_80EB1AC(void)
{ {
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE); VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
} }
gIsInSecretBase = FALSE; gInFriendSecretBase = FALSE;
} }
void sub_80EB218(void) void sub_80EB218(void)
{ {
if (VarGet(VAR_SECRET_BASE_IS_NOT_LOCAL) && gIsInSecretBase == TRUE && !CurrentMapIsSecretBase()) if (VarGet(VAR_SECRET_BASE_IS_NOT_LOCAL) && gInFriendSecretBase == TRUE && !CurrentMapIsSecretBase())
{ {
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE); VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
gIsInSecretBase = FALSE; gInFriendSecretBase = FALSE;
sub_80EEA70(); sub_80EEA70();
VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0); VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0);
VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0); VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0);

View File

@ -81,7 +81,7 @@ void UpdateShoalTideFlag(void)
1, // 23 1, // 23
}; };
if (IsMapTypeOutside(GetLastUsedWarpMapType())) if (IsMapTypeOutdoors(GetLastUsedWarpMapType()))
{ {
RtcCalcLocalTime(); RtcCalcLocalTime();
if (tide[gLocalTime.hours]) if (tide[gLocalTime.hours])

View File

@ -93,7 +93,7 @@ struct TrHillStruct2
// EWRAM // EWRAM
static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL; static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL;
static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL; static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL;
EWRAM_DATA u32 *gVBlankCounterPointer = NULL; EWRAM_DATA u32 *gTrainerHillVBlankCounter = NULL;
// This file's functions. // This file's functions.
static void TrainerHillStartChallenge(void); static void TrainerHillStartChallenge(void);
@ -372,7 +372,7 @@ void InitTrainerHillBattleStruct(void)
} }
sRoomTrainers->facilityClass[i] = sHillData->tag.floors[sHillData->floorId].trainers[i].facilityClass; sRoomTrainers->facilityClass[i] = sHillData->tag.floors[sHillData->floorId].trainers[i].facilityClass;
} }
SetVBlankCounterPointer(&gSaveBlock1Ptr->trainerHill.timer); SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
FreeDataStruct(); FreeDataStruct();
} }
@ -435,7 +435,7 @@ static void TrainerHillStartChallenge(void)
gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0; gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0;
gSaveBlock1Ptr->trainerHill.field_3D6C = 0; gSaveBlock1Ptr->trainerHill.field_3D6C = 0;
SetVBlankCounterPointer(&gSaveBlock1Ptr->trainerHill.timer); SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
gSaveBlock1Ptr->trainerHill.timer = 0; gSaveBlock1Ptr->trainerHill.timer = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0; gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0;
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0; gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0;
@ -447,7 +447,7 @@ static void TrainerHillStartChallenge(void)
static void sub_81D58D8(void) static void sub_81D58D8(void)
{ {
ClearVBlankCounterPointer(); ClearTrainerHillVBlankCounter();
gSpecialVar_Result = 0; gSpecialVar_Result = 0;
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c) if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
gSpecialVar_Result++; gSpecialVar_Result++;
@ -505,7 +505,7 @@ static void TrainerHillResumeTimer(void)
if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME) if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME)
gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME; gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME;
else else
SetVBlankCounterPointer(&gSaveBlock1Ptr->trainerHill.timer); SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
} }
} }