source: abuse/trunk/src/seq.hpp @ 97

Last change on this file since 97 was 57, checked in by Sam Hocevar, 12 years ago
  • Move each header to the same directory as its corresponding source, to get a better idea of which files are likely to export symbols.
File size: 1.4 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 __SEQUENCE_HPP_
11#define __SEQUENCE_HPP_
12
13#include "image.hpp"
14#include "items.hpp"
15#include "timage.hpp"
16#include "cache.hpp"
17#include <stdarg.h>
18
19class sequence
20{
21  int total;
22  int *seq;         // array of ids to figures
23public :
24  // takes a varible number of arguments (ints) specifing indexes into image array
25  sequence(int *figures, int total_frames) { total=total_frames; seq=figures; }
26
27  sequence(char *filename, void *pict_list, void *advance_list);
28
29  int next_frame(short &current) { current++; if (current>=total) { current=0; return 0; } return 1; }
30  int last_frame(short &current) { current--; if (current<0) { current=total-1; return 0; } return 1; }
31  trans_image  *get_frame(short current, int direction)
32   { if (direction>0) return cash.fig(seq[current])->forward;
33                 else return cash.fig(seq[current])->backward; }
34  figure *get_figure(short current) { return cash.fig(seq[current]); }
35  int cache_in();
36  int x_center(short current) { return (short) (cash.fig(seq[current])->xcfg); }
37  int length() { return total; }
38  int get_advance(int current) { return cash.fig(seq[current])->advance; }
39  int size();
40  ~sequence();
41};
42
43#endif
44
45
Note: See TracBrowser for help on using the repository browser.