pull in project-slippi/Ishiiruka/commit/d5de0070009e0ee2fde6ff276f249b816ff29cf7

allow fod to be randomed again in singles
This commit is contained in:
Nikhil Narayana 2021-12-18 17:28:31 -08:00
commit e43f72ad58
2 changed files with 14 additions and 5 deletions

View file

@ -2281,7 +2281,7 @@ void CEXISlippi::prepareOnlineMatchState()
}
std::vector<u16> CEXISlippi::singlesStages = {
// 0x2, // FoD
0x2, // FoD
0x3, // Pokemon
0x8, // Yoshi's Story
0x1C, // Dream Land
@ -2289,7 +2289,7 @@ std::vector<u16> CEXISlippi::singlesStages = {
0x20, // Final Destination
};
u16 CEXISlippi::getRandomStage()
u16 CEXISlippi::getRandomStage(u8 onlineMode)
{
static u16 selectedStage;
@ -2304,6 +2304,14 @@ u16 CEXISlippi::getRandomStage()
// Remove last selection from stage pool
stagePool.erase(stagePool.begin() + randIndex);
// If the mode is teams, don't allow FoD to be selected, re-roll instead. Note that this will
// cause a stack overflow exception/infinite recursion in the case the FoD is the only stage in
// the singlesStages vector
if (onlineMode == (u8)SlippiMatchmaking::OnlinePlayMode::TEAMS && selectedStage == 0x2)
{
return getRandomStage(onlineMode);
}
return selectedStage;
}
@ -2318,12 +2326,13 @@ void CEXISlippi::setMatchSelections(u8* payload)
s.stageId = Common::swap16(&payload[4]);
u8 stageSelectOption = payload[6];
u8 onlineMode = payload[7];
s.isStageSelected = stageSelectOption == 1 || stageSelectOption == 3;
if (stageSelectOption == 3)
{
// If stage requested is random, select a random stage
s.stageId = getRandomStage();
s.stageId = getRandomStage(onlineMode);
}
INFO_LOG(SLIPPI, "LPS set char: %d, iSS: %d, %d, stage: %d, team: %d", s.isCharacterSelected,
@ -2334,7 +2343,7 @@ void CEXISlippi::setMatchSelections(u8* payload)
if (matchmaking->LocalPlayerIndex() == 1 && firstMatch)
{
firstMatch = false;
s.stageId = getRandomStage();
s.stageId = getRandomStage(onlineMode);
}
// Merge these selections

View file

@ -163,7 +163,7 @@ private:
std::vector<u8> m_payload;
// online play stuff
u16 getRandomStage();
u16 getRandomStage(u8 onlineMode);
bool isDisconnected();
void handleOnlineInputs(u8* payload);
void prepareOpponentInputs(u8* payload);