210 IPCWaitPongEvent |
210 IPCWaitPongEvent |
211 end; |
211 end; |
212 |
212 |
213 procedure NetGetNextCmd; |
213 procedure NetGetNextCmd; |
214 var tmpflag: boolean; |
214 var tmpflag: boolean; |
215 s: shortstring; |
215 s: shortstring; |
216 begin |
216 begin |
217 while (headcmd <> nil) and (headcmd^.cmd = 's') do |
217 tmpflag:= true; |
218 begin |
218 |
219 s:= copy(headcmd^.str, 2, Pred(headcmd^.len)); |
219 while (headcmd <> nil) and ((GameTicks = headcmd^.Time) or (headcmd^.cmd = 's')) do |
220 AddChatString(s); |
220 begin |
221 WriteLnToConsole(s); |
221 tmpflag:= true; |
222 RemoveCmd |
222 case headcmd^.cmd of |
223 end; |
223 'L': ParseCommand('+left', true); |
|
224 'l': ParseCommand('-left', true); |
|
225 'R': ParseCommand('+right', true); |
|
226 'r': ParseCommand('-right', true); |
|
227 'U': ParseCommand('+up', true); |
|
228 'u': ParseCommand('-up', true); |
|
229 'D': ParseCommand('+down', true); |
|
230 'd': ParseCommand('-down', true); |
|
231 'A': ParseCommand('+attack', true); |
|
232 'a': ParseCommand('-attack', true); |
|
233 'S': ParseCommand('switch', true); |
|
234 'j': ParseCommand('ljump', true); |
|
235 'J': ParseCommand('hjump', true); |
|
236 ',': ParseCommand('skip', true); |
|
237 's': begin |
|
238 s:= copy(headcmd^.str, 2, Pred(headcmd^.len)); |
|
239 AddChatString(s); |
|
240 WriteLnToConsole(s) |
|
241 end; |
|
242 'N': begin |
|
243 tmpflag:= false; |
|
244 {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(headcmd^.Time)){$ENDIF} |
|
245 end; |
|
246 'p': begin |
|
247 TargetPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X))); |
|
248 TargetPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y))); |
|
249 ParseCommand('put', true) |
|
250 end; |
|
251 'P': begin |
|
252 CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X)) + WorldDx); |
|
253 CursorPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y)) + WorldDy); |
|
254 end; |
|
255 'w': ParseCommand('setweap ' + headcmd^.str[2], true); |
|
256 '1'..'5': ParseCommand('timer ' + headcmd^.cmd, true); |
|
257 #128..char(128 + cMaxSlotIndex): ParseCommand('slot ' + char(byte(headcmd^.cmd) - 79), true) |
|
258 end; |
|
259 RemoveCmd |
|
260 end; |
224 |
261 |
225 if (headcmd <> nil) then |
262 if (headcmd <> nil) then |
226 TryDo(GameTicks <= headcmd^.Time, |
263 TryDo(GameTicks < headcmd^.Time, |
227 'oops, queue error. in buffer: ' + headcmd^.cmd + |
264 'oops, queue error. in buffer: ' + headcmd^.cmd + |
228 ' (' + inttostr(GameTicks) + ' > ' + |
265 ' (' + inttostr(GameTicks) + ' > ' + |
229 inttostr(headcmd^.Time) + ')', |
266 inttostr(headcmd^.Time) + ')', |
230 true); |
267 true); |
231 |
268 |
232 tmpflag:= true; |
|
233 while (headcmd <> nil) and (GameTicks = headcmd^.Time) do |
|
234 begin |
|
235 tmpflag:= true; |
|
236 case headcmd^.cmd of |
|
237 'L': ParseCommand('+left', true); |
|
238 'l': ParseCommand('-left', true); |
|
239 'R': ParseCommand('+right', true); |
|
240 'r': ParseCommand('-right', true); |
|
241 'U': ParseCommand('+up', true); |
|
242 'u': ParseCommand('-up', true); |
|
243 'D': ParseCommand('+down', true); |
|
244 'd': ParseCommand('-down', true); |
|
245 'A': ParseCommand('+attack', true); |
|
246 'a': ParseCommand('-attack', true); |
|
247 'S': ParseCommand('switch', true); |
|
248 'j': ParseCommand('ljump', true); |
|
249 'J': ParseCommand('hjump', true); |
|
250 ',': ParseCommand('skip', true); |
|
251 'N': begin |
|
252 tmpflag:= false; |
|
253 {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(headcmd^.Time)){$ENDIF} |
|
254 end; |
|
255 'p': begin |
|
256 TargetPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X))); |
|
257 TargetPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y))); |
|
258 ParseCommand('put', true) |
|
259 end; |
|
260 'P': begin |
|
261 CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X)) + WorldDx); |
|
262 CursorPoint.Y:= SmallInt(SDLNet_Read16(@(headcmd^.Y)) + WorldDy); |
|
263 end; |
|
264 'w': ParseCommand('setweap ' + headcmd^.str[2], true); |
|
265 '1'..'5': ParseCommand('timer ' + headcmd^.cmd, true); |
|
266 #128..char(128 + cMaxSlotIndex): ParseCommand('slot ' + char(byte(headcmd^.cmd) - 79), true) |
|
267 end; |
|
268 RemoveCmd |
|
269 end; |
|
270 isInLag:= (headcmd = nil) and tmpflag |
269 isInLag:= (headcmd = nil) and tmpflag |
271 end; |
270 end; |
272 |
271 |
273 end. |
272 end. |