hedgewars/uIO.pas
changeset 2645 89aa2aa89066
parent 2643 2074393d4db7
child 2691 c0da3a98c01c
equal deleted inserted replaced
2644:52b7c4776af9 2645:89aa2aa89066
   259 end;
   259 end;
   260 
   260 
   261 procedure NetGetNextCmd;
   261 procedure NetGetNextCmd;
   262 var tmpflag: boolean;
   262 var tmpflag: boolean;
   263 	s: shortstring;
   263 	s: shortstring;
       
   264 	x16, y16: SmallInt;
   264 begin
   265 begin
   265 tmpflag:= true;
   266 tmpflag:= true;
   266 
   267 
   267 while (headcmd <> nil)
   268 while (headcmd <> nil)
   268 	and (tmpflag or (headcmd^.cmd = '#')) // '#' is the only cmd which can be sent within same tick after 'N'
   269 	and (tmpflag or (headcmd^.cmd = '#')) // '#' is the only cmd which can be sent within same tick after 'N'
   305 		'N': begin
   306 		'N': begin
   306 			tmpflag:= false;
   307 			tmpflag:= false;
   307 			{$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF}
   308 			{$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(hiTicks shl 16 + headcmd^.loTime)){$ENDIF}
   308 			end;
   309 			end;
   309 		'p': begin
   310 		'p': begin
   310 			TargetPoint.X:= SDLNet_Read16(@(headcmd^.X));
   311 			x16:= SDLNet_Read16(@(headcmd^.X));
   311 			TargetPoint.Y:= SDLNet_Read16(@(headcmd^.Y));
   312 			y16:= SDLNet_Read16(@(headcmd^.Y));
   312 			doPut(TargetPoint.X, TargetPoint.Y, true)
   313 			doPut(x16, y16, false)
   313 			end;
   314 			end;
   314 		'P': begin
   315 		'P': begin
   315 			// these are equations solved for CursorPoint
   316 			// these are equations solved for CursorPoint
   316 			// SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx;
   317 			// SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx;
   317 			// SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy;
   318 			// SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy;
   318 			CursorPoint.X:= SDLNet_Read16(@(headcmd^.X)) + WorldDx;
   319 			CursorPoint.X:= SmallInt(SDLNet_Read16(@(headcmd^.X))) + WorldDx;
   319 			CursorPoint.Y:= cScreenHeight - SDLNet_Read16(@(headcmd^.Y)) - WorldDy;
   320 			CursorPoint.Y:= cScreenHeight - SmallInt(SDLNet_Read16(@(headcmd^.Y))) - WorldDy;
   320 			end;
   321 			end;
   321 		'w': ParseCommand('setweap ' + headcmd^.str[2], true);
   322 		'w': ParseCommand('setweap ' + headcmd^.str[2], true);
   322 		't': ParseCommand('taunt ' + headcmd^.str[2], true);
   323 		't': ParseCommand('taunt ' + headcmd^.str[2], true);
   323 		'g': ParseCommand('newgrave', true);
   324 		'g': ParseCommand('newgrave', true);
   324 		'h': ParseCommand('hogsay ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);
   325 		'h': ParseCommand('hogsay ' + copy(headcmd^.str, 2, Pred(headcmd^.len)), true);