370 FillRoundInLandFT(X, Y, Radius, changePixelNotSetNotCurrent); |
370 FillRoundInLandFT(X, Y, Radius, changePixelNotSetNotCurrent); |
371 end; |
371 end; |
372 |
372 |
373 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); |
373 procedure DrawIceBreak(x, y, iceRadius, iceHeight: Longint); |
374 var |
374 var |
375 i, j: integer; |
375 i, j, iceL, iceR, IceT, iceB: LongInt; |
376 landRect: TSDL_Rect; |
376 landRect: TSDL_Rect; |
377 begin |
377 begin |
378 for i := min(max(x - iceRadius, 0), LAND_WIDTH - 1) to min(max(x + iceRadius, 0), LAND_WIDTH - 1) do |
378 // figure out bottom/left/right/top coords of ice to draw |
379 begin |
379 |
380 for j := min(max(y, 0), LAND_HEIGHT - 1) to min(max(y + iceHeight, 0), LAND_HEIGHT - 1) do |
380 // determine absolute limits first |
|
381 iceT:= 0; |
|
382 iceB:= min(cWaterLine, LAND_HEIGHT - 1); |
|
383 |
|
384 iceL:= 0; |
|
385 iceR:= LAND_WIDTH - 1; |
|
386 |
|
387 if WorldEdge <> weNone then |
|
388 begin |
|
389 iceL:= max(leftX, iceL); |
|
390 iceR:= min(rightX, iceR); |
|
391 end; |
|
392 |
|
393 // adjust based on location but without violating absolute limits |
|
394 if y >= cWaterLine then |
|
395 begin |
|
396 iceL:= max(x - iceRadius, iceL); |
|
397 iceR:= min(x + iceRadius, iceR); |
|
398 iceT:= max(cWaterLine - iceHeight, iceT); |
|
399 end |
|
400 else {if WorldEdge = weSea then} |
|
401 begin |
|
402 iceT:= max(y - iceRadius, iceT); |
|
403 iceB:= min(y + iceRadius, iceB); |
|
404 if x <= leftX then |
|
405 iceR:= min(leftX + iceHeight, iceR) |
|
406 else {if x >= rightX then} |
|
407 iceL:= max(LongInt(rightX) - iceHeight, iceL); |
|
408 end; |
|
409 |
|
410 // don't continue if all ice is outside land array |
|
411 if (iceL > iceR) or (iceT > iceB) then |
|
412 exit(); |
|
413 |
|
414 for i := iceL to iceR do |
|
415 begin |
|
416 for j := iceT to iceB do |
381 begin |
417 begin |
382 if Land[j, i] = 0 then |
418 if Land[j, i] = 0 then |
383 begin |
419 begin |
384 Land[j, i] := lfIce; |
420 Land[j, i] := lfIce; |
385 if (cReducedQuality and rqBlurryLand) = 0 then |
421 if (cReducedQuality and rqBlurryLand) = 0 then |
387 else |
423 else |
388 fillPixelFromIceSprite(i div 2, j div 2); |
424 fillPixelFromIceSprite(i div 2, j div 2); |
389 end; |
425 end; |
390 end; |
426 end; |
391 end; |
427 end; |
392 landRect.x := min(max(x - iceRadius, 0), LAND_WIDTH - 1); |
428 |
393 landRect.y := min(max(y, 0), LAND_HEIGHT - 1); |
429 landRect.x := iceL; |
394 landRect.w := min(2*iceRadius, LAND_WIDTH - landRect.x - 1); |
430 landRect.y := iceT; |
395 landRect.h := min(iceHeight, LAND_HEIGHT - landRect.y - 1); |
431 landRect.w := iceR - IceL + 1; |
|
432 landRect.h := iceB - iceT + 1; |
|
433 |
396 UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
434 UpdateLandTexture(landRect.x, landRect.w, landRect.y, landRect.h, true); |
397 end; |
435 end; |
398 |
436 |
399 function DrawExplosion(X, Y, Radius: LongInt): Longword; |
437 function DrawExplosion(X, Y, Radius: LongInt): Longword; |
400 var |
438 var |