22 interface |
22 interface |
23 |
23 |
24 procedure DoGameTick(Lag: LongInt); |
24 procedure DoGameTick(Lag: LongInt); |
25 |
25 |
26 //////////////////// |
26 //////////////////// |
27 implementation |
27 implementation |
28 //////////////////// |
28 //////////////////// |
29 uses uKeys, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables{$IFDEF SDL13}, uTouch{$ENDIF}; |
29 uses uKeys, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables{$IFDEF SDL13}, uTouch{$ENDIF}; |
30 |
30 |
31 procedure DoGameTick(Lag: LongInt); |
31 procedure DoGameTick(Lag: LongInt); |
32 var i: LongInt; |
32 var i: LongInt; |
33 begin |
33 begin |
34 if isPaused then exit; |
34 if isPaused then |
|
35 exit; |
35 if (not CurrentTeam^.ExtDriven) then |
36 if (not CurrentTeam^.ExtDriven) then |
36 begin |
37 begin |
37 NetGetNextCmd; // its for the case of receiving "/say" message |
38 NetGetNextCmd; // its for the case of receiving "/say" message |
38 isInLag:= false; |
39 isInLag:= false; |
39 SendKeepAliveMessage(Lag) |
40 SendKeepAliveMessage(Lag) |
40 end; |
41 end; |
41 if Lag > 100 then Lag:= 100 |
42 if Lag > 100 then |
42 else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then Lag:= 2500; |
43 Lag:= 100 |
|
44 else if (GameType = gmtSave) or (fastUntilLag and (GameType = gmtNet)) then |
|
45 Lag:= 2500; |
43 |
46 |
44 if (GameType = gmtDemo) then |
47 if (GameType = gmtDemo) then |
45 if isSpeed then Lag:= Lag * 10 |
48 if isSpeed then |
|
49 Lag:= Lag * 10 |
46 else |
50 else |
47 if cOnlyStats then Lag:= High(LongInt); |
51 if cOnlyStats then |
|
52 Lag:= High(LongInt); |
48 PlayNextVoice; |
53 PlayNextVoice; |
49 i:= 1; |
54 i:= 1; |
50 while (GameState <> gsExit) and (i <= Lag) do |
55 while (GameState <> gsExit) and (i <= Lag) do |
51 begin |
56 begin |
52 if not CurrentTeam^.ExtDriven then |
57 if not CurrentTeam^.ExtDriven then |
53 begin |
58 begin |
54 if CurrentHedgehog^.BotLevel <> 0 then ProcessBot; |
59 if CurrentHedgehog^.BotLevel <> 0 then |
55 ProcessGears; |
60 ProcessBot; |
56 {$IFDEF SDL13}ProcessTouch;{$ENDIF} |
61 ProcessGears; |
57 end else |
62 {$IFDEF SDL13}ProcessTouch;{$ENDIF} |
58 begin |
63 end |
59 NetGetNextCmd; |
64 else |
60 if isInLag then |
65 begin |
61 case GameType of |
66 NetGetNextCmd; |
|
67 if isInLag then |
|
68 case GameType of |
62 gmtNet: begin |
69 gmtNet: begin |
63 // just update the health bars |
70 // just update the health bars |
64 AddVisualGear(0, 0, vgtTeamHealthSorter); |
71 AddVisualGear(0, 0, vgtTeamHealthSorter); |
65 break; |
72 break; |
66 end; |
73 end; |
67 gmtDemo: begin |
74 gmtDemo: begin |
68 GameState:= gsExit; |
75 GameState:= gsExit; |
69 exit |
76 exit |
70 end; |
77 end; |
71 gmtSave: begin |
78 gmtSave: begin |
72 RestoreTeamsFromSave; |
79 RestoreTeamsFromSave; |
73 SetBinds(CurrentTeam^.Binds); |
80 SetBinds(CurrentTeam^.Binds); |
74 //CurrentHedgehog^.Gear^.Message:= 0; <- produces bugs with further save restoring and demos |
81 //CurrentHedgehog^.Gear^.Message:= 0; <- produces bugs with further save restoring and demos |
75 isSoundEnabled:= isSEBackup; |
82 isSoundEnabled:= isSEBackup; |
76 PlayMusic; |
83 PlayMusic; |
78 AddVisualGear(0, 0, vgtTeamHealthSorter); |
85 AddVisualGear(0, 0, vgtTeamHealthSorter); |
79 AddVisualGear(0, 0, vgtSmoothWindBar); |
86 AddVisualGear(0, 0, vgtSmoothWindBar); |
80 {$IFDEF IPHONEOS}InitIPC;{$ENDIF} |
87 {$IFDEF IPHONEOS}InitIPC;{$ENDIF} |
81 uMobile.SaveLoadingEnded(); |
88 uMobile.SaveLoadingEnded(); |
82 end; |
89 end; |
83 end |
90 end |
84 else ProcessGears |
91 else ProcessGears |
85 end; |
92 end; |
86 inc(i) |
93 inc(i) |
87 end |
94 end |
88 end; |
95 end; |
89 |
96 |
90 end. |
97 end. |