aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe')
-rw-r--r--engines/fullpipe/behavior.cpp116
-rw-r--r--engines/fullpipe/behavior.h24
-rw-r--r--engines/fullpipe/configure.engine2
-rw-r--r--engines/fullpipe/detection.cpp9
-rw-r--r--engines/fullpipe/fullpipe.cpp4
-rw-r--r--engines/fullpipe/fullpipe.h8
-rw-r--r--engines/fullpipe/gameloader.cpp14
-rw-r--r--engines/fullpipe/interaction.cpp2
-rw-r--r--engines/fullpipe/lift.cpp2
-rw-r--r--engines/fullpipe/messagehandlers.cpp9
-rw-r--r--engines/fullpipe/mgm.cpp92
-rw-r--r--engines/fullpipe/motion.cpp339
-rw-r--r--engines/fullpipe/motion.h107
-rw-r--r--engines/fullpipe/scenes.cpp4
-rw-r--r--engines/fullpipe/scenes.h8
-rw-r--r--engines/fullpipe/scenes/scene04.cpp16
-rw-r--r--engines/fullpipe/scenes/scene06.cpp12
-rw-r--r--engines/fullpipe/scenes/scene07.cpp4
-rw-r--r--engines/fullpipe/scenes/scene08.cpp4
-rw-r--r--engines/fullpipe/scenes/scene09.cpp6
-rw-r--r--engines/fullpipe/scenes/scene10.cpp2
-rw-r--r--engines/fullpipe/scenes/scene11.cpp8
-rw-r--r--engines/fullpipe/scenes/scene13.cpp16
-rw-r--r--engines/fullpipe/scenes/scene14.cpp18
-rw-r--r--engines/fullpipe/scenes/scene16.cpp2
-rw-r--r--engines/fullpipe/scenes/scene18and19.cpp2
-rw-r--r--engines/fullpipe/scenes/scene22.cpp8
-rw-r--r--engines/fullpipe/scenes/scene23.cpp6
-rw-r--r--engines/fullpipe/scenes/scene25.cpp2
-rw-r--r--engines/fullpipe/scenes/scene26.cpp2
-rw-r--r--engines/fullpipe/scenes/scene27.cpp8
-rw-r--r--engines/fullpipe/scenes/scene28.cpp2
-rw-r--r--engines/fullpipe/scenes/scene29.cpp14
-rw-r--r--engines/fullpipe/scenes/scene32.cpp8
-rw-r--r--engines/fullpipe/scenes/scene34.cpp12
-rw-r--r--engines/fullpipe/scenes/sceneFinal.cpp2
-rw-r--r--engines/fullpipe/sound.cpp22
-rw-r--r--engines/fullpipe/sound.h8
-rw-r--r--engines/fullpipe/statics.cpp12
-rw-r--r--engines/fullpipe/utils.cpp8
40 files changed, 487 insertions, 457 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp
index 14e9c33bdf..c90b2b07da 100644
--- a/engines/fullpipe/behavior.cpp
+++ b/engines/fullpipe/behavior.cpp
@@ -40,8 +40,8 @@ BehaviorManager::~BehaviorManager() {
void BehaviorManager::clear() {
for (uint i = 0; i < _behaviors.size(); i++) {
- for (int j = 0; j < _behaviors[i]->_itemsCount; j++)
- delete _behaviors[i]->_bheItems[j];
+ for (int j = 0; j < _behaviors[i]->_animsCount; j++)
+ delete _behaviors[i]->_behaviorAnims[j];
delete _behaviors[i];
}
@@ -90,7 +90,7 @@ void BehaviorManager::updateBehaviors() {
if (!beh->_ani) {
beh->_counter++;
if (beh->_counter >= beh->_counterMax)
- updateBehavior(beh, beh->_bheItems[0]);
+ updateBehavior(beh, beh->_behaviorAnims[0]);
continue;
}
@@ -104,15 +104,15 @@ void BehaviorManager::updateBehaviors() {
beh->_counter++;
if (beh->_counter >= beh->_counterMax) {
if (beh->_subIndex >= 0 && !(beh->_flags & 1) && beh->_ani->_messageQueueId <= 0)
- updateStaticAniBehavior(beh->_ani, beh->_counter, beh->_bheItems[beh->_subIndex]);
+ updateStaticAniBehavior(beh->_ani, beh->_counter, beh->_behaviorAnims[beh->_subIndex]);
}
} else {
beh->_staticsId = beh->_ani->_statics->_staticsId;
beh->_counter = 0;
beh->_subIndex = -1;
- for (int j = 0; j < beh->_itemsCount; j++)
- if (beh->_bheItems[j]->_staticsId == beh->_staticsId) {
+ for (int j = 0; j < beh->_animsCount; j++)
+ if (beh->_behaviorAnims[j]->_staticsId == beh->_staticsId) {
beh->_subIndex = j;
break;
}
@@ -121,10 +121,10 @@ void BehaviorManager::updateBehaviors() {
}
}
-void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry) {
- debug(4, "BehaviorManager::updateBehavior() %d", entry->_itemsCount);
- for (int i = 0; i < entry->_itemsCount; i++) {
- BehaviorEntryInfo *bhi = entry->_items[i];
+void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorAnim *entry) {
+ debug(4, "BehaviorManager::updateBehavior() %d", entry->_movesCount);
+ for (int i = 0; i < entry->_movesCount; i++) {
+ BehaviorMove *bhi = entry->_behaviorMoves[i];
if (!(bhi->_flags & 1)) {
if (bhi->_flags & 2) {
MessageQueue *mq = new MessageQueue(bhi->_messageQueue, 0, 1);
@@ -132,7 +132,7 @@ void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *
mq->sendNextCommand();
bhi->_flags &= 0xFFFFFFFD;
- } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fp->_rnd->getRandomNumber(32767) <= entry->_items[i]->_percent) {
+ } else if (behaviorInfo->_counter >= bhi->_delay && bhi->_percent && g_fp->_rnd->getRandomNumber(32767) <= entry->_behaviorMoves[i]->_percent) {
MessageQueue *mq = new MessageQueue(bhi->_messageQueue, 0, 1);
mq->sendNextCommand();
@@ -143,7 +143,7 @@ void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *
}
}
-void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *bhe) {
+void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorAnim *bhe) {
debug(4, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName));
MessageQueue *mq = 0;
@@ -151,21 +151,21 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
if (bhe->_flags & 1) {
uint rnd = g_fp->_rnd->getRandomNumber(32767);
uint runPercent = 0;
- for (int i = 0; i < bhe->_itemsCount; i++) {
- if (!(bhe->_items[i]->_flags & 1) && bhe->_items[i]->_percent) {
- if ((rnd >= runPercent && rnd <= runPercent + bhe->_items[i]->_percent) || i == bhe->_itemsCount - 1) {
- mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
+ for (int i = 0; i < bhe->_movesCount; i++) {
+ if (!(bhe->_behaviorMoves[i]->_flags & 1) && bhe->_behaviorMoves[i]->_percent) {
+ if ((rnd >= runPercent && rnd <= runPercent + bhe->_behaviorMoves[i]->_percent) || i == bhe->_movesCount - 1) {
+ mq = new MessageQueue(bhe->_behaviorMoves[i]->_messageQueue, 0, 1);
break;
}
- runPercent += bhe->_items[i]->_percent;
+ runPercent += bhe->_behaviorMoves[i]->_percent;
}
}
} else {
- for (int i = 0; i < bhe->_itemsCount; i++) {
- if (!(bhe->_items[i]->_flags & 1) && delay >= bhe->_items[i]->_delay) {
- if (bhe->_items[i]->_percent) {
- if (g_fp->_rnd->getRandomNumber(32767) <= bhe->_items[i]->_percent) {
- mq = new MessageQueue(bhe->_items[i]->_messageQueue, 0, 1);
+ for (int i = 0; i < bhe->_movesCount; i++) {
+ if (!(bhe->_behaviorMoves[i]->_flags & 1) && delay >= bhe->_behaviorMoves[i]->_delay) {
+ if (bhe->_behaviorMoves[i]->_percent) {
+ if (g_fp->_rnd->getRandomNumber(32767) <= bhe->_behaviorMoves[i]->_percent) {
+ mq = new MessageQueue(bhe->_behaviorMoves[i]->_messageQueue, 0, 1);
break;
}
}
@@ -180,7 +180,7 @@ void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, B
}
bool BehaviorManager::setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag) {
- BehaviorEntryInfo *entry = getBehaviorEntryInfoByMessageQueueDataId(obj, aniId, quId);
+ BehaviorMove *entry = getBehaviorMoveByMessageQueueDataId(obj, aniId, quId);
if (entry) {
if (flag)
@@ -206,14 +206,14 @@ void BehaviorManager::setFlagByStaticAniObject(StaticANIObject *ani, int flag) {
}
}
-BehaviorEntryInfo *BehaviorManager::getBehaviorEntryInfoByMessageQueueDataId(StaticANIObject *ani, int id1, int id2) {
+BehaviorMove *BehaviorManager::getBehaviorMoveByMessageQueueDataId(StaticANIObject *ani, int id1, int id2) {
for (uint i = 0; i < _behaviors.size(); i++) {
if (_behaviors[i]->_ani == ani) {
- for (uint j = 0; j < _behaviors[i]->_bheItems.size(); j++) {
- if (_behaviors[i]->_bheItems[j]->_staticsId == id1) {
- for (int k = 0; k < _behaviors[i]->_bheItems[j]->_itemsCount; k++) {
- if (_behaviors[i]->_bheItems[j]->_items[k]->_messageQueue->_dataId == id2)
- return _behaviors[i]->_bheItems[j]->_items[k];
+ for (uint j = 0; j < _behaviors[i]->_behaviorAnims.size(); j++) {
+ if (_behaviors[i]->_behaviorAnims[j]->_staticsId == id1) {
+ for (int k = 0; k < _behaviors[i]->_behaviorAnims[j]->_movesCount; k++) {
+ if (_behaviors[i]->_behaviorAnims[j]->_behaviorMoves[k]->_messageQueue->_dataId == id2)
+ return _behaviors[i]->_behaviorAnims[j]->_behaviorMoves[k];
}
}
}
@@ -230,32 +230,32 @@ void BehaviorInfo::clear() {
_counterMax = 0;
_flags = 0;
_subIndex = 0;
- _itemsCount = 0;
+ _animsCount = 0;
- _bheItems.clear();
+ _behaviorAnims.clear();
}
void BehaviorInfo::initAmbientBehavior(GameVar *var, Scene *sc) {
debug(4, "BehaviorInfo::initAmbientBehavior(%s)", transCyrillic((byte *)var->_varName));
clear();
- _itemsCount = 1;
+ _animsCount = 1;
_counterMax = -1;
- BehaviorEntry *bi = new BehaviorEntry();
+ BehaviorAnim *bi = new BehaviorAnim();
- _bheItems.push_back(bi);
+ _behaviorAnims.push_back(bi);
- bi->_itemsCount = var->getSubVarsCount();
+ bi->_movesCount = var->getSubVarsCount();
- bi->_items = (BehaviorEntryInfo**)calloc(bi->_itemsCount, sizeof(BehaviorEntryInfo *));
+ bi->_behaviorMoves = (BehaviorMove **)calloc(bi->_movesCount, sizeof(BehaviorMove *));
- for (int i = 0; i < bi->_itemsCount; i++) {
+ for (int i = 0; i < bi->_movesCount; i++) {
int delay;
- bi->_items[i] = new BehaviorEntryInfo(var->getSubVarByIndex(i), sc, &delay);
+ bi->_behaviorMoves[i] = new BehaviorMove(var->getSubVarByIndex(i), sc, &delay);
- if (bi->_items[i]->_delay <_counterMax)
- _counterMax = bi->_items[i]->_delay;
+ if (bi->_behaviorMoves[i]->_delay <_counterMax)
+ _counterMax = bi->_behaviorMoves[i]->_delay;
}
}
@@ -264,7 +264,7 @@ void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *
clear();
- _itemsCount = var->getSubVarsCount();
+ _animsCount = var->getSubVarsCount();
_counterMax = -1;
while (var->_varType == 2) {
@@ -278,54 +278,54 @@ void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *
sc = g_fp->accessScene(ani->_sceneId);
clear();
var = v1;
- _itemsCount = var->getSubVarsCount();
+ _animsCount = var->getSubVarsCount();
_counterMax = -1;
}
- for (int i = 0; i < _itemsCount; i++) {
+ for (int i = 0; i < _animsCount; i++) {
int maxDelay = 0;
- _bheItems.push_back(new BehaviorEntry(var->getSubVarByIndex(i), sc, ani, &maxDelay));
+ _behaviorAnims.push_back(new BehaviorAnim(var->getSubVarByIndex(i), sc, ani, &maxDelay));
if (maxDelay < _counterMax)
_counterMax = maxDelay;
}
}
-BehaviorEntry::BehaviorEntry() {
+BehaviorAnim::BehaviorAnim() {
_staticsId = 0;
- _itemsCount = 0;
+ _movesCount = 0;
_flags = 0;
- _items = 0;
+ _behaviorMoves = NULL;
}
-BehaviorEntry::BehaviorEntry(GameVar *var, Scene *sc, StaticANIObject *ani, int *minDelay) {
+BehaviorAnim::BehaviorAnim(GameVar *var, Scene *sc, StaticANIObject *ani, int *minDelay) {
_staticsId = 0;
- _itemsCount = 0;
+ _movesCount = 0;
*minDelay = 100000000;
int totalPercent = 0;
_flags = 0;
- _items = 0;
+ _behaviorMoves = 0;
Statics *st = ani->getStaticsByName(var->_varName);
if (st)
_staticsId = st->_staticsId;
- _itemsCount = var->getSubVarsCount();
- if (_itemsCount) {
- _items = (BehaviorEntryInfo**)calloc(_itemsCount, sizeof(BehaviorEntryInfo *));
+ _movesCount = var->getSubVarsCount();
+ if (_movesCount) {
+ _behaviorMoves = (BehaviorMove **)calloc(_movesCount, sizeof(BehaviorMove *));
- for (int i = 0; i < _itemsCount; i++) {
+ for (int i = 0; i < _movesCount; i++) {
GameVar *subvar = var->getSubVarByIndex(i);
int delay = 0;
- _items[i] = new BehaviorEntryInfo(subvar, sc, &delay);
+ _behaviorMoves[i] = new BehaviorMove(subvar, sc, &delay);
totalPercent += delay;
- if (_items[i]->_delay < *minDelay)
- *minDelay = _items[i]->_delay;
+ if (_behaviorMoves[i]->_delay < *minDelay)
+ *minDelay = _behaviorMoves[i]->_delay;
}
if (!*minDelay && totalPercent == 1000)
@@ -333,7 +333,7 @@ BehaviorEntry::BehaviorEntry(GameVar *var, Scene *sc, StaticANIObject *ani, int
}
}
-BehaviorEntryInfo::BehaviorEntryInfo(GameVar *subvar, Scene *sc, int *delay) {
+BehaviorMove::BehaviorMove(GameVar *subvar, Scene *sc, int *delay) {
_messageQueue = 0;
_delay = 0;
_percent = 0;
diff --git a/engines/fullpipe/behavior.h b/engines/fullpipe/behavior.h
index 1ec98d5bf2..e534371442 100644
--- a/engines/fullpipe/behavior.h
+++ b/engines/fullpipe/behavior.h
@@ -25,23 +25,23 @@
namespace Fullpipe {
-struct BehaviorEntryInfo {
+struct BehaviorMove {
MessageQueue *_messageQueue;
int _delay;
uint32 _percent;
int _flags;
- BehaviorEntryInfo(GameVar *subvar, Scene *sc, int *delay);
+ BehaviorMove(GameVar *subvar, Scene *sc, int *delay);
};
-struct BehaviorEntry {
+struct BehaviorAnim {
int _staticsId;
- int _itemsCount;
+ int _movesCount;
int _flags;
- BehaviorEntryInfo **_items;
+ BehaviorMove **_behaviorMoves;
- BehaviorEntry();
- BehaviorEntry(GameVar *var, Scene *sc, StaticANIObject *ani, int *minDelay);
+ BehaviorAnim();
+ BehaviorAnim(GameVar *var, Scene *sc, StaticANIObject *ani, int *minDelay);
};
struct BehaviorInfo {
@@ -51,8 +51,8 @@ struct BehaviorInfo {
int _counterMax;
int _flags;
int _subIndex;
- int _itemsCount;
- Common::Array<BehaviorEntry *> _bheItems;
+ int _animsCount;
+ Common::Array<BehaviorAnim *> _behaviorAnims;
BehaviorInfo() { clear(); }
@@ -75,14 +75,14 @@ class BehaviorManager : public CObject {
void initBehavior(Scene *scene, GameVar *var);
void updateBehaviors();
- void updateBehavior(BehaviorInfo *behaviorInfo, BehaviorEntry *entry);
- void updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorEntry *beh);
+ void updateBehavior(BehaviorInfo *behaviorInfo, BehaviorAnim *entry);
+ void updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorAnim *beh);
bool setBehaviorEnabled(StaticANIObject *obj, int aniId, int quId, int flag);
void setFlagByStaticAniObject(StaticANIObject *ani, int flag);
- BehaviorEntryInfo *getBehaviorEntryInfoByMessageQueueDataId(StaticANIObject *ani, int id1, int id2);
+ BehaviorMove *getBehaviorMoveByMessageQueueDataId(StaticANIObject *ani, int id1, int id2);
};
} // End of namespace Fullpipe
diff --git a/engines/fullpipe/configure.engine b/engines/fullpipe/configure.engine
index a9042449db..611d0188dc 100644
--- a/engines/fullpipe/configure.engine
+++ b/engines/fullpipe/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine fullpipe "Full Pipe" no "" "" "16bit"
+add_engine fullpipe "Full Pipe" no "" "" "16bit highres"
diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp
index de0ed04d25..6f92f19f24 100644
--- a/engines/fullpipe/detection.cpp
+++ b/engines/fullpipe/detection.cpp
@@ -32,7 +32,7 @@
namespace Fullpipe {
const char *FullpipeEngine::getGameId() const {
- return _gameDescription->gameid;
+ return _gameDescription->gameId;
}
}
@@ -76,7 +76,7 @@ static const ADGameDescription gameDescriptions[] = {
class FullpipeMetaEngine : public AdvancedMetaEngine {
public:
FullpipeMetaEngine() : AdvancedMetaEngine(Fullpipe::gameDescriptions, sizeof(ADGameDescription), fullpipeGames) {
- _singleid = "fullpipe";
+ _singleId = "fullpipe";
}
virtual const char *getName() const {
@@ -108,10 +108,9 @@ bool FullpipeMetaEngine::hasFeature(MetaEngineFeature f) const {
SaveStateList FullpipeMetaEngine::listSaves(const char *target) const {
Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
Common::StringArray filenames;
- Common::String pattern("fullpipe.s??");
+ Common::String pattern("fullpipe.s##");
filenames = saveFileMan->listSavefiles(pattern);
- sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
SaveStateList saveList;
for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
@@ -130,6 +129,8 @@ SaveStateList FullpipeMetaEngine::listSaves(const char *target) const {
}
}
+ // Sort saves based on slot number.
+ Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
return saveList;
}
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp
index ebaff32550..c2aae9ba88 100644
--- a/engines/fullpipe/fullpipe.cpp
+++ b/engines/fullpipe/fullpipe.cpp
@@ -24,6 +24,7 @@
#include "common/archive.h"
#include "common/config-manager.h"
+#include "audio/mixer.h"
#include "engines/util.h"
@@ -112,6 +113,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc)
_musicLocal = 0;
_trackStartDelay = 0;
+ _sceneTrackHandle = new Audio::SoundHandle();
+
memset(_sceneTracks, 0, sizeof(_sceneTracks));
memset(_trackName, 0, sizeof(_trackName));
memset(_sceneTracksCurrentTrack, 0, sizeof(_sceneTracksCurrentTrack));
@@ -192,6 +195,7 @@ FullpipeEngine::~FullpipeEngine() {
delete _rnd;
delete _console;
delete _globalMessageQueueList;
+ delete _sceneTrackHandle;
}
void FullpipeEngine::initialize() {
diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h
index 7f20a6d6af..fba61aa13b 100644
--- a/engines/fullpipe/fullpipe.h
+++ b/engines/fullpipe/fullpipe.h
@@ -30,8 +30,6 @@
#include "common/savefile.h"
#include "common/system.h"
-#include "audio/mixer.h"
-
#include "graphics/transparent_surface.h"
#include "engines/engine.h"
@@ -41,6 +39,10 @@
struct ADGameDescription;
+namespace Audio {
+class SoundHandle;
+}
+
namespace Fullpipe {
enum FullpipeGameFeatures {
@@ -312,7 +314,7 @@ public:
void lift_openLift();
GameVar *_musicGameVar;
- Audio::SoundHandle _sceneTrackHandle;
+ Audio::SoundHandle *_sceneTrackHandle;
public:
diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp
index 7815475d37..3a0e262f82 100644
--- a/engines/fullpipe/gameloader.cpp
+++ b/engines/fullpipe/gameloader.cpp
@@ -110,10 +110,10 @@ GameLoader::~GameLoader() {
}
bool GameLoader::load(MfcArchive &file) {
- debug(5, "GameLoader::load()");
+ debug(1, "GameLoader::load()");
_gameName = file.readPascalString();
- debug(6, "_gameName: %s", _gameName);
+ debug(1, "_gameName: %s", _gameName);
_gameProject = new GameProject();
@@ -126,13 +126,13 @@ bool GameLoader::load(MfcArchive &file) {
}
_gameName = file.readPascalString();
- debug(6, "_gameName: %s", _gameName);
+ debug(1, "_gameName: %s", _gameName);
_inventory.load(file);
_interactionController->load(file);
- debug(6, "sceneTag count: %d", _gameProject->_sceneTagList->size());
+ debug(1, "sceneTag count: %d", _gameProject->_sceneTagList->size());
_sc2array.resize(_gameProject->_sceneTagList->size());
@@ -142,7 +142,7 @@ bool GameLoader::load(MfcArchive &file) {
snprintf(tmp, 11, "%04d.sc2", it->_sceneId);
- debug(2, "sc: %s", tmp);
+ debug(1, "sc: %s", tmp);
_sc2array[i].loadFile((const char *)tmp);
}
@@ -152,6 +152,8 @@ bool GameLoader::load(MfcArchive &file) {
_field_FA = file.readUint16LE();
_field_F8 = file.readUint16LE();
+ debug(1, "_field_FA: %d\n_field_F8: %d", _field_FA, _field_F8);
+
_gameVar = (GameVar *)file.readClass();
return true;
@@ -419,7 +421,7 @@ bool GameLoader::unloadScene(int sceneId) {
if (_sc2array[sceneTag]._isLoaded)
saveScenePicAniInfos(sceneId);
- _sc2array[sceneTag]._motionController->freeItems();
+ _sc2array[sceneTag]._motionController->detachAllObjects();
delete tag->_scene;
tag->_scene = 0;
diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 84e9688e30..4aac3485f4 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -311,7 +311,7 @@ LABEL_38:
if (abs(xpos - subj->_ox) > 1 || abs(ypos - subj->_oy) > 1
|| (inter->_staticsId2 != 0 && (subj->_statics == 0 || subj->_statics->_staticsId != inter->_staticsId2))) {
- mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->method34(subj, xpos, ypos, 1, inter->_staticsId2);
+ mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->startMove(subj, xpos, ypos, 1, inter->_staticsId2);
if (!mq)
return false;
diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp
index 9a3d91540a..d066c89d4a 100644
--- a/engines/fullpipe/lift.cpp
+++ b/engines/fullpipe/lift.cpp
@@ -324,7 +324,7 @@ void FullpipeEngine::lift_walkAndGo() {
ExCommand *ex;
if (abs(_liftX - _aniMan->_ox) > 1 || abs(_liftY - _aniMan->_oy) > 1 || _aniMan->_movement || _aniMan->_statics->_staticsId != ST_MAN_UP) {
- mq = getCurrSceneSc2MotionController()->method34(_aniMan, _liftX, _liftY, 1, ST_MAN_UP);
+ mq = getCurrSceneSc2MotionController()->startMove(_aniMan, _liftX, _liftY, 1, ST_MAN_UP);
if (mq) {
ex = new ExCommand(0, 17, MSG_LIFT_CLICKBUTTON, 0, 0, 0, 1, 0, 0, 0);
diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp
index d4f79d1dd8..b9c79963f2 100644
--- a/engines/fullpipe/messagehandlers.cpp
+++ b/engines/fullpipe/messagehandlers.cpp
@@ -425,6 +425,7 @@ int global_messageHandler3(ExCommand *cmd) {
if (g_fp->_msgX != cmd->_sceneClickX || g_fp->_msgY != cmd->_sceneClickY) {
ani = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1);
if (!ani || (ani->isIdle() && !(ani->_flags & 0x80) && !(ani->_flags & 0x100))) {
+ warning("WWW 1");
result = startWalkTo(g_fp->_gameLoader->_field_FA, -1, cmd->_sceneClickX, cmd->_sceneClickY, 0);
if (result) {
ExCommand *ex = new ExCommand(g_fp->_gameLoader->_field_FA, 17, 64, 0, 0, 0, 1, 0, 0, 0);
@@ -765,7 +766,7 @@ int MovGraph_messageHandler(ExCommand *cmd) {
point.x = ani->_ox;
point.y = ani->_oy;
- double dst = gr->calcDistance(&point, (MovGraphLink *)(*i), 0);
+ double dst = gr->putToLink(&point, (MovGraphLink *)(*i), 0);
if (dst >= 0.0 && dst < mindistance) {
mindistance = dst;
link = (MovGraphLink *)(*i);
@@ -775,13 +776,13 @@ int MovGraph_messageHandler(ExCommand *cmd) {
int top;
if (link) {
- MovGraphNode *node = link->_movGraphNode1;
+ MovGraphNode *node = link->_graphSrc;
double sq = (ani->_oy - node->_y) * (ani->_oy - node->_y) + (ani->_ox - node->_x) * (ani->_ox - node->_x);
int off = (node->_field_14 >> 16) & 0xFF;
- double off2 = ((link->_movGraphNode2->_field_14 >> 8) & 0xff) - off;
+ double off2 = ((link->_graphDst->_field_14 >> 8) & 0xff) - off;
- top = off + (int)(sqrt(sq) * off2 / link->_distance);
+ top = off + (int)(sqrt(sq) * off2 / link->_length);
} else {
top = (gr->calcOffset(ani->_ox, ani->_oy)->_field_14 >> 8) & 0xff;
}
diff --git a/engines/fullpipe/mgm.cpp b/engines/fullpipe/mgm.cpp
index 1c8ca2a7b1..ca2ec060e2 100644
--- a/engines/fullpipe/mgm.cpp
+++ b/engines/fullpipe/mgm.cpp
@@ -155,10 +155,12 @@ void MGM::rebuildTables(int objId) {
if (!obj)
return;
+ warning("WWW rebuild. idx: %d, size: %d", idx, obj->_staticsList.size() * obj->_staticsList.size());
for (uint i = 0; i < obj->_staticsList.size(); i++) {
_items[idx]->statics.push_back((Statics *)obj->_staticsList[i]);
- _items[idx]->subItems.push_back(new MGMSubItem);
+ for (uint j = 0; j < obj->_staticsList.size(); j++) // Yes, square
+ _items[idx]->subItems.push_back(new MGMSubItem);
}
for (uint i = 0; i < obj->_movements.size(); i++)
@@ -389,9 +391,9 @@ int MGM::countPhases(int idx, int subIdx, int endIdx, int flag) {
if (subIdx < 0)
break;
- res += _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->movement->countPhasesWithFlag(-1, flag);
+ res += _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->movement->countPhasesWithFlag(0xffffffff, flag);
- subIdx = _items[idx]->subItems[subIdx + 6 * endIdx * _items[idx]->statics.size()]->staticsIndex;
+ subIdx = _items[idx]->subItems[subIdx + endIdx * _items[idx]->statics.size()]->staticsIndex;
}
return res;
@@ -474,7 +476,7 @@ int MGM::getStaticsIndexById(int idx, int16 id) {
return i;
}
- return 0;
+ return -1;
}
int MGM::getStaticsIndex(int idx, Statics *st) {
@@ -486,7 +488,7 @@ int MGM::getStaticsIndex(int idx, Statics *st) {
return i;
}
- return 0;
+ return -1;
}
void MGM::clearMovements2(int idx) {
@@ -502,7 +504,7 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
return 0;
}
- if (item->subItems[subIdx])
+ if (item->subItems[subIdx]->movement)
return item->subItems[subIdx]->field_8;
Common::Point point;
@@ -511,54 +513,59 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) {
Movement *mov = item->movements1[i];
if (mov->_staticsObj1 == item->statics[st1idx]) {
- if (!item->movements2[i] && (!flop || mov->_field_50)) {
- item->movements2[i] = 1;
+ if (item->movements2[i] || (flop && !mov->_field_50))
+ continue;
- int stidx = getStaticsIndex(idx, item->movements1[i]->_staticsObj2);
- int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
- int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
- int newsz = sz + item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->field_C;
+ item->movements2[i] = 1;
- if (recalc >= 0) {
- if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1 ||
- (item->subItems[subIdx]->field_8 == recalc + 1 && item->subItems[subIdx]->field_C > newsz)) {
- item->subItems[subIdx]->movement = mov;
- item->subItems[subIdx]->staticsIndex = stidx;
- item->subItems[subIdx]->field_8 = recalc + 1;
- item->subItems[subIdx]->field_C = newsz;
+ int stidx = getStaticsIndex(idx, mov->_staticsObj2);
+ int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+ int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+ int newsz = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
- mov->calcSomeXY(point, 0, -1);
+ if (recalc < 0)
+ continue;
- item->subItems[subIdx]->x = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->x + point.x;
- item->subItems[subIdx]->y = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->y + point.y;
- }
- }
+ if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1 ||
+ (item->subItems[subIdx]->field_8 == recalc + 1 && item->subItems[subIdx]->field_C > newsz)) {
+ item->subItems[subIdx]->movement = mov;
+ item->subItems[subIdx]->staticsIndex = stidx;
+ item->subItems[subIdx]->field_8 = recalc + 1;
+ item->subItems[subIdx]->field_C = newsz;
+
+ mov->calcSomeXY(point, 0, -1);
+
+ item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x + point.x;
+ item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y + point.y;
}
} else if (flip) {
- if (mov->_staticsObj2 == item->statics[st1idx]) {
- if (!item->movements2[i] && (!flop || mov->_field_50)) {
- item->movements2[i] = 1;
+ if (mov->_staticsObj2 != item->statics[st1idx])
+ continue;
- int stidx = getStaticsIndex(idx, mov->_staticsObj1);
- int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
+ if (item->movements2[i] || (flop && !mov->_field_50))
+ continue;
- if (recalc >= 0) {
- if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1) {
- item->subItems[subIdx]->movement = mov;
- item->subItems[subIdx]->staticsIndex = stidx;
- item->subItems[subIdx]->field_8 = recalc + 1;
+ item->movements2[i] = 1;
- int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+ int stidx = getStaticsIndex(idx, mov->_staticsObj1);
+ int recalc = recalcOffsets(idx, stidx, st2idx, flip, flop);
- item->subItems[subIdx]->field_C = sz + item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->field_C;
+ if (recalc < 0)
+ continue;
- mov->calcSomeXY(point, 0, -1);
+ if (!item->subItems[subIdx]->movement || item->subItems[subIdx]->field_8 > recalc + 1) {
+ item->subItems[subIdx]->movement = mov;
+ item->subItems[subIdx]->staticsIndex = stidx;
+ item->subItems[subIdx]->field_8 = recalc + 1;
- item->subItems[subIdx]->x = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->x - point.x;
- item->subItems[subIdx]->y = item->subItems[stidx + 6 * st2idx * _items[idx]->statics.size()]->y - point.y;
- }
- }
- }
+ int sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size();
+
+ item->subItems[subIdx]->field_C = sz + item->subItems[stidx + st2idx * _items[idx]->statics.size()]->field_C;
+
+ mov->calcSomeXY(point, 0, -1);
+
+ item->subItems[subIdx]->x = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->x - point.x;
+ item->subItems[subIdx]->y = item->subItems[stidx + st2idx * _items[idx]->statics.size()]->y - point.y;
}
}
}
@@ -576,6 +583,7 @@ int MGM::refreshOffsets(int objectId, int idx1, int idx2) {
int from = getStaticsIndexById(idx, idx1);
int to = getStaticsIndexById(idx, idx2);
+ warning("WWW 6, want idx: %d, off: %d", idx, from + to * _items[idx]->statics.size());
MGMSubItem *sub = _items[idx]->subItems[from + to * _items[idx]->statics.size()];
if (sub->movement) {
diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp
index 5845ad1501..81424db93a 100644
--- a/engines/fullpipe/motion.cpp
+++ b/engines/fullpipe/motion.cpp
@@ -88,7 +88,7 @@ bool MctlCompound::load(MfcArchive &file) {
for (int i = 0; i < count; i++) {
debug(6, "CompoundArray[%d]", i);
- MctlCompoundArrayItem *obj = new MctlCompoundArrayItem();
+ MctlItem *obj = new MctlItem();
obj->_motionControllerObj = (MotionController *)file.readClass();
@@ -114,14 +114,14 @@ bool MctlCompound::load(MfcArchive &file) {
return true;
}
-void MctlCompound::addObject(StaticANIObject *obj) {
+void MctlCompound::attachObject(StaticANIObject *obj) {
for (uint i = 0; i < _motionControllers.size(); i++)
- _motionControllers[i]->_motionControllerObj->addObject(obj);
+ _motionControllers[i]->_motionControllerObj->attachObject(obj);
}
-int MctlCompound::removeObject(StaticANIObject *obj) {
+int MctlCompound::detachObject(StaticANIObject *obj) {
for (uint i = 0; i < _motionControllers.size(); i++)
- _motionControllers[i]->_motionControllerObj->removeObject(obj);
+ _motionControllers[i]->_motionControllerObj->detachObject(obj);
return 1;
}
@@ -150,12 +150,12 @@ void MctlCompound::initMovGraph2() {
}
}
-void MctlCompound::freeItems() {
+void MctlCompound::detachAllObjects() {
for (uint i = 0; i < _motionControllers.size(); i++)
- _motionControllers[i]->_motionControllerObj->freeItems();
+ _motionControllers[i]->_motionControllerObj->detachAllObjects();
}
-MessageQueue *MctlCompound::method34(StaticANIObject *ani, int sourceX, int sourceY, int fuzzyMatch, int staticsId) {
+MessageQueue *MctlCompound::startMove(StaticANIObject *ani, int sourceX, int sourceY, int fuzzyMatch, int staticsId) {
int idx = -1;
int sourceIdx = -1;
@@ -186,8 +186,9 @@ MessageQueue *MctlCompound::method34(StaticANIObject *ani, int sourceX, int sour
if (sourceIdx == -1)
return 0;
+ warning("WWW 2");
if (idx == sourceIdx)
- return _motionControllers[idx]->_motionControllerObj->method34(ani, sourceX, sourceY, fuzzyMatch, staticsId);
+ return _motionControllers[idx]->_motionControllerObj->startMove(ani, sourceX, sourceY, fuzzyMatch, staticsId);
double dist;
MctlConnectionPoint *cp = findClosestConnectionPoint(ani->_ox, ani->_oy, idx, sourceX, sourceY, sourceIdx, &dist);
@@ -195,7 +196,7 @@ MessageQueue *MctlCompound::method34(StaticANIObject *ani, int sourceX, int sour
if (!cp)
return 0;
- MessageQueue *mq = _motionControllers[idx]->_motionControllerObj->doWalkTo(ani, cp->_connectionX, cp->_connectionY, 1, cp->_field_14);
+ MessageQueue *mq = _motionControllers[idx]->_motionControllerObj->doWalkTo(ani, cp->_connectionX, cp->_connectionY, 1, cp->_mctlmirror);
if (!mq)
return 0;
@@ -264,7 +265,7 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos,
if (!closestP)
return 0;
- MessageQueue *mq = _motionControllers[match1]->_motionControllerObj->doWalkTo(subj, closestP->_connectionX, closestP->_connectionY, 1, closestP->_field_14);
+ MessageQueue *mq = _motionControllers[match1]->_motionControllerObj->doWalkTo(subj, closestP->_connectionX, closestP->_connectionY, 1, closestP->_mctlmirror);
ExCommand *ex;
@@ -287,7 +288,7 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos,
return mq;
}
-MctlCompoundArrayItem::~MctlCompoundArrayItem() {
+MctlItem::~MctlItem() {
delete _movGraphReactObj;
delete _motionControllerObj;
}
@@ -304,7 +305,7 @@ MctlLadder::MctlLadder() {
}
MctlLadder::~MctlLadder() {
- freeItems();
+ detachAllObjects();
}
int MctlLadder::collisionDetection(StaticANIObject *man) {
@@ -326,7 +327,7 @@ int MctlLadder::collisionDetection(StaticANIObject *man) {
return res;
}
-void MctlLadder::addObject(StaticANIObject *obj) {
+void MctlLadder::attachObject(StaticANIObject *obj) {
if (findObjectPos(obj) < 0) {
MctlLadderMovement *movement = new MctlLadderMovement;
@@ -391,7 +392,7 @@ bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement
return true;
}
-void MctlLadder::freeItems() {
+void MctlLadder::detachAllObjects() {
_mgm.clear();
for (uint i = 0; i < _ladmovements.size(); i++) {
@@ -402,7 +403,7 @@ void MctlLadder::freeItems() {
_ladmovements.clear();
}
-MessageQueue *MctlLadder::method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+MessageQueue *MctlLadder::startMove(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) {
MessageQueue *mq = doWalkTo(subj, xpos, ypos, fuzzyMatch, staticsId);
if (mq) {
@@ -661,7 +662,7 @@ void MctlCompound::replaceNodeX(int from, int to) {
node->_x = to;
}
- gr->calcNodeDistancesAndAngles();
+ gr->recalcLinkParams();
}
}
}
@@ -669,10 +670,9 @@ void MctlCompound::replaceNodeX(int from, int to) {
MctlConnectionPoint::MctlConnectionPoint() {
_connectionX = 0;
_connectionY = 0;
- _field_C = 0;
- _field_10 = 0;
- _field_14 = 0;
- _field_16 = 0;
+ _mctlflags = 0;
+ _mctlstatic = 0;
+ _mctlmirror = 0;
_messageQueueObj = 0;
_motionControllerObj = 0;
}
@@ -779,7 +779,7 @@ bool MovGraph::load(MfcArchive &file) {
return true;
}
-void MovGraph::addObject(StaticANIObject *obj) {
+void MovGraph::attachObject(StaticANIObject *obj) {
_mgm.clear();
_mgm.addItem(obj->_id);
@@ -796,13 +796,13 @@ void MovGraph::addObject(StaticANIObject *obj) {
_mgm.addItem(obj->_id); // FIXME: Is it really needed?
}
-int MovGraph::removeObject(StaticANIObject *obj) {
- warning("STUB: MovGraph::removeObject()");
+int MovGraph::detachObject(StaticANIObject *obj) {
+ warning("STUB: MovGraph::detachObject()");
return 0;
}
-void MovGraph::freeItems() {
+void MovGraph::detachAllObjects() {
for (uint i = 0; i < _items.size(); i++) {
_items[i]->free();
@@ -812,7 +812,7 @@ void MovGraph::freeItems() {
_items.clear();
}
-Common::Array<MovItem *> *MovGraph::method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) {
+Common::Array<MovItem *> *MovGraph::getPaths(StaticANIObject *ani, int x, int y, int flag1, int *rescount) {
*rescount = 0;
if (_items.size() <= 0)
@@ -828,7 +828,7 @@ Common::Array<MovItem *> *MovGraph::method28(StaticANIObject *ani, int x, int y,
}
_items[idx]->free();
- calcNodeDistancesAndAngles();
+ recalcLinkParams();
_items[idx]->movarr._movSteps.clear();
@@ -837,8 +837,8 @@ Common::Array<MovItem *> *MovGraph::method28(StaticANIObject *ani, int x, int y,
point.x = ani->_ox;
point.y = ani->_oy;
- if (!calcChunk(idx, ani->_ox, ani->_oy, &_items[idx]->movarr, 0))
- findClosestLink(idx, &point, &_items[idx]->movarr);
+ if (!getHitPoint(idx, ani->_ox, ani->_oy, &_items[idx]->movarr, 0))
+ getNearestPoint(idx, &point, &_items[idx]->movarr);
_items[idx]->count = 0;
@@ -846,19 +846,19 @@ Common::Array<MovItem *> *MovGraph::method28(StaticANIObject *ani, int x, int y,
_items[idx]->movitems = 0;
int arrSize;
- Common::Array<MovArr *> *movarr = genMovArr(x, y, &arrSize, flag1, 0);
+ Common::Array<MovArr *> *movarr = getHitPoints(x, y, &arrSize, flag1, 0);
if (movarr) {
for (int i = 0; i < arrSize; i++) {
int sz;
- Common::Array<MovItem *> *movitems = calcMovItems(&_items[idx]->movarr, (*movarr)[i], &sz);
+ Common::Array<MovItem *> *movitems = getPaths(&_items[idx]->movarr, (*movarr)[i], &sz);
if (sz > 0) {
for (int j = 0; j < sz; j++)
_items[idx]->movitems->push_back(movitems[j]);
-
- delete movitems;
}
+
+ delete movitems;
}
delete movarr;
@@ -873,12 +873,12 @@ Common::Array<MovItem *> *MovGraph::method28(StaticANIObject *ani, int x, int y,
return 0;
}
-bool MovGraph::method2C(StaticANIObject *obj, int x, int y) {
+bool MovGraph::setPosImmediate(StaticANIObject *obj, int x, int y) {
obj->setOXY(x, y);
- return method3C(obj, 1);
+ return resetPosition(obj, 1);
}
-MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+MessageQueue *MovGraph::startMove(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) {
if (!ani) {
if (!_items.size())
return 0;
@@ -896,7 +896,7 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f
return 0;
int count;
- Common::Array<MovItem *> *movitems = method28(ani, xpos, ypos, fuzzyMatch, &count);
+ Common::Array<MovItem *> *movitems = getPaths(ani, xpos, ypos, fuzzyMatch, &count);
if (!movitems)
return 0;
@@ -941,9 +941,9 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f
int count2;
ani->setSomeDynamicPhaseIndex(ex->_field_14);
- method28(ani, xpos, ypos, fuzzyMatch, &count2);
+ getPaths(ani, xpos, ypos, fuzzyMatch, &count2);
- int idx = getItemIndexByStaticAni(ani);
+ int idx = getObjectIndex(ani);
count = _items[idx]->count;
movitems = _items[idx]->movitems;
}
@@ -951,12 +951,12 @@ MessageQueue *MovGraph::method34(StaticANIObject *ani, int xpos, int ypos, int f
return method50(ani, _callback1(ani, movitems, count), staticsId);
}
-void MovGraph::changeCallback(MovArr *(*callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter)) {
+void MovGraph::setSelFunc(MovArr *(*callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter)) {
_callback1 = callback1;
}
-bool MovGraph::method3C(StaticANIObject *ani, int flag) {
- int idx = getItemIndexByStaticAni(ani);
+bool MovGraph::resetPosition(StaticANIObject *ani, int flag) {
+ int idx = getObjectIndex(ani);
if (idx == -1)
return false;
@@ -967,7 +967,7 @@ bool MovGraph::method3C(StaticANIObject *ani, int flag) {
point.x = ani->_ox;
point.y = ani->_oy;
- findClosestLink(idx, &point, &movarr);
+ getNearestPoint(idx, &point, &movarr);
ani->setOXY(point.x, point.y);
if (flag) {
@@ -990,15 +990,15 @@ bool MovGraph::method3C(StaticANIObject *ani, int flag) {
return true;
}
-bool MovGraph::method44(StaticANIObject *ani, int x, int y) {
- int idx = getItemIndexByStaticAni(ani);
+bool MovGraph::canDropInventory(StaticANIObject *ani, int x, int y) {
+ int idx = getObjectIndex(ani);
MovArr m;
if (idx != -1) {
if (x != -1 || y != -1) {
int counter;
- Common::Array<MovItem *> *movitem = method28(ani, x, y, 0, &counter);
+ Common::Array<MovItem *> *movitem = getPaths(ani, x, y, 0, &counter);
if (movitem) {
MovArr *movarr = _callback1(ani, movitem, counter);
@@ -1009,7 +1009,7 @@ bool MovGraph::method44(StaticANIObject *ani, int x, int y) {
return true;
}
}
- } else if (calcChunk(idx, ani->_ox, ani->_oy, &m, 0) && m._link && (m._link->_flags & 0x4000000)) {
+ } else if (getHitPoint(idx, ani->_ox, ani->_oy, &m, 0) && m._link && (m._link->_flags & 0x4000000)) {
return true;
}
}
@@ -1021,13 +1021,13 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int
PicAniInfo picAniInfo;
int ss;
- Common::Array<MovItem *> *movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss);
+ Common::Array<MovItem *> *movitem = getPaths(subj, xpos, ypos, fuzzyMatch, &ss);
subj->getPicAniInfo(&picAniInfo);
if (movitem) {
MovArr *goal = _callback1(subj, movitem, ss);
- int idx = getItemIndexByStaticAni(subj);
+ int idx = getObjectIndex(subj);
for (int i = 0; i < _items[idx]->count; i++) {
if ((*_items[idx]->movitems)[i]->movarr == goal) {
@@ -1052,10 +1052,10 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int
}
}
- movitem = method28(subj, xpos, ypos, fuzzyMatch, &ss);
+ movitem = getPaths(subj, xpos, ypos, fuzzyMatch, &ss);
if (movitem) {
MovArr *goal = _callback1(subj, movitem, ss);
- int idx = getItemIndexByStaticAni(subj);
+ int idx = getObjectIndex(subj);
if (_items[idx]->count > 0) {
int arridx = 0;
@@ -1075,7 +1075,7 @@ MessageQueue *MovGraph::doWalkTo(StaticANIObject *subj, int xpos, int ypos, int
_items[idx]->movarr._afield_8 = -1;
_items[idx]->movarr._link = 0;
- MessageQueue *mq = fillMGMinfo(_items[idx]->ani, &_items[idx]->movarr, staticsId);
+ MessageQueue *mq = makeWholeQueue(_items[idx]->ani, &_items[idx]->movarr, staticsId);
if (mq) {
ExCommand *ex = new ExCommand();
ex->_messageKind = 17;
@@ -1106,7 +1106,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
int rescount;
- Common::Array<MovItem *> *movitems = method28(ani, x1, y1, flag1, &rescount);
+ Common::Array<MovItem *> *movitems = getPaths(ani, x1, y1, flag1, &rescount);
if (!movitems) {
ani->setPicAniInfo(&picinfo);
@@ -1117,7 +1117,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
MessageQueue *res = 0;
MovArr *goal = _callback1(ani, movitems, rescount);
- int idx = getItemIndexByStaticAni(ani);
+ int idx = getObjectIndex(ani);
MovGraphItem *movgitem = _items[idx];
int cnt = movgitem->count;
@@ -1130,7 +1130,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
_items[idx]->movarr._afield_8 = -1;
_items[idx]->movarr._link = 0;
- res = fillMGMinfo(_items[idx]->ani, &_items[idx]->movarr, stid2);
+ res = makeWholeQueue(_items[idx]->ani, &_items[idx]->movarr, stid2);
break;
}
@@ -1141,7 +1141,7 @@ MessageQueue *MovGraph::sub1(StaticANIObject *ani, int x, int y, int stid, int x
return res;
}
-MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId) {
+MessageQueue *MovGraph::makeWholeQueue(StaticANIObject *ani, MovArr *movarr, int staticsId) {
if (!movarr->_movStepCount)
return 0;
@@ -1177,16 +1177,16 @@ MessageQueue *MovGraph::fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int st
if (i == movarr->_movStepCount - 1) {
nx = movarr->_point.x;
ny = movarr->_point.y;
- nd = st->link->_movGraphNode1->_distance;
+ nd = st->link->_graphSrc->_z;
} else {
if (st->sfield_0) {
- nx = st->link->_movGraphNode1->_x;
- ny = st->link->_movGraphNode1->_y;
- nd = st->link->_movGraphNode1->_distance;
+ nx = st->link->_graphSrc->_x;
+ ny = st->link->_graphSrc->_y;
+ nd = st->link->_graphSrc->_z;
} else {
- nx = st->link->_movGraphNode2->_x;
- ny = st->link->_movGraphNode2->_y;
- nd = st->link->_movGraphNode2->_distance;
+ nx = st->link->_graphDst->_x;
+ ny = st->link->_graphDst->_y;
+ nd = st->link->_graphDst->_z;
}
}
@@ -1262,7 +1262,7 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati
_items[idx]->movarr._afield_8 = -1;
_items[idx]->movarr._link = 0;
- MessageQueue *mq = fillMGMinfo(_items[idx]->ani, &_items[idx]->movarr, 0);
+ MessageQueue *mq = makeWholeQueue(_items[idx]->ani, &_items[idx]->movarr, 0);
if (!mq)
return 0;
@@ -1284,24 +1284,24 @@ MessageQueue *MovGraph::method50(StaticANIObject *ani, MovArr *movarr, int stati
return mq;
}
-double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch) {
- int n1x = link->_movGraphNode1->_x;
- int n1y = link->_movGraphNode1->_y;
- int n2x = link->_movGraphNode2->_x;
- int n2y = link->_movGraphNode2->_y;
+double MovGraph::putToLink(Common::Point *point, MovGraphLink *link, int fuzzyMatch) {
+ int n1x = link->_graphSrc->_x;
+ int n1y = link->_graphSrc->_y;
+ int n2x = link->_graphDst->_x;
+ int n2y = link->_graphDst->_y;
double dist1x = (double)(point->x - n1x);
- double dist1y = (double)(n1y - point->y);
+ double dist1y = (double)(point->y - n1y);
double dist2x = (double)(n2x - n1x);
double dist2y = (double)(n2y - n1y);
- double dist1 = sqrt(dist1y * dist1y + dist1x * dist1x);
- double dist2 = ((double)(n1y - n2y) * dist1y + dist2x * dist1x) / link->_distance / dist1;
+ double dist1 = sqrt(dist1x * dist1x + dist1y * dist1y);
+ double dist2 = (dist2y * dist1y + dist2x * dist1x) / link->_length / dist1;
double distm = dist2 * dist1;
double res = sqrt(1.0 - dist2 * dist2) * dist1;
- if (dist2 <= 0.0 || distm >= link->_distance) {
+ if (dist2 <= 0.0 || distm >= link->_length) {
if (fuzzyMatch) {
if (dist2 > 0.0) {
- if (distm >= link->_distance) {
+ if (distm >= link->_length) {
point->x = n2x;
point->y = n2y;
}
@@ -1313,14 +1313,14 @@ double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int fuzz
return -1.0;
}
} else {
- point->x = (int)(n1x + (dist2x * distm / link->_distance));
- point->y = (int)(n1y + (dist2y * distm / link->_distance));
+ point->x = (int)(n1x + (dist2x * distm / link->_length));
+ point->y = (int)(n1y + (dist2y * distm / link->_length));
}
return res;
}
-void MovGraph::calcNodeDistancesAndAngles() {
+void MovGraph::recalcLinkParams() {
for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) {
assert(((CObject *)*i)->_objtype == kObjTypeMovGraphLink);
@@ -1328,11 +1328,11 @@ void MovGraph::calcNodeDistancesAndAngles() {
lnk->_flags &= 0x7FFFFFFF;
- lnk->calcNodeDistanceAndAngle();
+ lnk->recalcLength();
}
}
-bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr) {
+bool MovGraph::getNearestPoint(int unusedArg, Common::Point *p, MovArr *movarr) {
MovGraphLink *link = 0;
double mindist = 1.0e20;
int resx = 0, resy = 0;
@@ -1341,14 +1341,14 @@ bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr)
MovGraphLink *lnk = (MovGraphLink *)*i;
if ((lnk->_flags & 0x10000000) && !(lnk->_flags & 0x20000000) ) {
- double dx1 = lnk->_movGraphNode1->_x - p->x;
- double dy1 = lnk->_movGraphNode1->_y - p->y;
- double dx2 = lnk->_movGraphNode2->_x - p->x;
- double dy2 = lnk->_movGraphNode2->_y - p->y;
- double dx3 = lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x;
- double dy3 = lnk->_movGraphNode2->_y - lnk->_movGraphNode1->_y;
+ double dx1 = lnk->_graphSrc->_x - p->x;
+ double dy1 = lnk->_graphSrc->_y - p->y;
+ double dx2 = lnk->_graphDst->_x - p->x;
+ double dy2 = lnk->_graphDst->_y - p->y;
+ double dx3 = lnk->_graphDst->_x - lnk->_graphSrc->_x;
+ double dy3 = lnk->_graphDst->_y - lnk->_graphSrc->_y;
double sq1 = sqrt(dy1 * dy1 + dx1 * dx1);
- double sdist = (dy3 * dy1 + dx3 * dx1) / lnk->_distance / sq1;
+ double sdist = (dy3 * dy1 + dx3 * dx1) / lnk->_length / sq1;
double ldist = sdist * sq1;
double dist = sqrt(1.0 - sdist * sdist) * sq1;
@@ -1357,14 +1357,14 @@ bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr)
dist = sqrt(dx1 * dx1 + dy1 * dy1);
}
- if (ldist > lnk->_distance) {
- ldist = lnk->_distance;
+ if (ldist > lnk->_length) {
+ ldist = lnk->_length;
dist = sqrt(dx2 * dx2 + dy2 * dy2);
}
- if (ldist >= 0.0 && ldist <= lnk->_distance && dist < mindist) {
- resx = lnk->_movGraphNode1->_x + (int)(dx3 * ldist / lnk->_distance);
- resy = lnk->_movGraphNode1->_y + (int)(dy3 * ldist / lnk->_distance);
+ if (ldist >= 0.0 && ldist <= lnk->_length && dist < mindist) {
+ resx = lnk->_graphSrc->_x + (int)(dx3 * ldist / lnk->_length);
+ resy = lnk->_graphSrc->_y + (int)(dy3 * ldist / lnk->_length);
mindist = dist;
link = lnk;
@@ -1387,7 +1387,7 @@ bool MovGraph::findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr)
return false;
}
-int MovGraph::getItemIndexByStaticAni(StaticANIObject *ani) {
+int MovGraph::getObjectIndex(StaticANIObject *ani) {
for (uint i = 0; i < _items.size(); i++)
if (_items[i]->ani == ani)
return i;
@@ -1395,7 +1395,7 @@ int MovGraph::getItemIndexByStaticAni(StaticANIObject *ani) {
return -1;
}
-Common::Array<MovArr *> *MovGraph::genMovArr(int x, int y, int *arrSize, int flag1, int flag2) {
+Common::Array<MovArr *> *MovGraph::getHitPoints(int x, int y, int *arrSize, int flag1, int flag2) {
if (!_links.size()) {
*arrSize = 0;
@@ -1410,15 +1410,15 @@ Common::Array<MovArr *> *MovGraph::genMovArr(int x, int y, int *arrSize, int fla
if (flag1) {
Common::Point point(x, y);
- double dist = calcDistance(&point, lnk, 0);
+ double dist = putToLink(&point, lnk, 0);
if (dist >= 0.0 && dist < 2.0) {
movarr = new MovArr;
movarr->_link = lnk;
- movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - point.y) +
- (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(point.x - lnk->_movGraphNode1->_x)) /
- lnk->_distance / lnk->_distance;
+ movarr->_dist = ((double)(lnk->_graphSrc->_y - lnk->_graphDst->_y) * (double)(lnk->_graphSrc->_y - point.y) +
+ (double)(lnk->_graphDst->_x - lnk->_graphSrc->_x) * (double)(point.x - lnk->_graphSrc->_x)) /
+ lnk->_length / lnk->_length;
movarr->_point = point;
arr->push_back(movarr);
@@ -1431,27 +1431,27 @@ Common::Array<MovArr *> *MovGraph::genMovArr(int x, int y, int *arrSize, int fla
movarr = new MovArr;
movarr->_link = lnk;
movarr->_dist = 0.0;
- movarr->_point.x = lnk->_movGraphNode1->_x;
- movarr->_point.y = lnk->_movGraphNode1->_y;
+ movarr->_point.x = lnk->_graphSrc->_x;
+ movarr->_point.y = lnk->_graphSrc->_y;
arr->push_back(movarr);
movarr = new MovArr;
movarr->_link = lnk;
movarr->_dist = 1.0;
- movarr->_point.x = lnk->_movGraphNode1->_x;
- movarr->_point.y = lnk->_movGraphNode1->_y;
+ movarr->_point.x = lnk->_graphSrc->_x;
+ movarr->_point.y = lnk->_graphSrc->_y;
arr->push_back(movarr);
}
} else {
movarr = new MovArr;
movarr->_link = lnk;
- movarr->_dist = ((double)(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y) * (double)(lnk->_movGraphNode1->_y - y) +
- (double)(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) * (double)(x - lnk->_movGraphNode1->_x)) /
- lnk->_distance / lnk->_distance;
+ movarr->_dist = ((double)(lnk->_graphSrc->_y - lnk->_graphDst->_y) * (double)(lnk->_graphSrc->_y - y) +
+ (double)(lnk->_graphDst->_x - lnk->_graphSrc->_x) * (double)(x - lnk->_graphSrc->_x)) /
+ lnk->_length / lnk->_length;
movarr->_point.x = x;
movarr->_point.y = y;
- calcDistance(&movarr->_point, lnk, 0);
+ putToLink(&movarr->_point, lnk, 0);
arr->push_back(movarr);
}
@@ -1479,9 +1479,9 @@ void MovGraph::findAllPaths(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array
for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) {
MovGraphLink *l = (MovGraphLink *)*i;
- if (l->_movGraphNode1 != lnk->_movGraphNode1) {
- if (l->_movGraphNode2 != lnk->_movGraphNode1) {
- if (l->_movGraphNode1 != lnk->_movGraphNode2 && l->_movGraphNode2 != lnk->_movGraphNode2)
+ if (l->_graphSrc != lnk->_graphSrc) {
+ if (l->_graphDst != lnk->_graphSrc) {
+ if (l->_graphSrc != lnk->_graphDst && l->_graphDst != lnk->_graphDst)
continue;
}
}
@@ -1495,7 +1495,7 @@ void MovGraph::findAllPaths(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array
}
// Returns a list of possible paths two points in graph space
-Common::Array<MovItem *> *MovGraph::calcMovItems(MovArr *currPos, MovArr *destPos, int *pathCount) {
+Common::Array<MovItem *> *MovGraph::getPaths(MovArr *currPos, MovArr *destPos, int *pathCount) {
Common::Array<MovGraphLink *> tempObList1;
Common::Array<MovGraphLink *> allPaths;
@@ -1531,7 +1531,7 @@ void MovGraph::genMovItem(MovItem *movitem, MovGraphLink *grlink, MovArr *movarr
warning("STUB: MovGraph::genMovItem()");
}
-bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) {
+bool MovGraph::getHitPoint(int idx, int x, int y, MovArr *arr, int a6) {
int staticsId;
if (_items[idx]->ani->_statics) {
@@ -1545,10 +1545,10 @@ bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) {
int arrSize;
- Common::Array<MovArr *> *movarr = genMovArr(x, y, &arrSize, 0, 1);
+ Common::Array<MovArr *> *movarr = getHitPoints(x, y, &arrSize, 0, 1);
if (!movarr)
- return findClosestLink(idx, 0, arr);
+ return getNearestPoint(idx, 0, arr);
bool res = false;
@@ -1582,20 +1582,20 @@ bool MovGraph::calcChunk(int idx, int x, int y, MovArr *arr, int a6) {
}
void MovGraph::setEnds(MovStep *step1, MovStep *step2) {
- if (step1->link->_movGraphNode1 == step2->link->_movGraphNode2) {
+ if (step1->link->_graphSrc == step2->link->_graphDst) {
step1->sfield_0 = 1;
step2->sfield_0 = 1;
return;
}
- if (step1->link->_movGraphNode1 == step2->link->_movGraphNode1) {
+ if (step1->link->_graphSrc == step2->link->_graphSrc) {
step1->sfield_0 = 1;
step2->sfield_0 = 0;
} else {
step1->sfield_0 = 0;
- if (step1->link->_movGraphNode2 != step2->link->_movGraphNode1) {
+ if (step1->link->_graphDst != step2->link->_graphSrc) {
step2->sfield_0 = 1;
} else {
step2->sfield_0 = 0;
@@ -1634,6 +1634,7 @@ int MovGraph2::getItemSubIndexByMGM(int index, StaticANIObject *ani) {
int min = 0;
for (int i = 0; i < 4; i++) {
+ warning("WWW 5");
int tmp = _mgm.refreshOffsets(ani->_id, ani->_statics->_staticsId, _items2[index]->_subItems[i]._staticsId1);
if (tmp >= 0 && (minidx == -1 || tmp < min)) {
@@ -1777,8 +1778,8 @@ bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) {
return true;
}
-void MovGraph2::addObject(StaticANIObject *obj) {
- MovGraph::addObject(obj);
+void MovGraph2::attachObject(StaticANIObject *obj) {
+ MovGraph::attachObject(obj);
int id = getItemIndexByGameObjectId(obj->_id);
@@ -2031,26 +2032,27 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) {
return mq;
}
-int MovGraph2::removeObject(StaticANIObject *obj) {
- warning("STUB: MovGraph2::removeObject()");
+int MovGraph2::detachObject(StaticANIObject *obj) {
+ warning("STUB: MovGraph2::detachObject()");
return 0;
}
-void MovGraph2::freeItems() {
+void MovGraph2::detachAllObjects() {
for (uint i = 0; i < _items2.size(); i++)
delete _items2[i];
_items2.clear();
}
-MessageQueue *MovGraph2::method34(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) {
+MessageQueue *MovGraph2::startMove(StaticANIObject *ani, int xpos, int ypos, int fuzzyMatch, int staticsId) {
if (!ani->isIdle())
return 0;
if (ani->_flags & 0x100)
return 0;
+ warning("WWW 3");
MessageQueue *mq = doWalkTo(ani, xpos, ypos, fuzzyMatch, staticsId);
if (!mq)
@@ -2119,6 +2121,7 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
bool subMgm = false;
if (idxsub == -1) {
+ warning("WWW 4");
idxsub = getItemSubIndexByMGM(idx, obj);
subMgm = true;
@@ -2240,9 +2243,9 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
int dx2, dy2;
if (linkInfoSource.node)
- movInfo1.distance1 = linkInfoSource.node->_distance;
+ movInfo1.distance1 = linkInfoSource.node->_z;
else
- movInfo1.distance1 = linkInfoSource.link->_movGraphNode1->_distance;
+ movInfo1.distance1 = linkInfoSource.link->_graphSrc->_z;
if (linkInfoDest.node) {
dx2 = linkInfoDest.node->_x;
@@ -2251,18 +2254,18 @@ MessageQueue *MovGraph2::doWalkTo(StaticANIObject *obj, int xpos, int ypos, int
movInfo1.pt2.x = linkInfoDest.node->_x;
movInfo1.pt2.y = linkInfoDest.node->_y;
- movInfo1.distance2 = linkInfoDest.node->_distance;
+ movInfo1.distance2 = linkInfoDest.node->_z;
} else {
movInfo1.pt2.x = xpos;
movInfo1.pt2.y = ypos;
- MovGraphNode *nod = linkInfoDest.link->_movGraphNode1;
+ MovGraphNode *nod = linkInfoDest.link->_graphSrc;
double dst1 = sqrt((double)((ypos - nod->_y) * (ypos - nod->_y) + (xpos - nod->_x) * (xpos - nod->_x)));
- int dst = linkInfoDest.link->_movGraphNode2->_distance - nod->_distance;
+ int dst = linkInfoDest.link->_graphDst->_z - nod->_z;
- movInfo1.distance2 = (int)(nod->_distance + (dst1 * (double)dst / linkInfoDest.link->_distance));
+ movInfo1.distance2 = (int)(nod->_z + (dst1 * (double)dst / linkInfoDest.link->_length));
- calcDistance(&movInfo1.pt2, linkInfoDest.link, 1);
+ putToLink(&movInfo1.pt2, linkInfoDest.link, 1);
dx1 = movInfo1.pt1.x;
dy1 = movInfo1.pt1.y;
@@ -2350,7 +2353,7 @@ int MovGraph2::getShortSide(MovGraphLink *lnk, int x, int y) {
bool cond;
if (lnk)
- cond = abs(lnk->_movGraphNode2->_x - lnk->_movGraphNode1->_x) > abs(lnk->_movGraphNode2->_y - lnk->_movGraphNode1->_y);
+ cond = abs(lnk->_graphDst->_x - lnk->_graphSrc->_x) > abs(lnk->_graphDst->_y - lnk->_graphSrc->_y);
else
cond = abs(x) > abs(y);
@@ -2361,16 +2364,16 @@ int MovGraph2::getShortSide(MovGraphLink *lnk, int x, int y) {
}
int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common::Rect *rect, Common::Point *point) {
- MovGraphNode *node1 = (*linkList)[idx]->_movGraphNode1;
- MovGraphNode *node2 = (*linkList)[idx]->_movGraphNode2;
+ MovGraphNode *node1 = (*linkList)[idx]->_graphSrc;
+ MovGraphNode *node2 = (*linkList)[idx]->_graphDst;
MovGraphNode *node3 = node1;
if (idx != 0) {
MovGraphLink *lnk = (*linkList)[idx - 1];
- if (lnk->_movGraphNode2 != node1) {
- if (lnk->_movGraphNode1 != node1) {
- if (lnk->_movGraphNode2 == node2 || lnk->_movGraphNode1 == node2) {
+ if (lnk->_graphDst != node1) {
+ if (lnk->_graphSrc != node1) {
+ if (lnk->_graphDst == node2 || lnk->_graphSrc == node2) {
node3 = node2;
node2 = node1;
}
@@ -2381,10 +2384,10 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common
} else if (idx != (int)(linkList->size() - 1)) {
MovGraphLink *lnk = (*linkList)[idx + 1];
- if (lnk->_movGraphNode2 == node1 || lnk->_movGraphNode1 == node1) {
+ if (lnk->_graphDst == node1 || lnk->_graphSrc == node1) {
node3 = node2;
node2 = node1;
- } else if (lnk->_movGraphNode2 == node2 || lnk->_movGraphNode1 == node2) {
+ } else if (lnk->_graphDst == node2 || lnk->_graphSrc == node2) {
node3 = node1;
}
}
@@ -2397,8 +2400,8 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common
rect->bottom = node2->_y;
}
if (point) {
- point->x = node3->_distance;
- point->y = node2->_distance;
+ point->x = node3->_z;
+ point->y = node2->_z;
}
if (abs(node3->_x - node2->_x) <= abs(node3->_y - node2->_y))
@@ -2620,13 +2623,13 @@ MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) {
if (fuzzyMatch) {
point.x = x;
point.y = y;
- double dst = calcDistance(&point, lnk, 0);
+ double dst = putToLink(&point, lnk, 0);
if (dst >= 0.0 && dst < 2.0)
return lnk;
} else if (!(lnk->_flags & 0x20000000)) {
if (lnk->_movGraphReact->pointInRegion(x, y)) {
- if (abs(lnk->_movGraphNode1->_x - lnk->_movGraphNode2->_x) <= abs(lnk->_movGraphNode1->_y - lnk->_movGraphNode2->_y)) {
+ if (abs(lnk->_graphSrc->_x - lnk->_graphDst->_x) <= abs(lnk->_graphSrc->_y - lnk->_graphDst->_y)) {
if (idx == 2 || idx == 3)
return lnk;
res = lnk;
@@ -2652,14 +2655,14 @@ MovGraphLink *MovGraph2::findLink2(int x, int y) {
MovGraphLink *lnk = (MovGraphLink *)*i;
if (!(lnk->_flags & 0x20000000)) {
- double n1x = lnk->_movGraphNode1->_x;
- double n1y = lnk->_movGraphNode1->_y;
- double n2x = lnk->_movGraphNode2->_x;
- double n2y = lnk->_movGraphNode2->_y;
+ double n1x = lnk->_graphSrc->_x;
+ double n1y = lnk->_graphSrc->_y;
+ double n2x = lnk->_graphDst->_x;
+ double n2y = lnk->_graphDst->_y;
double n1dx = n1x - x;
double n1dy = n1y - y;
double dst1 = sqrt(n1dy * n1dy + n1dx * n1dx);
- double coeff1 = ((n1y - n2y) * n1dy + (n2x - n1x) * n1dx) / lnk->_distance / dst1;
+ double coeff1 = ((n1y - n2y) * n1dy + (n2x - n1x) * n1dx) / lnk->_length / dst1;
double dst3 = coeff1 * dst1;
double dst2 = sqrt(1.0 - coeff1 * coeff1) * dst1;
@@ -2667,11 +2670,11 @@ MovGraphLink *MovGraph2::findLink2(int x, int y) {
dst3 = 0.0;
dst2 = sqrt(n1dy * n1dy + n1dx * n1dx);
}
- if (dst3 > lnk->_distance) {
- dst3 = lnk->_distance;
+ if (dst3 > lnk->_length) {
+ dst3 = lnk->_length;
dst2 = sqrt((n2x - x) * (n2x - x) + (n2y - y) * (n2y - y));
}
- if (dst3 >= 0.0 && dst3 <= lnk->_distance && dst2 < mindist) {
+ if (dst3 >= 0.0 && dst3 <= lnk->_length && dst2 < mindist) {
mindist = dst2;
res = lnk;
}
@@ -2694,7 +2697,7 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest,
for (ObList::iterator i = _links.begin(); i != _links.end(); ++i) {
MovGraphLink *lnk = (MovGraphLink *)*i;
- if ((lnk->_movGraphNode1 == linkInfoSource->node || lnk->_movGraphNode2 == linkInfoSource->node) && !(lnk->_flags & 0xA0000000)) {
+ if ((lnk->_graphSrc == linkInfoSource->node || lnk->_graphDst == linkInfoSource->node) && !(lnk->_flags & 0xA0000000)) {
linkInfoWorkSource.node = 0;
linkInfoWorkSource.link = lnk;
@@ -2704,18 +2707,18 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest,
double newDistance = findMinPath(&linkInfoWorkSource, linkInfoDest, &tmpList);
- if (newDistance >= 0.0 && (minDistance < 0.0 || newDistance + lnk->_distance < minDistance)) {
+ if (newDistance >= 0.0 && (minDistance < 0.0 || newDistance + lnk->_length < minDistance)) {
listObj->clear();
listObj->push_back(tmpList);
- minDistance = newDistance + lnk->_distance;
+ minDistance = newDistance + lnk->_length;
}
lnk->_flags &= 0x7FFFFFFF;
}
}
} else if (linkInfoSource->link) {
- linkInfoWorkSource.node = linkInfoSource->link->_movGraphNode1;
+ linkInfoWorkSource.node = linkInfoSource->link->_graphSrc;
linkInfoWorkSource.link = 0;
Common::Array<MovGraphLink *> tmpList;
@@ -2732,7 +2735,7 @@ double MovGraph2::findMinPath(LinkInfo *linkInfoSource, LinkInfo *linkInfoDest,
}
linkInfoWorkSource.link = 0;
- linkInfoWorkSource.node = linkInfoSource->link->_movGraphNode2;
+ linkInfoWorkSource.node = linkInfoSource->link->_graphDst;
tmpList.clear();
@@ -2775,11 +2778,11 @@ MovGraphNode *MovGraph::calcOffset(int ox, int oy) {
}
MovGraphLink::MovGraphLink() {
- _distance = 0;
+ _length = 0;
_angle = 0;
_flags = 0x10000000;
- _movGraphNode2 = 0;
- _movGraphNode1 = 0;
+ _graphDst = 0;
+ _graphSrc = 0;
_field_3C = 0;
_field_38 = 0;
_movGraphReact = 0;
@@ -2805,14 +2808,14 @@ bool MovGraphLink::load(MfcArchive &file) {
_flags = file.readUint32LE();
debug(8, "GraphNode1");
- _movGraphNode1 = (MovGraphNode *)file.readClass();
+ _graphSrc = (MovGraphNode *)file.readClass();
debug(8, "GraphNode2");
- _movGraphNode2 = (MovGraphNode *)file.readClass();
+ _graphDst = (MovGraphNode *)file.readClass();
- _distance = file.readDouble();
+ _length = file.readDouble();
_angle = file.readDouble();
- debug(8, "distance: %g, angle: %g", _distance, _angle);
+ debug(8, "length: %g, angle: %g", _length, _angle);
_movGraphReact = (MovGraphReact *)file.readClass();
_name = file.readPascalString();
@@ -2820,12 +2823,12 @@ bool MovGraphLink::load(MfcArchive &file) {
return true;
}
-void MovGraphLink::calcNodeDistanceAndAngle() {
- if (_movGraphNode1) {
- double dx = _movGraphNode2->_x - _movGraphNode1->_x;
- double dy = _movGraphNode2->_y - _movGraphNode1->_y;
+void MovGraphLink::recalcLength() {
+ if (_graphSrc) {
+ double dx = _graphDst->_x - _graphSrc->_x;
+ double dy = _graphDst->_y - _graphSrc->_y;
- _distance = sqrt(dy * dy + dx * dx);
+ _length = sqrt(dy * dy + dx * dx);
_angle = atan2(dx, dy);
}
}
@@ -2836,7 +2839,7 @@ bool MovGraphNode::load(MfcArchive &file) {
_field_14 = file.readUint32LE();
_x = file.readUint32LE();
_y = file.readUint32LE();
- _distance = file.readUint32LE();
+ _z = file.readUint32LE();
return true;
}
@@ -3032,7 +3035,7 @@ int startWalkTo(int objId, int objKey, int x, int y, int fuzzyMatch) {
MctlCompound *mc = getCurrSceneSc2MotionController();
if (mc)
- return (mc->method34(g_fp->_currentScene->getStaticANIObject1ById(objId, objKey), x, y, fuzzyMatch, 0) != 0);
+ return (mc->startMove(g_fp->_currentScene->getStaticANIObject1ById(objId, objKey), x, y, fuzzyMatch, 0) != 0);
return 0;
}
@@ -3042,7 +3045,7 @@ bool doSomeAnimation(int objId, int objKey, int a3) {
MctlCompound *cmp = getCurrSceneSc2MotionController();
if (ani && cmp)
- return cmp->method3C(ani, a3);
+ return cmp->resetPosition(ani, a3);
return false;
}
diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h
index c488039e22..41860e32d0 100644
--- a/engines/fullpipe/motion.h
+++ b/engines/fullpipe/motion.h
@@ -48,19 +48,19 @@ public:
virtual bool load(MfcArchive &file);
virtual void methodC() {}
virtual void method10() {}
- virtual void clearEnabled() { _isEnabled = false; }
- virtual void setEnabled() { _isEnabled = true; }
- virtual void addObject(StaticANIObject *obj) {}
- virtual int removeObject(StaticANIObject *obj) { return 0; }
- virtual void freeItems() {}
- virtual Common::Array<MovItem *> *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { return 0; }
- virtual bool method2C(StaticANIObject *obj, int x, int y) { return false; }
+ virtual void deactivate() { _isEnabled = false; }
+ virtual void activate() { _isEnabled = true; }
+ virtual void attachObject(StaticANIObject *obj) {}
+ virtual int detachObject(StaticANIObject *obj) { return 0; }
+ virtual void detachAllObjects() {}
+ virtual Common::Array<MovItem *> *getPaths(StaticANIObject *ani, int x, int y, int flag1, int *rescount) { return 0; }
+ virtual bool setPosImmediate(StaticANIObject *obj, int x, int y) { return false; }
virtual int method30() { return 0; }
- virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
- virtual void changeCallback(MovArr *(*_callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter)) {}
- virtual bool method3C(StaticANIObject *ani, int flag) { return 0; }
+ virtual MessageQueue *startMove(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
+ virtual void setSelFunc(MovArr *(*_callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter)) {}
+ virtual bool resetPosition(StaticANIObject *ani, int flag) { return 0; }
virtual int method40() { return 0; }
- virtual bool method44(StaticANIObject *ani, int x, int y) { return false; }
+ virtual bool canDropInventory(StaticANIObject *ani, int x, int y) { return false; }
virtual int method48() { return -1; }
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId) { return 0; }
@@ -82,7 +82,7 @@ public:
virtual bool pointInRegion(int x, int y);
};
-class MctlCompoundArrayItem : public CObject {
+class MctlItem : public CObject {
public:
MotionController *_motionControllerObj;
MovGraphReact *_movGraphReactObj;
@@ -92,11 +92,11 @@ public:
int _field_28;
public:
- MctlCompoundArrayItem() : _movGraphReactObj(0), _motionControllerObj(0), _field_20(0), _field_24(0), _field_28(0) {}
- ~MctlCompoundArrayItem();
+ MctlItem() : _movGraphReactObj(0), _motionControllerObj(0), _field_20(0), _field_24(0), _field_28(0) {}
+ ~MctlItem();
};
-class MctlCompoundArray : public Common::Array<MctlCompoundArrayItem *>, public CObject {
+class MctlCompoundArray : public Common::Array<MctlItem *>, public CObject {
public:
virtual bool load(MfcArchive &file);
};
@@ -109,10 +109,10 @@ public:
virtual bool load(MfcArchive &file);
- virtual void addObject(StaticANIObject *obj);
- virtual int removeObject(StaticANIObject *obj);
- virtual void freeItems();
- virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual void attachObject(StaticANIObject *obj);
+ virtual int detachObject(StaticANIObject *obj);
+ virtual void detachAllObjects();
+ virtual MessageQueue *startMove(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
void initMovGraph2();
@@ -156,10 +156,10 @@ public:
virtual ~MctlLadder();
int collisionDetection(StaticANIObject *man);
- virtual void addObject(StaticANIObject *obj);
- virtual int removeObject(StaticANIObject *obj) { return 1; }
- virtual void freeItems();
- virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual void attachObject(StaticANIObject *obj);
+ virtual int detachObject(StaticANIObject *obj) { return 1; }
+ virtual void detachAllObjects();
+ virtual MessageQueue *startMove(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
MessageQueue *controllerWalkTo(StaticANIObject *ani, int off);
@@ -173,12 +173,12 @@ class MovGraphNode : public CObject {
public:
int _x;
int _y;
- int _distance;
+ int _z;
int16 _field_10;
int _field_14;
public:
- MovGraphNode() : _x(0), _y(0), _distance(0), _field_10(0), _field_14(0) { _objtype = kObjTypeMovGraphNode; }
+ MovGraphNode() : _x(0), _y(0), _z(0), _field_10(0), _field_14(0) { _objtype = kObjTypeMovGraphNode; }
virtual bool load(MfcArchive &file);
};
@@ -218,14 +218,14 @@ public:
class MovGraphLink : public CObject {
public:
- MovGraphNode *_movGraphNode1;
- MovGraphNode *_movGraphNode2;
+ MovGraphNode *_graphSrc;
+ MovGraphNode *_graphDst;
DWordArray _dwordArray1;
DWordArray _dwordArray2;
int _flags;
int _field_38;
int _field_3C;
- double _distance;
+ double _length;
double _angle;
MovGraphReact *_movGraphReact;
char *_name;
@@ -236,7 +236,7 @@ class MovGraphLink : public CObject {
virtual bool load(MfcArchive &file);
- void calcNodeDistanceAndAngle();
+ void recalcLength();
};
struct MovStep {
@@ -290,30 +290,30 @@ public:
virtual bool load(MfcArchive &file);
- virtual void addObject(StaticANIObject *obj);
- virtual int removeObject(StaticANIObject *obj);
- virtual void freeItems();
- virtual Common::Array<MovItem *> *method28(StaticANIObject *ani, int x, int y, int flag1, int *rescount);
- virtual bool method2C(StaticANIObject *obj, int x, int y);
- virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
- virtual void changeCallback(MovArr *(*_callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter));
- virtual bool method3C(StaticANIObject *ani, int flag);
- virtual bool method44(StaticANIObject *ani, int x, int y);
+ virtual void attachObject(StaticANIObject *obj);
+ virtual int detachObject(StaticANIObject *obj);
+ virtual void detachAllObjects();
+ virtual Common::Array<MovItem *> *getPaths(StaticANIObject *ani, int x, int y, int flag1, int *rescount);
+ virtual bool setPosImmediate(StaticANIObject *obj, int x, int y);
+ virtual MessageQueue *startMove(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual void setSelFunc(MovArr *(*_callback1)(StaticANIObject *ani, Common::Array<MovItem *> *items, signed int counter));
+ virtual bool resetPosition(StaticANIObject *ani, int flag);
+ virtual bool canDropInventory(StaticANIObject *ani, int x, int y);
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual MessageQueue *method50(StaticANIObject *ani, MovArr *movarr, int staticsId);
- double calcDistance(Common::Point *point, MovGraphLink *link, int fuzzyMatch);
- void calcNodeDistancesAndAngles();
- bool findClosestLink(int unusedArg, Common::Point *p, MovArr *movarr);
+ double putToLink(Common::Point *point, MovGraphLink *link, int fuzzyMatch);
+ void recalcLinkParams();
+ bool getNearestPoint(int unusedArg, Common::Point *p, MovArr *movarr);
MovGraphNode *calcOffset(int ox, int oy);
- int getItemIndexByStaticAni(StaticANIObject *ani);
- Common::Array<MovArr *> *genMovArr(int x, int y, int *arrSize, int flag1, int flag2);
+ int getObjectIndex(StaticANIObject *ani);
+ Common::Array<MovArr *> *getHitPoints(int x, int y, int *arrSize, int flag1, int flag2);
void findAllPaths(MovGraphLink *lnk, MovGraphLink *lnk2, Common::Array<MovGraphLink *> &tempObList1, Common::Array<MovGraphLink *> &tempObList2);
- Common::Array<MovItem *> *calcMovItems(MovArr *movarr1, MovArr *movarr2, int *listCount);
+ Common::Array<MovItem *> *getPaths(MovArr *movarr1, MovArr *movarr2, int *listCount);
void genMovItem(MovItem *movitem, MovGraphLink *grlink, MovArr *movarr1, MovArr *movarr2);
- bool calcChunk(int idx, int x, int y, MovArr *arr, int a6);
+ bool getHitPoint(int idx, int x, int y, MovArr *arr, int a6);
MessageQueue *sub1(StaticANIObject *ani, int x, int y, int a5, int x1, int y1, int a8, int a9);
- MessageQueue *fillMGMinfo(StaticANIObject *ani, MovArr *movarr, int staticsId);
+ MessageQueue *makeWholeQueue(StaticANIObject *ani, MovArr *movarr, int staticsId);
void setEnds(MovStep *step1, MovStep *step2);
};
@@ -374,10 +374,10 @@ public:
Common::Array<MovGraph2Item *> _items2;
public:
- virtual void addObject(StaticANIObject *obj);
- virtual int removeObject(StaticANIObject *obj);
- virtual void freeItems();
- virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
+ virtual void attachObject(StaticANIObject *obj);
+ virtual int detachObject(StaticANIObject *obj);
+ virtual void detachAllObjects();
+ virtual MessageQueue *startMove(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
virtual MessageQueue *doWalkTo(StaticANIObject *subj, int xpos, int ypos, int fuzzyMatch, int staticsId);
int getItemIndexByGameObjectId(int objectId);
@@ -404,10 +404,9 @@ class MctlConnectionPoint : public CObject {
public:
int _connectionX;
int _connectionY;
- int _field_C;
- int _field_10;
- int16 _field_14;
- int16 _field_16;
+ int _mctlflags;
+ int _mctlstatic;
+ int16 _mctlmirror;
MessageQueue *_messageQueueObj;
int _motionControllerObj;
diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp
index 13c653ad09..32aa955a61 100644
--- a/engines/fullpipe/scenes.cpp
+++ b/engines/fullpipe/scenes.cpp
@@ -583,8 +583,8 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) {
_aniMan2 = _aniMan;
MctlCompound *cmp = getSc2MctlCompoundBySceneId(entrance->_sceneId);
cmp->initMovGraph2();
- cmp->addObject(_aniMan);
- cmp->setEnabled();
+ cmp->attachObject(_aniMan);
+ cmp->activate();
getGameLoaderInteractionController()->enableFlag24();
setInputDisabled(0);
diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h
index 0b7c4e7c8f..17ef5c3140 100644
--- a/engines/fullpipe/scenes.h
+++ b/engines/fullpipe/scenes.h
@@ -26,7 +26,7 @@
namespace Fullpipe {
struct Bat;
-struct BehaviorEntryInfo;
+struct BehaviorMove;
struct Hanger;
class MGM;
class MctlLadder;
@@ -346,12 +346,12 @@ public:
int scene06_sceneClickX;
int scene06_sceneClickY;
int scene06_mumsyPos;
- BehaviorEntryInfo *scene06_mumsyJumpBk;
- BehaviorEntryInfo *scene06_mumsyJumpFw;
+ BehaviorMove *scene06_mumsyJumpBk;
+ BehaviorMove *scene06_mumsyJumpFw;
int scene06_mumsyJumpBkPercent;
int scene06_mumsyJumpFwPercent;
- BehaviorEntryInfo *scene07_lukeAnim;
+ BehaviorMove *scene07_lukeAnim;
int scene07_lukePercent;
StaticANIObject *scene07_plusMinus;
diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp
index 4a87ae5b87..6c361d6f1a 100644
--- a/engines/fullpipe/scenes/scene04.cpp
+++ b/engines/fullpipe/scenes/scene04.cpp
@@ -238,7 +238,7 @@ int scene04_updateCursor() {
}
}
- if (g_fp->_objectIdAtCursor == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC4_DOWNTRUBA)
+ if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC4_DOWNTRUBA)
g_fp->_cursorId = PIC_CSR_GOD;
return g_fp->_cursorId;
@@ -275,7 +275,7 @@ void sceneHandler04_clickButton() {
}
void sceneHandler04_downLadder(int x, int y) {
- g_vars->scene04_ladder->method34(g_fp->_aniMan, x + g_vars->scene04_ladder->_ladder_field_20, y + g_vars->scene04_ladder->_ladder_field_24, 0, 0);
+ g_vars->scene04_ladder->startMove(g_fp->_aniMan, x + g_vars->scene04_ladder->_ladder_field_20, y + g_vars->scene04_ladder->_ladder_field_24, 0, 0);
}
void sceneHandler04_walkClimbLadder(ExCommand *ex) {
@@ -321,7 +321,7 @@ void sceneHandler04_walkClimbLadder(ExCommand *ex) {
g_vars->scene04_ladder->_ladder_field_20 = 0;
g_vars->scene04_ladder->_ladder_field_24 = -60;
- g_vars->scene04_ladder->addObject(g_fp->_aniMan);
+ g_vars->scene04_ladder->attachObject(g_fp->_aniMan);
if (g_vars->scene04_soundPlaying) {
g_vars->scene04_ladder->_ladmovements.front()->movVars->varUpStart = MV_MAN_STARTLADDER2;
@@ -337,7 +337,7 @@ void sceneHandler04_walkClimbLadder(ExCommand *ex) {
g_fp->_aniMan->_priority = 12;
- getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->clearEnabled();
+ getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->deactivate();
getGameLoaderInteractionController()->disableFlag24();
}
@@ -368,7 +368,7 @@ void sceneHandler04_clickLadder() {
} else {
if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) {
if (abs(1095 - g_vars->scene04_dudePosX) > 1 || abs(434 - g_vars->scene04_dudePosY) > 1) {
- MessageQueue *mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->method34(g_fp->_aniMan, 1095, 434, 1, ST_MAN_UP);
+ MessageQueue *mq = getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->startMove(g_fp->_aniMan, 1095, 434, 1, ST_MAN_UP);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0);
@@ -533,7 +533,7 @@ void sceneHandler04_manFromBottle() {
g_vars->scene04_ladder = 0;
- getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->setEnabled();
+ getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->activate();
getGameLoaderInteractionController()->enableFlag24();
}
@@ -1120,7 +1120,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) {
ex->_messageKind = 0;
- mc->setEnabled();
+ mc->activate();
getGameLoaderInteractionController()->enableFlag24();
} else {
delete mq;
@@ -1275,7 +1275,7 @@ void sceneHandler04_winArcade() {
g_vars->scene04_objectIsTaken = false;
g_vars->scene04_soundPlaying = false;
- getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->setEnabled();
+ getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->activate();
getGameLoaderInteractionController()->enableFlag24();
diff --git a/engines/fullpipe/scenes/scene06.cpp b/engines/fullpipe/scenes/scene06.cpp
index 06ec20dcb5..14042031bf 100644
--- a/engines/fullpipe/scenes/scene06.cpp
+++ b/engines/fullpipe/scenes/scene06.cpp
@@ -38,8 +38,8 @@
namespace Fullpipe {
void scene06_initMumsy() {
- g_vars->scene06_mumsyJumpFw = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene06_mumsy, ST_MOM_STANDS, QU_MOM_JUMPFW);
- g_vars->scene06_mumsyJumpBk = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene06_mumsy, ST_MOM_STANDS, QU_MOM_JUMPBK);
+ g_vars->scene06_mumsyJumpFw = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene06_mumsy, ST_MOM_STANDS, QU_MOM_JUMPFW);
+ g_vars->scene06_mumsyJumpBk = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene06_mumsy, ST_MOM_STANDS, QU_MOM_JUMPBK);
g_vars->scene06_mumsyJumpFwPercent = g_vars->scene06_mumsyJumpFw->_percent;
g_vars->scene06_mumsyJumpBkPercent = g_vars->scene06_mumsyJumpBk->_percent;
}
@@ -118,7 +118,7 @@ void sceneHandler06_winArcade() {
sceneHandler06_setExits(g_fp->_currentScene);
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
}
@@ -300,7 +300,7 @@ void sceneHandler06_startAiming() {
if (getCurrSceneSc2MotionController()->_isEnabled)
g_fp->_updateScreenCallback = sceneHandler06_updateScreenCallback;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_vars->scene06_ballDrop->queueMessageQueue(0);
@@ -313,7 +313,7 @@ void sceneHandler06_takeBall() {
|| abs(452 - g_fp->_aniMan->_oy) > 1
|| g_fp->_aniMan->_movement
|| g_fp->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1158, 452, 1, (0x4000 | ST_MAN_RIGHT));
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 1158, 452, 1, (0x4000 | ST_MAN_RIGHT));
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC6_TAKEBALL, 0, 0, 0, 1, 0, 0, 0);
@@ -562,7 +562,7 @@ int sceneHandler06(ExCommand *ex) {
case MSG_SC6_RESTORESCROLL:
g_fp->_aniMan2 = g_fp->_aniMan;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
sceneHandler06_setExits(g_fp->_currentScene);
break;
diff --git a/engines/fullpipe/scenes/scene07.cpp b/engines/fullpipe/scenes/scene07.cpp
index 6db8c30932..6f98d014bc 100644
--- a/engines/fullpipe/scenes/scene07.cpp
+++ b/engines/fullpipe/scenes/scene07.cpp
@@ -66,7 +66,7 @@ void sceneHandler07_openLuke() {
} else {
StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_CORNERSITTER, -1);
- g_vars->scene07_lukeAnim = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(ani, ST_CST_HANDLELESS, QU_CST_CLOSELUKE);
+ g_vars->scene07_lukeAnim = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(ani, ST_CST_HANDLELESS, QU_CST_CLOSELUKE);
g_vars->scene07_lukeAnim->_percent = g_vars->scene07_lukePercent;
}
@@ -78,7 +78,7 @@ void sceneHandler07_closeLuke() {
if (!g_vars->scene07_lukeAnim) {
StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_CORNERSITTER, -1);
- g_vars->scene07_lukeAnim = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(ani, ST_CST_HANDLELESS, QU_CST_CLOSELUKE);
+ g_vars->scene07_lukeAnim = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(ani, ST_CST_HANDLELESS, QU_CST_CLOSELUKE);
}
g_vars->scene07_lukePercent = g_vars->scene07_lukeAnim->_percent;
diff --git a/engines/fullpipe/scenes/scene08.cpp b/engines/fullpipe/scenes/scene08.cpp
index a5f5a8b389..d64df8688e 100644
--- a/engines/fullpipe/scenes/scene08.cpp
+++ b/engines/fullpipe/scenes/scene08.cpp
@@ -224,7 +224,7 @@ void sceneHandler08_startArcade() {
g_vars->scene08_onBelly = false;
getGameLoaderInteractionController()->disableFlag24();
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
g_vars->scene08_batuta->stopAnim_maybe();
@@ -276,7 +276,7 @@ void sceneHandler08_finishArcade() {
g_vars->scene08_inArcade = false;
getGameLoaderInteractionController()->enableFlag24();
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
}
void sceneHandler08_jumpOff(ExCommand *cmd) {
diff --git a/engines/fullpipe/scenes/scene09.cpp b/engines/fullpipe/scenes/scene09.cpp
index 99cf0b20fd..ffe8a1b2de 100644
--- a/engines/fullpipe/scenes/scene09.cpp
+++ b/engines/fullpipe/scenes/scene09.cpp
@@ -271,7 +271,7 @@ void sceneHandler09_spitterClick() {
g_vars->scene09_spitter->setPicAniInfo(&info);
if (ABS(x - g_fp->_aniMan->_ox) > 1 || ABS(y - g_fp->_aniMan->_oy) > 1) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC9_PLVCLICK, 0, 0, 0, 1, 0, 0, 0);
@@ -602,14 +602,14 @@ int sceneHandler09(ExCommand *cmd) {
break;
case MSG_SC9_FROMLADDER:
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_vars->scene09_dudeIsOnLadder = false;
break;
case MSG_SC9_TOLADDER:
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_vars->scene09_dudeIsOnLadder = true;
diff --git a/engines/fullpipe/scenes/scene10.cpp b/engines/fullpipe/scenes/scene10.cpp
index 8c9e0b67d0..3e2a918b64 100644
--- a/engines/fullpipe/scenes/scene10.cpp
+++ b/engines/fullpipe/scenes/scene10.cpp
@@ -82,7 +82,7 @@ void sceneHandler10_clickGum() {
int y = g_vars->scene10_gum->_oy - 48;
if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, y, 1, ST_MAN_RIGHT);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC10_CLICKGUM, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags = 2;
diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp
index 0ce82f5d5f..1fa5cabc15 100644
--- a/engines/fullpipe/scenes/scene11.cpp
+++ b/engines/fullpipe/scenes/scene11.cpp
@@ -191,7 +191,7 @@ void sceneHandler11_restartMan() {
chainObjQueue(0, QU_SC11_RESTARTMAN, 1);
getGameLoaderInteractionController()->enableFlag24();
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
g_vars->scene11_scrollIsEnabled = false;
}
@@ -234,7 +234,7 @@ int sceneHandler11_updateScreenCallback() {
void sceneHandler11_manToSwing() {
g_vars->scene11_arcadeIsOn = true;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_aniMan2->hide();
@@ -271,7 +271,7 @@ void sceneHandler11_putABoot() {
void sceneHandler11_putBoot() {
if (abs(353 - g_fp->_aniMan->_ox) > 1 || abs(498 - g_fp->_aniMan->_oy) > 1
|| g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 353, 498, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 353, 498, 1, ST_MAN_RIGHT);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC11_PUTBOOT, 0, 0, 0, 1, 0, 0, 0);
@@ -299,7 +299,7 @@ void sceneHandler11_jumpFromSwing() {
g_vars->scene11_hint->_flags &= 0xFFFB;
g_vars->scene11_scrollIsEnabled = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_vars->scene11_swingOldAngle = 0.0;
diff --git a/engines/fullpipe/scenes/scene13.cpp b/engines/fullpipe/scenes/scene13.cpp
index c7b3c96b93..1397248bd5 100644
--- a/engines/fullpipe/scenes/scene13.cpp
+++ b/engines/fullpipe/scenes/scene13.cpp
@@ -178,14 +178,14 @@ void sceneHandler13_openFast() {
}
void sceneHandler13_uneatGum() {
- BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW);
+ BehaviorMove *beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW);
if (beh) {
beh->_percent = 0;
beh->_delay = 36;
}
- beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_PLUU);
+ beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_PLUU);
if (beh) {
beh->_percent = 0;
beh->_delay = 36;
@@ -193,7 +193,7 @@ void sceneHandler13_uneatGum() {
}
void sceneHandler13_eatGum() {
- BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW);
+ BehaviorMove *beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_CHEW);
if (beh) {
beh->_percent = 10922;
@@ -216,7 +216,7 @@ void sceneHandler13_showGum() {
chainQueue(QU_SC13_SHOWGUM, 0);
}
-void sceneHandler13_setBehFlag(BehaviorEntryInfo *beh, bool flag) {
+void sceneHandler13_setBehFlag(BehaviorMove *beh, bool flag) {
if (!flag) {
beh->_percent = 327;
beh->_flags |= 1;
@@ -229,11 +229,11 @@ void sceneHandler13_setBehFlag(BehaviorEntryInfo *beh, bool flag) {
}
void sceneHandler13_walkForward(bool flag) {
- BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_RTOL);
+ BehaviorMove *beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT, QU_STR_RTOL);
sceneHandler13_setBehFlag(beh, flag);
- beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT, QU_STR_TURNR);
+ beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT, QU_STR_TURNR);
sceneHandler13_setBehFlag(beh, flag);
@@ -241,11 +241,11 @@ void sceneHandler13_walkForward(bool flag) {
}
void sceneHandler13_walkBackward(bool flag) {
- BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT|0x4000, QU_STR_LTOR);
+ BehaviorMove *beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_RIGHT|0x4000, QU_STR_LTOR);
sceneHandler13_setBehFlag(beh, flag);
- beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT|0x4000, QU_STR_TURNR_L);
+ beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene13_guard, ST_STR_LEFT|0x4000, QU_STR_TURNR_L);
sceneHandler13_setBehFlag(beh, flag);
diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp
index 446f477133..d3ba3c345e 100644
--- a/engines/fullpipe/scenes/scene14.cpp
+++ b/engines/fullpipe/scenes/scene14.cpp
@@ -174,7 +174,7 @@ void sceneHandler14_exitScene() {
chainQueue(QU_SC14_ENDARCADE, 0);
getGameLoaderInteractionController()->disableFlag24();
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
}
void sceneHandler14_showBallMan() {
@@ -266,8 +266,8 @@ void sceneHandler14_showBallFly() {
}
void sceneHandler14_grandmaJump() {
- BehaviorEntryInfo *beh1 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPFW);
- BehaviorEntryInfo *beh2 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPBK);
+ BehaviorMove *beh1 = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPFW);
+ BehaviorMove *beh2 = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPBK);
if (beh1) {
if (beh2) {
@@ -284,13 +284,13 @@ void sceneHandler14_endArcade() {
setInputDisabled(0);
getGameLoaderInteractionController()->enableFlag24();
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
- BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_BLINK);
+ BehaviorMove *beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_BLINK);
if (beh)
beh->_percent = 327;
- beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_THROW);
+ beh = g_fp->_behaviorManager->getBehaviorMoveByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_THROW);
if (beh)
beh->_percent = 0;
@@ -365,7 +365,7 @@ void sceneHandler14_startArcade() {
g_fp->_aniMan->_priority = 25;
}
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_aniMan2 = 0;
@@ -458,7 +458,7 @@ bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) {
if (cmd->_sceneClickX > 1237)
return false;
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1237, 451, 1, 0);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 1237, 451, 1, 0);
if (!mq)
return false;
@@ -473,7 +473,7 @@ bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) {
cmd->_messageKind = 0;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
return true;
}
diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp
index df005950d2..5079863b4e 100644
--- a/engines/fullpipe/scenes/scene16.cpp
+++ b/engines/fullpipe/scenes/scene16.cpp
@@ -298,7 +298,7 @@ void sceneHandler16_drink() {
void sceneHandler16_mugClick() {
if (abs(310 - g_fp->_aniMan->_ox) >= 1 || abs(449 - g_fp->_aniMan->_oy) >= 1
|| g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 310, 449, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 310, 449, 1, ST_MAN_RIGHT);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC16_MUGCLICK, 0, 0, 0, 1, 0, 0, 0);
diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp
index 4f6677876b..5af7ef9043 100644
--- a/engines/fullpipe/scenes/scene18and19.cpp
+++ b/engines/fullpipe/scenes/scene18and19.cpp
@@ -379,7 +379,7 @@ int scene19_updateCursor() {
void sceneHandler18_clickBoard() {
if (ABS(967 - g_fp->_aniMan->_ox) > 1 || ABS(379 - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 967, 379, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 967, 379, 1, ST_MAN_RIGHT);
ExCommand *ex = new ExCommand(0, 17, MSG_SC18_MANREADY, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags = 2;
diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp
index 542834b51a..f51469da69 100644
--- a/engines/fullpipe/scenes/scene22.cpp
+++ b/engines/fullpipe/scenes/scene22.cpp
@@ -191,7 +191,7 @@ void sceneHandler22_stoolLogic(ExCommand *cmd) {
xpos = 841;
manId = ST_MAN_RIGHT;
LABEL_31:
- mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, xpos, 449, 1, manId);
+ mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, xpos, 449, 1, manId);
if (!mq)
return;
@@ -278,7 +278,7 @@ void sceneHandler22_stoolLogic(ExCommand *cmd) {
}
}
- mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1010, 443, 1, ST_MAN_UP);
+ mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 1010, 443, 1, ST_MAN_UP);
if (mq) {
mq->addExCommandToEnd(cmd->createClone());
@@ -318,13 +318,13 @@ int sceneHandler22(ExCommand *cmd) {
g_vars->scene22_dudeIsOnStool = false;
g_vars->scene22_interactionIsDisabled = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
break;
case MSG_SC22_ONSTOOL:
g_vars->scene22_dudeIsOnStool = true;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
break;
diff --git a/engines/fullpipe/scenes/scene23.cpp b/engines/fullpipe/scenes/scene23.cpp
index ded467e438..d6075c271b 100644
--- a/engines/fullpipe/scenes/scene23.cpp
+++ b/engines/fullpipe/scenes/scene23.cpp
@@ -296,7 +296,7 @@ void sceneHandler23_pushButton(ExCommand *cmd) {
if (g_fp->_msgX == 276 && g_fp->_msgY == 438 )
return;
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 276, 438, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 276, 438, 1, ST_MAN_RIGHT);
if (mq) {
mq->addExCommandToEnd(cmd->createClone());
@@ -424,7 +424,7 @@ int sceneHandler23(ExCommand *cmd) {
case MSG_SC23_FROMSTOOL:
g_vars->scene23_isOnStool = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
@@ -438,7 +438,7 @@ int sceneHandler23(ExCommand *cmd) {
case MSG_SC23_ONSTOOL:
g_vars->scene23_isOnStool = true;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp
index a07330f057..07eda73cf2 100644
--- a/engines/fullpipe/scenes/scene25.cpp
+++ b/engines/fullpipe/scenes/scene25.cpp
@@ -153,7 +153,7 @@ void sceneHandler25_enterMan() {
if (g_vars->scene25_waterIsPresent) {
chainQueue(QU_SC25_ENTERUP_WATER, 1);
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
} else {
chainQueue(QU_SC25_ENTERUP_FLOOR, 1);
}
diff --git a/engines/fullpipe/scenes/scene26.cpp b/engines/fullpipe/scenes/scene26.cpp
index b9d9161e7d..baed928d00 100644
--- a/engines/fullpipe/scenes/scene26.cpp
+++ b/engines/fullpipe/scenes/scene26.cpp
@@ -257,7 +257,7 @@ void sceneHandler26_clickVent(StaticANIObject *ani, ExCommand *cmd) {
int y = ani->_oy + 61;
if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, y, 1, ST_MAN_UP);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC26_CLICKVENT, 0, 0, 0, 1, 0, 0, 0);
diff --git a/engines/fullpipe/scenes/scene27.cpp b/engines/fullpipe/scenes/scene27.cpp
index 8ec05caaff..9570d30913 100644
--- a/engines/fullpipe/scenes/scene27.cpp
+++ b/engines/fullpipe/scenes/scene27.cpp
@@ -159,7 +159,7 @@ void sceneHandler27_driverGiveVent() {
g_vars->scene27_driverHasVent = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
@@ -226,7 +226,7 @@ void sceneHandler27_throwBat() {
g_fp->_aniMan->startAnim(MV_MAN27_THROWBET, 0, -1);
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
@@ -247,7 +247,7 @@ void sceneHandler27_clickBat(ExCommand *cmd) {
if (ABS(bx - g_fp->_aniMan->_ox) > 1 || ABS(by - g_fp->_aniMan->_oy) > 1
|| g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, bx, by, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, bx, by, 1, ST_MAN_RIGHT);
if (mq) {
mq->addExCommandToEnd(cmd->createClone());
@@ -501,7 +501,7 @@ void sceneHandler27_batLogic() {
default:
chainQueue(QU_SC27_RESTARTBETS, 1);
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp
index de5a96e70d..75ba2567b2 100644
--- a/engines/fullpipe/scenes/scene28.cpp
+++ b/engines/fullpipe/scenes/scene28.cpp
@@ -258,7 +258,7 @@ void sceneHandler28_clickLift(int keycode) {
if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(472 - g_fp->_aniMan->_oy) > 1
|| g_fp->_aniMan->_movement
|| g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, 472, 1, ST_MAN_UP);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, x, 472, 1, ST_MAN_UP);
if (mq) {
ExCommand *ex = new ExCommand(0, 17, MSG_SC28_CLICKLIFT, 0, 0, 0, 1, 0, 0, 0);
ex->_excFlags |= 3;
diff --git a/engines/fullpipe/scenes/scene29.cpp b/engines/fullpipe/scenes/scene29.cpp
index 222a541554..a03671a4d0 100644
--- a/engines/fullpipe/scenes/scene29.cpp
+++ b/engines/fullpipe/scenes/scene29.cpp
@@ -687,7 +687,7 @@ void sceneHandler29_ballHitCheck() {
void sceneHandler29_manFromL() {
if (g_vars->scene29_manX < 497 && !g_vars->scene29_scrollingDisabled) {
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000);
@@ -700,7 +700,7 @@ void sceneHandler29_manFromL() {
}
void sceneHandler29_manFromR() {
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
chainQueue(QU_SC29_MANFROM_R, 1);
@@ -721,7 +721,7 @@ int sceneHandler29_updateScreenCallback() {
}
void sceneHandler29_manToL() {
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
chainQueue(QU_SC29_MANTO_L, 1);
@@ -737,7 +737,7 @@ void sceneHandler29_manToL() {
}
void sceneHandler29_manToR() {
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
chainQueue(QU_SC29_MANTO_R, 1);
@@ -763,7 +763,7 @@ void sceneHandler29_clickPorter(ExCommand *cmd) {
if (ABS(351 - g_vars->scene29_manX) > 1 || ABS(443 - g_vars->scene29_manY) > 1
|| g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) {
if (g_fp->_msgX != 351 || g_fp->_msgY != 443) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 351, 443, 1, ST_MAN_RIGHT);
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 351, 443, 1, ST_MAN_RIGHT);
if (mq) {
mq->addExCommandToEnd(cmd->createClone());
@@ -781,7 +781,7 @@ void sceneHandler29_clickPorter(ExCommand *cmd) {
if (ABS(1582 - g_vars->scene29_manX) > 1 || ABS(445 - g_fp->_aniMan->_oy) > 1
|| g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != (0x4000 | ST_MAN_RIGHT)) {
if (g_fp->_msgX != 1582 || g_fp->_msgY != 445) {
- MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1582, 445, 1, (0x4000 | ST_MAN_RIGHT));
+ MessageQueue *mq = getCurrSceneSc2MotionController()->startMove(g_fp->_aniMan, 1582, 445, 1, (0x4000 | ST_MAN_RIGHT));
if (mq) {
mq->addExCommandToEnd(cmd->createClone());
@@ -1001,7 +1001,7 @@ int sceneHandler29(ExCommand *cmd) {
g_vars->scene29_reachedFarRight = false;
g_vars->scene29_rideBackEnabled = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
break;
diff --git a/engines/fullpipe/scenes/scene32.cpp b/engines/fullpipe/scenes/scene32.cpp
index 9279db7513..05b78efb3d 100644
--- a/engines/fullpipe/scenes/scene32.cpp
+++ b/engines/fullpipe/scenes/scene32.cpp
@@ -189,7 +189,7 @@ void sceneHandler32_trySit(ExCommand *cmd) {
g_vars->scene32_dudeIsSitting = true;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
}
}
@@ -236,7 +236,7 @@ void sceneHandler32_ladderLogic(ExCommand *cmd) {
g_vars->scene32_dudeOnLadder = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
}
@@ -258,7 +258,7 @@ void sceneHandler32_potLogic(ExCommand *cmd) {
mq->setFlags(mq->getFlags() | 1);
mq->chain(0);
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_vars->scene32_dudeIsSitting = false;
@@ -330,7 +330,7 @@ int sceneHandler32(ExCommand *cmd) {
case MSG_SC32_ONLADDER:
g_vars->scene32_dudeOnLadder = true;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
break;
diff --git a/engines/fullpipe/scenes/scene34.cpp b/engines/fullpipe/scenes/scene34.cpp
index 1c8c8b4855..32fb192756 100644
--- a/engines/fullpipe/scenes/scene34.cpp
+++ b/engines/fullpipe/scenes/scene34.cpp
@@ -115,7 +115,7 @@ int scene34_updateCursor() {
}
void sceneHandler34_leaveBoard() {
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
@@ -124,7 +124,7 @@ void sceneHandler34_leaveBoard() {
}
void sceneHandler34_onBoard() {
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
@@ -149,7 +149,7 @@ void sceneHandler34_hideStool() {
}
void sceneHandler34_climb() {
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
@@ -287,7 +287,7 @@ void sceneHandler34_showStool() {
}
void sceneHandler34_unclimb() {
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
@@ -323,7 +323,7 @@ int sceneHandler34(ExCommand *cmd) {
case MSG_SC34_FROMCACTUS:
g_vars->scene34_dudeOnCactus = false;
- getCurrSceneSc2MotionController()->setEnabled();
+ getCurrSceneSc2MotionController()->activate();
getGameLoaderInteractionController()->enableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1);
@@ -381,7 +381,7 @@ int sceneHandler34(ExCommand *cmd) {
case MSG_SC34_ONCACTUS:
g_vars->scene34_dudeOnCactus = true;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0);
diff --git a/engines/fullpipe/scenes/sceneFinal.cpp b/engines/fullpipe/scenes/sceneFinal.cpp
index d0040463ef..8b3ecb1025 100644
--- a/engines/fullpipe/scenes/sceneFinal.cpp
+++ b/engines/fullpipe/scenes/sceneFinal.cpp
@@ -97,7 +97,7 @@ void sceneHandlerFinal_goto2() {
void sceneHandlerFinal_startFinal() {
g_vars->sceneFinal_var01 = 1;
- getCurrSceneSc2MotionController()->clearEnabled();
+ getCurrSceneSc2MotionController()->deactivate();
getGameLoaderInteractionController()->disableFlag24();
g_fp->_aniMan2 = 0;
diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index 230d6c39a9..c82c2c414c 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -30,6 +30,7 @@
#include "fullpipe/statics.h"
#include "common/memstream.h"
+#include "audio/mixer.h"
#include "audio/audiostream.h"
#include "audio/decoders/vorbis.h"
#include "audio/decoders/wave.h"
@@ -96,12 +97,13 @@ Sound::Sound() {
memset(_directSoundBuffers, 0, sizeof(_directSoundBuffers));
_description = 0;
_volume = 100;
+ _handle = new Audio::SoundHandle();
}
Sound::~Sound() {
freeSound();
-
free(_description);
+ delete _handle;
}
bool Sound::load(MfcArchive &file, NGIArchive *archive) {
@@ -206,14 +208,14 @@ void Sound::setPanAndVolumeByStaticAni() {
}
void Sound::setPanAndVolume(int vol, int pan) {
- g_fp->_mixer->setChannelVolume(_handle, vol / 39); // 0..10000
- g_fp->_mixer->setChannelBalance(_handle, pan / 78); // -10000..10000
+ g_fp->_mixer->setChannelVolume(*_handle, vol / 39); // 0..10000
+ g_fp->_mixer->setChannelBalance(*_handle, pan / 78); // -10000..10000
}
void Sound::play(int flag) {
- Audio::SoundHandle handle = getHandle();
+ Audio::SoundHandle *handle = getHandle();
- if (g_fp->_mixer->isSoundHandleActive(handle))
+ if (g_fp->_mixer->isSoundHandleActive(*handle))
return;
byte *soundData = loadData();
@@ -221,7 +223,7 @@ void Sound::play(int flag) {
Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES);
Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1);
- g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream);
+ g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, handle, audioStream);
}
void Sound::freeSound() {
@@ -231,11 +233,11 @@ void Sound::freeSound() {
}
int Sound::getVolume() {
- return g_fp->_mixer->getChannelVolume(_handle) * 39; // 0..10000
+ return g_fp->_mixer->getChannelVolume(*_handle) * 39; // 0..10000
}
void Sound::stop() {
- g_fp->_mixer->stopHandle(_handle);
+ g_fp->_mixer->stopHandle(*_handle);
}
void FullpipeEngine::setSceneMusicParameters(GameVar *gvar) {
@@ -353,7 +355,7 @@ void FullpipeEngine::startSoundStream1(char *trackName) {
stopAllSoundStreams();
#ifdef USE_VORBIS
- if (_mixer->isSoundHandleActive(_sceneTrackHandle))
+ if (_mixer->isSoundHandleActive(*_sceneTrackHandle))
return;
Common::File *track = new Common::File();
@@ -363,7 +365,7 @@ void FullpipeEngine::startSoundStream1(char *trackName) {
return;
}
Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES);
- _mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg);
+ _mixer->playStream(Audio::Mixer::kMusicSoundType, _sceneTrackHandle, ogg);
#endif
}
diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h
index 14e766f5bb..983f28312b 100644
--- a/engines/fullpipe/sound.h
+++ b/engines/fullpipe/sound.h
@@ -23,6 +23,10 @@
#ifndef FULLPIPE_SOUND_H
#define FULLPIPE_SOUND_H
+namespace Audio {
+class SoundHandle;
+}
+
namespace Fullpipe {
class Sound : public MemoryObject {
@@ -31,7 +35,7 @@ class Sound : public MemoryObject {
int _directSoundBuffer;
int _directSoundBuffers[7];
byte *_soundData;
- Audio::SoundHandle _handle;
+ Audio::SoundHandle *_handle;
int _volume;
public:
@@ -45,7 +49,7 @@ public:
virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class
void updateVolume();
int getId() const { return _id; }
- Audio::SoundHandle getHandle() const { return _handle; }
+ Audio::SoundHandle *getHandle() const { return _handle; }
void play(int flag);
void freeSound();
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index de3e1ea728..059fd82e79 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -106,9 +106,14 @@ bool StepArray::gotoNextPoint() {
}
void StepArray::insertPoints(Common::Point **points, int pointsCount) {
- if (_currPointIndex + pointsCount >= _pointsCount)
+ if (_currPointIndex + pointsCount >= _pointsCount) {
_points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_currPointIndex + pointsCount));
+ if (!_points) {
+ error("Out of memory at StepArray::insertPoints()");
+ }
+ }
+
_maxPointIndex = _currPointIndex + pointsCount;
for (int i = 0; i < pointsCount; i++) {
@@ -1571,6 +1576,9 @@ Movement::Movement(Movement *src, int *oldIdxs, int newSize, StaticANIObject *an
_m2x = 0;
_m2y = 0;
+ _counter = 0;
+ _counterMax = 0;
+
_field_78 = 0;
_framePosOffsets = 0;
_field_84 = 0;
@@ -1758,8 +1766,8 @@ Common::Point *Movement::calcSomeXY(Common::Point &p, int idx, int dynidx) {
Common::Point point;
_staticsObj1->getSomeXY(point);
- int y1 = _my - point.y;
int x1 = _mx - point.x;
+ int y1 = _my - point.y;
setDynamicPhaseIndex(0);
diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp
index 0cc8bd83f4..a7dee2e59c 100644
--- a/engines/fullpipe/utils.cpp
+++ b/engines/fullpipe/utils.cpp
@@ -262,15 +262,11 @@ double MfcArchive::readDouble() {
// http://randomascii.wordpress.com/2012/01/11/tricks-with-the-floating-point-format/
union {
- struct {
- int32 a;
- int32 b;
- } i;
+ byte b[8];
double d;
} tmp;
- tmp.i.a = readUint32LE();
- tmp.i.b = readUint32LE();
+ read(&tmp.b, 8);
return tmp.d;
}