25 |
25 |
26 //////////////////// |
26 //////////////////// |
27 implementation |
27 implementation |
28 //////////////////// |
28 //////////////////// |
29 uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, |
29 uses uInputHandler, uTeams, uIO, uAI, uGears, uSound, |
|
30 uLocale, uCaptions, |
30 uVisualGears, uTypes, uVariables, uCommands, uConsts |
31 uVisualGears, uTypes, uVariables, uCommands, uConsts |
31 {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF}; |
32 {$IFDEF USE_TOUCH_INTERFACE}, uTouch{$ENDIF}; |
32 |
33 |
33 procedure DoGameTick(Lag: LongInt); |
34 procedure DoGameTick(Lag: LongInt); |
34 var i: LongInt; |
35 var i,j : LongInt; |
|
36 s: shortstring; |
35 begin |
37 begin |
36 if isPaused then |
38 if isPaused then |
37 exit; |
39 exit; |
|
40 |
38 if (not CurrentTeam^.ExtDriven) then |
41 if (not CurrentTeam^.ExtDriven) then |
39 begin |
42 begin |
40 NetGetNextCmd; // its for the case of receiving "/say" message |
43 NetGetNextCmd; // its for the case of receiving "/say" message |
41 isInLag:= false; |
44 isInLag:= false; |
42 SendKeepAliveMessage(Lag) |
45 FlushMessages(Lag) |
43 end; |
46 end; |
|
47 |
44 if GameType <> gmtRecord then |
48 if GameType <> gmtRecord then |
45 begin |
49 begin |
46 if Lag > 100 then |
50 if Lag > 100 then |
47 Lag:= 100 |
51 Lag:= 100 |
48 else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then |
52 else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then |
58 else if i < 8000 then Lag:= Lag*40 |
62 else if i < 8000 then Lag:= Lag*40 |
59 else Lag:= Lag*80; |
63 else Lag:= Lag*80; |
60 end |
64 end |
61 else if cOnlyStats then |
65 else if cOnlyStats then |
62 Lag:= High(LongInt) |
66 Lag:= High(LongInt) |
|
67 end; |
|
68 inc(SoundTimerTicks, Lag); |
|
69 if SoundTimerTicks >= 50 then |
|
70 begin |
|
71 SoundTimerTicks:= 0; |
|
72 if cVolumeDelta <> 0 then |
|
73 begin |
|
74 j:= Volume; |
|
75 i:= ChangeVolume(cVolumeDelta); |
|
76 if isAudioMuted and (j<>i) then |
|
77 AddCaption(trmsg[sidMute], cWhiteColor, capgrpVolume) |
|
78 else if not isAudioMuted then |
|
79 begin |
|
80 str(i, s); |
|
81 AddCaption(Format(trmsg[sidVolume], s), cWhiteColor, capgrpVolume) |
|
82 end |
|
83 end; |
63 end; |
84 end; |
64 PlayNextVoice; |
85 PlayNextVoice; |
65 i:= 1; |
86 i:= 1; |
66 while (GameState <> gsExit) and (i <= Lag) do |
87 while (GameState <> gsExit) and (i <= Lag) do |
67 begin |
88 begin |