diff options
author | Eugene Sandulenko | 2019-11-07 00:35:38 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-13 22:07:08 +0100 |
commit | 356e4014a7f7deb07d540d38bdfa5e31dd6e2090 (patch) | |
tree | 357f5c4b865c7d28bbc5ae69ce198c67928db572 | |
parent | 8ad0a0fd6aa436803a57f7e2219aa328c1f073d1 (diff) | |
download | scummvm-rg350-356e4014a7f7deb07d540d38bdfa5e31dd6e2090.tar.gz scummvm-rg350-356e4014a7f7deb07d540d38bdfa5e31dd6e2090.tar.bz2 scummvm-rg350-356e4014a7f7deb07d540d38bdfa5e31dd6e2090.zip |
GRIFFON: Implemented Player::reset()
-rw-r--r-- | engines/griffon/engine.cpp | 59 | ||||
-rw-r--r-- | engines/griffon/griffon.h | 2 |
2 files changed, 34 insertions, 27 deletions
diff --git a/engines/griffon/engine.cpp b/engines/griffon/engine.cpp index 7a270312dc..6dfb422b6e 100644 --- a/engines/griffon/engine.cpp +++ b/engines/griffon/engine.cpp @@ -41,6 +41,36 @@ namespace Griffon { +void Player::reset() { + px = 0; + py = 0; + opx = 0; + opy = 0; + walkDir = 0; + walkFrame = 0; + walkSpeed = 0; + attackFrame = 0; + attackSpeed = 0; + hp = 0; + maxHp = 0; + hpflash = 0; + level = 0; + maxLevel = 0; + sword = 0; + shield = 0; + armour = 0; + for (int i = 0; i < 5; i++) { + foundSpell[i] = 0; + spellCharge[i] = 0; + inventory[i] = 0; + } + attackStrength = 0; + spellDamage = 0; + swordDamage = 0; + exp = 0; + nextLevel = 0; +} + // copypaste from hRnd_CRT() float GriffonEngine::RND() { /* return between 0 and 1 (but never 1) */ @@ -260,33 +290,8 @@ void GriffonEngine::newGame() { if (_shouldQuit) return; - _player.px = 0; - _player.py = 0; - _player.opx = 0; - _player.opy = 0; - _player.walkDir = 0; - _player.walkFrame = 0; - _player.walkSpeed = 0; - _player.attackFrame = 0; - _player.attackSpeed = 0; - _player.hp = 0; - _player.maxHp = 0; - _player.hpflash = 0; - _player.level = 0; - _player.maxLevel = 0; - _player.sword = 0; - _player.shield = 0; - _player.armour = 0; - for (int i = 0; i < 5; i++) { - _player.foundSpell[i] = 0; - _player.spellCharge[i] = 0; - _player.inventory[i] = 0; - } - _player.attackStrength = 0; - _player.spellDamage = 0; - _player.swordDamage = 0; - _player.exp = 0; - _player.nextLevel = 0; + _player.reset(); + _playera.reset(); memset(_scriptFlag, 0, sizeof(_scriptFlag)); memset(_objectMapFull, 0, sizeof(_objectMapFull)); diff --git a/engines/griffon/griffon.h b/engines/griffon/griffon.h index 6973387b7b..ab70030090 100644 --- a/engines/griffon/griffon.h +++ b/engines/griffon/griffon.h @@ -167,6 +167,8 @@ struct Player { float itemselshade; int ysort; + + void reset(); }; struct BodySection { |