# HG changeset patch # User nemo # Date 1292368734 18000 # Node ID 4ea193b0e378dceeaeee33bef97403263cd8f67f # Parent 984f74b2f49880fed45afc08df4916dc4ca3fd18 Reenable ReadyTimer using a synced message NEEDS TESTING. diff -r 984f74b2f498 -r 4ea193b0e378 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Tue Dec 14 17:47:53 2010 -0500 +++ b/hedgewars/uCommandHandlers.pas Tue Dec 14 18:18:54 2010 -0500 @@ -9,6 +9,18 @@ implementation uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom; +procedure chGenCmd(var s: shortstring); +begin +AddFileLog('uhoh'); +case s[1] of + 'R': if ReadyTimeLeft > 1 then + begin + ReadyTimeLeft:= 1; + if not CurrentTeam^.ExtDriven then SendIPC('c'+s); + end + end +end; + procedure chQuit(var s: shortstring); const prevGState: TGameState = gsConfirm; begin @@ -152,7 +164,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('L'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmLeft and InputMask) @@ -172,7 +183,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('R'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmRight and InputMask) @@ -192,7 +202,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('U'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmUp and InputMask) @@ -212,7 +221,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('D'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmDown and InputMask) @@ -232,7 +240,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('Z'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmPrecise and InputMask); @@ -252,7 +259,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('j'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmLJump and InputMask) @@ -263,7 +269,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('J'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmHJump and InputMask) @@ -273,7 +278,6 @@ begin s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do begin @@ -304,7 +308,6 @@ s:= s; // avoid compiler hint if CheckNoTeamOrHH or isPaused then exit; if not CurrentTeam^.ExtDriven then SendIPC('S'); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do Message:= Message or (gmSwitch and InputMask) @@ -326,7 +329,6 @@ if (s[0] <> #1) or (s[1] < '1') or (s[1] > '5') or CheckNoTeamOrHH then exit; if not CurrentTeam^.ExtDriven then SendIPC(s); -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do begin @@ -342,7 +344,6 @@ 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 ReadyTimeLeft:= 1; bShowFinger:= false; with CurrentHedgehog^.Gear^ do begin @@ -438,7 +439,6 @@ ((MultiShootAttacks > 0) and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0)) or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true end; - if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1 end end; @@ -465,7 +465,6 @@ procedure chPause(var s: shortstring); begin s:= s; // avoid compiler hint -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; if gameType <> gmtNet then isPaused:= not isPaused; SDL_ShowCursor(ord(isPaused)) @@ -529,6 +528,7 @@ RegisterVariable('slot' , vtCommand, @chSlot , false); RegisterVariable('setweap' , vtCommand, @chSetWeapon , false); //////// End top by freq analysis + RegisterVariable('gencmd' , vtCommand, @chGenCmd , false); RegisterVariable('flag' , vtCommand, @chFlag , false); RegisterVariable('script' , vtCommand, @chScript , false); RegisterVariable('proto' , vtCommand, @chCheckProto , true ); diff -r 984f74b2f498 -r 4ea193b0e378 hedgewars/uIO.pas --- a/hedgewars/uIO.pas Tue Dec 14 17:47:53 2010 -0500 +++ b/hedgewars/uIO.pas Tue Dec 14 18:18:54 2010 -0500 @@ -309,6 +309,10 @@ 'j': ParseCommand('ljump', true); 'J': ParseCommand('hjump', true); ',': ParseCommand('skip', true); + 'c': begin + s:= copy(headcmd^.str, 2, Pred(headcmd^.len)); + ParseCommand('gencmd ' + s, true); + end; 's': begin s:= copy(headcmd^.str, 2, Pred(headcmd^.len)); ParseCommand('chatmsg ' + s, true); @@ -371,7 +375,6 @@ procedure doPut(putX, putY: LongInt; fromAI: boolean); begin if CheckNoTeamOrHH or isPaused then exit; -if ReadyTimeLeft > 1 then ReadyTimeLeft:= 1; bShowFinger:= false; if not CurrentTeam^.ExtDriven and bShowAmmoMenu then begin diff -r 984f74b2f498 -r 4ea193b0e378 hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Tue Dec 14 17:47:53 2010 -0500 +++ b/hedgewars/uKeys.pas Tue Dec 14 18:18:54 2010 -0500 @@ -171,14 +171,19 @@ if CurrentBinds[i][0] <> #0 then begin if (i > 3) and (tkbdn[i] <> 0) and not ((CurrentBinds[i] = 'put') or (CurrentBinds[i] = 'ammomenu') or (CurrentBinds[i] = '+cur_u') or (CurrentBinds[i] = '+cur_d') or (CurrentBinds[i] = '+cur_l') or (CurrentBinds[i] = '+cur_r')) then hideAmmoMenu:= true; - if (tkbd[i] = 0) and (tkbdn[i] <> 0) then ParseCommand(CurrentBinds[i], Trusted) + if (tkbd[i] = 0) and (tkbdn[i] <> 0) then + begin + ParseCommand(CurrentBinds[i], Trusted); + if (CurrentTeam <> nil) and not CurrentTeam^.ExtDriven and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true) + end else if (CurrentBinds[i][1] = '+') and (tkbdn[i] = 0) and (tkbd[i] <> 0) then begin s:= CurrentBinds[i]; s[1]:= '-'; - ParseCommand(s, Trusted) + ParseCommand(s, Trusted); + if (CurrentTeam <> nil) and not CurrentTeam^.ExtDriven and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true) end; tkbd[i]:= tkbdn[i] end diff -r 984f74b2f498 -r 4ea193b0e378 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Tue Dec 14 17:47:53 2010 -0500 +++ b/hedgewars/uVariables.pas Tue Dec 14 18:18:54 2010 -0500 @@ -23,7 +23,7 @@ cReducedQuality : LongWord = rqNone; //userNick is in uChat recordFileName : shortstring = ''; - cReadyDelay : Longword = 0; + cReadyDelay : Longword = 5000; cLogfileBase : shortstring = 'debug'; ////////////////////////// @@ -2248,7 +2248,7 @@ cReducedQuality := rqNone; //userNick is in uChat recordFileName := ''; - cReadyDelay := 0; + cReadyDelay := 5000; end; end.