source: abuse/trunk/src/light.h @ 555

Last change on this file since 555 was 555, checked in by Sam Hocevar, 11 years ago

ps3: make everything compile on the PS3. Of course, nothing links yet
because so much support is missing.

  • Property svn:keywords set to Id
File size: 2.5 KB
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
[494]4 *  Copyright (c) 2005-2011 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
[481]14#include "image.h"
15#include "palette.h"
16#include "configuration.h"
17#include "crc.h"
[2]18
19#define TTINTS 9
[17]20extern uint8_t *tints[TTINTS];
21extern uint8_t *white_light,*white_light_initial,*green_light,*trans_table;
22extern int16_t ambient_ramp;
[2]23#define REVERSE_GREEN_TINT 8
24
[17]25extern int16_t shutdown_lighting_value,shutdown_lighting;
[2]26
27class light_source
28{
29  public :
[16]30  int32_t type,x,xshift,y,yshift;
31  int32_t outer_radius,mul_div,inner_radius;
[2]32
[16]33  int32_t x1,y1,x2,y2;
[2]34  char known;
35  light_source *next;
36
37  void calc_range();
[124]38  light_source(char Type, int32_t X, int32_t Y, int32_t Inner_radius, int32_t Outer_radius,
39           int32_t Xshift, int32_t Yshift,
40           light_source *Next);
[2]41  light_source *copy();
42} ;
43
44class light_patch
45{
46  public :
[16]47  int32_t total,x1,y1,x2,y2;
[124]48  light_source **lights;
[2]49  light_patch *next;
[16]50  light_patch(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_patch *Next)
[124]51  {
[2]52    x1=X1; y1=Y1; x2=X2; y2=Y2;
53    next=Next;
54    total=0;
55    lights=NULL;
56  }
[16]57  void add_light(int32_t X1, int32_t Y1, int32_t X2, int32_t Y2, light_source *who);
[2]58  light_patch *copy(light_patch *Next);
[129]59  ~light_patch() { if (total) free(lights); }
[2]60} ;
61
62void delete_all_lights();
63void delete_light(light_source *which);
[124]64light_source *add_light_source(char type, int32_t x, int32_t y,
65                   int32_t inner, int32_t outer, int32_t xshift, int32_t yshift);
[2]66
[39]67void add_light_spec(spec_directory *sd, char const *level_name);
[2]68void write_lights(bFILE *fp);
[39]69void read_lights(spec_directory *sd, bFILE *fp, char const *level_name);
[2]70
71
72void delete_patch_list(light_patch *first);
73light_patch *find_patch(int screenx, int screeny, light_patch *list);
[494]74int calc_light_value(int32_t x, int32_t y, light_patch *which);
[17]75void light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient);
76void double_light_screen(image *sc, int32_t screenx, int32_t screeny, uint8_t *light_lookup, uint16_t ambient,
[124]77             image *out, int32_t out_x, int32_t out_y);
[2]78
79void calc_light_table(palette *pal);
80extern light_source *first_light_source;
81extern int light_detail;
82
[16]83extern int32_t light_to_number(light_source *l);
84extern light_source *number_to_light(int32_t x);
[2]85
86#endif
Note: See TracBrowser for help on using the repository browser.