diff options
author | Paul Gilbert | 2015-02-14 07:32:38 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-02-14 07:32:38 -0500 |
commit | b79d552c060b869a2f22727b4b7238294bc05943 (patch) | |
tree | 572af5b2d2e1fd47bc2623154cb3a930b22c1110 /engines/xeen/dialogs_party.cpp | |
parent | 9b0b0cd9e747780ec32a3589343f0172c0237aa0 (diff) | |
download | scummvm-rg350-b79d552c060b869a2f22727b4b7238294bc05943.tar.gz scummvm-rg350-b79d552c060b869a2f22727b4b7238294bc05943.tar.bz2 scummvm-rg350-b79d552c060b869a2f22727b4b7238294bc05943.zip |
XEEN: Implemented drawDice
Diffstat (limited to 'engines/xeen/dialogs_party.cpp')
-rw-r--r-- | engines/xeen/dialogs_party.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/engines/xeen/dialogs_party.cpp b/engines/xeen/dialogs_party.cpp index b570612ff4..7414ce3404 100644 --- a/engines/xeen/dialogs_party.cpp +++ b/engines/xeen/dialogs_party.cpp @@ -395,6 +395,16 @@ void PartyDialog::createChar() { dice.load("dice.vga"); icons.load("create.raw"); + _dicePos[0] = Common::Point(20, 17); + _dicePos[1] = Common::Point(112, 35); + _dicePos[2] = Common::Point(61, 50); + _diceFrame[0] = 0; + _diceFrame[1] = 2; + _diceFrame[2] = 4; + _diceInc[0] = Common::Point(10, -10); + _diceInc[1] = Common::Point(-10, -10); + _diceInc[2] = Common::Point(-10, 10); + // Add buttons saveButtons(); addButton(Common::Rect(132, 98, 156, 118), Common::KEYCODE_r, &icons); @@ -867,7 +877,38 @@ void PartyDialog::printSelectionArrow(SpriteResource &icons, int selectedClass) * Print the dice animation */ void PartyDialog::drawDice(SpriteResource &dice) { - error("TODO: drawDice"); + EventsManager &events = *_vm->_events; + Window &w = _vm->_screen->_windows[32]; + dice.draw(w, 7, Common::Point(12, 11)); + + for (int diceNum = 0; diceNum < 3; ++diceNum) { + _diceFrame[diceNum] = (_diceFrame[diceNum] + 1) % 7; + _dicePos[diceNum] += _diceInc[diceNum]; + + if (_dicePos[diceNum].x < 13) { + _dicePos[diceNum].x = 13; + _diceInc[diceNum].x *= -1; + } else if (_dicePos[diceNum].x >= 163) { + _dicePos[diceNum].x = 163; + _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; + _diceInc[diceNum].y *= -1; + } + + dice.draw(w, _diceFrame[diceNum], _dicePos[diceNum]); + } + + w.update(); + + // Wait for keypress + events.wait(1, true); + checkEvents(_vm); } /** |