1
0
Fork 0
forked from fte/fteqw

added explicit 'blend rtsmoke' particles that are intended to lit by rtlights without needing to override shaders.

addtrisoup_simple now supports line lists too.
fix a memory leak in the sound code.
fix chunked http download corruption in certain cases.
reworked the networking associated with entity editing. now carries ids instead of indexes (qc isn't aware of them).
'map blarg.map' will now auto-create a dummy map if it does not already exist. this should make it easier to get started with map editing.
fix some issues with banning yourself - loopback can now mute etc themselves, but not ban themselves.
downloads/updates menu now handles plugin detection. user-installed plugins will result in a prompt allowing the user to enable/disable/delete them. This makes using plugins more explicit.
revamped help menu to remove m_state
fix silly ode copypasta bug, added preliminary bullet code in case anyone is interested.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5090 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2017-04-18 11:12:17 +00:00
parent 81a9c45efa
commit 09ec3bf6ea
70 changed files with 2944 additions and 551 deletions

View file

@ -2,12 +2,10 @@
START=$(date +%s) START=$(date +%s)
SVNROOT=$(cd "$(dirname "$(readlink "$BASH_SOURCE")")" && pwd) SVNROOT=$(cd "$(dirname "$(readlink "$BASH_SOURCE")")" && pwd)
FTECONFIG=$SVNROOT/build_cfg.sh FTECONFIG=$SVNROOT/build.cfg
HOME=`echo ~` HOME=`echo ~`
BASE=$SVNROOT/.. BASE=$SVNROOT/..
#how many cpu cores do you have?
THREADS="-j 4"
#set this if you want non-default branding, for customised builds. #set this if you want non-default branding, for customised builds.
#export BRANDING=wastes #export BRANDING=wastes
@ -23,12 +21,15 @@ PLUGINS_LINUXx86="qi ezhud xmpp irc"
PLUGINS_LINUXx64="qi ezhud xmpp irc" PLUGINS_LINUXx64="qi ezhud xmpp irc"
PLUGINS_LINUXx32="qi ezhud xmpp irc" PLUGINS_LINUXx32="qi ezhud xmpp irc"
PLUGINS_WINDOWS="avplug ode qi ezhud xmpp irc" PLUGINS_WINDOWS="avplug ode qi ezhud xmpp irc"
THREADS="-j 4"
########### NaCL stuff ########### NaCL stuff
NACL_SDK_ROOT=/opt/nacl_sdk/pepper_31/ NACL_SDK_ROOT=/opt/nacl_sdk/pepper_31/
if [ -e $FTECONFIG ]; then if [ -e $FTECONFIG ]; then
. $FTECONFIG . $FTECONFIG
else
echo "WARNING: $FTECONFIG does not exist yet."
fi fi
export NACL_SDK_ROOT export NACL_SDK_ROOT
@ -143,6 +144,10 @@ if [ "$BUILD_WINDOWS" != "n" ]; then
NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows 32-bit" win32 FTE_TARGET=win32 CFLAGS="$WARNINGLEVEL" sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel NATIVE_PLUGINS="$PLUGINS_WINDOWS" NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows 32-bit" win32 FTE_TARGET=win32 CFLAGS="$WARNINGLEVEL" sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel NATIVE_PLUGINS="$PLUGINS_WINDOWS"
NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows 64-bit" win64 FTE_TARGET=win64 CFLAGS="$WARNINGLEVEL" sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows 64-bit" win64 FTE_TARGET=win64 CFLAGS="$WARNINGLEVEL" sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel
fi fi
if [ "$BUILD_MSVC" != "n" ]; then
NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows MSVC 32-bit" msvc FTE_TARGET=vc BITS=32 CFLAGS="$WARNINGLEVEL" sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel
NATIVE_PLUGINS="$PLUGINS_WINDOWS" build "Windows MSVC 64-bit" msvc FTE_TARGET=vc BITS=64 CFLAGS="$WARNINGLEVEL" sv-rel gl-rel vk-rel mingl-rel m-rel d3d-rel qcc-rel qccgui-scintilla qccgui-dbg gl-dbg sv-dbg plugins-dbg plugins-rel
fi
export NATIVE_PLUGINS="qi ezhud xmpp irc" export NATIVE_PLUGINS="qi ezhud xmpp irc"
if [ "$BUILD_ANDROID" != "n" ]; then if [ "$BUILD_ANDROID" != "n" ]; then
build "Android" android droid-rel build "Android" android droid-rel
@ -175,6 +180,7 @@ fi
####build "MorphOS" morphos CFLAGS="-I$BASE/morphos/os-include/ -I$BASE/morphos/lib/ -L$BASE/morphos/lib/ -I$BASE/zlib/zlib-1.2.5 -L$BASE/zlib/zlib-1.2.5 -I./libs $WARNINGLEVEL" gl-rel mingl-rel sv-rel qcc-rel ####build "MorphOS" morphos CFLAGS="-I$BASE/morphos/os-include/ -I$BASE/morphos/lib/ -L$BASE/morphos/lib/ -I$BASE/zlib/zlib-1.2.5 -L$BASE/zlib/zlib-1.2.5 -I./libs $WARNINGLEVEL" gl-rel mingl-rel sv-rel qcc-rel
if [ "$BUILD_MAC" != "n" ]; then if [ "$BUILD_MAC" != "n" ]; then
#build "MacOSX" macosx_tiger CFLAGS="-I$BASE/mac/x86/include/ -L$BASE/mac/x86/lib -I./libs" FTE_TARGET=macosx_x86 sv-rel gl-rel mingl-rel qcc-rel #build "MacOSX" macosx_tiger CFLAGS="-I$BASE/mac/x86/include/ -L$BASE/mac/x86/lib -I./libs" FTE_TARGET=macosx_x86 sv-rel gl-rel mingl-rel qcc-rel
#FIXME: figure out how to do universal binaries or whatever they're called
build "MacOSX 32-bit" osx32 CC=o32-clang CXX=o32-clang++ FTE_TARGET=osx_x86 BITS=32 sv-rel gl-rel mingl-rel qcc-rel build "MacOSX 32-bit" osx32 CC=o32-clang CXX=o32-clang++ FTE_TARGET=osx_x86 BITS=32 sv-rel gl-rel mingl-rel qcc-rel
build "MacOSX 64-bit" osx64 CC=o64-clang CXX=o64-clang++ FTE_TARGET=osx_x86_64 BITS=64 sv-rel gl-rel mingl-rel qcc-rel build "MacOSX 64-bit" osx64 CC=o64-clang CXX=o64-clang++ FTE_TARGET=osx_x86_64 BITS=64 sv-rel gl-rel mingl-rel qcc-rel
fi fi
@ -208,7 +214,7 @@ then
mv ~/.fte/fte/src/csqcsysdefs.qc $QCCBUILDFOLDER mv ~/.fte/fte/src/csqcsysdefs.qc $QCCBUILDFOLDER
mv ~/.fte/fte/src/menusysdefs.qc $QCCBUILDFOLDER mv ~/.fte/fte/src/menusysdefs.qc $QCCBUILDFOLDER
else else
echo "Skipping FTE Extensions, no Linux build located" echo "Skipping FTE Extensions, no Linux gl32 build located"
fi fi

View file

@ -380,7 +380,7 @@ endif
#DO_ECHO=@echo $< && #DO_ECHO=@echo $< &&
DO_ECHO=@ DO_ECHO=@
DO_ECHO= #DO_ECHO=
DO_CC=$(DO_ECHO) $(CC) $(LTO_CC) $(ALL_CFLAGS) -o $@ -c $< DO_CC=$(DO_ECHO) $(CC) $(LTO_CC) $(ALL_CFLAGS) -o $@ -c $<
ifeq ($(FTE_TARGET),vc) ifeq ($(FTE_TARGET),vc)
@ -452,7 +452,17 @@ DEBUG_CFLAGS?=-ggdb -g
DEBUG_CFLAGS+=-DDEBUG DEBUG_CFLAGS+=-DDEBUG
RELEASE_CFLAGS?=-O3 -ffast-math $(CPUOPTIMIZATIONS) RELEASE_CFLAGS?=-O3 -ffast-math $(CPUOPTIMIZATIONS)
ARCH?=$(shell $(CC) -dumpmachine) ifeq ($(FTE_TARGET),vc)
#msvc doesn't do -dumpmachine.
#we might as well get it to reuse the mingw libraries, if only because that makes those libraries easier to compile...
ifeq ($(BITS),64)
ARCH?=x86_64-w64-mingw32
else
ARCH?=i686-w64-mingw32
endif
else
ARCH?=$(shell $(CC) -dumpmachine)
endif
ARCHLIBS=$(NATIVE_ABSBASE_DIR)/libs-$(ARCH) ARCHLIBS=$(NATIVE_ABSBASE_DIR)/libs-$(ARCH)
#incase our compiler doesn't support it (mingw) #incase our compiler doesn't support it (mingw)
@ -1696,7 +1706,7 @@ m-dbg:
m-profile: m-profile:
@$(MAKE) m-tmp TYPE=_clsv-profile OUT_DIR="$(PROFILE_DIR)/$(NCDIRPREFIX)$(MB_DIR)" @$(MAKE) m-tmp TYPE=_clsv-profile OUT_DIR="$(PROFILE_DIR)/$(NCDIRPREFIX)$(MB_DIR)"
.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 reldir debugdir makelibs .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 reldir debugdir makelibs wel-rel web-dbg
_qcc-tmp: $(REQDIR) _qcc-tmp: $(REQDIR)
@ -1849,7 +1859,9 @@ nacl-dbg:
################################################# #################################################
#webgl helpers #webgl helpers
ifeq (,$(EMSDK)) #EMCC?=/opt/emsdk_portable/emscripten/master/emcc
EMCC?=emcc.bat --em-config $(shell cygpath -m $(USERPROFILE))/.emscripten
ifeq ($(EMSDK),)
#just adds some extra paths (WINDOWS HOST ONLY) #just adds some extra paths (WINDOWS HOST ONLY)
#assumes you installed the emscripten 1.22.0 sdk to EMSCRIPTENROOT #assumes you installed the emscripten 1.22.0 sdk to EMSCRIPTENROOT
#if you have a different version installed, you will need to fix up the paths yourself (or just use fte_target explicitly yourself). #if you have a different version installed, you will need to fix up the paths yourself (or just use fte_target explicitly yourself).
@ -1860,8 +1872,6 @@ else
EMSCRIPTENPATH=$(PATH) EMSCRIPTENPATH=$(PATH)
endif endif
#EMCC?=/opt/emsdk_portable/emscripten/master/emcc
EMCC?=emcc.bat --em-config $(shell cygpath -m $(USERPROFILE))/.emscripten
web-rel: web-rel:
@PATH="$(EMSCRIPTENPATH)" $(MAKE) gl-rel FTE_TARGET=web CC="$(EMCC)" @PATH="$(EMSCRIPTENPATH)" $(MAKE) gl-rel FTE_TARGET=web CC="$(EMCC)"
cp $(BASE_DIR)/web/fteshell.html $(RELEASE_DIR)/ftewebgl.html cp $(BASE_DIR)/web/fteshell.html $(RELEASE_DIR)/ftewebgl.html
@ -1871,7 +1881,7 @@ web-rel:
web-dbg: web-dbg:
@PATH="$(EMSCRIPTENPATH)" $(MAKE) gl-dbg FTE_TARGET=web CC="$(EMCC)" @PATH="$(EMSCRIPTENPATH)" $(MAKE) gl-dbg FTE_TARGET=web CC="$(EMCC)"
cp $(BASE_DIR)/web/fteshell.html $(RELEASE_DIR)/ftewebgl.html cp $(BASE_DIR)/web/fteshell.html $(DEBUG_DIR)/ftewebgl.html
@gzip -f $(DEBUG_DIR)/ftewebgl.html @gzip -f $(DEBUG_DIR)/ftewebgl.html
@gzip -f $(DEBUG_DIR)/ftewebgl.js @gzip -f $(DEBUG_DIR)/ftewebgl.js
@gzip -f $(DEBUG_DIR)/ftewebgl.js.map @gzip -f $(DEBUG_DIR)/ftewebgl.js.map

View file

@ -2580,7 +2580,6 @@ void CL_QTVPoll (void)
//now put it on a menu //now put it on a menu
if (!sourcesmenu) if (!sourcesmenu)
{ {
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
sourcesmenu = M_CreateMenu(0); sourcesmenu = M_CreateMenu(0);

View file

@ -3506,7 +3506,7 @@ qboolean CL_AllowArbitaryDownload(char *oldname, char *localfile)
if (!Q_strncasecmp(localfile, "game", 4) || //q2-ey things if (!Q_strncasecmp(localfile, "game", 4) || //q2-ey things
!Q_strcasecmp(localfile, "progs.dat") || !Q_strcasecmp(localfile, "menu.dat") || !Q_strcasecmp(localfile, "csprogs.dat") || !Q_strcasecmp(localfile, "qwprogs.dat") || //overriding gamecode is bad (csqc should be dlcached) !Q_strcasecmp(localfile, "progs.dat") || !Q_strcasecmp(localfile, "menu.dat") || !Q_strcasecmp(localfile, "csprogs.dat") || !Q_strcasecmp(localfile, "qwprogs.dat") || //overriding gamecode is bad (csqc should be dlcached)
strstr(localfile, "\\") || strstr(localfile, "..") || strstr(localfile, "./") || strstr(localfile, ":") || strstr(localfile, "//") || //certain path patterns are just bad strstr(localfile, "\\") || strstr(localfile, "..") || strstr(localfile, "./") || strstr(localfile, ":") || strstr(localfile, "//") || //certain path patterns are just bad
Q_strcasestr(localfile, ".qvm") || Q_strcasestr(localfile, ".dll") || Q_strcasestr(localfile, ".so")) //disallow any native code Q_strcasestr(localfile, ".qvm") || Q_strcasestr(localfile, ".dll") || Q_strcasestr(localfile, ".so") || Q_strcasestr(localfile, ".dylib")) //disallow any native code
{ //yes, I know the user can use a different progs from the one that is specified. If you leave it blank there will be no problem. (server isn't allowed to stuff progs cvar) { //yes, I know the user can use a different progs from the one that is specified. If you leave it blank there will be no problem. (server isn't allowed to stuff progs cvar)
Con_Printf("Ignoring arbitary download to \"%s\" due to possible security risk\n", localfile); Con_Printf("Ignoring arbitary download to \"%s\" due to possible security risk\n", localfile);
return false; return false;
@ -5469,15 +5469,15 @@ void CL_StartCinematicOrMenu(void)
if (!sv.state) if (!sv.state)
#endif #endif
{ {
if (qrenderer > QR_NONE && !m_state) if (qrenderer > QR_NONE && !Key_Dest_Has(kdm_emenu))
{ {
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS
if (!cls.state && !m_state && !*FS_GetGamedir(false)) if (!cls.state && !Key_Dest_Has(kdm_emenu) && !*FS_GetGamedir(false))
M_Menu_Mods_f(); M_Menu_Mods_f();
#endif #endif
if (!cls.state && !m_state && cl_demoreel.ival) if (!cls.state && !Key_Dest_Has(kdm_emenu) && cl_demoreel.ival)
CL_NextDemo(); CL_NextDemo();
if (!cls.state && !m_state) if (!cls.state && !Key_Dest_Has(kdm_emenu))
//if we're (now) meant to be using csqc for menus, make sure that its running. //if we're (now) meant to be using csqc for menus, make sure that its running.
if (!CSQC_UnconnectedInit()) if (!CSQC_UnconnectedInit())
M_ToggleMenu_f(); M_ToggleMenu_f();

View file

@ -2026,8 +2026,6 @@ void DL_Completed(qdownload_t *dl, qofs_t start, qofs_t end)
} }
} }
qboolean CL_AllowArbitaryDownload(char *localfile);
static float chunkrate; static float chunkrate;
void CL_ParseChunkedDownload(qdownload_t *dl) void CL_ParseChunkedDownload(qdownload_t *dl)
@ -2071,7 +2069,7 @@ void CL_ParseChunkedDownload(qdownload_t *dl)
{ {
if (flag == DLERR_REDIRECTFILE) if (flag == DLERR_REDIRECTFILE)
{ {
if (CL_AllowArbitaryDownload(svname)) if (CL_AllowArbitaryDownload(dl->remotename, svname))
{ {
Con_Printf("Download of \"%s\" redirected to \"%s\"\n", dl->remotename, svname); Con_Printf("Download of \"%s\" redirected to \"%s\"\n", dl->remotename, svname);
if (!strncmp(svname, "package/", 8)) if (!strncmp(svname, "package/", 8))
@ -2195,7 +2193,7 @@ void CL_ParseChunkedDownload(qdownload_t *dl)
chunkrate += 1; chunkrate += 1;
} }
int CL_CountQueuedDownloads(void) static int CL_CountQueuedDownloads(void)
{ {
int count = 0; int count = 0;
downloadlist_t *dl; downloadlist_t *dl;

View file

@ -6,7 +6,7 @@
static plugin_t *menuplug; //plugin that has the current menu plugin_t *menuplug; //plugin that has the current menu
static plugin_t *protocolclientplugin; static plugin_t *protocolclientplugin;
@ -27,17 +27,15 @@ static qintptr_t VARGS Plug_Menu_Control(void *offset, quintptr_t mask, const qi
Plug_Menu_Event(3, 0); Plug_Menu_Event(3, 0);
menuplug = NULL; menuplug = NULL;
currentplug = oldplug; currentplug = oldplug;
Key_Dest_Remove(kdm_emenu);
} }
if (VM_LONG(arg[0]) != 1) if (VM_LONG(arg[0]) != 1)
return 1; return 1;
//give us menu control //give us menu control
menuplug = currentplug; menuplug = currentplug;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_plugin;
return 1; return 1;
case 2: //weather it's us or not. case 2: //weather it's us or not.
return currentplug == menuplug && m_state == m_plugin; return currentplug == menuplug && Key_Dest_Has(kdm_emenu);
case 3: //weather a menu is active case 3: //weather a menu is active
return !!Key_Dest_Has(kdm_emenu|kdm_gmenu); return !!Key_Dest_Has(kdm_emenu|kdm_gmenu);
default: default:

View file

@ -1673,6 +1673,7 @@ void SCR_SetLoadingStage(int stage)
if (loadingfile) if (loadingfile)
Z_Free(loadingfile); Z_Free(loadingfile);
loadingfile = NULL; loadingfile = NULL;
scr_disabled_for_loading = scr_drawloading = false;
break; break;
case LS_CONNECTION: case LS_CONNECTION:
SCR_SetLoadingFile("waiting for connection..."); SCR_SetLoadingFile("waiting for connection...");
@ -2030,7 +2031,7 @@ void SCR_SetUpToDrawConsole (void)
{ {
if (CL_TryingToConnect()) //if we're trying to connect, make sure there's a loading/connecting screen showing instead of forcing the menu visible if (CL_TryingToConnect()) //if we're trying to connect, make sure there's a loading/connecting screen showing instead of forcing the menu visible
SCR_SetLoadingStage(LS_CONNECTION); SCR_SetLoadingStage(LS_CONNECTION);
else if (!m_state && !startuppending) //don't force anything until the startup stuff has been done else if (!Key_Dest_Has(kdm_emenu) && !startuppending) //don't force anything until the startup stuff has been done
M_ToggleMenu_f(); M_ToggleMenu_f();
} }
} }

View file

@ -416,6 +416,7 @@ enum qdlabort
qboolean DL_Begun(qdownload_t *dl); qboolean DL_Begun(qdownload_t *dl);
void DL_Completed(qdownload_t *dl, qofs_t start, qofs_t end); //notifies the download logic that a chunk of the file is no longer needed. void DL_Completed(qdownload_t *dl, qofs_t start, qofs_t end); //notifies the download logic that a chunk of the file is no longer needed.
void DL_Abort(qdownload_t *dl, enum qdlabort aborttype); //just frees the download's resources. does not delete the temp file. void DL_Abort(qdownload_t *dl, enum qdlabort aborttype); //just frees the download's resources. does not delete the temp file.
qboolean CL_AllowArbitaryDownload(char *oldname, char *localfile);
//chunked downloads //chunked downloads
void DLC_Poll(qdownload_t *dl); void DLC_Poll(qdownload_t *dl);
@ -1370,7 +1371,7 @@ qboolean CSQC_DrawView(void);
qboolean CSQC_UseGamecodeLoadingScreen(void); qboolean CSQC_UseGamecodeLoadingScreen(void);
void CSQC_Shutdown(void); void CSQC_Shutdown(void);
qboolean CSQC_StuffCmd(int lplayernum, char *cmd, char *cmdend); qboolean CSQC_StuffCmd(int lplayernum, char *cmd, char *cmdend);
void CSQC_MapEntityEdited(int idx, const char *newe); void CSQC_MapEntityEdited(int modelindex, int idx, const char *newe);
qboolean CSQC_LoadResource(char *resname, char *restype); qboolean CSQC_LoadResource(char *resname, char *restype);
qboolean CSQC_ParsePrint(char *message, int printlevel); qboolean CSQC_ParsePrint(char *message, int printlevel);
qboolean CSQC_ParseGamePacket(void); qboolean CSQC_ParseGamePacket(void);

View file

@ -180,6 +180,7 @@ char *ReadGreyTargaFile (qbyte *data, int flen, tgaheader_t *tgahead, int asgrey
return pixels; return pixels;
} }
#define MISSHORT(ptr) (*(ptr) | (*(ptr+1) << 8))
//remember to free it //remember to free it
qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, qboolean *hasalpha, int asgrey) qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, qboolean *hasalpha, int asgrey)
{ {
@ -196,8 +197,8 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, qboolean *
tgaheader.id_len = buf[0]; tgaheader.id_len = buf[0];
tgaheader.cm_type = buf[1]; tgaheader.cm_type = buf[1];
tgaheader.version = buf[2]; tgaheader.version = buf[2];
tgaheader.cm_idx = LittleShort(*(short *)&buf[3]); tgaheader.cm_idx = MISSHORT(buf+3);
tgaheader.cm_len = LittleShort(*(short *)&buf[5]); tgaheader.cm_len = MISSHORT(buf+5);
tgaheader.cm_size = buf[7]; tgaheader.cm_size = buf[7];
tgaheader.originx = LittleShort(*(short *)&buf[8]); tgaheader.originx = LittleShort(*(short *)&buf[8]);
tgaheader.originy = LittleShort(*(short *)&buf[10]); tgaheader.originy = LittleShort(*(short *)&buf[10]);
@ -331,7 +332,7 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, qboolean *
packetHeader=*data++; packetHeader=*data++;
packetSize = 1 + (packetHeader & 0x7f); packetSize = 1 + (packetHeader & 0x7f);
if (packetHeader & 0x80) if (packetHeader & 0x80)
{ // run-length packet { // run-length packet
switch (tgaheader.bpp) switch (tgaheader.bpp)
{ {
case 8: //we made sure this was version 11 case 8: //we made sure this was version 11
@ -5162,9 +5163,12 @@ void Image_List_f(void)
size_t mem = 0; size_t mem = 0;
unsigned int loadflags; unsigned int loadflags;
char fname[MAX_QPATH]; char fname[MAX_QPATH];
const char *filter = Cmd_Argv(1);
for (tex = imagelist; tex; tex = tex->next) for (tex = imagelist; tex; tex = tex->next)
{ {
total++; total++;
if (*filter && !strstr(tex->ident, filter))
continue;
if (tex->subpath) if (tex->subpath)
Con_Printf("^h(%s)^h", tex->subpath); Con_Printf("^h(%s)^h", tex->subpath);

View file

@ -2290,10 +2290,7 @@ qboolean Key_MouseShouldBeFree(void)
// return true; // return true;
if (Key_Dest_Has(kdm_emenu)) if (Key_Dest_Has(kdm_emenu))
{ return true;
if (m_state == m_complex || m_state == m_plugin /*|| m_state == m_menu_dat*/)
return true;
}
#ifdef VM_UI #ifdef VM_UI
if (UI_MenuState()) if (UI_MenuState())

View file

@ -87,6 +87,8 @@ extern cvar_t pm_downloads_url;
#define DPF_ENGINE 0x1000 //engine update. replaces old autoupdate mechanism #define DPF_ENGINE 0x1000 //engine update. replaces old autoupdate mechanism
#define DPF_PLUGIN 0x2000 //this is a plugin package, with a dll #define DPF_PLUGIN 0x2000 //this is a plugin package, with a dll
#define DPF_TRUSTED 0x4000 //flag used when parsing package lists. if not set then packages will be ignored if they are anything but paks/pk3s
#define DPF_PRESENT (DPF_NATIVE|DPF_CACHED) #define DPF_PRESENT (DPF_NATIVE|DPF_CACHED)
#define DPF_DISABLEDINSTALLED (DPF_ENGINE|DPF_PLUGIN) //engines+plugins can be installed without being enabled. #define DPF_DISABLEDINSTALLED (DPF_ENGINE|DPF_PLUGIN) //engines+plugins can be installed without being enabled.
//pak.lst //pak.lst
@ -185,6 +187,7 @@ static char *manifestpackages; //metapackage named by the manicfest.
static char *declinedpackages; //metapackage named by the manicfest. static char *declinedpackages; //metapackage named by the manicfest.
static int domanifestinstall; //SECURITY_MANIFEST_* static int domanifestinstall; //SECURITY_MANIFEST_*
static qboolean pluginpromptshown; //so we only show prompts for new externally-installed plugins once, instead of every time the file is reloaded.
static qboolean doautoupdate; //updates will be marked (but not applied without the user's actions) static qboolean doautoupdate; //updates will be marked (but not applied without the user's actions)
static qboolean pkg_updating; //when flagged, further changes are blocked until completion. static qboolean pkg_updating; //when flagged, further changes are blocked until completion.
@ -194,6 +197,7 @@ static struct
{ {
char *url; char *url;
char *prefix; char *prefix;
qboolean trustworthy; //trusted
char received; //says if we got a response yet or not char received; //says if we got a response yet or not
qboolean save; //written into our local file qboolean save; //written into our local file
struct dl_download *curdl; //the download context struct dl_download *curdl; //the download context
@ -559,7 +563,7 @@ static void PM_AddDep(package_t *p, int deptype, const char *depname)
*link = nd; *link = nd;
} }
static void PM_AddSubList(const char *url, const char *prefix, qboolean save) static void PM_AddSubList(const char *url, const char *prefix, qboolean save, qboolean trustworthy)
{ {
int i; int i;
if (!*url) if (!*url)
@ -576,6 +580,10 @@ static void PM_AddSubList(const char *url, const char *prefix, qboolean save)
} }
if (i == numdownloadablelists && i < countof(downloadablelist)) if (i == numdownloadablelists && i < countof(downloadablelist))
{ {
if (!strncmp(url, "https:", 6))
downloadablelist[i].trustworthy = trustworthy;
else
downloadablelist[i].trustworthy = false; //if its not a secure url, never consider it as trustworthy
downloadablelist[i].save = save; downloadablelist[i].save = save;
downloadablelist[i].url = BZ_Malloc(strlen(url)+1); downloadablelist[i].url = BZ_Malloc(strlen(url)+1);
@ -665,7 +673,7 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c
subprefix = va("%s/%s", prefix, Cmd_Argv(2)); subprefix = va("%s/%s", prefix, Cmd_Argv(2));
else else
subprefix = Cmd_Argv(2); subprefix = Cmd_Argv(2);
PM_AddSubList(Cmd_Argv(1), subprefix, (parseflags & DPF_ENABLED)?true:false); PM_AddSubList(Cmd_Argv(1), subprefix, (parseflags & DPF_ENABLED)?true:false, (parseflags&DPF_TRUSTED));
continue; continue;
} }
if (!strcmp(Cmd_Argv(0), "set")) if (!strcmp(Cmd_Argv(0), "set"))
@ -729,6 +737,7 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c
int extract = EXTRACT_COPY; int extract = EXTRACT_COPY;
int priority = PM_DEFAULTPRIORITY; int priority = PM_DEFAULTPRIORITY;
unsigned int flags = parseflags; unsigned int flags = parseflags;
enum fs_relative fsroot = FS_ROOT;
int i; int i;
if (version > 2) if (version > 2)
@ -795,6 +804,13 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c
flags &= ~DPF_ENABLED; //known about, (probably) cached, but not actually enabled. flags &= ~DPF_ENABLED; //known about, (probably) cached, but not actually enabled.
else if (!strncmp(arg, "installed=", 6) && version>2) else if (!strncmp(arg, "installed=", 6) && version>2)
flags |= parseflags & DPF_ENABLED; flags |= parseflags & DPF_ENABLED;
else if (!strncmp(arg, "root=", 5) && (parseflags&DPF_ENABLED))
{
if (!Q_strcasecmp(arg+5, "bin"))
fsroot = FS_BINARYPATH;
else
fsroot = FS_ROOT;
}
else else
{ {
Con_DPrintf("Unknown package property\n"); Con_DPrintf("Unknown package property\n");
@ -836,7 +852,7 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c
Q_strncpyz(p->version, ver?ver:"", sizeof(p->version)); Q_strncpyz(p->version, ver?ver:"", sizeof(p->version));
Q_snprintfz(p->gamedir, sizeof(p->gamedir), "%s", gamedir); Q_snprintfz(p->gamedir, sizeof(p->gamedir), "%s", gamedir);
p->fsroot = FS_ROOT; p->fsroot = fsroot;
p->extract = extract; p->extract = extract;
p->priority = priority; p->priority = priority;
p->flags = flags; p->flags = flags;
@ -927,7 +943,7 @@ static void PM_ParsePackageList(vfsfile_t *f, int parseflags, const char *url, c
} }
else if (!Q_strcasecmp(p->arch, THISARCH)) else if (!Q_strcasecmp(p->arch, THISARCH))
{ {
if (p->fsroot == FS_ROOT && !*p->gamedir) if ((p->fsroot == FS_ROOT || p->fsroot == FS_BINARYPATH) && !*p->gamedir)
p->flags |= DPF_PLUGIN; p->flags |= DPF_PLUGIN;
} }
else else
@ -976,6 +992,109 @@ void PM_EnumeratePlugins(void (*callback)(const char *name))
} }
#endif #endif
#ifdef PLUGINS
static void PM_WriteInstalledPackages(void);
static package_t *PM_FindPackage(const char *packagename);
static int QDECL PM_EnumeratedPlugin (const char *name, qofs_t size, time_t mtime, void *param, searchpathfuncs_t *spath)
{
package_t *p;
struct packagedep_s *dep;
char vmname[MAX_QPATH];
int len;
char *dot;
if (!strncmp(name, "fteplug_", 8))
Q_strncpyz(vmname, name+8, sizeof(vmname));
else
Q_strncpyz(vmname, name, sizeof(vmname));
len = strlen(vmname);
len -= strlen(ARCH_CPU_POSTFIX ARCH_DL_POSTFIX);
if (!strcmp(vmname+len, ARCH_CPU_POSTFIX ARCH_DL_POSTFIX))
vmname[len] = 0;
else
{
dot = strchr(vmname, '.');
if (dot)
*dot = 0;
}
len = strlen(vmname);
if (len > 0 && vmname[len-1] == '_')
vmname[len-1] = 0;
for (p = availablepackages; p; p = p->next)
{
if (!(p->flags & DPF_PLUGIN))
continue;
for (dep = p->deps; dep; dep = dep->next)
{
if (dep->dtype != DEP_FILE)
continue;
if (!Q_strcasecmp(dep->name, name))
return true;
}
}
if (PM_FindPackage(vmname))
return true; //don't include it if its a dupe anyway.
p = Z_Malloc(sizeof(*p));
p->deps = Z_Malloc(sizeof(*p->deps) + strlen(name));
p->deps->dtype = DEP_FILE;
strcpy(p->deps->name, name);
p->arch = Z_StrDup(THISARCH);
p->name = Z_StrDup(vmname);
p->title = Z_StrDup(vmname);
p->category = Z_StrDup("Plugins/");
p->priority = PM_DEFAULTPRIORITY;
p->fsroot = FS_BINARYPATH;
strcpy(p->version, "??""??");
p->flags = DPF_PLUGIN|DPF_NATIVE|DPF_FORGETONUNINSTALL;
PM_InsertPackage(p);
*(int*)param = true;
return true;
}
void PM_PluginDetected(void *ctx, int status)
{
PM_WriteInstalledPackages();
if (status == 0)
{
Cmd_ExecuteString("menu_download\n", RESTRICT_LOCAL);
Cmd_ExecuteString("menu_download \"Plugins/\"\n", RESTRICT_LOCAL);
}
}
#endif
static void PM_PreparePackageList(void)
{
//figure out what we've previously installed.
if (!loadedinstalled)
{
char nat[MAX_OSPATH];
vfsfile_t *f = FS_OpenVFS(INSTALLEDFILES, "rb", FS_ROOT);
loadedinstalled = true;
if (f)
{
PM_ParsePackageList(f, DPF_FORGETONUNINSTALL|DPF_ENABLED, NULL, "");
VFS_CLOSE(f);
}
#ifdef PLUGINS
{
int foundone = false;
FS_NativePath("", FS_BINARYPATH, nat, sizeof(nat));
Con_DPrintf("Loading plugins from \"%s\"\n", nat);
Sys_EnumerateFiles(nat, "fteplug_*" ARCH_CPU_POSTFIX ARCH_DL_POSTFIX, PM_EnumeratedPlugin, &foundone, NULL);
if (foundone && !pluginpromptshown)
{
pluginpromptshown = true;
M_Menu_Prompt(PM_PluginDetected, NULL, "Plugin(s) appears to have\nbeen installed externally.\nUse the updates menu\ntoenable them.", "View", NULL, "Disable");
}
}
#endif
}
}
void PM_LoadPackages(searchpath_t **oldpaths, const char *parent_pure, const char *parent_logical, searchpath_t *search, unsigned int loadstuff, int minpri, int maxpri) void PM_LoadPackages(searchpath_t **oldpaths, const char *parent_pure, const char *parent_logical, searchpath_t *search, unsigned int loadstuff, int minpri, int maxpri)
{ {
package_t *p; package_t *p;
@ -984,16 +1103,7 @@ void PM_LoadPackages(searchpath_t **oldpaths, const char *parent_pure, const cha
int pri; int pri;
//figure out what we've previously installed. //figure out what we've previously installed.
if (!loadedinstalled) PM_PreparePackageList();
{
vfsfile_t *f = FS_OpenVFS(INSTALLEDFILES, "rb", FS_ROOT);
loadedinstalled = true;
if (f)
{
PM_ParsePackageList(f, DPF_FORGETONUNINSTALL|DPF_ENABLED, NULL, "");
VFS_CLOSE(f);
}
}
do do
{ {
@ -1051,24 +1161,6 @@ void PM_Shutdown(void)
loadedinstalled = false; loadedinstalled = false;
} }
static void PM_PreparePackageList(void)
{
//figure out what we've previously installed.
if (!loadedinstalled)
{
vfsfile_t *f = FS_OpenVFS(INSTALLEDFILES, "rb", FS_ROOT);
loadedinstalled = true;
if (f)
{
PM_ParsePackageList(f, DPF_FORGETONUNINSTALL|DPF_ENABLED, NULL, "");
VFS_CLOSE(f);
}
}
}
//finds the newest version //finds the newest version
static package_t *PM_FindPackage(const char *packagename) static package_t *PM_FindPackage(const char *packagename)
{ {
@ -1484,7 +1576,6 @@ static void PM_ListDownloaded(struct dl_download *dl)
if (Key_Dest_Has(kdm_emenu)) if (Key_Dest_Has(kdm_emenu))
{ {
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
} }
#ifdef MENU_DAT #ifdef MENU_DAT
if (Key_Dest_Has(kdm_gmenu)) if (Key_Dest_Has(kdm_gmenu))
@ -1507,10 +1598,7 @@ static void PM_ListDownloaded(struct dl_download *dl)
if (!isDedicated) if (!isDedicated)
{ {
if (Key_Dest_Has(kdm_emenu)) if (Key_Dest_Has(kdm_emenu))
{
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
}
#ifdef MENU_DAT #ifdef MENU_DAT
if (Key_Dest_Has(kdm_gmenu)) if (Key_Dest_Has(kdm_gmenu))
MP_Toggle(0); MP_Toggle(0);
@ -1535,7 +1623,7 @@ static void PM_UpdatePackageList(qboolean autoupdate, int retry)
//make sure our sources are okay. //make sure our sources are okay.
if (*pm_downloads_url.string) if (*pm_downloads_url.string)
PM_AddSubList(pm_downloads_url.string, "", true); PM_AddSubList(pm_downloads_url.string, "", true, true);
doautoupdate |= autoupdate; doautoupdate |= autoupdate;
@ -1702,6 +1790,12 @@ static void PM_WriteInstalledPackages(void)
COM_QuotedConcat(va("preview=%s", p->previewimage), buf, sizeof(buf)); COM_QuotedConcat(va("preview=%s", p->previewimage), buf, sizeof(buf));
} }
if (p->fsroot == FS_BINARYPATH)
{
Q_strncatz(buf, " ", sizeof(buf));
COM_QuotedConcat(va("root=bin", p->previewimage), buf, sizeof(buf));
}
for (dep = p->deps; dep; dep = dep->next) for (dep = p->deps; dep; dep = dep->next)
{ {
if (dep->dtype == DEP_FILE) if (dep->dtype == DEP_FILE)
@ -1791,7 +1885,7 @@ static int QDECL PM_ExtractFiles(const char *fname, qofs_t fsize, time_t mtime,
//package has been downloaded and installed, but some packages need to be enabled //package has been downloaded and installed, but some packages need to be enabled
//(plugins might have other dll dependancies, so this can only happen AFTER the entire package was extracted) //(plugins might have other dll dependancies, so this can only happen AFTER the entire package was extracted)
void PM_PackageEnabled(package_t *p) static void PM_PackageEnabled(package_t *p)
{ {
char ext[8]; char ext[8];
struct packagedep_s *dep; struct packagedep_s *dep;
@ -2267,8 +2361,12 @@ static void PM_ApplyChanges(void)
if (reloadpacks) if (reloadpacks)
FS_ReloadPackFiles(); FS_ReloadPackFiles();
if (p->flags & DPF_FORGETONUNINSTALL) if ((p->flags & DPF_FORGETONUNINSTALL) && !(p->flags & DPF_PRESENT))
{ {
#if 1
downloadablessequence++;
PM_FreePackage(p);
#else
if (p->alternative) if (p->alternative)
{ //replace it with its alternative package { //replace it with its alternative package
*p->link = p->alternative; *p->link = p->alternative;
@ -2287,6 +2385,7 @@ static void PM_ApplyChanges(void)
//FIXME: the menu(s) hold references to packages, so its not safe to purge them //FIXME: the menu(s) hold references to packages, so its not safe to purge them
p->flags |= DPF_HIDDEN; p->flags |= DPF_HIDDEN;
// BZ_Free(p); // BZ_Free(p);
#endif
continue; continue;
} }
@ -2569,7 +2668,7 @@ void PM_Command_f(void)
Con_Printf("<%i sources>\n", numdownloadablelists); Con_Printf("<%i sources>\n", numdownloadablelists);
} }
else else
PM_AddSubList(Cmd_Argv(2), "", true); PM_AddSubList(Cmd_Argv(2), "", true, true);
} }
else if (!strcmp(act, "remsource")) else if (!strcmp(act, "remsource"))
PM_RemSubList(Cmd_Argv(2)); PM_RemSubList(Cmd_Argv(2));
@ -2676,16 +2775,7 @@ qboolean PM_FindUpdatedEngine(char *syspath, size_t syspathsize)
package_t *e = NULL, *p; package_t *e = NULL, *p;
char *pfname; char *pfname;
//figure out what we've previously installed. //figure out what we've previously installed.
if (!loadedinstalled) PM_PreparePackageList();
{
vfsfile_t *f = FS_OpenVFS(INSTALLEDFILES, "rb", FS_ROOT);
loadedinstalled = true;
if (f)
{
PM_ParsePackageList(f, DPF_FORGETONUNINSTALL|DPF_ENABLED, NULL, "");
VFS_CLOSE(f);
}
}
for (p = availablepackages; p; p = p->next) for (p = availablepackages; p; p = p->next)
{ {
@ -2998,7 +3088,7 @@ static qboolean MD_RevertUpdates (union menuoption_s *mo,struct menu_s *m,int ke
return false; return false;
} }
void M_AddItemsToDownloadMenu(menu_t *m) static void MD_AddItemsToDownloadMenu(menu_t *m)
{ {
char path[MAX_QPATH]; char path[MAX_QPATH];
int y; int y;
@ -3094,7 +3184,7 @@ void M_AddItemsToDownloadMenu(menu_t *m)
} }
#include "shader.h" #include "shader.h"
void M_Download_UpdateStatus(struct menu_s *m) static void MD_Download_UpdateStatus(struct menu_s *m)
{ {
dlmenu_t *info = m->data; dlmenu_t *info = m->data;
int i; int i;
@ -3130,7 +3220,7 @@ void M_Download_UpdateStatus(struct menu_s *m)
} }
info->populated = true; info->populated = true;
M_AddItemsToDownloadMenu(m); MD_AddItemsToDownloadMenu(m);
} }
if (m->selecteditem && m->selecteditem->common.type == mt_custom && m->selecteditem->custom.dptr) if (m->selecteditem && m->selecteditem->common.type == mt_custom && m->selecteditem->custom.dptr)
@ -3151,13 +3241,12 @@ void Menu_DownloadStuff_f (void)
dlmenu_t *info; dlmenu_t *info;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(dlmenu_t)); menu = M_CreateMenu(sizeof(dlmenu_t));
info = menu->data; info = menu->data;
menu->persist = true; menu->persist = true;
menu->predraw = M_Download_UpdateStatus; menu->predraw = MD_Download_UpdateStatus;
info->downloadablessequence = downloadablessequence; info->downloadablessequence = downloadablessequence;

View file

@ -1510,7 +1510,6 @@ changed:
void M_AddMenu (menu_t *menu) void M_AddMenu (menu_t *menu)
{ {
m_state = m_complex;
menu->prev = topmenu; menu->prev = topmenu;
if (topmenu) if (topmenu)
topmenu->next = menu; topmenu->next = menu;
@ -1649,7 +1648,6 @@ void M_Complex_Draw(void)
if (!topmenu) if (!topmenu)
{ {
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
return; return;
} }
@ -1927,7 +1925,6 @@ qboolean MC_Main_Key (int key, menu_t *menu) //here purly to restart demos.
return true; return true;
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
return true; return true;
} }
return false; return false;
@ -1986,7 +1983,6 @@ void M_Menu_Main_f (void)
{ {
if (R_GetShaderSizes(R2D_SafeCachePic("pics/m_main_quit"), NULL, NULL, true) > 0) if (R_GetShaderSizes(R2D_SafeCachePic("pics/m_main_quit"), NULL, NULL, true) > 0)
{ {
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
@ -2044,7 +2040,6 @@ void M_Menu_Main_f (void)
if (R_GetShaderSizes(p, NULL, NULL, true) <= 0) if (R_GetShaderSizes(p, NULL, NULL, true) <= 0)
return; return;
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
mainm->key = MC_Main_Key; mainm->key = MC_Main_Key;
@ -2084,7 +2079,6 @@ void M_Menu_Main_f (void)
if (QBigFontWorks()) if (QBigFontWorks())
{ {
int y; int y;
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);
@ -2136,7 +2130,6 @@ void M_Menu_Main_f (void)
else else
{ {
int width; int width;
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
mainm = M_CreateMenu(0); mainm = M_CreateMenu(0);

View file

@ -1134,7 +1134,6 @@ void M_Menu_ServerList2_f(void)
Key_Dest_Remove(kdm_console); Key_Dest_Remove(kdm_console);
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(serverlist_t)); menu = M_CreateMenu(sizeof(serverlist_t));
menu->predraw = SL_PreDraw; menu->predraw = SL_PreDraw;
@ -1335,7 +1334,6 @@ void M_QuickConnect_f(void)
menu_t *menu; menu_t *menu;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
MasterInfo_Refresh(); MasterInfo_Refresh();
isrefreshing = true; isrefreshing = true;

View file

@ -1260,7 +1260,6 @@ qboolean M_Media_Key (int key, menu_t *menu)
void M_Menu_Media_f (void) void M_Menu_Media_f (void)
{ {
menu_t *menu; menu_t *menu;
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
menu = M_CreateMenu(0); menu = M_CreateMenu(0);
@ -2481,10 +2480,7 @@ qboolean Media_PlayFilm(char *name, qboolean enqueue)
SCR_EndLoadingPlaque(); SCR_EndLoadingPlaque();
if (Key_Dest_Has(kdm_emenu)) if (Key_Dest_Has(kdm_emenu))
{
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
}
#ifdef MENU_DAT #ifdef MENU_DAT
if (Key_Dest_Has(kdm_gmenu)) if (Key_Dest_Has(kdm_gmenu))
MP_Toggle(0); MP_Toggle(0);

View file

@ -19,7 +19,6 @@ void M_Menu_MultiPlayer_f (void)
p = NULL; p = NULL;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
mgt = M_GameType(); mgt = M_GameType();
@ -442,7 +441,6 @@ void M_Menu_Setup_f (void)
}; };
mpic_t *p; mpic_t *p;
menucustom_t *cu; menucustom_t *cu;
m_state = m_complex;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
menu = M_CreateMenu(sizeof(setupmenu_t)); menu = M_CreateMenu(sizeof(setupmenu_t));
@ -470,7 +468,6 @@ void M_Menu_Setup_f (void)
#endif #endif
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(setupmenu_t)); menu = M_CreateMenu(sizeof(setupmenu_t));
info = menu->data; info = menu->data;
@ -657,7 +654,6 @@ void M_Menu_GameOptions_f (void)
int players; int players;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(newmultimenu_t)); menu = M_CreateMenu(sizeof(newmultimenu_t));
info = menu->data; info = menu->data;

View file

@ -104,7 +104,6 @@ menu_t *M_Options_Title(int *y, int infosize)
*y = 32; *y = 32;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(infosize); menu = M_CreateMenu(infosize);
@ -401,7 +400,6 @@ void M_Menu_Audio_Speakers_f (void)
menu_t *menu; menu_t *menu;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(audiomenuinfo_t)); menu = M_CreateMenu(sizeof(audiomenuinfo_t));
info = menu->data; info = menu->data;
@ -3004,7 +3002,7 @@ static void M_ModelViewerDraw(int x, int y, struct menucustom_s *c, struct menu_
mods->fixedrate = 1; mods->fixedrate = 1;
while (mods->fixedrate >= rate) while (mods->fixedrate >= rate)
{ {
sv.world.rbe->Frame(&mods->ragworld, rate, 800); sv.world.rbe->RunFrame(&mods->ragworld, rate, 800);
mods->fixedrate -= rate; mods->fixedrate -= rate;
} }
@ -3511,7 +3509,13 @@ static void Mods_Draw(int x, int y, struct menucustom_s *c, struct menu_s *m)
if (!mods->nummanifests) if (!mods->nummanifests)
{ {
Draw_FunString(x, y+0, "No games or mods known"); Draw_FunString(x, y+0, "No games or mods known");
Draw_FunString(x, y+8, "You may need to use -basedir $PATHTOGAME on the commandline"); #if defined(FTE_TARGET_WEB) || defined(NACL)
Draw_FunString(x, y+8, "Connection issue or bad server config");
#else
Draw_FunString(x, y+8, "You may need to use");
Draw_FunString(x, y+16, " -basedir $PATHTOGAME");
Draw_FunString(x, y+24, " on the commandline");
#endif
return; return;
} }

View file

@ -94,7 +94,6 @@ void M_MenuS_Script_f (void) //create a menu.
menu_t *oldmenu; menu_t *oldmenu;
char *alias = Cmd_Argv(1); char *alias = Cmd_Argv(1);
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
selectitem = 0; selectitem = 0;
items=0; items=0;

View file

@ -231,7 +231,6 @@ void M_Menu_Save_f (void)
return; return;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t)); menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
menu->data = menu+1; menu->data = menu+1;
@ -263,7 +262,6 @@ void M_Menu_Load_f (void)
char time[64]; char time[64];
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(loadsavemenuinfo_t)); menu = M_CreateMenu(sizeof(loadsavemenuinfo_t));
menu->data = menu+1; menu->data = menu+1;
@ -308,7 +306,6 @@ void M_Menu_SinglePlayer_f (void)
#endif #endif
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
#ifdef CLIENTONLY #ifdef CLIENTONLY
menu = M_CreateMenu(0); menu = M_CreateMenu(0);
@ -978,7 +975,6 @@ void M_Menu_Demos_f (void)
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
Key_Dest_Remove(kdm_console); Key_Dest_Remove(kdm_console);
m_state = m_complex;
menu = M_CreateMenu(sizeof(demomenu_t)); menu = M_CreateMenu(sizeof(demomenu_t));
menu->remove = M_Demo_Remove; menu->remove = M_Demo_Remove;
@ -1046,7 +1042,6 @@ void M_Menu_MediaFiles_f (void)
static demoloc_t mediareenterloc = {FS_GAME}; static demoloc_t mediareenterloc = {FS_GAME};
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(sizeof(demomenu_t)); menu = M_CreateMenu(sizeof(demomenu_t));
menu->remove = M_Demo_Remove; menu->remove = M_Demo_Remove;

View file

@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h" #include "winquake.h"
#include "shader.h" #include "shader.h"
m_state_t m_state;
qboolean menu_mousedown; qboolean menu_mousedown;
void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic) void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic)
@ -317,7 +316,6 @@ void M_CloseMenu_f (void)
return; return;
M_RemoveAllMenus(false); M_RemoveAllMenus(false);
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
} }
/* /*
================ ================
@ -326,7 +324,7 @@ M_ToggleMenu_f
*/ */
void M_ToggleMenu_f (void) void M_ToggleMenu_f (void)
{ {
if (m_state) if (topmenu)
{ {
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
return; return;
@ -355,7 +353,6 @@ void M_ToggleMenu_f (void)
if (Key_Dest_Has(kdm_emenu)) if (Key_Dest_Has(kdm_emenu))
{ {
Key_Dest_Remove(kdm_emenu); Key_Dest_Remove(kdm_emenu);
m_state = m_none;
return; return;
} }
if (Key_Dest_Has(kdm_console|kdm_cwindows)) if (Key_Dest_Has(kdm_console|kdm_cwindows))
@ -510,7 +507,6 @@ void M_Menu_Keys_f (void)
extern cvar_t cl_splitscreen; extern cvar_t cl_splitscreen;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
menu = M_CreateMenu(0); menu = M_CreateMenu(0);
switch(M_GameType()) switch(M_GameType())
@ -634,11 +630,75 @@ struct
{"gfx/menu/help%02i.lmp",1} //hexen2 {"gfx/menu/help%02i.lmp",1} //hexen2
}; };
void M_Help_Draw (menu_t *m)
{
int i;
mpic_t *pic = NULL;
for (i = 0; i < sizeof(helpstyles)/sizeof(helpstyles[0]) && !pic; i++)
{
pic = R2D_SafeCachePic(va(helpstyles[i].pattern, help_page+helpstyles[i].base));
if (R_GetShaderSizes(pic, NULL, NULL, true) <= 0)
pic = NULL;
}
if (!pic)
M_Menu_Main_f ();
else
{
//define default aspect ratio
int width = 320;
int height = 200;
//figure out which axis we're meeting.
if (vid.width/(float)width > vid.height/(float)height)
{
width = width * (vid.height/(float)height);
height = vid.height;
}
else
{
height = height * (vid.width/(float)width);
width = vid.width;
}
R2D_ScalePic ((vid.width-width)/2, (vid.height-height)/2, width, height, pic);
}
}
qboolean M_Help_Key (int key, menu_t *m)
{
switch (key)
{
case K_ESCAPE:
case K_MOUSE2:
M_Menu_Main_f ();
return true;
case K_UPARROW:
case K_RIGHTARROW:
case K_MOUSE1:
S_LocalSound ("misc/menu2.wav");
if (++help_page >= num_help_pages)
help_page = 0;
return true;
case K_DOWNARROW:
case K_LEFTARROW:
S_LocalSound ("misc/menu2.wav");
if (--help_page < 0)
help_page = num_help_pages-1;
return true;
default:
return false;
}
}
void M_Menu_Help_f (void) void M_Menu_Help_f (void)
{ {
int i; int i;
menu_t *helpmenu = M_CreateMenu(0);
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_help;
helpmenu->predraw = M_Help_Draw;
helpmenu->key = M_Help_Key;
help_page = 0; help_page = 0;
num_help_pages = 1; num_help_pages = 1;
@ -656,52 +716,6 @@ void M_Menu_Help_f (void)
} }
void M_Help_Draw (void)
{
int i;
mpic_t *pic = NULL;
for (i = 0; i < sizeof(helpstyles)/sizeof(helpstyles[0]) && !pic; i++)
{
pic = R2D_SafeCachePic(va(helpstyles[i].pattern, help_page+helpstyles[i].base));
if (R_GetShaderSizes(pic, NULL, NULL, true) <= 0)
pic = NULL;
}
if (!pic)
M_Menu_Main_f ();
else
M_DrawScalePic (0, 0, 320, 200, pic);
}
void M_Help_Key (int key)
{
switch (key)
{
case K_ESCAPE:
case K_MOUSE2:
M_Menu_Main_f ();
break;
case K_UPARROW:
case K_RIGHTARROW:
case K_MOUSE1:
S_LocalSound ("misc/menu2.wav");
if (++help_page >= num_help_pages)
help_page = 0;
break;
case K_DOWNARROW:
case K_LEFTARROW:
S_LocalSound ("misc/menu2.wav");
if (--help_page < 0)
help_page = num_help_pages-1;
break;
}
}
//============================================================================= //=============================================================================
/* Various callback-based prompts */ /* Various callback-based prompts */
@ -756,7 +770,6 @@ void M_Menu_Prompt (void (*callback)(void *, int), void *ctx, const char *messag
int x = 64, w = 224; int x = 64, w = 224;
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
m_state = m_complex;
m = (promptmenu_t*)M_CreateMenuInfront(sizeof(*m) - sizeof(m->m) + strlen(messages)+(optionyes?strlen(optionyes):0)+(optionno?strlen(optionno):0)+(optioncancel?strlen(optioncancel):0)+6); m = (promptmenu_t*)M_CreateMenuInfront(sizeof(*m) - sizeof(m->m) + strlen(messages)+(optionyes?strlen(optionyes):0)+(optionno?strlen(optionno):0)+(optioncancel?strlen(optioncancel):0)+6);
m->callback = callback; m->callback = callback;
@ -900,10 +913,7 @@ void M_Quit_Key (int key)
m_entersound = true; m_entersound = true;
} }
else else
{
key_dest = key_game; key_dest = key_game;
m_state = m_none;
}
break; break;
case 'Y': case 'Y':
@ -1086,7 +1096,6 @@ void M_Menu_Quit_f (void)
case 2: case 2:
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
Key_Dest_Remove(kdm_console); Key_Dest_Remove(kdm_console);
m_state = m_complex;
quitmenu = M_CreateMenuInfront(0); quitmenu = M_CreateMenuInfront(0);
quitmenu->key = MC_SaveQuit_Key; quitmenu->key = MC_SaveQuit_Key;
@ -1110,7 +1119,6 @@ void M_Menu_Quit_f (void)
case 1: case 1:
Key_Dest_Add(kdm_emenu); Key_Dest_Add(kdm_emenu);
Key_Dest_Remove(kdm_console); Key_Dest_Remove(kdm_console);
m_state = m_complex;
quitmenu = M_CreateMenuInfront(0); quitmenu = M_CreateMenuInfront(0);
quitmenu->key = MC_Quit_Key; quitmenu->key = MC_Quit_Key;
@ -1373,6 +1381,9 @@ void M_Init (void)
void M_Draw (int uimenu) void M_Draw (int uimenu)
{ {
extern menu_t *topmenu;
qboolean stillactive = false;
if (uimenu) if (uimenu)
{ {
if (uimenu == 2) if (uimenu == 2)
@ -1383,27 +1394,18 @@ void M_Draw (int uimenu)
} }
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS
if (m_state != m_complex) if (!Key_Dest_Has(kdm_emenu))
{ {
M_RemoveAllMenus(false); M_RemoveAllMenus(false);
menu_mousedown = false; menu_mousedown = false;
return;
} }
#endif #endif
if (!Key_Dest_Has(kdm_emenu))
{
m_state = m_none;
return;
}
if (m_state == m_none)
return;
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS
if ((!menu_script || scr_con_current) && !m_recursiveDraw) if ((!menu_script || scr_con_current) && !m_recursiveDraw)
{ {
extern menu_t *topmenu; if (topmenu && topmenu->selecteditem && topmenu->selecteditem->common.type == mt_slider && (topmenu->selecteditem->slider.var == &v_gamma || topmenu->selecteditem->slider.var == &v_contrast))
if (m_state == m_complex && topmenu && topmenu->selecteditem && topmenu->selecteditem->common.type == mt_slider && (topmenu->selecteditem->slider.var == &v_gamma || topmenu->selecteditem->slider.var == &v_contrast))
/*no menu tint if we're trying to adjust gamma*/; /*no menu tint if we're trying to adjust gamma*/;
else else
R2D_FadeScreen (); R2D_FadeScreen ();
@ -1416,45 +1418,31 @@ void M_Draw (int uimenu)
R2D_ImageColours(1, 1, 1, 1); R2D_ImageColours(1, 1, 1, 1);
switch (m_state) #ifdef PLUGINS
if (menuplug)
{ {
default: Plug_Menu_Event (0, (int)(realtime*1000));
case m_none: stillactive = true;
break; }
#endif
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS
case m_help: if (topmenu)
M_Help_Draw (); {
break;
case m_complex:
M_Complex_Draw (); M_Complex_Draw ();
break; stillactive = true;
#endif
#ifdef PLUGINS
case m_plugin:
Plug_Menu_Event (0, (int)(realtime*1000));
break;
#endif
} }
#endif
if (!stillactive)
Key_Dest_Remove(kdm_emenu);
} }
void M_Keydown (int key, int unicode) void M_Keydown (int key, int unicode)
{ {
switch (m_state)
{
default:
case m_none:
Key_Dest_Remove(kdm_emenu);
return;
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS
case m_help: if (topmenu)
M_Help_Key (key); {
return;
case m_complex:
if (key == K_MOUSE1) //mouse clicks are deferred until the release event. this is for touch screens and aiming. if (key == K_MOUSE1) //mouse clicks are deferred until the release event. this is for touch screens and aiming.
menu_mousedown = true; menu_mousedown = true;
else if (key == K_LSHIFT || key == K_RSHIFT || key == K_LALT || key == K_RALT || key == K_LCTRL || key == K_RCTRL) else if (key == K_LSHIFT || key == K_RSHIFT || key == K_LALT || key == K_RALT || key == K_LCTRL || key == K_RCTRL)
@ -1462,38 +1450,41 @@ void M_Keydown (int key, int unicode)
else else
M_Complex_Key (key, unicode); M_Complex_Key (key, unicode);
return; return;
}
#endif #endif
#ifdef PLUGINS #ifdef PLUGINS
case m_plugin: if (menuplug)
{
Plug_Menu_Event (1, key); Plug_Menu_Event (1, key);
return; return;
#endif
} }
#endif
Key_Dest_Remove(kdm_emenu);
} }
void M_Keyup (int key, int unicode) void M_Keyup (int key, int unicode)
{ {
switch (m_state)
{
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS
case m_complex: if (topmenu)
{
if (key == K_MOUSE1 && menu_mousedown) if (key == K_MOUSE1 && menu_mousedown)
M_Complex_Key (key, unicode); M_Complex_Key (key, unicode);
else if (key == K_LSHIFT || key == K_RSHIFT || key == K_LALT || key == K_RALT || key == K_LCTRL || key == K_RCTRL) else if (key == K_LSHIFT || key == K_RSHIFT || key == K_LALT || key == K_RALT || key == K_LCTRL || key == K_RCTRL)
M_Complex_Key (key, unicode); M_Complex_Key (key, unicode);
menu_mousedown = false; menu_mousedown = false;
return; return;
}
#endif #endif
#ifdef PLUGINS #ifdef PLUGINS
case m_plugin: if (menuplug)
{
Plug_Menu_Event (2, key); Plug_Menu_Event (2, key);
return; return;
#endif
default:
break;
} }
#endif
} }
// Generic function to choose which game menu to draw // Generic function to choose which game menu to draw

View file

@ -91,8 +91,12 @@ void M_SomeInitialisationFunctionCalledAtStartup(void)
} }
*/ */
typedef enum {m_none, m_complex, m_help, m_plugin} m_state_t; #ifdef PLUGINS
extern m_state_t m_state; extern struct plugin_s *menuplug;
#endif
#ifndef NOBUILTINMENUS
extern struct menu_s *topmenu;
#endif
void M_DrawTextBox (int x, int y, int width, int lines); void M_DrawTextBox (int x, int y, int width, int lines);
#ifndef NOBUILTINMENUS #ifndef NOBUILTINMENUS

View file

@ -712,6 +712,7 @@ static void P_LoadTexture(part_type_t *ptype, qboolean warn)
case BM_INVMODA: bmpostfix = "#INVMODA"; break; case BM_INVMODA: bmpostfix = "#INVMODA"; break;
case BM_INVMODC: bmpostfix = "#INVMODC"; break; case BM_INVMODC: bmpostfix = "#INVMODC"; break;
case BM_PREMUL: bmpostfix = "#PREMUL"; break; case BM_PREMUL: bmpostfix = "#PREMUL"; break;
case BM_RTSMOKE: bmpostfix = "#RTSMOKE"; break;
} }
/*try and load the shader, fail if we would need to generate one*/ /*try and load the shader, fail if we would need to generate one*/
ptype->looks.shader = R_RegisterCustom(va("%s%s", ptype->texname, bmpostfix), SUF_NONE, NULL, NULL); ptype->looks.shader = R_RegisterCustom(va("%s%s", ptype->texname, bmpostfix), SUF_NONE, NULL, NULL);
@ -885,6 +886,29 @@ static void P_LoadTexture(part_type_t *ptype, qboolean warn)
"}\n" "}\n"
; ;
break; break;
case BM_RTSMOKE:
namepostfix = "_rts";
defaultshader =
"{\n"
"program defaultsprite#LIGHT\n"
"{\n"
"map $diffuse\n"
"blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA\n"
"rgbgen const vertex\n"
"alphagen vertex\n"
"}\n"
"surfaceparm noshadows\n"
"sort seethrough\n" //needs to be low enough that its subject to rtlights
"bemode rtlight\n"
"{\n"
"program rtlight#NOBUMP#VERTEXCOLOURS\n"
"{\n"
"map $diffuse\n"
"blendfunc add\n"
"}\n"
"}\n"
"}\n";
break;
} }
memset(&tn, 0, sizeof(tn)); memset(&tn, 0, sizeof(tn));
@ -945,6 +969,8 @@ static void P_LoadTexture(part_type_t *ptype, qboolean warn)
} }
R_BuildDefaultTexnums(&tn, ptype->looks.shader); R_BuildDefaultTexnums(&tn, ptype->looks.shader);
} }
else
R_BuildDefaultTexnums(NULL, ptype->looks.shader);
} }
static void P_ResetToDefaults(part_type_t *ptype) static void P_ResetToDefaults(part_type_t *ptype)
@ -1836,6 +1862,11 @@ parsefluid:
ptype->looks.premul = 1; ptype->looks.premul = 1;
ptype->looks.blendmode = BM_PREMUL; ptype->looks.blendmode = BM_PREMUL;
} }
else if (!strcmp(value, "rtsmoke"))
{
ptype->looks.premul = 1;
ptype->looks.blendmode = BM_RTSMOKE;
}
else else
{ {
Con_DPrintf("%s.%s: uses unknown blend type '%s', assuming legacy 'blendalpha'\n", ptype->config, ptype->name, value); Con_DPrintf("%s.%s: uses unknown blend type '%s', assuming legacy 'blendalpha'\n", ptype->config, ptype->name, value);
@ -2307,6 +2338,9 @@ qboolean PScript_Query(int typenum, int body, char *outstr, int outstrlen)
else else
Q_strncatz(outstr, "blend premul_blend\n", outstrlen); Q_strncatz(outstr, "blend premul_blend\n", outstrlen);
break; break;
case BM_RTSMOKE:
Q_strncatz(outstr, "blend rtsmoke\n", outstrlen);
break;
} }
for (i = 0; i < ptype->nummodels; i++) for (i = 0; i < ptype->nummodels; i++)

View file

@ -1318,6 +1318,7 @@ static int csqc_poly_2d;
#define DRAWFLAG_MODULATE2 3 #define DRAWFLAG_MODULATE2 3
#define DRAWFLAG_2D (1u<<2) #define DRAWFLAG_2D (1u<<2)
#define DRAWFLAG_TWOSIDED 0x400 #define DRAWFLAG_TWOSIDED 0x400
#define DRAWFLAG_LINES 0x800
static void CSQC_PolyFlush(void) static void CSQC_PolyFlush(void)
{ {
@ -1542,6 +1543,8 @@ void QCBUILTIN PF_R_AddTrisoup_Simple(pubprogfuncs_t *prinst, struct globalvars_
beflags = BEF_NOSHADOWS; beflags = BEF_NOSHADOWS;
if (qcflags & DRAWFLAG_TWOSIDED) if (qcflags & DRAWFLAG_TWOSIDED)
beflags |= BEF_FORCETWOSIDED; beflags |= BEF_FORCETWOSIDED;
if (qcflags & DRAWFLAG_LINES)
beflags |= BEF_LINES;
if (twod) if (twod)
shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0), NULL); shader = R_RegisterPic(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
@ -7527,7 +7530,7 @@ qboolean CSQC_DrawView(void)
#ifdef RAGDOLL #ifdef RAGDOLL
rag_doallanimations(&sv.world); rag_doallanimations(&sv.world);
#endif #endif
csqc_world.rbe->Frame(&csqc_world, host_frametime, 800); csqc_world.rbe->RunFrame(&csqc_world, host_frametime, 800);
} }
#endif #endif
@ -7619,7 +7622,7 @@ qboolean CSQC_DrawView(void)
void *pr_globals = PR_globals(csqcprogs, PR_CURRENT); void *pr_globals = PR_globals(csqcprogs, PR_CURRENT);
G_FLOAT(OFS_PARM0) = vid.width; G_FLOAT(OFS_PARM0) = vid.width;
G_FLOAT(OFS_PARM1) = vid.height; G_FLOAT(OFS_PARM1) = vid.height;
G_FLOAT(OFS_PARM2) = !m_state && !r_refdef.eyeoffset[0] && !r_refdef.eyeoffset[1]; G_FLOAT(OFS_PARM2) = !Key_Dest_Has(kdm_emenu) && !r_refdef.eyeoffset[0] && !r_refdef.eyeoffset[1];
} }
//end EXT_CSQC_1 //end EXT_CSQC_1
if (csqcg.f_updateviewloading && cls.state && cls.state < ca_active) if (csqcg.f_updateviewloading && cls.state && cls.state < ca_active)
@ -7862,12 +7865,15 @@ qboolean CSQC_ParseGamePacket(void)
return true; return true;
} }
void CSQC_MapEntityEdited(int idx, const char *newe) void CSQC_MapEntityEdited(int modelindex, int idx, const char *newe)
{ {
void *pr_globals; void *pr_globals;
if (!csqcprogs || !csqcg.mapentityedited) if (!csqcprogs || !csqcg.mapentityedited)
return; return;
if (modelindex != 1)
return;
pr_globals = PR_globals(csqcprogs, PR_CURRENT); pr_globals = PR_globals(csqcprogs, PR_CURRENT);
G_INT(OFS_PARM0) = idx; G_INT(OFS_PARM0) = idx;
(((string_t *)pr_globals)[OFS_PARM1] = PR_TempString(csqcprogs, newe)); (((string_t *)pr_globals)[OFS_PARM1] = PR_TempString(csqcprogs, newe));

View file

@ -21,6 +21,7 @@ extern unsigned int r2d_be_flags;
#define DRAWFLAG_MODULATE2 3 #define DRAWFLAG_MODULATE2 3
#define DRAWFLAG_2D (1u<<2) #define DRAWFLAG_2D (1u<<2)
#define DRAWFLAG_TWOSIDED 0x400 #define DRAWFLAG_TWOSIDED 0x400
#define DRAWFLAG_LINES 0x800
static unsigned int PF_SelectDPDrawFlag(int flag) static unsigned int PF_SelectDPDrawFlag(int flag)
{ {
csqc_dp_lastwas3d = false; //for compat with dp's stupid beginpolygon csqc_dp_lastwas3d = false; //for compat with dp's stupid beginpolygon

View file

@ -529,7 +529,7 @@ void R_InitTextures (void)
{ {
int x,y, m; int x,y, m;
qbyte *dest; qbyte *dest;
static char r_notexture_mip_mem[(sizeof(texture_t) + 16*16)]; static FTE_ALIGN(4) char r_notexture_mip_mem[(sizeof(texture_t) + 16*16)];
// create a simple checkerboard texture for the default // create a simple checkerboard texture for the default
r_notexture_mip = (texture_t*)r_notexture_mip_mem; r_notexture_mip = (texture_t*)r_notexture_mip_mem;

View file

@ -2081,6 +2081,7 @@ void S_Shutdown(qboolean final)
{ {
next = sc->next; next = sc->next;
sc->Shutdown(sc); sc->Shutdown(sc);
Z_Free(sc->channel);
Z_Free(sc); Z_Free(sc);
sndcardinfo = next; sndcardinfo = next;
} }

View file

@ -203,7 +203,7 @@ static int WASAPI_Thread(void *arg)
IMMDevice *pDevice = NULL; IMMDevice *pDevice = NULL;
IAudioClient *pAudioClient = NULL; IAudioClient *pAudioClient = NULL;
IAudioRenderClient *pRenderClient = NULL; IAudioRenderClient *pRenderClient = NULL;
UINT32 bufferFrameCount; UINT32 bufferFrameCount = 0;
HANDLE hEvent = NULL; HANDLE hEvent = NULL;
WAVEFORMATEX *pwfx; WAVEFORMATEX *pwfx;

View file

@ -262,6 +262,9 @@ JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_init(JNIEnv *env, jobject o
parms.basedir = sys_basedir; /*filled in later*/ parms.basedir = sys_basedir; /*filled in later*/
parms.argc = 3; parms.argc = 3;
parms.argv = args; parms.argv = args;
#ifdef CONFIG_MANIFEST_TEXT
parms.manifest = CONFIG_MANIFEST_TEXT;
#endif
tmp = (*env)->GetStringUTFChars(env, japkpath, NULL); tmp = (*env)->GetStringUTFChars(env, japkpath, NULL);
Q_strncpyz(sys_basepak, tmp, sizeof(sys_basepak)); Q_strncpyz(sys_basepak, tmp, sizeof(sys_basepak));

View file

@ -154,6 +154,27 @@ void VARGS Con_Printf (const char *fmt, ...)
Q_vsnprintfz(dest, sizeof(dest), fmt, argptr); Q_vsnprintfz(dest, sizeof(dest), fmt, argptr);
va_end (argptr); va_end (argptr);
#ifdef _WIN32
OutputDebugString(dest);
#else
FILE *f = fopen("/tmp/ftelog", "a");
if (f)
{
fputs(dest, f);
fclose(f);
}
write(2, dest, strlen(dest));
#endif
}
void VARGS Con_DPrintf (const char *fmt, ...)
{
va_list argptr;
char dest[256];
va_start (argptr, fmt);
Q_vsnprintfz(dest, sizeof(dest), fmt, argptr);
va_end (argptr);
#ifdef _WIN32 #ifdef _WIN32
OutputDebugString(dest); OutputDebugString(dest);
#else #else

View file

@ -462,6 +462,9 @@ int QDECL main(int argc, char **argv)
parms.argc = argc; parms.argc = argc;
parms.argv = (const char**)argv; parms.argv = (const char**)argv;
#ifdef CONFIG_MANIFEST_TEXT
parms.manifest = CONFIG_MANIFEST_TEXT;
#endif
#ifndef WIN32 #ifndef WIN32
fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY); fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);

View file

@ -184,7 +184,12 @@ void main( int argc, char **argv)
memset(&parms, 0, sizeof(parms)); memset(&parms, 0, sizeof(parms));
//fill in parms parms.argc = argc;
parms.argv = argv;
#ifdef CONFIG_MANIFEST_TEXT
parms.manifest = CONFIG_MANIFEST_TEXT;
#endif
COM_InitArgv(parms.argc, parms.argv); COM_InitArgv(parms.argc, parms.argv);
TL_InitLanguages(parms.basedir); TL_InitLanguages(parms.basedir);
Host_Init(&parms); Host_Init(&parms);

View file

@ -44,6 +44,8 @@ typedef struct
} qpic_t; } qpic_t;
typedef struct shader_s shader_t; typedef struct shader_s shader_t;
#define material_t shader_t //the material
#define rshader_t shader_t //the shader the material will draw with
#define mpic_t shader_t #define mpic_t shader_t
//atlased images within some larger atlas //atlased images within some larger atlas

View file

@ -95,6 +95,10 @@ IDI_ICON1 ICON "bymorphed.ico"
IDI_ICON2 ICON "q2.ico" IDI_ICON2 ICON "q2.ico"
#endif #endif
#ifdef CONFIG_MANIFEST_TEXT
1 RCDATA {CONFIG_MANIFEST_TEXT}
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Version // Version

View file

@ -476,6 +476,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define GLESONLY //should reduce the conditions a little #define GLESONLY //should reduce the conditions a little
#define R_MAX_RECURSE 2 //less bss #define R_MAX_RECURSE 2 //less bss
// #undef RTLIGHTS // #undef RTLIGHTS
#undef HEADLESSQUAKE
#define NO_FREETYPE
#endif #endif
#ifdef WINRT #ifdef WINRT
//microsoft do not support winsock any more. //microsoft do not support winsock any more.
@ -491,6 +493,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef WEBSERVER //http/ftp servers #undef WEBSERVER //http/ftp servers
#undef WEBCLIENT //http/ftp clients. #undef WEBCLIENT //http/ftp clients.
#undef MULTITHREAD #undef MULTITHREAD
#undef HEADLESSQUAKE
#endif #endif
#ifdef ANDROID #ifdef ANDROID
#undef RTLIGHTS #undef RTLIGHTS
@ -499,6 +502,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
#undef TEXTEDITOR #undef TEXTEDITOR
#define GLESONLY //should reduce the conditions a little #define GLESONLY //should reduce the conditions a little
#undef HEADLESSQUAKE
#endif #endif
#if defined(NACL) #if defined(NACL)
//stuff is sandboxed. //stuff is sandboxed.
@ -513,6 +517,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef IRCCONNECT #undef IRCCONNECT
#define GLSLONLY //pointless having the junk #define GLSLONLY //pointless having the junk
#define GLESONLY //should reduce the conditions a little #define GLESONLY //should reduce the conditions a little
#undef HEADLESSQUAKE
#define NO_FREETYPE
#endif #endif
#ifndef MULTITHREAD #ifndef MULTITHREAD
@ -586,7 +592,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef TCPCONNECT #undef TCPCONNECT
#undef IRCCONNECT #undef IRCCONNECT
#undef WEBSERVER #undef WEBSERVER
#undef WEBCLIENT #if !defined(FTE_TARGET_WEB) && !defined(NACL)
#undef WEBCLIENT
#endif
#endif #endif
#ifndef HAVE_PACKET #ifndef HAVE_PACKET
#undef SV_MASTER #undef SV_MASTER
@ -730,12 +738,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ARCH_DL_POSTFIX ".so" #define ARCH_DL_POSTFIX ".so"
#endif #endif
#if defined(_M_AMD64) || defined(__amd64__) #if defined(_M_AMD64) || defined(__amd64__) || defined(__x86_64__)
#ifdef _WIN32 #ifdef __ILP32__
#define ARCH_CPU_POSTFIX "x64" #define ARCH_CPU_POSTFIX "x32" //32bit pointers, with 16 registers.
#else #else
#define ARCH_CPU_POSTFIX "amd64" #ifdef _WIN32
#endif #define ARCH_CPU_POSTFIX "x64"
#else
#define ARCH_CPU_POSTFIX "amd64"
#endif
#endif
#elif defined(_M_IX86) || defined(__i386__) #elif defined(_M_IX86) || defined(__i386__)
#define ARCH_CPU_POSTFIX "x86" #define ARCH_CPU_POSTFIX "x86"
#elif defined(__powerpc__) || defined(__ppc__) #elif defined(__powerpc__) || defined(__ppc__)
@ -743,7 +755,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#elif defined(__aarch64__) #elif defined(__aarch64__)
#define ARCH_CPU_POSTFIX "arm64" #define ARCH_CPU_POSTFIX "arm64"
#elif defined(__arm__) #elif defined(__arm__)
#define ARCH_CPU_POSTFIX "arm" #ifdef __SOFTFP__
#define ARCH_CPU_POSTFIX "arm"
#else
#define ARCH_CPU_POSTFIX "armhf"
#endif
#else #else
#define ARCH_CPU_POSTFIX "unk" #define ARCH_CPU_POSTFIX "unk"
#endif #endif

View file

@ -2737,7 +2737,7 @@ static void QDECL World_ODE_Start(world_t *world)
memset(ctx, 0, sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx));
world->rbe = &ctx->pub; world->rbe = &ctx->pub;
r_meshpitch.value = pCvar_GetFloat("physics_ode_quadtree_depth"); r_meshpitch.value = pCvar_GetFloat("r_meshpitch");
VectorAvg(world->worldmodel->mins, world->worldmodel->maxs, center); VectorAvg(world->worldmodel->mins, world->worldmodel->maxs, center);
VectorSubtract(world->worldmodel->maxs, center, extents); VectorSubtract(world->worldmodel->maxs, center, extents);
@ -2756,7 +2756,7 @@ static void QDECL World_ODE_Start(world_t *world)
ctx->pub.RagCreateJoint = World_ODE_RagCreateJoint; ctx->pub.RagCreateJoint = World_ODE_RagCreateJoint;
ctx->pub.RagDestroyBody = World_ODE_RagDestroyBody; ctx->pub.RagDestroyBody = World_ODE_RagDestroyBody;
ctx->pub.RagDestroyJoint = World_ODE_RagDestroyJoint; ctx->pub.RagDestroyJoint = World_ODE_RagDestroyJoint;
ctx->pub.Frame = World_ODE_Frame; ctx->pub.RunFrame = World_ODE_Frame;
ctx->pub.PushCommand = World_ODE_PushCommand; ctx->pub.PushCommand = World_ODE_PushCommand;
if(physics_ode_world_erp->value >= 0) if(physics_ode_world_erp->value >= 0)

View file

@ -4067,32 +4067,36 @@ skipwhite:
} }
#define DEFAULT_PUNCTUATION "(,{})(\':;=!><&|+" #define DEFAULT_PUNCTUATION "(,{})(\':;=!><&|+"
char *COM_ParseToken (const char *data, const char *punctuation) char *COM_ParseTokenOut (const char *data, const char *punctuation, char *token, size_t tokenlen, com_tokentype_t *tokentype)
{ {
int c; int c;
int len; size_t len;
if (!punctuation) if (!punctuation)
punctuation = DEFAULT_PUNCTUATION; punctuation = DEFAULT_PUNCTUATION;
COM_AssertMainThread("COM_ParseOut: com_token"); if (token == com_token || tokentype == &com_tokentype)
COM_AssertMainThread("COM_ParseTokenOut: com_token");
len = 0; len = 0;
com_token[0] = 0; token[0] = 0;
if (!data) if (!data)
{ {
com_tokentype = TTP_UNKNOWN; if (tokentype)
*tokentype = TTP_EOF;
return NULL; return NULL;
} }
// skip whitespace // skip whitespace
//line endings count as whitespace only if we can report the token type.
skipwhite: skipwhite:
while ( (c = *(unsigned char*)data) <= ' ' && c != '\r' && c != '\n') while ( (c = *(unsigned char*)data) <= ' ' && ((c != '\r' && c != '\n') || !tokentype))
{ {
if (c == 0) if (c == 0)
{ {
com_tokentype = TTP_UNKNOWN; if (tokentype)
*tokentype = TTP_EOF;
return NULL; // end of file; return NULL; // end of file;
} }
data++; data++;
@ -4104,24 +4108,25 @@ skipwhite:
if (c == '\r' || c == '\n') if (c == '\r' || c == '\n')
{ {
com_tokentype = TTP_LINEENDING; if (tokentype)
com_token[0] = '\n'; *tokentype = TTP_LINEENDING;
com_token[1] = '\0'; token[0] = '\n';
token[1] = '\0';
data++; data++;
return (char*)data; return (char*)data;
} }
// skip // comments // skip comments
if (c=='/') if (c=='/')
{ {
if (data[1] == '/') if (data[1] == '/')
{ { // style comments
while (*data && *data != '\n') while (*data && *data != '\n')
data++; data++;
goto skipwhite; goto skipwhite;
} }
else if (data[1] == '*') else if (data[1] == '*')
{ { /* style comments */
data+=2; data+=2;
while (*data && (*data != '*' || data[1] != '/')) while (*data && (*data != '*' || data[1] != '/'))
data++; data++;
@ -4136,34 +4141,35 @@ skipwhite:
// handle quoted strings specially // handle quoted strings specially
if (c == '\"') if (c == '\"')
{ {
com_tokentype = TTP_STRING; if (tokentype)
*tokentype = TTP_STRING;
data++; data++;
while (1) while (1)
{ {
if (len >= TOKENSIZE-1) if (len >= TOKENSIZE-1)
{ {
com_token[len] = '\0'; token[len] = '\0';
return (char*)data; return (char*)data;
} }
c = *data++; c = *data++;
if (c=='\"' || !c) if (c=='\"' || !c)
{ {
com_token[len] = 0; token[len] = 0;
return (char*)data; return (char*)data;
} }
com_token[len] = c; token[len] = c;
len++; len++;
} }
} }
com_tokentype = TTP_UNKNOWN;
// parse single characters // parse single characters
if (strchr(punctuation, c)) if (strchr(punctuation, c))
{ {
com_token[len] = c; token[len] = c;
len++; len++;
com_token[len] = 0; token[len] = 0;
if (tokentype)
*tokentype = TTP_PUNCTUATION;
return (char*)(data+1); return (char*)(data+1);
} }
@ -4172,7 +4178,7 @@ skipwhite:
{ {
if (len >= TOKENSIZE-1) if (len >= TOKENSIZE-1)
break; break;
com_token[len] = c; token[len] = c;
data++; data++;
len++; len++;
c = *data; c = *data;
@ -4180,7 +4186,9 @@ skipwhite:
break; break;
} while (c>32); } while (c>32);
com_token[len] = 0; token[len] = 0;
if (tokentype)
*tokentype = TTP_RAWTOKEN;
return (char*)data; return (char*)data;
} }
@ -4708,8 +4716,12 @@ void COM_Version_f (void)
#ifdef _WIN64 #ifdef _WIN64
Con_Printf("Compiled for 64bit windows\n"); Con_Printf("Compiled for 64bit windows\n");
#endif #endif
#if defined(_M_AMD64) || defined(__amd64__) #if defined(_M_AMD64) || defined(__amd64__) || defined(__x86_64__)
#ifdef __ILP32__
Con_Printf("Compiled for AMD64 compatible cpus (x32)\n");
#else
Con_Printf("Compiled for AMD64 compatible cpus\n"); Con_Printf("Compiled for AMD64 compatible cpus\n");
#endif
#endif #endif
#ifdef _M_IX86 #ifdef _M_IX86

View file

@ -348,7 +348,7 @@ void deleetstring(char *result, const char *leet);
extern char com_token[65536]; extern char com_token[65536];
typedef enum {TTP_UNKNOWN, TTP_STRING, TTP_LINEENDING, TTP_RAWTOKEN, TTP_EOF} com_tokentype_t; typedef enum {TTP_UNKNOWN, TTP_STRING, TTP_LINEENDING, TTP_RAWTOKEN, TTP_EOF, TTP_PUNCTUATION} com_tokentype_t;
extern com_tokentype_t com_tokentype; extern com_tokentype_t com_tokentype;
extern qboolean com_eof; extern qboolean com_eof;
@ -362,7 +362,8 @@ char *COM_ParseStringSet (const char *data, char *out, size_t outlen); //whitesp
char *COM_ParseStringSetSep (const char *data, char sep, char *out, size_t outsize); //single-char-separator, no whitespace char *COM_ParseStringSetSep (const char *data, char sep, char *out, size_t outsize); //single-char-separator, no whitespace
char *COM_ParseCString (const char *data, char *out, size_t maxoutlen, size_t *writtenlen); char *COM_ParseCString (const char *data, char *out, size_t maxoutlen, size_t *writtenlen);
char *COM_StringParse (const char *data, char *token, unsigned int tokenlen, qboolean expandmacros, qboolean qctokenize); char *COM_StringParse (const char *data, char *token, unsigned int tokenlen, qboolean expandmacros, qboolean qctokenize);
char *COM_ParseToken (const char *data, const char *punctuation); #define COM_ParseToken(data,punct) COM_ParseTokenOut(data, punct, com_token, sizeof(com_token), &com_tokentype)
char *COM_ParseTokenOut (const char *data, const char *punctuation, char *token, size_t tokenlen, com_tokentype_t *tokentype); //note that line endings are a special type of token.
char *COM_TrimString(char *str, char *buffer, int buffersize); char *COM_TrimString(char *str, char *buffer, int buffersize);
const char *COM_QuotedString(const char *string, char *buf, int buflen, qboolean omitquotes); //inverse of COM_StringParse const char *COM_QuotedString(const char *string, char *buf, int buflen, qboolean omitquotes); //inverse of COM_StringParse

View file

@ -183,8 +183,17 @@ typedef struct trailstate_s {
#define PARTICLE_Z_CLIP 8.0 #define PARTICLE_Z_CLIP 8.0
typedef enum { BM_BLEND/*SRC_ALPHA ONE_MINUS_SRC_ALPHA*/, BM_BLENDCOLOUR/*SRC_COLOR ONE_MINUS_SRC_COLOR*/, BM_ADDA/*SRC_ALPHA ONE*/, BM_ADDC/*GL_SRC_COLOR GL_ONE*/, BM_SUBTRACT/*SRC_ALPHA ONE_MINUS_SRC_COLOR*/, BM_INVMODA/*ZERO ONE_MINUS_SRC_ALPHA*/, BM_INVMODC/*ZERO ONE_MINUS_SRC_COLOR*/, BM_PREMUL/*ONE ONE_MINUS_SRC_ALPHA*/} blendmode_t; typedef enum {
BM_BLEND/*SRC_ALPHA ONE_MINUS_SRC_ALPHA*/,
BM_BLENDCOLOUR/*SRC_COLOR ONE_MINUS_SRC_COLOR*/,
BM_ADDA/*SRC_ALPHA ONE*/,
BM_ADDC/*GL_SRC_COLOR GL_ONE*/,
BM_SUBTRACT/*SRC_ALPHA ONE_MINUS_SRC_COLOR*/,
BM_INVMODA/*ZERO ONE_MINUS_SRC_ALPHA*/,
BM_INVMODC/*ZERO ONE_MINUS_SRC_COLOR*/,
BM_PREMUL/*ONE ONE_MINUS_SRC_ALPHA*/,
BM_RTSMOKE /*special shader generation that causes these particles to be lit up by nearby rtlights, instead of just being fullbright junk*/
} blendmode_t;
#define frandom() (rand()*(1.0f/RAND_MAX)) #define frandom() (rand()*(1.0f/RAND_MAX))
#define crandom() (rand()*(2.0f/RAND_MAX)-1.0f) #define crandom() (rand()*(2.0f/RAND_MAX)-1.0f)
#define hrandom() (rand()*(1.0f/RAND_MAX)-0.5f) #define hrandom() (rand()*(1.0f/RAND_MAX)-0.5f)

View file

@ -38,7 +38,7 @@ void PF_Common_RegisterCvars(void)
a.i = 1; a.i = 1;
b.i = 1; b.i = 1;
if (!(a.f && b.f)) if (!(a.f && b.f))
Con_Printf("WARNING: denormalised floats are disabled. Mods may malfunction\n"); Con_Printf(CON_WARNING "WARNING: denormalised floats are disabled. Mods may malfunction\n");
Cvar_Register (&sv_gameplayfix_blowupfallenzombies, cvargroup_progs); Cvar_Register (&sv_gameplayfix_blowupfallenzombies, cvargroup_progs);
@ -5822,6 +5822,23 @@ void QCBUILTIN PF_checkcommand (pubprogfuncs_t *prinst, struct globalvars_s *pr_
G_FLOAT(OFS_RETURN) = 0; G_FLOAT(OFS_RETURN) = 0;
} }
void QCBUILTIN PF_physics_supported(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
#ifdef USERBE
world_t *world = prinst->parms->user;
if (prinst->callargc)
{
if (G_FLOAT(OFS_PARM0) && !world->rbe)
World_RBE_Start(world);
else if (!G_FLOAT(OFS_PARM0) && world->rbe)
World_RBE_Shutdown(world);
}
if (world->rbe)
G_FLOAT(OFS_RETURN) = 1;
else
#endif
G_FLOAT(OFS_RETURN) = 0;
}
#ifdef USERBE #ifdef USERBE
void QCBUILTIN PF_physics_enable(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) void QCBUILTIN PF_physics_enable(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{ {

View file

@ -266,6 +266,7 @@ void QCBUILTIN PF_setattachment(pubprogfuncs_t *prinst, struct globalvars_s *pr_
void skel_dodelete(world_t *world); void skel_dodelete(world_t *world);
void skel_reset(world_t *world); void skel_reset(world_t *world);
#endif #endif
void QCBUILTIN PF_physics_supported(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_physics_enable(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals); void QCBUILTIN PF_physics_enable(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_physics_addforce(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals); void QCBUILTIN PF_physics_addforce(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
void QCBUILTIN PF_physics_addtorque(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals); void QCBUILTIN PF_physics_addtorque(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
@ -755,9 +756,9 @@ enum terrainedit_e
ter_reset, //vector pos, float radius ter_reset, //vector pos, float radius
ter_reloadsect, //vector pos, float radius ter_reloadsect, //vector pos, float radius
ter_ents_wipe, //none ter_ents_wipe_deprecated, //none
ter_ents_concat, //string ter_ents_concat_deprecated, //string
ter_ents_get, //none ter_ents_get, //none, returns the map's entity string.
// ter_poly_add, //add a poly, woo // ter_poly_add, //add a poly, woo
// ter_poly_remove, //remove polys // ter_poly_remove, //remove polys

View file

@ -166,7 +166,7 @@ typedef struct
void (QDECL *RagCreateJoint)(struct world_s *world, rbejoint_t *joint, rbejointinfo_t *info, rbebody_t *body1, rbebody_t *body2, vec3_t aaa2[3]); void (QDECL *RagCreateJoint)(struct world_s *world, rbejoint_t *joint, rbejointinfo_t *info, rbebody_t *body1, rbebody_t *body2, vec3_t aaa2[3]);
void (QDECL *RagDestroyBody)(struct world_s *world, rbebody_t *bodyptr); void (QDECL *RagDestroyBody)(struct world_s *world, rbebody_t *bodyptr);
void (QDECL *RagDestroyJoint)(struct world_s *world, rbejoint_t *joint); void (QDECL *RagDestroyJoint)(struct world_s *world, rbejoint_t *joint);
void (QDECL *Frame)(struct world_s *world, double frametime, double gravity); void (QDECL *RunFrame)(struct world_s *world, double frametime, double gravity);
void (QDECL *PushCommand)(struct world_s *world, rbecommandqueue_t *cmd); void (QDECL *PushCommand)(struct world_s *world, rbecommandqueue_t *cmd);
} rigidbodyengine_t; } rigidbodyengine_t;
#endif #endif

View file

@ -399,7 +399,7 @@ void *Z_Realloc(void *data, int newsize)
*/ */
#ifdef USE_MSVCRT_DEBUG #ifdef USE_MSVCRT_DEBUG
void *BZF_MallocNamed(int size, char *file, int line) //BZ_MallocNamed but allowed to fail - like straight malloc. void *BZF_MallocNamed(int size, const char *file, int line) //BZ_MallocNamed but allowed to fail - like straight malloc.
{ {
void *mem; void *mem;
mem = _malloc_dbg(size, _NORMAL_BLOCK, file, line); mem = _malloc_dbg(size, _NORMAL_BLOCK, file, line);
@ -425,7 +425,7 @@ void *BZF_Malloc(int size) //BZ_Malloc but allowed to fail - like straight mallo
#endif #endif
#ifdef USE_MSVCRT_DEBUG #ifdef USE_MSVCRT_DEBUG
void *BZ_MallocNamed(int size, char *file, int line) //BZ_MallocNamed but allowed to fail - like straight malloc. void *BZ_MallocNamed(int size, const char *file, int line) //BZ_MallocNamed but allowed to fail - like straight malloc.
{ {
void *mem = BZF_MallocNamed(size, file, line); void *mem = BZF_MallocNamed(size, file, line);
if (!mem) if (!mem)
@ -445,12 +445,12 @@ void *BZ_Malloc(int size) //Doesn't clear. The expectation is a large file, rath
#endif #endif
#ifdef USE_MSVCRT_DEBUG #ifdef USE_MSVCRT_DEBUG
void *BZF_ReallocNamed(void *data, int newsize, char *file, int line) void *BZF_ReallocNamed(void *data, int newsize, const char *file, int line)
{ {
return _realloc_dbg(data, newsize, _NORMAL_BLOCK, file, line); return _realloc_dbg(data, newsize, _NORMAL_BLOCK, file, line);
} }
void *BZ_ReallocNamed(void *data, int newsize, char *file, int line) void *BZ_ReallocNamed(void *data, int newsize, const char *file, int line)
{ {
void *mem = BZF_ReallocNamed(data, newsize, file, line); void *mem = BZF_ReallocNamed(data, newsize, file, line);

View file

@ -96,19 +96,19 @@ void *VARGS Z_TagMalloc (int size, int tag);
void VARGS Z_TagFree(void *ptr); void VARGS Z_TagFree(void *ptr);
void VARGS Z_FreeTags(int tag); void VARGS Z_FreeTags(int tag);
qboolean ZF_ReallocElements(void **ptr, size_t *elements, size_t newelements, size_t elementsize); //returns false on error qboolean ZF_ReallocElements(void **ptr, size_t *elements, size_t newelements, size_t elementsize); //returns false on error
qboolean ZF_ReallocElementsNamed(void **ptr, size_t *elements, size_t newelements, size_t elementsize, char *file, int line); //returns false on error qboolean ZF_ReallocElementsNamed(void **ptr, size_t *elements, size_t newelements, size_t elementsize, const char *file, int line); //returns false on error
#define Z_ReallocElements(ptr,elements,newelements,elementsize) do{if (!ZF_ReallocElements(ptr,elements,newelements,elementsize))Sys_Error("Z_ReallocElements failed (%s %i)\n", __FILE__, __LINE__);}while(0) //returns false on error #define Z_ReallocElements(ptr,elements,newelements,elementsize) do{if (!ZF_ReallocElements(ptr,elements,newelements,elementsize))Sys_Error("Z_ReallocElements failed (%s %i)\n", __FILE__, __LINE__);}while(0) //returns false on error
//Big Zone: allowed to fail, doesn't clear. The expectation is a large file, rather than sensitive data structures. //Big Zone: allowed to fail, doesn't clear. The expectation is a large file, rather than sensitive data structures.
//(this is a nicer name for malloc) //(this is a nicer name for malloc)
void *BZ_Malloc(int size); void *BZ_Malloc(int size);
void *BZF_Malloc(int size); void *BZF_Malloc(int size);
void *BZ_MallocNamed (int size, char *file, int line); // returns 0 filled memory void *BZ_MallocNamed (int size, const char *file, int line); // returns 0 filled memory
void *BZF_MallocNamed (int size, char *file, int line); // allowed to fail void *BZF_MallocNamed (int size, const char *file, int line); // allowed to fail
void *BZ_Realloc(void *ptr, int size); void *BZ_Realloc(void *ptr, int size);
void *BZ_ReallocNamed(void *data, int newsize, char *file, int line); void *BZ_ReallocNamed(void *data, int newsize, const char *file, int line);
void *BZF_Realloc(void *data, int newsize); void *BZF_Realloc(void *data, int newsize);
void *BZF_ReallocNamed(void *data, int newsize, char *file, int line); void *BZF_ReallocNamed(void *data, int newsize, const char *file, int line);
void BZ_Free(void *ptr); void BZ_Free(void *ptr);
//ctx should start off as void*ctx=NULL //ctx should start off as void*ctx=NULL

View file

@ -24919,6 +24919,202 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="..\client\sys_xdk.c"
>
<FileConfiguration
Name="MinGLDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MinGLRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release Dedicated Server|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release Dedicated Server|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug Dedicated Server|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug Dedicated Server|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="MDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="GLRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="D3DRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="VkDebug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="VkDebug|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="VkRelease|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
<FileConfiguration
Name="VkRelease|x64"
ExcludedFromBuild="true"
>
<Tool
Name="VCCLCompilerTool"
/>
</FileConfiguration>
</File>
</Filter> </Filter>
<Filter <Filter
Name="renderer" Name="renderer"

View file

@ -181,7 +181,7 @@ struct {
int oldwidth, oldheight; int oldwidth, oldheight;
vbo_t *sourcevbo; vbo_t *sourcevbo;
const shader_t *curshader; const material_t *curshader;
const entity_t *curentity; const entity_t *curentity;
const batch_t *curbatch; const batch_t *curbatch;
const texnums_t *curtexnums; const texnums_t *curtexnums;

View file

@ -4852,24 +4852,41 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
case ter_ent_set: case ter_ent_set:
{ {
int idx = G_INT(OFS_PARM1); int idx = G_INT(OFS_PARM1);
int id;
const char *newvals; const char *newvals;
//if there's no ents, then that's a problem. make sure that there's at least a worldspawn.
if (!mod->numentityinfo) if (!mod->numentityinfo)
Mod_ParseEntities(mod); Mod_ParseEntities(mod);
//make sure we don't have any cached entities string, by wiping it all.
Z_Free((char*)mod->entities_raw);
mod->entities_raw = NULL;
G_INT(OFS_RETURN) = 0;
if (idx < mod->numentityinfo) if (idx < mod->numentityinfo)
{ {
if (!G_INT(OFS_PARM2) && !mod->entityinfo[idx].keyvals)
return; //no-op
Z_Free(mod->entityinfo[idx].keyvals); Z_Free(mod->entityinfo[idx].keyvals);
mod->entityinfo[idx].keyvals = NULL; mod->entityinfo[idx].keyvals = NULL;
id = mod->entityinfo[idx].id;
} }
else
id = 0;
if (G_INT(OFS_PARM2)) if (G_INT(OFS_PARM2))
{ {
newvals = PR_GetStringOfs(prinst, OFS_PARM2); newvals = PR_GetStringOfs(prinst, OFS_PARM2);
if (idx >= mod->numentityinfo) if (idx >= mod->numentityinfo)
Z_ReallocElements((void**)&mod->entityinfo, &mod->numentityinfo, idx+64, sizeof(*mod->entityinfo)); Z_ReallocElements((void**)&mod->entityinfo, &mod->numentityinfo, idx+64, sizeof(*mod->entityinfo));
mod->entityinfo[idx].keyvals = Z_StrDup(newvals); mod->entityinfo[idx].keyvals = Z_StrDup(newvals);
if (!id)
id = (idx+1) | ((cl.playerview[0].playernum+1)<<24);
mod->entityinfo[idx].id = id;
} }
else else
{
newvals = NULL; newvals = NULL;
G_INT(OFS_RETURN) = 0; mod->entityinfo[idx].id = 0;
}
#ifndef CLIENTONLY #ifndef CLIENTONLY
if (sv.state && modelindex > 0) if (sv.state && modelindex > 0)
@ -4877,11 +4894,13 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
MSG_WriteByte(&sv.multicast, svcfte_brushedit); MSG_WriteByte(&sv.multicast, svcfte_brushedit);
MSG_WriteShort(&sv.multicast, modelindex); MSG_WriteShort(&sv.multicast, modelindex);
MSG_WriteByte(&sv.multicast, newvals?hmcmd_ent_edit:hmcmd_ent_remove); MSG_WriteByte(&sv.multicast, newvals?hmcmd_ent_edit:hmcmd_ent_remove);
MSG_WriteLong(&sv.multicast, idx); MSG_WriteLong(&sv.multicast, id);
if (newvals) if (newvals)
MSG_WriteString(&sv.multicast, newvals); MSG_WriteString(&sv.multicast, newvals);
SV_MulticastProtExt(vec3_origin, MULTICAST_ALL_R, ~0, 0, 0); SV_MulticastProtExt(vec3_origin, MULTICAST_ALL_R, ~0, 0, 0);
//tell ssqc, csqc will be told by the server //tell ssqc, csqc will be told by the server
SSQC_MapEntityEdited(modelindex, idx, newvals);
} }
else else
#endif #endif
@ -4891,19 +4910,19 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
MSG_WriteByte(&cls.netchan.message, clcfte_brushedit); MSG_WriteByte(&cls.netchan.message, clcfte_brushedit);
MSG_WriteShort(&cls.netchan.message, modelindex); MSG_WriteShort(&cls.netchan.message, modelindex);
MSG_WriteByte(&cls.netchan.message, newvals?hmcmd_ent_edit:hmcmd_ent_remove); MSG_WriteByte(&cls.netchan.message, newvals?hmcmd_ent_edit:hmcmd_ent_remove);
MSG_WriteLong(&cls.netchan.message, idx); MSG_WriteLong(&cls.netchan.message, id);
if (newvals) if (newvals)
MSG_WriteString(&cls.netchan.message, newvals); MSG_WriteString(&cls.netchan.message, newvals);
#ifdef CSQC_DAT #ifdef CSQC_DAT
CSQC_MapEntityEdited(idx, newvals); CSQC_MapEntityEdited(modelindex, idx, newvals);
#endif #endif
} }
else else
#endif #endif
{ {
#ifdef CSQC_DAT #ifdef CSQC_DAT
CSQC_MapEntityEdited(idx, newvals); CSQC_MapEntityEdited(modelindex, idx, newvals);
#endif #endif
} }
} }
@ -4913,7 +4932,6 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
// int idx = G_INT(OFS_PARM1); // int idx = G_INT(OFS_PARM1);
// const char *news = PR_GetStringOfs(prinst, OFS_PARM2); // const char *news = PR_GetStringOfs(prinst, OFS_PARM2);
G_INT(OFS_RETURN) = mod->numentityinfo; G_INT(OFS_RETURN) = mod->numentityinfo;
} }
return; return;
case ter_ent_count: case ter_ent_count:
@ -4921,11 +4939,11 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
Mod_ParseEntities(mod); Mod_ParseEntities(mod);
G_INT(OFS_RETURN) = mod->numentityinfo; G_INT(OFS_RETURN) = mod->numentityinfo;
return; return;
case ter_ents_wipe: case ter_ents_wipe_deprecated:
G_INT(OFS_RETURN) = PR_TempString(prinst, Mod_GetEntitiesString(mod)); G_INT(OFS_RETURN) = PR_TempString(prinst, Mod_GetEntitiesString(mod));
Mod_SetEntitiesString(mod, "", true); Mod_SetEntitiesString(mod, "", true);
return; return;
case ter_ents_concat: case ter_ents_concat_deprecated:
{ {
char *newv; char *newv;
const char *olds = Mod_GetEntitiesString(mod); const char *olds = Mod_GetEntitiesString(mod);
@ -6197,33 +6215,45 @@ void CL_Parse_BrushEdit(void)
else if (cmd == hmcmd_prespawned) else if (cmd == hmcmd_prespawned)
{ {
} }
else if (cmd == hmcmd_ent_edit) else if (cmd == hmcmd_ent_edit || cmd == hmcmd_ent_remove)
{ //ent edit { //ent edit
int id = MSG_ReadLong(); int id = MSG_ReadLong();
const char *data = MSG_ReadString(); const char *data;
if (id > 0xffff) int idx = mod->numentityinfo, i;
return; if (cmd == hmcmd_ent_edit)
if (id >= mod->numentityinfo) data = MSG_ReadString();
Z_ReallocElements((void**)&mod->entityinfo, &mod->numentityinfo, id+64, sizeof(*mod->entityinfo)); else
if (id < mod->numentityinfo) data = NULL;
//convert id to idx
for (i = 0; i < mod->numentityinfo; i++)
{
if (mod->entityinfo[i].id == id)
{
idx = i;
break;
}
if (!mod->entityinfo[i].keyvals)
idx = i;
}
//FIXME: cap the maximum data sizes (both count and storage, to prevent DOS attacks).
if (idx == mod->numentityinfo && data)
Z_ReallocElements((void**)&mod->entityinfo, &mod->numentityinfo, mod->numentityinfo+64, sizeof(*mod->entityinfo));
if (idx < mod->numentityinfo)
{ {
if (!ignore) if (!ignore)
{ {
Z_Free(mod->entityinfo[id].keyvals); mod->entityinfo[idx].id = id;
mod->entityinfo[id].keyvals = Z_StrDup(data); Z_Free(mod->entityinfo[idx].keyvals);
if (data)
mod->entityinfo[idx].keyvals = Z_StrDup(data);
else
mod->entityinfo[idx].keyvals = NULL;
CSQC_MapEntityEdited(modelindex, idx, data);
} }
CSQC_MapEntityEdited(id, data);
}
}
else if (cmd == hmcmd_ent_remove)
{
int id = MSG_ReadLong();
if (sv.state >= ss_loading)
return; //if we're the server then this will already have been done. don't clobber from internal latency
if (id < mod->numentityinfo)
{
Z_Free(mod->entityinfo[id].keyvals);
mod->entityinfo[id].keyvals = NULL;
} }
} }
else else
@ -6350,16 +6380,20 @@ qboolean SV_Parse_BrushEdit(void)
} }
else if (cmd == hmcmd_ent_edit || cmd == hmcmd_ent_remove) else if (cmd == hmcmd_ent_edit || cmd == hmcmd_ent_remove)
{ {
size_t entid = MSG_ReadLong(); unsigned int entid = MSG_ReadLong();
char *keyvals = (cmd == hmcmd_ent_edit)?MSG_ReadString():NULL; char *keyvals = (cmd == hmcmd_ent_edit)?MSG_ReadString():NULL;
if (mod->submodelof != mod) if (mod->submodelof != mod)
return true; return true;
if (!authorise) if (!authorise)
{ {
SV_PrintToClient(host_client, PRINT_MEDIUM, "Entity editing ignored: you are not a mapper\n"); SV_PrintToClient(host_client, PRINT_MEDIUM, "Entity editing ignored: you are not a mapper\n");
//FIXME: undo the client's edit? or is that rude?
return true; return true;
} }
//FIXME: need to update the server's entity list
//SSQC_MapEntityEdited(idx, newvals);
MSG_WriteByte(&sv.multicast, svcfte_brushedit); MSG_WriteByte(&sv.multicast, svcfte_brushedit);
MSG_WriteShort(&sv.multicast, modelindex); MSG_WriteShort(&sv.multicast, modelindex);
MSG_WriteByte(&sv.multicast, keyvals?hmcmd_ent_edit:hmcmd_ent_remove); MSG_WriteByte(&sv.multicast, keyvals?hmcmd_ent_edit:hmcmd_ent_remove);
@ -6471,7 +6505,7 @@ void QCBUILTIN PF_brush_create(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
model_t *mod = vmw->Get_CModel(vmw, modelindex); model_t *mod = vmw->Get_CModel(vmw, modelindex);
heightmap_t *hm = mod?mod->terrain:NULL; heightmap_t *hm = mod?mod->terrain:NULL;
unsigned int numfaces = G_INT(OFS_PARM2); unsigned int numfaces = G_INT(OFS_PARM2);
qcbrushface_t *in_faces = validateqcpointer(prinst, G_INT(OFS_PARM1), sizeof(*in_faces), numfaces, false); qcbrushface_t *in_faces = validateqcpointer(prinst, G_INT(OFS_PARM1), sizeof(*in_faces), numfaces, numfaces==0);
unsigned int contents = G_INT(OFS_PARM3); unsigned int contents = G_INT(OFS_PARM3);
unsigned int brushid = (prinst->callargc > 4)?G_INT(OFS_PARM4):0; //to simplify edits unsigned int brushid = (prinst->callargc > 4)?G_INT(OFS_PARM4):0; //to simplify edits
@ -6999,6 +7033,7 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
int brushcontents = FTECONTENTS_SOLID; int brushcontents = FTECONTENTS_SOLID;
heightmap_t *subhm = NULL; heightmap_t *subhm = NULL;
model_t *submod = NULL; model_t *submod = NULL;
const char *brushpunct = "(){}[]"; //use an empty string for better compat with vanilla qbsp...
#ifdef RUNTIMELIGHTING #ifdef RUNTIMELIGHTING
hm->entsdirty = true; hm->entsdirty = true;
@ -7013,7 +7048,7 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
while(entities) while(entities)
{ {
start = entities; start = entities;
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
if (token[0] == '}' && token[1] == 0) if (token[0] == '}' && token[1] == 0)
{ {
nest--; nest--;
@ -7136,24 +7171,24 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
{ {
if (token[0] != '(' || token[1] != 0) if (token[0] != '(' || token[1] != 0)
break; break;
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
points[p][0] = atof(token); points[p][0] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
points[p][1] = atof(token); points[p][1] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
points[p][2] = atof(token); points[p][2] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
if (token[0] != ')' || token[1] != 0) if (token[0] != ')' || token[1] != 0)
{ {
// VectorClear(points[1]); // VectorClear(points[1]);
// VectorClear(points[2]); // VectorClear(points[2]);
points[1][0] = atof(token); points[1][0] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
if (p == 0 && !strcmp(token, ")")) if (p == 0 && !strcmp(token, ")"))
p = 4; //we just managed to read an entire plane instead of 3 points. p = 4; //we just managed to read an entire plane instead of 3 points.
break; break;
} }
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
} }
if (p < 3) if (p < 3)
{ {
@ -7184,35 +7219,35 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
brushcontents = FTECONTENTS_SOLID; brushcontents = FTECONTENTS_SOLID;
//FIXME: halflife format has the entire [x y z dist] plane specified. //FIXME: halflife format has the entire [x y z dist] plane specified.
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
if (*token == '[') if (*token == '[')
{ {
hlstyle = true; hlstyle = true;
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[0][0] = atof(token); texplane[0][0] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[0][1] = atof(token); texplane[0][1] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[0][2] = atof(token); texplane[0][2] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[0][3] = atof(token); texplane[0][3] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
//] //]
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
//[ //[
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[1][0] = atof(token); texplane[1][0] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[1][1] = atof(token); texplane[1][1] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[1][2] = atof(token); texplane[1][2] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[1][3] = atof(token); texplane[1][3] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
//] //]
} }
else else
@ -7220,22 +7255,22 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
VectorClear(texplane[0]); VectorClear(texplane[0]);
VectorClear(texplane[1]); VectorClear(texplane[1]);
texplane[0][3] = atof(token); texplane[0][3] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
texplane[1][3] = atof(token); texplane[1][3] = atof(token);
} }
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
rot = atof(token); rot = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
scale[0] = atof(token); scale[0] = atof(token);
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
scale[1] = atof(token); scale[1] = atof(token);
//hexen2 has some extra junk that is useless - some 'light' value, but its never used and should normally be -1. //hexen2 has some extra junk that is useless - some 'light' value, but its never used and should normally be -1.
while (*entities == ' ' || *entities == '\t') while (*entities == ' ' || *entities == '\t')
entities++; entities++;
if (*entities == '-' || (*entities >= '0' && *entities <= '9')) if (*entities == '-' || (*entities >= '0' && *entities <= '9'))
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
//okay, that's all the actual parsing, now try to make sense of this plane. //okay, that's all the actual parsing, now try to make sense of this plane.
if (p == 4) if (p == 4)
@ -7298,13 +7333,13 @@ qboolean Terr_ReformEntitiesLump(model_t *mod, heightmap_t *hm, char *entities)
{ {
if (!strcmp(token, "classname")) if (!strcmp(token, "classname"))
{ {
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
if (!strcmp(token, "func_detail")) if (!strcmp(token, "func_detail"))
isdetail = true; isdetail = true;
} }
else else
entities = COM_ParseOut(entities, token, sizeof(token)); entities = COM_ParseTokenOut(entities, brushpunct, token, sizeof(token), NULL);
} }
while(start < entities) while(start < entities)
*out++ = *start++; *out++ = *start++;

View file

@ -586,6 +586,7 @@ void Mod_ParseEntities(model_t *mod)
m *= 2; m *= 2;
mod->entityinfo = BZ_Realloc(mod->entityinfo, sizeof(*mod->entityinfo) * m); mod->entityinfo = BZ_Realloc(mod->entityinfo, sizeof(*mod->entityinfo) * m);
} }
mod->entityinfo[c].id = c+1;
mod->entityinfo[c].keyvals = BZ_Malloc(entend-entstart + 1); mod->entityinfo[c].keyvals = BZ_Malloc(entend-entstart + 1);
memcpy(mod->entityinfo[c].keyvals, entstart, entend-entstart); memcpy(mod->entityinfo[c].keyvals, entstart, entend-entstart);
mod->entityinfo[c].keyvals[entend-entstart] = 0; mod->entityinfo[c].keyvals[entend-entstart] = 0;
@ -1267,7 +1268,37 @@ static void Mod_LoadModelWorker (void *ctx, void *data, size_t a, size_t b)
return; return;
} }
#endif #endif
break; // failed to load unreplaced file and nothing left #ifdef TERRAIN
if (!Q_strcasecmp(ext, "map"))
{
const char *dummymap =
"{\n"
"classname worldspawn\n"
"wad \"base.wad\"\n" //we ARE a quake engine after all, and default.wad is generally wrong
"message \"Unnamed map\"\n"
"{\n"
"(-128 128 0) ( 128 128 0) ( 128 -128 0) \"WBRICK1_5\" 0 0 0 1 1\n"
"( 128 -128 -16)( 128 128 -16) (-128 128 -16) \"WBRICK1_5\" 0 0 0 1 1\n"
"( 128 128 0) (-128 128 0) (-128 128 -16) \"WBRICK1_5\" 0 0 0 1 1\n"
"(-128 -128 0) ( 128 -128 0) ( 128 -128 -16) \"WBRICK1_5\" 0 0 0 1 1\n"
"(-128 128 0) (-128 -128 0) (-128 -128 -16) \"WBRICK1_5\" 0 0 0 1 1\n"
"( 128 -128 0) ( 128 128 0) ( 128 128 -16) \"WBRICK1_5\" 0 0 0 1 1\n"
"}\n"
"}\n"
"{\n"
"classname info_player_start\n"
"origin \"0 0 24\"\n"
"}\n"
"{\n"
"classname light\n"
"origin \"0 0 64\"\n"
"}\n";
buf = (unsigned*)Z_StrDup(dummymap);
filesize = strlen(dummymap);
}
else
#endif
break; // failed to load unreplaced file and nothing left
} }
} }
if (!buf) if (!buf)

View file

@ -950,7 +950,7 @@ typedef struct model_s
q3lightgridinfo_t *lightgrid; q3lightgridinfo_t *lightgrid;
mfog_t *fogs; mfog_t *fogs;
int numfogs; int numfogs;
struct {char *keyvals;} *entityinfo; struct {unsigned int id; char *keyvals;} *entityinfo;
size_t numentityinfo; size_t numentityinfo;
const char *entities_raw; const char *entities_raw;
int entitiescrc; int entitiescrc;

View file

@ -706,6 +706,14 @@ qboolean R_ImportRTLights(const char *entlump)
int nest; int nest;
qboolean okay = false; qboolean okay = false;
//a quick note about tenebrae:
//by default, tenebrae's rtlights come from the server via static entities, which is all fancy and posh and actually fairly nice... if all servers actually did it.
//(the tenebrae gamecode uses spawnflag 2048 for static lights. note the pflags_fulldynamic fte/dp vs tenebrae difference)
//failing that, it will insert lights with some crappy fixed radius around only all 'classname light' entities, without any colours or anything, vanilla only.
//such lights are ONLY created if they're not near some other existing light (like a static entity one).
//this can result in FTE having noticably more and bigger lights than tenebrae. shadowmapping doesn't help performance either.
float lightmaplevel = -1;
COM_Parse(entlump); COM_Parse(entlump);
if (!strcmp(com_token, "Version")) if (!strcmp(com_token, "Version"))
{ {
@ -921,6 +929,7 @@ qboolean R_ImportRTLights(const char *entlump)
else if (entnum == 0 && !strcmp("lightmapbright", key)) else if (entnum == 0 && !strcmp("lightmapbright", key))
{ {
//tenebrae compat. this overrides r_shadow_realtime_world_lightmap //tenebrae compat. this overrides r_shadow_realtime_world_lightmap
lightmaplevel = atof(value);
} }
} }
if (!islight) if (!islight)
@ -1262,7 +1271,9 @@ void R_ReloadRTLights_f(void)
R_ImportRTLights(Mod_GetEntitiesString(cl.worldmodel)); R_ImportRTLights(Mod_GetEntitiesString(cl.worldmodel));
else if (!strcmp(Cmd_Argv(1), "rtlights")) else if (!strcmp(Cmd_Argv(1), "rtlights"))
R_LoadRTLights(); R_LoadRTLights();
else if (strcmp(Cmd_Argv(1), "none")) else if (!strcmp(Cmd_Argv(1), "none"))
;
else
{ {
R_LoadRTLights(); R_LoadRTLights();
if (rtlights_first == rtlights_max) if (rtlights_first == rtlights_max)

View file

@ -2354,6 +2354,7 @@ static void Shader_DP_Refract(shader_t *shader, shaderpass_t *pass, char **ptr)
static void Shader_BEMode(shader_t *shader, shaderpass_t *pass, char **ptr) static void Shader_BEMode(shader_t *shader, shaderpass_t *pass, char **ptr)
{ {
char subname[1024];
int mode; int mode;
char tokencopy[1024]; char tokencopy[1024];
char *token; char *token;
@ -2417,8 +2418,7 @@ static void Shader_BEMode(shader_t *shader, shaderpass_t *pass, char **ptr)
{ {
if ((mode & LSHADER_CUBE) && (mode & LSHADER_SPOT)) if ((mode & LSHADER_CUBE) && (mode & LSHADER_SPOT))
continue; continue;
shader->bemoverrides[mode] = R_RegisterCustom(va("%s%s%s%s%s", Q_snprintfz(subname, sizeof(subname), "%s%s%s%s%s", tokencopy,
tokencopy,
(mode & LSHADER_SMAP)?"#PCF":"", (mode & LSHADER_SMAP)?"#PCF":"",
(mode & LSHADER_SPOT)?"#SPOT":"", (mode & LSHADER_SPOT)?"#SPOT":"",
(mode & LSHADER_CUBE)?"#CUBE":"", (mode & LSHADER_CUBE)?"#CUBE":"",
@ -2427,13 +2427,13 @@ static void Shader_BEMode(shader_t *shader, shaderpass_t *pass, char **ptr)
#else #else
"" ""
#endif #endif
) );
, shader->usageflags, embed?Shader_DefaultScript:NULL, embed); shader->bemoverrides[mode] = R_RegisterCustom(subname, shader->usageflags|(embed?SUR_FORCEFALLBACK:0), embed?Shader_DefaultScript:NULL, embed);
} }
} }
else else
{ {
shader->bemoverrides[mode] = R_RegisterCustom(tokencopy, shader->usageflags, embed?Shader_DefaultScript:NULL, embed); shader->bemoverrides[mode] = R_RegisterCustom(tokencopy, shader->usageflags|(embed?SUR_FORCEFALLBACK:0), embed?Shader_DefaultScript:NULL, embed);
} }
if (embed) if (embed)
BZ_Free(embed); BZ_Free(embed);
@ -6363,7 +6363,7 @@ static shader_t *R_LoadShader (const char *name, unsigned int usageflags, shader
*argsstart = 0; *argsstart = 0;
COM_StripExtension (cleanname, shortname, sizeof(shortname)); COM_StripExtension (cleanname, shortname, sizeof(shortname));
if (ruleset_allow_shaders.ival) if (ruleset_allow_shaders.ival && !(usageflags & SUR_FORCEFALLBACK))
{ {
if (sh_config.shadernamefmt) if (sh_config.shadernamefmt)
{ {

View file

@ -1725,7 +1725,7 @@ static const char *glsl_hdrs[] =
"#else\n" "#else\n"
"#ifdef USE_ARB_SHADOW\n" "#ifdef USE_ARB_SHADOW\n"
//with arb_shadow, we can benefit from hardware acclerated pcf, for smoother shadows //with arb_shadow, we can benefit from hardware acclerated pcf, for smoother shadows
"#define dosamp(x,y) shadow2D(smap, shadowcoord.xyz + (vec3(x,y,0.0)*l_shadowmapscale.xyx))\n" "#define dosamp(x,y) float(shadow2D(smap, shadowcoord.xyz + (vec3(x,y,0.0)*l_shadowmapscale.xyx)))\n"
"#else\n" "#else\n"
"#define dosamp(x,y) float(texture2D(smap, shadowcoord.xy + (vec2(x,y)*l_shadowmapscale.xy)).r >= shadowcoord.z)\n" "#define dosamp(x,y) float(texture2D(smap, shadowcoord.xy + (vec2(x,y)*l_shadowmapscale.xy)).r >= shadowcoord.z)\n"
"#endif\n" "#endif\n"
@ -3121,15 +3121,31 @@ void DumpGLState(void)
rendererinfo_t openglrendererinfo = { rendererinfo_t openglrendererinfo = {
//customise the text printed depending on the actual type of opengl that we're locking ourselves to
#ifdef FTE_TARGET_WEB #ifdef FTE_TARGET_WEB
"WebGL", "WebGL",
#elif defined(GLESONLY)
#ifdef GLSLONLY
"OpenGLES2+",
#else
"OpenGLES",
#endif
#else #else
"OpenGL", "OpenGL",
#endif #endif
{ {
//reorder these too, if only so that 'setrenderer' lists gles-only builds as using gles instead of gl
#if defined(GLESONLY)
"gles",
"opengles",
"gl", "gl",
"opengl", "opengl",
"hardware", #else
"gl",
"opengl",
"gles",
"opengles",
#endif
}, },
QR_OPENGL, QR_OPENGL,

View file

@ -4229,6 +4229,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"varying vec2 tc;\n" "varying vec2 tc;\n"
"varying vec4 vc;\n" "varying vec4 vc;\n"
"uniform vec4 e_colourident;\n" "uniform vec4 e_colourident;\n"
"uniform vec4 e_lmscale;\n"
"void main ()\n" "void main ()\n"
"{\n" "{\n"
"vec4 col = texture2D(s_t0, tc);\n" "vec4 col = texture2D(s_t0, tc);\n"
@ -4236,7 +4237,7 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"if (col.a < float(MASK))\n" "if (col.a < float(MASK))\n"
"discard;\n" "discard;\n"
"#endif\n" "#endif\n"
"gl_FragColor = fog4blend(col * vc * e_colourident);\n" "gl_FragColor = fog4blend(col * vc * e_colourident * e_lmscale);\n"
"}\n" "}\n"
"#endif\n" "#endif\n"
}, },
@ -9806,6 +9807,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#if !defined(TESS_CONTROL_SHADER)\n" "#if !defined(TESS_CONTROL_SHADER)\n"
"varying vec2 tcbase;\n" "varying vec2 tcbase;\n"
"varying vec3 lightvector;\n" "varying vec3 lightvector;\n"
"#if defined(VERTEXCOLOURS)\n"
"varying vec4 vc;\n"
"#endif\n"
"#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n" "#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"varying vec3 eyevector;\n" "varying vec3 eyevector;\n"
"#endif\n" "#endif\n"
@ -9838,6 +9842,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"lightvector.y = dot(lightminusvertex, t.xyz);\n" "lightvector.y = dot(lightminusvertex, t.xyz);\n"
"lightvector.z = dot(lightminusvertex, n.xyz);\n" "lightvector.z = dot(lightminusvertex, n.xyz);\n"
"#endif\n" "#endif\n"
"#if defined(VERTEXCOLOURS)\n"
"vc = v_colour;\n"
"#endif\n"
"#if defined(SPECULAR)||defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n" "#if defined(SPECULAR)||defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"vec3 eyeminusvertex = e_eyepos - w.xyz;\n" "vec3 eyeminusvertex = e_eyepos - w.xyz;\n"
"eyevector.x = dot(eyeminusvertex, s.xyz);\n" "eyevector.x = dot(eyeminusvertex, s.xyz);\n"
@ -9877,6 +9884,10 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"out vec2 t_tcbase[];\n" "out vec2 t_tcbase[];\n"
"in vec3 lightvector[];\n" "in vec3 lightvector[];\n"
"out vec3 t_lightvector[];\n" "out vec3 t_lightvector[];\n"
"#if defined(VERTEXCOLOURS)\n"
"in vec4 vc[];\n"
"out vec4 t_vc[];\n"
"#endif\n"
"#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n" "#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"in vec3 eyevector[];\n" "in vec3 eyevector[];\n"
"out vec3 t_eyevector[];\n" "out vec3 t_eyevector[];\n"
@ -9889,6 +9900,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"t_normal[id] = normal[id];\n" "t_normal[id] = normal[id];\n"
"t_tcbase[id] = tcbase[id];\n" "t_tcbase[id] = tcbase[id];\n"
"t_lightvector[id] = lightvector[id];\n" "t_lightvector[id] = lightvector[id];\n"
"#if defined(VERTEXCOLOURS)\n"
"t_vc[id] = vc[id];\n"
"#endif\n"
"#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n" "#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"t_eyevector[id] = eyevector[id];\n" "t_eyevector[id] = eyevector[id];\n"
"#endif\n" "#endif\n"
@ -9915,6 +9929,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"in vec3 t_normal[];\n" "in vec3 t_normal[];\n"
"in vec2 t_tcbase[];\n" "in vec2 t_tcbase[];\n"
"in vec3 t_lightvector[];\n" "in vec3 t_lightvector[];\n"
"#if defined(VERTEXCOLOURS)\n"
"in vec4 t_vc[];\n"
"#endif\n"
"#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n" "#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"in vec3 t_eyevector[];\n" "in vec3 t_eyevector[];\n"
"#endif\n" "#endif\n"
@ -9938,6 +9955,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
//FIXME: we should be recalcing these here, instead of just lerping them //FIXME: we should be recalcing these here, instead of just lerping them
"lightvector = LERP(t_lightvector);\n" "lightvector = LERP(t_lightvector);\n"
"#if defined(VERTEXCOLOURS)\n"
"vc = LERP(t_vc);\n"
"#endif\n"
"#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n" "#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)\n"
"eyevector = LERP(t_eyevector);\n" "eyevector = LERP(t_eyevector);\n"
"#endif\n" "#endif\n"
@ -9984,9 +10004,12 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"#define tcbase tcoffsetmap\n" "#define tcbase tcoffsetmap\n"
"#endif\n" "#endif\n"
"#if defined(FLAT)\n" "#if defined(FLAT)\n"
"vec3 bases = vec3(FLAT);\n" "vec4 bases = vec3(FLAT, 1.0);\n"
"#else\n" "#else\n"
"vec3 bases = vec3(texture2D(s_diffuse, tcbase));\n" "vec4 bases = texture2D(s_diffuse, tcbase);\n"
"#ifdef VERTEXCOLOURS\n"
"bases.rgb *= bases.a;\n"
"#endif\n"
"#endif\n" "#endif\n"
"#ifdef UPPER\n" "#ifdef UPPER\n"
"vec4 uc = texture2D(s_upper, tcbase);\n" "vec4 uc = texture2D(s_upper, tcbase);\n"
@ -10008,14 +10031,14 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
"vec3 diff;\n" "vec3 diff;\n"
"#ifdef NOBUMP\n" "#ifdef NOBUMP\n"
//surface can only support ambient lighting, even for lights that try to avoid it. //surface can only support ambient lighting, even for lights that try to avoid it.
"diff = bases * (l_lightcolourscale.x+l_lightcolourscale.y);\n" "diff = bases.rgb * (l_lightcolourscale.x+l_lightcolourscale.y);\n"
"#else\n" "#else\n"
"vec3 nl = normalize(lightvector);\n" "vec3 nl = normalize(lightvector);\n"
"#ifdef BUMP\n" "#ifdef BUMP\n"
"diff = bases * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(bumps, nl), 0.0));\n" "diff = bases.rgb * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(bumps, nl), 0.0));\n"
"#else\n" "#else\n"
//we still do bumpmapping even without bumps to ensure colours are always sane. light.exe does it too. //we still do bumpmapping even without bumps to ensure colours are always sane. light.exe does it too.
"diff = bases * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(vec3(0.0, 0.0, 1.0), nl), 0.0));\n" "diff = bases.rgb * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(vec3(0.0, 0.0, 1.0), nl), 0.0));\n"
"#endif\n" "#endif\n"
"#endif\n" "#endif\n"
@ -10042,6 +10065,9 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
/*2d projection, not used*/ /*2d projection, not used*/
// diff *= texture2d(s_projectionmap, shadowcoord); // diff *= texture2d(s_projectionmap, shadowcoord);
"#endif\n" "#endif\n"
"#if defined(VERTEXCOLOURS)\n"
"diff *= vc.rgb * vc.a;\n"
"#endif\n"
"gl_FragColor.rgb = fog3additive(diff*colorscale*l_lightcolour);\n" "gl_FragColor.rgb = fog3additive(diff*colorscale*l_lightcolour);\n"

View file

@ -536,13 +536,15 @@ enum
bemoverride_fog, //post-render volumetric fog bemoverride_fog, //post-render volumetric fog
bemoverride_max bemoverride_max
}; };
//FIXME: split into separate materials and shaders
struct shader_s struct shader_s
{ {
char name[MAX_QPATH]; char name[MAX_QPATH];
enum { enum {
SUF_NONE = 0, SUF_NONE = 0,
SUF_LIGHTMAP = 1<<0, //$lightmap passes are valid. otherwise collapsed to an rgbgen SUF_LIGHTMAP = 1<<0, //$lightmap passes are valid. otherwise collapsed to an rgbgen
SUF_2D = 1<<1 //any loaded textures will obey 2d picmips rather than 3d picmips SUF_2D = 1<<1, //any loaded textures will obey 2d picmips rather than 3d picmips
SUR_FORCEFALLBACK = 1<<2//shader fallback is forced, will not load from disk
} usageflags; // } usageflags; //
int uses; //released when the uses drops to 0 int uses; //released when the uses drops to 0
int width; //when used as an image, this is the logical 'width' of the image. FIXME. int width; //when used as an image, this is the logical 'width' of the image. FIXME.
@ -554,8 +556,8 @@ struct shader_s
struct shader_s *next; struct shader_s *next;
int id; int id;
shader_t *bemoverrides[bemoverride_max]; rshader_t *bemoverrides[bemoverride_max];
shader_t *remapto; //render using this shader instead. for q3 nonsense. material_t *remapto; //render using this material instead. for q3 nonsense.
float remaptime; float remaptime;
byte_vec4_t fog_color; byte_vec4_t fog_color;

View file

@ -27,6 +27,7 @@ static void DL_Cancel(struct dl_download *dl)
} }
static void DL_OnLoad(void *c, void *data, int datasize) static void DL_OnLoad(void *c, void *data, int datasize)
{ {
//also fires from 404s.
struct dl_download *dl = c; struct dl_download *dl = c;
//make sure the file is 'open'. //make sure the file is 'open'.
@ -65,13 +66,15 @@ static void DL_OnError(void *c)
#endif #endif
{ {
struct dl_download *dl = c; struct dl_download *dl = c;
//fires from cross-domain blocks, tls errors, etc.
//anything which doesn't yield an http response (404 is NOT an error as far as js is aware).
#if MYJS #if MYJS
dl->replycode = ecode; dl->replycode = ecode;
#else #else
dl->replycode = 404; //we don't actually know. should we not do this? dl->replycode = 404; //we don't actually know. should we not do this?
#endif #endif
Con_Printf("download: %s: error %i\n", dl->url, dl->replycode); Con_Printf(CON_WARNING"dl error: %s\n", dl->url);
dl->status = DL_FAILED; dl->status = DL_FAILED;
} }
static void DL_OnProgress(void *c, int position, int totalsize) static void DL_OnProgress(void *c, int position, int totalsize)
@ -495,6 +498,7 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
char *nl; char *nl;
char *msg; char *msg;
int ammount; int ammount;
qboolean transfercomplete = false;
#ifdef MULTITHREAD #ifdef MULTITHREAD
//if we're running in a thread, wait for some actual activity instead of busylooping like an moron. //if we're running in a thread, wait for some actual activity instead of busylooping like an moron.
@ -826,8 +830,11 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
con->bufferused+=ammount; con->bufferused+=ammount;
if (con->chunking) //FIXME: NEEDS TESTING!!! if (con->chunking)
{ {
//9\r\n
//chunkdata\r\n
//(etc)
int trim; int trim;
char *nl; char *nl;
con->buffer[con->bufferused] = '\0'; con->buffer[con->bufferused] = '\0';
@ -838,29 +845,46 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
trim = con->bufferused - con->chunked; trim = con->bufferused - con->chunked;
if (trim > con->chunksize) if (trim > con->chunksize)
trim = con->chunksize; //don't go into the next size field. trim = con->chunksize; //don't go into the next size field.
con->chunksize -= trim;
con->chunked += trim;
if (!con->chunksize) if (con->chunksize == trim)
{ //we need to find the next \n and trim it. { //we need to find the next \n and trim it.
nl = strchr(con->buffer+con->chunked, '\n'); nl = strchr(con->buffer+con->chunked+trim, '\n');
if (!nl) if (!nl)
break; break;
nl++; nl++;
con->chunksize = 0;
con->chunked += trim;
//chop out the \r\n from the stream
trim = nl - (con->buffer+con->chunked); trim = nl - (con->buffer+con->chunked);
memmove(con->buffer + con->chunked, nl, con->buffer+con->bufferused-nl+1); memmove(con->buffer + con->chunked, nl, con->buffer+con->bufferused-nl+1);
con->bufferused -= trim; con->bufferused -= trim;
} }
else
{
con->chunksize -= trim;
con->chunked += trim;
}
if (!(con->bufferused - con->chunked)) if (!(con->bufferused - con->chunked))
break; break;
} }
else else
{ {
size_t nextsize;
nl = strchr(con->buffer+con->chunked, '\n'); nl = strchr(con->buffer+con->chunked, '\n');
if (!nl) if (!nl)
break; break;
con->chunksize = strtol(con->buffer+con->chunked, NULL, 16); //it's hex. nextsize = strtoul(con->buffer+con->chunked, NULL, 16); //it's hex.
nl++; nl++;
if (!nextsize) //eof. make sure we skip its \n too
{
nl = strchr(nl, '\n');
if (!nl)
break;
transfercomplete = true;
}
con->chunksize = nextsize;
trim = nl - (con->buffer+con->chunked); trim = nl - (con->buffer+con->chunked);
memmove(con->buffer + con->chunked, nl, con->buffer+con->bufferused-nl+1); memmove(con->buffer + con->chunked, nl, con->buffer+con->bufferused-nl+1);
con->bufferused -= trim; con->bufferused -= trim;
@ -914,11 +938,12 @@ static qboolean HTTP_DL_Work(struct dl_download *dl)
con->bufferused -= chunk; con->bufferused -= chunk;
} }
if (con->totalreceived == con->contentlength) if (con->totalreceived == con->contentlength)
ammount = 0; transfercomplete = true;
} }
if (!ammount) if (!ammount || transfercomplete)
{ //server closed off the connection. { //server closed off the connection (or signalled eof/sent enough data).
//if (ammount) then we can save off the connection for reuse.
if (con->chunksize) if (con->chunksize)
dl->status = DL_FAILED; dl->status = DL_FAILED;
else else
@ -1716,16 +1741,6 @@ static int QDECL VFSPIPE_ReadBytes(vfsfile_t *f, void *buffer, int len)
len = p->writepos - p->readpos; len = p->writepos - p->readpos;
memcpy(buffer, p->data+p->readpos, len); memcpy(buffer, p->data+p->readpos, len);
p->readpos += len; p->readpos += len;
if (p->readpos > 8192)
{
//shift the memory down periodically
//fixme: use cyclic buffer? max size, etc?
memmove(p->data, p->data+p->readpos, p->writepos-p->readpos);
p->writepos -= p->readpos;
p->readpos = 0;
}
Sys_UnlockMutex(p->mutex); Sys_UnlockMutex(p->mutex);
return len; return len;
} }
@ -1733,6 +1748,12 @@ static int QDECL VFSPIPE_WriteBytes(vfsfile_t *f, const void *buffer, int len)
{ {
vfspipe_t *p = (vfspipe_t*)f; vfspipe_t *p = (vfspipe_t*)f;
Sys_LockMutex(p->mutex); Sys_LockMutex(p->mutex);
if (p->readpos > 8192)
{ //don't grow infinitely if we're reading+writing at the same time
memmove(p->data, p->data+p->readpos, p->writepos-p->readpos);
p->writepos -= p->readpos;
p->readpos = 0;
}
if (p->writepos + len > p->maxlen) if (p->writepos + len > p->maxlen)
{ {
p->maxlen = p->writepos + len; p->maxlen = p->writepos + len;

View file

@ -253,13 +253,11 @@ skipwhite:
return (char*)data; return (char*)data;
} }
#undef COM_ParseToken
char *COM_ParseToken (const char *data, const char *punctuation) char *COM_ParseToken (const char *data, const char *punctuation)
{ {
int c; int c;
int len; int len;
#ifndef WEBSVONLY
COM_AssertMainThread("COM_ParseToken");
#endif
len = 0; len = 0;
com_token[0] = 0; com_token[0] = 0;

View file

@ -3,6 +3,14 @@
#include "qcc.h" #include "qcc.h"
#include <math.h> #include <math.h>
/*
TODO:
*foo++ = 5;
is currently store foo->tmp; store 5->*tmp; add tmp,1->foo
should be just store 5->*foo; add foo,1->foo
the dereference does the post-inc. needs to be delayed somehow. could build a list of post-inc terms after the current expression, but might be really messy.
*/
#define WARN_IMPLICITVARIANTCAST 0 #define WARN_IMPLICITVARIANTCAST 0
//FIXME: #define IAMNOTLAZY //FIXME: #define IAMNOTLAZY
@ -2460,6 +2468,11 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
optres_constantarithmatic++; optres_constantarithmatic++;
return QCC_MakeFloatConst(eval_a->_float + eval_b->_int); return QCC_MakeFloatConst(eval_a->_float + eval_b->_int);
case OP_ADD_PIW:
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
optres_constantarithmatic++;
return QCC_MakeIntConst(eval_a->_int + eval_b->_int*4);
case OP_SUB_IF: case OP_SUB_IF:
QCC_FreeTemp(var_a); QCC_FreeTemp(var_b); QCC_FreeTemp(var_a); QCC_FreeTemp(var_b);
optres_constantarithmatic++; optres_constantarithmatic++;
@ -2772,7 +2785,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
return nd; return nd;
} }
break; break;
#endif
case OP_BITOR_F: case OP_BITOR_F:
case OP_OR_F: case OP_OR_F:
case OP_SUB_F: case OP_SUB_F:
@ -2813,6 +2826,7 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
case OP_OR_I: case OP_OR_I:
case OP_SUB_I: case OP_SUB_I:
case OP_ADD_I: case OP_ADD_I:
case OP_ADD_PIW:
if (eval_b->_int == 0) if (eval_b->_int == 0)
{ {
optres_constantarithmatic++; optres_constantarithmatic++;
@ -2830,12 +2844,13 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
} }
break; break;
case OP_BITAND_I: case OP_BITAND_I:
if (eval_b->_int == 0xffffffff) if (eval_b->_int == ~0)
{ {
optres_constantarithmatic++; optres_constantarithmatic++;
QCC_FreeTemp(var_b); QCC_FreeTemp(var_b);
return var_a; return var_a;
} }
break;
case OP_AND_I: case OP_AND_I:
if (eval_b->_int) if (eval_b->_int)
{ {
@ -2850,7 +2865,6 @@ QCC_sref_t QCC_PR_StatementFlags ( QCC_opcode_t *op, QCC_sref_t var_a, QCC_sref_
return var_b; return var_b;
} }
break; break;
#endif
} }
} }
} }
@ -10612,11 +10626,10 @@ void QCC_PR_ParseStatement (void)
e = QCC_PR_Expression (TOP_PRIORITY, 0); e = QCC_PR_Expression (TOP_PRIORITY, 0);
QCC_PR_Expect(":"); QCC_PR_Expect(":");
e2 = QCC_PR_Expression (TOP_PRIORITY, 0); e2 = QCC_PR_Expression (TOP_PRIORITY, 0);
e2 = QCC_SupplyConversion(e2, ev_float, true);
if (e.cast->type != ev_entity || e2.cast->type != ev_float) if (e.cast->type != ev_entity || e2.cast->type != ev_float)
QCC_PR_ParseError(ERR_THINKTIMETYPEMISMATCH, "thinktime type mismatch"); QCC_PR_ParseError(ERR_THINKTIMETYPEMISMATCH, "thinktime type mismatch");
QCC_SupplyConversion(e2, ev_float, true);
if (QCC_OPCodeValid(&pr_opcodes[OP_THINKTIME])) if (QCC_OPCodeValid(&pr_opcodes[OP_THINKTIME]))
QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_THINKTIME], e, e2, NULL)); QCC_FreeTemp(QCC_PR_Statement (&pr_opcodes[OP_THINKTIME], e, e2, NULL));
else else
@ -13678,7 +13691,7 @@ Called at the outer layer and when a local statement is hit
void QCC_PR_ParseDefs (char *classname) void QCC_PR_ParseDefs (char *classname)
{ {
char *name; char *name;
QCC_type_t *type, *defclass; QCC_type_t *basetype, *type, *defclass;
QCC_def_t *def, *d; QCC_def_t *def, *d;
QCC_sref_t dynlength; QCC_sref_t dynlength;
QCC_function_t *f; QCC_function_t *f;
@ -13805,68 +13818,12 @@ void QCC_PR_ParseDefs (char *classname)
QCC_PR_GetDef(type_void, "end_sys_globals", NULL, true, 0, false); QCC_PR_GetDef(type_void, "end_sys_globals", NULL, true, 0, false);
accglobalsblock = 3; accglobalsblock = 3;
} }
}
if (!pr_scope) if (!pr_scope)
switch(accglobalsblock)//reacc support. switch(accglobalsblock)//reacc support.
{
case 1:
{ {
char *oldp = pr_file_p; case 1:
name = QCC_PR_ParseName();
if (!QCC_PR_CheckToken(":")) //nope, it wasn't!
{
QCC_PR_IncludeChunk(name, true, NULL);
QCC_PR_Lex();
QCC_PR_UnInclude();
pr_file_p = oldp;
break;
}
if (QCC_PR_CheckKeyword(keyword_object, "object"))
QCC_PR_GetDef(type_entity, name, NULL, true, 0, true);
else if (QCC_PR_CheckKeyword(keyword_string, "string"))
QCC_PR_GetDef(type_string, name, NULL, true, 0, true);
else if (QCC_PR_CheckKeyword(keyword_real, "real"))
{
def = QCC_PR_GetDef(type_float, name, NULL, true, 0, true);
if (QCC_PR_CheckToken("="))
{ {
def->symboldata[0]._float = pr_immediate._float;
QCC_PR_Lex();
}
}
else if (QCC_PR_CheckKeyword(keyword_vector, "vector"))
{
def = QCC_PR_GetDef(type_vector, name, NULL, true, 0, true);
if (QCC_PR_CheckToken("="))
{
QCC_PR_Expect("[");
def->symboldata[0].vector[0] = pr_immediate._float;
QCC_PR_Lex();
def->symboldata[0].vector[1] = pr_immediate._float;
QCC_PR_Lex();
def->symboldata[0].vector[2] = pr_immediate._float;
QCC_PR_Lex();
QCC_PR_Expect("]");
}
}
else if (QCC_PR_CheckKeyword(keyword_pfunc, "pfunc"))
QCC_PR_GetDef(type_function, name, NULL, true, 0, true);
else
QCC_PR_ParseError(ERR_BADNOTTYPE, "Bad type\n");
QCC_PR_Expect (";");
if (QCC_PR_CheckKeyword (keyword_system, "system"))
QCC_PR_Expect (";");
return;
}
case 2:
name = QCC_PR_ParseName();
QCC_PR_GetDef(type_function, name, NULL, true, 0, true);
QCC_PR_CheckToken (";");
return;
case 3:
{
char *oldp = pr_file_p; char *oldp = pr_file_p;
name = QCC_PR_ParseName(); name = QCC_PR_ParseName();
if (!QCC_PR_CheckToken(":")) //nope, it wasn't! if (!QCC_PR_CheckToken(":")) //nope, it wasn't!
@ -13878,41 +13835,97 @@ void QCC_PR_ParseDefs (char *classname)
break; break;
} }
if (QCC_PR_CheckKeyword(keyword_object, "object")) if (QCC_PR_CheckKeyword(keyword_object, "object"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_entity), name, NULL, true, 0, GDF_CONST|GDF_SAVED); QCC_PR_GetDef(type_entity, name, NULL, true, 0, true);
else if (QCC_PR_CheckKeyword(keyword_string, "string")) else if (QCC_PR_CheckKeyword(keyword_string, "string"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_string), name, NULL, true, 0, GDF_CONST|GDF_SAVED); QCC_PR_GetDef(type_string, name, NULL, true, 0, true);
else if (QCC_PR_CheckKeyword(keyword_real, "real")) else if (QCC_PR_CheckKeyword(keyword_real, "real"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_float), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else if (QCC_PR_CheckKeyword(keyword_vector, "vector"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_vector), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else if (QCC_PR_CheckKeyword(keyword_pfunc, "pfunc"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_function), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else
{ {
def = QCC_PR_GetDef(type_float, name, NULL, true, 0, true);
if (QCC_PR_CheckToken("="))
{
def->symboldata[0]._float = pr_immediate._float;
QCC_PR_Lex();
}
}
else if (QCC_PR_CheckKeyword(keyword_vector, "vector"))
{
def = QCC_PR_GetDef(type_vector, name, NULL, true, 0, true);
if (QCC_PR_CheckToken("="))
{
QCC_PR_Expect("[");
def->symboldata[0].vector[0] = pr_immediate._float;
QCC_PR_Lex();
def->symboldata[0].vector[1] = pr_immediate._float;
QCC_PR_Lex();
def->symboldata[0].vector[2] = pr_immediate._float;
QCC_PR_Lex();
QCC_PR_Expect("]");
}
}
else if (QCC_PR_CheckKeyword(keyword_pfunc, "pfunc"))
QCC_PR_GetDef(type_function, name, NULL, true, 0, true);
else
QCC_PR_ParseError(ERR_BADNOTTYPE, "Bad type\n"); QCC_PR_ParseError(ERR_BADNOTTYPE, "Bad type\n");
QCC_PR_Expect (";");
if (QCC_PR_CheckKeyword (keyword_system, "system"))
QCC_PR_Expect (";");
return;
}
case 2:
name = QCC_PR_ParseName();
QCC_PR_GetDef(type_function, name, NULL, true, 0, true);
QCC_PR_CheckToken (";");
return;
case 3:
{
char *oldp = pr_file_p;
name = QCC_PR_ParseName();
if (!QCC_PR_CheckToken(":")) //nope, it wasn't!
{
QCC_PR_IncludeChunk(name, true, NULL);
QCC_PR_Lex();
QCC_PR_UnInclude();
pr_file_p = oldp;
break;
}
if (QCC_PR_CheckKeyword(keyword_object, "object"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_entity), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else if (QCC_PR_CheckKeyword(keyword_string, "string"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_string), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else if (QCC_PR_CheckKeyword(keyword_real, "real"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_float), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else if (QCC_PR_CheckKeyword(keyword_vector, "vector"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_vector), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else if (QCC_PR_CheckKeyword(keyword_pfunc, "pfunc"))
def = QCC_PR_GetDef(QCC_PR_FieldType(type_function), name, NULL, true, 0, GDF_CONST|GDF_SAVED);
else
{
QCC_PR_ParseError(ERR_BADNOTTYPE, "Bad type\n");
QCC_PR_Expect (";");
return;
}
if (!def->initialized)
{
unsigned int u;
def->initialized = 1;
for (u = 0; u < def->type->size*(def->arraysize?def->arraysize:1); u++) //make arrays of fields work.
{
if (*(int *)&def->symboldata[u])
{
QCC_PR_ParseWarning(0, "Field def already has a value:");
QCC_PR_ParsePrintDef(0, def);
}
*(int *)&def->symboldata[u] = pr.size_fields+u;
}
pr.size_fields += u;
}
QCC_PR_Expect (";"); QCC_PR_Expect (";");
return; return;
} }
if (!def->initialized)
{
unsigned int u;
def->initialized = 1;
for (u = 0; u < def->type->size*(def->arraysize?def->arraysize:1); u++) //make arrays of fields work.
{
if (*(int *)&def->symboldata[u])
{
QCC_PR_ParseWarning(0, "Field def already has a value:");
QCC_PR_ParsePrintDef(0, def);
}
*(int *)&def->symboldata[u] = pr.size_fields+u;
}
pr.size_fields += u;
}
QCC_PR_Expect (";");
return;
} }
} }
@ -13956,13 +13969,13 @@ void QCC_PR_ParseDefs (char *classname)
break; break;
} }
type = QCC_PR_ParseType (false, false); basetype = QCC_PR_ParseType (false, false);
if (type == NULL) //ignore if (basetype == NULL) //ignore
return; return;
inlinefunction = type_inlinefunction; inlinefunction = type_inlinefunction;
if (externfnc && type->type != ev_function) if (externfnc && basetype->type != ev_function)
{ {
printf ("Only functions may be defined as external (yet)\n"); printf ("Only functions may be defined as external (yet)\n");
externfnc=false; externfnc=false;
@ -13972,10 +13985,10 @@ void QCC_PR_ParseDefs (char *classname)
{ {
name = QCC_PR_ParseName (); name = QCC_PR_ParseName ();
QCC_PR_Expect("("); QCC_PR_Expect("(");
type = QCC_PR_ParseFunctionTypeReacc(false, type); type = QCC_PR_ParseFunctionTypeReacc(false, basetype);
QCC_PR_Expect(";"); QCC_PR_Expect(";");
def = QCC_PR_GetDef (type, name, NULL, true, 0, false); def = QCC_PR_GetDef (basetype, name, NULL, true, 0, false);
if (autoprototype || dostrip) if (autoprototype || dostrip)
{ //ignore the code and stuff { //ignore the code and stuff
@ -14018,7 +14031,7 @@ void QCC_PR_ParseDefs (char *classname)
{ {
def->referenced = true; def->referenced = true;
f = QCC_PR_ParseImmediateStatements (def, type, false); f = QCC_PR_ParseImmediateStatements (def, basetype, false);
def->initialized = 1; def->initialized = 1;
def->isstatic = isstatic; def->isstatic = isstatic;
@ -14039,6 +14052,7 @@ void QCC_PR_ParseDefs (char *classname)
do do
{ {
isinitialised = false; isinitialised = false;
type = basetype;
if (QCC_PR_CheckToken (";")) if (QCC_PR_CheckToken (";"))
{ {
@ -14062,6 +14076,8 @@ void QCC_PR_ParseDefs (char *classname)
} }
else else
{ {
while (QCC_PR_CheckToken ("*"))
type = QCC_PointerTypeTo(type);
name = QCC_PR_ParseName (); name = QCC_PR_ParseName ();
} }

View file

@ -4267,9 +4267,9 @@ void QCC_SetDefaultProperties (void)
if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) //force on the thinktime keyword if hexen2 progs. if (qcc_targetformat == QCF_HEXEN2 || qcc_targetformat == QCF_FTEH2) //force on the thinktime keyword if hexen2 progs.
{ {
keyword_thinktime = true; keyword_thinktime = true; //thinktime self : 0.1;
keyword_until = true; keyword_until = true; //until(cond) {code}; or do{code}until(cond);
keyword_loop = true; keyword_loop = true; //loop {code};
} }
if ((FWDSLASHARGS && QCC_CheckParm("/Debug"))) //disable any debug optimisations if ((FWDSLASHARGS && QCC_CheckParm("/Debug"))) //disable any debug optimisations

View file

@ -1031,7 +1031,7 @@ void PR_LoadGlabalStruct(qboolean muted)
#endif #endif
} }
progsnum_t AddProgs(const char *name) static progsnum_t AddProgs(const char *name)
{ {
float fl; float fl;
func_t f; func_t f;
@ -1133,7 +1133,7 @@ progsnum_t AddProgs(const char *name)
return num; return num;
} }
void PR_Decompile_f(void) static void PR_Decompile_f(void)
{ {
if (!svprogfuncs) if (!svprogfuncs)
{ {
@ -1147,7 +1147,7 @@ void PR_Decompile_f(void)
else else
svprogfuncs->Decompile(svprogfuncs, Cmd_Argv(1)); svprogfuncs->Decompile(svprogfuncs, Cmd_Argv(1));
} }
void PR_Compile_f(void) static void PR_Compile_f(void)
{ {
qboolean killondone = false; qboolean killondone = false;
int argc=3; int argc=3;
@ -1202,7 +1202,7 @@ void PR_Compile_f(void)
Con_TPrintf("Compile took %f secs\n", time); Con_TPrintf("Compile took %f secs\n", time);
} }
void PR_ApplyCompilation_f (void) static void PR_ApplyCompilation_f (void)
{ {
edict_t *ent; edict_t *ent;
char *s; char *s;
@ -1241,7 +1241,7 @@ void PR_ApplyCompilation_f (void)
svprogfuncs->parms->memfree(s); svprogfuncs->parms->memfree(s);
} }
void PR_BreakPoint_f(void) static void PR_BreakPoint_f(void)
{ {
int wasset; int wasset;
int isset; int isset;
@ -1265,7 +1265,7 @@ void PR_BreakPoint_f(void)
// Cvar_Set(Cvar_FindVar("debugger"), "1"); // Cvar_Set(Cvar_FindVar("debugger"), "1");
} }
void PR_WatchPoint_f(void) static void PR_WatchPoint_f(void)
{ {
char *variable = Cmd_Argv(1); char *variable = Cmd_Argv(1);
int oldself; int oldself;
@ -1320,7 +1320,7 @@ static void PR_SSPoke_f(void)
Con_TPrintf ("not supported.\n"); Con_TPrintf ("not supported.\n");
} }
void PR_SSCoreDump_f(void) static void PR_SSCoreDump_f(void)
{ {
if (!svprogfuncs) if (!svprogfuncs)
{ {
@ -1337,7 +1337,7 @@ void PR_SSCoreDump_f(void)
} }
} }
void PR_SVExtensionList_f(void); static void PR_SVExtensionList_f(void);
/* /*
#ifdef _DEBUG #ifdef _DEBUG
@ -2127,6 +2127,10 @@ qboolean PR_ParseClusterEvent(char *dest, char *source, char *cmd, char *info)
return false; return false;
} }
void SSQC_MapEntityEdited(int modelidx, int idx, const char *newdata)
{
}
qboolean PR_KrimzonParseCommand(char *s) qboolean PR_KrimzonParseCommand(char *s)
{ {
globalvars_t *pr_globals; globalvars_t *pr_globals;
@ -10662,6 +10666,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
// {"matchpattern", PF_Fixme, 0, 0, 0, 538, "float(string s, string pattern, float matchrule)"}, // {"matchpattern", PF_Fixme, 0, 0, 0, 538, "float(string s, string pattern, float matchrule)"},
// {"undefined", PF_Fixme, 0, 0, 0, 539, ""}, // {"undefined", PF_Fixme, 0, 0, 0, 539, ""},
{"physics_supported",PF_physics_supported,0, 0, 0, 0, D("float(optional float force)", "Queries whether rigid body physics is enabled or not. CSQC and SSQC may report different values. If the force argument is used then the engine will try to activate or release physics (returning the new state, which may fail if plugins or dlls are missing). Note that restarting the physics engine is likely to result in hitches when collision trees get generated. The state may change if a plugin is disabled mid-map.")},
#ifdef USERBE #ifdef USERBE
{"physics_enable", PF_physics_enable, 0, 0, 0, 540, D("void(entity e, float physics_enabled)", "Enable or disable the physics attached to a MOVETYPE_PHYSICS entity. Entities which have been disabled in this way will stop taking so much cpu time.")}, {"physics_enable", PF_physics_enable, 0, 0, 0, 540, D("void(entity e, float physics_enabled)", "Enable or disable the physics attached to a MOVETYPE_PHYSICS entity. Entities which have been disabled in this way will stop taking so much cpu time.")},
{"physics_addforce",PF_physics_addforce,0, 0, 0, 541, D("void(entity e, vector force, vector relative_ofs)", "Apply some impulse directional force upon a MOVETYPE_PHYSICS entity.")}, {"physics_addforce",PF_physics_addforce,0, 0, 0, 541, D("void(entity e, vector force, vector relative_ofs)", "Apply some impulse directional force upon a MOVETYPE_PHYSICS entity.")},
@ -11985,13 +11990,13 @@ void PR_DumpPlatform_f(void)
{"TEREDIT_TINT", "const float", CS, NULL, ter_tint}, {"TEREDIT_TINT", "const float", CS, NULL, ter_tint},
{"TEREDIT_RESET_SECT", "const float", CS, NULL, ter_reset}, {"TEREDIT_RESET_SECT", "const float", CS, NULL, ter_reset},
{"TEREDIT_RELOAD_SECT", "const float", CS, NULL, ter_reloadsect}, {"TEREDIT_RELOAD_SECT", "const float", CS, NULL, ter_reloadsect},
{"TEREDIT_ENTS_WIPE", "const float", CS, NULL, ter_ents_wipe}, // {"TEREDIT_ENTS_WIPE", "const float", CS, NULL, ter_ents_wipe_deprecated},
// {"TEREDIT_ENTS_CONCAT", "const float", CS, NULL, ter_ents_concat}, // {"TEREDIT_ENTS_CONCAT", "const float", CS, NULL, ter_ents_concat},
// {"TEREDIT_ENTS_GET", "const float", CS, NULL, ter_ents_get}, // {"TEREDIT_ENTS_GET", "const float", CS, NULL, ter_ents_get},
{"TEREDIT_ENT_GET", "const float", CS, NULL, ter_ent_get}, {"TEREDIT_ENT_GET", "const float", CS, NULL, ter_ent_get},
{"TEREDIT_ENT_SET", "const float", CS, NULL, ter_ent_set}, {"TEREDIT_ENT_SET", "const float", CS, NULL, ter_ent_set},
{"TEREDIT_ENT_ADD", "const float", CS, NULL, ter_ent_add}, {"TEREDIT_ENT_ADD", "const float", CS, NULL, ter_ent_add},
{"TEREDIT_ENT_COUNT", "const float", CS, NULL, ter_ent_count}, {"TEREDIT_ENT_COUNT", "const float", CS, NULL, ter_ent_count},
#endif #endif
{"SLIST_HOSTCACHEVIEWCOUNT", "const float", CS|MENU, NULL, SLIST_HOSTCACHEVIEWCOUNT}, {"SLIST_HOSTCACHEVIEWCOUNT", "const float", CS|MENU, NULL, SLIST_HOSTCACHEVIEWCOUNT},

View file

@ -35,6 +35,7 @@ void PR_SpawnInitialEntities(const char *file);
void PR_RegisterFields(void); void PR_RegisterFields(void);
void PR_Init(void); void PR_Init(void);
void QDECL ED_Spawned (struct edict_s *ent, int loading); void QDECL ED_Spawned (struct edict_s *ent, int loading);
void SSQC_MapEntityEdited(int modelidx, int idx, const char *newdata);
qboolean SV_RunFullQCMovement(struct client_s *client, usercmd_t *ucmd); qboolean SV_RunFullQCMovement(struct client_s *client, usercmd_t *ucmd);
qboolean PR_KrimzonParseCommand(char *s); qboolean PR_KrimzonParseCommand(char *s);
qboolean PR_ParseClusterEvent(char *dest, char *source, char *cmd, char *info); qboolean PR_ParseClusterEvent(char *dest, char *source, char *cmd, char *info);

View file

@ -1060,7 +1060,9 @@ void SV_AutoAddPenalty (client_t *cl, unsigned int banflag, int duration, char *
#define BAN_USER6 (1u<<16)//mod-specified #define BAN_USER6 (1u<<16)//mod-specified
#define BAN_USER7 (1u<<17)//mod-specified #define BAN_USER7 (1u<<17)//mod-specified
#define BAN_USER8 (1u<<18)//mod-specified #define BAN_USER8 (1u<<18)//mod-specified
#define BAN_MAPPER (1u<<19)//mod-specified #define BAN_MAPPER (1u<<19)//player is allowed to use the brush/entity editing clc.
#define BAN_NOLOCALHOST (BAN_BAN|BAN_PERMIT|BAN_SPECONLY) //any attempt to ban localhost is denied, but you can vip, lag, cripple, etc them.
// //
// sv_main.c // sv_main.c

View file

@ -556,6 +556,7 @@ void SV_Map_f (void)
COM_FlushFSCache(false, true); COM_FlushFSCache(false, true);
#ifdef Q2SERVER
if (strlen(level) > 4 && if (strlen(level) > 4 &&
(!strcmp(level + strlen(level)-4, ".cin") || (!strcmp(level + strlen(level)-4, ".cin") ||
!strcmp(level + strlen(level)-4, ".roq") || !strcmp(level + strlen(level)-4, ".roq") ||
@ -565,6 +566,13 @@ void SV_Map_f (void)
cinematic = true; cinematic = true;
} }
else else
#endif
#ifdef TERRAIN
//'map doesntexist.map' should just auto-generate that map or something
if (!Q_strcasecmp("map", COM_FileExtension(level, expanded, sizeof(expanded))))
;
else
#endif
{ {
char *exts[] = {"maps/%s", "maps/%s.bsp", "maps/%s.cm", "maps/%s.hmp", /*"maps/%s.map",*/ NULL}; char *exts[] = {"maps/%s", "maps/%s.bsp", "maps/%s.cm", "maps/%s.hmp", /*"maps/%s.map",*/ NULL};
int i, j; int i, j;
@ -1037,6 +1045,11 @@ void SV_EvaluatePenalties(client_t *cl)
} }
} }
} }
if (delta & BAN_VIP)
Info_SetValueForStarKey(cl->userinfo, "*VIP", (cl->penalties & BAN_VIP)?"1":"", sizeof(cl->userinfo));
if (delta & BAN_MAPPER)
Info_SetValueForStarKey(cl->userinfo, "*mapper", (cl->penalties & BAN_MAPPER)?"1":"", sizeof(cl->userinfo));
} }
static time_t reevaluatebantime; static time_t reevaluatebantime;
@ -1225,12 +1238,6 @@ static void SV_FilterIP_f (void)
return; return;
} }
if (NET_IsLoopBackAddress(&proto.adr))
{
Con_Printf("You're not allowed to filter loopback!\n");
return;
}
s = Cmd_Argv(2); s = Cmd_Argv(2);
proto.banflags = 0; proto.banflags = 0;
while(*s) while(*s)
@ -1258,6 +1265,12 @@ static void SV_FilterIP_f (void)
proto.banflags = filterban.ival?BAN_BAN:BAN_PERMIT; proto.banflags = filterban.ival?BAN_BAN:BAN_PERMIT;
} }
if (NET_IsLoopBackAddress(&proto.adr) && (proto.banflags & BAN_NOLOCALHOST))
{ //do allow them to be muted etc, just not banned outright.
Con_Printf("You're not allowed to filter loopback!\n");
return;
}
s = Cmd_Argv(3); s = Cmd_Argv(3);
if (*s == '+') if (*s == '+')
{ {
@ -1461,6 +1474,12 @@ static void SV_PenaltyToggle (unsigned int banflag, char *penaltyname)
proto.adr.port = 0; proto.adr.port = 0;
proto.adrmask.type = cl->netchan.remote_address.type; proto.adrmask.type = cl->netchan.remote_address.type;
if (NET_IsLoopBackAddress(&proto.adr) && (proto.banflags & BAN_NOLOCALHOST))
{
Con_Printf("You're not allowed to filter loopback!\n");
continue;
}
switch(SV_ToggleBan(&proto, reason)) switch(SV_ToggleBan(&proto, reason))
{ {
case 1: case 1:

View file

@ -781,7 +781,7 @@ static int QDECL Sys_listdirFound(const char *fname, qofs_t fsize, time_t mtime,
return true; return true;
} }
static int Sys_listdir_Sort(const void *va, const void *vb) static int QDECL Sys_listdir_Sort(const void *va, const void *vb)
{ {
const file_t *fa = va; const file_t *fa = va;
const file_t *fb = vb; const file_t *fb = vb;

View file

@ -2553,7 +2553,7 @@ qboolean SV_Physics (void)
#ifdef RAGDOLL #ifdef RAGDOLL
rag_doallanimations(&sv.world); rag_doallanimations(&sv.world);
#endif #endif
sv.world.rbe->Frame(&sv.world, host_frametime, sv_gravity.value); sv.world.rbe->RunFrame(&sv.world, host_frametime, sv_gravity.value);
} }
#endif #endif

View file

@ -717,6 +717,9 @@ int main(int argc, char *argv[])
COM_InitArgv (argc, (const char **)argv); COM_InitArgv (argc, (const char **)argv);
parms.argc = com_argc; parms.argc = com_argc;
parms.argv = com_argv; parms.argv = com_argv;
#ifdef CONFIG_MANIFEST_TEXT
parms.manifest = CONFIG_MANIFEST_TEXT;
#endif
#ifdef __linux__ #ifdef __linux__
if (!COM_CheckParm("-nodumpstack")) if (!COM_CheckParm("-nodumpstack"))

View file

@ -2158,6 +2158,7 @@ void World_RBE_Shutdown(world_t *world)
} }
} }
world->rbe->End(world); world->rbe->End(world);
world->rbe = NULL;
#endif #endif
} }
void QDECL World_UnregisterPhysicsEngine(const char *enginename) void QDECL World_UnregisterPhysicsEngine(const char *enginename)

View file

@ -20,6 +20,7 @@ uniform sampler2D s_t0;
varying vec2 tc; varying vec2 tc;
varying vec4 vc; varying vec4 vc;
uniform vec4 e_colourident; uniform vec4 e_colourident;
uniform vec4 e_lmscale;
void main () void main ()
{ {
vec4 col = texture2D(s_t0, tc); vec4 col = texture2D(s_t0, tc);
@ -27,6 +28,6 @@ void main ()
if (col.a < float(MASK)) if (col.a < float(MASK))
discard; discard;
#endif #endif
gl_FragColor = fog4blend(col * vc * e_colourident); gl_FragColor = fog4blend(col * vc * e_colourident * e_lmscale);
} }
#endif #endif

View file

@ -43,6 +43,9 @@
#if !defined(TESS_CONTROL_SHADER) #if !defined(TESS_CONTROL_SHADER)
varying vec2 tcbase; varying vec2 tcbase;
varying vec3 lightvector; varying vec3 lightvector;
#if defined(VERTEXCOLOURS)
varying vec4 vc;
#endif
#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK) #if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
varying vec3 eyevector; varying vec3 eyevector;
#endif #endif
@ -75,6 +78,9 @@ void main ()
lightvector.y = dot(lightminusvertex, t.xyz); lightvector.y = dot(lightminusvertex, t.xyz);
lightvector.z = dot(lightminusvertex, n.xyz); lightvector.z = dot(lightminusvertex, n.xyz);
#endif #endif
#if defined(VERTEXCOLOURS)
vc = v_colour;
#endif
#if defined(SPECULAR)||defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK) #if defined(SPECULAR)||defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
vec3 eyeminusvertex = e_eyepos - w.xyz; vec3 eyeminusvertex = e_eyepos - w.xyz;
eyevector.x = dot(eyeminusvertex, s.xyz); eyevector.x = dot(eyeminusvertex, s.xyz);
@ -114,6 +120,10 @@ in vec2 tcbase[];
out vec2 t_tcbase[]; out vec2 t_tcbase[];
in vec3 lightvector[]; in vec3 lightvector[];
out vec3 t_lightvector[]; out vec3 t_lightvector[];
#if defined(VERTEXCOLOURS)
in vec4 vc[];
out vec4 t_vc[];
#endif
#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK) #if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
in vec3 eyevector[]; in vec3 eyevector[];
out vec3 t_eyevector[]; out vec3 t_eyevector[];
@ -126,6 +136,9 @@ void main()
t_normal[id] = normal[id]; t_normal[id] = normal[id];
t_tcbase[id] = tcbase[id]; t_tcbase[id] = tcbase[id];
t_lightvector[id] = lightvector[id]; t_lightvector[id] = lightvector[id];
#if defined(VERTEXCOLOURS)
t_vc[id] = vc[id];
#endif
#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK) #if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
t_eyevector[id] = eyevector[id]; t_eyevector[id] = eyevector[id];
#endif #endif
@ -152,6 +165,9 @@ in vec3 t_vertex[];
in vec3 t_normal[]; in vec3 t_normal[];
in vec2 t_tcbase[]; in vec2 t_tcbase[];
in vec3 t_lightvector[]; in vec3 t_lightvector[];
#if defined(VERTEXCOLOURS)
in vec4 t_vc[];
#endif
#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK) #if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
in vec3 t_eyevector[]; in vec3 t_eyevector[];
#endif #endif
@ -175,6 +191,9 @@ void main()
//FIXME: we should be recalcing these here, instead of just lerping them //FIXME: we should be recalcing these here, instead of just lerping them
lightvector = LERP(t_lightvector); lightvector = LERP(t_lightvector);
#if defined(VERTEXCOLOURS)
vc = LERP(t_vc);
#endif
#if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK) #if defined(SPECULAR) || defined(OFFSETMAPPING) || defined(REFLECTCUBEMASK)
eyevector = LERP(t_eyevector); eyevector = LERP(t_eyevector);
#endif #endif
@ -221,9 +240,12 @@ void main ()
#define tcbase tcoffsetmap #define tcbase tcoffsetmap
#endif #endif
#if defined(FLAT) #if defined(FLAT)
vec3 bases = vec3(FLAT); vec4 bases = vec3(FLAT, 1.0);
#else #else
vec3 bases = vec3(texture2D(s_diffuse, tcbase)); vec4 bases = texture2D(s_diffuse, tcbase);
#ifdef VERTEXCOLOURS
bases.rgb *= bases.a;
#endif
#endif #endif
#ifdef UPPER #ifdef UPPER
vec4 uc = texture2D(s_upper, tcbase); vec4 uc = texture2D(s_upper, tcbase);
@ -245,14 +267,14 @@ void main ()
vec3 diff; vec3 diff;
#ifdef NOBUMP #ifdef NOBUMP
//surface can only support ambient lighting, even for lights that try to avoid it. //surface can only support ambient lighting, even for lights that try to avoid it.
diff = bases * (l_lightcolourscale.x+l_lightcolourscale.y); diff = bases.rgb * (l_lightcolourscale.x+l_lightcolourscale.y);
#else #else
vec3 nl = normalize(lightvector); vec3 nl = normalize(lightvector);
#ifdef BUMP #ifdef BUMP
diff = bases * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(bumps, nl), 0.0)); diff = bases.rgb * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(bumps, nl), 0.0));
#else #else
//we still do bumpmapping even without bumps to ensure colours are always sane. light.exe does it too. //we still do bumpmapping even without bumps to ensure colours are always sane. light.exe does it too.
diff = bases * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(vec3(0.0, 0.0, 1.0), nl), 0.0)); diff = bases.rgb * (l_lightcolourscale.x + l_lightcolourscale.y * max(dot(vec3(0.0, 0.0, 1.0), nl), 0.0));
#endif #endif
#endif #endif
@ -278,6 +300,9 @@ void main ()
#if defined(PROJECTION) #if defined(PROJECTION)
/*2d projection, not used*/ /*2d projection, not used*/
// diff *= texture2d(s_projectionmap, shadowcoord); // diff *= texture2d(s_projectionmap, shadowcoord);
#endif
#if defined(VERTEXCOLOURS)
diff *= vc.rgb * vc.a;
#endif #endif
gl_FragColor.rgb = fog3additive(diff*colorscale*l_lightcolour); gl_FragColor.rgb = fog3additive(diff*colorscale*l_lightcolour);

