39 procedure IPCWaitPongEvent; |
39 procedure IPCWaitPongEvent; |
40 procedure IPCCheckSock; |
40 procedure IPCCheckSock; |
41 procedure InitIPC; |
41 procedure InitIPC; |
42 procedure CloseIPC; |
42 procedure CloseIPC; |
43 procedure NetGetNextCmd; |
43 procedure NetGetNextCmd; |
|
44 procedure doPut(putX, putY: LongInt; fromAI: boolean); |
44 |
45 |
45 implementation |
46 implementation |
46 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug; |
47 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug; |
47 |
48 |
48 type PCmd = ^TCmd; |
49 type PCmd = ^TCmd; |
364 procedure chFatalError(var s: shortstring); |
365 procedure chFatalError(var s: shortstring); |
365 begin |
366 begin |
366 SendIPC('E' + s); |
367 SendIPC('E' + s); |
367 end; |
368 end; |
368 |
369 |
|
370 procedure doPut(putX, putY: LongInt; fromAI: boolean); |
|
371 begin |
|
372 if CheckNoTeamOrHH or isPaused then exit; |
|
373 if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; |
|
374 bShowFinger:= false; |
|
375 if not CurrentTeam^.ExtDriven and bShowAmmoMenu then |
|
376 begin |
|
377 bSelected:= true; |
|
378 exit |
|
379 end; |
|
380 |
|
381 with CurrentHedgehog^.Gear^, |
|
382 CurrentHedgehog^ do |
|
383 if (State and gstHHChooseTarget) <> 0 then |
|
384 begin |
|
385 isCursorVisible:= false; |
|
386 if not CurrentTeam^.ExtDriven then |
|
387 begin |
|
388 if fromAI then |
|
389 begin |
|
390 TargetPoint.X:= putX; |
|
391 TargetPoint.Y:= putY |
|
392 end else |
|
393 begin |
|
394 TargetPoint.X:= CursorPoint.X - WorldDx; |
|
395 TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy; |
|
396 end; |
|
397 SendIPCXY('p', TargetPoint.X, TargetPoint.Y); |
|
398 end |
|
399 else |
|
400 begin |
|
401 TargetPoint.X:= putX; |
|
402 TargetPoint.Y:= putY |
|
403 end; |
|
404 {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF} |
|
405 State:= State and not gstHHChooseTarget; |
|
406 if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AttackingPut) <> 0 then |
|
407 Message:= Message or gmAttack; |
|
408 end |
|
409 else |
|
410 if CurrentTeam^.ExtDriven then |
|
411 OutError('got /put while not being in choose target mode', false) |
|
412 end; |
|
413 |
369 procedure initModule; |
414 procedure initModule; |
370 begin |
415 begin |
371 RegisterVariable('fatal', vtCommand, @chFatalError, true ); |
416 RegisterVariable('fatal', vtCommand, @chFatalError, true ); |
372 |
417 |
373 IPCSock:= nil; |
418 IPCSock:= nil; |