GOB: Change SPRITES_COUNT into a const

svn-id: r55645
This commit is contained in:
Sven Hesse 2011-01-30 00:02:42 +00:00
parent 0793e5c0a3
commit c498d70dd2
4 changed files with 12 additions and 13 deletions

View File

@ -67,7 +67,7 @@ Draw::Draw(GobEngine *vm) : _vm(vm) {
for (int i = 0; i < kFontCount; i++) for (int i = 0; i < kFontCount; i++)
_fonts[i] = 0; _fonts[i] = 0;
_spritesArray.resize(SPRITES_COUNT); _spritesArray.resize(kSpritesCount);
_invalidatedCount = 0; _invalidatedCount = 0;
for (int i = 0; i < 30; i++) { for (int i = 0; i < 30; i++) {
@ -333,7 +333,7 @@ void Draw::initSpriteSurf(int16 index, int16 width, int16 height,
} }
void Draw::freeSprite(int16 index) { void Draw::freeSprite(int16 index) {
assert(index < SPRITES_COUNT); assert(index < kSpritesCount);
_spritesArray[index].reset(); _spritesArray[index].reset();

View File

@ -30,8 +30,6 @@
namespace Gob { namespace Gob {
#define SPRITES_COUNT 100
#define RENDERFLAG_NOINVALIDATE 0x0001 #define RENDERFLAG_NOINVALIDATE 0x0001
#define RENDERFLAG_CAPTUREPUSH 0x0002 #define RENDERFLAG_CAPTUREPUSH 0x0002
#define RENDERFLAG_COLLISIONS 0x0004 #define RENDERFLAG_COLLISIONS 0x0004
@ -45,12 +43,13 @@ namespace Gob {
class Draw { class Draw {
public: public:
static const int kFontCount = 16; static const int kSpritesCount = 100;
static const int kFrontSurface = 20; static const int kFontCount = 16;
static const int kBackSurface = 21; static const int kFrontSurface = 20;
static const int kAnimSurface = 22; static const int kBackSurface = 21;
static const int kCursorSurface = 23; static const int kAnimSurface = 22;
static const int kCaptureSurface = 30; static const int kCursorSurface = 23;
static const int kCaptureSurface = 30;
struct FontToSprite { struct FontToSprite {
int8 sprite; int8 sprite;

View File

@ -822,7 +822,7 @@ void Game::start() {
_vm->_draw->closeScreen(); _vm->_draw->closeScreen();
for (int i = 0; i < SPRITES_COUNT; i++) for (int i = 0; i < Draw::kSpritesCount; i++)
_vm->_draw->freeSprite(i); _vm->_draw->freeSprite(i);
_vm->_draw->_scummvmCursor.reset(); _vm->_draw->_scummvmCursor.reset();
} }

View File

@ -258,7 +258,7 @@ bool TempSpriteHandler::load(int16 dataVar, int32 size, int32 offset) {
// Index sane? // Index sane?
int index = getIndex(size); int index = getIndex(size);
if ((index < 0) || (index >= SPRITES_COUNT)) if ((index < 0) || (index >= Draw::kSpritesCount))
return false; return false;
SurfacePtr sprite = _vm->_draw->_spritesArray[index]; SurfacePtr sprite = _vm->_draw->_spritesArray[index];
@ -333,7 +333,7 @@ SurfacePtr TempSpriteHandler::createSprite(int16 dataVar, int32 size, int32 offs
// Index sane? // Index sane?
int index = getIndex(size); int index = getIndex(size);
if ((index < 0) || (index >= SPRITES_COUNT)) if ((index < 0) || (index >= Draw::kSpritesCount))
return sprt; return sprt;
// Sprite exists? // Sprite exists?