diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index 9ea5e6019..255c2eff7 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -2415,6 +2415,13 @@ qboolean SCR_ScreenShot (char *filename, enum fs_relative fsroot, void **buffer, char ext[8]; void *nbuffers[2]; + switch(fmt) + { //nuke any alpha channel... + case TF_RGBA32: fmt = TF_RGBX32; break; + case TF_BGRA32: fmt = TF_BGRX32; break; + default: break; + } + if (!bytestride) bytestride = width*4; if (bytestride < 0) diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 79382ef27..247348025 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -3426,7 +3426,7 @@ void CLQ2_ParseTEnt (void) case Q2TE_FORCEWALL: MSG_ReadPos (pos); - MSG_ReadDir (pos2); + MSG_ReadPos (pos2); color = MSG_ReadByte (); P_ParticleTrailIndex(pos, pos2, pt, color, 0, NULL); break; diff --git a/engine/client/image.c b/engine/client/image.c index 26675d473..09fd99f4d 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -2055,6 +2055,7 @@ typedef struct bmpheader_s unsigned short Reserved1; unsigned short Reserved2; unsigned int OffsetofBMPBits; + unsigned int SizeofBITMAPINFOHEADER; signed int Width; signed int Height; @@ -2074,7 +2075,8 @@ typedef struct bmpheaderv4_s unsigned int BlueMask; unsigned int AlphaMask; qbyte ColourSpace[4]; //"Win " or "sRGB" - qbyte ColourSpaceCrap[24+4*3]; + qbyte ColourSpaceCrap[12*3]; + unsigned int Gamma[3]; } bmpheaderv4_t; qbyte *ReadBMPFile(qbyte *buf, int length, int *width, int *height) @@ -2270,17 +2272,11 @@ qboolean WriteBMPFile(char *filename, enum fs_relative fsroot, qbyte *in, int in outstride = width * (bits/8); outstride = (outstride+3)&~3; //bmp pads rows to a multiple of 4 bytes. - data = BZ_Malloc(2+sizeof(h)+extraheadersize+width*outstride); - out = data+2+sizeof(h)+extraheadersize; - - - data[0] = 'B'; - data[1] = 'M'; h.Size = 2+sizeof(h)+extraheadersize + outstride*height; h.Reserved1 = 0; h.Reserved2 = 0; - h.OffsetofBMPBits = 2+sizeof(h)+extraheadersize; - h.SizeofBITMAPINFOHEADER = sizeof(h)+extraheadersize; + h.OffsetofBMPBits = 2+sizeof(h)+extraheadersize; //yes, this is misaligned. + h.SizeofBITMAPINFOHEADER = (sizeof(h)-12)+extraheadersize; h.Width = width; h.Height = height; h.Planes = 1; @@ -2291,9 +2287,18 @@ qboolean WriteBMPFile(char *filename, enum fs_relative fsroot, qbyte *in, int in h.TargetDeviceYRes = 2835; h.NumofColorIndices = 0; h.NumofImportantColorIndices = 0; - memcpy(data+2, &h, sizeof(h)); - if (extraheadersize) - memcpy(data+2+sizeof(h), &h4, sizeof(h4)); + + //bmp is bottom-up so flip it now. + in += instride*(height-1); + instride *= -1; + + out = data = BZ_Malloc(h.Size); + *out++ = 'B'; + *out++ = 'M'; + memcpy(out, &h, sizeof(h)); + out += sizeof(h); + memcpy(out, &h4, extraheadersize); + out += extraheadersize; for (y = 0; y < height; y++) { diff --git a/engine/client/m_download.c b/engine/client/m_download.c index c492cd4ee..019453326 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -260,7 +260,7 @@ qboolean PM_PurgeOnDisable(package_t *p) if (p->flags & DPF_DISABLEDINSTALLED) return false; //hashed packages can also be present and not enabled, but only if they're in the cache and not native - if (*p->gamedir && p->qhash && (p->flags & DPF_CACHED)) + if (*p->gamedir && p->qhash && (p->flags & DPF_PRESENT)) return false; //FIXME: add basedir-plugins to the package manager so they can be enabled/disabled properly. //if (p->arch) @@ -1472,7 +1472,7 @@ static unsigned int PM_ChangeList(char *out, size_t outsize) else change = va(" install %s\n", p->name); } - else if ((p->flags & DPF_PURGE) || !(p->qhash && (p->flags & DPF_CACHED))) + else if ((p->flags & DPF_PURGE) || !(p->qhash && (p->flags & DPF_PRESENT))) change = va(" uninstall %s\n", p->name); else change = va(" disable %s\n", p->name); @@ -2285,6 +2285,7 @@ static void PM_StartADownload(void) static void PM_ApplyChanges(void) { package_t *p, **link; + char temp[MAX_OSPATH]; if (pkg_updating) return; @@ -2331,7 +2332,6 @@ static void PM_ApplyChanges(void) if (*p->gamedir) { char *f = va("%s/%s", p->gamedir, dep->name); - char temp[MAX_OSPATH]; if (p->qhash && FS_GenCachedPakName(f, p->qhash, temp, sizeof(temp)) && PM_CheckFile(temp, p->fsroot)) { if (!FS_Remove(temp, p->fsroot)) @@ -2346,7 +2346,21 @@ static void PM_ApplyChanges(void) } } else + { + for (dep = p->deps; dep; dep = dep->next) + { + if (dep->dtype == DEP_FILE) + { + if (*p->gamedir) + { + char *f = va("%s/%s", p->gamedir, dep->name); + if ((p->flags & DPF_NATIVE) && p->qhash && FS_GenCachedPakName(f, p->qhash, temp, sizeof(temp))) + FS_Rename(f, temp, p->fsroot); + } + } + } Con_Printf("Disabling package %s\n", p->name); + } p->flags &= ~(DPF_PURGE|DPF_ENABLED); /* FIXME: windows bug: diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index c169a675e..d9928d260 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -7029,7 +7029,6 @@ qboolean CSQC_Init (qboolean anycsqc, qboolean csdatenabled, unsigned int checks csqc_world.Event_ContentsTransition = CSQC_Event_ContentsTransition; csqc_world.Get_CModel = CSQC_World_ModelForIndex; csqc_world.Get_FrameState = CSQC_World_GetFrameState; - csqc_world.defaultgravityscale = 1; World_ClearWorld(&csqc_world, false); CSQC_InitFields(); //let the qclib know the field order that the engine needs. diff --git a/engine/client/r_surf.c b/engine/client/r_surf.c index ae946777c..0a5488e33 100644 --- a/engine/client/r_surf.c +++ b/engine/client/r_surf.c @@ -496,8 +496,7 @@ static void Surf_AddDynamicLightsColours (msurface_t *surf) rad = cl_dlights[lnum].radius; VectorSubtract(cl_dlights[lnum].origin, currententity->origin, lightofs); - dist = DotProduct (lightofs, surf->plane->normal) - - surf->plane->dist; + dist = DotProduct (lightofs, surf->plane->normal) - surf->plane->dist; rad -= fabs(dist); minlight = cl_dlights[lnum].minlight; if (rad < minlight) @@ -525,16 +524,17 @@ static void Surf_AddDynamicLightsColours (msurface_t *surf) b = cl_dlights[lnum].color[2]*128; } -/* if (cl_dlights[lnum].type == 1) //a wierd effect. + bl = blocklights; + if (r < 0 || g < 0 || b < 0) { for (t = 0 ; tlmscale; + td = local[1] - (t<lmshift); if (td < 0) td = -td; for (s=0 ; slmscale; + sd = local[0] - (s<lmshift); if (sd < 0) sd = -sd; if (sd > td) @@ -543,16 +543,19 @@ static void Surf_AddDynamicLightsColours (msurface_t *surf) dist = td + (sd>>1); if (dist < minlight) { - blocklights[t*smax + s] += 2*sin(dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[0]*3; - greenblklights[t*smax + s] += 2*sin(M_PI/3+dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[1]*3; - blueblklights[t*smax + s] += 2*sin(2*M_PI/3+dist/10+cl.time*20)*(rad - dist)*256 * cl_dlights[lnum].colour[2]*3; + i = bl[0] + (rad - dist)*r; + bl[0] = (i<0)?0:i; + i = bl[1] + (rad - dist)*g; + bl[1] = (i<0)?0:i; + i = bl[2] + (rad - dist)*b; + bl[2] = (i<0)?0:i; } + bl += 3; } } } else -*/ { - bl = blocklights; + { for (t = 0 ; tlmshift); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index ca15099cb..17871fa9f 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -62,7 +62,7 @@ void R_ForceSky_f(void) else if (*cl.skyname) Con_Printf("Current per-map skybox is %s\n", cl.skyname); else - Con_Printf("no skybox forced.\n", cl.skyname); + Con_Printf("no skybox forced.\n"); } else { diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index b8ec1ff7b..073daf15d 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -247,7 +247,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SIDEVIEWS 4 //enable secondary/reverse views. -// #define DSPMODELS //doom sprites (only needs DOOMWADS to generate the right wad file names) +// #define DSPMODELS //doom sprites (only needs PACKAGE_DOOMWAD to generate the right wad file names) #define SPRMODELS //quake1 sprite models #define SP2MODELS //quake2 sprite models #define MD1MODELS //quake1 alias models @@ -262,7 +262,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define RAGDOLL #define HUFFNETWORK //huffman network compression - #define DOOMWADS //doom wad/sprite support +// #define PACKAGE_DOOMWAD //doom wad support (maps+sprites are separate) // #define MAP_DOOM //doom map support // #define MAP_PROC //doom3/quake4 map support //#define WOLF3DSUPPORT //wolfenstein3d map support (not started yet) @@ -444,7 +444,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #undef HALFLIFEMODELS #undef RUNTIMELIGHTING #undef HEXEN2 - #undef DOOMWADS + #undef PACKAGE_DOOMWAD #undef MAP_PROC #undef Q1BSPS #undef Q2BSPS diff --git a/engine/common/world.h b/engine/common/world.h index f499052a7..b51faf433 100644 --- a/engine/common/world.h +++ b/engine/common/world.h @@ -199,8 +199,6 @@ struct world_s double lastchecktime; // for monster ai qbyte *lastcheckpvs; // for monster ai - float defaultgravityscale; //0 in QW, 1 for anything else (inc csqc) - /*antilag*/ float lagentsfrac; laggedentinfo_t *lagents; diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index 6bb55afe0..d9a5816ff 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -1444,7 +1444,8 @@ void GLBE_Init(void) shaderstate.curentity = &r_worldentity; be_maxpasses = gl_config_nofixedfunc?1:gl_mtexarbable; gl_stencilbits = 0; - if (gl_config.glversion >= 3.0 && gl_config_nofixedfunc) +#ifndef GLESONLY + if (!gl_config_gles && 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); @@ -1452,6 +1453,7 @@ void GLBE_Init(void) gl_stencilbits = 8; } else +#endif qglGetIntegerv(GL_STENCIL_BITS, &gl_stencilbits); for (i = 0; i < FTABLE_SIZE; i++) { diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 46a3f68e9..68afc09d0 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -5924,7 +5924,7 @@ void Mod_LoadDoomSprite (model_t *mod) frame.left = -header->xpos; frame.right = header->width - header->xpos; - t[0] = t[1] = max(abs(frame.left),abs(frame.right)); + t[0] = t[1] = max(fabs(frame.left),fabs(frame.right)); t[2] = frame.up; AddPointToBounds(t, mod->mins, mod->maxs); t[0] *= -1; diff --git a/engine/partcfgs/q2part.cfg b/engine/partcfgs/q2part.cfg index 84ed0c309..96581e776 100644 --- a/engine/partcfgs/q2part.cfg +++ b/engine/partcfgs/q2part.cfg @@ -841,3 +841,37 @@ r_part TEQ2_BOSSTPORT scalefactor 0.8 sound "misc/bigtele.wav" 1 0 0 0 1 } + +/* +r_part teq2_heatbeam_steam +{ + count 20 + colorindex 0xe0 7 +// magnitude 60 + texture "classicparticle" + tcoords 0 0 16 16 32 + scale 1 + alpha 1 + die 0.3 0.8 + randomvel 20 magnitude/3 + veladd magnitude + orgadd magnitude/10 + spawnorg 4 + gravity -400 + scalefactor 0.8 +} +*/ + +//this is apparently just a trail effect (palette index specified by netcode) +r_part teq2_forcewall +{ + texture "classicparticle" + tcoords 0 0 16 16 32 + scale 0.5 + alpha 1 + scalefactor 0.8 + step 5 + spawnorg 3 + randomvel 5 + die 3 3.5 +} diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 293a8165a..237dea2da 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -2013,10 +2013,6 @@ void Q_InitProgs(void) sv.world.edict_size = PR_InitEnts(svprogfuncs, sv.world.max_edicts); - if (progstype == PROG_QW) - sv.world.defaultgravityscale = 0; - else - sv.world.defaultgravityscale = 1; #ifdef HEXEN2 SV_RegisterH2CustomTents(); #endif diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index fddce5fe2..3fdca2561 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -559,10 +559,11 @@ SV_AddGravity ============ */ -static void WPhys_AddGravity (world_t *w, wedict_t *ent, const float *gravitydir, float scale) +static void WPhys_AddGravity (world_t *w, wedict_t *ent, const float *gravitydir) { + float scale = ent->xv->gravity; if (!scale) - scale = w->defaultgravityscale; + scale = 1.0; VectorMA(ent->v->velocity, scale * movevars.gravity * host_frametime, gravitydir, ent->v->velocity); } @@ -1331,7 +1332,7 @@ static void WPhys_Physics_Toss (world_t *w, wedict_t *ent) && ent->v->movetype != MOVETYPE_FLYMISSILE && ent->v->movetype != MOVETYPE_BOUNCEMISSILE && ent->v->movetype != MOVETYPE_H2SWIM) - WPhys_AddGravity (w, ent, gravitydir, 1.0); + WPhys_AddGravity (w, ent, gravitydir); // move angles VectorMA (ent->v->angles, host_frametime, ent->v->avelocity, ent->v->angles); @@ -1455,7 +1456,7 @@ static void WPhys_Physics_Step (world_t *w, wedict_t *ent) { hitsound = -DotProduct(gravitydir, ent->v->velocity) < movevars.gravity*-0.1; - WPhys_AddGravity (w, ent, gravitydir, 1.0); + WPhys_AddGravity (w, ent, gravitydir); WPhys_CheckVelocity (w, ent); WPhys_FlyMove (w, ent, gravitydir, host_frametime, NULL); World_LinkEdict (w, ent, true); @@ -2180,7 +2181,7 @@ void WPhys_RunEntity (world_t *w, wedict_t *ent) gravitydir = w->g.defaultgravitydir; if (!WPhys_CheckWater (w, ent) && ! ((int)ent->v->flags & FL_WATERJUMP) ) - WPhys_AddGravity (w, ent, gravitydir, ent->xv->gravity); + WPhys_AddGravity (w, ent, gravitydir); WPhys_CheckStuck (w, ent); WPhys_WalkMove (w, ent, gravitydir); diff --git a/engine/web/ftejslib.js b/engine/web/ftejslib.js index a09747f22..629878ca8 100644 --- a/engine/web/ftejslib.js +++ b/engine/web/ftejslib.js @@ -114,7 +114,9 @@ mergeInto(LibraryManager.library, break; case 'resize': if (FTEC.evcb.resize != 0) + { Runtime.dynCall('vii', FTEC.evcb.resize, [Module['canvas'].width, Module['canvas'].height]); + } break; case 'mousemove': if (FTEC.evcb.mouse != 0) @@ -134,7 +136,10 @@ mergeInto(LibraryManager.library, Runtime.dynCall('viidddd', FTEC.evcb.mouse, [0, false, event.movementX, event.movementY, 0, 0]); } else - Runtime.dynCall('viidddd', FTEC.evcb.mouse, [0, true, event.pageX, event.pageY, 0, 0]); + { + var rect = Module['canvas'].getBoundingClientRect(); + Runtime.dynCall('viidddd', FTEC.evcb.mouse, [0, true, (event.clientX - rect.left)*(Module['canvas'].width/rect.width), (event.clientY - rect.top)*(Module['canvas'].height/rect.height), 0, 0]); + } } break; case 'mousedown': @@ -432,7 +437,7 @@ mergeInto(LibraryManager.library, 'keypress', 'keydown', 'keyup', 'touchstart', 'touchend', 'touchcancel', 'touchleave', 'touchmove', 'dragenter', 'dragover', 'drop', - 'message', + 'message', 'resize', 'pointerlockchange', 'mozpointerlockchange', 'webkitpointerlockchange', 'focus', 'blur']; //try to fix alt-tab events.forEach(function(event) @@ -453,11 +458,11 @@ mergeInto(LibraryManager.library, window.addEventListener(event, FTEC.handleevent, true); }); - Browser.resizeListeners.push(function(w, h) { - FTEC.handleevent({ - type: 'resize', - }); - }); +// Browser.resizeListeners.push(function(w, h) { +// FTEC.handleevent({ +// type: 'resize', +// }); +// }); } var ctx = Browser.createContext(Module['canvas'], true, true); if (ctx == null) @@ -482,7 +487,10 @@ mergeInto(LibraryManager.library, // Browser.windowedHeight = window.innerHeight; // } // else - Browser.setCanvasSize(window.innerWidth, window.innerHeight, false); + { + var rect = Module['canvas'].getBoundingClientRect(); + Browser.setCanvasSize(rect.width, rect.height, false); + } if (FTEC.evcb.resize != 0) Runtime.dynCall('vii', FTEC.evcb.resize, [Module['canvas'].width, Module['canvas'].height]); }; diff --git a/engine/web/fteshell.html b/engine/web/fteshell.html index 4213b3c61..08df78f77 100644 --- a/engine/web/fteshell.html +++ b/engine/web/fteshell.html @@ -6,10 +6,10 @@ FTE QuakeWorld