OSD scaling fixes (mostly)

git-svn-id: https://svn.eduke32.com/eduke32@4435 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-04-13 03:19:50 +00:00
parent 2293aa5f59
commit 04c466f1f2
3 changed files with 7 additions and 6 deletions

View file

@ -736,7 +736,7 @@ static int32_t osdcmd_cvar_set_osd(const osdfuncparm_t *parm)
if (!Bstrcasecmp(parm->name, "osdrows")) if (!Bstrcasecmp(parm->name, "osdrows"))
{ {
if (osdrows > osdmaxrows) osdrows = osdmaxrows; if (osdrows > osdmaxrows) osdrows = osdmaxrows;
if (osdrowscur!=-1)osdrowscur = osdrows; if (osdrowscur!=-1) osdrowscur = osdrows;
return r; return r;
} }
else if (!Bstrcasecmp(parm->name, "osdtextmode")) else if (!Bstrcasecmp(parm->name, "osdtextmode"))
@ -784,7 +784,7 @@ void OSD_Init(void)
{ "osdeditshade","sets the shade of the OSD input text",(void *) &osdeditshade, CVAR_INT, 0, 7 }, { "osdeditshade","sets the shade of the OSD input text",(void *) &osdeditshade, CVAR_INT, 0, 7 },
{ "osdtextshade","sets the shade of the OSD text",(void *) &osdtextshade, CVAR_INT, 0, 7 }, { "osdtextshade","sets the shade of the OSD text",(void *) &osdtextshade, CVAR_INT, 0, 7 },
{ "osdpromptshade","sets the shade of the OSD prompt",(void *) &osdpromptshade, CVAR_INT, INT8_MIN, INT8_MAX }, { "osdpromptshade","sets the shade of the OSD prompt",(void *) &osdpromptshade, CVAR_INT, INT8_MIN, INT8_MAX },
{ "osdrows","sets the number of visible lines of the OSD",(void *) &osdrows, CVAR_INT|CVAR_FUNCPTR, 0, MAXPALOOKUPS-1 }, { "osdrows","sets the number of visible lines of the OSD",(void *) &osdrows, CVAR_INT|CVAR_FUNCPTR, 1, MAXPALOOKUPS-1 },
{ "osdtextmode","set OSD text mode (0:graphical, 1:fast)",(void *) &osdtextmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 }, { "osdtextmode","set OSD text mode (0:graphical, 1:fast)",(void *) &osdtextmode, CVAR_BOOL|CVAR_FUNCPTR, 0, 1 },
{ "logcutoff","sets the maximal line count of the log file",(void *) &logcutoff, CVAR_INT, 0, 262144 }, { "logcutoff","sets the maximal line count of the log file",(void *) &logcutoff, CVAR_INT, 0, 262144 },
}; };

View file

@ -1379,7 +1379,7 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
} }
else if (!Bstrcasecmp(parm->name, "r_maxfps")) else if (!Bstrcasecmp(parm->name, "r_maxfps"))
{ {
if (r_maxfps) g_frameDelay = (int32_t)nearbyintf(1000.f/(float)r_maxfps); if (r_maxfps) g_frameDelay = (int32_t)lround(1000.f/(float)r_maxfps);
else g_frameDelay = 0; else g_frameDelay = 0;
return r; return r;

View file

@ -35,7 +35,8 @@ double osdscale = 2.0f;
double osdscale = 1.0f; double osdscale = 1.0f;
#endif #endif
#define OSD_SCALE(x) (int32_t)(osdscale != 1.f ? nearbyintf(osdscale*(double)(x)) : x) #define OSD_SCALE(x) (int32_t)(osdscale != 1.f ? lround(osdscale*(double)(x)) : x)
#define OSD_SCALEDIV(x) (int32_t)lround((x)/osdscale)
static int32_t GAME_isspace(int32_t ch) static int32_t GAME_isspace(int32_t ch)
{ {
@ -114,12 +115,12 @@ void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress
int32_t GAME_getcolumnwidth(int32_t w) int32_t GAME_getcolumnwidth(int32_t w)
{ {
return nearbyintf((w/9)/osdscale); return OSD_SCALEDIV(w/9);
} }
int32_t GAME_getrowheight(int32_t h) int32_t GAME_getrowheight(int32_t h)
{ {
return OSD_SCALE(h>>3); return OSD_SCALEDIV(h>>3);
} }
void GAME_onshowosd(int32_t shown) void GAME_onshowosd(int32_t shown)