2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2006-05-23 23:43:52 +00:00
|
|
|
*
|
2007-05-30 21:56:52 +00:00
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-05-23 23:43:52 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2014-02-18 01:34:17 +00:00
|
|
|
*
|
2006-05-23 23:43:52 +00:00
|
|
|
* 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.
|
2014-02-18 01:34:17 +00:00
|
|
|
*
|
2006-05-23 23:43:52 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-05-24 14:25:42 +00:00
|
|
|
#ifndef AGI_SPRITE_H
|
|
|
|
#define AGI_SPRITE_H
|
2006-05-23 23:43:52 +00:00
|
|
|
|
|
|
|
namespace Agi {
|
|
|
|
|
2016-01-29 12:13:40 +00:00
|
|
|
/**
|
|
|
|
* 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 {
|
|
|
|
uint16 givenOrderNr;
|
|
|
|
uint16 sortOrder;
|
2016-02-02 17:43:36 +00:00
|
|
|
ScreenObjEntry *screenObjPtr; /**< pointer to view table entry */
|
|
|
|
int16 xPos; /**< x coordinate of the sprite */
|
|
|
|
int16 yPos; /**< y coordinate of the sprite */
|
|
|
|
int16 xSize; /**< width of the sprite */
|
|
|
|
int16 ySize; /**< height of the sprite */
|
|
|
|
byte *backgroundBuffer; /**< buffer to store background data */
|
2016-01-29 12:13:40 +00:00
|
|
|
};
|
2006-05-30 18:53:01 +00:00
|
|
|
|
2016-01-29 12:13:40 +00:00
|
|
|
typedef Common::List<Sprite> SpriteList;
|
|
|
|
typedef Common::List<Sprite *> SpritePtrList;
|
2006-05-30 18:53:01 +00:00
|
|
|
|
2006-12-06 19:27:02 +00:00
|
|
|
class AgiEngine;
|
|
|
|
class GfxMgr;
|
|
|
|
class Obejcts;
|
|
|
|
|
|
|
|
class SpritesMgr {
|
2006-05-30 18:53:01 +00:00
|
|
|
private:
|
2006-12-06 19:27:02 +00:00
|
|
|
GfxMgr *_gfx;
|
|
|
|
AgiEngine *_vm;
|
|
|
|
|
2009-06-06 17:39:13 +00:00
|
|
|
//
|
|
|
|
// Sprite management functions
|
|
|
|
//
|
2006-05-30 18:53:01 +00:00
|
|
|
|
2016-01-29 12:13:40 +00:00
|
|
|
SpriteList _spriteRegularList;
|
|
|
|
SpriteList _spriteStaticList;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void buildRegularSpriteList();
|
|
|
|
void buildStaticSpriteList();
|
|
|
|
void buildAllSpriteLists();
|
|
|
|
void buildSpriteListAdd(uint16 givenOrderNr, ScreenObjEntry *screenObj, SpriteList &spriteList);
|
|
|
|
void freeList(SpriteList &spriteList);
|
|
|
|
void freeRegularSprites();
|
|
|
|
void freeStaticSprites();
|
|
|
|
void freeAllSprites();
|
|
|
|
|
|
|
|
void eraseSprites(SpriteList &spriteList);
|
|
|
|
void eraseRegularSprites();
|
|
|
|
void eraseStaticSprites();
|
|
|
|
void eraseSprites();
|
|
|
|
|
|
|
|
void drawSprites(SpriteList &spriteList);
|
|
|
|
void drawRegularSpriteList();
|
|
|
|
void drawStaticSpriteList();
|
|
|
|
void drawAllSpriteLists();
|
|
|
|
|
|
|
|
void drawCel(ScreenObjEntry *screenObj);
|
|
|
|
|
|
|
|
void showSprite(ScreenObjEntry *screenObj);
|
|
|
|
void showSprites(SpriteList &spriteList);
|
|
|
|
void showRegularSpriteList();
|
|
|
|
void showStaticSpriteList();
|
|
|
|
void showAllSpriteLists();
|
|
|
|
|
|
|
|
void showObject(int16 viewNr);
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2006-05-30 18:53:01 +00:00
|
|
|
public:
|
2006-12-06 19:27:02 +00:00
|
|
|
SpritesMgr(AgiEngine *agi, GfxMgr *gfx);
|
|
|
|
~SpritesMgr();
|
2006-05-30 18:53:01 +00:00
|
|
|
|
2007-01-16 12:40:51 +00:00
|
|
|
int initSprites();
|
|
|
|
void deinitSprites();
|
2016-01-29 12:13:40 +00:00
|
|
|
void addToPic(int16 viewNr, int16 loopNr, int16 celNr, int16 xPos, int16 yPos, int16 priority, int16 border);
|
|
|
|
void addToPicDrawPriorityBox(ScreenObjEntry *screenObj, int16 border);
|
2006-05-30 18:53:01 +00:00
|
|
|
};
|
|
|
|
|
2007-01-16 12:40:51 +00:00
|
|
|
} // End of namespace Agi
|
2006-05-23 23:43:52 +00:00
|
|
|
|
2007-01-16 12:40:51 +00:00
|
|
|
#endif /* AGI_SPRITE_H */
|