Changeset - r457:8379810cd1c9
[Not reviewed]
master
0 1 0
tron - 20 years ago 2004-11-17 21:11:16
tron@openttd.org
(svn r667) Fix bug in rendering stations from savegames
Also don't pitch custom station sprites by railtype
(pasky)
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
station_cmd.c
Show inline comments
 
@@ -1896,103 +1896,103 @@ static int32 RemoveDock(Station *st, uin
 
#include "table/station_land.h"
 

	
 

	
 
extern uint16 _custom_sprites_base;
 

	
 
static void DrawTile_Station(TileInfo *ti)
 
{
 
	uint32 image_or_modificator;
 
	uint32 image;
 
	const DrawTileSeqStruct *dtss;
 
	const DrawTileSprites *t = NULL;
 
	byte railtype = _map3_lo[ti->tile] & 0xF;
 
	uint32 relocation = 0;
 

	
 
	{
 
		uint owner = _map_owner[ti->tile];
 
		image_or_modificator = 0x315 << 16; /* NOTE: possible bug in ttd here? */
 
		if (owner < MAX_PLAYERS)
 
			image_or_modificator = PLAYER_SPRITE_COLOR(owner);
 
	}
 

	
 
	// don't show foundation for docks (docks are between 76 (0x4C) and 81 (0x51))
 
	if (ti->tileh != 0 && (ti->map5 < 0x4C || ti->map5 > 0x51))
 
		DrawFoundation(ti, ti->tileh);
 

	
 
	if (_map3_lo[ti->tile] & 0x10) {
 
		// look for customization
 
		struct StationSpec *statspec = GetCustomStation(STAT_CLASS_DFLT, _map3_hi[ti->tile]);
 

	
 
		//debug("Cust-o-mized %p", statspec);
 

	
 
		if (statspec != NULL) {
 
			Station *st = DEREF_STATION(_map2[ti->tile]);
 

	
 
			relocation = GetCustomStationRelocation(statspec, st, 0);
 
			//debug("Relocation %d", relocation);
 
			t = &statspec->renderdata[ti->map5];
 
		}
 
	}
 

	
 
	if (t == NULL) t = &_station_display_datas[ti->map5];
 

	
 
	image = t->ground_sprite;
 
	if (image & 0x8000)
 
		image |= image_or_modificator;
 

	
 
	// station_land array has been increased from 82 elements to 114
 
	// but this is something else. If AI builds station with 114 it looks all weird
 
	image += railtype * ((image < _custom_sprites_base) ? TRACKTYPE_SPRITE_PITCH : 1);
 
	image += railtype * ((image & 0x3FFF) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 1);
 
	DrawGroundSprite(image);
 

	
 
	foreach_draw_tile_seq(dtss, t->seq) {
 
		image =	dtss->image + relocation;
 
		// XXX: Do we want to do this for custom stations? --pasky
 
		image += railtype * ((image < _custom_sprites_base) ? TRACKTYPE_SPRITE_PITCH : 1);
 
		// For custom sprites, there's no railtype-based pitching.
 
		image += railtype * ((image & 0x3FFF) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 0);
 
		if (_display_opt & DO_TRANS_BUILDINGS) {
 
			if (image&0x8000) image |= image_or_modificator;	
 
		} else {
 
			image = (image & 0x3FFF) | 0x03224000;
 
		}
 

	
 
		if ((byte)dtss->delta_z != 0x80) {
 
			AddSortableSpriteToDraw(image, ti->x + dtss->delta_x, ti->y + dtss->delta_y, dtss->width, dtss->height, dtss->unk, ti->z + dtss->delta_z);
 
		} else {
 
			AddChildSpriteScreen(image, dtss->delta_x, dtss->delta_y);
 
		}
 
	}
 
}
 

	
 
void StationPickerDrawSprite(int x, int y, int railtype, int image)
 
{
 
	uint32 ormod, img;
 
	const DrawTileSeqStruct *dtss;
 
	const DrawTileSprites *t;
 

	
 
	/* baseimage */
 
	railtype *= TRACKTYPE_SPRITE_PITCH;
 

	
 
	ormod = PLAYER_SPRITE_COLOR(_local_player);
 

	
 
	t = &_station_display_datas[image];
 

	
 
	img = t->ground_sprite;
 
	if (img & 0x8000)
 
		img |= ormod;
 
	DrawSprite(img + railtype, x, y);
 

	
 
	foreach_draw_tile_seq(dtss, t->seq) {
 
		Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
 
		DrawSprite((dtss->image | ormod) + railtype, x + pt.x, y + pt.y);
 
	}
 
}
 

	
 
static uint GetSlopeZ_Station(TileInfo *ti)
 
{
 
	uint z = ti->z;
 
	if (ti->tileh != 0)
 
		z += 8;
 
	return z;
 
}
 

	
 
static uint GetSlopeTileh_Station(TileInfo *ti)
 
{
0 comments (0 inline, 0 general)