Record mixing fakematch fixed!

This commit is contained in:
PokeCodec 2020-09-09 15:23:52 -04:00
parent dc34cf1711
commit 84a92279c9
3 changed files with 32 additions and 37 deletions

View file

@ -245,46 +245,46 @@ static bool8 sub_8122A58(struct EasyChatPair *a, struct EasyChatPair *b, u8 c)
{
case 0:
if (a->unk0_0 > b->unk0_0)
return 1;
return TRUE;
if (a->unk0_0 < b->unk0_0)
return 0;
return FALSE;
if (a->unk0_7 > b->unk0_7)
return 1;
return TRUE;
if (a->unk0_7 < b->unk0_7)
return 0;
return FALSE;
break;
case 1:
if (a->unk0_7 > b->unk0_7)
return 1;
return TRUE;
if (a->unk0_7 < b->unk0_7)
return 0;
return FALSE;
if (a->unk0_0 > b->unk0_0)
return 1;
return TRUE;
if (a->unk0_0 < b->unk0_0)
return 0;
return FALSE;
break;
case 2:
if (a->unk0_0 > b->unk0_0)
return 1;
return TRUE;
if (a->unk0_0 < b->unk0_0)
return 0;
return FALSE;
if (a->unk0_7 > b->unk0_7)
return 1;
return TRUE;
if (a->unk0_7 < b->unk0_7)
return 0;
return FALSE;
if (a->unk2 > b->unk2)
return 1;
return TRUE;
if (a->unk2 < b->unk2)
return 0;
return FALSE;
if (a->words[0] > b->words[0])
return 1;
return TRUE;
if (a->words[0] < b->words[0])
return 0;
return FALSE;
if (a->words[1] > b->words[1])
return 1;
return TRUE;
if (a->words[1] < b->words[1])
return 0;
return 1;
return FALSE;
return TRUE;
}
return Random() & 1;
}

View file

@ -70,7 +70,7 @@ EWRAM_DATA u8 gEnemyPartyCount = 0;
EWRAM_DATA struct Pokemon gPlayerParty[PARTY_SIZE] = {0};
EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL};
EWRAM_DATA struct Unknown_806F160_Struct *gUnknown_020249B4[2] = {NULL, NULL};
// const rom data
#include "data/battle_moves.h"

View file

@ -866,28 +866,23 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
}
else if (sp1c[i][0] == TRUE && sp1c[i][1] == TRUE)
{
u32 var1, var2;
u8 mail1, mail2;
sp24[j][0] = i;
var1 = sub_80E7A9C(&_src->mail[0]);
var2 = sub_80E7A9C(&_src->mail[1]);
if (!var1 && var2)
mail1 = sub_80E7A9C(&_src->mail[0]);
mail2 = sub_80E7A9C(&_src->mail[1]);
if (!(mail1 || mail2) || (mail1 && mail2)) //Logical (not bitwise) XOR. Should be ((mail1 || mail2) && !(mail1 && mail2)), but that doesn't match.
{
#ifndef NONMATCHING
register u8 one asm("r0") = 1; // boo, a fakematch
sp24[j][1] = one;
#else
sp24[j][1] = 1;
#endif
sp24[j][1] = Random2() % 2;
}
else if ((var1 && var2) || (!var1 && !var2))
{
sp24[j][1] = Random2() % 2;
}
else if (var1 && !var2)
else if (mail1 && !mail2)
{
sp24[j][1] = 0;
}
else if (!mail1 && mail2)
{
sp24[j][1] = 1;
}
j++;
}
}
@ -921,8 +916,8 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
}
_src = (void *)src + which * recordSize;
memcpy(&gSaveBlock1Ptr->daycare.mons[0].mail, &_src->mail[0], sizeof(struct DayCareMail));
memcpy(&gSaveBlock1Ptr->daycare.mons[1].mail, &_src->mail[1], sizeof(struct DayCareMail));
gSaveBlock1Ptr->daycare.mons[0].mail = _src->mail[0];
gSaveBlock1Ptr->daycare.mons[1].mail = _src->mail[1];
SeedRng(oldSeed);
}