2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
2004-04-12 21:40:49 +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.
|
2004-04-12 21:40:49 +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.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-04-12 21:40:49 +00:00
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-12 21:40:49 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-05-01 16:15:55 +00:00
|
|
|
// Sprite management module private header file
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2006-07-23 15:16:50 +00:00
|
|
|
#ifndef SAGA_SPRITE_H
|
|
|
|
#define SAGA_SPRITE_H
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
namespace Saga {
|
|
|
|
|
2004-10-27 21:32:28 +00:00
|
|
|
#define SPRITE_ZMAX 16
|
|
|
|
#define SPRITE_ZMASK 0x0F
|
2004-04-12 21:40:49 +00:00
|
|
|
|
2005-01-09 15:07:49 +00:00
|
|
|
struct SpriteInfo {
|
2010-10-22 23:13:17 +00:00
|
|
|
ByteArray decodedBuffer;
|
2004-04-12 21:40:49 +00:00
|
|
|
int width;
|
|
|
|
int height;
|
2005-01-09 15:07:49 +00:00
|
|
|
int xAlign;
|
|
|
|
int yAlign;
|
|
|
|
|
2010-10-19 22:29:53 +00:00
|
|
|
SpriteInfo() : width(0), height(0), xAlign(0), yAlign(0) {
|
2005-01-09 15:07:49 +00:00
|
|
|
}
|
2004-04-12 21:40:49 +00:00
|
|
|
};
|
|
|
|
|
2011-01-31 11:36:14 +00:00
|
|
|
typedef Common::Array<SpriteInfo> SpriteList;
|
2005-07-08 16:56:03 +00:00
|
|
|
|
2004-08-03 01:07:34 +00:00
|
|
|
class Sprite {
|
2005-01-08 20:30:07 +00:00
|
|
|
public:
|
2005-01-09 15:07:49 +00:00
|
|
|
SpriteList _mainSprites;
|
2005-10-10 02:42:50 +00:00
|
|
|
SpriteList _saveReminderSprites;
|
|
|
|
SpriteList _arrowSprites;
|
2005-10-11 02:22:53 +00:00
|
|
|
SpriteList _inventorySprites;
|
2005-07-08 16:56:03 +00:00
|
|
|
|
2004-08-03 01:07:34 +00:00
|
|
|
Sprite(SagaEngine *vm);
|
2009-11-02 21:54:57 +00:00
|
|
|
~Sprite();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-07-08 16:56:03 +00:00
|
|
|
// draw scaled sprite using background scene mask
|
2010-10-19 22:29:53 +00:00
|
|
|
void drawOccluded(SpriteList &spriteList, uint spriteNumber, const Point &screenCoord, int scale, int depth);
|
2005-07-08 16:56:03 +00:00
|
|
|
|
|
|
|
// draw scaled sprite using background scene mask
|
2010-10-19 22:29:53 +00:00
|
|
|
void draw(SpriteList &spriteList, uint spriteNumber, const Point &screenCoord, int scale, bool clipToScene = false);
|
2005-07-08 16:56:03 +00:00
|
|
|
|
|
|
|
// main function
|
2008-12-12 20:10:00 +00:00
|
|
|
void drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer, bool clipToScene = false);
|
2005-07-08 16:56:03 +00:00
|
|
|
|
2010-10-19 22:29:53 +00:00
|
|
|
void draw(SpriteList &spriteList, uint spriteNumber, const Rect &screenRect, int scale, bool clipToScene = false);
|
2005-07-08 16:56:03 +00:00
|
|
|
|
2005-07-19 19:05:52 +00:00
|
|
|
void loadList(int resourceId, SpriteList &spriteList); // load or append spriteList
|
2010-10-19 22:29:53 +00:00
|
|
|
bool hitTest(SpriteList &spriteList, uint spriteNumber, const Point &screenCoord, int scale, const Point &testPoint);
|
|
|
|
void getScaledSpriteBuffer(SpriteList &spriteList, uint spriteNumber, int scale, int &width, int &height, int &xAlign, int &yAlign, const byte *&buffer);
|
2005-07-08 16:56:03 +00:00
|
|
|
|
2005-01-08 20:30:07 +00:00
|
|
|
private:
|
2005-01-09 15:07:49 +00:00
|
|
|
void decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t outLength);
|
2010-10-20 22:02:33 +00:00
|
|
|
void scaleBuffer(const byte *src, int width, int height, int scale, size_t outLength);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-08-03 01:07:34 +00:00
|
|
|
SagaEngine *_vm;
|
2005-07-19 19:05:52 +00:00
|
|
|
ResourceContext *_spriteContext;
|
2010-10-22 23:13:17 +00:00
|
|
|
ByteArray _decodeBuf;
|
2004-04-25 14:42:14 +00:00
|
|
|
};
|
2004-04-12 21:40:49 +00:00
|
|
|
|
|
|
|
} // End of namespace Saga
|
|
|
|
|
2004-05-01 16:15:55 +00:00
|
|
|
#endif
|