viewport.c
changeset 1093 4fdc46eaf423
parent 1083 8e64dc3ed29f
child 1095 b59632d9df1b
equal deleted inserted replaced
1092:e3b4a131db7c 1093:4fdc46eaf423
   318 
   318 
   319 	pt.y = pt.x = -1;
   319 	pt.y = pt.x = -1;
   320 	return pt;
   320 	return pt;
   321 }
   321 }
   322 
   322 
   323 Point GetTileBelowCursor()
   323 Point GetTileBelowCursor(void)
   324 {
   324 {
   325 	return GetTileFromScreenXY(_cursor.pos.x, _cursor.pos.y, _cursor.pos.x, _cursor.pos.y);
   325 	return GetTileFromScreenXY(_cursor.pos.x, _cursor.pos.y, _cursor.pos.x, _cursor.pos.y);
   326 }
   326 }
   327 
   327 
   328 
   328 
   471 	if (vd->combine_sprites == 1) {
   471 	if (vd->combine_sprites == 1) {
   472 		vd->combine_sprites = 2;
   472 		vd->combine_sprites = 2;
   473 	}
   473 	}
   474 }
   474 }
   475 
   475 
   476 void StartSpriteCombine()
   476 void StartSpriteCombine(void)
   477 {
   477 {
   478 	_cur_vd->combine_sprites = 1;
   478 	_cur_vd->combine_sprites = 1;
   479 }
   479 }
   480 
   480 
   481 void EndSpriteCombine()
   481 void EndSpriteCombine(void)
   482 {
   482 {
   483 	_cur_vd->combine_sprites = 0;
   483 	_cur_vd->combine_sprites = 0;
   484 }
   484 }
   485 
   485 
   486 void AddChildSpriteScreen(uint32 image, int x, int y)
   486 void AddChildSpriteScreen(uint32 image, int x, int y)
   548 
   548 
   549 static uint _stored_tile[200];
   549 static uint _stored_tile[200];
   550 static int _stored_track[200];
   550 static int _stored_track[200];
   551 static int _num_stored;
   551 static int _num_stored;
   552 
   552 
   553 void dbg_store_path()
   553 void dbg_store_path(void)
   554 {
   554 {
   555 	memcpy(_stored_tile, _pushed_tile, sizeof(_stored_tile));
   555 	memcpy(_stored_tile, _pushed_tile, sizeof(_stored_tile));
   556 	memcpy(_stored_track, _pushed_track, sizeof(_stored_tile));
   556 	memcpy(_stored_track, _pushed_track, sizeof(_stored_tile));
   557 	_num_stored = _num_push;
   557 	_num_stored = _num_push;
   558 	MarkWholeScreenDirty();
   558 	MarkWholeScreenDirty();
   563 	_pushed_tile[_num_push] = tile;
   563 	_pushed_tile[_num_push] = tile;
   564 	_pushed_track[_num_push++] = track;
   564 	_pushed_track[_num_push++] = track;
   565 	dbg_store_path();
   565 	dbg_store_path();
   566 }
   566 }
   567 
   567 
   568 void dbg_pop_tile()
   568 void dbg_pop_tile(void)
   569 {
   569 {
   570 	_num_push--;
   570 	_num_push--;
   571 }
   571 }
   572 
   572 
   573 static const uint16 _dbg_track_sprite[] = {
   573 static const uint16 _dbg_track_sprite[] = {
   709 		DrawSelectionSprite(0x30582F0 + _tileh_to_sprite[ti->tileh], ti);
   709 		DrawSelectionSprite(0x30582F0 + _tileh_to_sprite[ti->tileh], ti);
   710 		return;
   710 		return;
   711 	}
   711 	}
   712 }
   712 }
   713 
   713 
   714 static void ViewportAddLandscape()
   714 static void ViewportAddLandscape(void)
   715 {
   715 {
   716 	ViewportDrawer *vd = _cur_vd;
   716 	ViewportDrawer *vd = _cur_vd;
   717 	int x, y, width, height;
   717 	int x, y, width, height;
   718 	TileInfo ti;
   718 	TileInfo ti;
   719 	bool direction;
   719 	bool direction;
  1425 		pt.x - 31 + 67,
  1425 		pt.x - 31 + 67,
  1426 		pt.y - 122 + 154
  1426 		pt.y - 122 + 154
  1427 	);
  1427 	);
  1428 }
  1428 }
  1429 
  1429 
  1430 static void SetSelectionTilesDirty()
  1430 static void SetSelectionTilesDirty(void)
  1431 {
  1431 {
  1432 	int y_size, x_size;
  1432 	int y_size, x_size;
  1433 	TileHighlightData *thd = _thd_ptr;
  1433 	TileHighlightData *thd = _thd_ptr;
  1434 	int x = thd->pos.x;
  1434 	int x = thd->pos.x;
  1435 	int y = thd->pos.y;
  1435 	int y = thd->pos.y;
  1714 		Vehicle *v = CheckClickOnVehicle(vp, x, y);
  1714 		Vehicle *v = CheckClickOnVehicle(vp, x, y);
  1715 		if (v) _on_vehicle_click_proc[v->type - 0x10](v);
  1715 		if (v) _on_vehicle_click_proc[v->type - 0x10](v);
  1716 	}
  1716 	}
  1717 }
  1717 }
  1718 
  1718 
  1719 Vehicle *CheckMouseOverVehicle()
  1719 Vehicle *CheckMouseOverVehicle(void)
  1720 {
  1720 {
  1721 	Window *w;
  1721 	Window *w;
  1722 	ViewPort *vp;
  1722 	ViewPort *vp;
  1723 
  1723 
  1724 	int x = _cursor.pos.x;
  1724 	int x = _cursor.pos.x;
  1736 	}
  1736 	}
  1737 }
  1737 }
  1738 
  1738 
  1739 
  1739 
  1740 
  1740 
  1741 void PlaceObject()
  1741 void PlaceObject(void)
  1742 {
  1742 {
  1743 	Point pt;
  1743 	Point pt;
  1744 	Window *w;
  1744 	Window *w;
  1745 	WindowEvent e;
  1745 	WindowEvent e;
  1746 
  1746 
  1850 	i = AutorailPiece[x&0xF][y&0xF];
  1850 	i = AutorailPiece[x&0xF][y&0xF];
  1851 	return HT_RAIL | i;
  1851 	return HT_RAIL | i;
  1852 }
  1852 }
  1853 
  1853 
  1854 // called regular to update tile highlighting in all cases
  1854 // called regular to update tile highlighting in all cases
  1855 void UpdateTileSelection()
  1855 void UpdateTileSelection(void)
  1856 {
  1856 {
  1857 	TileHighlightData *thd = _thd_ptr;
  1857 	TileHighlightData *thd = _thd_ptr;
  1858 	Point pt;
  1858 	Point pt;
  1859 	int x1,y1;
  1859 	int x1,y1;
  1860 
  1860 
  1954 	thd->selstart.x = TileX(from) * 16;
  1954 	thd->selstart.x = TileX(from) * 16;
  1955 	thd->selstart.y = TileY(from) * 16;
  1955 	thd->selstart.y = TileY(from) * 16;
  1956 	thd->next_drawstyle = HT_RECT;
  1956 	thd->next_drawstyle = HT_RECT;
  1957 }
  1957 }
  1958 
  1958 
  1959 void VpStartPreSizing()
  1959 void VpStartPreSizing(void)
  1960 {
  1960 {
  1961 	_thd.selend.x = -1;
  1961 	_thd.selend.x = -1;
  1962 	_special_mouse_mode = WSM_PRESIZE;
  1962 	_special_mouse_mode = WSM_PRESIZE;
  1963 }
  1963 }
  1964 
  1964 
  2129 	thd->selend.x = x;
  2129 	thd->selend.x = x;
  2130 	thd->selend.y = y;
  2130 	thd->selend.y = y;
  2131 }
  2131 }
  2132 
  2132 
  2133 // while dragging 
  2133 // while dragging 
  2134 bool VpHandlePlaceSizingDrag()
  2134 bool VpHandlePlaceSizingDrag(void)
  2135 {
  2135 {
  2136 	Window *w;
  2136 	Window *w;
  2137 	WindowEvent e;
  2137 	WindowEvent e;
  2138 
  2138 
  2139 	if (_special_mouse_mode != WSM_SIZING)
  2139 	if (_special_mouse_mode != WSM_SIZING)
  2223 		SetAnimatedMouseCursor(_animcursors[~icon]);
  2223 		SetAnimatedMouseCursor(_animcursors[~icon]);
  2224 	else
  2224 	else
  2225 		SetMouseCursor(icon);
  2225 		SetMouseCursor(icon);
  2226 }
  2226 }
  2227 
  2227 
  2228 void ResetObjectToPlace(){
  2228 void ResetObjectToPlace(void)
       
  2229 {
  2229 	SetObjectToPlace(0,0,0,0);
  2230 	SetObjectToPlace(0,0,0,0);
  2230 }
  2231 }