mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
Simplify HUD scale and viewport size logic and clean up related code.
* Make the "classic status bar fullscreen viewport" mode accessible in classic too. * Make range of status bar scale 36..100 * Update ud.statusbarmode when executing OSD command r_size (ud.screen_size). NOTE: ud.statusbarmode is considered internal. Don't use from CON! * Make sure 1) loading any configuration and 2) menu bars work correctly. (The "classic status bar fullscreen viewport" mode will never be restored though because ud.statusbarmode isn't handled by the OSD var system). git-svn-id: https://svn.eduke32.com/eduke32@3402 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
a147dbcfe3
commit
753278cd12
7 changed files with 80 additions and 96 deletions
|
@ -230,7 +230,7 @@ void CONFIG_SetDefaults(void)
|
|||
ud.screen_size = 4;
|
||||
ud.screen_tilting = 1;
|
||||
ud.shadows = 1;
|
||||
ud.statusbarmode = 0;
|
||||
ud.statusbarmode = 1;
|
||||
ud.statusbarscale = 100;
|
||||
ud.team = 0;
|
||||
ud.viewbob = 1;
|
||||
|
|
|
@ -1939,7 +1939,6 @@ void G_FadePalette(int32_t r,int32_t g,int32_t b,int32_t e)
|
|||
{
|
||||
setpalettefade(r,g,b,e&63);
|
||||
|
||||
// if (getrendermode() >= REND_POLYMOST) pus = pub = NUMPAGES; // JBF 20040110: redraw the status bar next time
|
||||
if ((e&128) == 0)
|
||||
{
|
||||
int32_t tc;
|
||||
|
@ -2604,7 +2603,7 @@ static void G_FadePalaccum(const palaccum_t *pa)
|
|||
|
||||
void G_DisplayRest(int32_t smoothratio)
|
||||
{
|
||||
int32_t a, i, j;
|
||||
int32_t i, j;
|
||||
palaccum_t tint = PALACCUM_INITIALIZER;
|
||||
|
||||
DukePlayer_t *const pp = g_player[screenpeek].ps;
|
||||
|
@ -2783,8 +2782,7 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
if (ud.overhead_on == 2)
|
||||
{
|
||||
if (ud.screen_size > 0) a = 147;
|
||||
else a = 179;
|
||||
const int32_t a = (ud.screen_size > 0) ? 147 : 179;
|
||||
minitext(5,a+6,EpisodeNames[ud.volume_number],0,2+8+16+256);
|
||||
minitext(5,a+6+6,MapInfo[ud.volume_number*MAXLEVELS + ud.level_number].name,0,2+8+16+256);
|
||||
}
|
||||
|
@ -2870,7 +2868,8 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
|
||||
if (g_player[myconnectindex].ps->newowner == -1 && ud.overhead_on == 0 && ud.crosshair && ud.camerasprite == -1)
|
||||
{
|
||||
a = VM_OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, -1, 0);
|
||||
int32_t a = VM_OnEvent(EVENT_DISPLAYCROSSHAIR, g_player[screenpeek].ps->i, screenpeek, -1, 0);
|
||||
|
||||
if (a == 0 || a > 1)
|
||||
{
|
||||
int32_t x, y;
|
||||
|
@ -2939,20 +2938,12 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
const DukePlayer_t *myps = g_player[myconnectindex].ps;
|
||||
|
||||
if (ud.screen_size == 4)
|
||||
{
|
||||
i = sbarsc(ud.althud?tilesizy[BIGALPHANUM]+10:tilesizy[INVENTORYBOX]+2);
|
||||
// j = sbarsc(scale(6,ud.config.ScreenWidth,320));
|
||||
}
|
||||
else if (ud.screen_size > 2)
|
||||
{
|
||||
i = sbarsc(tilesizy[BOTTOMSTATUSBAR]+1);
|
||||
// j = scale(2,ud.config.ScreenWidth,320);
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 2;
|
||||
// j = scale(2,ud.config.ScreenWidth,320);
|
||||
}
|
||||
|
||||
j = scale(2,ud.config.ScreenWidth,320);
|
||||
|
||||
|
||||
|
@ -2978,12 +2969,14 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
myps->max_actors_killed>myps->actors_killed?
|
||||
myps->max_actors_killed:myps->actors_killed);
|
||||
}
|
||||
|
||||
G_PrintGameText(8+4+1,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(14),
|
||||
tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536);
|
||||
|
||||
if (myps->secret_rooms == myps->max_secret_rooms)
|
||||
Bsprintf(tempbuf,"S:%d/%d", myps->secret_rooms, myps->max_secret_rooms);
|
||||
else Bsprintf(tempbuf,"S:^15%d/%d", myps->secret_rooms, myps->max_secret_rooms);
|
||||
|
||||
G_PrintGameText(8+4+1,STARTALPHANUM, j,scale(200-i,ud.config.ScreenHeight,200)-textsc(7),
|
||||
tempbuf,0,10,26,0, 0, xdim-1, ydim-1, 65536);
|
||||
}
|
||||
|
@ -3099,13 +3092,11 @@ static void G_DoThirdPerson(const DukePlayer_t *pp, vec3_t *vect, int16_t *vsect
|
|||
//REPLACE FULLY
|
||||
void G_DrawBackground(void)
|
||||
{
|
||||
int32_t dapicnum;
|
||||
const int32_t dapicnum = BIGHOLE;
|
||||
int32_t x,y,x1,y1,x2,y2,rx;
|
||||
|
||||
flushperms();
|
||||
|
||||
dapicnum = BIGHOLE;
|
||||
|
||||
if (tilesizx[dapicnum] == 0 || tilesizy[dapicnum] == 0)
|
||||
{
|
||||
pus = pub = NUMPAGES;
|
||||
|
@ -7518,6 +7509,15 @@ FOUNDCHEAT:
|
|||
}
|
||||
}
|
||||
|
||||
void G_SetViewportShrink(int32_t dir)
|
||||
{
|
||||
if (ud.screen_size == 8 && dir!=0 && (dir>0)==(int32_t)ud.statusbarmode)
|
||||
ud.statusbarmode = !ud.statusbarmode;
|
||||
else
|
||||
ud.screen_size += dir;
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
void G_HandleLocalKeys(void)
|
||||
{
|
||||
int32_t i,ch;
|
||||
|
@ -7551,16 +7551,9 @@ void G_HandleLocalKeys(void)
|
|||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
if (ud.screen_size > 0)
|
||||
S_PlaySound(THUD);
|
||||
|
||||
if (getrendermode() >= REND_POLYMOST && ud.screen_size == 8 && ud.statusbarmode == 0)
|
||||
ud.statusbarmode = 1;
|
||||
else ud.screen_size -= 4;
|
||||
|
||||
if (ud.statusbarscale == 100 && ud.statusbarmode == 1)
|
||||
{
|
||||
ud.statusbarmode = 0;
|
||||
ud.screen_size -= 4;
|
||||
S_PlaySound(THUD);
|
||||
G_SetViewportShrink(-4);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -7578,15 +7571,14 @@ void G_HandleLocalKeys(void)
|
|||
if (!SHIFTS_IS_PRESSED)
|
||||
{
|
||||
if (ud.screen_size < 64)
|
||||
{
|
||||
S_PlaySound(THUD);
|
||||
|
||||
if (getrendermode() >= REND_POLYMOST && ud.screen_size == 8 && ud.statusbarmode == 1)
|
||||
ud.statusbarmode = 0;
|
||||
else ud.screen_size += 4;
|
||||
G_SetViewportShrink(+4);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G_SetStatusBarScale(max(ud.statusbarscale-4, 37));
|
||||
G_SetStatusBarScale(ud.statusbarscale-4);
|
||||
}
|
||||
|
||||
G_UpdateScreenArea();
|
||||
|
@ -10814,11 +10806,6 @@ MAIN_LOOP_RESTART:
|
|||
if (framewaiting)
|
||||
{
|
||||
framewaiting--;
|
||||
if (ud.statusbarmode == 1 && (ud.statusbarscale == 100 || getrendermode() == REND_CLASSIC))
|
||||
{
|
||||
ud.statusbarmode = 0;
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
nextpage();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
EXTERN_INLINE void G_SetStatusBarScale(int32_t sc)
|
||||
{
|
||||
ud.statusbarscale = min(100,max(10,sc));
|
||||
ud.statusbarscale = clamp(sc, 36, 100);
|
||||
G_UpdateScreenArea();
|
||||
}
|
||||
|
||||
|
|
|
@ -2979,44 +2979,29 @@ cheat_for_port_credits2:
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
int32_t sbs = ud.crosshairscale;
|
||||
sliderbar(1,d+8,yy+7, &sbs,5,x==io,MENUHIGHLIGHT(io),0,25,100);
|
||||
ud.crosshairscale = min(100,max(10,sbs));
|
||||
int32_t chs = ud.crosshairscale;
|
||||
sliderbar(1,d+8,yy+7, &chs,5,x==io,MENUHIGHLIGHT(io),0,25,100);
|
||||
ud.crosshairscale = clamp(chs, 10, 100);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
const int32_t ossize = ud.screen_size;
|
||||
int32_t vpsize = ud.screen_size + 4*(ud.screen_size>=8 && ud.statusbarmode==0);
|
||||
const int32_t ovpsize = vpsize;
|
||||
|
||||
barsm(d+8,yy+7, &ud.screen_size,-4,x==io,MENUHIGHLIGHT(io),0);
|
||||
sliderbar(1,d+8,yy+7, &vpsize,-4,x==io,MENUHIGHLIGHT(io),0,0,68);
|
||||
|
||||
// ud.screen_size 8 is the largest classic HUD
|
||||
if (getrendermode() >= REND_POLYMOST && ossize == 8)
|
||||
{
|
||||
if (ud.screen_size > ossize && ud.statusbarmode == 1)
|
||||
{
|
||||
ud.statusbarmode = 0;
|
||||
if (ud.statusbarscale != 100)
|
||||
ud.screen_size = ossize;
|
||||
}
|
||||
else if (ud.screen_size < ossize && ud.statusbarmode == 0)
|
||||
{
|
||||
if (ud.statusbarscale != 100)
|
||||
{
|
||||
ud.statusbarmode = 1;
|
||||
ud.screen_size = ossize;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (vpsize-ovpsize)
|
||||
G_SetViewportShrink(vpsize-ovpsize);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
int32_t sbs, sbsl;
|
||||
sbs = sbsl = ud.statusbarscale-37;
|
||||
barsm(d+8,yy+7, &sbs,4,x==io,MENUHIGHLIGHT(io),0);
|
||||
if (x == io && sbs != sbsl)
|
||||
G_SetStatusBarScale(sbs+37);
|
||||
int32_t sbs = ud.statusbarscale;
|
||||
const int32_t osbs = sbs;
|
||||
sliderbar(1,d+8,yy+7, &sbs,4,x==io,MENUHIGHLIGHT(io),0,36,100);
|
||||
if (x == io && sbs != osbs)
|
||||
G_SetStatusBarScale(sbs);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
|
|
|
@ -1326,7 +1326,14 @@ static int32_t osdcmd_cvar_set_game(const osdfuncparm_t *parm)
|
|||
|
||||
if (r != OSDCMD_OK) return r;
|
||||
|
||||
if (!Bstrcasecmp(parm->name, "r_maxfps"))
|
||||
if (!Bstrcasecmp(parm->name, "r_size"))
|
||||
{
|
||||
ud.statusbarmode = (ud.screen_size < 8);
|
||||
G_UpdateScreenArea();
|
||||
|
||||
return r;
|
||||
}
|
||||
else if (!Bstrcasecmp(parm->name, "r_maxfps"))
|
||||
{
|
||||
if (r_maxfps) g_frameDelay = (1000/r_maxfps);
|
||||
else g_frameDelay = 0;
|
||||
|
@ -1456,7 +1463,7 @@ int32_t registerosdcommands(void)
|
|||
{ "hud_shadows", "hud_shadows: enable/disable althud shadows", (void *)&althud_shadows, CVAR_BOOL, 0, 1 },
|
||||
{ "hud_flashing", "hud_flashing: enable/disable althud flashing", (void *)&althud_flashing, CVAR_BOOL, 0, 1 },
|
||||
{ "hud_glowingquotes", "hud_glowingquotes: enable/disable \"glowing\" quote text", (void *)&hud_glowingquotes, CVAR_BOOL, 0, 1 },
|
||||
{ "hud_scale","hud_scale: changes the hud scale", (void *)&ud.statusbarscale, CVAR_INT|CVAR_FUNCPTR, 10, 100 },
|
||||
{ "hud_scale","hud_scale: changes the hud scale", (void *)&ud.statusbarscale, CVAR_INT|CVAR_FUNCPTR, 36, 100 },
|
||||
{ "hud_showmapname", "hud_showmapname: enable/disable map name display on load", (void *)&hud_showmapname, CVAR_BOOL, 0, 1 },
|
||||
{ "hud_stats", "hud_stats: enable/disable level statistics display", (void *)&ud.levelstats, CVAR_BOOL, 0, 1 },
|
||||
{ "hud_textscale", "hud_textscale: sets multiplayer chat message size", (void *)&ud.textscale, CVAR_INT, 100, 400 },
|
||||
|
@ -1483,7 +1490,7 @@ int32_t registerosdcommands(void)
|
|||
{ "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void *)&ud.drawweapon, CVAR_INT, 0, 2 },
|
||||
{ "r_showfps", "r_showfps: show the frame rate counter", (void *)&ud.tickrate, CVAR_BOOL, 0, 1 },
|
||||
{ "r_shadows", "r_shadows: enable/disable sprite and model shadows", (void *)&ud.shadows, CVAR_BOOL, 0, 1 },
|
||||
{ "r_size", "r_size: change size of viewable area", (void *)&ud.screen_size, CVAR_INT, 0, 64 },
|
||||
{ "r_size", "r_size: change size of viewable area", (void *)&ud.screen_size, CVAR_INT|CVAR_FUNCPTR, 0, 64 },
|
||||
{ "r_precache", "r_precache: enable/disable the pre-level caching routine", (void *)&ud.config.useprecache, CVAR_BOOL, 0, 1 },
|
||||
|
||||
{ "r_ambientlight", "r_ambientlight: sets the global map light level",(void *)&r_ambientlight, CVAR_FLOAT|CVAR_FUNCPTR, 0, 10 },
|
||||
|
|
|
@ -576,40 +576,44 @@ void G_SetupCamTile(int32_t i,int32_t wn)
|
|||
|
||||
void G_UpdateScreenArea(void)
|
||||
{
|
||||
int32_t i, j, ss, x1, x2, y1, y2;
|
||||
|
||||
if (qsetmode != 200) return;
|
||||
if (qsetmode != 200)
|
||||
return;
|
||||
|
||||
ud.screen_size = clamp(ud.screen_size, 0, 64);
|
||||
if (ud.screen_size == 0) flushperms();
|
||||
if (ud.screen_size == 0)
|
||||
flushperms();
|
||||
|
||||
ss = max(ud.screen_size-8,0);
|
||||
|
||||
x1 = scale(ss,xdim,160);
|
||||
x2 = xdim-x1;
|
||||
|
||||
y1 = ss;
|
||||
y2 = 200;
|
||||
if (ud.screen_size > 0 && (GametypeFlags[ud.coop]&GAMETYPE_FRAGBAR) && (g_netServer || ud.multimode > 1))
|
||||
{
|
||||
j = 0;
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
if (i > j) j = i;
|
||||
const int32_t ss = max(ud.screen_size-8,0);
|
||||
|
||||
if (j >= 1) y1 += 8;
|
||||
if (j >= 4) y1 += 8;
|
||||
if (j >= 8) y1 += 8;
|
||||
if (j >= 12) y1 += 8;
|
||||
const int32_t x1 = scale(ss,xdim,160);
|
||||
const int32_t x2 = xdim-x1;
|
||||
|
||||
int32_t y1 = ss;
|
||||
int32_t y2 = 200;
|
||||
|
||||
if (ud.screen_size > 0 && (GametypeFlags[ud.coop]&GAMETYPE_FRAGBAR) && (g_netServer || ud.multimode > 1))
|
||||
{
|
||||
int32_t i, j = 0;
|
||||
|
||||
for (TRAVERSE_CONNECT(i))
|
||||
if (i > j) j = i;
|
||||
|
||||
if (j >= 1) y1 += 8;
|
||||
if (j >= 4) y1 += 8;
|
||||
if (j >= 8) y1 += 8;
|
||||
if (j >= 12) y1 += 8;
|
||||
}
|
||||
|
||||
if (ud.screen_size >= 8 && ud.statusbarmode==0)
|
||||
y2 -= (ss+scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100));
|
||||
|
||||
y1 = scale(y1,ydim,200);
|
||||
y2 = scale(y2,ydim,200);
|
||||
|
||||
setview(x1,y1,x2-1,y2-(getrendermode() == REND_CLASSIC));
|
||||
}
|
||||
|
||||
if (ud.screen_size >= 8 && !(getrendermode() >= REND_POLYMOST && ud.screen_size == 8 && ud.statusbarmode))
|
||||
y2 -= (ss+scale(tilesizy[BOTTOMSTATUSBAR],ud.statusbarscale,100));
|
||||
|
||||
y1 = scale(y1,ydim,200);
|
||||
y2 = scale(y2,ydim,200);
|
||||
|
||||
setview(x1,y1,x2-1,y2-(getrendermode() == REND_CLASSIC));
|
||||
|
||||
G_GetCrosshairColor();
|
||||
G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ void G_NewGame(int32_t vn,int32_t ln,int32_t sk);
|
|||
void G_ResetTimers(void);
|
||||
void G_SetCrosshairColor(int32_t r,int32_t g,int32_t b);
|
||||
void G_UpdateScreenArea(void);
|
||||
void G_SetViewportShrink(int32_t dir);
|
||||
void P_RandomSpawnPoint(int32_t snum);
|
||||
void P_ResetInventory(int32_t snum);
|
||||
void P_ResetPlayer(int32_t snum);
|
||||
|
|
Loading…
Reference in a new issue