Hexen2: Implement objectives popup as an overlay instead of just some prints. Fix some flickering. Make class selection menu a smidge nicer.

This commit is contained in:
Shpoike 2023-06-25 15:57:22 +01:00
parent 01a958e0a6
commit c55c8e96a9
3 changed files with 46 additions and 20 deletions

View file

@ -404,30 +404,37 @@ void M_Menu_SinglePlayer_f (void)
if (!strncmp(Cmd_Argv(1), "class", 5))
{
unsigned taken = 0;
int oldclass;
int pnum;
pnum = atoi(Cmd_Argv(1)+5);
if (!pnum)
pnum = 1;
cl_splitscreen.ival = bound(0, cl_splitscreen.ival, MAX_SPLITS-1);
pnum = bound(1, pnum, cl_splitscreen.ival+1);
MC_AddCenterPicture(menu, 0, 60, "gfx/menu/title2.lmp");
if (cl_splitscreen.ival)
MC_AddBufferedText(menu, 80, 0, (y+=8)+12, va(localtext("Player %i\n"), pnum), false, true);
for (i = 0; i < pnum-1 && i < countof(cls.userinfo); i++)
taken |= 1<<atoi(InfoBuf_ValueForKey(&cls.userinfo[i], "cl_playerclass"));
oldclass = atoi(InfoBuf_ValueForKey(&cls.userinfo[pnum-1], "cl_playerclass"));
for (i = 0; i <= 4+havemp; i++)
{
b = MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, classlistmp[i],
b = MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, (!i || !(taken&(1<<i)))?classlistmp[i]:(va(S_COLOR_GRAY"%s", classlistmp[i])),
va("p%i setinfo cl_playerclass %i; menu_single %s %s\n",
pnum,
i?i:((rand()%(4+havemp))+1),
((pnum+1 > cl_splitscreen.ival+1)?"skill":va("class%i",pnum+1)),
Cmd_Argv(2)));
if (!menu->selecteditem)
if (!menu->selecteditem || i == oldclass)
menu->selecteditem = (menuoption_t*)b;
}
}
else if (!strncmp(Cmd_Argv(1), "skill", 5))
{
extern cvar_t skill;
//yes, hexen2 has per-class names for the skill levels. because being weird and obtuse is kinda its forte
static char *skillnames[6][4] =
{
@ -477,7 +484,7 @@ void M_Menu_SinglePlayer_f (void)
for (i = 0; i < 4; i++)
{
b = MC_AddConsoleCommandHexen2BigFont(menu, 80, y+=20, sn[i], va("skill %i; closemenu; disconnect; deathmatch 0; coop %i;wait;map %s\n", i, cl_splitscreen.ival>0, Cmd_Argv(2)));
if (!menu->selecteditem)
if (!menu->selecteditem || i == skill.ival)
menu->selecteditem = (menuoption_t*)b;
}
}
@ -504,7 +511,7 @@ void M_Menu_SinglePlayer_f (void)
MC_AddCvarCombo(menu, 72, 170, y+=20, localtext("Splitscreen"), &cl_splitscreen, splitopts, splitvals);
}
menu->cursoritem = (menuoption_t *)MC_AddCursor(menu, &resel, 56, menu->selecteditem?menu->selecteditem->common.posy:0);
menu->cursoritem = (menuoption_t *)MC_AddCursor(menu, menu->selecteditem?NULL:&resel, 56, menu->selecteditem?menu->selecteditem->common.posy:0);
return;
}

View file

@ -3087,16 +3087,6 @@ void Sbar_Draw (playerview_t *pv)
sb_updates++;
if (cl_sbar.value == 1 || scr_viewsize.value<100)
{
if (sbar_rect.x>r_refdef.grect.x)
{ // left
R2D_TileClear (r_refdef.grect.x, r_refdef.grect.y+sbar_rect.height - sb_lines, sbar_rect.x - r_refdef.grect.x, sb_lines);
}
if (sbar_rect.x + 320 <= r_refdef.grect.x + sbar_rect.width && !headsup)
R2D_TileClear (sbar_rect.x + 320, r_refdef.grect.y+sbar_rect.height - sb_lines, sbar_rect.width - (320), sb_lines);
}
#ifdef HEXEN2
if (sbar_hexen2)
{
@ -3104,22 +3094,33 @@ void Sbar_Draw (playerview_t *pv)
float targlines;
//hexen2 hud
if (cl_sbar.value == 1 || scr_viewsize.value<100)
R2D_TileClear (r_refdef.grect.x, r_refdef.grect.y+sbar_rect.height - sb_lines, r_refdef.grect.width, sb_lines);
if (pv->sb_hexen2_infoplaque)
{
qboolean foundone = false;
int i;
Con_Printf("Objectives:\n");
char *text = Z_StrDup("Objectives:\n");
for (i = 0; i < 64; i++)
{
if (pv->stats[STAT_H2_OBJECTIVE1 + i/32] & (1<<(i&31)))
Con_Printf("%s\n", T_GetInfoString(i));
{
Z_StrCat(&text, va("%s\n", T_GetInfoString(i)));
foundone = true;
}
}
pv->sb_hexen2_infoplaque = false;
if (!foundone)
Z_StrCat(&text, va("<No Current Objectives>\n"));
R_DrawTextField(r_refdef.grect.x, r_refdef.grect.y, r_refdef.grect.width, r_refdef.grect.height, text, CON_WHITEMASK, CPRINT_BACKGROUND|CPRINT_LALIGN, font_default, NULL);
Z_Free(text);
}
if (pv->sb_hexen2_extra_info)
targlines = 46+98; //extra stuff shown when hitting tab
else if (sb_lines > SBAR_HEIGHT)
targlines = 46; //viewsize 100 stuff...
targlines = sb_lines; //viewsize 100 stuff...
else
targlines = -23; //viewsize 110/120 transparent overlay. negative covers the extra translucent details above.
if (targlines > pv->sb_hexen2_extra_info_lines)
@ -3173,6 +3174,16 @@ void Sbar_Draw (playerview_t *pv)
}
else
{
if (cl_sbar.value == 1 || scr_viewsize.value<100)
{
if (sbar_rect.x>r_refdef.grect.x)
{ // left
R2D_TileClear (r_refdef.grect.x, r_refdef.grect.y+sbar_rect.height - sb_lines, sbar_rect.x - r_refdef.grect.x, sb_lines);
}
if (sbar_rect.x + 320 <= r_refdef.grect.x + sbar_rect.width && !headsup)
R2D_TileClear (sbar_rect.x + 320, r_refdef.grect.y+sbar_rect.height - sb_lines, sbar_rect.width - (320), sb_lines);
}
//standard quake(world) hud.
// main area
if (sb_lines > 0)

View file

@ -1376,6 +1376,9 @@ void V_ApplyRefdef (void)
int h;
qboolean full = false;
#endif
#ifdef HEXEN2
extern qboolean sbar_hexen2;
#endif
// force the status bar to redraw
Sbar_Changed ();
@ -1409,6 +1412,11 @@ void V_ApplyRefdef (void)
else if (size >= 110)
sb_lines = 24; // no inventory
else
#ifdef HEXEN2
if (sbar_hexen2)
sb_lines = 46; //hexen2's sbar is a smidge more crampt.
else
#endif
sb_lines = 24+16+8;
if (scr_viewsize.value >= 100.0)