1
0
Fork 0
forked from fte/fteqw

Added skygroup command. Also polygon offset cvars. Even though its evil - I'm not sure how long it'll stay.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3321 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2009-07-19 20:43:07 +00:00
parent 12cccf0e39
commit f419538b37
11 changed files with 137 additions and 24 deletions

View file

@ -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
//

View file

@ -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);

View file

@ -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] == '{')

View file

@ -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);

View file

@ -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 ();

View file

@ -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);

View file

@ -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

View file

@ -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:

View file

@ -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();
}

View file

@ -405,7 +405,7 @@ void GL_DrawSkyChain (msurface_t *s)
return;
}
if (skyprogram)
if (skyprogram && !usingskybox)
{
GL_DrawProgram_SkyChain(s);
return;

View file

@ -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, ...)