View file

@ -825,9 +825,9 @@ console.log("onload: " + _url + " status " + http.status);
http.onerror = function(e) http.onerror = function(e)
{ {
console.log("onerror: " + _url + " status " + http.status); console.log("onerror: " + _url);
if (onerror) if (onerror)
Runtime.dynCall('vii', onerror, [ctx, http.status]); Runtime.dynCall('vii', onerror, [ctx, 0]);
}; };
http.onprogress = function(e) http.onprogress = function(e)

View file

@ -214,6 +214,9 @@ int QDECL main(int argc, char **argv)
parms.argc = argc; parms.argc = argc;
parms.argv = (const char**)argv; parms.argv = (const char**)argv;
#ifdef CONFIG_MANIFEST_TEXT
parms.manifest = CONFIG_MANIFEST_TEXT;
#endif
COM_InitArgv (parms.argc, parms.argv); COM_InitArgv (parms.argc, parms.argv);

View file

@ -1,18 +1,18 @@
#windows is special as always, but we don't support itanium, and microsoft don't support anything else (not even arm with the nt win32 api) #windows is special as always, but we don't support itanium, and microsoft don't support anything else (not even arm with the nt win32 api)
ifeq ($(FTE_TARGET),win32) ifeq ($(FTE_TARGET),win32)
PLUG_NATIVE_EXT=_x86.dll PLUG_NATIVE_EXT=_x86.dll
PLUG_LDFLAGS= PLUG_LDFLAGS=
PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw-libs -lzlib PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw-libs -lzlib
BITS=32 BITS=32
PLUG_LDFLAGS_DL= PLUG_LDFLAGS_DL=
endif endif
ifeq ($(FTE_TARGET),win64) ifeq ($(FTE_TARGET),win64)
PLUG_NATIVE_EXT=_x64.dll PLUG_NATIVE_EXT=_x64.dll
PLUG_LDFLAGS=-Wl,--support-old-code PLUG_LDFLAGS=-Wl,--support-old-code
PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw64-libs -lz PLUG_LDFLAGS_ZLIB=-L../engine/libs/mingw64-libs -lz
BITS=64 BITS=64
PLUG_LDFLAGS_DL= PLUG_LDFLAGS_DL=
endif endif
PLUG_LDFLAGS_DL?=-ldl PLUG_LDFLAGS_DL?=-ldl
@ -20,50 +20,50 @@ PLUG_LDFLAGS?=-L/usr/local/lib -Wl,-R/usr/local/lib -lm
PLUG_LDFLAGS_ZLIB?=-lz PLUG_LDFLAGS_ZLIB?=-lz
ifneq ($(PLUG_NATIVE_EXT),) ifneq ($(PLUG_NATIVE_EXT),)
#if we're on windows, we'll put our windows-specific hacks here. #if we're on windows, we'll put our windows-specific hacks here.
PLUG_DEFFILE=plugin.def PLUG_DEFFILE=plugin.def
PLUG_CFLAGS= PLUG_CFLAGS=
PLUG_CXXFLAGS= PLUG_CXXFLAGS=
endif endif
#cygwin uses dll naming. #cygwin uses dll naming.
ifeq ($(FTE_TARGET),cygwin) ifeq ($(FTE_TARGET),cygwin)
ifeq ($(BITS),64) ifeq ($(BITS),64)
PLUG_DEFFILE=plugin.def PLUG_DEFFILE=plugin.def
PLUG_NATIVE_EXT=_amd64.dll PLUG_NATIVE_EXT=_amd64.dll
endif endif
ifneq ($(BITS),64) ifneq ($(BITS),64)
PLUG_DEFFILE=plugin.def PLUG_DEFFILE=plugin.def
PLUG_NATIVE_EXT=_x86.dll PLUG_NATIVE_EXT=_x86.dll
endif endif
endif endif
#if they're not on windows, we'll try asking the compiler directly #if they're not on windows, we'll try asking the compiler directly
#the check to see if its already set is to avoid asking msvc, which would probably break things. #the check to see if its already set is to avoid asking msvc, which would probably break things.
ifeq ($(PLUG_NATIVE_EXT),) ifeq ($(PLUG_NATIVE_EXT),)
LIBRESOLV=-lresolv LIBRESOLV=-lresolv
ifneq ($(shell echo|$(CC) -E -dM -|grep __amd64__),) ifneq ($(shell echo|$(CC) -E -dM -|grep __amd64__),)
#either x32 or x64 ABIs #either x32 or x64 ABIs
ifneq ($(shell echo|$(CC) -E -dM -|grep __ILP32__),) ifneq ($(shell echo|$(CC) -E -dM -|grep __ILP32__|grep 1),)
PLUG_NATIVE_EXT=_x32.so PLUG_NATIVE_EXT=_x32.so
else else
PLUG_NATIVE_EXT=_amd64.so PLUG_NATIVE_EXT=_amd64.so
endif
endif endif
endif ifneq ($(shell echo|$(CC) -E -dM -|grep __i386__),)
ifneq ($(shell echo|$(CC) -E -dM -|grep __i386__),) PLUG_NATIVE_EXT=_x86.so
PLUG_NATIVE_EXT=_x86.so endif
endif ifneq ($(shell echo|$(CC) -E -dM -|grep __arm__),)
ifneq ($(shell echo|$(CC) -E -dM -|grep __arm__),) #gnueabi[hf]
#gnueabi[hf] ifneq ($(shell echo|$(CC) -E -dM -|grep __SOFTFP__),)
ifneq ($(shell echo|$(CC) -E -dM -|grep __SOFTFP__),) PLUG_NATIVE_EXT=_arm.so
PLUG_NATIVE_EXT=_arm.so else
else PLUG_NATIVE_EXT=_armhf.so
PLUG_NATIVE_EXT=_armhf.so endif
endif
ifneq ($(shell echo|$(CC) -E -dM -|grep __ppc__),)
PLUG_NATIVE_EXT=_ppc.so
endif endif
endif
ifneq ($(shell echo|$(CC) -E -dM -|grep __ppc__),)
PLUG_NATIVE_EXT=_ppc.so
endif
endif endif
#fallback #fallback

File diff suppressed because it is too large Load diff