diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 0e313f46f..c484ac387 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -2816,6 +2816,7 @@ void CL_FTP_f(void) } #endif +void CL_Skygroup_f(void); void SCR_ShowPic_Script_f(void); /* ================= @@ -3071,6 +3072,7 @@ void CL_Init (void) Cmd_AddCommand ("serverinfo", CL_ServerInfo_f); #endif + Cmd_AddCommand ("skygroup", CL_Skygroup_f); // // Windows commands // diff --git a/engine/client/renderer.c b/engine/client/renderer.c index ee094d2e4..64b41a235 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -227,6 +227,10 @@ extern cvar_t r_shadows; extern cvar_t r_speeds; extern cvar_t r_waterwarp; +extern cvar_t r_polygonoffset_submodel_factor; +extern cvar_t r_polygonoffset_submodel_offset; + + void R_BulletenForce_f (void); rendererstate_t currentrendererstate; @@ -416,6 +420,9 @@ void GLRenderer_Init(void) Cvar_Register (&r_waterlayers, GRAPHICALNICETIES); #endif + Cvar_Register (&r_polygonoffset_submodel_factor, GLRENDEREROPTIONS); + Cvar_Register (&r_polygonoffset_submodel_offset, GLRENDEREROPTIONS); + Cvar_Register (&gl_nobind, GLRENDEREROPTIONS); Cvar_Register (&gl_picmip, GLRENDEREROPTIONS); Cvar_Register (&gl_picmip2d, GLRENDEREROPTIONS); diff --git a/engine/client/wad.c b/engine/client/wad.c index 146b789c0..b1c0561a2 100644 --- a/engine/client/wad.c +++ b/engine/client/wad.c @@ -457,17 +457,114 @@ qbyte *W_GetTexture(char *name, int *width, int *height, qboolean *usesalpha)//r return NULL; } +typedef struct mapgroup_s { + char *mapname; + char *skyname; + struct mapgroup_s *next; +} mapskys_t; +static mapskys_t *mapskies; +void CL_Skygroup_f(void) +{ + mapskys_t **link; + mapskys_t *ms; + char *skyname; + char *mapname; + int i; + int remove; + + skyname = Cmd_Argv(1); + + if (!*skyname) + { + skyname = NULL; + for (ms = mapskies; ms; ms = ms->next) + { + if (!skyname || strcmp(skyname, ms->skyname)) + { + Con_Printf("%s%s:", skyname?"\n":"", ms->skyname); + skyname=ms->skyname; + } + Con_Printf(" %s", ms->mapname); + } + if (skyname) + Con_Printf("\n"); + else + Con_Printf("No skygroups defined\n"); + return; + } + + if (!strcmp(skyname, "clear") && Cmd_Argc() == 2) + { + while (mapskies) + { + ms = mapskies->next; + Z_Free(mapskies); + mapskies = ms; + } + return; + } + + if (*skyname == '-') + { + skyname++; + for (link = &mapskies; *link; ) + { + if (!strcmp((*link)->mapname, skyname) || !strcmp((*link)->skyname, skyname)) + { + ms = *link; + *link = ms->next; + Z_Free(ms); + } + else + link = &(*link)->next; + } + return; + } + + for (i = 2; i < Cmd_Argc(); i++) + { + mapname = Cmd_Argv(i); + + remove = *mapname == '-'; + mapname += remove; + + for (link = &mapskies; *link; link = &(*link)->next) + { + if (!strcmp((*link)->mapname, mapname)) + { + ms = *link; + *link = ms->next; + Z_Free(ms); + break; + } + } + if (remove) + continue; + + ms = Z_Malloc(sizeof(*ms) + strlen(mapname) + strlen(skyname) + 2); + + ms->mapname = (char*)(ms+1); + ms->skyname = ms->mapname + strlen(mapname)+1; + ms->next = mapskies; + + strcpy(ms->mapname, mapname); + strcpy(ms->skyname, skyname); + + mapskies = ms; + } +} //extern model_t *loadmodel; char wads[4096]; -void Mod_ParseInfoFromEntityLump(char *data) //actually, this should be in the model code. +void Mod_ParseInfoFromEntityLump(char *data, char *mapname) //actually, this should be in the model code. { extern model_t *loadmodel; char key[128]; char skyname[64]; float skyrotate = 0; vec3_t skyaxis = {0, 0, 0}; + mapskys_t *msky; wads[0] = '\0'; @@ -483,6 +580,15 @@ void Mod_ParseInfoFromEntityLump(char *data) //actually, this should be in the m else skyname[0] = '\0'; + for (msky = mapskies; msky; msky = msky->next) + { + if (!strcmp(msky->mapname, mapname)) + { + Q_strncpyz(skyname, msky->skyname, sizeof(skyname)); + break; + } + } + if (data) if ((data=COM_Parse(data))) //read the map info. if (com_token[0] == '{') diff --git a/engine/client/wad.h b/engine/client/wad.h index 96ddd844c..a85b5a706 100644 --- a/engine/client/wad.h +++ b/engine/client/wad.h @@ -108,6 +108,6 @@ void SwapPic (qpic_t *pic); void Mod_ParseWadsFromEntityLump(char *data); qbyte *W_ConvertWAD3Texture(miptex_t *tex, int *width, int *height, qboolean *usesalpha); -void Mod_ParseInfoFromEntityLump(char *data); +void Mod_ParseInfoFromEntityLump(char *data, char *mapname); qboolean Wad_NextDownload (void); qbyte *W_GetTexture(char *name, int *width, int *height, qboolean *usesalpha); diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 3ece8ba64..a2a4e6fb0 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -3995,7 +3995,7 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned } #ifndef SERVERONLY - Mod_ParseInfoFromEntityLump(loadmodel->entities); //only done for client's world model (or server if the server is loading it for client) + Mod_ParseInfoFromEntityLump(loadmodel->entities, loadname); //only done for client's world model (or server if the server is loading it for client) #endif CM_InitBoxHull (); diff --git a/engine/gl/gl_model.c b/engine/gl/gl_model.c index 463859db3..e8a5c81e4 100644 --- a/engine/gl/gl_model.c +++ b/engine/gl/gl_model.c @@ -2867,13 +2867,13 @@ qboolean GLMod_LoadBrushModel (model_t *mod, void *buffer) if (sv.state) //if the server is running { if (!strcmp(loadmodel->name, va("maps/%s.bsp", sv.name))) - Mod_ParseInfoFromEntityLump(mod_base + header->lumps[LUMP_ENTITIES].fileofs); + Mod_ParseInfoFromEntityLump(mod_base + header->lumps[LUMP_ENTITIES].fileofs, loadname); } else #endif { if (!cl.model_precache[1]) //not copied across yet - Mod_ParseInfoFromEntityLump(mod_base + header->lumps[LUMP_ENTITIES].fileofs); + Mod_ParseInfoFromEntityLump(mod_base + header->lumps[LUMP_ENTITIES].fileofs, loadname); } Q1BSP_SetModelFuncs(mod); diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index 9b12e8923..e93240e34 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -919,8 +919,6 @@ int CM_HeadnodeForBox (struct model_s *mod, vec3_t mins, vec3_t maxs); struct trace_s CM_TransformedBoxTrace (struct model_s *mod, vec3_t start, vec3_t end, vec3_t mins, vec3_t maxs, int brushmask, vec3_t origin, vec3_t angles); struct model_s *CM_TempBoxModel(vec3_t mins, vec3_t maxs); -void Mod_ParseInfoFromEntityLump(char *data); - void VARGS CMQ2_SetAreaPortalState (int portalnum, qboolean open); void CMQ3_SetAreaPortalState (int area1, int area2, qboolean open); #endif diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index f1bf30f6b..c4b4ff801 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -2568,21 +2568,6 @@ void R_DrawBeam( entity_t *e ) } } -void PPL_DrawEnt(entity_t *e, void *parm) -{ - qglEnd(); - currententity = e; - - qglDepthMask(1); - qglDisable(GL_POLYGON_OFFSET_FILL); - - R_IBrokeTheArrays(); - R_DrawGAliasModel (currententity); - - P_FlushRenderer(); - qglBegin(GL_QUADS); -} - void PPL_DelayBaseBModelTextures(int count, void **e, void *parm) { while(count--) @@ -2592,7 +2577,9 @@ void PPL_DelayBaseBModelTextures(int count, void **e, void *parm) qglDepthFunc ( gldepthfunc ); qglEnable(GL_DEPTH_TEST); qglDepthMask(1); + qglEnable(GL_POLYGON_OFFSET_FILL); PPL_BaseBModelTextures (currententity); + qglDisable(GL_POLYGON_OFFSET_FILL); } } @@ -2659,7 +2646,9 @@ void PPL_BaseEntTextures(void) qglDepthFunc ( gldepthfunc ); qglEnable(GL_DEPTH_TEST); qglDepthMask(1); + qglEnable(GL_POLYGON_OFFSET_FILL); PPL_BaseBModelTextures (currententity); + qglDisable(GL_POLYGON_OFFSET_FILL); } break; @@ -3526,7 +3515,9 @@ void PPL_DrawEntLighting(dlight_t *light, vec3_t colour) break; case mod_brush: + qglEnable(GL_POLYGON_OFFSET_FILL); PPL_LightBModelTextures (currententity, light, colour); + qglDisable(GL_POLYGON_OFFSET_FILL); break; default: @@ -3659,7 +3650,9 @@ void PPL_DrawEntDetails(void) break; case mod_brush: + qglEnable(GL_POLYGON_OFFSET_FILL); PPL_DetailsBModelTextures (currententity); + qglDisable(GL_POLYGON_OFFSET_FILL); break; default: @@ -4717,7 +4710,9 @@ void PPL_DrawShadowMeshes(dlight_t *dl) break; case mod_brush: + qglEnable(GL_POLYGON_OFFSET_FILL); PPL_DrawBrushModelShadow (dl, currententity); + qglDisable(GL_POLYGON_OFFSET_FILL); break; default: diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index d47d59bac..56c9371c4 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -119,6 +119,9 @@ cvar_t gl_finish = SCVAR("gl_finish","0"); cvar_t gl_dither = SCVAR("gl_dither", "1"); cvar_t gl_maxdist = SCVAR("gl_maxdist", "8192"); +cvar_t r_polygonoffset_submodel_factor = SCVAR("r_polygonoffset_submodel_factor", "0.05"); +cvar_t r_polygonoffset_submodel_offset = SCVAR("r_polygonoffset_submodel_offset", "25"); + extern cvar_t gl_contrast; extern cvar_t gl_mindist; @@ -1203,6 +1206,8 @@ void R_SetupGL (void) qglDisable(GL_DITHER); } + qglPolygonOffset(r_polygonoffset_submodel_factor.value, r_polygonoffset_submodel_offset.value); + GL_DisableMultitexture(); } diff --git a/engine/gl/gl_warp.c b/engine/gl/gl_warp.c index 1fe67192a..7b391295c 100644 --- a/engine/gl/gl_warp.c +++ b/engine/gl/gl_warp.c @@ -405,7 +405,7 @@ void GL_DrawSkyChain (msurface_t *s) return; } - if (skyprogram) + if (skyprogram && !usingskybox) { GL_DrawProgram_SkyChain(s); return; diff --git a/engine/server/pr_q1qvm.c b/engine/server/pr_q1qvm.c index 4fb6d8dbf..75e8fff1f 100755 --- a/engine/server/pr_q1qvm.c +++ b/engine/server/pr_q1qvm.c @@ -1268,7 +1268,7 @@ static int syscallqvm (void *offset, quintptr_t mask, int fn, const int *arg) return syscallhandle(offset, mask, fn, args); } #else -#define syscallqvm syscallhandle +#define syscallqvm (sys_callqvm_t)syscallhandle #endif static qintptr_t EXPORT_FN syscallnative (qintptr_t arg, ...)