mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-14 16:01:44 +00:00
gl_vidsdl.c: comment out the rest of vid_refreshrate usage which isn't supported.
(VID_SetMode): check whether SDL_SetVideoMode() actually succeeded. otherwise we just segfault. noticed by Sander. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@530 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
5926d9a2e3
commit
65d248f750
1 changed files with 41 additions and 46 deletions
|
@ -20,7 +20,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
// gl_vidnt.c -- NT GL vid component
|
||||
// gl_vidsdl.c -- SDL GL vid component
|
||||
|
||||
#include "quakedef.h"
|
||||
#include "bgmusic.h"
|
||||
|
@ -138,7 +138,7 @@ cvar_t vid_fullscreen = {"vid_fullscreen", "0", true}; // QuakeSpasm, was "1"
|
|||
cvar_t vid_width = {"vid_width", "800", true}; // QuakeSpasm, was 640
|
||||
cvar_t vid_height = {"vid_height", "600", true}; // QuakeSpasm, was 480
|
||||
cvar_t vid_bpp = {"vid_bpp", "16", true};
|
||||
cvar_t vid_refreshrate = {"vid_refreshrate", "60", true};
|
||||
//cvar_t vid_refreshrate = {"vid_refreshrate", "60", true};
|
||||
cvar_t vid_vsync = {"vid_vsync", "0", true};
|
||||
//johnfitz
|
||||
|
||||
|
@ -244,7 +244,6 @@ VID_SetMode
|
|||
int VID_SetMode (int modenum)
|
||||
{
|
||||
int temp;
|
||||
qboolean stat = false;
|
||||
Uint32 flags = SDL_DEFAULT_FLAGS;
|
||||
char caption[50];
|
||||
|
||||
|
@ -285,17 +284,14 @@ int VID_SetMode (int modenum)
|
|||
draw_context = SDL_SetVideoMode(modelist[modenum].width,
|
||||
modelist[modenum].height,
|
||||
modelist[modenum].bpp, flags);
|
||||
stat = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
draw_context = SDL_SetVideoMode(modelist[modenum].width,
|
||||
modelist[modenum].height,
|
||||
modelist[modenum].bpp, flags);
|
||||
stat = true;
|
||||
}
|
||||
modestate = MODE_WINDOWED;
|
||||
// TODO set icon and title
|
||||
}
|
||||
else if (modelist[modenum].type == MODE_FULLSCREEN_DEFAULT)
|
||||
{
|
||||
|
@ -303,7 +299,6 @@ int VID_SetMode (int modenum)
|
|||
draw_context = SDL_SetVideoMode(modelist[modenum].width,
|
||||
modelist[modenum].height,
|
||||
modelist[modenum].bpp, flags);
|
||||
stat = true;
|
||||
modestate = MODE_FULLSCREEN_DEFAULT;
|
||||
}
|
||||
else
|
||||
|
@ -311,12 +306,11 @@ int VID_SetMode (int modenum)
|
|||
Sys_Error ("VID_SetMode: Bad mode type in modelist");
|
||||
}
|
||||
|
||||
if (!stat)
|
||||
if (!draw_context)
|
||||
{
|
||||
Sys_Error ("Couldn't set video mode");
|
||||
}
|
||||
|
||||
//kristian -- set window caption
|
||||
sprintf(caption, "QuakeSpasm %1.2f.%d", (float)FITZQUAKE_VERSION, QUAKESPASM_VER_PATCH);
|
||||
SDL_WM_SetCaption(caption, caption);
|
||||
|
||||
|
@ -391,11 +385,10 @@ void VID_Restart (void)
|
|||
|
||||
if (i == nummodes)
|
||||
{
|
||||
Con_Printf ("%dx%dx%d %dHz is not a valid fullscreen mode\n",
|
||||
Con_Printf ("%dx%dx%d is not a valid fullscreen mode\n",
|
||||
(int)vid_width.value,
|
||||
(int)vid_height.value,
|
||||
(int)vid_bpp.value,
|
||||
(int)vid_refreshrate.value);
|
||||
(int)vid_bpp.value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -988,12 +981,13 @@ void VID_DescribeModes_f (void)
|
|||
{
|
||||
int i, lnummodes, t;
|
||||
vmode_t *pv;
|
||||
int lastwidth=0, lastheight=0, lastbpp=0, count=0;
|
||||
int lastwidth, lastheight, lastbpp, count;
|
||||
|
||||
lnummodes = VID_NumModes ();
|
||||
|
||||
t = leavecurrentmode;
|
||||
leavecurrentmode = 0;
|
||||
lastwidth = lastheight = lastbpp = count = 0;
|
||||
|
||||
for (i = 1; i < lnummodes; i++)
|
||||
{
|
||||
|
@ -1858,3 +1852,4 @@ void VID_Menu_f (void)
|
|||
//set up bpp and rate lists based on current cvars
|
||||
VID_Menu_RebuildBppList ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue