src/newgrf_station.cpp
changeset 5919 2b58160d667d
parent 5860 7fdc9b423ba1
child 6076 c4114ae31687
equal deleted inserted replaced
5918:602e158900a2 5919:2b58160d667d
   674 	const StationSpec *statspec;
   674 	const StationSpec *statspec;
   675 	const DrawTileSprites *sprites;
   675 	const DrawTileSprites *sprites;
   676 	const DrawTileSeqStruct *seq;
   676 	const DrawTileSeqStruct *seq;
   677 	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
   677 	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
   678 	SpriteID relocation;
   678 	SpriteID relocation;
   679 	PalSpriteID image;
   679 	SpriteID image;
   680 	PalSpriteID colourmod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player));
   680 	SpriteID pal = PLAYER_SPRITE_COLOR(_local_player);
   681 	uint tile = 2;
   681 	uint tile = 2;
   682 
   682 
   683 	statspec = GetCustomStationSpec(sclass, station);
   683 	statspec = GetCustomStationSpec(sclass, station);
   684 	if (statspec == NULL) return false;
   684 	if (statspec == NULL) return false;
   685 
   685 
   695 	} else {
   695 	} else {
   696 		sprites = &statspec->renderdata[(tile < statspec->tiles) ? tile + axis : (uint)axis];
   696 		sprites = &statspec->renderdata[(tile < statspec->tiles) ? tile + axis : (uint)axis];
   697 	}
   697 	}
   698 
   698 
   699 	image = sprites->ground_sprite;
   699 	image = sprites->ground_sprite;
   700 	if (HASBIT(image, 31)) {
   700 	if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
   701 		CLRBIT(image, 31);
       
   702 		image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
   701 		image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
   703 		image += rti->custom_ground_offset;
   702 		image += rti->custom_ground_offset;
   704 	} else {
   703 	} else {
   705 		image += rti->total_offset;
   704 		image += rti->total_offset;
   706 	}
   705 	}
   707 
   706 
   708 	if (image & PALETTE_MODIFIER_COLOR) image &= SPRITE_MASK;
   707 	DrawSprite(image, PAL_NONE, x, y);
   709 	DrawSprite(image, x, y);
       
   710 
   708 
   711 	foreach_draw_tile_seq(seq, sprites->seq) {
   709 	foreach_draw_tile_seq(seq, sprites->seq) {
   712 		Point pt;
   710 		Point pt;
   713 		image = seq->image;
   711 		image = seq->image;
   714 		if (HASBIT(image, 30)) {
   712 		if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
   715 			CLRBIT(image, 30);
       
   716 			image += rti->total_offset;
   713 			image += rti->total_offset;
   717 		} else {
   714 		} else {
   718 			image += relocation;
   715 			image += relocation;
   719 		}
   716 		}
   720 
   717 
   721 		if ((byte)seq->delta_z != 0x80) {
   718 		if ((byte)seq->delta_z != 0x80) {
   722 			pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z);
   719 			pt = RemapCoords(seq->delta_x, seq->delta_y, seq->delta_z);
   723 			DrawSprite((image & SPRITE_MASK) | colourmod, x + pt.x, y + pt.y);
   720 			DrawSprite(image, pal, x + pt.x, y + pt.y);
   724 		}
   721 		}
   725 	}
   722 	}
   726 
   723 
   727 	return true;
   724 	return true;
   728 }
   725 }