mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 15:11:54 +00:00
(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
This commit is contained in:
parent
76ea272c9c
commit
b0135b4381
@ -48,9 +48,6 @@ void DrawClearLandTile(const TileInfo *ti, byte set);
|
||||
void DrawClearLandFence(const TileInfo *ti);
|
||||
void TileLoopClearHelper(TileIndex tile);
|
||||
|
||||
/* road_land.c */
|
||||
void DrawRoadDepotSprite(int x, int y, int image);
|
||||
|
||||
/* water_land.c */
|
||||
void DrawShipDepotSprite(int x, int y, int image);
|
||||
void TileLoop_Water(TileIndex tile);
|
||||
|
@ -793,7 +793,7 @@ static void DrawTile_Road(TileInfo *ti)
|
||||
player = GetTileOwner(ti->tile);
|
||||
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);
|
||||
|
||||
@ -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);
|
||||
|
||||
x += 33;
|
||||
@ -825,8 +825,8 @@ void DrawRoadDepotSprite(int x, int y, int image)
|
||||
|
||||
for (; dtss->image != 0; dtss++) {
|
||||
Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
|
||||
uint32 image = dtss->image;
|
||||
|
||||
image = dtss->image;
|
||||
if (image & PALETTE_MODIFIER_COLOR) image |= ormod;
|
||||
|
||||
DrawSprite(image, x + pt.x, y + pt.y);
|
||||
|
10
road_cmd.h
Normal file
10
road_cmd.h
Normal 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
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "road_cmd.h"
|
||||
#include "road_map.h"
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
@ -353,10 +354,10 @@ static void BuildRoadDepotWndProc(Window *w, WindowEvent *e)
|
||||
w->click_state = (1<<3) << _road_depot_orientation;
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
DrawRoadDepotSprite(70, 17, 0);
|
||||
DrawRoadDepotSprite(70, 69, 1);
|
||||
DrawRoadDepotSprite( 2, 69, 2);
|
||||
DrawRoadDepotSprite( 2, 17, 3);
|
||||
DrawRoadDepotSprite(70, 17, DIAGDIR_NE);
|
||||
DrawRoadDepotSprite(70, 69, DIAGDIR_SE);
|
||||
DrawRoadDepotSprite( 2, 69, DIAGDIR_SW);
|
||||
DrawRoadDepotSprite( 2, 17, DIAGDIR_NW);
|
||||
break;
|
||||
|
||||
case WE_CLICK: {
|
||||
|
@ -4,37 +4,37 @@
|
||||
#define TILE_SEQ_LINE(a, b, c, d, e) { a, b, c, d, e },
|
||||
#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_LINE(0x584 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawRoadSeqStruct _road_display_datas_1[] = {
|
||||
static const DrawRoadSeqStruct _road_depot_SE[] = {
|
||||
TILE_SEQ_BEGIN(0xA4A)
|
||||
TILE_SEQ_LINE(0x580, 0, 0, 1, 16)
|
||||
TILE_SEQ_LINE(0x581 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawRoadSeqStruct _road_display_datas_2[] = {
|
||||
static const DrawRoadSeqStruct _road_depot_SW[] = {
|
||||
TILE_SEQ_BEGIN(0xA4A)
|
||||
TILE_SEQ_LINE(0x582, 0, 0, 16, 1)
|
||||
TILE_SEQ_LINE(0x583 | PALETTE_MODIFIER_COLOR, 0, 15, 16, 1)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawRoadSeqStruct _road_display_datas_3[] = {
|
||||
static const DrawRoadSeqStruct _road_depot_NW[] = {
|
||||
TILE_SEQ_BEGIN(0xA4A)
|
||||
TILE_SEQ_LINE(0x585 | PALETTE_MODIFIER_COLOR, 15, 0, 1, 16)
|
||||
TILE_SEQ_END()
|
||||
};
|
||||
|
||||
static const DrawRoadSeqStruct* const _road_display_datas[] = {
|
||||
_road_display_datas_0,
|
||||
_road_display_datas_1,
|
||||
_road_display_datas_2,
|
||||
_road_display_datas_3,
|
||||
static const DrawRoadSeqStruct* const _road_depot[] = {
|
||||
_road_depot_NE,
|
||||
_road_depot_SE,
|
||||
_road_depot_SW,
|
||||
_road_depot_NW
|
||||
};
|
||||
|
||||
#undef TILE_SEQ_BEGIN
|
||||
|
Loading…
Reference in New Issue
Block a user