[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 |
---|
| 7 | * domain software, no warranty is made or implied by Crack dot Com or |
---|
| 8 | * Jonathan Clark. |
---|
| 9 | */ |
---|
| 10 | |
---|
[2] | 11 | #ifndef __ITEMS_HPP__ |
---|
| 12 | #define __ITEMS_HPP__ |
---|
[481] | 13 | #include "image.h" |
---|
[541] | 14 | #include "transimage.h" |
---|
[481] | 15 | #include "specs.h" |
---|
| 16 | #include "points.h" |
---|
[2] | 17 | #include <stdio.h> |
---|
| 18 | #include <stdlib.h> |
---|
| 19 | |
---|
| 20 | #define AUTOTILE_WIDTH 6 |
---|
| 21 | #define AUTOTILE_HEIGHT 3 |
---|
| 22 | |
---|
[124] | 23 | class boundary : public point_list // a list of points with |
---|
[2] | 24 | { |
---|
[124] | 25 | public : |
---|
[39] | 26 | boundary(bFILE *fp,char const *er_name); |
---|
[17] | 27 | uint8_t *inside; // tells which side of the line is on the inside |
---|
[2] | 28 | boundary(boundary *p); // flips the *inside list |
---|
[129] | 29 | ~boundary() { if (tot) free(inside); } |
---|
[2] | 30 | } ; |
---|
| 31 | |
---|
| 32 | class backtile |
---|
| 33 | { |
---|
| 34 | public : |
---|
[17] | 35 | uint16_t next; |
---|
[2] | 36 | image *im; |
---|
| 37 | backtile(spec_entry *e, bFILE *fp); |
---|
| 38 | backtile(bFILE *fp); |
---|
[512] | 39 | int32_t size() { vec2i s = im->Size(); return 2 + 4 + s.x * s.y; } |
---|
[2] | 40 | ~backtile() { delete im; } |
---|
| 41 | } ; |
---|
| 42 | |
---|
| 43 | class foretile |
---|
| 44 | { |
---|
| 45 | public : |
---|
[541] | 46 | TransImage *im; |
---|
[17] | 47 | uint16_t next; |
---|
| 48 | uint8_t damage; |
---|
| 49 | uint8_t ylevel; // for fast intersections, this is the y level offset for the ground |
---|
[2] | 50 | // if ground is not level this is 255 |
---|
| 51 | boundary *points; |
---|
| 52 | |
---|
| 53 | image *micro_image; |
---|
| 54 | |
---|
| 55 | foretile(bFILE *fp); |
---|
[527] | 56 | int32_t size() { return im->Size().x*im->Size().y+4+2+1+points->size(); } |
---|
[2] | 57 | ~foretile() { delete im; delete points; delete micro_image; } |
---|
| 58 | } ; |
---|
| 59 | |
---|
| 60 | class figure |
---|
| 61 | { |
---|
| 62 | public : |
---|
[541] | 63 | TransImage *forward,*backward; |
---|
[17] | 64 | uint8_t hit_damage,xcfg; |
---|
| 65 | int8_t advance; |
---|
[2] | 66 | point_list *hit; |
---|
| 67 | boundary *f_damage,*b_damage; |
---|
[527] | 68 | size_t MemUsage(); |
---|
[2] | 69 | |
---|
| 70 | figure(bFILE *fp, int type); |
---|
[527] | 71 | int width() { return forward->Size().x; } |
---|
| 72 | int height() { return forward->Size().y; } |
---|
[2] | 73 | |
---|
[527] | 74 | ~figure() { delete forward; delete backward; delete hit; |
---|
| 75 | delete f_damage; delete b_damage; } |
---|
[2] | 76 | } ; |
---|
| 77 | |
---|
| 78 | class char_tint |
---|
| 79 | { |
---|
| 80 | public : |
---|
[17] | 81 | uint8_t data[256]; |
---|
[2] | 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 | |
---|