I think I figured it out.
This little handy dandy bitmap is a lifesaver. I remembered this approach from an article about Civ 1.
Basically this bitmap tells me how I must increment/decrement the row/column to get what cell the player is pointing at.
Blue=(row,col-1)
Red=(row-1,col)
Yellow=(row+1,col)
Green=(row,col+1)
White=(row,col)
The offset into the image is:
Code:
int v=(iCursorX-iTileX)/iTileWidth;
int u=(iCursorY-iTileY)/iTileHeight
if (mask(u,v))==BLUE) col--;
if (mask(u,v))==RED) row--;
if (mask(u,v))==YELLOW) row++;
if (mask(u,v))==GREEN) col++;
With a 2D flat map I was snapping the grid to the upper left corner of the grid, but width and height were the same. Here I'm snapping the grid to the upper left corner, but height is halved and width is doubled.
By accessing texels in this texture I can alter those calculations to fit the grid on screen.