rendered paste bodybool mapengine::pollmiso(BITMAP *bp) {
int xloop, yloop, tmx, tmy, ddxt, ddyt;
int pc, pr, pg, pb;
BITMAP *coor, *tile;
tmx = mouse_x;
tmy = mouse_y;
coor = create_bitmap_ex(32, 32, 16);
tile = load_bitmap("C:\\Documents and Settings\\ddark\\My Documents\\isometrik\\gfx\\tile.bmp", NULL);
blit(tile, coor, 0, 8, 0, 0, 32, 16);
for(xloop = 0;xloop <= mx;xloop++) { // find out x rectangular coordinate
if(xloop * 32 > tmx) {
xloop; xloop--; dx = ddx = xloop; xloop = mx;
}
}
for(yloop = 0;yloop <= my;yloop++) { // find our y rectangular coordinate
if(yloop * 16 > tmy) {
yloop; yloop--; dy = ddy = yloop; yloop = my;
}
}
dy += dy; // we have to hack it into what our rectangular coordinates are
// this is so below we can go into one of its corners.
floodfill(coor, 5, 0, makecol(255,0,0)); // flood our different regions in and out of the diamond
floodfill(coor, 20, 1, makecol(255,255,0));
floodfill(coor, 20, 15, makecol(255,0,255));
floodfill(coor, 1, 12, makecol(0,0,255));
floodfill(coor, 15, 8, makecol(255,255,255));
ddxt = ddx * 32 - tmx; // find out coordinates in the mousemap
ddyt = ddy * 16 - tmy;
ddxt = abs(ddxt); // this is just to keep things safe...
ddyt = abs(ddyt); // this as well...
pc = getpixel(coor, ddxt, ddyt); // figure out what color pixel it is (region)
pr = getr(pc);
pg = getg(pc);
pb = getb(pc);
// figure out which region mouse pointer is in and figure out isometric coordinates based on this
if(pr == 255 && pg == 0 && pb == 0) { // top left
floodfill(coor, 5, 0, makecol(50,50,50));
} else if(pr == 255 && pg == 255 && pb == 0) { // top right
floodfill(coor, 20, 1, makecol(50,50,50));
} else if(pr == 255 && pg == 0 && pb == 255) { // bottom right
floodfill(coor, 20, 15, makecol(50,50,50));
} else if(pr == 0 && pg == 0 && pb == 255) { // bottom left
floodfill(coor, 1, 12, makecol(50,50,50));
} else if(pr == 255 && pg == 255 && pb == 255) { // center
floodfill(coor, 15, 8, makecol(50,50,50));
} else { // we should be on the black outline here... so lets just keep it center.
floodfill(coor, 15, 8, makecol(50,50,50));
}
blit(coor, bp, 0, 0, ddx * 32, ddy * 16, 32, 16);
map[oldx][oldy].hover = 0;
map[dx][dy].hover = 1;
oldx = dx;
oldy = dy;
}