diff --git a/engines/ultima/ultima8/convert/convert_shape.cpp b/engines/ultima/ultima8/convert/convert_shape.cpp index 7790ee698dc..785a3216adf 100644 --- a/engines/ultima/ultima8/convert/convert_shape.cpp +++ b/engines/ultima/ultima8/convert/convert_shape.cpp @@ -631,7 +631,7 @@ bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *cs bool result = true; // Just to be safe - int start_pos = source->getPos(); + const uint32 start_pos = source->getPos(); // Read the ident if (csf->_bytes_ident) @@ -739,7 +739,7 @@ bool ConvertShape::CheckUnsafe(IDataSource *source, const ConvertShapeFormat *cs void ConvertShape::Write(ODataSource *dest, const ConvertShapeFormat *csf, uint32 &write_len) { // Just to be safe - uint32 start_pos = dest->getPos(); + const uint32 start_pos = dest->getPos(); // Write the ident if (csf->_bytes_ident) dest->write(csf->_ident, csf->_bytes_ident); diff --git a/engines/ultima/ultima8/graphics/render_surface.h b/engines/ultima/ultima8/graphics/render_surface.h index 5a8ab503f33..daf4b806d7d 100644 --- a/engines/ultima/ultima8/graphics/render_surface.h +++ b/engines/ultima/ultima8/graphics/render_surface.h @@ -207,9 +207,6 @@ public: // TODO: virtual void PaintHighlightInvis(CachedShape* s, uint32 frame, int32 x, int32 y, bool trans, bool mirrored, uint32 col32); virtual void PaintHighlightInvis(Shape *s, uint32 frame, int32 x, int32 y, bool trans, bool mirrored, uint32 col32, bool untformed_pal = false) = 0; - //! Paint a shape masked against destination alpha - virtual void PaintMasked(Shape *s, uint32 framenum, int32 x, int32 y, bool trans = false, bool mirrored = false, uint32 col32 = 0, bool untformed_pal = false) = 0; - // // Basic Line Drawing // diff --git a/engines/ultima/ultima8/graphics/shape.h b/engines/ultima/ultima8/graphics/shape.h index 35ad75b6028..40a331b3300 100644 --- a/engines/ultima/ultima8/graphics/shape.h +++ b/engines/ultima/ultima8/graphics/shape.h @@ -72,7 +72,7 @@ public: ENABLE_CUSTOM_MEMORY_ALLOCATION() -protected: +private: // This will load a u8 style shape 'optimized'. void LoadU8Format(const uint8 *data, uint32 size, const ConvertShapeFormat *format); diff --git a/engines/ultima/ultima8/graphics/shape_frame.h b/engines/ultima/ultima8/graphics/shape_frame.h index 897d0d1100c..afbe59c52ce 100644 --- a/engines/ultima/ultima8/graphics/shape_frame.h +++ b/engines/ultima/ultima8/graphics/shape_frame.h @@ -54,7 +54,7 @@ public: uint8 getPixelAtPoint(int32 x, int32 y) const; // Get the pixel at the point void getConvertShapeFrame(ConvertShapeFrame &csf); -protected: +private: // This will load a u8 style shape 'optimized'. void LoadU8Format(const uint8 *data, uint32 size); diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.cpp b/engines/ultima/ultima8/graphics/soft_render_surface.cpp index 94435e063d4..1498ebc8f85 100644 --- a/engines/ultima/ultima8/graphics/soft_render_surface.cpp +++ b/engines/ultima/ultima8/graphics/soft_render_surface.cpp @@ -942,35 +942,6 @@ template void SoftRenderSurface::PaintHighlightInvis(Shape * #undef BLEND_SHAPES } -// -// void SoftRenderSurface::PaintHighlight(Shape* s, uint32 frame, int32 x, int32 y, bool mirrored) -// -// Desc: Standard shape drawing functions. Masked against Dest Alpha. Highlights, Clips, and conditionally Flips and Xforms -// - -template void SoftRenderSurface::PaintMasked(Shape *s, uint32 framenum, int32 x, int32 y, bool trans, bool mirrored, uint32 col32, bool untformed_pal) { -#define FLIP_SHAPES -#define FLIP_CONDITIONAL mirrored -#define XFORM_SHAPES -#define XFORM_CONDITIONAL trans -#define BLEND_SHAPES(src,dst) BlendHighlight(src,cr,cg,cb,ca,255-ca) -#define DESTALPHA_MASK - - uint32 ca = TEX32_A(col32); - uint32 cr = TEX32_R(col32); - uint32 cg = TEX32_G(col32); - uint32 cb = TEX32_B(col32); - -#include "ultima/ultima8/graphics/soft_render_surface.inl" - -#undef FLIP_SHAPES -#undef FLIP_CONDITIONAL -#undef XFORM_SHAPES -#undef XFORM_CONDITIONAL -#undef BLEND_SHAPES -#undef DESTALPHA_MASK -} - // // Instantiate the SoftRenderSurface Class // diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.h b/engines/ultima/ultima8/graphics/soft_render_surface.h index ce12a3b860d..7ef1b5ab089 100644 --- a/engines/ultima/ultima8/graphics/soft_render_surface.h +++ b/engines/ultima/ultima8/graphics/soft_render_surface.h @@ -106,10 +106,6 @@ public: // TODO: virtual void PaintHighlightInvis(CachedShape* s, uint32 frame, int32 x, int32 y, bool trans, bool mirrored, uint32 col32); void PaintHighlightInvis(Shape *s, uint32 frame, int32 x, int32 y, bool trans, bool mirrored, uint32 col32, bool untformed_pal = false) override; - // Paint a shape masked against destination alpha - void PaintMasked(Shape *s, uint32 framenum, int32 x, int32 y, bool trans, bool mirrored, uint32 col32 = 0, bool untformed_pal = false) override; - - // // Basic Line Drawing // diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.inl b/engines/ultima/ultima8/graphics/soft_render_surface.inl index 4cbb38813e7..48c91c86db5 100644 --- a/engines/ultima/ultima8/graphics/soft_render_surface.inl +++ b/engines/ultima/ultima8/graphics/soft_render_surface.inl @@ -167,25 +167,13 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0; // The Function // -// All the variables we want - - const uint8 *linedata; - int32 xpos; - sintptr line; // sintptr for pointer arithmetic - int32 dlen; - - uintX *pixptr; - uintX *endrun; - uintX *line_start; - uint32 pix; - // Sanity check if (framenum >= s->frameCount()) return; if (s->getPalette() == 0) return; - const ShapeFrame *frame = s->getFrame(framenum); + const ShapeFrame *frame = s->getFrame(framenum); const uint8 *rle_data = frame->_rle_data; const uint32 *line_offsets = frame->_line_offsets; const uint32 *pal = untformed_pal? @@ -199,21 +187,19 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0; &(s->getPalette()->_xform[0]); #endif - int32 width_ = frame->_width; - int32 height_ = frame->_height; + const int32 width_ = frame->_width; + const int32 height_ = frame->_height; x -= XNEG(frame->_xoff); y -= frame->_yoff; // Do it this way if compressed if (frame->_compressed) for (int i=0; i(static_cast(OFFSET_PIXELS) + _pitch*line); - + const uint8 *linedata = rle_data + line_offsets[i]; + uintX *line_start = reinterpret_cast(static_cast(OFFSET_PIXELS) + _pitch*line); LINE_END_ASSIGN(); do { @@ -221,14 +207,15 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0; if (xpos == width_) break; - dlen = *linedata++; - int type = dlen & 1; + int32 dlen = *linedata++; + const int type = dlen & 1; dlen >>= 1; - pixptr = line_start+x+XNEG(xpos); - endrun = pixptr + XNEG(dlen); + uintX *pixptr = line_start+x+XNEG(xpos); + uintX *endrun = pixptr + XNEG(dlen); if (!type) { + // Identical to the uncompressed case while (pixptr != endrun) { if (NOT_CLIPPED_X && NOT_DESTINATION_MASKED) { #ifdef XFORM_SHAPES @@ -244,17 +231,18 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0; linedata++; } } else { + // a run of the same pixel #ifdef XFORM_SHAPES - pix = xform_pal[*linedata]; if (USE_XFORM_FUNC) { + const uint32 pix = xform_pal[*linedata]; while (pixptr != endrun) { - if (NOT_CLIPPED_X && NOT_DESTINATION_MASKED) *pixptr = CUSTOM_BLEND(BlendPreModulated(xform_pal[*linedata],*pixptr)); + if (NOT_CLIPPED_X && NOT_DESTINATION_MASKED) *pixptr = CUSTOM_BLEND(BlendPreModulated(pix,*pixptr)); pixptr += XNEG(1); } } else #endif { - pix = pal[*linedata]; + const uint32 pix = pal[*linedata]; while (pixptr != endrun) { if (NOT_CLIPPED_X && NOT_DESTINATION_MASKED) @@ -274,12 +262,12 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0; } // Uncompressed else for (int i=0; i(static_cast(OFFSET_PIXELS) + _pitch*line); + const uint8 *linedata = rle_data + line_offsets[i]; + uintX *line_start = reinterpret_cast(static_cast(OFFSET_PIXELS) + _pitch*line); LINE_END_ASSIGN(); do { @@ -287,10 +275,10 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0; if (xpos == width_) break; - dlen = *linedata++; + const int32 dlen = *linedata++; - pixptr= line_start+x+XNEG(xpos); - endrun = pixptr + XNEG(dlen); + uintX *pixptr = line_start+x+XNEG(xpos); + uintX *endrun = pixptr + XNEG(dlen); while (pixptr != endrun) { if (NOT_CLIPPED_X && NOT_DESTINATION_MASKED) {