hedgewars/uCommandHandlers.pas
changeset 15897 d7b53d08ad9c
parent 15667 fb1f47e382d0
child 15908 014f4edd0421
child 15929 128ace913837
child 15983 416bca0a172c
equal deleted inserted replaced
15894:c09063ea0267 15897:d7b53d08ad9c
   883 end;
   883 end;
   884 
   884 
   885 procedure chFastUntilLag(var s: shortstring);
   885 procedure chFastUntilLag(var s: shortstring);
   886 begin
   886 begin
   887     fastUntilLag:= StrToInt(s) <> 0;
   887     fastUntilLag:= StrToInt(s) <> 0;
       
   888     fastForward:= fastUntilLag;
   888 
   889 
   889     if not fastUntilLag then
   890     if not fastUntilLag then
   890     begin
   891     begin
   891         // update health bars and the wind indicator
   892         // update health bars and the wind indicator
   892         AddVisualGear(0, 0, vgtTeamHealthSorter);
   893         AddVisualGear(0, 0, vgtTeamHealthSorter);
   893         AddVisualGear(0, 0, vgtSmoothWindBar)
   894         AddVisualGear(0, 0, vgtSmoothWindBar)
   894     end
   895     end
       
   896 end;
       
   897 
       
   898 procedure chFastForward(var cmd: shortstring);
       
   899 var str0, str1, str2 : shortstring;
       
   900     h, m, s : integer;
       
   901 begin
       
   902    if gameType <> gmtDemo then
       
   903       exit;
       
   904    if CountChar(cmd, ':') > 2 then
       
   905       exit;
       
   906    str0:= cmd;
       
   907    SplitByChar(str0, str1, ':');
       
   908    SplitByChar(str1, str2, ':');
       
   909    if str2 <> '' then
       
   910    begin
       
   911       h:= StrToInt(str0);
       
   912       m:= StrToInt(str1);
       
   913       s:= StrToInt(str2)
       
   914    end
       
   915    else if str1 <> '' then
       
   916    begin
       
   917       h:= 0;
       
   918       m:= StrToInt(str0);
       
   919       s:= StrToInt(str1)
       
   920    end
       
   921    else
       
   922    begin
       
   923       h:= 0;
       
   924       m:= 0;
       
   925       s:= StrToInt(str0)
       
   926    end;
       
   927    FFGameTick:= (s + m * 60 + h * 60 * 60) * 1000;
       
   928    if FFGameTick > GameTicks then
       
   929    begin
       
   930       fastUntilLag:= True;
       
   931       fastForward:= True;
       
   932    end
       
   933 end;
       
   934 
       
   935 procedure chStopFastForward(var s: shortstring);
       
   936 begin
       
   937    if gameType <> gmtDemo then
       
   938       exit;
       
   939    fastUntilLag:= False;
       
   940    fastForward:= False;
       
   941    AddVisualGear(0, 0, vgtTeamHealthSorter);
       
   942    AddVisualGear(0, 0, vgtSmoothWindBar)
   895 end;
   943 end;
   896 
   944 
   897 procedure chCampVar(var s:shortstring);
   945 procedure chCampVar(var s:shortstring);
   898 begin
   946 begin
   899   CampaignVariable := s;
   947   CampaignVariable := s;
  1024     RegisterVariable('campvar' , @chCampVar      , true );
  1072     RegisterVariable('campvar' , @chCampVar      , true );
  1025     RegisterVariable('missvar' , @chMissVar      , true );
  1073     RegisterVariable('missvar' , @chMissVar      , true );
  1026     RegisterVariable('record'  , @chRecord       , true );
  1074     RegisterVariable('record'  , @chRecord       , true );
  1027     RegisterVariable('worldedge',@chWorldEdge    , false);
  1075     RegisterVariable('worldedge',@chWorldEdge    , false);
  1028     RegisterVariable('advmapgen',@chAdvancedMapGenMode, false);
  1076     RegisterVariable('advmapgen',@chAdvancedMapGenMode, false);
       
  1077     RegisterVariable('ff'      , @chFastForward  , true);
       
  1078     RegisterVariable('sff'     , @chStopFastForward, true);
  1029     RegisterVariable('+mission', @chShowMission_p, true);
  1079     RegisterVariable('+mission', @chShowMission_p, true);
  1030     RegisterVariable('-mission', @chShowMission_m, true);
  1080     RegisterVariable('-mission', @chShowMission_m, true);
  1031     RegisterVariable('gearinfo', @chGearInfo     , true );
  1081     RegisterVariable('gearinfo', @chGearInfo     , true );
  1032     RegisterVariable('timer_u' , @chTimerU       , true );
  1082     RegisterVariable('timer_u' , @chTimerU       , true );
  1033 end;
  1083 end;