1
0
Fork 0

(svn r5723) - Move the declaration of DrawRoadDepotSprite() out of functions.h (but I'm not too happy with the new header)

- Use DiagDirection instead of plain int for the orientation of the depot graphics
- Rename the associated data tables with sprites to something more meaningful
release/0.5
tron 2006-08-03 06:44:54 +00:00
parent 76ea272c9c
commit b0135b4381
5 changed files with 28 additions and 20 deletions

View File

@ -48,9 +48,6 @@ void DrawClearLandTile(const TileInfo *ti, byte set);
void DrawClearLandFence(const TileInfo *ti); void DrawClearLandFence(const TileInfo *ti);
void TileLoopClearHelper(TileIndex tile); void TileLoopClearHelper(TileIndex tile);
/* road_land.c */
void DrawRoadDepotSprite(int x, int y, int image);
/* water_land.c */ /* water_land.c */
void DrawShipDepotSprite(int x, int y, int image); void DrawShipDepotSprite(int x, int y, int image);
void TileLoop_Water(TileIndex tile); void TileLoop_Water(TileIndex tile);

View File

@ -793,7 +793,7 @@ static void DrawTile_Road(TileInfo *ti)
player = GetTileOwner(ti->tile); player = GetTileOwner(ti->tile);
if (player < MAX_PLAYERS) ormod = PLAYER_SPRITE_COLOR(player); if (player < MAX_PLAYERS) ormod = PLAYER_SPRITE_COLOR(player);
drss = _road_display_datas[GetRoadDepotDirection(ti->tile)]; drss = _road_depot[GetRoadDepotDirection(ti->tile)];
DrawGroundSprite(drss++->image); DrawGroundSprite(drss++->image);
@ -813,9 +813,9 @@ static void DrawTile_Road(TileInfo *ti)
} }
} }
void DrawRoadDepotSprite(int x, int y, int image) void DrawRoadDepotSprite(int x, int y, DiagDirection dir)
{ {
const DrawRoadSeqStruct* dtss = _road_display_datas[image]; const DrawRoadSeqStruct* dtss = _road_depot[dir];
uint32 ormod = PLAYER_SPRITE_COLOR(_local_player); uint32 ormod = PLAYER_SPRITE_COLOR(_local_player);
x += 33; x += 33;
@ -825,8 +825,8 @@ void DrawRoadDepotSprite(int x, int y, int image)
for (; dtss->image != 0; dtss++) { for (; dtss->image != 0; dtss++) {
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0); Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
uint32 image = dtss->image;
image = dtss->image;
if (image & PALETTE_MODIFIER_COLOR) image |= ormod; if (image & PALETTE_MODIFIER_COLOR) image |= ormod;
DrawSprite(image, x + pt.x, y + pt.y); DrawSprite(image, x + pt.x, y + pt.y);

10
road_cmd.h 100644
View File

@ -0,0 +1,10 @@
/* $Id$ */
#ifndef ROAD_CMD_H
#define ROAD_CMD_H
#include "direction.h"
void DrawRoadDepotSprite(int x, int y, DiagDirection dir);
#endif

View File

@ -2,6 +2,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "openttd.h" #include "openttd.h"
#include "road_cmd.h"
#include "road_map.h" #include "road_map.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
@ -353,10 +354,10 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
w->click_state = (1<<3) << _road_depot_orientation; w->click_state = (1<<3) << _road_depot_orientation;
DrawWindowWidgets(w); DrawWindowWidgets(w);
DrawRoadDepotSprite(70, 17, 0); DrawRoadDepotSprite(70, 17, DIAGDIR_NE);
DrawRoadDepotSprite(70, 69, 1); DrawRoadDepotSprite(70, 69, DIAGDIR_SE);
DrawRoadDepotSprite( 2, 69, 2); DrawRoadDepotSprite( 2, 69, DIAGDIR_SW);
DrawRoadDepotSprite( 2, 17, 3); DrawRoadDepotSprite( 2, 17, DIAGDIR_NW);
break; break;
case WE_CLICK: { case WE_CLICK: {

View File

@ -4,37 +4,37 @@
#define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e }, #define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e },
#define TILE_SEQ_END() { 0, 0, 0, 0, 0 } #define TILE_SEQ_END() { 0, 0, 0, 0, 0 }
static const DrawRoadSeqStruct _road_display_datas_0[] = { static const DrawRoadSeqStruct _road_depot_NE[] = {
TILE_SEQ_BEGIN(0xA4A) 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_display_datas_1[] = { static const DrawRoadSeqStruct _road_depot_SE[] = {
TILE_SEQ_BEGIN(0xA4A) 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_display_datas_2[] = { static const DrawRoadSeqStruct _road_depot_SW[] = {
TILE_SEQ_BEGIN(0xA4A) 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_display_datas_3[] = { static const DrawRoadSeqStruct _road_depot_NW[] = {
TILE_SEQ_BEGIN(0xA4A) 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_display_datas[] = { static const DrawRoadSeqStruct* const _road_depot[] = {
_road_display_datas_0, _road_depot_NE,
_road_display_datas_1, _road_depot_SE,
_road_display_datas_2, _road_depot_SW,
_road_display_datas_3, _road_depot_NW
}; };
#undef TILE_SEQ_BEGIN #undef TILE_SEQ_BEGIN