Skip to content

Commit

Permalink
Fix #17229: Rename G1_FLAG_BMP to G1_FLAG_HAS_TRANSPARENCY (#17441)
Browse files Browse the repository at this point in the history
* Renamed All Instance of G1_FLAG_BMP

Renamed all instances of G1_FLAG_BMP to GA_FLAG_HAS_TRANSPARENCY

* Fixed comments and labels

Fixed comments and labels to be more in line with new definitions
  • Loading branch information
jazzysoggy committed Jun 25, 2022
1 parent fb7be45 commit f77611d
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/openrct2-ui/scripting/CustomImages.cpp
Expand Up @@ -155,7 +155,7 @@ namespace OpenRCT2::Scripting
obj.Set("width", g1->width);
obj.Set("height", g1->height);

obj.Set("isBMP", (g1->flags & G1_FLAG_BMP) != 0);
obj.Set("hasTransparent", (g1->flags & G1_FLAG_HAS_TRANSPARENCY) != 0);
obj.Set("isRLE", (g1->flags & G1_FLAG_RLE_COMPRESSION) != 0);
obj.Set("isPalette", (g1->flags & G1_FLAG_PALETTE) != 0);
obj.Set("noZoom", (g1->flags & G1_FLAG_NO_ZOOM_DRAW) != 0);
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2-ui/windows/InstallTrack.cpp
Expand Up @@ -208,7 +208,7 @@ static void WindowInstallTrackPaint(rct_window* w, rct_drawpixelinfo* dpi)
g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * TRACK_PREVIEW_IMAGE_SIZE);
g1temp.width = 370;
g1temp.height = 217;
g1temp.flags = G1_FLAG_BMP;
g1temp.flags = G1_FLAG_HAS_TRANSPARENCY;
gfx_set_g1_element(SPR_TEMP, &g1temp);
drawing_engine_invalidate_image(SPR_TEMP);
gfx_draw_sprite(dpi, ImageId(SPR_TEMP), screenPos);
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2-ui/windows/TrackList.cpp
Expand Up @@ -504,7 +504,7 @@ class TrackListWindow final : public Window
g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * TRACK_PREVIEW_IMAGE_SIZE);
g1temp.width = 370;
g1temp.height = 217;
g1temp.flags = G1_FLAG_BMP;
g1temp.flags = G1_FLAG_HAS_TRANSPARENCY;
gfx_set_g1_element(SPR_TEMP, &g1temp);
drawing_engine_invalidate_image(SPR_TEMP);
gfx_draw_sprite(&dpi, ImageId(SPR_TEMP), trackPreview);
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/drawing/Drawing.Sprite.BMP.cpp
Expand Up @@ -102,7 +102,7 @@ void FASTCALL gfx_bmp_sprite_to_buffer(rct_drawpixelinfo& dpi, const DrawSpriteA
// Used for glass.
DrawBMPSprite<BLEND_TRANSPARENT | BLEND_DST>(dpi, args);
}
else if (!(args.SourceImage.flags & G1_FLAG_BMP))
else if (!(args.SourceImage.flags & G1_FLAG_HAS_TRANSPARENCY))
{
// Copy raw bitmap data to target
DrawBMPSprite<BLEND_NONE>(dpi, args);
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2/drawing/Drawing.Sprite.cpp
Expand Up @@ -633,8 +633,8 @@ void FASTCALL gfx_draw_sprite_raw_masked_software(
return;
}

// Only BMP format is supported for masking
if (!(imgMask->flags & G1_FLAG_BMP) || !(imgColour->flags & G1_FLAG_BMP))
// Must have transparency in order to pass check
if (!(imgMask->flags & G1_FLAG_HAS_TRANSPARENCY) || !(imgColour->flags & G1_FLAG_HAS_TRANSPARENCY))
{
gfx_draw_sprite_software(dpi, colourImage, scrCoords);
return;
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/drawing/Drawing.h
Expand Up @@ -146,7 +146,7 @@ assert_struct_size(rct_g1_element_32bit, 0x10);

enum
{
G1_FLAG_BMP = (1 << 0), // Image data is encoded as raw pixels (no transparency)
G1_FLAG_HAS_TRANSPARENCY = (1 << 0), // Image data contains transparent pixels (0XFF) which will not be rendered
G1_FLAG_1 = (1 << 1),
G1_FLAG_RLE_COMPRESSION = (1 << 2), // Image data is encoded using RCT2's form of run length encoding
G1_FLAG_PALETTE = (1 << 3), // Image data is a sequence of palette entries R8G8B8
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/drawing/ImageImporter.cpp
Expand Up @@ -46,7 +46,7 @@ ImportResult ImageImporter::Import(
rct_g1_element outElement;
outElement.width = width;
outElement.height = height;
outElement.flags = (flags & ImportFlags::RLE ? G1_FLAG_RLE_COMPRESSION : G1_FLAG_BMP);
outElement.flags = (flags & ImportFlags::RLE ? G1_FLAG_RLE_COMPRESSION : G1_FLAG_HAS_TRANSPARENCY);
outElement.x_offset = offsetX;
outElement.y_offset = offsetY;
outElement.zoomed_offset = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/openrct2/drawing/ScrollingText.cpp
Expand Up @@ -108,7 +108,7 @@ void scrolling_text_initialise_bitmaps()
g1.offset = _drawScrollTextList[i].bitmap;
g1.x_offset = -32;
g1.y_offset = 0;
g1.flags = G1_FLAG_BMP;
g1.flags = G1_FLAG_HAS_TRANSPARENCY;
g1.width = 64;
g1.height = 40;
g1.offset[0] = 0xFF;
Expand Down
4 changes: 2 additions & 2 deletions src/openrct2/interface/Viewport.cpp
Expand Up @@ -1508,8 +1508,8 @@ static bool is_pixel_present_bmp(
{
PROFILED_FUNCTION();

// Probably used to check for corruption
if (!(g1->flags & G1_FLAG_BMP))
// Needs investigation as it has no consideration for pure BMP maps.
if (!(g1->flags & G1_FLAG_HAS_TRANSPARENCY))
{
return false;
}
Expand Down

0 comments on commit f77611d

Please sign in to comment.