Merge branch 'master' into alias4

This commit is contained in:
Eric Wasylishen 2014-10-23 20:00:27 -06:00
commit ac6a728b23
14 changed files with 104 additions and 43 deletions

View file

@ -4,7 +4,7 @@
<toc>
<verb></verb>
<em>Page last edited Oct. 11, 2014</em>
<em>Page last edited Oct. 17, 2014</em>
<sect> About <p>
@ -72,7 +72,7 @@ Compile time options include
<item><bf>make DO_USERDIRS=1</bf> to include user directories support
<item><bf>make DEBUG=1</bf> for debugging
<item><bf>make SDL_CONFIG=</bf><em>/PATH/TO/SDL-CONFIG</em> for unusual SDL installations
<item><bf>make USE_SDL2=1</bf> to compile against SDL2 instead of SDL1.2
<item><bf>make USE_SDL2=1</bf> to compile against SDL2 instead of SDL-1.2
</itemize>
<p>Streaming music playback requires "libmad" or "libmpg123" for MP3, and "libogg" and "libvorbis" for OGG files.
<p>The project can also be built with Codeblocks (project files included).</p>
@ -104,15 +104,13 @@ these patched libSDL binaries may help.
OS X has a well known gamma issue where the screen turns dark, but we currently have no fix.
</p>
<p>
High-DPI displays on Windows can break Quakespasm. As a workaround, right-click the quakespasm exe, go to Properties, the Compatibility tab, and check "Disable display scaling on high DPI settings".
</p>
<p>
The "game" command doesn't execute quake.rc in the new game directory being switched to. This means any custom key bindings in a mod's config.cfg or special settings in a quake.rc won't be loaded. The only workaround is launching the engine with the -game command-line switch instead of using the game console command. Or, after running the game command, you can run "exec quake.rc" by yourself (YMMV).
</p>
<sect> Changes<p>
<sect1> Changes in 0.90.0<p>
<itemize>
<item> Fix issues on Windows systems with DPI scaling.</item>
<item> Unix/Mac user directories support. Disabled by default, 'make DO_USERDIRS=1' to enable it.
<item> SDL2 support. Disabled by default, 'make USE_SDL2=1' to enable it.
<item> Revised keyboard input code.

View file

