map command now strips parms+spawnflags. use changelevel if you want to keep that (unlike nq, we still won't kick players).

fix some compiler warnings.
update the emscripten port.
reduce bss a little (as emscripten blatently can't cope with it)
support for '_wateralpha'. also support for cvar_foo too.
demo_jump works in nq demos.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4732 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-08-25 07:35:41 +00:00
parent 8c951e13fc
commit 957afd8c3b
53 changed files with 808 additions and 513 deletions

View File

@ -1213,15 +1213,16 @@ ifeq ($(FTE_TARGET),web)
ASMJS_MEMORY?=536870912 #512mb (required for asm.js)
# ASMJS_MEMORY?=268435456 #256mb (required for asm.js)
WEB_MEMORY?=$(ASMJS_MEMORY)
JSLIBS=--js-library web/ftejslib.js -s DISABLE_GL_EMULATION=1
JSLIBS=--js-library web/ftejslib.js -s LEGACY_GL_EMULATION=0
EMCC_ARGS=$(JSLIBS) $(WEB_PREJS) --shell-file web/fteshell.html -s ERROR_ON_UNDEFINED_SYMBOLS=1
RELEASE_CFLAGS=-DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB
DEBUG_CFLAGS=-g -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB
RELEASE_LDFLAGS=-s ASM_JS=1 -O2 -s TOTAL_MEMORY=$(ASMJS_MEMORY) $(EMCC_ARGS)
DEBUG_CFLAGS=-g -g4 -DOMIT_QCC -DGL_STATIC -DFTE_TARGET_WEB
RELEASE_LDFLAGS=-s ASM_JS=1 -O3 -s TOTAL_MEMORY=$(ASMJS_MEMORY) $(EMCC_ARGS)
# RELEASE_LDFLAGS=-s ASM_JS=0 -O1 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_ARGS)
DEBUG_LDLAGS=-O0 -s TOTAL_MEMORY=$(WEB_MEMORY) $(EMCC_ARGS)
CC=emcc
#BASELDFLAGS=
PRECOMPHEADERS=
#mostly we inherit the sdl defaults. because we can, however emscripten does not support sdl cd code.
GLCL_OBJS=$(GL_OBJS) $(D3DGL_OBJS) $(GLQUAKE_OBJS) gl_vidweb.o cd_null.o

View File

@ -19,7 +19,7 @@ void CG_Command_f(void);
#define CGTAGNUM 5423
extern model_t mod_known[];
extern model_t *mod_known;
extern int mod_numknown;
#define VM_FROMMHANDLE(a) ((a&&((unsigned int)a)<=mod_numknown)?mod_known+a-1:NULL)
#define VM_TOMHANDLE(a) (a?a-mod_known+1:0)

View File

@ -294,7 +294,7 @@ int readdemobytes(int *readpos, void *data, int len)
if (*readpos+len > demobuffersize)
{
if (i < 0)
{ //0 means no data available yet
{ //0 means no data available yet, don't error on that.
endofdemo = true;
return 0;
}
@ -366,7 +366,10 @@ void CL_DemoJump_f(void)
char *colon = strchr(s, ':');
if (!cls.demoplayback)
{
Con_Printf("not playing a demo, cannot jump.\n");
return;
}
if (*s == '+' || *s == '-')
{
@ -478,7 +481,15 @@ qboolean CL_GetDemoMessage (void)
return 0;
}
cls.netchan.last_received = realtime;
if ((cls.timedemo && host_framecount == demoframe) || (!cls.timedemo && demtime<= cl.gametime && cl.gametime))// > dem_lasttime+demtime)
if (cls.demoseeking)
{
if (cl.gametime > cls.demoseektime)
{
cls.demoseeking = false;
return 0;
}
}
else if ((cls.timedemo && host_framecount == demoframe) || (!cls.timedemo && demtime < cl.gametime && cl.gametime))// > dem_lasttime+demtime)
{
if (demtime <= cl.gametime-1)
demtime = cl.gametime;

View File

@ -2297,6 +2297,8 @@ void CL_Changing_f (void)
if (cls.download) // don't change when downloading
return;
cls.demoseeking = false; //don't seek over it
if (*mapname)
SCR_ImageName(mapname);
else
@ -3324,6 +3326,7 @@ void CL_FTP_f(void)
#endif
*/
//fixme: make a cvar
void CL_Fog_f(void)
{
if ((cl.fog_locked && !Cmd_FromGamecode()) || Cmd_Argc() <= 1)
@ -3362,15 +3365,13 @@ void CL_Fog_f(void)
cl.fog.time += 1;
//fitz:
//if (Cmd_Argc() >= 6) cl.fog_time = atof(Cmd_Argv(5));
//if (Cmd_Argc() >= 6) cl.fog_time += atof(Cmd_Argv(5));
//dp:
if (Cmd_Argc() >= 6) cl.fog.alpha = atof(Cmd_Argv(5));
if (Cmd_Argc() >= 7) cl.fog.depthbias = atof(Cmd_Argv(6));
/*
if (Cmd_Argc() >= 8) cl.fog.end = atof(Cmd_Argv(7));
if (Cmd_Argc() >= 9) cl.fog.height = atof(Cmd_Argv(8));
if (Cmd_Argc() >= 10) cl.fog.fadedepth = atof(Cmd_Argv(9));
*/
//if (Cmd_Argc() >= 8) cl.fog.end = atof(Cmd_Argv(7));
//if (Cmd_Argc() >= 9) cl.fog.height = atof(Cmd_Argv(8));
//if (Cmd_Argc() >= 10) cl.fog.fadedepth = atof(Cmd_Argv(9));
if (Cmd_FromGamecode())
cl.fog_locked = !!cl.fog.density;
@ -3846,8 +3847,13 @@ void Host_RunFileNotify(struct dl_download *dl)
#include "fs.h"
#define HRF_OVERWRITE (1<<0)
#define HRF_NOOVERWRITE (1<<1)
// (1<<2)
#define HRF_ABORT (1<<3)
#define HRF_OPENED (1<<4)
// (1<<5)
// (1<<6)
// (1<<7)
#define HRF_DEMO_MVD (1<<8)
#define HRF_DEMO_QWD (1<<9)
@ -3925,6 +3931,7 @@ void Host_BeginFileDownload(struct dl_download *dl, char *mimetype)
f->flags |= HRF_PACKAGE;
else
{
Con_Printf("file extension of %s not recognised\n", f->fname);
//file type not guessable from extension either.
f->flags |= HRF_ABORT;
Host_DoRunFile(f);
@ -4043,6 +4050,7 @@ void Host_DoRunFile(hrf_t *f)
//if we still don't know what it is, give up.
if (!(f->flags & HRF_FILETYPES))
{
Con_Printf("Host_DoRunFile: unknown filetype\n");
f->flags |= HRF_ABORT;
Host_DoRunFile(f);
return;
@ -4085,14 +4093,23 @@ void Host_DoRunFile(hrf_t *f)
{
ftemanifest_t *man;
int len = VFS_GETLEN(f->srcfile);
int foo;
char *fdata = BZ_Malloc(len+1);
VFS_READ(f->srcfile, fdata, len);
foo = VFS_READ(f->srcfile, fdata, len);
fdata[len] = 0;
man = FS_Manifest_Parse(NULL, fdata);
if (!man->updateurl)
man->updateurl = Z_StrDup(f->fname);
BZ_Free(fdata);
FS_ChangeGame(man, true);
if (foo != len)
{
Con_Printf("Host_DoRunFile: unable to read file properly\n");
BZ_Free(fdata);
}
else
{
man = FS_Manifest_Parse(NULL, fdata);
if (!man->updateurl)
man->updateurl = Z_StrDup(f->fname);
BZ_Free(fdata);
FS_ChangeGame(man, true);
}
f->flags |= HRF_ABORT;
Host_DoRunFile(f);
@ -4102,6 +4119,7 @@ void Host_DoRunFile(hrf_t *f)
}
else if (!(f->flags & HRF_QTVINFO))
{
Con_Printf("Host_DoRunFile: filetype not handled\n");
f->flags |= HRF_ABORT;
Host_DoRunFile(f);
return;
@ -4241,7 +4259,7 @@ qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file)
fname = utf8;
nlen = strlen(fname);
}
#else
#elif !defined(FTE_TARGET_WEB)
//unix file urls are fairly consistant.
if (nlen >= 8 && !strncmp(fname, "file:///", 8))
{

View File

@ -664,7 +664,7 @@ void CL_DownloadFinished(qdownload_t *dl)
{
/*
extern int mod_numknown;
extern model_t mod_known[];
extern model_t *mod_known;
for (i = 0; i < mod_numknown; i++) //go and load this model now.
{
if (!strcmp(mod_known[i].name, filename))
@ -5940,7 +5940,7 @@ void CLQW_ParseServerMessage (void)
{
rgb[0] = MSG_ReadShort()/1024.0;
rgb[1] = MSG_ReadShort()/1024.0;
rgb[1] = MSG_ReadShort()/1024.0;
rgb[2] = MSG_ReadShort()/1024.0;
}
else
{

View File

@ -787,6 +787,8 @@ void CL_PredictEntityMovement(entity_state_t *estate, float age)
VectorCopy(estate->origin, estate->u.q1.predorg);
else
{
VectorClear(startstate.velocity);
startstate.onground = false;
CL_EntStateToPlayerState(&startstate, estate);
CL_EntStateToPlayerCommand(&cmd, estate, age);

View File

@ -496,7 +496,7 @@ void CL_RefreshCustomTEnts(void);
void CL_RegisterParticles(void)
{
model_t *mod;
extern model_t mod_known[];
extern model_t *mod_known;
extern int mod_numknown;
int i;
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
@ -2092,7 +2092,7 @@ void CL_RefreshCustomTEnts(void)
if (cl.particle_ssprecaches)
{
for (i = 0; i <= MAX_SSPARTICLESPRE; i++)
for (i = 0; i < MAX_SSPARTICLESPRE; i++)
{
if (cl.particle_ssname[i])
cl.particle_ssprecache[i] = P_FindParticleType(cl.particle_ssname[i]);
@ -2102,7 +2102,7 @@ void CL_RefreshCustomTEnts(void)
}
if (cl.particle_csprecaches)
{
for (i = 0; i <= MAX_CSPARTICLESPRE; i++)
for (i = 0; i < MAX_CSPARTICLESPRE; i++)
{
if (cl.particle_csname[i])
cl.particle_csprecache[i] = P_FindParticleType(cl.particle_csname[i]);
@ -2427,7 +2427,7 @@ void CLQ2_ParseTEnt (void)
int cnt;
int color;
int r;
// int ent;
int ent;
// int magnitude;
type = MSG_ReadByte ();
@ -2515,6 +2515,21 @@ void CLQ2_ParseTEnt (void)
CL_ParseBeam (4);
MSG_ReadPos (pos);
break;
case Q2TE_LIGHTNING:
ent = MSGCL_ReadEntity ();
/*toent =*/ MSGCL_ReadEntity ();
pos[0] = MSG_ReadCoord ();
pos[1] = MSG_ReadCoord ();
pos[2] = MSG_ReadCoord ();
pos2[0] = MSG_ReadCoord ();
pos2[1] = MSG_ReadCoord ();
pos2[2] = MSG_ReadCoord ();
CL_AddBeam(0, ent, pos, pos2);
break;
/*
case Q2TE_LASER_SPARKS:
case Q2TE_WELDING_SPARKS:

View File

@ -281,7 +281,7 @@ netadr_t ui_pings[MAX_PINGREQUESTS];
#define UITAGNUM 2452
extern model_t mod_known[];
extern model_t *mod_known;
#define VM_FROMMHANDLE(a) (a?mod_known+a-1:NULL)
#define VM_TOMHANDLE(a) (a?a-mod_known+1:0)

View File

@ -185,7 +185,7 @@ void IN_Commands(void)
{
if (Key_MouseShouldBeFree())
ptr[ev->devid].down = 0;
else
else if (ptr[ev->devid].down)
{
if (ev->type == IEV_KEYDOWN)
Key_Event(ev->devid, ev->keyboard.scancode, ev->keyboard.unicode, ev->type == IEV_KEYDOWN);

View File

@ -62,7 +62,7 @@ static struct sdljoy_s
//the enumid is the value for the open function rather than the working id.
static void J_ControllerAdded(int enumid)
{
char *cname;
const char *cname;
int i;
for (i = 0; i < MAX_JOYSTICKS; i++)
if (sdljoy[i].controller == NULL)
@ -84,7 +84,7 @@ static void J_ControllerAdded(int enumid)
}
static void J_JoystickAdded(int enumid)
{
char *cname;
const char *cname;
int i;
for (i = 0; i < MAX_JOYSTICKS; i++)
if (sdljoy[i].joystick == NULL)

View File

@ -263,12 +263,16 @@ void M_Menu_Audio_Remove(menu_t *menu)
struct audiomenuinfo *info = menu->data;
for (i = 0; info->outdevnames[i]; i++)
Z_Free(info->outdevnames[i]);
Z_Free(info->outdevnames);
for (i = 0; info->outdevdescs[i]; i++)
Z_Free(info->outdevdescs[i]);
Z_Free(info->outdevdescs);
for (i = 0; info->capdevnames[i]; i++)
Z_Free(info->capdevnames[i]);
Z_Free(info->capdevnames);
for (i = 0; info->capdevdescs[i]; i++)
Z_Free(info->capdevdescs[i]);
Z_Free(info->capdevdescs);
}
struct audiomenuinfo *M_Menu_Audio_Setup(menu_t *menu)
{

View File

@ -1985,6 +1985,9 @@ qboolean PScript_Query(int typenum, int body, char *outstr, int outstrlen)
case SM_DISTBALL:
Q_strncatz(outstr, va("spawnmode distball %g %g\n", ptype->spawnparam1, ptype->spawnparam2), outstrlen);
break;
case SM_BOX:
Q_strncatz(outstr, va("spawnmode box %g %g\n", ptype->spawnparam1, ptype->spawnparam2), outstrlen);
break;
}
if (ptype->spawnvel || ptype->spawnvelvert)
Q_strncatz(outstr, va("spawnvel %g %g\n", ptype->spawnvel, ptype->spawnvelvert), outstrlen);
@ -2624,8 +2627,7 @@ static void P_ImportEffectInfo(char *config, char *line)
static void P_ImportEffectInfo_f(void)
{
char *file, *line;
int args = 0;
char *file;
char *config = "effectinfo";
FS_LoadFile(va("%s.txt", config), (void**)&file);
@ -2635,7 +2637,6 @@ static void P_ImportEffectInfo_f(void)
Con_Printf("effectinfo.txt not found\n");
return;
}
line = file;
P_ImportEffectInfo(config, file);
FS_FreeFile(file);
}
@ -3373,8 +3374,11 @@ static void PScript_ApplyOrgVel(vec3_t oorg, vec3_t ovel, vec3_t eforg, vec3_t e
case SM_FIELD:
if (!avelocities[0][0])
{
for (j=0 ; j<NUMVERTEXNORMALS*2 ; j++)
avelocities[0][j] = (rand()&255) * 0.01;
for (j=0 ; j<NUMVERTEXNORMALS ; j++)
{
avelocities[j][0] = (rand()&255) * 0.01;
avelocities[j][1] = (rand()&255) * 0.01;
}
}
j = 0;
@ -3879,8 +3883,11 @@ static int PScript_RunParticleEffectState (vec3_t org, vec3_t dir, float count,
case SM_FIELD:
if (!avelocities[0][0])
{
for (j=0 ; j<NUMVERTEXNORMALS*2 ; j++)
avelocities[0][j] = (rand()&255) * 0.01;
for (j=0 ; j<NUMVERTEXNORMALS ; j++)
{
avelocities[j][0] = (rand()&255) * 0.01;
avelocities[j][1] = (rand()&255) * 0.01;
}
}
j = 0;

View File

@ -628,26 +628,26 @@ void QCBUILTIN PF_cl_getextresponse(pubprogfuncs_t *prinst, struct globalvars_s
G_INT(OFS_RETURN) = 0;
}
#else
void PF_cl_gethostcachevalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void PF_cl_gethostcachestring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) {G_INT(OFS_RETURN) = 0;}
void QCBUILTIN PF_cl_gethostcachevalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void QCBUILTIN PF_cl_gethostcachestring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) {G_INT(OFS_RETURN) = 0;}
//void resethostcachemasks(void) = #615;
void PF_cl_resethostcachemasks(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
void QCBUILTIN PF_cl_resethostcachemasks(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
void PF_cl_sethostcachemaskstring(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
void QCBUILTIN PF_cl_sethostcachemaskstring(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
void PF_cl_sethostcachemasknumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
void QCBUILTIN PF_cl_sethostcachemasknumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void resorthostcache(void) = #618;
void PF_cl_resorthostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
void QCBUILTIN PF_cl_resorthostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void sethostcachesort(float fld, float descending) = #619;
void PF_cl_sethostcachesort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
void QCBUILTIN PF_cl_sethostcachesort(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
//void refreshhostcache(void) = #620;
void PF_cl_refreshhostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) {}
void QCBUILTIN PF_cl_refreshhostcache(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) {}
//float gethostcachenumber(float fld, float hostnr) = #621;
void PF_cl_gethostcachenumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void QCBUILTIN PF_cl_gethostcachenumber(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
//float gethostcacheindexforkey(string key) = #622;
void PF_cl_gethostcacheindexforkey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
void QCBUILTIN PF_cl_gethostcacheindexforkey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){G_FLOAT(OFS_RETURN) = 0;}
//void addwantedhostcachekey(string key) = #623;
void PF_cl_addwantedhostcachekey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
void QCBUILTIN PF_cl_addwantedhostcachekey(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals){}
#endif

View File

@ -4901,9 +4901,12 @@ static struct {
// {"bufstr_find", PF_Fixme, 537},
// {"matchpattern", PF_Fixme, 538},
// {"undefined", PF_Fixme, 539},
#ifdef USEODE
{"physics_enable", PF_physics_enable, 540},
{"physics_addforce", PF_physics_addforce, 541},
{"physics_addtorque", PF_physics_addtorque, 542},
#endif
{"setmousetarget", PF_cl_setmousetarget, 603},
{"getmousetarget", PF_cl_getmousetarget, 604},

View File

@ -281,6 +281,15 @@ void R2D_Init(void)
shader_menutint = R_RegisterShader("menutint", SUF_NONE,
"{\n"
"affine\n"
#ifdef FTE_TARGET_WEB
//currentrender is problematic here, so avoid using it.
"program default2d\n"
"{\n"
"map $whiteimage\n"
"blendfunc gl_dst_color gl_zero\n"
"rgbgen const $r_menutint\n"
"}\n"
#else
"if $glsl && gl_menutint_shader != 0\n"
"program menutint\n"
"{\n"
@ -293,6 +302,7 @@ void R2D_Init(void)
"rgbgen const $r_menutint\n"
"}\n"
"endif\n"
#endif
"}\n"
);
shader_crosshair = R_RegisterShader("crosshairshader", SUF_NONE,

View File

@ -29,7 +29,7 @@ void R_Rockettrail_Callback(struct cvar_s *var, char *oldvalue)
{
int i;
model_t *mod;
extern model_t mod_known[];
extern model_t *mod_known;
extern int mod_numknown;
if (cls.state == ca_disconnected)
@ -47,7 +47,7 @@ void R_Grenadetrail_Callback(struct cvar_s *var, char *oldvalue)
{
int i;
model_t *mod;
extern model_t mod_known[];
extern model_t *mod_known;
extern int mod_numknown;
if (cls.state == ca_disconnected)

View File

@ -194,8 +194,9 @@ typedef struct {
} rtname_t;
#define R_MAX_RENDERTARGETS 8
#ifndef R_MAX_RECURSE
#define R_MAX_RECURSE 6
#define R_POSTPROC_PASSES 6
#endif
#define RDFD_FOV 1
typedef struct
{
@ -536,9 +537,12 @@ extern cvar_t r_editlights_import_specular;
extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha;
extern cvar_t r_lavaalpha;
extern cvar_t r_slimealpha;
extern cvar_t r_telealpha;
extern cvar_t r_waterstyle;
extern cvar_t r_slimestyle;
extern cvar_t r_lavastyle;
extern cvar_t r_slimestyle;
extern cvar_t r_telestyle;
extern cvar_t r_dynamic;
extern cvar_t r_novis;
extern cvar_t r_netgraph;

View File

@ -146,6 +146,10 @@ cvar_t r_wateralpha = CVARF ("r_wateralpha", "1",
CVAR_ARCHIVE | CVAR_SHADERSYSTEM);
cvar_t r_lavaalpha = CVARF ("r_lavaalpha", "",
CVAR_ARCHIVE | CVAR_SHADERSYSTEM);
cvar_t r_slimealpha = CVARF ("r_slimealpha", "",
CVAR_ARCHIVE | CVAR_SHADERSYSTEM);
cvar_t r_telealpha = CVARF ("r_telealpha", "",
CVAR_ARCHIVE | CVAR_SHADERSYSTEM);
cvar_t r_waterwarp = CVARF ("r_waterwarp", "1",
CVAR_ARCHIVE);
@ -361,6 +365,7 @@ cvar_t r_glsl_turbscale = CVARFD ("r_glsl_turbscale", "1", CVAR_ARCHIVE, "
cvar_t r_waterstyle = CVARFD ("r_waterstyle", "1", CVAR_ARCHIVE|CVAR_SHADERSYSTEM, "Changes how water, and teleporters are drawn. Possible values are:\n0: fastturb-style block colour.\n1: regular q1-style water.\n2: refraction(ripply and transparent)\n3: refraction with reflection at an angle\n4: ripplemapped without reflections (requires particle effects)\n5: ripples+reflections");
cvar_t r_slimestyle = CVARFD ("r_slimestyle", "", CVAR_ARCHIVE|CVAR_SHADERSYSTEM, "See r_waterstyle, but affects only slime. If empty, defers to r_waterstyle.");
cvar_t r_lavastyle = CVARFD ("r_lavastyle", "1", CVAR_ARCHIVE|CVAR_SHADERSYSTEM, "See r_waterstyle, but affects only lava. If empty, defers to r_waterstyle.");
cvar_t r_telestyle = CVARFD ("r_telestyle", "1", CVAR_ARCHIVE|CVAR_SHADERSYSTEM, "See r_waterstyle, but affects only lava. If empty, defers to r_waterstyle.");
cvar_t r_vertexdlights = CVARD ("r_vertexdlights", "0", "Determine model lighting with respect to nearby dlights. Poor-man's rtlights.");
@ -639,8 +644,9 @@ void Renderer_Init(void)
Sh_RegisterCvars();
Cvar_Register (&r_waterstyle, GRAPHICALNICETIES);
Cvar_Register (&r_slimestyle, GRAPHICALNICETIES);
Cvar_Register (&r_lavastyle, GRAPHICALNICETIES);
Cvar_Register (&r_slimestyle, GRAPHICALNICETIES);
Cvar_Register (&r_telestyle, GRAPHICALNICETIES);
Cvar_Register (&r_wireframe, GRAPHICALNICETIES);
Cvar_Register (&r_refract_fbo, GRAPHICALNICETIES);
Cvar_Register (&r_stereo_separation, GRAPHICALNICETIES);
@ -699,6 +705,8 @@ void Renderer_Init(void)
Cvar_Register (&r_fastskycolour, GRAPHICALNICETIES);
Cvar_Register (&r_wateralpha, GRAPHICALNICETIES);
Cvar_Register (&r_lavaalpha, GRAPHICALNICETIES);
Cvar_Register (&r_slimealpha, GRAPHICALNICETIES);
Cvar_Register (&r_telealpha, GRAPHICALNICETIES);
Cvar_Register (&gl_shadeq1_name, GLRENDEREROPTIONS);
Cvar_Register (&r_clear, GLRENDEREROPTIONS);

View File

@ -406,7 +406,7 @@ void Sbar_ExecuteLayoutString (char *s)
p = R2D_SafeCachePic(va("players/%s_i.pcx", cl.players[value].skin->name));
if (!p) //display a default if the icon couldn't be found.
p = R2D_SafeCachePic(va("players/male/grunt_i.pcx", cl.players[value].skin->name));
p = R2D_SafeCachePic("players/male/grunt_i.pcx");
R2D_ScalePic (x, y, 32, 32, p);
continue;
}

View File

@ -13,6 +13,62 @@ FIXME: a capture device would be useful (voice chat).
#ifdef AVAIL_OPENAL
#ifdef FTE_TARGET_WEB
//our javascript port doesn't support dynamic linking.
#define OPENAL_STATIC
#endif
#ifdef OPENAL_STATIC
#include <AL/al.h> //output
#include <AL/alc.h> //input
#ifndef AL_API
#define AL_API
#endif
#ifndef AL_APIENTRY
#define AL_APIENTRY
#endif
#define palGetError alGetError
#define palSourcef alSourcef
#define palSourcei alSourcei
#define palSourcePlayv alSourcePlayv
#define palSourceStopv alSourceStopv
#define palSourcePlay alSourcePlay
#define palSourceStop alSourceStop
#define palDopplerFactor alDopplerFactor
#define palGenBuffers alGenBuffers
#define palIsBuffer alIsBuffer
#define palBufferData alBufferData
#define palDeleteBuffers alDeleteBuffers
#define palListenerfv alListenerfv
#define palSourcefv alSourcefv
#define palGetString alGetString
#define palGenSources alGenSources
#define palListenerf alListenerf
#define palDeleteBuffers alDeleteBuffers
#define palDeleteSources alDeleteSources
#define palSpeedOfSound alSpeedOfSound
#define palDistanceModel alDistanceModel
#define palGetSourcei alGetSourcei
#define palSourceQueueBuffers alSourceQueueBuffers
#define palSourceUnqueueBuffers alSourceUnqueueBuffers
#define palcOpenDevice alcOpenDevice
#define palcCloseDevice alcCloseDevice
#define palcCreateContext alcCreateContext
#define palcDestroyContext alcDestroyContext
#define palcMakeContextCurrent alcMakeContextCurrent
#define palcProcessContext alcProcessContext
#define palcGetString alcGetString
#define palcIsExtensionPresent alcIsExtensionPresent
#ifdef FTE_TARGET_WEB //emscripten sucks.
AL_API void (AL_APIENTRY alSpeedOfSound)( ALfloat value ) {}
#endif
#else
#if defined(_WIN32)
#define AL_APIENTRY __cdecl
#else
@ -143,7 +199,23 @@ static ALC_API ALCboolean (ALC_APIENTRY *palcIsExtensionPresent)( ALCdevice
//#include "AL/al.h"
//#include "AL/alext.h"
//capture-specific stuff
static ALC_API void (ALC_APIENTRY *palcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
static ALC_API ALCdevice * (ALC_APIENTRY *palcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
static ALC_API ALCboolean (ALC_APIENTRY *palcCaptureCloseDevice)( ALCdevice *device );
static ALC_API void (ALC_APIENTRY *palcCaptureStart)( ALCdevice *device );
static ALC_API void (ALC_APIENTRY *palcCaptureStop)( ALCdevice *device );
static ALC_API void (ALC_APIENTRY *palcCaptureSamples)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
#define ALC_CAPTURE_SAMPLES 0x312
#endif
//efx
#ifdef USEEFX
#define AL_AUXILIARY_SEND_FILTER 0x20006
#define AL_FILTER_NULL 0x0000
#define AL_EFFECTSLOT_EFFECT 0x0001
@ -151,43 +223,43 @@ static ALC_API ALCboolean (ALC_APIENTRY *palcIsExtensionPresent)( ALCdevice
#define AL_EFFECT_REVERB 0x0001
#define AL_EFFECT_EAXREVERB 0x8000
#define AL_REVERB_DENSITY 0x0001
#define AL_REVERB_DIFFUSION 0x0002
#define AL_REVERB_GAIN 0x0003
#define AL_REVERB_GAINHF 0x0004
#define AL_REVERB_DECAY_TIME 0x0005
#define AL_REVERB_DECAY_HFRATIO 0x0006
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
#define AL_REVERB_DECAY_HFLIMIT 0x000D
/* EAX Reverb effect parameters */
#define AL_EAXREVERB_DENSITY 0x0001
#define AL_EAXREVERB_DIFFUSION 0x0002
#define AL_EAXREVERB_GAIN 0x0003
#define AL_EAXREVERB_GAINHF 0x0004
#define AL_EAXREVERB_GAINLF 0x0005
#define AL_EAXREVERB_DECAY_TIME 0x0006
#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
#define AL_EAXREVERB_ECHO_TIME 0x000F
#define AL_EAXREVERB_ECHO_DEPTH 0x0010
#define AL_EAXREVERB_MODULATION_TIME 0x0011
#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
#define AL_EAXREVERB_HFREFERENCE 0x0014
#define AL_EAXREVERB_LFREFERENCE 0x0015
#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
#define AL_REVERB_DENSITY 0x0001
#define AL_REVERB_DIFFUSION 0x0002
#define AL_REVERB_GAIN 0x0003
#define AL_REVERB_GAINHF 0x0004
#define AL_REVERB_DECAY_TIME 0x0005
#define AL_REVERB_DECAY_HFRATIO 0x0006
#define AL_REVERB_REFLECTIONS_GAIN 0x0007
#define AL_REVERB_REFLECTIONS_DELAY 0x0008
#define AL_REVERB_LATE_REVERB_GAIN 0x0009
#define AL_REVERB_LATE_REVERB_DELAY 0x000A
#define AL_REVERB_AIR_ABSORPTION_GAINHF 0x000B
#define AL_REVERB_ROOM_ROLLOFF_FACTOR 0x000C
#define AL_REVERB_DECAY_HFLIMIT 0x000D
/* EAX Reverb effect parameters */
#define AL_EAXREVERB_DENSITY 0x0001
#define AL_EAXREVERB_DIFFUSION 0x0002
#define AL_EAXREVERB_GAIN 0x0003
#define AL_EAXREVERB_GAINHF 0x0004
#define AL_EAXREVERB_GAINLF 0x0005
#define AL_EAXREVERB_DECAY_TIME 0x0006
#define AL_EAXREVERB_DECAY_HFRATIO 0x0007
#define AL_EAXREVERB_DECAY_LFRATIO 0x0008
#define AL_EAXREVERB_REFLECTIONS_GAIN 0x0009
#define AL_EAXREVERB_REFLECTIONS_DELAY 0x000A
#define AL_EAXREVERB_REFLECTIONS_PAN 0x000B
#define AL_EAXREVERB_LATE_REVERB_GAIN 0x000C
#define AL_EAXREVERB_LATE_REVERB_DELAY 0x000D
#define AL_EAXREVERB_LATE_REVERB_PAN 0x000E
#define AL_EAXREVERB_ECHO_TIME 0x000F
#define AL_EAXREVERB_ECHO_DEPTH 0x0010
#define AL_EAXREVERB_MODULATION_TIME 0x0011
#define AL_EAXREVERB_MODULATION_DEPTH 0x0012
#define AL_EAXREVERB_AIR_ABSORPTION_GAINHF 0x0013
#define AL_EAXREVERB_HFREFERENCE 0x0014
#define AL_EAXREVERB_LFREFERENCE 0x0015
#define AL_EAXREVERB_ROOM_ROLLOFF_FACTOR 0x0016
#define AL_EAXREVERB_DECAY_HFLIMIT 0x0017
static AL_API void*(AL_APIENTRY *palGetProcAddress)(const ALchar *fname);
static AL_API void (AL_APIENTRY *palSource3i)(ALuint source, ALenum param, ALint value1, ALint value2, ALint value3);
@ -198,24 +270,11 @@ static AL_API ALvoid (AL_APIENTRY *palDeleteAuxiliaryEffectSlots)(ALsizei n, con
static AL_API ALvoid (AL_APIENTRY *palDeleteEffects)(ALsizei n, const ALuint *effects);
static AL_API ALvoid (AL_APIENTRY *palGenEffects)(ALsizei n, ALuint *effects);
static AL_API ALvoid (AL_APIENTRY *palEffecti)(ALuint effect, ALenum param, ALint iValue);
static AL_API ALvoid (AL_APIENTRY *palEffectiv)(ALuint effect, ALenum param, const ALint *piValues);
static AL_API ALvoid (AL_APIENTRY *palEffectf)(ALuint effect, ALenum param, ALfloat flValue);
static AL_API ALvoid (AL_APIENTRY *palEffecti)(ALuint effect, ALenum param, ALint iValue);
static AL_API ALvoid (AL_APIENTRY *palEffectiv)(ALuint effect, ALenum param, const ALint *piValues);
static AL_API ALvoid (AL_APIENTRY *palEffectf)(ALuint effect, ALenum param, ALfloat flValue);
static AL_API ALvoid (AL_APIENTRY *palEffectfv)(ALuint effect, ALenum param, const ALfloat *pflValues);
//capture-specific stuff
static ALC_API void (ALC_APIENTRY *palcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
static ALC_API ALCdevice * (ALC_APIENTRY *palcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
static ALC_API ALCboolean (ALC_APIENTRY *palcCaptureCloseDevice)( ALCdevice *device );
static ALC_API void (ALC_APIENTRY *palcCaptureStart)( ALCdevice *device );
static ALC_API void (ALC_APIENTRY *palcCaptureStop)( ALCdevice *device );
static ALC_API void (ALC_APIENTRY *palcCaptureSamples)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
#define ALC_CAPTURE_SAMPLES 0x312
#endif
#define SOUNDVARS "OpenAL variables"
@ -477,8 +536,14 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
{
if (src)
{
#ifdef FTE_TARGET_WEB
//emscripten's webaudio wrapper spams error messages after alDeleteSources has been called, if the context isn't also killed.
if (!schanged)
palSourceStop(src);
#else
palDeleteSources(1, &src);
oali->source[chnum] = 0;
#endif
}
return;
}
@ -549,10 +614,12 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
pitch = (float)chan->rate/(1<<PITCHSHIFT);
palSourcef(src, AL_PITCH, pitch);
#ifdef USEEFX
if (chan->entnum == -2) //don't do the underwater thing on static sounds. it sounds like arse with all those sources.
palSource3i(src, AL_AUXILIARY_SEND_FILTER, 0, 0, AL_FILTER_NULL);
else
palSource3i(src, AL_AUXILIARY_SEND_FILTER, oali->effectslot, 0, AL_FILTER_NULL);
#endif
palSourcei(src, AL_LOOPING, chan->looping?AL_TRUE:AL_FALSE);
if (chan->entnum == -1 || chan->entnum == cl.playerview[0].viewentity)
@ -607,6 +674,9 @@ static void S_Info (void)
static qboolean OpenAL_InitLibrary(void)
{
#ifdef OPENAL_STATIC
return true;
#else
static dllfunction_t openalfuncs[] =
{
{(void*)&palGetError, "alGetError"},
@ -630,7 +700,9 @@ static qboolean OpenAL_InitLibrary(void)
{(void*)&palSpeedOfSound, "alSpeedOfSound"},
{(void*)&palDistanceModel, "alDistanceModel"},
#ifdef USEEFX
{(void*)&palGetProcAddress, "alGetProcAddress"},
#endif
{(void*)&palGetSourcei, "alGetSourcei"},
{(void*)&palSourceQueueBuffers, "alSourceQueueBuffers"},
{(void*)&palSourceUnqueueBuffers, "alSourceUnqueueBuffers"},
@ -652,6 +724,7 @@ static qboolean OpenAL_InitLibrary(void)
openallib = Sys_LoadLibrary("OpenAL32", openalfuncs);
}
return !!openallib;
#endif
}
static qboolean OpenAL_Init(soundcardinfo_t *sc, const char *devname)
@ -760,6 +833,7 @@ static void OpenAL_UnlockBuffer (soundcardinfo_t *sc, void *buffer)
static void OpenAL_SetUnderWater (soundcardinfo_t *sc, qboolean underwater)
{
#ifdef USEEFX
oalinfo_t *oali = sc->handle;
if (!oali->effectslot)
@ -772,6 +846,7 @@ static void OpenAL_SetUnderWater (soundcardinfo_t *sc, qboolean underwater)
palAuxiliaryEffectSloti(oali->effectslot, AL_EFFECTSLOT_EFFECT, oali->effecttype[oali->cureffect]);
PrintALError("postunderwater");
//Con_Printf("OpenAL: SetUnderWater %i\n", underwater);
#endif
}
/*stub should not be called*/
@ -804,48 +879,51 @@ static void OpenAL_Shutdown (soundcardinfo_t *sc)
}
}
#ifdef USEEFX
palDeleteAuxiliaryEffectSlots(1, &oali->effectslot);
palDeleteEffects(1, &oali->effecttype[1]);
#endif
palcDestroyContext(oali->OpenAL_Context);
palcCloseDevice(oali->OpenAL_Device);
Z_Free(oali);
}
typedef struct {
float flDensity;
float flDiffusion;
float flGain;
float flGainHF;
float flGainLF;
float flDecayTime;
float flDecayHFRatio;
float flDecayLFRatio;
float flReflectionsGain;
float flReflectionsDelay;
float flReflectionsPan[3];
float flLateReverbGain;
float flLateReverbDelay;
float flLateReverbPan[3];
float flEchoTime;
float flEchoDepth;
float flModulationTime;
float flModulationDepth;
float flAirAbsorptionGainHF;
float flHFReference;
float flLFReference;
float flRoomRolloffFactor;
int iDecayHFLimit;
typedef struct {
float flDensity;
float flDiffusion;
float flGain;
float flGainHF;
float flGainLF;
float flDecayTime;
float flDecayHFRatio;
float flDecayLFRatio;
float flReflectionsGain;
float flReflectionsDelay;
float flReflectionsPan[3];
float flLateReverbGain;
float flLateReverbDelay;
float flLateReverbPan[3];
float flEchoTime;
float flEchoDepth;
float flModulationTime;
float flModulationDepth;
float flAirAbsorptionGainHF;
float flHFReference;
float flLFReference;
float flRoomRolloffFactor;
int iDecayHFLimit;
} EFXEAXREVERBPROPERTIES, *LPEFXEAXREVERBPROPERTIES;
#define EFX_REVERB_PRESET_PSYCHOTIC \
#define EFX_REVERB_PRESET_PSYCHOTIC \
{ 0.0625f, 0.5000f, 0.3162f, 0.8404f, 1.0000f, 7.5600f, 0.9100f, 1.0000f, 0.4864f, 0.0200f, { 0.0000f, 0.0000f, 0.0000f }, 2.4378f, 0.0300f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 4.0000f, 1.0000f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x0 }
#define EFX_REVERB_PRESET_UNDERWATER \
#define EFX_REVERB_PRESET_UNDERWATER \
{ 0.3645f, 1.0000f, 0.3162f, 0.0100f, 1.0000f, 1.4900f, 0.1000f, 1.0000f, 0.5963f, 0.0070f, { 0.0000f, 0.0000f, 0.0000f }, 7.0795f, 0.0110f, { 0.0000f, 0.0000f, 0.0000f }, 0.2500f, 0.0000f, 1.1800f, 0.3480f, 0.9943f, 5000.0000f, 250.0000f, 0.0000f, 0x1 }
ALuint OpenAL_LoadEffect(const EFXEAXREVERBPROPERTIES *reverb)
{
ALuint effect;
ALuint effect = 0;
#ifdef AL_EFFECT_EAXREVERB
palGenEffects(1, &effect);
if(1)//alGetEnumValue("AL_EFFECT_EAXREVERB") != 0)
if(alGetEnumValue("AL_EFFECT_EAXREVERB") != 0)
{
/* EAX Reverb is available. Set the EAX effect type then load the
* reverb properties. */
@ -895,15 +973,18 @@ ALuint OpenAL_LoadEffect(const EFXEAXREVERBPROPERTIES *reverb)
palEffectf(effect, AL_REVERB_ROOM_ROLLOFF_FACTOR, reverb->flRoomRolloffFactor);
palEffecti(effect, AL_REVERB_DECAY_HFLIMIT, reverb->iDecayHFLimit);
}
#endif
return effect;
}
static qboolean QDECL OpenAL_InitCard(soundcardinfo_t *sc, const char *devname)
{
oalinfo_t *oali;
#ifndef OPENAL_STATIC
//no default support, because we're buggy as fuck
if (!devname)
return false;
#endif
if (!devname || !*devname)
devname = palcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
@ -939,6 +1020,7 @@ static qboolean QDECL OpenAL_InitCard(soundcardinfo_t *sc, const char *devname)
Cvar_ForceCallback(&s_al_dopplerfactor);
Cvar_ForceCallback(&s_al_max_distance);
#ifdef USEEFX
PrintALError("preeffects");
palSource3i = palGetProcAddress("alSource3i");
palAuxiliaryEffectSloti = palGetProcAddress("alAuxiliaryEffectSloti");
@ -960,6 +1042,7 @@ static qboolean QDECL OpenAL_InitCard(soundcardinfo_t *sc, const char *devname)
oali->effecttype[1] = OpenAL_LoadEffect(&uw);
}
PrintALError("posteffects");
#endif
return true;
}
@ -1032,8 +1115,10 @@ qboolean QDECL OPENAL_Capture_Enumerate (void (QDECL *callback) (const char *dri
//fte's capture api specifies mono 16.
void *QDECL OPENAL_Capture_Init (int samplerate, const char *device)
{
#ifndef OPENAL_STATIC
if (!device) //no default devices please, too buggy for that.
return NULL;
#endif
if (!OpenAL_InitCapture())
return NULL; //enumerate nothing if al is disabled

View File

@ -638,11 +638,32 @@ void Mod_ParseInfoFromEntityLump(model_t *wmodel, char *data, char *mapname) //a
CL_Fog_f();
Cmd_ExecLevel=oel;
}
else if (!strncmp("cvar_", key, 5)) //override cvars so mappers don't end up hacking cvars and fucking over configs (at least in other engines).
{
cvar_t *var = Cvar_FindVar(key+5);
if (var && !(var->flags & CVAR_NOTFROMSERVER))
Cvar_LockFromServer(var, com_token);
}
else if (!strcmp("wateralpha", key)) //override cvars so mappers don't end up hacking cvars and fucking over configs (at least in other engines).
{
Cvar_LockFromServer(&r_wateralpha, com_token);
Cvar_LockFromServer(&r_waterstyle, "1"); //force vanilla-style water too.
}
else if (!strcmp("slimealpha", key))
{
Cvar_LockFromServer(&r_slimealpha, com_token);
Cvar_LockFromServer(&r_slimestyle, "1");
}
else if (!strcmp("lavaalpha", key))
{
Cvar_LockFromServer(&r_lavaalpha, com_token);
Cvar_LockFromServer(&r_lavastyle, "1");
}
else if (!strcmp("telealpha", key))
{
Cvar_LockFromServer(&r_telealpha, com_token);
Cvar_LockFromServer(&r_telestyle, "1");
}
else if (!strcmp("sky", key)) // for Quake2 maps
{
Q_strncpyz(cl.skyname, com_token, sizeof(cl.skyname));

View File

@ -295,6 +295,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#undef Q2SERVER //requires a dll anyway.
#undef Q3CLIENT
#undef Q3SERVER //trying to trim memory use
#undef Q2BSPS //emscripten can't cope with bss, leading to increased download time. too lazy to fix.
#undef Q3BSPS //emscripten can't cope with bss, leading to increased download time. too lazy to fix.
#undef PSET_SCRIPT //bss+size
#define GLSLONLY //pointless having the junk
#define R_MAX_RECURSE 2 //less bss
#undef RTLIGHTS
#endif
#ifdef WINRT
#undef TCPCONNECT //err...
@ -594,8 +600,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// per-level limits
//
#ifdef FTE_TARGET_WEB
#define MAX_EDICTS ((1<<15)-1)
#else
//#define MAX_EDICTS ((1<<22)-1) // expandable up to 22 bits
#define MAX_EDICTS ((1<<18)-1) // expandable up to 22 bits
#endif
#define MAX_LIGHTSTYLES 255
#define MAX_STANDARDLIGHTSTYLES 64
#define MAX_MODELS 1024 // these are sent over the net as bytes

View File

@ -688,7 +688,7 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
return NULL;
}
if (var->flags & CVAR_SERVEROVERRIDE && !force)
if (0)//var->flags & CVAR_SERVEROVERRIDE && !force)
latch = "variable %s is under server control - latched\n";
else if (var->flags & CVAR_LATCH && (sv_state || cls_state))
latch = "variable %s is latched and will be applied for the start of the next map\n";

View File

@ -73,15 +73,6 @@ void Log_String (logtype_t lognum, char *s)
conchar_t cline[2048], *c;
unsigned int u;
if (!log_enable[lognum].value)
return;
// get directory/filename
if (log_dir.string[0])
d = log_dir.string;
else
d = "";//gamedirfile;
f = NULL;
switch(lognum)
{
@ -95,8 +86,18 @@ void Log_String (logtype_t lognum, char *s)
f = "rcon";
break;
default:
break;
return;
}
if (!log_enable[lognum].value)
return;
// get directory/filename
if (log_dir.string[0])
d = log_dir.string;
else
d = "";//gamedirfile;
if (log_name[lognum].string[0])
f = log_name[lognum].string;

View File

@ -77,14 +77,14 @@ extern int debuggerresumeline;
extern int isPlugin; //if 2, we were invoked by a debugger, and we need to give it debug locations (and it'll feed us continue/steps/breakpoints)
static int debuggerstacky;
#ifdef _WIN32
#if defined(_WIN32) && !defined(FTE_SDL)
#include <windows.h>
void INS_UpdateGrabs(int fullscreen, int activeapp);
#endif
int QCLibEditor(pubprogfuncs_t *prinst, char *filename, int line, int statement, int nump, char **parms);
void QCLoadBreakpoints(const char *vmname, const char *progsname)
{ //this asks the gui to reapply any active breakpoints and waits for them so that any spawn functions can be breakpointed properly.
#if defined(_WIN32) && !defined(SERVERONLY)
#if defined(_WIN32) && !defined(SERVERONLY) && !defined(FTE_SDL)
extern int isPlugin;
if (isPlugin == 2)
{
@ -104,7 +104,7 @@ void QCLoadBreakpoints(const char *vmname, const char *progsname)
extern cvar_t pr_sourcedir;
int QDECL QCEditor (pubprogfuncs_t *prinst, char *filename, int line, int statement, int nump, char **parms)
{
#if defined(_WIN32) && !defined(SERVERONLY)
#if defined(_WIN32) && !defined(SERVERONLY) && !defined(FTE_SDL)
if (isPlugin == 2)
{
if (!*filename) //don't try editing an empty line, it won't work

View File

@ -319,7 +319,7 @@ static LRESULT WINAPI D3D11_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPAR
if (!d3dscreen && modestate == MS_FULLSCREEN)
IDXGISwapChain_GetContainingOutput(d3dswapchain, &d3dscreen);
IDXGISwapChain_SetFullscreenState(d3dswapchain, modestate == MS_FULLSCREEN, d3dscreen);
IDXGISwapChain_SetFullscreenState(d3dswapchain, modestate == MS_FULLSCREEN, (modestate == MS_FULLSCREEN)?d3dscreen:NULL);
if (modestate == MS_WINDOWED)
{

View File

@ -239,7 +239,6 @@ Global
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|Win32.Build.0 = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MRelease|Win32.ActiveCfg = Release|Win32
{873CCE24-3549-49D4-A4B4-653F91B1532A}.MRelease|Win32.Build.0 = Release|Win32
@ -326,7 +325,6 @@ Global
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|Win32.Build.0 = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MinGLRelease|x64.ActiveCfg = Debug|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MRelease|Win32.ActiveCfg = Release|Win32
{4735677B-6D5A-4BE6-A945-CB32DEADBEEF}.MRelease|Win32.Build.0 = Release|Win32
@ -600,7 +598,6 @@ Global
{74542CA7-48C1-4664-9007-66F751131EA3}.D3DDebug|Win32.Build.0 = Debug|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.D3DDebug|x64.ActiveCfg = Debug|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.D3DRelease|Win32.ActiveCfg = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.D3DRelease|Win32.Build.0 = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.D3DRelease|x64.ActiveCfg = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.Debug Dedicated Server|Win32.Build.0 = Debug|Win32
@ -621,7 +618,6 @@ Global
{74542CA7-48C1-4664-9007-66F751131EA3}.MinGLDebug|Win32.Build.0 = Debug|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.MinGLRelease|Win32.Build.0 = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.MinGLRelease|x64.ActiveCfg = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.MRelease|Win32.ActiveCfg = Release|Win32
{74542CA7-48C1-4664-9007-66F751131EA3}.MRelease|Win32.Build.0 = Release|Win32

View File

@ -751,7 +751,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
{
int i, j;
unsigned translate32[256];
static unsigned pixels[512*512]; //FIXME: too big for stack, so lets just chuck it in the bss, yay! because that sounds like a good idea! not.
unsigned *pixels;
unsigned *out;
unsigned frac, fracstep;
@ -860,6 +860,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
}
}
pixels = malloc(sizeof(*pixels) * scaled_height*scaled_width);
out = pixels;
fracstep = tinwidth*0x10000/scaled_width;
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
@ -961,6 +962,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
scaled_width, scaled_height, TF_RGBA32, pixels, IF_NOMIPMAP);
}
free(pixels);
}
else
{

View File

@ -388,7 +388,7 @@ void GL_MTBind(int tmu, int target, texid_t texnum)
#ifndef FORCESTATE
shaderstate.curtexturetype[tmu] != target &&
#endif
!gl_config.nofixedfunc)
!gl_config_nofixedfunc)
{
if (shaderstate.curtexturetype[tmu])
@ -415,7 +415,7 @@ void GL_LazyBind(int tmu, int target, texid_t texnum)
{
if (shaderstate.curtexturetype[tmu])
qglBindTexture (shaderstate.curtexturetype[tmu], 0);
if (gl_config.nofixedfunc)
if (gl_config_nofixedfunc)
{
shaderstate.curtexturetype[tmu] = target;
}
@ -723,9 +723,9 @@ void GLBE_SetupVAO(vbo_t *vbo, unsigned int vaodynamic, unsigned int vaostatic)
{
qglGenVertexArrays(1, &vbo->vao);
if ((vaostatic & VATTR_VERTEX1) && !gl_config.nofixedfunc)
if ((vaostatic & VATTR_VERTEX1) && !gl_config_nofixedfunc)
vaostatic = (vaostatic & ~VATTR_VERTEX1) | VATTR_LEG_VERTEX;
if ((vaodynamic & VATTR_VERTEX1) && !gl_config.nofixedfunc)
if ((vaodynamic & VATTR_VERTEX1) && !gl_config_nofixedfunc)
vaodynamic = (vaodynamic & ~VATTR_VERTEX1) | VATTR_LEG_VERTEX;
shaderstate.curvertexpointer = NULL;
@ -788,7 +788,7 @@ void GLBE_RenderShadowBuffer(unsigned int numverts, int vbo, vecV_t *verts, unsi
{
GL_SelectProgram(shaderstate.allblackshader);
BE_EnableShaderAttributes(gl_config.nofixedfunc?(1u<<VATTR_VERTEX1):(1u<<VATTR_LEG_VERTEX), 0);
BE_EnableShaderAttributes(gl_config_nofixedfunc?(1u<<VATTR_VERTEX1):(1u<<VATTR_LEG_VERTEX), 0);
if (shaderstate.allblackshader != shaderstate.lastuniform && shaderstate.allblack_mvp != -1)
{
@ -928,7 +928,7 @@ static void RevertToKnownState(void)
GL_SelectTexture(0);
if (!gl_config.nofixedfunc)
if (!gl_config_nofixedfunc)
{
BE_SetPassBlendMode(0, PBM_REPLACE);
qglColor3f(1,1,1);
@ -1326,7 +1326,7 @@ void GLBE_Init(void)
shaderstate.curentity = &r_worldentity;
be_maxpasses = gl_mtexarbable;
gl_stencilbits = 0;
if (gl_config.glversion >= 3.0 && gl_config.nofixedfunc)
if (gl_config.glversion >= 3.0 && gl_config_nofixedfunc)
{
//docs say this line should be okay in gl3+. nvidia do not seem to agree. GL_STENCIL_BITS is depricated however. so for now, just assume.
//qglGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER_EXT, GL_STENCIL, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &gl_stencilbits);
@ -1374,7 +1374,7 @@ void GLBE_Init(void)
gl_overbright.modified = true; /*in case the d3d renderer does the same*/
/*lock the cvar down if the backend can't actually do it*/
if (!gl_config.tex_env_combine && !gl_config.nofixedfunc && gl_overbright.ival)
if (!gl_config.tex_env_combine && !gl_config_nofixedfunc && gl_overbright.ival)
Cvar_ApplyLatchFlag(&gl_overbright, "0", CVAR_RENDERERLATCH);
shaderstate.shaderbits = ~SBITS_ATEST_BITS;
BE_SendPassBlendDepthMask(0);
@ -1411,7 +1411,7 @@ void GLBE_Init(void)
R_InitFlashblends();
//only do this where we have to.
if (qglBufferDataARB && gl_config.nofixedfunc)
if (qglBufferDataARB && gl_config_nofixedfunc)
{
memset(&shaderstate.streamvbo, 0, sizeof(shaderstate.streamvbo));
memset(&shaderstate.streamebo, 0, sizeof(shaderstate.streamebo));
@ -1425,6 +1425,7 @@ void GLBE_Init(void)
//end tables
#ifndef GLSLONLY
#define MAX_ARRAY_VERTS 65535
static avec4_t coloursarray[MAX_ARRAY_VERTS];
static float texcoordarray[SHADER_PASS_MAX][MAX_ARRAY_VERTS*2];
@ -2442,6 +2443,7 @@ static void BE_GeneratePassTC(const shaderpass_t *pass, int tmu)
GenerateTCMods(pass, tmu);
}
}
#endif
static void BE_SendPassBlendDepthMask(unsigned int sbits)
{
@ -2527,7 +2529,7 @@ static void BE_SendPassBlendDepthMask(unsigned int sbits)
}
#ifdef GL_ALPHA_TEST //alpha test doesn't exist in gles2
if ((delta & SBITS_ATEST_BITS) && !gl_config.nofixedfunc)
if ((delta & SBITS_ATEST_BITS) && !gl_config_nofixedfunc)
{
switch (sbits & SBITS_ATEST_BITS)
{
@ -2603,7 +2605,7 @@ static void BE_SendPassBlendDepthMask(unsigned int sbits)
#ifdef GL_PERSPECTIVE_CORRECTION_HINT
if ((delta & SBITS_AFFINE) && qglHint)
{
if (!qglHint || (gl_config.gles && gl_config.glversion >= 2) || (!gl_config.gles && gl_config.nofixedfunc))
if (!qglHint || (gl_config_gles && gl_config.glversion >= 2) || (!gl_config_gles && gl_config_nofixedfunc))
; //doesn't exist in gles2 nor gl3+core contexts
else if (sbits & SBITS_AFFINE)
qglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST);
@ -2724,6 +2726,7 @@ static void BE_SubmitMeshChain(void)
}
}
#ifndef GLSLONLY
static void DrawPass(const shaderpass_t *pass)
{
int i, j, k;
@ -2844,6 +2847,7 @@ static void DrawPass(const shaderpass_t *pass)
BE_SubmitMeshChain();
}
#endif
static void BE_Program_Set_Attributes(const program_t *prog, unsigned int perm, qboolean entunchanged)
{
@ -3217,7 +3221,23 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
BE_SendPassBlendDepthMask(pass->shaderbits);
BE_EnableShaderAttributes(p->permu[perm].attrmask, shaderstate.sourcevbo->vao);
if (p->nofixedcompat)
#ifndef GLSLONLY
if (!p->nofixedcompat)
{
GenerateColourMods(pass);
for (i = 0; i < pass->numMergedPasses; i++)
{
Shader_BindTextureForPass(i, pass+i);
BE_GeneratePassTC(pass+i, i);
}
for (; i < shaderstate.lastpasstmus; i++)
{
GL_LazyBind(i, 0, r_nulltex);
}
shaderstate.lastpasstmus = pass->numMergedPasses;
}
else
#endif
{
for (i = 0; i < pass->numMergedPasses; i++)
{
@ -3248,20 +3268,6 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
shaderstate.lastpasstmus = pass->numMergedPasses;
}
}
else
{
GenerateColourMods(pass);
for (i = 0; i < pass->numMergedPasses; i++)
{
Shader_BindTextureForPass(i, pass+i);
BE_GeneratePassTC(pass+i, i);
}
for (; i < shaderstate.lastpasstmus; i++)
{
GL_LazyBind(i, 0, r_nulltex);
}
shaderstate.lastpasstmus = pass->numMergedPasses;
}
BE_SubmitMeshChain();
}
@ -3330,10 +3336,10 @@ void GLBE_SelectMode(backendmode_t mode)
/*BEM_STENCIL doesn't support mesh writing*/
GLBE_PushOffsetShadow(false);
if (gl_config.nofixedfunc && !shaderstate.allblackshader)
if (gl_config_nofixedfunc && !shaderstate.allblackshader)
{
char *defs[] = {NULL};
shaderstate.allblackshader = GLSlang_CreateProgram("allblackprogram", gl_config.gles?100:110, defs, "#include \"sys/skeletal.h\"\nvoid main(){gl_Position = skeletaltransform();}", "void main(){gl_FragColor=vec4(0.0,0.0,0.0,1.0);}", false, NULL);
const char *defs[] = {NULL};
shaderstate.allblackshader = GLSlang_CreateProgram("allblackprogram", gl_config_gles?100:110, defs, "#include \"sys/skeletal.h\"\nvoid main(){gl_Position = skeletaltransform();}", "void main(){gl_FragColor=vec4(0.0,0.0,0.0,1.0);}", false, NULL);
shaderstate.allblack_mvp = qglGetUniformLocationARB(shaderstate.allblackshader, "m_modelviewprojection");
}
@ -3342,7 +3348,7 @@ void GLBE_SelectMode(backendmode_t mode)
{
GL_LazyBind(--shaderstate.lastpasstmus, 0, r_nulltex);
}
if (!gl_config.nofixedfunc)
if (!gl_config_nofixedfunc)
{
GL_DeSelectProgram();
@ -3587,7 +3593,7 @@ void GLBE_PushOffsetShadow(qboolean pushdepth)
}
}
#ifdef RTLIGHTS
#if defined(RTLIGHTS) && !defined(GLSLONLY)
texid_t GenerateNormalisationCubeMap(void);
static void BE_LegacyLighting(void)
{
@ -3755,11 +3761,13 @@ static void DrawMeshes(void)
}
}
#ifndef GLSLONLY
if (shaderstate.sourcevbo->coord2.gl.addr && (shaderstate.curshader->numdeforms || !shaderstate.curshader->prog))
GenerateVertexBlends(shaderstate.curshader);
else if (shaderstate.curshader->numdeforms)
GenerateVertexDeforms(shaderstate.curshader);
else
#endif
{
shaderstate.pendingvertexpointer = shaderstate.sourcevbo->coord.gl.addr;
shaderstate.pendingvertexvbo = shaderstate.sourcevbo->coord.gl.vbo;
@ -3785,8 +3793,10 @@ static void DrawMeshes(void)
altshader = shaderstate.shader_light[shaderstate.lightmode];
if (altshader && altshader->prog)
BE_RenderMeshProgram(altshader, altshader->passes);
#ifndef GLSLONLY
else
BE_LegacyLighting();
#endif
break;
case BEM_DEPTHNORM:
altshader = shaderstate.curshader->bemoverrides[bemoverride_prelight];
@ -3825,11 +3835,13 @@ static void DrawMeshes(void)
break;
case BEM_FOG:
#ifndef GLSLONLY
GL_DeSelectProgram();
GenerateTCFog(0, NULL);
BE_EnableShaderAttributes((1u<<VATTR_LEG_VERTEX), 0);
BE_SubmitMeshChain();
#endif
break;
case BEM_WIREFRAME:
@ -3850,14 +3862,14 @@ static void DrawMeshes(void)
BE_SubmitMeshChain();
break;
case BEM_DEPTHDARK:
if ((shaderstate.curshader->flags & SHADER_HASLIGHTMAP) && !TEXVALID(shaderstate.curtexnums->fullbright) && !gl_config.nofixedfunc)
if ((shaderstate.curshader->flags & SHADER_HASLIGHTMAP) && !TEXVALID(shaderstate.curtexnums->fullbright) && !gl_config_nofixedfunc)
{
if (gl_config.arb_shader_objects)
{
if (!shaderstate.allblackshader)
{
const char *defs[] = {NULL};
shaderstate.allblackshader = GLSlang_CreateProgram("allblackprogram", gl_config.gles?100:110, defs, "#include \"sys/skeletal.h\"\nvoid main(){gl_Position = skeletaltransform();}", "void main(){gl_FragColor=vec4(0.0,0.0,0.0,1.0);}", false, NULL);
shaderstate.allblackshader = GLSlang_CreateProgram("allblackprogram", gl_config_gles?100:110, defs, "#include \"sys/skeletal.h\"\nvoid main(){gl_Position = skeletaltransform();}", "void main(){gl_FragColor=vec4(0.0,0.0,0.0,1.0);}", false, NULL);
shaderstate.allblack_mvp = qglGetUniformLocationARB(shaderstate.allblackshader, "m_modelviewprojection");
}
@ -3900,7 +3912,10 @@ static void DrawMeshes(void)
{
BE_RenderMeshProgram(shaderstate.curshader, shaderstate.curshader->passes);
}
else if (gl_config.nofixedfunc)
#ifdef GLSLONLY
break;
#else
else if (gl_config_nofixedfunc)
break;
else
{
@ -3940,6 +3955,7 @@ static void DrawMeshes(void)
BE_SubmitMeshChain();
}
break;
#endif
}
}

View File

@ -1250,9 +1250,13 @@ static void GL_Upload32_Int (const char *name, unsigned *data, int width, int he
else if (gl_config.gles)
{
glcolormode = GL_RGBA; /*our input is RGBA or RGBX, with the internal format restriction, we must therefore always have an alpha value*/
type = GL_UNSIGNED_BYTE;
if (flags & IF_NOALPHA)
if (gl_config.webgl_ie)
{
type = GL_UNSIGNED_BYTE;
glcolormode = GL_RGBA; //I hope its 1. note that samples matching colormode means we can't use packed formats, and I'm too lazy to strip it
}
else if (flags & IF_NOALPHA)
{
/*no alpha there, yay*/
type = GL_UNSIGNED_SHORT_5_6_5;

View File

@ -66,7 +66,7 @@ void Mod_LoadDoomSprite (model_t *mod);
#endif
#define MAX_MOD_KNOWN 8192
model_t mod_known[MAX_MOD_KNOWN];
model_t *mod_known;
int mod_numknown;
extern cvar_t r_loadlits;
@ -514,6 +514,7 @@ Mod_Init
*/
void Mod_Init (qboolean initial)
{
mod_known = malloc(MAX_MOD_KNOWN * sizeof(*mod_known));
if (!initial)
{
Mod_ClearAll(); //shouldn't be needed
@ -581,13 +582,17 @@ void Mod_Shutdown (qboolean final)
{
Mod_ClearAll();
Mod_Purge(MP_RESET);
mod_numknown = 0;
Cmd_RemoveCommand("mod_memlist");
Cmd_RemoveCommand("mod_batchlist");
Cmd_RemoveCommand("mod_texturelist");
Cmd_RemoveCommand("mod_usetexture");
}
free(mod_known);
mod_known = NULL;
mod_numknown = 0;
r_worldentity.model = NULL; //just in case.
}
/*
@ -2624,6 +2629,7 @@ static void Mod_Batches_BuildModelMeshes(model_t *mod, int maxverts, int maxindi
int styles = mod->lightmaps.surfstyles;
char *ptr;
memset(&vbo, 0, sizeof(vbo));
vbo.indicies.dummy = ZG_Malloc(&loadmodel->memgroup, sizeof(index_t) * maxindicies);
ptr = ZG_Malloc(&loadmodel->memgroup, (sizeof(vecV_t)+sizeof(vec2_t)*(1+styles)+sizeof(vec3_t)*3+sizeof(vec4_t)*styles)* maxverts);
vbo.coord.dummy = ptr;

View File

@ -511,8 +511,9 @@ void R_SetupGL (float stereooffset)
qglDisable(GL_DITHER);
}
}
if (vid_srgb.modified)
if (vid_srgb.modified && !gl_config_gles)
{
vid_srgb.modified = false;
if (vid_srgb.ival)
qglEnable(GL_FRAMEBUFFER_SRGB);
else
@ -1567,9 +1568,9 @@ void GLR_RenderView (void)
Surf_SetupFrame();
r_refdef.flags &= ~RDF_ALLPOSTPROC;
//if bloom is
if (R_CanBloom())
r_refdef.flags |= RDF_BLOOM;
if (!(r_refdef.flags & RDF_NOWORLDMODEL))
if (R_CanBloom())
r_refdef.flags |= RDF_BLOOM;
//check if we can do underwater warp
if (cls.protocol != CP_QUAKE2) //quake2 tells us directly
@ -1587,8 +1588,7 @@ void GLR_RenderView (void)
r_refdef.flags |= RDF_WATERWARP; //try fullscreen warp instead if we can
}
//
if (*r_postprocshader.string)
if (!(r_refdef.flags & RDF_NOWORLDMODEL) && (*r_postprocshader.string))
{
custompostproc = R_RegisterCustom(r_postprocshader.string, SUF_NONE, NULL, NULL);
if (custompostproc)

View File

@ -313,15 +313,24 @@ static qboolean Shader_EvaluateCondition(shader_t *shader, char **ptr)
}
else
{
float lhs;
cv = Cvar_Get(token, "", 0, "Shader Conditions");
if (!cv)
if (cv)
{
Con_Printf("Shader_EvaluateCondition: '%s' is not a cvar\n", token);
return conditiontrue;
cv->flags |= CVAR_SHADERSYSTEM;
lhs = cv->value;
}
else
{
if (*token < '0' || *token > '9')
{
Con_Printf("Shader_EvaluateCondition: '%s' is not a cvar\n", token);
return conditiontrue;
}
lhs = strtod(token, NULL);
}
if (*token)
token = COM_ParseExt(ptr, false, false);
cv->flags |= CVAR_SHADERSYSTEM;
if (*token)
{
float rhs;
@ -330,17 +339,17 @@ static qboolean Shader_EvaluateCondition(shader_t *shader, char **ptr)
token = COM_ParseExt(ptr, false, false);
rhs = atof(token);
if (!strcmp(cmp, "!="))
conditiontrue = cv->value != rhs;
conditiontrue = lhs != rhs;
else if (!strcmp(cmp, "=="))
conditiontrue = cv->value == rhs;
conditiontrue = lhs == rhs;
else if (!strcmp(cmp, "<"))
conditiontrue = cv->value < rhs;
conditiontrue = lhs < rhs;
else if (!strcmp(cmp, "<="))
conditiontrue = cv->value <= rhs;
conditiontrue = lhs <= rhs;
else if (!strcmp(cmp, ">"))
conditiontrue = cv->value > rhs;
conditiontrue = lhs > rhs;
else if (!strcmp(cmp, ">="))
conditiontrue = cv->value >= rhs;
conditiontrue = lhs >= rhs;
else
conditiontrue = false;
}
@ -1323,7 +1332,10 @@ static void Shader_LoadGeneric(sgeneric_t *g, int qrtype)
else
{
if (sh_config.progpath)
FS_LoadFile(va(sh_config.progpath, basicname), &file);
{
Q_snprintfz(blobname, sizeof(blobname), sh_config.progpath, basicname);
FS_LoadFile(blobname, &file);
}
else
file = NULL;
if (sh_config.blobpath && r_shaderblobs.ival)
@ -4174,24 +4186,37 @@ void Shader_DefaultSkybox(const char *shortname, shader_t *s, const void *args)
);
}
char *Shader_DefaultBSPWater(const char *shortname)
char *Shader_DefaultBSPWater(shader_t *s, const char *shortname)
{
int wstyle;
int islava = !strncmp(shortname, "*lava", 5);
int type;
float alpha;
qboolean explicitalpha = false;
cvar_t *alphavars[] = { &r_wateralpha, &r_lavaalpha, &r_slimealpha, &r_telealpha};
cvar_t *stylevars[] = { &r_waterstyle, &r_lavastyle, &r_slimestyle, &r_telestyle};
if (!strncmp(shortname, "*lava", 5))
type = 1;
else if (!strncmp(shortname, "*slime", 6))
type = 2;
else if (!strncmp(shortname, "*tele", 5))
type = 3;
else
type = 0;
alpha = Shader_FloatArgument(s, "ALPHA");
if (alpha)
explicitalpha = true;
else
alpha = *alphavars[type]->string?alphavars[type]->value:alphavars[0]->value;
if (((islava && *r_lavaalpha.string)?r_lavaalpha.value:r_wateralpha.value) <= 0)
if (alpha <= 0)
wstyle = -1;
else if (r_fastturb.ival)
wstyle = 0;
#ifdef GLQUAKE
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && islava && *r_lavastyle.string)
wstyle = r_lavastyle.ival;
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && !strncmp(shortname, "*slime", 5) && *r_slimestyle.string)
wstyle = r_slimestyle.ival;
else if (!strncmp(shortname, "*lava", 5))
wstyle = -2;
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && strncmp(shortname, "*lava", 5))
wstyle = r_waterstyle.ival<1?1:r_waterstyle.ival;
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && *stylevars[type]->string)
wstyle = stylevars[type]->ival;
else if (qrenderer == QR_OPENGL && gl_config.arb_shader_objects && stylevars[0]->ival > 0)
wstyle = stylevars[0]->ival;
#endif
else
wstyle = 1;
@ -4232,54 +4257,20 @@ char *Shader_DefaultBSPWater(const char *shortname)
);
default:
case 1: //vanilla style
if (islava && *r_lavaalpha.string)
{
return (
return va(
"{\n"
"program defaultwarp\n"
"program defaultwarp%s\n"
"{\n"
"map $diffuse\n"
"tcmod turb 0.02 0.1 0.5 0.1\n"
"if !$#ALPHA\n"
"if r_lavaalpha < 1\n"
"alphagen const $r_lavaalpha\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"else\n"
"if $#ALPHA < 1\n"
"alphagen const $#ALPHA\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"if %g < 1\n"
"alphagen const %g\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"}\n"
"surfaceparm nodlight\n"
"}\n"
);
}
else
{
return (
"{\n"
"program defaultwarp\n"
"{\n"
"map $diffuse\n"
"tcmod turb 0.02 0.1 0.5 0.1\n"
"if !$#ALPHA\n"
"if r_wateralpha < 1\n"
"alphagen const $r_wateralpha\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"else\n"
"if $#ALPHA < 1\n"
"alphagen const $#ALPHA\n"
"blendfunc gl_src_alpha gl_one_minus_src_alpha\n"
"endif\n"
"endif\n"
"}\n"
"surfaceparm nodlight\n"
"}\n"
);
}
, explicitalpha?"":va("#ALPHA=%g",alpha), alpha, alpha);
case 2: //refraction of the underwater surface, with a fresnel
return (
"{\n"
@ -4367,7 +4358,7 @@ char *Shader_DefaultBSPWater(const char *shortname)
void Shader_DefaultWaterShader(const char *shortname, shader_t *s, const void *args)
{
Shader_DefaultScript(shortname, s, Shader_DefaultBSPWater(shortname));
Shader_DefaultScript(shortname, s, Shader_DefaultBSPWater(s, shortname));
}
void Shader_DefaultBSPQ2(const char *shortname, shader_t *s, const void *args)
{
@ -4382,7 +4373,7 @@ void Shader_DefaultBSPQ2(const char *shortname, shader_t *s, const void *args)
}
else if (!strncmp(shortname, "warp/", 5) || !strncmp(shortname, "warp33/", 7) || !strncmp(shortname, "warp66/", 7))
{
Shader_DefaultScript(shortname, s, Shader_DefaultBSPWater(shortname));
Shader_DefaultScript(shortname, s, Shader_DefaultBSPWater(s, shortname));
}
else if (!strncmp(shortname, "trans/", 6))
Shader_DefaultScript(shortname, s,
@ -4433,7 +4424,7 @@ void Shader_DefaultBSPQ1(const char *shortname, shader_t *s, const void *args)
if (!builtin && (*shortname == '*'))
{
builtin = Shader_DefaultBSPWater(shortname);
builtin = Shader_DefaultBSPWater(s, shortname);
}
if (!builtin && !strncmp(shortname, "sky", 3))
{

View File

@ -576,11 +576,9 @@ static struct {
short count2;
int next;
int prev;
} edge[MAX_MAP_EDGES];
} *edge;
static int firstedge;
//} *edge;
//static int firstedge;
//static int maxedge;
static int maxedge;
static void SHM_RecursiveWorldNodeQ1_r (dlight_t *dl, mnode_t *node)
{
@ -1407,11 +1405,12 @@ static struct shadowmesh_s *SHM_BuildShadowMesh(dlight_t *dl, unsigned char *lvi
}
firstedge=0;
// if (maxedge < cl.worldmodel->numedges)
// {
// maxedge = cl.worldmodel->numedges;
// edge = realloc(edge, sizeof(*edge) * maxedge);
// }
if (maxedge < cl.worldmodel->numedges)
{
maxedge = cl.worldmodel->numedges;
free(edge);
edge = malloc(sizeof(*edge) * maxedge);
}
if (cl.worldmodel->type == mod_brush)
{
@ -3229,6 +3228,8 @@ void Sh_PurgeShadowMeshes(void)
dl->rebuildcache = true;
}
}
free(edge);
edge = NULL;
}
void Sh_PreGenerateLights(void)

View File

@ -58,11 +58,6 @@ void (APIENTRY *qglStencilOpSeparateATI) (GLenum face, GLenum fail, GLenum zfail
void (APIENTRY *qglGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params);
void (APIENTRY *qglGetVertexAttribPointerv) (GLuint index, GLenum pname, GLvoid* *pointer);
//GL_OES_get_program_binary
void (APIENTRY *qglGetProgramBinary)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
void (APIENTRY *qglProgramBinary)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
#define GL_PROGRAM_BINARY_LENGTH 0x8741
//quick hack that made quake work on both 1+ext and 1.1 gl implementations.
BINDTEXFUNCPTR qglBindTexture;
@ -87,8 +82,6 @@ FTEPFNGLBINDATTRIBLOCATIONARBPROC qglBindAttribLocationARB;
FTEPFNGLGETATTRIBLOCATIONARBPROC qglGetAttribLocationARB;
FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB;
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB;
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv;
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv;
FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB;
FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB;
FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB;
@ -98,6 +91,14 @@ FTEPFNGLUNIFORM1IARBPROC qglUniform1iARB;
FTEPFNGLUNIFORM1FARBPROC qglUniform1fARB;
FTEPFNGLGETSHADERSOURCEARBPROC qglGetShaderSource;
#endif
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv;
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv;
//GL_OES_get_program_binary
void (APIENTRY *qglGetProgramBinary)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
void (APIENTRY *qglProgramBinary)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
#define GL_PROGRAM_BINARY_LENGTH 0x8741
//standard 1.1 opengl calls
void (APIENTRY *qglAlphaFunc) (GLenum func, GLclampf ref);
void (APIENTRY *qglBegin) (GLenum mode);
@ -412,6 +413,9 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
{
gl_config.gles = true;
webgl = true;
if (!strcmp(gl_renderer, "Internet Explorer"))
gl_config.webgl_ie = true;
}
else if (!strncmp(gl_version, "OpenGL ES", 9))
gl_config.gles = true;
@ -1377,6 +1381,7 @@ static GLhandleARB GLSlang_CreateShader (const char *name, int ver, const char *
const GLchar *prstrings[64+16];
GLint length[sizeof(prstrings)/sizeof(prstrings[0])];
int strings = 0;
char verline[64];
if (ver)
{
@ -1388,7 +1393,8 @@ static GLhandleARB GLSlang_CreateShader (const char *name, int ver, const char *
if (ver != 100)
#endif
{
prstrings[strings] = va("#version %u\n", ver);
Q_snprintfz(verline, sizeof(verline), "#version %u\n", ver);
prstrings[strings] = verline;
length[strings] = strlen(prstrings[strings]);
strings++;
}
@ -1449,9 +1455,9 @@ static GLhandleARB GLSlang_CreateShader (const char *name, int ver, const char *
"#else\n"
"#define v_position v_position1\n"
"#endif\n"
"vec4 ftetransform() { return m_modelviewprojection * vec4(v_position, 1.0); }\n"
// "#define ftetransform() (m_modelviewprojection * vec4(v_position, 1.0))\n"
"uniform mat4 m_modelviewprojection;\n"
// "#define ftetransform() (m_modelviewprojection * vec4(v_position, 1.0))\n"
"vec4 ftetransform() { return m_modelviewprojection * vec4(v_position, 1.0); }\n"
;
length[strings] = strlen(prstrings[strings]);
strings++;
@ -1463,12 +1469,12 @@ static GLhandleARB GLSlang_CreateShader (const char *name, int ver, const char *
"attribute vec3 v_position2;\n"
"uniform vec2 e_vblend;\n"
"#define v_position (gl_Vertex.xyz*e_vblend.x+v_position2*e_vblend.y)\n"
"#define ftetransform() (m_modelviewprojection * vec4(v_position, 1.0))\n"
"uniform mat4 m_modelviewprojection;\n"
"#define ftetransform() (m_modelviewprojection * vec4(v_position, 1.0))\n"
"#else\n"
"#define v_position gl_Vertex.xyz\n"
"#define ftetransform ftransform\n"
"uniform mat4 m_modelviewprojection;\n"
"#define ftetransform ftransform\n"
"#endif\n"
;
length[strings] = strlen(prstrings[strings]);
@ -1827,10 +1833,12 @@ static void GLSlang_ProgAutoFields(program_t *prog, char **cvarnames, int *cvart
found = false;
for (p = 0; p < PERMUTATIONS; p++)
{
char uniformname[64];
if (!prog->permu[p].handle.glsl)
continue;
GL_SelectProgram(prog->permu[p].handle.glsl);
uniformloc = qglGetUniformLocationARB(prog->permu[p].handle.glsl, va("cvar_%s", tmpname));
Q_snprintfz(uniformname, sizeof(uniformname), "cvar_%s", tmpname);
uniformloc = qglGetUniformLocationARB(prog->permu[p].handle.glsl, uniformname);
if (uniformloc != -1)
{
//qglUniform1fARB(uniformloc, cvar->value);
@ -1851,7 +1859,8 @@ static void GLSlang_ProgAutoFields(program_t *prog, char **cvarnames, int *cvart
GLSlang_UseProgram(prog->permu[p].handle.glsl);
for (i = 0; i < 8; i++)
{
uniformloc = qglGetUniformLocationARB(prog->permu[p].handle.glsl, va("s_t%i", i));
Q_snprintfz(tmpname, sizeof(tmpname), "s_t%i", i);
uniformloc = qglGetUniformLocationARB(prog->permu[p].handle.glsl, tmpname);
if (uniformloc != -1)
qglUniform1iARB(uniformloc, i);
}
@ -2072,7 +2081,7 @@ void GL_Init(void *(*getglfunction) (char *name))
}
sh_config.progs_supported = gl_config.arb_shader_objects;
sh_config.progs_required = gl_config.nofixedfunc;
sh_config.progs_required = gl_config_nofixedfunc;
sh_config.pDeleteProg = GLSlang_DeleteProg;
sh_config.pLoadBlob = qglProgramBinary?GLSlang_LoadBlob:NULL;

View File

@ -149,7 +149,7 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
{
SDL_Surface *iconsurf;
#include "bymorphed.h"
iconsurf = SDL_CreateRGBSurfaceFrom(icon.pixel_data, icon.width, icon.height, 32, 4*icon.height, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //RGBA byte order on a little endian machine, at least...
iconsurf = SDL_CreateRGBSurfaceFrom((void*)icon.pixel_data, icon.width, icon.height, 32, 4*icon.height, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); //RGBA byte order on a little endian machine, at least...
SDL_SetWindowIcon(sdlwindow, iconsurf);
SDL_FreeSurface(iconsurf);
}

View File

@ -207,6 +207,7 @@ typedef struct {
int maxglslversion;
qboolean nofixedfunc;
qboolean gles;
qboolean webgl_ie; //workaround ie webgl bugs/omissions.
qboolean tex_env_combine;
qboolean nv_tex_env_combine4;
qboolean env_add;

View File

@ -637,6 +637,14 @@ typedef struct
} sh_config_t;
extern sh_config_t sh_config;
#ifdef GLSLONLY
#define gl_config_nofixedfunc true
#define gl_config_gles true
#else
#define gl_config_nofixedfunc gl_config.nofixedfunc
#define gl_config_gles gl_config.gles
#endif
#ifdef GLQUAKE
void GLBE_Init(void);
void GLBE_Shutdown(void);

View File

@ -17,8 +17,9 @@
#include <emscripten/emscripten.h>
#endif
static void DL_Abort(struct dl_download *dl)
static void DL_Cancel(struct dl_download *dl)
{
//FIXME: clear out the callbacks somehow
dl->ctx = NULL;
}
static void DL_OnLoad(void *c, void *data, int datasize)
@ -73,6 +74,7 @@ static void DL_OnError(void *c)
static void DL_OnProgress(void *c, int position, int totalsize)
{
struct dl_download *dl = c;
dl->completed = position;
dl->totalsize = totalsize;
}
@ -86,22 +88,24 @@ qboolean DL_Decide(struct dl_download *dl)
if (dl->postdata)
{
DL_Abort(dl);
DL_Cancel(dl);
return false; //safe to destroy it now
}
if (dl->ctx)
{
if (dl->status == DL_FAILED || dl->status == DL_FINISHED)
if (dl->status == DL_FINISHED)
return false;
if (dl->status == DL_FAILED)
{
DL_Abort(dl);
return false; //safe to destroy it now
DL_Cancel(dl);
return false;
}
}
else
{
dl->status = DL_ACTIVE;
dl->abort = DL_Abort;
dl->abort = DL_Cancel;
dl->ctx = dl;
#if MYJS

View File

@ -14,7 +14,6 @@ extern PPB_Graphics3D* graphics3d_interface;
extern PP_Instance pp_instance;
static PP_Resource glcontext;
extern PPB_Instance* instance_interface;
int delayedswap = false;
qboolean swappending;
extern cvar_t vid_vsync;
@ -33,42 +32,27 @@ void swap_callback(void* user_data, int32_t result)
FrameEvent(NULL, 0);
}
}
void GL_BeginRendering (void)
void GLVID_SwapBuffers(void)
{
}
void GL_EndRendering (void)
{
delayedswap = true;
qboolean vsync = vid_vsync.ival || !*vid_vsync.string;
struct PP_CompletionCallback ccb = { swap_callback, NULL, vsync?PP_COMPLETIONCALLBACK_FLAG_NONE:PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
glFlush();
// if (!gl_lateswap.value)
// GL_DoSwap();
}
void GL_DoSwap(void)
{
if (delayedswap)
switch(graphics3d_interface->SwapBuffers(glcontext, ccb))
{
qboolean vsync = vid_vsync.ival || !*vid_vsync.string;
struct PP_CompletionCallback ccb = { swap_callback, NULL, vsync?PP_COMPLETIONCALLBACK_FLAG_NONE:PP_COMPLETIONCALLBACK_FLAG_OPTIONAL};
glFlush();
delayedswap = false;
switch(graphics3d_interface->SwapBuffers(glcontext, ccb))
{
case PP_OK_COMPLETIONPENDING:
swappending |= vsync;
break;
case PP_OK:
break;
case PP_ERROR_INPROGRESS:
Con_DPrintf("chrome still can't handle vid_wait 0. forcing vsync\n");
vid_vsync.ival = 1;
break;
default:
Con_DPrintf("unknown error on SwapBuffers call\n");
break;
}
case PP_OK_COMPLETIONPENDING:
swappending |= vsync;
break;
case PP_OK:
break;
case PP_ERROR_INPROGRESS:
Con_DPrintf("chrome still can't handle vid_wait 0. forcing vsync\n");
vid_vsync.ival = 1;
break;
default:
Con_DPrintf("unknown error on SwapBuffers call\n");
break;
}
}

View File

@ -183,7 +183,7 @@ static void PR_memvalidate (progfuncs_t *progfuncs)
if (b < 0 || b >= prinst.addressableused)
{
printf("PF_memalloc: memory corruption\n");
PR_StackTrace(&progfuncs->funcs);
PR_StackTrace(&progfuncs->funcs, false);
return;
}
p = (qcmemfreeblock_t*)(progfuncs->funcs.stringtable + b);
@ -195,7 +195,7 @@ static void PR_memvalidate (progfuncs_t *progfuncs)
p->prev >= b)
{
printf("PF_memalloc: memory corruption\n");
PR_StackTrace(&progfuncs->funcs);
PR_StackTrace(&progfuncs->funcs, false);
return;
}
l = b;

View File

@ -1277,10 +1277,12 @@ static int PR_ExecuteCode16 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
while (progfuncs->funcs.pr_trace || prinst.watch_ptr || prinst.profiling)
{
#ifdef FTE_TARGET_WEB
cont16:
reeval16:
//this can generate huge functions, so disable it on systems that can't realiably cope with such things (IE initiates an unwanted denial-of-service attack when pointed our javascript, and firefox prints a warning too)
pr_xstatement = st-pr_statements;
pr_xstatement = st-pr_statements16;
PR_RunError (&progfuncs->funcs, "This platform does not support QC debugging.\n");
PR_StackTrace(&progfuncs->funcs);
PR_StackTrace(&progfuncs->funcs, false);
return -1;
#else
#define DEBUGABLE
@ -1302,6 +1304,14 @@ static int PR_ExecuteCode16 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
static int PR_ExecuteCode32 (progfuncs_t *fte_restrict progfuncs, int s, int *fte_restrict runaway)
{
#ifdef FTE_TARGET_WEB
//this can generate huge functions, so disable it on systems that can't realiably cope with such things (IE initiates an unwanted denial-of-service attack when pointed our javascript, and firefox prints a warning too)
pr_xstatement = s;
PR_RunError (&progfuncs->funcs, "32bit qc statement support was disabled for this platform.\n");
PR_StackTrace(&progfuncs->funcs, false);
return -1;
#else
eval_t *t, *swtch=NULL;
int swtchtype = 0; //warning about not being initialized before use
@ -1323,13 +1333,6 @@ static int PR_ExecuteCode32 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
st = &pr_statements32[s];
while (progfuncs->funcs.pr_trace || prinst.watch_ptr || prinst.profiling)
{
#ifdef FTE_TARGET_WEB
//this can generate huge functions, so disable it on systems that can't realiably cope with such things (IE initiates an unwanted denial-of-service attack when pointed our javascript, and firefox prints a warning too)
pr_xstatement = st-pr_statements;
PR_RunError (&progfuncs->funcs, "This platform does not support QC debugging.\n");
PR_StackTrace(&progfuncs->funcs, false);
return -1;
#else
#define DEBUGABLE
#ifdef SEPARATEINCLUDES
#include "execloop32d.h"
@ -1337,7 +1340,6 @@ static int PR_ExecuteCode32 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
#include "execloop.h"
#endif
#undef DEBUGABLE
#endif
}
while(1)
@ -1349,6 +1351,7 @@ static int PR_ExecuteCode32 (progfuncs_t *fte_restrict progfuncs, int s, int *ft
#endif
}
#undef INTSIZE
#endif
}
/*
@ -1446,7 +1449,7 @@ void PDECL PR_ExecuteProgram (pubprogfuncs_t *ppf, func_t fnum)
{
// if (pr_global_struct->self)
// ED_Print (PROG_TO_EDICT(pr_global_struct->self));
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(FTE_TARGET_WEB)
printf("PR_ExecuteProgram: NULL function from exe (address %p)\n", __builtin_return_address(0));
#else
printf("PR_ExecuteProgram: NULL function from exe\n");

View File

@ -653,9 +653,8 @@ pbool QCC_PR_Precompiler(void)
else if (!strncmp(directive, "error", 5))
{
pr_file_p = directive+5;
for (a = 0; a < sizeof(msg)-1 && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
for (a = 0; a < sizeof(msg)-1 && pr_file_p[a] != '\t' && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
msg[a] = pr_file_p[a];
msg[a] = '\0';
QCC_PR_SkipToEndOfLine(false);
@ -665,10 +664,9 @@ pbool QCC_PR_Precompiler(void)
else if (!strncmp(directive, "warning", 7))
{
pr_file_p = directive+7;
for (a = 0; a < 1023 && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
for (a = 0; a < 1023 && pr_file_p[a] != '\r' && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
msg[a] = pr_file_p[a];
msg[a-1] = '\0';
msg[a] = '\0';
QCC_PR_SkipToEndOfLine(false);
@ -677,10 +675,9 @@ pbool QCC_PR_Precompiler(void)
else if (!strncmp(directive, "message", 7))
{
pr_file_p = directive+7;
for (a = 0; a < sizeof(msg)-1 && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
for (a = 0; a < sizeof(msg)-1 && pr_file_p[a] != '\r' && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
msg[a] = pr_file_p[a];
msg[a-1] = '\0';
msg[a] = '\0';
if (flag_msvcstyle)
printf ("%s(%i) : #message: %s\n", strings + s_file, pr_source_line, msg);
@ -691,10 +688,9 @@ pbool QCC_PR_Precompiler(void)
else if (!strncmp(directive, "copyright", 9))
{
pr_file_p = directive+9;
for (a = 0; a < sizeof(msg)-1 && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
for (a = 0; a < sizeof(msg)-1 && qcc_iswhite(pr_file_p[a]) && pr_file_p[a] != '\0'; a++)
msg[a] = pr_file_p[a];
msg[a-1] = '\0';
msg[a] = '\0';
QCC_PR_SkipToEndOfLine(false);
@ -715,10 +711,9 @@ pbool QCC_PR_Precompiler(void)
ifmode = 1;
pr_file_p++;
}
for (a = 0; a < sizeof(msg)-1 && pr_file_p[a] != '\n' && pr_file_p[a] != '\0'; a++)
for (a = 0; a < sizeof(msg)-1 && qcc_iswhite(pr_file_p[a]) && pr_file_p[a] != '\0'; a++)
msg[a] = pr_file_p[a];
msg[a-1] = '\0';
msg[a] = '\0';
QCC_PR_SkipToEndOfLine(true);

View File

@ -5050,7 +5050,7 @@ void QCBUILTIN PF_changelevel (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
if ((int)pr_global_struct->serverflags & (16|32))
{
COM_QuotedString(va("*%s", PR_GetStringOfs(prinst, OFS_PARM0)), newmap, sizeof(newmap));
Cbuf_AddText (va("\nmap %s %s\n", newmap, startspot), RESTRICT_LOCAL);
Cbuf_AddText (va("\nchangelevel %s %s\n", newmap, startspot), RESTRICT_LOCAL);
}
else
{
@ -5067,7 +5067,7 @@ void QCBUILTIN PF_changelevel (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
Cbuf_AddText (va("\nchangelevel %s %s\n", newmap, startspot), RESTRICT_LOCAL);
}
else
Cbuf_AddText (va("\nmap %s\n", newmap), RESTRICT_LOCAL);
Cbuf_AddText (va("\nchangelevel %s\n", newmap), RESTRICT_LOCAL);
}
}
@ -7423,7 +7423,7 @@ static void QCBUILTIN PF_h2rain_go(pubprogfuncs_t *prinst, struct globalvars_s *
//used by (tomed) icemace.hc
float *min = G_VECTOR(OFS_PARM0);
float *max = G_VECTOR(OFS_PARM1);
float *size = G_VECTOR(OFS_PARM2);
//unused float *size = G_VECTOR(OFS_PARM2);
float *dir = G_VECTOR(OFS_PARM3);
float colour = G_FLOAT(OFS_PARM4);
float count = G_FLOAT(OFS_PARM5);
@ -9472,7 +9472,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"particleeffectquery",PF_Fixme,0, 0, 0, 374, D("string(float efnum, float body)", "Retrieves either the name or the body of the effect with the given number. The effect body is regenerated from internal state, and can be changed before being reapplied via the localcmd builtin.")},
{"adddecal", PF_Fixme, 0, 0, 0, 375, D("void(string shadername, vector origin, vector up, vector side, vector rgb, float alpha)", "Adds a temporary clipped decal shader to the scene, centered at the given point with given orientation. Will be drawn by the next renderscene call, and freed by the next clearscene call.")},
{"setcustomskin", PF_Fixme, 0, 0, 0, 376, D("float(entity e, string skinfilename, optional string skindata)", "Sets an entity's skin overrides. These are custom per-entity surface->shader lookups. The skinfilename/data should be in .skin format:\nsurfacename,shadername - makes the named surface use the named shader\nreplace \"surfacename\" \"shadername\" - same.\ncompose \"surfacename\" \"shader\" \"imagename@x,y:w,h?r,g,b,a\" - compose a skin texture from multiple images. The texture is determined to be sufficient to hold the first named image, additional images can be named as extra tokens on the same line. Use a + at the end of the line to continue reading image tokens from the next line also, the named shader must use 'map $diffuse' to read the composed texture (compatible with the defaultskin shader).")},
{"setcustomskin", PF_Fixme, 0, 0, 0, 376, D("void(entity e, string skinfilename, optional string skindata)", "Sets an entity's skin overrides. These are custom per-entity surface->shader lookups. The skinfilename/data should be in .skin format:\nsurfacename,shadername - makes the named surface use the named shader\nreplace \"surfacename\" \"shadername\" - same.\ncompose \"surfacename\" \"shader\" \"imagename@x,y:w,h?r,g,b,a\" - compose a skin texture from multiple images. The texture is determined to be sufficient to hold the first named image, additional images can be named as extra tokens on the same line. Use a + at the end of the line to continue reading image tokens from the next line also, the named shader must use 'map $diffuse' to read the composed texture (compatible with the defaultskin shader).")},
//END EXT_CSQC
{"memalloc", PF_memalloc, 0, 0, 0, 384, D("__variant*(int size)", "Allocate an arbitary block of memory")},
@ -9693,9 +9693,11 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
// {"matchpattern", PF_Fixme, 0, 0, 0, 538, "float(string s, string pattern, float matchrule)"},
// {"undefined", PF_Fixme, 0, 0, 0, 539, ""},
#ifdef USEODE
{"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_addtorque",PF_physics_addtorque,0, 0, 0, 542, D("void(entity e, vector torque)", "Apply some impulse rotational force upon a MOVETYPE_PHYSICS entity.")},
#endif
{"setkeydest", PF_Fixme, 0, 0, 0, 601, "void(float dest)"},
{"getkeydest", PF_Fixme, 0, 0, 0, 602, "float()"},

View File

@ -608,7 +608,8 @@ qboolean SV_LoadLevelCache(char *savename, char *level, char *startspot, qboolea
f = FS_OpenVFS(name, "rb", FS_GAME);
if (!f)
{
Con_Printf ("ERROR: Couldn't load \"%s\"\n", name);
if (isloadgame)
Con_Printf ("ERROR: Couldn't load \"%s\"\n", name);
return false;
}

View File

@ -406,11 +406,11 @@ map <mapname>
command from the console or progs.
quirks:
a leading '*' means new unit, meaning all old state is flushed regardless of startspot
a leading '*' means new unit, meaning all old map state is flushed regardless of startspot
a '+' means 'set nextmap cvar to the following value and otherwise ignore, for q2 compat. only applies if there's also a '.' and the specified bsp doesn't exist, for q1 compat.
just a '.' is taken to mean 'restart'. parms are not changed from their current values, startspot is also unchanged.
'map' will change map, for most games. note that NQ kicks everyone (NQ expects you to use changelevel for that).
'map' will change map, for most games. strips parms+serverflags+cache. note that NQ kicks everyone (NQ expects you to use changelevel for that).
'changelevel' will not flush the level cache, for h2 compat (won't save current level state in such a situation, as nq would prefer not)
'gamemap' will save the game to 'save0' after loading, for q2 compat
'spmap' is for q3 and sets 'gametype' to '2', otherwise identical to 'map'. all other map commands will reset it to '0' if its '2' at the time.
@ -422,12 +422,14 @@ void SV_Map_f (void)
char spot[MAX_QPATH];
char expanded[MAX_QPATH];
char *nextserver;
qboolean isrestart = false;
qboolean newunit = false;
qboolean cinematic = false;
qboolean waschangelevel = false;
qboolean wasspmap = false;
qboolean wasgamemap = false;
qboolean isrestart = false; //don't hurt settings
qboolean newunit = false; //no hubcache
qboolean flushparms = false; //flush parms+serverflags
qboolean cinematic = false; //new map is .cin / .roq or something
qboolean q2savetos0 = false;
qboolean q3singleplayer = false; //forces g_gametype to 2 (otherwise clears if it was 2).
qboolean waschangelevel = false;
int i;
char *startspot;
@ -436,14 +438,15 @@ void SV_Map_f (void)
#ifndef SERVERONLY
if (!Renderer_Started() && !isDedicated)
{
Cbuf_AddText(va("wait;map %s\n", Cmd_Args()), Cmd_ExecLevel);
Cbuf_AddText(va("wait;%s %s\n", Cmd_Argv(0), Cmd_Args()), Cmd_ExecLevel);
return;
}
#endif
if (Cmd_Argc() != 2 && Cmd_Argc() != 3)
{
Con_TPrintf ("map <levelname> : continue game on a new level\n");
Con_TPrintf ("%s <levelname> <startspot>: change the level\n", Cmd_Argv(0));
return;
}
@ -452,9 +455,10 @@ void SV_Map_f (void)
Q_strncpyz (level, Cmd_Argv(1), sizeof(level));
startspot = ((Cmd_Argc() == 2)?NULL:Cmd_Argv(2));
waschangelevel = !strcmp(Cmd_Argv(0), "changelevel");
wasspmap = !strcmp(Cmd_Argv(0), "spmap");
wasgamemap = !strcmp(Cmd_Argv(0), "gamemap");
q2savetos0 = !strcmp(Cmd_Argv(0), "gamemap") && !isDedicated; //q2
q3singleplayer = !strcmp(Cmd_Argv(0), "spmap");
flushparms = !strcmp(Cmd_Argv(0), "map") || !strcmp(Cmd_Argv(0), "spmap");
newunit = flushparms || (!strcmp(Cmd_Argv(0), "changelevel") && !startspot);
if (strcmp(level, ".")) //restart current
{
@ -489,6 +493,9 @@ void SV_Map_f (void)
//grab the current map name
COM_StripExtension(COM_SkipPath(sv.modelname), level, sizeof(level));
isrestart = true;
flushparms = false;
newunit = false;
q2savetos0 = false;
if (!*level)
{
@ -581,7 +588,9 @@ void SV_Map_f (void)
if (!isrestart)
SV_SaveSpawnparms ();
if (startspot && !isrestart && !newunit)
if (newunit)
SV_FlushLevelCache(); //forget all on new unit
else if (startspot && !isrestart && !newunit)
{
#ifdef Q2SERVER
if (ge)
@ -613,7 +622,7 @@ void SV_Map_f (void)
gametype = Cvar_Get("g_gametype", "", CVAR_LATCH|CVAR_SERVERINFO, "Q3 compatability");
gametype->callback = gtcallback;
if (wasspmap)
if (q3singleplayer)
Cvar_ForceSet(gametype, "2");//singleplayer
else if (gametype->value == 2)
Cvar_ForceSet(gametype, "");//force to ffa deathmatch
@ -647,6 +656,9 @@ void SV_Map_f (void)
}
SV_SendMessagesToAll ();
if (flushparms)
svs.serverflags = 0;
SCR_SetLoadingFile("spawnserver");
if (newunit || !startspot || cinematic || !SV_LoadLevelCache(NULL, level, startspot, false))
{
@ -665,6 +677,16 @@ void SV_Map_f (void)
host_client->ratetime = 0;
if (host_client->pendingentbits)
host_client->pendingentbits[0] = UF_REMOVE;
if (flushparms)
{
if (host_client->spawninfo)
Z_Free(host_client->spawninfo);
host_client->spawninfo = NULL;
memset(host_client->spawn_parms, 0, sizeof(host_client->spawn_parms));
SV_GetNewSpawnParms(host_client);
}
if (host_client->controller)
continue;
if (host_client->state>=cs_connected)
@ -691,7 +713,7 @@ void SV_Map_f (void)
Cvar_Set(nsv, "");
}
if (wasgamemap)
if (q2savetos0)
{
SV_Savegame("s0");
}

View File

@ -279,8 +279,9 @@ void SV_SaveSpawnparmsClient(client_t *client, float *transferparms)
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, client->edict);
Q1QVM_SetChangeParms();
}
else
#endif
else if (pr_global_ptrs->SetChangeParms)
if (pr_global_ptrs->SetChangeParms)
{
func_t setparms = 0;
if (transferparms)
@ -343,7 +344,7 @@ void SV_SaveSpawnparmsClient(client_t *client, float *transferparms)
rs.deaths += client->deaths;
client->kills=0;
client->deaths=0;
for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
for (j=0 ; j<NUM_RANK_SPAWN_PARMS ; j++)
{
rs.parm[j] = client->spawn_parms[j];
}
@ -384,6 +385,32 @@ void SV_SaveSpawnparms (void)
}
}
void SV_GetNewSpawnParms(client_t *cl)
{
int i;
if (svprogfuncs) //q2 dlls don't use parms in this manner. It's all internal to the dll.
{
// call the progs to get default spawn parms for the new client
#ifdef VM_Q1
if (svs.gametype == GT_Q1QVM)
Q1QVM_SetNewParms();
else
#endif
{
if (pr_global_ptrs->SetNewParms)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetNewParms);
}
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
{
if (pr_global_ptrs->spawnparamglobals[i])
cl->spawn_parms[i] = *pr_global_ptrs->spawnparamglobals[i];
else
cl->spawn_parms[i] = 0;
}
}
}
/*
================
SV_CalcPHS
@ -970,11 +997,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
Info_SetValueForStarKey(svs.info, "*bspversion", "46", MAX_SERVERINFO_STRING);
else
Info_SetValueForStarKey(svs.info, "*bspversion", "", MAX_SERVERINFO_STRING);
if (startspot)
Info_SetValueForStarKey(svs.info, "*startspot", startspot, MAX_SERVERINFO_STRING);
else
Info_SetValueForStarKey(svs.info, "*startspot", "", MAX_SERVERINFO_STRING);
Info_SetValueForStarKey(svs.info, "*startspot", (startspot?startspot:""), MAX_SERVERINFO_STRING);
//
// init physics interaction links

View File

@ -1533,32 +1533,6 @@ void SVC_GetChallenge (void)
// svs.challenges[i].challenge);
}
void SV_GetNewSpawnParms(client_t *cl)
{
int i;
if (svprogfuncs) //q2 dlls don't use parms in this mannor. It's all internal to the dll.
{
// call the progs to get default spawn parms for the new client
#ifdef VM_Q1
if (svs.gametype == GT_Q1QVM)
Q1QVM_SetNewParms();
else
#endif
{
if (pr_global_ptrs->SetNewParms)
PR_ExecuteProgram (svprogfuncs, pr_global_struct->SetNewParms);
}
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
{
if (pr_global_ptrs->spawnparamglobals[i])
cl->spawn_parms[i] = *pr_global_ptrs->spawnparamglobals[i];
else
cl->spawn_parms[i] = 0;
}
}
}
void VARGS SV_OutOfBandPrintf (int q2, netadr_t *adr, char *format, ...)
{
va_list argptr;
@ -6000,7 +5974,10 @@ void SV_Init (quakeparms_t *parms)
#ifdef SVRANKING
Rank_RegisterCommands();
#endif
Cbuf_AddText("alias restart \"map .\"\nalias startmap_sp \"map start\"\n", RESTRICT_LOCAL);
Cbuf_AddText(
"alias restart \"changelevel .\"\n"
"alias startmap_sp \"map start\"\n",
RESTRICT_LOCAL);
#ifndef SERVERONLY
if (isDedicated)

View File

@ -82,7 +82,7 @@ void DestClose(mvddest_t *d, qboolean destroyfiles)
VFS_CLOSE(d->file);
#ifdef HAVE_TCP
if (d->socket)
UDP_CloseSocket(d->socket);
closesocket(d->socket);
#endif
if (destroyfiles)

View File

@ -15,12 +15,13 @@ typedef struct {
} webpath_t;
typedef struct {
vfsfile_t funcs;
int offset;
qofs_t offset;
int handle;
} vfswebfile_t;
static int QDECL VFSWEB_ReadBytes (struct vfsfile_s *file, void *buffer, int bytestoread)
{
vfswebfile_t *intfile = (vfswebfile_t*)file;
memset(buffer, 'e', bytestoread);
int len = emscriptenfte_buf_read(intfile->handle, intfile->offset, buffer, bytestoread);
intfile->offset += len;
return len;
@ -32,7 +33,7 @@ static int QDECL VFSWEB_WriteBytes (struct vfsfile_s *file, const void *buffer,
intfile->offset += len;
return len;
}
static qboolean QDECL VFSWEB_Seek (struct vfsfile_s *file, unsigned long pos)
static qboolean QDECL VFSWEB_Seek (struct vfsfile_s *file, qofs_t pos)
{
vfswebfile_t *intfile = (vfswebfile_t*)file;
if (pos < 0)
@ -40,7 +41,7 @@ static qboolean QDECL VFSWEB_Seek (struct vfsfile_s *file, unsigned long pos)
intfile->offset = pos;
return true;
}
static unsigned long QDECL VFSWEB_Tell (struct vfsfile_s *file)
static qofs_t QDECL VFSWEB_Tell (struct vfsfile_s *file)
{
vfswebfile_t *intfile = (vfswebfile_t*)file;
return intfile->offset;
@ -49,18 +50,19 @@ static void QDECL VFSWEB_Flush(struct vfsfile_s *file)
{
vfswebfile_t *intfile = (vfswebfile_t*)file;
}
static unsigned long QDECL VFSWEB_GetSize (struct vfsfile_s *file)
static qofs_t QDECL VFSWEB_GetSize (struct vfsfile_s *file)
{
vfswebfile_t *intfile = (vfswebfile_t*)file;
unsigned long l;
l = emscriptenfte_buf_getsize(intfile->handle);
return l;
}
static void QDECL VFSWEB_Close(vfsfile_t *file)
static qboolean QDECL VFSWEB_Close(vfsfile_t *file)
{
vfswebfile_t *intfile = (vfswebfile_t*)file;
emscriptenfte_buf_release(intfile->handle);
Z_Free(file);
return true;
}
vfsfile_t *FSWEB_OpenTemp(void)
@ -161,7 +163,7 @@ static qboolean QDECL FSWEB_PollChanges(searchpathfuncs_t *handle)
// webpath_t *np = handle;
return true; //can't verify that or not, so we have to assume the worst
}
static int QDECL FSWEB_RebuildFSHash(const char *filename, int filesize, void *data, searchpathfuncs_t *spath)
static int QDECL FSWEB_RebuildFSHash(const char *filename, qofs_t filesize, void *data, searchpathfuncs_t *spath)
{
webpath_t *sp = (void*)spath;
void (QDECL *AddFileHash)(int depth, const char *fname, fsbucket_t *filehandle, void *pathhandle) = data;
@ -235,7 +237,7 @@ static void QDECL FSWEB_ReadFile(searchpathfuncs_t *handle, flocation_t *loc, ch
VFS_CLOSE(f);
}
static int QDECL FSWEB_EnumerateFiles (searchpathfuncs_t *handle, const char *match, int (QDECL *func)(const char *, int, void *, searchpathfuncs_t *spath), void *parm)
static int QDECL FSWEB_EnumerateFiles (searchpathfuncs_t *handle, const char *match, int (QDECL *func)(const char *, qofs_t, void *, searchpathfuncs_t *spath), void *parm)
{
webpath_t *sp = (webpath_t*)handle;
return Sys_EnumerateFiles(sp->rootpath, match, func, parm, handle);

View File

@ -43,16 +43,19 @@ mergeInto(LibraryManager.library,
event.movementX = event.webkitMovementX;
event.movementY = event.webkitMovementY;
}
Runtime.dynCall('viiffff', FTEC.evcb.mouse, [0, false, event.movementX, event.movementY, 0, 0]);
Runtime.dynCall('viidddd', FTEC.evcb.mouse, [0, false, event.movementX, event.movementY, 0, 0]);
}
else
Runtime.dynCall('viiffff', FTEC.evcb.mouse, [0, true, event.pageX, event.pageY, 0, 0]);
Runtime.dynCall('viidddd', FTEC.evcb.mouse, [0, true, event.pageX, event.pageY, 0, 0]);
}
break;
case 'mousedown':
if (Browser.isFullScreen == 0)
{
Browser.requestFullScreen(true, true);
Module['canvas'].requestPointerLock();
}
case 'mouseup':
Browser.requestFullScreen(true, true);
Module['canvas'].requestPointerLock();
if (FTEC.evcb.button != 0)
{
Runtime.dynCall('viii', FTEC.evcb.button, [0, event.type=='mousedown', event.button]);
@ -63,7 +66,7 @@ mergeInto(LibraryManager.library,
case 'wheel':
if (FTEC.evcb.button != 0)
{
Runtime.dynCall('viii', FTEC.evcb.button, [0, 3, event.deltaY]);
Runtime.dynCall('viii', FTEC.evcb.button, [0, 2, event.deltaY]);
event.preventDefault();
}
break;
@ -284,6 +287,8 @@ console.log('deleted '+name);
emscriptenfte_buf_write : function(handle, offset, data, len)
{
var b = FTEH.h[handle];
if (len < 0)
len = 0;
if (offset+len > b.m)
{ //extend it if needed.
b.m = offset + len + 4095;
@ -292,9 +297,6 @@ console.log('deleted '+name);
nd.set(b.d, 0);
b.d = nd;
}
if (len < 0)
len = 0;
console.log('deleted '+name);
b.d.set(HEAPU8.subarray(data, data+len), offset);
if (offset + len > b.l)
b.l = offset + len;
@ -376,7 +378,7 @@ console.log('deleted '+name);
http.onload = function(e)
{
console.log("onload: " + _url + " status " + http.status);
// console.log("onload: " + _url + " status " + http.status);
if (http.status == 200)
{
var bar = new Uint8Array(http.response);
@ -394,7 +396,7 @@ console.log('deleted '+name);
http.onerror = function(e)
{
console.log("onerror: " + _url + " status " + http.status);
// console.log("onerror: " + _url + " status " + http.status);
if (onerror)
Runtime.dynCall('vii', onerror, [ctx, http.status]);
};

View File

@ -1,79 +1,77 @@
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>FTE QuakeWorld</title>
<style>
body { background-color:#000000; color:#808080; height:100%;width:100%;margin:0;padding:0;}
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten { text-align: center; padding:0; margin: 0;}
div.emscripten_border { padding:0; margin: 0; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; width:100%; height:100%; padding:0; margin: 0;}
</style>
</head>
<body>
<div class="emscripten" id="status">Is javascript enabled?</div>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div class="emscripten_border">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
</div>
<!-- <div class="emscripten">
<input type="checkbox" id="resize">Resize canvas
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="Module.requestFullScreen(document.getElementById('pointerLock').checked,
document.getElementById('resize').checked)">
</div>
-->
<script type='text/javascript'>
// connect to canvas
var Module = {
preRun: [],
postRun: [],
print: (function() {
})(),
printErr: function(text) {
text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.log(text);
}
},
canvas: document.getElementById('canvas'),
setStatus: function(text) {
if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var statusElement = document.getElementById('status');
var progressElement = document.getElementById('progress');
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
</script>
<script type='text/javascript'>
{{{ SCRIPT_CODE }}}
</script>
</body>
</html>
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>FTE QuakeWorld</title>
<style>
body { background-color:#000000; color:#808080; height:100%;width:100%;margin:0;padding:0;}
.emscripten { padding-right: 0; margin-left: auto; margin-right: auto; display: block; }
div.emscripten { text-align: center; padding:0; margin: 0;}
div.emscripten_border { padding:0; margin: 0; }
/* the canvas *must not* have any border or padding, or mouse coords will be wrong */
canvas.emscripten { border: 0px none; width:100%; height:100%; padding:0; margin: 0;}
</style>
</head>
<body>
<div class="emscripten" id="status">Is javascript enabled?</div>
<div class="emscripten">
<progress value="0" max="100" id="progress" hidden=1></progress>
</div>
<div class="emscripten_border">
<canvas class="emscripten" id="canvas" oncontextmenu="event.preventDefault()"></canvas>
</div>
<!-- <div class="emscripten">
<input type="checkbox" id="resize">Resize canvas
<input type="checkbox" id="pointerLock" checked>Lock/hide mouse pointer
&nbsp;&nbsp;&nbsp;
<input type="button" value="Fullscreen" onclick="Module.requestFullScreen(document.getElementById('pointerLock').checked,
document.getElementById('resize').checked)">
</div>
-->
<script type='text/javascript'>
// connect to canvas
var Module = {
preRun: [],
postRun: [],
print: (function() {
})(),
printErr: function(text) {
text = Array.prototype.slice.call(arguments).join(' ');
if (0) { // XXX disabled for safety typeof dump == 'function') {
dump(text + '\n'); // fast, straight to the real console
} else {
console.log(text);
}
},
canvas: document.getElementById('canvas'),
setStatus: function(text) {
if (Module.setStatus.interval) clearInterval(Module.setStatus.interval);
var m = text.match(/([^(]+)\((\d+(\.\d+)?)\/(\d+)\)/);
var statusElement = document.getElementById('status');
var progressElement = document.getElementById('progress');
if (m) {
text = m[1];
progressElement.value = parseInt(m[2])*100;
progressElement.max = parseInt(m[4])*100;
progressElement.hidden = false;
} else {
progressElement.value = null;
progressElement.max = null;
progressElement.hidden = true;
}
statusElement.innerHTML = text;
},
totalDependencies: 0,
monitorRunDependencies: function(left) {
this.totalDependencies = Math.max(this.totalDependencies, left);
Module.setStatus(left ? 'Preparing... (' + (this.totalDependencies-left) + '/' + this.totalDependencies + ')' : 'All downloads complete.');
}
};
Module.setStatus('Downloading...');
</script>
{{{ SCRIPT }}}
</body>
</html>

View File

@ -30,7 +30,7 @@ static void VID_Resized(int width, int height)
}
static unsigned int domkeytoquake(unsigned int code)
{
unsigned int tab[256] =
unsigned char tab[256] =
{
/* 0*/ 0,0,0,0,0,0,0,0, K_BACKSPACE,K_TAB,0,0,0,K_ENTER,0,0,
/* 16*/ K_SHIFT,K_CTRL,K_ALT,K_PAUSE,K_CAPSLOCK,0,0,0,0,0,0,K_ESCAPE,0,0,0,0,
@ -60,21 +60,69 @@ static unsigned int domkeytoquake(unsigned int code)
if (!tab[code])
Con_DPrintf("You just pressed key %u, but I don't know what its meant to be\n", code);
Con_DPrintf("You just pressed dom key %u, which is quake key %u\n", code, tab[code]);
// Con_DPrintf("You just pressed dom key %u, which is quake key %u\n", code, tab[code]);
return tab[code];
}
static unsigned int domkeytoshift(unsigned int code)
{
unsigned char tab[256] =
{
/* 0*/ 0,0,0,0,0,0,0,0, K_BACKSPACE,K_TAB,0,0,0,K_ENTER,0,0,
/* 16*/ K_SHIFT,K_CTRL,K_ALT,K_PAUSE,K_CAPSLOCK,0,0,0,0,0,0,K_ESCAPE,0,0,0,0,
/* 32*/ ' ',K_PGUP,K_PGDN,K_END,K_HOME,K_LEFTARROW,K_UPARROW,K_RIGHTARROW, K_DOWNARROW,0,0,0,K_PRINTSCREEN,K_INS,K_DEL,0,
/* 48*/ ')','!','\"',0/*£*/,'$','%','^','&', '*','(',0,0,0,0,0,0,
/* 64*/ 0,'A','B','C','D','E','F','G', 'H','I','J','K','L','M','N','O',
/* 80*/ 'P','Q','R','S','T','U','V','W', 'X','Y','Z',K_LWIN,K_RWIN,K_APP,0,0,
/* 96*/ K_KP_INS,K_KP_END,K_KP_DOWNARROW,K_KP_PGDN,K_KP_LEFTARROW,K_KP_5,K_KP_RIGHTARROW,K_KP_HOME, K_KP_UPARROW,K_KP_PGDN,K_KP_STAR,K_KP_PLUS,0,K_KP_MINUS,K_KP_DEL,K_KP_SLASH,
/*112*/ K_F1,K_F2,K_F3,K_F4,K_F5,K_F6,K_F7,K_F8,K_F9,K_F10,K_F11,K_F12,0,0,0,0,
/*128*/ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/*144*/ K_KP_NUMLOCK,K_SCRLCK,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/*160*/ 0,0,0,'~',0,0,0,0, 0,0,0,0,0,0,0,0,
/*176*/ 0,0,0,0,0,0,0,0, 0,0,':','+','<','_','>','?',
/*192*/ '`',0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/*208*/ 0,0,0,0,0,0,0,0, 0,0,0,'{','|','}','@','`',
/*224*/ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
/*240*/ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
};
if (!code)
return 0;
if (code >= sizeof(tab)/sizeof(tab[0]))
{
Con_DPrintf("You just pressed key %u, but I don't know what its meant to be\n", code);
return 0;
}
if (!tab[code])
Con_DPrintf("You just pressed key %u, but I don't know what its meant to be\n", code);
// Con_DPrintf("You just pressed dom key %u, which is quake key %u\n", code, tab[code]);
return tab[code];
}
static int DOM_KeyEvent(int devid, int down, int scan, int uni)
{
IN_KeyEvent(0, down, domkeytoquake(scan), uni);
extern int shift_down;
// Con_Printf("Key %i %i:%c\n", scan, uni, (char)uni);
if (shift_down)
{
uni = domkeytoshift(scan);
scan = domkeytoquake(scan);
uni = (uni >= 32 && uni <= 127)?uni:0;
}
else
{
scan = domkeytoquake(scan);
uni = (scan >= 32 && scan <= 127)?scan:0;
}
IN_KeyEvent(devid, down, scan, uni);
//Chars which don't map to some printable ascii value get preventDefaulted.
//This is to stop fucking annoying fucking things like backspace randomly destroying the page and thus game.
//And it has to be conditional, or we don't get any unicode chars at all.
//The behaviour browsers seem to give is retardedly unhelpful, and just results in hacks to detect keys that appear to map to ascii...
//Preventing the browser from leaving the page etc should NOT mean I can no longer get ascii/unicode values, only that the browser stops trying to do something random due to the event.
//If you are the person that decreed that this is the holy way, then please castrate yourself now.
if (scan < ' ' || scan >= 127)
// if (scan == K_BACKSPACE || scan == K_LCTRL || scan == K_LALT || scan == K_LSHIFT || scan == K_RCTRL || scan == K_RALT || scan == K_RSHIFT)
return true;
return false;
// return false;
}
static void DOM_ButtonEvent(int devid, int down, int button)
{
@ -142,7 +190,7 @@ void GLVID_DeInit (void)
}
void VIDGL_SwapBuffers (void)
void GLVID_SwapBuffers (void)
{
//webgl doesn't support swapbuffers.
//you can't use it for loading screens.