source: abuse/trunk/src/items.hpp @ 129

Last change on this file since 129 was 129, checked in by Sam Hocevar, 15 years ago
  • Get rid of jmalloc and replace it with standard malloc. Modern operating systems certainly perform a lot better than this custom implementation, and we have superior tools (eg. valgrind) to debug and profile memory usage without interfering with the code itself.
File size: 2.2 KB
RevLine 
[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 __ITEMS_HPP__
11#define __ITEMS_HPP__
12#include "image.hpp"
13#include "specs.hpp"
14#include "points.hpp"
15#include "timage.hpp"
16#include <stdio.h>
17#include <stdlib.h>
18
19#define AUTOTILE_WIDTH 6
20#define AUTOTILE_HEIGHT 3
21
[124]22class boundary : public point_list      //  a list of points with
[2]23{
[124]24public :
[39]25  boundary(bFILE *fp,char const *er_name);
[17]26  uint8_t *inside;     // tells which side of the line is on the inside
[2]27  boundary(boundary *p);      // flips the *inside list
[129]28  ~boundary() { if (tot) free(inside); }
[2]29} ;
30
31class backtile
32{
33public :
[17]34  uint16_t next;
[2]35  image *im;
36  backtile(spec_entry *e, bFILE *fp);
37  backtile(bFILE *fp);
[17]38  int32_t size() { return 2+4+im->width()*im->height(); }
[2]39  ~backtile() { delete im; }
40} ;
41
42class foretile
43{
44public :
45  trans_image *im;
[17]46  uint16_t next;
47  uint8_t damage;
48  uint8_t ylevel;            // for fast intersections, this is the y level offset for the ground
[2]49                           // if ground is not level this is 255
50  boundary *points;
51
52  image *micro_image;
53
54  foretile(bFILE *fp);
[17]55  int32_t size() { return im->width()*im->height()+4+2+1+points->size(); }
[2]56  ~foretile() { delete im; delete points; delete micro_image; }
57} ;
58
59class figure
60{
61public :
62  trans_image *forward,*backward;
[17]63  uint8_t hit_damage,xcfg;
64  int8_t advance;
[2]65  point_list *hit;
66  boundary *f_damage,*b_damage;
67  int size();
68
69  figure(bFILE *fp, int type);
70  int width() { return forward->width(); }
71  int height() { return forward->height(); }
72
[17]73/*  int32_t size(int type)         // taken from spaint items
[2]74  {
[124]75    if
[2]76    return forward->width()*backward->height()+4+
77                       1+1+       // hit & xcfg
[124]78               touch->size()+
79               hit->size()+
80               damage->size();
[2]81  }*/
82
[124]83  ~figure() { delete forward; delete backward;
84          delete hit;
85          delete f_damage; delete b_damage; }
[2]86} ;
87
88class char_tint
89{
90  public :
[17]91  uint8_t data[256];
[2]92  ~char_tint() { ; }
93  char_tint(bFILE *fp);               // should be a palette entry
94} ;
95
96#endif
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Note: See TracBrowser for help on using the repository browser.