Okay this is a simple work in progress. The progress has come to a halt because I cant figure out how to get the tilemap to scroll smoothly. Here is the relevant code. With the scroll plus the x and y its no longer smooth scrolling and when I use just the scroll it works but it no longer looks up my tiles. im not sure whats wrong exactly but help would be good. Thanks for looking. Oh yeah the tile lookup function is wrong I havent really worked it out yet i borrowed it from a post thats in progress.

Code:
void DrawTileMap(ID3DXSprite &mapsprite,int tiledimx,int tiledimy,RECT &rect,CGRAPHICS *anobject)
{
	int numtilesx=20,numtilesy=15;


	//are tiles power of 2
	if(tiledimx/2!=0&&tiledimy/2!=0)
	{
		//Print tiles must be power of 2
	}

	//Load Level file using FILE I/O store in structure

	//Draw Screen
	for(int y=0;y<numtilesy+1;y++)
	{
		for(int x=0;x<numtilesx+1;x++)
		{
			//mapspritedraw();

			int scrollx=worldx/tiledimx;
			int scrolly=worldy/tiledimy;

			offsety=scrolly & (tiledimy-1);
			offsetx=scrollx & (tiledimx-1);

			tilecoord.x=(x*tiledimx)-offsetx;
			tilecoord.y=(y*tiledimy)-offsety;

                 //Problem maybe at this line????
			TileLookUp(97,32,32,map[scrollx+x][scrolly+y],rect);

			mapsprite.Draw(anobject->pTexture,&rect,NULL, NULL, 0.0f,&tilecoord,0xffffffff);
		}
	}
}

void TileLookUp(int imagewidth,int dimx,int dimy,int numtile,RECT &rect)
{	
	int numtilesx=imagewidth/dimx;
	int x=0;


	rect.top=(numtile%numtilesx)*dimx;
	rect.bottom=(numtile%numtilesx)+1*dimx;
	rect.left=(numtile-x/dimx)/numtilesx*dimy;
	rect.right=((numtile-x/dimx)/numtilesx)+1*dimy;
}