Add an option to move the status bar to the top of the screen in the Android version.

Restores a feature temporarily disabled in r6553.

Currently only supports the modern status bar.

Patch from Fox.

git-svn-id: https://svn.eduke32.com/eduke32@6588 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-01-26 04:34:57 +00:00
parent 150ddded12
commit 4da012a15f
10 changed files with 24 additions and 6 deletions

View file

@ -250,6 +250,7 @@ void CONFIG_SetDefaults(void)
ud.textscale = 200;
ud.screenfade = 1;
ud.menubackground = 1;
ud.hudontop = 0;
ud.config.CheckForUpdates = 1;

View file

@ -161,6 +161,7 @@ typedef struct {
int32_t m_noexits,noexits,autovote,automsg,idplayers;
int32_t team, viewbob, weaponsway, althud, weaponscale, textscale;
int32_t statusbarflags, statusbarrange, statusbarcustom;
int32_t hudontop;
int32_t screenarea_x1, screenarea_y1, screenarea_x2, screenarea_y2;
int32_t entered_name,screen_tilting,shadows,fta_on,executions,auto_run;

View file

@ -1239,6 +1239,7 @@ const memberlabel_t UserdefsLabels[]=
{ "statusbarflags", USERDEFS_STATUSBARFLAGS, 0, 0 },
{ "statusbarrange", USERDEFS_STATUSBARRANGE, 0, 0 },
{ "statusbarcustom", USERDEFS_STATUSBARCUSTOM, 0, 0 },
{ "hudontop", USERDEFS_HUDONTOP, 0, 0 },
{ NULL, -1, 0, 0 } // END OF LIST
};

View file

@ -537,6 +537,7 @@ enum UserdefsLabel_t
USERDEFS_STATUSBARFLAGS,
USERDEFS_STATUSBARRANGE,
USERDEFS_STATUSBARCUSTOM,
USERDEFS_HUDONTOP,
USERDEFS_END
};

View file

@ -181,6 +181,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum)
case USERDEFS_STATUSBARFLAGS: labelNum = ud.statusbarflags; break;
case USERDEFS_STATUSBARRANGE: labelNum = ud.statusbarrange; break;
case USERDEFS_STATUSBARCUSTOM: labelNum = ud.statusbarcustom; break;
case USERDEFS_HUDONTOP: labelNum = ud.hudontop; break;
default: labelNum = -1; break;
}
@ -312,6 +313,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const iSet)
case USERDEFS_STATUSBARFLAGS: ud.statusbarflags = iSet; break;
case USERDEFS_STATUSBARRANGE: ud.statusbarrange = iSet; break;
case USERDEFS_STATUSBARCUSTOM: ud.statusbarcustom = iSet; break;
case USERDEFS_HUDONTOP: ud.hudontop = iSet; break;
default: break;
}
}

View file

