[56] | 1 | /* |
---|
| 2 | * Abuse - dark 2D side-scrolling platform game |
---|
| 3 | * Copyright (c) 1995 Crack dot Com |
---|
| 4 | * |
---|
| 5 | * This software was released into the Public Domain. As with most public |
---|
| 6 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
| 7 | * Jonathan Clark. |
---|
| 8 | */ |
---|
| 9 | |
---|
[2] | 10 | #ifndef LIGHT_HPP |
---|
| 11 | #define LIGHT_HPP |
---|
| 12 | |
---|
| 13 | #include "image.hpp" |
---|
| 14 | #include "palette.hpp" |
---|
| 15 | #include "config.hpp" |
---|
| 16 | #include "crc.hpp" |
---|
| 17 | |
---|
| 18 | #define TTINTS 9 |
---|
[17] | 19 | extern uint8_t *tints[TTINTS]; |
---|
| 20 | extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table; |
---|
| 21 | extern int16_t ambient_ramp; |
---|
[2] | 22 | #define REVERSE_GREEN_TINT 8 |
---|
| 23 | |
---|
[17] | 24 | extern int16_t shutdown_lighting_value,shutdown_lighting; |
---|
[2] | 25 | |
---|
| 26 | class light_source |
---|
| 27 | { |
---|
| 28 | public : |
---|
[16] | 29 | int32_t type,x,xshift,y,yshift; |
---|
| 30 | int32_t outer_radius,mul_div,inner_radius; |
---|
[2] | 31 | |
---|
[16] | 32 | int32_t x1,y1,x2,y2; |
---|
[2] | 33 | char known; |
---|
| 34 | light_source *next; |
---|
| 35 | |
---|
| 36 | void calc_range(); |
---|
[16] | 37 | light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius, int32_t Outer_radius, |
---|
| 38 | int32_t Xshift, int32_t Yshift, |
---|
[2] | 39 | light_source *Next); |
---|
| 40 | light_source *copy(); |
---|
| 41 | } ; |
---|
| 42 | |
---|
| 43 | class light_patch |
---|
| 44 | { |
---|
| 45 | public : |
---|
[16] | 46 | int32_t total,x1,y1,x2,y2; |
---|
[2] | 47 | light_source **lights; |
---|
| 48 | light_patch *next; |
---|
[16] | 49 | light_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_patch *Next) |
---|
[2] | 50 | { |
---|
| 51 | x1=X1; y1=Y1; x2=X2; y2=Y2; |
---|
| 52 | next=Next; |
---|
| 53 | total=0; |
---|
| 54 | lights=NULL; |
---|
| 55 | } |
---|
[16] | 56 | void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who); |
---|
[2] | 57 | light_patch *copy(light_patch *Next); |
---|
| 58 | ~light_patch() { if (total) jfree(lights); } |
---|
| 59 | } ; |
---|
| 60 | |
---|
| 61 | void delete_all_lights(); |
---|
| 62 | void delete_light(light_source *which); |
---|
[16] | 63 | light_source *add_light_source(char type, int32_t x, int32_t y, |
---|
| 64 | int32_t inner, int32_t outer, int32_t xshift, int32_t yshift); |
---|
[2] | 65 | |
---|
[39] | 66 | void add_light_spec(spec_directory *sd, char const *level_name); |
---|
[2] | 67 | void write_lights(bFILE *fp); |
---|
[39] | 68 | void read_lights(spec_directory *sd, bFILE *fp, char const *level_name); |
---|
[2] | 69 | |
---|
| 70 | |
---|
| 71 | void delete_patch_list(light_patch *first); |
---|
| 72 | light_patch *find_patch(int screenx, int screeny, light_patch *list); |
---|
[16] | 73 | int calc_light_value(int32_t x, int32_t y, light_patch *which); |
---|
[17] | 74 | void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient); |
---|
| 75 | void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient, |
---|
[16] | 76 | image *out, int32_t out_x, int32_t out_y); |
---|
[2] | 77 | |
---|
| 78 | void calc_light_table(palette *pal); |
---|
| 79 | extern light_source *first_light_source; |
---|
| 80 | extern int light_detail; |
---|
| 81 | |
---|
[16] | 82 | extern int32_t light_to_number(light_source *l); |
---|
| 83 | extern light_source *number_to_light(int32_t x); |
---|
[2] | 84 | |
---|
| 85 | #endif |
---|