mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-29 07:02:12 +00:00
------------------------------------------------------------------------
r4227 | acceptthis | 2013-02-26 16:29:38 +0000 (Tue, 26 Feb 2013) | 2 lines numerous small fixes and tweaks for the nacl+npfte ports. support for q3bsp tangent-space deluxemaps. ------------------------------------------------------------------------ git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4223 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
5cb6c9f190
commit
2e009e1d26
51 changed files with 1048 additions and 499 deletions
136
engine/Makefile
136
engine/Makefile
|
@ -60,6 +60,8 @@ ifeq ($(FTE_TARGET),win32_sdl)
|
||||||
FTE_TARGET=win32_SDL
|
FTE_TARGET=win32_SDL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
USER_TARGET:=$(FTE_TARGET)
|
||||||
|
|
||||||
DROID_NDK_PATH?=~/droid/android-ndk-r6b
|
DROID_NDK_PATH?=~/droid/android-ndk-r6b
|
||||||
DROID_SDK_PATH?=~/droid/android-sdk-linux_x86
|
DROID_SDK_PATH?=~/droid/android-sdk-linux_x86
|
||||||
ANT?=ant
|
ANT?=ant
|
||||||
|
@ -672,24 +674,56 @@ endif
|
||||||
ifeq ($(FTE_TARGET),nacl)
|
ifeq ($(FTE_TARGET),nacl)
|
||||||
OGGVORBISLDFLAGS=
|
OGGVORBISLDFLAGS=
|
||||||
|
|
||||||
|
NARCH ?= x86_32
|
||||||
ifeq ($(shell uname -o 2>&1 | grep Cygwin),)
|
ifeq ($(shell uname -o 2>&1 | grep Cygwin),)
|
||||||
CC=$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/i686-nacl-gcc -DNACL -m$(BITS)
|
MYOS=linux
|
||||||
STRIP=$(NACL_SDK_ROOT)/toolchain/linux_x86_newlib/bin/i686-nacl-strip
|
|
||||||
else
|
else
|
||||||
CC=$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/i686-nacl-gcc -DNACL -m$(BITS)
|
MYOS=win
|
||||||
STRIP=$(NACL_SDK_ROOT)/toolchain/win_x86_newlib/bin/i686-nacl-strip
|
endif
|
||||||
|
|
||||||
|
CC=
|
||||||
|
STRIP=
|
||||||
|
ifeq ($(NARCH),x86_32)
|
||||||
|
CC=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_newlib/bin/i686-nacl-gcc -DNACL -m32
|
||||||
|
STRIP=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_newlib/bin/i686-nacl-strip
|
||||||
|
BITS=
|
||||||
|
endif
|
||||||
|
ifeq ($(NARCH),x86_64)
|
||||||
|
CC=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_newlib/bin/i686-nacl-gcc -DNACL -m64
|
||||||
|
STRIP=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_newlib/bin/i686-nacl-strip
|
||||||
|
BITS=
|
||||||
|
endif
|
||||||
|
ifeq ($(NARCH),arm)
|
||||||
|
CC=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_arm_newlib/bin/arm-nacl-gcc -DNACL
|
||||||
|
STRIP=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_arm_newlib/bin/arm-nacl-strip
|
||||||
|
BITS=
|
||||||
|
endif
|
||||||
|
ifeq ($(NARCH),pnacl)
|
||||||
|
CC=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_pnacl/newlib/bin/pnacl-clang -DNACL
|
||||||
|
STRIP=$(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_pnacl/newlib/bin/pnacl-strip
|
||||||
|
STRIPFLAGS=
|
||||||
|
DO_LD =/cygdrive/c/Windows/system32/cmd /C $(NACL_SDK_ROOT)/toolchain/$(MYOS)_x86_pnacl/newlib/bin/pnacl-clang -o $@ $(LTO_LD) $(WCFLAGS) $(CFLAGS)
|
||||||
|
BITS=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BASELDFLAGS = -lm -lppapi_gles2 -lnosys -lppapi
|
BASELDFLAGS = -lm -lppapi_gles2 -lnosys -lppapi
|
||||||
IMAGELDFLAGS =
|
IMAGELDFLAGS =
|
||||||
|
|
||||||
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) sys_ppapi.o cd_null.o gl_vidppapi.o fs_ppapi.o snd_ppapi.o
|
GL_CFLAGS+=$(SPEEXCFLAGS)
|
||||||
|
|
||||||
GLB_DIR=gl_nacl_x86_$(BITS)
|
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) $(SPEEX_OBJS) sys_ppapi.o cd_null.o gl_vidppapi.o fs_ppapi.o snd_ppapi.o
|
||||||
GL_EXE_NAME=../fteqw_x86_$(BITS).nexe
|
|
||||||
GLCL_EXE_NAME=../fteqwcl_x86_$(BITS).nexe
|
GLB_DIR=gl_nacl_$(NARCH)
|
||||||
MINGL_DIR=mingl_nacl_x86_$(BITS)
|
MINGL_DIR=mingl_nacl_$(NARCH)
|
||||||
MINGL_EXE_NAME=../fteqw_mingl_x86_$(BITS).nexe
|
ifeq ($(NARCH),pnacl)
|
||||||
|
GL_EXE_NAME=../fteqw.pexe
|
||||||
|
GLCL_EXE_NAME=../fteqwcl.pexe
|
||||||
|
MINGL_EXE_NAME=../fteqw_mingl.pexe
|
||||||
|
else
|
||||||
|
GL_EXE_NAME=../fteqw_$(NARCH).nexe
|
||||||
|
GLCL_EXE_NAME=../fteqwcl_$(NARCH).nexe
|
||||||
|
MINGL_EXE_NAME=../fteqw_mingl_$(NARCH).nexe
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#FTE_TARGET=win32_SDL | FTE_TARGET=win64_SDL (MinGW32 + SDL | MinGW64 + SDL)
|
#FTE_TARGET=win32_SDL | FTE_TARGET=win64_SDL (MinGW32 + SDL | MinGW64 + SDL)
|
||||||
|
@ -1241,32 +1275,6 @@ d3d-profile:
|
||||||
@$(MAKE) d3d-tmp TYPE=_clsv-profile OUT_DIR="$(PROFILE_DIR)/$(D3DB_DIR)"
|
@$(MAKE) d3d-tmp TYPE=_clsv-profile OUT_DIR="$(PROFILE_DIR)/$(D3DB_DIR)"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
npfte-tmprel: reldir
|
|
||||||
@$(MAKE) $(OUT_DIR)/$(EXE_NAME) OUT_DIR="$(OUT_DIR)" WCFLAGS="$(NPFTE_CFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(NPFTE_LDFLAGS) $(LDFLAGS) $(RELEASE_LDFLAGS)" OBJS="NPFTE_OBJS"
|
|
||||||
npfte-tmpdbg: debugdir
|
|
||||||
@$(MAKE) $(OUT_DIR)/$(EXE_NAME) OUT_DIR="$(OUT_DIR)" WCFLAGS="$(NPFTE_CFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(BASELDFLAGS) $(NPFTE_LDFLAGS) $(LDFLAGS) $(DEBUG_LDFLAGS)" OBJS="NPFTE_OBJS"
|
|
||||||
npfte-rel:
|
|
||||||
@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)w32" EXE_NAME="../npfte.dll" PRECOMPHEADERS="" FTE_TARGET=win32
|
|
||||||
@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)l32" EXE_NAME="../npfte32.so" PRECOMPHEADERS="" FTE_TARGET=linux32
|
|
||||||
@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)l64" EXE_NAME="../npfte64.so" PRECOMPHEADERS="" FTE_TARGET=linux64
|
|
||||||
cp $(RELEASE_DIR)/npfte.dll npfte/plugins
|
|
||||||
cp $(RELEASE_DIR)/npfte32.so npfte/plugins
|
|
||||||
cp $(RELEASE_DIR)/npfte64.so npfte/plugins
|
|
||||||
cd npfte && zip $(abspath $(RELEASE_DIR)/npfte.xpi) install.rdf plugins/npfte.dll plugins/npfte32.so plugins/npfte64.so
|
|
||||||
rm -rf /tmp/npfte
|
|
||||||
mkdir /tmp/npfte
|
|
||||||
cp $(RELEASE_DIR)/npfte.dll /tmp/npfte
|
|
||||||
cp ./npfte/manifest.json /tmp/npfte
|
|
||||||
-cd $(RELEASE_DIR)/ && ../npfte/crxmake.sh /tmp/npfte ../npfte/chrome.pem
|
|
||||||
rm -rf /tmp/npfte
|
|
||||||
npfte-dbg:
|
|
||||||
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)w32" EXE_NAME="../npfte.dll" PRECOMPHEADERS="" FTE_TARGET=win32
|
|
||||||
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)l32" EXE_NAME="../npfte32.so" PRECOMPHEADERS="" FTE_TARGET=linux32
|
|
||||||
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)l64" EXE_NAME="../npfte64.so" PRECOMPHEADERS="" FTE_TARGET=linux64
|
|
||||||
npfte-profile:
|
|
||||||
@$(MAKE) npfte-tmp TYPE=_npfte-profile OUT_DIR="$(PROFILE_DIR)/$(NPFTEB_DIR)"
|
|
||||||
|
|
||||||
glcl-tmp:
|
glcl-tmp:
|
||||||
@$(MAKE) $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GLCL_EXE_NAME)" WCFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS) $(LDFLAGS)" SOBJS="$(GLCL_OBJS)"
|
@$(MAKE) $(TYPE) OUT_DIR="$(OUT_DIR)" EXE_NAME="$(GLCL_EXE_NAME)" WCFLAGS="$(GL_CFLAGS)" LDFLAGS="$(GL_LDFLAGS) $(LDFLAGS)" SOBJS="$(GLCL_OBJS)"
|
||||||
gl-tmp:
|
gl-tmp:
|
||||||
|
@ -1314,6 +1322,7 @@ m-profile:
|
||||||
|
|
||||||
.PHONY: m-tmp mcl-tmp mingl-tmp glcl-tmp gl-tmp sv-tmp _clsv-dbg _clsv-rel _cl-dbg _cl-rel _out-rel _out-dbg
|
.PHONY: m-tmp mcl-tmp mingl-tmp glcl-tmp gl-tmp sv-tmp _clsv-dbg _clsv-rel _cl-dbg _cl-rel _out-rel _out-dbg
|
||||||
|
|
||||||
|
|
||||||
ifdef windir
|
ifdef windir
|
||||||
debugdir:
|
debugdir:
|
||||||
@-mkdir -p $(subst /,\, $(OUT_DIR))
|
@-mkdir -p $(subst /,\, $(OUT_DIR))
|
||||||
|
@ -1350,18 +1359,19 @@ help:
|
||||||
@-echo "'gl-???' (OpenGL rendering + Built-in Server)"
|
@-echo "'gl-???' (OpenGL rendering + Built-in Server)"
|
||||||
@-echo "'m-???' (Merged client, OpenGL & D3D rendering + Dedicated server)"
|
@-echo "'m-???' (Merged client, OpenGL & D3D rendering + Dedicated server)"
|
||||||
@-echo "'mingl-???' (Minimal featured OpenGL render)"
|
@-echo "'mingl-???' (Minimal featured OpenGL render)"
|
||||||
@-echo "'npfte-???' (FTE_TARGET=win32 only, for now) (QuakeTV Firefox/Netscape browser plugin)"
|
|
||||||
@-echo "'d3d-???' (for windows builds)"
|
@-echo "'d3d-???' (for windows builds)"
|
||||||
@-echo "'mcl-???' (currently broken)"
|
@-echo "'mcl-???' (currently broken)"
|
||||||
@-echo "'glcl-???' (currently broken)"
|
@-echo "'glcl-???' (currently broken)"
|
||||||
@-echo "'droid-???' (build Android package)"
|
@-echo "'droid-???' (cross compiles Android package)"
|
||||||
|
@-echo "'npfte-???' (cross compiles QuakeTV Firefox/Netscape browser plugin)"
|
||||||
|
@-echo "'nacl-???' (cross compiles QuakeTV Firefox/Netscape browser plugin)"
|
||||||
@-echo ""
|
@-echo ""
|
||||||
@-echo "Cross targets can be specified with FTE_TARGET=blah"
|
@-echo "Cross targets can be specified with FTE_TARGET=blah"
|
||||||
@-echo "linux32, linux64 specify specific x86 archs"
|
@-echo "linux32, linux64 specify specific x86 archs"
|
||||||
@-echo "SDL - Attempt to use sdl for the current target"
|
@-echo "SDL - Attempt to use sdl for the current target"
|
||||||
@-echo "win32 - Mingw compile for win32"
|
@-echo "win32 - Mingw compile for win32"
|
||||||
@-echo "vc - Attempts to use msvc8+ to compile. Note: uses profile guided optimisations. You must build+run the relevent profile target before a release target will compile properly. Debug doesn't care."
|
@-echo "vc - Attempts to use msvc8+ to compile. Note: uses profile guided optimisations. You must build+run the relevent profile target before a release target will compile properly. Debug doesn't care."
|
||||||
@-echo "android is different - use 'make droid-help' for explicit help."
|
@-echo "android, npfte, nacl targets explicitly cross compile, and should generally not be given an FTE_TARGET."
|
||||||
|
|
||||||
install:
|
install:
|
||||||
-cp debug/*.* /opt/quake/
|
-cp debug/*.* /opt/quake/
|
||||||
|
@ -1383,6 +1393,54 @@ clean:
|
||||||
distclean: clean
|
distclean: clean
|
||||||
-rm -f droid/ftekeystore
|
-rm -f droid/ftekeystore
|
||||||
|
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
#npfte
|
||||||
|
|
||||||
|
npfte-tmprel: reldir
|
||||||
|
@$(MAKE) $(OUT_DIR)/$(EXE_NAME) OUT_DIR="$(OUT_DIR)" WCFLAGS="$(NPFTE_CFLAGS) $(RELEASE_CFLAGS)" LDFLAGS="$(NPFTE_LDFLAGS) $(LDFLAGS) $(RELEASE_LDFLAGS)" OBJS="NPFTE_OBJS"
|
||||||
|
npfte-tmpdbg: debugdir
|
||||||
|
@$(MAKE) $(OUT_DIR)/$(EXE_NAME) OUT_DIR="$(OUT_DIR)" WCFLAGS="$(NPFTE_CFLAGS) $(DEBUG_CFLAGS)" LDFLAGS="$(NPFTE_LDFLAGS) $(LDFLAGS) $(DEBUG_LDFLAGS)" OBJS="NPFTE_OBJS"
|
||||||
|
npfte-rel:
|
||||||
|
ifeq ($(USER_TARGET),)
|
||||||
|
@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)w32" EXE_NAME="../npfte.dll" PRECOMPHEADERS="" FTE_TARGET=win32
|
||||||
|
@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)l32" EXE_NAME="../npfte32.so" PRECOMPHEADERS="" FTE_TARGET=linux32
|
||||||
|
@$(MAKE) npfte-tmprel OUT_DIR="$(RELEASE_DIR)/$(NPFTEB_DIR)l64" EXE_NAME="../npfte64.so" PRECOMPHEADERS="" FTE_TARGET=linux64
|
||||||
|
-cp $(RELEASE_DIR)/npfte.dll npfte/plugins
|
||||||
|
-cp $(RELEASE_DIR)/npfte32.so npfte/plugins
|
||||||
|
-cp $(RELEASE_DIR)/npfte64.so npfte/plugins
|
||||||
|
cd npfte && zip $(abspath $(RELEASE_DIR)/npfte.xpi) install.rdf plugins/npfte.dll plugins/npfte32.so plugins/npfte64.so
|
||||||
|
rm -rf /tmp/npfte
|
||||||
|
mkdir /tmp/npfte
|
||||||
|
cp $(RELEASE_DIR)/npfte.dll /tmp/npfte
|
||||||
|
cp ./npfte/manifest.json /tmp/npfte
|
||||||
|
-cd $(RELEASE_DIR)/ && ../npfte/crxmake.sh /tmp/npfte ../npfte/chrome.pem
|
||||||
|
rm -rf /tmp/npfte
|
||||||
|
npfte-dbg:
|
||||||
|
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)w32" EXE_NAME="../npfte.dll" PRECOMPHEADERS="" FTE_TARGET=win32
|
||||||
|
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)l32" EXE_NAME="../npfte32.so" PRECOMPHEADERS="" FTE_TARGET=linux32
|
||||||
|
@$(MAKE) npfte-tmpdbg OUT_DIR="$(DEBUG_DIR)/$(NPFTEB_DIR)l64" EXE_NAME="../npfte64.so" PRECOMPHEADERS="" FTE_TARGET=linux64
|
||||||
|
npfte-profile:
|
||||||
|
@$(MAKE) npfte-tmp TYPE=_npfte-profile OUT_DIR="$(PROFILE_DIR)/$(NPFTEB_DIR)"
|
||||||
|
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
#nacl shortcut
|
||||||
|
|
||||||
|
nacl-rel:
|
||||||
|
@$(MAKE) gl-rel FTE_TARGET=nacl NARCH=x86_32
|
||||||
|
@$(MAKE) gl-rel FTE_TARGET=nacl NARCH=x86_64
|
||||||
|
@$(MAKE) gl-rel FTE_TARGET=nacl NARCH=arm
|
||||||
|
@$(MAKE) gl-rel FTE_TARGET=nacl NARCH=pnacl
|
||||||
|
nacl-dbg:
|
||||||
|
@$(MAKE) gl-dbg FTE_TARGET=nacl NARCH=x86_32
|
||||||
|
@$(MAKE) gl-dbg FTE_TARGET=nacl NARCH=x86_64
|
||||||
|
@$(MAKE) gl-dbg FTE_TARGET=nacl NARCH=arm
|
||||||
|
@$(MAKE) gl-dbg FTE_TARGET=nacl NARCH=pnacl
|
||||||
|
|
||||||
|
#################################################
|
||||||
|
#android
|
||||||
|
|
||||||
#building for android will require:
|
#building for android will require:
|
||||||
#download android sdk+ndk
|
#download android sdk+ndk
|
||||||
#ant installed
|
#ant installed
|
||||||
|
|
|
@ -1141,7 +1141,6 @@ entity_state_t *CL_FindOldPacketEntity(int num)
|
||||||
}
|
}
|
||||||
#ifdef NQPROT
|
#ifdef NQPROT
|
||||||
|
|
||||||
entity_state_t defaultstate;
|
|
||||||
void DP5_ParseDelta(entity_state_t *s)
|
void DP5_ParseDelta(entity_state_t *s)
|
||||||
{
|
{
|
||||||
int bits;
|
int bits;
|
||||||
|
@ -1166,7 +1165,7 @@ void DP5_ParseDelta(entity_state_t *s)
|
||||||
{
|
{
|
||||||
int num;
|
int num;
|
||||||
num = s->number;
|
num = s->number;
|
||||||
*s = defaultstate;
|
*s = nullentitystate;
|
||||||
s->trans = 255;
|
s->trans = 255;
|
||||||
s->scale = 16;
|
s->scale = 16;
|
||||||
s->number = num;
|
s->number = num;
|
||||||
|
@ -1317,7 +1316,7 @@ void CLDP_ParseDarkPlaces5Entities(void) //the things I do.. :o(
|
||||||
if (read >= MAX_EDICTS)
|
if (read >= MAX_EDICTS)
|
||||||
Host_EndGame("Too many entities.\n");
|
Host_EndGame("Too many entities.\n");
|
||||||
|
|
||||||
from = &defaultstate;
|
from = &nullentitystate;
|
||||||
|
|
||||||
for (oldi=0 ; oldi<oldpack.num_entities ; oldi++)
|
for (oldi=0 ; oldi<oldpack.num_entities ; oldi++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1086,6 +1086,7 @@ void CL_ClearState (void)
|
||||||
S_StopAllSounds (true);
|
S_StopAllSounds (true);
|
||||||
S_UntouchAll();
|
S_UntouchAll();
|
||||||
S_ResetFailedLoad();
|
S_ResetFailedLoad();
|
||||||
|
r_regsequence++;
|
||||||
|
|
||||||
Cvar_ApplyLatches(CVAR_SERVEROVERRIDE);
|
Cvar_ApplyLatches(CVAR_SERVEROVERRIDE);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ typedef struct master_s{
|
||||||
char name[1];
|
char name[1];
|
||||||
} master_t;
|
} master_t;
|
||||||
|
|
||||||
struct {
|
extern struct selectedserver_s {
|
||||||
qboolean inuse;
|
qboolean inuse;
|
||||||
netadr_t adr;
|
netadr_t adr;
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ mpic_t *scr_turtle;
|
||||||
int clearconsole;
|
int clearconsole;
|
||||||
int clearnotify;
|
int clearnotify;
|
||||||
|
|
||||||
int sb_lines;
|
extern int sb_lines;
|
||||||
|
|
||||||
viddef_t vid; // global video state
|
viddef_t vid; // global video state
|
||||||
|
|
||||||
|
|
|
@ -2036,7 +2036,7 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
|
||||||
#endif
|
#endif
|
||||||
case key_game:
|
case key_game:
|
||||||
case key_console:
|
case key_console:
|
||||||
if ((unicode) || key == K_ENTER || key == K_TAB)
|
if ((key && unicode) || key == K_ENTER || key == K_TAB)
|
||||||
key_dest = key_console;
|
key_dest = key_console;
|
||||||
Key_Console (unicode, key);
|
Key_Console (unicode, key);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -804,10 +804,11 @@ void Menu_DownloadStuff_f (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(AVAIL_ZLIB) && defined(WEBCLIENT)
|
#if defined(WEBCLIENT)
|
||||||
|
|
||||||
static int numbootdownloads;
|
static int numbootdownloads;
|
||||||
#include "fs.h"
|
#include "fs.h"
|
||||||
|
#ifdef AVAIL_ZLIB
|
||||||
extern searchpathfuncs_t zipfilefuncs;
|
extern searchpathfuncs_t zipfilefuncs;
|
||||||
static int CL_BootDownload_Extract(const char *fname, int fsize, void *ptr)
|
static int CL_BootDownload_Extract(const char *fname, int fsize, void *ptr)
|
||||||
{
|
{
|
||||||
|
@ -863,6 +864,7 @@ static int CL_BootDownload_Extract(const char *fname, int fsize, void *ptr)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
qboolean FS_LoadPackageFromFile(vfsfile_t *vfs, char *pname, char *localname, int *crc, qboolean copyprotect, qboolean istemporary, qboolean isexplicit);
|
qboolean FS_LoadPackageFromFile(vfsfile_t *vfs, char *pname, char *localname, int *crc, qboolean copyprotect, qboolean istemporary, qboolean isexplicit);
|
||||||
|
|
||||||
|
@ -870,85 +872,167 @@ void FS_GenCachedPakName(char *pname, char *crc, char *local, int llen);
|
||||||
static void CL_BootDownload_Complete(struct dl_download *dl)
|
static void CL_BootDownload_Complete(struct dl_download *dl)
|
||||||
{
|
{
|
||||||
void *zip;
|
void *zip;
|
||||||
if (dl->status == DL_FINISHED)
|
char *q = strchr(dl->url, '?');
|
||||||
zip = zipfilefuncs.OpenNew(dl->file, dl->url);
|
char *ext;
|
||||||
else
|
if (dl->file && dl->status == DL_FINISHED)
|
||||||
zip = NULL;
|
|
||||||
/*the zip code will have eaten the file handle*/
|
|
||||||
dl->file = NULL;
|
|
||||||
if (zip)
|
|
||||||
{
|
{
|
||||||
if (dl->user_ctx)
|
if (q) *q = '0';
|
||||||
|
ext = COM_FileExtension(dl->url);
|
||||||
|
if (q) *q = '?';
|
||||||
|
if (!stricmp(ext, "zip"))
|
||||||
{
|
{
|
||||||
vfsfile_t *in, *out;
|
#ifdef AVAIL_ZLIB
|
||||||
flocation_t loc;
|
if (dl->status == DL_FINISHED)
|
||||||
qboolean found = false;
|
zip = zipfilefuncs.OpenNew(dl->file, dl->url);
|
||||||
int crc;
|
else
|
||||||
|
zip = NULL;
|
||||||
found = zipfilefuncs.FindFile(zip, &loc, dl->user_ctx, NULL);
|
if (zip)
|
||||||
if (!found)
|
|
||||||
{
|
{
|
||||||
char *s = COM_SkipPath(dl->user_ctx);
|
dl->file = NULL; //file is now owned by the zip context.
|
||||||
if (s != dl->user_ctx)
|
if (dl->user_ctx)
|
||||||
found = zipfilefuncs.FindFile(zip, &loc, s, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found)
|
|
||||||
{
|
|
||||||
in = zipfilefuncs.OpenVFS(zip, &loc, "rb");
|
|
||||||
if (in)
|
|
||||||
{
|
{
|
||||||
char local[MAX_OSPATH];
|
vfsfile_t *in, *out;
|
||||||
FS_GenCachedPakName(dl->user_ctx, va("%i", dl->user_num), local, sizeof(local));
|
flocation_t loc;
|
||||||
FS_CreatePath(local, FS_ROOT);
|
qboolean found = false;
|
||||||
out = FS_OpenVFS(local, "wb", FS_ROOT);
|
int crc;
|
||||||
if (out)
|
|
||||||
|
found = zipfilefuncs.FindFile(zip, &loc, dl->user_ctx, NULL);
|
||||||
|
if (!found)
|
||||||
{
|
{
|
||||||
char buffer[8192];
|
char *s = COM_SkipPath(dl->user_ctx);
|
||||||
int read;
|
if (s != dl->user_ctx)
|
||||||
for(;;)
|
found = zipfilefuncs.FindFile(zip, &loc, s, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
{
|
||||||
|
in = zipfilefuncs.OpenVFS(zip, &loc, "rb");
|
||||||
|
if (in)
|
||||||
{
|
{
|
||||||
read = VFS_READ(in, buffer, sizeof(buffer));
|
char local[MAX_OSPATH];
|
||||||
if (read <= 0)
|
FS_GenCachedPakName(dl->user_ctx, va("%i", dl->user_num), local, sizeof(local));
|
||||||
break;
|
FS_CreatePath(local, FS_ROOT);
|
||||||
if (VFS_WRITE(out, buffer, read) != read)
|
out = FS_OpenVFS(local, "wb", FS_ROOT);
|
||||||
|
if (out)
|
||||||
{
|
{
|
||||||
Con_Printf("write failed writing %s. disk full?\n", local);
|
char buffer[8192];
|
||||||
break;
|
int read;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
read = VFS_READ(in, buffer, sizeof(buffer));
|
||||||
|
if (read <= 0)
|
||||||
|
break;
|
||||||
|
if (VFS_WRITE(out, buffer, read) != read)
|
||||||
|
{
|
||||||
|
Con_Printf("write failed writing %s. disk full?\n", local);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VFS_CLOSE(out);
|
||||||
|
out = FS_OpenVFS(local, "rb", FS_ROOT);
|
||||||
|
crc = dl->user_num;
|
||||||
|
if (!FS_LoadPackageFromFile(out, dl->user_ctx, local, &crc, true, false, true))
|
||||||
|
{
|
||||||
|
if (crc == dl->user_num)
|
||||||
|
Con_Printf(CON_WARNING "Manifest package \"%s\" is unusable.\n", (char*)dl->user_ctx);
|
||||||
|
else
|
||||||
|
Con_Printf(CON_WARNING "Manifest package \"%s\" is unusable or has invalid crc. Stated crc %#x is not calculated crc %#x\n", (char*)dl->user_ctx, dl->user_num, crc);
|
||||||
|
FS_Remove(local, FS_ROOT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VFS_CLOSE(out);
|
VFS_CLOSE(in);
|
||||||
out = FS_OpenVFS(local, "rb", FS_ROOT);
|
|
||||||
crc = dl->user_num;
|
|
||||||
if (!FS_LoadPackageFromFile(out, dl->user_ctx, local, &crc, true, false, true))
|
|
||||||
{
|
|
||||||
if (crc == dl->user_num)
|
|
||||||
Con_Printf(CON_WARNING "Manifest package \"%s\" is unusable.\n", dl->user_ctx);
|
|
||||||
else
|
|
||||||
Con_Printf(CON_WARNING "Manifest package \"%s\" is unusable or has invalid crc. Stated crc %#x is not calculated crc %#x\n", dl->user_ctx, dl->user_num, crc);
|
|
||||||
FS_Remove(local, FS_ROOT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
VFS_CLOSE(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
free(dl->user_ctx);
|
free(dl->user_ctx);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*scan it to extract its contents*/
|
||||||
|
zipfilefuncs.EnumerateFiles(zip, "*/*.pk3", CL_BootDownload_Extract, zip);
|
||||||
|
zipfilefuncs.EnumerateFiles(zip, "*/*.pak", CL_BootDownload_Extract, zip);
|
||||||
|
zipfilefuncs.EnumerateFiles(zip, "*/*/*.pk3", CL_BootDownload_Extract, zip);
|
||||||
|
zipfilefuncs.EnumerateFiles(zip, "*/*/*.pak", CL_BootDownload_Extract, zip);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*close it, delete the temp file from disk, etc*/
|
||||||
|
zipfilefuncs.ClosePath(zip);
|
||||||
|
|
||||||
|
/*restart the filesystem so those new files can be found*/
|
||||||
|
Cmd_ExecuteString("fs_restart\n", RESTRICT_LOCAL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*scan it to extract its contents*/
|
//okay, its named directly, write it out as it is
|
||||||
zipfilefuncs.EnumerateFiles(zip, "*/*.pk3", CL_BootDownload_Extract, zip);
|
vfsfile_t *out;
|
||||||
zipfilefuncs.EnumerateFiles(zip, "*/*.pak", CL_BootDownload_Extract, zip);
|
int crc, *crcptr = &crc;
|
||||||
zipfilefuncs.EnumerateFiles(zip, "*/*/*.pk3", CL_BootDownload_Extract, zip);
|
char local[MAX_OSPATH];
|
||||||
zipfilefuncs.EnumerateFiles(zip, "*/*/*.pak", CL_BootDownload_Extract, zip);
|
|
||||||
|
qboolean ispackage = (!stricmp(ext, "pak") || !stricmp(ext, "pk3"));
|
||||||
|
#ifndef NACL
|
||||||
|
if (ispackage)
|
||||||
|
{
|
||||||
|
FS_GenCachedPakName(dl->user_ctx, va("%i", dl->user_num), local, sizeof(local));
|
||||||
|
#else
|
||||||
|
//nacl permits any files to be listed in the manifest file, as there's no prior files to override/conflict, so don't mess about with crcs etc
|
||||||
|
crcptr = NULL;
|
||||||
|
Q_strncpyz(local, dl->user_ctx, sizeof(local));
|
||||||
|
if (1)
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
FS_CreatePath(local, FS_ROOT);
|
||||||
|
|
||||||
|
//write it out
|
||||||
|
out = FS_OpenVFS(local, "wb", FS_ROOT);
|
||||||
|
if (!out)
|
||||||
|
Con_Printf("Unable to open %s for writing\n", local);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char buffer[65535];
|
||||||
|
int read;
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
read = VFS_READ(dl->file, buffer, sizeof(buffer));
|
||||||
|
if (read <= 0)
|
||||||
|
break;
|
||||||
|
if (VFS_WRITE(out, buffer, read) != read)
|
||||||
|
{
|
||||||
|
Con_Printf("write failed writing %s. disk full?\n", local);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
VFS_CLOSE(out);
|
||||||
|
|
||||||
|
if (ispackage)
|
||||||
|
{
|
||||||
|
if (crcptr)
|
||||||
|
{
|
||||||
|
//load it as a package
|
||||||
|
out = FS_OpenVFS(local, "rb", FS_ROOT);
|
||||||
|
if (out)
|
||||||
|
{
|
||||||
|
crc = dl->user_num;
|
||||||
|
if (!FS_LoadPackageFromFile(out, dl->user_ctx, local, crcptr, true, false, true))
|
||||||
|
{
|
||||||
|
if (crc == dl->user_num)
|
||||||
|
Con_Printf(CON_WARNING "Manifest package \"%s\" is unusable.\n", (char*)dl->user_ctx);
|
||||||
|
else
|
||||||
|
Con_Printf(CON_WARNING "Manifest package \"%s\" is unusable or has invalid crc. Stated crc %#x is not calculated crc %#x\n", (char*)dl->user_ctx, dl->user_num, crc);
|
||||||
|
FS_Remove(local, FS_ROOT);
|
||||||
|
}
|
||||||
|
Cmd_ExecuteString("fs_restart\n", RESTRICT_LOCAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Cmd_ExecuteString("fs_restart\n", RESTRICT_LOCAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Con_Printf("File %s isn't a recognised package!\n", (char*)dl->user_ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*close it, delete the temp file from disk, etc*/
|
|
||||||
zipfilefuncs.ClosePath(zip);
|
|
||||||
|
|
||||||
/*restart the filesystem so those new files can be found*/
|
|
||||||
Cmd_ExecuteString("fs_restart\n", RESTRICT_LOCAL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!--numbootdownloads)
|
if (!--numbootdownloads)
|
||||||
|
@ -963,7 +1047,9 @@ static void CL_BootDownload_Complete(struct dl_download *dl)
|
||||||
|
|
||||||
static void CL_Manifest_Complete(struct dl_download *dl)
|
static void CL_Manifest_Complete(struct dl_download *dl)
|
||||||
{
|
{
|
||||||
if (dl->file)
|
if (!dl->file)
|
||||||
|
Con_Printf("Unable to load manifest from %s\n", dl->url);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
vfsfile_t *f;
|
vfsfile_t *f;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
|
@ -1002,16 +1088,30 @@ static void CL_Manifest_Complete(struct dl_download *dl)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Con_Printf("Downloading %s from %s\n", fname, Cmd_Argv(2));
|
int args = Cmd_Argc() - 2;
|
||||||
dl = HTTP_CL_Get(Cmd_Argv(2), "", CL_BootDownload_Complete);
|
if (!args)
|
||||||
if (dl)
|
Con_Printf("No mirrors for \"%s\"\n", fname);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
dl->user_ctx = strdup(fname);
|
struct dl_download *ndl;
|
||||||
dl->user_num = crc;
|
#ifdef NACL
|
||||||
#ifdef MULTITHREAD
|
args = 0; //nacl currently depends upon the browser's download cache for all file persistance, which means we want the same file every time.
|
||||||
DL_CreateThread(dl, FS_OpenTemp(), CL_BootDownload_Complete);
|
//there's only one way to do that, sadly.
|
||||||
#endif
|
#else
|
||||||
numbootdownloads++;
|
args = rand() % args;
|
||||||
|
#endif
|
||||||
|
Con_Printf("Downloading \"%s\" from \"%s\"\n", fname, Cmd_Argv(2 + args));
|
||||||
|
ndl = HTTP_CL_Get(Cmd_Argv(2), "", CL_BootDownload_Complete);
|
||||||
|
|
||||||
|
if (ndl)
|
||||||
|
{
|
||||||
|
ndl->user_ctx = strdup(fname);
|
||||||
|
ndl->user_num = crc;
|
||||||
|
#ifdef MULTITHREAD
|
||||||
|
DL_CreateThread(ndl, FS_OpenTemp(), CL_BootDownload_Complete);
|
||||||
|
#endif
|
||||||
|
numbootdownloads++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1040,16 +1140,18 @@ qboolean CL_CheckBootDownloads(void)
|
||||||
if (man)
|
if (man)
|
||||||
{
|
{
|
||||||
const char *fname = com_argv[man+1];
|
const char *fname = com_argv[man+1];
|
||||||
|
if (*fname)
|
||||||
Con_Printf("Checking manifest from \"%s\"\n", fname);
|
|
||||||
|
|
||||||
dl = HTTP_CL_Get(fname, token, CL_Manifest_Complete);
|
|
||||||
if (dl)
|
|
||||||
{
|
{
|
||||||
#ifdef MULTITHREAD
|
Con_Printf("Checking manifest from \"%s\"\n", fname);
|
||||||
DL_CreateThread(dl, FS_OpenTemp(), CL_Manifest_Complete);
|
|
||||||
#endif
|
dl = HTTP_CL_Get(fname, "", CL_Manifest_Complete);
|
||||||
numbootdownloads++;
|
if (dl)
|
||||||
|
{
|
||||||
|
#ifdef MULTITHREAD
|
||||||
|
DL_CreateThread(dl, FS_OpenTemp(), CL_Manifest_Complete);
|
||||||
|
#endif
|
||||||
|
numbootdownloads++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,7 +1194,7 @@ qboolean CL_CheckBootDownloads(void)
|
||||||
|
|
||||||
Con_Printf("Attempting to download %s\n", c);
|
Con_Printf("Attempting to download %s\n", c);
|
||||||
|
|
||||||
dl = HTTP_CL_Get(c, token, CL_BootDownload_Complete);
|
dl = HTTP_CL_Get(c, "", CL_BootDownload_Complete);
|
||||||
if (dl)
|
if (dl)
|
||||||
{
|
{
|
||||||
#ifdef MULTITHREAD
|
#ifdef MULTITHREAD
|
||||||
|
@ -1107,6 +1209,8 @@ qboolean CL_CheckBootDownloads(void)
|
||||||
#else
|
#else
|
||||||
qboolean CL_CheckBootDownloads(void)
|
qboolean CL_CheckBootDownloads(void)
|
||||||
{
|
{
|
||||||
|
if (COM_CheckParm("-manifest"))
|
||||||
|
Con_Printf("download manifests not supported in this build\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1636,6 +1636,10 @@ void M_Complex_Key(int key, int unicode)
|
||||||
{
|
{
|
||||||
if (bindingactive)
|
if (bindingactive)
|
||||||
{
|
{
|
||||||
|
//don't let key 0 be bound here. unicode-only keys are also not bindable.
|
||||||
|
if (key == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
if (mgt == MGT_HEXEN2)
|
if (mgt == MGT_HEXEN2)
|
||||||
S_LocalSound ("raven/menu1.wav");
|
S_LocalSound ("raven/menu1.wav");
|
||||||
else
|
else
|
||||||
|
|
|
@ -516,19 +516,18 @@ typedef struct fpsmenuinfo_s
|
||||||
static void ApplyPreset (int presetnum)
|
static void ApplyPreset (int presetnum)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
// TODO: work backwards and only set cvars once
|
//this function is written backwards, to ensure things work properly in configs etc.
|
||||||
for (i = 0; i <= presetnum; i++)
|
|
||||||
{
|
|
||||||
Cbuf_AddText(presetexec[i], RESTRICT_LOCAL);
|
|
||||||
Cbuf_AddText("\n", RESTRICT_LOCAL);
|
|
||||||
Cbuf_Execute(); // hack
|
|
||||||
}
|
|
||||||
|
|
||||||
//make sure the presets always set up particles correctly for certain other game modes.
|
//make sure the presets always set up particles correctly for certain other game modes.
|
||||||
if (M_GameType() == MGT_HEXEN2)
|
if (M_GameType() == MGT_HEXEN2)
|
||||||
{
|
{
|
||||||
Cbuf_AddText("r_particledesc $r_particledesc h2part\n", RESTRICT_LOCAL);
|
Cbuf_InsertText("r_particledesc $r_particledesc h2part\n", RESTRICT_LOCAL, false);
|
||||||
Cbuf_Execute();
|
}
|
||||||
|
|
||||||
|
// TODO: work backwards and only set cvars once
|
||||||
|
for (i = presetnum; i >= 0; i--)
|
||||||
|
{
|
||||||
|
Cbuf_InsertText(presetexec[i], RESTRICT_LOCAL, true);
|
||||||
}
|
}
|
||||||
forcesaveprompt = true;
|
forcesaveprompt = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ void Draw_FunString(int x, int y, const void *str);
|
||||||
void Draw_AltFunString(int x, int y, const void *str);
|
void Draw_AltFunString(int x, int y, const void *str);
|
||||||
void Draw_FunStringWidth(int x, int y, const void *str, int width);
|
void Draw_FunStringWidth(int x, int y, const void *str, int width);
|
||||||
|
|
||||||
int r_regsequence;
|
extern int r_regsequence;
|
||||||
|
|
||||||
#ifdef SERVERONLY
|
#ifdef SERVERONLY
|
||||||
#define Mod_Q1LeafPVS Mod_LeafPVS
|
#define Mod_Q1LeafPVS Mod_LeafPVS
|
||||||
|
|
|
@ -45,6 +45,7 @@ void MasterInfo_RemoveAllPlayers(void);
|
||||||
master_t *master;
|
master_t *master;
|
||||||
player_t *mplayers;
|
player_t *mplayers;
|
||||||
serverinfo_t *firstserver;
|
serverinfo_t *firstserver;
|
||||||
|
struct selectedserver_s selectedserver;
|
||||||
|
|
||||||
static serverinfo_t **visibleservers;
|
static serverinfo_t **visibleservers;
|
||||||
static int numvisibleservers;
|
static int numvisibleservers;
|
||||||
|
|
|
@ -2201,9 +2201,6 @@ static qboolean PScript_InitParticles (void)
|
||||||
pscripttmesh.st_array = pscripttexcoords;
|
pscripttmesh.st_array = pscripttexcoords;
|
||||||
pscripttmesh.colors4f_array = pscriptcolours;
|
pscripttmesh.colors4f_array = pscriptcolours;
|
||||||
pscripttmesh.indexes = pscripttriindexes;
|
pscripttmesh.indexes = pscripttriindexes;
|
||||||
|
|
||||||
if (fallback)
|
|
||||||
fallback->InitParticles();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2237,6 +2234,7 @@ static void PScript_Shutdown (void)
|
||||||
BZ_Free (part_type);
|
BZ_Free (part_type);
|
||||||
part_type = NULL;
|
part_type = NULL;
|
||||||
part_run_list = NULL;
|
part_run_list = NULL;
|
||||||
|
fallback = NULL;
|
||||||
|
|
||||||
BZ_Free (particles);
|
BZ_Free (particles);
|
||||||
BZ_Free (beams);
|
BZ_Free (beams);
|
||||||
|
|
|
@ -4602,7 +4602,9 @@ static struct {
|
||||||
{"gethostcachenumber", PF_cl_gethostcachenumber, 621},
|
{"gethostcachenumber", PF_cl_gethostcachenumber, 621},
|
||||||
{"gethostcacheindexforkey", PF_cl_gethostcacheindexforkey,622},
|
{"gethostcacheindexforkey", PF_cl_gethostcacheindexforkey,622},
|
||||||
{"addwantedhostcachekey", PF_cl_addwantedhostcachekey, 623},
|
{"addwantedhostcachekey", PF_cl_addwantedhostcachekey, 623},
|
||||||
|
#ifdef CL_MASTER
|
||||||
{"getextresponse", PF_cl_getextresponse, 624},
|
{"getextresponse", PF_cl_getextresponse, 624},
|
||||||
|
#endif
|
||||||
{"netaddress_resolve", PF_netaddress_resolve, 625},
|
{"netaddress_resolve", PF_netaddress_resolve, 625},
|
||||||
|
|
||||||
{"sprintf", PF_sprintf, 627},
|
{"sprintf", PF_sprintf, 627},
|
||||||
|
@ -5402,7 +5404,7 @@ qboolean CSQC_DrawView(void)
|
||||||
if (!csqcg.draw_function || !csqcprogs)
|
if (!csqcg.draw_function || !csqcprogs)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (cls.state < (csqcg.loadresource?ca_active:ca_onserver) && !CSQC_UnconnectedOkay(false))
|
if (cls.state < ca_active && !CSQC_UnconnectedOkay(false))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
r_secondaryview = 0;
|
r_secondaryview = 0;
|
||||||
|
|
|
@ -1422,7 +1422,9 @@ static struct {
|
||||||
{"gethostcachenumber", PF_cl_gethostcachenumber, 621},
|
{"gethostcachenumber", PF_cl_gethostcachenumber, 621},
|
||||||
{"gethostcacheindexforkey", PF_cl_gethostcacheindexforkey,622},
|
{"gethostcacheindexforkey", PF_cl_gethostcacheindexforkey,622},
|
||||||
{"addwantedhostcachekey", PF_cl_addwantedhostcachekey,623},
|
{"addwantedhostcachekey", PF_cl_addwantedhostcachekey,623},
|
||||||
|
#ifdef CL_MASTER
|
||||||
{"getextresponse", PF_cl_getextresponse, 624},
|
{"getextresponse", PF_cl_getextresponse, 624},
|
||||||
|
#endif
|
||||||
{"netaddress_resolve", PF_netaddress_resolve, 625},
|
{"netaddress_resolve", PF_netaddress_resolve, 625},
|
||||||
//gap
|
//gap
|
||||||
{"sprintf", PF_sprintf, 627},
|
{"sprintf", PF_sprintf, 627},
|
||||||
|
|
|
@ -312,7 +312,6 @@ mpic_t *R2D_SafeCachePic (char *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *failedpic; //easier this way
|
|
||||||
mpic_t *R2D_SafePicFromWad (char *name)
|
mpic_t *R2D_SafePicFromWad (char *name)
|
||||||
{
|
{
|
||||||
char newnamewad[32];
|
char newnamewad[32];
|
||||||
|
@ -330,7 +329,6 @@ mpic_t *R2D_SafePicFromWad (char *name)
|
||||||
if (!(s->flags & SHADER_NOIMAGE))
|
if (!(s->flags & SHADER_NOIMAGE))
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
failedpic = name;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,18 +61,26 @@ void R_Grenadetrail_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
particleengine_t pe_null;
|
extern particleengine_t pe_null;
|
||||||
particleengine_t pe_classic;
|
#ifdef PSET_CLASSIC
|
||||||
|
extern particleengine_t pe_classic;
|
||||||
|
#endif
|
||||||
particleengine_t pe_darkplaces;
|
particleengine_t pe_darkplaces;
|
||||||
particleengine_t pe_qmb;
|
particleengine_t pe_qmb;
|
||||||
particleengine_t pe_script;
|
#ifdef PSET_SCRIPT
|
||||||
|
extern particleengine_t pe_script;
|
||||||
|
#endif
|
||||||
|
|
||||||
particleengine_t *particlesystem[] =
|
particleengine_t *particlesystem[] =
|
||||||
{
|
{
|
||||||
|
#ifdef PSET_SCRIPT
|
||||||
&pe_script,
|
&pe_script,
|
||||||
|
#endif
|
||||||
&pe_darkplaces,
|
&pe_darkplaces,
|
||||||
&pe_qmb,
|
&pe_qmb,
|
||||||
|
#ifdef PSET_CLASSIC
|
||||||
&pe_classic,
|
&pe_classic,
|
||||||
|
#endif
|
||||||
&pe_null,
|
&pe_null,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,7 @@ unsigned blocklights[3*MAX_LIGHTMAP_SIZE*MAX_LIGHTMAP_SIZE];
|
||||||
lightmapinfo_t **lightmap;
|
lightmapinfo_t **lightmap;
|
||||||
int numlightmaps;
|
int numlightmaps;
|
||||||
|
|
||||||
mleaf_t *r_vischain; // linked list of visible leafs
|
extern mleaf_t *r_vischain; // linked list of visible leafs
|
||||||
|
|
||||||
extern cvar_t r_stains;
|
extern cvar_t r_stains;
|
||||||
extern cvar_t r_loadlits;
|
extern cvar_t r_loadlits;
|
||||||
|
@ -2430,6 +2430,12 @@ int Surf_NewLightmaps(int count, int width, int height, qboolean deluxe)
|
||||||
if (!count)
|
if (!count)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (deluxe && (count & 1))
|
||||||
|
{
|
||||||
|
deluxe = false;
|
||||||
|
Con_Print("WARNING: Deluxemapping with odd number of lightmaps\n");
|
||||||
|
}
|
||||||
|
|
||||||
i = numlightmaps + count;
|
i = numlightmaps + count;
|
||||||
lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(i));
|
lightmap = BZ_Realloc(lightmap, sizeof(*lightmap)*(i));
|
||||||
while(i > first)
|
while(i > first)
|
||||||
|
|
|
@ -490,7 +490,7 @@ enum {
|
||||||
|
|
||||||
RSPEED_MAX
|
RSPEED_MAX
|
||||||
};
|
};
|
||||||
int rspeeds[RSPEED_MAX];
|
extern int rspeeds[RSPEED_MAX];
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
RQUANT_MSECS, //old r_speeds
|
RQUANT_MSECS, //old r_speeds
|
||||||
|
@ -506,7 +506,7 @@ enum {
|
||||||
|
|
||||||
RQUANT_MAX
|
RQUANT_MAX
|
||||||
};
|
};
|
||||||
int rquant[RQUANT_MAX];
|
extern int rquant[RQUANT_MAX];
|
||||||
|
|
||||||
#define RQuantAdd(type,quant) rquant[type] += quant
|
#define RQuantAdd(type,quant) rquant[type] += quant
|
||||||
|
|
||||||
|
|
|
@ -11,14 +11,16 @@ refdef_t r_refdef;
|
||||||
vec3_t r_origin, vpn, vright, vup;
|
vec3_t r_origin, vpn, vright, vup;
|
||||||
entity_t r_worldentity;
|
entity_t r_worldentity;
|
||||||
entity_t *currententity; //nnggh
|
entity_t *currententity; //nnggh
|
||||||
model_t *currentmodel; //fixme: remove? or fix.
|
|
||||||
int sh_shadowframe; //index for msurf->shadowframe
|
|
||||||
int r_framecount;
|
int r_framecount;
|
||||||
struct texture_s *r_notexture_mip;
|
struct texture_s *r_notexture_mip;
|
||||||
|
|
||||||
r_config_t r_config;
|
r_config_t r_config;
|
||||||
|
|
||||||
qboolean r_blockvidrestart;
|
qboolean r_blockvidrestart;
|
||||||
|
int r_regsequence;
|
||||||
|
|
||||||
|
int rspeeds[RSPEED_MAX];
|
||||||
|
int rquant[RQUANT_MAX];
|
||||||
|
|
||||||
void R_InitParticleTexture (void);
|
void R_InitParticleTexture (void);
|
||||||
|
|
||||||
|
@ -187,14 +189,15 @@ cvar_t vid_bpp = CVARF ("vid_bpp", "32",
|
||||||
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
||||||
cvar_t vid_desktopsettings = CVARF ("vid_desktopsettings", "0",
|
cvar_t vid_desktopsettings = CVARF ("vid_desktopsettings", "0",
|
||||||
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
||||||
#ifdef NPQTV
|
#ifdef NACL
|
||||||
cvar_t vid_fullscreen_npqtv = CVARF ("vid_fullscreen", "1",
|
cvar_t vid_fullscreen = CVARF ("vid_fullscreen", "0",
|
||||||
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
CVAR_ARCHIVE);
|
||||||
cvar_t vid_fullscreen = CVARF ("vid_fullscreen_embedded", "0",
|
|
||||||
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
|
||||||
#else
|
#else
|
||||||
cvar_t vid_fullscreen = CVARF ("vid_fullscreen", "1",
|
//these cvars will be given their names when they're registered, based upon whether -plugin was used. this means code can always use vid_fullscreen without caring, but gets saved properly.
|
||||||
|
cvar_t vid_fullscreen = CVARAF (NULL, "1", "vid_fullscreen",
|
||||||
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
||||||
|
cvar_t vid_fullscreen_alternative = CVARF (NULL, "1",
|
||||||
|
CVAR_ARCHIVE);
|
||||||
#endif
|
#endif
|
||||||
cvar_t vid_height = CVARF ("vid_height", "0",
|
cvar_t vid_height = CVARF ("vid_height", "0",
|
||||||
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
|
||||||
|
@ -575,8 +578,18 @@ void Renderer_Init(void)
|
||||||
Cvar_Register (&vid_renderer, VIDCOMMANDGROUP);
|
Cvar_Register (&vid_renderer, VIDCOMMANDGROUP);
|
||||||
Cvar_Register (&vid_wndalpha, VIDCOMMANDGROUP);
|
Cvar_Register (&vid_wndalpha, VIDCOMMANDGROUP);
|
||||||
|
|
||||||
#ifdef NPQTV
|
#ifndef NACL
|
||||||
Cvar_Register (&vid_fullscreen_npqtv, VIDCOMMANDGROUP);
|
if (COM_CheckParm("-plugin"))
|
||||||
|
{
|
||||||
|
vid_fullscreen.name = "vid_fullscreen_embedded";
|
||||||
|
vid_fullscreen_alternative.name = "vid_fullscreen_standalone";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vid_fullscreen.name = "vid_fullscreen_standalone";
|
||||||
|
vid_fullscreen_alternative.name = "vid_fullscreen_embedded";
|
||||||
|
}
|
||||||
|
Cvar_Register (&vid_fullscreen_alternative, VIDCOMMANDGROUP);
|
||||||
#endif
|
#endif
|
||||||
Cvar_Register (&vid_fullscreen, VIDCOMMANDGROUP);
|
Cvar_Register (&vid_fullscreen, VIDCOMMANDGROUP);
|
||||||
Cvar_Register (&vid_bpp, VIDCOMMANDGROUP);
|
Cvar_Register (&vid_bpp, VIDCOMMANDGROUP);
|
||||||
|
@ -871,11 +884,17 @@ rendererinfo_t dedicatedrendererinfo = {
|
||||||
};
|
};
|
||||||
rendererinfo_t *pdedicatedrendererinfo = &dedicatedrendererinfo;
|
rendererinfo_t *pdedicatedrendererinfo = &dedicatedrendererinfo;
|
||||||
|
|
||||||
rendererinfo_t openglrendererinfo;
|
#ifdef GLQUAKE
|
||||||
|
extern rendererinfo_t openglrendererinfo;
|
||||||
rendererinfo_t eglrendererinfo;
|
rendererinfo_t eglrendererinfo;
|
||||||
|
#endif
|
||||||
|
#ifdef D3DQUAKE
|
||||||
rendererinfo_t d3d9rendererinfo;
|
rendererinfo_t d3d9rendererinfo;
|
||||||
rendererinfo_t d3d11rendererinfo;
|
rendererinfo_t d3d11rendererinfo;
|
||||||
|
#endif
|
||||||
|
#ifdef SWQUAKE
|
||||||
rendererinfo_t swrendererinfo;
|
rendererinfo_t swrendererinfo;
|
||||||
|
#endif
|
||||||
|
|
||||||
rendererinfo_t *rendererinfo[] =
|
rendererinfo_t *rendererinfo[] =
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,10 +31,6 @@ extern qboolean scr_disabled_for_loading;
|
||||||
extern cvar_t scr_fov;
|
extern cvar_t scr_fov;
|
||||||
extern cvar_t scr_viewsize;
|
extern cvar_t scr_viewsize;
|
||||||
|
|
||||||
extern cvar_t scr_viewsize;
|
|
||||||
|
|
||||||
qboolean scr_skipupdate;
|
|
||||||
|
|
||||||
qboolean SCR_RSShot (void);
|
qboolean SCR_RSShot (void);
|
||||||
|
|
||||||
//void SCR_DrawConsole (qboolean noback);
|
//void SCR_DrawConsole (qboolean noback);
|
||||||
|
|
|
@ -728,10 +728,7 @@ int DSOUND_InitCard (soundcardinfo_t *sc, int cardnum)
|
||||||
dsbuf.lpwfxFormat = NULL;
|
dsbuf.lpwfxFormat = NULL;
|
||||||
|
|
||||||
#ifdef DSBCAPS_GLOBALFOCUS
|
#ifdef DSBCAPS_GLOBALFOCUS
|
||||||
if (snd_inactive.ival
|
if (snd_inactive.ival || sys_parentwindow
|
||||||
#ifdef NPQTV
|
|
||||||
|| sys_parentwindow
|
|
||||||
#endif
|
|
||||||
) /*always inactive if we have a parent window, because we can't tell properly otherwise*/
|
) /*always inactive if we have a parent window, because we can't tell properly otherwise*/
|
||||||
{
|
{
|
||||||
dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS;
|
dsbuf.dwFlags |= DSBCAPS_GLOBALFOCUS;
|
||||||
|
|
|
@ -666,7 +666,9 @@ sounddriver pSDL_InitCard;
|
||||||
sounddriver pWAV_InitCard;
|
sounddriver pWAV_InitCard;
|
||||||
sounddriver pDroid_InitCard;
|
sounddriver pDroid_InitCard;
|
||||||
sounddriver pAHI_InitCard;
|
sounddriver pAHI_InitCard;
|
||||||
sounddriver pPPAPI_InitCard;
|
#ifdef NACL
|
||||||
|
extern sounddriver pPPAPI_InitCard;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -680,7 +682,9 @@ sdriver_t drivers[] = {
|
||||||
{"MacOS", &pMacOS_InitCard}, //prefered on mac
|
{"MacOS", &pMacOS_InitCard}, //prefered on mac
|
||||||
{"Droid", &pDroid_InitCard}, //prefered on android (java thread)
|
{"Droid", &pDroid_InitCard}, //prefered on android (java thread)
|
||||||
{"AHI", &pAHI_InitCard}, //prefered on morphos
|
{"AHI", &pAHI_InitCard}, //prefered on morphos
|
||||||
|
#ifdef NACL
|
||||||
{"PPAPI", &pPPAPI_InitCard}, //google's native client
|
{"PPAPI", &pPPAPI_InitCard}, //google's native client
|
||||||
|
#endif
|
||||||
{"SNDIO", &pSNDIO_InitCard}, //prefered on OpenBSD
|
{"SNDIO", &pSNDIO_InitCard}, //prefered on OpenBSD
|
||||||
|
|
||||||
{"SDL", &pSDL_InitCard}, //prefered on linux
|
{"SDL", &pSDL_InitCard}, //prefered on linux
|
||||||
|
|
|
@ -913,7 +913,7 @@ char *cleanarg(char *arg)
|
||||||
{
|
{
|
||||||
unsigned char *c;
|
unsigned char *c;
|
||||||
//skip over any leading spaces.
|
//skip over any leading spaces.
|
||||||
while (*arg <= ' ')
|
while (*arg && *arg <= ' ')
|
||||||
arg++;
|
arg++;
|
||||||
|
|
||||||
//reject anything with a leading + or -
|
//reject anything with a leading + or -
|
||||||
|
@ -945,8 +945,13 @@ qboolean Plug_GetBinaryName(char *exe, int exelen, char *basedir, int basedirlen
|
||||||
*exe = 0;
|
*exe = 0;
|
||||||
*basedir = 0;
|
*basedir = 0;
|
||||||
|
|
||||||
// Q_strncpyz(exe, "C:/Games/Quake/fte_trunk/fteglqw_dbg.exe", exelen);
|
#ifdef _DEBUG
|
||||||
// Q_strncpyz(exe, "/home/david/quake/fte_trunk/engine/debug/fteqw.gl", exelen);
|
#ifdef _WIN32
|
||||||
|
Q_strncpyz(exe, "C:/Games/Quake/fte_trunk/fteglqw_dbg.exe", exelen);
|
||||||
|
#else
|
||||||
|
Q_strncpyz(exe, "/home/david/quake/fte_trunk/engine/debug/fteqw.gl", exelen);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
Q_snprintfz(buffer, sizeof(buffer), "%s%s", binarypath, "npfte.txt");
|
Q_snprintfz(buffer, sizeof(buffer), "%s%s", binarypath, "npfte.txt");
|
||||||
|
|
||||||
|
@ -1089,7 +1094,7 @@ qboolean Plug_GenCommandlineString(struct context *ctx, char *cmdline, int cmdli
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
//add quotes for any arguments with spaces
|
//add quotes for any arguments with spaces
|
||||||
if (strchr(argv[i], ' ') || strchr(argv[i], '\t'))
|
if (!*argv[i] || strchr(argv[i], ' ') || strchr(argv[i], '\t'))
|
||||||
{
|
{
|
||||||
Q_strncatz(cmdline, "\"", cmdlinelen);
|
Q_strncatz(cmdline, "\"", cmdlinelen);
|
||||||
Q_strncatz(cmdline, argv[i], cmdlinelen);
|
Q_strncatz(cmdline, argv[i], cmdlinelen);
|
||||||
|
|
|
@ -1509,8 +1509,6 @@ void Sys_SendKeyEvents (void)
|
||||||
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
|
while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
// we always update if there are any event, even if we're paused
|
// we always update if there are any event, even if we're paused
|
||||||
scr_skipupdate = 0;
|
|
||||||
|
|
||||||
//if (!GetMessage (&msg, NULL, 0, 0))
|
//if (!GetMessage (&msg, NULL, 0, 0))
|
||||||
// break;
|
// break;
|
||||||
// Sys_Quit ();
|
// Sys_Quit ();
|
||||||
|
|
|
@ -257,9 +257,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#ifdef NACL
|
#ifdef NACL
|
||||||
#undef CL_MASTER //no sockets support
|
#undef CL_MASTER //no sockets support
|
||||||
#undef SV_MASTER //noone uses this anyway
|
#undef SV_MASTER //noone uses this anyway
|
||||||
#undef VOICECHAT //not going to compile a speex library - I'm too lazy, but it can be done.
|
|
||||||
#undef WEBSERVER //no sockets support (certainly no servers)
|
#undef WEBSERVER //no sockets support (certainly no servers)
|
||||||
#undef WEBCLIENT //no sockets support (could use a different method, but that is non-trivial)
|
|
||||||
#undef TCPCONNECT
|
#undef TCPCONNECT
|
||||||
#undef IRCCONNECT
|
#undef IRCCONNECT
|
||||||
#endif
|
#endif
|
||||||
|
@ -555,6 +553,7 @@ STAT_MONSTERS = 14, // bumped by svc_killedmonster
|
||||||
STAT_ITEMS = 15,
|
STAT_ITEMS = 15,
|
||||||
STAT_VIEWHEIGHT = 16, //same as zquake
|
STAT_VIEWHEIGHT = 16, //same as zquake
|
||||||
STAT_TIME = 17, //zquake
|
STAT_TIME = 17, //zquake
|
||||||
|
STAT_MATCHSTARTTIME = 18,
|
||||||
#ifdef SIDEVIEWS
|
#ifdef SIDEVIEWS
|
||||||
STAT_VIEW2 = 20,
|
STAT_VIEW2 = 20,
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -181,7 +181,7 @@ void MSG_WriteDir (sizebuf_t *sb, float *dir);
|
||||||
|
|
||||||
extern int msg_readcount;
|
extern int msg_readcount;
|
||||||
extern qboolean msg_badread; // set if a read goes beyond end of message
|
extern qboolean msg_badread; // set if a read goes beyond end of message
|
||||||
struct netprim_s msg_nullnetprim;
|
extern struct netprim_s msg_nullnetprim;
|
||||||
|
|
||||||
void MSG_BeginReading (struct netprim_s prim);
|
void MSG_BeginReading (struct netprim_s prim);
|
||||||
void MSG_ChangePrimitives(struct netprim_s prim);
|
void MSG_ChangePrimitives(struct netprim_s prim);
|
||||||
|
|
|
@ -1882,7 +1882,10 @@ qboolean FS_LoadPackageFromFile(vfsfile_t *vfs, char *pname, char *localname, in
|
||||||
{
|
{
|
||||||
handle = searchpathformats[i].funcs->OpenNew (vfs, localname);
|
handle = searchpathformats[i].funcs->OpenNew (vfs, localname);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
|
{
|
||||||
|
Con_Printf("file %s isn't a %s after all\n", pname, searchpathformats[i].extension);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (crc)
|
if (crc)
|
||||||
{
|
{
|
||||||
int truecrc = searchpathformats[i].funcs->GeneratePureCRC(handle, 0, false);
|
int truecrc = searchpathformats[i].funcs->GeneratePureCRC(handle, 0, false);
|
||||||
|
@ -2583,9 +2586,13 @@ void FS_StartupWithGame(int gamenum)
|
||||||
i = COM_CheckParm ("-addbasegame");
|
i = COM_CheckParm ("-addbasegame");
|
||||||
while (i && i < com_argc-1) //use multiple -addbasegames (this is so the basic dirs don't die)
|
while (i && i < com_argc-1) //use multiple -addbasegames (this is so the basic dirs don't die)
|
||||||
{
|
{
|
||||||
FS_AddGameDirectory (com_argv[i+1], va("%s%s", com_quakedir, com_argv[i+1]), ~0);
|
//reject various evil path arguments.
|
||||||
if (*com_homedir)
|
if (*com_argv[i+1] && !(strchr(com_argv[i+1], '.') || strchr(com_argv[i+1], ':') || strchr(com_argv[i+1], '?') || strchr(com_argv[i+1], '*') || strchr(com_argv[i+1], '/') || strchr(com_argv[i+1], '\\') || strchr(com_argv[i+1], '$')))
|
||||||
FS_AddGameDirectory (com_argv[i+1], va("%s%s", com_homedir, com_argv[i+1]), ~0);
|
{
|
||||||
|
FS_AddGameDirectory (com_argv[i+1], va("%s%s", com_quakedir, com_argv[i+1]), ~0);
|
||||||
|
if (*com_homedir)
|
||||||
|
FS_AddGameDirectory (com_argv[i+1], va("%s%s", com_homedir, com_argv[i+1]), ~0);
|
||||||
|
}
|
||||||
|
|
||||||
i = COM_CheckNextParm ("-addbasegame", i);
|
i = COM_CheckNextParm ("-addbasegame", i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,9 +203,8 @@ void *FSPAK_LoadPackFile (vfsfile_t *file, const char *desc)
|
||||||
if (header.id[0] != 'P' || header.id[1] != 'A'
|
if (header.id[0] != 'P' || header.id[1] != 'A'
|
||||||
|| header.id[2] != 'C' || header.id[3] != 'K')
|
|| header.id[2] != 'C' || header.id[3] != 'K')
|
||||||
{
|
{
|
||||||
VFS_CLOSE(packhandle);
|
Con_Printf("%s is not a pak - %c%c%c%c\n", desc, header.id[0], header.id[1], header.id[2], header.id[3]);
|
||||||
return NULL;
|
return NULL;
|
||||||
// Sys_Error ("%s is not a packfile", packfile);
|
|
||||||
}
|
}
|
||||||
header.dirofs = LittleLong (header.dirofs);
|
header.dirofs = LittleLong (header.dirofs);
|
||||||
header.dirlen = LittleLong (header.dirlen);
|
header.dirlen = LittleLong (header.dirlen);
|
||||||
|
|
|
@ -3334,6 +3334,58 @@ qboolean CModQ3_LoadVisibility (lump_t *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
|
void CModQ3_LoadLighting (lump_t *l)
|
||||||
|
{
|
||||||
|
qbyte *in = mod_base + l->fileofs;
|
||||||
|
qbyte *out;
|
||||||
|
unsigned int samples = l->filelen;
|
||||||
|
int m, s;
|
||||||
|
int mapsize = loadmodel->lightmaps.width*loadmodel->lightmaps.height*3;
|
||||||
|
int maps;
|
||||||
|
|
||||||
|
extern cvar_t gl_overbright;
|
||||||
|
extern qbyte lmgamma[256];
|
||||||
|
extern void BuildLightMapGammaTable (float g, float c);
|
||||||
|
loadmodel->engineflags &= ~MDLF_RGBLIGHTING;
|
||||||
|
|
||||||
|
//round up the samples, in case the last one is partial.
|
||||||
|
maps = ((samples+mapsize-1)&~(mapsize-1)) / mapsize;
|
||||||
|
|
||||||
|
//q3 maps have built in 4-fold overbright.
|
||||||
|
//if we're not rendering with that, we need to brighten the lightmaps in order to keep the darker parts the same brightness. we loose the 2 upper bits. those bright areas become uniform and indistinct.
|
||||||
|
gl_overbright.flags |= CVAR_LATCH;
|
||||||
|
BuildLightMapGammaTable(1, (1<<(2-gl_overbright.ival)));
|
||||||
|
|
||||||
|
loadmodel->engineflags |= MDLF_RGBLIGHTING;
|
||||||
|
loadmodel->lightdata = out = Hunk_AllocName(samples, "lit data");
|
||||||
|
|
||||||
|
//be careful here, q3bsp deluxemapping is done using interleaving. we want to unoverbright ONLY lightmaps and not deluxemaps.
|
||||||
|
for (m = 0; m < maps; m++)
|
||||||
|
{
|
||||||
|
if (loadmodel->lightmaps.deluxemapping && (m & 1))
|
||||||
|
{
|
||||||
|
//no gamma for deluxemap
|
||||||
|
for(s = 0; s < mapsize; s+=3)
|
||||||
|
{
|
||||||
|
*out++ = in[0];
|
||||||
|
*out++ = in[1];
|
||||||
|
*out++ = in[2];
|
||||||
|
in += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(s = 0; s < mapsize; s++)
|
||||||
|
{
|
||||||
|
*out++ = lmgamma[*in++];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_lightmap_saturation.value != 1.0f)
|
||||||
|
SaturateR8G8B8(out - mapsize, mapsize, r_lightmap_saturation.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qboolean CModQ3_LoadLightgrid (lump_t *l)
|
qboolean CModQ3_LoadLightgrid (lump_t *l)
|
||||||
{
|
{
|
||||||
dq3gridlight_t *in;
|
dq3gridlight_t *in;
|
||||||
|
@ -3849,8 +3901,6 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
if (qrenderer != QR_NONE)
|
if (qrenderer != QR_NONE)
|
||||||
{
|
{
|
||||||
if (noerrors)
|
|
||||||
RMod_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
|
|
||||||
if (header.version == 1)
|
if (header.version == 1)
|
||||||
noerrors = noerrors && CModRBSP_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID], &header.lumps[RBSPLUMP_LIGHTINDEXES]);
|
noerrors = noerrors && CModRBSP_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID], &header.lumps[RBSPLUMP_LIGHTINDEXES]);
|
||||||
else
|
else
|
||||||
|
@ -3881,6 +3931,22 @@ cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned *c
|
||||||
if (!loadmodel->textures[i]->shader)
|
if (!loadmodel->textures[i]->shader)
|
||||||
loadmodel->textures[i]->shader = R_RegisterShader_Lightmap(loadmodel->textures[i]->name);
|
loadmodel->textures[i]->shader = R_RegisterShader_Lightmap(loadmodel->textures[i]->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (loadmodel->fromgame == fg_quake3)
|
||||||
|
{
|
||||||
|
i = header.lumps[Q3LUMP_LIGHTMAPS].filelen / (loadmodel->lightmaps.width*loadmodel->lightmaps.height*3);
|
||||||
|
loadmodel->lightmaps.deluxemapping = !(i&1);
|
||||||
|
loadmodel->lightmaps.count = max(loadmodel->lightmaps.count, i);
|
||||||
|
|
||||||
|
for (i = 0; i < loadmodel->numsurfaces && loadmodel->lightmaps.deluxemapping; i++)
|
||||||
|
{
|
||||||
|
if (loadmodel->surfaces[i].lightmaptexturenums[0] >= 0 && (loadmodel->surfaces[i].lightmaptexturenums[0] & 1))
|
||||||
|
loadmodel->lightmaps.deluxemapping = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (noerrors)
|
||||||
|
CModQ3_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
noerrors = noerrors && CModQ3_LoadLeafFaces (&header.lumps[Q3LUMP_LEAFSURFACES]);
|
noerrors = noerrors && CModQ3_LoadLeafFaces (&header.lumps[Q3LUMP_LEAFSURFACES]);
|
||||||
|
|
|
@ -880,11 +880,11 @@ qboolean NET_StringToAdr (const char *s, int defaultport, netadr_t *a)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*code for convienience - no other protocols work anyway*/
|
/*code for convienience - no other protocols work anyway*/
|
||||||
static qboolean warned;
|
static float warned;
|
||||||
if (!warned)
|
if (warned < realtime)
|
||||||
{
|
{
|
||||||
Con_Printf("Note: Native client builds can only connect to websocket servers.\n");
|
Con_Printf("Note: Assuming ws:// prefix\n");
|
||||||
warned = true;
|
warned = realtime + 1;
|
||||||
}
|
}
|
||||||
memset (a, 0, sizeof(*a));
|
memset (a, 0, sizeof(*a));
|
||||||
a->type = NA_WEBSOCKET;
|
a->type = NA_WEBSOCKET;
|
||||||
|
@ -2447,9 +2447,53 @@ closesvstream:
|
||||||
{
|
{
|
||||||
memmove(st->inbuffer, st->inbuffer+i, st->inlen - (i));
|
memmove(st->inbuffer, st->inbuffer+i, st->inlen - (i));
|
||||||
st->inlen -= i;
|
st->inlen -= i;
|
||||||
resp = va( "HTTP/1.1 426 Upgrade Required\r\n"
|
if (!strcmp(arg[WCATTR_URL], "/live.html"))
|
||||||
"Sec-WebSocket-Version: 13\r\n"
|
{
|
||||||
"\r\n");
|
resp = va( "HTTP/1.1 200 Ok\r\n"
|
||||||
|
"Connection: Close\r\n"
|
||||||
|
"Content-Type: text/html\r\n"
|
||||||
|
"\r\n"
|
||||||
|
"<!DOCTYPE HTML>"
|
||||||
|
"<html>"
|
||||||
|
"<style>"
|
||||||
|
"html, body { height: 100%%; width: 100%%; margin: 0; padding: 0;}"
|
||||||
|
"div { height: 100%%; width: 100%%; }"
|
||||||
|
"</style>"
|
||||||
|
"<div>"
|
||||||
|
"<object name=\"ieplug\" type=\"application/x-fteplugin\" classid=\"clsid:7d676c9f-fb84-40b6-b3ff-e10831557eeb\" width=\"100%%\" height=\"100%%\">"
|
||||||
|
"<param name=\"game\" value=\"q1\">"
|
||||||
|
"<object name=\"npplug\" type=\"application/x-fteplugin\" width=\"100%%\" height=\"100%%\">"
|
||||||
|
"<param name=\"game\" value=\"q1\">"
|
||||||
|
"Please install a plugin first.<br/>"
|
||||||
|
"</object>"
|
||||||
|
"</object>"
|
||||||
|
"</div>"
|
||||||
|
"</html>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/*else if (!strcmp(arg[WCATTR_URL], "/index.html") || !strcmp(arg[WCATTR_URL], "/"))
|
||||||
|
{
|
||||||
|
resp = va( "HTTP/1.1 200 Ok\r\n"
|
||||||
|
"Connection: Close\r\n"
|
||||||
|
"Content-Type: text/html\r\n"
|
||||||
|
"\r\n"
|
||||||
|
|
||||||
|
"This is a Quake WebSocket server, not an http server.<br/>\r\n"
|
||||||
|
"<a href='"ENGINEWEBSITE"'>"FULLENGINENAME"</a>"
|
||||||
|
);
|
||||||
|
}*/
|
||||||
|
else
|
||||||
|
{
|
||||||
|
resp = va( "HTTP/1.1 404 Ok\r\n"
|
||||||
|
"Connection: Close\r\n"
|
||||||
|
"Content-Type: text/html\r\n"
|
||||||
|
"\r\n"
|
||||||
|
|
||||||
|
"This is a Quake WebSocket server, not an http server.<br/>\r\n"
|
||||||
|
"<a href='"ENGINEWEBSITE"'>"FULLENGINENAME"</a>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//send the websocket handshake rejection.
|
//send the websocket handshake rejection.
|
||||||
send(st->socketnum, resp, strlen(resp), 0);
|
send(st->socketnum, resp, strlen(resp), 0);
|
||||||
|
|
||||||
|
@ -3675,9 +3719,9 @@ static qboolean FTENET_WebSocket_SendPacket(ftenet_generic_connection_t *gcon, i
|
||||||
|
|
||||||
while(length-->0)
|
while(length-->0)
|
||||||
{
|
{
|
||||||
/*FIXME: do we need this code?*/
|
|
||||||
if (!*in)
|
if (!*in)
|
||||||
{
|
{
|
||||||
|
//sends 256 instead of 0
|
||||||
*out++ = 0xc0 | (0x100 >> 6);
|
*out++ = 0xc0 | (0x100 >> 6);
|
||||||
*out++ = 0x80 | (0x100 & 0x3f);
|
*out++ = 0x80 | (0x100 & 0x3f);
|
||||||
}
|
}
|
||||||
|
@ -3711,7 +3755,7 @@ static ftenet_generic_connection_t *FTENET_WebSocket_EstablishConnection(qboolea
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!NET_StringToAdr(address, &adr))
|
if (!NET_StringToAdr(address, 80, &adr))
|
||||||
return NULL; //couldn't resolve the name
|
return NULL; //couldn't resolve the name
|
||||||
newcon = Z_Malloc(sizeof(*newcon));
|
newcon = Z_Malloc(sizeof(*newcon));
|
||||||
if (newcon)
|
if (newcon)
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
AdditionalIncludeDirectories="..\client;../common;../server;../gl;../sw;../qclib;../libs;../libs/dxsdk7/include;../libs/freetype2/include;../libs/speex"
|
AdditionalIncludeDirectories="..\client;../common;../server;../gl;../sw;../qclib;../libs;../libs/dxsdk7/include;../libs/freetype2/include;../libs/speex;../"
|
||||||
PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;NPQTV;MULTITHREAD"
|
PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;NPQTV;MULTITHREAD"
|
||||||
RuntimeLibrary="1"
|
RuntimeLibrary="1"
|
||||||
FloatingPointModel="2"
|
FloatingPointModel="2"
|
||||||
|
|
|
@ -6,7 +6,7 @@ void DumpGLState(void);
|
||||||
|
|
||||||
#ifdef GLQUAKE
|
#ifdef GLQUAKE
|
||||||
|
|
||||||
#define r_refract_fboival 1
|
#define r_refract_fboival gl_config.ext_framebuffer_objects
|
||||||
|
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
|
@ -191,7 +191,7 @@ struct {
|
||||||
batch_t *wbatches;
|
batch_t *wbatches;
|
||||||
} shaderstate;
|
} shaderstate;
|
||||||
|
|
||||||
struct {
|
static struct {
|
||||||
int numlights;
|
int numlights;
|
||||||
int shadowsurfcount;
|
int shadowsurfcount;
|
||||||
} bench;
|
} bench;
|
||||||
|
@ -458,7 +458,8 @@ static void BE_ApplyAttributes(unsigned int bitstochange, unsigned int bitstoend
|
||||||
{
|
{
|
||||||
if (!shaderstate.curcolourpointer && !shaderstate.curcolourvbo)
|
if (!shaderstate.curcolourpointer && !shaderstate.curcolourvbo)
|
||||||
{
|
{
|
||||||
qglShadeModel(GL_SMOOTH);
|
if (qglShadeModel)
|
||||||
|
qglShadeModel(GL_SMOOTH);
|
||||||
bitstoendisable |= (1u<<VATTR_LEG_COLOUR);
|
bitstoendisable |= (1u<<VATTR_LEG_COLOUR);
|
||||||
}
|
}
|
||||||
shaderstate.curcolourpointer = shaderstate.pendingcolourpointer;
|
shaderstate.curcolourpointer = shaderstate.pendingcolourpointer;
|
||||||
|
@ -949,7 +950,8 @@ void GLBE_SetupForShadowMap(texid_t shadowmaptex)
|
||||||
|
|
||||||
shaderstate.shaderbits &= ~SBITS_MISC_DEPTHWRITE;
|
shaderstate.shaderbits &= ~SBITS_MISC_DEPTHWRITE;
|
||||||
|
|
||||||
qglShadeModel(GL_FLAT);
|
if (qglShadeModel)
|
||||||
|
qglShadeModel(GL_FLAT);
|
||||||
BE_SetPassBlendMode(0, PBM_REPLACE);
|
BE_SetPassBlendMode(0, PBM_REPLACE);
|
||||||
GL_ForceDepthWritable();
|
GL_ForceDepthWritable();
|
||||||
// qglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
// qglColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
|
||||||
|
@ -2289,7 +2291,7 @@ static void BE_SendPassBlendDepthMask(unsigned int sbits)
|
||||||
{
|
{
|
||||||
if ((sbits & SBITS_BLEND_BITS) == (SBITS_SRCBLEND_ONE| SBITS_DSTBLEND_ZERO) || !(sbits & SBITS_BLEND_BITS)) /*if transparency is forced, clear alpha test bits*/
|
if ((sbits & SBITS_BLEND_BITS) == (SBITS_SRCBLEND_ONE| SBITS_DSTBLEND_ZERO) || !(sbits & SBITS_BLEND_BITS)) /*if transparency is forced, clear alpha test bits*/
|
||||||
sbits = (sbits & ~(SBITS_BLEND_BITS|SBITS_ATEST_BITS))
|
sbits = (sbits & ~(SBITS_BLEND_BITS|SBITS_ATEST_BITS))
|
||||||
| (SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA);
|
| (SBITS_SRCBLEND_SRC_ALPHA | SBITS_DSTBLEND_ONE_MINUS_SRC_ALPHA | SBITS_ATEST_GT0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shaderstate.flags & BEF_FORCENODEPTH) /*EF_NODEPTHTEST dp extension*/
|
if (shaderstate.flags & BEF_FORCENODEPTH) /*EF_NODEPTHTEST dp extension*/
|
||||||
|
@ -3878,7 +3880,7 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist)
|
||||||
continue;
|
continue;
|
||||||
oldbem = shaderstate.mode;
|
oldbem = shaderstate.mode;
|
||||||
|
|
||||||
if (batch->shader->flags & SHADER_HASREFLECT)
|
if ((batch->shader->flags & SHADER_HASREFLECT) && gl_config.ext_framebuffer_objects)
|
||||||
{
|
{
|
||||||
vrect_t orect = r_refdef.vrect;
|
vrect_t orect = r_refdef.vrect;
|
||||||
if (!shaderstate.tex_reflection.num)
|
if (!shaderstate.tex_reflection.num)
|
||||||
|
@ -3941,9 +3943,9 @@ static void GLBE_SubmitMeshesSortList(batch_t *sortlist)
|
||||||
r_refdef.vrect = orect;
|
r_refdef.vrect = orect;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GLR_DrawPortal(batch, cl.worldmodel->batches, 2);
|
GLR_DrawPortal(batch, cl.worldmodel->batches, 3);
|
||||||
}
|
}
|
||||||
if (batch->shader->flags & SHADER_HASRIPPLEMAP)
|
if ((batch->shader->flags & SHADER_HASRIPPLEMAP) && gl_config.ext_framebuffer_objects)
|
||||||
{
|
{
|
||||||
vrect_t orect;
|
vrect_t orect;
|
||||||
if (!shaderstate.tex_ripplemap.num)
|
if (!shaderstate.tex_ripplemap.num)
|
||||||
|
|
|
@ -148,8 +148,6 @@ extern cvar_t gl_texturemode, gl_texture_anisotropic_filtering;
|
||||||
|
|
||||||
extern cvar_t gl_savecompressedtex;
|
extern cvar_t gl_savecompressedtex;
|
||||||
|
|
||||||
texid_t missing_texture; //texture used when one is missing.
|
|
||||||
|
|
||||||
int gl_anisotropy_factor;
|
int gl_anisotropy_factor;
|
||||||
|
|
||||||
mpic_t *conback;
|
mpic_t *conback;
|
||||||
|
@ -269,6 +267,9 @@ void GL_Mipcap_Callback (struct cvar_s *var, char *oldvalue)
|
||||||
gltexture_t *glt;
|
gltexture_t *glt;
|
||||||
char *s = var->string;
|
char *s = var->string;
|
||||||
|
|
||||||
|
if (gl_config.gles)
|
||||||
|
return;
|
||||||
|
|
||||||
s = COM_Parse(s);
|
s = COM_Parse(s);
|
||||||
gl_mipcap_min = *com_token?atoi(com_token):0;
|
gl_mipcap_min = *com_token?atoi(com_token):0;
|
||||||
if (gl_mipcap_min > 3) /*cap it to 3, so no 16*16 textures get bugged*/
|
if (gl_mipcap_min > 3) /*cap it to 3, so no 16*16 textures get bugged*/
|
||||||
|
|
|
@ -37,11 +37,9 @@ extern int gl_stencilbits;
|
||||||
FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2DARB;
|
FTEPFNGLCOMPRESSEDTEXIMAGE2DARBPROC qglCompressedTexImage2DARB;
|
||||||
FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImageARB;
|
FTEPFNGLGETCOMPRESSEDTEXIMAGEARBPROC qglGetCompressedTexImageARB;
|
||||||
|
|
||||||
entity_t r_worldentity;
|
|
||||||
|
|
||||||
vec3_t modelorg, r_entorigin;
|
vec3_t modelorg, r_entorigin;
|
||||||
|
|
||||||
int r_visframecount; // bumped when going to a new PVS
|
extern int r_visframecount; // bumped when going to a new PVS
|
||||||
extern int r_framecount; // used for dlight push checking
|
extern int r_framecount; // used for dlight push checking
|
||||||
|
|
||||||
float r_wateralphaval; //allowed or not...
|
float r_wateralphaval; //allowed or not...
|
||||||
|
@ -53,12 +51,10 @@ int c_brush_polys, c_alias_polys;
|
||||||
//
|
//
|
||||||
// view origin
|
// view origin
|
||||||
//
|
//
|
||||||
vec3_t vup;
|
//vec3_t vup;
|
||||||
vec3_t vpn;
|
//vec3_t vpn;
|
||||||
vec3_t vright;
|
//vec3_t vright;
|
||||||
vec3_t r_origin;
|
//vec3_t r_origin;
|
||||||
|
|
||||||
texture_t *r_notexture_mip;
|
|
||||||
|
|
||||||
cvar_t r_norefresh = SCVAR("r_norefresh","0");
|
cvar_t r_norefresh = SCVAR("r_norefresh","0");
|
||||||
|
|
||||||
|
@ -426,7 +422,7 @@ void R_SetupGL (float stereooffset)
|
||||||
stencilshadows |= r_shadow_realtime_world.ival && r_shadow_realtime_world_shadows.ival;
|
stencilshadows |= r_shadow_realtime_world.ival && r_shadow_realtime_world_shadows.ival;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (1)//(!stencilshadows || !gl_stencilbits) && gl_maxdist.value>=100)//gl_nv_range_clamp)
|
if ((!stencilshadows || !gl_stencilbits) && gl_maxdist.value>=100)//gl_nv_range_clamp)
|
||||||
{
|
{
|
||||||
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*180/M_PI;
|
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*180/M_PI;
|
||||||
// yfov = (2.0 * tan (scr_fov.value/360*M_PI)) / screenaspect;
|
// yfov = (2.0 * tan (scr_fov.value/360*M_PI)) / screenaspect;
|
||||||
|
@ -807,14 +803,15 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, int portaltype)
|
||||||
|
|
||||||
r_refdef.externalview = true;
|
r_refdef.externalview = true;
|
||||||
|
|
||||||
if (portaltype == 1)
|
switch(portaltype)
|
||||||
{
|
{
|
||||||
/*explicit mirror*/
|
case 1: /*fbo explicit mirror (fucked depth, working clip plane)*/
|
||||||
r_refdef.flipcull ^= true;
|
r_refdef.flipcull ^= true;
|
||||||
R_MirrorMatrix(&plane);
|
R_MirrorMatrix(&plane);
|
||||||
}
|
break;
|
||||||
else if (portaltype == 2)
|
|
||||||
{
|
case 2: /*fbo refraction (fucked depth, working clip plane)*/
|
||||||
|
case 3: /*screen copy refraction (screen depth, fucked clip planes)*/
|
||||||
/*refraction image (same view, just with things culled*/
|
/*refraction image (same view, just with things culled*/
|
||||||
r_refdef.externalview = oldrefdef.externalview;
|
r_refdef.externalview = oldrefdef.externalview;
|
||||||
VectorNegate(plane.normal, plane.normal);
|
VectorNegate(plane.normal, plane.normal);
|
||||||
|
@ -864,50 +861,54 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, int portaltype)
|
||||||
}
|
}
|
||||||
// memset(newvis, 0xff, pvsbytes);
|
// memset(newvis, 0xff, pvsbytes);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if (batch->ent != &r_worldentity)
|
|
||||||
{
|
|
||||||
float d;
|
|
||||||
view = batch->ent;
|
|
||||||
d = DotProduct(r_refdef.vieworg, plane.normal) - plane.dist;
|
|
||||||
d-= 0.1; //nudge it past.
|
|
||||||
VectorAdd(r_refdef.vieworg, view->oldorigin, r_refdef.vieworg); //trivial offset for the warpzone.
|
|
||||||
VectorMA(r_refdef.vieworg, -d, plane.normal, r_refdef.pvsorigin); //clip the pvs origin to the plane.
|
|
||||||
}
|
|
||||||
else if (!(view = R_NearestPortal(&plane)) || VectorCompare(view->origin, view->oldorigin))
|
|
||||||
{
|
|
||||||
r_refdef.flipcull ^= true;
|
|
||||||
R_MirrorMatrix(&plane);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float d;
|
|
||||||
vec3_t paxis[3], porigin, vaxis[3], vorg;
|
|
||||||
void PerpendicularVector( vec3_t dst, const vec3_t src );
|
|
||||||
|
|
||||||
/*calculate where the surface is meant to be*/
|
default: /*q3 portal*/
|
||||||
VectorCopy(mesh->normals_array[0], paxis[0]);
|
if (batch->ent != &r_worldentity)
|
||||||
PerpendicularVector(paxis[1], paxis[0]);
|
{
|
||||||
CrossProduct(paxis[0], paxis[1], paxis[2]);
|
float d;
|
||||||
d = DotProduct(view->origin, plane.normal) - plane.dist;
|
view = batch->ent;
|
||||||
VectorMA(view->origin, -d, paxis[0], porigin);
|
d = DotProduct(r_refdef.vieworg, plane.normal) - plane.dist;
|
||||||
|
d-= 0.1; //nudge it past.
|
||||||
|
VectorAdd(r_refdef.vieworg, view->oldorigin, r_refdef.vieworg); //trivial offset for the warpzone.
|
||||||
|
VectorMA(r_refdef.vieworg, -d, plane.normal, r_refdef.pvsorigin); //clip the pvs origin to the plane.
|
||||||
|
}
|
||||||
|
else if (!(view = R_NearestPortal(&plane)) || VectorCompare(view->origin, view->oldorigin))
|
||||||
|
{
|
||||||
|
r_refdef.flipcull ^= true;
|
||||||
|
R_MirrorMatrix(&plane);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float d;
|
||||||
|
vec3_t paxis[3], porigin, vaxis[3], vorg;
|
||||||
|
void PerpendicularVector( vec3_t dst, const vec3_t src );
|
||||||
|
|
||||||
/*grab the camera origin*/
|
/*calculate where the surface is meant to be*/
|
||||||
VectorNegate(view->axis[0], vaxis[0]);
|
VectorCopy(mesh->normals_array[0], paxis[0]);
|
||||||
VectorNegate(view->axis[1], vaxis[1]);
|
PerpendicularVector(paxis[1], paxis[0]);
|
||||||
VectorCopy(view->axis[2], vaxis[2]);
|
CrossProduct(paxis[0], paxis[1], paxis[2]);
|
||||||
VectorCopy(view->oldorigin, vorg);
|
d = DotProduct(view->origin, plane.normal) - plane.dist;
|
||||||
|
VectorMA(view->origin, -d, paxis[0], porigin);
|
||||||
|
|
||||||
VectorCopy(vorg, r_refdef.pvsorigin);
|
/*grab the camera origin*/
|
||||||
|
VectorNegate(view->axis[0], vaxis[0]);
|
||||||
|
VectorNegate(view->axis[1], vaxis[1]);
|
||||||
|
VectorCopy(view->axis[2], vaxis[2]);
|
||||||
|
VectorCopy(view->oldorigin, vorg);
|
||||||
|
|
||||||
/*rotate it a bit*/
|
VectorCopy(vorg, r_refdef.pvsorigin);
|
||||||
RotatePointAroundVector(vaxis[1], vaxis[0], view->axis[1], sin(realtime)*4);
|
|
||||||
CrossProduct(vaxis[0], vaxis[1], vaxis[2]);
|
|
||||||
|
|
||||||
TransformCoord(oldrefdef.vieworg, paxis, porigin, vaxis, vorg, r_refdef.vieworg);
|
/*rotate it a bit*/
|
||||||
TransformDir(vpn, paxis, vaxis, vpn);
|
RotatePointAroundVector(vaxis[1], vaxis[0], view->axis[1], sin(realtime)*4);
|
||||||
TransformDir(vright, paxis, vaxis, vright);
|
CrossProduct(vaxis[0], vaxis[1], vaxis[2]);
|
||||||
TransformDir(vup, paxis, vaxis, vup);
|
|
||||||
|
TransformCoord(oldrefdef.vieworg, paxis, porigin, vaxis, vorg, r_refdef.vieworg);
|
||||||
|
TransformDir(vpn, paxis, vaxis, vpn);
|
||||||
|
TransformDir(vright, paxis, vaxis, vright);
|
||||||
|
TransformDir(vup, paxis, vaxis, vup);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
|
||||||
VectorAngles(vpn, vup, r_refdef.viewangles);
|
VectorAngles(vpn, vup, r_refdef.viewangles);
|
||||||
|
@ -939,7 +940,8 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist, int portaltype)
|
||||||
frustum[4].normal[1] = plane.normal[1];
|
frustum[4].normal[1] = plane.normal[1];
|
||||||
frustum[4].normal[2] = plane.normal[2];
|
frustum[4].normal[2] = plane.normal[2];
|
||||||
frustum[4].dist = plane.dist + 0.01;
|
frustum[4].dist = plane.dist + 0.01;
|
||||||
R_ObliqueNearClip(&frustum[4]);
|
if (portaltype == 1 || portaltype == 2)
|
||||||
|
R_ObliqueNearClip(&frustum[4]);
|
||||||
R_RenderScene();
|
R_RenderScene();
|
||||||
// if (qglClipPlane)
|
// if (qglClipPlane)
|
||||||
// qglDisable(GL_CLIP_PLANE0);
|
// qglDisable(GL_CLIP_PLANE0);
|
||||||
|
|
|
@ -4185,6 +4185,10 @@ char *Shader_DefaultBSPWater(char *shortname)
|
||||||
wstyle = 1;
|
wstyle = 1;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#ifdef GLQUAKE
|
||||||
|
if (wstyle > 2 && !gl_config.ext_framebuffer_objects)
|
||||||
|
wstyle = 2;
|
||||||
|
#endif
|
||||||
switch(wstyle)
|
switch(wstyle)
|
||||||
{
|
{
|
||||||
case -1: //invisible
|
case -1: //invisible
|
||||||
|
|
|
@ -44,7 +44,7 @@ shader_t *crepuscular_shader;
|
||||||
static void Sh_DrawEntLighting(dlight_t *light, vec3_t colour);
|
static void Sh_DrawEntLighting(dlight_t *light, vec3_t colour);
|
||||||
|
|
||||||
|
|
||||||
struct {
|
static struct {
|
||||||
int numlights;
|
int numlights;
|
||||||
int shadowsurfcount;
|
int shadowsurfcount;
|
||||||
|
|
||||||
|
@ -202,6 +202,7 @@ static void SHM_TriangleFan(int numverts, vecV_t *verts, vec3_t lightorg, float
|
||||||
v = (sh_shmesh->numverts+numverts*2 + inc)&~(inc-1); //and a bit of padding
|
v = (sh_shmesh->numverts+numverts*2 + inc)&~(inc-1); //and a bit of padding
|
||||||
if (sh_shmesh->maxverts < v)
|
if (sh_shmesh->maxverts < v)
|
||||||
{
|
{
|
||||||
|
v += 1024;
|
||||||
sh_shmesh->maxverts = v;
|
sh_shmesh->maxverts = v;
|
||||||
sh_shmesh->verts = BZ_Realloc(sh_shmesh->verts, v * sizeof(*sh_shmesh->verts));
|
sh_shmesh->verts = BZ_Realloc(sh_shmesh->verts, v * sizeof(*sh_shmesh->verts));
|
||||||
}
|
}
|
||||||
|
@ -226,6 +227,7 @@ static void SHM_TriangleFan(int numverts, vecV_t *verts, vec3_t lightorg, float
|
||||||
v = (sh_shmesh->numindicies+idxs*2+inc)&~(inc-1); //and a bit of padding
|
v = (sh_shmesh->numindicies+idxs*2+inc)&~(inc-1); //and a bit of padding
|
||||||
if (sh_shmesh->maxindicies < v)
|
if (sh_shmesh->maxindicies < v)
|
||||||
{
|
{
|
||||||
|
v += 1024;
|
||||||
sh_shmesh->maxindicies = v;
|
sh_shmesh->maxindicies = v;
|
||||||
sh_shmesh->indicies = BZ_Realloc(sh_shmesh->indicies, v * sizeof(*sh_shmesh->indicies));
|
sh_shmesh->indicies = BZ_Realloc(sh_shmesh->indicies, v * sizeof(*sh_shmesh->indicies));
|
||||||
}
|
}
|
||||||
|
@ -2141,9 +2143,13 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, 90, 90, nearplane, l->radius);
|
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, 90, 90, nearplane, l->radius);
|
||||||
qglMatrixMode(GL_PROJECTION);
|
|
||||||
qglLoadMatrixf(r_refdef.m_projection);
|
if (!gl_config.nofixedfunc)
|
||||||
qglMatrixMode(GL_MODELVIEW);
|
{
|
||||||
|
qglMatrixMode(GL_PROJECTION);
|
||||||
|
qglLoadMatrixf(r_refdef.m_projection);
|
||||||
|
qglMatrixMode(GL_MODELVIEW);
|
||||||
|
}
|
||||||
|
|
||||||
/*generate faces*/
|
/*generate faces*/
|
||||||
for (f = 0; f < 6; f++)
|
for (f = 0; f < 6; f++)
|
||||||
|
@ -2159,11 +2165,13 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis)
|
||||||
|
|
||||||
qglDisable(GL_POLYGON_OFFSET_FILL);
|
qglDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
|
||||||
qglMatrixMode(GL_PROJECTION);
|
if (!gl_config.nofixedfunc)
|
||||||
qglLoadMatrixf(r_refdef.m_projection);
|
{
|
||||||
|
qglMatrixMode(GL_PROJECTION);
|
||||||
qglMatrixMode(GL_MODELVIEW);
|
qglLoadMatrixf(r_refdef.m_projection);
|
||||||
qglLoadMatrixf(r_refdef.m_view);
|
qglMatrixMode(GL_MODELVIEW);
|
||||||
|
qglLoadMatrixf(r_refdef.m_view);
|
||||||
|
}
|
||||||
|
|
||||||
qglViewport(r_refdef.pxrect.x, vid.pixelheight - r_refdef.pxrect.y, r_refdef.pxrect.width, r_refdef.pxrect.height);
|
qglViewport(r_refdef.pxrect.x, vid.pixelheight - r_refdef.pxrect.y, r_refdef.pxrect.width, r_refdef.pxrect.height);
|
||||||
|
|
||||||
|
@ -2601,7 +2609,7 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis)
|
||||||
if (gl_config.ext_stencil_wrap)
|
if (gl_config.ext_stencil_wrap)
|
||||||
{ //minimise damage...
|
{ //minimise damage...
|
||||||
sbackfail = GL_INCR_WRAP_EXT;
|
sbackfail = GL_INCR_WRAP_EXT;
|
||||||
sdecrw = GL_DECR_WRAP_EXT;
|
sfrontfail = GL_DECR_WRAP_EXT;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
sref = (1<<gl_stencilbits)-1; /*this is halved for two-sided stencil support, just in case there's no wrap support*/
|
sref = (1<<gl_stencilbits)-1; /*this is halved for two-sided stencil support, just in case there's no wrap support*/
|
||||||
|
@ -2623,17 +2631,18 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis)
|
||||||
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
qglColor3f(dl->color[0], dl->color[1], dl->color[2]);
|
qglColor3f(dl->color[0], dl->color[1], dl->color[2]);
|
||||||
qglDisable(GL_STENCIL_TEST);
|
qglDisable(GL_STENCIL_TEST);
|
||||||
qglEnable(GL_POLYGON_OFFSET_FILL);
|
// qglEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
qglPolygonOffset(-1, -1);
|
// qglPolygonOffset(-1, -1);
|
||||||
// qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
// qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||||
Sh_DrawStencilLightShadows(dl, lvis, vvis, false);
|
Sh_DrawStencilLightShadows(dl, lvis, vvis, false);
|
||||||
qglDisable(GL_POLYGON_OFFSET_FILL);
|
// qglDisable(GL_POLYGON_OFFSET_FILL);
|
||||||
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
// qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (qglStencilOpSeparateATI)
|
if (qglStencilOpSeparateATI)
|
||||||
{
|
{
|
||||||
|
//ATI/GLES/ARB method
|
||||||
sref/=2;
|
sref/=2;
|
||||||
qglClearStencil(sref);
|
qglClearStencil(sref);
|
||||||
qglClear(GL_STENCIL_BUFFER_BIT);
|
qglClear(GL_STENCIL_BUFFER_BIT);
|
||||||
|
@ -2653,8 +2662,8 @@ static qboolean Sh_DrawStencilLight(dlight_t *dl, vec3_t colour, qbyte *vvis)
|
||||||
}
|
}
|
||||||
else if (qglActiveStencilFaceEXT)
|
else if (qglActiveStencilFaceEXT)
|
||||||
{
|
{
|
||||||
|
//Nvidia-specific method.
|
||||||
sref/=2;
|
sref/=2;
|
||||||
/*personally I prefer the ATI way (nvidia method)*/
|
|
||||||
qglClearStencil(sref);
|
qglClearStencil(sref);
|
||||||
qglClear(GL_STENCIL_BUFFER_BIT);
|
qglClear(GL_STENCIL_BUFFER_BIT);
|
||||||
GL_CullFace(0);
|
GL_CullFace(0);
|
||||||
|
|
|
@ -131,6 +131,7 @@ void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachmentPoin
|
||||||
void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId);
|
void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId);
|
||||||
GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target);
|
GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target);
|
||||||
|
|
||||||
|
void (APIENTRY *qglDepthBoundsEXT) (GLclampd zmin, GLclampd zmax);
|
||||||
/*
|
/*
|
||||||
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB;
|
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB;
|
||||||
PFNGLGETPROGRAMIVARBPROC qglGetProgramivARB;
|
PFNGLGETPROGRAMIVARBPROC qglGetProgramivARB;
|
||||||
|
@ -860,7 +861,22 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
||||||
qglFramebufferRenderbufferEXT = (void *)getglext("glFramebufferRenderbufferEXT");
|
qglFramebufferRenderbufferEXT = (void *)getglext("glFramebufferRenderbufferEXT");
|
||||||
qglCheckFramebufferStatusEXT = (void *)getglext("glCheckFramebufferStatusEXT");
|
qglCheckFramebufferStatusEXT = (void *)getglext("glCheckFramebufferStatusEXT");
|
||||||
}
|
}
|
||||||
|
/* //I don't think we care about the differences, so this code should be safe, but I have no way to test that theory right now
|
||||||
|
else if (GL_CheckExtension("GL_OES_framebuffer_object"))
|
||||||
|
{
|
||||||
|
gl_config.ext_framebuffer_objects = true;
|
||||||
|
qglGenFramebuffersEXT = (void *)getglext("glGenFramebuffersOES");
|
||||||
|
qglDeleteFramebuffersEXT = (void *)getglext("glDeleteFramebuffersOES");
|
||||||
|
qglBindFramebufferEXT = (void *)getglext("glBindFramebufferOES");
|
||||||
|
qglGenRenderbuffersEXT = (void *)getglext("glGenRenderbuffersOES");
|
||||||
|
qglDeleteRenderbuffersEXT = (void *)getglext("glDeleteRenderbuffersOES");
|
||||||
|
qglBindRenderbufferEXT = (void *)getglext("glBindRenderbufferOES");
|
||||||
|
qglRenderbufferStorageEXT = (void *)getglext("glRenderbufferStorageOES");
|
||||||
|
qglFramebufferTexture2DEXT = (void *)getglext("glFramebufferTexture2DOES");
|
||||||
|
qglFramebufferRenderbufferEXT = (void *)getglext("glFramebufferRenderbufferOES");
|
||||||
|
qglCheckFramebufferStatusEXT = (void *)getglext("glCheckFramebufferStatusOES");
|
||||||
|
}
|
||||||
|
*/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (GL_CheckExtension("GL_ARB_debug_output"))
|
if (GL_CheckExtension("GL_ARB_debug_output"))
|
||||||
{
|
{
|
||||||
|
@ -1581,8 +1597,6 @@ void GL_Init(void *(*getglfunction) (char *name))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int d_8to24rgbtable[256];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1652,8 +1652,6 @@ qboolean X11VID_Init (rendererstate_t *info, unsigned char *palette, int psl)
|
||||||
GLVID_SetPalette(palette);
|
GLVID_SetPalette(palette);
|
||||||
GLVID_ShiftPalette(palette);
|
GLVID_ShiftPalette(palette);
|
||||||
|
|
||||||
qglGetIntegerv(GL_STENCIL_BITS, &gl_stencilbits);
|
|
||||||
|
|
||||||
InitSig(); // trap evil signals
|
InitSig(); // trap evil signals
|
||||||
|
|
||||||
//probably going to be resized in the event handler
|
//probably going to be resized in the event handler
|
||||||
|
|
|
@ -580,6 +580,9 @@ qboolean VID_SetWindowedMode (rendererstate_t *info)
|
||||||
ptop = sys_parenttop;
|
ptop = sys_parenttop;
|
||||||
pwidth = sys_parentwidth;
|
pwidth = sys_parentwidth;
|
||||||
pheight = sys_parentheight;
|
pheight = sys_parentheight;
|
||||||
|
|
||||||
|
WindowRect.right = sys_parentwidth;
|
||||||
|
WindowRect.bottom = sys_parentheight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -1337,7 +1340,7 @@ void GLVID_Recenter_f(void)
|
||||||
|
|
||||||
if (sys_parentwindow && modestate==MS_WINDOWED)
|
if (sys_parentwindow && modestate==MS_WINDOWED)
|
||||||
{
|
{
|
||||||
WindowRect = centerrect(sys_parentleft, sys_parenttop, sys_parentwidth, sys_parentheight, vid_width.value, vid_height.value);
|
WindowRect = centerrect(sys_parentleft, sys_parenttop, sys_parentwidth, sys_parentheight, sys_parentwidth, sys_parentheight);
|
||||||
MoveWindow(mainwindow, WindowRect.left, WindowRect.top, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top, FALSE);
|
MoveWindow(mainwindow, WindowRect.left, WindowRect.top, WindowRect.right - WindowRect.left, WindowRect.bottom - WindowRect.top, FALSE);
|
||||||
|
|
||||||
VID_UpdateWindowStatus (mainwindow);
|
VID_UpdateWindowStatus (mainwindow);
|
||||||
|
@ -1386,8 +1389,7 @@ void GL_DoSwap (void)
|
||||||
return;
|
return;
|
||||||
screenflush = 0;
|
screenflush = 0;
|
||||||
|
|
||||||
if (!scr_skipupdate)
|
qSwapBuffers(maindc);
|
||||||
qSwapBuffers(maindc);
|
|
||||||
|
|
||||||
// handle the mouse state when windowed if that's changed
|
// handle the mouse state when windowed if that's changed
|
||||||
|
|
||||||
|
@ -1706,7 +1708,6 @@ BOOL bSetupPixelFormat(HDC hDC, rendererstate_t *info)
|
||||||
TRACE(("dbg: bSetupPixelFormat: we can use the stencil buffer. woot\n"));
|
TRACE(("dbg: bSetupPixelFormat: we can use the stencil buffer. woot\n"));
|
||||||
qDescribePixelFormat(hDC, pixelformat, sizeof(pfd), &pfd);
|
qDescribePixelFormat(hDC, pixelformat, sizeof(pfd), &pfd);
|
||||||
FixPaletteInDescriptor(hDC, &pfd);
|
FixPaletteInDescriptor(hDC, &pfd);
|
||||||
gl_stencilbits = pfd.cStencilBits;
|
|
||||||
|
|
||||||
if ((pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED))
|
if ((pfd.dwFlags & PFD_GENERIC_FORMAT) && !(pfd.dwFlags & PFD_GENERIC_ACCELERATED))
|
||||||
{
|
{
|
||||||
|
@ -1718,7 +1719,6 @@ BOOL bSetupPixelFormat(HDC hDC, rendererstate_t *info)
|
||||||
TRACE(("dbg: ChoosePixelFormat 1: no stencil buffer for us\n"));
|
TRACE(("dbg: ChoosePixelFormat 1: no stencil buffer for us\n"));
|
||||||
|
|
||||||
pfd.cStencilBits = 0;
|
pfd.cStencilBits = 0;
|
||||||
gl_stencilbits = 0;
|
|
||||||
|
|
||||||
if ( (pixelformat = qChoosePixelFormat(hDC, &pfd)) == 0 )
|
if ( (pixelformat = qChoosePixelFormat(hDC, &pfd)) == 0 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -817,7 +817,7 @@ extern void (APIENTRY *qglFramebufferTexture2DEXT)(GLenum target, GLenum attachm
|
||||||
extern void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId);
|
extern void (APIENTRY *qglFramebufferRenderbufferEXT)(GLenum target, GLenum attachmentPoint, GLenum textureTarget, GLuint textureId);
|
||||||
extern GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target);
|
extern GLenum (APIENTRY *qglCheckFramebufferStatusEXT)(GLenum target);
|
||||||
|
|
||||||
void (APIENTRY *qglDepthBoundsEXT) (GLclampd zmin, GLclampd zmax);
|
extern void (APIENTRY *qglDepthBoundsEXT) (GLclampd zmin, GLclampd zmax);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extern qboolean gl_arb_fragment_program;
|
extern qboolean gl_arb_fragment_program;
|
||||||
|
|
|
@ -732,6 +732,61 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef GLQUAKE
|
#ifdef GLQUAKE
|
||||||
|
{QR_OPENGL, 110, "defaultfill",
|
||||||
|
"#ifdef VERTEX_SHADER\n"
|
||||||
|
"attribute vec4 v_colour;\n"
|
||||||
|
"varying vec4 vc;\n"
|
||||||
|
|
||||||
|
"void main ()\n"
|
||||||
|
"{\n"
|
||||||
|
"vc = v_colour;\n"
|
||||||
|
"gl_Position = ftetransform();\n"
|
||||||
|
"}\n"
|
||||||
|
"#endif\n"
|
||||||
|
|
||||||
|
"#ifdef FRAGMENT_SHADER\n"
|
||||||
|
"varying vec4 vc;\n"
|
||||||
|
"void main ()\n"
|
||||||
|
"{\n"
|
||||||
|
"gl_FragColor = vc;\n"
|
||||||
|
"}\n"
|
||||||
|
"#endif\n"
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
#ifdef D3D11QUAKE
|
||||||
|
{QR_DIRECT3D11, 11, "defaultfill",
|
||||||
|
"struct a2v\n"
|
||||||
|
"{\n"
|
||||||
|
"float4 pos: POSITION;\n"
|
||||||
|
"float4 vcol: COLOR0;\n"
|
||||||
|
"};\n"
|
||||||
|
"struct v2f\n"
|
||||||
|
"{\n"
|
||||||
|
"float4 pos: SV_POSITION;\n"
|
||||||
|
"float4 vcol: COLOR0;\n"
|
||||||
|
"};\n"
|
||||||
|
|
||||||
|
"#include <ftedefs.h>\n"
|
||||||
|
|
||||||
|
"#ifdef VERTEX_SHADER\n"
|
||||||
|
"v2f main (a2v inp)\n"
|
||||||
|
"{\n"
|
||||||
|
"v2f outp;\n"
|
||||||
|
"outp.pos = mul(m_projection, inp.pos);\n"
|
||||||
|
"outp.vcol = inp.vcol;\n"
|
||||||
|
"return outp;\n"
|
||||||
|
"}\n"
|
||||||
|
"#endif\n"
|
||||||
|
|
||||||
|
"#ifdef FRAGMENT_SHADER\n"
|
||||||
|
"float4 main (v2f inp) : SV_TARGET\n"
|
||||||
|
"{\n"
|
||||||
|
"return inp.vcol;\n"
|
||||||
|
"}\n"
|
||||||
|
"#endif\n"
|
||||||
|
},
|
||||||
|
#endif
|
||||||
|
#ifdef GLQUAKE
|
||||||
{QR_OPENGL, 110, "defaultsprite",
|
{QR_OPENGL, 110, "defaultsprite",
|
||||||
"!!permu FOG\n"
|
"!!permu FOG\n"
|
||||||
//used by both particles and sprites.
|
//used by both particles and sprites.
|
||||||
|
|
|
@ -4,8 +4,150 @@
|
||||||
|
|
||||||
#include "netinc.h"
|
#include "netinc.h"
|
||||||
|
|
||||||
#ifdef WEBCLIENT
|
#if defined(WEBCLIENT)
|
||||||
|
#if defined(NACL)
|
||||||
|
#include <ppapi/c/pp_errors.h>
|
||||||
|
#include <ppapi/c/ppb_core.h>
|
||||||
|
#include <ppapi/c/pp_file_info.h>
|
||||||
|
#include <ppapi/c/ppb_file_system.h>
|
||||||
|
#include <ppapi/c/ppb_file_ref.h>
|
||||||
|
#include <ppapi/c/ppb_url_request_info.h>
|
||||||
|
#include <ppapi/c/ppb_url_response_info.h>
|
||||||
|
#include <ppapi/c/pp_var.h>
|
||||||
|
#include <ppapi/c/ppb_var.h>
|
||||||
|
#include <ppapi/c/ppb_file_io.h>
|
||||||
|
#include <ppapi/c/ppb_url_loader.h>
|
||||||
|
|
||||||
|
extern PPB_Core *ppb_core;
|
||||||
|
extern PPB_URLRequestInfo *urlrequestinfo;
|
||||||
|
extern PPB_URLLoader *urlloader;
|
||||||
|
extern PP_Instance pp_instance;
|
||||||
|
extern PPB_Var *ppb_var_interface;
|
||||||
|
|
||||||
|
struct nacl_dl {
|
||||||
|
char buffer[65536];
|
||||||
|
PP_Resource req;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void readfinished(void* user_data, int32_t result)
|
||||||
|
{
|
||||||
|
struct dl_download *f = user_data;
|
||||||
|
struct nacl_dl *ctx = f->ctx;
|
||||||
|
struct PP_CompletionCallback ccb = {readfinished, f, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
||||||
|
|
||||||
|
//trying to clean up
|
||||||
|
if (!ctx)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Sys_Printf("lastresult: %i\n", result);
|
||||||
|
|
||||||
|
if (result == PP_OK)
|
||||||
|
{
|
||||||
|
// Sys_Printf("%s completed\n", f->url);
|
||||||
|
ppb_core->ReleaseResource(ctx->req);
|
||||||
|
ctx->req = 0;
|
||||||
|
|
||||||
|
f->status = DL_FINISHED;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; result > 0; result = urlloader->ReadResponseBody(ctx->req, ctx->buffer, sizeof(ctx->buffer), ccb))
|
||||||
|
{
|
||||||
|
//make sure the file is 'open'.
|
||||||
|
if (!f->file)
|
||||||
|
{
|
||||||
|
if (*f->localname)
|
||||||
|
{
|
||||||
|
FS_CreatePath(f->localname, FS_GAME);
|
||||||
|
f->file = FS_OpenVFS(f->localname, "w+b", FS_GAME);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
f->file = FS_OpenTemp();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sys_Printf("write: %i\n", result);
|
||||||
|
VFS_WRITE(f->file, ctx->buffer, result);
|
||||||
|
|
||||||
|
f->completed += result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sys_Printf("result: %i\n", result);
|
||||||
|
if (result != PP_OK_COMPLETIONPENDING)
|
||||||
|
{
|
||||||
|
Sys_Printf("file %s failed or something\n", f->url);
|
||||||
|
ppb_core->ReleaseResource(ctx->req);
|
||||||
|
ctx->req = 0;
|
||||||
|
f->status = DL_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//urloader->open completed
|
||||||
|
static void dlstarted(void* user_data, int32_t result)
|
||||||
|
{
|
||||||
|
struct dl_download *f = user_data;
|
||||||
|
struct nacl_dl *ctx = f->ctx;
|
||||||
|
|
||||||
|
struct PP_CompletionCallback ccb = {readfinished, f, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
||||||
|
readfinished(user_data, urlloader->ReadResponseBody(ctx->req, ctx->buffer, sizeof(ctx->buffer), ccb));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void nadl_cleanup(void* user_data, int32_t result)
|
||||||
|
{
|
||||||
|
struct nacl_dl *ctx = user_data;
|
||||||
|
|
||||||
|
if (ctx->req)
|
||||||
|
ppb_core->ReleaseResource(ctx->req);
|
||||||
|
free(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NADL_Cleanup(struct dl_download *dl)
|
||||||
|
{
|
||||||
|
struct nacl_dl *ctx = dl->ctx;
|
||||||
|
|
||||||
|
//we can't free the ctx memory etc, in case the browser still has requests pending on it before it handles our close.
|
||||||
|
//so set up a callback to do it later
|
||||||
|
|
||||||
|
dl->ctx = NULL; //orphan
|
||||||
|
struct PP_CompletionCallback ccb = {nadl_cleanup, ctx, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
||||||
|
ppb_core->CallOnMainThread(1000, ccb, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
qboolean HTTPDL_Decide(struct dl_download *dl)
|
||||||
|
{
|
||||||
|
const char *url = dl->redir;
|
||||||
|
struct nacl_dl *ctx;
|
||||||
|
if (!*url)
|
||||||
|
url = dl->url;
|
||||||
|
|
||||||
|
if (dl->ctx)
|
||||||
|
{
|
||||||
|
if (dl->status == DL_FAILED || dl->status == DL_FINISHED)
|
||||||
|
{
|
||||||
|
NADL_Cleanup(dl);
|
||||||
|
return false; //safe to destroy it now
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PP_Resource dlri;
|
||||||
|
|
||||||
|
dl->status = DL_ACTIVE;
|
||||||
|
dl->abort = NADL_Cleanup;
|
||||||
|
dl->ctx = ctx = Z_Malloc(sizeof(*ctx));
|
||||||
|
|
||||||
|
/*everything goes via nacl, so we might as well just init that here*/
|
||||||
|
ctx->req = urlloader->Create(pp_instance);
|
||||||
|
dlri = urlrequestinfo->Create(pp_instance);
|
||||||
|
urlrequestinfo->SetProperty(dlri, PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS, ppb_var_interface->VarFromUtf8(url, strlen(url)));
|
||||||
|
urlrequestinfo->SetProperty(dlri, PP_URLREQUESTPROPERTY_URL, ppb_var_interface->VarFromUtf8(url, strlen(url)));
|
||||||
|
|
||||||
|
struct PP_CompletionCallback ccb = {dlstarted, dl, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
||||||
|
urlloader->Open(ctx->req, dlri, ccb);
|
||||||
|
ppb_core->ReleaseResource(dlri);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#else
|
||||||
qboolean HTTPDL_Decide(struct dl_download *dl);
|
qboolean HTTPDL_Decide(struct dl_download *dl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -477,6 +619,7 @@ qboolean HTTPDL_Decide(struct dl_download *dl)
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif /*!defined(NACL)*/
|
||||||
|
|
||||||
#ifdef MULTITHREAD
|
#ifdef MULTITHREAD
|
||||||
static int DL_Thread_Work(void *arg)
|
static int DL_Thread_Work(void *arg)
|
||||||
|
@ -539,9 +682,23 @@ struct dl_download *DL_Create(const char *url)
|
||||||
|
|
||||||
return newdl;
|
return newdl;
|
||||||
}
|
}
|
||||||
|
static struct dl_download *showndownload;
|
||||||
|
|
||||||
/*destroys an entire download context*/
|
/*destroys an entire download context*/
|
||||||
void DL_Close(struct dl_download *dl)
|
void DL_Close(struct dl_download *dl)
|
||||||
{
|
{
|
||||||
|
#ifndef NPFTE
|
||||||
|
if (showndownload == dl)
|
||||||
|
{
|
||||||
|
if (cls.downloadmethod == DL_HTTP)
|
||||||
|
{
|
||||||
|
cls.downloadmethod = DL_NONE;
|
||||||
|
*cls.downloadlocalname = *cls.downloadremotename = 0;
|
||||||
|
}
|
||||||
|
showndownload = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MULTITHREAD
|
#ifdef MULTITHREAD
|
||||||
dl->threaddie = true;
|
dl->threaddie = true;
|
||||||
if (dl->threadctx)
|
if (dl->threadctx)
|
||||||
|
@ -559,7 +716,6 @@ void DL_Close(struct dl_download *dl)
|
||||||
#ifndef NPFTE
|
#ifndef NPFTE
|
||||||
|
|
||||||
static struct dl_download *activedownloads;
|
static struct dl_download *activedownloads;
|
||||||
static struct dl_download *showndownload;
|
|
||||||
unsigned int shownbytestart;
|
unsigned int shownbytestart;
|
||||||
/*create a download context and add it to the list, for lazy people*/
|
/*create a download context and add it to the list, for lazy people*/
|
||||||
struct dl_download *HTTP_CL_Get(const char *url, const char *localfile, void (*NotifyFunction)(struct dl_download *dl))
|
struct dl_download *HTTP_CL_Get(const char *url, const char *localfile, void (*NotifyFunction)(struct dl_download *dl))
|
||||||
|
@ -580,69 +736,63 @@ struct dl_download *HTTP_CL_Get(const char *url, const char *localfile, void (*N
|
||||||
|
|
||||||
void HTTP_CL_Think(void)
|
void HTTP_CL_Think(void)
|
||||||
{
|
{
|
||||||
struct dl_download *con = activedownloads;
|
struct dl_download *dl = activedownloads;
|
||||||
struct dl_download **link = NULL;
|
struct dl_download **link = NULL;
|
||||||
|
|
||||||
link = &activedownloads;
|
link = &activedownloads;
|
||||||
while (*link)
|
while (*link)
|
||||||
{
|
{
|
||||||
con = *link;
|
dl = *link;
|
||||||
#ifdef MULTITHREAD
|
#ifdef MULTITHREAD
|
||||||
if (con->threadctx)
|
if (dl->threadctx)
|
||||||
{
|
{
|
||||||
if (con->status == DL_FINISHED || con->status == DL_FAILED)
|
if (dl->status == DL_FINISHED || dl->status == DL_FAILED)
|
||||||
{
|
{
|
||||||
Sys_WaitOnThread(con->threadctx);
|
Sys_WaitOnThread(dl->threadctx);
|
||||||
con->threadctx = NULL;
|
dl->threadctx = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
if (!con->poll(con))
|
if (!dl->poll(dl))
|
||||||
{
|
{
|
||||||
*link = con->next;
|
*link = dl->next;
|
||||||
if (con->file)
|
if (dl->file)
|
||||||
VFS_SEEK(con->file, 0);
|
VFS_SEEK(dl->file, 0);
|
||||||
if (con->notify)
|
if (dl->notify)
|
||||||
con->notify(con);
|
dl->notify(dl);
|
||||||
DL_Close(con);
|
DL_Close(dl);
|
||||||
|
|
||||||
if (cls.downloadmethod == DL_HTTP)
|
|
||||||
{
|
|
||||||
if (showndownload == con)
|
|
||||||
{
|
|
||||||
cls.downloadmethod = DL_NONE;
|
|
||||||
*cls.downloadlocalname = *cls.downloadremotename = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
link = &con->next;
|
link = &dl->next;
|
||||||
|
|
||||||
if (!cls.downloadmethod && *con->localname)
|
if (!cls.downloadmethod)
|
||||||
{
|
{
|
||||||
cls.downloadmethod = DL_HTTP;
|
cls.downloadmethod = DL_HTTP;
|
||||||
showndownload = con;
|
showndownload = dl;
|
||||||
strcpy(cls.downloadlocalname, con->localname);
|
if (*dl->localname)
|
||||||
strcpy(cls.downloadremotename, con->url);
|
strcpy(cls.downloadlocalname, dl->localname);
|
||||||
|
else
|
||||||
|
strcpy(cls.downloadlocalname, dl->url);
|
||||||
|
strcpy(cls.downloadremotename, dl->url);
|
||||||
cls.downloadstarttime = Sys_DoubleTime();
|
cls.downloadstarttime = Sys_DoubleTime();
|
||||||
cls.downloadedbytes = 0;
|
cls.downloadedbytes = 0;
|
||||||
shownbytestart = con->completed;
|
shownbytestart = dl->completed;
|
||||||
}
|
}
|
||||||
if (cls.downloadmethod == DL_HTTP)
|
if (cls.downloadmethod == DL_HTTP)
|
||||||
{
|
{
|
||||||
if (showndownload == con)
|
if (showndownload == dl)
|
||||||
{
|
{
|
||||||
if (con->status == DL_FINISHED)
|
if (dl->status == DL_FINISHED)
|
||||||
cls.downloadpercent = 100;
|
cls.downloadpercent = 100;
|
||||||
else if (con->status != DL_ACTIVE)
|
else if (dl->status != DL_ACTIVE)
|
||||||
cls.downloadpercent = 0;
|
cls.downloadpercent = 0;
|
||||||
else if (con->totalsize <= 0)
|
else if (dl->totalsize <= 0)
|
||||||
cls.downloadpercent = 50;
|
cls.downloadpercent = 50;
|
||||||
else
|
else
|
||||||
cls.downloadpercent = con->completed*100.0f/con->totalsize;
|
cls.downloadpercent = dl->completed*100.0f/dl->totalsize;
|
||||||
cls.downloadedbytes = con->completed;
|
cls.downloadedbytes = dl->completed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,111 +70,9 @@ typedef struct
|
||||||
mfchunk_t *cchunk;
|
mfchunk_t *cchunk;
|
||||||
} vfsmfile_t;
|
} vfsmfile_t;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
PP_Resource dl;
|
|
||||||
char buffer[65536];
|
|
||||||
char *fname;
|
|
||||||
vfsfile_t *out;
|
|
||||||
} dlfile_t;
|
|
||||||
|
|
||||||
static int activedls;
|
|
||||||
static int availdlslots = 2;
|
|
||||||
void readfinished(void* user_data, int32_t result)
|
|
||||||
{
|
|
||||||
dlfile_t *f = user_data;
|
|
||||||
/*if there was a prior request that didn't finish yet...*/
|
|
||||||
struct PP_CompletionCallback ccb = {readfinished, f, PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
|
|
||||||
|
|
||||||
// Sys_Printf("lastresult: %i\n", result);
|
|
||||||
|
|
||||||
if (result == PP_OK)
|
|
||||||
{
|
|
||||||
Sys_Printf("%s completed\n", f->fname);
|
|
||||||
if (f->out)
|
|
||||||
VFS_CLOSE(f->out);
|
|
||||||
//ppb_core->ReleaseResource(f->dl);
|
|
||||||
activedls--;
|
|
||||||
availdlslots++;
|
|
||||||
free(f);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; result > 0; result = urlloader->ReadResponseBody(f->dl, f->buffer, sizeof(f->buffer), ccb))
|
|
||||||
{
|
|
||||||
if (!f->out)
|
|
||||||
{
|
|
||||||
Sys_Printf("Downloading %s\n", f->fname);
|
|
||||||
f->out = VFSOS_Open(f->fname, "wb");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sys_Printf("write: %i\n", result);
|
|
||||||
VFS_WRITE(f->out, f->buffer, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sys_Printf("result: %i\n", result);
|
|
||||||
if (result != PP_OK_COMPLETIONPENDING)
|
|
||||||
{
|
|
||||||
Sys_Printf("file %s failed or something\n", f->fname);
|
|
||||||
if (f->out)
|
|
||||||
VFS_CLOSE(f->out);
|
|
||||||
ppb_core->ReleaseResource(f->dl);
|
|
||||||
activedls--;
|
|
||||||
availdlslots++;
|
|
||||||
free(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void dlstarted(void* user_data, int32_t result)
|
|
||||||
{
|
|
||||||
dlfile_t *f = user_data;
|
|
||||||
|
|
||||||
struct PP_CompletionCallback ccb = {readfinished, f, PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
|
|
||||||
readfinished(user_data, urlloader->ReadResponseBody(f->dl, f->buffer, sizeof(f->buffer), ccb));
|
|
||||||
}
|
|
||||||
qboolean FSPPAPI_Init(int *fileid)
|
qboolean FSPPAPI_Init(int *fileid)
|
||||||
{
|
{
|
||||||
dlfile_t *dlf;
|
return true; /*engine has all the content it needs*/
|
||||||
PP_Resource dlri;
|
|
||||||
static char *dlnames[] =
|
|
||||||
{
|
|
||||||
"id1/pak0.pak",
|
|
||||||
// "id1/gfx/conback.tga",
|
|
||||||
// "id1/gfx/conchars.tga",
|
|
||||||
"id1/pak1.pak",
|
|
||||||
// "id1/bigass1.dem",
|
|
||||||
// "id1/overkill.qwd",
|
|
||||||
"id1/pak2.pak",
|
|
||||||
"id1/pak3.pak",
|
|
||||||
"id1/pak4.pak",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
if (availdlslots)
|
|
||||||
{
|
|
||||||
if (!dlnames[*fileid])
|
|
||||||
{
|
|
||||||
if (!activedls)
|
|
||||||
return true; /*engine has all the content it needs*/
|
|
||||||
return false; /*still downloading something, don't let it continue just yet*/
|
|
||||||
}
|
|
||||||
|
|
||||||
dlf = malloc(sizeof(*dlf));
|
|
||||||
if (!dlf)
|
|
||||||
return false;
|
|
||||||
dlf->out = NULL;
|
|
||||||
|
|
||||||
activedls++;
|
|
||||||
availdlslots--;
|
|
||||||
dlf->fname = dlnames[*fileid];
|
|
||||||
*fileid+=1;
|
|
||||||
dlf->dl = urlloader->Create(pp_instance);
|
|
||||||
dlri = urlrequestinfo->Create(pp_instance);
|
|
||||||
urlrequestinfo->SetProperty(dlri, PP_URLREQUESTPROPERTY_URL, ppb_var_interface->VarFromUtf8(dlf->fname, strlen(dlf->fname)));
|
|
||||||
|
|
||||||
struct PP_CompletionCallback ccb = {dlstarted, dlf, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
|
||||||
urlloader->Open(dlf->dl, dlri, ccb);
|
|
||||||
ppb_core->ReleaseResource(dlri);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int preparechunk(vfsmfile_t *f, int bytes, void **data)
|
static int preparechunk(vfsmfile_t *f, int bytes, void **data)
|
||||||
|
@ -438,14 +336,43 @@ static vfsfile_t *FSPPAPI_OpenVFS(void *handle, flocation_t *loc, const char *mo
|
||||||
return VFSPPAPI_Open(diskname, mode);
|
return VFSPPAPI_Open(diskname, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FSPPAPI_PrintPath(void *handle)
|
static void FSPPAPI_GetDisplayPath(void *handle, char *outpath, unsigned int pathsize)
|
||||||
{
|
{
|
||||||
Con_Printf("%s\n", (char*)handle);
|
Q_strncpyz(outpath, (char*)handle, pathsize);
|
||||||
}
|
}
|
||||||
static void FSPPAPI_ClosePath(void *handle)
|
static void FSPPAPI_ClosePath(void *handle)
|
||||||
{
|
{
|
||||||
Z_Free(handle);
|
Z_Free(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Sys_EnumerateFiles (const char *rootpath, const char *match, int (*func)(const char *, int, void *), void *parm)
|
||||||
|
{
|
||||||
|
int rootlen = strlen(rootpath);
|
||||||
|
char *sub;
|
||||||
|
mfile_t *f;
|
||||||
|
if (*match == '/')
|
||||||
|
match++;
|
||||||
|
for (f = mfiles; f; f = f->next)
|
||||||
|
{
|
||||||
|
sub = f->name;
|
||||||
|
if (strncmp(sub, rootpath, rootlen))
|
||||||
|
continue;
|
||||||
|
sub += rootlen;
|
||||||
|
if (*sub == '/')
|
||||||
|
sub++;
|
||||||
|
if (wildcmp(match, sub))
|
||||||
|
{
|
||||||
|
if (!func(sub, f->length, parm))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
static int FSPPAPI_EnumerateFiles (void *handle, const char *match, int (*func)(const char *, int, void *), void *parm)
|
||||||
|
{
|
||||||
|
return Sys_EnumerateFiles((char*)handle, match, func, parm);
|
||||||
|
}
|
||||||
|
|
||||||
static int FSPPAPI_RebuildFSHash(const char *filename, int filesize, void *data)
|
static int FSPPAPI_RebuildFSHash(const char *filename, int filesize, void *data)
|
||||||
{
|
{
|
||||||
if (filename[strlen(filename)-1] == '/')
|
if (filename[strlen(filename)-1] == '/')
|
||||||
|
@ -456,22 +383,10 @@ static int FSPPAPI_RebuildFSHash(const char *filename, int filesize, void *data)
|
||||||
Sys_EnumerateFiles((char*)data, childpath, FSPPAPI_RebuildFSHash, data);
|
Sys_EnumerateFiles((char*)data, childpath, FSPPAPI_RebuildFSHash, data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!Hash_GetInsensative(&filesystemhash, filename))
|
FS_AddFileHash(0, filename, NULL, data);
|
||||||
{
|
|
||||||
bucket_t *bucket = (bucket_t*)BZ_Malloc(sizeof(bucket_t) + strlen(filename)+1);
|
|
||||||
strcpy((char *)(bucket+1), filename);
|
|
||||||
//#ifdef _WIN32
|
|
||||||
// Q_strlwr((char *)(bucket+1));
|
|
||||||
//#endif
|
|
||||||
Hash_AddInsensative(&filesystemhash, (char *)(bucket+1), data, bucket);
|
|
||||||
|
|
||||||
fs_hash_files++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
fs_hash_dups++;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static void FSPPAPI_BuildHash(void *handle)
|
static void FSPPAPI_BuildHash(void *handle, int depth)
|
||||||
{
|
{
|
||||||
Sys_EnumerateFiles(handle, "*", FSPPAPI_RebuildFSHash, handle);
|
Sys_EnumerateFiles(handle, "*", FSPPAPI_RebuildFSHash, handle);
|
||||||
}
|
}
|
||||||
|
@ -554,19 +469,29 @@ static void FSPPAPI_ReadFile(void *handle, flocation_t *loc, char *buffer)
|
||||||
|
|
||||||
VFS_CLOSE(f);
|
VFS_CLOSE(f);
|
||||||
}
|
}
|
||||||
static int FSPPAPI_EnumerateFiles (void *handle, const char *match, int (*func)(const char *, int, void *), void *parm)
|
|
||||||
|
static void *FSPPAPI_OpenPath(vfsfile_t *mustbenull, const char *desc)
|
||||||
{
|
{
|
||||||
return Sys_EnumerateFiles(handle, match, func, parm);
|
char *np;
|
||||||
|
int dlen = strlen(desc);
|
||||||
|
if (mustbenull)
|
||||||
|
return NULL;
|
||||||
|
np = Z_Malloc(dlen+1);
|
||||||
|
if (np)
|
||||||
|
{
|
||||||
|
memcpy(np, desc, dlen+1);
|
||||||
|
}
|
||||||
|
return np;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchpathfuncs_t osfilefuncs = {
|
searchpathfuncs_t osfilefuncs = {
|
||||||
FSPPAPI_PrintPath,
|
FSPPAPI_GetDisplayPath,
|
||||||
FSPPAPI_ClosePath,
|
FSPPAPI_ClosePath,
|
||||||
FSPPAPI_BuildHash,
|
FSPPAPI_BuildHash,
|
||||||
FSPPAPI_FLocate,
|
FSPPAPI_FLocate,
|
||||||
FSPPAPI_ReadFile,
|
FSPPAPI_ReadFile,
|
||||||
FSPPAPI_EnumerateFiles,
|
FSPPAPI_EnumerateFiles,
|
||||||
NULL,
|
FSPPAPI_OpenPath,
|
||||||
NULL,
|
NULL,
|
||||||
FSPPAPI_OpenVFS
|
FSPPAPI_OpenVFS
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <ppapi/gles2/gl2ext_ppapi.h>
|
#include <ppapi/gles2/gl2ext_ppapi.h>
|
||||||
#include <ppapi/c/ppb_graphics_3d.h>
|
#include <ppapi/c/ppb_graphics_3d.h>
|
||||||
#include <ppapi/c/ppb_instance.h>
|
#include <ppapi/c/ppb_instance.h>
|
||||||
|
#include <ppapi/c/pp_errors.h>
|
||||||
|
|
||||||
extern PPB_Core *ppb_core;
|
extern PPB_Core *ppb_core;
|
||||||
extern PPB_GetInterface sys_gbi;
|
extern PPB_GetInterface sys_gbi;
|
||||||
|
@ -14,10 +15,23 @@ extern PP_Instance pp_instance;
|
||||||
static PP_Resource glcontext;
|
static PP_Resource glcontext;
|
||||||
extern PPB_Instance* instance_interface;
|
extern PPB_Instance* instance_interface;
|
||||||
int delayedswap = false;
|
int delayedswap = false;
|
||||||
|
qboolean swappending;
|
||||||
|
|
||||||
|
extern cvar_t _vid_wait_override;
|
||||||
|
|
||||||
|
void FrameEvent(void* user_data, int32_t result);
|
||||||
|
qboolean NAGL_SwapPending(void)
|
||||||
|
{
|
||||||
|
return swappending;
|
||||||
|
}
|
||||||
void swap_callback(void* user_data, int32_t result)
|
void swap_callback(void* user_data, int32_t result)
|
||||||
{
|
{
|
||||||
// printf("swap result: %d\n", result);
|
if (swappending)
|
||||||
|
{
|
||||||
|
swappending = false;
|
||||||
|
|
||||||
|
FrameEvent(NULL, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void GL_BeginRendering (void)
|
void GL_BeginRendering (void)
|
||||||
{
|
{
|
||||||
|
@ -26,16 +40,34 @@ void GL_EndRendering (void)
|
||||||
{
|
{
|
||||||
delayedswap = true;
|
delayedswap = true;
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
|
// if (!gl_lateswap.value)
|
||||||
|
// GL_DoSwap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GL_DoSwap(void)
|
void GL_DoSwap(void)
|
||||||
{
|
{
|
||||||
if (delayedswap)
|
if (delayedswap)
|
||||||
{
|
{
|
||||||
struct PP_CompletionCallback ccb = { swap_callback, NULL, PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
|
qboolean vsync = _vid_wait_override.ival || !*_vid_wait_override.string;
|
||||||
|
struct PP_CompletionCallback ccb = { swap_callback, NULL, vsync?PP_COMPLETIONCALLBACK_FLAG_NONE:PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
|
||||||
glFlush();
|
glFlush();
|
||||||
graphics3d_interface->SwapBuffers(glcontext, ccb);
|
|
||||||
delayedswap = false;
|
delayedswap = false;
|
||||||
|
|
||||||
|
switch(graphics3d_interface->SwapBuffers(glcontext, ccb))
|
||||||
|
{
|
||||||
|
case PP_OK_COMPLETIONPENDING:
|
||||||
|
swappending |= vsync;
|
||||||
|
break;
|
||||||
|
case PP_OK:
|
||||||
|
break;
|
||||||
|
case PP_ERROR_INPROGRESS:
|
||||||
|
Con_DPrintf("chrome can't handle vid_wait 0\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Con_DPrintf("unknown error on SwapBuffers call\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,23 +259,33 @@ void *PPAPI_GetGLSymbol(char *symname)
|
||||||
void GL_Resized(int width, int height)
|
void GL_Resized(int width, int height)
|
||||||
{
|
{
|
||||||
extern cvar_t vid_conautoscale, vid_conwidth;
|
extern cvar_t vid_conautoscale, vid_conwidth;
|
||||||
|
|
||||||
|
vid.pixelwidth = width;
|
||||||
|
vid.pixelheight = height;
|
||||||
if (glcontext)
|
if (glcontext)
|
||||||
{
|
{
|
||||||
graphics3d_interface->ResizeBuffers(glcontext, width, height);
|
graphics3d_interface->ResizeBuffers(glcontext, width, height);
|
||||||
vid.pixelwidth = width;
|
|
||||||
vid.pixelheight = height;
|
|
||||||
|
|
||||||
Cvar_ForceCallback(&vid_conautoscale);
|
Cvar_ForceCallback(&vid_conautoscale);
|
||||||
Cvar_ForceCallback(&vid_conwidth);
|
Cvar_ForceCallback(&vid_conwidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||||
{
|
{
|
||||||
int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, info->width,
|
if (!vid.pixelwidth)
|
||||||
PP_GRAPHICS3DATTRIB_HEIGHT, info->height,
|
vid.pixelwidth = info->width;
|
||||||
|
if (!vid.pixelheight)
|
||||||
|
vid.pixelheight = info->height;
|
||||||
|
if (vid.pixelwidth < 320)
|
||||||
|
vid.pixelwidth = 320;
|
||||||
|
if (vid.pixelheight < 200)
|
||||||
|
vid.pixelheight = 200;
|
||||||
|
|
||||||
|
int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, vid.pixelwidth,
|
||||||
|
PP_GRAPHICS3DATTRIB_HEIGHT, vid.pixelheight,
|
||||||
PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
|
PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
|
||||||
PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
|
PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
|
||||||
|
PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR, PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED,
|
||||||
PP_GRAPHICS3DATTRIB_NONE};
|
PP_GRAPHICS3DATTRIB_NONE};
|
||||||
|
|
||||||
glcontext = graphics3d_interface->Create(pp_instance, 0, attribs);
|
glcontext = graphics3d_interface->Create(pp_instance, 0, attribs);
|
||||||
|
@ -261,8 +303,8 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
|
||||||
GL_EndRendering();
|
GL_EndRendering();
|
||||||
GL_DoSwap();
|
GL_DoSwap();
|
||||||
|
|
||||||
vid.pixelwidth = info->width;
|
// vid.pixelwidth = info->width;
|
||||||
vid.pixelheight = info->height;
|
// vid.pixelheight = info->height;
|
||||||
|
|
||||||
GLVID_SetPalette (palette);
|
GLVID_SetPalette (palette);
|
||||||
GL_Init(PPAPI_GetGLSymbol);
|
GL_Init(PPAPI_GetGLSymbol);
|
||||||
|
|
|
@ -80,7 +80,11 @@ int PPAPI_InitCard (soundcardinfo_t *sc, int cardnum)
|
||||||
sc->sn.samplebits = 16;
|
sc->sn.samplebits = 16;
|
||||||
sc->sn.numchannels = 2;
|
sc->sn.numchannels = 2;
|
||||||
|
|
||||||
|
#ifdef PPB_AUDIO_CONFIG_INTERFACE_1_1
|
||||||
|
framecount = audioconfig_interface->RecommendSampleFrameCount(pp_instance, sc->sn.speed, 2048);
|
||||||
|
#else
|
||||||
framecount = audioconfig_interface->RecommendSampleFrameCount(sc->sn.speed, 2048);
|
framecount = audioconfig_interface->RecommendSampleFrameCount(sc->sn.speed, 2048);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*the callback paints directly into the caller's buffer, so we don't need a separate 'dma' buffer*/
|
/*the callback paints directly into the caller's buffer, so we don't need a separate 'dma' buffer*/
|
||||||
sc->selfpainting = true;
|
sc->selfpainting = true;
|
||||||
|
|
|
@ -57,6 +57,7 @@ static qboolean mouselocked;
|
||||||
static qboolean shuttingdown;
|
static qboolean shuttingdown;
|
||||||
|
|
||||||
qboolean FSPPAPI_Init(int *filenocookie);
|
qboolean FSPPAPI_Init(int *filenocookie);
|
||||||
|
qboolean NAGL_SwapPending(void);
|
||||||
|
|
||||||
unsigned short htons(unsigned short a)
|
unsigned short htons(unsigned short a)
|
||||||
{
|
{
|
||||||
|
@ -177,11 +178,13 @@ void INS_Shutdown(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
//nacl supposedly has no way to implement this (other than us writing a listfile in each directory)
|
//nacl supposedly has no way to implement this (other than us writing a listfile in each directory)
|
||||||
int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const char *, int, void *), void *parm)
|
int Sys_EnumerateFiles (const char *gpath, const char *match, int (*func)(const char *, int, void *), void *parm)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate)
|
qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate)
|
||||||
{
|
{
|
||||||
|
@ -204,8 +207,7 @@ NORETURN void VARGS Sys_Error (const char *error, ...)
|
||||||
vsnprintf (string, sizeof(string)-1, error, argptr);
|
vsnprintf (string, sizeof(string)-1, error, argptr);
|
||||||
va_end (argptr);
|
va_end (argptr);
|
||||||
|
|
||||||
Sys_Printf("Sys_Error: ");
|
Sys_Printf("Sys_Error: %s", string);
|
||||||
Sys_Printf("%s", string);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,30 +307,38 @@ void FrameEvent(void* user_data, int32_t result)
|
||||||
}
|
}
|
||||||
if (pp_instance)
|
if (pp_instance)
|
||||||
{
|
{
|
||||||
double newtime = Sys_DoubleTime();
|
if (!NAGL_SwapPending())
|
||||||
Host_Frame(newtime - lasttime);
|
{
|
||||||
lasttime = newtime;
|
double newtime = Sys_DoubleTime();
|
||||||
|
// Sys_Printf("Frame %f\n", newtime);
|
||||||
|
Host_Frame(newtime - lasttime);
|
||||||
|
lasttime = newtime;
|
||||||
|
}
|
||||||
|
|
||||||
// Sys_Printf("Frame %f\n", newtime);
|
if (!NAGL_SwapPending())
|
||||||
|
{
|
||||||
struct PP_CompletionCallback ccb = {FrameEvent, user_data, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
struct PP_CompletionCallback ccb = {FrameEvent, user_data, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
||||||
ppb_core->CallOnMainThread(0, ccb, 0);
|
ppb_core->CallOnMainThread(0, ccb, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void startquake(void)
|
void startquake(char *manif)
|
||||||
{
|
{
|
||||||
const char *args [] =
|
static char *args[16];
|
||||||
{
|
|
||||||
"ftedroid",
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
};
|
|
||||||
quakeparms_t parms;
|
quakeparms_t parms;
|
||||||
memset(&parms, 0, sizeof(parms));
|
memset(&parms, 0, sizeof(parms));
|
||||||
parms.basedir = ""; /*filled in later*/
|
parms.basedir = ""; /*filled in later*/
|
||||||
parms.argc = 1;
|
parms.argc = 0;
|
||||||
parms.argv = args;
|
parms.argv = args;
|
||||||
//FIXME: do something with the embed arguments
|
|
||||||
|
//FIXME: generate some sort of commandline properly.
|
||||||
|
args[parms.argc++] = "ftedroid";
|
||||||
|
if (manif)
|
||||||
|
{
|
||||||
|
args[parms.argc++] = "-manifest";
|
||||||
|
args[parms.argc++] = manif;
|
||||||
|
}
|
||||||
|
|
||||||
parms.memsize = 16*1024*1024;
|
parms.memsize = 16*1024*1024;
|
||||||
parms.membase = malloc(parms.memsize);
|
parms.membase = malloc(parms.memsize);
|
||||||
if (!parms.membase)
|
if (!parms.membase)
|
||||||
|
@ -355,7 +365,7 @@ void startquake(void)
|
||||||
void trystartquake(void* user_data, int32_t result)
|
void trystartquake(void* user_data, int32_t result)
|
||||||
{
|
{
|
||||||
if (FSPPAPI_Init(&result))
|
if (FSPPAPI_Init(&result))
|
||||||
startquake();
|
startquake(user_data);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct PP_CompletionCallback ccb = {trystartquake, user_data, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
struct PP_CompletionCallback ccb = {trystartquake, user_data, PP_COMPLETIONCALLBACK_FLAG_NONE};
|
||||||
|
@ -368,13 +378,20 @@ static PP_Bool Instance_DidCreate(PP_Instance instance,
|
||||||
const char* argn[],
|
const char* argn[],
|
||||||
const char* argv[])
|
const char* argv[])
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
pp_instance = instance;
|
pp_instance = instance;
|
||||||
|
char *manif = NULL;
|
||||||
|
|
||||||
//FIXME: do something with the embed arguments
|
//FIXME: do something with the embed arguments
|
||||||
|
for (i = 0; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (!strcasecmp(argn[i], "ftemanifest"))
|
||||||
|
manif = strdup(argv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
ppb_inputevent_interface->RequestInputEvents(pp_instance, PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_KEYBOARD | PP_INPUTEVENT_CLASS_WHEEL);
|
ppb_inputevent_interface->RequestInputEvents(pp_instance, PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_KEYBOARD | PP_INPUTEVENT_CLASS_WHEEL);
|
||||||
|
|
||||||
trystartquake(NULL, 0);
|
trystartquake(manif, 0);
|
||||||
|
|
||||||
return PP_TRUE;
|
return PP_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -421,10 +438,24 @@ unsigned int domkeytoquake(unsigned int code)
|
||||||
}
|
}
|
||||||
if (!tab[code])
|
if (!tab[code])
|
||||||
Con_DPrintf("You just pressed key %u, but I don't know what its meant to be\n", code);
|
Con_DPrintf("You just pressed key %u, but I don't know what its meant to be\n", code);
|
||||||
|
|
||||||
|
Con_DPrintf("You just pressed dom key %u, which is quake key %u\n", code, tab[code]);
|
||||||
return tab[code];
|
return tab[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource)
|
static int QuakeButtonForNACLButton(int but)
|
||||||
|
{
|
||||||
|
switch(but)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
return K_MOUSE3;
|
||||||
|
case 2:
|
||||||
|
return K_MOUSE2;
|
||||||
|
default:
|
||||||
|
return K_MOUSE1 + but;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource)
|
||||||
{
|
{
|
||||||
extern cvar_t vid_fullscreen;
|
extern cvar_t vid_fullscreen;
|
||||||
if (!pp_instance || !host_initialized)
|
if (!pp_instance || !host_initialized)
|
||||||
|
@ -448,10 +479,10 @@ PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource)
|
||||||
return PP_TRUE;
|
return PP_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IN_KeyEvent(0, true, K_MOUSE1 + ppb_mouseinputevent_interface->GetButton(resource), 0);
|
IN_KeyEvent(0, true, QuakeButtonForNACLButton(ppb_mouseinputevent_interface->GetButton(resource)), 0);
|
||||||
return PP_TRUE;
|
return PP_TRUE;
|
||||||
case PP_INPUTEVENT_TYPE_MOUSEUP:
|
case PP_INPUTEVENT_TYPE_MOUSEUP:
|
||||||
IN_KeyEvent(0, false, K_MOUSE1 + ppb_mouseinputevent_interface->GetButton(resource), 0);
|
IN_KeyEvent(0, false, QuakeButtonForNACLButton(ppb_mouseinputevent_interface->GetButton(resource)), 0);
|
||||||
return PP_TRUE;
|
return PP_TRUE;
|
||||||
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
|
case PP_INPUTEVENT_TYPE_MOUSEMOVE:
|
||||||
{
|
{
|
||||||
|
@ -478,20 +509,23 @@ PP_Bool InputEvent_HandleEvent(PP_Instance pp_instance, PP_Resource resource)
|
||||||
return PP_TRUE;
|
return PP_TRUE;
|
||||||
case PP_INPUTEVENT_TYPE_WHEEL:
|
case PP_INPUTEVENT_TYPE_WHEEL:
|
||||||
{
|
{
|
||||||
|
static float wheelticks;
|
||||||
struct PP_FloatPoint p;
|
struct PP_FloatPoint p;
|
||||||
p = ppb_wheelinputevent_interface->GetTicks(resource);
|
p = ppb_wheelinputevent_interface->GetTicks(resource);
|
||||||
//BUG: the value is fractional.
|
|
||||||
while (p.x >= 1)
|
//the value is fractional, so we need some persistant value to track it on high-precision mice.
|
||||||
|
wheelticks += p.y;
|
||||||
|
while (wheelticks > 1)
|
||||||
{
|
{
|
||||||
IN_KeyEvent(0, 1, K_MWHEELUP, 0);
|
IN_KeyEvent(0, 1, K_MWHEELUP, 0);
|
||||||
IN_KeyEvent(0, 0, K_MWHEELUP, 0);
|
IN_KeyEvent(0, 0, K_MWHEELUP, 0);
|
||||||
p.x--;
|
wheelticks--;
|
||||||
}
|
}
|
||||||
while (p.x <= -1)
|
while (wheelticks < 0)
|
||||||
{
|
{
|
||||||
IN_KeyEvent(0, 1, K_MWHEELDOWN, 0);
|
IN_KeyEvent(0, 1, K_MWHEELDOWN, 0);
|
||||||
IN_KeyEvent(0, 0, K_MWHEELDOWN, 0);
|
IN_KeyEvent(0, 0, K_MWHEELDOWN, 0);
|
||||||
p.x++;
|
wheelticks++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PP_TRUE;
|
return PP_TRUE;
|
||||||
|
@ -576,8 +610,6 @@ static void Instance_DidDestroy(PP_Instance instance)
|
||||||
void GL_Resized(int width, int height);
|
void GL_Resized(int width, int height);
|
||||||
static void Instance_DidChangeView(PP_Instance instance, PP_Resource view_resource)
|
static void Instance_DidChangeView(PP_Instance instance, PP_Resource view_resource)
|
||||||
{
|
{
|
||||||
int newwidth;
|
|
||||||
int newheight;
|
|
||||||
struct PP_Rect rect;
|
struct PP_Rect rect;
|
||||||
ppb_view_instance->GetRect(view_resource, &rect);
|
ppb_view_instance->GetRect(view_resource, &rect);
|
||||||
GL_Resized(rect.size.width, rect.size.height);
|
GL_Resized(rect.size.width, rect.size.height);
|
||||||
|
|
|
@ -11,8 +11,6 @@ struct edict_s;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
vec3_t vec3_origin;
|
|
||||||
|
|
||||||
fdef_t *ED_FieldAtOfs (progfuncs_t *progfuncs, unsigned int ofs);
|
fdef_t *ED_FieldAtOfs (progfuncs_t *progfuncs, unsigned int ofs);
|
||||||
pbool ED_ParseEpair (progfuncs_t *progfuncs, int qcptr, unsigned int fldofs, int fldtype, char *s);
|
pbool ED_ParseEpair (progfuncs_t *progfuncs, int qcptr, unsigned int fldofs, int fldtype, char *s);
|
||||||
|
|
||||||
|
|
|
@ -1613,7 +1613,6 @@ void SVDP_EmitEntityDelta(entity_state_t *from, entity_state_t *to, sizebuf_t *m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity_state_t defaultstate;
|
|
||||||
void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t *msg)
|
void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t *msg)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
@ -1661,7 +1660,7 @@ void SVDP_EmitEntitiesUpdate (client_t *client, packet_entities_t *to, sizebuf_t
|
||||||
{ // this is a new entity, send it from the baseline... as far as dp understands it...
|
{ // this is a new entity, send it from the baseline... as far as dp understands it...
|
||||||
ent = EDICT_NUM(svprogfuncs, newnum);
|
ent = EDICT_NUM(svprogfuncs, newnum);
|
||||||
//Con_Printf ("baseline %i\n", newnum);
|
//Con_Printf ("baseline %i\n", newnum);
|
||||||
SVDP_EmitEntityDelta (&defaultstate, &to->entities[newindex], msg, true);
|
SVDP_EmitEntityDelta (&nullentitystate, &to->entities[newindex], msg, true);
|
||||||
newindex++;
|
newindex++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,14 +29,13 @@ void SV_Loadgame_f (void);
|
||||||
#define INVIS_CHAR2 (char)138
|
#define INVIS_CHAR2 (char)138
|
||||||
#define INVIS_CHAR3 (char)160
|
#define INVIS_CHAR3 (char)160
|
||||||
|
|
||||||
quakeparms_t host_parms;
|
#ifdef SERVERONLY
|
||||||
|
|
||||||
qboolean host_initialized; // true if into command execution (compatability)
|
|
||||||
|
|
||||||
double host_frametime;
|
double host_frametime;
|
||||||
double realtime; // without any filtering or bounding
|
double realtime; // without any filtering or bounding
|
||||||
|
qboolean host_initialized; // true if into command execution (compatability)
|
||||||
|
quakeparms_t host_parms;
|
||||||
int host_hunklevel;
|
int host_hunklevel;
|
||||||
|
#endif
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
void SV_Masterlist_Callback(struct cvar_s *var, char *oldvalue);
|
void SV_Masterlist_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
|
|
|
@ -3392,7 +3392,7 @@ void SV_Pause_f (void)
|
||||||
|
|
||||||
if (SV_TogglePause(host_client))
|
if (SV_TogglePause(host_client))
|
||||||
{
|
{
|
||||||
if (sv.paused)
|
if (sv.paused & 1)
|
||||||
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTPAUSED, host_client->name);
|
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTPAUSED, host_client->name);
|
||||||
else
|
else
|
||||||
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTUNPAUSED, host_client->name);
|
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTUNPAUSED, host_client->name);
|
||||||
|
|
|
@ -15,6 +15,7 @@ char shaders[][64] =
|
||||||
"defaultadditivesprite",
|
"defaultadditivesprite",
|
||||||
"defaultskin",
|
"defaultskin",
|
||||||
"defaultsky",
|
"defaultsky",
|
||||||
|
"defaultfill",
|
||||||
"defaultsprite",
|
"defaultsprite",
|
||||||
"defaultwall",
|
"defaultwall",
|
||||||
"defaultwarp",
|
"defaultwarp",
|
||||||
|
|
Loading…
Reference in a new issue