]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
dlights using light_lev now need the PFLAG_FULLDYNAMIC flag set to operate, otherwise...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 2 Mar 2004 00:22:31 +0000 (00:22 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 2 Mar 2004 00:22:31 +0000 (00:22 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3947 d7cf8633-e32d-0410-b094-e92efae38249

cl_main.c
protocol.h
r_shadow.c
sv_main.c
todo

index 768397e165bfc01a6ed467ab138595305469c161..5ccdc562ea83a796a58323a076401ef5bc524998 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -798,9 +798,12 @@ void CL_LinkNetworkEntity(entity_t *e)
                        dlightradius = max(dlightradius, e->state_current.glowsize * 4);
                        VectorMA(dlightcolor, (1.0f / 255.0f), (qbyte *)&palette_complete[e->state_current.glowcolor], dlightcolor);
                }
-               if (e->state_current.light[3])
+               if (e->state_current.lightpflags & PFLAGS_FULLDYNAMIC)
                {
-                       dlightradius = max(dlightradius, e->state_current.light[3]);
+                       if (e->state_current.light[3])
+                               dlightradius = max(dlightradius, e->state_current.light[3]);
+                       else
+                               dlightradius = max(dlightradius, 350);
                        if (VectorLength2(dlightcolor) == 0)
                                (dlightcolor[0] += 1, dlightcolor[1] += 1, dlightcolor[2] += 1);
                        else
@@ -813,7 +816,7 @@ void CL_LinkNetworkEntity(entity_t *e)
                        // hack to make glowing player light shine on their gun
                        if ((e - cl_entities) == cl.viewentity/* && !chase_active.integer*/)
                                dlightmatrix.m[2][3] += 30;
-                       CL_AllocDlight(&e->render, &dlightmatrix, dlightradius, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0, e->state_current.skin >= 16 ? e->state_current.skin : 0, e->state_current.lightstyle, !(e->state_current.lightpflags & 1), 1);
+                       CL_AllocDlight(&e->render, &dlightmatrix, dlightradius, dlightcolor[0], dlightcolor[1], dlightcolor[2], 0, 0, e->state_current.skin >= 16 ? e->state_current.skin : 0, e->state_current.lightstyle, !(e->state_current.lightpflags & PFLAGS_NOSHADOW), (e->state_current.lightpflags & PFLAGS_FULLDYNAMIC) ? ((e->state_current.lightpflags & PFLAGS_CORONA) != 0) : 1);
                }
                // trails need the previous frame
                if (e->state_previous.active && e->state_previous.modelindex == e->state_current.modelindex)
@@ -839,6 +842,8 @@ void CL_LinkNetworkEntity(entity_t *e)
                        V_CalcRefdef();
                if (e->render.model && e->render.model->name[0] == '*' && e->render.model->TraceBox)
                        cl_brushmodel_entities[cl_num_brushmodel_entities++] = &e->render;
+               if (gamemode == GAME_TENEBRAE && e->render.model && e->render.model->type == mod_sprite)
+                       e->render.effects |= EF_ADDITIVE;
                // don't show entities with no modelindex (note: this still shows
                // entities which have a modelindex that resolved to a NULL model)
                if (e->render.model && !(e->render.effects & EF_NODRAW) && r_refdef.numentities < r_refdef.maxentities)
index 717d9916de37b8721003c865af201db0c19d9195..0d1f87d82fb8c96a7047102cefcd0dda0a20a18f 100644 (file)
@@ -61,6 +61,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #define EF_STEP                                        0x80000000 // internal client use only - present on MOVETYPE_STEP entities, not QC accessible (too many bits)
 
+// flags for the pflags field of entities
+#define PFLAGS_NOSHADOW                        1
+#define PFLAGS_CORONA                  2
+#define PFLAGS_FULLDYNAMIC             128 // must be set or the light fields are ignored
+
 // if the high bit of the servercmd is set, the low bits are fast update flags:
 #define U_MOREBITS             (1<<0)
 #define U_ORIGIN1              (1<<1)
index a62dfaecb221d3a1794c1b052383651c121fa187..0083e42696b083361d78e52870fccefca9bec4e6 100644 (file)
@@ -2718,7 +2718,7 @@ void R_Shadow_LoadLightsFile(void)
 
 void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
 {
-       int entnum, style, islight, skin, pflags;
+       int entnum, style, islight, skin, pflags, effects;
        char key[256], value[1024];
        float origin[3], angles[3], radius, color[3], light, fadescale, lightscale, originhack[3], overridecolor[3];
        const char *data;
@@ -2857,6 +2857,8 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                                skin = (int)atof(value);
                        else if (!strcmp("pflags", key))
                                pflags = (int)atof(value);
+                       else if (!strcmp("effects", key))
+                               effects = (int)atof(value);
                }
                if (light <= 0 && islight)
                        light = 300;
@@ -2864,14 +2866,22 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                        lightscale = 1;
                if (fadescale <= 0)
                        fadescale = 1;
+               if (gamemode == GAME_TENEBRAE)
+               {
+                       if (effects & EF_NODRAW)
+                       {
+                               pflags |= PFLAGS_FULLDYNAMIC;
+                               effects &= ~EF_NODRAW;
+                       }
+               }
                radius = min(light * r_editlights_quakelightsizescale.value * lightscale / fadescale, 1048576);
                light = sqrt(bound(0, light, 1048576)) * (1.0f / 16.0f);
                if (color[0] == 1 && color[1] == 1 && color[2] == 1)
                        VectorCopy(overridecolor, color);
                VectorScale(color, light, color);
                VectorAdd(origin, originhack, origin);
-               if (radius >= 15)
-                       R_Shadow_NewWorldLight(origin, angles, color, radius, !!(pflags & 2), style, !(pflags & 1), skin >= 16 ? va("cubemaps/%i", skin) : NULL);
+               if (radius >= 15 && !(pflags & PFLAGS_FULLDYNAMIC))
+                       R_Shadow_NewWorldLight(origin, angles, color, radius, (pflags & PFLAGS_CORONA) != 0, style, (pflags & PFLAGS_NOSHADOW) == 0, skin >= 16 ? va("cubemaps/%i", skin) : NULL);
        }
 }
 
