blob: 25e77ab127cd667b634a04ed4d2e5c14daed874b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include "fixer.h"
#include "3dc.h"
#include "platform.h"
#include "inline.h"
#include "gamedef.h"
#include "module.h"
#include "stratdef.h"
#include "projfont.h"
#include "kshape.h"
#include "prototyp.h"
#include "d3d_hud.h"
#include "bh_types.h"
#include "equipmnt.h"
#include "pldghost.h"
#define UseLocalAssert Yes
#include "ourasert.h"
extern DISPLAYBLOCK *ActiveBlockList[];
extern int NumActiveBlocks;
extern int GlobalAmbience;
int LightIntensityAtPoint(VECTORCH *pointPtr)
{
int intensity = 0;
int i, j;
DISPLAYBLOCK **activeBlockListPtr = ActiveBlockList;
for(i = NumActiveBlocks; i != 0; i--) {
DISPLAYBLOCK *dispPtr = *activeBlockListPtr++;
if (dispPtr->ObNumLights) {
for(j = 0; j < dispPtr->ObNumLights; j++) {
LIGHTBLOCK *lptr = dispPtr->ObLights[j];
VECTORCH disp = lptr->LightWorld;
int dist;
disp.vx -= pointPtr->vx;
disp.vy -= pointPtr->vy;
disp.vz -= pointPtr->vz;
dist = Approximate3dMagnitude(&disp);
if (dist<lptr->LightRange) {
intensity += WideMulNarrowDiv(lptr->LightBright,lptr->LightRange-dist,lptr->LightRange);
}
}
}
}
if (intensity>ONE_FIXED) intensity=ONE_FIXED;
else if (intensity<GlobalAmbience) intensity=GlobalAmbience;
/* KJL 20:31:39 12/1/97 - limit how dark things can be so blood doesn't go green */
if (intensity<10*256) intensity = 10*256;
return intensity;
}
|