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