diff options
author | Willem Jan Palenstijn | 2006-05-30 19:48:47 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2006-05-30 19:48:47 +0000 |
commit | a9dc501ee03ec573208e54da597ee67688e97f18 (patch) | |
tree | 35fa235c9c02fa2816a20b431528e4e6187eb5ab | |
parent | 7094405116e43a2a11df36f0922999e808ebafce (diff) | |
download | scummvm-rg350-a9dc501ee03ec573208e54da597ee67688e97f18.tar.gz scummvm-rg350-a9dc501ee03ec573208e54da597ee67688e97f18.tar.bz2 scummvm-rg350-a9dc501ee03ec573208e54da597ee67688e97f18.zip |
cleanup
svn-id: r22783
-rw-r--r-- | engines/agi/sprite.cpp | 30 | ||||
-rw-r--r-- | engines/agi/sprite.h | 21 |
2 files changed, 26 insertions, 25 deletions
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp index ece1e8241f..9cf18f22a0 100644 --- a/engines/agi/sprite.cpp +++ b/engines/agi/sprite.cpp @@ -30,6 +30,22 @@ 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; /* @@ -37,7 +53,9 @@ SpritesMan *_sprites; */ #undef ALLOC_DEBUG + #define POOL_SIZE 68000 /* Gold Rush mine room needs > 50000 */ + /* Speeder bike challenge needs > 67000 */ void *SpritesMan::pool_alloc(int size) { uint8 *x; @@ -285,10 +303,10 @@ void SpritesMan::objs_restorearea(sprite *s) { /** * Condition to determine whether a sprite will be in the 'updating' list. */ -int SpritesMan::test_updating(vt_entry *v) { +static bool test_updating(vt_entry *v) { /* Sanity check (see bug #779302) */ if (~game.dir_view[v->current_view].flags & RES_LOADED) - return 0; + return false; return (v->flags & (ANIMATED | UPDATE | DRAWN)) == (ANIMATED | UPDATE | DRAWN); } @@ -296,10 +314,10 @@ int SpritesMan::test_updating(vt_entry *v) { /** * Condition to determine whether a sprite will be in the 'non-updating' list. */ -int SpritesMan::test_not_updating(vt_entry *v) { +static bool test_not_updating(vt_entry *v) { /* Sanity check (see bug #779302) */ if (~game.dir_view[v->current_view].flags & RES_LOADED) - return 0; + return false; return (v->flags & (ANIMATED | UPDATE | DRAWN)) == (ANIMATED | DRAWN); } @@ -353,7 +371,7 @@ void SpritesMan::spr_addlist(SpriteList& l, vt_entry *v) { /** * Sort sprites from lower y values to build a sprite list. */ -void SpritesMan::build_list(SpriteList& l, int (SpritesMan::*test) (vt_entry *)) { +void SpritesMan::build_list(SpriteList& l, bool (*test) (vt_entry *)) { int i, j, k; vt_entry *v; vt_entry *entry[0x100]; @@ -365,7 +383,7 @@ void SpritesMan::build_list(SpriteList& l, int (SpritesMan::*test) (vt_entry *)) */ i = 0; for (v = game.view_table; v < &game.view_table[MAX_VIEWTABLE]; v++) { - if ((this->*(test))(v)) { + if ((*test)(v)) { entry[i] = v; y_val[i] = v->flags & FIXED_PRIORITY ? prio_to_y(v->priority) : v->y_pos; i++; diff --git a/engines/agi/sprite.h b/engines/agi/sprite.h index cc8987269f..5f65d9e237 100644 --- a/engines/agi/sprite.h +++ b/engines/agi/sprite.h @@ -29,27 +29,12 @@ 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 */ -}; +struct sprite; typedef Common::List<sprite*> SpriteList; class SpritesMan { private: - /* Speeder bike challenge needs > 67000 */ uint8 *sprite_pool; uint8 *pool_top; @@ -67,13 +52,11 @@ private: 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_list(SpriteList& l, bool (*test) (vt_entry *)); void build_upd_blitlist(); void build_nonupd_blitlist(); void free_list(SpriteList& l); |