Refactor InitStateHandlers so each key in the reset combo is checked
This commit is contained in:
parent
3d87a88067
commit
99448002e1
3 changed files with 12 additions and 19 deletions
|
@ -2044,8 +2044,7 @@ void sub_80110B8(u32 a0)
|
|||
if ((r8 >> i) & 1)
|
||||
{
|
||||
child_sprite_genders |= ((0x80 | ((gLinkPlayers[Rfu.linkPlayerIdx[i]].gender & 1) << 3) | (gLinkPlayers[Rfu.linkPlayerIdx[i]].trainerId & 7)) << (numConnectedChildren << 3));
|
||||
numConnectedChildren++;
|
||||
if (numConnectedChildren == a0 - 1)
|
||||
if (++numConnectedChildren == a0 - 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -309,8 +309,7 @@ static const struct SpriteTemplate sWirelessStatusIndicatorSpriteTemplate = {
|
|||
|
||||
void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 i, j;
|
||||
|
||||
for (i = 0; i < RECV_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
|
@ -327,8 +326,7 @@ void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
|||
|
||||
void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 i, j;
|
||||
|
||||
for (i = 0; i < SEND_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
|
@ -345,8 +343,7 @@ void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
|||
|
||||
static void RfuUnusedQueue_Reset(struct RfuUnusedQueue *queue)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 i, j;
|
||||
|
||||
for (i = 0; i < UNUSED_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
|
@ -631,7 +628,7 @@ static u8 GetConnectedChildStrength(u8 maxFlags)
|
|||
|
||||
if (gRfuLinkStatus->parentChild == MODE_PARENT)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
if (flags & 1)
|
||||
{
|
||||
|
@ -925,8 +922,7 @@ void RecordMixTrainerNames(void)
|
|||
{
|
||||
if (gWirelessCommType != 0)
|
||||
{
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 i, j;
|
||||
s32 nextSpace;
|
||||
s32 connectedTrainerRecordIndices[5];
|
||||
struct TrainerNameRecord *newRecords = calloc(ARRAY_COUNT(gSaveBlock1Ptr->trainerNameRecords), sizeof(struct TrainerNameRecord));
|
||||
|
|
14
src/main.c
14
src/main.c
|
@ -81,8 +81,6 @@ void InitIntrHandlers(void);
|
|||
static void WaitForVBlank(void);
|
||||
void EnableVCountIntrAtLine150(void);
|
||||
|
||||
#define B_START_SELECT (B_BUTTON | START_BUTTON | SELECT_BUTTON)
|
||||
|
||||
void AgbMain()
|
||||
{
|
||||
#if MODERN
|
||||
|
@ -136,9 +134,11 @@ void AgbMain()
|
|||
{
|
||||
ReadKeys();
|
||||
|
||||
if (gSoftResetDisabled == FALSE
|
||||
if (!gSoftResetDisabled
|
||||
&& (gMain.heldKeysRaw & A_BUTTON)
|
||||
&& (gMain.heldKeysRaw & B_START_SELECT) == B_START_SELECT)
|
||||
&& (gMain.heldKeysRaw & B_BUTTON)
|
||||
&& (gMain.heldKeysRaw & START_BUTTON)
|
||||
&& (gMain.heldKeysRaw & SELECT_BUTTON)) //The reset key combo A + B + START + SELECT
|
||||
{
|
||||
rfu_REQ_stopMode();
|
||||
rfu_waitREQComplete();
|
||||
|
@ -262,9 +262,7 @@ static void ReadKeys(void)
|
|||
|
||||
if (keyInput != 0 && gMain.heldKeys == keyInput)
|
||||
{
|
||||
gMain.keyRepeatCounter--;
|
||||
|
||||
if (gMain.keyRepeatCounter == 0)
|
||||
if (--gMain.keyRepeatCounter == 0)
|
||||
{
|
||||
gMain.newAndRepeatedKeys = keyInput;
|
||||
gMain.keyRepeatCounter = gKeyRepeatContinueDelay;
|
||||
|
@ -343,7 +341,7 @@ static void VBlankIntr(void)
|
|||
{
|
||||
if (gWirelessCommType != 0)
|
||||
RfuVSync();
|
||||
else if (gLinkVSyncDisabled == FALSE)
|
||||
else if (!gLinkVSyncDisabled)
|
||||
LinkVSync();
|
||||
|
||||
gMain.vblankCounter1++;
|
||||
|
|
Loading…
Reference in a new issue