I thought the ingame minimap had too small blips (the small dots that show where you are) on my 1280x800 screen, and I thought I could fix it very easily.
After some diving in the source, I realized there are some bugs in the blip drawing in both 2.6.9 and 2.6.8.
In 2.6.8, for some reason, a 18x3 bitmap (as the blip.bmp is in 2.6. is cut down to a 4x4 square bitmap (the lowest power of 2 which is higher to one of the two dimensions). I don't know why, I think it is feasible to use a 18x3 texture but I didn't want to mess with SDL and left it like that.
In 2.6.9 blip.bmp it's handled differently but still "doubtful" (magic numbers here and there, constants set to the wrong value...?)
Also, if you look very close, you'll notice that some blips are made up from two colors.
Enough said, that's what I did and what I got:
- in 2.6.8, modify the blip.bmp so that it becomes 18x18
- in egoboo.h, change
#define BLIPSIZE 2
to
#define BLIPSIZE 3 or 6 in 2.6.9
(I don't know why it should be 2: blips are 3x3 or 6x6 squares in the bmp!)
- in graphic.c, add the following after draw_blip
void draw_blip( Uint8 color, int x, int y ) {
draw_big_blip( 1.0f, color, x, y );
}
or in 2.6.9 maybe 0.5f is better since blips are bigger in the bmp ... your choice.
then change this
void draw_blip( Uint8 color, int x, int y )
to this
void draw_big_blip( float sizeFactor, Uint8 color, int x, int y )
also change these
xl = ( ( float )bliprect[color].left ) / 32;
xr = ( ( float )bliprect[color].right ) / 32;
yt = ( ( float )bliprect[color].top ) / 4;
yb = ( ( float )bliprect[color].bottom ) / 4;
to these (magic numbers are bad!)
xl = ( ( float )bliprect[color].left ) / (float)TxBlip.txDimensions;
xr = ( ( float )bliprect[color].right ) / (float)TxBlip.txDimensions;
yt = ( ( float )bliprect[color].top ) / (float)TxBlip.txDimensions;
yb = ( ( float )bliprect[color].bottom ) / (float)TxBlip.txDimensions
or, in 2.6.9, to these
xl = ( ( float )bliprect[color].left ) / (float)TxBlip.txW;
xr = ( ( float )bliprect[color].right ) / (float)TxBlip.txW;
yt = ( ( float )bliprect[color].top ) / (float)TxBlip.txH;
yb = ( ( float )bliprect[color].bottom ) / (float)TxBlip.txH;
the following code adds the possibility to change the blip size:
add this
width *= sizeFactor; height *= sizeFactor;
just before glBegin( GL_QUADS );
then change the last lines to these (this will center the blip on the target)
glTexCoord2f( xl, yb ); glVertex2i( x - 1 - (width/2), scry - y - 1 - (height/2) );
glTexCoord2f( xr, yb ); glVertex2i( x - 1 + (width/2), scry - y - 1 - (height/2) );
glTexCoord2f( xr, yt ); glVertex2i( x - 1 + (width/2), scry - y - 1 + (height/2) );
glTexCoord2f( xl, yt ); glVertex2i( x - 1 - (width/2), scry - y - 1 + (height/2) );
around line 4118 change this
draw_blip( 0, chrxpos[tnc]*MAPSIZE / meshedgex, ( chrypos[tnc]*MAPSIZE / meshedgey ) + scry - MAPSIZE );
to this
draw_big_blip( 2.0f, 0, chrxpos[tnc]*MAPSIZE / meshedgex, ( chrypos[tnc]*MAPSIZE / meshedgey ) + scry - MAPSIZE );
this will cause the player's position to be displayed with a bigger blip (maybe 1.0f is a better choice than 2.0f in 2.6.9)
Before and after (i suggest ctrl-mouse wheel to zoom...):
(edit - this screenshot sucks, the first one is 2.6.9 with default settings and shows 2x1 blips, the second is 2.6.8 with 2x2 blips - should be 3x3, i think i introduced a rounding bug, when I width/2 height/2 ... - and a 6x6 player blip)
As a side note: there are strange shades in the blips (like the purple shade on the right of the white blip in certain cases) because of texture filtering. Also the map image gets filtered and becomes a little less sharp. This should be easy to fix though.
p.s. sorry for the mess, i wrote it once, then noticed things had changed in the svn version, checked/fixed it again and rewritten this post
minimap blips
Moderator: Developers
- Ben Urban
- Cobol (Esteemed member)
- Posts: 829
- Joined: Sat Oct 04, 2008 10:49 pm
- Location: Maryland, USA
- Contact:
That only works on Mac OS X 10.4 and later.SimoneB wrote:Before and after (i suggest ctrl-mouse wheel to zoom...):
Thanks to penguinflyer2222 for the avatar, and to penguinflyer5234 for hosting it.
Er, no, I was refering to the browser. Too see the tiny differences between screenshots, you may zoom in the web page. In all versions of Firefox and Opera (as far as i know) ctrl-mousewheel zooms in and out.
Zooming the ingame map may be nice, but perhaps a little overkill. Two sizes (a small map, with size depending on resolution, and a full screen big map) may be more than enough, imho. But maybe also enlarge a little the minimap would be enough ... we're talking about a 64x64 bitmap in the end!
Zooming the ingame map may be nice, but perhaps a little overkill. Two sizes (a small map, with size depending on resolution, and a full screen big map) may be more than enough, imho. But maybe also enlarge a little the minimap would be enough ... we're talking about a 64x64 bitmap in the end!
Re: minimap blips
I tried this and not much convinced of it anymore. I think the map looks better with filters on. However blips still have shades if they get bigger (which may or may not be an issue... will we have blips like big skulls and bones? giant character-eating monsters?)SimoneB wrote:As a side note: there are strange shades in the blips (like the purple shade on the right of the white blip in certain cases) because of texture filtering. Also the map image gets filtered and becomes a little less sharp. This should be easy to fix though.
filtered and unfiltered
Last edited by SimoneB on Sat Jan 03, 2009 10:23 pm, edited 1 time in total.