hedgewars/uGearsRender.pas
branchqmlfrontend
changeset 11544 b69f5f22a3ba
parent 11529 58b4e357bcbf
child 11806 2af936302bab
equal deleted inserted replaced
11481:caa1e84c3ac2 11544:b69f5f22a3ba
   844             defaultPos:= false
   844             defaultPos:= false
   845         end;
   845         end;
   846 
   846 
   847     end else // not gstHHDriven
   847     end else // not gstHHDriven
   848         begin
   848         begin
       
   849         // check if hedgehog is sliding/rolling
   849         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
   850         if (Gear^.Damage > 0) and (HH^.Effects[heFrozen] = 0)
   850         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
   851         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then
   851             begin
   852             begin
   852             defaultPos:= false;
   853             defaultPos:= false;
   853                 DrawHedgehog(sx, sy,
   854                 DrawHedgehog(sx, sy,
   854                     sign,
   855                     sign,
   855                     2,
   856                     2,
   856                     1,
   857                     1,
   857                     Gear^.DirAngle);
   858                     Gear^.DirAngle);
       
   859 
       
   860             // dust effect
       
   861             // TODO fix: this gives different results based on framerate
       
   862             if (sx mod 8) = 0 then
       
   863                 begin
       
   864                 if Gear^.dX.isNegative then
       
   865                     tx := hwRound(Gear^.X) + cHHRadius
       
   866                 else
       
   867                     tx := hwRound(Gear^.X) - cHHRadius;
       
   868                 ty:= hwRound(Gear^.Y) + cHHRadius + 2;
       
   869                 if ((tx and LAND_WIDTH_MASK) = 0) and
       
   870                     ((ty and LAND_HEIGHT_MASK) = 0) and
       
   871                         (Land[ty, tx] <> 0) then
       
   872                             AddVisualGear(tx - 2 + Random(4), ty - 8, vgtDust);
       
   873                 end;
       
   874 
       
   875             // draw april's fool hat
   858             if AprilOne and (curhat <> nil) then
   876             if AprilOne and (curhat <> nil) then
   859                 DrawTextureRotatedF(curhat, 1.0, -1.0, 0, sx, sy, 18, sign, 32, 32,
   877                 DrawTextureRotatedF(curhat, 1.0, -1.0, 0, sx, sy, 18, sign, 32, 32,
   860                     sign*Gear^.DirAngle)
   878                     sign*Gear^.DirAngle)
   861             end;
   879             end;
   862 
   880 
  1248                     else if Gear^.State and gsttmpFlag = 0 then
  1266                     else if Gear^.State and gsttmpFlag = 0 then
  1249                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
  1267                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 0, 0, Gear^.DirAngle)
  1250                     else
  1268                     else
  1251                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle)
  1269                         DrawSpriteRotatedF(sprExplosivesRoll, x, y + 4, 1, 0, Gear^.DirAngle)
  1252                     end;
  1270                     end;
  1253         gtDynamite: DrawSprite(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
  1271         gtDynamite: begin
       
  1272                     DrawSprite(sprDynamite, x - 16, y - 25, Gear^.Tag and 1, Gear^.Tag shr 1);
       
  1273                     if (random(3) = 0) then
       
  1274                         begin
       
  1275                         vg:= AddVisualGear(hwRound(Gear^.X)+12-(Gear^.Tag shr 1), hwRound(Gear^.Y)-16, vgtStraightShot);
       
  1276                         if vg <> nil then
       
  1277                             with vg^ do
       
  1278                                 begin
       
  1279                                 Tint:= $FFCC00FF;
       
  1280                                 Angle:= random(360);
       
  1281                                 dx:= 0.0005 * (random(200));
       
  1282                                 dy:= 0.0005 * (random(200));
       
  1283                                 if random(2) = 0 then
       
  1284                                     dx := -dx;
       
  1285                                 if random(2) = 0 then
       
  1286                                     dy := -dy;
       
  1287                                 FrameTicks:= 100+random(300);
       
  1288                                 Scale:= 0.1+1/(random(3)+3);
       
  1289                                 State:= ord(sprStar)
       
  1290                                 end
       
  1291                         end;
       
  1292 
       
  1293                     end;
  1254      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
  1294      gtClusterBomb: DrawSpriteRotated(sprClusterBomb, x, y, 0, Gear^.DirAngle);
  1255          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
  1295          gtCluster: DrawSprite(sprClusterParticle, x - 8, y - 8, 0);
  1256            gtFlame: if Gear^.Tag and 1 = 0 then
  1296            gtFlame: if Gear^.Tag and 1 = 0 then
  1257                          DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
  1297                          DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, 1, 16, 16)
  1258                     else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);
  1298                     else DrawTextureF(SpritesData[sprFlame].Texture, 2 / (Gear^.Tag mod 3 + 2), x, y, (GameTicks shr 7 + LongWord(Gear^.Tag)) mod 8, -1, 16, 16);