mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
SHERLOCK: Implement remainder of RT doBgAnim
This commit is contained in:
parent
c79b0d1db9
commit
6b8452538f
@ -364,6 +364,10 @@ void Sprite::checkSprite() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Common::Rect Sprite::getOldBounds() const {
|
||||||
|
return Common::Rect(_oldPosition.x, _oldPosition.y, _oldPosition.x + _oldSize.x, _oldPosition.y + _oldSize.y);
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
void WalkSequence::load(Common::SeekableReadStream &s) {
|
void WalkSequence::load(Common::SeekableReadStream &s) {
|
||||||
|
@ -242,6 +242,11 @@ public:
|
|||||||
* Return frame height
|
* Return frame height
|
||||||
*/
|
*/
|
||||||
int frameHeight() const { return _imageFrame ? _imageFrame->_frame.h : 0; }
|
int frameHeight() const { return _imageFrame ? _imageFrame->_frame.h : 0; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the old bounsd for the sprite from the previous frame
|
||||||
|
*/
|
||||||
|
const Common::Rect getOldBounds() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { OBJ_BEHIND = 1, OBJ_FLIPPED = 2, OBJ_FORWARD = 4, TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 };
|
enum { OBJ_BEHIND = 1, OBJ_FLIPPED = 2, OBJ_FORWARD = 4, TURNON_OBJ = 0x20, TURNOFF_OBJ = 0x40 };
|
||||||
|
@ -79,6 +79,10 @@ void Person::clearNPC() {
|
|||||||
_npcName = "";
|
_npcName = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Person::updateNPC() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
|
||||||
People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) {
|
People::People(SherlockEngine *vm) : _vm(vm), _player(_data[0]) {
|
||||||
|
@ -76,6 +76,7 @@ public:
|
|||||||
Common::String _npcName;
|
Common::String _npcName;
|
||||||
int _tempX;
|
int _tempX;
|
||||||
int _tempScaleVal;
|
int _tempScaleVal;
|
||||||
|
bool _updateNPCPath;
|
||||||
|
|
||||||
// Rose Tattoo fields
|
// Rose Tattoo fields
|
||||||
Common::String _walkVGSName; // Name of walk library person is using
|
Common::String _walkVGSName; // Name of walk library person is using
|
||||||
@ -86,6 +87,11 @@ public:
|
|||||||
* Clear the NPC related data
|
* Clear the NPC related data
|
||||||
*/
|
*/
|
||||||
void clearNPC();
|
void clearNPC();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the NPC
|
||||||
|
*/
|
||||||
|
void updateNPC();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SherlockEngine;
|
class SherlockEngine;
|
||||||
|
@ -306,6 +306,18 @@ void Screen::flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *
|
|||||||
*height = newBounds.height();
|
*height = newBounds.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Screen::flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal) {
|
||||||
|
Common::Point newPos, newSize;
|
||||||
|
|
||||||
|
if (scaleVal == 256)
|
||||||
|
flushImage(frame, pt, &newPos.x, &newPos.y, &newSize.x, &newSize.y);
|
||||||
|
else
|
||||||
|
flushScaleImage(frame, pt, &newPos.x, &newPos.y, &newSize.x, &newSize.y, scaleVal);
|
||||||
|
|
||||||
|
// Transfer the pos and size amounts into a single bounds rect
|
||||||
|
newBounds = Common::Rect(newPos.x, newPos.y, newPos.x + newSize.x, newPos.y + newSize.y);
|
||||||
|
}
|
||||||
|
|
||||||
void Screen::blockMove(const Common::Rect &r, const Common::Point &scrollPos) {
|
void Screen::blockMove(const Common::Rect &r, const Common::Point &scrollPos) {
|
||||||
Common::Rect bounds = r;
|
Common::Rect bounds = r;
|
||||||
bounds.translate(scrollPos.x, scrollPos.y);
|
bounds.translate(scrollPos.x, scrollPos.y);
|
||||||
|
@ -189,6 +189,11 @@ public:
|
|||||||
void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
|
void flushScaleImage(ImageFrame *frame, const Common::Point &pt, int16 *xp, int16 *yp,
|
||||||
int16 *width, int16 *height, int scaleVal);
|
int16 *width, int16 *height, int scaleVal);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Variation of flushImage/flushScaleImage that takes in and updates a rect
|
||||||
|
*/
|
||||||
|
void flushImage(ImageFrame *frame, const Common::Point &pt, Common::Rect &newBounds, int scaleVal);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies data from the back buffer to the screen, taking into account scrolling position
|
* Copies data from the back buffer to the screen, taking into account scrolling position
|
||||||
*/
|
*/
|
||||||
|
@ -50,6 +50,7 @@ SherlockEngine::SherlockEngine(OSystem *syst, const SherlockGameDescription *gam
|
|||||||
_canLoadSave = false;
|
_canLoadSave = false;
|
||||||
_showOriginalSavesDialog = false;
|
_showOriginalSavesDialog = false;
|
||||||
_interactiveFl = true;
|
_interactiveFl = true;
|
||||||
|
_fastMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SherlockEngine::~SherlockEngine() {
|
SherlockEngine::~SherlockEngine() {
|
||||||
|
@ -123,6 +123,7 @@ public:
|
|||||||
bool _canLoadSave;
|
bool _canLoadSave;
|
||||||
bool _showOriginalSavesDialog;
|
bool _showOriginalSavesDialog;
|
||||||
bool _interactiveFl;
|
bool _interactiveFl;
|
||||||
|
bool _fastMode;
|
||||||
public:
|
public:
|
||||||
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
|
SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
|
||||||
virtual ~SherlockEngine();
|
virtual ~SherlockEngine();
|
||||||
|
@ -72,6 +72,10 @@ void TattooEngine::drawCredits() {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TattooEngine::blitCredits() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void TattooEngine::eraseCredits() {
|
void TattooEngine::eraseCredits() {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void drawCredits();
|
void drawCredits();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blit the drawn credits to the screen
|
||||||
|
*/
|
||||||
|
void blitCredits();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Erase any area of the screen covered by credits
|
* Erase any area of the screen covered by credits
|
||||||
*/
|
*/
|
||||||
|
@ -196,15 +196,15 @@ void TattooScene::doBgAnimEraseBackground() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TattooScene::doBgAnim() {
|
void TattooScene::doBgAnim() {
|
||||||
|
TattooEngine &vm = *(TattooEngine *)_vm;
|
||||||
|
Events &events = *_vm->_events;
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
Screen &screen = *_vm->_screen;
|
||||||
|
Talk &talk = *_vm->_talk;
|
||||||
TattooUserInterface &ui = *((TattooUserInterface *)_vm->_ui);
|
TattooUserInterface &ui = *((TattooUserInterface *)_vm->_ui);
|
||||||
|
|
||||||
doBgAnimCheckCursor();
|
doBgAnimCheckCursor();
|
||||||
|
|
||||||
// Events &events = *_vm->_events;
|
|
||||||
People &people = *_vm->_people;
|
|
||||||
// Scene &scene = *_vm->_scene;
|
|
||||||
Screen &screen = *_vm->_screen;
|
|
||||||
Talk &talk = *_vm->_talk;
|
|
||||||
|
|
||||||
screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
|
screen.setDisplayBounds(Common::Rect(0, 0, SHERLOCK_SCREEN_WIDTH, SHERLOCK_SCENE_HEIGHT));
|
||||||
talk._talkToAbort = false;
|
talk._talkToAbort = false;
|
||||||
@ -226,6 +226,23 @@ void TattooScene::doBgAnim() {
|
|||||||
doBgAnimUpdateBgObjectsAndAnim();
|
doBgAnimUpdateBgObjectsAndAnim();
|
||||||
|
|
||||||
ui.drawInterface();
|
ui.drawInterface();
|
||||||
|
|
||||||
|
doBgAnimDrawSprites();
|
||||||
|
|
||||||
|
if (vm._creditsActive)
|
||||||
|
vm.blitCredits();
|
||||||
|
|
||||||
|
if (!vm._fastMode)
|
||||||
|
events.wait(3);
|
||||||
|
|
||||||
|
screen._flushScreen = false;
|
||||||
|
_doBgAnimDone = false;
|
||||||
|
ui._drawMenu = false;
|
||||||
|
|
||||||
|
for (uint idx = 1; idx < MAX_CHARACTERS; ++idx) {
|
||||||
|
if (people[idx]._updateNPCPath)
|
||||||
|
people[idx].updateNPC();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TattooScene::doBgAnimUpdateBgObjectsAndAnim() {
|
void TattooScene::doBgAnimUpdateBgObjectsAndAnim() {
|
||||||
@ -288,7 +305,6 @@ void TattooScene::doBgAnimUpdateBgObjectsAndAnim() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TattooScene::updateBackground() {
|
void TattooScene::updateBackground() {
|
||||||
People &people = *_vm->_people;
|
People &people = *_vm->_people;
|
||||||
Screen &screen = *_vm->_screen;
|
Screen &screen = *_vm->_screen;
|
||||||
@ -397,6 +413,83 @@ void TattooScene::updateBackground() {
|
|||||||
screen._flushScreen = false;
|
screen._flushScreen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TattooScene::doBgAnimDrawSprites() {
|
||||||
|
People &people = *_vm->_people;
|
||||||
|
Screen &screen = *_vm->_screen;
|
||||||
|
TattooUserInterface &ui = *(TattooUserInterface *)_vm->_ui;
|
||||||
|
|
||||||
|
for (uint idx = 0; idx < MAX_CHARACTERS; ++idx) {
|
||||||
|
Person &person = people[idx];
|
||||||
|
|
||||||
|
if (person._type != INVALID) {
|
||||||
|
if (_goToScene == -1 || _cAnim.size() == 0) {
|
||||||
|
if (person._type == REMOVE) {
|
||||||
|
screen.slamRect(person.getOldBounds());
|
||||||
|
person._type = INVALID;
|
||||||
|
} else {
|
||||||
|
if (person._tempScaleVal == 256) {
|
||||||
|
screen.flushImage(person._imageFrame, Common::Point(person._tempX, person._position.y / FIXED_INT_MULTIPLIER
|
||||||
|
- person.frameHeight()), &person._oldPosition.x, &person._oldPosition.y, &person._oldSize.x, &person._oldSize.y);
|
||||||
|
} else {
|
||||||
|
int ts = person._imageFrame->sDrawYSize(person._tempScaleVal);
|
||||||
|
int ty = person._position.y / FIXED_INT_MULTIPLIER - ts;
|
||||||
|
screen.flushScaleImage(person._imageFrame, Common::Point(person._tempX, ty),
|
||||||
|
&person._oldPosition.x, &person._oldPosition.y, &person._oldSize.x, &person._oldSize.y, person._tempScaleVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
Object &obj = _bgShapes[idx];
|
||||||
|
|
||||||
|
if (obj._type == ACTIVE_BG_SHAPE || obj._type == REMOVE) {
|
||||||
|
if (_goToScene == -1) {
|
||||||
|
if (obj._scaleVal == 256)
|
||||||
|
screen.flushImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
|
||||||
|
&obj._oldSize.x, &obj._oldSize.y);
|
||||||
|
else
|
||||||
|
screen.flushScaleImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
|
||||||
|
&obj._oldSize.x, &obj._oldSize.y, obj._scaleVal);
|
||||||
|
|
||||||
|
if (obj._type == REMOVE)
|
||||||
|
obj._type = INVALID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint idx = 0; idx < _bgShapes.size(); ++idx) {
|
||||||
|
Object &obj = _bgShapes[idx];
|
||||||
|
|
||||||
|
if (_goToScene == -1) {
|
||||||
|
if (obj._type == NO_SHAPE && (obj._flags & 1) == 0) {
|
||||||
|
screen.slamRect(obj.getNoShapeBounds());
|
||||||
|
screen.slamRect(obj.getOldBounds());
|
||||||
|
} else if (obj._type == HIDE_SHAPE) {
|
||||||
|
if (obj._scaleVal == 256)
|
||||||
|
screen.flushImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
|
||||||
|
&obj._oldSize.x, &obj._oldSize.y);
|
||||||
|
else
|
||||||
|
screen.flushScaleImage(obj._imageFrame, obj._position, &obj._oldPosition.x, &obj._oldPosition.y,
|
||||||
|
&obj._oldSize.x, &obj._oldSize.y, obj._scaleVal);
|
||||||
|
obj._type = HIDDEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_activeCAnim._images != nullptr || _activeCAnim._zPlacement == REMOVE) {
|
||||||
|
if (_activeCAnim._zPlacement != REMOVE) {
|
||||||
|
screen.flushImage(_activeCAnim._imageFrame, _activeCAnim._position, _activeCAnim._oldBounds, _activeCAnim._scaleVal);
|
||||||
|
} else {
|
||||||
|
screen.slamArea(_activeCAnim._removeBounds.left - ui._currentScroll.x, _activeCAnim._removeBounds.top,
|
||||||
|
_activeCAnim._removeBounds.width(), _activeCAnim._removeBounds.height());
|
||||||
|
_activeCAnim._removeBounds.left = _activeCAnim._removeBounds.top = 0;
|
||||||
|
_activeCAnim._removeBounds.right = _activeCAnim._removeBounds.bottom = 0;
|
||||||
|
_activeCAnim._zPlacement = -1; // Reset _zPlacement so we don't REMOVE again
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Tattoo
|
} // End of namespace Tattoo
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ private:
|
|||||||
* Update the background objects and canimations as part of doBgAnim
|
* Update the background objects and canimations as part of doBgAnim
|
||||||
*/
|
*/
|
||||||
void doBgAnimUpdateBgObjectsAndAnim();
|
void doBgAnimUpdateBgObjectsAndAnim();
|
||||||
|
|
||||||
|
void doBgAnimDrawSprites();
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Checks all the background shapes. If a background shape is animating,
|
* Checks all the background shapes. If a background shape is animating,
|
||||||
|
@ -34,6 +34,7 @@ TattooUserInterface::TattooUserInterface(SherlockEngine *vm): UserInterface(vm)
|
|||||||
_tagBuffer = nullptr;
|
_tagBuffer = nullptr;
|
||||||
_invGraphic = nullptr;
|
_invGraphic = nullptr;
|
||||||
_scrollSize = _scrollSpeed = 0;
|
_scrollSize = _scrollSpeed = 0;
|
||||||
|
_drawMenu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TattooUserInterface::initScrollVars() {
|
void TattooUserInterface::initScrollVars() {
|
||||||
|
@ -53,6 +53,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
Common::Point _currentScroll, _targetScroll;
|
Common::Point _currentScroll, _targetScroll;
|
||||||
int _scrollSize, _scrollSpeed;
|
int _scrollSize, _scrollSpeed;
|
||||||
|
bool _drawMenu;
|
||||||
public:
|
public:
|
||||||
TattooUserInterface(SherlockEngine *vm);
|
TattooUserInterface(SherlockEngine *vm);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user