2392 if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
2392 if (Gear^.Health > 0) and ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
2393 if (cBarrelHealth div Gear^.Health) > 2 then |
2393 if (cBarrelHealth div Gear^.Health) > 2 then |
2394 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
2394 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
2395 else |
2395 else |
2396 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
2396 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
2397 // health texture |
2397 |
2398 FreeAndNilTexture(Gear^.Tex); |
|
2399 Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); |
|
2400 dec(Gear^.Health, Gear^.Damage); |
2398 dec(Gear^.Health, Gear^.Damage); |
2401 Gear^.Damage := 0; |
2399 Gear^.Damage := 0; |
2402 if Gear^.Health <= 0 then |
2400 if Gear^.Health <= 0 then |
2403 doStepCase(Gear); |
2401 doStepCase(Gear) |
|
2402 else |
|
2403 // health texture (FlightTime = health when the last texture was generated) |
|
2404 if Gear^.Health <> Gear^.FlightTime then |
|
2405 begin |
|
2406 Gear^.FlightTime:= Gear^.Health; |
|
2407 FreeAndNilTexture(Gear^.Tex); |
|
2408 Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); |
|
2409 end; |
2404 end; |
2410 end; |
2405 |
2411 |
2406 procedure doStepCase(Gear: PGear); |
2412 procedure doStepCase(Gear: PGear); |
2407 var |
2413 var |
2408 i, x, y: LongInt; |
2414 i, x, y: LongInt; |
2467 if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
2473 if ((Gear^.Health * 100 div cBarrelHealth) < random(90)) and ((GameTicks and $FF) = 0) then |
2468 if (cBarrelHealth div Gear^.Health) > 2 then |
2474 if (cBarrelHealth div Gear^.Health) > 2 then |
2469 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
2475 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmoke) |
2470 else |
2476 else |
2471 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
2477 AddVisualGear(hwRound(Gear^.X) - 16 + Random(32), hwRound(Gear^.Y) - 2, vgtSmokeWhite); |
|
2478 |
2472 dec(Gear^.Health, Gear^.Damage); |
2479 dec(Gear^.Health, Gear^.Damage); |
2473 Gear^.Damage := 0; |
2480 Gear^.Damage := 0; |
2474 // health texture |
2481 // health texture (FlightTime = health when the last texture was generated) |
2475 FreeAndNilTexture(Gear^.Tex); |
2482 if Gear^.Health <> Gear^.FlightTime then |
2476 Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); |
2483 begin |
|
2484 Gear^.FlightTime:= Gear^.Health; |
|
2485 FreeAndNilTexture(Gear^.Tex); |
|
2486 Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff808080, fnt16); |
|
2487 end; |
2477 end |
2488 end |
2478 else |
2489 else |
2479 begin |
2490 begin |
2480 // health texture for health crate |
2491 // health texture for health crate |
2481 if (k = gtCase) and ((Gear^.Pos and $02) <> 0) then |
2492 if (k = gtCase) and ((Gear^.Pos and posCaseHealth) <> 0) then |
2482 begin |
2493 begin |
2483 FreeAndNilTexture(Gear^.Tex); |
|
2484 if ((Gear^.State and gstFrozen) = 0) then |
2494 if ((Gear^.State and gstFrozen) = 0) then |
2485 begin |
2495 begin |
2486 // Karma=2: Always hide health |
2496 // Karma=2: Always hide health |
2487 if (Gear^.Karma = 2) then |
2497 if (Gear^.Karma = 2) then |
2488 i:= 0 |
2498 i:= 0 |
2494 i:= 0 |
2504 i:= 0 |
2495 // Always show health (default) |
2505 // Always show health (default) |
2496 else |
2506 else |
2497 i:= 1; |
2507 i:= 1; |
2498 if i = 1 then |
2508 if i = 1 then |
2499 Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16) |
2509 begin |
|
2510 if Gear^.Health <> Gear^.FlightTime then |
|
2511 begin |
|
2512 Gear^.FlightTime:= Gear^.Health; |
|
2513 FreeAndNilTexture(Gear^.Tex); |
|
2514 Gear^.Tex := RenderStringTex(ansistring(inttostr(Gear^.Health)), $ff80ff80, fnt16) |
|
2515 end |
|
2516 end |
2500 else |
2517 else |
2501 Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16) |
2518 begin |
|
2519 if Gear^.FlightTime <> $ffffffff then |
|
2520 begin |
|
2521 Gear^.FlightTime:= $ffffffff; |
|
2522 FreeAndNilTexture(Gear^.Tex); |
|
2523 Gear^.Tex := RenderStringTex(trmsg[sidUnknownGearValue], $ff80ff80, fnt16) |
|
2524 end |
|
2525 end |
2502 end; |
2526 end; |
2503 end; |
2527 end; |
2504 if Gear^.Timer = 500 then |
2528 if Gear^.Timer = 500 then |
2505 begin |
2529 begin |
2506 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up |
2530 (* Can't make sparkles team coloured without working out what the next team is going to be. This should be solved, really, since it also screws up |