X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=cl_main.c;h=bfb33600e9938a088f4aa2335183a1a9835cac58;hb=020178ff4f855970d5233c3d3d4becc8c80875e5;hp=8753a5ebb8f75a5f0bac8c405daaf1dc2db33165;hpb=4e1f3f76d5fe7befe20034a730630c314d45956b;p=xonotic%2Fdarkplaces.git diff --git a/cl_main.c b/cl_main.c index 8753a5eb..bfb33600 100644 --- a/cl_main.c +++ b/cl_main.c @@ -93,8 +93,6 @@ cvar_t cl_deathnoviewmodel = {0, "cl_deathnoviewmodel", "1", "hides gun model wh cvar_t cl_locs_enable = {CVAR_SAVE, "locs_enable", "1", "enables replacement of certain % codes in chat messages: %l (location), %d (last death location), %h (health), %a (armor), %x (rockets), %c (cells), %r (rocket launcher status), %p (powerup status), %w (weapon status), %t (current time in level)"}; cvar_t cl_locs_show = {0, "locs_show", "0", "shows defined locations for editing purposes"}; -extern cvar_t r_equalize_entities_fullbright; - client_static_t cls; client_state_t cl; @@ -163,7 +161,7 @@ void CL_ClearState(void) cl.decals = (decal_t *) Mem_Alloc(cls.levelmempool, cl.max_decals * sizeof(decal_t)); cl.showlmps = NULL; - // LordHavoc: have to set up the baseline info for alpha and other stuff + // LadyHavoc: have to set up the baseline info for alpha and other stuff for (i = 0;i < cl.max_entities;i++) { cl.entities[i].state_baseline = defaultstate; @@ -623,7 +621,7 @@ static float CL_LerpPoint(void) if (cl_nettimesyncboundmode.integer == 1) cl.time = bound(cl.mtime[1], cl.time, cl.mtime[0]); - // LordHavoc: lerp in listen games as the server is being capped below the client (usually) + // LadyHavoc: lerp in listen games as the server is being capped below the client (usually) if (cl.mtime[0] <= cl.mtime[1]) { cl.time = cl.mtime[0]; @@ -1166,8 +1164,6 @@ static void CL_UpdateNetworkEntity(entity_t *e, int recursionlimit, qboolean int { if (!(e->render.effects & EF_FULLBRIGHT)) e->render.flags |= RENDER_LIGHT; - else if(r_equalize_entities_fullbright.integer) - e->render.flags |= RENDER_LIGHT | RENDER_EQUALIZE; } // hide player shadow during intermission or nehahra movie if (!(e->render.effects & (EF_NOSHADOW | EF_ADDITIVE | EF_NODEPTHTEST)) @@ -1213,7 +1209,7 @@ static void CL_UpdateNetworkEntityTrail(entity_t *e) // handle particle trails and such effects now that we know where this // entity is in the world... trailtype = EFFECT_NONE; - // LordHavoc: if the entity has no effects, don't check each + // LadyHavoc: if the entity has no effects, don't check each if (e->render.effects & (EF_BRIGHTFIELD | EF_FLAME | EF_STARDUST)) { if (e->render.effects & EF_BRIGHTFIELD) @@ -1236,7 +1232,7 @@ static void CL_UpdateNetworkEntityTrail(entity_t *e) // muzzleflash fades over time if (e->persistent.muzzleflash > 0) e->persistent.muzzleflash -= bound(0, cl.time - cl.oldtime, 0.1) * 20; - // LordHavoc: if the entity has no effects, don't check each + // LadyHavoc: if the entity has no effects, don't check each if (e->render.effects && !(e->render.flags & RENDER_VIEWMODEL)) { if (e->render.effects & EF_GIB) @@ -1251,7 +1247,7 @@ static void CL_UpdateNetworkEntityTrail(entity_t *e) trailtype = EFFECT_TR_ROCKET; else if (e->render.effects & EF_GRENADE) { - // LordHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke) + // LadyHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke) trailtype = e->render.alpha == -1 ? EFFECT_TR_NEHAHRASMOKE : EFFECT_TR_GRENADE; } else if (e->render.effects & EF_TRACER3) @@ -1440,7 +1436,7 @@ static void CL_LinkNetworkEntity(entity_t *e) dlightcolor[0] = 0; dlightcolor[1] = 0; dlightcolor[2] = 0; - // LordHavoc: if the entity has no effects, don't check each + // LadyHavoc: if the entity has no effects, don't check each if (e->render.effects & (EF_BRIGHTFIELD | EF_DIMLIGHT | EF_BRIGHTLIGHT | EF_RED | EF_BLUE | EF_FLAME | EF_STARDUST)) { if (e->render.effects & EF_BRIGHTFIELD) @@ -1462,7 +1458,7 @@ static void CL_LinkNetworkEntity(entity_t *e) dlightcolor[1] += 3.00f; dlightcolor[2] += 3.00f; } - // LordHavoc: more effects + // LadyHavoc: more effects if (e->render.effects & EF_RED) // red { dlightradius = max(dlightradius, 200); @@ -1498,7 +1494,7 @@ static void CL_LinkNetworkEntity(entity_t *e) R_RTLight_Update(&r_refdef.scene.templights[r_refdef.scene.numlights], false, &tempmatrix, color, -1, NULL, true, 0, 0.25, 0, 1, 1, LIGHTFLAG_NORMALMODE | LIGHTFLAG_REALTIMEMODE); r_refdef.scene.lights[r_refdef.scene.numlights] = &r_refdef.scene.templights[r_refdef.scene.numlights];r_refdef.scene.numlights++; } - // LordHavoc: if the model has no flags, don't check each + // LadyHavoc: if the model has no flags, don't check each if (e->render.model && e->render.effects && !(e->render.flags & RENDER_VIEWMODEL)) { if (e->render.effects & EF_GIB) @@ -1513,13 +1509,13 @@ static void CL_LinkNetworkEntity(entity_t *e) trailtype = EFFECT_TR_ROCKET; else if (e->render.effects & EF_GRENADE) { - // LordHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke) + // LadyHavoc: e->render.alpha == -1 is for Nehahra dem compatibility (cigar smoke) trailtype = e->render.alpha == -1 ? EFFECT_TR_NEHAHRASMOKE : EFFECT_TR_GRENADE; } else if (e->render.effects & EF_TRACER3) trailtype = EFFECT_TR_VORESPIKE; } - // LordHavoc: customizable glow + // LadyHavoc: customizable glow if (e->state_current.glowsize) { // * 4 for the expansion from 0-255 to 0-1023 range, @@ -1607,8 +1603,6 @@ static void CL_RelinkStaticEntities(void) { if (!(e->render.effects & EF_FULLBRIGHT)) e->render.flags |= RENDER_LIGHT; - else if(r_equalize_entities_fullbright.integer) - e->render.flags |= RENDER_LIGHT | RENDER_EQUALIZE; } // hide player shadow during intermission or nehahra movie if (!(e->render.effects & (EF_NOSHADOW | EF_ADDITIVE | EF_NODEPTHTEST)) && (e->render.alpha >= 1)) @@ -1718,7 +1712,7 @@ void CL_Beam_CalculatePositions(const beam_t *b, vec3_t start, vec3_t end) { if (cl_beams_quakepositionhack.integer && !chase_active.integer) { - // LordHavoc: this is a stupid hack from Quake that makes your + // LadyHavoc: this is a stupid hack from Quake that makes your // lightning appear to come from your waist and cover less of your // view // in Quake this hack was applied to all players (causing the @@ -1730,7 +1724,7 @@ void CL_Beam_CalculatePositions(const beam_t *b, vec3_t start, vec3_t end) { vec3_t dir, localend; vec_t len; - // LordHavoc: this updates the beam direction to match your + // LadyHavoc: this updates the beam direction to match your // viewangles VectorSubtract(end, start, dir); len = VectorLength(dir); @@ -1958,7 +1952,7 @@ void CL_UpdateWorld(void) r_refdef.scene.time = cl.time; } -// LordHavoc: pausedemo command +// LadyHavoc: pausedemo command static void CL_PauseDemo_f (void) { cls.demopaused = !cls.demopaused; @@ -2257,12 +2251,12 @@ void CL_Locs_Reload_f(void) CL_Locs_Clear_f(); - // try maps/something.loc first (LordHavoc: where I think they should be) + // try maps/something.loc first (LadyHavoc: where I think they should be) dpsnprintf(locfilename, sizeof(locfilename), "%s.loc", cl.worldnamenoextension); filedata = (char *)FS_LoadFile(locfilename, cls.levelmempool, false, &filesize); if (!filedata) { - // try proquake name as well (LordHavoc: I hate path mangling) + // try proquake name as well (LadyHavoc: I hate path mangling) dpsnprintf(locfilename, sizeof(locfilename), "locs/%s.loc", cl.worldbasename); filedata = (char *)FS_LoadFile(locfilename, cls.levelmempool, false, &filesize); if (!filedata) @@ -2385,7 +2379,7 @@ const char *cl_meshentitynames[NUM_MESHENTITIES] = "MESH_UI", }; -void CL_MeshEntities_Restart(void) +static void CL_MeshEntities_Restart(void) { int i; entity_t *ent; @@ -2396,7 +2390,7 @@ void CL_MeshEntities_Restart(void) } } -void CL_MeshEntities_Init(void) +static void CL_MeshEntities_Init(void) { int i; entity_t *ent; @@ -2405,8 +2399,8 @@ void CL_MeshEntities_Init(void) ent = cl_meshentities + i; ent->state_current.active = true; ent->render.model = cl_meshentitymodels + i; - ent->render.alpha = 1; - ent->render.flags = RENDER_SHADOW | RENDER_LIGHT | RENDER_CUSTOMIZEDMODELLIGHT; + ent->render.alpha = 0.999999f; // not quite 1 so that MATERIALFLAG_ALPHA is always set. + ent->render.flags = RENDER_SHADOW | RENDER_LIGHT; ent->render.framegroupblend[0].lerp = 1; ent->render.frameblend[0].lerp = 1; VectorSet(ent->render.colormod, 1, 1, 1); @@ -2414,6 +2408,18 @@ void CL_MeshEntities_Init(void) VectorSet(ent->render.custommodellight_ambient, 1, 1, 1); VectorSet(ent->render.custommodellight_diffuse, 0, 0, 0); VectorSet(ent->render.custommodellight_lightdir, 0, 0, 1); + VectorSet(ent->render.render_fullbright, 1, 1, 1); + VectorSet(ent->render.render_glowmod, 0, 0, 0); + VectorSet(ent->render.render_modellight_ambient, 1, 1, 1); + VectorSet(ent->render.render_modellight_diffuse, 0, 0, 0); + VectorSet(ent->render.render_modellight_specular, 0, 0, 0); + VectorSet(ent->render.render_modellight_lightdir, 0, 0, 1); + VectorSet(ent->render.render_lightmap_ambient, 0, 0, 0); + VectorSet(ent->render.render_lightmap_diffuse, 1, 1, 1); + VectorSet(ent->render.render_lightmap_specular, 1, 1, 1); + VectorSet(ent->render.render_rtlight_diffuse, 1, 1, 1); + VectorSet(ent->render.render_rtlight_specular, 1, 1, 1); + Matrix4x4_CreateIdentity(&ent->render.matrix); CL_UpdateRenderEntity(&ent->render); } @@ -2447,7 +2453,7 @@ void CL_MeshEntities_Reset(void) } } -void CL_MeshEntities_Shutdown(void) +static void CL_MeshEntities_Shutdown(void) { } @@ -2457,9 +2463,6 @@ extern cvar_t r_fullbright_directed_pitch; extern cvar_t r_fullbright_directed_ambient; extern cvar_t r_fullbright_directed_diffuse; extern cvar_t r_fullbright_directed; -extern cvar_t r_equalize_entities_minambient; -extern cvar_t r_equalize_entities_to; -extern cvar_t r_equalize_entities_by; extern cvar_t r_hdr_glowintensity; static void CL_UpdateEntityShading_GetDirectedFullbright(vec3_t ambient, vec3_t diffuse, vec3_t worldspacenormal) @@ -2485,7 +2488,7 @@ static void CL_UpdateEntityShading_GetDirectedFullbright(vec3_t ambient, vec3_t static void CL_UpdateEntityShading_Entity(entity_render_t *ent) { - float shadingorigin[3], f, fa, fd, fdd, a[3], c[3], dir[3]; + float shadingorigin[3], a[3], c[3], dir[3]; int q; for (q = 0; q < 3; q++) @@ -2577,56 +2580,6 @@ static void CL_UpdateEntityShading_Entity(entity_render_t *ent) CL_UpdateEntityShading_GetDirectedFullbright(a, c, dir); else R_CompleteLightPoint(a, c, dir, shadingorigin, LP_LIGHTMAP, r_refdef.scene.lightmapintensity, r_refdef.scene.ambientintensity); - - if (ent->flags & RENDER_EQUALIZE) - { - // first fix up ambient lighting... - if (r_equalize_entities_minambient.value > 0) - { - fd = 0.299f * ent->render_modellight_diffuse[0] + 0.587f * ent->render_modellight_diffuse[1] + 0.114f * ent->render_modellight_diffuse[2]; - if (fd > 0) - { - fa = (0.299f * ent->render_modellight_ambient[0] + 0.587f * ent->render_modellight_ambient[1] + 0.114f * ent->render_modellight_ambient[2]); - if (fa < r_equalize_entities_minambient.value * fd) - { - // solve: - // fa'/fd' = minambient - // fa'+0.25*fd' = fa+0.25*fd - // ... - // fa' = fd' * minambient - // fd'*(0.25+minambient) = fa+0.25*fd - // ... - // fd' = (fa+0.25*fd) * 1 / (0.25+minambient) - // fa' = (fa+0.25*fd) * minambient / (0.25+minambient) - // ... - fdd = (fa + 0.25f * fd) / (0.25f + r_equalize_entities_minambient.value); - f = fdd / fd; // f>0 because all this is additive; f<1 because fdd 0 && r_equalize_entities_by.value != 0) - { - fa = 0.299f * a[0] + 0.587f * a[1] + 0.114f * a[2]; - fd = 0.299f * c[0] + 0.587f * c[1] + 0.114f * c[2]; - f = fa + 0.25 * fd; - if (f > 0) - { - // adjust brightness and saturation to target - float l2 = r_equalize_entities_by.value, l1 = 1 - l2; - for (q = 0; q < 3; q++) - { - a[q] = l1 * a[q] + l2 * (fa / f); - c[q] = l1 * c[q] + l2 * (fd / f); - } - } - } - } } for (q = 0; q < 3; q++) @@ -2753,7 +2706,7 @@ void CL_Init (void) Cmd_AddCommand ("fog", CL_Fog_f, "set global fog parameters (density red green blue [alpha [mindist [maxdist [top [fadedepth]]]]])"); Cmd_AddCommand ("fog_heighttexture", CL_Fog_HeightTexture_f, "set global fog parameters (density red green blue alpha mindist maxdist top depth textures/mapname/fogheight.tga)"); - // LordHavoc: added pausedemo + // LadyHavoc: added pausedemo Cmd_AddCommand ("pausedemo", CL_PauseDemo_f, "pause demo playback (can also safely pause demo recording if using QUAKE, QUAKEDP or NEHAHRAMOVIE protocol, useful for making movies)"); Cmd_AddCommand ("cl_areastats", CL_AreaStats_f, "prints statistics on entity culling during collision traces");