static void M_DrawPic(float cx, float cy, const char *picname)
{
- DrawQ_Pic(menu_x + cx, menu_y + cy, Draw_CachePic(picname, false), 0, 0, 1, 1, 1, 1, 0);
+ DrawQ_Pic(menu_x + cx, menu_y + cy, Draw_CachePic(picname, true), 0, 0, 1, 1, 1, 1, 0);
}
static unsigned char identityTable[256];
if (gamemode == GAME_TRANSFUSION) {
int y1, y2, y3;
M_Background(640, 480);
- p = Draw_CachePic ("gfx/menu/tb-transfusion", false);
+ p = Draw_CachePic ("gfx/menu/tb-transfusion", true);
M_DrawPic (640/2 - p->width/2, 40, "gfx/menu/tb-transfusion");
y2 = 120;
// 8 rather than MAIN_ITEMS to skip a number and not miss the last option
}
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque");
- p = Draw_CachePic ("gfx/ttl_main", false);
+ p = Draw_CachePic ("gfx/ttl_main", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main");
// Nehahra
if (gamemode == GAME_NEHAHRA)
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque");
- p = Draw_CachePic ("gfx/ttl_sgl", false);
+ p = Draw_CachePic ("gfx/ttl_sgl", true);
// Some mods don't have a single player mode
if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
M_Background(320, 200);
- p = Draw_CachePic ("gfx/p_load", false);
+ p = Draw_CachePic ("gfx/p_load", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load" );
for (i=0 ; i< MAX_SAVEGAMES; i++)
M_Background(320, 200);
- p = Draw_CachePic ("gfx/p_save", false);
+ p = Draw_CachePic ("gfx/p_save", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save");
for (i=0 ; i<MAX_SAVEGAMES ; i++)
cachepic_t *p;
M_Background(640, 480);
- p = Draw_CachePic ("gfx/menu/tb-episodes", false);
+ p = Draw_CachePic ("gfx/menu/tb-episodes", true);
M_DrawPic (640/2 - p->width/2, 40, "gfx/menu/tb-episodes");
for (y = 0; y < EPISODE_ITEMS; y++){
M_DrawPic (0, 160 + y * 40, va("gfx/menu/episode%i", y+1));
cachepic_t *p;
M_Background(640, 480);
- p = Draw_CachePic ("gfx/menu/tb-difficulty", false);
+ p = Draw_CachePic ("gfx/menu/tb-difficulty", true);
M_DrawPic(640/2 - p->width/2, 40, "gfx/menu/tb-difficulty");
for (y = 0; y < SKILL_ITEMS; y++)
if (gamemode == GAME_TRANSFUSION)
{
M_Background(640, 480);
- p = Draw_CachePic ("gfx/menu/tb-online", false);
+ p = Draw_CachePic ("gfx/menu/tb-online", true);
M_DrawPic (640/2 - p->width/2, 140, "gfx/menu/tb-online");
for (f = 1; f <= MULTIPLAYER_ITEMS; f++)
M_DrawPic (0, 180 + f*40, va("gfx/menu/online%i", f));
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque");
- p = Draw_CachePic ("gfx/p_multi", false);
+ p = Draw_CachePic ("gfx/p_multi", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi");
M_DrawPic (72, 32, "gfx/mp_menu");
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque");
- p = Draw_CachePic ("gfx/p_multi", false);
+ p = Draw_CachePic ("gfx/p_multi", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi");
M_Print(64, 40, "Your name");
menuplyr_width = image_width;
menuplyr_height = image_height;
Mem_Free(f);
- menuplyr_pixels = (unsigned char *)Mem_Alloc(cls.mempool, menuplyr_width * menuplyr_height);
- menuplyr_translated = (unsigned int *)Mem_Alloc(cls.mempool, menuplyr_width * menuplyr_height * 4);
+ menuplyr_pixels = (unsigned char *)Mem_Alloc(cls.permanentmempool, menuplyr_width * menuplyr_height);
+ menuplyr_translated = (unsigned int *)Mem_Alloc(cls.permanentmempool, menuplyr_width * menuplyr_height * 4);
memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
Mem_Free(data);
}
Cvar_SetValueQuick (&vid_conwidth, bound(320, vid_conwidth.value + dir * 64, 2048));
else if (options_cursor == optnum++)
Cvar_SetValueQuick (&vid_conheight, bound(240, vid_conheight.value + dir * 48, 1536));
- else if (options_cursor == optnum++)
- Cvar_SetValueQuick (&scr_conspeed, bound(0, scr_conspeed.value + dir * 100, 1000));
else if (options_cursor == optnum++)
Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1));
else if (options_cursor == optnum++)
else if (options_cursor == optnum++)
Cvar_SetValueQuick (&scr_screenshot_jpeg_quality, bound(0, scr_screenshot_jpeg_quality.value + dir * 0.1, 1));
else if (options_cursor == optnum++)
- Cvar_SetValueQuick (&scr_screenshot_gamma, bound(0.1, scr_screenshot_gamma.value + dir * 0.1, 4));
+ Cvar_SetValueQuick (&scr_screenshot_gammaboost, bound(0.1, scr_screenshot_gammaboost.value + dir * 0.1, 4));
else if (options_cursor == optnum++)
Cvar_SetValueQuick (&r_sky, !r_sky.integer);
else if (options_cursor == optnum++)
M_Background(320, bound(200, 32 + OPTIONS_ITEMS * 8, vid_conheight.integer));
M_DrawPic(16, 4, "gfx/qplaque");
- p = Draw_CachePic("gfx/p_option", false);
+ p = Draw_CachePic("gfx/p_option", true);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
optnum = 0;
optcursor = options_cursor;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_ITEMS - visible)) * 8;
M_Options_PrintCommand( "Customize controls", true);
M_Options_PrintCommand( " Color Control", true);
M_Options_PrintSlider( " 2D Screen Width ", true, vid_conwidth.value, 320, 2048);
M_Options_PrintSlider( " 2D Screen Height", true, vid_conheight.value, 240, 1536);
- M_Options_PrintSlider( " Console Speed", true, scr_conspeed.value, 0, 1000);
M_Options_PrintSlider( " Console Alpha", true, scr_conalpha.value, 0, 1);
M_Options_PrintSlider( "Conback Brightness", true, scr_conbrightness.value, 0, 1);
M_Options_PrintSlider( " Sbar Alpha BG", true, sbar_alpha_bg.value, 0, 1);
M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
M_Options_PrintCheckbox(" JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer);
M_Options_PrintSlider( " JPEG quality", jpeg_dll != NULL, scr_screenshot_jpeg_quality.value, 0, 1);
- M_Options_PrintSlider( " Screenshot Gamma", jpeg_dll != NULL, scr_screenshot_gamma.value, 0.1, 4);
+ M_Options_PrintSlider( " Screenshot Gamma", jpeg_dll != NULL, scr_screenshot_gammaboost.value, 0.1, 4);
M_Options_PrintCheckbox(" Sky", true, r_sky.integer);
M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer);
M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy);
M_Background(320, bound(200, 32 + OPTIONS_EFFECTS_ITEMS * 8, vid_conheight.integer));
M_DrawPic(16, 4, "gfx/qplaque");
- p = Draw_CachePic("gfx/p_option", false);
+ p = Draw_CachePic("gfx/p_option", true);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
optcursor = options_effects_cursor;
optnum = 0;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_EFFECTS_ITEMS - visible)) * 8;
M_Options_PrintSlider( " Corona Intensity", true, r_coronas.value, 0, 4);
M_Background(320, bound(200, 32 + OPTIONS_GRAPHICS_ITEMS * 8, vid_conheight.integer));
M_DrawPic(16, 4, "gfx/qplaque");
- p = Draw_CachePic("gfx/p_option", false);
+ p = Draw_CachePic("gfx/p_option", true);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
optcursor = options_graphics_cursor;
optnum = 0;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
M_Options_PrintSlider( " Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
float x, c, s, t, u, v;
cachepic_t *p, *dither;
- dither = Draw_CachePic("gfx/colorcontrol/ditherpattern", false);
+ dither = Draw_CachePic("gfx/colorcontrol/ditherpattern", true);
M_Background(320, 256);
M_DrawPic(16, 4, "gfx/qplaque");
- p = Draw_CachePic("gfx/p_option", false);
+ p = Draw_CachePic("gfx/p_option", true);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
optcursor = options_colorcontrol_cursor;
optnum = 0;
- visible = (menu_height - 32) / 8;
+ visible = (int)((menu_height - 32) / 8);
opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8;
M_Options_PrintCommand( " Reset to defaults", true);
M_Background(320, 48 + 8 * numcommands);
- p = Draw_CachePic ("gfx/ttl_cstm", false);
+ p = Draw_CachePic ("gfx/ttl_cstm", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm");
if (bind_grab)
M_Background(320, 200);
M_DrawPic(16, 4, "gfx/qplaque");
- p = Draw_CachePic("gfx/vidmodes", false);
+ p = Draw_CachePic("gfx/vidmodes", true);
M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes");
// Current Resolution
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque");
- p = Draw_CachePic ("gfx/p_multi", false);
+ p = Draw_CachePic ("gfx/p_multi", true);
basex = (320-p->width)/2;
M_DrawPic (basex, 4, "gfx/p_multi");
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque");
- p = Draw_CachePic ("gfx/p_multi", false);
+ p = Draw_CachePic ("gfx/p_multi", true);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi");
M_DrawTextBox (152, 32, 10, 1);
if (*m_return_reason)
M_Print(16, menu_height - 8, m_return_reason);
y = 48;
- visible = (menu_height - 16 - y) / 8 / 2;
+ visible = (int)((menu_height - 16 - y) / 8 / 2);
start = bound(0, slist_cursor - (visible >> 1), serverlist_viewcount - visible);
end = min(start + visible, serverlist_viewcount);
- p = Draw_CachePic("gfx/p_multi", false);
+ p = Draw_CachePic("gfx/p_multi", true);
M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi");
if (end > start)
{
//=============================================================================
/* Menu Subsystem */
-static void M_Keydown(int key, char ascii);
+static void M_KeyEvent(int key, char ascii, qboolean downevent);
static void M_Draw(void);
void M_ToggleMenu_f(void);
static void M_Shutdown(void);
g = (int)(realtime * 64)%96;
scale_y_rate = (float)(g+1) / 96;
top_offset = (g+12)/12;
- p = Draw_CachePic (va("gfx/menu/blooddrip%i", top_offset), false);
- drop1 = Draw_CachePic("gfx/menu/blooddrop1", false);
- drop2 = Draw_CachePic("gfx/menu/blooddrop2", false);
- drop3 = Draw_CachePic("gfx/menu/blooddrop3", false);
+ p = Draw_CachePic (va("gfx/menu/blooddrip%i", top_offset), true);
+ drop1 = Draw_CachePic("gfx/menu/blooddrop1", true);
+ drop2 = Draw_CachePic("gfx/menu/blooddrop2", true);
+ drop3 = Draw_CachePic("gfx/menu/blooddrop3", true);
for (scale_x = 0; scale_x <= vid_conwidth.integer; scale_x += p->width) {
for (scale_y = -scale_y_repeat; scale_y <= vid_conheight.integer; scale_y += scale_y_repeat) {
DrawQ_Pic (scale_x + 21, scale_y_repeat * .5 + scale_y + scale_y_rate * scale_y_repeat, drop3, 0, 0, 1, 1, 1, 1, 0);
DrawQ_Pic (scale_x + 557, scale_y_repeat * .9425 + scale_y + scale_y_rate * scale_y_repeat, drop1, 0, 0, 1, 1, 1, 1, 0);
DrawQ_Pic (scale_x + 606, scale_y_repeat * .5 + scale_y + scale_y_rate * scale_y_repeat, drop2, 0, 0, 1, 1, 1, 1, 0);
}
- DrawQ_Pic (scale_x, -1, Draw_CachePic(va("gfx/menu/blooddrip%i", top_offset), false), 0, 0, 1, 1, 1, 1, 0);
+ DrawQ_Pic (scale_x, -1, Draw_CachePic(va("gfx/menu/blooddrip%i", top_offset), true), 0, 0, 1, 1, 1, 1, 0);
}
}
}
}
-void M_Keydown (int key, char ascii)
+void M_KeyEvent (int key, char ascii, qboolean downevent)
{
+ if (!downevent)
+ return;
switch (m_state)
{
case m_none:
#define M_F_INIT "m_init"
#define M_F_KEYDOWN "m_keydown"
+#define M_F_KEYUP "m_keyup"
#define M_F_DRAW "m_draw"
// normal menu names (rest)
#define M_F_TOGGLE "m_toggle"
static int m_numrequiredfunc = sizeof(m_required_func) / sizeof(char*);
static func_t m_draw, m_keydown;
+static mfunction_t *m_keyup;
void MR_SetRouting (qboolean forceold);
Host_AbortCurrentFrame();
}
-void MP_Keydown (int key, char ascii)
+void MP_KeyEvent (int key, char ascii, qboolean downevent)
{
PRVM_Begin;
PRVM_SetProg(PRVM_MENUPROG);
// pass key
prog->globals.generic[OFS_PARM0] = (float) key;
prog->globals.generic[OFS_PARM1] = (float) ascii;
- PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
+ if (downevent)
+ PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
+ else if (m_keyup)
+ PRVM_ExecuteProgram((func_t)(m_keyup - prog->functions), M_F_KEYUP"(float key, float ascii) required\n");
PRVM_End;
}
// set m_draw and m_keydown
m_draw = (func_t) (PRVM_ED_FindFunction(M_F_DRAW) - prog->functions);
m_keydown = (func_t) (PRVM_ED_FindFunction(M_F_KEYDOWN) - prog->functions);
+ m_keyup = PRVM_ED_FindFunction(M_F_KEYUP);
#ifdef NG_MENU
m_displayed = false;
static cvar_t forceqmenu = { 0, "forceqmenu", "0", "enables the quake menu instead of the quakec menu.dat (if present)" };
-void (*MR_Keydown) (int key, char ascii);
+void (*MR_KeyEvent) (int key, char ascii, qboolean downevent);
void (*MR_Draw) (void);
void (*MR_ToggleMenu_f) (void);
void (*MR_Shutdown) (void);
if(!FS_FileExists(M_PROG_FILENAME) || forceqmenu.integer || forceold)
{
// set menu router function pointers
- MR_Keydown = M_Keydown;
+ MR_KeyEvent = M_KeyEvent;
MR_Draw = M_Draw;
MR_ToggleMenu_f = M_ToggleMenu_f;
MR_Shutdown = M_Shutdown;
else
{
// set menu router function pointers
- MR_Keydown = MP_Keydown;
+ MR_KeyEvent = MP_KeyEvent;
MR_Draw = MP_Draw;
MR_ToggleMenu_f = MP_ToggleMenu_f;
MR_Shutdown = MP_Shutdown;