# HG changeset patch # User smaxx # Date 1280506842 -7200 # Node ID e2be39ee19f0a03c500a1ef896ce7b0f8f5ebdd9 # Parent f2d5bc20064a44a32a07568a5e5db97d4e8cefe8 Engine: * Engine will now try to load the grave "Statue" if it couldn't load a team's grave graphic (http://code.google.com/p/hedgewars/issues/detail?id=3) * Explosions may now create chunks/stones knocked out of the landscape (only supported on Olympic theme so far) diff -r f2d5bc20064a -r e2be39ee19f0 hedgewars/VGSHandlers.inc --- a/hedgewars/VGSHandlers.inc Fri Jul 30 12:07:30 2010 -0400 +++ b/hedgewars/VGSHandlers.inc Fri Jul 30 18:20:42 2010 +0200 @@ -543,3 +543,19 @@ Gear^.doStep:= @doStepBigExplosionWork; if Steps > 1 then Gear^.doStep(Gear, Steps-1); end; + +procedure doStepChunk(Gear: PVisualGear; Steps: Longword); +begin +Gear^.X:= Gear^.X + Gear^.dX * Steps; + +Gear^.Y:= Gear^.Y + Gear^.dY * Steps; +Gear^.dY:= Gear^.dY + cGravityf * Steps; + +Gear^.Angle:= round(Gear^.Angle + Steps) mod cMaxAngle; + +if round(Gear^.Y) > cWaterLine then + begin + DeleteVisualGear(Gear); + AddVisualGear(round(Gear^.X), round(Gear^.Y), vgtDroplet); + end +end; diff -r f2d5bc20064a -r e2be39ee19f0 hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Fri Jul 30 12:07:30 2010 -0400 +++ b/hedgewars/uConsts.pas Fri Jul 30 18:20:42 2010 +0200 @@ -73,7 +73,7 @@ sprHandDynamite, sprHandHellish, sprHandMine, sprHandSeduction, sprHandVamp, sprBigExplosion, sprSmokeRing, sprBeeTrace, sprEgg, sprTargetBee, sprHandBee, sprFeather, sprPiano, sprHandSineGun, sprPortalGun, sprPortal, - sprCheese, sprHandCheese, sprHandFlamethrower + sprCheese, sprHandCheese, sprHandFlamethrower, sprChunk ); // Gears that interact with other Gears and/or Land @@ -94,7 +94,7 @@ vgtSteam, vgtAmmo, vgtSmoke, vgtSmokeWhite, vgtHealth, vgtShell, vgtDust, vgtSplash, vgtDroplet, vgtSmokeRing, vgtBeeTrace, vgtEgg, vgtFeather, vgtHealthTag, vgtSmokeTrace, vgtEvilTrace, vgtExplosion, - vgtBigExplosion); + vgtBigExplosion, vgtChunk); TGearsType = set of TGearType; @@ -797,7 +797,9 @@ (FileName: 'amCheese'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; Width: 64; Height: 64; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandCheese (FileName: 'amFlamethrower'; Path: ptHedgehog; AltPath: ptNone; Texture: nil; Surface: nil; - Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprHandFlamethrower + Width: 128; Height: 128; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true),// sprHandFlamethrower + (FileName: 'Chunk'; Path: ptCurrTheme; AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 32; Height: 32; imageWidth: 0; imageHeight: 0; saveSurf: false; priority: tpMedium; getDimensions: false; getImageDimensions: true) // sprChunk ); Wavez: array [TWave] of record diff -r f2d5bc20064a -r e2be39ee19f0 hedgewars/uGears.pas --- a/hedgewars/uGears.pas Fri Jul 30 12:07:30 2010 -0400 +++ b/hedgewars/uGears.pas Fri Jul 30 18:20:42 2010 +0200 @@ -1177,6 +1177,7 @@ dmg, dmgRadius, dmgBase: LongInt; fX, fY: hwFloat; vg: PVisualGear; + i, cnt: LongInt; begin TargetPoint.X:= NoPointX; {$IFDEF DEBUGFILE}if Radius > 4 then AddFileLog('Explosion: at (' + inttostr(x) + ',' + inttostr(y) + ')');{$ENDIF} @@ -1261,7 +1262,13 @@ end; if (Mask and EXPLDontDraw) = 0 then - if (GameFlags and gfSolidLand) = 0 then DrawExplosion(X, Y, Radius); + if (GameFlags and gfSolidLand) = 0 then + begin + cnt:= DrawExplosion(X, Y, Radius) div 1608; // approx 2 16x16 circles to erase per chunk + if cnt > 0 then + for i:= 0 to cnt do + AddVisualGear(X, Y, vgtChunk) + end; uAIMisc.AwareOfExplosion(0, 0, 0) end; diff -r f2d5bc20064a -r e2be39ee19f0 hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Fri Jul 30 12:07:30 2010 -0400 +++ b/hedgewars/uLandGraphics.pas Fri Jul 30 18:20:42 2010 +0200 @@ -30,7 +30,7 @@ function SweepDirty: boolean; function Despeckle(X, Y: LongInt): boolean; function CheckLandValue(X, Y: LongInt; LandFlag: Word): boolean; -procedure DrawExplosion(X, Y, Radius: LongInt); +function DrawExplosion(X, Y, Radius: LongInt): Longword; procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt); procedure FillRoundInLand(X, Y, Radius: LongInt; Value: Longword); @@ -181,17 +181,22 @@ end; -procedure FillLandCircleLinesBG(x, y, dx, dy: LongInt); +function FillLandCircleLinesBG(x, y, dx, dy: LongInt): Longword; var i, t: LongInt; + cnt: Longword; begin +cnt:= 0; t:= y + dy; if (t and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then + begin + inc(cnt); if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= LandBackPixel(i, t) else LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) + end else if ((Land[t, i] and lfObject) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then @@ -203,10 +208,13 @@ if (t and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dx, 0) to min(x + dx, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then + begin + inc(cnt); if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= LandBackPixel(i, t) else LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) + end else if ((Land[t, i] and lfObject) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then @@ -218,10 +226,13 @@ if (t and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then + begin + inc(cnt); if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= LandBackPixel(i, t) else LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) + end else if ((Land[t, i] and lfObject) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then @@ -233,18 +244,20 @@ if (t and LAND_HEIGHT_MASK) = 0 then for i:= max(x - dy, 0) to min(x + dy, LAND_WIDTH - 1) do if ((Land[t, i] and lfBasic) <> 0) then - if (cReducedQuality and rqBlurryLand) = 0 then - LandPixels[t, i]:= LandBackPixel(i, t) - else - LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) - + begin + inc(cnt); + if (cReducedQuality and rqBlurryLand) = 0 then + LandPixels[t, i]:= LandBackPixel(i, t) + else + LandPixels[t div 2, i div 2]:= LandBackPixel(i, t) + end else if ((Land[t, i] and lfObject) <> 0) then if (cReducedQuality and rqBlurryLand) = 0 then LandPixels[t, i]:= 0 else LandPixels[t div 2, i div 2]:= 0; - +FillLandCircleLinesBG:= cnt; end; procedure FillLandCircleLinesEBC(x, y, dx, dy: LongInt); @@ -310,19 +323,21 @@ end; end; -procedure DrawExplosion(X, Y, Radius: LongInt); +function DrawExplosion(X, Y, Radius: LongInt): Longword; var dx, dy, ty, tx, d: LongInt; + cnt: Longword; begin // draw background land texture begin + cnt:= 0; dx:= 0; dy:= Radius; d:= 3 - 2 * Radius; while (dx < dy) do begin - FillLandCircleLinesBG(x, y, dx, dy); + inc(cnt, FillLandCircleLinesBG(x, y, dx, dy)); if (d < 0) then d:= d + 4 * dx + 6 else begin @@ -331,7 +346,7 @@ end; inc(dx) end; - if (dx = dy) then FillLandCircleLinesBG(x, y, dx, dy); + if (dx = dy) then inc(cnt, FillLandCircleLinesBG(x, y, dx, dy)); end; // draw a hole in land @@ -382,7 +397,8 @@ dx:= min(X + Radius + 1, LAND_WIDTH) - tx; ty:= max(Y - Radius - 1, 0); dy:= min(Y + Radius + 1, LAND_HEIGHT) - ty; -UpdateLandTexture(tx, dx, ty, dy) +UpdateLandTexture(tx, dx, ty, dy); +DrawExplosion:= cnt end; procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte); diff -r f2d5bc20064a -r e2be39ee19f0 hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Jul 30 12:07:30 2010 -0400 +++ b/hedgewars/uStore.pas Fri Jul 30 18:20:42 2010 +0200 @@ -356,8 +356,9 @@ if TeamsArray[t] <> nil then with TeamsArray[t]^ do begin - if GraveName = '' then GraveName:= 'Simple'; - texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifCritical or ifTransparent); + if GraveName = '' then GraveName:= 'Statue'; + texsurf:= LoadImage(Pathz[ptGraves] + '/' + GraveName, ifTransparent); + if texsurf = nil then texsurf:= LoadImage(Pathz[ptGraves] + '/Statue', ifCritical or ifTransparent); GraveTex:= Surface2Tex(texsurf, false); SDL_FreeSurface(texsurf) end diff -r f2d5bc20064a -r e2be39ee19f0 hedgewars/uVisualGears.pas --- a/hedgewars/uVisualGears.pas Fri Jul 30 12:07:30 2010 -0400 +++ b/hedgewars/uVisualGears.pas Fri Jul 30 18:20:42 2010 +0200 @@ -115,7 +115,8 @@ @doStepSmokeTrace, @doStepSmokeTrace, @doStepExplosion, - @doStepBigExplosion + @doStepBigExplosion, + @doStepChunk ); function AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0): PVisualGear; @@ -299,6 +300,15 @@ vgtBigExplosion: begin gear^.Angle:= random(360); end; + vgtChunk: begin + gear^.Frame:= random(4); + t:= random(1024); + sp:= 0.001 * (random(85) + 47); + dx:= AngleSin(t).QWordValue/4294967296 * sp; + dy:= AngleCos(t).QWordValue/4294967296 * sp; + if random(2) = 0 then dx := -dx; + (*if random(2) = 0 then*) dy := -2 * dy; + end; end; if State <> 0 then gear^.State:= State; @@ -455,6 +465,7 @@ Tint($FF, $FF, $FF, floor(Gear^.alpha * $FF)); DrawRotatedTextureF(SpritesData[sprSmokeRing].Texture, Gear^.scale, 0, 0, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, 0, 1, 200, 200, Gear^.Angle); end; + vgtChunk: DrawRotatedF(sprChunk, round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Frame, 1, Gear^.Angle); end; case Gear^.Kind of vgtSmallDamageTag: DrawCentered(round(Gear^.X) + WorldDx, round(Gear^.Y) + WorldDy, Gear^.Tex); diff -r f2d5bc20064a -r e2be39ee19f0 share/hedgewars/Data/Graphics/Chunk.png Binary file share/hedgewars/Data/Graphics/Chunk.png has changed diff -r f2d5bc20064a -r e2be39ee19f0 share/hedgewars/Data/Themes/Olympics/Chunk.png Binary file share/hedgewars/Data/Themes/Olympics/Chunk.png has changed