hedgewars/uVisualGears.pas
changeset 3145 a9af6bf223cf
parent 3118 1320933fd651
child 3148 3e28a12be5ac
equal deleted inserted replaced
3144:f1ba655a6941 3145:a9af6bf223cf
   342     Gear^.scale := 1.25 * (-power(2, -7 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4;
   342     Gear^.scale := 1.25 * (-power(2, -7 * Int(Gear^.Timer)/Gear^.FrameTicks) + 1) + 0.4;
   343     Gear^.alpha := 1.0 * (power(2, -3 * (Gear^.Timer - 350)/350));
   343     Gear^.alpha := 1.0 * (power(2, -3 * (Gear^.Timer - 350)/350));
   344     end;
   344     end;
   345 end;
   345 end;
   346 
   346 
       
   347 procedure doStepFeather(Gear: PVisualGear; Steps: Longword);
       
   348 begin
       
   349 Gear^.X:= Gear^.X + Gear^.dX * Steps;
       
   350 
       
   351 Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
       
   352 Gear^.dY:= Gear^.dY + cGravity * Steps;
       
   353 
       
   354 Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle;
       
   355 
       
   356 if Gear^.FrameTicks <= Steps then
       
   357     DeleteVisualGear(Gear)
       
   358 else
       
   359     dec(Gear^.FrameTicks, Steps)
       
   360 end;
   347 ////////////////////////////////////////////////////////////////////////////////
   361 ////////////////////////////////////////////////////////////////////////////////
   348 const cSorterWorkTime = 640;
   362 const cSorterWorkTime = 640;
   349 var thexchar: array[0..cMaxTeams] of
   363 var thexchar: array[0..cMaxTeams] of
   350             record
   364             record
   351             dy, ny, dw: LongInt;
   365             dy, ny, dw: LongInt;
   484             @doStepDust,
   498             @doStepDust,
   485             @doStepSplash,
   499             @doStepSplash,
   486             @doStepDroplet,
   500             @doStepDroplet,
   487             @doStepSmokeRing,
   501             @doStepSmokeRing,
   488             @doStepBeeTrace,
   502             @doStepBeeTrace,
   489             @doStepEgg
   503             @doStepEgg,
       
   504             @doStepFeather
   490         );
   505         );
   491 
   506 
   492 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   507 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   493 var gear: PVisualGear;
   508 var gear: PVisualGear;
   494     t: Longword;
   509     t: Longword;
   646                 Timer:= 0;
   661                 Timer:= 0;
   647                 Frame:= 0;
   662                 Frame:= 0;
   648                 scale:= 0.6;
   663                 scale:= 0.6;
   649                 alpha:= 1;
   664                 alpha:= 1;
   650                 angle:= random(360);
   665                 angle:= random(360);
       
   666                 end;
       
   667      vgtFeather: begin
       
   668                 t:= random(1024);
       
   669                 sp:= _0_001 * (random(85) + 95);
       
   670                 dx:= AngleSin(t) * sp;
       
   671                 dx.isNegative:= random(2) = 0;
       
   672                 dy:= AngleCos(t) * sp;
       
   673                 dy.isNegative:= random(2) = 0;
       
   674                 FrameTicks:= 650 + random(250);
       
   675                 Frame:= 1
   651                 end;
   676                 end;
   652         end;
   677         end;
   653 
   678 
   654 if VisualGearsList <> nil then
   679 if VisualGearsList <> nil then
   655     begin
   680     begin
   787                 vgtSmokeRing: begin
   812                 vgtSmokeRing: begin
   788                             glColor4f(1, 1, 1, Gear^.alpha);
   813                             glColor4f(1, 1, 1, Gear^.alpha);
   789                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
   814                             DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle);
   790                             glColor4f(1, 1, 1, 1);
   815                             glColor4f(1, 1, 1, 1);
   791                             end;
   816                             end;
       
   817                  vgtFeather: begin
       
   818                             if Gear^.FrameTicks < 250 then
       
   819                                 glColor4f(1, 1, 1, Gear^.FrameTicks / 250);
       
   820                             DrawRotatedF(sprFeather, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
       
   821                             if Gear^.FrameTicks < 250 then
       
   822                                 glColor4f(1, 1, 1, 1);
       
   823                             end;
   792             end;
   824             end;
   793         case Gear^.Kind of
   825         case Gear^.Kind of
   794             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   826             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   795             vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   827             vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   796         end;
   828         end;