mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r18872) -Codechange: introduce PaletteID and use it
This commit is contained in:
parent
02edae5454
commit
f94c83a387
|
@ -200,7 +200,7 @@ static SpriteID GetAircraftIcon(EngineID engine)
|
||||||
return DIR_W + _aircraft_sprite[spritenum];
|
return DIR_W + _aircraft_sprite[spritenum];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
|
void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
|
||||||
{
|
{
|
||||||
SpriteID sprite = GetAircraftIcon(engine);
|
SpriteID sprite = GetAircraftIcon(engine);
|
||||||
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
||||||
|
|
|
@ -87,7 +87,7 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s
|
||||||
int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
|
int x = rtl ? right - real_sprite->width - real_sprite->x_offs : left - real_sprite->x_offs;
|
||||||
bool helicopter = v->subtype == AIR_HELICOPTER;
|
bool helicopter = v->subtype == AIR_HELICOPTER;
|
||||||
|
|
||||||
SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
||||||
DrawSprite(sprite, pal, x, y + 10);
|
DrawSprite(sprite, pal, x, y + 10);
|
||||||
if (helicopter) {
|
if (helicopter) {
|
||||||
const Aircraft *a = Aircraft::From(v);
|
const Aircraft *a = Aircraft::From(v);
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct BridgeSpec {
|
||||||
uint16 price; ///< the price multiplier
|
uint16 price; ///< the price multiplier
|
||||||
uint16 speed; ///< maximum travel speed
|
uint16 speed; ///< maximum travel speed
|
||||||
SpriteID sprite; ///< the sprite which is used in the GUI
|
SpriteID sprite; ///< the sprite which is used in the GUI
|
||||||
SpriteID pal; ///< the palette which is used in the GUI
|
PaletteID pal; ///< the palette which is used in the GUI
|
||||||
StringID material; ///< the string that contains the bridge description
|
StringID material; ///< the string that contains the bridge description
|
||||||
StringID transport_name[2]; ///< description of the bridge, when built for road or rail
|
StringID transport_name[2]; ///< description of the bridge, when built for road or rail
|
||||||
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
|
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
|
||||||
|
|
|
@ -846,7 +846,7 @@ void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y)
|
||||||
bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge) != 0;
|
bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetCompanyManagerFaceBits(cmf, CMFV_HAS_MOUSTACHE, ge) != 0;
|
||||||
bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge) != 0;
|
bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetCompanyManagerFaceBits(cmf, CMFV_HAS_TIE_EARRING, ge) != 0;
|
||||||
bool has_glasses = GetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge) != 0;
|
bool has_glasses = GetCompanyManagerFaceBits(cmf, CMFV_HAS_GLASSES, ge) != 0;
|
||||||
SpriteID pal;
|
PaletteID pal;
|
||||||
|
|
||||||
/* Modify eye colour palette only if 2 or more valid values exist */
|
/* Modify eye colour palette only if 2 or more valid values exist */
|
||||||
if (_cmf_info[CMFV_EYE_COLOUR].valid_values[ge] < 2) {
|
if (_cmf_info[CMFV_EYE_COLOUR].valid_values[ge] < 2) {
|
||||||
|
|
|
@ -248,7 +248,7 @@ StringID GetEngineInfoString(EngineID engine)
|
||||||
* @param engine Engine to draw.
|
* @param engine Engine to draw.
|
||||||
* @param pal Palette to use for drawing.
|
* @param pal Palette to use for drawing.
|
||||||
*/
|
*/
|
||||||
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
|
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
|
||||||
{
|
{
|
||||||
const Engine *e = Engine::Get(engine);
|
const Engine *e = Engine::Get(engine);
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, ui
|
||||||
StringID GetEngineCategoryName(EngineID engine);
|
StringID GetEngineCategoryName(EngineID engine);
|
||||||
StringID GetEngineInfoString(EngineID engine);
|
StringID GetEngineInfoString(EngineID engine);
|
||||||
|
|
||||||
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal);
|
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal);
|
||||||
void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal);
|
void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal);
|
||||||
void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal);
|
void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal);
|
||||||
void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal);
|
void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal);
|
||||||
void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal);
|
void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal);
|
||||||
|
|
||||||
#endif /* ENGINE_GUI_H */
|
#endif /* ENGINE_GUI_H */
|
||||||
|
|
|
@ -1028,7 +1028,7 @@ Dimension GetSpriteSize(SpriteID sprid)
|
||||||
* @param y Top coordinate of image
|
* @param y Top coordinate of image
|
||||||
* @param sub If available, draw only specified part of the sprite
|
* @param sub If available, draw only specified part of the sprite
|
||||||
*/
|
*/
|
||||||
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub)
|
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub)
|
||||||
{
|
{
|
||||||
if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) {
|
if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) {
|
||||||
_colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1;
|
_colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1;
|
||||||
|
@ -1645,7 +1645,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetCursorSprite(SpriteID cursor, SpriteID pal)
|
static void SetCursorSprite(CursorID cursor, PaletteID pal)
|
||||||
{
|
{
|
||||||
CursorVars *cv = &_cursor;
|
CursorVars *cv = &_cursor;
|
||||||
const Sprite *p;
|
const Sprite *p;
|
||||||
|
@ -1682,7 +1682,7 @@ void CursorTick()
|
||||||
SwitchAnimatedCursor();
|
SwitchAnimatedCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMouseCursor(SpriteID sprite, SpriteID pal)
|
void SetMouseCursor(CursorID sprite, PaletteID pal)
|
||||||
{
|
{
|
||||||
/* Turn off animation */
|
/* Turn off animation */
|
||||||
_cursor.animate_timeout = 0;
|
_cursor.animate_timeout = 0;
|
||||||
|
|
|
@ -91,7 +91,7 @@ void RedrawScreenRect(int left, int top, int right, int bottom);
|
||||||
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
||||||
|
|
||||||
Dimension GetSpriteSize(SpriteID sprid);
|
Dimension GetSpriteSize(SpriteID sprid);
|
||||||
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub = NULL);
|
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub = NULL);
|
||||||
|
|
||||||
/** How to align the to-be drawn text. */
|
/** How to align the to-be drawn text. */
|
||||||
enum StringAlignment {
|
enum StringAlignment {
|
||||||
|
@ -149,7 +149,7 @@ bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int heigh
|
||||||
/* window.cpp */
|
/* window.cpp */
|
||||||
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
||||||
|
|
||||||
void SetMouseCursor(SpriteID sprite, SpriteID pal);
|
void SetMouseCursor(CursorID cursor, PaletteID pal);
|
||||||
void SetAnimatedMouseCursor(const AnimCursor *table);
|
void SetAnimatedMouseCursor(const AnimCursor *table);
|
||||||
void CursorTick();
|
void CursorTick();
|
||||||
bool ChangeResInGame(int w, int h);
|
bool ChangeResInGame(int w, int h);
|
||||||
|
|
|
@ -16,14 +16,15 @@
|
||||||
#include "core/geometry_type.hpp"
|
#include "core/geometry_type.hpp"
|
||||||
#include "zoom_type.h"
|
#include "zoom_type.h"
|
||||||
|
|
||||||
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colourtables
|
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colourtables
|
||||||
|
typedef uint32 PaletteID; ///< The number of the palette
|
||||||
|
typedef uint32 CursorID; ///< The number of the cursor (sprite)
|
||||||
|
|
||||||
/** Combination of a palette sprite and a 'real' sprite */
|
/** Combination of a palette sprite and a 'real' sprite */
|
||||||
struct PalSpriteID {
|
struct PalSpriteID {
|
||||||
SpriteID sprite; ///< The 'real' sprite
|
SpriteID sprite; ///< The 'real' sprite
|
||||||
SpriteID pal; ///< The palette (use \c PAL_NONE) if not needed)
|
PaletteID pal; ///< The palette (use \c PAL_NONE) if not needed)
|
||||||
};
|
};
|
||||||
typedef int32 CursorID;
|
|
||||||
|
|
||||||
enum WindowKeyCodes {
|
enum WindowKeyCodes {
|
||||||
WKC_SHIFT = 0x8000,
|
WKC_SHIFT = 0x8000,
|
||||||
|
@ -113,8 +114,8 @@ struct CursorVars {
|
||||||
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
|
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
|
||||||
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
|
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
|
||||||
int short_vehicle_offset; ///< offset of the X for short vehicles
|
int short_vehicle_offset; ///< offset of the X for short vehicles
|
||||||
SpriteID sprite; ///< current image of cursor
|
CursorID sprite; ///< current image of cursor
|
||||||
SpriteID pal;
|
PaletteID pal;
|
||||||
|
|
||||||
int wheel; ///< mouse wheel movement
|
int wheel; ///< mouse wheel movement
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ static void DrawTile_Industry(TileInfo *ti)
|
||||||
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
|
const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
|
||||||
const DrawBuildingsTileStruct *dits;
|
const DrawBuildingsTileStruct *dits;
|
||||||
SpriteID image;
|
SpriteID image;
|
||||||
SpriteID pal;
|
PaletteID pal;
|
||||||
|
|
||||||
/* Retrieve pointer to the draw industry tile struct */
|
/* Retrieve pointer to the draw industry tile struct */
|
||||||
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
|
if (gfx >= NEW_INDUSTRYTILEOFFSET) {
|
||||||
|
|
|
@ -1389,7 +1389,7 @@ static ChangeInfoResult BridgeChangeInfo(uint brid, int numinfo, int prop, byte
|
||||||
|
|
||||||
for (byte sprite = 0; sprite < 32; sprite++) {
|
for (byte sprite = 0; sprite < 32; sprite++) {
|
||||||
SpriteID image = grf_load_word(&buf);
|
SpriteID image = grf_load_word(&buf);
|
||||||
SpriteID pal = grf_load_word(&buf);
|
PaletteID pal = grf_load_word(&buf);
|
||||||
|
|
||||||
bridge->sprite_table[tableid][sprite].sprite = image;
|
bridge->sprite_table[tableid][sprite].sprite = image;
|
||||||
bridge->sprite_table[tableid][sprite].pal = pal;
|
bridge->sprite_table[tableid][sprite].pal = pal;
|
||||||
|
|
|
@ -663,7 +663,7 @@ struct NewGRFWindow : public Window {
|
||||||
for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) {
|
for (const GRFConfig *c = this->list; c != NULL; c = c->next, i++) {
|
||||||
if (this->vscroll.IsVisible(i)) {
|
if (this->vscroll.IsVisible(i)) {
|
||||||
const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
|
const char *text = (c->name != NULL && !StrEmpty(c->name)) ? c->name : c->filename;
|
||||||
SpriteID pal;
|
PaletteID pal;
|
||||||
|
|
||||||
/* Pick a colour */
|
/* Pick a colour */
|
||||||
switch (c->status) {
|
switch (c->status) {
|
||||||
|
|
|
@ -404,7 +404,7 @@ static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *grou
|
||||||
const DrawTileSprites *dts = group->dts;
|
const DrawTileSprites *dts = group->dts;
|
||||||
|
|
||||||
const HouseSpec *hs = HouseSpec::Get(house_id);
|
const HouseSpec *hs = HouseSpec::Get(house_id);
|
||||||
SpriteID palette = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOUR_START;
|
PaletteID palette = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOUR_START;
|
||||||
if (HasBit(hs->callback_mask, CBM_HOUSE_COLOUR)) {
|
if (HasBit(hs->callback_mask, CBM_HOUSE_COLOUR)) {
|
||||||
uint16 callback = GetHouseCallback(CBID_HOUSE_COLOUR, 0, 0, house_id, Town::GetByTile(ti->tile), ti->tile);
|
uint16 callback = GetHouseCallback(CBID_HOUSE_COLOUR, 0, 0, house_id, Town::GetByTile(ti->tile), ti->tile);
|
||||||
if (callback != CALLBACK_FAILED) {
|
if (callback != CALLBACK_FAILED) {
|
||||||
|
@ -414,7 +414,7 @@ static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *grou
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID image = dts->ground.sprite;
|
SpriteID image = dts->ground.sprite;
|
||||||
SpriteID pal = dts->ground.pal;
|
PaletteID pal = dts->ground.pal;
|
||||||
|
|
||||||
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) image += stage;
|
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) image += stage;
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGro
|
||||||
const DrawTileSprites *dts = group->dts;
|
const DrawTileSprites *dts = group->dts;
|
||||||
|
|
||||||
SpriteID image = dts->ground.sprite;
|
SpriteID image = dts->ground.sprite;
|
||||||
SpriteID pal = dts->ground.pal;
|
PaletteID pal = dts->ground.pal;
|
||||||
|
|
||||||
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) image += stage;
|
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) image += stage;
|
||||||
|
|
||||||
|
|
|
@ -879,7 +879,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
|
||||||
const StationSpec *statspec;
|
const StationSpec *statspec;
|
||||||
const DrawTileSprites *sprites;
|
const DrawTileSprites *sprites;
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
const RailtypeInfo *rti = GetRailTypeInfo(railtype);
|
||||||
SpriteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
||||||
uint tile = 2;
|
uint tile = 2;
|
||||||
|
|
||||||
statspec = GetCustomStationSpec(sclass, station);
|
statspec = GetCustomStationSpec(sclass, station);
|
||||||
|
@ -899,7 +899,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID image = sprites->ground.sprite;
|
SpriteID image = sprites->ground.sprite;
|
||||||
SpriteID pal = sprites->ground.pal;
|
PaletteID pal = sprites->ground.pal;
|
||||||
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
|
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
|
||||||
image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
|
image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
|
||||||
image += rti->custom_ground_offset;
|
image += rti->custom_ground_offset;
|
||||||
|
|
|
@ -1757,7 +1757,7 @@ static void DrawTrackBits(TileInfo *ti, TrackBits track)
|
||||||
/* DrawFoundation modifies ti */
|
/* DrawFoundation modifies ti */
|
||||||
|
|
||||||
SpriteID image;
|
SpriteID image;
|
||||||
SpriteID pal = PAL_NONE;
|
PaletteID pal = PAL_NONE;
|
||||||
const SubSprite *sub = NULL;
|
const SubSprite *sub = NULL;
|
||||||
bool junction = false;
|
bool junction = false;
|
||||||
|
|
||||||
|
@ -1944,7 +1944,7 @@ static void DrawTile_Track(TileInfo *ti)
|
||||||
} else {
|
} else {
|
||||||
/* draw depot */
|
/* draw depot */
|
||||||
const DrawTileSprites *dts;
|
const DrawTileSprites *dts;
|
||||||
SpriteID pal = PAL_NONE;
|
PaletteID pal = PAL_NONE;
|
||||||
|
|
||||||
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
||||||
|
|
||||||
|
@ -1997,7 +1997,7 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
|
||||||
y += 17;
|
y += 17;
|
||||||
|
|
||||||
if (image != SPR_FLAT_GRASS_TILE) image += offset;
|
if (image != SPR_FLAT_GRASS_TILE) image += offset;
|
||||||
SpriteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
||||||
|
|
||||||
DrawSprite(image, PAL_NONE, x, y);
|
DrawSprite(image, PAL_NONE, x, y);
|
||||||
DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette);
|
DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette);
|
||||||
|
|
|
@ -1087,7 +1087,7 @@ static void DrawRoadBits(TileInfo *ti)
|
||||||
RoadBits tram = GetRoadBits(ti->tile, ROADTYPE_TRAM);
|
RoadBits tram = GetRoadBits(ti->tile, ROADTYPE_TRAM);
|
||||||
|
|
||||||
SpriteID image = 0;
|
SpriteID image = 0;
|
||||||
SpriteID pal = PAL_NONE;
|
PaletteID pal = PAL_NONE;
|
||||||
|
|
||||||
if (ti->tileh != SLOPE_FLAT) {
|
if (ti->tileh != SLOPE_FLAT) {
|
||||||
DrawFoundation(ti, GetRoadFoundation(ti->tileh, road | tram));
|
DrawFoundation(ti, GetRoadFoundation(ti->tileh, road | tram));
|
||||||
|
@ -1176,7 +1176,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
||||||
|
|
||||||
SpriteID image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.crossing;
|
SpriteID image = GetRailTypeInfo(GetRailType(ti->tile))->base_sprites.crossing;
|
||||||
SpriteID pal = PAL_NONE;
|
PaletteID pal = PAL_NONE;
|
||||||
|
|
||||||
if (GetCrossingRoadAxis(ti->tile) == AXIS_X) image++;
|
if (GetCrossingRoadAxis(ti->tile) == AXIS_X) image++;
|
||||||
if (IsCrossingBarred(ti->tile)) image += 2;
|
if (IsCrossingBarred(ti->tile)) image += 2;
|
||||||
|
@ -1212,7 +1212,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
case ROAD_TILE_DEPOT: {
|
case ROAD_TILE_DEPOT: {
|
||||||
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
||||||
|
|
||||||
SpriteID palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
|
PaletteID palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
|
||||||
|
|
||||||
const DrawTileSprites *dts;
|
const DrawTileSprites *dts;
|
||||||
if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
|
if (HasTileRoadType(ti->tile, ROADTYPE_TRAM)) {
|
||||||
|
@ -1231,7 +1231,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
|
|
||||||
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
|
void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
|
||||||
{
|
{
|
||||||
SpriteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
PaletteID palette = COMPANY_SPRITE_COLOUR(_local_company);
|
||||||
const DrawTileSprites *dts = (rt == ROADTYPE_TRAM) ? &_tram_depot[dir] : &_road_depot[dir];
|
const DrawTileSprites *dts = (rt == ROADTYPE_TRAM) ? &_tram_depot[dir] : &_road_depot[dir];
|
||||||
|
|
||||||
x += 33;
|
x += 33;
|
||||||
|
|
|
@ -145,7 +145,7 @@ SpriteID RoadVehicle::GetImage(Direction direction) const
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
|
void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
|
||||||
{
|
{
|
||||||
SpriteID sprite = GetRoadVehIcon(engine);
|
SpriteID sprite = GetRoadVehIcon(engine);
|
||||||
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
||||||
|
|
|
@ -143,7 +143,7 @@ void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID se
|
||||||
Point offset;
|
Point offset;
|
||||||
int width = u->GetDisplayImageWidth(&offset);
|
int width = u->GetDisplayImageWidth(&offset);
|
||||||
|
|
||||||
SpriteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
|
PaletteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u);
|
||||||
DrawSprite(u->GetImage(dir), pal, pos + (rtl ? -offset.x : offset.x), y + 6 + offset.y);
|
DrawSprite(u->GetImage(dir), pal, pos + (rtl ? -offset.x : offset.x), y + 6 + offset.y);
|
||||||
|
|
||||||
pos += rtl ? -width : width;
|
pos += rtl ? -width : width;
|
||||||
|
|
|
@ -65,7 +65,7 @@ static SpriteID GetShipIcon(EngineID engine)
|
||||||
return DIR_W + _ship_sprites[spritenum];
|
return DIR_W + _ship_sprites[spritenum];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
|
void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
|
||||||
{
|
{
|
||||||
SpriteID sprite = GetShipIcon(engine);
|
SpriteID sprite = GetShipIcon(engine);
|
||||||
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
* @param default_palette The default recolour sprite to use (typically company colour)
|
* @param default_palette The default recolour sprite to use (typically company colour)
|
||||||
* @param child_offset_is_unsigned Whether child sprite offsets are interpreted signed or unsigned
|
* @param child_offset_is_unsigned Whether child sprite offsets are interpreted signed or unsigned
|
||||||
*/
|
*/
|
||||||
void DrawCommonTileSeq(const TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 orig_offset, uint32 newgrf_offset, SpriteID default_palette, bool child_offset_is_unsigned)
|
void DrawCommonTileSeq(const TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned)
|
||||||
{
|
{
|
||||||
const DrawTileSeqStruct *dtss;
|
const DrawTileSeqStruct *dtss;
|
||||||
foreach_draw_tile_seq(dtss, dts->seq) {
|
foreach_draw_tile_seq(dtss, dts->seq) {
|
||||||
|
@ -42,7 +42,7 @@ void DrawCommonTileSeq(const TileInfo *ti, const DrawTileSprites *dts, Transpare
|
||||||
|
|
||||||
image += (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? newgrf_offset : orig_offset);
|
image += (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? newgrf_offset : orig_offset);
|
||||||
|
|
||||||
SpriteID pal = SpriteLayoutPaletteTransform(image, dtss->image.pal, default_palette);
|
PaletteID pal = SpriteLayoutPaletteTransform(image, dtss->image.pal, default_palette);
|
||||||
|
|
||||||
if ((byte)dtss->delta_z != 0x80) {
|
if ((byte)dtss->delta_z != 0x80) {
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
|
@ -70,7 +70,7 @@ void DrawCommonTileSeq(const TileInfo *ti, const DrawTileSprites *dts, Transpare
|
||||||
* @param default_palette The default recolour sprite to use (typically company colour)
|
* @param default_palette The default recolour sprite to use (typically company colour)
|
||||||
* @param child_offset_is_unsigned Whether child sprite offsets are interpreted signed or unsigned
|
* @param child_offset_is_unsigned Whether child sprite offsets are interpreted signed or unsigned
|
||||||
*/
|
*/
|
||||||
void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig_offset, uint32 newgrf_offset, SpriteID default_palette, bool child_offset_is_unsigned)
|
void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned)
|
||||||
{
|
{
|
||||||
const DrawTileSeqStruct *dtss;
|
const DrawTileSeqStruct *dtss;
|
||||||
Point child_offset = {0, 0};
|
Point child_offset = {0, 0};
|
||||||
|
@ -83,7 +83,7 @@ void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig
|
||||||
|
|
||||||
image += (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? newgrf_offset : orig_offset);
|
image += (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE) ? newgrf_offset : orig_offset);
|
||||||
|
|
||||||
SpriteID pal = SpriteLayoutPaletteTransform(image, dtss->image.pal, default_palette);
|
PaletteID pal = SpriteLayoutPaletteTransform(image, dtss->image.pal, default_palette);
|
||||||
|
|
||||||
if ((byte)dtss->delta_z != 0x80) {
|
if ((byte)dtss->delta_z != 0x80) {
|
||||||
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
|
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
|
||||||
|
|
18
src/sprite.h
18
src/sprite.h
|
@ -59,15 +59,15 @@ struct DrawBuildingsTileStruct {
|
||||||
/** Iterate through all DrawTileSeqStructs in DrawTileSprites. */
|
/** Iterate through all DrawTileSeqStructs in DrawTileSprites. */
|
||||||
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
|
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
|
||||||
|
|
||||||
void DrawCommonTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 orig_offset, uint32 newgrf_offset, SpriteID default_palette, bool child_offset_is_unsigned);
|
void DrawCommonTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned);
|
||||||
void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig_offset, uint32 newgrf_offset, SpriteID default_palette, bool child_offset_is_unsigned);
|
void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw tile sprite sequence on tile with railroad specifics.
|
* Draw tile sprite sequence on tile with railroad specifics.
|
||||||
* @param total_offset Spriteoffset from normal rail to current railtype.
|
* @param total_offset Spriteoffset from normal rail to current railtype.
|
||||||
* @param newgrf_offset Startsprite of the Action1 to use.
|
* @param newgrf_offset Startsprite of the Action1 to use.
|
||||||
*/
|
*/
|
||||||
static inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, SpriteID default_palette)
|
static inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeq(ti, dts, to, total_offset, newgrf_offset, default_palette, false);
|
DrawCommonTileSeq(ti, dts, to, total_offset, newgrf_offset, default_palette, false);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ static inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSpri
|
||||||
* @param total_offset Spriteoffset from normal rail to current railtype.
|
* @param total_offset Spriteoffset from normal rail to current railtype.
|
||||||
* @param newgrf_offset Startsprite of the Action1 to use.
|
* @param newgrf_offset Startsprite of the Action1 to use.
|
||||||
*/
|
*/
|
||||||
static inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, SpriteID default_palette)
|
static inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeqInGUI(x, y, dts, total_offset, newgrf_offset, default_palette, false);
|
DrawCommonTileSeqInGUI(x, y, dts, total_offset, newgrf_offset, default_palette, false);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ static inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts
|
||||||
/**
|
/**
|
||||||
* Draw TTD sprite sequence on tile.
|
* Draw TTD sprite sequence on tile.
|
||||||
*/
|
*/
|
||||||
static inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, SpriteID default_palette)
|
static inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeq(ti, dts, to, 0, 0, default_palette, false);
|
DrawCommonTileSeq(ti, dts, to, 0, 0, default_palette, false);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ static inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSpri
|
||||||
/**
|
/**
|
||||||
* Draw TTD sprite sequence in GUI.
|
* Draw TTD sprite sequence in GUI.
|
||||||
*/
|
*/
|
||||||
static inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, SpriteID default_palette)
|
static inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeqInGUI(x, y, dts, 0, 0, default_palette, false);
|
DrawCommonTileSeqInGUI(x, y, dts, 0, 0, default_palette, false);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ static inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts
|
||||||
* Draw NewGRF industrytile or house sprite layout
|
* Draw NewGRF industrytile or house sprite layout
|
||||||
* @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
|
* @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
|
||||||
*/
|
*/
|
||||||
static inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32 stage, SpriteID default_palette)
|
static inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32 stage, PaletteID default_palette)
|
||||||
{
|
{
|
||||||
DrawCommonTileSeq(ti, dts, to, 0, stage, default_palette, true);
|
DrawCommonTileSeq(ti, dts, to, 0, stage, default_palette, true);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ static inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSp
|
||||||
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
||||||
* @return The palette to use
|
* @return The palette to use
|
||||||
*/
|
*/
|
||||||
static inline SpriteID SpriteLayoutPaletteTransform(SpriteID image, SpriteID pal, SpriteID default_pal)
|
static inline PaletteID SpriteLayoutPaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
|
||||||
{
|
{
|
||||||
if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
||||||
return (pal != 0 ? pal : default_pal);
|
return (pal != 0 ? pal : default_pal);
|
||||||
|
@ -137,7 +137,7 @@ static inline SpriteID SpriteLayoutPaletteTransform(SpriteID image, SpriteID pal
|
||||||
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
* @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
|
||||||
* @return The palette to use
|
* @return The palette to use
|
||||||
*/
|
*/
|
||||||
static inline SpriteID GroundSpritePaletteTransform(SpriteID image, SpriteID pal, SpriteID default_pal)
|
static inline PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
|
||||||
{
|
{
|
||||||
if (HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
if (HasBit(image, PALETTE_MODIFIER_COLOUR)) {
|
||||||
return (pal != 0 ? pal : default_pal);
|
return (pal != 0 ? pal : default_pal);
|
||||||
|
|
|
@ -2325,7 +2325,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
const StationSpec *statspec = NULL;
|
const StationSpec *statspec = NULL;
|
||||||
Owner owner = GetTileOwner(ti->tile);
|
Owner owner = GetTileOwner(ti->tile);
|
||||||
|
|
||||||
SpriteID palette;
|
PaletteID palette;
|
||||||
if (Company::IsValidID(owner)) {
|
if (Company::IsValidID(owner)) {
|
||||||
palette = COMPANY_SPRITE_COLOUR(owner);
|
palette = COMPANY_SPRITE_COLOUR(owner);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2430,7 +2430,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SpriteID image = t->ground.sprite;
|
SpriteID image = t->ground.sprite;
|
||||||
SpriteID pal = t->ground.pal;
|
PaletteID pal = t->ground.pal;
|
||||||
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
|
if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
|
||||||
image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
|
image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
|
||||||
image += custom_ground_offset;
|
image += custom_ground_offset;
|
||||||
|
@ -2465,7 +2465,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||||
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image)
|
void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image)
|
||||||
{
|
{
|
||||||
int32 total_offset = 0;
|
int32 total_offset = 0;
|
||||||
SpriteID pal = COMPANY_SPRITE_COLOUR(_local_company);
|
PaletteID pal = COMPANY_SPRITE_COLOUR(_local_company);
|
||||||
const DrawTileSprites *t = &_station_display_datas[st][image];
|
const DrawTileSprites *t = &_station_display_datas[st][image];
|
||||||
|
|
||||||
if (railtype != INVALID_RAILTYPE) {
|
if (railtype != INVALID_RAILTYPE) {
|
||||||
|
|
|
@ -20,8 +20,8 @@ void PlaceProc_DemolishArea(TileIndex tile);
|
||||||
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
|
bool GUIPlaceProcDragXY(ViewportDragDropSelectionProcess proc, TileIndex start_tile, TileIndex end_tile);
|
||||||
|
|
||||||
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc);
|
bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyle mode, PlaceProc *placeproc);
|
||||||
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, HighLightStyle mode, Window *w);
|
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w);
|
||||||
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);
|
||||||
void ResetObjectToPlace();
|
void ResetObjectToPlace();
|
||||||
|
|
||||||
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
|
void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method);
|
||||||
|
|
|
@ -637,7 +637,7 @@ static SpriteID GetRailIcon(EngineID engine, bool rear_head, int &y)
|
||||||
return GetDefaultTrainSprite(spritenum, DIR_W);
|
return GetDefaultTrainSprite(spritenum, DIR_W);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engine, SpriteID pal)
|
void DrawTrainEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal)
|
||||||
{
|
{
|
||||||
if (RailVehInfo(engine)->railveh_type == RAILVEH_MULTIHEAD) {
|
if (RailVehInfo(engine)->railveh_type == RAILVEH_MULTIHEAD) {
|
||||||
int yf = y;
|
int yf = y;
|
||||||
|
|
|
@ -80,7 +80,7 @@ void DrawTrainImage(const Train *v, int left, int right, int y, VehicleID select
|
||||||
int width = Train::From(v)->GetDisplayImageWidth(&offset);
|
int width = Train::From(v)->GetDisplayImageWidth(&offset);
|
||||||
|
|
||||||
if (rtl ? px + width > 0 : px - width < max_width) {
|
if (rtl ? px + width > 0 : px - width < max_width) {
|
||||||
SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
||||||
DrawSprite(v->GetImage(dir), pal, px + (rtl ? -offset.x : offset.x), 7 + offset.y);
|
DrawSprite(v->GetImage(dir), pal, px + (rtl ? -offset.x : offset.x), 7 + offset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ void DrawTrainDetails(const Train *v, int left, int right, int y, int vscroll_po
|
||||||
Point offset;
|
Point offset;
|
||||||
int width = u->GetDisplayImageWidth(&offset);
|
int width = u->GetDisplayImageWidth(&offset);
|
||||||
if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) {
|
if (vscroll_pos <= 0 && vscroll_pos > -vscroll_cap) {
|
||||||
SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
||||||
DrawSprite(u->GetImage(dir), pal, px + (rtl ? -offset.x : offset.x), y - line_height * vscroll_pos + sprite_y_offset + offset.y);
|
DrawSprite(u->GetImage(dir), pal, px + (rtl ? -offset.x : offset.x), y - line_height * vscroll_pos + sprite_y_offset + offset.y);
|
||||||
}
|
}
|
||||||
px += rtl ? -width : width;
|
px += rtl ? -width : width;
|
||||||
|
|
|
@ -433,9 +433,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TreeListEnt {
|
struct TreeListEnt : PalSpriteID {
|
||||||
SpriteID image;
|
|
||||||
SpriteID pal;
|
|
||||||
byte x, y;
|
byte x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -477,11 +475,11 @@ static void DrawTile_Trees(TileInfo *ti)
|
||||||
uint trees = GetTreeCount(ti->tile);
|
uint trees = GetTreeCount(ti->tile);
|
||||||
|
|
||||||
for (uint i = 0; i < trees; i++) {
|
for (uint i = 0; i < trees; i++) {
|
||||||
SpriteID image = s[0].sprite + (i == trees - 1 ? GetTreeGrowth(ti->tile) : 3);
|
SpriteID sprite = s[0].sprite + (i == trees - 1 ? GetTreeGrowth(ti->tile) : 3);
|
||||||
SpriteID pal = s[0].pal;
|
PaletteID pal = s[0].pal;
|
||||||
|
|
||||||
te[i].image = image;
|
te[i].sprite = sprite;
|
||||||
te[i].pal = pal;
|
te[i].pal = pal;
|
||||||
te[i].x = d->x;
|
te[i].x = d->x;
|
||||||
te[i].y = d->y;
|
te[i].y = d->y;
|
||||||
s++;
|
s++;
|
||||||
|
@ -502,7 +500,7 @@ static void DrawTile_Trees(TileInfo *ti)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSortableSpriteToDraw(te[mi].image, te[mi].pal, ti->x + te[mi].x, ti->y + te[mi].y, 16 - te[mi].x, 16 - te[mi].y, 0x30, z, IsTransparencySet(TO_TREES), -te[mi].x, -te[mi].y);
|
AddSortableSpriteToDraw(te[mi].sprite, te[mi].pal, ti->x + te[mi].x, ti->y + te[mi].y, 16 - te[mi].x, 16 - te[mi].y, 0x30, z, IsTransparencySet(TO_TREES), -te[mi].x, -te[mi].y);
|
||||||
|
|
||||||
/* replace the removed one with the last one */
|
/* replace the removed one with the last one */
|
||||||
te[mi] = te[trees - 1];
|
te[mi] = te[trees - 1];
|
||||||
|
|
|
@ -232,7 +232,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
|
||||||
assert(IsCompanyHQ(ti->tile));
|
assert(IsCompanyHQ(ti->tile));
|
||||||
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, FOUNDATION_LEVELED);
|
||||||
|
|
||||||
SpriteID palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
|
PaletteID palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
|
||||||
|
|
||||||
const DrawTileSprites *t = &_unmovable_display_datas[GetCompanyHQSize(ti->tile) << 2 | GetCompanyHQSection(ti->tile)];
|
const DrawTileSprites *t = &_unmovable_display_datas[GetCompanyHQSize(ti->tile) << 2 | GetCompanyHQSection(ti->tile)];
|
||||||
DrawGroundSprite(t->ground.sprite, palette);
|
DrawGroundSprite(t->ground.sprite, palette);
|
||||||
|
|
|
@ -766,7 +766,7 @@ void CallVehicleTicks()
|
||||||
static void DoDrawVehicle(const Vehicle *v)
|
static void DoDrawVehicle(const Vehicle *v)
|
||||||
{
|
{
|
||||||
SpriteID image = v->cur_image;
|
SpriteID image = v->cur_image;
|
||||||
SpriteID pal = PAL_NONE;
|
PaletteID pal = PAL_NONE;
|
||||||
|
|
||||||
if (v->vehstatus & VS_DEFPAL) pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
if (v->vehstatus & VS_DEFPAL) pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
|
||||||
|
|
||||||
|
@ -1393,9 +1393,9 @@ const Livery *GetEngineLivery(EngineID engine_type, CompanyID company, EngineID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v)
|
static PaletteID GetEngineColourMap(EngineID engine_type, CompanyID company, EngineID parent_engine_type, const Vehicle *v)
|
||||||
{
|
{
|
||||||
SpriteID map = (v != NULL) ? v->colourmap : PAL_NONE;
|
PaletteID map = (v != NULL) ? v->colourmap : PAL_NONE;
|
||||||
|
|
||||||
/* Return cached value if any */
|
/* Return cached value if any */
|
||||||
if (map != PAL_NONE) return map;
|
if (map != PAL_NONE) return map;
|
||||||
|
@ -1421,7 +1421,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, Engi
|
||||||
|
|
||||||
bool twocc = HasBit(e->info.misc_flags, EF_USES_2CC);
|
bool twocc = HasBit(e->info.misc_flags, EF_USES_2CC);
|
||||||
|
|
||||||
if (map == PAL_NONE) map = twocc ? (SpriteID)SPR_2CCMAP_BASE : (SpriteID)PALETTE_RECOLOUR_START;
|
if (map == PAL_NONE) map = twocc ? (PaletteID)SPR_2CCMAP_BASE : (PaletteID)PALETTE_RECOLOUR_START;
|
||||||
|
|
||||||
/* Spectator has news shown too, but has invalid company ID - as well as dedicated server */
|
/* Spectator has news shown too, but has invalid company ID - as well as dedicated server */
|
||||||
if (!Company::IsValidID(company)) return map;
|
if (!Company::IsValidID(company)) return map;
|
||||||
|
@ -1436,12 +1436,12 @@ static SpriteID GetEngineColourMap(EngineID engine_type, CompanyID company, Engi
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID GetEnginePalette(EngineID engine_type, CompanyID company)
|
PaletteID GetEnginePalette(EngineID engine_type, CompanyID company)
|
||||||
{
|
{
|
||||||
return GetEngineColourMap(engine_type, company, INVALID_ENGINE, NULL);
|
return GetEngineColourMap(engine_type, company, INVALID_ENGINE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID GetVehiclePalette(const Vehicle *v)
|
PaletteID GetVehiclePalette(const Vehicle *v)
|
||||||
{
|
{
|
||||||
if (v->type == VEH_TRAIN) {
|
if (v->type == VEH_TRAIN) {
|
||||||
return GetEngineColourMap(v->engine_type, v->owner, Train::From(v)->tcache.first_engine, v);
|
return GetEngineColourMap(v->engine_type, v->owner, Train::From(v)->tcache.first_engine, v);
|
||||||
|
|
|
@ -142,7 +142,7 @@ void DepotSortList(VehicleList *list)
|
||||||
/** draw the vehicle profit button in the vehicle list window. */
|
/** draw the vehicle profit button in the vehicle list window. */
|
||||||
static void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
|
static void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
|
||||||
{
|
{
|
||||||
SpriteID pal;
|
PaletteID pal;
|
||||||
|
|
||||||
/* draw profit-based coloured icons */
|
/* draw profit-based coloured icons */
|
||||||
if (v->age <= DAYS_IN_YEAR * 2) {
|
if (v->age <= DAYS_IN_YEAR * 2) {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -45,10 +45,10 @@ static inline void MaxZoomInOut(int how, Window *w)
|
||||||
|
|
||||||
void OffsetGroundSprite(int x, int y);
|
void OffsetGroundSprite(int x, int y);
|
||||||
|
|
||||||
void DrawGroundSprite(SpriteID image, SpriteID pal, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
|
void DrawGroundSprite(SpriteID image, PaletteID pal, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
|
||||||
void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
|
void DrawGroundSpriteAt(SpriteID image, PaletteID pal, int32 x, int32 y, int z, const SubSprite *sub = NULL, int extra_offs_x = 0, int extra_offs_y = 0);
|
||||||
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, const SubSprite *sub = NULL);
|
void AddSortableSpriteToDraw(SpriteID image, PaletteID 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, const SubSprite *sub = NULL);
|
||||||
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
|
void AddChildSpriteScreen(SpriteID image, PaletteID pal, int x, int y, bool transparent = false, const SubSprite *sub = NULL);
|
||||||
void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const ViewportSign *sign, StringID string_normal, StringID string_small, StringID string_small_shadow, uint64 params_1, uint64 params_2 = 0, Colours colour = INVALID_COLOUR);
|
void ViewportAddString(const DrawPixelInfo *dpi, ZoomLevel small_from, const ViewportSign *sign, StringID string_normal, StringID string_small, StringID string_small_shadow, uint64 params_1, uint64 params_2 = 0, Colours colour = INVALID_COLOUR);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -535,7 +535,7 @@ struct LocksDrawTileStruct {
|
||||||
#include "table/water_land.h"
|
#include "table/water_land.h"
|
||||||
|
|
||||||
static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts,
|
static void DrawWaterStuff(const TileInfo *ti, const WaterDrawTileStruct *wdts,
|
||||||
SpriteID palette, uint base, bool draw_ground)
|
PaletteID palette, uint base, bool draw_ground)
|
||||||
{
|
{
|
||||||
SpriteID image;
|
SpriteID image;
|
||||||
SpriteID water_base = GetCanalSprite(CF_WATERSLOPE, ti->tile);
|
SpriteID water_base = GetCanalSprite(CF_WATERSLOPE, ti->tile);
|
||||||
|
|
Loading…
Reference in New Issue