diff --git a/data/config/gameover.ini b/data/config/gameover.ini index 6127983..660781a 100644 --- a/data/config/gameover.ini +++ b/data/config/gameover.ini @@ -7,3 +7,7 @@ Color = % > Get GameOver Winner, get < Color ParentCamera = MainCamera UseParentSpace = false Position = (0, -500, 0) +ChildList = GameOverSound + +[Tie] +Color = (120, 120, 120) diff --git a/data/config/sound.ini b/data/config/sound.ini index 523c568..68fcf8e 100644 --- a/data/config/sound.ini +++ b/data/config/sound.ini @@ -17,3 +17,8 @@ Sound = InvalidAction.ogg [ScoreSound@Sound] Sound = ScorePoint.ogg + +[GameOverSound@Sound] +Sound = ScorePoint.ogg +Loop = true +LifeTime = 0.5 diff --git a/src/Table.cpp b/src/Table.cpp index 296763a..9faf4c1 100644 --- a/src/Table.cpp +++ b/src/Table.cpp @@ -63,6 +63,7 @@ void Table::Update(const orxCLOCK_INFO &_rstInfo) ggj2021 &roGame = ggj2021::GetInstance(); Player *poWinner = orxNULL; orxCHAR acName[128] = {}; + orxBOOL bTie = orxFALSE; for(Player *poPlayer = roGame.GetNextObject(); poPlayer; @@ -73,7 +74,13 @@ void Table::Update(const orxCLOCK_INFO &_rstInfo) || ((poPlayer->u32Score == poWinner->u32Score) && (poPlayer->u32Picks < poWinner->u32Picks))) { - poWinner = poPlayer; + poWinner = poPlayer; + bTie = orxFALSE; + } + else if((poPlayer->u32Score == poWinner->u32Score) + && (poPlayer->u32Picks == poWinner->u32Picks)) + { + bTie = orxTRUE; } poPlayer->astHands[0].poHand->Enable(orxFALSE); poPlayer->astHands[1].poHand->Enable(orxFALSE); @@ -81,9 +88,9 @@ void Table::Update(const orxCLOCK_INFO &_rstInfo) orxConfig_PushSection("GameOver"); orxString_NPrint(acName, sizeof(acName) - 1, "%s", poWinner->GetModelName()); - orxConfig_SetString("Winner", acName); + orxConfig_SetString("Winner", bTie ? "Tie" : acName); orxString_UpperCase(acName); - orxConfig_SetString("WINNER", acName); + orxConfig_SetString("WINNER", bTie ? "TIE" : acName); orxConfig_PopSection(); roGame.CreateObject("GameOver"); }