@ -504,7 +504,7 @@ int CDAudio_Init(void)
export_cddev_arg();
if (SDL_InitSubSystem(SDL_INIT_CDROM) == -1)
if (SDL_InitSubSystem(SDL_INIT_CDROM) < 0)
{
Con_Printf("Couldn't init SDL cdrom: %s\n", SDL_GetError());
return -1;

View file

@ -107,14 +107,15 @@ void Con_ToggleConsole_f (void)
{
if (key_dest == key_console/* || (key_dest == key_game && con_forcedup)*/)
{
key_lines[edit_line][1] = 0; // clear any typing
key_linepos = 1;
con_backscroll = 0; //johnfitz -- toggleconsole should return you to the bottom of the scrollback
history_line = edit_line; //johnfitz -- it should also return you to the bottom of the command history
if (cls.state == ca_connected)
{
IN_Activate();
key_dest = key_game;
key_lines[edit_line][1] = 0; // clear any typing
key_linepos = 1;
con_backscroll = 0; //johnfitz -- toggleconsole should return you to the bottom of the scrollback
history_line = edit_line; //johnfitz -- it should also return you to the bottom of the command history
}
else
{

View file

@ -444,10 +444,6 @@ void R_SetupView (void)
else if (r_lightmap.value) r_lightmap_cheatsafe = true;
}
//johnfitz
// mh dynamic lightmap speedup: upload all modified lightmaps from the last
// frame in a single batch
R_UploadLightmaps ();
}
//==============================================================================

View file

@ -1383,8 +1383,8 @@ void VID_Init (void)
putenv (vid_center); /* SDL_putenv is problematic in versions <= 1.2.9 */
if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1)
Sys_Error("Could not initialize SDL Video");
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
Sys_Error("Couldn't init SDL video: %s", SDL_GetError());
#if defined(USE_SDL2)
{

View file

@ -160,6 +160,9 @@ keyname_t keynames[] =
{"SEMICOLON", ';'}, // because a raw semicolon seperates commands
{"BACKQUOTE", '`'}, // because a raw backquote may toggle the console
{"TILDE", '~'}, // because a raw tilde may toggle the console
{NULL, 0}
};
@ -824,7 +827,6 @@ void Key_Init (void)
consolekeys[K_DOWNARROW] = true;
consolekeys[K_LEFTARROW] = true;
consolekeys[K_RIGHTARROW] = true;
consolekeys[K_ALT] = true;
consolekeys[K_CTRL] = true;
consolekeys[K_SHIFT] = true;
consolekeys[K_INS] = true;
@ -1076,6 +1078,13 @@ void Char_Event (int key)
if (key < 32 || key > 126)
return;
#if defined(PLATFORM_OSX) || defined(PLATFORM_MAC)
if (keydown[K_COMMAND])
return;
#endif
if (keydown[K_CTRL])
return;
if (key_inputgrab.active)
{
key_inputgrab.lastchar = key;

View file

@ -54,7 +54,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
static void Sys_CheckSDL (void)
static void Sys_AtExit (void)
{
SDL_Quit();
}
static void Sys_InitSDL (void)
{
#if defined(USE_SDL2)
SDL_version v;
@ -74,6 +79,12 @@ static void Sys_CheckSDL (void)
Sys_Error("Your version of SDL library is incompatible with me.\n"
"You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
}
if (SDL_Init(0) < 0)
{
Sys_Error("Couldn't init SDL: %s", SDL_GetError());
}
atexit(Sys_AtExit);
}
#if defined(_LP64) || defined(__LP64__) || defined(_WIN64)
@ -105,14 +116,11 @@ int main(int argc, char *argv[])
isDedicated = (COM_CheckParm("-dedicated") != 0);
Sys_CheckSDL ();
Sys_InitSDL ();
Sys_Init();
// default memory size
// TODO: less mem, eg. 16 mb, for dedicated server??
parms.memsize = DEFAULT_MEMORY;
if (COM_CheckParm("-heapsize"))
{
t = COM_CheckParm("-heapsize") + 1;
@ -158,12 +166,12 @@ int main(int argc, char *argv[])
while (1)
{
/* If we have no input focus at all, sleep a bit */
if ( !VID_HasMouseOrInputFocus() || cl.paused)
if (!VID_HasMouseOrInputFocus() || cl.paused)
{
SDL_Delay(16);
}
/* If we're minimised, sleep a bit more */
if ( VID_IsMinimized() )
if (VID_IsMinimized())
{
scr_skipupdate = 1;
SDL_Delay(32);

View file

@ -236,10 +236,14 @@ void R_CullSurfaces (void)
/*
================
R_BuildLightmapChains -- johnfitz -- used for r_lightmap 1
ericw -- now always used at the start of R_DrawTextureChains for the
mh dynamic lighting speedup
================
*/
void R_BuildLightmapChains (qmodel_t *model)
void R_BuildLightmapChains (qmodel_t *model, texchain_t chain)
{
texture_t *t;
msurface_t *s;
int i;
@ -247,10 +251,17 @@ void R_BuildLightmapChains (qmodel_t *model)
memset (lightmap_polys, 0, sizeof(lightmap_polys));
// now rebuild them
s = &model->surfaces[model->firstmodelsurface];
for (i=0 ; i<model->nummodelsurfaces ; i++, s++)
if (model != cl.worldmodel || (s->visframe == r_visframecount && !R_CullBox(s->mins, s->maxs) && !R_BackFaceCull (s)))
R_RenderDynamicLightmaps (s);
for (i=0 ; i<model->numtextures ; i++)
{
t = model->textures[i];
if (!t || !t->texturechains[chain])
continue;
for (s = t->texturechains[chain]; s; s = s->texturechain)
if (!s->culled)
R_RenderDynamicLightmaps (s);
}
}
//==============================================================================
@ -527,7 +538,6 @@ void R_DrawTextureChains_Multitexture (qmodel_t *model, entity_t *ent, texchain_
GL_EnableMultitexture(); // selects TEXTURE1
bound = true;
}
R_RenderDynamicLightmaps (s);
GL_Bind (lightmap_textures[s->lightmaptexturenum]);
glBegin(GL_POLYGON);
v = s->polys->verts[0];
@ -617,7 +627,6 @@ void R_DrawTextureChains_TextureOnly (qmodel_t *model, entity_t *ent, texchain_t
bound = true;
}
R_RenderDynamicLightmaps (s); //adds to lightmap chain
DrawGLPoly (s->polys);
rs_brushpasses++;
}
@ -860,7 +869,6 @@ void R_DrawTextureChains_Multitexture_VBO (qmodel_t *model, entity_t *ent, texch
bound = true;
lastlightmap = s->lightmaptexturenum;
}
R_RenderDynamicLightmaps (s);
if (s->lightmaptexturenum != lastlightmap)
R_FlushBatch ();
@ -906,6 +914,14 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
else
entalpha = 1;
// ericw -- the mh dynamic lightmap speedup: make a first pass through all
// surfaces we are going to draw, and rebuild any lightmaps that need it.
// this also chains surfaces by lightmap which is used by r_lightmap 1.
// the previous implementation of the speedup uploaded lightmaps one frame
// late which was visible under some conditions, this method avoids that.
R_BuildLightmapChains (model, chain);
R_UploadLightmaps ();
if (r_drawflat_cheatsafe)
{
glDisable (GL_TEXTURE_2D);
@ -924,7 +940,6 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
if (r_lightmap_cheatsafe)
{
R_BuildLightmapChains (model);
if (!gl_overbright.value)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

View file

@ -84,7 +84,7 @@ qboolean SNDDMA_Init (dma_t *dma)
int tmp, val;
char drivername[128];
if (SDL_InitSubSystem(SDL_INIT_AUDIO) == -1)
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
{
Con_Printf("Couldn't init SDL audio: %s\n", SDL_GetError());
return false;

View file

@ -173,10 +173,43 @@ static void Sys_GetBasedir (char *argv0, char *dst, size_t dstsize)
}
}
typedef enum { dpi_unaware = 0, dpi_system_aware = 1, dpi_monitor_aware = 2 } dpi_awareness;
typedef BOOL(*SetProcessDPIAwareFunc)();
typedef HRESULT(*SetProcessDPIAwarenessFunc)(dpi_awareness value);
void Sys_SetDPIAware (void)
{
HMODULE hUser32, hShcore;
SetProcessDPIAwarenessFunc setDPIAwareness;
SetProcessDPIAwareFunc setDPIAware;
/* Neither SDL 1.2 nor SDL 2.0.3 can handle the OS scaling our window.
(e.g. https://bugzilla.libsdl.org/show_bug.cgi?id=2713)
Call SetProcessDpiAwareness/SetProcessDPIAware to opt out of scaling.
*/
hShcore = LoadLibraryA ("Shcore.dll");
hUser32 = LoadLibraryA ("user32.dll");
setDPIAwareness = (SetProcessDPIAwarenessFunc) (hShcore ? GetProcAddress (hShcore, "SetProcessDpiAwareness") : NULL);
setDPIAware = (SetProcessDPIAwareFunc) (hUser32 ? GetProcAddress (hUser32, "SetProcessDPIAware") : NULL);
if (setDPIAwareness) /* Windows 8.1+ */
setDPIAwareness (dpi_monitor_aware);
else if (setDPIAware) /* Windows Vista-8.0 */
setDPIAware ();
if (hShcore)
FreeLibrary (hShcore);
if (hUser32)
FreeLibrary (hUser32);
}
void Sys_Init (void)
{
OSVERSIONINFO vinfo;
Sys_SetDPIAware ();
memset (cwd, 0, sizeof(cwd));
Sys_GetBasedir(NULL, cwd, sizeof(cwd));
host_parms->basedir = cwd;

View file

@ -11,7 +11,7 @@
<PRE>
</PRE>
</P>
<P><EM>Page last edited Oct. 11, 2014</EM></P>
<P><EM>Page last edited Oct. 17, 2014</EM></P>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="Quakespasm.html#s1">About </A></H2>
@ -147,7 +147,7 @@ Compile time options include
<LI><B>make DO_USERDIRS=1</B> to include user directories support</LI>
<LI><B>make DEBUG=1</B> for debugging</LI>
<LI><B>make SDL_CONFIG=</B><EM>/PATH/TO/SDL-CONFIG</EM> for unusual SDL installations</LI>
<LI><B>make USE_SDL2=1</B> to compile against SDL2 instead of SDL1.2</LI>
<LI><B>make USE_SDL2=1</B> to compile against SDL2 instead of SDL-1.2</LI>
</UL>
</P>
<P>Streaming music playback requires "libmad" or "libmpg123" for MP3, and "libogg" and "libvorbis" for OGG files.</P>
@ -177,7 +177,6 @@ these patched libSDL binaries may help.
</UL>
</P>
<P>OS X has a well known gamma issue where the screen turns dark, but we currently have no fix.</P>
<P>High-DPI displays on Windows can break Quakespasm. As a workaround, right-click the quakespasm exe, go to Properties, the Compatibility tab, and check "Disable display scaling on high DPI settings".</P>
<P>The "game" command doesn't execute quake.rc in the new game directory being switched to. This means any custom key bindings in a mod's config.cfg or special settings in a quake.rc won't be loaded. The only workaround is launching the engine with the -game command-line switch instead of using the game console command. Or, after running the game command, you can run "exec quake.rc" by yourself (YMMV).</P>
<H2><A NAME="s6">6.</A> <A HREF="#toc6">Changes</A></H2>
@ -188,6 +187,7 @@ these patched libSDL binaries may help.
<P>
<UL>
<LI> Fix issues on Windows systems with DPI scaling.</LI>
<LI> Unix/Mac user directories support. Disabled by default, 'make DO_USERDIRS=1' to enable it.</LI>
<LI> SDL2 support. Disabled by default, 'make USE_SDL2=1' to enable it.</LI>
<LI> Revised keyboard input code.</LI>

View file

@ -35,7 +35,7 @@
______________________________________________________________________
Page last edited Oct. 11, 2014
Page last edited Oct. 17, 2014
1. About
@ -131,7 +131,7 @@
o make SDL_CONFIG=/PATH/TO/SDL-CONFIG for unusual SDL installations
o make USE_SDL2=1 to compile against SDL2 instead of SDL1.2
o make USE_SDL2=1 to compile against SDL2 instead of SDL-1.2
Streaming music playback requires "libmad" or "libmpg123" for MP3, and
"libogg" and "libvorbis" for OGG files.
@ -171,10 +171,6 @@
OS X has a well known gamma issue where the screen turns dark, but we
currently have no fix.
High-DPI displays on Windows can break Quakespasm. As a workaround,
right-click the quakespasm exe, go to Properties, the Compatibility
tab, and check "Disable display scaling on high DPI settings".
The "game" command doesn't execute quake.rc in the new game directory
being switched to. This means any custom key bindings in a mod's
config.cfg or special settings in a quake.rc won't be loaded. The only
@ -187,6 +183,8 @@
6.1. Changes in 0.90.0
o Fix issues on Windows systems with DPI scaling.
o Unix/Mac user directories support. Disabled by default,
'make DO_USERDIRS=1' to enable it.

View file

@ -1 +1,4 @@
#include <winresrc.h>
icon ICON "QuakeSpasm.ico"