Tweeked menus. Slightly less buggy for hexen2 now.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3579 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
6d8e3b01a9
commit
fed179480a
3 changed files with 70 additions and 16 deletions
|
@ -86,7 +86,11 @@ void Draw_Hexen2BigFontString(int x, int y, const char *text)
|
||||||
{
|
{
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
mpic_t *p;
|
mpic_t *p;
|
||||||
|
unsigned int hack;
|
||||||
|
hack = d_8to24rgbtable[0];
|
||||||
|
d_8to24rgbtable[0] = 0;
|
||||||
p = Draw_SafeCachePic ("gfx/menu/bigfont.lmp");
|
p = Draw_SafeCachePic ("gfx/menu/bigfont.lmp");
|
||||||
|
d_8to24rgbtable[0] = hack;
|
||||||
|
|
||||||
while(*text)
|
while(*text)
|
||||||
{
|
{
|
||||||
|
@ -797,7 +801,7 @@ menupicture_t *MC_AddCursor(menu_t *menu, int x, int y)
|
||||||
menudotstyle = "gfx/menu/menudot%i.lmp";
|
menudotstyle = "gfx/menu/menudot%i.lmp";
|
||||||
mindot = 1;
|
mindot = 1;
|
||||||
maxdots = 8;
|
maxdots = 8;
|
||||||
dotofs=-5;
|
dotofs=-2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ //QUAKE 1 WINS BY DEFAULT!
|
{ //QUAKE 1 WINS BY DEFAULT!
|
||||||
|
@ -1536,12 +1540,12 @@ menuoption_t *M_NextSelectableItem(menu_t *m, menuoption_t *old)
|
||||||
|
|
||||||
if (op == old)
|
if (op == old)
|
||||||
{
|
{
|
||||||
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
|
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || (op->common.type == mt_custom && op->custom.key))
|
||||||
return op;
|
return op;
|
||||||
return NULL; //whoops.
|
return NULL; //whoops.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
|
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || (op->common.type == mt_custom && op->custom.key))
|
||||||
if (!op->common.ishidden)
|
if (!op->common.ishidden)
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
@ -1568,7 +1572,7 @@ menuoption_t *M_PrevSelectableItem(menu_t *m, menuoption_t *old)
|
||||||
if (op == old)
|
if (op == old)
|
||||||
return old; //whoops.
|
return old; //whoops.
|
||||||
|
|
||||||
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || op->common.type == mt_custom)
|
if (op->common.type == mt_slider || op->common.type == mt_checkbox || op->common.type == mt_button || op->common.type == mt_hexen2buttonbigfont || op->common.type == mt_qbuttonbigfont || op->common.type == mt_edit || op->common.type == mt_combo || op->common.type == mt_bind || (op->common.type == mt_custom && op->custom.key))
|
||||||
if (!op->common.ishidden)
|
if (!op->common.ishidden)
|
||||||
return op;
|
return op;
|
||||||
}
|
}
|
||||||
|
@ -1919,10 +1923,16 @@ void M_Menu_Main_f (void)
|
||||||
return;
|
return;
|
||||||
MC_AddCenterPicture(mainm, 0, 60, "gfx/menu/title0.lmp");
|
MC_AddCenterPicture(mainm, 0, 60, "gfx/menu/title0.lmp");
|
||||||
|
|
||||||
|
#ifndef CLIENTONLY
|
||||||
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64, "Single Player", "menu_single\n");
|
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64, "Single Player", "menu_single\n");
|
||||||
|
mainm->selecteditem = (menuoption_t *)b;
|
||||||
b->common.width = 12*20;
|
b->common.width = 12*20;
|
||||||
b->common.height = 20;
|
b->common.height = 20;
|
||||||
|
#endif
|
||||||
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+20, "MultiPlayer", "menu_multi\n");
|
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+20, "MultiPlayer", "menu_multi\n");
|
||||||
|
#ifdef CLIENTONLY
|
||||||
|
mainm->selecteditem = (menuoption_t *)b;
|
||||||
|
#endif
|
||||||
b->common.width = 12*20;
|
b->common.width = 12*20;
|
||||||
b->common.height = 20;
|
b->common.height = 20;
|
||||||
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+40, "Options", "menu_options\n");
|
b=MC_AddConsoleCommandHexen2BigFont (mainm, 80, 64+40, "Options", "menu_options\n");
|
||||||
|
@ -1938,7 +1948,7 @@ void M_Menu_Main_f (void)
|
||||||
b->common.width = 12*20;
|
b->common.width = 12*20;
|
||||||
b->common.height = 20;
|
b->common.height = 20;
|
||||||
|
|
||||||
mainm->cursoritem = (menuoption_t *)MC_AddCursor(mainm, 48, 64);
|
mainm->cursoritem = (menuoption_t *)MC_AddCursor(mainm, 56, mainm->selecteditem->common.posy);
|
||||||
}
|
}
|
||||||
else if (QBigFontWorks())
|
else if (QBigFontWorks())
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,12 +113,14 @@ typedef struct {
|
||||||
menuedit_t *nameedit;
|
menuedit_t *nameedit;
|
||||||
menuedit_t *teamedit;
|
menuedit_t *teamedit;
|
||||||
menuedit_t *skinedit;
|
menuedit_t *skinedit;
|
||||||
|
menucombo_t *classedit;
|
||||||
menucombo_t *modeledit;
|
menucombo_t *modeledit;
|
||||||
int topcolour;
|
int topcolour;
|
||||||
int lowercolour;
|
int lowercolour;
|
||||||
|
|
||||||
|
int ticlass;
|
||||||
int tiwidth, tiheight;
|
int tiwidth, tiheight;
|
||||||
qbyte translationimage[64*64];
|
qbyte translationimage[128*128];
|
||||||
} setupmenu_t;
|
} setupmenu_t;
|
||||||
qboolean ApplySetupMenu (union menuoption_s *option,struct menu_s *menu, int key)
|
qboolean ApplySetupMenu (union menuoption_s *option,struct menu_s *menu, int key)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +129,10 @@ qboolean ApplySetupMenu (union menuoption_s *option,struct menu_s *menu, int key
|
||||||
return false;
|
return false;
|
||||||
Cvar_Set(&name, info->nameedit->text);
|
Cvar_Set(&name, info->nameedit->text);
|
||||||
Cvar_Set(&team, info->teamedit->text);
|
Cvar_Set(&team, info->teamedit->text);
|
||||||
Cvar_Set(&skin, info->skinedit->text);
|
if (info->skinedit)
|
||||||
|
Cvar_Set(&skin, info->skinedit->text);
|
||||||
|
if (info->classedit)
|
||||||
|
Cvar_SetValue(Cvar_FindVar("cl_playerclass"), info->classedit->selectedoption+1);
|
||||||
Cbuf_AddText(va("color %i %i\n", info->lowercolour, info->topcolour), RESTRICT_LOCAL);
|
Cbuf_AddText(va("color %i %i\n", info->lowercolour, info->topcolour), RESTRICT_LOCAL);
|
||||||
S_LocalSound ("misc/menu2.wav");
|
S_LocalSound ("misc/menu2.wav");
|
||||||
M_RemoveMenu(menu);
|
M_RemoveMenu(menu);
|
||||||
|
@ -270,19 +275,38 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
|
||||||
setupmenu_t *info = menu->data;
|
setupmenu_t *info = menu->data;
|
||||||
mpic_t *p;
|
mpic_t *p;
|
||||||
void *f;
|
void *f;
|
||||||
|
qboolean reloadtimage = false;
|
||||||
|
|
||||||
if (info->skinedit->modified)
|
if (info->skinedit && info->skinedit->modified)
|
||||||
{
|
{
|
||||||
info->skinedit->modified = false;
|
info->skinedit->modified = false;
|
||||||
|
reloadtimage = true;
|
||||||
|
}
|
||||||
|
if (info->classedit && info->classedit->selectedoption != info->ticlass)
|
||||||
|
{
|
||||||
|
info->ticlass = info->classedit->selectedoption;
|
||||||
|
reloadtimage = true;
|
||||||
|
}
|
||||||
|
|
||||||
FS_LoadFile(va("gfx/player/%s.lmp", info->skinedit->text), &f);
|
if (reloadtimage)
|
||||||
if (!f)
|
{
|
||||||
FS_LoadFile("gfx/menuplyr.lmp", &f);
|
if (info->classedit) //quake2 main menu.
|
||||||
|
{
|
||||||
|
FS_LoadFile(va("gfx/menu/netp%i.lmp", info->ticlass+1), &f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FS_LoadFile(va("gfx/player/%s.lmp", info->skinedit->text), &f);
|
||||||
|
if (!f)
|
||||||
|
FS_LoadFile("gfx/menuplyr.lmp", &f);
|
||||||
|
}
|
||||||
|
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
info->tiwidth = ((int*)f)[0];
|
info->tiwidth = ((int*)f)[0];
|
||||||
info->tiheight = ((int*)f)[1];
|
info->tiheight = ((int*)f)[1];
|
||||||
|
if (info->tiwidth * info->tiheight > sizeof(info->translationimage))
|
||||||
|
info->tiwidth = info->tiheight = 0;
|
||||||
memcpy(info->translationimage, (char*)f+8, info->tiwidth*info->tiheight);
|
memcpy(info->translationimage, (char*)f+8, info->tiwidth*info->tiheight);
|
||||||
FS_FreeFile(f);
|
FS_FreeFile(f);
|
||||||
}
|
}
|
||||||
|
@ -301,6 +325,16 @@ void M_Menu_Setup_f (void)
|
||||||
int mgt;
|
int mgt;
|
||||||
setupmenu_t *info;
|
setupmenu_t *info;
|
||||||
menu_t *menu;
|
menu_t *menu;
|
||||||
|
menucustom_t *ci;
|
||||||
|
char *classnames[] =
|
||||||
|
{
|
||||||
|
"1",
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"Assasin",
|
||||||
|
"Demoness",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
mgt = M_GameType();
|
mgt = M_GameType();
|
||||||
if (mgt == MGT_QUAKE2) //quake2 main menu.
|
if (mgt == MGT_QUAKE2) //quake2 main menu.
|
||||||
|
@ -379,9 +413,17 @@ void M_Menu_Setup_f (void)
|
||||||
menu->selecteditem = (menuoption_t*)
|
menu->selecteditem = (menuoption_t*)
|
||||||
(info->nameedit = MC_AddEdit(menu, 64, 40, "Your name", name.string));
|
(info->nameedit = MC_AddEdit(menu, 64, 40, "Your name", name.string));
|
||||||
(info->teamedit = MC_AddEdit(menu, 64, 56, "Your team", team.string));
|
(info->teamedit = MC_AddEdit(menu, 64, 56, "Your team", team.string));
|
||||||
(info->skinedit = MC_AddEdit(menu, 64, 72, "Your skin", skin.string));
|
if (mgt == MGT_HEXEN2)
|
||||||
|
{
|
||||||
|
cvar_t *pc = Cvar_Get("cl_playerclass", "1", CVAR_USERINFO|CVAR_ARCHIVE, "Hexen2");
|
||||||
|
(info->classedit = MC_AddCombo(menu, 64, 72, "Your class", classnames, pc->ival-1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
(info->skinedit = MC_AddEdit(menu, 64, 72, "Your skin", skin.string));
|
||||||
|
|
||||||
MC_AddCustom(menu, 172, 88, NULL)->draw = MSetup_TransDraw;
|
ci = MC_AddCustom(menu, 172+32, 88, NULL);
|
||||||
|
ci->draw = MSetup_TransDraw;
|
||||||
|
ci->key = NULL;
|
||||||
|
|
||||||
MC_AddCommand(menu, 64, 96, "Top colour", SetupMenuColour);
|
MC_AddCommand(menu, 64, 96, "Top colour", SetupMenuColour);
|
||||||
MC_AddCommand(menu, 64, 120, "Lower colour", SetupMenuColour);
|
MC_AddCommand(menu, 64, 120, "Lower colour", SetupMenuColour);
|
||||||
|
@ -393,7 +435,9 @@ void M_Menu_Setup_f (void)
|
||||||
|
|
||||||
info->lowercolour = bottomcolor.value;
|
info->lowercolour = bottomcolor.value;
|
||||||
info->topcolour = topcolor.value;
|
info->topcolour = topcolor.value;
|
||||||
info->skinedit->modified = true;
|
if (info->skinedit)
|
||||||
|
info->skinedit->modified = true;
|
||||||
|
info->ticlass = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ void M_Menu_Options_f (void)
|
||||||
MC_AddCheckBox(menu, 16, y, " Use Mouse", &_windowed_mouse,0); y+=8;
|
MC_AddCheckBox(menu, 16, y, " Use Mouse", &_windowed_mouse,0); y+=8;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 225, 32, NULL, false);
|
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 225, menu->selecteditem->common.posy, NULL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __CYGWIN__
|
#ifndef __CYGWIN__
|
||||||
|
|
Loading…
Reference in a new issue