aboutsummaryrefslogtreecommitdiff
path: root/kyra/sprites.h
blob: 3a87b051539f163a5ca7f253754a7065ed80ac10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2004-2005 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 *
 * $Header$
 *
 */

#ifndef KYRASPRITES_H
#define KYRASPRITES_H

namespace Kyra {

#define MAX_NUM_SPRITES 50
#define MAX_NUM_ANIMS 11

struct Sprite {
	uint16 x;
	uint16 y;
	uint16 width;
	uint16 height;
};

struct Anim {
	uint8 *script;
	uint16 length;
	uint16 x;
	uint16 y;
	bool flag0;
	int8 sprite;
	uint8 *loopStart;
	uint16 loopsLeft;
	uint8 *reentry;
	uint32 nextRun;
	bool play;
};

class Sprites {
public:

	Sprites(KyraEngine *engine, OSystem *system);
	~Sprites();

	void doAnims();
	void loadDAT(const char* filename);
	Sprite getSprite(uint8 spriteID);
	void drawSprites(uint8 srcPage, uint8 dstPage);

protected:
	KyraEngine *_engine;
	Resource *_res;
	OSystem *_system;
	Screen *_screen;
	Sprite _sprites[MAX_NUM_SPRITES];
	uint8 *_dat;
	Anim _anims[MAX_NUM_ANIMS];
	Common::RandomSource _rnd;
	uint8 _animDelay;
};

} // End of namespace Kyra

#endif