32 procedure DeleteVisualGear(Gear: PVisualGear); |
32 procedure DeleteVisualGear(Gear: PVisualGear); |
33 procedure AddClouds; |
33 procedure AddClouds; |
34 procedure AddDamageTag(X, Y, Damage, Color: LongWord); |
34 procedure AddDamageTag(X, Y, Damage, Color: LongWord); |
35 |
35 |
36 implementation |
36 implementation |
37 uses uMisc, uStore, uSound, uMobile, uVariables, uTextures, uRender; |
37 uses uMisc, uStore, uSound, uMobile, uVariables, uTextures, uRender, uUtils, Math; |
38 |
38 |
39 const cExplFrameTicks = 110; |
39 const cExplFrameTicks = 110; |
40 |
40 |
41 {$INCLUDE "VGSHandlers.inc"} |
41 {$INCLUDE "VGSHandlers.inc"} |
42 |
42 |
349 begin |
349 begin |
350 Gear:= t; |
350 Gear:= t; |
351 if Gear^.Kind = vgtFlake then |
351 if Gear^.Kind = vgtFlake then |
352 begin |
352 begin |
353 // Damage calc from doMakeExplosion |
353 // Damage calc from doMakeExplosion |
354 dmg:= min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5); |
354 dmg:= Min(101, Radius + cHHRadius div 2 - LongInt(abs(round(Gear^.X) - X) + abs(round(Gear^.Y) - Y)) div 5); |
355 if dmg > 1 then |
355 if dmg > 1 then |
356 begin |
356 begin |
357 Gear^.tdX:= 0.02 * dmg + 0.01; |
357 Gear^.tdX:= 0.02 * dmg + 0.01; |
358 if Gear^.X - X < 0 then Gear^.tdX := -Gear^.tdX; |
358 if Gear^.X - X < 0 then Gear^.tdX := -Gear^.tdX; |
359 Gear^.tdY:= 0.02 * dmg + 0.01; |
359 Gear^.tdY:= 0.02 * dmg + 0.01; |
407 begin |
407 begin |
408 Tint(Gear^.Tint); |
408 Tint(Gear^.Tint); |
409 case Gear^.Kind of |
409 case Gear^.Kind of |
410 vgtExplosion: DrawSprite(sprExplosion50, round(Gear^.X) - 32 + WorldDx, round(Gear^.Y) - 32 + WorldDy, Gear^.State); |
410 vgtExplosion: DrawSprite(sprExplosion50, round(Gear^.X) - 32 + WorldDx, round(Gear^.Y) - 32 + WorldDy, Gear^.State); |
411 vgtBigExplosion: begin |
411 vgtBigExplosion: begin |
412 Tint($FF, $FF, $FF, floor($FF * (1 - power(Gear^.Timer / 250, 4)))); |
412 Tint($FF, $FF, $FF, round($FF * (1 - power(Gear^.Timer / 250, 4)))); |
413 DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle); |
413 DrawRotatedTextureF(SpritesData[sprBigExplosion].Texture, 0.85 * (-power(2, -10 * Int(Gear^.Timer)/250) + 1) + 0.4, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 385, 385, Gear^.Angle); |
414 end; |
414 end; |
415 end; |
415 end; |
416 if (cReducedQuality and rqFancyBoom) = 0 then |
416 if (cReducedQuality and rqFancyBoom) = 0 then |
417 case Gear^.Kind of |
417 case Gear^.Kind of |
422 else |
422 else |
423 DrawTextureF(SpritesData[sprFlame].Texture, Gear^.FrameTicks / 900, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, (RealTicks shr 7 + Gear^.Frame) mod 8, 1, 16, 16); |
423 DrawTextureF(SpritesData[sprFlame].Texture, Gear^.FrameTicks / 900, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, (RealTicks shr 7 + Gear^.Frame) mod 8, 1, 16, 16); |
424 vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8); |
424 vgtBubble: DrawSprite(sprBubbles, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, Gear^.Frame);//(RealTicks div 64 + Gear^.Frame) mod 8); |
425 vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); |
425 vgtSteam: DrawSprite(sprSmokeWhite, round(Gear^.X) + WorldDx - 11, round(Gear^.Y) + WorldDy - 11, 7 - Gear^.Frame); |
426 vgtAmmo: begin |
426 vgtAmmo: begin |
427 Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); |
427 Tint($FF, $FF, $FF, round(Gear^.alpha * $FF)); |
428 DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32); |
428 DrawTextureF(ropeIconTex, Gear^.scale, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 32, 32); |
429 DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32); |
429 DrawTextureF(SpritesData[sprAMAmmos].Texture, Gear^.scale * 0.90, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame - 1, 1, 32, 32); |
430 end; |
430 end; |
431 vgtHealth: begin |
431 vgtHealth: begin |
432 case Gear^.Frame div 10 of |
432 case Gear^.Frame div 10 of |
433 0:Tint(0, $FF, 0, floor(Gear^.FrameTicks * $FF / 1000)); |
433 0:Tint(0, $FF, 0, round(Gear^.FrameTicks * $FF / 1000)); |
434 1:Tint($FF, 0, 0, floor(Gear^.FrameTicks * $FF / 1000)); |
434 1:Tint($FF, 0, 0, round(Gear^.FrameTicks * $FF / 1000)); |
435 end; |
435 end; |
436 DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0); |
436 DrawSprite(sprHealth, round(Gear^.X) + WorldDx - 8, round(Gear^.Y) + WorldDy - 8, 0); |
437 end; |
437 end; |
438 vgtShell: begin |
438 vgtShell: begin |
439 if Gear^.FrameTicks < $FF then |
439 if Gear^.FrameTicks < $FF then |
453 else |
453 else |
454 Tint($FF, $FF, $FF, $80); |
454 Tint($FF, $FF, $FF, $80); |
455 DrawRotatedF(sprBeeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle); |
455 DrawRotatedF(sprBeeTrace, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, (RealTicks shr 4) mod cMaxAngle); |
456 end; |
456 end; |
457 vgtSmokeRing: begin |
457 vgtSmokeRing: begin |
458 Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); |
458 Tint($FF, $FF, $FF, round(Gear^.alpha * $FF)); |
459 DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle); |
459 DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle); |
460 end; |
460 end; |
461 vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); |
461 vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); |
462 vgtNote: DrawRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); |
462 vgtNote: DrawRotatedF(sprNote, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); |
463 vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle); |
463 vgtBulletHit: DrawRotatedF(sprBulletHit, round(Gear^.X) + WorldDx - 0, round(Gear^.Y) + WorldDy - 0, 7 - (Gear^.FrameTicks div 50), 1, Gear^.Angle); |