[Scummvm-git-logs] scummvm master -> c5981a1fad9c107e05d0a66eb42305823481863b
dreammaster
dreammaster at scummvm.org
Sun Feb 18 05:11:40 CET 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c5981a1fad XEEN: Fix dice animation in Create Character dialog
Commit: c5981a1fad9c107e05d0a66eb42305823481863b
https://github.com/scummvm/scummvm/commit/c5981a1fad9c107e05d0a66eb42305823481863b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-02-17T23:11:43-05:00
Commit Message:
XEEN: Fix dice animation in Create Character dialog
Changed paths:
engines/xeen/dialogs_party.cpp
engines/xeen/sprites.cpp
engines/xeen/sprites.h
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp
index de80a29..12d8074 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 72af511..2959d87 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 4c4a230..ce04c25 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(); }
More information about the Scummvm-git-logs
mailing list