source: abuse/trunk/src/imlib/morph.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.8 KB
Line 
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
10/* FIXME: this file is unused */
11
12#ifndef __MORPH_HPP_
13#define __MORPH_HPP_
14
15#include <stdio.h>
16
17#include "image.hpp"
18#include "palette.hpp"
19#include "macs.hpp"
20#include "specs.hpp"
21#include "filter.hpp"
22
23
24struct morph_point8
25{
26  unsigned char x1,y1,x2,y2;
27  unsigned char start_color,end_color;
28} ;
29
30struct morph_point16
31{
32  unsigned short x1,y1,x2,y2;
33  unsigned char start_color,end_color;
34} ;
35
36struct morph_patch                // patch a frame of animation
37{
38  unsigned short patches;
39  unsigned char *patch_data;       // x,y,color
40} ;
41
42class jmorph
43{
44protected :
45  unsigned char small;
46  void *p;                  // points to a 8 or 16 struct
47  long total;
48  unsigned short w[2],h[2];
49public :
50  int total_points() { return total; }
51  morph_point8 *small_points() { return (morph_point8 *)p; }
52  jmorph(spec_entry *e, FILE *fp);
53  jmorph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps);
54  void show_frame(image *screen, int x, int y, int frames, int frame_on,
55             color_filter *fli, palette *pal);
56  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
57  void show_24frame(unsigned char *screen, int width, int height,
58                    int x, int y, int frames, int frame_on, palette *pal);
59  void show_step_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
60  int bound_x1(int which) { return 0; }
61  int bound_y1(int which) { return 0; }
62  int bound_x2(int which) { return w[which]; }
63  int bound_y2(int which) { return h[which]; }
64  int write(FILE *fp);
65  void add_filler(int frames);
66  int small_morph() { return small; }
67  ~jmorph() { free(p); }
68} ;
69
70
71
72class patched_morph : public jmorph
73{
74public :
75  morph_patch *pats;
76  unsigned short patches;
77  patched_morph(spec_entry *e, FILE *fp);
78  patched_morph(image *i1, image *hint1, image *i2, image *hint2, int aneal_steps,
79            color_filter *fli, palette *pal, int frames);
80  void show_frame(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
81  void show_8(image *screen, int x, int y, int frame_on, color_filter *fli, palette *pal);
82  ~patched_morph() { free(pats); }
83
84} ;
85
86struct step_struct
87{
88  unsigned short x,y,r,g,b;
89  short dx,dy,dr,dg,db;
90} ;
91
92class step_morph
93{
94  int total;
95  step_struct *points;
96  int frame_on,dir,face_dir;
97  patched_morph *pm;
98public :
99  step_morph(patched_morph *mor, palette *pal, int frame_direction, int face_direction);
100  void show_frame(image *screen, int x, int y,  color_filter *fli);
101  void reverse_direction();
102  ~step_morph() { free(points); }
103} ;
104
105
106#endif
107
108
109
110
111
112
Note: See TracBrowser for help on using the repository browser.