25 procedure initModule; |
25 procedure initModule; |
26 procedure freeModule; |
26 procedure freeModule; |
27 |
27 |
28 procedure InitIPC; |
28 procedure InitIPC; |
29 procedure SendIPC(s: shortstring); |
29 procedure SendIPC(s: shortstring); |
30 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
30 procedure SendIPCXY(cmd: char; X, Y: LongInt); |
31 procedure SendIPCRaw(p: pointer; len: Longword); |
31 procedure SendIPCRaw(p: pointer; len: Longword); |
32 procedure SendIPCAndWaitReply(s: shortstring); |
32 procedure SendIPCAndWaitReply(s: shortstring); |
33 procedure SendKeepAliveMessage(Lag: Longword); |
33 procedure SendKeepAliveMessage(Lag: Longword); |
34 procedure LoadRecordFromFile(fileName: shortstring); |
34 procedure LoadRecordFromFile(fileName: shortstring); |
35 procedure SendStat(sit: TStatInfoType; s: shortstring); |
35 procedure SendStat(sit: TStatInfoType; s: shortstring); |
232 begin |
232 begin |
233 SDLNet_TCP_Send(IPCSock, p, len) |
233 SDLNet_TCP_Send(IPCSock, p, len) |
234 end |
234 end |
235 end; |
235 end; |
236 |
236 |
237 procedure SendIPCXY(cmd: char; X, Y: SmallInt); |
237 procedure SendIPCXY(cmd: char; X, Y: LongInt); |
238 var s: shortstring; |
238 var s: shortstring; |
239 begin |
239 begin |
240 s[0]:= #5; |
240 s[0]:= #5; |
241 s[1]:= cmd; |
241 s[1]:= cmd; |
242 SDLNet_Write16(X, @s[2]); |
242 SDLNet_Write32(X, @s[2]); |
243 SDLNet_Write16(Y, @s[4]); |
243 SDLNet_Write32(Y, @s[4]); |
244 SendIPC(s) |
244 SendIPC(s) |
245 end; |
245 end; |
246 |
246 |
247 procedure IPCWaitPongEvent; |
247 procedure IPCWaitPongEvent; |
248 begin |
248 begin |
325 tmpflag:= false; |
325 tmpflag:= false; |
326 lastTurnChecksum:= SDLNet_Read32(@headcmd^.str[2]); |
326 lastTurnChecksum:= SDLNet_Read32(@headcmd^.str[2]); |
327 AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime)) |
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 x32:= SDLNet_Read32(@(headcmd^.X)); |
331 y16:= SDLNet_Read16(@(headcmd^.Y)); |
331 y32:= SDLNet_Read32(@(headcmd^.Y)); |
332 doPut(x16, y16, false) |
332 doPut(x32, y32, false) |
333 end; |
333 end; |
334 'P': begin |
334 'P': begin |
335 // these are equations solved for CursorPoint |
335 // these are equations solved for CursorPoint |
336 // SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx; |
336 // SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx; |
337 // SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy; |
337 // SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy; |
338 if not (CurrentTeam^.ExtDriven and bShowAmmoMenu) then |
338 if not (CurrentTeam^.ExtDriven and bShowAmmoMenu) then |
339 begin |
339 begin |
340 CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X))) + WorldDx; |
340 CursorPoint.X:= LongInt(SDLNet_Read32(@(headcmd^.X))) + WorldDx; |
341 CursorPoint.Y:= cScreenHeight - SmallInt(SDLNet_Read16(@(headcmd^.Y))) - WorldDy |
341 CursorPoint.Y:= cScreenHeight - LongInt(SDLNet_Read32(@(headcmd^.Y))) - WorldDy |
342 end |
342 end |
343 end; |
343 end; |
344 'w': ParseCommand('setweap ' + headcmd^.str[2], true); |
344 'w': ParseCommand('setweap ' + headcmd^.str[2], true); |
345 't': ParseCommand('taunt ' + headcmd^.str[2], true); |
345 't': ParseCommand('taunt ' + headcmd^.str[2], true); |
346 'h': ParseCommand('hogsay ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true); |
346 'h': ParseCommand('hogsay ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true); |