From c193c18d5b6368d52e29288e2ac63dad280317c5 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Sat, 6 Apr 2013 13:25:11 +1030 Subject: [PATCH] make -gate affect linear falloff lights as well Signed-off-by: Kevin Shanahan --- changelog.txt | 1 + light/entities.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 8b0a72e6..b728fbe7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -14,6 +14,7 @@ Unreleased * light: remove support for negative color components (never worked properly) * light: removed the "-nominlimit" option (now the default behaviour) * light: removed the "-compress" option (a bad idea from long ago) +* light: make -gate command line affect linear falloff lights as well * vis: changed the default testlevel to 4 * vis: added the '-noambient*' options to disable auto ambient sounds. diff --git a/light/entities.c b/light/entities.c index 1cd0e9d4..1e6bd33e 100644 --- a/light/entities.c +++ b/light/entities.c @@ -198,7 +198,8 @@ CheckEntityFields(entity_t *entity) if (entity->formula == LF_LINEAR) { /* Linear formula always has a falloff point */ - entity->fadedist = fabs(entity->light.light / entity->atten / scaledist); + entity->fadedist = fabs(entity->light.light) - fadegate; + entity->fadedist = entity->fadedist / entity->atten / scaledist; } else if (fadegate < EQUAL_EPSILON) { /* If fadegate is tiny, other lights have effectively infinite reach */ entity->fadedist = VECT_MAX;