mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r5796) Use DrawTileSprites/DrawTileSeqStruct for road depot drawing data, too
This commit is contained in:
parent
3254155930
commit
5fae4637d8
40
road_cmd.c
40
road_cmd.c
|
@ -5,6 +5,7 @@
|
||||||
#include "bridge_map.h"
|
#include "bridge_map.h"
|
||||||
#include "rail_map.h"
|
#include "rail_map.h"
|
||||||
#include "road_map.h"
|
#include "road_map.h"
|
||||||
|
#include "sprite.h"
|
||||||
#include "table/sprites.h"
|
#include "table/sprites.h"
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
@ -650,14 +651,6 @@ typedef struct DrawRoadTileStruct {
|
||||||
byte subcoord_y;
|
byte subcoord_y;
|
||||||
} DrawRoadTileStruct;
|
} DrawRoadTileStruct;
|
||||||
|
|
||||||
typedef struct DrawRoadSeqStruct {
|
|
||||||
uint32 image;
|
|
||||||
byte subcoord_x;
|
|
||||||
byte subcoord_y;
|
|
||||||
byte width;
|
|
||||||
byte height;
|
|
||||||
} DrawRoadSeqStruct;
|
|
||||||
|
|
||||||
#include "table/road_land.h"
|
#include "table/road_land.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -783,19 +776,19 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case ROAD_TILE_DEPOT: {
|
case ROAD_TILE_DEPOT: {
|
||||||
const DrawRoadSeqStruct* drss;
|
const DrawTileSprites* dts;
|
||||||
|
const DrawTileSeqStruct* dtss;
|
||||||
uint32 palette;
|
uint32 palette;
|
||||||
|
|
||||||
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh);
|
if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh);
|
||||||
|
|
||||||
palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
|
palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
|
||||||
|
|
||||||
drss = _road_depot[GetRoadDepotDirection(ti->tile)];
|
dts = &_road_depot[GetRoadDepotDirection(ti->tile)];
|
||||||
|
DrawGroundSprite(dts->ground_sprite);
|
||||||
|
|
||||||
DrawGroundSprite(drss++->image);
|
for (dtss = dts->seq; dtss->image != 0; dtss++) {
|
||||||
|
uint32 image = dtss->image;
|
||||||
for (; drss->image != 0; drss++) {
|
|
||||||
uint32 image = drss->image;
|
|
||||||
|
|
||||||
if (_display_opt & DO_TRANS_BUILDINGS) {
|
if (_display_opt & DO_TRANS_BUILDINGS) {
|
||||||
MAKE_TRANSPARENT(image);
|
MAKE_TRANSPARENT(image);
|
||||||
|
@ -804,8 +797,10 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddSortableSpriteToDraw(
|
AddSortableSpriteToDraw(
|
||||||
image, ti->x | drss->subcoord_x,
|
image,
|
||||||
ti->y | drss->subcoord_y, drss->width, drss->height, 0x14, ti->z
|
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
|
||||||
|
dtss->size_x, dtss->size_y,
|
||||||
|
dtss->size_z, ti->z
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -815,19 +810,20 @@ static void DrawTile_Road(TileInfo *ti)
|
||||||
|
|
||||||
void DrawRoadDepotSprite(int x, int y, DiagDirection dir)
|
void DrawRoadDepotSprite(int x, int y, DiagDirection dir)
|
||||||
{
|
{
|
||||||
const DrawRoadSeqStruct* dtss = _road_depot[dir];
|
uint32 palette = PLAYER_SPRITE_COLOR(_local_player);
|
||||||
uint32 ormod = PLAYER_SPRITE_COLOR(_local_player);
|
const DrawTileSprites* dts = &_road_depot[dir];
|
||||||
|
const DrawTileSeqStruct* dtss;
|
||||||
|
|
||||||
x += 33;
|
x += 33;
|
||||||
y += 17;
|
y += 17;
|
||||||
|
|
||||||
DrawSprite(dtss++->image, x, y);
|
DrawSprite(dts->ground_sprite, x, y);
|
||||||
|
|
||||||
for (; dtss->image != 0; dtss++) {
|
for (dtss = dts->seq; dtss->image != 0; dtss++) {
|
||||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
|
||||||
uint32 image = dtss->image;
|
uint32 image = dtss->image;
|
||||||
|
|
||||||
if (image & PALETTE_MODIFIER_COLOR) image |= ormod;
|
if (image & PALETTE_MODIFIER_COLOR) image |= palette;
|
||||||
|
|
||||||
DrawSprite(image, x + pt.x, y + pt.y);
|
DrawSprite(image, x + pt.x, y + pt.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,35 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#define TILE_SEQ_BEGIN(x) { x, 0, 0, 0, 0 },
|
#define TILE_SEQ_LINE(img, dx, dy, sx, sy) { dx, dy, 0, sx, sy, 20, img },
|
||||||
#define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e },
|
#define TILE_SEQ_END() { 0, 0, 0, 0, 0, 0, 0 }
|
||||||
#define TILE_SEQ_END() { 0, 0, 0, 0, 0 }
|
|
||||||
|
|
||||||
static const DrawRoadSeqStruct _road_depot_NE[] = {
|
static const DrawTileSeqStruct _road_depot_NE[] = {
|
||||||
TILE_SEQ_BEGIN(0xA4A)
|
|
||||||
TILE_SEQ_LINE(0x584 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
|
TILE_SEQ_LINE(0x584 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const DrawRoadSeqStruct _road_depot_SE[] = {
|
static const DrawTileSeqStruct _road_depot_SE[] = {
|
||||||
TILE_SEQ_BEGIN(0xA4A)
|
|
||||||
TILE_SEQ_LINE(0x580, 0, 0, 1, 16)
|
TILE_SEQ_LINE(0x580, 0, 0, 1, 16)
|
||||||
TILE_SEQ_LINE(0x581 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
|
TILE_SEQ_LINE(0x581 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const DrawRoadSeqStruct _road_depot_SW[] = {
|
static const DrawTileSeqStruct _road_depot_SW[] = {
|
||||||
TILE_SEQ_BEGIN(0xA4A)
|
|
||||||
TILE_SEQ_LINE(0x582, 0, 0, 16, 1)
|
TILE_SEQ_LINE(0x582, 0, 0, 16, 1)
|
||||||
TILE_SEQ_LINE(0x583 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
|
TILE_SEQ_LINE(0x583 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const DrawRoadSeqStruct _road_depot_NW[] = {
|
static const DrawTileSeqStruct _road_depot_NW[] = {
|
||||||
TILE_SEQ_BEGIN(0xA4A)
|
|
||||||
TILE_SEQ_LINE(0x585 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
|
TILE_SEQ_LINE(0x585 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
|
||||||
TILE_SEQ_END()
|
TILE_SEQ_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
static const DrawRoadSeqStruct* const _road_depot[] = {
|
static const DrawTileSprites _road_depot[] = {
|
||||||
_road_depot_NE,
|
{ 0xA4A, _road_depot_NE },
|
||||||
_road_depot_SE,
|
{ 0xA4A, _road_depot_SE },
|
||||||
_road_depot_SW,
|
{ 0xA4A, _road_depot_SW },
|
||||||
_road_depot_NW
|
{ 0xA4A, _road_depot_NW }
|
||||||
};
|
};
|
||||||
|
|
||||||
#undef TILE_SEQ_BEGIN
|
#undef TILE_SEQ_BEGIN
|
||||||
|
|
Loading…
Reference in New Issue