hedgewars/GSHandlers.inc
changeset 7416 2f2f78fc65a3
parent 7408 38d369c59d51
child 7426 55b49cc1f33a
equal deleted inserted replaced
7414:a9f18c66ce34 7416:2f2f78fc65a3
  3005 end;
  3005 end;
  3006 
  3006 
  3007 ////////////////////////////////////////////////////////////////////////////////
  3007 ////////////////////////////////////////////////////////////////////////////////
  3008 
  3008 
  3009 const cakeh =   27;
  3009 const cakeh =   27;
  3010     cakeDmg =   75;
       
  3011 var 
  3010 var 
  3012     CakePoints: array[0..Pred(cakeh)] of record
  3011     CakePoints: array[0..Pred(cakeh)] of record
  3013         x, y: hwFloat;
  3012         x, y: hwFloat;
  3014     end;
  3013     end;
  3015     CakeI: Longword;
  3014     CakeI: Longword;
  3089 
  3088 
  3090     inc(Gear^.Tag);
  3089     inc(Gear^.Tag);
  3091     if Gear^.Tag < 7 then
  3090     if Gear^.Tag < 7 then
  3092         exit;
  3091         exit;
  3093 
  3092 
       
  3093     dec(Gear^.Health);
       
  3094     Gear^.Timer := Gear^.Health*10;
       
  3095     if Gear^.Health mod 100 = 0 then
       
  3096         Gear^.PortalCounter:= 0;
       
  3097     // This is not seconds, but at least it is *some* feedback
       
  3098     if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 0) then
       
  3099         begin
       
  3100         FollowGear := Gear;
       
  3101         Gear^.RenderTimer := false;
       
  3102         Gear^.doStep := @doStepCakeDown;
       
  3103         exit
       
  3104         end;
       
  3105 
  3094     cakeStep(Gear);
  3106     cakeStep(Gear);
  3095 
  3107 
  3096     if Gear^.Tag = 0 then
  3108     if Gear^.Tag = 0 then
  3097         begin
  3109         begin
  3098         CakeI := (CakeI + 1) mod cakeh;
  3110         CakeI := (CakeI + 1) mod cakeh;
  3100         tdy := - CakePoints[CakeI].y + Gear^.Y;
  3112         tdy := - CakePoints[CakeI].y + Gear^.Y;
  3101         CakePoints[CakeI].x := Gear^.X;
  3113         CakePoints[CakeI].x := Gear^.X;
  3102         CakePoints[CakeI].y := Gear^.Y;
  3114         CakePoints[CakeI].y := Gear^.Y;
  3103         Gear^.DirAngle := DxDy2Angle(tdx, tdy);
  3115         Gear^.DirAngle := DxDy2Angle(tdx, tdy);
  3104         end;
  3116         end;
  3105 
       
  3106     dec(Gear^.Health);
       
  3107     Gear^.Timer := Gear^.Health*10;
       
  3108     if Gear^.Health mod 100 = 0 then
       
  3109         Gear^.PortalCounter:= 0;
       
  3110     // This is not seconds, but at least it is *some* feedback
       
  3111     if (Gear^.Health = 0) or ((Gear^.Message and gmAttack) <> 0) then
       
  3112         begin
       
  3113         FollowGear := Gear;
       
  3114         Gear^.RenderTimer := false;
       
  3115         Gear^.doStep := @doStepCakeDown
       
  3116         end
       
  3117 end;
  3117 end;
  3118 
  3118 
  3119 procedure doStepCakeUp(Gear: PGear);
  3119 procedure doStepCakeUp(Gear: PGear);
  3120 var 
  3120 var 
  3121     i: Longword;
  3121     i: Longword;