source: abuse/trunk/src/seq.h @ 682

Last change on this file since 682 was 555, checked in by Sam Hocevar, 8 years ago

ps3: make everything compile on the PS3. Of course, nothing links yet
because so much support is missing.

  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
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, by
8 *  Jonathan Clark, or by Sam Hocevar.
9 */
10
11#ifndef __SEQUENCE_HPP_
12#define __SEQUENCE_HPP_
13
14#include "image.h"
15#include "transimage.h"
16#include "items.h"
17#include "cache.h"
18
19#include <stdarg.h>
20
21class sequence
22{
23  int total;
24  int *seq;         // array of ids to figures
25public :
26  // takes a varible number of arguments (ints) specifing indexes into image array
27  sequence(int *figures, int total_frames) { total=total_frames; seq=figures; }
28
29  sequence(char *filename, void *pict_list, void *advance_list);
30
31  int next_frame(short &current) { current++; if (current>=total) { current=0; return 0; } return 1; }
32  int last_frame(short &current) { current--; if (current<0) { current=total-1; return 0; } return 1; }
33  TransImage  *get_frame(short current, int direction)
34   { if (direction>0) return cache.fig(seq[current])->forward;
35                 else return cache.fig(seq[current])->backward; }
36  figure *get_figure(short current) { return cache.fig(seq[current]); }
37  int cache_in();
38  int x_center(short current) { return (short) (cache.fig(seq[current])->xcfg); }
39  int length() { return total; }
40  int get_advance(int current) { return cache.fig(seq[current])->advance; }
41  size_t MemUsage();
42  ~sequence();
43};
44
45#endif
46
47
Note: See TracBrowser for help on using the repository browser.