aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-02-17 23:11:43 -0500
committerPaul Gilbert2018-02-17 23:11:43 -0500
commitc5981a1fad9c107e05d0a66eb42305823481863b (patch)
treec0ce1897cab1e4db56b04bbf3c946150d23736e2 /engines
parent9c2e71fd52ba49e60f0a47b4b01058db96767ec2 (diff)
downloadscummvm-rg350-c5981a1fad9c107e05d0a66eb42305823481863b.tar.gz
scummvm-rg350-c5981a1fad9c107e05d0a66eb42305823481863b.tar.bz2
scummvm-rg350-c5981a1fad9c107e05d0a66eb42305823481863b.zip
XEEN: Fix dice animation in Create Character dialog
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/dialogs_party.cpp13
-rw-r--r--engines/xeen/sprites.cpp18
-rw-r--r--engines/xeen/sprites.h5
3 files changed, 31 insertions, 5 deletions
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index de80a299e3..12d807488c 100644
--- a/engines/xeen/dialogs_party.cpp
+++ b/engines/xeen/dialogs_party.cpp
@@ -461,7 +461,7 @@ void PartyDialog::createChar() {
// Get the display of the rolled character details
selectedClass = newCharDetails(attribs, allowedClasses,
race, sex, classId, selectedClass, details);
- Common::String msg = Common::String::format(Res.CREATE_CHAR_DETAILS,
+ msg = Common::String::format(Res.CREATE_CHAR_DETAILS,
details.c_str());
// Draw the screen
@@ -867,6 +867,9 @@ void PartyDialog::drawDice(SpriteResource &dice) {
EventsManager &events = *_vm->_events;
Windows &windows = *_vm->_windows;
Window &w = windows[32];
+ Common::Point diceSize = dice.getFrameSize(0);
+
+ events.updateGameCounter();
dice.draw(w, 7, Common::Point(12, 11));
for (int diceNum = 0; diceNum < 3; ++diceNum) {
@@ -876,16 +879,16 @@ void PartyDialog::drawDice(SpriteResource &dice) {
if (_dicePos[diceNum].x < 13) {
_dicePos[diceNum].x = 13;
_diceInc[diceNum].x *= -1;
- } else if (_dicePos[diceNum].x >= 163) {
- _dicePos[diceNum].x = 163;
+ } else if (_dicePos[diceNum].x >= (163 - diceSize.x)) {
+ _dicePos[diceNum].x = 163 - diceSize.x;
_diceInc[diceNum].x *= -1;
}
if (_dicePos[diceNum].y < 12) {
_dicePos[diceNum].y = 12;
_diceInc[diceNum].y *= -1;
- } else if (_dicePos[diceNum].y >= 93) {
- _dicePos[diceNum].y = 93;
+ } else if (_dicePos[diceNum].y >= (93 - diceSize.y)) {
+ _dicePos[diceNum].y = 93 - diceSize.y;
_diceInc[diceNum].y *= -1;
}
diff --git a/engines/xeen/sprites.cpp b/engines/xeen/sprites.cpp
index 72af511d5e..2959d87b3d 100644
--- a/engines/xeen/sprites.cpp
+++ b/engines/xeen/sprites.cpp
@@ -350,4 +350,22 @@ uint SpriteResource::getScaledVal(int xy, uint16 &scaleMask) {
return result;
}
+Common::Point SpriteResource::getFrameSize(int frame) const {
+ Common::MemoryReadStream f(_data, _filesize);
+ Common::Point size;
+
+ for (int idx = 0; idx < (_index[frame]._offset2 ? 2 : 1); ++idx) {
+ f.seek((idx == 0) ? _index[frame]._offset1 : _index[frame]._offset2);
+ int xOffset = f.readUint16LE();
+ int width = f.readUint16LE();
+ int yOffset = f.readUint16LE();
+ int height = f.readUint16LE();
+
+ size.x = MAX((int)size.x, xOffset + width);
+ size.y = MAX((int)size.y, yOffset + height);
+ }
+
+ return size;
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/sprites.h b/engines/xeen/sprites.h
index 4c4a230b2e..ce04c254d4 100644
--- a/engines/xeen/sprites.h
+++ b/engines/xeen/sprites.h
@@ -160,6 +160,11 @@ public:
void draw(int windowIndex, int frame);
/**
+ * Gets the size of a sprite
+ */
+ Common::Point getFrameSize(int frame) const;
+
+ /**
* Returns the number of frames the sprite resource has
*/
size_t size() const { return _index.size(); }