local ctfws = self.ctfws
if self.dl_elapsed == nil then
lcd:put(lcd:locate(0,0), " ")
- if rix == 0 then lcd:put(lcd:locate(0,0), "SETUP :")
- elseif rix == ctfws.rounds then lcd:put(lcd:locate(0,0), "GAME :")
- elseif ctfws.rounds >= 11 then lcd:put(lcd:locate(0,0), string.format("JB# %2d/%2d :",rix,ctfws.rounds-1))
- else lcd:put(lcd:locate(0,0), string.format("JB# %d/%d :",rix,ctfws.rounds-1))
+ if rix == 0
+ then lcd:put(lcd:locate(0,0), "SETUP :")
+ else lcd:put(lcd:locate(0,0), "GAME :")
end
end
drawDS(lcd,0,13,maxt,self.dl_elapsed,ela); self.dl_elapsed = ela
if rix == 0 then
lcd:put(lcd:locate(3,0), "START IN :")
elseif rix < ctfws.rounds then
- lcd:put(lcd:locate(3,0), "JAILBREAK :")
+ if ctfws.rounds >= 11
+ then lcd:put(lcd:locate(3,0), string.format("JB# %2d/%2d :",rix,ctfws.rounds-1))
+ else lcd:put(lcd:locate(3,0), string.format("JB# %d/%d :",rix,ctfws.rounds-1))
+ end
else
lcd:put(lcd:locate(3,0), "GAME END :")
end
-- the next message or event
local function drawTimes(self)
local ctfws = self.ctfws
- local rix, maxt, ela = ctfws:times(rtctime.get)
+ local rix, roundD, roundEla, gameEla = ctfws:times(rtctime.get)
if rix == nil then
- drawNoGame(self.lcd, maxt)
+ drawNoGame(self.lcd, roundD)
if rix ~= self.dl_round then
self.dl_round = rix
attention(self,true)
self.dl_elapsed = nil -- force redraws of times on round boundaries
self.dl_remain = nil
end
- drawSteadyTopLine(self,rix,maxt,ela)
- drawSteadyBotLine(self,rix,maxt,maxt-ela)
+ drawSteadyTopLine(self,rix,roundD,gameEla)
+ drawSteadyBotLine(self,rix,roundD,roundD-roundEla)
return true
end
local elapsed = (now_sec - self.startT) * 10 + math.floor(now_usec / 100000)
if elapsed < self.setupD then
- return 0, self.setupD, elapsed
+ return 0, self.setupD, elapsed, elapsed -- treat setup (round 0) as a self-contained "game"
end
- elapsed = elapsed - self.setupD
+ gameElapsed = elapsed - self.setupD
- local rounds = math.floor(elapsed / self.roundD)
+ local rounds = math.floor(gameElapsed / self.roundD)
if rounds >= self.rounds
then return nil, "TIME IS UP"
else -- game still in progress
- local roundElapsed = elapsed - rounds * self.roundD
- return rounds + 1, self.roundD, roundElapsed
+ local roundElapsed = gameElapsed - rounds * self.roundD
+ return rounds + 1, self.roundD, roundElapsed, gameElapsed
end
end