Undo PokeCodec's PRs
This commit undoes most of PokeCodec's PRs after the debate in chat. Some harmless or completely superseded PRs have been left alone, as there is not much benefit in attempting to undo them. Reverts #1104, #1108, #1115, #1118, #1119, #1124, #1126, #1127, #1132, #1136, #1137, #1139, #1140, #1144, #1148, #1149, #1150, #1153, #1155, #1177, #1179, #1180, #1181, #1182 and #1183.
This commit is contained in:
+25
-21
@@ -713,18 +713,17 @@ static u8 sub_80E7A9C(struct DayCareMail *rmMail)
|
||||
return rmMail->message.itemId;
|
||||
}
|
||||
|
||||
static void ExchangeMail(struct RecordMixingDayCareMail *src, size_t recordSize, u8 (*idxs)[2], u8 which0, u8 which1)
|
||||
static void sub_80E7AA4(struct RecordMixingDayCareMail *src, size_t recordSize, u8 (*idxs)[2], u8 which0, u8 which1)
|
||||
{
|
||||
struct DayCareMail buffer;
|
||||
struct RecordMixingDayCareMail *mail1;
|
||||
struct RecordMixingDayCareMail *mail2;
|
||||
|
||||
mail1 = (void *)src + recordSize * idxs[which0][0];
|
||||
buffer = mail1->mail[idxs[which0][1]];
|
||||
|
||||
memcpy(&buffer, &mail1->mail[idxs[which0][1]], sizeof(struct DayCareMail));
|
||||
mail2 = (void *)src + recordSize * idxs[which1][0];
|
||||
mail1->mail[idxs[which0][1]] = mail2->mail[idxs[which1][1]];
|
||||
mail2->mail[idxs[which1][1]] = buffer;
|
||||
memcpy(&mail1->mail[idxs[which0][1]], &mail2->mail[idxs[which1][1]], sizeof(struct DayCareMail));
|
||||
memcpy(&mail2->mail[idxs[which1][1]], &buffer, sizeof(struct DayCareMail));
|
||||
}
|
||||
|
||||
static void sub_80E7B2C(const u8 *src)
|
||||
@@ -866,23 +865,28 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
|
||||
}
|
||||
else if (sp1c[i][0] == TRUE && sp1c[i][1] == TRUE)
|
||||
{
|
||||
u8 mail1, mail2;
|
||||
u32 var1, var2;
|
||||
|
||||
sp24[j][0] = i;
|
||||
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.
|
||||
var1 = sub_80E7A9C(&_src->mail[0]);
|
||||
var2 = sub_80E7A9C(&_src->mail[1]);
|
||||
if (!var1 && var2)
|
||||
{
|
||||
sp24[j][1] = Random2() % 2;
|
||||
#ifndef NONMATCHING
|
||||
register u8 one asm("r0") = 1; // boo, a fakematch
|
||||
sp24[j][1] = one;
|
||||
#else
|
||||
sp24[j][1] = 1;
|
||||
#endif
|
||||
}
|
||||
else if (mail1 && !mail2)
|
||||
else if ((var1 && var2) || (!var1 && !var2))
|
||||
{
|
||||
sp24[j][1] = Random2() % 2;
|
||||
}
|
||||
else if (var1 && !var2)
|
||||
{
|
||||
sp24[j][1] = 0;
|
||||
}
|
||||
else if (!mail1 && mail2)
|
||||
{
|
||||
sp24[j][1] = 1;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
@@ -897,27 +901,27 @@ static void ReceiveDaycareMailData(struct RecordMixingDayCareMail *src, size_t r
|
||||
switch (sp34)
|
||||
{
|
||||
case 2:
|
||||
ExchangeMail(src, recordSize, sp24, 0, 1);
|
||||
sub_80E7AA4(src, recordSize, sp24, 0, 1);
|
||||
break;
|
||||
case 3:
|
||||
which0 = gUnknown_0858CFB8[tableId][0];
|
||||
which1 = gUnknown_0858CFB8[tableId][1];
|
||||
ExchangeMail(src, recordSize, sp24, which0, which1);
|
||||
sub_80E7AA4(src, recordSize, sp24, which0, which1);
|
||||
break;
|
||||
case 4:
|
||||
ptr = sp24;
|
||||
which0 = gUnknown_0858CFBE[tableId][0];
|
||||
which1 = gUnknown_0858CFBE[tableId][1];
|
||||
ExchangeMail(src, recordSize, ptr, which0, which1);
|
||||
sub_80E7AA4(src, recordSize, ptr, which0, which1);
|
||||
which0 = gUnknown_0858CFBE[tableId][2];
|
||||
which1 = gUnknown_0858CFBE[tableId][3];
|
||||
ExchangeMail(src, recordSize, ptr, which0, which1);
|
||||
sub_80E7AA4(src, recordSize, ptr, which0, which1);
|
||||
break;
|
||||
}
|
||||
|
||||
_src = (void *)src + which * recordSize;
|
||||
gSaveBlock1Ptr->daycare.mons[0].mail = _src->mail[0];
|
||||
gSaveBlock1Ptr->daycare.mons[1].mail = _src->mail[1];
|
||||
memcpy(&gSaveBlock1Ptr->daycare.mons[0].mail, &_src->mail[0], sizeof(struct DayCareMail));
|
||||
memcpy(&gSaveBlock1Ptr->daycare.mons[1].mail, &_src->mail[1], sizeof(struct DayCareMail));
|
||||
SeedRng(oldSeed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user