49 procedure StartSuddenDeath; |
49 procedure StartSuddenDeath; |
50 function GearByUID(uid : Longword) : PGear; |
50 function GearByUID(uid : Longword) : PGear; |
51 function IsClockRunning() : boolean; |
51 function IsClockRunning() : boolean; |
52 |
52 |
53 implementation |
53 implementation |
54 uses uStore, uSound, uTeams, uRandom, uIO, uLandGraphics, |
54 uses sysutils, uStore, uSound, uTeams, uRandom, uIO, uLandGraphics, |
55 {$IFDEF USE_TOUCH_INTERFACE}uTouch,{$ENDIF} |
55 {$IFDEF USE_TOUCH_INTERFACE}uTouch,{$ENDIF} |
56 uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables, |
56 uLocale, uAmmos, uStats, uVisualGears, uScript, uVariables, |
57 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, |
57 uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, |
58 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlersRope |
58 uGearsHedgehog, uGearsUtils, uGearsList, uGearsHandlersRope |
59 , uVisualGearsList, uGearsHandlersMess, uAI; |
59 , uVisualGearsList, uGearsHandlersMess, uAI; |
274 end; |
274 end; |
275 if curHandledGear^.Active then |
275 if curHandledGear^.Active then |
276 begin |
276 begin |
277 if curHandledGear^.RenderTimer then |
277 if curHandledGear^.RenderTimer then |
278 begin |
278 begin |
|
279 // Mine timer |
279 if (curHandledGear^.Kind in [gtMine, gtSMine, gtAirMine]) then |
280 if (curHandledGear^.Kind in [gtMine, gtSMine, gtAirMine]) then |
280 begin |
|
281 if curHandledGear^.Tex = nil then |
281 if curHandledGear^.Tex = nil then |
282 if (curHandledGear^.Karma = 1) and (not (GameType in [gmtDemo, gmtRecord])) then |
282 if (curHandledGear^.Karma = 1) and (not (GameType in [gmtDemo, gmtRecord])) then |
|
283 // Secret mine timer |
283 curHandledGear^.Tex:= RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff808080, fntSmall) |
284 curHandledGear^.Tex:= RenderStringTex(ansistring(trmsg[sidUnknownGearValue]), $ff808080, fntSmall) |
284 else |
285 else |
285 begin |
286 begin |
286 i:= curHandledGear^.Timer; |
287 // Display mine timer with up to 1 decimal point of precision (rounded down) |
287 if (i > 0) and (i < 1000) then |
288 i:= curHandledGear^.Timer div 1000; |
288 i:= 1 |
289 j:= (curHandledGear^.Timer mod 1000) div 100; |
|
290 if j = 0 then |
|
291 curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(i)), $ff808080, fntSmall) |
289 else |
292 else |
290 i:= curHandledGear^.Timer div 1000; |
293 curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(i) + FormatSettings.DecimalSeparator + inttostr(j)), $ff808080, fntSmall); |
291 curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(i)), $ff808080, fntSmall); |
294 end |
292 end; |
295 // Timer of other gears |
293 end |
|
294 else if ((curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0)) then |
296 else if ((curHandledGear^.Timer > 500) and ((curHandledGear^.Timer mod 1000) = 0)) then |
295 begin |
297 begin |
|
298 // Display time in seconds as whole number, rounded up |
296 FreeAndNilTexture(curHandledGear^.Tex); |
299 FreeAndNilTexture(curHandledGear^.Tex); |
297 curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(curHandledGear^.Timer div 1000)), cWhiteColor, fntSmall); |
300 curHandledGear^.Tex:= RenderStringTex(ansistring(inttostr(curHandledGear^.Timer div 1000)), cWhiteColor, fntSmall); |
298 end; |
301 end; |
299 end; |
302 end; |
300 curHandledGear^.doStep(curHandledGear); |
303 curHandledGear^.doStep(curHandledGear); |