@ -586,6 +586,14 @@ static MenuEntry_t ME_SCREENSETUP_SHOWPICKUPMESSAGES = MAKE_MENUENTRY( "Game mes
#ifdef EDUKE32_ANDROID_MENU
static char const *MEOSN_SCREENSETUP_STATUSBARONTOP[] = { "Bottom", "Top" };
static int32_t MEOSV_SCREENSETUP_STATUSBARONTOP[] = { 0, 1};
static MenuOptionSet_t MEOS_SCREENSETUP_STATUSBARONTOP = MAKE_MENUOPTIONSET( MEOSN_SCREENSETUP_STATUSBARONTOP, MEOSV_SCREENSETUP_STATUSBARONTOP, 0x2 );
static MenuOption_t MEO_SCREENSETUP_STATUSBARONTOP = MAKE_MENUOPTION(&MF_Redfont, &MEOS_SCREENSETUP_STATUSBARONTOP, &ud.hudontop);
static MenuEntry_t ME_SCREENSETUP_STATUSBARONTOP = MAKE_MENUENTRY( "Status bar:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SCREENSETUP_STATUSBARONTOP, Option );
#endif
static MenuRangeInt32_t MEO_SCREENSETUP_SBARSIZE = MAKE_MENURANGE( &ud.statusbarscale, &MF_Redfont, 36, 100, 0, 17, 2 );
static MenuEntry_t ME_SCREENSETUP_SBARSIZE = MAKE_MENUENTRY( s_Scale, &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SCREENSETUP_SBARSIZE, RangeInt32 );
@ -1096,6 +1104,9 @@ static MenuEntry_t *MEL_SCREENSETUP[] = {
&ME_SCREENSETUP_SCREENSIZE,
#endif
#ifdef EDUKE32_ANDROID_MENU
&ME_SCREENSETUP_STATUSBARONTOP,
#endif
&ME_SCREENSETUP_SBARSIZE,
&ME_SCREENSETUP_CROSSHAIR,

View file

@ -1589,7 +1589,8 @@ int32_t registerosdcommands(void)
{ "demoplay_diffs","enable/disable application of diffs in demo playback",(void *)&demoplay_diffs, CVAR_BOOL, 0, 1 },
{ "demoplay_showsync","enable/disable display of sync status",(void *)&demoplay_showsync, CVAR_BOOL, 0, 1 },
{ "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_INT, 0, 2 },
{ "hud_althud", "enable/disable alternate mini-hud", (void *)&ud.althud, CVAR_BOOL, 0, 1 },
{ "hud_position", "aligns the status bar to the bottom/top", (void *)&ud.hudontop, CVAR_BOOL, 0, 1 },
{ "hud_bgstretch", "enable/disable background image stretching in wide resolutions", (void *)&ud.bgstretch, CVAR_BOOL, 0, 1 },
{ "hud_messagetime", "length of time to display multiplayer chat messages", (void *)&ud.msgdisptime, CVAR_INT, 0, 3600 },
{ "hud_numbertile", "first tile in alt hud number set", (void *)&althud_numbertile, CVAR_INT, 0, MAXUSERTILES-10 },

View file

@ -48,7 +48,7 @@ static int32_t sbarxr(int32_t x)
static int32_t sbary(int32_t y)
{
if (ud.althud == 2 && ud.screen_size == 4) return sbarsc(y << 16);
if (ud.hudontop == 1 && ud.screen_size == 4 && ud.althud == 1) return sbarsc(y << 16);
else return (200<<16) - sbarsc(200<<16) + sbarsc(y<<16);
}
@ -608,7 +608,7 @@ void G_DrawStatusBar(int32_t snum)
{
// ALTERNATIVE STATUS BAR
int32_t hudoffset = althud == 2 ? 32 : 200;
int32_t hudoffset = ud.hudontop == 1 ? 32 : 200;
static int32_t ammo_sprites[MAX_WEAPONS];
if (EDUKE32_PREDICT_FALSE(ammo_sprites[0] == 0))
@ -703,7 +703,7 @@ void G_DrawStatusBar(int32_t snum)
}
}
if (ud.althud == 2)
if (ud.hudontop == 1)
hudoffset += 40;
if (p->got_access&1) rotatesprite_althudr(39, hudoffset-43, sb15, 0, ACCESSCARD, 0, 0, 10+16+512);

View file

@ -1221,7 +1221,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.screen_size == 4)
{
if (ud.althud != 2)
if (ud.althud == 1 && ud.hudontop == 0)
i -= sbarsc(ud.althud ? (tilesiz[BIGALPHANUM].y+8)<<16 : tilesiz[INVENTORYBOX].y<<16);
}
else if (ud.screen_size > 2)

View file

@ -1044,7 +1044,7 @@ static FORCE_INLINE int32_t text_fragbarheight(void)
static FORCE_INLINE int32_t text_ypos(void)
{
if (ud.althud == 2)
if (ud.hudontop == 1 && ud.screen_size == 4 && ud.althud == 1)
return 32<<16;
#ifdef GEKKO