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));
rotatesprite(tx,ty,scl,0,BOTTOMSTATUSBAR,4,0,10+16+64,clx1+clofx,cly1+clofy,clx2+clofx-1,cly2+clofy-1);
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)
@ -4020,9 +4022,9 @@ void displayrooms(int snum,long smoothratio)
if (ud.camerahoriz > 299) ud.camerahoriz = 299;
else if (ud.camerahoriz < -99) ud.camerahoriz = -99;
OnEvent(EVENT_DISPLAYROOMS, ps[screenpeek].i, screenpeek, -1);
OnEvent(EVENT_DISPLAYROOMS, ps[screenpeek].i, screenpeek, -1);
#ifdef SE40
se40code(ud.camerax,ud.cameray,ud.cameraz,ud.cameraang,ud.camerahoriz,smoothratio);
#endif
@ -7630,22 +7632,47 @@ static void nonsharedkeys(void)
if (BUTTON(gamefunc_Enlarge_Screen))
{
CONTROL_ClearButton(gamefunc_Enlarge_Screen);
if (ud.screen_size > 0)
sound(THUD);
if (ud.screen_size == 8 && ud.statusbarmode == 0 && bpp > 8 && ud.statusbarscale != 100)
ud.statusbarmode = 1;
else ud.screen_size -= 4;
if (!SHIFTS_IS_PRESSED)
{
if (ud.screen_size > 0)
sound(THUD);
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 (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;
if (!SHIFTS_IS_PRESSED)
{
if (ud.screen_size < 64) sound(THUD);
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();
}
}
@ -8189,7 +8216,7 @@ static int load_rancid_net(char *fn)
if (strtok(ip,":"))
{
char *p = strtok(NULL,":");
if (p != NULL)
{
if (atoi(p) > 1024)
@ -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

@ -812,7 +812,7 @@ LABELS userdefslabels[]=
{ "automsg", USERDEFS_AUTOMSG, 0, 0 },
{ "idplayers", USERDEFS_IDPLAYERS, 0, 0 },
{ "team", USERDEFS_TEAM, 0, 0 },
#if 0
#if 0
{ "myx", USERDEFS_MYX, 0, 0 },
{ "omyx", USERDEFS_OMYX, 0, 0 },
{ "myxvel", USERDEFS_MYXVEL, 0, 0 },
@ -1047,8 +1047,8 @@ char CheckEventSync(int iEventID)
case EVENT_DISPLAYCROSSHAIR:
case EVENT_DISPLAYREST:
case EVENT_DISPLAYROOMS:
case EVENT_DISPLAYWEAPON:
case EVENT_DRAWWEAPON:
case EVENT_DISPLAYWEAPON:
case EVENT_DRAWWEAPON:
case EVENT_ENTERLEVEL:
case EVENT_FAKEDOMOVETHINGS:
case EVENT_GETLOADTILE:

View file

@ -4784,10 +4784,10 @@ static int parse(void)
if (x1 > x2) swaplong(&x1,&x2);
if (y1 > y2) swaplong(&y1,&y2);
if (x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 1 || y2-y1 < 1)
break;
#if defined(USE_OPENGL) && defined(POLYMOST)
j = glprojectionhacks;
glprojectionhacks = 0;
@ -4799,7 +4799,7 @@ static int parse(void)
vscrn();
#if defined(USE_OPENGL) && defined(POLYMOST)
glprojectionhacks = j;
#endif
#endif
break;
}

View file

@ -219,7 +219,7 @@ int MUSIC_Shutdown(void)
music_context = 0;
music_initialized = 0;
music_loopflag = MUSIC_PlayOnce;
if (midifn != NULL)
{
initprintf("Removing temporary file '%s'\n",midifn);
@ -227,7 +227,7 @@ int MUSIC_Shutdown(void)
Bfree(midifn);
midifn = NULL;
}
return(MUSIC_Ok);
} // MUSIC_Shutdown
@ -309,7 +309,7 @@ int MUSIC_StopSong(void)
music_songdata = NULL;
music_musicchunk = NULL;
return(MUSIC_Ok);
} // MUSIC_StopSong
@ -386,14 +386,14 @@ void PlayMusic(char *_filename)
// save the file somewhere, so SDL_mixer can load it
{
char *user = getenv("USERNAME");
if (user) Bsprintf(tempbuf,"duke3d-%s.mid.%d",user,getpid());
else Bsprintf(tempbuf,"duke3d.mid.%d",getpid());
GetUnixPathFromEnvironment(filename, BMAX_PATH, tempbuf);
handle = SafeOpenWrite(filename, filetype_binary);
if (handle == -1)
return;

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);