Added slider to advanced video menu for cel shading width.

This commit is contained in:
Knightmare66 2020-02-25 02:53:01 -05:00
parent 1be86ec1b2
commit f9688191e1
4 changed files with 23 additions and 24 deletions

View file

@ -2105,14 +2105,12 @@ void CL_DrawLayoutString (char *string, int x, int y, int centerwidth, int xor,
if (xor)
{ // Knightmare- text color hack
// Com_sprintf (line, sizeof(line), S_COLOR_ALT"%s", line);
// Hud_DrawStringAlt(x, y, line, 255, isStatusBar);
len = (int)strlen(line);
for (i=0; i<len; i++) {
line[i] ^= xor;
}
}
// else
Hud_DrawString(x, y, line, 255, isStatusBar);
Hud_DrawString(x, y, line, 255, isStatusBar);
if (*string)
{
@ -2237,7 +2235,6 @@ void SCR_ExecuteLayoutString (char *s, qboolean isStatusBar)
int x, y;
int value;
char *token;
// char string[1024];
int width;
int index;
clientinfo_t *ci;
@ -2564,8 +2561,6 @@ void SCR_ExecuteLayoutString (char *s, qboolean isStatusBar)
if (!strcmp(token, "string2"))
{
token = COM_Parse (&s);
// Com_sprintf (string, sizeof(string), S_COLOR_ALT"%s", token);
// Hud_DrawStringAlt (x, y, string, 255, isStatusBar);
Hud_DrawStringAlt (x, y, token, 255, isStatusBar);
continue;
}

View file

@ -242,26 +242,11 @@ void DrawStringGeneric (int x, int y, const char *string, int alpha, textscalety
case SCALETYPE_HUD:
textSize = scaledHud(HUD_FONT_SIZE);
textScale = HudScale();
// hack for alternate text color
/* if (altBit) {
if (!modified) {
character ^= 0x80;
if (character & 128)
TextColor((int)alt_text_color->value, &red, &green, &blue);
}
}
else {
if (!modified && (character & 128))
TextColor((int)alt_text_color->value, &red, &green, &blue);
}*/
break;
case SCALETYPE_CONSOLE:
default:
textSize = FONT_SIZE;
textScale = FONT_SIZE/8.0f;
// hack for alternate text color
// if (!modified && (character & 128))
// TextColor((int)alt_text_color->value, &red, &green, &blue);
break;
}
@ -271,6 +256,6 @@ void DrawStringGeneric (int x, int y, const char *string, int alpha, textscalety
R_DrawChar( ( x + (j-1)*textSize+textSize/4 ), y+(textSize/8),
character, textScale, 0, 0, 0, alpha, italic, false );
R_DrawChar( ( x + (j-1)*textSize ), y,
character, textScale, red, green, blue, alpha, italic, flushChar ); // (i==(len-1)) );
character, textScale, red, green, blue, alpha, italic, flushChar );
}
}

View file

@ -127,6 +127,7 @@ static void ResetVideoDefaults ( void *unused )
Cvar_SetToDefault ("r_stencilTwoSide");
Cvar_SetToDefault ("r_shelltype");
Cvar_SetToDefault ("r_celshading");
Cvar_SetToDefault ("r_celshading_width");
// Cvar_SetToDefault ("r_screenshot_jpeg");
Cvar_SetToDefault ("r_screenshot_format");
Cvar_SetToDefault ("r_screenshot_jpeg_quality");

View file

@ -57,6 +57,7 @@ static menulist_s s_shadows_box;
static menulist_s s_two_side_stencil_box;
static menulist_s s_ent_shell_box;
static menulist_s s_celshading_box;
static menuslider_s s_celshading_width_slider;
static menulist_s s_glass_envmap_box;
//static menulist_s s_screenshotjpeg_box;
static menulist_s s_screenshotformat_box;
@ -71,10 +72,10 @@ static void Video_Advanced_MenuSetValues ( void )
char *sshotformat;
Cvar_SetValue( "r_modulate", ClampCvar( 1, 2, Cvar_VariableValue("r_modulate") ) );
s_lightmapscale_slider.curvalue = (Cvar_VariableValue("r_modulate") -1) * 10;
s_lightmapscale_slider.curvalue = (Cvar_VariableValue("r_modulate") - 1) * 10;
Cvar_SetValue( "r_intensity", ClampCvar( 1, 2, Cvar_VariableValue("r_intensity") ) );
s_textureintensity_slider.curvalue = (Cvar_VariableValue("r_intensity") -1) * 10;
s_textureintensity_slider.curvalue = (Cvar_VariableValue("r_intensity") - 1) * 10;
Cvar_SetValue( "r_rgbscale", ClampCvar( 1, 2, Cvar_VariableValue("r_rgbscale") ) );
if (Cvar_VariableValue("r_rgbscale") == 1)
@ -127,6 +128,9 @@ static void Video_Advanced_MenuSetValues ( void )
Cvar_SetValue( "r_celshading", ClampCvar( 0, 1, Cvar_VariableValue("r_celshading") ) );
s_celshading_box.curvalue = Cvar_VariableValue("r_celshading");
Cvar_SetValue( "r_celshading_width", ClampCvar( 1, 12, Cvar_VariableValue("r_celshading_width") ) );
s_celshading_width_slider.curvalue = Cvar_VariableValue("r_celshading_width") - 1;
// Cvar_SetValue( "r_screenshot_jpeg", ClampCvar( 0, 1, Cvar_VariableValue("r_screenshot_jpeg") ) );
// s_screenshotjpeg_box.curvalue = Cvar_VariableValue("r_screenshot_jpeg");
@ -235,6 +239,10 @@ static void CelShadingCallback ( void *unused )
Cvar_SetValue( "r_celshading", s_celshading_box.curvalue);
}
static void CelShadingWidthCallback ( void *unused )
{
Cvar_SetValue( "r_celshading_width", s_celshading_width_slider.curvalue + 1);
}
/*
static void JPEGScreenshotCallback ( void *unused )
{
@ -500,6 +508,15 @@ void Menu_Video_Advanced_Init (void)
s_celshading_box.itemnames = yesno_names;
s_celshading_box.generic.statusbar = "cartoon-style rendering of models";
s_celshading_width_slider.generic.type = MTYPE_SLIDER;
s_celshading_width_slider.generic.x = 0;
s_celshading_width_slider.generic.y = y += MENU_LINE_SIZE;
s_celshading_width_slider.generic.name = "cel shading width";
s_celshading_width_slider.generic.callback = CelShadingWidthCallback;
s_celshading_width_slider.minvalue = 0;
s_celshading_width_slider.maxvalue = 11;
s_celshading_width_slider.generic.statusbar = "width of cel shading outlines";
/*
s_screenshotjpeg_box.generic.type = MTYPE_SPINCONTROL;
s_screenshotjpeg_box.generic.x = 0;
@ -568,6 +585,7 @@ void Menu_Video_Advanced_Init (void)
Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_two_side_stencil_box );
Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_ent_shell_box );
Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_celshading_box );
Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_celshading_width_slider );
// Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_screenshotjpeg_box );
Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_screenshotformat_box );
Menu_AddItem( &s_video_advanced_menu, ( void * ) &s_screenshotjpegquality_slider );