Hmm, the more I think about this, the more I think that the entire interaction with objects needs to be simplified. Let the player target something, and then figure out what they want to do depending on what's under the target. In Timekeepers case, everything would basically be done by a more generic, "use" button, rather than having specialised target and aim functions.
I think that's probably the approach I'm going to start taking, too.
void draw_mousepointer()
{
int pointercolour = RGB( 0, 128, 32 );
int ent_no = 0;
string ent_description = "";
while (ent_no < entities)
{
if ( ((mouse.x + xwin) / 32) == ((entity.x[ent_no]) / 32) )
if ( (mouse.y + ywin / 32 ) == ((entity.y[ent_no]) / 32)) // mouse over an entity?
{
pointercolour = RGB( 128, 0, 32 ); // make the pointer turn red
ent_description = entity.description[ent_no]; // and load ent_description with the entity's description
}
ent_no++;
}
SetLucent(50);
rectfill(mouse.x-2, mouse.y-2, mouse.x+2, mouse.y+2, pointercolour, screen);
setlucent(0);
if ( asc(ent_description) != 0 ) { bannerbox( mouse.x+6, mouse.y+6, font_builtin, RGB( 0, 128, 32 ), ent_description,); }
// End of Function
}
void bannerbox( int x, int y, int font_name, int box_colour, string banner_text)
{
rectfill(x - 2, y - 2, x + textwidth( font_name, banner_text) +1 , y + FontHeight(font_name)+1, box_colour, screen);
printstring( x, y, screen, font_name, banner_text );
// End of Function
}
Sticking that in the map retrace function should give you a mouse pointer that'll print the description of any entity nearby.