aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/sprite.h
blob: 5f65d9e237a81220448f877fb487b14d409ca2c4 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2006 The ScummVM project
 *
 * Copyright (C) 1999-2001 Sarien Team
 *
 * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL$
 * $Id$
 *
 */

#ifndef AGI_SPRITE_H
#define AGI_SPRITE_H

#include "common/list.h"

namespace Agi {


struct sprite;
typedef Common::List<sprite*> SpriteList;

class SpritesMan {
private:
	uint8 *sprite_pool;
	uint8 *pool_top;

	/*
	 * Sprite management functions
	 */

	SpriteList spr_upd;
	SpriteList spr_nonupd;

	void *pool_alloc(int size);
	void pool_release(void *s);
	void blit_pixel(uint8 *p, uint8 *end, uint8 col, int spr, int width, int *hidden);
	int blit_hires_cel(int x, int y, int spr, view_cel *c);
	int blit_cel(int x, int y, int spr, view_cel *c);
	void objs_savearea(sprite *s);
	void objs_restorearea(sprite *s);
	
	FORCEINLINE int prio_to_y(int p);
	sprite *new_sprite(vt_entry *v);
	void spr_addlist(SpriteList& l, vt_entry *v);
	void build_list(SpriteList& l, bool (*test) (vt_entry *));
	void build_upd_blitlist();
	void build_nonupd_blitlist();
	void free_list(SpriteList& l);
	void commit_sprites(SpriteList& l);
	void erase_sprites(SpriteList& l);
	void blit_sprites(SpriteList& l);	
	
public:
	SpritesMan();
	~SpritesMan();

	int init_sprites(void);
	void deinit_sprites(void);
	void erase_upd_sprites(void);
	void erase_nonupd_sprites(void);
	void erase_both(void);
	void blit_upd_sprites(void);
	void blit_nonupd_sprites(void);
	void blit_both(void);
	void commit_upd_sprites(void);
	void commit_nonupd_sprites(void);
	void commit_both(void);
	void add_to_pic(int, int, int, int, int, int, int);
	void show_obj(int);
	void commit_block(int, int, int, int);
};

extern SpritesMan *_sprites;

}                             // End of namespace Agi

#endif				/* AGI_SPRITE_H */