SHERLOCK: Implement RT drawAllShapes and support methods
This commit is contained in:
parent
fdd220e9f7
commit
1f9d1e9c16
10 changed files with 325 additions and 95 deletions
|
@ -496,4 +496,32 @@ int ImageFrame::sDrawYSize(int scaleVal) const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ImageFrame::sDrawXOffset(int scaleVal) const {
|
||||||
|
int width = _offset.x;
|
||||||
|
int scale = scaleVal == 0 ? 1 : scaleVal;
|
||||||
|
|
||||||
|
if (scaleVal >= 256)
|
||||||
|
--width;
|
||||||
|
|
||||||
|
int result = width * 256 / scale;
|
||||||
|
if (scaleVal >= 256)
|
||||||
|
++result;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ImageFrame::sDrawYOffset(int scaleVal) const {
|
||||||
|
int height = _offset.y;
|
||||||
|
int scale = scaleVal == 0 ? 1 : scaleVal;
|
||||||
|
|
||||||
|
if (scaleVal >= 256)
|
||||||
|
--height;
|
||||||
|
|
||||||
|
int result = height * 256 / scale;
|
||||||
|
if (scaleVal >= 256)
|
||||||
|
++result;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Sherlock
|
} // End of namespace Sherlock
|
||||||
|
|
|
@ -183,6 +183,16 @@ struct ImageFrame {
|
||||||
* Return the frame height adjusted by a specified scale amount
|
* Return the frame height adjusted by a specified scale amount
|
||||||
*/
|
*/
|
||||||
int sDrawYSize(int scaleVal) const;
|
int sDrawYSize(int scaleVal) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the frame offset x adjusted by a specified scale amount
|
||||||
|
*/
|
||||||
|
int sDrawXOffset(int scaleVal) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the frame offset y adjusted by a specified scale amount
|
||||||
|
*/
|
||||||
|
int sDrawYOffset(int scaleVal) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ImageFile : public Common::Array<ImageFrame> {
|
class ImageFile : public Common::Array<ImageFrame> {
|
||||||
|
|
|
@ -30,6 +30,93 @@ namespace Sherlock {
|
||||||
|
|
||||||
namespace Scalpel {
|
namespace Scalpel {
|
||||||
|
|
||||||
|
void ScalpelScene::drawAllShapes() {
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
Screen &screen = *_vm->_screen;
|
||||||
|
|
||||||
|
// Restrict drawing window
|
||||||
|
screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
|
||||||
|
|
||||||
|
// Draw all active shapes which are behind the person
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND)
|
||||||
|
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all canimations which are behind the person
|
||||||
|
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
||||||
|
if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == BEHIND)
|
||||||
|
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame,
|
||||||
|
_canimShapes[idx]._position, _canimShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all active shapes which are normal and behind the person
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND)
|
||||||
|
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all canimations which are normal and behind the person
|
||||||
|
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
||||||
|
if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == NORMAL_BEHIND)
|
||||||
|
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position,
|
||||||
|
_canimShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw any active characters
|
||||||
|
for (int idx = 0; idx < MAX_CHARACTERS; ++idx) {
|
||||||
|
Person &p = people[idx];
|
||||||
|
if (p._type == CHARACTER && p._walkLoaded) {
|
||||||
|
bool flipped = IS_SERRATED_SCALPEL && (
|
||||||
|
p._sequenceNumber == WALK_LEFT || p._sequenceNumber == STOP_LEFT ||
|
||||||
|
p._sequenceNumber == WALK_UPLEFT || p._sequenceNumber == STOP_UPLEFT ||
|
||||||
|
p._sequenceNumber == WALK_DOWNRIGHT || p._sequenceNumber == STOP_DOWNRIGHT);
|
||||||
|
|
||||||
|
screen._backBuffer->transBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER,
|
||||||
|
p._position.y / FIXED_INT_MULTIPLIER - p.frameHeight()), flipped);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all static and active shapes that are NORMAL and are in front of the player
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
|
||||||
|
_bgShapes[idx]._misc == NORMAL_FORWARD)
|
||||||
|
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
|
||||||
|
_bgShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all static and active canimations that are NORMAL and are in front of the player
|
||||||
|
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
||||||
|
if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) &&
|
||||||
|
_canimShapes[idx]._misc == NORMAL_FORWARD)
|
||||||
|
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position,
|
||||||
|
_canimShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all static and active shapes that are FORWARD
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
_bgShapes[idx]._oldPosition = _bgShapes[idx]._position;
|
||||||
|
_bgShapes[idx]._oldSize = Common::Point(_bgShapes[idx].frameWidth(),
|
||||||
|
_bgShapes[idx].frameHeight());
|
||||||
|
|
||||||
|
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
|
||||||
|
_bgShapes[idx]._misc == FORWARD)
|
||||||
|
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
|
||||||
|
_bgShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all static and active canimations that are forward
|
||||||
|
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
||||||
|
if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) &&
|
||||||
|
_canimShapes[idx]._misc == FORWARD)
|
||||||
|
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position,
|
||||||
|
_canimShapes[idx]._flags & OBJ_FLIPPED);
|
||||||
|
}
|
||||||
|
|
||||||
|
screen.resetDisplayBounds();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ScalpelScene::checkBgShapes() {
|
void ScalpelScene::checkBgShapes() {
|
||||||
People &people = *_vm->_people;
|
People &people = *_vm->_people;
|
||||||
Person &holmes = people._player;
|
Person &holmes = people._player;
|
||||||
|
|
|
@ -45,6 +45,11 @@ protected:
|
||||||
* colliding with another shape, it will also flag it as needing drawing
|
* colliding with another shape, it will also flag it as needing drawing
|
||||||
*/
|
*/
|
||||||
virtual void checkBgShapes();
|
virtual void checkBgShapes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw all the shapes, people and NPCs in the correct order
|
||||||
|
*/
|
||||||
|
virtual void drawAllShapes();
|
||||||
public:
|
public:
|
||||||
ScalpelScene(SherlockEngine *vm) : Scene(vm) {}
|
ScalpelScene(SherlockEngine *vm) : Scene(vm) {}
|
||||||
|
|
||||||
|
|
|
@ -892,92 +892,6 @@ void Scene::updateBackground() {
|
||||||
drawAllShapes();
|
drawAllShapes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::drawAllShapes() {
|
|
||||||
People &people = *_vm->_people;
|
|
||||||
Screen &screen = *_vm->_screen;
|
|
||||||
|
|
||||||
// Restrict drawing window
|
|
||||||
screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
|
|
||||||
|
|
||||||
// Draw all active shapes which are behind the person
|
|
||||||
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
|
||||||
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == BEHIND)
|
|
||||||
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all canimations which are behind the person
|
|
||||||
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
|
||||||
if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == BEHIND)
|
|
||||||
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame,
|
|
||||||
_canimShapes[idx]._position, _canimShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all active shapes which are normal and behind the person
|
|
||||||
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
|
||||||
if (_bgShapes[idx]._type == ACTIVE_BG_SHAPE && _bgShapes[idx]._misc == NORMAL_BEHIND)
|
|
||||||
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position, _bgShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all canimations which are normal and behind the person
|
|
||||||
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
|
||||||
if (_canimShapes[idx]._type == ACTIVE_BG_SHAPE && _canimShapes[idx]._misc == NORMAL_BEHIND)
|
|
||||||
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position,
|
|
||||||
_canimShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw any active characters
|
|
||||||
for (int idx = 0; idx < MAX_CHARACTERS; ++idx) {
|
|
||||||
Person &p = people[idx];
|
|
||||||
if (p._type == CHARACTER && p._walkLoaded) {
|
|
||||||
bool flipped = IS_SERRATED_SCALPEL && (
|
|
||||||
p._sequenceNumber == WALK_LEFT || p._sequenceNumber == STOP_LEFT ||
|
|
||||||
p._sequenceNumber == WALK_UPLEFT || p._sequenceNumber == STOP_UPLEFT ||
|
|
||||||
p._sequenceNumber == WALK_DOWNRIGHT || p._sequenceNumber == STOP_DOWNRIGHT);
|
|
||||||
|
|
||||||
screen._backBuffer->transBlitFrom(*p._imageFrame, Common::Point(p._position.x / FIXED_INT_MULTIPLIER,
|
|
||||||
p._position.y / FIXED_INT_MULTIPLIER - p.frameHeight()), flipped);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all static and active shapes that are NORMAL and are in front of the player
|
|
||||||
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
|
||||||
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
|
|
||||||
_bgShapes[idx]._misc == NORMAL_FORWARD)
|
|
||||||
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
|
|
||||||
_bgShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all static and active canimations that are NORMAL and are in front of the player
|
|
||||||
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
|
||||||
if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) &&
|
|
||||||
_canimShapes[idx]._misc == NORMAL_FORWARD)
|
|
||||||
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position,
|
|
||||||
_canimShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all static and active shapes that are FORWARD
|
|
||||||
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
|
||||||
_bgShapes[idx]._oldPosition = _bgShapes[idx]._position;
|
|
||||||
_bgShapes[idx]._oldSize = Common::Point(_bgShapes[idx].frameWidth(),
|
|
||||||
_bgShapes[idx].frameHeight());
|
|
||||||
|
|
||||||
if ((_bgShapes[idx]._type == ACTIVE_BG_SHAPE || _bgShapes[idx]._type == STATIC_BG_SHAPE) &&
|
|
||||||
_bgShapes[idx]._misc == FORWARD)
|
|
||||||
screen._backBuffer->transBlitFrom(*_bgShapes[idx]._imageFrame, _bgShapes[idx]._position,
|
|
||||||
_bgShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw all static and active canimations that are forward
|
|
||||||
for (uint idx = 0; idx < _canimShapes.size(); ++idx) {
|
|
||||||
if ((_canimShapes[idx]._type == ACTIVE_BG_SHAPE || _canimShapes[idx]._type == STATIC_BG_SHAPE) &&
|
|
||||||
_canimShapes[idx]._misc == FORWARD)
|
|
||||||
screen._backBuffer->transBlitFrom(*_canimShapes[idx]._imageFrame, _canimShapes[idx]._position,
|
|
||||||
_canimShapes[idx]._flags & OBJ_FLIPPED);
|
|
||||||
}
|
|
||||||
|
|
||||||
screen.resetDisplayBounds();
|
|
||||||
}
|
|
||||||
|
|
||||||
Exit *Scene::checkForExit(const Common::Rect &r) {
|
Exit *Scene::checkForExit(const Common::Rect &r) {
|
||||||
for (uint idx = 0; idx < _exits.size(); ++idx) {
|
for (uint idx = 0; idx < _exits.size(); ++idx) {
|
||||||
if (_exits[idx].intersects(r))
|
if (_exits[idx].intersects(r))
|
||||||
|
|
|
@ -196,7 +196,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Draw all the shapes, people and NPCs in the correct order
|
* Draw all the shapes, people and NPCs in the correct order
|
||||||
*/
|
*/
|
||||||
void drawAllShapes();
|
virtual void drawAllShapes() = 0;
|
||||||
|
|
||||||
Scene(SherlockEngine *vm);
|
Scene(SherlockEngine *vm);
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -92,18 +92,22 @@ void Surface::blitFrom(const Surface &src, const Common::Point &pt, const Common
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::transBlitFrom(const ImageFrame &src, const Common::Point &pt,
|
void Surface::transBlitFrom(const ImageFrame &src, const Common::Point &pt,
|
||||||
bool flipped, int overrideColor) {
|
bool flipped, int overrideColor, int scaleVal) {
|
||||||
transBlitFrom(src._frame, pt + src._offset, flipped, overrideColor);
|
transBlitFrom(src._frame, pt + src._offset, flipped, overrideColor, scaleVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::transBlitFrom(const Surface &src, const Common::Point &pt,
|
void Surface::transBlitFrom(const Surface &src, const Common::Point &pt,
|
||||||
bool flipped, int overrideColor) {
|
bool flipped, int overrideColor, int scaleVal) {
|
||||||
const Graphics::Surface &s = src._surface;
|
const Graphics::Surface &s = src._surface;
|
||||||
transBlitFrom(s, pt, flipped, overrideColor);
|
transBlitFrom(s, pt, flipped, overrideColor, scaleVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
|
void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
|
||||||
bool flipped, int overrideColor) {
|
bool flipped, int overrideColor, int scaleVal) {
|
||||||
|
if (scaleVal != 256) {
|
||||||
|
error("TODO: scaling for transBlitFrom");
|
||||||
|
}
|
||||||
|
|
||||||
Common::Rect drawRect(0, 0, src.w, src.h);
|
Common::Rect drawRect(0, 0, src.w, src.h);
|
||||||
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
|
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
|
||||||
|
|
||||||
|
|
|
@ -102,19 +102,19 @@ public:
|
||||||
* Draws an image frame at a given position within this surface with transparency
|
* Draws an image frame at a given position within this surface with transparency
|
||||||
*/
|
*/
|
||||||
void transBlitFrom(const ImageFrame &src, const Common::Point &pt,
|
void transBlitFrom(const ImageFrame &src, const Common::Point &pt,
|
||||||
bool flipped = false, int overrideColor = 0);
|
bool flipped = false, int overrideColor = 0, int scaleVal = 256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a surface at a given position within this surface with transparency
|
* Draws a surface at a given position within this surface with transparency
|
||||||
*/
|
*/
|
||||||
void transBlitFrom(const Surface &src, const Common::Point &pt,
|
void transBlitFrom(const Surface &src, const Common::Point &pt,
|
||||||
bool flipped = false, int overrideColor = 0);
|
bool flipped = false, int overrideColor = 0, int scaleVal = 256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a surface at a given position within this surface with transparency
|
* Draws a surface at a given position within this surface with transparency
|
||||||
*/
|
*/
|
||||||
void transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
|
void transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
|
||||||
bool flipped = false, int overrideColor = 0);
|
bool flipped = false, int overrideColor = 0, int scaleVal = 256);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fill a given area of the surface with a given color
|
* Fill a given area of the surface with a given color
|
||||||
|
|
|
@ -36,6 +36,172 @@ TattooScene::TattooScene(SherlockEngine *vm) : Scene(vm) {
|
||||||
_maskCounter = 0;
|
_maskCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct ShapeEntry {
|
||||||
|
Object *_shape;
|
||||||
|
Person *_person;
|
||||||
|
bool _isAnimation;
|
||||||
|
int _yp;
|
||||||
|
|
||||||
|
ShapeEntry(Person *person, int yp) : _shape(nullptr), _person(person), _yp(yp), _isAnimation(false) {}
|
||||||
|
ShapeEntry(Object *shape, int yp) : _shape(shape), _person(nullptr), _yp(yp), _isAnimation(false) {}
|
||||||
|
ShapeEntry(int yp) : _shape(nullptr), _person(nullptr), _yp(yp), _isAnimation(true) {}
|
||||||
|
int personNum;
|
||||||
|
};
|
||||||
|
typedef Common::List<ShapeEntry> ShapeList;
|
||||||
|
|
||||||
|
static bool sortImagesY(const ShapeEntry &s1, const ShapeEntry &s2) {
|
||||||
|
return s1._yp <= s2._yp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TattooScene::drawAllShapes() {
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
Screen &screen = *_vm->_screen;
|
||||||
|
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||||
|
ShapeList shapeList;
|
||||||
|
|
||||||
|
// Draw all objects and animations that are set to behind
|
||||||
|
screen.setDisplayBounds(Common::Rect(ui._currentScroll.x, 0, ui._currentScroll.x + SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCREEN_HEIGHT));
|
||||||
|
|
||||||
|
// Draw all active shapes which are behind the person
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
Object &obj = _bgShapes[idx];
|
||||||
|
|
||||||
|
if (obj._type == ACTIVE_BG_SHAPE && obj._misc == BEHIND) {
|
||||||
|
if (obj._quickDraw && obj._scaleVal == 256)
|
||||||
|
screen._backBuffer1.blitFrom(*obj._imageFrame, obj._position);
|
||||||
|
else
|
||||||
|
screen._backBuffer1.transBlitFrom(*obj._imageFrame, obj._position, obj._flags & OBJ_FLIPPED, 0, obj._scaleVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the animation if it is behind the person
|
||||||
|
if (_activeCAnim._imageFrame != nullptr && _activeCAnim._zPlacement == BEHIND)
|
||||||
|
screen._backBuffer1.transBlitFrom(*_activeCAnim._imageFrame, _activeCAnim._position,
|
||||||
|
(_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal);
|
||||||
|
|
||||||
|
screen.setDisplayBounds(Common::Rect(0, 0, screen._backBuffer1.w(), screen._backBuffer1.h()));
|
||||||
|
|
||||||
|
// Queue drawing of all objects that are set to NORMAL.
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
Object &obj = _bgShapes[idx];
|
||||||
|
|
||||||
|
if (obj._type == ACTIVE_BG_SHAPE && (obj._misc == NORMAL_BEHIND || obj._misc == NORMAL_FORWARD)) {
|
||||||
|
if (obj._scaleVal == 256)
|
||||||
|
shapeList.push_back(ShapeEntry(&obj, obj._position.y + obj._imageFrame->_offset.y +
|
||||||
|
obj._imageFrame->_height));
|
||||||
|
else
|
||||||
|
shapeList.push_back(ShapeEntry(&obj, obj._position.y + obj._imageFrame->sDrawYOffset(obj._scaleVal) +
|
||||||
|
obj._imageFrame->sDrawYSize(obj._scaleVal)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Queue drawing the animation if it is NORMAL and can fall in front of, or behind the people
|
||||||
|
if (_activeCAnim._imageFrame != nullptr && (_activeCAnim._zPlacement == NORMAL_BEHIND) || _activeCAnim._zPlacement == NORMAL_FORWARD) {
|
||||||
|
if (_activeCAnim._scaleVal == 256)
|
||||||
|
if (_activeCAnim._scaleVal == 256)
|
||||||
|
shapeList.push_back(ShapeEntry(_activeCAnim._position.y + _activeCAnim._imageFrame->_offset.y +
|
||||||
|
_activeCAnim._imageFrame->_height));
|
||||||
|
else
|
||||||
|
shapeList.push_back(ShapeEntry(_activeCAnim._position.y + _activeCAnim._imageFrame->sDrawYOffset(_activeCAnim._scaleVal) +
|
||||||
|
_activeCAnim._imageFrame->sDrawYSize(_activeCAnim._scaleVal)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Queue all active characters for drawing
|
||||||
|
for (uint idx = 0; idx < MAX_CHARACTERS; ++idx) {
|
||||||
|
if (people[idx]._type == CHARACTER && people[idx]._walkLoaded)
|
||||||
|
shapeList.push_back(ShapeEntry(&people[idx], people[idx]._position.y / FIXED_INT_MULTIPLIER));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the list
|
||||||
|
Common::sort(shapeList.begin(), shapeList.end(), sortImagesY);
|
||||||
|
|
||||||
|
// Draw the list of shapes in order
|
||||||
|
for (ShapeList::iterator i = shapeList.begin(); i != shapeList.end(); ++i) {
|
||||||
|
ShapeEntry &se = *i;
|
||||||
|
|
||||||
|
if (se._shape) {
|
||||||
|
// it's a bg shape
|
||||||
|
if (se._shape->_quickDraw && se._shape->_scaleVal == 256)
|
||||||
|
screen._backBuffer1.blitFrom(*se._shape->_imageFrame, se._shape->_position);
|
||||||
|
else
|
||||||
|
screen._backBuffer1.transBlitFrom(*se._shape->_imageFrame, se._shape->_position,
|
||||||
|
se._shape->_flags & OBJ_FLIPPED, 0, se._shape->_scaleVal);
|
||||||
|
} else if (se._isAnimation) {
|
||||||
|
// It's an active animation
|
||||||
|
screen._backBuffer1.transBlitFrom(*_activeCAnim._imageFrame, _activeCAnim._position,
|
||||||
|
(_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal);
|
||||||
|
} else {
|
||||||
|
// Drawing person
|
||||||
|
Person &p = *se._person;
|
||||||
|
|
||||||
|
p._tempX = p._position.x / FIXED_INT_MULTIPLIER;
|
||||||
|
p._tempScaleVal = getScaleVal(p._position);
|
||||||
|
Common::Point adjust = p._adjust;
|
||||||
|
|
||||||
|
if (p._tempScaleVal == 256) {
|
||||||
|
p._tempX += adjust.x;
|
||||||
|
screen._backBuffer1.transBlitFrom(*p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER
|
||||||
|
- p.frameHeight() - adjust.y), p._walkSequences[p._sequenceNumber]._horizFlip, 0, p._tempScaleVal);
|
||||||
|
} else {
|
||||||
|
if (adjust.x) {
|
||||||
|
if (!p._tempScaleVal)
|
||||||
|
++p._tempScaleVal;
|
||||||
|
|
||||||
|
if (p._tempScaleVal >= 256 && adjust.x)
|
||||||
|
--adjust.x;
|
||||||
|
|
||||||
|
adjust.x = adjust.x * 256 / p._tempScaleVal;
|
||||||
|
|
||||||
|
if (p._tempScaleVal >= 256)
|
||||||
|
++adjust.x;
|
||||||
|
p._tempX += adjust.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (adjust.y)
|
||||||
|
{
|
||||||
|
if (!p._tempScaleVal)
|
||||||
|
p._tempScaleVal++;
|
||||||
|
|
||||||
|
if (p._tempScaleVal >= 256 && adjust.y)
|
||||||
|
--adjust.y;
|
||||||
|
|
||||||
|
adjust.y = adjust.y * 256 / p._tempScaleVal;
|
||||||
|
|
||||||
|
if (p._tempScaleVal >= 256)
|
||||||
|
++adjust.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
screen._backBuffer1.transBlitFrom(*p._imageFrame, Common::Point(p._tempX, p._position.y / FIXED_INT_MULTIPLIER
|
||||||
|
- p._imageFrame->sDrawYSize(p._tempScaleVal) - adjust.y), p._walkSequences[p._sequenceNumber]._horizFlip, 0, p._tempScaleVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw all objects & canimations that are set to FORWARD.
|
||||||
|
// Draw all static and active shapes that are FORWARD
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
Object &obj = _bgShapes[idx];
|
||||||
|
|
||||||
|
if (obj._type == ACTIVE_BG_SHAPE && obj._misc == FORWARD) {
|
||||||
|
if (obj._quickDraw && obj._scaleVal == 256)
|
||||||
|
screen._backBuffer1.blitFrom(*obj._imageFrame, obj._position);
|
||||||
|
else
|
||||||
|
screen._backBuffer1.transBlitFrom(*obj._imageFrame, obj._position, obj._flags & OBJ_FLIPPED, 0, obj._scaleVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw the canimation if it is set as FORWARD
|
||||||
|
if (_activeCAnim._imageFrame != nullptr && _activeCAnim._zPlacement == FORWARD)
|
||||||
|
screen._backBuffer1.transBlitFrom(*_activeCAnim._imageFrame, _activeCAnim._position, (_activeCAnim._flags & 4) >> 1, 0, _activeCAnim._scaleVal);
|
||||||
|
|
||||||
|
// Draw all NO_SHAPE shapes which have their flag bits clear
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
Object &obj = _bgShapes[idx];
|
||||||
|
if (obj._type == NO_SHAPE && (obj._flags & 1) == 0)
|
||||||
|
screen._backBuffer1.fillRect(obj.getNoShapeBounds(), 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TattooScene::checkBgShapes() {
|
void TattooScene::checkBgShapes() {
|
||||||
People &people = *_vm->_people;
|
People &people = *_vm->_people;
|
||||||
Person &holmes = people._player;
|
Person &holmes = people._player;
|
||||||
|
@ -491,6 +657,11 @@ void TattooScene::doBgAnimDrawSprites() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int TattooScene::getScaleVal(const Common::Point &pt) {
|
||||||
|
error("TODO: getScaleVal");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // End of namespace Tattoo
|
} // End of namespace Tattoo
|
||||||
|
|
||||||
} // End of namespace Sherlock
|
} // End of namespace Sherlock
|
||||||
|
|
|
@ -46,6 +46,12 @@ private:
|
||||||
void doBgAnimUpdateBgObjectsAndAnim();
|
void doBgAnimUpdateBgObjectsAndAnim();
|
||||||
|
|
||||||
void doBgAnimDrawSprites();
|
void doBgAnimDrawSprites();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the scale value for the passed co-ordinates. This is taken from the scene's
|
||||||
|
* scale zones, interpolating inbetween the top and bottom values of the zones as needed
|
||||||
|
*/
|
||||||
|
int getScaleVal(const Common::Point &pt);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Checks all the background shapes. If a background shape is animating,
|
* Checks all the background shapes. If a background shape is animating,
|
||||||
|
@ -53,6 +59,11 @@ protected:
|
||||||
* colliding with another shape, it will also flag it as needing drawing
|
* colliding with another shape, it will also flag it as needing drawing
|
||||||
*/
|
*/
|
||||||
virtual void checkBgShapes();
|
virtual void checkBgShapes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw all the shapes, people and NPCs in the correct order
|
||||||
|
*/
|
||||||
|
virtual void drawAllShapes();
|
||||||
public:
|
public:
|
||||||
ImageFile *_mask, *_mask1;
|
ImageFile *_mask, *_mask1;
|
||||||
CAnimStream _activeCAnim;
|
CAnimStream _activeCAnim;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue