hedgewars/uIO.pas
changeset 15908 014f4edd0421
parent 15156 7a8cc8bc963e
equal deleted inserted replaced
15907:a323e1954a6f 15908:014f4edd0421
    34 procedure LoadRecordFromFile(fileName: shortstring);
    34 procedure LoadRecordFromFile(fileName: shortstring);
    35 procedure SendStat(sit: TStatInfoType; s: shortstring);
    35 procedure SendStat(sit: TStatInfoType; s: shortstring);
    36 procedure IPCWaitPongEvent;
    36 procedure IPCWaitPongEvent;
    37 procedure IPCCheckSock;
    37 procedure IPCCheckSock;
    38 procedure NetGetNextCmd;
    38 procedure NetGetNextCmd;
    39 procedure doPut(putX, putY: LongInt; fromAI: boolean);
    39 procedure doPut(putX, putY: LongInt; fromAI, extSource: boolean);
    40 
    40 
    41 implementation
    41 implementation
    42 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug, uLocale, uSound;
    42 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug, uLocale, uSound, uDrawing;
    43 
    43 
    44 const
    44 const
    45     cSendEmptyPacketTime = 1000;
    45     cSendEmptyPacketTime = 1000;
    46     cSendBufferSize = 1024;
    46     cSendBufferSize = 1024;
    47 
    47 
   205              else
   205              else
   206                  ParseChatCommand('chatmsg ' + #4, s, 2);
   206                  ParseChatCommand('chatmsg ' + #4, s, 2);
   207              end
   207              end
   208           else
   208           else
   209              isProcessed:= false;
   209              isProcessed:= false;
       
   210      'O': begin
       
   211               s:= copy(s, 2, Length(s) - 1);
       
   212               uDrawing.handleIPCInput(s);
       
   213           end;
   210      else
   214      else
   211         isProcessed:= false;
   215         isProcessed:= false;
   212      end;
   216      end;
   213 
   217 
   214     if (not isProcessed) then
   218     if (not isProcessed) then
   441             AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime))
   445             AddFileLog('got cmd "N": time '+IntToStr(hiTicks shl 16 + headcmd^.loTime))
   442              end;
   446              end;
   443         'p': begin
   447         'p': begin
   444             x32:= SDLNet_Read32(@(headcmd^.str[2]));
   448             x32:= SDLNet_Read32(@(headcmd^.str[2]));
   445             y32:= SDLNet_Read32(@(headcmd^.str[6]));
   449             y32:= SDLNet_Read32(@(headcmd^.str[6]));
   446             doPut(x32, y32, false)
   450             doPut(x32, y32, false, true)
   447              end;
   451              end;
   448         'P': begin
   452         'P': begin
   449             // these are equations solved for CursorPoint
   453             // these are equations solved for CursorPoint
   450             // SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx;
   454             // SDLNet_Read16(@(headcmd^.X)) == CursorPoint.X - WorldDx;
   451             // SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy;
   455             // SDLNet_Read16(@(headcmd^.Y)) == cScreenHeight - CursorPoint.Y - WorldDy;
   496         halt(HaltFatalError)
   500         halt(HaltFatalError)
   497     else
   501     else
   498         halt(HaltFatalErrorNoIPC);
   502         halt(HaltFatalErrorNoIPC);
   499 end;
   503 end;
   500 
   504 
   501 procedure doPut(putX, putY: LongInt; fromAI: boolean);
   505 procedure doPut(putX, putY: LongInt; fromAI, extSource: boolean);
   502 begin
   506 begin
   503 if CheckNoTeamOrHH or isPaused then
   507 if CheckNoTeamOrHH or isPaused or (CurrentTeam^.ExtDriven and (not extSource)) or
       
   508    (CurrentHedgehog = nil) or ((CurrentHedgehog^.BotLevel <> 0) and (not fromAI)) then
   504     exit;
   509     exit;
   505 bShowFinger:= false;
   510 bShowFinger:= false;
   506 if (not CurrentTeam^.ExtDriven) and bShowAmmoMenu then
   511 if (not CurrentTeam^.ExtDriven) and bShowAmmoMenu then
   507     begin
   512     begin
   508     bSelected:= true;
   513     bSelected:= true;