mirror of https://github.com/pret/pokeemerald.git
Simplified CheckPlayerHasSecretBase
parent
7dad8a2e21
commit
3803ab18ec
|
@ -38,34 +38,32 @@ index 1a4a0ac9cd..3bace19de3 100644
|
|||
}
|
||||
}
|
||||
|
||||
+static u16 GetHighestOwnedSecretBaseIdx(void)
|
||||
+{
|
||||
+ u16 idx;
|
||||
+ for (idx = SECRET_BASES_COUNT - 1; idx >= 0; idx--)
|
||||
+ {
|
||||
+ if (FlagGet(FLAG_SECRET_BASE_OWNED_00 + idx))
|
||||
+ return idx + 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
void CheckPlayerHasSecretBase(void)
|
||||
{
|
||||
- // The player's secret base is always the first in the array.
|
||||
- if (gSaveBlock1Ptr->secretBases[0].secretBaseId)
|
||||
+ if (GetHighestOwnedSecretBaseIdx() == 0)
|
||||
+ gSpecialVar_Result = FALSE;
|
||||
+ else
|
||||
- gSpecialVar_Result = TRUE;
|
||||
- else
|
||||
- gSpecialVar_Result = FALSE;
|
||||
+ u16 i;
|
||||
+ for (i = 0; i < SECRET_BASES_COUNT; i++)
|
||||
+ {
|
||||
+ if (FlagGet(FLAG_SECRET_BASE_OWNED_00 + i)){
|
||||
+ gSpecialVar_Result = TRUE;
|
||||
+}
|
||||
+
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ gSpecialVar_Result = FALSE;
|
||||
}
|
||||
|
||||
+void CheckNoMoreSecretBases(void)
|
||||
+{
|
||||
+ if (FindAvailableSecretBaseIndex() == -1) // If we're out of Secret Bases
|
||||
gSpecialVar_Result = TRUE;
|
||||
else
|
||||
gSpecialVar_Result = FALSE;
|
||||
}
|
||||
+ gSpecialVar_Result = TRUE;
|
||||
+ else
|
||||
+ gSpecialVar_Result = FALSE;
|
||||
+}
|
||||
+
|
||||
@@ -361,18 +381,22 @@ static u8 GetNameLength(const u8 *secretBaseOwnerName)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue