[Scummvm-cvs-logs] SF.net SVN: scummvm: [22781] scummvm/trunk/engines/agi

chrilith at users.sourceforge.net chrilith at users.sourceforge.net
Tue May 30 11:54:02 CEST 2006


Revision: 22781
Author:   chrilith
Date:     2006-05-30 11:53:01 -0700 (Tue, 30 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22781&view=rev

Log Message:
-----------
objectify AGI sprite.h/cpp

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/cycle.cpp
    scummvm/trunk/engines/agi/op_cmd.cpp
    scummvm/trunk/engines/agi/savegame.cpp
    scummvm/trunk/engines/agi/sprite.cpp
    scummvm/trunk/engines/agi/sprite.h
    scummvm/trunk/engines/agi/text.cpp
    scummvm/trunk/engines/agi/view.cpp
Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/agi.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -513,7 +513,7 @@
 	game.sbuf = (uint8 *) calloc(_WIDTH, _HEIGHT);
 	game.hires = (uint8 *) calloc(_WIDTH * 2, _HEIGHT);
 
-	init_sprites();
+	_sprites = new SpritesMan;
 	init_video();
 
 	tick_timer = 0;
@@ -539,7 +539,7 @@
 	delete g_agi_music;
 	deinit_sound();
 	deinit_video();
-	deinit_sprites();
+	delete _sprites;
 	free(game.hires);
 	free(game.sbuf);
 	deinit_machine();

Modified: scummvm/trunk/engines/agi/cycle.cpp
===================================================================
--- scummvm/trunk/engines/agi/cycle.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/cycle.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -218,11 +218,11 @@
 	}
 
 	if (key == KEY_PRIORITY) {
-		erase_both();
+		_sprites->erase_both();
 		debug_.priority = !debug_.priority;
 		show_pic();
-		blit_both();
-		commit_both();
+		_sprites->blit_both();
+		_sprites->commit_both();
 		key = 0;
 	}
 

