equal
deleted
inserted
replaced
119 |
119 |
120 procedure ParseIPCCommand(s: shortstring); |
120 procedure ParseIPCCommand(s: shortstring); |
121 var loTicks: Word; |
121 var loTicks: Word; |
122 begin |
122 begin |
123 case s[1] of |
123 case s[1] of |
124 '!': begin {$IFDEF DEBUGFILE}AddFileLog('Ping? Pong!');{$ENDIF}isPonged:= true; end; |
124 '!': begin AddFileLog('Ping? Pong!'); isPonged:= true; end; |
125 '?': SendIPC('!'); |
125 '?': SendIPC('!'); |
126 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); |
126 'e': ParseCommand(copy(s, 2, Length(s) - 1), true); |
127 'E': OutError(copy(s, 2, Length(s) - 1), true); |
127 'E': OutError(copy(s, 2, Length(s) - 1), true); |
128 'W': OutError(copy(s, 2, Length(s) - 1), false); |
128 'W': OutError(copy(s, 2, Length(s) - 1), false); |
129 'M': ParseCommand('landcheck ' + s, true); |
129 'M': ParseCommand('landcheck ' + s, true); |
134 'S': GameType:= gmtSave; |
134 'S': GameType:= gmtSave; |
135 else OutError(errmsgIncorrectUse + ' IPC "T" :' + s[2], true) end; |
135 else OutError(errmsgIncorrectUse + ' IPC "T" :' + s[2], true) end; |
136 else |
136 else |
137 loTicks:= SDLNet_Read16(@s[byte(s[0]) - 1]); |
137 loTicks:= SDLNet_Read16(@s[byte(s[0]) - 1]); |
138 AddCmd(loTicks, s); |
138 AddCmd(loTicks, s); |
139 {$IFDEF DEBUGFILE}AddFileLog('[IPC in] '+s[1]+' ticks '+IntToStr(lastcmd^.loTime));{$ENDIF} |
139 AddFileLog('[IPC in] '+s[1]+' ticks '+IntToStr(lastcmd^.loTime)); |
140 end |
140 end |
141 end; |
141 end; |
142 |
142 |
143 procedure IPCCheckSock; |
143 procedure IPCCheckSock; |
144 const ss: shortstring = ''; |
144 const ss: shortstring = ''; |
215 if IPCSock <> nil then |
215 if IPCSock <> nil then |
216 begin |
216 begin |
217 SendEmptyPacketTicks:= 0; |
217 SendEmptyPacketTicks:= 0; |
218 if s[0]>#251 then s[0]:= #251; |
218 if s[0]>#251 then s[0]:= #251; |
219 SDLNet_Write16(GameTicks, @s[Succ(byte(s[0]))]); |
219 SDLNet_Write16(GameTicks, @s[Succ(byte(s[0]))]); |
220 {$IFDEF DEBUGFILE}AddFileLog('[IPC out] '+ s[1]);{$ENDIF} |
220 AddFileLog('[IPC out] '+ s[1]); |
221 inc(s[0], 2); |
221 inc(s[0], 2); |
222 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0]))) |
222 SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0]))) |
223 end |
223 end |
224 end; |
224 end; |
225 |
225 |
242 end; |
242 end; |
243 |
243 |
244 procedure SendIPCTimeInc; |
244 procedure SendIPCTimeInc; |
245 const timeinc: shortstring = '#'; |
245 const timeinc: shortstring = '#'; |
246 begin |
246 begin |
247 {$IFDEF DEBUGFILE}AddFileLog('[IPC out] <time increment>');{$ENDIF} |
247 AddFileLog('[IPC out] <time increment>'); |
248 SendIPCRaw(@timeinc, 2) |
248 SendIPCRaw(@timeinc, 2) |
249 end; |
249 end; |
250 |
250 |
251 procedure IPCWaitPongEvent; |
251 procedure IPCWaitPongEvent; |
252 begin |
252 begin |
322 end; |
322 end; |
323 // TODO: deprecate 'F' |
323 // TODO: deprecate 'F' |
324 'F': ParseCommand('teamgone ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true); |
324 'F': ParseCommand('teamgone ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true); |
325 'N': begin |
325 'N': begin |
326 tmpflag:= false; |
326 tmpflag:= false; |
327 {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF} |
327 AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime)) |
328 end; |
328 end; |
329 'p': begin |
329 'p': begin |
330 x16:= SDLNet_Read16(@(headcmd^.X)); |
330 x16:= SDLNet_Read16(@(headcmd^.X)); |
331 y16:= SDLNet_Read16(@(headcmd^.Y)); |
331 y16:= SDLNet_Read16(@(headcmd^.Y)); |
332 doPut(x16, y16, false) |
332 doPut(x16, y16, false) |
400 else |
400 else |
401 begin |
401 begin |
402 TargetPoint.X:= putX; |
402 TargetPoint.X:= putX; |
403 TargetPoint.Y:= putY |
403 TargetPoint.Y:= putY |
404 end; |
404 end; |
405 {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} |
405 AddFileLog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y)); |
406 State:= State and not gstHHChooseTarget; |
406 State:= State and not gstHHChooseTarget; |
407 if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then |
407 if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then |
408 Message:= Message or (gmAttack and InputMask); |
408 Message:= Message or (gmAttack and InputMask); |
409 end |
409 end |
410 else |
410 else |