hedgewars/uCommandHandlers.pas
changeset 13533 0c8001e43fd3
parent 13461 854caa3c9212
child 13641 007813b81f1b
equal deleted inserted replaced
13532:ee77086fc5fa 13533:0c8001e43fd3
   415     begin
   415     begin
   416     Message:= Message or (gmTimer and InputMask);
   416     Message:= Message or (gmTimer and InputMask);
   417     MsgParam:= byte(s[1]) - ord('0');
   417     MsgParam:= byte(s[1]) - ord('0');
   418     ScriptCall('onTimer', MsgParam);
   418     ScriptCall('onTimer', MsgParam);
   419     end
   419     end
       
   420 end;
       
   421 
       
   422 // Increment timer or bounciness
       
   423 procedure chTimerU(var s: shortstring);
       
   424 var t: LongWord;
       
   425     tb: Byte;
       
   426 begin
       
   427 s:= s; // avoid compiler hint
       
   428 if CheckNoTeamOrHH then
       
   429     exit;
       
   430 // We grab the current timer first so we can increment it
       
   431 if (CurrentHedgehog^.Gear^.Message and gmPrecise) = 0 then
       
   432     t:= HHGetTimerMsg(CurrentHedgehog^.Gear)
       
   433 else
       
   434     // Use bounciness if Precise is pressed
       
   435     t:= HHGetBouncinessMsg(CurrentHedgehog^.Gear);
       
   436 if t <> MSGPARAM_INVALID then
       
   437     begin
       
   438     // Calculate new timer
       
   439     Inc(t);
       
   440     if t > 5 then
       
   441         t:= 1;
       
   442     tb:= t mod 255;
       
   443     // Delegate the actual change to /timer
       
   444     ParseCommand('timer ' + Chr(tb + Ord('0')), true);
       
   445     end;
   420 end;
   446 end;
   421 
   447 
   422 procedure chSlot(var s: shortstring);
   448 procedure chSlot(var s: shortstring);
   423 var slot: LongWord;
   449 var slot: LongWord;
   424     ss: shortstring;
   450     ss: shortstring;
   936     RegisterVariable('record'  , @chRecord       , true );
   962     RegisterVariable('record'  , @chRecord       , true );
   937     RegisterVariable('worldedge',@chWorldEdge    , false);
   963     RegisterVariable('worldedge',@chWorldEdge    , false);
   938     RegisterVariable('advmapgen',@chAdvancedMapGenMode, false);
   964     RegisterVariable('advmapgen',@chAdvancedMapGenMode, false);
   939     RegisterVariable('+mission', @chShowMission_p, true);
   965     RegisterVariable('+mission', @chShowMission_p, true);
   940     RegisterVariable('-mission', @chShowMission_m, true);
   966     RegisterVariable('-mission', @chShowMission_m, true);
       
   967     RegisterVariable('timer_u' , @chTimerU       , true );
   941 end;
   968 end;
   942 
   969 
   943 procedure freeModule;
   970 procedure freeModule;
   944 begin
   971 begin
   945 end;
   972 end;