Status bar stuff... this adds new hotkeys for scaling the status bar (hold shift while pressing the shrink or enlarge screen buttons) and also adds support for a left-justified version of the full status bar

git-svn-id: https://svn.eduke32.com/eduke32@491 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-02-13 01:28:50 +00:00
parent ac95cded34
commit ef8f308c9b
5 changed files with 72 additions and 45 deletions

View file

@ -179,7 +179,7 @@ inline void setstatusbarscale(long sc)
static inline long sbarx(long x)
{
if (ud.screen_size == 4) return scale(x<<16,ud.statusbarscale,100);
if (ud.screen_size == 4 || ud.statusbarmode == 1) return scale(x<<16,ud.statusbarscale,100);
return (((320l<<16) - scale(320l<<16,ud.statusbarscale,100)) >> 1) + scale(x<<16,ud.statusbarscale,100);
}
@ -209,7 +209,9 @@ static void patchstatusbar(long x1, long y1, long x2, long y2)
clofx = (xdim - scale(xdim,ud.statusbarscale,100)) >> 1;
clofy = (ydim - scale(ydim,ud.statusbarscale,100));
if (ud.statusbarmode == 0)
rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1+clofx,cly1+clofy,clx2+clofx-1,cly2+clofy-1);
else rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1,cly1,clx2+clofx-1,cly2+clofy-1);
}
void setgamepalette(struct player_struct *player, char *pal, int set)
@ -7630,22 +7632,47 @@ static void nonsharedkeys(void)
if (BUTTON(gamefunc_Enlarge_Screen))
{
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
if (!SHIFTS_IS_PRESSED)
{
if (ud.screen_size > 0)
sound(THUD);
if (ud.screen_size == 8 && ud.statusbarmode == 0 && bpp > 8 && ud.statusbarscale != 100)
if (ud.screen_size == 8 && ud.statusbarmode == 0 && bpp > 8)
ud.statusbarmode = 1;
else ud.screen_size -= 4;
if (ud.statusbarscale == 100 && ud.statusbarmode == 1)
{
ud.statusbarmode = 0;
ud.screen_size -= 4;
}
}
else
{
ud.statusbarscale += 8;
setstatusbarscale(ud.statusbarscale);
}
vscrn();
}
if (BUTTON(gamefunc_Shrink_Screen))
{
CONTROL_ClearButton(gamefunc_Shrink_Screen);
if (!SHIFTS_IS_PRESSED)
{
if (ud.screen_size < 64) sound(THUD);
if (ud.screen_size == 4 && ud.statusbarscale == 100 && ud.statusbarmode == 1)
ud.statusbarmode = 0;
if (ud.screen_size == 8 && ud.statusbarmode == 1 && bpp > 8)
ud.statusbarmode = 0;
else ud.screen_size += 4;
}
else
{
ud.statusbarscale -= 8;
if (ud.statusbarscale < 37)
ud.statusbarscale = 37;
setstatusbarscale(ud.statusbarscale);
if (ud.screen_size == 8)
ud.statusbarmode = 1;
}
vscrn();
}
}
@ -10166,6 +10193,12 @@ MAIN_LOOP_RESTART:
else
i = 65536;
if (ud.statusbarmode == 1 && ud.statusbarscale == 100)
{
ud.statusbarmode = 0;
vscrn();
}
displayrooms(screenpeek,i);
displayrest(i);

View file

@ -360,6 +360,16 @@ static int osdcmd_restartsound(const osdfuncparm_t *parm)
FX_StopAllSounds();
clearsoundlocks();
if (MusicToggle == 1)
{
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
{
if (music_fn[0][(unsigned char)music_select] != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]);
}
else playmusic(&env_music_fn[0][0]);
}
return OSDCMD_OK;
}
@ -428,21 +438,6 @@ static int osdcmd_setstatusbarscale(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
static int osdcmd_setstatusbarmode(const osdfuncparm_t *parm)
{
if (parm->numparms == 0)
{
OSD_Printf("\"cl_statusbarmode\" is \"%d\"\n", ud.statusbarmode);
return OSDCMD_SHOWHELP;
}
else if (parm->numparms != 1) return OSDCMD_SHOWHELP;
ud.statusbarmode = Batol(parm->parms[0]);
vscrn();
OSD_Printf("cl_statusbarmode %d\n", ud.statusbarmode);
return OSDCMD_OK;
}
static int osdcmd_spawn(const osdfuncparm_t *parm)
{
long x=0,y=0,z=0;
@ -924,7 +919,6 @@ int registerosdcommands(void)
OSD_RegisterFunction("addpath","addpath <path>: adds path to game filesystem", osdcmd_addpath);
OSD_RegisterFunction("cl_statusbarmode","cl_statusbarmode: enable/disable status bar drawing hack", osdcmd_setstatusbarmode);
OSD_RegisterFunction("cl_statusbarscale","cl_statusbarscale: changes the status bar scale", osdcmd_setstatusbarscale);
OSD_RegisterFunction("cmenu","cmenu <#>: jumps to menu", osdcmd_cmenu);