diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 32dbeb39f..d06bbb340 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -144,6 +144,8 @@ cvar_t cl_muzzleflash = SCVAR("cl_muzzleflash", "1"); cvar_t cl_item_bobbing = SCVAR("cl_model_bobbing", "0"); cvar_t cl_countpendingpl = SCVAR("cl_countpendingpl", "0"); +cvar_t cl_download_mapsrc = SCVAR("cl_download_mapsrc", ""); //EG: "http://bigfoot.morphos-team.net/misc/quakemaps/" + cvar_t cl_standardchat = SCVARF("cl_standardchat", "0", CVAR_ARCHIVE); cvar_t msg_filter = SCVAR("msg_filter", "0"); //0 for neither, 1 for mm1, 2 for mm2, 3 for both cvar_t cl_standardmsg = SCVARF("cl_standardmsg", "0", CVAR_ARCHIVE); @@ -2998,6 +3000,7 @@ void CL_Init (void) Cvar_Register (&cl_indepphysics, cl_controlgroup); Cvar_Register (&cl_antibunch, "evil hacks"); Cvar_Register (&hud_tracking_show, "statusbar"); + Cvar_Register (&cl_download_mapsrc, cl_controlgroup); Cvar_Register (&cl_dlemptyterminate, cl_controlgroup); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 8562d97aa..cee63854c 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -202,7 +202,7 @@ char *svc_nqstrings[] = "dpsvc_pointparticles1" //62 }; -extern cvar_t requiredownloads, cl_standardchat, msg_filter, cl_countpendingpl; +extern cvar_t requiredownloads, cl_standardchat, msg_filter, cl_countpendingpl, cl_download_mapsrc; int oldparsecountmod; int parsecountmod; double parsecounttime; @@ -285,8 +285,19 @@ int CL_CalcNet (void) qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags) { downloadlist_t *dl; - if (!localname) - localname = filename; + qboolean webdl = false; + if (localname && !strncmp(filename, "http://", 7)) + { + webdl = true; + } + else + { + if (!localname) + localname = filename; + + if (cls.demoplayback && cls.demoplayback != DPB_EZTV) + return false; + } if (strchr(localname, '\\') || strchr(localname, ':') || strstr(localname, "..")) { @@ -294,13 +305,10 @@ qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags) return false; } - if (cls.demoplayback && cls.demoplayback != DPB_EZTV) - return false; - if (!(flags & DLLF_IGNOREFAILED)) { #ifdef NQPROT - if (cls.protocol == CP_NETQUAKE) + if (!webdl && cls.protocol == CP_NETQUAKE) if (!cl_dp_serverextension_download) return false; #endif @@ -347,11 +355,11 @@ qboolean CL_EnqueDownload(char *filename, char *localname, unsigned int flags) dl->size = 0; dl->flags = flags | DLLF_SIZEUNKNOWN; - if (cls.fteprotocolextensions & (PEXT_CHUNKEDDOWNLOADS + if (!webdl && (cls.fteprotocolextensions & (PEXT_CHUNKEDDOWNLOADS #ifdef PEXT_PK3DOWNLOADS | PEXT_PK3DOWNLOADS #endif - )) + ))) CL_SendClientCommand(true, "dlsize \"%s\"", dl->rname); if (flags & DLLF_VERBOSE) @@ -413,6 +421,19 @@ void CL_DisenqueDownload(char *filename) } } +void CL_WebDownloadFinished(struct dl_download *dl) +{ + if (dl->status == DL_FAILED) + CL_DownloadFailed(dl->url); + else if (dl->status == DL_FINISHED) + { + if (dl->file) + VFS_CLOSE(dl->file); + dl->file = NULL; + CL_DownloadFinished(); + } +} + void CL_SendDownloadStartRequest(char *filename, char *localname) { strcpy (cls.downloadremotename, filename); @@ -425,12 +446,21 @@ void CL_SendDownloadStartRequest(char *filename, char *localname) COM_StripExtension (localname, cls.downloadtempname, sizeof(cls.downloadtempname)-5); strcat (cls.downloadtempname, ".tmp"); - CL_SendClientCommand(true, "download %s", filename); - - //prevent ftp/http from changing stuff - cls.downloadmethod = DL_QWPENDING; - cls.downloadpercent = 0; + if (!strncmp(cls.downloadremotename, "http://", 7)) + { + cls.downloadmethod = DL_HTTP; + cls.downloadpercent = 0; + if (!HTTP_CL_Get(cls.downloadremotename, cls.downloadtempname, CL_WebDownloadFinished)) + CL_DownloadFailed(cls.downloadremotename); + } + else + { + CL_SendClientCommand(true, "download %s", filename); + //prevent ftp/http from changing stuff + cls.downloadmethod = DL_QWPENDING; + cls.downloadpercent = 0; + } CL_DisenqueDownload(filename); } @@ -525,16 +555,6 @@ void CL_DownloadFinished(void) Skin_FlushSkin(filename); } } -/* -void MapDownload(char *name, qboolean gotornot) -{ - if (gotornot) //yay - return; - - - CL_EnqueDownload(filename, false, false); -} -*/ qboolean CL_CheckFile(char *filename) { @@ -554,8 +574,7 @@ qboolean CL_CheckFile(char *filename) =============== CL_CheckOrEnqueDownloadFile -Returns true if the file exists, otherwise it attempts -to start a download from the server. +Returns true if the file exists, returns false if it triggered a download. =============== */ @@ -564,14 +583,14 @@ qboolean CL_CheckOrEnqueDownloadFile (char *filename, char *localname, unsigned if (!localname) localname = filename; - if (!(flags & DLLF_OVERWRITE) && CL_CheckFile(localname)) - return true; - #ifndef CLIENTONLY if (sv.state) return true; #endif + if (!(flags & DLLF_OVERWRITE) && CL_CheckFile(localname)) + return true; + //ZOID - can't download when recording if (cls.demorecording) { @@ -579,21 +598,22 @@ qboolean CL_CheckOrEnqueDownloadFile (char *filename, char *localname, unsigned return true; } //ZOID - can't download when playback - if (cls.demoplayback && cls.demoplayback != DPB_EZTV) - return true; +// if (cls.demoplayback && cls.demoplayback != DPB_EZTV) +// return true; SCR_EndLoadingPlaque(); //release console. -/* if (1) - if (strncmp(filename, "maps/", 5)) - if (strcmp(filename + strlen(filename)-4, ".bsp")) + if (*cl_download_mapsrc.string) + if (!strncmp(filename, "maps/", 5)) + if (!strcmp(filename + strlen(filename)-4, ".bsp")) { char base[MAX_QPATH]; - COM_FileBase(filename, base); - HTTP_CL_Get(va("http://maps.quakeworld.nu/%s/download/", base), filename, MapDownload); + COM_FileBase(filename, base, sizeof(base)); + filename = va("%s%s.bsp", cl_download_mapsrc.string, base); } -*/ - CL_EnqueDownload(filename, localname, flags); + + if (!CL_EnqueDownload(filename, localname, flags)) + return true; /*don't stall waiting for it if it failed*/ if (!(flags & DLLF_IGNOREFAILED)) @@ -809,6 +829,9 @@ void Model_CheckDownloads (void) if (!stricmp(COM_FileExtension(s), "dsp")) //doom sprites are weird, and not really downloadable via this system continue; + if (!*s) + continue; + CL_CheckOrEnqueDownloadFile(s, s, 0); CL_CheckModelResources(s); } diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 3d16cb357..5bddbe5ec 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -739,7 +739,7 @@ void CL_ParseTEnt (void) S_StartSound (-2, 0, cl_sfx_knighthit, pos, 1, 1); break; - case DPTE_SPIKEQUAD: + case TEDP_SPIKEQUAD: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -790,7 +790,7 @@ void CL_ParseTEnt (void) S_StartSound (-2, 0, cl_sfx_ric3, pos, 1, 1); } break; - case DPTE_SUPERSPIKEQUAD: // super spike hitting wall + case TEDP_SUPERSPIKEQUAD: // super spike hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -900,7 +900,7 @@ void CL_ParseTEnt (void) break; #endif - case DPTE_EXPLOSIONQUAD: // rocket explosion + case TEDP_EXPLOSIONQUAD: // rocket explosion // particles pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); @@ -982,7 +982,7 @@ void CL_ParseTEnt (void) } break; - case DPTE_EXPLOSIONRGB: + case TEDP_EXPLOSIONRGB: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1012,7 +1012,7 @@ void CL_ParseTEnt (void) S_StartSound (-2, 0, cl_sfx_r_exp3, pos, 1, 1); break; - case DPTE_TEI_BIGEXPLOSION: + case TEDP_TEI_BIGEXPLOSION: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1074,7 +1074,7 @@ void CL_ParseTEnt (void) P_RunParticleEffectType(pos, NULL, 1, pt_teleportsplash); break; - case DPTE_GUNSHOTQUAD: // bullet hitting wall + case TEDP_GUNSHOTQUAD: // bullet hitting wall pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1102,7 +1102,7 @@ void CL_ParseTEnt (void) break; - case TE_BLOOD: // bullets hitting body + case TEQW_BLOOD: // bullets hitting body cnt = MSG_ReadByte (); pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); @@ -1116,7 +1116,7 @@ void CL_ParseTEnt (void) break; - case TE_LIGHTNINGBLOOD: // lightning hitting body + case TEQW_LIGHTNINGBLOOD: // lightning hitting body pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1153,7 +1153,7 @@ void CL_ParseTEnt (void) CL_ParseStream (type); break; - case DPTE_BLOOD: + case TEDP_BLOOD: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1167,7 +1167,7 @@ void CL_ParseTEnt (void) P_RunParticleEffectType(pos, pos2, cnt, ptdp_blood); break; - case DPTE_SPARK: + case TEDP_SPARK: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1182,7 +1182,7 @@ void CL_ParseTEnt (void) } break; - case DPTE_BLOODSHOWER: + case TEDP_BLOODSHOWER: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1202,7 +1202,7 @@ void CL_ParseTEnt (void) } break; - case DPTE_SMALLFLASH: + case TEDP_SMALLFLASH: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1218,7 +1218,7 @@ void CL_ParseTEnt (void) dl->color[2] = 0.4; break; - case DPTE_CUSTOMFLASH: + case TEDP_CUSTOMFLASH: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1238,7 +1238,7 @@ void CL_ParseTEnt (void) break; - case DPTE_FLAMEJET: + case TEDP_FLAMEJET: // origin pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); @@ -1256,7 +1256,7 @@ void CL_ParseTEnt (void) P_RunParticleEffect (pos, pos2, 232, cnt); break; - case DPTE_PLASMABURN: + case TEDP_PLASMABURN: // origin pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); @@ -1279,7 +1279,7 @@ void CL_ParseTEnt (void) P_ParticleTrailIndex(pos, pos2, 15, 0, NULL); break; - case DPTE_TEI_G3: //nexuiz's nex beam + case TEDP_TEI_G3: //nexuiz's nex beam pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1297,7 +1297,7 @@ void CL_ParseTEnt (void) P_ParticleTrailIndex(pos, pos2, 15, 0, NULL); break; - case DPTE_SMOKE: + case TEDP_SMOKE: //org pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); @@ -1315,7 +1315,7 @@ void CL_ParseTEnt (void) } break; - case DPTE_TEI_PLASMAHIT: + case TEDP_TEI_PLASMAHIT: pos[0] = MSG_ReadCoord (); pos[1] = MSG_ReadCoord (); pos[2] = MSG_ReadCoord (); @@ -1331,7 +1331,7 @@ void CL_ParseTEnt (void) } break; - case DPTE_PARTICLECUBE: + case TEDP_PARTICLECUBE: { vec3_t dir; int jitter; @@ -1360,7 +1360,7 @@ void CL_ParseTEnt (void) P_RunParticleCube(pos, pos2, dir, cnt, colour, gravity, jitter); } break; - case DPTE_PARTICLERAIN: + case TEDP_PARTICLERAIN: { vec3_t dir; @@ -1385,7 +1385,7 @@ void CL_ParseTEnt (void) P_RunParticleWeather(pos, pos2, dir, cnt, colour, "rain"); } break; - case DPTE_PARTICLESNOW: + case TEDP_PARTICLESNOW: { vec3_t dir; diff --git a/engine/client/client.h b/engine/client/client.h index 62235fe43..23e8ebd4b 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -503,8 +503,7 @@ typedef struct float item_gettime[MAX_SPLITS][32]; // cl.time of aquiring item, for blinking float faceanimtime[MAX_SPLITS]; // use anim frame if cl.time < this - cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups - cshift_t prev_cshifts[NUM_CSHIFTS]; // and content types + cshift_t cshifts[NUM_CSHIFTS]; // color shifts for damage, powerups and content types // the client maintains its own idea of view angles, which are // sent to the server each frame. And only reset at level change @@ -927,7 +926,6 @@ void V_RenderView (void); void V_Register (void); void V_ParseDamage (int pnum); void V_SetContentsColor (int contents); -void GLV_CalcBlend (void); //used directly by csqc void V_CalcRefdef (int pnum); diff --git a/engine/client/clq2_ents.c b/engine/client/clq2_ents.c index a329d5039..0b5888093 100644 --- a/engine/client/clq2_ents.c +++ b/engine/client/clq2_ents.c @@ -2024,7 +2024,7 @@ void CLQ2_CalcViewValues (void) // don't interpolate blend color for (i=0 ; i<4 ; i++) - v_blend[i] = ps->blend[i]; + sw_blend[i] = ps->blend[i]; // add the weapon CLQ2_AddViewWeapon (ps, ops); diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 51ca7ef9e..6fcbbec3d 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -1218,10 +1218,10 @@ void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles) #endif #ifdef WEBCLIENT case MT_MASTERHTTP: - HTTP_CL_Get(mast->address, va("master_%i_%i.tmp", mastersequence++, mast->servertype), MasterInfo_ProcessHTTPNQ); + HTTP_CL_Get(mast->address, NULL, MasterInfo_ProcessHTTPNQ); break; case MT_MASTERHTTPQW: - HTTP_CL_Get(mast->address, va("master_%i_%i.tmp", mastersequence++, mast->servertype), MasterInfo_ProcessHTTPQW); + HTTP_CL_Get(mast->address, NULL, MasterInfo_ProcessHTTPQW); break; #endif } diff --git a/engine/client/resource.h b/engine/client/resource.h index 5f2497b60..361a693e8 100644 --- a/engine/client/resource.h +++ b/engine/client/resource.h @@ -2,6 +2,7 @@ // Microsoft Developer Studio generated include file. // Used by winquake.rc // +#define IDC_STATIC -1 #define IDI_ICON1 1 #define IDI_ICON2 2 diff --git a/engine/client/sys_npfte.c b/engine/client/sys_npfte.c new file mode 100644 index 000000000..4d1e5df61 --- /dev/null +++ b/engine/client/sys_npfte.c @@ -0,0 +1,697 @@ +#include "quakedef.h" +#include "winquake.h" +#define bool int //we ain't c++ (grr microsoft stdbool.h gief!) + +#ifdef _WIN32 +#ifndef _WINDOWS +#define _WINDOWS //stupid GCC +#endif +#endif + +#include "npapi/npupp.h" +#include "sys_plugfte.h" + +#define Q_STRINGZ_TO_NPVARIANT(_val, _v) \ +NP_BEGIN_MACRO \ + NPString str = { _val, strlen(_val) }; \ + (_v).type = NPVariantType_String; \ + (_v).value.stringValue = str; \ +NP_END_MACRO +#undef STRINGZ_TO_NPVARIANT +#define STRINGZ_TO_NPVARIANT Q_STRINGZ_TO_NPVARIANT + +#define FIREFOX_BUGS_OVER_25MB + +//TODO: player name input (before allowing them to join) +//TODO: fix active gl context (per thread, and we hijacked the browser's thread) + + +NPNetscapeFuncs *browserfuncs; + + + + +#ifdef _WIN32 +#ifndef GetWindowLongPtr +#define GetWindowLongPtr GetWindowLong +#endif +#ifndef SetWindowLongPtr +#define SetWindowLongPtr SetWindowLong +#define LONG_PTR LONG +#endif +#endif + + + + + +qboolean NPFTE_BeginDownload(void *ctx, struct pipetype *ftype, char *url) +{ + return NPERR_NO_ERROR==browserfuncs->geturlnotify(ctx, url, NULL, ftype); +} + + +#ifdef _WIN32 +void DrawWndBack(struct context *ctx, HWND hWnd, HDC hdc, PAINTSTRUCT *p) +{ + int width, height; + HBITMAP bmp = Plug_GetSplashBack(ctx, hdc, &width, &height); + if (bmp) + { + HDC memDC; + + memDC = CreateCompatibleDC(hdc); + SelectObject(memDC, bmp); + StretchBlt(hdc, p->rcPaint.left, p->rcPaint.top, p->rcPaint.right-p->rcPaint.left,p->rcPaint.bottom-p->rcPaint.top, memDC, 0, 0, width, height, SRCCOPY); + SelectObject(memDC, NULL); + DeleteDC(memDC); + Plug_ReleaseSplashBack(ctx, bmp); + } + else + PatBlt(hdc, p->rcPaint.left, p->rcPaint.top, p->rcPaint.right-p->rcPaint.left,p->rcPaint.bottom-p->rcPaint.top,PATCOPY); +} + +LRESULT CALLBACK MyPluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + struct context *ctx; + struct contextpublic *pub; + ctx = (struct context *)GetWindowLongPtr(hWnd, GWL_USERDATA); + if (!ctx) + return DefWindowProc(hWnd, msg, wParam, lParam); + pub = (struct contextpublic*)ctx; + + switch(msg) + { + case WM_USER: + /*if the plugin is somewhere in video code, the plugin might depend upon us being able to respond to window messages*/ +/* while(ctx->queuedstreams) + { + struct qstream *strm; + strm = ctx->queuedstreams; + ctx->queuedstreams = strm->next; + + if (!browserfuncs->geturlnotify(ctx->nppinstance, strm->url, NULL, strm->type)) + { + VS_DebugLocation(__FILE__, __LINE__, "Starting Download %s", strm->url); + if (strm->type->wait == WAIT_YES) + ctx->waitingfordatafiles++; + } + free(strm); + } +*/ + return TRUE; + + case WM_PAINT: +/* if (ctx->waitingfordatafiles) + { + HDC hdc; + PAINTSTRUCT paint; + char *s; + unsigned int progress; + unsigned int total; + bool sizeknown = true; + struct qstream *strm; + + progress = 0; + total = 0; + if (Sys_TryLockMutex(ctx->mutex)) //this lock doesn't have to be here + { + for (strm = ctx->activestreams; strm; strm = strm->next) + { + progress += strm->offset; + total += strm->size; + if (!total && progress) + sizeknown = false; + } + Plug_LockPlugin(ctx, false); + } + + hdc = BeginPaint(hWnd, &paint); + DrawWndBack(ctx, hWnd, hdc, &paint); + SetBkMode(hdc, TRANSPARENT); + TextOutA(hdc, 0, 0, "Downloading Data, please wait", 16); + if (!progress && !total) + s = "connecting"; + else if (sizeknown) + s = va("%i bytes (%i%%)", progress, (int)((100.0f*progress)/total)); + else + s = va("%i bytes", progress); + TextOutA(hdc, 0, 32, s, strlen(s)); + EndPaint(hWnd, &paint); + return TRUE; + } + else +*/ { + HDC hdc; + PAINTSTRUCT paint; + char *s; + + hdc = BeginPaint(hWnd, &paint); + DrawWndBack(ctx, hWnd, hdc, &paint); + SetBkMode(hdc, TRANSPARENT); + if (!pub->running) + { + s = "Click to activate"; + TextOutA(hdc, 0, 0, s, strlen(s)); + + if (pub->availver) + { + s = va("Your plugin may be incompatible"); + TextOutA(hdc, 0, 32, s, strlen(s)); + s = va("Version %3.2f was requested, you are using version %3.2f", pub->availver, (float)build_number()); + TextOutA(hdc, 0, 48, s, strlen(s)); + } + } + EndPaint(hWnd, &paint); + return TRUE; + } + break; + + case WM_LBUTTONDOWN: + SetActiveWindow(hWnd); + if (!Plug_StartContext(ctx)) + Plug_StopContext(NULL); + break; + default: + break; + } + + //I would call the previous wndproc... but that crashes firefox + return DefWindowProc(hWnd, msg, wParam, lParam); +} + +#endif + +static const struct browserfuncs npfte_browserfuncs = +{ + NPFTE_BeginDownload +}; + +NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, + uint16 mode, int16 argc, char* argn[], + char* argv[], NPSavedData* saved) +{ + int i; + struct context *ctx; + + if (!instance || instance->pdata) + { + return NPERR_INVALID_INSTANCE_ERROR; + } + if (mode != NP_EMBED && mode != NP_FULL) + { + return NPERR_INVALID_PLUGIN_ERROR; + } + + ctx = Plug_CreateContext(instance, &npfte_browserfuncs); + instance->pdata = ctx; + if (!ctx) + { + return NPERR_OUT_OF_MEMORY_ERROR; + } + + //parse out the properties + for (i = 0; i < argc; i++) + { + Plug_SetString(ctx, Plug_FindProp(ctx, argn[i]), argv[i]); + } + + return NPERR_NO_ERROR; +} +NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save) +{ + struct context *ctx = instance->pdata; + struct contextpublic *pub = (struct contextpublic *)ctx; + + if (!ctx) + return NPERR_INVALID_INSTANCE_ERROR; + +#ifdef _WIN32 + if (pub->oldwnd) + { + if (pub->oldproc) + SetWindowLongPtr(pub->oldwnd, GWL_WNDPROC, (LONG_PTR)pub->oldproc); + SetWindowLongPtr(pub->oldwnd, GWL_USERDATA, (LONG_PTR)NULL); + } +#endif + + Plug_DestroyContext(ctx); + instance->pdata = NULL; + + return NPERR_NO_ERROR; +} +NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window) +{ + extern cvar_t vid_width; + struct context *ctx = instance->pdata; + struct contextpublic *pub = (struct contextpublic*)ctx; + +#ifdef _WIN32 + HWND oldwindow; + WNDPROC p; + + if (!ctx) + return NPERR_INVALID_INSTANCE_ERROR; + + //if the window changed + if (Plug_ChangeWindow(ctx, window->window, window->width, window->height)) + { + //we switched window? + if (pub->oldwnd && pub->oldproc) + { + SetWindowLongPtr(pub->oldwnd, GWL_WNDPROC, (LONG_PTR)pub->oldproc); + } + pub->oldproc = NULL; + + p = (WNDPROC)GetWindowLongPtr(window->window, GWL_WNDPROC); + if (p != MyPluginWndProc) + pub->oldproc = p; + pub->oldwnd = window->window; + + SetWindowLongPtr(window->window, GWL_WNDPROC, (LONG_PTR)MyPluginWndProc); + SetWindowLongPtr(window->window, GWL_USERDATA, (LONG_PTR)ctx); + } + + InvalidateRgn(window->window, NULL, FALSE); +#endif + return NPERR_NO_ERROR; +} + +NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, + NPStream* stream, NPBool seekable, + uint16* stype) +{ + return NPERR_NO_ERROR; +/* struct context *ctx = instance->pdata; + struct qstream *qstr; + + stream->pdata = qstr = malloc(sizeof(*qstr) + strlen(stream->url)); + memset(qstr, 0, sizeof(*qstr)); + strcpy(qstr->url, stream->url); + + Plug_LockPlugin(ctx, true); + qstr->next = ctx->activestreams; + if (qstr->next) + qstr->next->prev = qstr; + ctx->activestreams = qstr; + Plug_LockPlugin(ctx, false); + + if (!stream->notifyData) + { + //choose source type based on mime type + if (!strncmp(type, "text/x-quaketvident", 5)) + stream->notifyData = &QTVFileDescriptor; + else if (!strcmp(type, "application/x-multiviewdemo")) + stream->notifyData = &DemoFileDescriptor; + + //well that failed, try choosing based on extension + else if (!strcmp(COM_FileExtension(stream->url), "qtv")) + stream->notifyData = &QTVFileDescriptor; + + else + return NPERR_INVALID_PARAM; + } + qstr->type = stream->notifyData; + + if (qstr->type->needseeking) + { + *stype = NP_ASFILEONLY; //everything is a download + +#ifdef FIREFOX_BUGS_OVER_25MB + *stype = NP_NORMAL; + qstr->pipe = FS_OpenTemp(); +#endif + } + else + { + *stype = NP_NORMAL; + qstr->pipe = VFSPIPE_Open(); + } + + return NPERR_NO_ERROR;*/ +} +NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, + NPReason reason) +{ + return NPERR_NO_ERROR; +/* struct context *ctx = instance->pdata; + struct qstream *qstr = stream->pdata; + + if (!qstr) //urm, got canceled before it finished downloading? + return NPERR_NO_ERROR; + + if (qstr->type->wait == WAIT_YES) + { + ctx->waitingfordatafiles--; + } + + if (qstr->next) + qstr->next->prev = qstr->prev; + if (qstr->prev) + qstr->prev->next = qstr->next; + else + ctx->activestreams = qstr->next; + + if (qstr->type->wait == WAIT_NONACTIVE) + { + Plug_LockPlugin(ctx, true); + qstr->type->completionfunc(ctx, qstr->pipe, qstr->url); + Plug_LockPlugin(ctx, false); + } + else + { + qstr->next = ctx->donestreams; + ctx->donestreams = qstr; + } + + if (qstr && qstr->type && qstr->type->wait) + { + InvalidateRgn(ctx->window.window, NULL, FALSE); + } + return NPERR_NO_ERROR;*/ +} +int32 NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream) +{ + return 8192; + +/* struct qstream *qstr = stream->pdata; + vfsfile_t *pipe = qstr?qstr->pipe:NULL; + + if (pipe && pipe->seekingisabadplan) + return 1024*1024 - VFS_GETLEN(pipe); + else + return 8192;*/ +} +int32 NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, + int32 len, void* buffer) +{ + return NPERR_NO_ERROR; +/* int bytes = NPP_WriteReady(instance, stream); + struct context *ctx = instance->pdata; + struct qstream *qstr = stream->pdata; + + if (qstr && qstr->type && qstr->type->wait) + { + qstr->offset = offset; + qstr->size = stream->end; + InvalidateRgn(ctx->window.window, NULL, FALSE); + } + + if (!qstr || !qstr->pipe) + return bytes; + + //we're not meant to read more bytes than we said we could read. + if (len > bytes) + len = bytes; + + return VFS_WRITE(qstr->pipe, buffer, len);*/ +} +void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, + const char* fname) +{ + return; +/* struct qstream *qstr = stream->pdata; + + if (!qstr) + return; + + if (qstr->pipe) + VFS_CLOSE(qstr->pipe); + qstr->pipe = VFSOS_Open(fname, "rb"); +*/ +} + +void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint) +{ + //we don't support printing. + //paper and ink doesn't give a good frame rate. + return; +} +int16 NP_LOADDS NPP_HandleEvent(NPP instance, void* event) +{ +// MessageBox(NULL, "NPP_HandleEvent", "npapi", 0); + return NPERR_NO_ERROR; +} +void NP_LOADDS NPP_URLNotify(NPP instance, const char* url, + NPReason reason, void* notifyData) +{ +} + +struct npscript +{ + NPObject obj; + + struct context *ctx; +}; + +NPObject *npscript_allocate(NPP npp, NPClass *aClass) +{ + struct npscript_property *prop; + struct npscript *obj; + obj = malloc(sizeof(*obj)); + obj->obj._class = aClass; + obj->obj.referenceCount = 1; + obj->ctx = npp->pdata; + + return (NPObject*)obj; +} +void npscript_deallocate(NPObject *npobj) +{ + free(npobj); +} +void npscript_invalidate(NPObject *npobj) +{ + struct npscript *obj = (struct npscript *)npobj; + obj->ctx = NULL; +} +bool npscript_hasMethod(NPObject *npobj, NPIdentifier name) +{ + NPUTF8 *mname; + mname = browserfuncs->utf8fromidentifier(name); + return false; +} +bool npscript_invoke(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) +{ + return false; +} +bool npscript_invokeDefault(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) +{ + return false; +} +bool npscript_hasProperty(NPObject *npobj, NPIdentifier name) +{ + struct npscript *obj = (struct npscript *)npobj; + struct npscript_property *prop; + NPUTF8 *pname; + pname = browserfuncs->utf8fromidentifier(name); + + if (Plug_FindProp(obj->ctx, pname)) + return true; + return false; +} +bool npscript_getProperty(NPObject *npobj, NPIdentifier name, NPVariant *result) +{ + struct npscript *obj = (struct npscript *)npobj; + struct context *ctx = obj->ctx; + NPUTF8 *pname; + struct pscript_property *prop; + bool success = false; + char *strval; + int intval; + float floatval; + pname = browserfuncs->utf8fromidentifier(name); + + Plug_LockPlugin(ctx, true); + prop = Plug_FindProp(obj->ctx, pname); + if (prop) + { + if (Plug_GetString(ctx, prop, &strval)) + { + char *ns; + int len; + len = strlen(strval); + ns = browserfuncs->memalloc(len); + if (ns) + { + memcpy(ns, strval, len); + STRINGZ_TO_NPVARIANT(ns, *result); + success = true; + } + Plug_GotString(strval); + } + else if (Plug_GetInteger(ctx, prop, &intval)) + { + INT32_TO_NPVARIANT(intval, *result); + success = true; + } + else if (Plug_GetFloat(ctx, prop, &floatval)) + { + DOUBLE_TO_NPVARIANT(floatval, *result); + success = true; + } + } + Plug_LockPlugin(ctx, false); + return success; +} +bool npscript_setProperty(NPObject *npobj, NPIdentifier name, const NPVariant *value) +{ + struct npscript *obj = (struct npscript *)npobj; + struct context *ctx = obj->ctx; + NPUTF8 *pname; + NPString str; + struct pscript_property *prop; + bool success = false; + pname = browserfuncs->utf8fromidentifier(name); + + Plug_LockPlugin(ctx, true); + prop = Plug_FindProp(obj->ctx, pname); + if (prop) + { + success = true; + if (NPVARIANT_IS_STRING(*value)) + { + char *t = NULL; + + str = NPVARIANT_TO_STRING(*value); + if (str.utf8characters[str.utf8length] != 0) + { + t = malloc(str.utf8length+1); + memcpy(t, str.utf8characters, str.utf8length); + t[str.utf8length] = 0; + str.utf8characters = t; + } + Plug_SetString(ctx, prop, str.utf8characters); + if (t) + free(t); + } + else if (NPVARIANT_IS_INT32(*value)) + Plug_SetInteger(ctx, prop, NPVARIANT_TO_INT32(*value)); + else if (NPVARIANT_IS_BOOLEAN(*value)) + Plug_SetInteger(ctx, prop, NPVARIANT_TO_BOOLEAN(*value)); + else if (NPVARIANT_IS_DOUBLE(*value)) + Plug_SetFloat(ctx, prop, NPVARIANT_TO_DOUBLE(*value)); + else + success = false; + } + Plug_LockPlugin(ctx, false); + return success; +} +bool npscript_removeProperty(NPObject *npobj, NPIdentifier name) +{ + return false; +} +bool npscript_enumerate(NPObject *npobj, NPIdentifier **value, uint32_t *count) +{ + return false; +} +bool npscript_construct(NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result) +{ + return false; +} + +NPClass npscript_class = +{ + NP_CLASS_STRUCT_VERSION, + + npscript_allocate, + npscript_deallocate, + npscript_invalidate, + npscript_hasMethod, + npscript_invoke, + npscript_invokeDefault, + npscript_hasProperty, + npscript_getProperty, + npscript_setProperty, + npscript_removeProperty, + npscript_enumerate, + npscript_construct +}; + +NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value) +{ + switch(variable) + { + case NPPVpluginScriptableNPObject: + *(void**)value = browserfuncs->createobject(instance, &npscript_class); + return NPERR_NO_ERROR; + default: + return NPERR_INVALID_PARAM; + } + + return NPERR_NO_ERROR; +} +NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value) +{ + switch(variable) + { + default: + return NPERR_INVALID_PARAM; + } + return NPERR_NO_ERROR; +} + +NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs) +{ + browserfuncs = pFuncs; + return NPERR_NO_ERROR; +} + +NPError OSCALL NP_Shutdown(void) +{ +/* if (contextlist) + { //the browser isn't meant to call this when there's still instances left... + return NPERR_GENERIC_ERROR; + } +*/ + return NPERR_NO_ERROR; +} + +NPError OSCALL NP_GetValue(void *instance, NPPVariable variable, void *value) +{ + if (value == NULL) + return NPERR_INVALID_PARAM; + + switch(variable) + { + case NPPVpluginNameString: + *(char**)value = "QTV Viewer"; + break; + case NPPVpluginDescriptionString: + *(char**)value = "QTV Viewer"; + break; + default: + return NPERR_INVALID_PARAM; + } + return NPERR_NO_ERROR; +} + +NPError OSCALL NP_GetEntryPoints (NPPluginFuncs* pFuncs) +{ + if (pFuncs->size < sizeof(NPPluginFuncs)) + return NPERR_INVALID_FUNCTABLE_ERROR; + pFuncs->size = sizeof(NPPluginFuncs); + + pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR; + + pFuncs->newp = NPP_New; + pFuncs->destroy = NPP_Destroy; + pFuncs->setwindow = NPP_SetWindow; + pFuncs->newstream = NPP_NewStream; + pFuncs->destroystream = NPP_DestroyStream; + pFuncs->asfile = NPP_StreamAsFile; + pFuncs->writeready = NPP_WriteReady; + pFuncs->write = NPP_Write; + pFuncs->print = NPP_Print; + pFuncs->event = NPP_HandleEvent; + pFuncs->urlnotify = NPP_URLNotify; + pFuncs->javaClass = NULL; + pFuncs->getvalue = NPP_GetValue; + pFuncs->setvalue = NPP_SetValue; + + return NPERR_NO_ERROR; +} + +char *NP_GetMIMEDescription(void) +{ + return "test/x-qtv:qtv:QTV Stream Description"; +} diff --git a/engine/client/sys_plugfte.c b/engine/client/sys_plugfte.c index d683bf357..9e32eb78f 100644 --- a/engine/client/sys_plugfte.c +++ b/engine/client/sys_plugfte.c @@ -825,7 +825,7 @@ void pscript_property_splash_sets(struct context *ctx, const char *val) */ } -extern cvar_t skin, team, topcolor, bottomcolor, vid_fullscreen; +extern cvar_t skin, team, topcolor, bottomcolor, vid_fullscreen, cl_download_mapsrc; static struct pscript_property pscript_properties[] = { {"running", false, NULL, NULL, NULL, pscript_property_running_getb, pscript_property_running_setb}, @@ -838,6 +838,7 @@ static struct pscript_property pscript_properties[] = {NULL, true, &bottomcolor}, {NULL, true, &password}, // {NULL, true, &spectator}, + {"mapsrc", true, &cl_download_mapsrc}, {"fullscreen", true, &vid_fullscreen}, {"datadownload",false, NULL, NULL, pscript_property_datadownload_sets}, diff --git a/engine/client/view.c b/engine/client/view.c index 0830f7ffd..61a3c89bb 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -309,7 +309,8 @@ qbyte gammatable[256]; // palette is sent through this unsigned short ramps[3][256]; //extern qboolean gammaworks; -float v_blend[4]; // rgba 0.0 - 1.0 +float sw_blend[4]; // rgba 0.0 - 1.0 +float hw_blend[4]; // rgba 0.0 - 1.0 /* void BuildGammaTable (float g) { @@ -600,74 +601,61 @@ V_CalcBlend */ #if defined(GLQUAKE) || defined(D3DQUAKE) -void GLV_CalcBlendServer (float colors[4]) +void GLV_CalcBlend (float *hw_blend) { -// extern qboolean gammaworks; -// if (gammaworks || !v_blend[3]) - if (!v_blend[3]) - { //regular cshifts work through hardware gamma - //server sent cshifts do not. - colors[0] = cl.cshifts[CSHIFT_SERVER].destcolor[0]/255.0f; - colors[1] = cl.cshifts[CSHIFT_SERVER].destcolor[1]/255.0f; - colors[2] = cl.cshifts[CSHIFT_SERVER].destcolor[2]/255.0f; - colors[3] = cl.cshifts[CSHIFT_SERVER].percent/255.0f; - } - else - { - float na; - na = cl.cshifts[CSHIFT_SERVER].percent/255.0f; - - colors[3] = v_blend[3] + na*(1-v_blend[3]); -//Con_Printf ("j:%i a:%f\n", j, a); - na = na/colors[3]; - colors[0] = v_blend[0]*(1-na) + (cl.cshifts[CSHIFT_SERVER].destcolor[0]/255.0f)*na; - colors[1] = v_blend[1]*(1-na) + (cl.cshifts[CSHIFT_SERVER].destcolor[1]/255.0f)*na; - colors[2] = v_blend[2]*(1-na) + (cl.cshifts[CSHIFT_SERVER].destcolor[2]/255.0f)*na; - } -} -void GLV_CalcBlend (void) -{ - float r, g, b, a, a2; + float a2; int j; + float *blend; - r = 0; - g = 0; - b = 0; - a = 0; + memset(hw_blend, 0, sizeof(float)*4); + memset(sw_blend, 0, sizeof(float)*4); //don't apply it to the server, we'll blend the two later if the user has no hardware gamma (if they do have it, we use just the server specified value) This way we avoid winnt users having a cheat with flashbangs and stuff. - for (j=0 ; j 1) - v_blend[3] = 1; - if (v_blend[3] < 0) - v_blend[3] = 0; + if (hw_blend[3] > 1) + hw_blend[3] = 1; + if (hw_blend[3] < 0) + hw_blend[3] = 0; + if (sw_blend[3] > 1) + sw_blend[3] = 1; + if (sw_blend[3] < 0) + sw_blend[3] = 0; } /* @@ -682,41 +670,13 @@ void GLV_UpdatePalette (qboolean force, double ftime) qboolean update; // qbyte *basepal, *newpal; // qbyte pal[768]; - float r,g,b,a; + float newhw_blend[4]; int ir, ig, ib; RSpeedMark(); V_CalcPowerupCshift (); - update = false; - - for (i=0 ; i ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -34,7 +34,7 @@ END 2 TEXTINCLUDE DISCARDABLE BEGIN - "#include ""afxres.h""\r\n" + "#include ""windows.h""\r\n" "\0" END diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index 7b077d7ab..218d59017 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -226,7 +226,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef NPQTV #undef TEXTEDITOR - #undef WEBCLIENT #undef WEBSERVER #endif diff --git a/engine/common/fs.c b/engine/common/fs.c index eed7f0aec..514f7a54a 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -74,7 +74,7 @@ char *VFS_GETS(vfsfile_t *vf, char *buffer, int buflen) return NULL; while (len > 0) { - if (!VFS_READ(vf, &in, 1)) + if (VFS_READ(vf, &in, 1) != 1) { if (len == buflen-1) return NULL; diff --git a/engine/common/protocol.h b/engine/common/protocol.h index 7ca10d76d..08e32c15c 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -576,8 +576,10 @@ enum { TE_LAVASPLASH = 10, TE_TELEPORT = 11, - TE_BLOOD = 12, - TE_LIGHTNINGBLOOD = 13, + TEQW_BLOOD = 12, + TENQ_EXPLOSION2 = 12, + TEQW_LIGHTNINGBLOOD = 13, + TENQ_BEAM = 13, #ifdef PEXT_TE_BULLET TE_BULLET = 14, @@ -587,94 +589,36 @@ enum { TE_RAILTRAIL = 17, // hexen 2 - TE_STREAM_CHAIN = 25, - TE_STREAM_SUNSTAFF1 = 26, - TE_STREAM_SUNSTAFF2 = 27, - TE_STREAM_LIGHTNING = 28, - TE_STREAM_COLORBEAM = 29, - TE_STREAM_ICECHUNKS = 30, - TE_STREAM_GAZE = 31, - TE_STREAM_FAMINE = 32, + TEH2_STREAM_CHAIN = 25, + TEH2_STREAM_SUNSTAFF1 = 26, + TEH2_STREAM_SUNSTAFF2 = 27, + TEH2_STREAM_LIGHTNING = 28, + TEH2_STREAM_COLORBEAM = 29, + TEH2_STREAM_ICECHUNKS = 30, + TEH2_STREAM_GAZE = 31, + TEH2_STREAM_FAMINE = 32, - TE_BIGGRENADE = 33, - TE_CHUNK = 34, - TE_HWBONEPOWER = 35, - TE_HWBONEPOWER2 = 36, - TE_METEORHIT = 37, - TE_HWRAVENDIE = 38, - TE_HWRAVENEXPLODE = 39, - TE_XBOWHIT = 40, - - TE_CHUNK2 = 41, - TE_ICEHIT = 42, - TE_ICESTORM = 43, - TE_HWMISSILEFLASH = 44, - TE_SUNSTAFF_CHEAP = 45, - TE_LIGHTNING_HAMMER = 46, - TE_DRILLA_EXPLODE = 47, - TE_DRILLA_DRILL = 48, - - TE_HWTELEPORT = 49, - TE_SWORD_EXPLOSION = 50, - - TE_AXE_BOUNCE = 51, - TE_AXE_EXPLODE = 52, - TE_TIME_BOMB = 53, - TE_FIREBALL = 54, - TE_SUNSTAFF_POWER = 55, - TE_PURIFY2_EXPLODE = 56, - TE_PLAYER_DEATH = 57, - TE_PURIFY1_EFFECT = 58, - TE_TELEPORT_LINGER = 59, - TE_LINE_EXPLOSION = 60, - TE_METEOR_CRUSH = 61, -//MISSION PACK - TE_STREAM_LIGHTNING_SMALL = 62, - - TE_ACIDBALL = 63, - TE_ACIDBLOB = 64, - TE_FIREWALL = 65, - TE_FIREWALL_IMPACT = 66, - TE_HWBONERIC = 67, - TE_POWERFLAME = 68, - TE_BLOODRAIN = 69, - TE_AXE = 70, - TE_PURIFY2_MISSILE = 71, - TE_SWORD_SHOT = 72, - TE_ICESHOT = 73, - TE_METEOR = 74, - TE_LIGHTNINGBALL = 75, - TE_MEGAMETEOR = 76, - TE_CUBEBEAM = 77, - TE_LIGHTNINGEXPLODE = 78, - TE_ACID_BALL_FLY = 79, - TE_ACID_BLOB_FLY = 80, - TE_CHAINLIGHTNING = 81 + TEDP_BLOOD = 50, + TEDP_SPARK = 51, + TEDP_BLOODSHOWER = 52, + TEDP_EXPLOSIONRGB = 53, + TEDP_PARTICLECUBE = 54, + TEDP_PARTICLERAIN = 55, // [vector] min [vector] max [vector] dir [short] count [byte] color + TEDP_PARTICLESNOW = 56, // [vector] min [vector] max [vector] dir [short] count [byte] color + TEDP_GUNSHOTQUAD = 57, // [vector] origin + TEDP_SPIKEQUAD = 58, // [vector] origin + TEDP_SUPERSPIKEQUAD = 59, // [vector] origin + TEDP_EXPLOSIONQUAD = 70, // [vector] origin + TEDP_SMALLFLASH = 72, // [vector] origin + TEDP_CUSTOMFLASH = 73, + TEDP_FLAMEJET = 74, + TEDP_PLASMABURN = 75, + TEDP_TEI_G3 = 76, + TEDP_SMOKE = 77, + TEDP_TEI_BIGEXPLOSION = 78, + TEDP_TEI_PLASMAHIT = 79, }; -#define NQTE_EXPLOSION2 12 -#define NQTE_BEAM 13 - -#define DPTE_BLOOD 50 -#define DPTE_SPARK 51 -#define DPTE_BLOODSHOWER 52 -#define DPTE_EXPLOSIONRGB 53 -#define DPTE_PARTICLECUBE 54 -#define DPTE_PARTICLERAIN 55 // [vector] min [vector] max [vector] dir [short] count [byte] color -#define DPTE_PARTICLESNOW 56 // [vector] min [vector] max [vector] dir [short] count [byte] color -#define DPTE_GUNSHOTQUAD 57 // [vector] origin -#define DPTE_SPIKEQUAD 58 // [vector] origin -#define DPTE_SUPERSPIKEQUAD 59 // [vector] origin -#define DPTE_EXPLOSIONQUAD 70 // [vector] origin -#define DPTE_SMALLFLASH 72 // [vector] origin -#define DPTE_CUSTOMFLASH 73 -#define DPTE_FLAMEJET 74 -#define DPTE_PLASMABURN 75 -#define DPTE_TEI_G3 76 -#define DPTE_SMOKE 77 -#define DPTE_TEI_BIGEXPLOSION 78 -#define DPTE_TEI_PLASMAHIT 79 - //FTE's version of TEI_SHOWLMP2 #define SL_ORG_NW 0 #define SL_ORG_NE 1 diff --git a/engine/dotnet2005/ftequake.sln b/engine/dotnet2005/ftequake.sln index fd59ed25a..7bf1b4e23 100644 --- a/engine/dotnet2005/ftequake.sln +++ b/engine/dotnet2005/ftequake.sln @@ -9,13 +9,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftequake", "ftequake.vcproj EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gas2masm", "gas2masm.vcproj", "{382E6790-D1CA-48F5-8E53-D114635EB61D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "npqtv", "npqtv.vcproj", "{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}" - ProjectSection(ProjectDependencies) = postProject - {382E6790-D1CA-48F5-8E53-D114635EB61D} = {382E6790-D1CA-48F5-8E53-D114635EB61D} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "botlib", "..\..\plugins\botlib\botlib.vcproj", "{66E1D0C0-BEB5-4365-A457-E177AFA6EB89}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "npfte", "npfte.vcproj", "{88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution D3DDebug|Win32 = D3DDebug|Win32 @@ -127,44 +124,6 @@ Global {382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|Win32.ActiveCfg = Debug|x64 {382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|x64.ActiveCfg = Debug|x64 {382E6790-D1CA-48F5-8E53-D114635EB61D}.Release|x64.Build.0 = Debug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|Win32.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|Win32.ActiveCfg = GLDebug|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.ActiveCfg = GLDebug|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.Build.0 = GLDebug|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.ActiveCfg = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.Build.0 = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.ActiveCfg = GLDebug|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.ActiveCfg = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.Build.0 = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.ActiveCfg = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.Build.0 = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|Win32.ActiveCfg = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.ActiveCfg = GLDebug|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.Build.0 = GLDebug|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.ActiveCfg = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.Build.0 = GLDebug|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.ActiveCfg = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.Build.0 = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|Win32.ActiveCfg = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|Win32.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|x64.Build.0 = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.ActiveCfg = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.Build.0 = GLRelease|Win32 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.ActiveCfg = GLRelease|x64 - {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.Build.0 = GLRelease|x64 {66E1D0C0-BEB5-4365-A457-E177AFA6EB89}.D3DDebug|Win32.ActiveCfg = Debug|Win32 {66E1D0C0-BEB5-4365-A457-E177AFA6EB89}.D3DDebug|Win32.Build.0 = Debug|Win32 {66E1D0C0-BEB5-4365-A457-E177AFA6EB89}.D3DDebug|x64.ActiveCfg = Debug|Win32 @@ -198,6 +157,45 @@ Global {66E1D0C0-BEB5-4365-A457-E177AFA6EB89}.Release|Win32.ActiveCfg = Release|Win32 {66E1D0C0-BEB5-4365-A457-E177AFA6EB89}.Release|Win32.Build.0 = Release|Win32 {66E1D0C0-BEB5-4365-A457-E177AFA6EB89}.Release|x64.ActiveCfg = Release|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|Win32.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.D3DDebug|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|Win32.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug Dedicated Server|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.ActiveCfg = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|Win32.Build.0 = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.ActiveCfg = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Debug|x64.Build.0 = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.ActiveCfg = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|Win32.Build.0 = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.ActiveCfg = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLDebug|x64.Build.0 = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|Win32.Build.0 = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.GLRelease|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|Win32.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MDebug|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.ActiveCfg = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|Win32.Build.0 = GLDebug|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.ActiveCfg = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLDebug|x64.Build.0 = GLDebug|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|Win32.Build.0 = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MinGLRelease|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|Win32.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.MRelease|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|Win32.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release Dedicated Server|x64.Build.0 = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.ActiveCfg = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|Win32.Build.0 = GLRelease|Win32 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.ActiveCfg = GLRelease|x64 + {88BFEE0E-7BC0-43AD-9CCC-6B1A6E4C1365}.Release|x64.Build.0 = GLRelease|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/engine/ftequake/npplug.rc b/engine/ftequake/npplug.rc index 4f12e9582..130e909a6 100644 --- a/engine/ftequake/npplug.rc +++ b/engine/ftequake/npplug.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,2 - PRODUCTVERSION 1,0,0,2 + FILEVERSION 1,0,0,3 + PRODUCTVERSION 1,0,0,3 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -48,15 +48,15 @@ BEGIN VALUE "CompanyName", "Forethought Entertainment\0" VALUE "FileDescription", "Quake in a browser\0" VALUE "FileExtents", "qtv|mvd\0" - VALUE "FileVersion", "1, 0, 0, 2\0" - VALUE "InternalName", "npqtv\0" + VALUE "FileVersion", "1, 0, 0, 3\0" + VALUE "InternalName", "npfte\0" VALUE "LegalCopyright", "Copyright © 2010\0" VALUE "LegalTrademarks", "\0" VALUE "MIMEType", "text/x-quaketvident|application/x-multiviewdemo|application/x-fteplugin\0" - VALUE "OriginalFilename", "npqtv.dll\0" + VALUE "OriginalFilename", "npfte.dll\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "QTV Viewer\0" - VALUE "ProductVersion", "1, 0, 0, 2\0" + VALUE "ProductName", "FTE Browser Plugin\0" + VALUE "ProductVersion", "1, 0, 0, 3\0" VALUE "SpecialBuild", "\0" END END @@ -82,7 +82,7 @@ END 2 TEXTINCLUDE DISCARDABLE BEGIN - "#include ""afxres.h""\r\n" + "#include ""windows.h""\r\n" "\0" END diff --git a/engine/gl/gl_draw.c b/engine/gl/gl_draw.c index e33d592b0..f173888a5 100644 --- a/engine/gl/gl_draw.c +++ b/engine/gl/gl_draw.c @@ -417,6 +417,7 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n")); TRACE(("dbg: GLDraw_ReInit: PPL_LoadSpecularFragmentProgram\n")); PPL_CreateShaderObjects(); + GL_InitSceneProcessingShaders(); #ifdef PLUGINS Plug_DrawReloadImages(); diff --git a/engine/gl/gl_rlight.c b/engine/gl/gl_rlight.c index 4ff6bcff8..17b56436f 100644 --- a/engine/gl/gl_rlight.c +++ b/engine/gl/gl_rlight.c @@ -83,13 +83,13 @@ void AddLightBlend (float r, float g, float b, float a2) g = bound(0, g, 1); b = bound(0, b, 1); - v_blend[3] = a = v_blend[3] + a2*(1-v_blend[3]); + sw_blend[3] = a = sw_blend[3] + a2*(1-sw_blend[3]); a2 = a2/a; - v_blend[0] = v_blend[0]*(1-a2) + r*a2; - v_blend[1] = v_blend[1]*(1-a2) + g*a2; - v_blend[2] = v_blend[2]*(1-a2) + b*a2; + sw_blend[0] = sw_blend[0]*(1-a2) + r*a2; + sw_blend[1] = sw_blend[1]*(1-a2) + g*a2; + sw_blend[2] = sw_blend[2]*(1-a2) + b*a2; //Con_Printf("AddLightBlend(): %4.2f %4.2f %4.2f %4.6f\n", v_blend[0], v_blend[1], v_blend[2], v_blend[3]); } diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 7f70b332d..33b67b167 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "glquake.h" #include "renderque.h" #include "shader.h" +#include "gl_draw.h" void R_RenderBrushPoly (msurface_t *fa); @@ -157,6 +158,9 @@ int scenepp_fisheye_parm_fov; int scenepp_panorama_program; int scenepp_panorama_parm_fov; +shader_t *shader_brighten; +shader_t *shader_polyblend; + // KrimZon - init post processing - called in GL_CheckExtensions, when they're called // I put it here so that only this file need be changed when messing with the post // processing shaders @@ -336,9 +340,34 @@ void GL_InitSceneProcessingShaders_MenuTint(void) void GL_InitSceneProcessingShaders (void) { - GL_InitSceneProcessingShaders_WaterWarp(); - GL_InitFisheyeFov(); - GL_InitSceneProcessingShaders_MenuTint(); + shader_brighten = R_RegisterShader("constrastshader", + "{\n" + "{\n" + "map $whiteimage\n" + "blendfunc gl_dst_color gl_one\n" + "rgbgen vertex\n" + "alphagen vertex\n" + "}\n" + "}\n" + ); + shader_polyblend = R_RegisterShader("polyblendshader", + "{\n" + "{\n" + "map $whiteimage\n" + "blendfunc gl_src_alpha gl_one_minus_src_alpha\n" + "rgbgen vertex\n" + "alphagen vertex\n" + "}\n" + "}\n" + ); + + + if (gl_config.arb_shader_objects) + { + GL_InitSceneProcessingShaders_WaterWarp(); + GL_InitFisheyeFov(); + GL_InitSceneProcessingShaders_MenuTint(); + } } #define PP_WARP_TEX_SIZE 64 @@ -865,49 +894,17 @@ void GLR_DrawEntitiesOnList (void) R_PolyBlend ============ */ -void GLV_CalcBlendServer (float colors[4]); //bright flashes and stuff void R_PolyBlend (void) { - float shift[4]; - extern qboolean gammaworks; - if ((!v_blend[3] || !gl_nohwblend.value) && !cl.cshifts[CSHIFT_SERVER].percent) + if (!sw_blend[3]) return; if (r_refdef.flags & Q2RDF_NOWORLDMODEL) return; -#pragma message("backend fixme") - Con_Printf("polyblends are not updated for the backend\n"); - - GLV_CalcBlendServer(shift); //figure out the shift we need (normally just the server specified one) - -Con_Printf("R_PolyBlend(): %4.2f %4.2f %4.2f %4.2f\n",shift[0], shift[1], shift[2], shift[3]); - - PPL_RevertToKnownState(); - - qglDisable (GL_ALPHA_TEST); - qglEnable (GL_BLEND); - qglDisable (GL_DEPTH_TEST); - qglDisable (GL_TEXTURE_2D); - - qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - qglColor4fv (shift); - - qglBegin (GL_QUADS); - - qglVertex3f (r_refdef.vrect.x, r_refdef.vrect.y, -1); - qglVertex3f (r_refdef.vrect.x, r_refdef.vrect.y+r_refdef.vrect.height, -1); - qglVertex3f (r_refdef.vrect.x+r_refdef.vrect.width, r_refdef.vrect.y+r_refdef.vrect.height, -1); - qglVertex3f (r_refdef.vrect.x+r_refdef.vrect.width, r_refdef.vrect.y, -1); - qglEnd (); - - qglDisable (GL_BLEND); - qglEnable (GL_TEXTURE_2D); - qglEnable (GL_ALPHA_TEST); - - PPL_RevertToKnownState(); + R2D_ImageColours (sw_blend[0], sw_blend[1], sw_blend[2], sw_blend[3]); + R2D_ScalePic(0, 0, vid.width, vid.height, shader_polyblend); } //for lack of hardware gamma @@ -923,33 +920,18 @@ void GLR_BrightenScreen (void) if (r_refdef.flags & Q2RDF_NOWORLDMODEL) return; - PPL_RevertToKnownState(); - f = gl_contrast.value; f = min (f, 3); - qglDisable (GL_TEXTURE_2D); - qglEnable (GL_BLEND); - qglBlendFunc (GL_DST_COLOR, GL_ONE); - qglBegin (GL_QUADS); - while (f > 1) { + while (f > 1) + { if (f >= 2) - qglColor3f (1,1,1); + R2D_ImageColours (1, 1, 1, 1); else - qglColor3f (f - 1, f - 1, f - 1); - qglVertex2f (0, 0); - qglVertex2f (vid.width, 0); - qglVertex2f (vid.width, vid.height); - qglVertex2f (0, vid.height); + R2D_ImageColours (f - 1, f - 1, f - 1, 1); + R2D_ScalePic(0, 0, vid.width, vid.height, shader_brighten); f *= 0.5; } - qglEnd (); - qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - qglEnable (GL_TEXTURE_2D); - qglDisable (GL_BLEND); - qglColor3f(1, 1, 1); - - PPL_RevertToKnownState(); RSpeedEnd(RSPEED_PALETTEFLASHES); } @@ -1061,7 +1043,6 @@ static void GLR_SetupFrame (void) if (r_viewleaf) V_SetContentsColor (r_viewleaf->contents); } - GLV_CalcBlend (); c_brush_polys = 0; c_alias_polys = 0; diff --git a/engine/gl/gl_screen.c b/engine/gl/gl_screen.c index beae91f5b..e6d39e6ba 100644 --- a/engine/gl/gl_screen.c +++ b/engine/gl/gl_screen.c @@ -278,8 +278,11 @@ void GLSCR_UpdateScreen (void) GL_Set2D (); - R_PolyBlend (); - GLR_BrightenScreen(); + if (!noworld) + { + R_PolyBlend (); + GLR_BrightenScreen(); + } scr_con_forcedraw = false; if (noworld) diff --git a/engine/gl/gl_vidcommon.c b/engine/gl/gl_vidcommon.c index 43df512d0..1be92763c 100644 --- a/engine/gl/gl_vidcommon.c +++ b/engine/gl/gl_vidcommon.c @@ -448,8 +448,6 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name)) qglUniform3fvARB = (void *)getglext("glUniform3fvARB"); qglUniform1iARB = (void *)getglext("glUniform1iARB"); qglUniform1fARB = (void *)getglext("glUniform1fARB"); - - GL_InitSceneProcessingShaders(); } if (GL_CheckExtension("GL_ARB_fragment_shader")) diff --git a/engine/http/httpclient.c b/engine/http/httpclient.c index 7527d4a3b..54f4b793a 100644 --- a/engine/http/httpclient.c +++ b/engine/http/httpclient.c @@ -11,530 +11,6 @@ This file does one thing. Connects to servers and grabs the specified file. It d It doesn't use persistant connections. */ - -#if 0 - -typedef struct http_con_s { - int sock; - - enum {HC_REQUESTING,HC_GETTINGHEADER, HC_GETTING} state; - - char *buffer; - - char filename[MAX_QPATH]; - vfsfile_t *file; - - int bufferused; - int bufferlen; - - int totalreceived; //useful when we're just dumping to a file. - - qboolean chunking; - int chunksize; - int chunked; - - int contentlength; - - void (*NotifyFunction)(char *localfile, qboolean sucess); //called when failed or succeeded, and only if it got a connection in the first place. - struct http_con_s *next; -} http_con_t; - -static http_con_t *httpcl; - -static void ExpandBuffer(http_con_t *con, int quant) -{ - int newlen; - newlen = con->bufferlen + quant; - con->buffer = IWebRealloc(con->buffer, newlen); - con->bufferlen = newlen; -} - -static qboolean HTTP_CL_Run(http_con_t *con) -{ - char buffer[256]; - char Location[256]; - char *nl; - char *msg; - int ammount; - switch(con->state) - { - case HC_REQUESTING: - ammount = send(con->sock, con->buffer, con->bufferused, 0); - if (!ammount) - return false; - - if (ammount < 0) - { - if (qerrno != EWOULDBLOCK) - return false; - return true; - } - - con->bufferused -= ammount; - memmove(con->buffer, con->buffer+ammount, con->bufferused); - if (!con->bufferused) //that's it, all sent. - con->state = HC_GETTINGHEADER; - break; - - case HC_GETTINGHEADER: - if (con->bufferlen - con->bufferused < 1530) - ExpandBuffer(con, 1530); - - ammount = recv(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-15, 0); - if (!ammount) - return false; - if (ammount < 0) - { - if (qerrno != EWOULDBLOCK) - return false; - return true; - } - - con->bufferused+=ammount; - con->buffer[con->bufferused] = '\0'; - //have we got the entire thing yet? - - msg = con->buffer; - con->chunking = false; - if (strnicmp(msg, "HTTP/", 5)) - { //pre version 1. (lame servers. - con->state = HC_GETTING; - con->contentlength = -1; //meaning end of stream. - } - else - { - while(*msg) - { - if (*msg == '\n') - { - if (msg[1] == '\n') - { //tut tut, not '\r'? that's not really allowed... - msg+=1; - break; - } - if (msg[2] == '\n') - { - msg+=2; - break; - } - } - msg++; - if (!strnicmp(msg, "Content-Length: ", 16)) - con->contentlength = atoi(msg+16); - else if (!strnicmp(msg, "Location: ", 10)) - { - nl = strchr(msg, '\n'); - if (nl) - { - *nl = '\0'; - Q_strncpyz(Location, COM_TrimString(msg+10), sizeof(Location)); - *nl = '\n'; - } - } - else if (!strnicmp(msg, "Transfer-Encoding: ", 19)) - { - char *chunk = strstr(msg, "chunked"); - nl = strchr(msg, '\n'); - if (nl) - if (chunk < nl) - con->chunking = true; - } - } - if (!*msg) - break;//switch - msg++; - - ammount = msg - con->buffer; - - msg = COM_ParseOut(con->buffer, buffer, sizeof(buffer)); - msg = COM_ParseOut(msg, buffer, sizeof(buffer)); - if (!stricmp(buffer, "100")) - { //http/1.1 servers can give this. We ignore it. - - con->bufferused -= ammount; - memmove(con->buffer, con->buffer+ammount, con->bufferused); - return true; - } - - if (!stricmp(buffer, "301") || !stricmp(buffer, "302") || !stricmp(buffer, "303")) - { - nl = strchr(msg, '\n'); - if (nl) - *nl = '\0'; - Con_Printf("HTTP: %s %s\n", buffer, COM_TrimString(msg)); - if (!*Location) - Con_Printf("Server redirected to null location\n"); - else - { - if (HTTP_CL_Get(Location, con->filename, con->NotifyFunction)) - con->NotifyFunction = NULL; - } - - return false; - } - - if (stricmp(buffer, "200")) - { - nl = strchr(msg, '\n'); - if (!nl) - return false; //eh? - if (nl>msg&&nl[-1] == '\r') - nl--; - *nl = '\0'; - Con_Printf("HTTP: %s%s\n", buffer, msg); - return false; //something went wrong. - } - - con->bufferused -= ammount; - - if (!con->file) - { - con->file = FS_OpenVFS(con->filename, "wb", FS_GAME); - if (!con->file) - { - Con_Printf("HTTP: Couldn't open file %s\n", con->filename); - return false; - } - } - - if (!con->file) - { - VFS_WRITE(con->file, con->buffer+ammount, con->bufferused); - con->bufferused = 0; - } - else - memmove(con->buffer, con->buffer+ammount, con->bufferused); - - - con->state = HC_GETTING; - - } - //Fall through - - case HC_GETTING: - if (con->bufferlen - con->bufferused < 1530) - ExpandBuffer(con, 1530); - - ammount = recv(con->sock, con->buffer+con->bufferused, con->bufferlen-con->bufferused-1, 0); - if (ammount < 0) - { - if (qerrno != EWOULDBLOCK) - return false; - return true; - } - - con->bufferused+=ammount; - - if (con->chunking) //FIXME: NEEDS TESTING!!! - { - int trim; - char *nl; - con->buffer[con->bufferused] = '\0'; - for(;;) - { //work out as we go. - if (con->chunksize)//we are trying to parse a chunk. - { - trim = con->bufferused - con->chunked; - if (trim > con->chunksize) - trim = con->chunksize; //don't go into the next size field. - con->chunksize -= trim; - con->chunked += trim; - - if (!con->chunksize) - { //we need to find the next \n and trim it. - nl = strchr(con->buffer+con->chunked, '\n'); - if (!nl) - break; - nl++; - trim = nl - (con->buffer+con->chunked); - memmove(con->buffer + con->chunked, nl, con->buffer+con->bufferused-nl+1); - con->bufferused -= trim; - } - if (!(con->bufferused - con->chunked)) - break; - } - else - { - nl = strchr(con->buffer+con->chunked, '\n'); - if (!nl) - break; - con->chunksize = strtol(con->buffer+con->chunked, NULL, 16); //it's hex. - nl++; - trim = nl - (con->buffer+con->chunked); - memmove(con->buffer + con->chunked, nl, con->buffer+con->bufferused-nl+1); - con->bufferused -= trim; - } - } - - - con->totalreceived+=con->chunked; - if (con->file && con->chunked) //we've got a chunk in the buffer - { //write it - if (VFS_WRITE(con->file, con->buffer, con->chunked) != con->chunked) - { - Con_Printf("Write error whilst downloading %s\nDisk full?\n", con->filename); - return false; - } - - //and move the unparsed chunk to the front. - con->bufferused -= con->chunked; - memmove(con->buffer, con->buffer+con->chunked, con->bufferused); - con->chunked = 0; - } - } - else - { - con->totalreceived+=ammount; - if (con->file) //we've got a chunk in the buffer - { //write it - if (VFS_WRITE(con->file, con->buffer, con->bufferused) != con->bufferused) - { - Con_Printf("Write error whilst downloading %s\nDisk full?\n", con->filename); - return false; - } - con->bufferused = 0; - } - } - - if (!ammount) - { //server closed off the connection. - if (con->chunksize) - Con_Printf("Download was part way through chunking - must be corrupt - %s\n", con->filename); - else if (con->bufferused != con->contentlength && !con->file) - Con_Printf("Recieved file isn't the correct length - must be corrupt - %s\n", con->filename); - Con_Printf("Retrieved %s\n", con->filename); - if (!con->file && *con->filename) - { - FS_WriteFile(con->filename, con->buffer, con->bufferused, FS_GAME); - } - if (con->NotifyFunction) - { - con->NotifyFunction(con->filename, true); - con->NotifyFunction = NULL; - } - return false; - } - - break; - } - - return true; -} - -qboolean HTTP_CL_SingleThink(http_con_t *con) -{ - if (!HTTP_CL_Run(con)) - { - if (con->NotifyFunction) - con->NotifyFunction(con->filename, false); - - if (cls.downloadmethod == DL_HTTP) - cls.downloadmethod = DL_NONE; - closesocket(con->sock); - - if (con->buffer) - IWebFree(con->buffer); - IWebFree(con); - - //I don't fancy fixing this up. - return false; - } - - return true; -} - -void HTTP_CL_Think(void) -{ - http_con_t *con = httpcl; - http_con_t *prev = NULL; - http_con_t *oldnext; - - while (con) - { - oldnext = con->next; - - if (!HTTP_CL_SingleThink(con)) - { - if (prev) - prev->next = oldnext; - else - httpcl = oldnext; - - return; - } - else if (!cls.downloadmethod) - { - cls.downloadmethod = DL_HTTP; - if (con->state != HC_GETTING) - cls.downloadpercent = 0; - else if (con->contentlength <= 0) - cls.downloadpercent = 50; - else - cls.downloadpercent = con->bufferused*100.0f/con->contentlength; - strcpy(cls.downloadlocalname, con->filename); - strcpy(cls.downloadremotename, con->filename); - } - else if (cls.downloadmethod == DL_HTTP) - { - if (!strcmp(cls.downloadlocalname, con->filename)) - { - if (con->state != HC_GETTING) - cls.downloadpercent = 0; - else if (con->contentlength <= 0) - cls.downloadpercent = 50; - else - cls.downloadpercent = con->totalreceived*100.0f/con->contentlength; - } - } - - prev = con; - con = con->next; - } -} - -//returns true if we start downloading it -//returns false if we couldn't connect -//note that this return value is actually pretty useless -//the NotifyFunction will only ever be called after this has returned true, and won't always suceed. -qboolean HTTP_CL_Get(char *url, char *localfile, void (*NotifyFunction)(char *localfile, qboolean sucess)) -{ - unsigned long _true = true; - struct sockaddr_qstorage from; - http_con_t *con; - - char server[128]; - char uri[MAX_OSPATH]; - char *slash; - - if (localfile) - if (!*localfile) - localfile = NULL; - - if (!strnicmp(url, "http://", 7)) - url+=7; - else if (!strnicmp(url, "ftp://", 6)) - { - url+=6; - slash = strchr(url, '/'); - if (!slash) - { - Q_strncpyz(server, url, sizeof(server)); - Q_strncpyz(uri, "/", sizeof(uri)); - } - else - { - Q_strncpyz(uri, slash, sizeof(uri)); - Q_strncpyz(server, url, sizeof(server)); - server[slash-url] = '\0'; - } - - if (!localfile) - localfile = uri+1; - - return FTP_Client_Command(va("download %s \"%s\" \"%s\"", server, uri+1, localfile), NotifyFunction); - } - else - { - Con_Printf("Bad URL: %s\n", url); - return false; - } - - slash = strchr(url, '/'); - if (!slash) - { - Q_strncpyz(server, url, sizeof(server)); - Q_strncpyz(uri, "/", sizeof(uri)); - } - else - { - Q_strncpyz(uri, slash, sizeof(uri)); - Q_strncpyz(server, url, sizeof(server)); - server[slash-url] = '\0'; - } - - if (!localfile) - localfile = uri+1; - - con = IWebMalloc(sizeof(http_con_t)); - - if ((con->sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) - { - Sys_Error ("HTTPCL_TCP_OpenSocket: socket: %s\n", strerror(qerrno)); - } - - - {//quake routines using dns and stuff (Really, I wanna keep quake and ftp fairly seperate) - netadr_t qaddy; - if (!NET_StringToAdr (server, &qaddy)) - { - IWebWarnPrintf ("HTTPCL_TCP_OpenSocket: Failed to resolve host: %s\n", server); - closesocket(con->sock); - IWebFree(con); - return false; - } - if (!qaddy.port) - qaddy.port = htons(80); - NetadrToSockadr(&qaddy, &from); - }//end of quake. - - //not yet blocking. - if (connect(con->sock, (struct sockaddr *)&from, sizeof(struct sockaddr_in)) == -1) - { - IWebWarnPrintf ("HTTPCL_TCP_OpenSocket: connect: %i %s\n", qerrno, strerror(qerrno)); - closesocket(con->sock); - IWebFree(con); - return false; - } - - if (ioctlsocket (con->sock, FIONBIO, &_true) == -1) //now make it non blocking. - { - Sys_Error ("HTTPCL_TCP_OpenSocket: ioctl FIONBIO: %s\n", strerror(qerrno)); - } - - ExpandBuffer(con, 2048); - sprintf(con->buffer, "GET %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "User-Agent: "FULLENGINENAME"\r\n" "\r\n", uri, server); - con->bufferused = strlen(con->buffer); - con->contentlength = -1; - con->NotifyFunction = NotifyFunction; - if (!NotifyFunction) - Con_Printf("No NotifyFunction\n"); - Q_strncpyz(con->filename, localfile, sizeof(con->filename)); - - slash = strchr(con->filename, '?'); - if (slash) - *slash = '_'; - - if (HTTP_CL_SingleThink(con)) - { - con->next = httpcl; - httpcl = con; - return true; - } - - return false; -} - -#endif - - - - - - - - - - - - - - - - - - - - struct http_dl_ctx_s { struct dl_download *dlctx; @@ -721,21 +197,22 @@ static qboolean HTTP_DL_Work(struct dl_download *dl) if (!dl->file) { - dl->file = FS_OpenVFS(dl->localname, "wb", FS_GAME); + if (*dl->localname) + { + FS_CreatePath(dl->localname, FS_GAME); + dl->file = FS_OpenVFS(dl->localname, "wb", FS_GAME); + } + else + dl->file = FS_OpenTemp(); if (!dl->file) { Con_Printf("HTTP: Couldn't open file %s\n", dl->localname); + dl->status = DL_FAILED; return false; } } - if (!dl->file) - { - VFS_WRITE(dl->file, con->buffer+ammount, con->bufferused); - con->bufferused = 0; - } - else - memmove(con->buffer, con->buffer+ammount, con->bufferused); + memmove(con->buffer, con->buffer+ammount, con->bufferused); con->state = HC_GETTING; @@ -914,15 +391,6 @@ void HTTPDL_Establish(struct dl_download *dl) sprintf(con->buffer, "GET %s HTTP/1.1\r\n" "Host: %s\r\n" "Connection: close\r\n" "User-Agent: "FULLENGINENAME"\r\n" "\r\n", uri, server); con->bufferused = strlen(con->buffer); con->contentlength = -1; - - if (!*dl->localname) - { - Q_strncpyz(dl->localname, url+1, sizeof(dl->localname)); - - slash = strchr(dl->localname, '?'); - if (slash) - *slash = '_'; - } } qboolean HTTPDL_Poll(struct dl_download *dl) @@ -937,6 +405,7 @@ qboolean HTTPDL_Poll(struct dl_download *dl) if (dl->status == DL_FAILED) { HTTP_Cleanup(dl); + dl->status = DL_FAILED; return false; } } @@ -947,6 +416,7 @@ qboolean HTTPDL_Poll(struct dl_download *dl) if (dl->status == DL_FAILED) { HTTP_Cleanup(dl); + dl->status = DL_FAILED; return false; } if (dl->status == DL_FINISHED) @@ -1050,7 +520,8 @@ struct dl_download *HTTP_CL_Get(const char *url, const char *localfile, void (*N return newdl; newdl->notify = NotifyFunction; - Q_strncpyz(newdl->localname, localfile, sizeof(newdl->localname)); + if (localfile) + Q_strncpyz(newdl->localname, localfile, sizeof(newdl->localname)); newdl->next = activedownloads; activedownloads = newdl; @@ -1069,10 +540,21 @@ void HTTP_CL_Think(void) con = *link; if (!con->poll(con)) { + if (con->file) + VFS_SEEK(con->file, 0); if (con->notify) con->notify(con); *link = con->next; DL_Close(con); + + if (cls.downloadmethod == DL_HTTP) + { + if (!strcmp(cls.downloadlocalname, con->localname)) + { + cls.downloadmethod = DL_NONE; + *cls.downloadlocalname = *cls.downloadremotename = 0; + } + } continue; } link = &con->next; diff --git a/engine/npfte/install.rdf b/engine/npfte/install.rdf new file mode 100644 index 000000000..28c4eb002 --- /dev/null +++ b/engine/npfte/install.rdf @@ -0,0 +1,16 @@ + + + + + npfte@fteqw.com + FTE Browser Plugin + 0.1 + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 1.0 + 3.9.* + + + + diff --git a/engine/server/net_preparse.c b/engine/server/net_preparse.c index 6ff1927e9..7423e4069 100644 --- a/engine/server/net_preparse.c +++ b/engine/server/net_preparse.c @@ -154,7 +154,7 @@ void NPP_NQFlush(void) case svc_temp_entity: switch (buffer[1]) { - case NQTE_EXPLOSION2: //happens with rogue. + case TENQ_EXPLOSION2: //happens with rogue. bufferlen -= 2; //trim the colour buffer[1] = TE_EXPLOSION; break; @@ -375,7 +375,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw) case svc_temp_entity: switch(data) { - case NQTE_BEAM: + case TENQ_BEAM: data = TE_LIGHTNING1; //QW doesn't do te_beam. Replace with lightning1. //fallthrough case TE_LIGHTNING1: @@ -414,7 +414,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw) protocollen = sizeof(qbyte) + sizeofcoord*6; ignoreprotocol = true; break; - case NQTE_EXPLOSION2: + case TENQ_EXPLOSION2: protocollen = sizeof(qbyte)*4 + sizeofcoord*3; multicastpos=2; multicasttype=MULTICAST_PHS_R; @@ -430,48 +430,48 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw) multicastpos=2; multicasttype=MULTICAST_PHS; break; - case TE_STREAM_CHAIN: - case TE_STREAM_SUNSTAFF1: - case TE_STREAM_SUNSTAFF2: - case TE_STREAM_LIGHTNING: - case TE_STREAM_ICECHUNKS: - case TE_STREAM_GAZE: - case TE_STREAM_FAMINE: + case TEH2_STREAM_CHAIN: + case TEH2_STREAM_SUNSTAFF1: + case TEH2_STREAM_SUNSTAFF2: + case TEH2_STREAM_LIGHTNING: + case TEH2_STREAM_ICECHUNKS: + case TEH2_STREAM_GAZE: + case TEH2_STREAM_FAMINE: protocollen = sizeofcoord*6+sizeof(short)+sizeof(qbyte)*(2+2); multicastpos = 8; multicasttype=MULTICAST_PHS; break; - case TE_STREAM_COLORBEAM: + case TEH2_STREAM_COLORBEAM: protocollen = sizeofcoord*6+sizeof(short)+sizeof(qbyte)*(3+2); multicastpos = 8; multicasttype=MULTICAST_PHS; break; - case DPTE_FLAMEJET: //TE_FLAMEJET + case TEDP_FLAMEJET: //TE_FLAMEJET protocollen = sizeofcoord*6 +sizeof(qbyte)*3; multicastpos = 2; multicasttype=MULTICAST_PVS; break; - case DPTE_TEI_G3: + case TEDP_TEI_G3: protocollen = sizeofcoord*9+sizeof(qbyte)*2; multicastpos = 2; multicasttype=MULTICAST_PHS; break; - case DPTE_SMOKE: + case TEDP_SMOKE: protocollen = sizeofcoord*6+sizeof(qbyte)*3; multicastpos = 2; multicasttype=MULTICAST_PHS; break; - case DPTE_TEI_BIGEXPLOSION: + case TEDP_TEI_BIGEXPLOSION: protocollen = sizeofcoord*3+sizeof(qbyte)*2; multicastpos = 2; multicasttype=MULTICAST_PHS; break; - case DPTE_TEI_PLASMAHIT: + case TEDP_TEI_PLASMAHIT: protocollen = sizeofcoord*6+sizeof(qbyte)*3; multicastpos = 2; multicasttype=MULTICAST_PHS; @@ -894,8 +894,8 @@ void NPP_QWFlush(void) case svc_temp_entity: switch(minortype) { - case TE_LIGHTNINGBLOOD: - case TE_BLOOD: //needs to be converted to a particle + case TEQW_LIGHTNINGBLOOD: + case TEQW_BLOOD: //needs to be converted to a particle { vec3_t org; qbyte count; @@ -910,7 +910,7 @@ void NPP_QWFlush(void) org[1] = (*(short*)&buffer[multicastpos+2])/8.0f; org[2] = (*(short*)&buffer[multicastpos+4])/8.0f; count = buffer[2]*20; - if (minortype == TE_LIGHTNINGBLOOD) + if (minortype == TEQW_LIGHTNINGBLOOD) colour = 225; else colour = 73; @@ -1169,13 +1169,13 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw) multicasttype=MULTICAST_PHS; protocollen = sizeofcoord*6+sizeof(short)+sizeof(qbyte)*2; break; - case TE_BLOOD: //needs to be converted to a particle + case TEQW_BLOOD: //needs to be converted to a particle case TE_GUNSHOT: //needs qbyte 2 removed multicastpos=3; multicasttype=MULTICAST_PVS; protocollen = sizeofcoord*3+sizeof(qbyte)*3; break; - case TE_LIGHTNINGBLOOD: + case TEQW_LIGHTNINGBLOOD: case TE_EXPLOSION: case TE_SPIKE: case TE_SUPERSPIKE: diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index b4bd05626..8baf683fd 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -2330,7 +2330,7 @@ static void PF_particle (progfuncs_t *prinst, globalvars_t *pr_globals) //I said if (color == 73) { MSG_WriteByte (&sv.multicast, svc_temp_entity); - MSG_WriteByte (&sv.multicast, TE_BLOOD); + MSG_WriteByte (&sv.multicast, TEQW_BLOOD); MSG_WriteByte (&sv.multicast, count<10?1:(count+10)/20); MSG_WriteCoord (&sv.multicast, org[0]); MSG_WriteCoord (&sv.multicast, org[1]); @@ -2340,7 +2340,7 @@ static void PF_particle (progfuncs_t *prinst, globalvars_t *pr_globals) //I said else if (color == 225) { MSG_WriteByte (&sv.multicast, svc_temp_entity); - MSG_WriteByte (&sv.multicast, TE_LIGHTNINGBLOOD); + MSG_WriteByte (&sv.multicast, TEQW_LIGHTNINGBLOOD); MSG_WriteCoord (&sv.multicast, org[0]); MSG_WriteCoord (&sv.multicast, org[1]); MSG_WriteCoord (&sv.multicast, org[2]); @@ -2395,7 +2395,7 @@ void PF_te_blooddp (progfuncs_t *prinst, globalvars_t *pr_globals) #endif MSG_WriteByte (&sv.multicast, svc_temp_entity); - MSG_WriteByte (&sv.multicast, TE_BLOOD); + MSG_WriteByte (&sv.multicast, TEQW_BLOOD); MSG_WriteByte (&sv.multicast, count<10?1:(count+10)/20); MSG_WriteCoord (&sv.multicast, org[0]); MSG_WriteCoord (&sv.multicast, org[1]); @@ -4517,7 +4517,7 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is type = TE_SUPERBULLET; split = PEXT_TE_BULLET; break; - case TE_BLOOD: + case TEQW_BLOOD: case TE_GUNSHOT: MSG_WriteByte (&sv.multicast, type); MSG_WriteByte (&sv.multicast, count); @@ -4543,7 +4543,7 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is MSG_WriteCoord (&sv.nqmulticast, o[1]); MSG_WriteCoord (&sv.nqmulticast, o[2]); #endif - if (type == TE_BLOOD || type == TE_LIGHTNINGBLOOD) + if (type == TEQW_BLOOD || type == TEQW_LIGHTNINGBLOOD) { #ifdef NQPROT sv.nqmulticast.cursize = 0; //don't send a te_blood or lightningblood to an nq client - they'll die horribly. @@ -4558,7 +4558,7 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is MSG_WriteChar (&sv.nqmulticast, 0); MSG_WriteChar (&sv.nqmulticast, 0); MSG_WriteByte (&sv.nqmulticast, count*20); - if (type == TE_BLOOD) + if (type == TEQW_BLOOD) MSG_WriteByte (&sv.nqmulticast, 73); else MSG_WriteByte (&sv.nqmulticast, 225); @@ -4595,7 +4595,7 @@ void SV_beam_tempentity (int ownerent, vec3_t start, vec3_t end, int type) if (type == TE_LIGHTNING2 && ownerent<0) //special handling for TE_BEAM (don't do TE_RAILGUN - it's a tomaz extension) { MSG_WriteByte (&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte (&sv.nqmulticast, NQTE_BEAM); + MSG_WriteByte (&sv.nqmulticast, TENQ_BEAM); MSG_WriteShort (&sv.nqmulticast, -1-ownerent); MSG_WriteCoord (&sv.nqmulticast, start[0]); MSG_WriteCoord (&sv.nqmulticast, start[1]); @@ -7426,7 +7426,7 @@ void PF_te_gunshotquad(progfuncs_t *prinst, struct globalvars_s *pr_globals) count = G_FLOAT(OFS_PARM1); else count = 1; - SV_point_tempentity(G_VECTOR(OFS_PARM0), DPTE_GUNSHOTQUAD, count); + SV_point_tempentity(G_VECTOR(OFS_PARM0), TEDP_GUNSHOTQUAD, count); } //DP_TE_STANDARDEFFECTBUILTINS @@ -7439,13 +7439,13 @@ void PF_te_spike(progfuncs_t *prinst, struct globalvars_s *pr_globals) //DP_TE_QUADEFFECTS1 void PF_te_spikequad(progfuncs_t *prinst, struct globalvars_s *pr_globals) { - SV_point_tempentity(G_VECTOR(OFS_PARM0), DPTE_SPIKEQUAD, 1); + SV_point_tempentity(G_VECTOR(OFS_PARM0), TEDP_SPIKEQUAD, 1); } // FTE_TE_STANDARDEFFECTBUILTINS void PF_te_lightningblood(progfuncs_t *prinst, struct globalvars_s *pr_globals) { - SV_point_tempentity(G_VECTOR(OFS_PARM0), TE_LIGHTNINGBLOOD, 1); + SV_point_tempentity(G_VECTOR(OFS_PARM0), TEQW_LIGHTNINGBLOOD, 1); } // FTE_TE_STANDARDEFFECTBUILTINS @@ -7456,7 +7456,7 @@ void PF_te_bloodqw(progfuncs_t *prinst, struct globalvars_s *pr_globals) count = G_FLOAT(OFS_PARM1); else count = 1; - SV_point_tempentity(G_VECTOR(OFS_PARM0), TE_BLOOD, count); + SV_point_tempentity(G_VECTOR(OFS_PARM0), TEQW_BLOOD, count); } //DP_TE_STANDARDEFFECTBUILTINS @@ -7468,7 +7468,7 @@ void PF_te_superspike(progfuncs_t *prinst, struct globalvars_s *pr_globals) //DP_TE_QUADEFFECTS1 void PF_te_superspikequad(progfuncs_t *prinst, struct globalvars_s *pr_globals) { - SV_point_tempentity(G_VECTOR(OFS_PARM0), DPTE_SUPERSPIKEQUAD, 1); + SV_point_tempentity(G_VECTOR(OFS_PARM0), TEDP_SUPERSPIKEQUAD, 1); } //DP_TE_STANDARDEFFECTBUILTINS @@ -7480,7 +7480,7 @@ void PF_te_explosion(progfuncs_t *prinst, struct globalvars_s *pr_globals) //DP_TE_QUADEFFECTS1 void PF_te_explosionquad(progfuncs_t *prinst, struct globalvars_s *pr_globals) { - SV_point_tempentity(G_VECTOR(OFS_PARM0), DPTE_EXPLOSIONQUAD, 1); + SV_point_tempentity(G_VECTOR(OFS_PARM0), TEDP_EXPLOSIONQUAD, 1); } //DP_TE_STANDARDEFFECTBUILTINS @@ -7563,7 +7563,7 @@ void PF_te_spark(progfuncs_t *prinst, struct globalvars_s *pr_globals) return; MSG_WriteByte(&sv.multicast, svc_temp_entity); - MSG_WriteByte(&sv.multicast, DPTE_SPARK); + MSG_WriteByte(&sv.multicast, TEDP_SPARK); // origin MSG_WriteCoord(&sv.multicast, org[0]); MSG_WriteCoord(&sv.multicast, org[1]); @@ -7578,7 +7578,7 @@ void PF_te_spark(progfuncs_t *prinst, struct globalvars_s *pr_globals) //the nq version #ifdef NQPROT MSG_WriteByte(&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte(&sv.nqmulticast, DPTE_SPARK); + MSG_WriteByte(&sv.nqmulticast, TEDP_SPARK); // origin MSG_WriteCoord(&sv.nqmulticast, org[0]); MSG_WriteCoord(&sv.nqmulticast, org[1]); @@ -7597,7 +7597,7 @@ void PF_te_spark(progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_te_smallflash(progfuncs_t *prinst, struct globalvars_s *pr_globals) { float *org = G_VECTOR(OFS_PARM0); - SV_point_tempentity(org, DPTE_SMALLFLASH, 0); + SV_point_tempentity(org, TEDP_SMALLFLASH, 0); } // #417 void(vector org, float radius, float lifetime, vector color) te_customflash (DP_TE_CUSTOMFLASH) @@ -7608,7 +7608,7 @@ void PF_te_customflash(progfuncs_t *prinst, struct globalvars_s *pr_globals) if (G_FLOAT(OFS_PARM1) < 8 || G_FLOAT(OFS_PARM2) < (1.0 / 256.0)) return; MSG_WriteByte(&sv.multicast, svc_temp_entity); - MSG_WriteByte(&sv.multicast, DPTE_CUSTOMFLASH); + MSG_WriteByte(&sv.multicast, TEDP_CUSTOMFLASH); // origin MSG_WriteCoord(&sv.multicast, G_VECTOR(OFS_PARM0)[0]); MSG_WriteCoord(&sv.multicast, G_VECTOR(OFS_PARM0)[1]); @@ -7624,7 +7624,7 @@ void PF_te_customflash(progfuncs_t *prinst, struct globalvars_s *pr_globals) #ifdef NQPROT MSG_WriteByte(&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte(&sv.nqmulticast, DPTE_CUSTOMFLASH); + MSG_WriteByte(&sv.nqmulticast, TEDP_CUSTOMFLASH); // origin MSG_WriteCoord(&sv.nqmulticast, G_VECTOR(OFS_PARM0)[0]); MSG_WriteCoord(&sv.nqmulticast, G_VECTOR(OFS_PARM0)[1]); @@ -7660,7 +7660,7 @@ void PF_te_particlecube(progfuncs_t *prinst, struct globalvars_s *pr_globals) // [vector] min [vector] max [vector] dir [short] count [byte] color [byte] gravity [coord] randomvel MSG_WriteByte (&sv.multicast, svc_temp_entity); - MSG_WriteByte (&sv.multicast, DPTE_PARTICLECUBE); + MSG_WriteByte (&sv.multicast, TEDP_PARTICLECUBE); MSG_WriteCoord(&sv.multicast, min[0]); MSG_WriteCoord(&sv.multicast, min[1]); MSG_WriteCoord(&sv.multicast, min[2]); @@ -7677,7 +7677,7 @@ void PF_te_particlecube(progfuncs_t *prinst, struct globalvars_s *pr_globals) #ifdef NQPROT MSG_WriteByte (&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte (&sv.nqmulticast, DPTE_PARTICLECUBE); + MSG_WriteByte (&sv.nqmulticast, TEDP_PARTICLECUBE); MSG_WriteCoord(&sv.nqmulticast, min[0]); MSG_WriteCoord(&sv.nqmulticast, min[1]); MSG_WriteCoord(&sv.nqmulticast, min[2]); @@ -7704,7 +7704,7 @@ void PF_te_explosionrgb(progfuncs_t *prinst, struct globalvars_s *pr_globals) float *colour = G_VECTOR(OFS_PARM0); MSG_WriteByte(&sv.multicast, svc_temp_entity); - MSG_WriteByte(&sv.multicast, DPTE_EXPLOSIONRGB); + MSG_WriteByte(&sv.multicast, TEDP_EXPLOSIONRGB); // origin MSG_WriteCoord(&sv.multicast, org[0]); MSG_WriteCoord(&sv.multicast, org[1]); @@ -7715,7 +7715,7 @@ void PF_te_explosionrgb(progfuncs_t *prinst, struct globalvars_s *pr_globals) MSG_WriteByte(&sv.multicast, bound(0, (int) (colour[2] * 255), 255)); #ifdef NQPROT MSG_WriteByte(&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte(&sv.nqmulticast, DPTE_EXPLOSIONRGB); + MSG_WriteByte(&sv.nqmulticast, TEDP_EXPLOSIONRGB); // origin MSG_WriteCoord(&sv.nqmulticast, org[0]); MSG_WriteCoord(&sv.nqmulticast, org[1]); @@ -7740,7 +7740,7 @@ void PF_te_particlerain(progfuncs_t *prinst, struct globalvars_s *pr_globals) return; MSG_WriteByte(&sv.multicast, svc_temp_entity); - MSG_WriteByte(&sv.multicast, DPTE_PARTICLERAIN); + MSG_WriteByte(&sv.multicast, TEDP_PARTICLERAIN); // min MSG_WriteCoord(&sv.multicast, min[0]); MSG_WriteCoord(&sv.multicast, min[1]); @@ -7760,7 +7760,7 @@ void PF_te_particlerain(progfuncs_t *prinst, struct globalvars_s *pr_globals) #ifdef NQPROT MSG_WriteByte(&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte(&sv.nqmulticast, DPTE_PARTICLERAIN); + MSG_WriteByte(&sv.nqmulticast, TEDP_PARTICLERAIN); // min MSG_WriteCoord(&sv.nqmulticast, min[0]); MSG_WriteCoord(&sv.nqmulticast, min[1]); @@ -7794,7 +7794,7 @@ void PF_te_particlesnow(progfuncs_t *prinst, struct globalvars_s *pr_globals) return; MSG_WriteByte(&sv.multicast, svc_temp_entity); - MSG_WriteByte(&sv.multicast, DPTE_PARTICLESNOW); + MSG_WriteByte(&sv.multicast, TEDP_PARTICLESNOW); // min MSG_WriteCoord(&sv.multicast, min[0]); MSG_WriteCoord(&sv.multicast, min[1]); @@ -7814,7 +7814,7 @@ void PF_te_particlesnow(progfuncs_t *prinst, struct globalvars_s *pr_globals) #ifdef NQPROT MSG_WriteByte(&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte(&sv.nqmulticast, DPTE_PARTICLESNOW); + MSG_WriteByte(&sv.nqmulticast, TEDP_PARTICLESNOW); // min MSG_WriteCoord(&sv.nqmulticast, min[0]); MSG_WriteCoord(&sv.nqmulticast, min[1]); @@ -7847,7 +7847,7 @@ void PF_te_bloodshower(progfuncs_t *prinst, struct globalvars_s *pr_globals) vec3_t org; MSG_WriteByte(&sv.multicast, svc_temp_entity); - MSG_WriteByte(&sv.multicast, DPTE_BLOODSHOWER); + MSG_WriteByte(&sv.multicast, TEDP_BLOODSHOWER); // min MSG_WriteCoord(&sv.multicast, min[0]); MSG_WriteCoord(&sv.multicast, min[1]); @@ -7863,7 +7863,7 @@ void PF_te_bloodshower(progfuncs_t *prinst, struct globalvars_s *pr_globals) #ifdef NQPROT MSG_WriteByte(&sv.nqmulticast, svc_temp_entity); - MSG_WriteByte(&sv.nqmulticast, DPTE_BLOODSHOWER); + MSG_WriteByte(&sv.nqmulticast, TEDP_BLOODSHOWER); // min MSG_WriteCoord(&sv.nqmulticast, min[0]); MSG_WriteCoord(&sv.nqmulticast, min[1]);