void gamefont_choose_game_font(int scrx,int scry){ int close=-1,m=-1; if (!Gamefont_installed) return; for (int gf=0;gf<MAX_FONTS;gf++){ for (int i=0;i<font_conf[gf].num;i++) if ((scrx>=font_conf[gf].font[i].x && close<font_conf[gf].font[i].x)&&(scry>=font_conf[gf].font[i].y && close<font_conf[gf].font[i].y)){ close=font_conf[gf].font[i].x; m=i; } if (m<0) Error("no gamefont found for %ix%i\n",scrx,scry); #if DXX_USE_OGL if (!CGameArg.OglFixedFont) { // if there's no texture filtering, scale by int auto &f = font_conf[gf].font[m]; if (!CGameCfg.TexFilt) { FNTScaleX = scrx / f.x; FNTScaleY = scry / f.y; } else { FNTScaleX = static_cast<float>(scrx) / f.x; FNTScaleY = static_cast<float>(scry) / f.y; } // keep proportions #if defined(DXX_BUILD_DESCENT_I) #define DXX_FONT_SCALE_MULTIPLIER 1 #elif defined(DXX_BUILD_DESCENT_II) #define DXX_FONT_SCALE_MULTIPLIER 100 #endif if (FNTScaleY*DXX_FONT_SCALE_MULTIPLIER < FNTScaleX*DXX_FONT_SCALE_MULTIPLIER) FNTScaleX = FNTScaleY; else if (FNTScaleX*DXX_FONT_SCALE_MULTIPLIER < FNTScaleY*DXX_FONT_SCALE_MULTIPLIER) FNTScaleY = FNTScaleX; } #endif gamefont_loadfont(gf,m); } }
void addfontconf(int gf, int x,char * fn){ int i; mprintf((0,"adding font %s at %i %i: ",fn,gf,x)); for (i=0;i<font_conf[gf].num;i++){ if (font_conf[gf].font[i].x==x){ mprintf((0,"replaced %i\n",i)); if (i==font_conf[gf].cur) gamefont_unloadfont(gf); strcpy(font_conf[gf].font[i].f.name,fn); if (i==font_conf[gf].cur) gamefont_loadfont(gf,i); return; } } mprintf((0,"added %i\n",font_conf[gf].num)); font_conf[gf].font[font_conf[gf].num].x=x; strcpy(font_conf[gf].font[font_conf[gf].num].f.name,fn); font_conf[gf].num++; }
void gamefont_choose_game_font(int scrx,int scry){ int gf,i,close=-1,m=-1; mprintf ((0,"gamefont_choose_game_font(%i,%i) %i\n",scrx,scry,Gamefont_installed)); if (!Gamefont_installed) return; for (gf=0;gf<MAX_FONTS;gf++){ for (i=0;i<font_conf[gf].num;i++) if (scrx>=font_conf[gf].font[i].x && close<font_conf[gf].font[i].x){ close=font_conf[gf].font[i].x; m=i; } if (m<0) Error("no gamefont found for %ix%i\n",scrx,scry); gamefont_loadfont(gf,m); } for (i=0; i<MAX_FONTS; i++ ) mprintf ((0,"font %i: %ix%i\n",i,Gamefonts[i]->ft_w,Gamefonts[i]->ft_h)); }
static void addfontconf(int gf, int x, int y, const char *const fn) { if (!PHYSFSX_exists(fn,1)) return; for (int i=0;i<font_conf[gf].num;i++){ if (font_conf[gf].font[i].x==x && font_conf[gf].font[i].y==y){ if (i==font_conf[gf].cur) gamefont_unloadfont(gf); strcpy(font_conf[gf].font[i].f.name,fn); if (i==font_conf[gf].cur) gamefont_loadfont(gf,i); return; } } font_conf[gf].font[font_conf[gf].num].x=x; font_conf[gf].font[font_conf[gf].num].y=y; strcpy(font_conf[gf].font[font_conf[gf].num].f.name,fn); font_conf[gf].num++; }
void addfontconf(int gf, int x, int y, char * fn){ int i; if (!cfexist(fn)) return; for (i=0;i<font_conf[gf].num;i++){ if (font_conf[gf].font[i].x==x && font_conf[gf].font[i].y==y){ if (i==font_conf[gf].cur) gamefont_unloadfont(gf); strcpy(font_conf[gf].font[i].f.name,fn); if (i==font_conf[gf].cur) gamefont_loadfont(gf,i); return; } } font_conf[gf].font[font_conf[gf].num].x=x; font_conf[gf].font[font_conf[gf].num].y=y; strcpy(font_conf[gf].font[font_conf[gf].num].f.name,fn); font_conf[gf].num++; }
void gamefont_choose_game_font(int scrx,int scry){ int gf,i,close=-1,m=-1; if (!Gamefont_installed) return; for (gf=0;gf<MAX_FONTS;gf++){ for (i=0;i<font_conf[gf].num;i++) if ((scrx>=font_conf[gf].font[i].x && close<font_conf[gf].font[i].x)&&(scry>=font_conf[gf].font[i].y && close<font_conf[gf].font[i].y)){ close=font_conf[gf].font[i].x; m=i; } if (m<0) Error("no gamefont found for %ix%i\n",scrx,scry); #ifdef OGL if (!GameArg.OglFixedFont) { // if there's no texture filtering, scale by int if (!GameCfg.TexFilt) { FNTScaleX = (int)scrx/font_conf[gf].font[m].x; FNTScaleY = (int)scry/font_conf[gf].font[m].y; } else { FNTScaleX = (float)scrx/font_conf[gf].font[m].x; FNTScaleY = (float)scry/font_conf[gf].font[m].y; } // keep proportions if (FNTScaleY*100 < FNTScaleX*100) FNTScaleX = FNTScaleY; else if (FNTScaleX*100 < FNTScaleY*100) FNTScaleY = FNTScaleX; } #endif gamefont_loadfont(gf,m); } }