diff --git a/engine/Makefile b/engine/Makefile index 1d610acdf..fbdf30a63 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -140,8 +140,8 @@ endif USER_TARGET:=$(FTE_TARGET) #make droid-rel doesn't get the right stuff -#add a small default config file. its only small. -DROID_PACKSU?= $(BASE_DIR)/droid/fte.cfg +#add a small default config file. its only small. and some other stuff, because we can. This makes it much easier to get it up and running. +DROID_PACKSU?= $(BASE_DIR)/droid/fte.cfg $(BASE_DIR)/droid/default.fmf $(BASE_DIR)/droid/configs/touch.cfg ANDROID_NDK_ROOT?=~/android-ndk-r8e ANDROID_HOME?=~/android-sdk-linux ANT?=ant diff --git a/engine/client/m_download.c b/engine/client/m_download.c index 0fa0c9f2e..c9b6c7891 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -1,5 +1,6 @@ //copyright 'Spike', license gplv2+ //provides both a package manager and downloads menu. +//FIXME: block downloads of exe/dll/so/etc if not an https url (even if inside zips). also block such files from package lists over http. #include "quakedef.h" #ifdef WEBCLIENT @@ -1437,9 +1438,6 @@ static void PM_ListDownloaded(struct dl_download *dl) f = dl->file; dl->file = NULL; - if (!availablepackages) - Con_Printf("ZOMG NO PACKAGES\n"); - i = dl->user_num; if (dl != downloadablelist[i].curdl) diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 82343d279..8c36bf5f4 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -2300,7 +2300,7 @@ void CheckCustomMode(struct menu_s *menu) info->hzfixed->common.ishidden = true; for (i = 0; i < ASPECT_RATIOS; i++) info->ressize[i]->common.ishidden = true; - if (info->dispmode->selectedoption != 2) + if (!info->dispmode || info->dispmode->selectedoption != 2) { info->resmode->common.ishidden = false; sel = info->resmode->selectedoption; @@ -2481,9 +2481,39 @@ void M_Menu_Video_f (void) { extern cvar_t v_contrast, vid_conwidth, vid_conheight; // extern cvar_t vid_width, vid_height, vid_preservegamma, vid_hardwaregamma, vid_desktopgamma; - extern cvar_t vid_fullscreen, vid_desktopsettings, vid_conautoscale; + extern cvar_t vid_desktopsettings, vid_conautoscale; extern cvar_t vid_bpp, vid_refreshrate, vid_multisample; +#ifdef ANDROID + extern cvar_t sys_orientation; + static const char *orientationopts[] = { + "Auto", + "Landscape", + "Portrait", + "Reverse Landscape", + "Reverse Portrait", + NULL + }; + static const char *orientationvalues[] = { + "", + "landscape", + "portrait", + "reverselandscape", + "reverseportrait", + NULL + }; + extern cvar_t sys_glesversion_cvar; + static const char *glesopts[] = { + "GLES 1", + "GLES 2", + NULL + }; + static const char *glesvalues[] = { + "1", + "2", + NULL + }; +#else extern cvar_t vid_renderer; static const char *rendererops[] = { @@ -2544,6 +2574,7 @@ void M_Menu_Video_f (void) NULL }; + extern cvar_t vid_fullscreen; static const char *fullscreenopts[] = { "Windowed", "Fullscreen", @@ -2551,6 +2582,7 @@ void M_Menu_Video_f (void) NULL }; static const char *fullscreenvalues[] = {"0", "1", "2", NULL}; +#endif static const char *aaopts[] = { "1x", @@ -2612,6 +2644,8 @@ void M_Menu_Video_f (void) NULL }; static const char *scalevalues[] = { "1", "1.5", "2", "2.5", "3", "4", "5", "6", NULL}; + + /* static const char *vsyncoptions[] = { @@ -2651,8 +2685,13 @@ void M_Menu_Video_f (void) { MB_REDTEXT("Video Options", true), MB_TEXT("^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082", true), +#ifdef ANDROID + MB_COMBOCVAR("Orientation", sys_orientation, orientationopts, orientationvalues, NULL), + MB_COMBOCVAR("GLES Version", sys_glesversion_cvar, glesopts, glesvalues, NULL), +#else MB_COMBOCVAR("Renderer", vid_renderer, rendererops, renderervalues, NULL), MB_COMBOCVARRETURN("Display Mode", vid_fullscreen, fullscreenopts, fullscreenvalues, info->dispmode, vid_fullscreen.description), +#endif MB_COMBOCVAR("Anti-aliasing", vid_multisample, aaopts, aavalues, NULL), MB_REDTEXT(current3dres, true), MB_COMBORETURN("Aspect", resmodeopts, resmodechoice, info->resmode, "Select method for determining or configuring display options. The desktop option will attempt to use the width, height, color depth, and refresh from your operating system's desktop environment."), diff --git a/engine/client/menu.h b/engine/client/menu.h index 24a99b3be..cd40b893e 100644 --- a/engine/client/menu.h +++ b/engine/client/menu.h @@ -449,7 +449,7 @@ void M_UnbindCommand (const char *command); #else //no builtin menu code. //stubs -#define M_Menu_Prompt(cb,ctx,m1,m2,m3,optionyes,optionno,optioncancel) (cb)(ctx,-1) +#define M_Menu_Prompt(cb,ctx,messages,optionyes,optionno,optioncancel) (cb)(ctx,-1) #define M_ToggleMenu_f() Cbuf_AddText("togglemenu\n",RESTRICT_LOCAL) //#define M_Shutdown(t) MP_Shutdown() diff --git a/engine/client/sys_droid.c b/engine/client/sys_droid.c index e03d276de..0b6d509fa 100644 --- a/engine/client/sys_droid.c +++ b/engine/client/sys_droid.c @@ -35,11 +35,11 @@ static char sys_basedir[MAX_OSPATH]; static char sys_basepak[MAX_OSPATH]; extern jmp_buf host_abort; -cvar_t sys_vibrate = CVARD("sys_vibrate", "1", "Enables the system vibrator for damage events and such things. The value provided is a duration scaler."); +cvar_t sys_vibrate = CVARFD("sys_vibrate", "1", CVAR_ARCHIVE, "Enables the system vibrator for damage events and such things. The value provided is a duration scaler."); cvar_t sys_osk = CVAR("sys_osk", "0"); //to be toggled -cvar_t sys_keepscreenon = CVARD("sys_keepscreenon", "1", "If set, the screen will never darken. This might cost some extra battery power, but then so will running a 3d engine."); //to be toggled -cvar_t sys_orientation = CVARD("sys_orientation", "landscape", "Specifies what angle to render quake at.\nValid values are: sensor (autodetect), landscape, portrait, reverselandscape, reverseportrait"); -cvar_t sys_glesversion_cvar = CVARD("sys_glesversion", "1", "Specifies which version of gles to use. 1 or 2 are valid values."); +cvar_t sys_keepscreenon = CVARFD("sys_keepscreenon", "1", CVAR_ARCHIVE, "If set, the screen will never darken. This might cost some extra battery power, but then so will running a 3d engine."); //to be toggled +cvar_t sys_orientation = CVARFD("sys_orientation", "landscape", CVAR_ARCHIVE, "Specifies what angle to render quake at.\nValid values are: sensor (autodetect), landscape, portrait, reverselandscape, reverseportrait"); +cvar_t sys_glesversion_cvar = CVARFD("sys_glesversion", "1", CVAR_ARCHIVE, "Specifies which version of gles to use. 1 or 2 are valid values."); extern cvar_t vid_conautoscale; @@ -264,7 +264,7 @@ JNIEXPORT void JNICALL Java_com_fteqw_FTEDroidEngine_init(JNIEnv *env, jobject o parms.argv = args; tmp = (*env)->GetStringUTFChars(env, japkpath, NULL); - Q_strncpyz(sys_basepak, tmp, sizeof(sys_basedir)); + Q_strncpyz(sys_basepak, tmp, sizeof(sys_basepak)); (*env)->ReleaseStringUTFChars(env, japkpath, tmp); tmp = (*env)->GetStringUTFChars(env, jusrpath, NULL); diff --git a/engine/common/fs.c b/engine/common/fs.c index c225b9623..0efb59ff2 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -3420,8 +3420,8 @@ void FS_ReloadPackFilesFlags(unsigned int reloadflags) searchpathfuncs_t *pak; vfsfile_t *vfs = VFSOS_Open(pakname, "rb"); pak = FS_OpenPackByExtension(vfs, pakname); - if (pak) - FS_AddPathHandle(&oldpaths, "", pakname, pak, "", SPF_COPYPROTECTED|SPF_EXPLICIT, reloadflags); + if (pak) //logically should have SPF_EXPLICIT set, but that would give it a worse gamedir depth + FS_AddPathHandle(&oldpaths, "", pakname, pak, "", SPF_COPYPROTECTED, reloadflags); i = COM_CheckNextParm ("-basepack", i); } @@ -4884,11 +4884,27 @@ qboolean FS_FoundManifest(void *usr, ftemanifest_t *man) //if fixedbasedir is true, stuff like -quake won't override/change the active basedir (ie: -basedir or gamedir switching without breaking gamedir) ftemanifest_t *FS_ReadDefaultManifest(char *newbasedir, size_t newbasedirsize, qboolean fixedbasedir) { + int i; int game = -1; ftemanifest_t *man = NULL; vfsfile_t *f; + //commandline generally takes precedence + if (!man && game == -1) + { + int i; + for (i = 0; gamemode_info[i].argname; i++) + { + if (COM_CheckParm(gamemode_info[i].argname)) + { + game = i; + break; + } + } + } + + //hopefully this will be used for TCs. if (!man && game == -1) { #ifdef BRANDING_NAME @@ -4912,19 +4928,41 @@ ftemanifest_t *FS_ReadDefaultManifest(char *newbasedir, size_t newbasedirsize, q } } - if (!man && game == -1) + //-basepack is primarily an android feature + i = COM_CheckParm ("-basepack"); + while (!man && game == -1 && i && i < com_argc-1) { - int i; - for (i = 0; gamemode_info[i].argname; i++) + const char *pakname = com_argv[i+1]; + searchpathfuncs_t *pak; + vfsfile_t *vfs = VFSOS_Open(pakname, "rb"); + pak = FS_OpenPackByExtension(vfs, pakname); + if (pak) { - if (COM_CheckParm(gamemode_info[i].argname)) + flocation_t loc; + if (pak->FindFile(pak, &loc, "default.fmf", NULL)) { - game = i; - break; + f = pak->OpenVFS(pak, &loc, "rb"); + if (f) + { + size_t len = VFS_GETLEN(f); + char *fdata = BZ_Malloc(len+1); + if (fdata) + { + VFS_READ(f, fdata, len); + fdata[len] = 0; + man = FS_Manifest_Parse(NULL, fdata); + man->security = MANIFEST_SECURITY_DEFAULT; + BZ_Free(fdata); + } + VFS_CLOSE(f); + } } + pak->ClosePath(pak); } + i = COM_CheckNextParm ("-basepack", i); } + if (!man && game == -1 && host_parms.manifest) { man = FS_Manifest_Parse(va("%sdefault.fmf", newbasedir), host_parms.manifest); diff --git a/engine/dotnet2005/ftequake.vcproj b/engine/dotnet2005/ftequake.vcproj index 6cc128fe4..88fc45f6a 100644 --- a/engine/dotnet2005/ftequake.vcproj +++ b/engine/dotnet2005/ftequake.vcproj @@ -1491,7 +1491,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="../libs/speex;..\client;../libs/freetype2/include;../common;../server;../gl;../sw;../qclib;../libs;../libs/dxsdk9/include;../libs/dxsdk7/include" - PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;GLQUAKE;D3D9QUAKE;D3D11QUAKE;SWQUAKE;VKQUAKE;MULTITHREAD;USE_MSVCRT_DEBUG" + PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;GLQUAKE;D3D8QUAKE;D3D9QUAKE;D3D11QUAKE;SWQUAKE;VKQUAKE;MULTITHREAD;USE_MSVCRT_DEBUG" BasicRuntimeChecks="3" RuntimeLibrary="1" FloatingPointModel="2" @@ -29907,6 +29907,14 @@ RelativePath="..\d3d\d3d11_shader.c" > + + + + @@ -29927,6 +29935,10 @@ RelativePath="..\d3d\vid_d3d11.c" > + + @@ -11,7 +11,7 @@ @@ -20,6 +20,14 @@ + + + + + + + + diff --git a/engine/droid/configs/touch.cfg b/engine/droid/configs/touch.cfg index 4cbd20b43..2bc9ec30f 100644 --- a/engine/droid/configs/touch.cfg +++ b/engine/droid/configs/touch.cfg @@ -1,13 +1,13 @@ showpic_removeall sv_aim 0.90 //quake style, avoid needing to pitch too much -showpic gfx/touch_forward.png forward 96 -88 bm 32 32 +forward -showpic gfx/touch_back.png moveback 96 -56 bm 32 32 +back -showpic gfx/touch_moveleft.png moveleft 64 -56 bm 32 32 +moveleft -showpic gfx/touch_moveright.png moveright 128 -56 bm 32 32 +moveright +showpic res/drawable/touch_moveforward.tga forward -16 -88 bm 32 32 +forward +showpic res/drawable/touch_moveback.tga moveback -16 -56 bm 32 32 +back +showpic res/drawable/touch_moveleft.tga moveleft -48 -56 bm 32 32 +moveleft +showpic res/drawable/touch_moveright.tga moveright 16 -56 bm 32 32 +moveright -showpic gfx/touch_attack.png attack 32 -56 bm 32 32 +attack -showpic gfx/touch_jump.png jump 160 -56 bm 32 32 +jump +showpic res/drawable/touch_attack.tga attack -80 -56 bm 32 32 +attack +showpic res/drawable/touch_jump.tga jump 48 -56 bm 32 32 +jump -showpic gfx/touch_turnleft.png turnleft 0 -56 bm 32 32 +left -showpic gfx/touch_turnright.png turnright 192 -56 bm 32 32 +right +showpic res/drawable/touch_turnleft.tga turnleft -112 -56 bm 32 32 +left +showpic res/drawable/touch_turnright.tga turnright 80 -56 bm 32 32 +right diff --git a/engine/droid/default.fmf b/engine/droid/default.fmf new file mode 100644 index 000000000..cc8cbc15e --- /dev/null +++ b/engine/droid/default.fmf @@ -0,0 +1,23 @@ +//documentation on this file can be found at https://sourceforge.net/p/fteqw/code/HEAD/tree/trunk/specs/fte_manifests.txt + +FTEManifestVer 1 +game afterquake +name "AfterQuake" +//listing dp here allows listing public dp servers, but still won't be listed inside dp +protocolname "FTE-Quake DarkPlaces-Quake" +basegame id1 +basegame qw +basegame *fte +disablehomedir 1 + +//first, so we don't favour it over pak1.pak +//avoids distributing the demo as anything other than the demo. +package id1/gpl_maps.pk3 +archivedpackage id1/pak0.pak - id1/pak0.pak http://triptohell.info/moodles/live/QUAKE_SW.zip +package id1/pak1.pak +package id1/new_playermodel_only.pak + +//autoupdate stuff +//FIME FIXME FIXME - on android we have no https support +downloadsurl "http://fte.triptohell.info/downloadables.php" +install "AfterQuake - Minimum" diff --git a/engine/droid/fte.cfg b/engine/droid/fte.cfg index 094222d6b..b1b55fa75 100644 --- a/engine/droid/fte.cfg +++ b/engine/droid/fte.cfg @@ -15,4 +15,4 @@ vid_conwidth "0" //make something up based upon aspect ratio vid_conheight "300" //not using autoscale as it can make the menu unusable. vid_conautoscale "0" // Text/Menu size. 2 is the default. 4 is bigger -exec configs/touch.cfg +exec touch.cfg diff --git a/engine/droid/res/drawable-hdpi/icon.png b/engine/droid/res/drawable-hdpi/icon.png index 8ac009c91..288987f98 100644 Binary files a/engine/droid/res/drawable-hdpi/icon.png and b/engine/droid/res/drawable-hdpi/icon.png differ diff --git a/engine/droid/res/drawable-ldpi/icon.png b/engine/droid/res/drawable-ldpi/icon.png index 5b506ad38..1fa6d3c6f 100644 Binary files a/engine/droid/res/drawable-ldpi/icon.png and b/engine/droid/res/drawable-ldpi/icon.png differ diff --git a/engine/droid/res/drawable-mdpi/icon.png b/engine/droid/res/drawable-mdpi/icon.png index 75212a197..f6b45bf2f 100644 Binary files a/engine/droid/res/drawable-mdpi/icon.png and b/engine/droid/res/drawable-mdpi/icon.png differ diff --git a/engine/droid/res/drawable-xhdpi/icon.png b/engine/droid/res/drawable-xhdpi/icon.png new file mode 100644 index 000000000..d6bf9d896 Binary files /dev/null and b/engine/droid/res/drawable-xhdpi/icon.png differ diff --git a/engine/droid/res/drawable-xxhdpi/icon.png b/engine/droid/res/drawable-xxhdpi/icon.png new file mode 100644 index 000000000..2b9e45661 Binary files /dev/null and b/engine/droid/res/drawable-xxhdpi/icon.png differ diff --git a/engine/droid/res/drawable/icon.png b/engine/droid/res/drawable/icon.png new file mode 100644 index 000000000..9015ee19e Binary files /dev/null and b/engine/droid/res/drawable/icon.png differ diff --git a/engine/droid/res/drawable/touch_attack.tga b/engine/droid/res/drawable/touch_attack.tga new file mode 100644 index 000000000..6858563a0 Binary files /dev/null and b/engine/droid/res/drawable/touch_attack.tga differ diff --git a/engine/droid/res/drawable/touch_jump.tga b/engine/droid/res/drawable/touch_jump.tga new file mode 100644 index 000000000..174bc5be9 Binary files /dev/null and b/engine/droid/res/drawable/touch_jump.tga differ diff --git a/engine/droid/res/drawable/touch_moveback.tga b/engine/droid/res/drawable/touch_moveback.tga new file mode 100644 index 000000000..5006f223f Binary files /dev/null and b/engine/droid/res/drawable/touch_moveback.tga differ diff --git a/engine/droid/res/drawable/touch_moveforward.tga b/engine/droid/res/drawable/touch_moveforward.tga new file mode 100644 index 000000000..4f0e8f5d0 Binary files /dev/null and b/engine/droid/res/drawable/touch_moveforward.tga differ diff --git a/engine/droid/res/drawable/touch_moveleft.tga b/engine/droid/res/drawable/touch_moveleft.tga new file mode 100644 index 000000000..22b504310 Binary files /dev/null and b/engine/droid/res/drawable/touch_moveleft.tga differ diff --git a/engine/droid/res/drawable/touch_moveright.tga b/engine/droid/res/drawable/touch_moveright.tga new file mode 100644 index 000000000..2045f9ca6 Binary files /dev/null and b/engine/droid/res/drawable/touch_moveright.tga differ diff --git a/engine/droid/res/drawable/touch_turnleft.tga b/engine/droid/res/drawable/touch_turnleft.tga new file mode 100644 index 000000000..6d733267b Binary files /dev/null and b/engine/droid/res/drawable/touch_turnleft.tga differ diff --git a/engine/droid/res/drawable/touch_turnright.tga b/engine/droid/res/drawable/touch_turnright.tga new file mode 100644 index 000000000..b6ee5c080 Binary files /dev/null and b/engine/droid/res/drawable/touch_turnright.tga differ diff --git a/engine/droid/src/com/fteqw/FTEDroidActivity.java b/engine/droid/src/com/fteqw/FTEDroidActivity.java index e972de320..1fecad079 100644 --- a/engine/droid/src/com/fteqw/FTEDroidActivity.java +++ b/engine/droid/src/com/fteqw/FTEDroidActivity.java @@ -495,6 +495,9 @@ public class FTEDroidActivity extends Activity ori = 9;//android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT; else if (ors.equalsIgnoreCase("fullsensor")) ori = 10;//android.content.pm.ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR; + //and the default, because specifying it again is always useless. + else + ori = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_SENSOR; android.util.Log.i("FTEDroid", "Orientation changed to " + ori + " (" + ors + ")."); act.setRequestedOrientation(ori); } diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 442af6c2e..e672a29e3 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -1889,7 +1889,11 @@ void Mod_LoadLighting (model_t *loadmodel, qbyte *mod_base, lump_t *l, qboolean lightmodel = loadmodel; relitsurface = 0; } - else if (!lightmodel && r_deluxmapping_cvar.value>1 && r_deluxmapping && !luxdata && !(r_shadow_realtime_world.ival && r_shadow_realtime_world_lightmaps.value<=0)) + else if (!lightmodel && r_deluxmapping_cvar.value>1 && r_deluxmapping && !luxdata +#ifdef RTLIGHTS + && !(r_shadow_realtime_world.ival && r_shadow_realtime_world_lightmaps.value<=0) +#endif + ) { //if deluxemapping is on, generate missing lux files a little more often, but don't bother if we have rtlights on anyway. writelitfile = false; numlightdata = l->filelen; diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 4696453df..ee36d5c10 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -7050,12 +7050,10 @@ const char *SV_CheckRejectConnection(netadr_t *adr, const char *uinfo, unsigned } Info_SetValueForKey(clfeatures, "basicprotocol", bp, sizeof(clfeatures)); Info_SetValueForKey(clfeatures, "guid", guid, sizeof(clfeatures)); - Info_SetValueForKey(clfeatures, "maxsounds", "256", sizeof(clfeatures)); - Info_SetValueForKey(clfeatures, "maxmodels", "256", sizeof(clfeatures)); //this is not the limits of the client itself, but the limits that the server is able and willing to send to them. - if ((pext1 & PEXT_SOUNDDBL) || (protocol == SCP_BJP3 || protocol == SCP_FITZ666 || protocol == SCP_DARKPLACES6) || (protocol == SCP_DARKPLACES7)) + if ((pext1 & PEXT_SOUNDDBL) || (pext2 & PEXT2_REPLACEMENTDELTAS) || (protocol == SCP_BJP3 || protocol == SCP_FITZ666 || protocol == SCP_DARKPLACES6) || (protocol == SCP_DARKPLACES7)) Info_SetValueForKey(clfeatures, "maxsounds", va("%i", MAX_PRECACHE_SOUNDS), sizeof(clfeatures)); else Info_SetValueForKey(clfeatures, "maxsounds", "256", sizeof(clfeatures)); diff --git a/engine/server/sv_ents.c b/engine/server/sv_ents.c index a900ae58a..2e319fb87 100644 --- a/engine/server/sv_ents.c +++ b/engine/server/sv_ents.c @@ -798,7 +798,7 @@ void SVQW_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, if (to->dpflags != from->dpflags && (protext & PEXT_DPFLAGS)) evenmorebits |= U_DPFLAGS; - if ((to->tagentity != from->tagentity || to->tagindex != from->tagindex) && (protext & PEXT_DPFLAGS)) + if ((to->tagentity != from->tagentity || to->tagindex != from->tagindex) && (protext & PEXT_SETATTACHMENT)) evenmorebits |= U_TAGINFO; if ((to->light[0] != from->light[0] || to->light[1] != from->light[1] || to->light[2] != from->light[2] || to->light[3] != from->light[3] || to->lightstyle != from->lightstyle || to->lightpflags != from->lightstyle) && (protext & PEXT_DPFLAGS)) diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 33582e33d..c08db060a 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -1792,7 +1792,7 @@ void SV_ClientProtocolExtensionsChanged(client_t *client) //you need to reconnect for this to update, of course. so make sure its not *too* low... client->max_net_ents = bound(512, pr_maxedicts.ival, MAX_EDICTS); - client->maxmodels = MAX_PRECACHE_MODELS; //protocol limited to 14 bits. + client->maxmodels = min(1u<<14, MAX_PRECACHE_MODELS); //protocol limited to 14 bits. } else if (ISQWCLIENT(client)) //readd? { @@ -1804,7 +1804,7 @@ void SV_ClientProtocolExtensionsChanged(client_t *client) client->max_net_ents += 1024; if (client->fteprotocolextensions & PEXT_MODELDBL) - client->maxmodels = MAX_PRECACHE_MODELS; + client->maxmodels = 512; } else if (ISDPCLIENT(client)) { diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index 2d5210216..5acd08be7 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -1240,44 +1240,6 @@ qboolean SV_MVDWritePackets (int num) return true; } -// table of readable characters, same as ezquake -char readable[256] = -{ - '.', '_', '_', '_', '_', '.', '_', '_', - '_', '_', '\n', '_', '\n', '>', '.', '.', - '[', ']', '0', '1', '2', '3', '4', '5', - '6', '7', '8', '9', '.', '_', '_', '_', - ' ', '!', '\"', '#', '$', '%', '&', '\'', - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', - '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', - 'x', 'y', 'z', '{', '|', '}', '~', '_', - '_', '_', '_', '_', '_', '.', '_', '_', - '_', '_', '_', '_', '_', '>', '.', '.', - '[', ']', '0', '1', '2', '3', '4', '5', - '6', '7', '8', '9', '.', '_', '_', '_', - ' ', '!', '\"', '#', '$', '%', '&', '\'', - '(', ')', '*', '+', ',', '-', '.', '/', - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', ':', ';', '<', '=', '>', '?', - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', - 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', - 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', - 'X', 'Y', 'Z', '[', '\\', ']', '^', '_', - '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', - 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', - 'x', 'y', 'z', '{', '|', '}', '~', '_' -}; -#define chartbl readable - void MVD_Init (void) { #define MVDVARGROUP "Server MVD cvars" @@ -1707,9 +1669,12 @@ qboolean SV_MVD_Record (mvddest_t *dest) #ifdef PEXT_VIEW2 demo.recorder.fteprotocolextensions |= PEXT_VIEW2; #endif - demo.recorder.fteprotocolextensions2 = PEXT2_VOICECHAT | PEXT2_SETANGLEDELTA | PEXT2_PRYDONCURSOR | (pext_replacementdeltas.ival?PEXT2_REPLACEMENTDELTAS:0); + demo.recorder.fteprotocolextensions2 = PEXT2_VOICECHAT | PEXT2_SETANGLEDELTA | /*PEXT2_PRYDONCURSOR |*/ (pext_replacementdeltas.ival?PEXT2_REPLACEMENTDELTAS:0); /*enable these, because we might as well (stat ones are always useful)*/ demo.recorder.zquake_extensions = Z_EXT_PM_TYPE | Z_EXT_PM_TYPE_NEW | Z_EXT_VIEWHEIGHT | Z_EXT_SERVERTIME | Z_EXT_PITCHLIMITS | Z_EXT_JOIN_OBSERVE | Z_EXT_VWEP; + +// if (demo.recorder.fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS) //replacementdeltas makes a number of earlier extensions obsolete... +// demo.recorder.fteprotocolextensions &= ~(PEXT_COLOURMOD|PEXT_DPFLAGS|PEXT_ENTITYDBL|PEXT_ENTITYDBL2|PEXT_FATNESS|PEXT_HEXEN2|PEXT_HULLSIZE|PEXT_MODELDBL|PEXT_SCALE|PEXT_SETATTACHMENT|PEXT_SOUNDDBL|PEXT_SPAWNSTATIC2|PEXT_TRANS); } else { @@ -1912,6 +1877,80 @@ void SV_MVD_SendInitialGamestate(mvddest_t *dest) singledest = NULL; } +//double-underscores will get merged together. +const char *SV_GenCleanTable(void) +{ + static char tab[256]; + static int tabbuilt = -1; + int mode = com_parseutf8.ival>0; + int i; + + if (tabbuilt == mode) + return tab; + + //identity + for(i = 0; i < 32; i++) + tab[i] = '_'; //unprintables. + for( ; i < 128; i++) + tab[i] = i; + + //cheesy way around NUL.mvd etc filenames. + for(i = 'A'; i <= 'Z'; i++) + tab[i] = i + ('a'-'A'); + + //these chars are reserved by windows, so its generally best to not use them, even on loonix + tab['<'] = '['; + tab['>'] = ']'; + tab['|'] = '_'; + tab[':'] = '_'; + tab['*'] = '_'; + tab['?'] = '_'; + tab['\\']= '_'; + tab['/'] = '_'; + tab['\"']= '_'; + //some extra ones to make unix scripts nicer. + tab['&'] = '_'; + tab['~'] = '_'; + tab['`'] = '_'; + tab[','] = '_'; + tab[' '] = '_'; //don't use spaces, it means files need quotes, and then stuff bugs out. + tab['.'] = '_'; //many windows programs can't properly deal with multiple dots + + if (mode) + { + //high chars are regular utf-8. yay + for(i = 128; i < 256; i++) + tab[i] = i; + } + else + { + //second row contains coloured numbers for the hud + tab[16] = '['; + tab[17] = ']'; + for(i = 0; i < 10; i++) + tab[18+i] = '0'+i; + tab[28] = '_'; //'.' + tab[29] = //line breaks + tab[30] = + tab[31] = '_'; + + //high chars + + //the first 16 chars of the high range are actually different. + tab[128] = '_'; //scrollbars + tab[129] = '_'; + tab[130] = '_'; + tab[130] = '_'; + for(i = 132; i < 128+16; i++) + tab[18+i] = '_'; //LEDs mostly + + //but the rest of the table is just recoloured. + for(i = 128+16; i < 256; i++) + tab[i] = tab[i&127]; + } + return tab; +} + /* ==================== SV_CleanName @@ -1924,6 +1963,7 @@ char *SV_CleanName (unsigned char *name) { static char text[1024]; char *out = text; + const char *chartbl = SV_GenCleanTable(); *out = chartbl[*name++]; @@ -1933,7 +1973,12 @@ char *SV_CleanName (unsigned char *name) else *++out = chartbl[*name++]; *++out = 0; - return text; + + + out = text; + while (*out == '.') + out++; //leading dots (which could be caused by all sorts of things) are bad. boo hidden files. + return out; } /* diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index d4197d8cd..e7857aa15 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -1359,9 +1359,9 @@ static void SV_SoundMulticast(client_t *client, sizebuf_t *msg, void *vctx) MSG_WriteShort (msg, bound(-32768, ctx->timeofs*1000, 32767)); if (field_mask & FTESND_VELOCITY) { - MSG_WriteShort (msg, ctx->vel[0]*8); - MSG_WriteShort (msg, ctx->vel[1]*8); - MSG_WriteShort (msg, ctx->vel[2]*8); + MSG_WriteShort (msg, bound(-32767, ctx->vel[0]*8, 32767)); + MSG_WriteShort (msg, bound(-32767, ctx->vel[1]*8, 32767)); + MSG_WriteShort (msg, bound(-32767, ctx->vel[2]*8, 32767)); } if (field_mask & DPSND_SPEEDUSHORT4000) MSG_WriteShort (msg, bound(1, ctx->ratemul*4000, 65535)); diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index d7f42d420..3c4007218 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -1043,10 +1043,14 @@ void SV_SendClientPrespawnInfo(client_t *client) else { int maxclientsupportedsounds = 256; - #ifdef PEXT_SOUNDDBL +#ifdef PEXT_SOUNDDBL if (client->fteprotocolextensions & PEXT_SOUNDDBL) maxclientsupportedsounds = MAX_PRECACHE_SOUNDS; - #endif +#endif +#ifdef PEXT_SOUNDDBL + if (client->fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS) + maxclientsupportedsounds = MAX_PRECACHE_SOUNDS; +#endif started = false; //allows stalling for the soundlist command, for compat. @@ -1060,7 +1064,7 @@ void SV_SendClientPrespawnInfo(client_t *client) { started = true; client->prespawn_allow_soundlist = false; - #ifdef PEXT_SOUNDDBL + #if defined(PEXT_SOUNDDBL) || defined(PEXT2_REPLACEMENTDELTAS) if (client->prespawn_idx > 255) { MSG_WriteByte (&client->netchan.message, svcfte_soundlistshort); @@ -1164,7 +1168,7 @@ void SV_SendClientPrespawnInfo(client_t *client) { started = true; client->prespawn_allow_modellist = false; - #ifdef PEXT_SOUNDDBL + #if defined(PEXT_SOUNDDBL) || defined(PEXT2_REPLACEMENTDELTAS) if (client->prespawn_idx > 255) { MSG_WriteByte (&client->netchan.message, svcfte_modellistshort);