Engine:
authorsmaxx
Thu, 26 Aug 2010 22:41:36 +0200
changeset 3776 28849f5a03c9
parent 3775 c0397452e7c5
child 3777 5276f2150d65
Engine: * Made all keybinds skip ready time
hedgewars/CCHandlers.inc
--- a/hedgewars/CCHandlers.inc	Thu Aug 26 22:38:25 2010 +0200
+++ b/hedgewars/CCHandlers.inc	Thu Aug 26 22:41:36 2010 +0200
@@ -289,9 +289,10 @@
 procedure chLeft_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('L');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('L');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_Left
 end;
@@ -308,9 +309,10 @@
 procedure chRight_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('R');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('R');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_Right
 end;
@@ -327,9 +329,10 @@
 procedure chUp_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('U');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('U');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_Up
 end;
@@ -346,9 +349,10 @@
 procedure chDown_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('D');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('D');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_Down
 end;
@@ -365,9 +369,10 @@
 procedure chPrecise_p(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('Z');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('Z');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_Precise
 end;
@@ -384,9 +389,10 @@
 procedure chLJump(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('j');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('j');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_LJump
 end;
@@ -394,9 +400,10 @@
 procedure chHJump(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if not CurrentTeam^.ExtDriven then SendIPC('J');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 bShowFinger:= false;
-if not CurrentTeam^.ExtDriven then SendIPC('J');
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_HJump
 end;
@@ -439,8 +446,10 @@
 procedure chSwitch(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('S');
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
+bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     Message:= Message or gm_Switch
 end;
@@ -483,9 +492,10 @@
 procedure chTimer(var s: shortstring);
 begin
 if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit;
-bShowFinger:= false;
 
 if not CurrentTeam^.ExtDriven then SendIPC(s);
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
+bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     begin
     Message:= Message or gm_Timer;
@@ -497,10 +507,11 @@
 var slot: LongWord;
 begin
 if (s[0] <> #1) or CheckNoTeamOrHH then exit;
-bShowFinger:= false;
 slot:= byte(s[1]) - 49;
 if slot > cMaxSlotIndex then exit;
 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
+bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
     begin
     Message:= Message or gm_Slot;
@@ -572,7 +583,9 @@
 
 procedure chNewGrave;
 begin
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 
 if not CurrentTeam^.ExtDriven then SendIPC('g');
 
@@ -581,7 +594,9 @@
 
 procedure doPut(putX, putY: LongInt; fromAI: boolean);
 begin
-if CheckNoTeamOrHH or isPaused or (ReadyTimeLeft > 0) then exit;
+if CheckNoTeamOrHH or isPaused then exit;
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
+bShowFinger:= false;
 if not CurrentTeam^.ExtDriven and bShowAmmoMenu then
     begin
     bSelected:= true;
@@ -785,6 +800,7 @@
 procedure chPause(var s: shortstring);
 begin
 s:= s; // avoid compiler hint
+if ReadyTimeLeft > 1 then begin ReadyTimeLeft:= 1; exit end;
 if gameType <> gmtNet then
     isPaused:= not isPaused;
 SDL_ShowCursor(ord(isPaused))