source: abuse/trunk/src/imlib/include/morph.hpp @ 56

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