1 | /* |
---|
2 | * Abuse - dark 2D side-scrolling platform game |
---|
3 | * Copyright (c) 1995 Crack dot Com |
---|
4 | * Copyright (c) 2005-2011 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 or |
---|
8 | * Jonathan Clark. |
---|
9 | */ |
---|
10 | |
---|
11 | #ifndef __ITEMS_HPP__ |
---|
12 | #define __ITEMS_HPP__ |
---|
13 | #include "image.h" |
---|
14 | #include "transimage.h" |
---|
15 | #include "specs.h" |
---|
16 | #include "points.h" |
---|
17 | #include <stdio.h> |
---|
18 | #include <stdlib.h> |
---|
19 | |
---|
20 | #define AUTOTILE_WIDTH 6 |
---|
21 | #define AUTOTILE_HEIGHT 3 |
---|
22 | |
---|
23 | class boundary : public point_list // a list of points with |
---|
24 | { |
---|
25 | public : |
---|
26 | boundary(bFILE *fp,char const *er_name); |
---|
27 | uint8_t *inside; // tells which side of the line is on the inside |
---|
28 | boundary(boundary *p); // flips the *inside list |
---|
29 | ~boundary() { if (tot) free(inside); } |
---|
30 | } ; |
---|
31 | |
---|
32 | class backtile |
---|
33 | { |
---|
34 | public : |
---|
35 | uint16_t next; |
---|
36 | image *im; |
---|
37 | backtile(spec_entry *e, bFILE *fp); |
---|
38 | backtile(bFILE *fp); |
---|
39 | int32_t size() { vec2i s = im->Size(); return 2 + 4 + s.x * s.y; } |
---|
40 | ~backtile() { delete im; } |
---|
41 | } ; |
---|
42 | |
---|
43 | class foretile |
---|
44 | { |
---|
45 | public : |
---|
46 | TransImage *im; |
---|
47 | uint16_t next; |
---|
48 | uint8_t damage; |
---|
49 | uint8_t ylevel; // for fast intersections, this is the y level offset for the ground |
---|
50 | // if ground is not level this is 255 |
---|
51 | boundary *points; |
---|
52 | |
---|
53 | image *micro_image; |
---|
54 | |
---|
55 | foretile(bFILE *fp); |
---|
56 | int32_t size() { return im->Size().x*im->Size().y+4+2+1+points->size(); } |
---|
57 | ~foretile() { delete im; delete points; delete micro_image; } |
---|
58 | } ; |
---|
59 | |
---|
60 | class figure |
---|
61 | { |
---|
62 | public : |
---|
63 | TransImage *forward,*backward; |
---|
64 | uint8_t hit_damage,xcfg; |
---|
65 | int8_t advance; |
---|
66 | point_list *hit; |
---|
67 | boundary *f_damage,*b_damage; |
---|
68 | size_t MemUsage(); |
---|
69 | |
---|
70 | figure(bFILE *fp, int type); |
---|
71 | int width() { return forward->Size().x; } |
---|
72 | int height() { return forward->Size().y; } |
---|
73 | |
---|
74 | ~figure() { delete forward; delete backward; delete hit; |
---|
75 | delete f_damage; delete b_damage; } |
---|
76 | } ; |
---|
77 | |
---|
78 | class char_tint |
---|
79 | { |
---|
80 | public : |
---|
81 | uint8_t data[256]; |
---|
82 | ~char_tint() { ; } |
---|
83 | char_tint(bFILE *fp); // should be a palette entry |
---|
84 | } ; |
---|
85 | |
---|
86 | #endif |
---|
87 | |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | |
---|