# HG changeset patch # User sheepluva # Date 1506715751 -7200 # Node ID 00b539e6115d0df35c398dbdf01f038474090c32 # Parent 7bae1fab444bb527db991f93a39e615b4a971a20 rename ifTransparent to ifColorKey This should make the name less confusing. However this image-flag will possibly be dropped completely. diff -r 7bae1fab444b -r 00b539e6115d hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Fri Sep 29 22:06:29 2017 +0200 +++ b/hedgewars/uConsts.pas Fri Sep 29 22:09:11 2017 +0200 @@ -93,7 +93,7 @@ ifNone = $00000000; // nothing special ifAlpha = $00000001; // use alpha channel (unused right now?) ifCritical = $00000002; // image is critical for gameplay (exit game if unable to load) - ifTransparent = $00000004; // image uses transparent pixels (color keying) + ifColorKey = $00000004; // image uses transparent pixels (color keying) ifIgnoreCaps = $00000008; // ignore hardware capabilities when loading (i.e. image will not be drawn using OpenGL) // texture priority (allows OpenGL to keep frequently used textures in video memory more easily) diff -r 7bae1fab444b -r 00b539e6115d hedgewars/uLand.pas --- a/hedgewars/uLand.pas Fri Sep 29 22:06:29 2017 +0200 +++ b/hedgewars/uLand.pas Fri Sep 29 22:09:11 2017 +0200 @@ -53,7 +53,7 @@ x, yd, yu: LongInt; targetMask: Word; begin - tmpsurf:= LoadDataImage(ptCurrTheme, 'Border', ifCritical or ifIgnoreCaps or ifTransparent); + tmpsurf:= LoadDataImage(ptCurrTheme, 'Border', ifCritical or ifIgnoreCaps or ifColorKey); // if mask only, all land gets filled with landtex and therefore needs borders if maskOnly then @@ -251,7 +251,7 @@ SDL_UnlockSurface(mapsurf); // freed in freeModule() below - LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); + LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifColorKey); if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); end; @@ -278,7 +278,7 @@ SDL_FreeSurface(tmpsurf); // freed in freeModule() below - LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); + LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifColorKey); if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); end; @@ -544,11 +544,11 @@ if mirror then begin // not critical because if no R we can fallback to mirrored L - tmpsurf:= LoadDataImage(ptForts, SpawnClansArray[i]^.Teams[0]^.FortName + 'R', ifAlpha or ifTransparent or ifIgnoreCaps); + tmpsurf:= LoadDataImage(ptForts, SpawnClansArray[i]^.Teams[0]^.FortName + 'R', ifAlpha or ifColorKey or ifIgnoreCaps); // fallback if tmpsurf = nil then begin - tmpsurf:= LoadDataImage(ptForts, SpawnClansArray[i]^.Teams[0]^.FortName + 'L', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); + tmpsurf:= LoadDataImage(ptForts, SpawnClansArray[i]^.Teams[0]^.FortName + 'L', ifAlpha or ifCritical or ifColorKey or ifIgnoreCaps); BlitImageAndGenerateCollisionInfo(leftX + sectionWidth * i + ((sectionWidth - tmpsurf^.w) div 2), LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf, 0, true); end else @@ -557,7 +557,7 @@ end else begin - tmpsurf:= LoadDataImage(ptForts, SpawnClansArray[i]^.Teams[0]^.FortName + 'L', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); + tmpsurf:= LoadDataImage(ptForts, SpawnClansArray[i]^.Teams[0]^.FortName + 'L', ifAlpha or ifCritical or ifColorKey or ifIgnoreCaps); BlitImageAndGenerateCollisionInfo(leftX + sectionWidth * i + ((sectionWidth - tmpsurf^.w) div 2), LAND_HEIGHT - tmpsurf^.h, tmpsurf^.w, tmpsurf); SDL_FreeSurface(tmpsurf); end; @@ -597,11 +597,11 @@ x, y, cpX, cpY: Longword; mapName: shortstring; begin -tmpsurf:= LoadDataImage(ptMapCurrent, 'mask', ifAlpha or ifTransparent or ifIgnoreCaps); +tmpsurf:= LoadDataImage(ptMapCurrent, 'mask', ifAlpha or ifColorKey or ifIgnoreCaps); if tmpsurf = nil then begin mapName:= ExtractFileName(cPathz[ptMapCurrent]); - tmpsurf:= LoadDataImage(ptMissionMaps, mapName + '/mask', ifAlpha or ifTransparent or ifIgnoreCaps); + tmpsurf:= LoadDataImage(ptMissionMaps, mapName + '/mask', ifAlpha or ifColorKey or ifIgnoreCaps); end; @@ -639,7 +639,7 @@ if not disableLandBack then begin // freed in freeModule() below - LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); + LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifColorKey); if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface) end; @@ -656,11 +656,11 @@ begin WriteLnToConsole('Loading land from file...'); AddProgress; -tmpsurf:= LoadDataImage(ptMapCurrent, 'map', ifAlpha or ifTransparent or ifIgnoreCaps); +tmpsurf:= LoadDataImage(ptMapCurrent, 'map', ifAlpha or ifColorKey or ifIgnoreCaps); if tmpsurf = nil then begin mapName:= ExtractFileName(cPathz[ptMapCurrent]); - tmpsurf:= LoadDataImage(ptMissionMaps, mapName + '/map', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps); + tmpsurf:= LoadDataImage(ptMissionMaps, mapName + '/map', ifAlpha or ifCritical or ifColorKey or ifIgnoreCaps); if not allOK then exit; end; // (bare) Sanity check. Considering possible LongInt comparisons as well as just how much system memoery it would take diff -r 7bae1fab444b -r 00b539e6115d hedgewars/uLandObjects.pas --- a/hedgewars/uLandObjects.pas Fri Sep 29 22:06:29 2017 +0200 +++ b/hedgewars/uLandObjects.pas Fri Sep 29 22:09:11 2017 +0200 @@ -259,7 +259,7 @@ bRes: boolean; begin if girSurf = nil then - girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifTransparent or ifIgnoreCaps); + girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifColorKey or ifIgnoreCaps); girderHeight:= girSurf^.h; @@ -685,10 +685,10 @@ with ThemeObjects.objs[Pred(ThemeObjects.Count)] do begin i:= Pos(',', s); - Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifTransparent or ifIgnoreCaps or ifCritical); + Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifColorKey or ifIgnoreCaps or ifCritical); Width:= Surf^.w; Height:= Surf^.h; - Mask:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i)))+'_mask', ifTransparent or ifIgnoreCaps); + Mask:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i)))+'_mask', ifColorKey or ifIgnoreCaps); Delete(s, 1, i); i:= Pos(',', s); Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); @@ -762,7 +762,7 @@ with SprayObjects.objs[Pred(SprayObjects.Count)] do begin i:= Pos(',', s); - Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifTransparent or ifIgnoreCaps); + Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifColorKey or ifIgnoreCaps); Width:= Surf^.w; Height:= Surf^.h; Delete(s, 1, i); diff -r 7bae1fab444b -r 00b539e6115d hedgewars/uStore.pas --- a/hedgewars/uStore.pas Fri Sep 29 22:06:29 2017 +0200 +++ b/hedgewars/uStore.pas Fri Sep 29 22:09:11 2017 +0200 @@ -344,7 +344,7 @@ begin if GraveName = '' then GraveName:= 'Statue'; - texsurf:= LoadDataImageAltFile(ptGraves, GraveName, 'Statue', ifCritical or ifTransparent); + texsurf:= LoadDataImageAltFile(ptGraves, GraveName, 'Statue', ifCritical or ifColorKey); GraveTex:= Surface2Tex(texsurf, false); SDL_FreeSurface(texsurf) end @@ -412,7 +412,7 @@ tmpsurf:= Surface else begin - imflags := (ifAlpha or ifTransparent); + imflags := (ifAlpha or ifColorKey); // these sprites are optional if not (ii in [sprHorizont, sprHorizontL, sprHorizontR, sprSky, sprSkyL, sprSkyR, sprChunk, sprFlakeL, sprSDFlakeL, sprCloudL, sprSDCloudL]) then // FIXME: hack @@ -491,7 +491,7 @@ if not reload then AddProgress; - tmpsurf:= LoadDataImage(ptGraphics, cHHFileName, ifAlpha or ifCritical or ifTransparent); + tmpsurf:= LoadDataImage(ptGraphics, cHHFileName, ifAlpha or ifCritical or ifColorKey); HHTexture:= Surface2Tex(tmpsurf, false); SDL_FreeSurface(tmpsurf); @@ -663,7 +663,7 @@ tmpsurf:= doSurfaceConversion(tmpsurf); - if (imageFlags and ifTransparent) <> 0 then + if (imageFlags and ifColorKey) <> 0 then if checkFails(SDL_SetColorKey(tmpsurf, SDL_TRUE, 0) = 0, errmsgTransparentSet, true) then exit; WriteLnToConsole(msgOK + ' (' + inttostr(tmpsurf^.w) + 'x' + inttostr(tmpsurf^.h) + ')'); @@ -799,7 +799,7 @@ if Step = 0 then begin WriteToConsole(msgLoading + 'progress sprite: '); - texsurf:= LoadDataImage(ptGraphics, 'Progress', ifCritical or ifTransparent); + texsurf:= LoadDataImage(ptGraphics, 'Progress', ifCritical or ifColorKey); ProgrTex:= Surface2Tex(texsurf, false);