mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 07:22:28 +00:00
Merge branch 'nohw-renderswitch' into 'master'
NOHW V.S. Renderer Switching See merge request STJr/SRB2!609
This commit is contained in:
commit
e9843590da
5 changed files with 46 additions and 9 deletions
|
@ -842,7 +842,9 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_fullscreen);
|
||||
CV_RegisterVar(&cv_renderview);
|
||||
CV_RegisterVar(&cv_renderer);
|
||||
#ifdef HWRENDER
|
||||
CV_RegisterVar(&cv_newrenderer);
|
||||
#endif
|
||||
CV_RegisterVar(&cv_scr_depth);
|
||||
CV_RegisterVar(&cv_scr_width);
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
|
31
src/m_menu.c
31
src/m_menu.c
|
@ -389,7 +389,9 @@ static void M_ResetCvars(void);
|
|||
|
||||
// Consvar onchange functions
|
||||
static void Newgametype_OnChange(void);
|
||||
#ifdef HWRENDER
|
||||
static void Newrenderer_OnChange(void);
|
||||
#endif
|
||||
static void Dummymares_OnChange(void);
|
||||
|
||||
// ==========================================================================
|
||||
|
@ -414,8 +416,10 @@ CV_PossibleValue_t gametype_cons_t[NUMGAMETYPES+1];
|
|||
|
||||
consvar_t cv_newgametype = {"newgametype", "Co-op", CV_HIDEN|CV_CALL, gametype_cons_t, Newgametype_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
#ifdef HWRENDER
|
||||
consvar_t cv_newrenderer = {"newrenderer", "Software", CV_HIDEN|CV_CALL, cv_renderer_t, Newrenderer_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
static int newrenderer_set = 1;/* Software doesn't need confirmation! */
|
||||
#endif
|
||||
|
||||
static CV_PossibleValue_t serversort_cons_t[] = {
|
||||
{0,"Ping"},
|
||||
|
@ -1216,7 +1220,11 @@ static menuitem_t OP_VideoOptionsMenu[] =
|
|||
{IT_STRING|IT_CVAR, NULL, "Fullscreen", &cv_fullscreen, 11},
|
||||
#endif
|
||||
{IT_STRING | IT_CVAR, NULL, "Vertical Sync", &cv_vidwait, 16},
|
||||
#ifdef HWRENDER
|
||||
{IT_STRING | IT_CVAR, NULL, "Renderer", &cv_newrenderer, 21},
|
||||
#else
|
||||
{IT_TRANSTEXT | IT_PAIR, "Renderer", "Software", &cv_renderer, 21},
|
||||
#endif
|
||||
|
||||
{IT_HEADER, NULL, "Color Profile", NULL, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Brightness (F11)", &cv_globalgamma,36},
|
||||
|
@ -2229,6 +2237,7 @@ static void Newgametype_OnChange(void)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
static void Newrenderer_AREYOUSURE(INT32 c)
|
||||
{
|
||||
int n;
|
||||
|
@ -2266,6 +2275,7 @@ static void Newrenderer_OnChange(void)
|
|||
);
|
||||
}
|
||||
}
|
||||
#endif/*HWRENDER*/
|
||||
|
||||
void Screenshot_option_Onchange(void)
|
||||
{
|
||||
|
@ -2973,7 +2983,7 @@ static void M_NextOpt(void)
|
|||
itemOn = 0;
|
||||
else
|
||||
itemOn++;
|
||||
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
|
||||
} while (oldItemOn != itemOn && ( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ));
|
||||
}
|
||||
|
||||
static void M_PrevOpt(void)
|
||||
|
@ -2985,7 +2995,7 @@ static void M_PrevOpt(void)
|
|||
itemOn = currentMenu->numitems - 1;
|
||||
else
|
||||
itemOn--;
|
||||
} while (oldItemOn != itemOn && (currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE);
|
||||
} while (oldItemOn != itemOn && ( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ));
|
||||
}
|
||||
|
||||
// lock out further input in a tic when important buttons are pressed
|
||||
|
@ -3619,11 +3629,11 @@ void M_SetupNextMenu(menu_t *menudef)
|
|||
|
||||
// the curent item can be disabled,
|
||||
// this code go up until an enabled item found
|
||||
if ((currentMenu->menuitems[itemOn].status & IT_TYPE) == IT_SPACE)
|
||||
if (( (currentMenu->menuitems[itemOn].status & IT_TYPE) & IT_SPACE ))
|
||||
{
|
||||
for (i = 0; i < currentMenu->numitems; i++)
|
||||
{
|
||||
if ((currentMenu->menuitems[i].status & IT_TYPE) != IT_SPACE)
|
||||
if (!( (currentMenu->menuitems[i].status & IT_TYPE) & IT_SPACE ))
|
||||
{
|
||||
itemOn = i;
|
||||
break;
|
||||
|
@ -4306,7 +4316,18 @@ static void M_DrawGenericScrollMenu(void)
|
|||
}
|
||||
break;
|
||||
case IT_TRANSTEXT:
|
||||
V_DrawString(x, y, V_TRANSLUCENT, currentMenu->menuitems[i].text);
|
||||
switch (currentMenu->menuitems[i].status & IT_TYPE)
|
||||
{
|
||||
case IT_PAIR:
|
||||
V_DrawString(x, y,
|
||||
V_TRANSLUCENT, currentMenu->menuitems[i].patch);
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH - x, y,
|
||||
V_TRANSLUCENT, currentMenu->menuitems[i].text);
|
||||
break;
|
||||
default:
|
||||
V_DrawString(x, y,
|
||||
V_TRANSLUCENT, currentMenu->menuitems[i].text);
|
||||
}
|
||||
break;
|
||||
case IT_QUESTIONMARKS:
|
||||
V_DrawString(x, y, V_TRANSLUCENT|V_OLDSPACING, M_CreateSecretMenuOption(currentMenu->menuitems[i].text));
|
||||
|
|
|
@ -222,13 +222,14 @@ boolean M_CanShowLevelInList(INT32 mapnum, INT32 gt);
|
|||
|
||||
// flags for items in the menu
|
||||
// menu handle (what we do when key is pressed
|
||||
#define IT_TYPE 14 // (2+4+8)
|
||||
#define IT_TYPE 15 // (1+2+4+8)
|
||||
#define IT_CALL 0 // call the function
|
||||
#define IT_SPACE 1 // no handling
|
||||
#define IT_ARROWS 2 // call function with 0 for left arrow and 1 for right arrow in param
|
||||
#define IT_KEYHANDLER 4 // call with the key in param
|
||||
#define IT_SUBMENU 6 // go to sub menu
|
||||
#define IT_CVAR 8 // handle as a cvar
|
||||
#define IT_SPACE 10 // no handling
|
||||
#define IT_PAIR 11 // no handling, define both sides of text
|
||||
#define IT_MSGHANDLER 12 // same as key but with event and sometime can handle y/n key (special for message)
|
||||
|
||||
#define IT_DISPLAY (48+64+128) // 16+32+64+128
|
||||
|
|
15
src/screen.c
15
src/screen.c
|
@ -64,7 +64,13 @@ consvar_t cv_scr_depth = {"scr_depth", "16 bits", CV_SAVE, scr_depth_cons_t, NUL
|
|||
consvar_t cv_renderview = {"renderview", "On", 0, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void SCR_ActuallyChangeRenderer(void);
|
||||
CV_PossibleValue_t cv_renderer_t[] = {{1, "Software"}, {2, "OpenGL"}, {0, NULL}};
|
||||
CV_PossibleValue_t cv_renderer_t[] = {
|
||||
{1, "Software"},
|
||||
#ifdef HWRENDER
|
||||
{2, "OpenGL"},
|
||||
#endif
|
||||
{0, NULL}
|
||||
};
|
||||
consvar_t cv_renderer = {"renderer", "Software", CV_SAVE|CV_NOLUA|CV_CALL, cv_renderer_t, SCR_ChangeRenderer, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void SCR_ChangeFullscreen(void);
|
||||
|
@ -454,9 +460,12 @@ void SCR_ChangeRenderer(void)
|
|||
if (con_startup)
|
||||
{
|
||||
target_renderer = cv_renderer.value;
|
||||
#ifdef HWRENDER
|
||||
if (M_CheckParm("-opengl"))
|
||||
target_renderer = rendermode = render_opengl;
|
||||
else if (M_CheckParm("-software"))
|
||||
else
|
||||
#endif
|
||||
if (M_CheckParm("-software"))
|
||||
target_renderer = rendermode = render_soft;
|
||||
// set cv_renderer back
|
||||
SCR_ChangeRendererCVars(rendermode);
|
||||
|
@ -477,7 +486,9 @@ void SCR_ChangeRendererCVars(INT32 mode)
|
|||
CV_StealthSetValue(&cv_renderer, 1);
|
||||
else if (mode == render_opengl)
|
||||
CV_StealthSetValue(&cv_renderer, 2);
|
||||
#ifdef HWRENDER
|
||||
CV_StealthSetValue(&cv_newrenderer, cv_renderer.value);
|
||||
#endif
|
||||
}
|
||||
|
||||
boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||
|
|
|
@ -184,7 +184,9 @@ extern UINT8 *scr_borderpatch; // patch used to fill the view borders
|
|||
extern CV_PossibleValue_t cv_renderer_t[];
|
||||
|
||||
extern consvar_t cv_scr_width, cv_scr_height, cv_scr_depth, cv_renderview, cv_renderer, cv_fullscreen;
|
||||
#ifdef HWRENDER
|
||||
extern consvar_t cv_newrenderer;
|
||||
#endif
|
||||
// wait for page flipping to end or not
|
||||
extern consvar_t cv_vidwait;
|
||||
|
||||
|
|
Loading…
Reference in a new issue