rubidium - 17 years ago 2007-09-14 21:54:57 rubidium@openttd.org
(svn r11105) -Codechange [FS#1223]: add some support for tuning of the bounding boxes for some special cases (like tunnels and bridges). Patch by frosch.
2 files changed with 49 insertions and 32 deletions:
/** Draw a (transparent) sprite at given coordinates
/** Draw a (transparent) sprite at given coordinates with a given bounding box.
* The bounding box extends from (x + bb_offset_x, y + bb_offset_y, z + bb_offset_z) to (x + w - 1, y + h - 1, z + dz - 1), both corners included.
*
* @note Bounding boxes are normally specified with bb_offset_x = bb_offset_y = bb_offset_z = 0. The extent of the bounding box in negative direction is
* defined by the sprite offset in the grf file.
* However if modifying the sprite offsets is not suitable (e.g. when using existing graphics), the bounding box can be tuned by bb_offset.
*
* @pre w > bb_offset_x, h > bb_offset_y, dz > bb_offset_z. Else w, h or dz are ignored.
*
* @param image the image to combine and draw,
* @param pal the provided palette,
* @param x position x of the sprite,
* @param y position y of the sprite,
* @param w width of the sprite,
* @param h height of the sprite,
* @param dz delta z, difference of elevation between sprite and parent sprite,
* @param z elevation of the sprite,
* @param transparent if true, switch the palette between the provided palette and the transparent palette
* @param x position X (world) of the sprite,
* @param y position Y (world) of the sprite,
* @param w bounding box extent towards positive X (world),
* @param h bounding box extent towards positive Y (world),
* @param dz bounding box extent towards positive Z (world),
* @param z position Z (world) of the sprite,
* @param transparent if true, switch the palette between the provided palette and the transparent palette,
* @param bb_offset_x bounding box extent towards negative X (world),
* @param bb_offset_y bounding box extent towards negative Y (world),
* @param bb_offset_z bounding box extent towards negative Z (world)
*/
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z, bool transparent)
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent, int bb_offset_x, int bb_offset_y, int bb_offset_z)
{
ViewportDrawer *vd = _cur_vd;
ParentSpriteToDraw *ps;
@@ -533,11 +549,13 @@ void AddSortableSpriteToDraw(SpriteID im
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, byte dz, byte z, bool transparent = false);
void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w, int h, int dz, int z, bool transparent = false, int bb_offset_x = 0, int bb_offset_y = 0, int bb_offset_z = 0);
void *AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint64 params_2);
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y);