hedgewars/uVisualGears.pas
changeset 2972 82828fd23dea
parent 2948 3f21a9dc93d0
child 2974 f3fa665f0874
equal deleted inserted replaced
2971:c65929077646 2972:82828fd23dea
    41         Timer: Longword;
    41         Timer: Longword;
    42         Angle, dAngle: real;
    42         Angle, dAngle: real;
    43         Kind: TVisualGearType;
    43         Kind: TVisualGearType;
    44         doStep: TVGearStepProcedure;
    44         doStep: TVGearStepProcedure;
    45         Tex: PTexture;
    45         Tex: PTexture;
       
    46         alpha, scale: GLfloat;
    46         Hedgehog: pointer;
    47         Hedgehog: pointer;
    47         Text: shortstring
    48         Text: shortstring
    48         end;
    49         end;
    49 
    50 
    50 procedure init_uVisualGears;
    51 procedure init_uVisualGears;
   213             begin
   214             begin
   214             if Random(2) = 0 then dec(Gear^.Frame);
   215             if Random(2) = 0 then dec(Gear^.Frame);
   215             Gear^.FrameTicks:= cExplFrameTicks
   216             Gear^.FrameTicks:= cExplFrameTicks
   216             end
   217             end
   217         else dec(Gear^.FrameTicks, Steps)
   218         else dec(Gear^.FrameTicks, Steps)
       
   219 end;
       
   220 
       
   221 procedure doStepAmmo(Gear: PVisualGear; Steps: Longword);
       
   222 begin
       
   223     Gear^.Y:= Gear^.Y - cDrownSpeed * Steps;
       
   224 
       
   225     Gear^.scale:= Gear^.scale + 0.0025 * Steps;
       
   226     Gear^.alpha:= Gear^.alpha - 0.0015 * Steps;
       
   227 
       
   228     if Gear^.alpha < 0 then DeleteVisualGear(Gear)
   218 end;
   229 end;
   219 
   230 
   220 procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
   231 procedure doStepSmoke(Gear: PVisualGear; Steps: Longword);
   221 begin
   232 begin
   222     Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps;
   233     Gear^.X:= Gear^.X + (cWindSpeed + Gear^.dX) * Steps;
   383             @doStepSmallDamage,
   394             @doStepSmallDamage,
   384             @doStepTeamHealthSorter,
   395             @doStepTeamHealthSorter,
   385             @doStepSpeechBubble,
   396             @doStepSpeechBubble,
   386             @doStepBubble,
   397             @doStepBubble,
   387             @doStepSteam,
   398             @doStepSteam,
       
   399             @doStepAmmo,
   388             @doStepSmoke,
   400             @doStepSmoke,
   389             @doStepSmoke,
   401             @doStepSmoke,
   390             @doStepHealth,
   402             @doStepHealth,
   391             @doStepShell,
   403             @doStepShell,
   392             @doStepDust
   404             @doStepDust
   478                 dx.QWordValue:= random(100000000);
   490                 dx.QWordValue:= random(100000000);
   479                 dy:= _0_001 * (random(85) + 95);
   491                 dy:= _0_001 * (random(85) + 95);
   480                 dy.isNegative:= false;
   492                 dy.isNegative:= false;
   481                 Frame:= 7 - random(3);
   493                 Frame:= 7 - random(3);
   482                 FrameTicks:= cExplFrameTicks * 2;
   494                 FrameTicks:= cExplFrameTicks * 2;
       
   495                 end;
       
   496     vgtAmmo: begin
       
   497                 alpha:= 1.0;
       
   498                 scale:= 1.0
   483                 end;
   499                 end;
   484   vgtSmokeWhite, 
   500   vgtSmokeWhite, 
   485   vgtSmoke: begin
   501   vgtSmoke: begin
   486                 dx:= _0_0002 * (random(45) + 10);
   502                 dx:= _0_0002 * (random(45) + 10);
   487                 dx.isNegative:= random(2) = 0;
   503                 dx.isNegative:= random(2) = 0;
   575                 vgtExplPart: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   591                 vgtExplPart: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   576                 vgtExplPart2: DrawSprite(sprExplPart2, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   592                 vgtExplPart2: DrawSprite(sprExplPart2, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   577                 vgtFire: DrawSprite(sprFlame, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy, (RealTicks div 64 + Gear^.Frame) mod 8);
   593                 vgtFire: DrawSprite(sprFlame, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy, (RealTicks div 64 + Gear^.Frame) mod 8);
   578                 vgtBubble: DrawSprite(sprBubbles, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
   594                 vgtBubble: DrawSprite(sprBubbles, hwRound(Gear^.X) + WorldDx - 8, hwRound(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8);
   579                 vgtSteam: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
   595                 vgtSteam: DrawSprite(sprExplPart, hwRound(Gear^.X) + WorldDx - 16, hwRound(Gear^.Y) + WorldDy - 16, 7 - Gear^.Frame);
       
   596                 vgtAmmo: begin
       
   597                         glColor4f(1, 1, 1, Gear^.alpha);
       
   598                         DrawTextureF(ropeIconTex, Gear^.scale, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, 0, 1, 32, 32);
       
   599                         DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, hwRound(Gear^.X) + WorldDx, hwRound(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32);
       
   600                         glColor4f(1, 1, 1, 1);
       
   601                         end;
   580                 vgtHealth:  begin
   602                 vgtHealth:  begin
   581                             case Gear^.Frame div 10 of
   603                             case Gear^.Frame div 10 of
   582                                 0:glColor4f(0, 1, 0, Gear^.FrameTicks / 1000);
   604                                 0:glColor4f(0, 1, 0, Gear^.FrameTicks / 1000);
   583                                 1:glColor4f(1, 0, 0, Gear^.FrameTicks / 1000);
   605                                 1:glColor4f(1, 0, 0, Gear^.FrameTicks / 1000);
   584                             end;
   606                             end;