mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-22 01:57:16 +00:00
XEEN: Fix dice animation in Create Character dialog
This commit is contained in:
parent
9c2e71fd52
commit
c5981a1fad
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -159,6 +159,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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user