index 71b57193840b7f9671a234c4351134b42f86a65e..97669a558e535bfab93c5cc3e259b574eb3fc5e8 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -816,7 +816,29 @@ void SV_PrepareEntitiesForSending(void)
                cs.lightstyle = (qbyte)GETEDICTFIELDVALUE(ent, eval_style)->_float;
                cs.lightpflags = (qbyte)GETEDICTFIELDVALUE(ent, eval_pflags)->_float;
 
-               cs.specialvisibilityradius = cs.light[3];
+               if (gamemode == GAME_TENEBRAE)
+               {
+                       // tenebrae's EF_FULLDYNAMIC conflicts with Q2's EF_NODRAW
+                       if (cs.effects & 16)
+                       {
+                               cs.effects &= ~16;
+                               cs.lightpflags |= PFLAGS_FULLDYNAMIC;
+                       }
+                       // tenebrae's EF_GREEN conflicts with DP's EF_ADDITIVE
+                       if (cs.effects & 32)
+                       {
+                               cs.effects &= ~32;
+                               cs.light[0] = 0.2;
+                               cs.light[1] = 1;
+                               cs.light[2] = 0.2;
+                               cs.light[3] = 200;
+                               cs.lightpflags |= PFLAGS_FULLDYNAMIC;
+                       }
+               }
+
+               cs.specialvisibilityradius = 0;
+               if (cs.lightpflags & PFLAGS_FULLDYNAMIC)
+                       cs.specialvisibilityradius = max(cs.specialvisibilityradius, cs.light[3]);
                if (cs.glowsize)
                        cs.specialvisibilityradius = max(cs.specialvisibilityradius, cs.glowsize * 4);
                if (cs.flags & RENDER_GLOWTRAIL)
diff --git a/todo b/todo
index b531ed5ec297883c292de0e196233885fedb11ed..0cc3f437c23b71160b9b4b7f211344ef82a9806d 100644 (file)
--- a/todo
+++ b/todo
@@ -30,16 +30,19 @@ d darkplaces: make the WriteEntitiesToClient code call TraceBox directly instead
 -n darkplaces: net_slist should print out "No network." if networking is not initialized (yummyluv)
 d darkplaces: noclipping out the ceiling of q3dm17 crashes (Static_Fiend)
 -n darkplaces: remove dead master server from default masters list (yummyluv)
--n darkplaces: revert noclip movement to match nq for compatibility with mods that trap movement as input (MauveBib)
+d darkplaces: revert noclip movement to match nq for compatibility with mods that trap movement as input (MauveBib)
 -n darkplaces: segfault reading memory in windows when starting a new server from menu (yummyluv)
 -n darkplaces: server is starting before the "port" cvar is set by commandline and scripts? (yummyluv)
 -n darkplaces: typing ip in join game menu should show 'trying' and 'no response' after a while, or 'no network' if networking is not initialized (yummyluv)
+d darkplaces: make light_lev dlights from qc require PFLAGS_FULLDYNAMIC flag
+d darkplaces: improve tenebrae compatibility by handling EF_FULLDYNAMIC flag in tenebrae mode, also make all sprites render additive
+0 darkplaces: figure out why bmodels aren't receiving lightmap dlights
 d darkplaces: fixed SV_TouchAreaGrid to not crash if SV_IncreaseEdicts is called during a touch function, by making a list of edicts to touch and then running through the list afterward (KGB|romi)
 d darkplaces: moved R_ShadowVolumeLighting to r_shadow.c
 d darkplaces: added RENDER_LIGHT flag to entity_render_t to make rtlighting optional per entity
 d darkplaces: cleaned up rtlight handling, merging most code between world rtlights and dlights
 d darkplaces: safety checked lightmap access in Mod_Q1BSP_RecursiveLightPoint as one map Sajt uses was crashing (Sajt)
--n darkplaces: upgrade network protocol to send precise angles, and make EF_LOWPRECISION downgrade both origin and angles (-Urre, -Wazat for Battlemech, FrikaC, -mashakos, RenegadeC, Sajt)
+-n darkplaces: upgrade network protocol to send precise angles, and make EF_LOWPRECISION downgrade both origin and angles (-Urre, -Wazat for Battlemech, FrikaC, mashakos, RenegadeC, Sajt)
 -n darkplaces: fix cubemap upload scaling crashes (Urre)
 d darkplaces: make screenshots save to screenshots/fniggium%04i.tga in GAME_FNIGGIUM (Sajt)
 d darkplaces: make screenshots save to screenshots directory (Sajt)