1 | /********************************************************************** <BR>
|
---|
2 | This file is part of Crack dot Com's free source code release of
|
---|
3 | Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
|
---|
4 | information about compiling & licensing issues visit this URL</a>
|
---|
5 | <PRE> If that doesn't help, contact Jonathan Clark at
|
---|
6 | golgotha_source@usa.net (Subject should have "GOLG" in it)
|
---|
7 | ***********************************************************************/
|
---|
8 |
|
---|
9 | #include "map_man.hh"
|
---|
10 | #include "map.hh"
|
---|
11 | #include "cwin_man.hh"
|
---|
12 | #include "light.hh"
|
---|
13 | #include "map_vert.hh"
|
---|
14 | #include "map_cell.hh"
|
---|
15 |
|
---|
16 | void g1_calc_static_lighting()
|
---|
17 | {
|
---|
18 | if (!g1_map_is_loaded())
|
---|
19 | return ;
|
---|
20 |
|
---|
21 | g1_object_class *olist[G1_MAX_OBJECTS];
|
---|
22 | sw32 t=g1_get_map()->make_object_list(olist, G1_MAX_OBJECTS);
|
---|
23 | int i;
|
---|
24 | for (i=0; i<t; i++)
|
---|
25 | olist[i]->unoccupy_location();
|
---|
26 |
|
---|
27 | g1_map_vertex_class *v=g1_get_map()->vertex(0,0);
|
---|
28 | int mw=g1_get_map()->width(), mh=g1_get_map()->height();
|
---|
29 |
|
---|
30 | int x,y;
|
---|
31 | for (y=0; y<=mh; y++)
|
---|
32 | for (x=0; x<=mw; x++, v++)
|
---|
33 | {
|
---|
34 | v->light_sum=0x80000000; // mark for recalc
|
---|
35 | v->normal=0x8000; // mark for recalc
|
---|
36 | }
|
---|
37 |
|
---|
38 | g1_map_cell_class *c=g1_get_map()->cell(0,0);
|
---|
39 | for (y=0; y<mh; y++)
|
---|
40 | for (x=0; x<mw; x++, c++)
|
---|
41 | {
|
---|
42 | c->bottom_right_normal=0x8000;
|
---|
43 | c->top_left_normal=0x8000;
|
---|
44 | }
|
---|
45 |
|
---|
46 |
|
---|
47 | v=g1_get_map()->vertex(0,0);
|
---|
48 | for (y=0; y<=mh; y++)
|
---|
49 | for (x=0; x<=mw; x++, v++)
|
---|
50 | {
|
---|
51 | float r,g,b;
|
---|
52 | v->static_intensity=i4_f_to_i(g1_lights.directional_intensity * 255.0);
|
---|
53 | v->get_rgb(r,g,b, x,y); // this will force it to be recalculated
|
---|
54 | }
|
---|
55 |
|
---|
56 | for (i=0; i<t; i++)
|
---|
57 | olist[i]->occupy_location();
|
---|
58 | }
|
---|