source: abuse/trunk/src/include/light.hpp @ 18

Last change on this file since 18 was 17, checked in by Sam Hocevar, 17 years ago
  • absolute shitloads of 64 bit fixes.
File size: 2.2 KB
Line 
1#ifndef LIGHT_HPP
2#define LIGHT_HPP
3
4#include "image.hpp"
5#include "palette.hpp"
6#include "config.hpp"
7#include "crc.hpp"
8
9#define TTINTS 9
10extern uint8_t *tints[TTINTS];
11extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
12extern int16_t ambient_ramp;
13#define REVERSE_GREEN_TINT 8
14
15extern int16_t shutdown_lighting_value,shutdown_lighting;
16
17class light_source
18{
19  public :
20  int32_t type,x,xshift,y,yshift;
21  int32_t outer_radius,mul_div,inner_radius;
22
23  int32_t x1,y1,x2,y2;
24  char known;
25  light_source *next;
26
27  void calc_range();
28  light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius, int32_t Outer_radius,
29               int32_t Xshift, int32_t Yshift,
30               light_source *Next);
31  light_source *copy();
32} ;
33
34class light_patch
35{
36  public :
37  int32_t total,x1,y1,x2,y2;
38  light_source **lights; 
39  light_patch *next;
40  light_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_patch *Next)
41  {
42    x1=X1; y1=Y1; x2=X2; y2=Y2;
43    next=Next;
44    total=0;
45    lights=NULL;
46  }
47  void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who);
48  light_patch *copy(light_patch *Next);
49  ~light_patch() { if (total) jfree(lights); }
50} ;
51
52void delete_all_lights();
53void delete_light(light_source *which);
54light_source *add_light_source(char type, int32_t x, int32_t y,
55                               int32_t inner, int32_t outer, int32_t xshift, int32_t yshift);
56
57void add_light_spec(spec_directory *sd, char *level_name);
58void write_lights(bFILE *fp);
59void read_lights(spec_directory *sd, bFILE *fp, char *level_name);
60
61
62void delete_patch_list(light_patch *first);
63light_patch *find_patch(int screenx, int screeny, light_patch *list);
64int calc_light_value(int32_t x, int32_t y, light_patch *which);                       
65void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
66void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient,
67                         image *out, int32_t out_x, int32_t out_y);
68
69void calc_light_table(palette *pal);
70extern light_source *first_light_source;
71extern int light_detail;
72
73extern int32_t light_to_number(light_source *l);
74extern light_source *number_to_light(int32_t x);
75
76#endif
Note: See TracBrowser for help on using the repository browser.