diff options
-rw-r--r-- | engines/fullpipe/messagehandlers.cpp | 64 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 19 | ||||
-rw-r--r-- | engines/fullpipe/statics.h | 5 |
3 files changed, 36 insertions, 52 deletions
diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp index de226852b3..bd67fd4295 100644 --- a/engines/fullpipe/messagehandlers.cpp +++ b/engines/fullpipe/messagehandlers.cpp @@ -39,18 +39,16 @@ void global_messageHandler_KickStucco() { bool flip = false; for (int i = 0; i < end; i++) { - ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; - - if (ex) - if (ex->_messageKind == 35) - if (ex->_messageNum == SND_CMN_015) { - if (flip) { - ex->_messageNum = SND_CMN_055; - } else { - ex->_messageNum = SND_CMN_054; - flip = true; - } - } + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->getExCommand(); + + if (ex && ex->_messageKind == 35 && ex->_messageNum == SND_CMN_015) { + if (flip) { + ex->_messageNum = SND_CMN_055; + } else { + ex->_messageNum = SND_CMN_054; + flip = true; + } + } } mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK_COINLESS); @@ -58,18 +56,16 @@ void global_messageHandler_KickStucco() { flip = false; for (int i = 0; i < end; i++) { - ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; - - if (ex) - if (ex->_messageKind == 35) - if (ex->_messageNum == SND_CMN_015) { - if (flip) { - ex->_messageNum = SND_CMN_055; - } else { - ex->_messageNum = SND_CMN_054; - flip = true; - } - } + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->getExCommand(); + + if (ex && ex->_messageKind == 35 && ex->_messageNum == SND_CMN_015) { + if (flip) { + ex->_messageNum = SND_CMN_055; + } else { + ex->_messageNum = SND_CMN_054; + flip = true; + } + } } } @@ -78,24 +74,24 @@ void global_messageHandler_KickMetal() { int end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); for (int i = 0; i < end; i++) { - ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->getExCommand(); - if (ex) - if (ex->_messageKind == 35) - if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055) - ex->_messageNum = SND_CMN_015; + if (ex && ex->_messageKind == 35) { + if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055) + ex->_messageNum = SND_CMN_015; + } } mov = g_fp->_aniMan->getMovementById(MV_MAN_HMRKICK_COINLESS); end = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); for (int i = 0; i < end; i++) { - ExCommand *ex = mov->getDynamicPhaseByIndex(i)->_exCommand; + ExCommand *ex = mov->getDynamicPhaseByIndex(i)->getExCommand(); - if (ex) - if (ex->_messageKind == 35) - if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055) - ex->_messageNum = SND_CMN_015; + if (ex && ex->_messageKind == 35) { + if (ex->_messageNum == SND_CMN_054 || ex->_messageNum == SND_CMN_055) + ex->_messageNum = SND_CMN_015; + } } } diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index a85b90b595..eb28b93f59 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -2112,9 +2112,9 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) { _field_7C = src->_field_7C; if (src->getExCommand()) - _exCommand = src->getExCommand()->createClone(); + _exCommand.reset(src->getExCommand()->createClone()); else - _exCommand = 0; + _exCommand.reset(); _initialCountdown = src->_initialCountdown; _field_6A = src->_field_6A; @@ -2153,11 +2153,6 @@ StaticPhase::StaticPhase() { _initialCountdown = 0; _countdown = 0; _field_68 = 0; - _exCommand = 0; -} - -StaticPhase::~StaticPhase() { - delete _exCommand; } bool StaticPhase::load(MfcArchive &file) { @@ -2168,15 +2163,9 @@ bool StaticPhase::load(MfcArchive &file) { _initialCountdown = file.readUint16LE(); _field_6A = file.readUint16LE(); - if (g_fp->_gameProjectVersion >= 12) { - _exCommand = file.readClass<ExCommand>(); - - return true; - } - - assert (g_fp->_gameProjectVersion >= 12); + assert(g_fp->_gameProjectVersion >= 12); - warning("StaticPhase::load(): Code continues here"); + _exCommand.reset(file.readClass<ExCommand>()); return true; } diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index ab5ba67616..fa893d6118 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -53,15 +53,14 @@ class StaticPhase : public Picture { int16 _countdown; int16 _field_68; int16 _field_6A; - ExCommand *_exCommand; + Common::ScopedPtr<ExCommand> _exCommand; public: StaticPhase(); - virtual ~StaticPhase(); virtual bool load(MfcArchive &file); - ExCommand *getExCommand() { return _exCommand; } + ExCommand *getExCommand() { return _exCommand.get(); } }; class DynamicPhase : public StaticPhase { |