Finish documenting event vars

This commit is contained in:
Phlosioneer
2019-02-27 23:54:51 -05:00
parent 782979f1fc
commit bf45b83c65
37 changed files with 178 additions and 178 deletions

View File

@@ -60,7 +60,7 @@ struct SecretBaseRecordMixer {
// Static RAM declarations
EWRAM_DATA u8 sCurSecretBaseId = 0;
EWRAM_DATA u8 gUnknown_0203A01D = 0;
EWRAM_DATA bool8 gIsInSecretBase = FALSE;
EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
// Static ROM declarations
@@ -1186,11 +1186,11 @@ void SecretBasePerStepCallback(u8 taskId)
case 0:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
gUnknown_0203A01D = TRUE;
gIsInSecretBase = TRUE;
}
else
{
gUnknown_0203A01D = FALSE;
gIsInSecretBase = FALSE;
}
PlayerGetDestCoords(&data[2], &data[3]);
data[1] = 1;
@@ -1201,103 +1201,103 @@ void SecretBasePerStepCallback(u8 taskId)
{
data[2] = x;
data[3] = y;
VarSet(VAR_0x40EC, VarGet(VAR_0x40EC) + 1);
VarSet(VAR_SECRET_BASE_STEP_COUNTER, VarGet(VAR_SECRET_BASE_STEP_COUNTER) + 1);
behavior = MapGridGetMetatileBehaviorAt(x, y);
tileId = MapGridGetMetatileIdAt(x, y);
if (tileId == 0x234 || tileId == 0x23C)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 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)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 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)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 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))
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x200);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x200);
}
}
else if (behavior == 0xc1 && tileId == 0x23d)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) ^ 0x1000);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x2000);
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);
}
}
else if (behavior == 0x47 && tileId == 0x23e)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x1000);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) ^ 0x2000);
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);
}
}
else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x80);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x80);
}
}
else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE)
{
PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y);
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
switch ((int)MapGridGetMetatileIdAt(x, y))
{
case 0x338:
case 0x33c:
case 0x340:
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x02);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x02);
break;
case 0x228:
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x100);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x100);
break;
}
}
}
else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x400);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x400);
}
ShatterSecretBaseBreakableDoor(x, y);
}
else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){
if (gUnknown_0203A01D == TRUE) {
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8000);
if (gIsInSecretBase == TRUE) {
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8000);
}
}
else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4000);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4000);
}
}
else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE)
{
if (gUnknown_0203A01D == TRUE)
if (gIsInSecretBase == TRUE)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x02);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x02);
}
}
}
@@ -1780,33 +1780,33 @@ void sub_80EB18C(struct SecretBaseRecord *bases)
void sub_80EB1AC(void)
{
VarSet(VAR_0x40EC, 0);
VarSet(VAR_0x40ED, 0);
VarSet(VAR_0x40EE, 0);
VarSet(VAR_0x40EF, 0);
VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0);
VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, 0);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, 0);
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40F0, TRUE);
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, TRUE);
}
else
{
VarSet(VAR_0x40F0, FALSE);
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
}
gUnknown_0203A01D = FALSE;
gIsInSecretBase = FALSE;
}
void sub_80EB218(void)
{
if (VarGet(VAR_0x40F0) && gUnknown_0203A01D == TRUE && !CurrentMapIsSecretBase())
if (VarGet(VAR_SECRET_BASE_IS_NOT_LOCAL) && gIsInSecretBase == TRUE && !CurrentMapIsSecretBase())
{
VarSet(VAR_0x40F0, FALSE);
gUnknown_0203A01D = FALSE;
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
gIsInSecretBase = FALSE;
sub_80EEA70();
VarSet(VAR_0x40EC, 0);
VarSet(VAR_0x40ED, 0);
VarSet(VAR_0x40EE, 0);
VarSet(VAR_0x40EF, 0);
VarSet(VAR_0x40F0, FALSE);
VarSet(VAR_SECRET_BASE_STEP_COUNTER, 0);
VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, 0);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, 0);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, 0);
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
}
}
@@ -1814,7 +1814,7 @@ void sub_80EB290(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x800);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x800);
}
}
@@ -1822,7 +1822,7 @@ void sub_80EB2C8(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x400);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x400);
}
}
@@ -1830,9 +1830,9 @@ void sub_80EB300(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x2000);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x2000);
}
}
@@ -1840,9 +1840,9 @@ void sub_80EB368(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x800);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x800);
}
}
@@ -1850,9 +1850,9 @@ void sub_80EB3D0(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x1000);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x1000);
}
}
@@ -1860,9 +1860,9 @@ void sub_80EB438(void)
{
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) & ~0x3800);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) & ~0x001);
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x001);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) & ~0x3800);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) & ~0x001);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x001);
}
}
@@ -1891,7 +1891,7 @@ void sub_80EB498(void)
case 0x334:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x4000);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x4000);
}
break;
}
@@ -1909,7 +1909,7 @@ void sub_80EB56C(void)
case 0x28b:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x40);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x40);
}
break;
case 0x2d8:
@@ -1932,21 +1932,21 @@ void sub_80EB56C(void)
case 0x2fb:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x8);
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x8);
}
break;
case 0x22c:
case 0x233:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x40);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x40);
}
break;
case 0x288:
case 0x289:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x100);
}
break;
case 0x22d:
@@ -1954,7 +1954,7 @@ void sub_80EB56C(void)
case 0x22f:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x10);
}
break;
case 0x287:
@@ -1982,7 +1982,7 @@ void sub_80EB56C(void)
case 0x2cf:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8);
}
break;
}
@@ -2009,7 +2009,7 @@ void sub_80EB9E0(void)
case 0x2c6:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8);
}
break;
}
@@ -2047,14 +2047,14 @@ void sub_80EBB28(void)
case 0x2c7:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x8);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x8);
}
break;
case 0x280:
case 0x281:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x100);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x100);
}
break;
case 0x225:
@@ -2062,7 +2062,7 @@ void sub_80EBB28(void)
case 0x227:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x10);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x10);
}
break;
}
@@ -2080,7 +2080,7 @@ void sub_80EBE7C(void)
case 0x28e:
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
{
VarSet(VAR_0x40EF, VarGet(VAR_0x40EF) | 0x4);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | 0x4);
}
break;
}