hedgewars/uCommandHandlers.pas
changeset 6898 344b0dbd9690
parent 6828 6a5d33bff0b0
child 6982 8d41d22a291d
equal deleted inserted replaced
6897:a9126661f613 6898:344b0dbd9690
   657 begin
   657 begin
   658     s:= s; // avoid compiler hint
   658     s:= s; // avoid compiler hint
   659     ZoomValue:= cDefaultZoomLevel;
   659     ZoomValue:= cDefaultZoomLevel;
   660 end;
   660 end;
   661 
   661 
       
   662 procedure chMapGen(var s: shortstring);
       
   663 begin
       
   664 val(s, cMapGen)
       
   665 end;
       
   666 
       
   667 procedure chTemplateFilter(var s: shortstring);
       
   668 begin
       
   669 val(s, cTemplateFilter)
       
   670 end;
       
   671 
       
   672 procedure chInactDelay(var s: shortstring);
       
   673 begin
       
   674 val(s, cInactDelay)
       
   675 end;
       
   676 
       
   677 procedure chReadyDelay(var s: shortstring);
       
   678 begin
       
   679 val(s, cReadyDelay)
       
   680 end;
       
   681 
       
   682 procedure chCaseFactor(var s: shortstring);
       
   683 begin
       
   684 val(s, cCaseFactor)
       
   685 end;
       
   686 
       
   687 procedure chHealthCaseProb(var s: shortstring);
       
   688 begin
       
   689 val(s, cHealthCaseProb)
       
   690 end;
       
   691 
       
   692 procedure chHealthCaseAmount(var s: shortstring);
       
   693 begin
       
   694 val(s, cHealthCaseAmount)
       
   695 end;
       
   696 
       
   697 procedure chSuddenDTurns(var s: shortstring);
       
   698 begin
       
   699 val(s, cSuddenDTurns)
       
   700 end;
       
   701 
       
   702 procedure chWaterRise(var s: shortstring);
       
   703 begin
       
   704 val(s, cWaterRise)
       
   705 end;
       
   706 
       
   707 procedure chHealthDecrease(var s: shortstring);
       
   708 begin
       
   709 val(s, cHealthDecrease)
       
   710 end;
       
   711 
       
   712 procedure chDamagePercent(var s: shortstring);
       
   713 begin
       
   714 val(s, cDamagePercent)
       
   715 end;
       
   716 
       
   717 procedure chRopePercent(var s: shortstring);
       
   718 begin
       
   719 val(s, cRopePercent)
       
   720 end;
       
   721 
       
   722 procedure chGetAwayTime(var s: shortstring);
       
   723 begin
       
   724 val(s, cGetAwayTime)
       
   725 end;
       
   726 
       
   727 procedure chMineDudPercent(var s: shortstring);
       
   728 begin
       
   729 val(s, cMineDudPercent)
       
   730 end;
       
   731 
       
   732 procedure chLandMines(var s: shortstring);
       
   733 begin
       
   734 val(s, cLandMines)
       
   735 end;
       
   736 
       
   737 procedure chExplosives(var s: shortstring);
       
   738 begin
       
   739 val(s, cExplosives)
       
   740 end;
       
   741 
       
   742 procedure chGameFlags(var s: shortstring);
       
   743 begin
       
   744 val(s, GameFlags)
       
   745 end;
       
   746 
       
   747 procedure chHedgehogTurnTime(var s: shortstring);
       
   748 begin
       
   749 val(s, cHedgehogTurnTime)
       
   750 end;
       
   751 
       
   752 procedure chMinesTime(var s: shortstring);
       
   753 begin
       
   754 val(s, cMinesTime)
       
   755 end;
       
   756 
       
   757 procedure chFastUntilLag(var s: shortstring);
       
   758 var i: LongInt;
       
   759 begin
       
   760 val(s, i);
       
   761 fastUntilLag:= i <> 0
       
   762 end;
   662 
   763 
   663 procedure initModule;
   764 procedure initModule;
   664 begin
   765 begin
   665 //////// Begin top sorted by freq analysis not including chatmsg
   766 //////// Begin top sorted by freq analysis not including chatmsg
   666     RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
   767     RegisterVariable('+right'  , @chRight_p      , false);
   667     RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
   768     RegisterVariable('-right'  , @chRight_m      , false);
   668     RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
   769     RegisterVariable('+up'     , @chUp_p         , false);
   669     RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
   770     RegisterVariable('-up'     , @chUp_m         , false);
   670     RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
   771     RegisterVariable('+left'   , @chLeft_p       , false);
   671     RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
   772     RegisterVariable('-left'   , @chLeft_m       , false);
   672     RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
   773     RegisterVariable('+attack' , @chAttack_p     , false);
   673     RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
   774     RegisterVariable('+down'   , @chDown_p       , false);
   674     RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
   775     RegisterVariable('-down'   , @chDown_m       , false);
   675     RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
   776     RegisterVariable('hjump'   , @chHJump        , false);
   676     RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
   777     RegisterVariable('ljump'   , @chLJump        , false);
   677     RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
   778     RegisterVariable('nextturn', @chNextTurn     , false);
   678     RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
   779     RegisterVariable('-attack' , @chAttack_m     , false);
   679     RegisterVariable('slot'    , vtCommand, @chSlot         , false);
   780     RegisterVariable('slot'    , @chSlot         , false);
   680     RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
   781     RegisterVariable('setweap' , @chSetWeapon    , false);
   681 //////// End top by freq analysis
   782 //////// End top by freq analysis
   682     RegisterVariable('gencmd'  , vtCommand, @chGenCmd       , false);
   783     RegisterVariable('gencmd'  , @chGenCmd       , false);
   683     RegisterVariable('flag'    , vtCommand, @chFlag         , false);
   784     RegisterVariable('flag'    , @chFlag         , false);
   684     RegisterVariable('script'  , vtCommand, @chScript       , false);
   785     RegisterVariable('script'  , @chScript       , false);
   685     RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
   786     RegisterVariable('proto'   , @chCheckProto   , true );
   686     RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
   787     RegisterVariable('spectate', @chFastUntilLag   , false);
   687     RegisterVariable('capture' , vtCommand, @chCapture      , true );
   788     RegisterVariable('capture' , @chCapture      , true );
   688     RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
   789     RegisterVariable('rotmask' , @chRotateMask   , true );
   689     RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
   790     RegisterVariable('rdriven' , @chTeamLocal    , false);
   690     RegisterVariable('map'     , vtCommand, @chSetMap       , false);
   791     RegisterVariable('map'     , @chSetMap       , false);
   691     RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
   792     RegisterVariable('theme'   , @chSetTheme     , false);
   692     RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
   793     RegisterVariable('seed'    , @chSetSeed      , false);
   693     RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
   794     RegisterVariable('template_filter', @chTemplateFilter, false);
   694     RegisterVariable('mapgen'  , vtLongInt, @cMapGen        , false);
   795     RegisterVariable('mapgen'  , @chMapGen        , false);
   695     RegisterVariable('maze_size',vtLongInt, @cTemplateFilter, false);
   796     RegisterVariable('maze_size',@chTemplateFilter, false);
   696     RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
   797     RegisterVariable('delay'   , @chInactDelay    , false);
   697     RegisterVariable('ready'   , vtLongInt, @cReadyDelay    , false);
   798     RegisterVariable('ready'   , @chReadyDelay    , false);
   698     RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
   799     RegisterVariable('casefreq', @chCaseFactor    , false);
   699     RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
   800     RegisterVariable('healthprob', @chHealthCaseProb, false);
   700     RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
   801     RegisterVariable('hcaseamount', @chHealthCaseAmount, false);
   701     RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
   802     RegisterVariable('sd_turns', @chSuddenDTurns  , false);
   702     RegisterVariable('waterrise', vtLongInt, @cWaterRise    , false);
   803     RegisterVariable('waterrise', @chWaterRise    , false);
   703     RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
   804     RegisterVariable('healthdec', @chHealthDecrease, false);
   704     RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
   805     RegisterVariable('damagepct',@chDamagePercent , false);
   705     RegisterVariable('ropepct' , vtLongInt, @cRopePercent   , false);
   806     RegisterVariable('ropepct' , @chRopePercent   , false);
   706     RegisterVariable('getawaytime' , vtLongInt, @cGetAwayTime , false);
   807     RegisterVariable('getawaytime' , @chGetAwayTime , false);
   707     RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
   808     RegisterVariable('minedudpct',@chMineDudPercent, false);
   708     RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
   809     RegisterVariable('minesnum', @chLandMines     , false);
   709     RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
   810     RegisterVariable('explosives',@chExplosives    , false);
   710     RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
   811     RegisterVariable('gmflags' , @chGameFlags      , false);
   711     RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
   812     RegisterVariable('turntime', @chHedgehogTurnTime, false);
   712     RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
   813     RegisterVariable('minestime',@chMinesTime     , false);
   713     RegisterVariable('fort'    , vtCommand, @chFort         , false);
   814     RegisterVariable('fort'    , @chFort         , false);
   714     RegisterVariable('grave'   , vtCommand, @chGrave        , false);
   815     RegisterVariable('grave'   , @chGrave        , false);
   715     RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
   816     RegisterVariable('hat'     , @chSetHat       , false);
   716     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
   817     RegisterVariable('quit'    , @chQuit         , true );
   717     RegisterVariable('forcequit', vtCommand, @chForceQuit   , true );
   818     RegisterVariable('forcequit', @chForceQuit   , true );
   718     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
   819     RegisterVariable('confirm' , @chConfirm      , true );
   719     RegisterVariable('halt',     vtCommand, @chHalt         , true );
   820     RegisterVariable('halt',     @chHalt         , true );
   720     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
   821     RegisterVariable('+speedup', @chSpeedup_p    , true );
   721     RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
   822     RegisterVariable('-speedup', @chSpeedup_m    , true );
   722     RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
   823     RegisterVariable('zoomin'  , @chZoomIn       , true );
   723     RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
   824     RegisterVariable('zoomout' , @chZoomOut      , true );
   724     RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
   825     RegisterVariable('zoomreset',@chZoomReset    , true );
   725     RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
   826     RegisterVariable('ammomenu', @chAmmoMenu     , true);
   726     RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
   827     RegisterVariable('+precise', @chPrecise_p    , false);
   727     RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
   828     RegisterVariable('-precise', @chPrecise_m    , false);
   728     RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
   829     RegisterVariable('switch'  , @chSwitch       , false);
   729     RegisterVariable('timer'   , vtCommand, @chTimer        , false);
   830     RegisterVariable('timer'   , @chTimer        , false);
   730     RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
   831     RegisterVariable('taunt'   , @chTaunt        , false);
   731     RegisterVariable('put'     , vtCommand, @chPut          , false);
   832     RegisterVariable('put'     , @chPut          , false);
   732     RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
   833     RegisterVariable('+volup'  , @chVol_p        , true );
   733     RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
   834     RegisterVariable('-volup'  , @chVol_m        , true );
   734     RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
   835     RegisterVariable('+voldown', @chVol_m        , true );
   735     RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
   836     RegisterVariable('-voldown', @chVol_p        , true );
   736     RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
   837     RegisterVariable('findhh'  , @chFindhh       , true );
   737     RegisterVariable('pause'   , vtCommand, @chPause        , true );
   838     RegisterVariable('pause'   , @chPause        , true );
   738     RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
   839     RegisterVariable('+cur_u'  , @chCurU_p       , true );
   739     RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
   840     RegisterVariable('-cur_u'  , @chCurU_m       , true );
   740     RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
   841     RegisterVariable('+cur_d'  , @chCurD_p       , true );
   741     RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
   842     RegisterVariable('-cur_d'  , @chCurD_m       , true );
   742     RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
   843     RegisterVariable('+cur_l'  , @chCurL_p       , true );
   743     RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
   844     RegisterVariable('-cur_l'  , @chCurL_m       , true );
   744     RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
   845     RegisterVariable('+cur_r'  , @chCurR_p       , true );
   745     RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
   846     RegisterVariable('-cur_r'  , @chCurR_m       , true );
   746 end;
   847 end;
   747 
   848 
   748 procedure freeModule;
   849 procedure freeModule;
   749 begin
   850 begin
   750 end;
   851 end;