Merge branch 'master' into main-menu-state-machine
This commit is contained in:
@@ -1417,7 +1417,7 @@ static void AnimTask_WithdrawStep(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
// Animates a "zap of energy" used in KINESIS.
|
||||
// Animates a "zap of energy" used in KINESIS.
|
||||
// arg 0: x pixel offset
|
||||
// arg 1: y pixel offset
|
||||
// arg 2: vertical flip
|
||||
@@ -1592,7 +1592,7 @@ void sub_8103AA4(struct Sprite *sprite)
|
||||
sprite->data[3] = sub_8151534(sub_8151534(b, a), sub_8151624(0x1C0));
|
||||
sprite->data[4] = sub_8151534(sub_8151534(c, a), sub_8151624(0x1C0));
|
||||
sprite->callback = sub_8103A00;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8103BE4(u8 taskId)
|
||||
@@ -3470,7 +3470,7 @@ void AnimOrbitFast(struct Sprite *sprite)
|
||||
|
||||
static void AnimOrbitFastStep(struct Sprite *sprite)
|
||||
{
|
||||
if ((u16)(sprite->data[1] - 64) < 128)
|
||||
if (sprite->data[1] >= 64 && sprite->data[1] <= 191)
|
||||
sprite->subpriority = sprite->data[7] + 1;
|
||||
else
|
||||
sprite->subpriority = sprite->data[7] - 1;
|
||||
|
||||
@@ -767,7 +767,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
|
||||
{
|
||||
if (IsLinkMaster())
|
||||
{
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
gTasks[taskId].data[11]++;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1267,7 +1267,7 @@ static u8 GetPostBattleDirectionHintTextIndex(int *hintType, u8 minDistanceForEx
|
||||
{
|
||||
for (x = 0; x < 32; x++)
|
||||
{
|
||||
if ((map[x] & 0x3FF) == FLOOR_EXIT_METATILE)
|
||||
if ((map[x] & METATILE_ID_MASK) == FLOOR_EXIT_METATILE)
|
||||
{
|
||||
x += 7 - gEventObjects[gSelectedEventObject].initialCoords.x;
|
||||
y += 7 - gEventObjects[gSelectedEventObject].initialCoords.y;
|
||||
@@ -1568,7 +1568,7 @@ void GenerateBattlePyramidFloorLayout(u16 *backupMapData, bool8 setPlayerPositio
|
||||
{
|
||||
for (x = 0; x < mapLayout->width; x++)
|
||||
{
|
||||
if ((layoutMap[x] & 0x3FF) != FLOOR_EXIT_METATILE)
|
||||
if ((layoutMap[x] & METATILE_ID_MASK) != FLOOR_EXIT_METATILE)
|
||||
{
|
||||
map[x] = layoutMap[x];
|
||||
}
|
||||
|
||||
+1
-1
@@ -641,7 +641,7 @@ u8 BattleSetup_GetTerrainId(void)
|
||||
return BATTLE_TERRAIN_BUILDING;
|
||||
case MAP_TYPE_UNDERWATER:
|
||||
return BATTLE_TERRAIN_UNDERWATER;
|
||||
case MAP_TYPE_6:
|
||||
case MAP_TYPE_OCEAN_ROUTE:
|
||||
if (MetatileBehavior_IsSurfableWaterOrUnderwater(tileBehavior))
|
||||
return BATTLE_TERRAIN_WATER;
|
||||
return BATTLE_TERRAIN_PLAIN;
|
||||
|
||||
+4
-4
@@ -2401,9 +2401,9 @@ static void sub_8163EE4(void)
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
playerRecord->greeting[i] = gSaveBlock1Ptr->unk2BBC[i];
|
||||
playerRecord->speechWon[i] = gSaveBlock1Ptr->unk2BC8[i];
|
||||
playerRecord->speechLost[i] = gSaveBlock1Ptr->unk2BD4[i];
|
||||
playerRecord->greeting[i] = gSaveBlock1Ptr->easyChatBattleStart[i];
|
||||
playerRecord->speechWon[i] = gSaveBlock1Ptr->easyChatBattleWon[i];
|
||||
playerRecord->speechLost[i] = gSaveBlock1Ptr->easyChatBattleLost[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -3059,7 +3059,7 @@ static void FillEReaderTrainerWithPlayerData(void)
|
||||
j = 7;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
ereaderTrainer->greeting[i] = gSaveBlock1Ptr->unk2BBC[i];
|
||||
ereaderTrainer->greeting[i] = gSaveBlock1Ptr->easyChatBattleStart[i];
|
||||
ereaderTrainer->farewellPlayerLost[i] = j;
|
||||
ereaderTrainer->farewellPlayerWon[i] = j + 6;
|
||||
j++;
|
||||
|
||||
+4
-9
@@ -34,6 +34,8 @@
|
||||
#include "battle_records.h"
|
||||
#include "graphics.h"
|
||||
#include "new_game.h"
|
||||
#include "save.h"
|
||||
#include "link.h"
|
||||
|
||||
#define BLENDER_SCORE_BEST 0
|
||||
#define BLENDER_SCORE_GOOD 1
|
||||
@@ -140,15 +142,8 @@ extern const u8 gText_Space[];
|
||||
extern const u8 gText_BlenderMaxSpeedRecord[];
|
||||
extern const u8 gText_234Players[];
|
||||
|
||||
extern void sub_800A418(void);
|
||||
extern u8 sub_800A9D8(void);
|
||||
extern void sub_81AABF0(void (*callback)(void));
|
||||
extern void sub_800B4C0(void);
|
||||
extern void ClearLinkCallback(void);
|
||||
extern void sub_8009F8C(void);
|
||||
extern void sub_8153430(void);
|
||||
extern bool8 sub_8153474(void);
|
||||
extern void sub_80EECEC(void);
|
||||
|
||||
// this file's functions
|
||||
static void BerryBlender_SetBackgroundsPos(void);
|
||||
@@ -2600,7 +2595,7 @@ static bool8 LinkPlayAgainHandleSaving(void)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
sub_8153430();
|
||||
FullSaveGame();
|
||||
sBerryBlenderData->field_1A0++;
|
||||
sBerryBlenderData->framesToWait = 0;
|
||||
break;
|
||||
@@ -2614,7 +2609,7 @@ static bool8 LinkPlayAgainHandleSaving(void)
|
||||
case 4:
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
if (sub_8153474())
|
||||
if (CheckSaveFile())
|
||||
{
|
||||
sBerryBlenderData->field_1A0 = 5;
|
||||
}
|
||||
|
||||
@@ -1056,7 +1056,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
for (x16 = x; x16 < (x + width); x16++)
|
||||
{
|
||||
CopyTileMapEntry(&firstTileNum, &((u16*)sGpuBgConfigs2[bg].tilemap)[(u16)GetTileMapIndexFromCoords(x16, y16, attribute, mode, mode2)], paletteSlot, 0, 0);
|
||||
firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF);
|
||||
firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1067,7 +1067,7 @@ void WriteSequenceToBgTilemapBuffer(u8 bg, u16 firstTileNum, u8 x, u8 y, u8 widt
|
||||
for (x16 = x; x16 < (x + width); x16++)
|
||||
{
|
||||
((u8*)sGpuBgConfigs2[bg].tilemap)[(y16 * mode3) + x16] = firstTileNum;
|
||||
firstTileNum = (firstTileNum & 0xFC00) + ((firstTileNum + tileNumDelta) & 0x3FF);
|
||||
firstTileNum = (firstTileNum & (METATILE_COLLISION_MASK | METATILE_ELEVATION_MASK)) + ((firstTileNum + tileNumDelta) & METATILE_ID_MASK);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
+24
-19
@@ -284,7 +284,7 @@ static void sub_80B2804(u8 taskId)
|
||||
|
||||
if (GetFieldMessageBoxMode() == FIELD_MESSAGE_BOX_HIDDEN)
|
||||
{
|
||||
if (sub_800AA48() != GetLinkPlayerCount_2())
|
||||
if (GetSavedPlayerCount() != GetLinkPlayerCount_2())
|
||||
{
|
||||
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
|
||||
gTasks[taskId].func = sub_80B270C;
|
||||
@@ -297,7 +297,7 @@ static void sub_80B2804(u8 taskId)
|
||||
else if (gMain.heldKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
gTasks[taskId].func = sub_80B28A8;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +312,7 @@ static void sub_80B28A8(u8 taskId)
|
||||
|| sub_80B2D6C(taskId) == TRUE)
|
||||
return;
|
||||
|
||||
if (GetLinkPlayerCount_2() != sub_800AA48())
|
||||
if (GetLinkPlayerCount_2() != GetSavedPlayerCount())
|
||||
{
|
||||
gTasks[taskId].func = sub_80B2D2C;
|
||||
}
|
||||
@@ -354,7 +354,7 @@ static void sub_80B2918(u8 taskId)
|
||||
else
|
||||
{
|
||||
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
|
||||
gUnknown_03005DB4 = GetMultiplayerId();
|
||||
gLocalLinkPlayerId = GetMultiplayerId();
|
||||
sub_800AA04(gFieldLinkPlayerCount);
|
||||
card = (struct TrainerCard *)gBlockSendBuffer;
|
||||
TrainerCard_GenerateCardForPlayer(card);
|
||||
@@ -401,7 +401,7 @@ static void sub_80B2A08(u8 taskId)
|
||||
else
|
||||
{
|
||||
gFieldLinkPlayerCount = GetLinkPlayerCount_2();
|
||||
gUnknown_03005DB4 = GetMultiplayerId();
|
||||
gLocalLinkPlayerId = GetMultiplayerId();
|
||||
sub_800AA04(gFieldLinkPlayerCount);
|
||||
card = (struct TrainerCard *)gBlockSendBuffer;
|
||||
TrainerCard_GenerateCardForPlayer(card);
|
||||
@@ -766,9 +766,9 @@ static void sub_80B3194(u8 taskId)
|
||||
|
||||
static void sub_80B31E8(u8 taskId)
|
||||
{
|
||||
if (sub_800AA48() == GetLinkPlayerCount_2())
|
||||
if (GetSavedPlayerCount() == GetLinkPlayerCount_2())
|
||||
{
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
gTasks[taskId].func = sub_80B3220;
|
||||
}
|
||||
}
|
||||
@@ -974,7 +974,7 @@ void sub_80B360C(void)
|
||||
|
||||
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2)
|
||||
{
|
||||
UpdatePlayerLinkBattleRecords(gUnknown_03005DB4 ^ 1);
|
||||
UpdatePlayerLinkBattleRecords(gLocalLinkPlayerId ^ 1);
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
switch (gBattleOutcome)
|
||||
@@ -995,13 +995,13 @@ void sub_80B360C(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gMain.savedCallback = c2_8056854;
|
||||
gMain.savedCallback = CB2_ReturnToFieldFromMultiplayer;
|
||||
}
|
||||
|
||||
SetMainCallback2(sub_80A0514);
|
||||
}
|
||||
|
||||
void sub_80B36EC(void)
|
||||
void CleanupLinkRoomState(void)
|
||||
{
|
||||
if (gSpecialVar_0x8004 == 1 || gSpecialVar_0x8004 == 2 || gSpecialVar_0x8004 == 5 || gSpecialVar_0x8004 == 9)
|
||||
{
|
||||
@@ -1011,9 +1011,9 @@ void sub_80B36EC(void)
|
||||
SetWarpDestinationToDynamicWarp(0x7F);
|
||||
}
|
||||
|
||||
void sub_80B371C(void)
|
||||
void ExitLinkRoom(void)
|
||||
{
|
||||
sub_80872B0();
|
||||
QueueExitLinkRoomKey();
|
||||
}
|
||||
|
||||
static void sub_80B3728(u8 taskId)
|
||||
@@ -1030,7 +1030,7 @@ static void sub_80B3728(u8 taskId)
|
||||
if (IsFieldMessageBoxHidden())
|
||||
{
|
||||
sub_8087288();
|
||||
sub_8009628(gSpecialVar_0x8005);
|
||||
SetLocalLinkPlayerId(gSpecialVar_0x8005);
|
||||
task->data[0] = 2;
|
||||
}
|
||||
break;
|
||||
@@ -1132,7 +1132,8 @@ static void sub_80B3894(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80B3924(void)
|
||||
// Note: VAR_0x8005 is set to the ID of the trade seat.
|
||||
void PlayerEnteredTradeSeat(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
{
|
||||
@@ -1154,7 +1155,8 @@ void nullsub_37(void)
|
||||
|
||||
}
|
||||
|
||||
void sub_80B3968(void)
|
||||
// Note: VAR_0x8005 is set to the ID of the player spot.
|
||||
void ColosseumPlayerSpotTriggered(void)
|
||||
{
|
||||
gLinkType = 0x2211;
|
||||
|
||||
@@ -1168,6 +1170,7 @@ void sub_80B3968(void)
|
||||
}
|
||||
}
|
||||
|
||||
// This function is never called.
|
||||
static void sub_80B39A4(void)
|
||||
{
|
||||
u8 taskId = CreateTask(sub_80B3728, 80);
|
||||
@@ -1179,14 +1182,16 @@ void sp02A_crash_sound(void)
|
||||
ShowTrainerCardInLink(gSpecialVar_0x8006, CB2_ReturnToFieldContinueScriptPlayMapMusic);
|
||||
}
|
||||
|
||||
bool32 sub_80B39D4(u8 linkPlayerIndex)
|
||||
// Returns FALSE if the player has no stars. Returns TRUE otherwise, and puts the name of the
|
||||
// color into gStringVar2.
|
||||
bool32 GetLinkTrainerCardColor(u8 linkPlayerIndex)
|
||||
{
|
||||
u32 trainerCardColorIndex;
|
||||
|
||||
gSpecialVar_0x8006 = linkPlayerIndex;
|
||||
StringCopy(gStringVar1, gLinkPlayers[linkPlayerIndex].name);
|
||||
|
||||
trainerCardColorIndex = sub_80C4904(linkPlayerIndex);
|
||||
trainerCardColorIndex = GetTrainerCardStars(linkPlayerIndex);
|
||||
if (trainerCardColorIndex == 0)
|
||||
return FALSE;
|
||||
|
||||
@@ -1265,13 +1270,13 @@ void sub_80B3AF8(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (GetLinkPlayerCount_2() >= sub_800AA48())
|
||||
if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
|
||||
{
|
||||
if (IsLinkMaster())
|
||||
{
|
||||
if (++data[1] > 30)
|
||||
{
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
data[0]++;
|
||||
}
|
||||
}
|
||||
|
||||
+9
-9
@@ -1158,7 +1158,7 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
|
||||
u16 i;
|
||||
u16 j;
|
||||
u16 behavior;
|
||||
u16 flags;
|
||||
u16 impassableFlag;
|
||||
u16 v0;
|
||||
u16 v1;
|
||||
s16 decLeft;
|
||||
@@ -1173,11 +1173,11 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
|
||||
behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decor].tiles[i * decWidth + j]);
|
||||
if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decor].permission != DECORPERM_PASS_FLOOR && (behavior >> 12)))
|
||||
{
|
||||
flags = 0xc00;
|
||||
impassableFlag = METATILE_COLLISION_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = 0x000;
|
||||
impassableFlag = 0x000;
|
||||
}
|
||||
if (gDecorations[decor].permission != DECORPERM_NA_WALL && MetatileBehavior_IsSecretBaseNorthWall(MapGridGetMetatileBehaviorAt(decLeft, decBottom)) == TRUE)
|
||||
{
|
||||
@@ -1190,11 +1190,11 @@ void sub_8127B90(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight, u16 decor)
|
||||
v1 = sub_8127B54(gDecorations[decor].id, i * decWidth + j);
|
||||
if (v1 != 0xFFFF)
|
||||
{
|
||||
MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags | v1);
|
||||
MapGridSetMetatileEntryAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag | v1);
|
||||
}
|
||||
else
|
||||
{
|
||||
MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | flags);
|
||||
MapGridSetMetatileIdAt(decLeft, decBottom, (gDecorations[decor].tiles[i * decWidth + j] + (0x200 | v0)) | impassableFlag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1254,7 +1254,7 @@ void sub_8127E18(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
VarSet(VAR_0x3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]);
|
||||
VarSet(UNKNOWN_VAR_OFFSET_3F20 + gMapHeader.events->eventObjects[j].graphicsId, sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0]);
|
||||
gSpecialVar_0x8005 = gMapHeader.events->eventObjects[j].localId;
|
||||
gSpecialVar_0x8006 = sCurDecorMapX;
|
||||
gSpecialVar_0x8007 = sCurDecorMapY;
|
||||
@@ -1502,7 +1502,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
|
||||
{
|
||||
curX = gTasks[taskId].data[0] + j;
|
||||
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
|
||||
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
|
||||
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
|
||||
if (!sub_81284F4(behaviorAt, decoration))
|
||||
{
|
||||
return FALSE;
|
||||
@@ -1527,7 +1527,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
|
||||
{
|
||||
curX = gTasks[taskId].data[0] + j;
|
||||
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
|
||||
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & 0xf000;
|
||||
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
|
||||
if (!MetatileBehavior_IsNormal(behaviorAt) && !sub_8128484(behaviorAt, behaviorBy))
|
||||
{
|
||||
return FALSE;
|
||||
@@ -1547,7 +1547,7 @@ bool8 sub_812853C(u8 taskId, const struct Decoration *decoration)
|
||||
{
|
||||
curX = gTasks[taskId].data[0] + j;
|
||||
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
|
||||
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & 0xf000;
|
||||
behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & METATILE_ELEVATION_MASK;
|
||||
if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt))
|
||||
{
|
||||
return FALSE;
|
||||
|
||||
+852
-844
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -23,8 +23,8 @@ EWRAM_DATA u16 gSpecialVar_LastTalked = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_Facing = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_MonBoxId = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_MonBoxPos = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_0x8014 = 0;
|
||||
EWRAM_DATA static u8 gUnknown_020375FC[16] = {0};
|
||||
EWRAM_DATA u16 gSpecialVar_Unused_0x8014 = 0;
|
||||
EWRAM_DATA static u8 gSpecialFlags[16] = {0};
|
||||
|
||||
extern u16 *const gSpecialVars[];
|
||||
|
||||
@@ -32,7 +32,7 @@ void InitEventData(void)
|
||||
{
|
||||
memset(gSaveBlock1Ptr->flags, 0, sizeof(gSaveBlock1Ptr->flags));
|
||||
memset(gSaveBlock1Ptr->vars, 0, sizeof(gSaveBlock1Ptr->vars));
|
||||
memset(gUnknown_020375FC, 0, sizeof(gUnknown_020375FC));
|
||||
memset(gSpecialFlags, 0, sizeof(gSpecialFlags));
|
||||
}
|
||||
|
||||
void ClearTempFieldEventData(void)
|
||||
@@ -131,13 +131,13 @@ void sub_809D4D8(void)
|
||||
void sub_809D570(void)
|
||||
{
|
||||
VarSet(VAR_EVENT_PICHU_SLOT, 0);
|
||||
VarSet(VAR_0x40DE, 0);
|
||||
VarSet(VAR_0x40DF, 0);
|
||||
VarSet(VAR_0x40E0, 0);
|
||||
VarSet(VAR_0x40E1, 0);
|
||||
VarSet(VAR_0x40E2, 0);
|
||||
VarSet(VAR_0x40E3, 0);
|
||||
VarSet(VAR_0x40E4, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40DE, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40DF, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40E0, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40E1, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40E2, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40E3, 0);
|
||||
VarSet(VAR_NEVER_READ_0x40E4, 0);
|
||||
}
|
||||
|
||||
void DisableResetRTC(void)
|
||||
@@ -199,7 +199,7 @@ u8 *GetFlagPointer(u16 id)
|
||||
else if (id < SPECIAL_FLAGS_START)
|
||||
return &gSaveBlock1Ptr->flags[id / 8];
|
||||
else
|
||||
return &gUnknown_020375FC[(id - SPECIAL_FLAGS_START) / 8];
|
||||
return &gSpecialFlags[(id - SPECIAL_FLAGS_START) / 8];
|
||||
}
|
||||
|
||||
u8 FlagSet(u16 id)
|
||||
|
||||
@@ -557,9 +557,9 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
|
||||
ScriptContext1_SetupScript(EventScript_EggHatch);
|
||||
return TRUE;
|
||||
}
|
||||
if (sub_813B3B0() == TRUE)
|
||||
if (UnusualWeatherHasExpired() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(gUnknown_08273D1F);
|
||||
ScriptContext1_SetupScript(UnusualWeather_EventScript_EndEventAndCleanup_1);
|
||||
return TRUE;
|
||||
}
|
||||
if (ShouldDoBrailleRegicePuzzle() == TRUE)
|
||||
@@ -567,27 +567,27 @@ static bool8 TryStartStepCountScript(u16 metatileBehavior)
|
||||
ScriptContext1_SetupScript(IslandCave_EventScript_238EAF);
|
||||
return TRUE;
|
||||
}
|
||||
if (is_tile_that_overrides_player_control() == TRUE)
|
||||
if (ShouldDoWallyCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(MauvilleCity_EventScript_1DF7BA);
|
||||
return TRUE;
|
||||
}
|
||||
if (sub_8138120() == TRUE)
|
||||
if (ShouldDoWinonaCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(Route119_EventScript_1F49EC);
|
||||
return TRUE;
|
||||
}
|
||||
if (sub_8138168() == TRUE)
|
||||
if (ShouldDoScottCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(LittlerootTown_ProfessorBirchsLab_EventScript_1FA4D6);
|
||||
return TRUE;
|
||||
}
|
||||
if (sub_81381B0() == TRUE)
|
||||
if (ShouldDoRoxanneCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(RustboroCity_Gym_EventScript_21307B);
|
||||
return TRUE;
|
||||
}
|
||||
if (sub_81381F8() == TRUE)
|
||||
if (ShouldDoRivalRayquazaCall() == TRUE)
|
||||
{
|
||||
ScriptContext1_SetupScript(MossdeepCity_SpaceCenter_2F_EventScript_224175);
|
||||
return TRUE;
|
||||
|
||||
+2
-2
@@ -2443,7 +2443,7 @@ static void sub_80B8410(struct Task *task)
|
||||
bool8 FldEff_FieldMoveShowMon(void)
|
||||
{
|
||||
u8 taskId;
|
||||
if (is_map_type_1_2_3_5_or_6(GetCurrentMapType()) == TRUE)
|
||||
if (IsMapTypeOutdoors(GetCurrentMapType()) == TRUE)
|
||||
{
|
||||
taskId = CreateTask(sub_80B8554, 0xff);
|
||||
} else
|
||||
@@ -2620,7 +2620,7 @@ static void sub_80B8874(u16 offs)
|
||||
dest = (u16 *)(VRAM + 0x140 + offs);
|
||||
for (i = 0; i < 0x140; i++, dest++)
|
||||
{
|
||||
*dest = gFieldMoveStreaksTilemap[i] | 0xf000;
|
||||
*dest = gFieldMoveStreaksTilemap[i] | METATILE_ELEVATION_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ void sub_80AF2B4(u8 taskId)
|
||||
break;
|
||||
case 2:
|
||||
sub_8009F18();
|
||||
sub_8086C2C();
|
||||
ResetAllMultiplayerState();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
@@ -621,7 +621,7 @@ void sub_80AF948(void)
|
||||
CreateTask(sub_80AF8E0, 10);
|
||||
}
|
||||
|
||||
static void sub_80AF96C(u8 taskId)
|
||||
static void Task_ReturnToWorldFromLinkRoom(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
@@ -654,7 +654,7 @@ static void sub_80AF96C(u8 taskId)
|
||||
|
||||
void sub_80AF9F8(void)
|
||||
{
|
||||
CreateTask(sub_80AF96C, 10);
|
||||
CreateTask(Task_ReturnToWorldFromLinkRoom, 10);
|
||||
}
|
||||
|
||||
static void sub_80AFA0C(u8 taskId)
|
||||
|
||||
+84
-47
@@ -360,17 +360,17 @@ u8 GetSSTidalLocation(s8 *mapGroup, s8 *mapNum, s16 *x, s16 *y)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool32 is_tile_that_overrides_player_control(void)
|
||||
bool32 ShouldDoWallyCall(void)
|
||||
{
|
||||
if (FlagGet(FLAG_ENABLE_FIRST_WALLY_POKENAV_CALL))
|
||||
{
|
||||
switch (gMapHeader.mapType)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
if (++(*GetVarPointer(VAR_0x40F2)) < 0xFA)
|
||||
case MAP_TYPE_TOWN:
|
||||
case MAP_TYPE_CITY:
|
||||
case MAP_TYPE_ROUTE:
|
||||
case MAP_TYPE_OCEAN_ROUTE:
|
||||
if (++(*GetVarPointer(VAR_WALLY_CALL_STEP_COUNTER)) < 250)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ bool32 is_tile_that_overrides_player_control(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_8138120(void)
|
||||
bool32 ShouldDoWinonaCall(void)
|
||||
{
|
||||
if (FlagGet(FLAG_REGISTER_WINONA_POKENAV))
|
||||
{
|
||||
@@ -396,8 +396,8 @@ bool32 sub_8138120(void)
|
||||
case MAP_TYPE_TOWN:
|
||||
case MAP_TYPE_CITY:
|
||||
case MAP_TYPE_ROUTE:
|
||||
case MAP_TYPE_6:
|
||||
if (++(*GetVarPointer(VAR_0x40F3)) < 10)
|
||||
case MAP_TYPE_OCEAN_ROUTE:
|
||||
if (++(*GetVarPointer(VAR_WINONA_CALL_STEP_COUNTER)) < 10)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -414,7 +414,7 @@ bool32 sub_8138120(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_8138168(void)
|
||||
bool32 ShouldDoScottCall(void)
|
||||
{
|
||||
if (FlagGet(FLAG_SCOTT_CALL_NATIONAL_DEX))
|
||||
{
|
||||
@@ -424,7 +424,7 @@ bool32 sub_8138168(void)
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
if (++(*GetVarPointer(VAR_0x40F5)) < 0xA)
|
||||
if (++(*GetVarPointer(VAR_SCOTT_CALL_STEP_COUNTER)) < 10)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ bool32 sub_8138168(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_81381B0(void)
|
||||
bool32 ShouldDoRoxanneCall(void)
|
||||
{
|
||||
if (FlagGet(FLAG_ENABLE_ROXANNE_FIRST_CALL))
|
||||
{
|
||||
@@ -451,7 +451,7 @@ bool32 sub_81381B0(void)
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
if (++(*GetVarPointer(VAR_0x40F4)) < 0xFA)
|
||||
if (++(*GetVarPointer(VAR_ROXANNE_CALL_STEP_COUNTER)) < 250)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ bool32 sub_81381B0(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 sub_81381F8(void)
|
||||
bool32 ShouldDoRivalRayquazaCall(void)
|
||||
{
|
||||
if (FlagGet(FLAG_DEFEATED_MAGMA_SPACE_CENTER))
|
||||
{
|
||||
@@ -478,7 +478,7 @@ bool32 sub_81381F8(void)
|
||||
case 2:
|
||||
case 3:
|
||||
case 6:
|
||||
if (++(*GetVarPointer(VAR_0x40F6)) < 0xFA)
|
||||
if (++(*GetVarPointer(VAR_RIVAL_RAYQUAZA_CALL_STEP_COUNTER)) < 250)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -887,8 +887,8 @@ static void PetalburgGymFunc(u8 a0, u16 a1)
|
||||
}
|
||||
for (i = 0; i < nDoors; i++)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | 0xc00);
|
||||
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | 0xc00);
|
||||
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 7, a1 | METATILE_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(x[i] + 7, y[i] + 8, (a1 + 8) | METATILE_COLLISION_MASK);
|
||||
}
|
||||
DrawWholeMapView();
|
||||
}
|
||||
@@ -1100,7 +1100,7 @@ static void PCTurnOnEffect_1(s16 flag, s8 dx, s8 dy)
|
||||
tileId = 0x27e;
|
||||
}
|
||||
}
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00);
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK);
|
||||
}
|
||||
|
||||
void DoPCTurnOffEffect(void)
|
||||
@@ -1141,7 +1141,7 @@ static void PCTurnOffEffect(void)
|
||||
{
|
||||
tileId = 0x259;
|
||||
}
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | 0xc00);
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + 7, gSaveBlock1Ptr->pos.y + dy + 7, tileId | METATILE_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
@@ -1516,7 +1516,7 @@ bool8 FoundBlackGlasses(void)
|
||||
|
||||
void SetRoute119Weather(void)
|
||||
{
|
||||
if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE)
|
||||
if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE)
|
||||
{
|
||||
SetSav1Weather(20);
|
||||
}
|
||||
@@ -1524,7 +1524,7 @@ void SetRoute119Weather(void)
|
||||
|
||||
void SetRoute123Weather(void)
|
||||
{
|
||||
if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()) != TRUE)
|
||||
if (IsMapTypeOutdoors(GetLastUsedWarpMapType()) != TRUE)
|
||||
{
|
||||
SetSav1Weather(21);
|
||||
}
|
||||
@@ -1892,7 +1892,7 @@ static void sub_8139C80(u8 taskId)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | 0xC00);
|
||||
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2BF4[y][data[0] % 3] | METATILE_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1902,7 +1902,7 @@ static void sub_8139C80(u8 taskId)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | 0xC00);
|
||||
MapGridSetMetatileIdAt(x + 8, y + 7, gUnknown_085B2C06[y][data[0] % 3] | METATILE_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3421,40 +3421,59 @@ bool8 sub_813B260(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_813B2E4(void)
|
||||
void CreateUnusualWeatherEvent(void)
|
||||
{
|
||||
u16 randomValue = Random();
|
||||
VarSet(VAR_0x4038, 0);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, 0);
|
||||
|
||||
if (FlagGet(FLAG_DEFEATED_KYOGRE) == TRUE)
|
||||
{
|
||||
VarSet(VAR_0x4037, (randomValue & 7) + 1);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
|
||||
}
|
||||
else if (FlagGet(FLAG_DEFEATED_GROUDON) == TRUE)
|
||||
{
|
||||
VarSet(VAR_0x4037, (randomValue & 7) + 9);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
|
||||
}
|
||||
else if ((randomValue & 1) == 0)
|
||||
{
|
||||
randomValue = Random();
|
||||
VarSet(VAR_0x4037, (randomValue & 7) + 1);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_GROUDON_LOCATIONS_START);
|
||||
}
|
||||
else
|
||||
{
|
||||
randomValue = Random();
|
||||
VarSet(VAR_0x4037, (randomValue & 7) + 9);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, (randomValue % UNUSUAL_WEATHER_COUNT_PER_LEGENDARY) + UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_813B374(void)
|
||||
// Saves the map name for the current unusual weather location in gStringVar1, then
|
||||
// returns TRUE if the weather is for Kyogre, and FALSE if it's for Groudon.
|
||||
bool32 GetUnusualWeatherMapNameAndType(void)
|
||||
{
|
||||
static const u8 gUnknown_085B3400[] = { 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 var = VarGet(VAR_0x4037);
|
||||
u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
|
||||
|
||||
GetMapName(gStringVar1, gUnknown_085B3400[var - 1], 0);
|
||||
GetMapName(gStringVar1, sUnusualWeatherMapNumbers[unusualWeather - 1], 0);
|
||||
|
||||
if (var < 9)
|
||||
if (unusualWeather < UNUSUAL_WEATHER_KYOGRE_LOCATIONS_START)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3464,21 +3483,39 @@ bool32 sub_813B374(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_813B3B0(void)
|
||||
bool8 UnusualWeatherHasExpired(void)
|
||||
{
|
||||
static const u8 gUnknown_085B3410[] = { 0x1d, 0x1d, 0x1e, 0x1e, 0x1f, 0x1f, 0x21, 0x21, 0x14, 0x14, 0x28, 0x28, 0x2a, 0x2a, 0x2c, 0x2c };
|
||||
// Duplicate array.
|
||||
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 var1 = VarGet(VAR_0x4038);
|
||||
u16 var2 = VarGet(VAR_0x4037);
|
||||
u16 steps = VarGet(VAR_UNUSUAL_WEATHER_STEP_COUNTER);
|
||||
u16 unusualWeather = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
|
||||
|
||||
if (!var2)
|
||||
if (unusualWeather == UNUSUAL_WEATHER_NONE)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (++var1 > 999)
|
||||
if (++steps > 999)
|
||||
{
|
||||
VarSet(VAR_0x4038, 0);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, 0);
|
||||
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(UNDERWATER_MARINE_CAVE))
|
||||
{
|
||||
switch (gSaveBlock1Ptr->location.mapNum)
|
||||
@@ -3488,7 +3525,7 @@ bool8 sub_813B3B0(void)
|
||||
case MAP_NUM(MARINE_CAVE_END):
|
||||
case MAP_NUM(TERRA_CAVE_ENTRANCE):
|
||||
case MAP_NUM(TERRA_CAVE_END):
|
||||
VarSet(VAR_0x4039, 1);
|
||||
VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 1);
|
||||
return FALSE;
|
||||
default:
|
||||
break;
|
||||
@@ -3503,27 +3540,27 @@ bool8 sub_813B3B0(void)
|
||||
case MAP_NUM(UNDERWATER5):
|
||||
case MAP_NUM(UNDERWATER6):
|
||||
case MAP_NUM(UNDERWATER7):
|
||||
VarSet(VAR_0x4039, 1);
|
||||
VarSet(VAR_SHOULD_END_UNUSUAL_WEATHER, 1);
|
||||
return FALSE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (gSaveBlock1Ptr->location.mapNum == gUnknown_085B3410[var2 - 1] &&
|
||||
if (gSaveBlock1Ptr->location.mapNum == sUnusualWeatherMapNumbers_2[unusualWeather - 1] &&
|
||||
gSaveBlock1Ptr->location.mapGroup == 0)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_0x4037, 0);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_LOCATION, UNUSUAL_WEATHER_NONE);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VarSet(VAR_0x4038, var1);
|
||||
VarSet(VAR_UNUSUAL_WEATHER_STEP_COUNTER, steps);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
@@ -3577,7 +3614,7 @@ bool32 sub_813B4E0(void)
|
||||
|
||||
bool32 sub_813B514(void)
|
||||
{
|
||||
if (!VarGet(VAR_0x403F))
|
||||
if (!VarGet(VAR_ALWAYS_ZERO_0x403F))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+20
-19
@@ -383,15 +383,15 @@ u8 MapGridGetZCoordAt(int x, int y)
|
||||
i = (x + 1) & 1;
|
||||
i += ((y + 1) & 1) * 2;
|
||||
block = gMapHeader.mapLayout->border[i];
|
||||
block |= 0xc00;
|
||||
block |= METATILE_COLLISION_MASK;
|
||||
}
|
||||
|
||||
if (block == 0x3ff)
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return block >> 12;
|
||||
return block >> METATILE_ELEVATION_SHIFT;
|
||||
}
|
||||
|
||||
u8 MapGridIsImpassableAt(int x, int y)
|
||||
@@ -411,13 +411,13 @@ u8 MapGridIsImpassableAt(int x, int y)
|
||||
i = (x + 1) & 1;
|
||||
i += ((y + 1) & 1) * 2;
|
||||
block = gMapHeader.mapLayout->border[i];
|
||||
block |= 0xc00;
|
||||
block |= METATILE_COLLISION_MASK;
|
||||
}
|
||||
if (block == 0x3ff)
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return (block & 0xc00) >> 10;
|
||||
return (block & METATILE_COLLISION_MASK) >> METATILE_COLLISION_SHIFT;
|
||||
}
|
||||
|
||||
u32 MapGridGetMetatileIdAt(int x, int y)
|
||||
@@ -439,18 +439,19 @@ u32 MapGridGetMetatileIdAt(int x, int y)
|
||||
mapLayout = gMapHeader.mapLayout;
|
||||
i = (x + 1) & 1;
|
||||
i += ((y + 1) & 1) * 2;
|
||||
block = mapLayout->border[i] | 0xc00;
|
||||
block = mapLayout->border[i] | METATILE_COLLISION_MASK;
|
||||
}
|
||||
if (block == 0x3ff)
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
{
|
||||
border = gMapHeader.mapLayout->border;
|
||||
j = (x + 1) & 1;
|
||||
j += ((y + 1) & 1) * 2;
|
||||
block2 = gMapHeader.mapLayout->border[j];
|
||||
block2 |= 0xc00;
|
||||
return block2 & block;
|
||||
// This OR is completely pointless.
|
||||
block2 |= METATILE_COLLISION_MASK;
|
||||
return block2 & METATILE_ID_MASK;
|
||||
}
|
||||
return block & 0x3ff;
|
||||
return block & METATILE_ID_MASK;
|
||||
}
|
||||
|
||||
u32 MapGridGetMetatileBehaviorAt(int x, int y)
|
||||
@@ -464,7 +465,7 @@ u8 MapGridGetMetatileLayerTypeAt(int x, int y)
|
||||
{
|
||||
u16 metatile;
|
||||
metatile = MapGridGetMetatileIdAt(x, y);
|
||||
return (GetBehaviorByMetatileId(metatile) & 0xf000) >> 12;
|
||||
return (GetBehaviorByMetatileId(metatile) & METATILE_ELEVATION_MASK) >> METATILE_ELEVATION_SHIFT;
|
||||
}
|
||||
|
||||
void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
|
||||
@@ -474,7 +475,7 @@ void MapGridSetMetatileIdAt(int x, int y, u16 metatile)
|
||||
&& y >= 0 && y < gBackupMapLayout.height)
|
||||
{
|
||||
i = x + y * gBackupMapLayout.width;
|
||||
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & 0xf000) | (metatile & 0xfff);
|
||||
gBackupMapLayout.map[i] = (gBackupMapLayout.map[i] & METATILE_ELEVATION_MASK) | (metatile & ~METATILE_ELEVATION_MASK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,7 +655,7 @@ int GetMapBorderIdAt(int x, int y)
|
||||
i = gBackupMapLayout.width;
|
||||
i *= y;
|
||||
block = gBackupMapLayout.map[x + i];
|
||||
if (block == 0x3ff)
|
||||
if (block == METATILE_ID_UNDEFINED)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
@@ -664,8 +665,8 @@ int GetMapBorderIdAt(int x, int y)
|
||||
mapLayout = gMapHeader.mapLayout;
|
||||
j = (x + 1) & 1;
|
||||
j += ((y + 1) & 1) * 2;
|
||||
block2 = 0xc00 | mapLayout->border[j];
|
||||
if (block2 == 0x3ff)
|
||||
block2 = METATILE_COLLISION_MASK | mapLayout->border[j];
|
||||
if (block2 == METATILE_ID_UNDEFINED)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
@@ -921,9 +922,9 @@ void sub_8088B94(int x, int y, int a2)
|
||||
if (x >= 0 && x < gBackupMapLayout.width && y >= 0 && y < gBackupMapLayout.height)
|
||||
{
|
||||
if (a2 != 0)
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= 0xC00;
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] |= METATILE_COLLISION_MASK;
|
||||
else
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= 0xF3FF;
|
||||
gBackupMapLayout.map[x + gBackupMapLayout.width * y] &= ~METATILE_COLLISION_MASK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,7 +938,7 @@ static bool8 SkipCopyingMetatileFromSavedMap(u16* mapMetatilePtr, u16 mapWidth,
|
||||
else
|
||||
mapMetatilePtr += mapWidth;
|
||||
|
||||
if (sub_80FADE4(*mapMetatilePtr & 0x3FF, yMode) == 1)
|
||||
if (sub_80FADE4(*mapMetatilePtr & METATILE_ID_MASK, yMode) == 1)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
static EWRAM_DATA u8 sEscalatorAnim_TaskId = 0;
|
||||
|
||||
static void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
|
||||
static void sub_80E12E8(u8 taskId, const s16 *list, u16 isImpassableFlag)
|
||||
{
|
||||
s16 r5 = gTasks[taskId].data[4] - 1;
|
||||
s16 r3 = gTasks[taskId].data[5] - 1;
|
||||
@@ -26,9 +26,9 @@ static void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
|
||||
if (list[r4] == metatileId)
|
||||
{
|
||||
if (r4 != 2)
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[r4 + 1]);
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[r4 + 1]);
|
||||
else
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[0]);
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,9 +44,9 @@ static void sub_80E12E8(u8 taskId, const s16 *list, u16 c)
|
||||
if (list[2 - r4] == metatileId)
|
||||
{
|
||||
if (r4 != 2)
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[1 - r4]);
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[1 - r4]);
|
||||
else
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, c | list[2]);
|
||||
MapGridSetMetatileIdAt(r5 + x, r3 + y, isImpassableFlag | list[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -76,13 +76,13 @@ static void sub_80E1444(u8 taskId)
|
||||
sub_80E12E8(taskId, gUnknown_08589AC0, 0);
|
||||
break;
|
||||
case 2:
|
||||
sub_80E12E8(taskId, gUnknown_08589AC6, 0xC00);
|
||||
sub_80E12E8(taskId, gUnknown_08589AC6, METATILE_COLLISION_MASK);
|
||||
break;
|
||||
case 3:
|
||||
sub_80E12E8(taskId, gUnknown_08589ACC, 0);
|
||||
break;
|
||||
case 4:
|
||||
sub_80E12E8(taskId, gUnknown_08589AD2, 0xC00);
|
||||
sub_80E12E8(taskId, gUnknown_08589AD2, METATILE_COLLISION_MASK);
|
||||
break;
|
||||
case 5:
|
||||
sub_80E12E8(taskId, gUnknown_08589AD8, 0);
|
||||
|
||||
+5
-5
@@ -1126,7 +1126,7 @@ void GetShieldToyTVDecorationInfo(void)
|
||||
if (!VarGet(VAR_CURRENT_SECRET_BASE))
|
||||
return;
|
||||
|
||||
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x10);
|
||||
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x10);
|
||||
break;
|
||||
case 734:
|
||||
ConvertIntToDecimalStringN(gStringVar1, 50, STR_CONV_MODE_LEFT_ALIGN, 2);
|
||||
@@ -1137,7 +1137,7 @@ void GetShieldToyTVDecorationInfo(void)
|
||||
if (!VarGet(VAR_CURRENT_SECRET_BASE))
|
||||
return;
|
||||
|
||||
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x20);
|
||||
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x20);
|
||||
break;
|
||||
case 756:
|
||||
gSpecialVar_Result = 1;
|
||||
@@ -1145,7 +1145,7 @@ void GetShieldToyTVDecorationInfo(void)
|
||||
if (!VarGet(VAR_CURRENT_SECRET_BASE))
|
||||
return;
|
||||
|
||||
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80);
|
||||
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80);
|
||||
break;
|
||||
case 757:
|
||||
gSpecialVar_Result = 2;
|
||||
@@ -1153,7 +1153,7 @@ void GetShieldToyTVDecorationInfo(void)
|
||||
if (!VarGet(VAR_CURRENT_SECRET_BASE))
|
||||
return;
|
||||
|
||||
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80);
|
||||
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80);
|
||||
break;
|
||||
case 758:
|
||||
gSpecialVar_Result = 3;
|
||||
@@ -1161,7 +1161,7 @@ void GetShieldToyTVDecorationInfo(void)
|
||||
if (!VarGet(VAR_CURRENT_SECRET_BASE))
|
||||
return;
|
||||
|
||||
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x80);
|
||||
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x80);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -539,8 +539,8 @@ bool8 RemoveBagItem(u16 itemId, u16 count)
|
||||
|
||||
if (CurrentMapIsSecretBase() == TRUE)
|
||||
{
|
||||
VarSet(VAR_0x40EE, VarGet(VAR_0x40EE) | 0x200);
|
||||
VarSet(VAR_0x40ED, itemId);
|
||||
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | 0x200);
|
||||
VarSet(VAR_SECRET_BASE_LAST_ITEM_USED, itemId);
|
||||
}
|
||||
|
||||
var = GetItemListPosition(pocket);
|
||||
|
||||
+1
-1
@@ -8,6 +8,7 @@
|
||||
#include "bg.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
#include "data2.h"
|
||||
#include "decompress.h"
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
@@ -446,7 +447,6 @@ EWRAM_DATA u16 gSpecialVar_ItemId = 0;
|
||||
static EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
|
||||
|
||||
extern u8 *const gPocketNamesStringsTable[];
|
||||
extern const u8 gMoveNames[][0xD];
|
||||
extern u8* gReturnToXStringsTable[];
|
||||
extern const u8 EventScript_2736B3[];
|
||||
extern const u16 gUnknown_0860F074[];
|
||||
|
||||
+3
-3
@@ -695,7 +695,7 @@ u8 sub_818E2D8(void)
|
||||
|
||||
void sub_818E2FC(void)
|
||||
{
|
||||
easy_chat_input_maybe();
|
||||
ShowEasyChatScreen();
|
||||
}
|
||||
|
||||
bool8 sub_818E308(void)
|
||||
@@ -763,8 +763,8 @@ void sub_818E430(void)
|
||||
|
||||
void sub_818E47C(void)
|
||||
{
|
||||
gSpecialVar_0x8004 = 0x11;
|
||||
easy_chat_input_maybe();
|
||||
gSpecialVar_0x8004 = EASY_CHAT_TYPE_QUIZ_SET_QUESTION;
|
||||
ShowEasyChatScreen();
|
||||
}
|
||||
|
||||
void sub_818E490(void)
|
||||
|
||||
+15
-13
@@ -28,7 +28,7 @@
|
||||
#include "link.h"
|
||||
#include "link_rfu.h"
|
||||
|
||||
extern u16 gUnknown_03005DA8;
|
||||
extern u16 gHeldKeyCodeToSend;
|
||||
|
||||
// Static type declarations
|
||||
|
||||
@@ -302,9 +302,9 @@ void LinkTestScreen(void)
|
||||
SetMainCallback2(CB2_LinkTest);
|
||||
}
|
||||
|
||||
void sub_8009628(u8 a0)
|
||||
void SetLocalLinkPlayerId(u8 playerId)
|
||||
{
|
||||
gLocalLinkPlayer.id = a0;
|
||||
gLocalLinkPlayer.id = playerId;
|
||||
}
|
||||
|
||||
static void InitLocalLinkPlayer(void)
|
||||
@@ -695,12 +695,12 @@ static void BuildSendCmd(u16 command)
|
||||
gSendCmd[0] = LINKCMD_0x5566;
|
||||
break;
|
||||
case LINKCMD_SEND_HELD_KEYS_2:
|
||||
if (gUnknown_03005DA8 == 0 || gLinkTransferringData)
|
||||
if (gHeldKeyCodeToSend == 0 || gLinkTransferringData)
|
||||
{
|
||||
break;
|
||||
}
|
||||
gSendCmd[0] = LINKCMD_SEND_HELD_KEYS_2;
|
||||
gSendCmd[1] = gUnknown_03005DA8;
|
||||
gSendCmd[1] = gHeldKeyCodeToSend;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -714,11 +714,11 @@ void sub_8009F18(void)
|
||||
gLinkCallback = sub_8009F70;
|
||||
}
|
||||
|
||||
bool32 sub_8009F3C(void)
|
||||
bool32 IsSendingKeysToLink(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
return sub_800F7E4();
|
||||
return IsSendingKeysToRfu();
|
||||
}
|
||||
if (gLinkCallback == sub_8009F70)
|
||||
{
|
||||
@@ -1142,7 +1142,7 @@ void ResetBlockReceivedFlag(u8 who)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800A620(void)
|
||||
void CheckShouldAdvanceLinkState(void)
|
||||
{
|
||||
if ((gLinkStatus & LINK_STAT_MASTER) && EXTRACT_PLAYER_COUNT(gLinkStatus) > 1)
|
||||
{
|
||||
@@ -1327,7 +1327,9 @@ void sub_800AA04(u8 a0)
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_800AA48(void)
|
||||
// The number of players when trading began. This is frequently compared against the
|
||||
// current number of connected players to check if anyone dropped out.
|
||||
u8 GetSavedPlayerCount(void)
|
||||
{
|
||||
return gSavedLinkPlayerCount;
|
||||
}
|
||||
@@ -1849,7 +1851,7 @@ bool8 HandleLinkConnection(void)
|
||||
r5 = sub_8010F1C();
|
||||
if (sub_808766C() == TRUE)
|
||||
{
|
||||
if (r4 == TRUE || sub_800F0B8() || r5)
|
||||
if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1882,18 +1884,18 @@ void sub_800B4C0(void)
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_800B4DC(void)
|
||||
u32 GetLinkRecvQueueLength(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
{
|
||||
return sub_80124D4();
|
||||
return GetRfuRecvQueueLength();
|
||||
}
|
||||
return gLink.recvQueue.count;
|
||||
}
|
||||
|
||||
bool8 sub_800B504(void)
|
||||
{
|
||||
if (sub_800B4DC() > 2)
|
||||
if (GetLinkRecvQueueLength() > 2)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
+12
-10
@@ -18,7 +18,7 @@
|
||||
#include "constants/species.h"
|
||||
#include "save.h"
|
||||
|
||||
extern u16 gUnknown_03005DA8;
|
||||
extern u16 gHeldKeyCodeToSend;
|
||||
extern void nullsub_89(u8 taskId);
|
||||
|
||||
struct UnkRfuStruct_1 gUnknown_03004140;
|
||||
@@ -2991,7 +2991,7 @@ static void sub_800F048(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_800F0B8(void)
|
||||
bool32 IsRfuRecvQueueEmpty(void)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
@@ -3212,7 +3212,7 @@ bool32 sub_800F4F0(void)
|
||||
for (i = 0; i < CMD_LENGTH - 1; i++)
|
||||
gSendCmd[i] = 0;
|
||||
}
|
||||
return sub_800F0B8();
|
||||
return IsRfuRecvQueueEmpty();
|
||||
}
|
||||
|
||||
void sub_800F638(u8 unused, u32 flags)
|
||||
@@ -3272,10 +3272,12 @@ u8 sub_800F74C(const u8 *a0)
|
||||
|
||||
void rfu_func_080F97B8(void)
|
||||
{
|
||||
if (gReceivedRemoteLinkPlayers && gUnknown_03005DA8 && gLinkTransferringData != 1)
|
||||
if (gReceivedRemoteLinkPlayers
|
||||
&& gHeldKeyCodeToSend != LINK_KEY_CODE_NULL
|
||||
&& gLinkTransferringData != TRUE)
|
||||
{
|
||||
gUnknown_03000D78[0]++;
|
||||
gUnknown_03005DA8 |= (gUnknown_03000D78[0] << 8);
|
||||
gHeldKeyCodeToSend |= (gUnknown_03000D78[0] << 8);
|
||||
sub_800FD14(0xbe00);
|
||||
}
|
||||
}
|
||||
@@ -3285,7 +3287,7 @@ struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void)
|
||||
return &gUnknown_02022B14;
|
||||
}
|
||||
|
||||
bool32 sub_800F7E4(void)
|
||||
bool32 IsSendingKeysToRfu(void)
|
||||
{
|
||||
return gUnknown_03005000.unk_00 == rfu_func_080F97B8;
|
||||
}
|
||||
@@ -3509,7 +3511,7 @@ void sub_800FD14(u16 command)
|
||||
gSendCmd[1 + i] = gUnknown_03005000.unk_f2[i];
|
||||
break;
|
||||
case 0xbe00:
|
||||
gSendCmd[1] = gUnknown_03005DA8;
|
||||
gSendCmd[1] = gHeldKeyCodeToSend;
|
||||
break;
|
||||
case 0xee00:
|
||||
break;
|
||||
@@ -3799,10 +3801,10 @@ bool32 sub_8010454(u32 a0)
|
||||
|
||||
u8 sub_801048C(bool32 a0)
|
||||
{
|
||||
if (a0 == 0)
|
||||
if (a0 == FALSE)
|
||||
return sub_800D550(0, 0);
|
||||
sub_800D550(1, 0x258);
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_80104B0(void)
|
||||
@@ -5163,7 +5165,7 @@ u32 sub_80124C0(void)
|
||||
return gUnknown_03005000.unk_9e8.unk_232;
|
||||
}
|
||||
|
||||
u32 sub_80124D4(void)
|
||||
u32 GetRfuRecvQueueLength(void)
|
||||
{
|
||||
return gUnknown_03005000.unk_124.unk_8c2;
|
||||
}
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ void MoveSaveBlocks_ResetHeap(void)
|
||||
hblankCB = gMain.hblankCallback;
|
||||
gMain.vblankCallback = NULL;
|
||||
gMain.hblankCallback = NULL;
|
||||
gUnknown_0203CF5C = NULL;
|
||||
gTrainerHillVBlankCounter = NULL;
|
||||
|
||||
saveBlock2Copy = (struct SaveBlock2 *)(gHeap);
|
||||
saveBlock1Copy = (struct SaveBlock1 *)(gHeap + sizeof(struct SaveBlock2));
|
||||
|
||||
@@ -27,7 +27,7 @@ void ResetLotteryCorner(void)
|
||||
u16 rand = Random();
|
||||
|
||||
SetLotteryNumber((Random() << 16) | rand);
|
||||
VarSet(VAR_POKELOT_PRIZE, 0);
|
||||
VarSet(VAR_POKELOT_PRIZE_ITEM, 0);
|
||||
}
|
||||
|
||||
void SetRandomLotteryNumber(u16 i)
|
||||
|
||||
+7
-7
@@ -163,7 +163,7 @@ static void UpdateLinkAndCallCallbacks(void)
|
||||
static void InitMainCallbacks(void)
|
||||
{
|
||||
gMain.vblankCounter1 = 0;
|
||||
gUnknown_0203CF5C = NULL;
|
||||
gTrainerHillVBlankCounter = NULL;
|
||||
gMain.vblankCounter2 = 0;
|
||||
gMain.callback1 = NULL;
|
||||
SetMainCallback2(CB2_InitCopyrightScreenAfterBootup);
|
||||
@@ -324,8 +324,8 @@ static void VBlankIntr(void)
|
||||
|
||||
gMain.vblankCounter1++;
|
||||
|
||||
if (gUnknown_0203CF5C && *gUnknown_0203CF5C < 0xFFFFFFFF)
|
||||
(*gUnknown_0203CF5C)++;
|
||||
if (gTrainerHillVBlankCounter && *gTrainerHillVBlankCounter < 0xFFFFFFFF)
|
||||
(*gTrainerHillVBlankCounter)++;
|
||||
|
||||
if (gMain.vblankCallback)
|
||||
gMain.vblankCallback();
|
||||
@@ -393,14 +393,14 @@ static void WaitForVBlank(void)
|
||||
;
|
||||
}
|
||||
|
||||
void sub_80008DC(u32 *var)
|
||||
void SetTrainerHillVBlankCounter(u32 *counter)
|
||||
{
|
||||
gUnknown_0203CF5C = var;
|
||||
gTrainerHillVBlankCounter = counter;
|
||||
}
|
||||
|
||||
void sub_80008E8(void)
|
||||
void ClearTrainerHillVBlankCounter(void)
|
||||
{
|
||||
gUnknown_0203CF5C = NULL;
|
||||
gTrainerHillVBlankCounter = NULL;
|
||||
}
|
||||
|
||||
void DoSoftReset(void)
|
||||
|
||||
+1
-1
@@ -1016,7 +1016,7 @@ static bool32 MapAllowsMatchCall(void)
|
||||
|
||||
if (gMapHeader.regionMapSectionId == MAPSEC_SOOTOPOLIS_CITY
|
||||
&& FlagGet(FLAG_HIDE_SOOTOPOLIS_CITY_RAYQUAZA) == TRUE
|
||||
&& FlagGet(FLAG_UNUSED_0x0DC) == FALSE)
|
||||
&& FlagGet(FLAG_NEVER_SET_0x0DC) == FALSE)
|
||||
return FALSE;
|
||||
|
||||
if (gMapHeader.regionMapSectionId == MAPSEC_MT_CHIMNEY
|
||||
|
||||
+2
-2
@@ -293,7 +293,7 @@ bool8 sub_8122148(u16 itemId)
|
||||
|
||||
bool8 itemid_80BF6D8_mail_related(u16 itemId)
|
||||
{
|
||||
if (is_c1_link_related_active() != TRUE && InUnionRoom() != TRUE)
|
||||
if (IsUpdateLinkStateCBActive() != TRUE && InUnionRoom() != TRUE)
|
||||
return TRUE;
|
||||
else if (ItemIsMail(itemId) != TRUE)
|
||||
return TRUE;
|
||||
@@ -303,7 +303,7 @@ bool8 itemid_80BF6D8_mail_related(u16 itemId)
|
||||
|
||||
bool8 sub_81221AC(void)
|
||||
{
|
||||
if (is_c1_link_related_active() == TRUE || gReceivedRemoteLinkPlayers == 1)
|
||||
if (IsUpdateLinkStateCBActive() == TRUE || gReceivedRemoteLinkPlayers == 1)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
+1
-1
@@ -317,7 +317,7 @@ void SetMirageTowerVisibility(void)
|
||||
u16 rand;
|
||||
bool8 visible;
|
||||
|
||||
if (VarGet(VAR_0x40CB))
|
||||
if (VarGet(VAR_ROUTE_111_STATE))
|
||||
{
|
||||
FlagClear(FLAG_MIRAGE_TOWER_VISIBLE);
|
||||
return;
|
||||
|
||||
@@ -179,7 +179,7 @@ static void CB2_MysteryEventMenu(void)
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
DrawStdFrameWithCustomTileAndPalette(1, 1, 1, 0xD);
|
||||
PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0);
|
||||
PutWindowTilemap(1);
|
||||
|
||||
+528
-447
File diff suppressed because it is too large
Load Diff
+12
-3
@@ -63,6 +63,7 @@
|
||||
#include "window.h"
|
||||
#include "constants/battle.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/easy_chat.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/items.h"
|
||||
@@ -4212,7 +4213,11 @@ static void sub_81B452C(void)
|
||||
{
|
||||
u8 mail = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL);
|
||||
|
||||
sub_811A20C(4, gSaveBlock1Ptr->mail[mail].words, sub_81B4578, 3);
|
||||
DoEasyChatScreen(
|
||||
EASY_CHAT_TYPE_MAIL,
|
||||
gSaveBlock1Ptr->mail[mail].words,
|
||||
sub_81B4578,
|
||||
EASY_CHAT_PERSON_DISPLAY_NONE);
|
||||
}
|
||||
|
||||
static void sub_81B4578(void)
|
||||
@@ -6386,7 +6391,11 @@ static void sub_81B814C(void)
|
||||
|
||||
sub_81B1DB8(&gPlayerParty[gUnknown_0203CEC8.unk9], gUnknown_0203CEC8.unkC);
|
||||
mail = GetMonData(&gPlayerParty[gUnknown_0203CEC8.unk9], MON_DATA_MAIL);
|
||||
sub_811A20C(4, gSaveBlock1Ptr->mail[mail].words, sub_81B81A8, 3);
|
||||
DoEasyChatScreen(
|
||||
EASY_CHAT_TYPE_MAIL,
|
||||
gSaveBlock1Ptr->mail[mail].words,
|
||||
sub_81B81A8,
|
||||
EASY_CHAT_PERSON_DISPLAY_NONE);
|
||||
}
|
||||
|
||||
static void sub_81B81A8(void)
|
||||
@@ -6514,7 +6523,7 @@ static void sub_81B8474(u8 taskId)
|
||||
gTasks[taskId].func = sub_81B8104;
|
||||
}
|
||||
|
||||
void sub_81B8518(u8 unused)
|
||||
void InitChooseHalfPartyForBattle(u8 unused)
|
||||
{
|
||||
sub_81B8558();
|
||||
InitPartyMenu(4, 0, 0, 0, 0, sub_81B1370, gMain.savedCallback);
|
||||
|
||||
+1
-1
@@ -388,7 +388,7 @@ u32 sub_81C7078(u32 (*func)(s32), u32 priority)
|
||||
{
|
||||
u16 taskId;
|
||||
|
||||
if (!is_c1_link_related_active())
|
||||
if (!IsUpdateLinkStateCBActive())
|
||||
taskId = CreateTask(sub_81C7170, priority);
|
||||
else
|
||||
taskId = CreateTask(sub_81C71E4, priority);
|
||||
|
||||
+29
-21
@@ -106,7 +106,7 @@ static EWRAM_DATA union PlayerRecords *sSentRecord = NULL;
|
||||
// Static ROM declarations
|
||||
|
||||
static void Task_RecordMixing_Main(u8 taskId);
|
||||
static void sub_80E7324(u8 taskId);
|
||||
static void Task_MixingRecordsRecv(u8 taskId);
|
||||
static void Task_SendPacket(u8 taskId);
|
||||
static void Task_CopyReceiveBuffer(u8 taskId);
|
||||
static void Task_SendPacket_SwitchToReceive(u8 taskId);
|
||||
@@ -120,7 +120,7 @@ static void ReceiveLilycoveLadyData(LilycoveLady *, size_t, u8);
|
||||
static void sub_80E7B2C(const u8 *);
|
||||
static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *, size_t, u8, TVShow *);
|
||||
static void ReceiveGiftItem(u16 *item, u8 which);
|
||||
static void sub_80E7FF8(u8 taskId);
|
||||
static void Task_DoRecordMixing(u8 taskId);
|
||||
static void sub_80E8110(struct Apprentice *arg0, struct Apprentice *arg1);
|
||||
static void ReceiveApprenticeData(struct Apprentice *arg0, size_t arg1, u32 arg2);
|
||||
static void ReceiveRankingHallRecords(struct PlayerHallRecords *hallRecords, size_t arg1, u32 arg2);
|
||||
@@ -170,7 +170,8 @@ static const u8 gUnknown_0858CFBE[3][4] =
|
||||
|
||||
#define BUFFER_CHUNK_SIZE 200
|
||||
|
||||
void sub_80E6BE8(void)
|
||||
// Note: VAR_0x8005 contains the spotId.
|
||||
void RecordMixingPlayerSpotTriggered(void)
|
||||
{
|
||||
sub_80B37D4(Task_RecordMixing_Main);
|
||||
}
|
||||
@@ -313,6 +314,7 @@ static void Task_RecordMixing_SoundEffect(u8 taskId)
|
||||
#define tState data[0]
|
||||
#define tSndEffTaskId data[15]
|
||||
|
||||
// Note: Currently, special var 8005 contains the player's spot id.
|
||||
static void Task_RecordMixing_Main(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
@@ -322,16 +324,16 @@ static void Task_RecordMixing_Main(u8 taskId)
|
||||
case 0: // init
|
||||
sSentRecord = malloc(sizeof(union PlayerRecords));
|
||||
sReceivedRecords = malloc(sizeof(union PlayerRecords) * 4);
|
||||
sub_8009628(gSpecialVar_0x8005);
|
||||
SetLocalLinkPlayerId(gSpecialVar_0x8005);
|
||||
VarSet(VAR_TEMP_0, 1);
|
||||
gUnknown_03001130 = FALSE;
|
||||
PrepareExchangePacket();
|
||||
CreateRecordMixingSprite();
|
||||
tState = 1;
|
||||
data[10] = CreateTask(sub_80E7324, 80);
|
||||
data[10] = CreateTask(Task_MixingRecordsRecv, 80);
|
||||
tSndEffTaskId = CreateTask(Task_RecordMixing_SoundEffect, 81);
|
||||
break;
|
||||
case 1: // wait for sub_80E7324
|
||||
case 1: // wait for Task_MixingRecordsRecv
|
||||
if (!gTasks[data[10]].isActive)
|
||||
{
|
||||
tState = 2;
|
||||
@@ -341,11 +343,11 @@ static void Task_RecordMixing_Main(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
data[10] = CreateTask(sub_80E7FF8, 10);
|
||||
data[10] = CreateTask(Task_DoRecordMixing, 10);
|
||||
tState = 3;
|
||||
PlaySE(SE_W226);
|
||||
break;
|
||||
case 3: // wait for sub_80E7FF8
|
||||
case 3: // wait for Task_DoRecordMixing
|
||||
if (!gTasks[data[10]].isActive)
|
||||
{
|
||||
tState = 4;
|
||||
@@ -381,7 +383,7 @@ static void Task_RecordMixing_Main(u8 taskId)
|
||||
#undef tState
|
||||
#undef tSndEffTaskId
|
||||
|
||||
static void sub_80E7324(u8 taskId)
|
||||
static void Task_MixingRecordsRecv(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
@@ -405,7 +407,7 @@ static void sub_80E7324(u8 taskId)
|
||||
u8 players = GetLinkPlayerCount_2();
|
||||
if (IsLinkMaster() == TRUE)
|
||||
{
|
||||
if (players == sub_800AA48())
|
||||
if (players == GetSavedPlayerCount())
|
||||
{
|
||||
PlaySE(SE_PIN);
|
||||
task->data[0] = 201;
|
||||
@@ -420,14 +422,15 @@ static void sub_80E7324(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 201:
|
||||
if (sub_800AA48() == GetLinkPlayerCount_2() && ++task->data[12] > (GetLinkPlayerCount_2() * 30))
|
||||
// We're the link master. Delay for 30 frames per connected player.
|
||||
if (GetSavedPlayerCount() == GetLinkPlayerCount_2() && ++task->data[12] > (GetLinkPlayerCount_2() * 30))
|
||||
{
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
task->data[0] = 1;
|
||||
}
|
||||
break;
|
||||
case 301:
|
||||
if (sub_800AA48() == GetLinkPlayerCount_2())
|
||||
if (GetSavedPlayerCount() == GetLinkPlayerCount_2())
|
||||
task->data[0] = 1;
|
||||
break;
|
||||
case 400: // wait 20 frames
|
||||
@@ -470,6 +473,7 @@ static void sub_80E7324(u8 taskId)
|
||||
StorePtrInTaskData(sReceivedRecords, (u16 *)&gTasks[subTaskId].data[5]);
|
||||
sRecordStructSize = sizeof(struct PlayerRecordsEmerald);
|
||||
}
|
||||
// Note: This task is destroyed by Task_CopyReceiveBuffer when it's done.
|
||||
}
|
||||
break;
|
||||
case 5: // wait 60 frames
|
||||
@@ -938,7 +942,7 @@ static void ReceiveGiftItem(u16 *item, u8 which)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80E7FF8(u8 taskId)
|
||||
static void Task_DoRecordMixing(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
|
||||
@@ -953,20 +957,22 @@ static void sub_80E7FF8(u8 taskId)
|
||||
else
|
||||
task->data[0] = 6;
|
||||
break;
|
||||
|
||||
// Mixing Ruby/Sapphire records.
|
||||
case 2:
|
||||
SetContinueGameWarpStatusToDynamicWarp();
|
||||
sub_8153430();
|
||||
FullSaveGame();
|
||||
task->data[0] ++;
|
||||
break;
|
||||
case 3:
|
||||
if (sub_8153474())
|
||||
if (CheckSaveFile())
|
||||
{
|
||||
ClearContinueGameWarpStatus2();
|
||||
task->data[0] = 4;
|
||||
task->data[1] = 0;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 4: // Wait 10 frames
|
||||
if (++task->data[1] > 10)
|
||||
{
|
||||
sub_800AC34();
|
||||
@@ -974,22 +980,24 @@ static void sub_80E7FF8(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (gReceivedRemoteLinkPlayers == 0)
|
||||
if (gReceivedRemoteLinkPlayers == FALSE)
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
|
||||
// Mixing Emerald records.
|
||||
case 6:
|
||||
if (!sub_801048C(0))
|
||||
if (!sub_801048C(FALSE))
|
||||
{
|
||||
CreateTask(sub_8153688, 5);
|
||||
task->data[0] ++;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
case 7: // wait for sub_8153688 to finish.
|
||||
if (!FuncIsActiveTask(sub_8153688))
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_801048C(1);
|
||||
sub_801048C(TRUE);
|
||||
task->data[0] = 8;
|
||||
}
|
||||
else
|
||||
|
||||
+4
-4
@@ -883,7 +883,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||
case MAP_TYPE_CITY:
|
||||
case MAP_TYPE_ROUTE:
|
||||
case MAP_TYPE_UNDERWATER:
|
||||
case MAP_TYPE_6:
|
||||
case MAP_TYPE_OCEAN_ROUTE:
|
||||
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
|
||||
gRegionMap->playerIsInCave = FALSE;
|
||||
mapWidth = gMapHeader.mapLayout->width;
|
||||
@@ -896,7 +896,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
|
||||
}
|
||||
break;
|
||||
case MAP_TYPE_UNDERGROUND:
|
||||
case MAP_TYPE_7:
|
||||
case MAP_TYPE_UNUSED_2:
|
||||
if (gMapHeader.flags & 0x02)
|
||||
{
|
||||
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum);
|
||||
@@ -1159,7 +1159,7 @@ static u16 RegionMap_GetTerraCaveMapSecId(void)
|
||||
{
|
||||
s16 idx;
|
||||
|
||||
idx = VarGet(VAR_0x4037) - 1;
|
||||
idx = VarGet(VAR_UNUSUAL_WEATHER_LOCATION) - 1;
|
||||
if (idx < 0 || idx > 15)
|
||||
{
|
||||
idx = 0;
|
||||
@@ -1171,7 +1171,7 @@ static void RegionMap_GetMarineCaveCoords(u16 *x, u16 *y)
|
||||
{
|
||||
u16 idx;
|
||||
|
||||
idx = VarGet(VAR_0x4037);
|
||||
idx = VarGet(VAR_UNUSUAL_WEATHER_LOCATION);
|
||||
if (idx < 9 || idx > 16)
|
||||
{
|
||||
idx = 9;
|
||||
|
||||
+3
-3
@@ -188,7 +188,7 @@ extern u8 gUnknown_02022C3E;
|
||||
extern u16 gUnknown_02022C3C;
|
||||
extern u8 gUnknown_02022C20[];
|
||||
extern u8 gFieldLinkPlayerCount;
|
||||
extern u8 gUnknown_03005DB4;
|
||||
extern u8 gLocalLinkPlayerId;
|
||||
|
||||
// IWRAM vars
|
||||
IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0;
|
||||
@@ -1641,7 +1641,7 @@ void sub_8014304(s8 mapGroup, s8 mapNum, s32 x, s32 y, u16 arg4)
|
||||
gSpecialVar_0x8004 = arg4;
|
||||
VarSet(VAR_CABLE_CLUB_STATE, arg4);
|
||||
gFieldLinkPlayerCount = GetLinkPlayerCount();
|
||||
gUnknown_03005DB4 = GetMultiplayerId();
|
||||
gLocalLinkPlayerId = GetMultiplayerId();
|
||||
SetCableClubWarp();
|
||||
SetWarpDestination(mapGroup, mapNum, -1, x, y);
|
||||
WarpIntoMap();
|
||||
@@ -1697,7 +1697,7 @@ void sub_801440C(u8 taskId)
|
||||
case 81:
|
||||
CleanupOverworldWindowsAndTilemaps();
|
||||
gMain.savedCallback = sub_801AC54;
|
||||
sub_81B8518(3);
|
||||
InitChooseHalfPartyForBattle(3);
|
||||
break;
|
||||
case 1:
|
||||
CleanupOverworldWindowsAndTilemaps();
|
||||
|
||||
+2
-2
@@ -996,7 +996,7 @@ static void sub_81405CC(void)
|
||||
taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0);
|
||||
gTasks[taskId].data[6] = 6;
|
||||
gTasks[taskId].data[13] = GetCoins();
|
||||
sub_80EDE84(GetCoins());
|
||||
AlertTVThatPlayerPlayedRoulette(GetCoins());
|
||||
gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1);
|
||||
SetMainCallback2(sub_8140238);
|
||||
return;
|
||||
@@ -1964,7 +1964,7 @@ static void sub_8141DE4(u8 taskId)
|
||||
gSpecialVar_0x8004 = TRUE;
|
||||
else
|
||||
gSpecialVar_0x8004 = FALSE;
|
||||
sub_80EDD78(GetCoins());
|
||||
AlertTVOfNewCoinTotal(GetCoins());
|
||||
BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0);
|
||||
gTasks[taskId].func = sub_8141E7C;
|
||||
}
|
||||
|
||||
+5
-5
@@ -659,10 +659,10 @@ static void UpdateSaveAddresses(void)
|
||||
u8 HandleSavingData(u8 saveType)
|
||||
{
|
||||
u8 i;
|
||||
u32 *backupVar = gUnknown_0203CF5C;
|
||||
u32 *backupVar = gTrainerHillVBlankCounter;
|
||||
u8 *tempAddr;
|
||||
|
||||
gUnknown_0203CF5C = NULL;
|
||||
gTrainerHillVBlankCounter = NULL;
|
||||
UpdateSaveAddresses();
|
||||
switch (saveType)
|
||||
{
|
||||
@@ -705,7 +705,7 @@ u8 HandleSavingData(u8 saveType)
|
||||
save_write_to_flash(0xFFFF, gRamSaveSectionLocations);
|
||||
break;
|
||||
}
|
||||
gUnknown_0203CF5C = backupVar;
|
||||
gTrainerHillVBlankCounter = backupVar;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -768,7 +768,7 @@ u8 sub_8153408(void) // trade.s save
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 sub_8153430(void)
|
||||
u8 FullSaveGame(void)
|
||||
{
|
||||
if (gFlashMemoryPresent != TRUE)
|
||||
return 1;
|
||||
@@ -780,7 +780,7 @@ u8 sub_8153430(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool8 sub_8153474(void)
|
||||
bool8 CheckSaveFile(void)
|
||||
{
|
||||
u8 retVal = FALSE;
|
||||
u16 val = ++gUnknown_03006208;
|
||||
|
||||
+6
-6
@@ -1203,7 +1203,7 @@ bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_lockall(struct ScriptContext *ctx)
|
||||
{
|
||||
if (is_c1_link_related_active())
|
||||
if (IsUpdateLinkStateCBActive())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1217,7 +1217,7 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_lock(struct ScriptContext *ctx)
|
||||
{
|
||||
if (is_c1_link_related_active())
|
||||
if (IsUpdateLinkStateCBActive())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2028,14 +2028,14 @@ bool8 ScrCmd_setmetatile(struct ScriptContext *ctx)
|
||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 tileId = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 v8 = VarGet(ScriptReadHalfword(ctx));
|
||||
u16 isImpassable = VarGet(ScriptReadHalfword(ctx));
|
||||
|
||||
x += 7;
|
||||
y += 7;
|
||||
if (!v8)
|
||||
if (!isImpassable)
|
||||
MapGridSetMetatileIdAt(x, y, tileId);
|
||||
else
|
||||
MapGridSetMetatileIdAt(x, y, tileId | 0xC00);
|
||||
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2182,7 +2182,7 @@ bool8 ScrCmd_cmdD8(struct ScriptContext *ctx)
|
||||
|
||||
bool8 ScrCmd_cmdD9(struct ScriptContext *ctx)
|
||||
{
|
||||
if (is_c1_link_related_active())
|
||||
if (IsUpdateLinkStateCBActive())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "constants/items.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/vars.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
|
||||
extern const u16 gEventObjectPalette8[];
|
||||
extern const u16 gEventObjectPalette17[];
|
||||
@@ -40,7 +41,7 @@ static const u8 gUnknown_0858D8EC[] = { 3, 4, 5, 14 };
|
||||
|
||||
static void sub_80F8EE8(u8 taskId);
|
||||
static void sub_80F9088(u8 taskId);
|
||||
static void sub_80F9460(void);
|
||||
static void CB2_ReturnFromChooseHalfParty(void);
|
||||
static void sub_80F94B8(void);
|
||||
|
||||
void SetContestTrainerGfxIds(void)
|
||||
@@ -640,22 +641,24 @@ void ScriptSetMonMoveSlot(u8 monIndex, u16 move, u8 slot)
|
||||
SetMonMoveSlot(&gPlayerParty[monIndex], move, slot);
|
||||
}
|
||||
|
||||
void sub_80F9438(void)
|
||||
// Note: When control returns to the event script, gSpecialVar_Result will be
|
||||
// TRUE if the party selection was successful.
|
||||
void ChooseHalfPartyForBattle(void)
|
||||
{
|
||||
gMain.savedCallback = sub_80F9460;
|
||||
VarSet(VAR_FRONTIER_FACILITY, 9); // this isn't a valid frontier facility id (??)
|
||||
sub_81B8518(0);
|
||||
gMain.savedCallback = CB2_ReturnFromChooseHalfParty;
|
||||
VarSet(VAR_FRONTIER_FACILITY, FRONTIER_FACILITY_DOUBLE_COLOSSEUM);
|
||||
InitChooseHalfPartyForBattle(0);
|
||||
}
|
||||
|
||||
static void sub_80F9460(void)
|
||||
static void CB2_ReturnFromChooseHalfParty(void)
|
||||
{
|
||||
switch (gSelectedOrderFromParty[0])
|
||||
{
|
||||
case 0:
|
||||
gSpecialVar_Result = 0;
|
||||
gSpecialVar_Result = FALSE;
|
||||
break;
|
||||
default:
|
||||
gSpecialVar_Result = 1;
|
||||
gSpecialVar_Result = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -665,7 +668,7 @@ static void sub_80F9460(void)
|
||||
void sub_80F9490(void)
|
||||
{
|
||||
gMain.savedCallback = sub_80F94B8;
|
||||
sub_81B8518(gSpecialVar_0x8004 + 1);
|
||||
InitChooseHalfPartyForBattle(gSpecialVar_0x8004 + 1);
|
||||
}
|
||||
|
||||
static void sub_80F94B8(void)
|
||||
|
||||
+83
-83
@@ -60,7 +60,7 @@ struct SecretBaseRecordMixer {
|
||||
|
||||
// Static RAM declarations
|
||||
EWRAM_DATA u8 sCurSecretBaseId = 0;
|
||||
EWRAM_DATA u8 gUnknown_0203A01D = 0;
|
||||
EWRAM_DATA bool8 gInFriendSecretBase = FALSE;
|
||||
EWRAM_DATA struct SecretBaseListMenuBuffer *gUnknown_0203A020 = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
@@ -259,7 +259,7 @@ void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile)
|
||||
{
|
||||
for (x = 0; x < mapLayout->width; x ++)
|
||||
{
|
||||
if ((mapLayout->map[y * mapLayout->width + x] & 0x3ff) == tile)
|
||||
if ((mapLayout->map[y * mapLayout->width + x] & METATILE_ID_MASK) == tile)
|
||||
{
|
||||
*xPtr = x;
|
||||
*yPtr = y;
|
||||
@@ -282,7 +282,7 @@ void sub_80E8D4C(void)
|
||||
{
|
||||
if (gUnknown_0858CFCC[i].tile1 == tile)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | 0xC00);
|
||||
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | METATILE_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
return;
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void sub_80E8D4C(void)
|
||||
{
|
||||
if (gUnknown_0858CFCC[i].tile2 == tile)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | 0xC00);
|
||||
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile1 | METATILE_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
return;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ void sub_80E8EE0(struct MapEvents const *events)
|
||||
{
|
||||
if (gUnknown_0858CFCC[i].tile1 == tile_id)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | 0xc00);
|
||||
MapGridSetMetatileIdAt(x, y, gUnknown_0858CFCC[i].tile2 | METATILE_COLLISION_MASK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -407,7 +407,7 @@ void sub_80E9068(void)
|
||||
|
||||
bool8 sub_80E909C(void)
|
||||
{
|
||||
if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_0x4097) == 0)
|
||||
if (gMapHeader.mapType == MAP_TYPE_SECRET_BASE && VarGet(VAR_INIT_SECRET_BASE) == 0)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -434,7 +434,7 @@ void sub_80E9108(void)
|
||||
sub_80E8CB0(&x, &y, 0x220);
|
||||
x += 7;
|
||||
y += 7;
|
||||
MapGridSetMetatileIdAt(x, y, 0x220 | 0xC00);
|
||||
MapGridSetMetatileIdAt(x, y, 0x220 | METATILE_COLLISION_MASK);
|
||||
CurrentMapDrawMetatileAt(x, y);
|
||||
pal_fill_black();
|
||||
CreateTask(sub_80E90C8, 0);
|
||||
@@ -492,12 +492,12 @@ void sub_80E9238(u8 flagIn)
|
||||
if (curBaseId != 0)
|
||||
{
|
||||
sub_80E8CB0(&x, &y, 0x220);
|
||||
MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | 0xc00);
|
||||
MapGridSetMetatileIdAt(x + 7, y + 7, 0x221 | METATILE_COLLISION_MASK);
|
||||
}
|
||||
else if (flagIn == 1 && VarGet(VAR_0x4089) == 1)
|
||||
else if (flagIn == 1 && VarGet(VAR_SECRET_BASE_INITIALIZED) == 1)
|
||||
{
|
||||
sub_80E8CB0(&x, &y, 0x220);
|
||||
MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | 0xc00);
|
||||
MapGridSetMetatileIdAt(x + 7, y + 7, 0x20a | METATILE_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -552,7 +552,7 @@ void sub_80E933C(void)
|
||||
metatile = MapGridGetMetatileBehaviorAt(gSpecialVar_0x8006 + 7, gSpecialVar_0x8007 + 7);
|
||||
if (MetatileBehavior_IsSecretBaseLargeMatEdge(metatile) == TRUE || MetatileBehavior_IsLargeMatCenter(metatile) == TRUE)
|
||||
{
|
||||
gSpecialVar_Result = gMapHeader.events->eventObjects[objIdx].graphicsId + VAR_0x3F20;
|
||||
gSpecialVar_Result = gMapHeader.events->eventObjects[objIdx].graphicsId + UNKNOWN_VAR_OFFSET_3F20;
|
||||
VarSet(gSpecialVar_Result, gDecorations[roomDecor[decorIdx]].tiles[0]);
|
||||
gSpecialVar_Result = gMapHeader.events->eventObjects[objIdx].localId;
|
||||
FlagClear(gSpecialVar_0x8004 + 0xAE);
|
||||
@@ -791,7 +791,7 @@ void sub_80E9AD0(void)
|
||||
{
|
||||
if (gUnknown_0858CFCC[j].tile2 == tile)
|
||||
{
|
||||
MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | 0xc00);
|
||||
MapGridSetMetatileIdAt(events->bgEvents[i].x + 7, events->bgEvents[i].y + 7, gUnknown_0858CFCC[j].tile1 | METATILE_COLLISION_MASK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1186,11 +1186,11 @@ void SecretBasePerStepCallback(u8 taskId)
|
||||
case 0:
|
||||
if (VarGet(VAR_CURRENT_SECRET_BASE) != 0)
|
||||
{
|
||||
gUnknown_0203A01D = TRUE;
|
||||
gInFriendSecretBase = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203A01D = FALSE;
|
||||
gInFriendSecretBase = 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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 (gInFriendSecretBase == 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;
|
||||
gInFriendSecretBase = FALSE;
|
||||
}
|
||||
|
||||
void sub_80EB218(void)
|
||||
{
|
||||
if (VarGet(VAR_0x40F0) && gUnknown_0203A01D == TRUE && !CurrentMapIsSecretBase())
|
||||
if (VarGet(VAR_SECRET_BASE_IS_NOT_LOCAL) && gInFriendSecretBase == TRUE && !CurrentMapIsSecretBase())
|
||||
{
|
||||
VarSet(VAR_0x40F0, FALSE);
|
||||
gUnknown_0203A01D = FALSE;
|
||||
VarSet(VAR_SECRET_BASE_IS_NOT_LOCAL, FALSE);
|
||||
gInFriendSecretBase = 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;
|
||||
}
|
||||
|
||||
+1427
-1340
File diff suppressed because it is too large
Load Diff
+7
-7
@@ -84,7 +84,7 @@ EWRAM_DATA static bool8 sSavingComplete = FALSE;
|
||||
EWRAM_DATA static u8 sSaveInfoWindowId = 0;
|
||||
|
||||
// Extern variables.
|
||||
extern u8 gUnknown_03005DB4;
|
||||
extern u8 gLocalLinkPlayerId;
|
||||
|
||||
// Extern functions in not decompiled files.
|
||||
extern void sub_80AF688(void);
|
||||
@@ -244,7 +244,7 @@ static void BuildStartMenuActions(void)
|
||||
{
|
||||
sNumStartMenuActions = 0;
|
||||
|
||||
if (is_c1_link_related_active() == TRUE)
|
||||
if (IsUpdateLinkStateCBActive() == TRUE)
|
||||
{
|
||||
BuildLinkModeStartMenu();
|
||||
}
|
||||
@@ -547,7 +547,7 @@ void sub_809FA34(u8 taskId) // Referenced in field_screen.s and rom_8011DC0.s
|
||||
|
||||
void ShowStartMenu(void) // Called from overworld.c and field_control_avatar.s
|
||||
{
|
||||
if (!is_c1_link_related_active())
|
||||
if (!IsUpdateLinkStateCBActive())
|
||||
{
|
||||
FreezeEventObjects();
|
||||
sub_808B864();
|
||||
@@ -672,7 +672,7 @@ static bool8 StartMenuPlayerNameCallback(void)
|
||||
RemoveExtraStartMenuWindows();
|
||||
CleanupOverworldWindowsAndTilemaps();
|
||||
|
||||
if (is_c1_link_related_active() || InUnionRoom())
|
||||
if (IsUpdateLinkStateCBActive() || InUnionRoom())
|
||||
ShowPlayerTrainerCard(CB2_ReturnToFieldWithOpenMenu); // Display trainer card
|
||||
else if (FlagGet(FLAG_SYS_FRONTIER_PASS))
|
||||
ShowFrontierPass(CB2_ReturnToFieldWithOpenMenu); // Display frontier pass
|
||||
@@ -734,7 +734,7 @@ static bool8 StartMenuLinkModePlayerNameCallback(void)
|
||||
{
|
||||
PlayRainStoppingSoundEffect();
|
||||
CleanupOverworldWindowsAndTilemaps();
|
||||
ShowTrainerCardInLink(gUnknown_03005DB4, CB2_ReturnToFieldWithOpenMenu);
|
||||
ShowTrainerCardInLink(gLocalLinkPlayerId, CB2_ReturnToFieldWithOpenMenu);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1265,11 +1265,11 @@ static void sub_80A0550(u8 taskId)
|
||||
break;
|
||||
case 1:
|
||||
SetContinueGameWarpStatusToDynamicWarp();
|
||||
sub_8153430();
|
||||
FullSaveGame();
|
||||
*step = 2;
|
||||
break;
|
||||
case 2:
|
||||
if (sub_8153474())
|
||||
if (CheckSaveFile())
|
||||
{
|
||||
ClearContinueGameWarpStatus2();
|
||||
*step = 3;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "task.h"
|
||||
|
||||
#define HEAD_SENTINEL 0xFE
|
||||
#define TAIL_SENTINEL 0xFF
|
||||
|
||||
struct Task gTasks[NUM_TASKS];
|
||||
|
||||
static void InsertTask(u8 newTaskId);
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ void UpdateShoalTideFlag(void)
|
||||
1, // 23
|
||||
};
|
||||
|
||||
if (is_map_type_1_2_3_5_or_6(GetLastUsedWarpMapType()))
|
||||
if (IsMapTypeOutdoors(GetLastUsedWarpMapType()))
|
||||
{
|
||||
RtcCalcLocalTime();
|
||||
if (tide[gLocalTime.hours])
|
||||
|
||||
+6
-6
@@ -1507,13 +1507,13 @@ static void sub_80773D0(void)
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (GetLinkPlayerCount_2() >= sub_800AA48())
|
||||
if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
|
||||
{
|
||||
if (IsLinkMaster())
|
||||
{
|
||||
if (++gUnknown_0203229C->unk_A8 > 30)
|
||||
{
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
gMain.state++;
|
||||
}
|
||||
}
|
||||
@@ -2762,7 +2762,7 @@ static void sub_80794CC(void)
|
||||
Free(gUnknown_0203229C);
|
||||
FreeAllWindowBuffers();
|
||||
sub_800E084();
|
||||
SetMainCallback2(c2_8056854);
|
||||
SetMainCallback2(CB2_ReturnToFieldFromMultiplayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2772,7 +2772,7 @@ static void sub_80794CC(void)
|
||||
Free(gUnknown_02032184);
|
||||
Free(gUnknown_0203229C);
|
||||
FreeAllWindowBuffers();
|
||||
SetMainCallback2(c2_8056854);
|
||||
SetMainCallback2(CB2_ReturnToFieldFromMultiplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4099,11 +4099,11 @@ void sub_807AE50(void)
|
||||
case 3:
|
||||
if (IsLinkMaster())
|
||||
{
|
||||
if (GetLinkPlayerCount_2() >= sub_800AA48())
|
||||
if (GetLinkPlayerCount_2() >= GetSavedPlayerCount())
|
||||
{
|
||||
if (++gUnknown_020322A0->timer > 30)
|
||||
{
|
||||
sub_800A620();
|
||||
CheckShouldAdvanceLinkState();
|
||||
gMain.state++;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -695,7 +695,7 @@ static void SetPlayerCardData(struct TrainerCard *trainerCard, u8 cardType)
|
||||
trainerCard->money = GetMoney(&gSaveBlock1Ptr->money);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
trainerCard->var_28[i] = gSaveBlock1Ptr->unk2BB0[i];
|
||||
trainerCard->var_28[i] = gSaveBlock1Ptr->easyChatProfile[i];
|
||||
|
||||
StringCopy(trainerCard->playerName, gSaveBlock2Ptr->playerName);
|
||||
|
||||
@@ -1536,7 +1536,7 @@ static void sub_80C48C8(void)
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_80C4904(u8 cardId)
|
||||
u8 GetTrainerCardStars(u8 cardId)
|
||||
{
|
||||
struct TrainerCard* trainerCards = gTrainerCards;
|
||||
return trainerCards[cardId].stars;
|
||||
|
||||
+45
-41
@@ -30,6 +30,7 @@
|
||||
#include "constants/species.h"
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/easy_chat.h"
|
||||
#include "constants/trainer_hill.h"
|
||||
|
||||
extern bool32 sub_81D3B34(void);
|
||||
|
||||
@@ -92,16 +93,16 @@ struct TrHillStruct2
|
||||
// EWRAM
|
||||
static EWRAM_DATA struct TrHillStruct2 *sHillData = NULL;
|
||||
static EWRAM_DATA struct TrHillRoomTrainers *sRoomTrainers = NULL;
|
||||
EWRAM_DATA u32 *gUnknown_0203CF5C = NULL;
|
||||
EWRAM_DATA u32 *gTrainerHillVBlankCounter = NULL;
|
||||
|
||||
// This file's functions.
|
||||
static void sub_81D581C(void);
|
||||
static void TrainerHillStartChallenge(void);
|
||||
static void sub_81D58D8(void);
|
||||
static void sub_81D5924(void);
|
||||
static void sub_81D59D0(void);
|
||||
static void sub_81D5A70(void);
|
||||
static void sub_81D5AB4(void);
|
||||
static void sub_81D5AD0(void);
|
||||
static void TrainerHillResumeTimer(void);
|
||||
static void TrainerHillSetPlayerLost(void);
|
||||
static void TrainerHillGetChallengeStatus(void);
|
||||
static void sub_81D5B2C(void);
|
||||
static void sub_81D5BBC(void);
|
||||
static void sub_81D5C00(void);
|
||||
@@ -112,7 +113,7 @@ static void sub_81D64DC(void);
|
||||
static void sub_81D64FC(void);
|
||||
static void sub_81D6518(void);
|
||||
static void sub_81D6568(void);
|
||||
static void sub_81D65A0(void);
|
||||
static void TrainerHillSetTag(void);
|
||||
static void SetUpDataStruct(void);
|
||||
static void FreeDataStruct(void);
|
||||
static void nullsub_2(void);
|
||||
@@ -263,13 +264,13 @@ static const u8 *const sFloorStrings[] =
|
||||
|
||||
static void (* const sHillFunctions[])(void) =
|
||||
{
|
||||
sub_81D581C,
|
||||
TrainerHillStartChallenge,
|
||||
sub_81D58D8,
|
||||
sub_81D5924,
|
||||
sub_81D59D0,
|
||||
sub_81D5A70,
|
||||
sub_81D5AB4,
|
||||
sub_81D5AD0,
|
||||
TrainerHillResumeTimer,
|
||||
TrainerHillSetPlayerLost,
|
||||
TrainerHillGetChallengeStatus,
|
||||
sub_81D5B2C,
|
||||
sub_81D5BBC,
|
||||
sub_81D5C00,
|
||||
@@ -280,7 +281,7 @@ static void (* const sHillFunctions[])(void) =
|
||||
sub_81D64FC,
|
||||
sub_81D6518,
|
||||
sub_81D6568,
|
||||
sub_81D65A0,
|
||||
TrainerHillSetTag,
|
||||
};
|
||||
|
||||
static const u8 *const sTagMatchStrings[] =
|
||||
@@ -318,7 +319,7 @@ void ResetTrainerHillResults(void)
|
||||
|
||||
gSaveBlock2Ptr->frontier.field_EF9_1 = 0;
|
||||
gSaveBlock2Ptr->frontier.field_EF9_0 = 0;
|
||||
gSaveBlock1Ptr->trainerHill.field_3D68 = 0;
|
||||
gSaveBlock1Ptr->trainerHill.bestTime = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
SetTimerValue(&gSaveBlock1Ptr->trainerHillTimes[i], HILL_MAX_TIME);
|
||||
}
|
||||
@@ -371,7 +372,7 @@ void InitTrainerHillBattleStruct(void)
|
||||
}
|
||||
sRoomTrainers->facilityClass[i] = sHillData->tag.floors[sHillData->floorId].trainers[i].facilityClass;
|
||||
}
|
||||
sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64);
|
||||
SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
|
||||
FreeDataStruct();
|
||||
}
|
||||
|
||||
@@ -425,7 +426,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId)
|
||||
FreeDataStruct();
|
||||
}
|
||||
|
||||
static void sub_81D581C(void)
|
||||
static void TrainerHillStartChallenge(void)
|
||||
{
|
||||
nullsub_2();
|
||||
if (!sub_81D3B34())
|
||||
@@ -434,11 +435,11 @@ static void sub_81D581C(void)
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0;
|
||||
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6C = 0;
|
||||
sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64);
|
||||
gSaveBlock1Ptr->trainerHill.field_3D64 = 0;
|
||||
SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
|
||||
gSaveBlock1Ptr->trainerHill.timer = 0;
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0c = 0;
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 0;
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0e = 0;
|
||||
gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0;
|
||||
gSaveBlock2Ptr->frontier.field_EE0 = 0;
|
||||
gBattleOutcome = 0;
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0a = 0;
|
||||
@@ -446,7 +447,7 @@ static void sub_81D581C(void)
|
||||
|
||||
static void sub_81D58D8(void)
|
||||
{
|
||||
sub_80008E8();
|
||||
ClearTrainerHillVBlankCounter();
|
||||
gSpecialVar_Result = 0;
|
||||
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
|
||||
gSpecialVar_Result++;
|
||||
@@ -483,10 +484,10 @@ static void sub_81D59D0(void)
|
||||
{
|
||||
gSpecialVar_Result = 2;
|
||||
}
|
||||
else if (GetTimerValue(&gSaveBlock1Ptr->trainerHill.field_3D68) > gSaveBlock1Ptr->trainerHill.field_3D64)
|
||||
else if (GetTimerValue(&gSaveBlock1Ptr->trainerHill.bestTime) > gSaveBlock1Ptr->trainerHill.timer)
|
||||
{
|
||||
SetTimerValue(&gSaveBlock1Ptr->trainerHill.field_3D68, gSaveBlock1Ptr->trainerHill.field_3D64);
|
||||
gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.tag] = gSaveBlock1Ptr->trainerHill.field_3D68;
|
||||
SetTimerValue(&gSaveBlock1Ptr->trainerHill.bestTime, gSaveBlock1Ptr->trainerHill.timer);
|
||||
gSaveBlock1Ptr->trainerHillTimes[gSaveBlock1Ptr->trainerHill.tag] = gSaveBlock1Ptr->trainerHill.bestTime;
|
||||
gSpecialVar_Result = 0;
|
||||
}
|
||||
else
|
||||
@@ -497,37 +498,40 @@ static void sub_81D59D0(void)
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0b = 1;
|
||||
}
|
||||
|
||||
static void sub_81D5A70(void)
|
||||
static void TrainerHillResumeTimer(void)
|
||||
{
|
||||
if (!gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
|
||||
{
|
||||
if (gSaveBlock1Ptr->trainerHill.field_3D64 >= HILL_MAX_TIME)
|
||||
gSaveBlock1Ptr->trainerHill.field_3D64 = HILL_MAX_TIME;
|
||||
if (gSaveBlock1Ptr->trainerHill.timer >= HILL_MAX_TIME)
|
||||
gSaveBlock1Ptr->trainerHill.timer = HILL_MAX_TIME;
|
||||
else
|
||||
sub_80008DC(&gSaveBlock1Ptr->trainerHill.field_3D64);
|
||||
SetTrainerHillVBlankCounter(&gSaveBlock1Ptr->trainerHill.timer);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81D5AB4(void)
|
||||
static void TrainerHillSetPlayerLost(void)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 1;
|
||||
gSaveBlock1Ptr->trainerHill.hasLost = 1;
|
||||
}
|
||||
|
||||
static void sub_81D5AD0(void)
|
||||
static void TrainerHillGetChallengeStatus(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d)
|
||||
if (gSaveBlock1Ptr->trainerHill.hasLost)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0d = 0;
|
||||
gSpecialVar_Result = 0;
|
||||
// The player lost their last match.
|
||||
gSaveBlock1Ptr->trainerHill.hasLost = 0;
|
||||
gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_LOST;
|
||||
}
|
||||
else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0e)
|
||||
else if (gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerHill.field_3D6E_0e = 0;
|
||||
gSpecialVar_Result = 1;
|
||||
// Unreachable code. Something relating to eCards?
|
||||
gSaveBlock1Ptr->trainerHill.maybeECardScanDuringChallenge = 0;
|
||||
gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_ECARD_SCANNED;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSpecialVar_Result = 2;
|
||||
// Continue playing.
|
||||
gSpecialVar_Result = TRAINER_HILL_PLAYER_STATUS_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -535,7 +539,7 @@ static void sub_81D5B2C(void)
|
||||
{
|
||||
s32 total, minutes, secondsWhole, secondsFraction;
|
||||
|
||||
total = gSaveBlock1Ptr->trainerHill.field_3D64;
|
||||
total = gSaveBlock1Ptr->trainerHill.timer;
|
||||
if (total >= HILL_MAX_TIME)
|
||||
total = HILL_MAX_TIME;
|
||||
|
||||
@@ -575,7 +579,7 @@ static void sub_81D5C00(void)
|
||||
|
||||
bool8 sub_81D5C18(void)
|
||||
{
|
||||
if (VarGet(VAR_0x40D6) == 0)
|
||||
if (VarGet(VAR_TRAINER_HILL_IS_ACTIVE) == 0)
|
||||
return FALSE;
|
||||
else if (gSaveBlock1Ptr->trainerHill.field_3D6E_0c)
|
||||
return FALSE;
|
||||
@@ -1048,16 +1052,16 @@ bool32 sub_81D6534(void)
|
||||
|
||||
static void sub_81D6568(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->trainerHill.field_3D6E_0d)
|
||||
if (gSaveBlock1Ptr->trainerHill.hasLost)
|
||||
gSpecialVar_Result = 0;
|
||||
else
|
||||
gSpecialVar_Result = 1;
|
||||
}
|
||||
|
||||
static void sub_81D65A0(void)
|
||||
static void TrainerHillSetTag(void)
|
||||
{
|
||||
gSaveBlock1Ptr->trainerHill.tag = gSpecialVar_0x8005;
|
||||
gSaveBlock1Ptr->trainerHill.field_3D68 = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
|
||||
gSaveBlock1Ptr->trainerHill.bestTime = gSaveBlock1Ptr->trainerHillTimes[gSpecialVar_0x8005];
|
||||
}
|
||||
|
||||
static u8 sub_81D65E8(u8 arg0)
|
||||
@@ -1103,7 +1107,7 @@ static u16 sub_81D6640(void)
|
||||
i = (i + 1) % 10;
|
||||
|
||||
ptr = gUnknown_0862A5CC[var2][i];
|
||||
minutes = (signed)(gSaveBlock1Ptr->trainerHill.field_3D64) / (60 * 60);
|
||||
minutes = (signed)(gSaveBlock1Ptr->trainerHill.timer) / (60 * 60);
|
||||
if (minutes < 12)
|
||||
id = 0;
|
||||
else if (minutes < 13)
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "tv.h"
|
||||
#include "data2.h"
|
||||
#include "constants/layouts.h"
|
||||
#include "constants/metatile_behaviors.h"
|
||||
|
||||
// Static type declarations
|
||||
|
||||
@@ -62,7 +63,7 @@ IWRAM_DATA s8 sTVShowMixingCurSlot;
|
||||
EWRAM_DATA u16 sPokemonAnglerSpecies = 0;
|
||||
EWRAM_DATA u16 sPokemonAnglerAttemptCounters = 0;
|
||||
EWRAM_DATA u16 sFindThatGamerCoinsSpent = 0;
|
||||
EWRAM_DATA bool8 sFindThatGamerWhichGame = FALSE;
|
||||
EWRAM_DATA u8 sFindThatGamerWhichGame = SLOT_MACHINE;
|
||||
EWRAM_DATA ALIGNED(4) u8 sRecordMixingPartnersWithoutShowsToShare = 0;
|
||||
EWRAM_DATA ALIGNED(4) u8 sTVShowState = 0;
|
||||
EWRAM_DATA u8 sTVSecretBaseSecretsRandomValues[3] = {};
|
||||
@@ -853,9 +854,9 @@ void SetTVMetatilesOnMap(int width, int height, u16 tileId)
|
||||
{
|
||||
for (x = 0; x < width; x ++)
|
||||
{
|
||||
if (MapGridGetMetatileBehaviorAt(x, y) == 0x86) // is this tile a TV?
|
||||
if (MapGridGetMetatileBehaviorAt(x, y) == MB_TELEVISION)
|
||||
{
|
||||
MapGridSetMetatileIdAt(x, y, tileId | 0xc00);
|
||||
MapGridSetMetatileIdAt(x, y, tileId | METATILE_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2019,7 +2020,7 @@ void sub_80EDCE8(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80EDD78(u16 nCoinsPaidOut)
|
||||
void AlertTVOfNewCoinTotal(u16 nCoinsPaidOut)
|
||||
{
|
||||
TVShow *show;
|
||||
bool8 flag;
|
||||
@@ -2031,7 +2032,7 @@ void sub_80EDD78(u16 nCoinsPaidOut)
|
||||
flag = FALSE;
|
||||
switch (sFindThatGamerWhichGame)
|
||||
{
|
||||
case FALSE:
|
||||
case SLOT_MACHINE:
|
||||
if (nCoinsPaidOut >= sFindThatGamerCoinsSpent + 200)
|
||||
{
|
||||
flag = TRUE;
|
||||
@@ -2044,7 +2045,7 @@ void sub_80EDD78(u16 nCoinsPaidOut)
|
||||
break;
|
||||
}
|
||||
return;
|
||||
case TRUE:
|
||||
case ROULETTE:
|
||||
if (nCoinsPaidOut >= sFindThatGamerCoinsSpent + 50)
|
||||
{
|
||||
flag = TRUE;
|
||||
@@ -2072,15 +2073,15 @@ void sub_80EDD78(u16 nCoinsPaidOut)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80EDE70(u16 nCoinsSpent)
|
||||
void AlertTVThatPlayerPlayedSlotMachine(u16 nCoinsSpent)
|
||||
{
|
||||
sFindThatGamerWhichGame = FALSE;
|
||||
sFindThatGamerWhichGame = SLOT_MACHINE;
|
||||
sFindThatGamerCoinsSpent = nCoinsSpent;
|
||||
}
|
||||
|
||||
void sub_80EDE84(u16 nCoinsSpent)
|
||||
void AlertTVThatPlayerPlayedRoulette(u16 nCoinsSpent)
|
||||
{
|
||||
sFindThatGamerWhichGame = TRUE;
|
||||
sFindThatGamerWhichGame = ROULETTE;
|
||||
sFindThatGamerCoinsSpent = nCoinsSpent;
|
||||
}
|
||||
|
||||
@@ -2448,8 +2449,8 @@ void sub_80EE72C(void)
|
||||
show->trainerFanClub.kind = TVSHOW_TRAINER_FAN_CLUB;
|
||||
show->trainerFanClub.active = FALSE;
|
||||
StringCopy(show->trainerFanClub.playerName, gSaveBlock2Ptr->playerName);
|
||||
show->trainerFanClub.words[0] = gSaveBlock1Ptr->unk2BB0[0];
|
||||
show->trainerFanClub.words[1] = gSaveBlock1Ptr->unk2BB0[1];
|
||||
show->trainerFanClub.words[0] = gSaveBlock1Ptr->easyChatProfile[0];
|
||||
show->trainerFanClub.words[1] = gSaveBlock1Ptr->easyChatProfile[1];
|
||||
tv_store_id_3x(show);
|
||||
show->trainerFanClub.language = gGameLanguage;
|
||||
}
|
||||
@@ -2565,13 +2566,13 @@ void sub_80EEA70(void)
|
||||
show->secretBaseSecrets.kind = TVSHOW_SECRET_BASE_SECRETS;
|
||||
show->secretBaseSecrets.active = FALSE;
|
||||
StringCopy(show->secretBaseSecrets.playerName, gSaveBlock2Ptr->playerName);
|
||||
show->secretBaseSecrets.stepsInBase = VarGet(VAR_0x40EC);
|
||||
show->secretBaseSecrets.stepsInBase = VarGet(VAR_SECRET_BASE_STEP_COUNTER);
|
||||
sub_80E980C();
|
||||
StringCopy(strbuf, gStringVar1);
|
||||
StripExtCtrlCodes(strbuf);
|
||||
StringCopy(show->secretBaseSecrets.baseOwnersName, strbuf);
|
||||
show->secretBaseSecrets.item = VarGet(VAR_0x40ED);
|
||||
show->secretBaseSecrets.flags = VarGet(VAR_0x40EE) + (VarGet(VAR_0x40EF) << 16);
|
||||
show->secretBaseSecrets.item = VarGet(VAR_SECRET_BASE_LAST_ITEM_USED);
|
||||
show->secretBaseSecrets.flags = VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) + (VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) << 16);
|
||||
tv_store_id_3x(show);
|
||||
show->secretBaseSecrets.language = gGameLanguage;
|
||||
if (show->secretBaseSecrets.language == LANGUAGE_JAPANESE || gSaveBlock1Ptr->secretBases[VarGet(VAR_CURRENT_SECRET_BASE)].language == LANGUAGE_JAPANESE)
|
||||
@@ -7350,7 +7351,7 @@ static void DoTVShowWhatsNo1InHoennToday(void)
|
||||
ShowFieldMessage(sTVWhatsNo1InHoennTodayTextGroup[state]);
|
||||
}
|
||||
|
||||
u8 sub_80F5180(TVShow *show)
|
||||
u8 TVShowGetFlagCount(TVShow *show)
|
||||
{
|
||||
u8 i;
|
||||
u8 tot;
|
||||
@@ -7365,7 +7366,7 @@ u8 sub_80F5180(TVShow *show)
|
||||
return tot;
|
||||
}
|
||||
|
||||
u8 sub_80F51AC(TVShow *show, u8 a1)
|
||||
u8 TVShowGetStateForFlagNumber(TVShow *show, u8 a1)
|
||||
{
|
||||
u8 i;
|
||||
u8 tot;
|
||||
@@ -7399,7 +7400,7 @@ static void DoTVShowSecretBaseSecrets(void)
|
||||
case 0:
|
||||
TVShowConvertInternationalString(gStringVar1, show->secretBaseSecrets.baseOwnersName, show->secretBaseSecrets.baseOwnersNameLanguage);
|
||||
TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language);
|
||||
bitCount = sub_80F5180(show);
|
||||
bitCount = TVShowGetFlagCount(show);
|
||||
if (bitCount == 0)
|
||||
{
|
||||
sTVShowState = 8;
|
||||
@@ -7408,12 +7409,12 @@ static void DoTVShowSecretBaseSecrets(void)
|
||||
{
|
||||
show->secretBaseSecrets.savedState = 1;
|
||||
sTVSecretBaseSecretsRandomValues[0] = Random() % bitCount;
|
||||
sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[0]);
|
||||
sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[0]);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language);
|
||||
bitCount = sub_80F5180(show);
|
||||
bitCount = TVShowGetFlagCount(show);
|
||||
switch (bitCount)
|
||||
{
|
||||
case 1:
|
||||
@@ -7423,11 +7424,11 @@ static void DoTVShowSecretBaseSecrets(void)
|
||||
show->secretBaseSecrets.savedState = 2;
|
||||
if (sTVSecretBaseSecretsRandomValues[0] == 0)
|
||||
{
|
||||
sTVShowState = sub_80F51AC(show, 1);
|
||||
sTVShowState = TVShowGetStateForFlagNumber(show, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
sTVShowState = sub_80F51AC(show, 0);
|
||||
sTVShowState = TVShowGetStateForFlagNumber(show, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -7440,13 +7441,13 @@ static void DoTVShowSecretBaseSecrets(void)
|
||||
}
|
||||
}
|
||||
show->secretBaseSecrets.savedState = 2;
|
||||
sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[1]);
|
||||
sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[1]);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
TVShowConvertInternationalString(gStringVar2, show->secretBaseSecrets.playerName, show->secretBaseSecrets.language);
|
||||
bitCount = sub_80F5180(show);
|
||||
bitCount = TVShowGetFlagCount(show);
|
||||
if (bitCount == 2)
|
||||
{
|
||||
sTVShowState = 9;
|
||||
@@ -7462,7 +7463,7 @@ static void DoTVShowSecretBaseSecrets(void)
|
||||
}
|
||||
}
|
||||
show->secretBaseSecrets.savedState = 3;
|
||||
sTVShowState = sub_80F51AC(show, sTVSecretBaseSecretsRandomValues[2]);
|
||||
sTVShowState = TVShowGetStateForFlagNumber(show, sTVSecretBaseSecretsRandomValues[2]);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
||||
Reference in New Issue
Block a user