hedgewars/uCommandHandlers.pas
changeset 7629 d624030abf24
parent 7628 bc7b1d228a2c
child 7671 43f38923bc6e
equal deleted inserted replaced
7628:bc7b1d228a2c 7629:d624030abf24
    24 
    24 
    25 procedure initModule;
    25 procedure initModule;
    26 procedure freeModule;
    26 procedure freeModule;
    27 
    27 
    28 implementation
    28 implementation
    29 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom, uCaptions;
    29 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uRandom, uCaptions
       
    30      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
    30 
    31 
    31 var prevGState: TGameState = gsConfirm;
    32 var prevGState: TGameState = gsConfirm;
    32 
    33 
    33 procedure chGenCmd(var s: shortstring);
    34 procedure chGenCmd(var s: shortstring);
    34 begin
    35 begin
   526 
   527 
   527 procedure chCapture(var s: shortstring);
   528 procedure chCapture(var s: shortstring);
   528 begin
   529 begin
   529 s:= s; // avoid compiler hint
   530 s:= s; // avoid compiler hint
   530 flagMakeCapture:= true
   531 flagMakeCapture:= true
       
   532 end;
       
   533 
       
   534 procedure chRecord(var s: shortstring);
       
   535 begin
       
   536 s:= s; // avoid compiler hint
       
   537 {$IFDEF USE_VIDEO_RECORDING}
       
   538 if flagPrerecording then
       
   539     StopPreRecording()
       
   540 else
       
   541     BeginPreRecording();
       
   542 {$ENDIF}
   531 end;
   543 end;
   532 
   544 
   533 procedure chSetMap(var s: shortstring);
   545 procedure chSetMap(var s: shortstring);
   534 begin
   546 begin
   535 if isDeveloperMode then
   547 if isDeveloperMode then
   612 begin
   624 begin
   613 s:= s; // avoid compiler hint
   625 s:= s; // avoid compiler hint
   614 if CheckNoTeamOrHH or isPaused then
   626 if CheckNoTeamOrHH or isPaused then
   615     exit;
   627     exit;
   616 
   628 
   617 if FollowGear <> nil then
   629 if autoCameraOn then
   618     begin
   630     begin
       
   631     FollowGear:= nil;
   619     AddCaption('Auto Camera Off', $CCCCCC, capgrpVolume);
   632     AddCaption('Auto Camera Off', $CCCCCC, capgrpVolume);
   620     autoCameraOn:= false
   633     autoCameraOn:= false
   621     end
   634     end
   622     else
   635 else
   623         begin
   636     begin
   624     AddCaption('Auto Camera On', $CCCCCC, capgrpVolume);
   637     AddCaption('Auto Camera On', $CCCCCC, capgrpVolume);
   625     bShowFinger:= true;
   638     bShowFinger:= true;
   626     if not CurrentHedgehog^.Unplaced then
   639     if not CurrentHedgehog^.Unplaced then
   627         FollowGear:= CurrentHedgehog^.Gear;
   640         FollowGear:= CurrentHedgehog^.Gear;
   628     autoCameraOn:= true
   641     autoCameraOn:= true
   651 end;
   664 end;
   652 
   665 
   653 procedure chSpeedup_p(var s: shortstring);
   666 procedure chSpeedup_p(var s: shortstring);
   654 begin
   667 begin
   655 s:= s; // avoid compiler hint
   668 s:= s; // avoid compiler hint
       
   669 SpeedStart:= RealTicks;
   656 isSpeed:= true
   670 isSpeed:= true
   657 end;
   671 end;
   658 
   672 
   659 procedure chSpeedup_m(var s: shortstring);
   673 procedure chSpeedup_m(var s: shortstring);
   660 begin
   674 begin
   763 end;
   777 end;
   764 
   778 
   765 procedure chGameFlags(var s: shortstring);
   779 procedure chGameFlags(var s: shortstring);
   766 begin
   780 begin
   767 GameFlags:= StrToInt(s);
   781 GameFlags:= StrToInt(s);
   768 if GameFlags and gfSharedAmmo <> 0 then GameFlags:= GameFlags and not gfPerHogAmmo
   782 if GameFlags and gfSharedAmmo <> 0 then GameFlags:= GameFlags and (not gfPerHogAmmo)
   769 end;
   783 end;
   770 
   784 
   771 procedure chHedgehogTurnTime(var s: shortstring);
   785 procedure chHedgehogTurnTime(var s: shortstring);
   772 begin
   786 begin
   773 cHedgehogTurnTime:= StrToInt(s)
   787 cHedgehogTurnTime:= StrToInt(s)
   795     RegisterVariable('-right'  , @chRight_m      , false, true);
   809     RegisterVariable('-right'  , @chRight_m      , false, true);
   796     RegisterVariable('+up'     , @chUp_p         , false, true);
   810     RegisterVariable('+up'     , @chUp_p         , false, true);
   797     RegisterVariable('-up'     , @chUp_m         , false, true);
   811     RegisterVariable('-up'     , @chUp_m         , false, true);
   798     RegisterVariable('+left'   , @chLeft_p       , false, true);
   812     RegisterVariable('+left'   , @chLeft_p       , false, true);
   799     RegisterVariable('-left'   , @chLeft_m       , false, true);
   813     RegisterVariable('-left'   , @chLeft_m       , false, true);
   800     RegisterVariable('+attack' , @chAttack_p     , false, false); // WTF?
   814     RegisterVariable('+attack' , @chAttack_p     , false);
   801     RegisterVariable('+down'   , @chDown_p       , false, true);
   815     RegisterVariable('+down'   , @chDown_p       , false, true);
   802     RegisterVariable('-down'   , @chDown_m       , false, true);
   816     RegisterVariable('-down'   , @chDown_m       , false, true);
   803     RegisterVariable('hjump'   , @chHJump        , false, true);
   817     RegisterVariable('hjump'   , @chHJump        , false, true);
   804     RegisterVariable('ljump'   , @chLJump        , false, true);
   818     RegisterVariable('ljump'   , @chLJump        , false, true);
   805     RegisterVariable('nextturn', @chNextTurn     , false, false);
   819     RegisterVariable('nextturn', @chNextTurn     , false);
   806     RegisterVariable('-attack' , @chAttack_m     , false, false);
   820     RegisterVariable('-attack' , @chAttack_m     , false);
   807     RegisterVariable('slot'    , @chSlot         , false, true);
   821     RegisterVariable('slot'    , @chSlot         , false);
   808     RegisterVariable('setweap' , @chSetWeapon    , false, true);
   822     RegisterVariable('setweap' , @chSetWeapon    , false, true);
   809 //////// End top by freq analysis
   823 //////// End top by freq analysis
   810     RegisterVariable('gencmd'  , @chGenCmd       , false, true);
   824     RegisterVariable('gencmd'  , @chGenCmd       , false);
   811     RegisterVariable('flag'    , @chFlag         , false);
   825     RegisterVariable('flag'    , @chFlag         , false);
   812     RegisterVariable('script'  , @chScript       , false);
   826     RegisterVariable('script'  , @chScript       , false);
   813     RegisterVariable('proto'   , @chCheckProto   , true );
   827     RegisterVariable('proto'   , @chCheckProto   , true );
   814     RegisterVariable('spectate', @chFastUntilLag   , false);
   828     RegisterVariable('spectate', @chFastUntilLag   , false);
   815     RegisterVariable('capture' , @chCapture      , true );
   829     RegisterVariable('capture' , @chCapture      , true );
   849     RegisterVariable('-speedup', @chSpeedup_m    , true );
   863     RegisterVariable('-speedup', @chSpeedup_m    , true );
   850     RegisterVariable('zoomin'  , @chZoomIn       , true );
   864     RegisterVariable('zoomin'  , @chZoomIn       , true );
   851     RegisterVariable('zoomout' , @chZoomOut      , true );
   865     RegisterVariable('zoomout' , @chZoomOut      , true );
   852     RegisterVariable('zoomreset',@chZoomReset    , true );
   866     RegisterVariable('zoomreset',@chZoomReset    , true );
   853     RegisterVariable('ammomenu', @chAmmoMenu     , true);
   867     RegisterVariable('ammomenu', @chAmmoMenu     , true);
   854     RegisterVariable('+precise', @chPrecise_p    , false);
   868     RegisterVariable('+precise', @chPrecise_p    , false, true);
   855     RegisterVariable('-precise', @chPrecise_m    , false);
   869     RegisterVariable('-precise', @chPrecise_m    , false, true);
   856     RegisterVariable('switch'  , @chSwitch       , false);
   870     RegisterVariable('switch'  , @chSwitch       , false);
   857     RegisterVariable('timer'   , @chTimer        , false);
   871     RegisterVariable('timer'   , @chTimer        , false, true);
   858     RegisterVariable('taunt'   , @chTaunt        , false);
   872     RegisterVariable('taunt'   , @chTaunt        , false);
   859     RegisterVariable('put'     , @chPut          , false);
   873     RegisterVariable('put'     , @chPut          , false);
   860     RegisterVariable('+volup'  , @chVol_p        , true );
   874     RegisterVariable('+volup'  , @chVol_p        , true );
   861     RegisterVariable('-volup'  , @chVol_m        , true );
   875     RegisterVariable('-volup'  , @chVol_m        , true );
   862     RegisterVariable('+voldown', @chVol_m        , true );
   876     RegisterVariable('+voldown', @chVol_m        , true );
   870     RegisterVariable('+cur_l'  , @chCurL_p       , true );
   884     RegisterVariable('+cur_l'  , @chCurL_p       , true );
   871     RegisterVariable('-cur_l'  , @chCurL_m       , true );
   885     RegisterVariable('-cur_l'  , @chCurL_m       , true );
   872     RegisterVariable('+cur_r'  , @chCurR_p       , true );
   886     RegisterVariable('+cur_r'  , @chCurR_p       , true );
   873     RegisterVariable('-cur_r'  , @chCurR_m       , true );
   887     RegisterVariable('-cur_r'  , @chCurR_m       , true );
   874     RegisterVariable('campvar' , @chCampVar      , true );
   888     RegisterVariable('campvar' , @chCampVar      , true );
       
   889     RegisterVariable('record'  , @chRecord       , true );
   875 end;
   890 end;
   876 
   891 
   877 procedure freeModule;
   892 procedure freeModule;
   878 begin
   893 begin
   879 end;
   894 end;