pull in project-slippi/Ishiiruka/commit/55086d48543c922d32dd2519da425a61d96efdef

This commit is contained in:
Nikhil Narayana 2022-05-29 23:14:15 -07:00
commit b0849e6fbc

View file

@ -2302,6 +2302,10 @@ void CEXISlippi::prepareOnlineMatchState()
}
}
// Set rng offset
rngOffset = isDecider ? lps.rngOffset : rps[0].rngOffset;
INFO_LOG(SLIPPI_ONLINE, "Rng Offset: 0x%x", rngOffset);
// Check if everyone is the same color
auto color = orderedSelections[0].teamId;
bool areAllSameTeam = true;
@ -2311,6 +2315,11 @@ void CEXISlippi::prepareOnlineMatchState()
areAllSameTeam = false;
}
// Randomize assignments to randomize teams when all same color
std::vector<u8> teamAssignments = {0, 0, 1, 1};
generator.seed(rngOffset);
std::shuffle(teamAssignments.begin(), teamAssignments.end(), generator);
// Overwrite player character choices
for (auto& s : orderedSelections)
{
@ -2318,7 +2327,7 @@ void CEXISlippi::prepareOnlineMatchState()
{
// Overwrite teamId
// TODO: overwrite color
s.teamId = s.playerIdx <= 1 ? 0 : 1;
s.teamId = teamAssignments[s.playerIdx];
}
// Overwrite player character
@ -2354,12 +2363,6 @@ void CEXISlippi::prepareOnlineMatchState()
onlineMatchBlock[0x61 + 3 * 0x24] = 0;
}
// Set rng offset
rngOffset = isDecider ? lps.rngOffset : rps[0].rngOffset;
WARN_LOG(SLIPPI_ONLINE, "Rng Offset: 0x%x", rngOffset);
WARN_LOG(SLIPPI_ONLINE, "P1 Char: 0x%X, P2 Char: 0x%X", onlineMatchBlock[0x60],
onlineMatchBlock[0x84]);
// Turn pause off in unranked/ranked, on in other modes
u8* gameBitField3 = static_cast<u8*>(&onlineMatchBlock[2]);
*gameBitField3 = SlippiMatchmaking::IsFixedRulesMode(lastSearch.mode) ? *gameBitField3 | 0x8 :