hedgewars/uVisualGears.pas
changeset 2982 4213c6a8aceb
parent 2974 f3fa665f0874
child 2985 d268a7fbb868
equal deleted inserted replaced
2981:d0471586a616 2982:4213c6a8aceb
   270       DeleteVisualGear(Gear)
   270       DeleteVisualGear(Gear)
   271   else
   271   else
   272       dec(Gear^.FrameTicks, Steps);
   272       dec(Gear^.FrameTicks, Steps);
   273 end;
   273 end;
   274 
   274 
       
   275 procedure doStepDroplet(Gear: PVisualGear; Steps: Longword);
       
   276 begin
       
   277   Gear^.X:= Gear^.X + Gear^.dX * Steps;
       
   278 
       
   279   Gear^.Y:= Gear^.Y + Gear^.dY * Steps;
       
   280   Gear^.dY:= Gear^.dY + cGravity * Steps;
       
   281 
       
   282   if hwRound(Gear^.Y) > cWaterLine then begin
       
   283     DeleteVisualGear(Gear);
       
   284     PlaySound(TSound(ord(sndDroplet1) + Random(3)));
       
   285     end;
       
   286 end;
       
   287 
   275 ////////////////////////////////////////////////////////////////////////////////
   288 ////////////////////////////////////////////////////////////////////////////////
   276 const cSorterWorkTime = 640;
   289 const cSorterWorkTime = 640;
   277 var thexchar: array[0..cMaxTeams] of
   290 var thexchar: array[0..cMaxTeams] of
   278             record
   291             record
   279             dy, ny, dw: LongInt;
   292             dy, ny, dw: LongInt;
   408             @doStepSmoke,
   421             @doStepSmoke,
   409             @doStepSmoke,
   422             @doStepSmoke,
   410             @doStepHealth,
   423             @doStepHealth,
   411             @doStepShell,
   424             @doStepShell,
   412             @doStepDust,
   425             @doStepDust,
   413             @doStepSplash
   426             @doStepSplash,
       
   427             @doStepDroplet
   414         );
   428         );
   415 
   429 
   416 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   430 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
   417 var gear: PVisualGear;
   431 var gear: PVisualGear;
   418     t: Longword;
   432     t: Longword;
   533                 dx:= _0;
   547                 dx:= _0;
   534                 dx.isNegative:= false;
   548                 dx.isNegative:= false;
   535                 dy:= _0;
   549                 dy:= _0;
   536                 FrameTicks:= 740;
   550                 FrameTicks:= 740;
   537                 Frame:= 19;
   551                 Frame:= 19;
       
   552                 end;
       
   553     vgtDroplet: begin
       
   554                 dx:= _0_001 * (random(75) + 15);
       
   555                 dx.isNegative:= random(2) = 0;
       
   556                 dy:= _0_001 * (random(80) + 120);
       
   557                 dy.isNegative:= true;
       
   558                 FrameTicks:= 250 + random(1751);
       
   559                 Frame:= random(3)
   538                 end;
   560                 end;
   539         end;
   561         end;
   540 
   562 
   541 if VisualGearsList <> nil then
   563 if VisualGearsList <> nil then
   542     begin
   564     begin
   629                             DrawRotatedF(sprShell, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   651                             DrawRotatedF(sprShell, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle);
   630                             if Gear^.FrameTicks < 250 then
   652                             if Gear^.FrameTicks < 250 then
   631                                 glColor4f(1, 1, 1, 1);
   653                                 glColor4f(1, 1, 1, 1);
   632                             end;
   654                             end;
   633                 vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 64, hwRound(Gear^.Y) + WorldDy - 72, 19 - (Gear^.FrameTicks div 37));
   655                 vgtSplash: DrawSprite(sprSplash, hwRound(Gear^.X) + WorldDx - 64, hwRound(Gear^.Y) + WorldDy - 72, 19 - (Gear^.FrameTicks div 37));
       
   656                 vgtDroplet: DrawSprite(sprDroplet, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);
   634             end;
   657             end;
   635         case Gear^.Kind of
   658         case Gear^.Kind of
   636             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   659             vgtSmallDamageTag: DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   637             vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   660             vgtSpeechBubble: if Gear^.Tex <> nil then DrawCentered(hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Tex);
   638         end;
   661         end;