Modified: scummvm/trunk/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/trunk/engines/agi/op_cmd.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/op_cmd.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -400,11 +400,11 @@
 }
 
 cmd(show_obj) {
-	show_obj(p0);
+	_sprites->show_obj(p0);
 }
 
 cmd(show_obj_v) {
-	show_obj(_v[p0]);
+	_sprites->show_obj(_v[p0]);
 }
 
 cmd(sound) {
@@ -558,9 +558,9 @@
 
 cmd(draw_pic) {
 	debugC(6, kDebugLevelScripts, "=== draw pic %d ===", _v[p0]);
-	erase_both();
+	_sprites->erase_both();
 	decode_picture(_v[p0], true);
-	blit_both();
+	_sprites->blit_both();
 	game.picture_shown = 0;
 	debugC(6, kDebugLevelScripts, "--- end of draw pic %d ---", _v[p0]);
 }
@@ -575,9 +575,9 @@
 }
 
 cmd(load_pic) {
-	erase_both();
+	_sprites->erase_both();
 	agi_load_resource(rPICTURE, _v[p0]);
-	blit_both();
+	_sprites->blit_both();
 }
 
 cmd(discard_pic) {
@@ -587,23 +587,23 @@
 
 cmd(overlay_pic) {
 	debugC(6, kDebugLevelScripts, "--- overlay pic ---");
-	erase_both();
+	_sprites->erase_both();
 	decode_picture(_v[p0], false);
-	blit_both();
+	_sprites->blit_both();
 	game.picture_shown = 0;
-	commit_both();
+	_sprites->commit_both();
 }
 
 cmd(show_pri_screen) {
 	debug_.priority = 1;
-	erase_both();
+	_sprites->erase_both();
 	show_pic();
-	blit_both();
+	_sprites->blit_both();
 	wait_key();
 	debug_.priority = 0;
-	erase_both();
+	_sprites->erase_both();
 	show_pic();
-	blit_both();
+	_sprites->blit_both();
 }
 
 cmd(animate_obj) {
@@ -641,16 +641,16 @@
 	vt.x_pos2 = vt.x_pos;
 	vt.y_pos2 = vt.y_pos;
 	vt.cel_data_2 = vt.cel_data;
-	erase_upd_sprites();
+	_sprites->erase_upd_sprites();
 	vt.flags |= DRAWN;
 
 	if (agi_get_release() <= 0x2440)	/* See bug #546562 */
 		vt.flags |= ANIMATED;
 
-	blit_upd_sprites();
+	_sprites->blit_upd_sprites();
 	vt.flags &= ~DONTUPDATE;
 
-	commit_block(vt.x_pos, vt.y_pos - vt.y_size + 1, vt.x_pos + vt.x_size - 1, vt.y_pos);
+	_sprites->commit_block(vt.x_pos, vt.y_pos - vt.y_size + 1, vt.x_pos + vt.x_size - 1, vt.y_pos);
 
 	debugC(4, kDebugLevelScripts, "vt entry #%d flags = %02x", p0, vt.flags);
 }
@@ -659,17 +659,17 @@
 	if (~vt.flags & DRAWN)
 		return;
 
-	erase_upd_sprites();
+	_sprites->erase_upd_sprites();
 	if (vt.flags & UPDATE) {
 		vt.flags &= ~DRAWN;
 	} else {
-		erase_nonupd_sprites();
+		_sprites->erase_nonupd_sprites();
 		vt.flags &= ~DRAWN;
-		blit_nonupd_sprites();
+		_sprites->blit_nonupd_sprites();
 	}
-	blit_upd_sprites();
+	_sprites->blit_upd_sprites();
 
-	commit_block(vt.x_pos, vt.y_pos - vt.y_size + 1, vt.x_pos + vt.x_size - 1, vt.y_pos);
+	_sprites->commit_block(vt.x_pos, vt.y_pos - vt.y_size + 1, vt.x_pos + vt.x_size - 1, vt.y_pos);
 }
 
 cmd(position) {
@@ -721,17 +721,17 @@
 }
 
 cmd(add_to_pic) {
-	add_to_pic(p0, p1, p2, p3, p4, p5, p6);
+	_sprites->add_to_pic(p0, p1, p2, p3, p4, p5, p6);
 }
 
 cmd(add_to_pic_f) {
-	add_to_pic(_v[p0], _v[p1], _v[p2], _v[p3], _v[p4], _v[p5], _v[p6]);
+	_sprites->add_to_pic(_v[p0], _v[p1], _v[p2], _v[p3], _v[p4], _v[p5], _v[p6]);
 }
 
 cmd(force_update) {
-	erase_both();
-	blit_both();
-	commit_both();
+	_sprites->erase_both();
+	_sprites->blit_both();
+	_sprites->commit_both();
 }
 
 cmd(reverse_loop) {
@@ -1216,7 +1216,7 @@
 	} else
 		shake_start();
 
-	commit_both();		/* Fixes SQ1 demo */
+	_sprites->commit_both();		/* Fixes SQ1 demo */
 	for (i = 4 * p0; i; i--) {
 		shake_screen(i & 1);
 		flush_block(0, 0, GFX_WIDTH - 1, GFX_HEIGHT - 1);
@@ -1444,11 +1444,11 @@
 					debug_.steps--;
 				}
 			} else {
-				blit_both();
+				_sprites->blit_both();
 				do {
 					main_cycle();
 				} while (!debug_.steps && debug_.enabled);
-				erase_both();
+				_sprites->erase_both();
 			}
 		}
 

Modified: scummvm/trunk/engines/agi/savegame.cpp
===================================================================
--- scummvm/trunk/engines/agi/savegame.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/savegame.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -117,7 +117,7 @@
 		break;
 	case ADD_VIEW:
 		agi_load_resource(rVIEW, p1);
-		add_to_pic(p1, p2, p3, p4, p5, p6, p7);
+		_sprites->add_to_pic(p1, p2, p3, p4, p5, p6, p7);
 		break;
 	}
 }
@@ -544,7 +544,7 @@
 		v->s = NULL;	/* not sure if it is used... */
 	}
 
-	erase_both();
+	_sprites->erase_both();
 
 	/* Clear input line */
 	clear_screen(0);
@@ -566,9 +566,9 @@
 	game.has_prompt = 0;	/* force input line repaint if necessary */
 	clean_input();
 
-	erase_both();
-	blit_both();
-	commit_both();
+	_sprites->erase_both();
+	_sprites->blit_both();
+	_sprites->commit_both();
 	show_pic();
 	do_update();
 
@@ -725,7 +725,7 @@
 
 	sprintf(path, "%s/%05X_%s_%02d.sav", _savePath, game.crc, game.id, 0);
 
