# HG changeset patch # User sheepluva # Date 1436778061 -7200 # Node ID cb06b79852617dfd1048286b2dd2ace78adbe78b # Parent 71927bdb776ad64d1464722dadb9d0f9e4d7cf0c don't keep around those right-side fort files which are just mirror images of left-side forts. generate them at run-time instead. note: inlining changes and deleting files - so consider clean build/install diff -r 71927bdb776a -r cb06b7985261 hedgewars/uLand.pas --- a/hedgewars/uLand.pas Mon Jul 13 06:19:51 2015 +0200 +++ b/hedgewars/uLand.pas Mon Jul 13 11:01:01 2015 +0200 @@ -372,8 +372,16 @@ BlitImageAndGenerateCollisionInfo(leftX+150, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); SDL_FreeSurface(tmpsurf); -tmpsurf:= LoadDataImage(ptForts, ClansArray[1]^.Teams[0]^.FortName + 'R', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); -BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); +// not critical because if no R we can fallback to mirrored L +tmpsurf:= LoadDataImage(ptForts, ClansArray[1]^.Teams[0]^.FortName + 'R', ifAlpha or ifTransparent or ifIgnoreCaps); +// fallback +if tmpsurf = nil then + begin + tmpsurf:= LoadDataImage(ptForts, ClansArray[1]^.Teams[0]^.FortName + 'L', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); + BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf, 0, true); + end +else + BlitImageAndGenerateCollisionInfo(rightX - 150 - tmpsurf^.w, LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); SDL_FreeSurface(tmpsurf); end; diff -r 71927bdb776a -r cb06b7985261 hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Mon Jul 13 06:19:51 2015 +0200 +++ b/hedgewars/uLandObjects.pas Mon Jul 13 11:01:01 2015 +0200 @@ -26,7 +26,8 @@ procedure FreeLandObjects(); procedure LoadThemeConfig; procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; -procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); +procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); inline; +procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word; Flip: boolean); procedure BlitImageUsingMask(cpX, cpY: Longword; Image, Mask: PSDL_Surface); procedure AddOnLandObjects(Surface: PSDL_Surface); procedure SetLand(var LandWord: Word; Pixel: LongWord); inline; @@ -92,12 +93,17 @@ procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline; begin - BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, 0); + BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, 0, false); end; -procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); +procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word); inline; +begin + BlitImageAndGenerateCollisionInfo(cpX, cpY, Width, Image, LandFlags, false); +end; + +procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; LandFlags: Word; Flip: boolean); var p: PLongwordArray; - x, y: Longword; + px, x, y: Longword; bpp: LongInt; begin WriteToConsole('Generating collision info... '); @@ -115,21 +121,29 @@ for y:= 0 to Pred(Image^.h) do begin for x:= 0 to Pred(Width) do - if (p^[x] and AMask) <> 0 then + begin + // map image pixels per line backwards if in flip mode + if Flip then + px:= Pred(Image^.w) - x + else + px:= x; + + if (p^[px] and AMask) <> 0 then begin if (cReducedQuality and rqBlurryLand) = 0 then begin if (LandPixels[cpY + y, cpX + x] = 0) - or (((p^[x] and AMask) <> 0) and (((LandPixels[cpY + y, cpX + x] and AMask) shr AShift) < 255)) then - LandPixels[cpY + y, cpX + x]:= p^[x]; + or (((p^[px] and AMask) <> 0) and (((LandPixels[cpY + y, cpX + x] and AMask) shr AShift) < 255)) then + LandPixels[cpY + y, cpX + x]:= p^[px]; end else if LandPixels[(cpY + y) div 2, (cpX + x) div 2] = 0 then - LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[x]; + LandPixels[(cpY + y) div 2, (cpX + x) div 2]:= p^[px]; - if (Land[cpY + y, cpX + x] <= lfAllObjMask) and ((p^[x] and AMask) <> 0) then + if (Land[cpY + y, cpX + x] <= lfAllObjMask) and ((p^[px] and AMask) <> 0) then Land[cpY + y, cpX + x]:= lfObject or LandFlags end; + end; p:= PLongwordArray(@(p^[Image^.pitch shr 2])) end; diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/CakeR.png Binary file share/hedgewars/Data/Forts/CakeR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/CastleR.png Binary file share/hedgewars/Data/Forts/CastleR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/EvilChickenR.png Binary file share/hedgewars/Data/Forts/EvilChickenR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/FlowerhogR.png Binary file share/hedgewars/Data/Forts/FlowerhogR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/HydrantR.png Binary file share/hedgewars/Data/Forts/HydrantR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/LegoR.png Binary file share/hedgewars/Data/Forts/LegoR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/PlaneR.png Binary file share/hedgewars/Data/Forts/PlaneR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/StatueR.png Binary file share/hedgewars/Data/Forts/StatueR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/SteelTowerR.png Binary file share/hedgewars/Data/Forts/SteelTowerR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/TankR.png Binary file share/hedgewars/Data/Forts/TankR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/UFOR.png Binary file share/hedgewars/Data/Forts/UFOR.png has changed diff -r 71927bdb776a -r cb06b7985261 share/hedgewars/Data/Forts/WoodR.png Binary file share/hedgewars/Data/Forts/WoodR.png has changed