#define TYPE_GAME 2
#define TYPE_BOTH 3
-static cvar_t forceqmenu = { 0, "forceqmenu", "0", "enables the quake menu instead of the quakec menu.dat (if present)" };
-static cvar_t menu_progs = { 0, "menu_progs", "menu.dat", "name of quakec menu.dat file" };
+static cvar_t forceqmenu = {CVAR_CLIENT, "forceqmenu", "0", "enables the quake menu instead of the quakec menu.dat (if present)"};
+static cvar_t menu_progs = {CVAR_CLIENT, "menu_progs", "menu.dat", "name of quakec menu.dat file"};
static int NehGameType;
M_Print(16, 16 + 8*i, NehahraDemos[i].desc);
// line cursor
- M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(realtime*4)&1));
+ M_DrawCharacter (8, 16 + demo_cursor*8, 12+((int)(host.realtime*4)&1));
}
s = "to your launch commandline";M_Print ((640-strlen(s)*8)*0.5, y, s);y+=8;
M_Print (640/2 - 48, 480/2, "Open Console"); //The console usually better shows errors (failures)
M_Print (640/2 - 48, 480/2 + 8, "Quit");
- M_DrawCharacter(640/2 - 56, 480/2 + (8 * m_main_cursor), 12+((int)(realtime*4)&1));
+ M_DrawCharacter(640/2 - 56, 480/2 + (8 * m_main_cursor), 12+((int)(host.realtime*4)&1));
return;
}
else
M_DrawPic (72, 32, "gfx/mainmenu");
- f = (int)(realtime * 10)%6;
+ f = (int)(host.realtime * 10)%6;
M_DrawPic (54, 32 + m_main_cursor * 20, va(vabuf, sizeof(vabuf), "gfx/menudot%i", f+1));
}
M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/ttl_sgl");
M_DrawPic (72, 32, "gfx/sp_menu");
- f = (int)(realtime * 10)%6;
+ f = (int)(host.realtime * 10)%6;
M_DrawPic (54, 32 + m_singleplayer_cursor * 20, va(vabuf, sizeof(vabuf), "gfx/menudot%i", f+1));
}
M_Print(16, 32 + 8*i, m_filenames[i]);
// line cursor
- M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
+ M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(host.realtime*4)&1));
}
M_Print(16, 32 + 8*i, m_filenames[i]);
// line cursor
- M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
+ M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(host.realtime*4)&1));
}
M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/p_multi");
M_DrawPic (72, 32, "gfx/mp_menu");
- f = (int)(realtime * 10)%6;
+ f = (int)(host.realtime * 10)%6;
M_DrawPic (54, 32 + m_multiplayer_cursor * 20, va(vabuf, sizeof(vabuf), "gfx/menudot%i", f+1));
}
#define NUM_SETUP_CMDS 5
+extern cvar_t topcolor;
+extern cvar_t bottomcolor;
+
void M_Menu_Setup_f(cmd_state_t *cmd)
{
key_dest = key_menu;
m_state = m_setup;
m_entersound = true;
- strlcpy(setup_myname, cl_name.string, sizeof(setup_myname));
- setup_top = setup_oldtop = cl_color.integer >> 4;
- setup_bottom = setup_oldbottom = cl_color.integer & 15;
- setup_rate = cl_rate.integer;
+ strlcpy(setup_myname, name.string, sizeof(setup_myname));
+ setup_top = setup_oldtop = topcolor.integer;
+ setup_bottom = setup_oldbottom = bottomcolor.integer;
+ setup_rate = rate.integer;
}
static int menuplyr_width, menuplyr_height, menuplyr_top, menuplyr_bottom, menuplyr_load;
}
if (setup_cursor == 0)
- M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(realtime*4)&1));
+ M_DrawCharacter (168 + 8*strlen(setup_myname), setup_cursor_table [setup_cursor], 10+((int)(host.realtime*4)&1));
else
- M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(realtime*4)&1));
+ M_DrawCharacter (56, setup_cursor_table [setup_cursor], 12+((int)(host.realtime*4)&1));
}
goto forward;
// setup_cursor == 4 (Accept changes)
- if (strcmp(cl_name.string, setup_myname) != 0)
+ if (strcmp(name.string, setup_myname) != 0)
Cbuf_AddText(cmd, va(vabuf, sizeof(vabuf), "name \"%s\"\n", setup_myname) );
if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
Cbuf_AddText(cmd, va(vabuf, sizeof(vabuf), "color %i %i\n", setup_top, setup_bottom) );
m_entersound = true;
}
-extern cvar_t slowmo;
+extern cvar_t host_timescale;
extern dllhandle_t jpeg_dll;
extern cvar_t gl_texture_anisotropy;
extern cvar_t r_textshadow;
Cvar_SetValueQuick (&cl_backspeed, 400);
}
}
- else if (options_cursor == optnum++) Cvar_SetValueQuick(&showfps, !showfps.integer);
- else if (options_cursor == optnum++) {f = !(showdate.integer && showtime.integer);Cvar_SetValueQuick(&showdate, f);Cvar_SetValueQuick(&showtime, f);}
+ else if (options_cursor == optnum++) Cvar_SetValueQuick(&cl_showfps, !cl_showfps.integer);
+ else if (options_cursor == optnum++) {f = !(cl_showdate.integer && cl_showtime.integer);Cvar_SetValueQuick(&cl_showdate, f);Cvar_SetValueQuick(&cl_showtime, f);}
else if (options_cursor == optnum++) ;
else if (options_cursor == optnum++) Cvar_SetValueQuick(&r_hdr_scenebrightness, bound(1, r_hdr_scenebrightness.value + dir * 0.0625, 4));
else if (options_cursor == optnum++) Cvar_SetValueQuick(&v_contrast, bound(1, v_contrast.value + dir * 0.0625, 4));
if (m_opty >= 32)
{
if (m_optnum == m_optcursor)
- DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
M_ItemPrint(0 + 48, m_opty, s, enabled);
}
m_opty += 8;
if (m_opty >= 32)
{
if (m_optnum == m_optcursor)
- DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
M_ItemPrint(0 + 48, m_opty, s, enabled);
M_DrawCheckbox(0 + 48 + (int)strlen(s) * 8 + 8, m_opty, yes);
}
if (m_opty >= 32)
{
if (m_optnum == m_optcursor)
- DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ DrawQ_Fill(menu_x + 48, menu_y + m_opty, 320, 8, m_optnum == m_optcursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
M_ItemPrint(0 + 48, m_opty, s, enabled);
M_DrawSlider(0 + 48 + (int)strlen(s) * 8 + 8, m_opty, value, minvalue, maxvalue);
}
M_Options_PrintCheckbox(" Invert Mouse", true, m_pitch.value < 0);
M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
M_Options_PrintCheckbox(" Always Run", true, cl_forwardspeed.value > 200);
- M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer);
- M_Options_PrintCheckbox(" Show Date and Time", true, showdate.integer && showtime.integer);
+ M_Options_PrintCheckbox(" Show Framerate", true, cl_showfps.integer);
+ M_Options_PrintCheckbox(" Show Date and Time", true, cl_showdate.integer && cl_showtime.integer);
M_Options_PrintCommand( " Custom Brightness", true);
M_Options_PrintSlider( " Game Brightness", true, r_hdr_scenebrightness.value, 1, 4);
M_Options_PrintSlider( " Brightness", true, v_contrast.value, 1, 2);
static int options_colorcontrol_cursor;
// intensity value to match up to 50% dither to 'correct' quake
-static cvar_t menu_options_colorcontrol_correctionvalue = {0, "menu_options_colorcontrol_correctionvalue", "0.5", "intensity value that matches up to white/black dither pattern, should be 0.5 for linear color"};
+static cvar_t menu_options_colorcontrol_correctionvalue = {CVAR_CLIENT, "menu_options_colorcontrol_correctionvalue", "0.5", "intensity value that matches up to white/black dither pattern, should be 0.5 for linear color"};
void M_Menu_Options_ColorControl_f(cmd_state_t *cmd)
{
if (bind_grab)
M_DrawCharacter (140, 48 + keys_cursor*8, '=');
else
- M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(realtime*4)&1));
+ M_DrawCharacter (140, 48 + keys_cursor*8, 12+((int)(host.realtime*4)&1));
}
t++;
// Cursor
- M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1));
+ M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(host.realtime*4)&1));
}
M_Print(basex+8, lanConfig_cursor_table[1], "OK");
}
- M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(realtime*4)&1));
+ M_DrawCharacter (basex-8, lanConfig_cursor_table [lanConfig_cursor], 12+((int)(host.realtime*4)&1));
if (lanConfig_cursor == 0)
- M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [lanConfig_cursor], 10+((int)(realtime*4)&1));
+ M_DrawCharacter (basex+9*8 + 8*strlen(lanConfig_portname), lanConfig_cursor_table [lanConfig_cursor], 10+((int)(host.realtime*4)&1));
if (lanConfig_cursor == 3)
- M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [lanConfig_cursor], 10+((int)(realtime*4)&1));
+ M_DrawCharacter (basex+16 + 8*strlen(lanConfig_joinname), lanConfig_cursor_table [lanConfig_cursor], 10+((int)(host.realtime*4)&1));
if (*m_return_reason)
M_Print(basex, 168, m_return_reason);
Cbuf_AddText(cmd, "stopdemo\n");
- Cvar_SetValue("port", lanConfig_port);
+ Cvar_SetValue(&cvars_all, "port", lanConfig_port);
if (lanConfig_cursor == 1 || lanConfig_cursor == 2)
{
if (gamemode == GAME_TRANSFUSION)
{
if (!coop.integer && !deathmatch.integer)
- Cvar_SetValue("deathmatch", 1);
+ Cvar_SetValue(&cvars_all, "deathmatch", 1);
if (deathmatch.integer == 0)
M_Print(160, 64, "Cooperative");
else if (deathmatch.integer == 2)
else if (gamemode == GAME_BATTLEMECH)
{
if (!deathmatch.integer)
- Cvar_SetValue("deathmatch", 1);
+ Cvar_SetValue(&cvars_all, "deathmatch", 1);
if (deathmatch.integer == 2)
M_Print(160, 64, "Rambo Match");
else
else
{
if (!coop.integer && !deathmatch.integer)
- Cvar_SetValue("deathmatch", 1);
+ Cvar_SetValue(&cvars_all, "deathmatch", 1);
if (coop.integer)
M_Print(160, 64, "Cooperative");
else
// line cursor
if (gameoptions_cursor == 9)
- M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1));
+ M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(host.realtime*4)&1));
else
- M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
+ M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(host.realtime*4)&1));
if (m_serverInfoMessage)
{
- if ((realtime - m_serverInfoMessageTime) < 5.0)
+ if ((host.realtime - m_serverInfoMessageTime) < 5.0)
{
x = (320-26*8)/2;
M_DrawTextBox (x, 138, 24, 4);
{
maxplayers = MAX_SCOREBOARD;
m_serverInfoMessage = true;
- m_serverInfoMessageTime = realtime;
+ m_serverInfoMessageTime = host.realtime;
}
if (maxplayers < 2)
maxplayers = 2;
l = min(l - 1, 37);
memcpy(hostnamebuf, hostname.string, l);
hostnamebuf[l] = 0;
- Cvar_Set("hostname", hostnamebuf);
+ Cvar_Set(&cvars_all, "hostname", hostnamebuf);
}
}
break;
memcpy(hostnamebuf, hostname.string, l);
hostnamebuf[l] = ascii;
hostnamebuf[l+1] = 0;
- Cvar_Set("hostname", hostnamebuf);
+ Cvar_Set(&cvars_all, "hostname", hostnamebuf);
}
}
}
for (n = start;n < end;n++)
{
serverlist_entry_t *entry = ServerList_GetViewEntry(n);
- DrawQ_Fill(menu_x, menu_y + y, 640, 16, n == slist_cursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ DrawQ_Fill(menu_x, menu_y + y, 640, 16, n == slist_cursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
M_PrintColored(0, y, entry->line1);y += 8;
M_PrintColored(0, y, entry->line2);y += 8;
}
}
- else if (realtime - masterquerytime > 10)
+ else if (host.realtime - masterquerytime > 10)
{
if (masterquerycount)
M_Print(0, y, "No servers found");
{
for (n = start;n < end;n++)
{
- DrawQ_Pic(menu_x + 40, menu_y + y, NULL, 360, 8, n == modlist_cursor ? (0.5 + 0.2 * sin(realtime * M_PI)) : 0, 0, 0, 0.5, 0);
+ DrawQ_Pic(menu_x + 40, menu_y + y, NULL, 360, 8, n == modlist_cursor ? (0.5 + 0.2 * sin(host.realtime * M_PI)) : 0, 0, 0, 0.5, 0);
M_ItemPrint(80, y, modlist[n].dir, true);
M_DrawCheckbox(48, y, modlist[n].loaded);
y +=8;
menuplyr_load = true;
menuplyr_pixels = NULL;
- Cmd_AddCommand(&cmd_client, "menu_main", M_Menu_Main_f, "open the main menu");
- Cmd_AddCommand(&cmd_client, "menu_singleplayer", M_Menu_SinglePlayer_f, "open the singleplayer menu");
- Cmd_AddCommand(&cmd_client, "menu_load", M_Menu_Load_f, "open the loadgame menu");
- Cmd_AddCommand(&cmd_client, "menu_save", M_Menu_Save_f, "open the savegame menu");
- Cmd_AddCommand(&cmd_client, "menu_multiplayer", M_Menu_MultiPlayer_f, "open the multiplayer menu");
- Cmd_AddCommand(&cmd_client, "menu_setup", M_Menu_Setup_f, "open the player setup menu");
- Cmd_AddCommand(&cmd_client, "menu_options", M_Menu_Options_f, "open the options menu");
- Cmd_AddCommand(&cmd_client, "menu_options_effects", M_Menu_Options_Effects_f, "open the effects options menu");
- Cmd_AddCommand(&cmd_client, "menu_options_graphics", M_Menu_Options_Graphics_f, "open the graphics options menu");
- Cmd_AddCommand(&cmd_client, "menu_options_colorcontrol", M_Menu_Options_ColorControl_f, "open the color control menu");
- Cmd_AddCommand(&cmd_client, "menu_keys", M_Menu_Keys_f, "open the key binding menu");
- Cmd_AddCommand(&cmd_client, "menu_video", M_Menu_Video_f, "open the video options menu");
- Cmd_AddCommand(&cmd_client, "menu_reset", M_Menu_Reset_f, "open the reset to defaults menu");
- Cmd_AddCommand(&cmd_client, "menu_mods", M_Menu_ModList_f, "open the mods browser menu");
- Cmd_AddCommand(&cmd_client, "help", M_Menu_Help_f, "open the help menu");
- Cmd_AddCommand(&cmd_client, "menu_quit", M_Menu_Quit_f, "open the quit menu");
- Cmd_AddCommand(&cmd_client, "menu_transfusion_episode", M_Menu_Transfusion_Episode_f, "open the transfusion episode select menu");
- Cmd_AddCommand(&cmd_client, "menu_transfusion_skill", M_Menu_Transfusion_Skill_f, "open the transfusion skill select menu");
- Cmd_AddCommand(&cmd_client, "menu_credits", M_Menu_Credits_f, "open the credits menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_main", M_Menu_Main_f, "open the main menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_singleplayer", M_Menu_SinglePlayer_f, "open the singleplayer menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_load", M_Menu_Load_f, "open the loadgame menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_save", M_Menu_Save_f, "open the savegame menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_multiplayer", M_Menu_MultiPlayer_f, "open the multiplayer menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_setup", M_Menu_Setup_f, "open the player setup menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_options", M_Menu_Options_f, "open the options menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_options_effects", M_Menu_Options_Effects_f, "open the effects options menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_options_graphics", M_Menu_Options_Graphics_f, "open the graphics options menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_options_colorcontrol", M_Menu_Options_ColorControl_f, "open the color control menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_keys", M_Menu_Keys_f, "open the key binding menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_video", M_Menu_Video_f, "open the video options menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_reset", M_Menu_Reset_f, "open the reset to defaults menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_mods", M_Menu_ModList_f, "open the mods browser menu");
+ Cmd_AddCommand(CMD_CLIENT, "help", M_Menu_Help_f, "open the help menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_quit", M_Menu_Quit_f, "open the quit menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_transfusion_episode", M_Menu_Transfusion_Episode_f, "open the transfusion episode select menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_transfusion_skill", M_Menu_Transfusion_Skill_f, "open the transfusion skill select menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_credits", M_Menu_Credits_f, "open the credits menu");
}
void M_Draw (void)
int g, scale_x, scale_y, scale_y_repeat, top_offset;
float scale_y_rate;
scale_y_repeat = vid_conheight.integer * 2;
- g = (int)(realtime * 64)%96;
+ g = (int)(host.realtime * 64)%96;
scale_y_rate = (float)(g+1) / 96;
top_offset = (g+12)/12;
p = Draw_CachePic (va(vabuf, sizeof(vabuf), "gfx/menu/blooddrip%i", top_offset));
key_dest = key_game;
// init the normal menu now -> this will also correct the menu router pointers
- MR_SetRouting (TRUE);
+ MR_SetRouting (true);
// reset the active scene, too (to be on the safe side ;))
R_SelectScene( RST_CLIENT );
oldquality = r_refdef.view.quality;
r_refdef.view.quality = 1;
// TODO: this needs to be exposed to R_SetView (or something similar) ASAP [2/5/2008 Andreas]
- r_refdef.scene.time = realtime;
+ r_refdef.scene.time = host.realtime;
+
+ // free memory for resources that are no longer referenced
+ PRVM_GarbageCollection(prog);
// FIXME: this really shouldnt error out lest we have a very broken refdef state...?
// or does it kill the server too?
static void MP_Init (void)
{
prvm_prog_t *prog = MVM_prog;
- PRVM_Prog_Init(prog);
+ PRVM_Prog_Init(prog, &cmd_client);
prog->edictprivate_size = 0; // no private struct used
prog->name = "menu";
prog->ExecuteProgram(prog, PRVM_menufunction(m_init),"m_init() required");
// Once m_init was called, we consider menuqc code fully initialized.
- prog->inittime = realtime;
+ prog->inittime = host.realtime;
}
//============================================================================
{
if(MR_Shutdown)
MR_Shutdown ();
- MR_SetRouting (FALSE);
+ MR_SetRouting (false);
}
static void MR_Restart_f(cmd_state_t *cmd)
MR_ToggleMenu(m);
}
+static qboolean menu_active;
+
+static void MR_Start_f(cmd_state_t *cmd)
+{
+ if(menu_active || cls.state == ca_dedicated)
+ return;
+ MR_Init();
+
+}
+
void MR_Init_Commands(void)
{
// set router console commands
Cvar_RegisterVariable (&forceqmenu);
Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue);
Cvar_RegisterVariable (&menu_progs);
- Cmd_AddCommand(&cmd_client, "menu_restart", MR_Restart_f, "restart menu system (reloads menu.dat)");
- Cmd_AddCommand(&cmd_client, "togglemenu", Call_MR_ToggleMenu_f, "opens or closes menu");
+ Cmd_AddCommand(CMD_CLIENT, "menu_start", MR_Start_f, "initialize the menu system");
+ Cmd_AddCommand(CMD_CLIENT, "menu_restart", MR_Restart_f, "restart menu system (reloads menu.dat)");
+ Cmd_AddCommand(CMD_CLIENT, "togglemenu", Call_MR_ToggleMenu_f, "opens or closes menu");
}
void MR_Init(void)
// the normal quake menu only the first time
// COMMANDLINEOPTION: Client: -useqmenu causes the first time you open the menu to use the quake menu, then reverts to menu.dat (if forceqmenu is 0)
if(COM_CheckParm("-useqmenu"))
- MR_SetRouting (TRUE);
+ MR_SetRouting (true);
else
- MR_SetRouting (FALSE);
+ MR_SetRouting (false);
+ menu_active = true;
}