378 i:= Y1; |
379 i:= Y1; |
379 Y1:= Y2; |
380 Y1:= Y2; |
380 Y2:= i |
381 Y2:= i |
381 end; |
382 end; |
382 k:= (Y2 - Y1) / (X2 - X1); |
383 k:= (Y2 - Y1) / (X2 - X1); |
|
384 ladd:= sqrt(1 + sqr(k)); |
383 if X1 < 0 then |
385 if X1 < 0 then |
384 begin |
386 begin |
385 t:= Y1 - 2 - k * X1; |
387 t:= Y1 - 2 - k * X1; |
386 X1:= 0 |
388 X1:= 0 |
387 end else t:= Y1 - 2; |
389 end else t:= Y1 - 2; |
388 if X2 > cScreenWidth then X2:= cScreenWidth; |
390 if X2 > cScreenWidth then X2:= cScreenWidth; |
389 r.x:= X1; |
391 for x:= X1 to X2 do |
390 while r.x <= X2 do |
392 begin |
391 begin |
393 roplen:= roplen + ladd; |
392 r.y:= round(t); |
394 if roplen > nodlen then |
393 r.w:= 4; |
395 begin |
394 r.h:= 4; |
396 DrawGear(sRopeNode, x - 2, round(t) - 2, Surface); |
395 SDL_FillRect(Surface, @r, cWhiteColor); |
397 roplen:= roplen - nodlen; |
396 t:= t + k*3; |
398 end; |
397 inc(r.x, 3) |
399 t:= t + k; |
398 end; |
400 end; |
399 end else |
401 end else |
400 begin |
402 begin |
401 if Y1 > Y2 then |
403 if Y1 > Y2 then |
402 begin |
404 begin |
403 i:= X1; |
405 i:= X1; |
406 i:= Y1; |
408 i:= Y1; |
407 Y1:= Y2; |
409 Y1:= Y2; |
408 Y2:= i |
410 Y2:= i |
409 end; |
411 end; |
410 k:= (X2 - X1) / (Y2 - Y1); |
412 k:= (X2 - X1) / (Y2 - Y1); |
|
413 ladd:= sqrt(1 + sqr(k)); |
411 if Y1 < 0 then |
414 if Y1 < 0 then |
412 begin |
415 begin |
413 t:= X1 - 2 - k * Y1; |
416 t:= X1 - 2 - k * Y1; |
414 Y1:= 0 |
417 Y1:= 0 |
415 end else t:= X1 - 2; |
418 end else t:= X1 - 2; |
416 if Y2 > cScreenHeight then Y2:= cScreenHeight; |
419 if Y2 > cScreenHeight then Y2:= cScreenHeight; |
417 r.y:= Y1; |
420 for y:= Y1 to Y2 do |
418 while r.y <= Y2 do |
421 begin |
419 begin |
422 roplen:= roplen + ladd; |
420 r.x:= round(t); |
423 if roplen > nodlen then |
421 r.w:= 4; |
424 begin |
422 r.h:= 4; |
425 DrawGear(sRopeNode, round(t) - 2, y - 2, Surface); |
423 SDL_FillRect(Surface, @r, cWhiteColor); |
426 roplen:= roplen - nodlen; |
424 t:= t + k*3; |
427 end; |
425 inc(r.y, 3) |
428 t:= t + k; |
426 end; |
429 end; |
427 end |
430 end |
428 end; |
431 end; |
429 |
432 |
430 begin |
433 begin |
431 Gear:= GearsList; |
434 Gear:= GearsList; |
441 gtHealthTag: DrawCaption(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, PHedgehog(Gear.Hedgehog).HealthTagRect, Surface, true); |
444 gtHealthTag: DrawCaption(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, PHedgehog(Gear.Hedgehog).HealthTagRect, Surface, true); |
442 gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface); |
445 gtGrave: DrawSpriteFromRect(PHedgehog(Gear.Hedgehog).Team.GraveRect, Round(Gear.X) + WorldDx - 16, Round(Gear.Y) + WorldDy - 16, 32, (GameTicks shr 7) and 7, Surface); |
443 gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface); |
446 gtUFO: DrawSprite(sprUFO, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, (GameTicks shr 7) mod 4, Surface); |
444 gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
447 gtSmokeTrace: if Gear.State < 8 then DrawSprite(sprSmokeTrace, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
445 gtRope: begin |
448 gtRope: begin |
446 DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, |
449 roplen:= 0; |
447 Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy); |
|
448 if RopePoints.Count > 0 then |
450 if RopePoints.Count > 0 then |
449 begin |
451 begin |
450 i:= 0; |
452 i:= 0; |
451 while i < Pred(RopePoints.Count) do |
453 while i < Pred(RopePoints.Count) do |
452 begin |
454 begin |
454 Round(RopePoints.ar[Succ(i)].X) + WorldDx, Round(RopePoints.ar[Succ(i)].Y) + WorldDy); |
456 Round(RopePoints.ar[Succ(i)].X) + WorldDx, Round(RopePoints.ar[Succ(i)].Y) + WorldDy); |
455 inc(i) |
457 inc(i) |
456 end; |
458 end; |
457 DrawRopeLine(Round(RopePoints.ar[i].X) + WorldDx, Round(RopePoints.ar[i].Y) + WorldDy, |
459 DrawRopeLine(Round(RopePoints.ar[i].X) + WorldDx, Round(RopePoints.ar[i].Y) + WorldDy, |
458 Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy); |
460 Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy); |
|
461 DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, |
|
462 Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy); |
459 DrawSprite(sprRopeHook, Round(RopePoints.ar[0].X) + WorldDx - 16, Round(RopePoints.ar[0].Y) + WorldDy - 16, RopePoints.HookAngle, Surface); |
463 DrawSprite(sprRopeHook, Round(RopePoints.ar[0].X) + WorldDx - 16, Round(RopePoints.ar[0].Y) + WorldDy - 16, RopePoints.HookAngle, Surface); |
460 end else |
464 end else |
|
465 begin |
|
466 DrawRopeLine(Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, |
|
467 Round(PHedgehog(Gear.Hedgehog).Gear.X) + WorldDx, Round(PHedgehog(Gear.Hedgehog).Gear.Y) + WorldDy); |
461 DrawSprite(sprRopeHook, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface); |
468 DrawSprite(sprRopeHook, Round(Gear.X) - 16 + WorldDx, Round(Gear.Y) - 16 + WorldDy, DxDy2Angle32(Gear.dY, Gear.dX), Surface); |
|
469 end; |
462 end; |
470 end; |
463 gtExplosion: DrawSprite(sprExplosion50, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
471 gtExplosion: DrawSprite(sprExplosion50, Round(Gear.X) + WorldDx, Round(Gear.Y) + WorldDy, Gear.State, Surface); |
464 gtMine: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420) |
472 gtMine: if ((Gear.State and gstAttacking) = 0)or((Gear.Timer and $3FF) < 420) |
465 then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface) |
473 then DrawSprite(sprMineOff , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface) |
466 else DrawSprite(sprMineOn , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface); |
474 else DrawSprite(sprMineOn , Round(Gear.X) - 8 + WorldDx, Round(Gear.Y) - 8 + WorldDy, trunc(Gear.DirAngle), Surface); |