hedgewars/uVisualGearsHandlers.pas
changeset 10251 a3b42e81803c
parent 10193 d7cd5b43588f
child 10298 7d5d93f9a515
equal deleted inserted replaced
10250:887610b44848 10251:a3b42e81803c
   893     if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then
   893     if (Gear^.FrameTicks < 501) and (Gear^.FrameTicks mod 5 = 0) then
   894         Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500)
   894         Gear^.Tint:= (Gear^.Tint and $FFFFFF00) or (((Gear^.Tint and $000000FF) * Gear^.FrameTicks) div 500)
   895     end
   895     end
   896 end;
   896 end;
   897 
   897 
       
   898 ////////////////////////////////////////////////////////////////////////////////
       
   899 procedure doStepNoPlaceWarn(Gear: PVisualGear; Steps: Longword);
       
   900 begin
       
   901 
       
   902 if Gear^.FrameTicks <= Steps then
       
   903     DeleteVisualGear(Gear)
       
   904 else
       
   905     begin
       
   906     // age
       
   907     dec(Gear^.FrameTicks, Steps);
       
   908     // toggle between orange and red every few ticks
       
   909     if (Gear^.FrameTicks div 300) mod 2 = 0 then
       
   910         Gear^.Tint:= $FF400000
       
   911     else
       
   912         Gear^.Tint:= $FF000000;
       
   913     // fade out alpha
       
   914     Gear^.Tint:= Gear^.Tint or ((Gear^.FrameTicks * $FF) div 3000);
       
   915     // get bigger as we fade out
       
   916     // Gear^.Scale:= 1.1 - 0.001 * (Gear^.FrameTicks div 30);
       
   917     end
       
   918 end;
   898 
   919 
   899 const handlers: array[TVisualGearType] of TVGearStepProcedure =
   920 const handlers: array[TVisualGearType] of TVGearStepProcedure =
   900         (
   921         (
   901             @doStepFlake,
   922             @doStepFlake,
   902             @doStepCloud,
   923             @doStepCloud,
   928             @doStepNote,
   949             @doStepNote,
   929             @doStepLineTrail,
   950             @doStepLineTrail,
   930             @doStepBulletHit,
   951             @doStepBulletHit,
   931             @doStepCircle,
   952             @doStepCircle,
   932             @doStepSmoothWindBar,
   953             @doStepSmoothWindBar,
   933             @doStepStraightShot
   954             @doStepStraightShot,
       
   955             @doStepNoPlaceWarn
   934         );
   956         );
   935 
   957 
   936 procedure initModule;
   958 procedure initModule;
   937 begin
   959 begin
   938     doStepVGHandlers:= handlers
   960     doStepVGHandlers:= handlers