Cleanup of main.c
This commit is contained in:
+3
-3
@@ -158,7 +158,7 @@ void ResetGameStats(void);
|
|||||||
void Overworld_CreditsMainCB(void);
|
void Overworld_CreditsMainCB(void);
|
||||||
bool32 Overworld_DoScrollSceneForCredits(u8 *, const struct CreditsOverworldCmd *, u8);
|
bool32 Overworld_DoScrollSceneForCredits(u8 *, const struct CreditsOverworldCmd *, u8);
|
||||||
|
|
||||||
bool32 sub_8058318(void);
|
bool32 IsSendingKeysOverCable(void);
|
||||||
|
|
||||||
void CB2_ReturnToFieldWithOpenMenu(void);
|
void CB2_ReturnToFieldWithOpenMenu(void);
|
||||||
void CB2_WhiteOut(void);
|
void CB2_WhiteOut(void);
|
||||||
@@ -170,8 +170,8 @@ void SetContinueGameWarpToHealLocation(u8 loc);
|
|||||||
|
|
||||||
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
|
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
|
||||||
void SetWarpDestinationToHealLocation(u8 a0);
|
void SetWarpDestinationToHealLocation(u8 a0);
|
||||||
bool32 sub_80582E0(void);
|
bool32 Overworld_SendKeysToLinkIsRunning(void);
|
||||||
bool32 sub_8058274(void);
|
bool32 Overworld_RecvKeysFromLinkIsRunning(void);
|
||||||
void OverworldWhiteOutGetMoneyLoss(void);
|
void OverworldWhiteOutGetMoneyLoss(void);
|
||||||
u8 GetCurrentMapBattleScene(void);
|
u8 GetCurrentMapBattleScene(void);
|
||||||
void Overworld_ResetStateAfterFly(void);
|
void Overworld_ResetStateAfterFly(void);
|
||||||
|
|||||||
@@ -1109,12 +1109,10 @@ static void SpriteCB_BT_Phase2SlidingPokeballs(struct Sprite *sprite)
|
|||||||
|
|
||||||
if (posX != sprite->data[2])
|
if (posX != sprite->data[2])
|
||||||
{
|
{
|
||||||
u32 var;
|
|
||||||
u16 *ptr;
|
u16 *ptr;
|
||||||
|
|
||||||
sprite->data[2] = posX;
|
sprite->data[2] = posX;
|
||||||
var = (((GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F) << 11);
|
ptr = (u16 *)BG_SCREEN_ADDR((GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F);
|
||||||
ptr = (u16 *)(VRAM + var);
|
|
||||||
SOME_VRAM_STORE(ptr, posY - 2, posX, 0xF001);
|
SOME_VRAM_STORE(ptr, posY - 2, posX, 0xF001);
|
||||||
SOME_VRAM_STORE(ptr, posY - 1, posX, 0xF001);
|
SOME_VRAM_STORE(ptr, posY - 1, posX, 0xF001);
|
||||||
SOME_VRAM_STORE(ptr, posY - 0, posX, 0xF001);
|
SOME_VRAM_STORE(ptr, posY - 0, posX, 0xF001);
|
||||||
@@ -3512,7 +3510,7 @@ static void BT_GetBg0TilesetBase(u16 **tilesetPtr)
|
|||||||
u16 charBase;
|
u16 charBase;
|
||||||
|
|
||||||
charBase = GetGpuReg(REG_OFFSET_BG0CNT) >> 2;
|
charBase = GetGpuReg(REG_OFFSET_BG0CNT) >> 2;
|
||||||
charBase <<= 0xE;
|
charBase <<= 14;
|
||||||
*tilesetPtr = (u16 *)(VRAM + charBase);
|
*tilesetPtr = (u16 *)(VRAM + charBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3522,8 +3520,8 @@ static void BT_GetBg0TilemapAndTilesetBase(u16 **tilemapPtr, u16 **tilesetPtr)
|
|||||||
|
|
||||||
screenBase = (GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F;
|
screenBase = (GetGpuReg(REG_OFFSET_BG0CNT) >> 8) & 0x1F;
|
||||||
charBase = GetGpuReg(REG_OFFSET_BG0CNT) >> 2;
|
charBase = GetGpuReg(REG_OFFSET_BG0CNT) >> 2;
|
||||||
screenBase <<= 0xB;
|
screenBase <<= 11;
|
||||||
charBase <<= 0xE;
|
charBase <<= 14;
|
||||||
*tilemapPtr = (u16 *)(VRAM + screenBase);
|
*tilemapPtr = (u16 *)(VRAM + screenBase);
|
||||||
*tilesetPtr = (u16 *)(VRAM + charBase);
|
*tilesetPtr = (u16 *)(VRAM + charBase);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1656,7 +1656,7 @@ bool8 HandleLinkConnection(void)
|
|||||||
{
|
{
|
||||||
gLinkStatus = LinkMain1(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds);
|
gLinkStatus = LinkMain1(&gShouldAdvanceLinkState, gSendCmd, gRecvCmds);
|
||||||
LinkMain2(&gMain.heldKeys);
|
LinkMain2(&gMain.heldKeys);
|
||||||
if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && sub_8058318() == TRUE)
|
if ((gLinkStatus & LINK_STAT_RECEIVED_NOTHING) && IsSendingKeysOverCable() == TRUE)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -1665,7 +1665,7 @@ bool8 HandleLinkConnection(void)
|
|||||||
{
|
{
|
||||||
r4 = LinkRfuMain1();
|
r4 = LinkRfuMain1();
|
||||||
r5 = LinkRfuMain2();
|
r5 = LinkRfuMain2();
|
||||||
if (sub_8058318() == TRUE)
|
if (IsSendingKeysOverCable() == TRUE)
|
||||||
{
|
{
|
||||||
if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5)
|
if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5)
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-8
@@ -132,7 +132,7 @@ void AgbMain()
|
|||||||
InitMapMusic();
|
InitMapMusic();
|
||||||
ClearDma3Requests();
|
ClearDma3Requests();
|
||||||
ResetBgs();
|
ResetBgs();
|
||||||
InitHeap(gHeap, 0x1C000);
|
InitHeap(gHeap, HEAP_SIZE);
|
||||||
SetDefaultFontsPointer();
|
SetDefaultFontsPointer();
|
||||||
|
|
||||||
gSoftResetDisabled = FALSE;
|
gSoftResetDisabled = FALSE;
|
||||||
@@ -162,7 +162,7 @@ void AgbMain()
|
|||||||
DoSoftReset();
|
DoSoftReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sub_80582E0() == 1)
|
if (Overworld_SendKeysToLinkIsRunning() == TRUE)
|
||||||
{
|
{
|
||||||
gLinkTransferringData = TRUE;
|
gLinkTransferringData = TRUE;
|
||||||
UpdateLinkAndCallCallbacks();
|
UpdateLinkAndCallCallbacks();
|
||||||
@@ -173,7 +173,7 @@ void AgbMain()
|
|||||||
gLinkTransferringData = FALSE;
|
gLinkTransferringData = FALSE;
|
||||||
UpdateLinkAndCallCallbacks();
|
UpdateLinkAndCallCallbacks();
|
||||||
|
|
||||||
if (sub_8058274() == 1)
|
if (Overworld_RecvKeysFromLinkIsRunning() == 1)
|
||||||
{
|
{
|
||||||
gMain.newKeys = 0;
|
gMain.newKeys = 0;
|
||||||
ClearSpriteCopyRequests();
|
ClearSpriteCopyRequests();
|
||||||
@@ -293,16 +293,16 @@ static void ReadKeys(void)
|
|||||||
gMain.heldKeys = gMain.heldKeysRaw;
|
gMain.heldKeys = gMain.heldKeysRaw;
|
||||||
|
|
||||||
// Remap L to A if the L=A option is enabled.
|
// Remap L to A if the L=A option is enabled.
|
||||||
if (gSaveBlock2Ptr->optionsButtonMode == 2)
|
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
|
||||||
{
|
{
|
||||||
if (gMain.newKeys & L_BUTTON)
|
if (JOY_NEW(L_BUTTON))
|
||||||
gMain.newKeys |= A_BUTTON;
|
gMain.newKeys |= A_BUTTON;
|
||||||
|
|
||||||
if (gMain.heldKeys & L_BUTTON)
|
if (JOY_HELD(L_BUTTON))
|
||||||
gMain.heldKeys |= A_BUTTON;
|
gMain.heldKeys |= A_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMain.newKeys & gMain.watchedKeysMask)
|
if (JOY_NEW(gMain.watchedKeysMask))
|
||||||
gMain.watchedKeysPressed = TRUE;
|
gMain.watchedKeysPressed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +323,7 @@ void InitIntrHandlers(void)
|
|||||||
|
|
||||||
REG_IME = 1;
|
REG_IME = 1;
|
||||||
|
|
||||||
EnableInterrupts(0x1);
|
EnableInterrupts(INTR_FLAG_VBLANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetVBlankCallback(IntrCallback callback)
|
void SetVBlankCallback(IntrCallback callback)
|
||||||
|
|||||||
+7
-7
@@ -3192,7 +3192,7 @@ bool32 Overworld_LinkRecvQueueLengthMoreThan2(void)
|
|||||||
return sReceivingFromLink;
|
return sReceivingFromLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 sub_8058274(void)
|
bool32 Overworld_RecvKeysFromLinkIsRunning(void)
|
||||||
{
|
{
|
||||||
u8 temp;
|
u8 temp;
|
||||||
|
|
||||||
@@ -3218,7 +3218,7 @@ bool32 sub_8058274(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 sub_80582E0(void)
|
bool32 Overworld_SendKeysToLinkIsRunning(void)
|
||||||
{
|
{
|
||||||
if (GetLinkSendQueueLength() < 2)
|
if (GetLinkSendQueueLength() < 2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -3232,7 +3232,7 @@ bool32 sub_80582E0(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 sub_8058318(void)
|
bool32 IsSendingKeysOverCable(void)
|
||||||
{
|
{
|
||||||
if (gWirelessCommType != 0)
|
if (gWirelessCommType != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -3298,17 +3298,17 @@ static void InitLinkPlayerObjectEventPos(struct ObjectEvent *objEvent, s16 x, s1
|
|||||||
ObjectEventUpdateZCoord(objEvent);
|
ObjectEventUpdateZCoord(objEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8058488(u8 linkPlayerId, u8 a2)
|
static void SetLinkPlayerObjectRange(u8 linkPlayerId, u8 range)
|
||||||
{
|
{
|
||||||
if (gLinkPlayerObjectEvents[linkPlayerId].active)
|
if (gLinkPlayerObjectEvents[linkPlayerId].active)
|
||||||
{
|
{
|
||||||
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
|
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||||
objEvent->range.as_byte = a2;
|
objEvent->range.as_byte = range;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80584B8(u8 linkPlayerId)
|
static void DestroyLinkPlayerOBject(u8 linkPlayerId)
|
||||||
{
|
{
|
||||||
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
|
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
|
||||||
u8 objEventId = linkPlayerObjEvent->objEventId;
|
u8 objEventId = linkPlayerObjEvent->objEventId;
|
||||||
@@ -3349,7 +3349,7 @@ static u8 GetLinkPlayerElevation(u8 linkPlayerId)
|
|||||||
return objEvent->currentElevation;
|
return objEvent->currentElevation;
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 sub_8058590(u8 linkPlayerId)
|
static s32 GetLinkPlayerObjectStepTimer(u8 linkPlayerId)
|
||||||
{
|
{
|
||||||
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
|
u8 objEventId = gLinkPlayerObjectEvents[linkPlayerId].objEventId;
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||||
|
|||||||
Reference in New Issue
Block a user