-	erase_both();
+	_sprites->erase_both();
 	stop_sound();
 	close_window();
 
@@ -754,7 +754,7 @@
 
 	sprintf(path, "%s/%05X_%s_%02d.sav", _savePath, game.crc, game.id, slot);
 
-	erase_both();
+	_sprites->erase_both();
 	stop_sound();
 
 	draw_window(hp, vp, GFX_WIDTH - hp, GFX_HEIGHT - vp);

Modified: scummvm/trunk/engines/agi/sprite.cpp
===================================================================
--- scummvm/trunk/engines/agi/sprite.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/sprite.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -27,25 +27,10 @@
 #include "agi/graphics.h"
 #include "agi/text.h"
 #include "agi/savegame.h"
-#include "common/list.h"
 
 namespace Agi {
 
-/**
- * Sprite structure.
- * This structure holds information on visible and priority data of
- * a rectangular area of the AGI screen. Sprites are chained in two
- * circular lists, one for updating and other for non-updating sprites.
- */
-struct sprite {
-	vt_entry *v;		/**< pointer to view table entry */
-	int16 x_pos;			/**< x coordinate of the sprite */
-	int16 y_pos;			/**< y coordinate of the sprite */
-	int16 x_size;			/**< width of the sprite */
-	int16 y_size;			/**< height of the sprite */
-	uint8 *buffer;			/**< buffer to store background data */
-	uint8 *hires;			/**< buffer for hi-res background */
-};
+SpritesMan *_sprites;
 
 /*
  * Sprite pool replaces dynamic allocation
@@ -53,11 +38,8 @@
 #undef ALLOC_DEBUG
 
 #define POOL_SIZE 68000		/* Gold Rush mine room needs > 50000 */
-	/* Speeder bike challenge needs > 67000 */
-static uint8 *sprite_pool;
-static uint8 *pool_top;
 
-static void *pool_alloc(int size) {
+void *SpritesMan::pool_alloc(int size) {
 	uint8 *x;
 
 	/* Adjust size to 32-bit boundary to prevent data misalignment
@@ -80,7 +62,7 @@
 /* Note: it's critical that pool_release() is called in the exact
          reverse order of pool_alloc()
 */
-static void pool_release(void *s) {
+void SpritesMan::pool_release(void *s) {
 	pool_top = (uint8 *)s;
 }
 
@@ -90,7 +72,7 @@
 
 /* Blit one pixel considering the priorities */
 
-static void blit_pixel(uint8 *p, uint8 *end, uint8 col, int spr, int width, int *hidden) {
+void SpritesMan::blit_pixel(uint8 *p, uint8 *end, uint8 col, int spr, int width, int *hidden) {
 	int epr = 0, pr = 0;	/* effective and real priorities */
 
 	/* CM: priority 15 overrides control lines and is ignored when
@@ -138,7 +120,7 @@
 
 #define X_FACT 2		/* Horizontal hires factor */
 
-static int blit_hires_cel(int x, int y, int spr, view_cel *c) {
+int SpritesMan::blit_hires_cel(int x, int y, int spr, view_cel *c) {
 	uint8 *q = NULL;
 	uint8 *h0, *h, *end;
 	int i, j, t, m, col;
@@ -170,7 +152,7 @@
 	return hidden;
 }
 
-static int blit_cel(int x, int y, int spr, view_cel *c) {
+int SpritesMan::blit_cel(int x, int y, int spr, view_cel *c) {
 	uint8 *p0, *p, *q = NULL, *end;
 	int i, j, t, m, col;
 	int hidden = true;
@@ -214,7 +196,7 @@
 	return hidden;
 }
 
-static void objs_savearea(sprite *s) {
+void SpritesMan::objs_savearea(sprite *s) {
 	int y;
 	int16 x_pos = s->x_pos, y_pos = s->y_pos;
 	int16 x_size = s->x_size, y_size = s->y_size;
@@ -254,7 +236,7 @@
 	}
 }
 
-static void objs_restorearea(sprite *s) {
+void SpritesMan::objs_restorearea(sprite *s) {
 	int y, offset;
 	int16 x_pos = s->x_pos, y_pos = s->y_pos;
 	int16 x_size = s->x_size, y_size = s->y_size;
@@ -299,19 +281,11 @@
 	}
 }
 
-/*
- * Sprite management functions
- */
 
-typedef Common::List<sprite*> SpriteList;
-
-static SpriteList spr_upd;
-static SpriteList spr_nonupd;
-
 /**
  * Condition to determine whether a sprite will be in the 'updating' list.
  */
-static int test_updating(vt_entry *v) {
+int SpritesMan::test_updating(vt_entry *v) {
 	/* Sanity check (see bug #779302) */
 	if (~game.dir_view[v->current_view].flags & RES_LOADED)
 		return 0;
@@ -322,7 +296,7 @@
 /**
  * Condition to determine whether a sprite will be in the 'non-updating' list.
  */
-static int test_not_updating(vt_entry *v) {
+int SpritesMan::test_not_updating(vt_entry *v) {
 	/* Sanity check (see bug #779302) */
 	if (~game.dir_view[v->current_view].flags & RES_LOADED)
 		return 0;
@@ -333,7 +307,7 @@
 /**
  * Convert sprite priority to y value.
  */
-static INLINE int prio_to_y(int p) {
+INLINE int SpritesMan::prio_to_y(int p) {
 	int i;
 
 	if (p == 0)
@@ -350,7 +324,7 @@
 /**
  * Create and initialize a new sprite structure.
  */
-static sprite *new_sprite(vt_entry *v) {
+sprite *SpritesMan::new_sprite(vt_entry *v) {
 	sprite *s;
 	s = (sprite *)pool_alloc(sizeof(sprite));
 	if (s == NULL)
@@ -371,7 +345,7 @@
 /**
  * Insert sprite in the specified sprite list.
  */
-static void spr_addlist(SpriteList& l, vt_entry *v) {
+void SpritesMan::spr_addlist(SpriteList& l, vt_entry *v) {
 	sprite *s = new_sprite(v);
 	l.push_back(s);
 }
@@ -379,7 +353,7 @@
 /**
  * Sort sprites from lower y values to build a sprite list.
  */
-static void build_list(SpriteList& l, int (*test) (vt_entry *)) {
+void SpritesMan::build_list(SpriteList& l, int (SpritesMan::*test) (vt_entry *)) {
 	int i, j, k;
 	vt_entry *v;
 	vt_entry *entry[0x100];
@@ -391,7 +365,7 @@
 	 */
 	i = 0;
 	for (v = game.view_table; v < &game.view_table[MAX_VIEWTABLE]; v++) {
-		if (test(v)) {
+		if ((this->*(test))(v)) {
 			entry[i] = v;
 			y_val[i] = v->flags & FIXED_PRIORITY ? prio_to_y(v->priority) : v->y_pos;
 			i++;
@@ -418,21 +392,21 @@
 /**
  * Build list of updating sprites.
  */
-static void build_upd_blitlist() {
+void SpritesMan::build_upd_blitlist() {
 	build_list(spr_upd, test_updating);
 }
 
 /**
  * Build list of non-updating sprites.
  */
-static void build_nonupd_blitlist() {
+void SpritesMan::build_nonupd_blitlist() {
 	build_list(spr_nonupd, test_not_updating);
 }
 
 /**
  * Clear the given sprite list.
  */
-static void free_list(SpriteList& l) {
+void SpritesMan::free_list(SpriteList& l) {
 	SpriteList::iterator iter;
 	for (iter = l.reverse_begin(); iter != l.end(); ) {
 		sprite* s = *iter;
@@ -447,7 +421,7 @@
  * Copy sprites from the pic buffer to the screen buffer, and check if
  * sprites of the given list have moved.
  */
-static void commit_sprites(SpriteList& l) {
+void SpritesMan::commit_sprites(SpriteList& l) {
 	SpriteList::iterator iter;
 	for (iter = l.begin(); iter != l.end(); ++iter) {
 		sprite *s = *iter;
@@ -497,7 +471,7 @@
 /**
  * Erase all sprites in the given list.
  */
-static void erase_sprites(SpriteList& l) {
+void SpritesMan::erase_sprites(SpriteList& l) {
 	SpriteList::iterator iter;
 	for (iter = l.reverse_begin(); iter != l.end(); --iter) {
 		sprite *s = *iter;
@@ -510,7 +484,7 @@
 /**
  * Blit all sprites in the given list.
  */
-static void blit_sprites(SpriteList& l) {
+void SpritesMan::blit_sprites(SpriteList& l) {
 	int hidden;
 	SpriteList::iterator iter;
 	for (iter = l.begin(); iter != l.end(); ++iter) {
@@ -528,16 +502,16 @@
  * Public functions
  */
 
-void commit_upd_sprites() {
+void SpritesMan::commit_upd_sprites() {
 	commit_sprites(spr_upd);
 }
 
-void commit_nonupd_sprites() {
+void SpritesMan::commit_nonupd_sprites() {
 	commit_sprites(spr_nonupd);
 }
 
 /* check moves in both lists */
-void commit_both() {
+void SpritesMan::commit_both() {
 	commit_upd_sprites();
 	commit_nonupd_sprites();
 }
@@ -551,7 +525,7 @@
  * @see erase_nonupd_sprites()
  * @see erase_both()
  */
-void erase_upd_sprites() {
+void SpritesMan::erase_upd_sprites() {
 	erase_sprites(spr_upd);
 }
 
@@ -564,7 +538,7 @@
  * @see erase_upd_sprites()
  * @see erase_both()
  */
-void erase_nonupd_sprites() {
+void SpritesMan::erase_nonupd_sprites() {
 	erase_sprites(spr_nonupd);
 }
 
@@ -577,7 +551,7 @@
  * @see erase_upd_sprites()
  * @see erase_nonupd_sprites()
  */
-void erase_both() {
+void SpritesMan::erase_both() {
 	erase_upd_sprites();
 	erase_nonupd_sprites();
 }
@@ -590,7 +564,7 @@
  * @see blit_nonupd_sprites()
  * @see blit_both()
  */
-void blit_upd_sprites() {
+void SpritesMan::blit_upd_sprites() {
 	debugC(7, kDebugLevelSprites, "blit updating");
 	build_upd_blitlist();
 	blit_sprites(spr_upd);
@@ -604,7 +578,7 @@
  * @see blit_upd_sprites()
  * @see blit_both()
  */
-void blit_nonupd_sprites() {
+void SpritesMan::blit_nonupd_sprites() {
 	debugC(7, kDebugLevelSprites, "blit non-updating");
 	build_nonupd_blitlist();
 	blit_sprites(spr_nonupd);
@@ -618,7 +592,7 @@
  * @see blit_upd_sprites()
  * @see blit_nonupd_sprites()
  */
-void blit_both() {
+void SpritesMan::blit_both() {
 	blit_nonupd_sprites();
 	blit_upd_sprites();
 }
@@ -636,7 +610,7 @@
  * @param pri   priority to use
  * @param mar   if < 4, create a margin around the the base of the cel
  */
-void add_to_pic(int view, int loop, int cel, int x, int y, int pri, int mar) {
+void SpritesMan::add_to_pic(int view, int loop, int cel, int x, int y, int pri, int mar) {
 	view_cel *c = NULL;
 	int x1, y1, x2, y2, y3;
 	uint8 *p1, *p2;
@@ -727,7 +701,7 @@
  * a message box with the object description.
  * @param n  Number of the object to show
  */
-void show_obj(int n) {
+void SpritesMan::show_obj(int n) {
 	view_cel *c;
 	sprite s;
 	int x1, y1, x2, y2;
@@ -761,7 +735,7 @@
 	free(s.hires);
 }
 
-void commit_block(int x1, int y1, int x2, int y2) {
+void SpritesMan::commit_block(int x1, int y1, int x2, int y2) {
 	int i, w, offset;
 	uint8 *q;
 	uint8 *h;
@@ -805,16 +779,17 @@
 	flush_block_a(x1, y1 + offset, x2, y2 + offset);
 }
 
-int init_sprites() {
-	if ((sprite_pool = (uint8 *)malloc(POOL_SIZE)) == NULL)
-		return err_NotEnoughMemory;
+SpritesMan::SpritesMan() {
+//	if ((sprite_pool = (uint8 *)malloc(POOL_SIZE)) == NULL)
+//		return err_NotEnoughMemory;
 
+	sprite_pool = (uint8 *)malloc(POOL_SIZE);
 	pool_top = sprite_pool;
 
-	return err_OK;
+//	return err_OK;
 }
 
-void deinit_sprites() {
+SpritesMan::~SpritesMan() {
 	free(sprite_pool);
 }
 

Modified: scummvm/trunk/engines/agi/sprite.h
===================================================================
--- scummvm/trunk/engines/agi/sprite.h	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/sprite.h	2006-05-30 18:53:01 UTC (rev 22781)
@@ -25,23 +25,84 @@
 #ifndef AGI_SPRITE_H
 #define AGI_SPRITE_H
 
+#include "common/list.h"
+
 namespace Agi {
 
-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);
+/**
+ * Sprite structure.
+ * This structure holds information on visible and priority data of
+ * a rectangular area of the AGI screen. Sprites are chained in two
+ * circular lists, one for updating and other for non-updating sprites.
+ */
+struct sprite {
+	vt_entry *v;		/**< pointer to view table entry */
+	int16 x_pos;			/**< x coordinate of the sprite */
+	int16 y_pos;			/**< y coordinate of the sprite */
+	int16 x_size;			/**< width of the sprite */
+	int16 y_size;			/**< height of the sprite */
+	uint8 *buffer;			/**< buffer to store background data */
+	uint8 *hires;			/**< buffer for hi-res background */
+};
 
+typedef Common::List<sprite*> SpriteList;
+
+class SpritesMan {
+private:
+	/* Speeder bike challenge needs > 67000 */
+	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);
+	int test_updating(vt_entry *v);
+	int test_not_updating(vt_entry *v);
+	
+	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, int (SpritesMan::*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 */

Modified: scummvm/trunk/engines/agi/text.cpp
===================================================================
--- scummvm/trunk/engines/agi/text.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/text.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -277,10 +277,10 @@
  */
 void close_window() {
 	debugC(4, kDebugLevelText, "close window");
-	erase_both();
+	_sprites->erase_both();
 	erase_textbox();	/* remove window, if any */
-	blit_both();
-	commit_both();		/* redraw sprites */
+	_sprites->blit_both();
+	_sprites->commit_both();		/* redraw sprites */
 	game.has_window = false;
 }
 
@@ -293,9 +293,9 @@
 int message_box(const char *s) {
 	int k;
 
-	erase_both();
+	_sprites->erase_both();
 	blit_textbox(s, -1, -1, -1);
-	blit_both();
+	_sprites->blit_both();
 	k = wait_key();
 	debugC(4, kDebugLevelText, "wait_key returned %02x", k);
 	close_window();
@@ -316,7 +316,7 @@
 	int rc = -1;
 	int bx[5], by[5];
 
-	erase_both();
+	_sprites->erase_both();
 	blit_textbox(m, -1, -1, -1);
 
 	x = game.window.x1 + 5 * CHAR_COLS / 2;
@@ -342,7 +342,7 @@
 		x += CHAR_COLS * strlen(b[i]) + s;
 	}
 
-	blit_both();
+	_sprites->blit_both();
 
 	/* clear key queue */
 	while (keypress()) {

Modified: scummvm/trunk/engines/agi/view.cpp
===================================================================
--- scummvm/trunk/engines/agi/view.cpp	2006-05-30 18:48:16 UTC (rev 22780)
+++ scummvm/trunk/engines/agi/view.cpp	2006-05-30 18:53:01 UTC (rev 22781)
@@ -212,9 +212,9 @@
 		return;
 
 	/* Rebuild sprite list, see bug #779302 */
-	erase_both();
-	blit_both();
-	commit_both();
+	_sprites->erase_both();
+	_sprites->blit_both();
+	_sprites->commit_both();
 
 	/* free all the loops */
 	for (x = 0; x < game.views[n].num_loops; x++)
@@ -282,9 +282,9 @@
  */
 void start_update(vt_entry *v) {
 	if (~v->flags & UPDATE) {
-		erase_both();
+		_sprites->erase_both();
 		v->flags |= UPDATE;
-		blit_both();
+		_sprites->blit_both();
 	}
 }
 
@@ -294,9 +294,9 @@
  */
 void stop_update(vt_entry *v) {
 	if (v->flags & UPDATE) {
-		erase_both();
+		_sprites->erase_both();
 		v->flags &= ~UPDATE;
-		blit_both();
+		_sprites->blit_both();
 	}
 }
 
@@ -367,10 +367,10 @@
 	}
 
 	if (i) {
-		erase_upd_sprites();
+		_sprites->erase_upd_sprites();
 		update_position();
-		blit_upd_sprites();
-		commit_upd_sprites();
+		_sprites->blit_upd_sprites();
+		_sprites->commit_upd_sprites();
 		game.view_table[0].flags &= ~(ON_WATER | ON_LAND);
 	}
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list