From 24b8426dd5cda76c8313db6b5f92decae210a642 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Thu, 9 Jun 2011 10:28:55 +0200 Subject: [PATCH] Saturate colored dynamic light just like normal one - makes the hwole thing a bit less colorful but makes for better balanced color mixing (theoretically) and does not reduce static light --- CHANGELOG.txt | 4 ++++ main/lighting.c | 6 +++--- main/render.c | 20 +++++++------------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ba9f5fb8d..8b2f5dc1d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20110609 +-------- +main/render.c: Saturate colored dynamic light just like normal one - makes the hwole thing a bit less colorful but makes for better balanced color mixing (theoretically) and does not reduce static light + 20110607 -------- main/render.c: Definition of dynlight_time should have been static to archive timed light calculations diff --git a/main/lighting.c b/main/lighting.c index 7ee585640..b8339a83b 100644 --- a/main/lighting.c +++ b/main/lighting.c @@ -144,7 +144,7 @@ void apply_light(g3s_lrgb obj_light_emission, int obj_seg, vms_vector *obj_pos, fix dist; vertnum = vp[vv]; - if ((vertnum ^ light_frame_count) & 1) { + if (/*(vertnum ^ light_frame_count) & */1) { vertpos = &Vertices[vertnum]; dist = vm_vec_dist_quick(obj_pos, vertpos); dist = fixmul(dist/4, dist/4); @@ -170,7 +170,7 @@ void apply_light(g3s_lrgb obj_light_emission, int obj_seg, vms_vector *obj_pos, int apply_light; vertnum = render_vertices[vv]; - if ((vertnum ^ light_frame_count) & 1) { + if (/*(vertnum ^ light_frame_count) & */1) { vertpos = &Vertices[vertnum]; dist = vm_vec_dist_quick(obj_pos, vertpos); apply_light = 0; @@ -501,7 +501,7 @@ void set_dynamic_light(void) vertnum = render_vertices[vv]; Assert(vertnum >= 0 && vertnum <= Highest_vertex_index); - if ((vertnum ^ light_frame_count) & 1) + if (/*(vertnum ^ light_frame_count) & */1) Dynamic_light[vertnum].r = Dynamic_light[vertnum].g = Dynamic_light[vertnum].b = 0; } diff --git a/main/render.c b/main/render.c index 32eb979d1..f8271988e 100644 --- a/main/render.c +++ b/main/render.c @@ -247,7 +247,6 @@ void render_face(int segnum, int sidenum, int nv, short *vp, int tmap1, int tmap for (i=0;i highval) - highval = dyn_light[i].r/MAX_LIGHT; - if (dyn_light[i].g/MAX_LIGHT > highval) - highval = dyn_light[i].g/MAX_LIGHT; - if (dyn_light[i].b/MAX_LIGHT > highval) - highval = dyn_light[i].b/MAX_LIGHT; - if (highval > 1.0) - { - dyn_light[i].r /= highval; - dyn_light[i].g /= highval; - dyn_light[i].b /= highval; - } + if (dyn_light[i].r > MAX_LIGHT) + dyn_light[i].r = MAX_LIGHT; + if (dyn_light[i].g > MAX_LIGHT) + dyn_light[i].g = MAX_LIGHT; + if (dyn_light[i].b > MAX_LIGHT) + dyn_light[i].b = MAX_LIGHT; } }