diff --git a/engine/client/cl_ents.c b/engine/client/cl_ents.c index 231110d2f..5107160d9 100644 --- a/engine/client/cl_ents.c +++ b/engine/client/cl_ents.c @@ -1685,7 +1685,7 @@ void CLNQ_ParseEntity(unsigned int bits) entity_state_t *base; packet_entities_t *pack; - qboolean isnehahra = false;//(cls.protocol_nq == CPNQ_ID && cls.demoplayback); + qboolean isnehahra = CPNQ_IS_BJP;//||(cls.protocol_nq == CPNQ_ID && cls.demoplayback); if (cls.signon == 4 - 1) { // first update is the final signon stage @@ -1746,7 +1746,7 @@ void CLNQ_ParseEntity(unsigned int bits) state->sequence = cls.netchan.incoming_sequence; state->solidsize = ES_SOLID_BSP; - state->dpflags = (bits & NQU_NOLERP)?RENDER_STEP:0; + state->dpflags = 0; if (bits & NQU_MODEL) { @@ -1783,6 +1783,9 @@ void CLNQ_ParseEntity(unsigned int bits) if (bits & NQU_ANGLE3) state->angles[2] = MSG_ReadAngle(); + if (bits & NQU_NOLERP) + state->dpflags |= RENDER_STEP; + if (isnehahra) { if (bits & DPU_EXTEND1) //U_TRANS @@ -1839,11 +1842,19 @@ void CLNQ_ParseEntity(unsigned int bits) state->colormod[2] = (qbyte)((i & 3) * (32.0f / 3.0f)); } + if (bits & DPU_GLOWTRAIL) + state->dpflags |= RENDER_GLOWTRAIL; + if (bits & DPU_FRAME2) state->frame |= MSG_ReadByte() << 8; if (bits & DPU_MODEL2) state->modelindex |= MSG_ReadByte() << 8; + + if (bits & DPU_VIEWMODEL) + state->dpflags |= RENDER_VIEWMODEL; + if (bits & DPU_EXTERIORMODEL) + state->dpflags |= RENDER_EXTERIORMODEL; } } #endif @@ -2955,7 +2966,7 @@ void CLQ1_AddShadow(entity_t *ent) scenetris_t *t; cl_adddecal_ctx_t ctx; - if (!r_shadows.value || !ent->model || ent->model->type != mod_alias) + if (!r_shadows.value || !ent->model || (ent->model->type != mod_alias && ent->model->type != mod_halflife)) return; s = R_RegisterShader("shadowshader", SUF_NONE, diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 7a7de9984..113442515 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -3489,7 +3489,7 @@ void CLNQ_ParseProtoVersion(void) else if (protover == PROTOCOL_VERSION_BJP3) { cls.protocol_nq = CPNQ_BJP3; - Con_DPrintf("bjp3 %i protocol\n", PROTOCOL_VERSION_BJP2); + Con_DPrintf("bjp3 %i protocol\n", PROTOCOL_VERSION_BJP3); } else if (protover == PROTOCOL_VERSION_NQ) Con_DPrintf("Standard NQ protocols\n"); diff --git a/engine/client/client.h b/engine/client/client.h index e21ef8d53..08a8993a2 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -338,7 +338,7 @@ typedef struct int length; char map[MAX_STYLESTRING]; vec3_t colours; - int colourkey; + int colourkey; //compacted version of the colours, for comparison against caches } lightstyle_t; diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index dd031f7b5..3eda0d764 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -2859,7 +2859,7 @@ static void QDECL capture_raw_video (void *vctx, void *data, int frame, int widt *COM_SkipPath(base) = 0; if (FS_NativePath(base, FS_GAMEONLY, filename, sizeof(filename))) { - #if HAVE_STATVFS + #ifdef HAVE_STATVFS //posix 2001 struct statvfs inf; if(0==statvfs(filename, &inf)) diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 16a88da93..3d5b37cb3 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -3807,6 +3807,63 @@ static void QCBUILTIN PF_cs_lightstyle (pubprogfuncs_t *prinst, struct globalvar R_UpdateLightStyle(stnum, str, rgb[0],rgb[1],rgb[2]); } +static void QCBUILTIN PF_getlightstyle (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + unsigned int stnum = G_FLOAT(OFS_PARM0); + + if (stnum >= MAX_LIGHTSTYLES) + { + VectorSet(G_VECTOR(OFS_PARM1), 0, 0, 0); + G_INT(OFS_RETURN) = 0; + return; + } + + VectorCopy(cl_lightstyle[stnum].colours, G_VECTOR(OFS_PARM1)); + if (!cl_lightstyle[stnum].length) + G_INT(OFS_RETURN) = 0; + else + RETURN_TSTRING(cl_lightstyle[stnum].map); +} +static void QCBUILTIN PF_getlightstylergb (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + unsigned int stnum = G_FLOAT(OFS_PARM0); + int value; //could be float, but that would exceed the precision of R_AnimateLight + + if (stnum >= MAX_LIGHTSTYLES) + { + Con_Printf ("PF_getlightstyle: stnum > MAX_LIGHTSTYLES"); + return; + } + + if (!cl_lightstyle[stnum].length) + value = ('m'-'a')*22 * r_lightstylescale.value; + else if (cl_lightstyle[stnum].map[0] == '=') + value = atof(cl_lightstyle[stnum].map+1)*256*r_lightstylescale.value; + else + { + int v1, v2, vd, i; + float f; + + f = (cl.time*r_lightstylespeed.value); + if (f < 0) + f = 0; + i = (int)f; + f -= i; //this can require updates at 1000 times a second.. Depends on your framerate of course + + v1 = i % cl_lightstyle[stnum].length; + v1 = cl_lightstyle[stnum].map[v1] - 'a'; + v2 = (i+1) % cl_lightstyle[stnum].length; + v2 = cl_lightstyle[stnum].map[v2] - 'a'; + vd = v1 - v2; + if (!r_lightstylesmooth.ival || vd < -r_lightstylesmooth_limit.ival || vd > r_lightstylesmooth_limit.ival) + value = v1*22*r_lightstylescale.value; + else + value = (v1*(1-f) + v2*(f))*22*r_lightstylescale.value; + } + + VectorScale(cl_lightstyle[stnum].colours, value*(1.0/256), G_VECTOR(OFS_RETURN)); +} + //entity(string field, float match) findchainflags = #450 //chained search for float, int, and entity reference fields static void QCBUILTIN PF_cs_findchainflags (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) @@ -5571,6 +5628,8 @@ static struct { {"stof", PF_stof, 81}, // #81 float(string s) stof (FRIK_FILE or QW_ENGINE) {"multicast", PF_NoCSQC, 82}, // #82 void(vector where, float set) multicast (QW_ENGINE) (don't support) + {"getlightstyle", PF_getlightstyle, 0}, + {"getlightstylergb", PF_getlightstylergb, 0}, //90 {"tracebox", PF_cs_tracebox, 90}, diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 51ab85986..fe5678ad7 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -57,11 +57,11 @@ void QDECL R_SkyBox_Changed (struct cvar_s *var, char *oldvalue) } #ifdef FTE_TARGET_WEB //webgl sucks too much to get a stable framerate without vsync. -cvar_t vid_vsync = CVARAF ("vid_wait", "1", - "vid_vsync", CVAR_ARCHIVE); +cvar_t vid_vsync = CVARAF ("vid_vsync", "1", + "vid_wait", CVAR_ARCHIVE); #else -cvar_t vid_vsync = CVARAF ("vid_wait", "0", - "vid_vsync", CVAR_ARCHIVE); +cvar_t vid_vsync = CVARAF ("vid_vsync", "0", + "vid_wait", CVAR_ARCHIVE); #endif cvar_t _windowed_mouse = CVARF ("_windowed_mouse","1", diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 4fb869c46..2cdd92748 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -233,7 +233,7 @@ void S_SoundInfo_f(void) Con_DPrintf(" %s (%i %i, %g %g %g, inactive)\n", sc->channel[i].sfx->name, sc->channel[i].entnum, sc->channel[i].entchannel, sc->channel[i].origin[0], sc->channel[i].origin[1], sc->channel[i].origin[2]); } } - Con_Printf(" %d/%d/%d/%d active/known/highest/max\n", active, known, sc->total_chans, sc->max_chans); + Con_Printf(" %d/%d/%"PRIiSIZE"/%"PRIiSIZE" active/known/highest/max\n", active, known, sc->total_chans, sc->max_chans); for (i = 0; i < sc->sn.numchannels; i++) { Con_Printf(" chan %i: fwd:%-4g rt:%-4g up:%-4g dist:%-4g\n", i, sc->speakerdir[i][0], sc->speakerdir[i][1], sc->speakerdir[i][2], sc->dist[i]); diff --git a/engine/client/sound.h b/engine/client/sound.h index 3dc78f15c..1c8a59a65 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -331,8 +331,8 @@ struct soundcardinfo_s { //windows has one defined AFTER directsound //info on which sound effects are playing //FIXME: use a linked list channel_t *channel; - int total_chans; - int max_chans; + size_t total_chans; + size_t max_chans; float ambientlevels[NUM_AMBIENTS]; //we use a float instead of the channel's int volume value to avoid framerate dependancies with slow transitions. diff --git a/engine/common/com_mesh.c b/engine/common/com_mesh.c index 7d4acd09f..b54f1ae33 100644 --- a/engine/common/com_mesh.c +++ b/engine/common/com_mesh.c @@ -2521,6 +2521,67 @@ static frameinfo_t *ParseFrameInfo(char *modelname, int *numgroups) return frames; } +//parses a foo.mdl.events file and inserts the events into the relevant animations +static void Mod_InsertEvent(zonegroup_t *mem, galiasanimation_t *anims, unsigned int numanimations, unsigned int eventanimation, float eventpose, int eventcode, const char *eventdata) +{ + galiasevent_t *ev, **link; + if (eventanimation >= numanimations) + { + Con_Printf("Mod_InsertEvent: invalid frame index\n"); + return; + } + ev = ZG_Malloc(mem, sizeof(*ev) + strlen(eventdata)+1); + ev->data = (char*)(ev+1); + + ev->timestamp = eventpose; + ev->timestamp /= anims[eventanimation].rate; + ev->code = eventcode; + strcpy(ev->data, eventdata); + link = &anims[eventanimation].events; + while (*link && (*link)->timestamp <= ev->timestamp) + link = &(*link)->next; + ev->next = *link; + *link = ev; +} +static qboolean Mod_ParseModelEvents(model_t *mod, galiasanimation_t *anims, unsigned int numanimations) +{ + unsigned int anim; + float pose; + int eventcode; + + const char *modelname = mod->name; + zonegroup_t *mem = &mod->memgroup; + char fname[MAX_QPATH], tok[2048]; + size_t fsize; + char *line, *file, *eol; + Q_snprintfz(fname, sizeof(fname), "%s.events", modelname); + line = file = COM_LoadFile(fname, 5, &fsize); + if (!file) + return false; + while(line && *line) + { + eol = strchr(line, '\n'); + if (eol) + *eol = 0; + + line = COM_ParseOut(line, tok, sizeof(tok)); + anim = strtoul(tok, NULL, 0); + line = COM_ParseOut(line, tok, sizeof(tok)); + pose = strtod(tok, NULL); + line = COM_ParseOut(line, tok, sizeof(tok)); + eventcode = (long)strtol(tok, NULL, 0); + line = COM_ParseOut(line, tok, sizeof(tok)); + Mod_InsertEvent(mem, anims, numanimations, anim, pose, eventcode, tok); + + if (eol) + line = eol+1; + else + break; + } + BZ_Free(file); + return true; +} + void Mod_DefaultMesh(galiasinfo_t *galias, const char *name, unsigned int index) { Q_strncpyz(galias->surfacename, name, sizeof(galias->surfacename)); @@ -2672,80 +2733,6 @@ void Mod_BuildTextureVectors(galiasinfo_t *galias) } #ifndef SERVERONLY -/* -================= -Mod_FloodFillSkin - -Fill background pixels so mipmapping doesn't have haloes - Ed -================= -*/ - -typedef struct -{ - short x, y; -} floodfill_t; - -// must be a power of 2 -#define FLOODFILL_FIFO_SIZE 0x1000 -#define FLOODFILL_FIFO_MASK (FLOODFILL_FIFO_SIZE - 1) - -#define FLOODFILL_STEP( off, dx, dy ) \ -{ \ - if (pos[off] == fillcolor) \ - { \ - pos[off] = 255; \ - fifo[inpt].x = x + (dx), fifo[inpt].y = y + (dy); \ - inpt = (inpt + 1) & FLOODFILL_FIFO_MASK; \ - } \ - else if (pos[off] != 255) fdc = pos[off]; \ -} - -static void Mod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight ) -{ - qbyte fillcolor = *skin; // assume this is the pixel to fill - floodfill_t fifo[FLOODFILL_FIFO_SIZE]; - int inpt = 0, outpt = 0; - int filledcolor = -1; - int i; - - if (filledcolor == -1) - { - filledcolor = 0; - // attempt to find opaque black - for (i = 0; i < 256; ++i) - if (d_8to24rgbtable[i] == (255 << 0)) // alpha 1.0 - { - filledcolor = i; - break; - } - } - - // can't fill to filled color or to transparent color (used as visited marker) - if ((fillcolor == filledcolor) || (fillcolor == 255)) - { - //printf( "not filling skin from %d to %d\n", fillcolor, filledcolor ); - return; - } - - fifo[inpt].x = 0, fifo[inpt].y = 0; - inpt = (inpt + 1) & FLOODFILL_FIFO_MASK; - - while (outpt != inpt) - { - int x = fifo[outpt].x, y = fifo[outpt].y; - int fdc = filledcolor; - qbyte *pos = &skin[x + skinwidth * y]; - - outpt = (outpt + 1) & FLOODFILL_FIFO_MASK; - - if (x > 0) FLOODFILL_STEP( -1, -1, 0 ); - if (x < skinwidth - 1) FLOODFILL_STEP( 1, 1, 0 ); - if (y > 0) FLOODFILL_STEP( -skinwidth, 0, -1 ); - if (y < skinheight - 1) FLOODFILL_STEP( skinwidth, 0, 1 ); - skin[x + skinwidth * y] = fdc; - } -} - //looks for foo.md3_0.skin files, for dp compat //also try foo_0.skin, because people appear to use that too. *sigh*. int Mod_CountSkinFiles(char *modelname) @@ -3211,6 +3198,80 @@ static void *Q1MDL_LoadSkins_SV (galiasinfo_t *galias, dmdl_t *pq1inmodel, dalia } #ifndef SERVERONLY +/* +================= +Mod_FloodFillSkin + +Fill background pixels so mipmapping doesn't have haloes - Ed +================= +*/ + +typedef struct +{ + short x, y; +} floodfill_t; + +// must be a power of 2 +#define FLOODFILL_FIFO_SIZE 0x1000 +#define FLOODFILL_FIFO_MASK (FLOODFILL_FIFO_SIZE - 1) + +#define FLOODFILL_STEP( off, dx, dy ) \ +{ \ + if (pos[off] == fillcolor) \ + { \ + pos[off] = 255; \ + fifo[inpt].x = x + (dx), fifo[inpt].y = y + (dy); \ + inpt = (inpt + 1) & FLOODFILL_FIFO_MASK; \ + } \ + else if (pos[off] != 255) fdc = pos[off]; \ +} + +static void Mod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight ) +{ + qbyte fillcolor = *skin; // assume this is the pixel to fill + floodfill_t fifo[FLOODFILL_FIFO_SIZE]; + int inpt = 0, outpt = 0; + int filledcolor = -1; + int i; + + if (filledcolor == -1) + { + filledcolor = 0; + // attempt to find opaque black + for (i = 0; i < 256; ++i) + if (d_8to24rgbtable[i] == (255 << 0)) // alpha 1.0 + { + filledcolor = i; + break; + } + } + + // can't fill to filled color or to transparent color (used as visited marker) + if ((fillcolor == filledcolor) || (fillcolor == 255)) + { + //printf( "not filling skin from %d to %d\n", fillcolor, filledcolor ); + return; + } + + fifo[inpt].x = 0, fifo[inpt].y = 0; + inpt = (inpt + 1) & FLOODFILL_FIFO_MASK; + + while (outpt != inpt) + { + int x = fifo[outpt].x, y = fifo[outpt].y; + int fdc = filledcolor; + qbyte *pos = &skin[x + skinwidth * y]; + + outpt = (outpt + 1) & FLOODFILL_FIFO_MASK; + + if (x > 0) FLOODFILL_STEP( -1, -1, 0 ); + if (x < skinwidth - 1) FLOODFILL_STEP( 1, 1, 0 ); + if (y > 0) FLOODFILL_STEP( -skinwidth, 0, -1 ); + if (y < skinheight - 1) FLOODFILL_STEP( skinwidth, 0, 1 ); + skin[x + skinwidth * y] = fdc; + } +} + static void *Q1MDL_LoadSkins_GL (galiasinfo_t *galias, dmdl_t *pq1inmodel, model_t *loadmodel, daliasskintype_t *pskintype, uploadfmt_t skintranstype) { skinframe_t *frames; @@ -3357,67 +3418,6 @@ static void *Q1MDL_LoadSkins_GL (galiasinfo_t *galias, dmdl_t *pq1inmodel, model } #endif -//parses a foo.mdl.events file and inserts the events into the relevant animations -static void Mod_InsertEvent(zonegroup_t *mem, galiasanimation_t *anims, unsigned int numanimations, unsigned int eventanimation, float eventpose, int eventcode, const char *eventdata) -{ - galiasevent_t *ev, **link; - if (eventanimation >= numanimations) - { - Con_Printf("Mod_InsertEvent: invalid frame index\n"); - return; - } - ev = ZG_Malloc(mem, sizeof(*ev) + strlen(eventdata)+1); - ev->data = (char*)(ev+1); - - ev->timestamp = eventpose; - ev->timestamp /= anims[eventanimation].rate; - ev->code = eventcode; - strcpy(ev->data, eventdata); - link = &anims[eventanimation].events; - while (*link && (*link)->timestamp <= ev->timestamp) - link = &(*link)->next; - ev->next = *link; - *link = ev; -} -static qboolean Mod_ParseModelEvents(model_t *mod, galiasanimation_t *anims, unsigned int numanimations) -{ - unsigned int anim; - float pose; - int eventcode; - - const char *modelname = mod->name; - zonegroup_t *mem = &mod->memgroup; - char fname[MAX_QPATH], tok[2048]; - size_t fsize; - char *line, *file, *eol; - Q_snprintfz(fname, sizeof(fname), "%s.events", modelname); - line = file = COM_LoadFile(fname, 5, &fsize); - if (!file) - return false; - while(line && *line) - { - eol = strchr(line, '\n'); - if (eol) - *eol = 0; - - line = COM_ParseOut(line, tok, sizeof(tok)); - anim = strtoul(tok, NULL, 0); - line = COM_ParseOut(line, tok, sizeof(tok)); - pose = strtod(tok, NULL); - line = COM_ParseOut(line, tok, sizeof(tok)); - eventcode = (long)strtol(tok, NULL, 0); - line = COM_ParseOut(line, tok, sizeof(tok)); - Mod_InsertEvent(mem, anims, numanimations, anim, pose, eventcode, tok); - - if (eol) - line = eol+1; - else - break; - } - BZ_Free(file); - return true; -} - static void Mesh_HandleFramegroupsFile(model_t *mod, galiasinfo_t *galias) { unsigned int numanims, a, p, g, oldnumanims = galias->numanimations, targpose; @@ -3790,7 +3790,7 @@ static qboolean QDECL Mod_LoadQ1Model (model_t *mod, void *buffer, size_t fsize) return true; } -static int Mod_ReadFlagsFromMD1(char *name, int md3version) +int Mod_ReadFlagsFromMD1(char *name, int md3version) { int result = 0; size_t fsize; @@ -3817,7 +3817,7 @@ static int Mod_ReadFlagsFromMD1(char *name, int md3version) return result; } #else -static int Mod_ReadFlagsFromMD1(char *name, int md3version) +int Mod_ReadFlagsFromMD1(char *name, int md3version) { return 0; } diff --git a/engine/common/q1bsp.c b/engine/common/q1bsp.c index 2d2e97f0f..544fc3536 100644 --- a/engine/common/q1bsp.c +++ b/engine/common/q1bsp.c @@ -622,7 +622,7 @@ void Mod_ClipDecal(struct model_s *mod, vec3_t center, vec3_t normal, vec3_t tan { } #ifdef Q1BSPS - else if (mod->fromgame == fg_quake) + else if (mod->fromgame == fg_quake || mod->fromgame == fg_halflife) Q1BSP_ClipDecalToNodes(mod, &dec, mod->rootnode); #endif #ifdef Q3BSPS diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 1075aa6dc..4ffb4513b 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -4102,9 +4102,9 @@ static qboolean Shader_Parsetok (shader_t *shader, shaderpass_t *pass, shaderkey } if (prefix) - Con_DPrintf("Unknown shader directive: \"%s\"\n", prefix); + Con_DPrintf("Unknown shader directive parsing %s: \"%s\"\n", shader->name, prefix); else - Con_DPrintf("Unknown shader directive: \"%s\"\n", token); + Con_DPrintf("Unknown shader directive parsing %s: \"%s\"\n", shader->name, token); // Next Line while (ptr) diff --git a/engine/gl/gl_vidlinuxglx.c b/engine/gl/gl_vidlinuxglx.c index 1c964b6da..aa0b2dd5f 100644 --- a/engine/gl/gl_vidlinuxglx.c +++ b/engine/gl/gl_vidlinuxglx.c @@ -169,12 +169,15 @@ static struct int (*pXWarpPointer)(Display *display, Window src_w, Window dest_w, int src_x, int src_y, unsigned int src_width, unsigned int src_height, int dest_x, int dest_y); Status (*pXMatchVisualInfo)(Display *display, int screen, int depth, int class, XVisualInfo *vinfo_return); +#define XI_RESOURCENAME "FTEQW" +#define XI_RESOURCECLASS "FTEQW" char *(*pXSetLocaleModifiers)(char *modifier_list); Bool (*pXSupportsLocale)(void); XIM (*pXOpenIM)(Display *display, struct _XrmHashBucketRec *db, char *res_name, char *res_class); char * (*pXGetIMValues)(XIM im, ...); XIC (*pXCreateIC)(XIM im, ...); void (*pXSetICFocus)(XIC ic); + void (*pXUnsetICFocus)(XIC ic); char * (*pXGetICValues)(XIC ic, ...); Bool (*pXFilterEvent)(XEvent *event, Window w); int (*pXutf8LookupString)(XIC ic, XKeyPressedEvent *event, char *buffer_return, int bytes_buffer, KeySym *keysym_return, Status *status_return); @@ -266,6 +269,7 @@ static qboolean x11_initlib(void) x11.pXGetIMValues = Sys_GetAddressForName(x11.lib, "XGetIMValues"); x11.pXCreateIC = Sys_GetAddressForName(x11.lib, "XCreateIC"); x11.pXSetICFocus = Sys_GetAddressForName(x11.lib, "XSetICFocus"); + x11.pXUnsetICFocus = Sys_GetAddressForName(x11.lib, "XUnsetICFocus"); x11.pXGetICValues = Sys_GetAddressForName(x11.lib, "XGetICValues"); x11.pXFilterEvent = Sys_GetAddressForName(x11.lib, "XFilterEvent"); x11.pXutf8LookupString = Sys_GetAddressForName(x11.lib, "Xutf8LookupString"); @@ -649,13 +653,13 @@ static long X_InitUnicode(void) if (!COM_CheckParm("-noxim")) { - if (x11.pXSetLocaleModifiers && x11.pXSupportsLocale && x11.pXOpenIM && x11.pXGetIMValues && x11.pXCreateIC && x11.pXSetICFocus && x11.pXGetICValues && x11.pXFilterEvent && (x11.pXutf8LookupString || x11.pXwcLookupString) && x11.pXDestroyIC && x11.pXCloseIM) + if (x11.pXSetLocaleModifiers && x11.pXSupportsLocale && x11.pXOpenIM && x11.pXGetIMValues && x11.pXCreateIC && x11.pXSetICFocus && x11.pXUnsetICFocus && x11.pXGetICValues && x11.pXFilterEvent && (x11.pXutf8LookupString || x11.pXwcLookupString) && x11.pXDestroyIC && x11.pXCloseIM) { setlocale(LC_CTYPE, ""); //just in case. x11.pXSetLocaleModifiers(""); if (x11.pXSupportsLocale()) { - x11.inputmethod = x11.pXOpenIM(vid_dpy, NULL, NULL, NULL); + x11.inputmethod = x11.pXOpenIM(vid_dpy, NULL, XI_RESOURCENAME, XI_RESOURCECLASS); if (x11.inputmethod) { XIMStyles *sup = NULL; @@ -691,10 +695,12 @@ static long X_InitUnicode(void) XNInputStyle, st, XNClientWindow, vid_window, XNFocusWindow, vid_window, + XNResourceName, XI_RESOURCENAME, + XNResourceClass, XI_RESOURCECLASS, NULL); if (x11.unicodecontext) { - x11.pXSetICFocus(x11.unicodecontext); +// x11.pXSetICFocus(x11.unicodecontext); x11.dounicode = true; x11.pXGetICValues(x11.unicodecontext, XNFilterEvents, &requiredevents, NULL); @@ -1205,12 +1211,18 @@ static void GetEvent(void) modeswitchtime = Sys_Milliseconds() + 1500; /*fairly slow, to make sure*/ } + if (event.xfocus.window == vid_window && x11.unicodecontext) + x11.pXSetICFocus(x11.unicodecontext); + //we we're focusing onto the game window and we're currently fullscreen, hide the other one so alt-tab won't select that instead of a real alternate app. // if ((fullscreenflags & FULLSCREEN_ACTIVE) && (fullscreenflags & FULLSCREEN_LEGACY) && event.xfocus.window == vid_window) // x11.pXUnmapWindow(vid_dpy, vid_decoywindow); break; case FocusOut: //if we're already active, the decoy window shouldn't be focused anyway. + if (event.xfocus.window == vid_window && x11.unicodecontext) + x11.pXSetICFocus(x11.unicodecontext); + if ((fullscreenflags & FULLSCREEN_ACTIVE) && event.xfocus.window == vid_decoywindow) { break; diff --git a/engine/gl/gl_vidsdl.c b/engine/gl/gl_vidsdl.c index dcb3feb4b..81b9ed10a 100644 --- a/engine/gl/gl_vidsdl.c +++ b/engine/gl/gl_vidsdl.c @@ -182,7 +182,7 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette) #if SDL_PATCHLEVEL >= 1 flags |= SDL_WINDOW_ALLOW_HIGHDPI; #endif - sdlwindow = SDL_CreateWindow("My Magic Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, info->width, info->height, flags); + sdlwindow = SDL_CreateWindow(FULLENGINENAME, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, info->width, info->height, flags); if (!sdlwindow) { Con_Printf("Couldn't set video mode: %s\n", SDL_GetError()); diff --git a/engine/qclib/pr_edict.c b/engine/qclib/pr_edict.c index 4937d857d..885cc0554 100644 --- a/engine/qclib/pr_edict.c +++ b/engine/qclib/pr_edict.c @@ -2529,8 +2529,6 @@ int PR_ReallyLoadProgs (progfuncs_t *progfuncs, const char *filename, progstate_ int stringadjust; - char *mainstringtable, *newstringtable; - current_progstate = progstate; strcpy(current_progstate->filename, filename); @@ -2794,9 +2792,6 @@ retry: len=sizeof(char)*pr_progs->numstrings; s = PRAddressableExtend(progfuncs, pr_strings, len, 0); - - newstringtable = s; - mainstringtable = progfuncs->funcs.stringtable; pr_strings = (char *)s; len=sizeof(float)*pr_progs->numglobals; diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 5c0a81da2..b31eccc1a 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -4447,6 +4447,37 @@ static void QCBUILTIN PF_lightstyle (pubprogfuncs_t *prinst, struct globalvars_s PF_applylightstyle(style, val, rgb); } +static void QCBUILTIN PF_getlightstyle (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + unsigned int style = G_FLOAT(OFS_PARM0); + + if (style >= countof(sv.strings.lightstyles)) + { + VectorSet(G_VECTOR(OFS_PARM1), 0, 0, 0); + G_INT(OFS_RETURN) = 0; + } + else + { + VectorCopy(sv.lightstylecolours[style], G_VECTOR(OFS_PARM1)); + if (!sv.strings.lightstyles[style]) + G_INT(OFS_RETURN) = 0; + else + RETURN_TSTRING(sv.strings.lightstyles[style]); + } +} +static void QCBUILTIN PF_getlightstylergb (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) +{ + unsigned int style = G_FLOAT(OFS_PARM0); + int value; + if (!sv.strings.lightstyles[style]) + value = ('m'-'a')*22; + else if (sv.strings.lightstyles[style][0] == '=') + value = atof(sv.strings.lightstyles[style]+1)*256; + else + value = sv.strings.lightstyles[style][max(0,(int)(sv.time*10)) % strlen(sv.strings.lightstyles[style])] - 'a'; + VectorScale(sv.lightstylecolours[style], value*(1.0/256), G_VECTOR(OFS_RETURN)); +} + #ifdef HEXEN2 static void QCBUILTIN PF_lightstylevalue (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals) { @@ -10041,6 +10072,8 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs //end of mvdsv #endif + {"getlightstyle", PF_getlightstyle, 0, 0, 0, 0, D("string(float style, optional __out vector rgb)", "Obtains the light style string for the given style.")}, + {"getlightstylergb",PF_getlightstylergb,0, 0, 0, 0, D("vector(float style)", "Obtains the current rgb value of the specified light style. In csqc, this is correct with regard to the current frame, while ssqc gives no guarentees about time and ignores client cvars. Note: use getlight if you want the actual light value at a point.")}, #ifdef HEXEN2 {"lightstylestatic",PF_lightstylestatic,0, 0, 5, 5, D("void(float style, float val, optional vector rgb)", "Sets the lightstyle to an explicit numerical level. From Hexen2.")}, {"tracearea", PF_traceboxh2, 0, 0, 33, 0, D("void(vector v1, vector v2, vector mins, vector maxs, float nomonsters, entity ent)", "For hexen2 compat")}, diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index 57f9515a0..2371937b5 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -588,7 +588,7 @@ void SVNQ_New_f (void) { Q_snprintfz (message, sizeof(message), "\x02\n" "!!! THIS MAP REQUIRES AN IMPROVED PROTOCOL,\n" - "!!! BUT YOUR SHITTY CLIENT DOESN'T APPEAR TO SUPPORT ANY.\n" + "!!! BUT YOUR CLIENT DOESN'T APPEAR TO SUPPORT ANY.\n" "!!! EXPECT MISSING MODELS, SOUNDS, OR ENTITIES\n"); //if you're reading this message to try to avoid your client being described as shitty, implement support for 'cmd protocol' and maybe 'cmd pext' stuffcmds. //simply put, I can't use 666 if I don't know that its safe to do so.