Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/iarwain/ggj2021
Browse files Browse the repository at this point in the history
  • Loading branch information
fbrizu committed Jan 31, 2021
2 parents 0db9c78 + c034c0d commit 726126c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions data/config/gameover.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 5 additions & 0 deletions data/config/sound.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ Sound = InvalidAction.ogg

[ScoreSound@Sound]
Sound = ScorePoint.ogg

[GameOverSound@Sound]
Sound = ScorePoint.ogg
Loop = true
LifeTime = 0.5
13 changes: 10 additions & 3 deletions src/Table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Player>();
poPlayer;
Expand All @@ -73,17 +74,23 @@ 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);
}

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");
}
Expand Down

0 comments on commit 726126c

Please sign in to comment.