hedgewars/uCommandHandlers.pas
branchsdl2transition
changeset 9798 f2b18754742f
parent 9797 1fdc1507e42d
child 9902 eb8e8b09b2f0
equal deleted inserted replaced
9711:7d0329f37181 9798:f2b18754742f
   107 if CurrentTeam = nil then
   107 if CurrentTeam = nil then
   108     OutError(errmsgIncorrectUse + ' "/rdriven"', true);
   108     OutError(errmsgIncorrectUse + ' "/rdriven"', true);
   109 CurrentTeam^.ExtDriven:= true
   109 CurrentTeam^.ExtDriven:= true
   110 end;
   110 end;
   111 
   111 
   112 procedure chGrave(var s: shortstring);
       
   113 begin
       
   114 if CurrentTeam = nil then
       
   115     OutError(errmsgIncorrectUse + ' "/grave"', true);
       
   116 if s[1]='"' then
       
   117     Delete(s, 1, 1);
       
   118 if s[byte(s[0])]='"' then
       
   119     Delete(s, byte(s[0]), 1);
       
   120 CurrentTeam^.GraveName:= s
       
   121 end;
       
   122 
       
   123 procedure chFort(var s: shortstring);
       
   124 begin
       
   125 if CurrentTeam = nil then
       
   126     OutError(errmsgIncorrectUse + ' "/fort"', true);
       
   127 if s[1]='"' then
       
   128     Delete(s, 1, 1);
       
   129 if s[byte(s[0])]='"' then
       
   130     Delete(s, byte(s[0]), 1);
       
   131 CurrentTeam^.FortName:= s
       
   132 end;
       
   133 
       
   134 procedure chFlag(var s: shortstring);
       
   135 begin
       
   136 if CurrentTeam = nil then
       
   137     OutError(errmsgIncorrectUse + ' "/flag"', true);
       
   138 if s[1]='"' then
       
   139     Delete(s, 1, 1);
       
   140 if s[byte(s[0])]='"' then
       
   141     Delete(s, byte(s[0]), 1);
       
   142 CurrentTeam^.flag:= s
       
   143 end;
       
   144 
       
   145 procedure chScript(var s: shortstring);
   112 procedure chScript(var s: shortstring);
   146 begin
   113 begin
   147 if s[1]='"' then
   114 if s[1]='"' then
   148     Delete(s, 1, 1);
   115     Delete(s, 1, 1);
   149 if s[byte(s[0])]='"' then
   116 if s[byte(s[0])]='"' then
   150     Delete(s, byte(s[0]), 1);
   117     Delete(s, byte(s[0]), 1);
   151 cScriptName:= s;
   118 cScriptName:= s;
   152 ScriptLoad(s)
   119 ScriptLoad(s)
   153 end;
       
   154 
       
   155 procedure chSetHat(var s: shortstring);
       
   156 begin
       
   157 if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
       
   158 with CurrentTeam^ do
       
   159     begin
       
   160     if not CurrentHedgehog^.King then
       
   161     if (s = '')
       
   162     or (((GameFlags and gfKing) <> 0) and (s = 'crown'))
       
   163     or ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
       
   164         CurrentHedgehog^.Hat:= 'NoHat'
       
   165     else
       
   166         CurrentHedgehog^.Hat:= s
       
   167     end;
       
   168 end;
   120 end;
   169 
   121 
   170 procedure chCurU_p(var s: shortstring);
   122 procedure chCurU_p(var s: shortstring);
   171 begin
   123 begin
   172 s:= s; // avoid compiler hint
   124 s:= s; // avoid compiler hint
   655 end;
   607 end;
   656 
   608 
   657 procedure chRotateMask(var s: shortstring);
   609 procedure chRotateMask(var s: shortstring);
   658 begin
   610 begin
   659 s:= s; // avoid compiler hint
   611 s:= s; // avoid compiler hint
   660 if ((GameFlags and gfInvulnerable) = 0) then
   612 // this is just for me, 'cause I thought it'd be fun.  using the old precise + switch to keep it out of people's way
   661     cTagsMask:= cTagsMasks[cTagsMask]
   613 if LocalMessage and (gmPrecise or gmSwitch) = (gmPrecise or gmSwitch) then
       
   614     begin
       
   615     if UIDisplay <> uiNone then
       
   616          UIDisplay:= uiNone
       
   617     else UIDisplay:= uiAll
       
   618     end
       
   619 else if LocalMessage and gmPrecise = gmPrecise then
       
   620     begin
       
   621     if ((GameFlags and gfInvulnerable) = 0) then
       
   622         cTagsMask:= cTagsMasks[cTagsMask]
       
   623     else
       
   624         cTagsMask:= cTagsMasksNoHealth[cTagsMask]
       
   625     end
   662 else
   626 else
   663     cTagsMask:= cTagsMasksNoHealth[cTagsMask];
   627     begin
       
   628     if UIDisplay <> uiNoTeams then
       
   629          UIDisplay:= uiNoTeams
       
   630     else UIDisplay:= uiAll
       
   631     end
   664 end;
   632 end;
   665 
   633 
   666 procedure chSpeedup_p(var s: shortstring);
   634 procedure chSpeedup_p(var s: shortstring);
   667 begin
   635 begin
   668 s:= s; // avoid compiler hint
   636 s:= s; // avoid compiler hint
   825     RegisterVariable('-attack' , @chAttack_m     , false);
   793     RegisterVariable('-attack' , @chAttack_m     , false);
   826     RegisterVariable('slot'    , @chSlot         , false);
   794     RegisterVariable('slot'    , @chSlot         , false);
   827     RegisterVariable('setweap' , @chSetWeapon    , false, true);
   795     RegisterVariable('setweap' , @chSetWeapon    , false, true);
   828 //////// End top by freq analysis
   796 //////// End top by freq analysis
   829     RegisterVariable('gencmd'  , @chGenCmd       , false);
   797     RegisterVariable('gencmd'  , @chGenCmd       , false);
   830     RegisterVariable('flag'    , @chFlag         , false);
       
   831     RegisterVariable('script'  , @chScript       , false);
   798     RegisterVariable('script'  , @chScript       , false);
   832     RegisterVariable('proto'   , @chCheckProto   , true );
   799     RegisterVariable('proto'   , @chCheckProto   , true );
   833     RegisterVariable('spectate', @chFastUntilLag   , false);
   800     RegisterVariable('spectate', @chFastUntilLag   , false);
   834     RegisterVariable('capture' , @chCapture      , true );
   801     RegisterVariable('capture' , @chCapture      , true );
   835     RegisterVariable('rotmask' , @chRotateMask   , true );
   802     RegisterVariable('rotmask' , @chRotateMask   , true );
   855     RegisterVariable('minesnum', @chLandMines     , false);
   822     RegisterVariable('minesnum', @chLandMines     , false);
   856     RegisterVariable('explosives',@chExplosives    , false);
   823     RegisterVariable('explosives',@chExplosives    , false);
   857     RegisterVariable('gmflags' , @chGameFlags      , false);
   824     RegisterVariable('gmflags' , @chGameFlags      , false);
   858     RegisterVariable('turntime', @chHedgehogTurnTime, false);
   825     RegisterVariable('turntime', @chHedgehogTurnTime, false);
   859     RegisterVariable('minestime',@chMinesTime     , false);
   826     RegisterVariable('minestime',@chMinesTime     , false);
   860     RegisterVariable('fort'    , @chFort         , false);
       
   861     RegisterVariable('grave'   , @chGrave        , false);
       
   862     RegisterVariable('hat'     , @chSetHat       , false);
       
   863     RegisterVariable('quit'    , @chQuit         , true );
   827     RegisterVariable('quit'    , @chQuit         , true );
   864     RegisterVariable('forcequit', @chForceQuit   , true );
   828     RegisterVariable('forcequit', @chForceQuit   , true );
   865     RegisterVariable('confirm' , @chConfirm      , true );
   829     RegisterVariable('confirm' , @chConfirm      , true );
   866     RegisterVariable('halt',     @chHalt         , true );
   830     RegisterVariable('halt',     @chHalt         , true );
   867     RegisterVariable('+speedup', @chSpeedup_p    , true );
   831     RegisterVariable('+speedup', @chSpeedup_p    , true );