|
|
@ -63,7 +63,7 @@ struct StringSpriteToDraw {
|
|
|
|
|
|
|
|
|
|
|
|
struct TileSpriteToDraw {
|
|
|
|
struct TileSpriteToDraw {
|
|
|
|
SpriteID image;
|
|
|
|
SpriteID image;
|
|
|
|
SpriteID pal;
|
|
|
|
PaletteID pal;
|
|
|
|
const SubSprite *sub; ///< only draw a rectangular part of the sprite
|
|
|
|
const SubSprite *sub; ///< only draw a rectangular part of the sprite
|
|
|
|
int32 x; ///< screen X coordinate of sprite
|
|
|
|
int32 x; ///< screen X coordinate of sprite
|
|
|
|
int32 y; ///< screen Y coordinate of sprite
|
|
|
|
int32 y; ///< screen Y coordinate of sprite
|
|
|
@ -71,7 +71,7 @@ struct TileSpriteToDraw {
|
|
|
|
|
|
|
|
|
|
|
|
struct ChildScreenSpriteToDraw {
|
|
|
|
struct ChildScreenSpriteToDraw {
|
|
|
|
SpriteID image;
|
|
|
|
SpriteID image;
|
|
|
|
SpriteID pal;
|
|
|
|
PaletteID pal;
|
|
|
|
const SubSprite *sub; ///< only draw a rectangular part of the sprite
|
|
|
|
const SubSprite *sub; ///< only draw a rectangular part of the sprite
|
|
|
|
int32 x;
|
|
|
|
int32 x;
|
|
|
|
int32 y;
|
|
|
|
int32 y;
|
|
|
@ -81,7 +81,7 @@ struct ChildScreenSpriteToDraw {
|
|
|
|
/** Parent sprite that should be drawn */
|
|
|
|
/** Parent sprite that should be drawn */
|
|
|
|
struct ParentSpriteToDraw {
|
|
|
|
struct ParentSpriteToDraw {
|
|
|
|
SpriteID image; ///< sprite to draw
|
|
|
|
SpriteID image; ///< sprite to draw
|
|
|
|
SpriteID pal; ///< palette to use
|
|
|
|
PaletteID pal; ///< palette to use
|
|
|
|
const SubSprite *sub; ///< only draw a rectangular part of the sprite
|
|
|
|
const SubSprite *sub; ///< only draw a rectangular part of the sprite
|
|
|
|
|
|
|
|
|
|
|
|
int32 x; ///< screen X coordinate of sprite
|
|
|
|
int32 x; ///< screen X coordinate of sprite
|
|
|
@ -476,7 +476,7 @@ void HandleZoomMessage(Window *w, const ViewPort *vp, byte widget_zoom_in, byte
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void AddTileSpriteToDraw(SpriteID image, SpriteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0)
|
|
|
|
static void AddTileSpriteToDraw(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
|
|
|
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
|
|
|
|
|
|
|
|
|
|
@ -501,7 +501,7 @@ static void AddTileSpriteToDraw(SpriteID image, SpriteID pal, int32 x, int32 y,
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void AddChildSpriteToFoundation(SpriteID image, SpriteID pal, const SubSprite *sub, FoundationPart foundation_part, int extra_offs_x, int extra_offs_y)
|
|
|
|
static void AddChildSpriteToFoundation(SpriteID image, PaletteID pal, const SubSprite *sub, FoundationPart foundation_part, int extra_offs_x, int extra_offs_y)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert(IsInsideMM(foundation_part, 0, FOUNDATION_PART_END));
|
|
|
|
assert(IsInsideMM(foundation_part, 0, FOUNDATION_PART_END));
|
|
|
|
assert(_vd.foundation[foundation_part] != -1);
|
|
|
|
assert(_vd.foundation[foundation_part] != -1);
|
|
|
@ -530,7 +530,7 @@ static void AddChildSpriteToFoundation(SpriteID image, SpriteID pal, const SubSp
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, int z, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
|
|
|
|
void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* Switch to first foundation part, if no foundation was drawn */
|
|
|
|
/* Switch to first foundation part, if no foundation was drawn */
|
|
|
|
if (_vd.foundation_part == FOUNDATION_PART_NONE) _vd.foundation_part = FOUNDATION_PART_NORMAL;
|
|
|
|
if (_vd.foundation_part == FOUNDATION_PART_NONE) _vd.foundation_part = FOUNDATION_PART_NORMAL;
|
|
|
@ -553,7 +553,7 @@ void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, int z, c
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_x Pixel X offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
* @param extra_offs_y Pixel Y offset for the sprite position.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
|
|
|
|
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub, int extra_offs_x, int extra_offs_y)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DrawGroundSpriteAt(image, pal, 0, 0, 0, sub, extra_offs_x, extra_offs_y);
|
|
|
|
DrawGroundSpriteAt(image, pal, 0, 0, 0, sub, extra_offs_x, extra_offs_y);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -597,7 +597,7 @@ void OffsetGroundSprite(int x, int y)
|
|
|
|
* @param z position z of the sprite.
|
|
|
|
* @param z position z of the sprite.
|
|
|
|
* @param sub Only draw a part of the sprite.
|
|
|
|
* @param sub Only draw a part of the sprite.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void AddCombinedSprite(SpriteID image, SpriteID pal, int x, int y, byte z, const SubSprite *sub)
|
|
|
|
static void AddCombinedSprite(SpriteID image, PaletteID pal, int x, int y, byte z, const SubSprite *sub)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Point pt = RemapCoords(x, y, z);
|
|
|
|
Point pt = RemapCoords(x, y, z);
|
|
|
|
const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL);
|
|
|
|
const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL);
|
|
|
@ -636,7 +636,7 @@ static void AddCombinedSprite(SpriteID image, SpriteID pal, int x, int y, byte z
|
|
|
|
* @param bb_offset_z bounding box extent towards negative Z (world)
|
|
|
|
* @param bb_offset_z bounding box extent towards negative Z (world)
|
|
|
|
* @param sub Only draw a part of the sprite.
|
|
|
|
* @param sub Only draw a part of the sprite.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
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, const SubSprite *sub)
|
|
|
|
void AddSortableSpriteToDraw(SpriteID image, PaletteID 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, const SubSprite *sub)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int32 left, right, top, bottom;
|
|
|
|
int32 left, right, top, bottom;
|
|
|
|
|
|
|
|
|
|
|
@ -759,7 +759,7 @@ void EndSpriteCombine()
|
|
|
|
* @param transparent if true, switch the palette between the provided palette and the transparent palette,
|
|
|
|
* @param transparent if true, switch the palette between the provided palette and the transparent palette,
|
|
|
|
* @param sub Only draw a part of the sprite.
|
|
|
|
* @param sub Only draw a part of the sprite.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent, const SubSprite *sub)
|
|
|
|
void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent, const SubSprite *sub)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
|
|
|
assert((image & SPRITE_MASK) < MAX_SPRITES);
|
|
|
|
|
|
|
|
|
|
|
@ -815,7 +815,7 @@ static void AddStringToDraw(int x, int y, StringID string, uint64 params_1, uint
|
|
|
|
* @param z_offset Z offset relative to the groundsprite. Only used for the sprite position, not for sprite sorting.
|
|
|
|
* @param z_offset Z offset relative to the groundsprite. Only used for the sprite position, not for sprite sorting.
|
|
|
|
* @param foundation_part Foundation part the sprite belongs to.
|
|
|
|
* @param foundation_part Foundation part the sprite belongs to.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void DrawSelectionSprite(SpriteID image, SpriteID pal, const TileInfo *ti, int z_offset, FoundationPart foundation_part)
|
|
|
|
static void DrawSelectionSprite(SpriteID image, PaletteID pal, const TileInfo *ti, int z_offset, FoundationPart foundation_part)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* FIXME: This is not totally valid for some autorail highlights, that extent over the edges of the tile. */
|
|
|
|
/* FIXME: This is not totally valid for some autorail highlights, that extent over the edges of the tile. */
|
|
|
|
if (_vd.foundation[foundation_part] == -1) {
|
|
|
|
if (_vd.foundation[foundation_part] == -1) {
|
|
|
@ -833,7 +833,7 @@ static void DrawSelectionSprite(SpriteID image, SpriteID pal, const TileInfo *ti
|
|
|
|
* @param ti TileInfo Tile that is being drawn
|
|
|
|
* @param ti TileInfo Tile that is being drawn
|
|
|
|
* @param pal Palette to apply.
|
|
|
|
* @param pal Palette to apply.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
static void DrawTileSelectionRect(const TileInfo *ti, SpriteID pal)
|
|
|
|
static void DrawTileSelectionRect(const TileInfo *ti, PaletteID pal)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!IsValidTile(ti->tile)) return;
|
|
|
|
if (!IsValidTile(ti->tile)) return;
|
|
|
|
|
|
|
|
|
|
|
@ -896,7 +896,7 @@ static const HighLightStyle _autorail_type[6][2] = {
|
|
|
|
static void DrawAutorailSelection(const TileInfo *ti, uint autorail_type)
|
|
|
|
static void DrawAutorailSelection(const TileInfo *ti, uint autorail_type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SpriteID image;
|
|
|
|
SpriteID image;
|
|
|
|
SpriteID pal;
|
|
|
|
PaletteID pal;
|
|
|
|
int offset;
|
|
|
|
int offset;
|
|
|
|
|
|
|
|
|
|
|
|
FoundationPart foundation_part = FOUNDATION_PART_NORMAL;
|
|
|
|
FoundationPart foundation_part = FOUNDATION_PART_NORMAL;
|
|
|
@ -2656,14 +2656,14 @@ bool VpHandlePlaceSizingDrag()
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, HighLightStyle mode, Window *w)
|
|
|
|
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number);
|
|
|
|
SetObjectToPlace(icon, pal, mode, w->window_class, w->window_number);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#include "table/animcursors.h"
|
|
|
|
#include "table/animcursors.h"
|
|
|
|
|
|
|
|
|
|
|
|
void SetObjectToPlace(CursorID icon, SpriteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
|
|
|
|
void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/* undo clicking on button and drag & drop */
|
|
|
|
/* undo clicking on button and drag & drop */
|
|
|
|
if (_thd.place_mode != HT_NONE || _special_mouse_mode == WSM_DRAGDROP) {
|
|
|
|
if (_thd.place_mode != HT_NONE || _special_mouse_mode == WSM_DRAGDROP) {
|
|
|
|