Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions games/huarong_v1/huarong_v1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,9 @@ CGameMode.bCanStart = false
CGameMode.bOneAxisMoveMode = false
CGameMode.iOneAxisMoveModeScorableCount = 0

CGameMode.iTruePlayerCount = 0
CGameMode.iFinishCount = 0

CGameMode.StartCountDown = function(iCountDownTime)
bCountDownStarted = true
CGameMode.iCountdown = iCountDownTime
Expand Down Expand Up @@ -321,6 +324,7 @@ CGameMode.LoadPiecesForPlayers = function(iMapID)

for iPlayerID = 1, #tGame.StartPositions do
if tPlayerInGame[iPlayerID] then
CGameMode.iTruePlayerCount = CGameMode.iTruePlayerCount + 1
CGameMode.LoadPiecesForPlayer(iPlayerID, iMapID)
end
end
Expand Down Expand Up @@ -368,9 +372,7 @@ CGameMode.IsPointInBounds = function(iPlayerID, iX, iY)
or (iX == CGameMode.tFinishPosPlayerY[iPlayerID].iX and iY == CGameMode.tFinishPosPlayerY[iPlayerID].iY)
end

CGameMode.EndGame = function(iPlayerID)
CGameMode.iWinnerID = iPlayerID

CGameMode.EndGame = function()
iGameState = GAMESTATE_POSTGAME

CAudio.StopBackground()
Expand Down Expand Up @@ -570,7 +572,14 @@ CPieces.PieceFinsh = function(iPieceID)

tGameStats.Players[iPlayerID].Score = tGameStats.Players[iPlayerID].Score + 1
if tGameStats.Players[iPlayerID].Score == tGameStats.TargetScore then
CGameMode.EndGame(iPlayerID)
if CGameMode.iWinnerID == -1 then
CGameMode.iWinnerID = iPlayerID
end

CGameMode.iFinishCount = CGameMode.iFinishCount + 1
if CGameMode.iFinishCount >= CGameMode.iTruePlayerCount - 1 then
CGameMode.EndGame()
end
end

CPieces.PieceBlock(iPieceID, false)
Expand Down