(svn r612) [newgrf] Fix: custom waypoints on monorail/maglev are displayed correctly
This commit is contained in:
		@@ -66,7 +66,7 @@ void StationPickerDrawSprite(int x, int y, int railtype, int image);
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* track_land.c */
 | 
					/* track_land.c */
 | 
				
			||||||
void DrawTrainDepotSprite(int x, int y, int image, int railtype);
 | 
					void DrawTrainDepotSprite(int x, int y, int image, int railtype);
 | 
				
			||||||
void DrawWaypointSprite(int x, int y, int image);
 | 
					void DrawWaypointSprite(int x, int y, int image, int railtype);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* road_land.c */
 | 
					/* road_land.c */
 | 
				
			||||||
void DrawRoadDepotSprite(int x, int y, int image);
 | 
					void DrawRoadDepotSprite(int x, int y, int image);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								rail_cmd.c
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								rail_cmd.c
									
									
									
									
									
								
							@@ -9,6 +9,8 @@
 | 
				
			|||||||
#include "station.h"
 | 
					#include "station.h"
 | 
				
			||||||
#include "sprite.h"
 | 
					#include "sprite.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					extern uint16 _custom_sprites_base;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ShowTrainDepotWindow(uint tile);
 | 
					void ShowTrainDepotWindow(uint tile);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
enum { /* These values are bitmasks for the map5 byte */
 | 
					enum { /* These values are bitmasks for the map5 byte */
 | 
				
			||||||
@@ -1569,9 +1571,12 @@ static void DrawTile_Track(TileInfo *ti)
 | 
				
			|||||||
				// emulate station tile - open with building
 | 
									// emulate station tile - open with building
 | 
				
			||||||
				DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
 | 
									DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
 | 
				
			||||||
				uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
 | 
									uint32 relocation = GetCustomStationRelocation(stat, ComposeWaypointStation(ti->tile), 0);
 | 
				
			||||||
 | 
									int railtype=(_map3_lo[ti->tile] & 0xF);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									image = cust->ground_sprite + railtype*((image<_custom_sprites_base)?TRACKTYPE_SPRITE_PITCH:1);
 | 
				
			||||||
 | 
									if (image & 0x8000) image = (image & 0x7FFF);
 | 
				
			||||||
 | 
									
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				image = cust->ground_sprite;
 | 
					 | 
				
			||||||
				if (image & 0x8000) image = (image & 0x7FFF) + tracktype_offs;
 | 
					 | 
				
			||||||
				DrawGroundSprite(image);
 | 
									DrawGroundSprite(image);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				foreach_draw_tile_seq(seq, cust->seq) {
 | 
									foreach_draw_tile_seq(seq, cust->seq) {
 | 
				
			||||||
@@ -1640,7 +1645,7 @@ void DrawTrainDepotSprite(int x, int y, int image, int railtype)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DrawWaypointSprite(int x, int y, int stat_id)
 | 
					void DrawWaypointSprite(int x, int y, int stat_id, int railtype)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct StationSpec *stat;
 | 
						struct StationSpec *stat;
 | 
				
			||||||
	uint32 relocation;
 | 
						uint32 relocation;
 | 
				
			||||||
@@ -1659,14 +1664,14 @@ void DrawWaypointSprite(int x, int y, int stat_id)
 | 
				
			|||||||
		const DrawTrackSeqStruct *dtss;
 | 
							const DrawTrackSeqStruct *dtss;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		img = *(const uint16*)t;
 | 
							img = *(const uint16*)t;
 | 
				
			||||||
		if (img & 0x8000) img = (img & 0x7FFF) + 0;
 | 
							if (img & 0x8000) img = (img & 0x7FFF) + railtype*TRACKTYPE_SPRITE_PITCH;
 | 
				
			||||||
		DrawSprite(img, x, y);
 | 
							DrawSprite(img, x, y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
 | 
							for (dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
 | 
				
			||||||
			Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
 | 
								Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
 | 
				
			||||||
			img = dtss->image;
 | 
								img = dtss->image;
 | 
				
			||||||
			if (img & 0x8000) img |= ormod;
 | 
								if (img & 0x8000) img |= ormod;
 | 
				
			||||||
			DrawSprite(img + 0, x + pt.x, y + pt.y);
 | 
								DrawSprite(img, x + pt.x, y + pt.y);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1678,7 +1683,7 @@ void DrawWaypointSprite(int x, int y, int stat_id)
 | 
				
			|||||||
	// add 1 to get the other direction
 | 
						// add 1 to get the other direction
 | 
				
			||||||
	cust = &stat->renderdata[2];
 | 
						cust = &stat->renderdata[2];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	img = cust->ground_sprite;
 | 
						img = cust->ground_sprite + railtype*((img<_custom_sprites_base)?TRACKTYPE_SPRITE_PITCH:1);
 | 
				
			||||||
	if (img & 0x8000) img = (img & 0x7FFF);
 | 
						if (img & 0x8000) img = (img & 0x7FFF);
 | 
				
			||||||
	DrawSprite(img, x, y);
 | 
						DrawSprite(img, x, y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								rail_gui.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								rail_gui.c
									
									
									
									
									
								
							@@ -1065,11 +1065,11 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
 | 
				
			|||||||
		DrawWindowWidgets(w);
 | 
							DrawWindowWidgets(w);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		r = 4*w->hscroll.pos;
 | 
							r = 4*w->hscroll.pos;
 | 
				
			||||||
		if(r+0<=_waypoint_count) DrawWaypointSprite(2,   25, r + 0);
 | 
							if(r+0<=_waypoint_count) DrawWaypointSprite(2,   25, r + 0, _cur_railtype);
 | 
				
			||||||
		if(r+1<=_waypoint_count) DrawWaypointSprite(70,  25, r + 1);
 | 
							if(r+1<=_waypoint_count) DrawWaypointSprite(70,  25, r + 1, _cur_railtype);
 | 
				
			||||||
		if(r+2<=_waypoint_count) DrawWaypointSprite(138, 25, r + 2);
 | 
							if(r+2<=_waypoint_count) DrawWaypointSprite(138, 25, r + 2, _cur_railtype);
 | 
				
			||||||
		if(r+3<=_waypoint_count) DrawWaypointSprite(206, 25, r + 3);
 | 
							if(r+3<=_waypoint_count) DrawWaypointSprite(206, 25, r + 3, _cur_railtype);
 | 
				
			||||||
		if(r+4<=_waypoint_count) DrawWaypointSprite(274, 25, r + 4);
 | 
							if(r+4<=_waypoint_count) DrawWaypointSprite(274, 25, r + 4, _cur_railtype);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	case WE_CLICK: {
 | 
						case WE_CLICK: {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user