source: abuse/branches/lol/src/light.h

Last change on this file was 729, checked in by Sam Hocevar, 9 years ago

build: sync with newer Lol Engine changes.

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2013 Sam Hocevar <sam@hocevar.net>
5 *
6 *  This software was released into the Public Domain. As with most public
7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef LIGHT_HPP
12#define LIGHT_HPP
13
14#include "imlib/image.h"
15#include "imlib/palette.h"
16
17#include "configuration.h"
18#include "crc.h"
19
20#define TTINTS 9
21extern uint8_t *tints[TTINTS];
22extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
23extern int16_t ambient_ramp;
24#define REVERSE_GREEN_TINT 8
25
26extern int16_t shutdown_lighting_value,shutdown_lighting;
27
28class LightSource
29{
30public:
31    LightSource(char Type, ivec2 pos, int32_t inner_r, int32_t outer_r,
32                ivec2 shift, LightSource *next);
33    LightSource *Copy();
34    void CalcRange();
35
36    ivec2 m_pos, m_shift;
37    int32_t m_type;
38    int32_t m_outer_radius, mul_div, m_inner_radius;
39
40    ivec2 m_p1, m_p2;
41    char known;
42    LightSource *m_next;
43};
44
45class LightPatch
46{
47public:
48    LightPatch(ivec2 p1, ivec2 p2, LightPatch *next)
49      : m_p1(p1),
50        m_p2(p2),
51        m_next(next)
52    {
53    }
54
55    void AddLight(ivec2 p1, ivec2 p2, LightSource *who);
56    LightPatch *Copy(LightPatch *next);
57
58    ivec2 m_p1, m_p2;
59    array<LightSource *> m_lights;
60
61    /* FIXME: this should disappear */
62    LightPatch *m_next;
63};
64
65void delete_all_lights();
66void delete_light(LightSource *which);
67LightSource *AddLightSource(char type, ivec2 pos, int32_t inner,
68                            int32_t outer, ivec2 shift);
69
70void add_light_spec(SpecDir *sd, char const *level_name);
71void write_lights(bFILE *fp);
72void read_lights(SpecDir *sd, bFILE *fp, char const *level_name);
73
74void light_screen(AImage *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
75
76void calc_light_table(Palette *pal);
77extern LightSource *first_light_source;
78extern int light_detail;
79
80extern int32_t light_to_number(LightSource *l);
81extern LightSource *number_to_light(int32_t x);
82
83#endif
Note: See TracBrowser for help on using the repository browser.