diff options
Diffstat (limited to 'engines/fullpipe')
-rw-r--r-- | engines/fullpipe/behavior.cpp | 22 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 5 | ||||
-rw-r--r-- | engines/fullpipe/fullpipe.h | 4 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 20 | ||||
-rw-r--r-- | engines/fullpipe/interaction.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/inventory.cpp | 32 | ||||
-rw-r--r-- | engines/fullpipe/lift.cpp | 5 | ||||
-rw-r--r-- | engines/fullpipe/messages.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/modal.cpp | 32 | ||||
-rw-r--r-- | engines/fullpipe/motion.cpp | 40 | ||||
-rw-r--r-- | engines/fullpipe/objects.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 2 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene03.cpp | 8 | ||||
-rw-r--r-- | engines/fullpipe/scenes/scene04.cpp | 9 | ||||
-rw-r--r-- | engines/fullpipe/stateloader.cpp | 4 | ||||
-rw-r--r-- | engines/fullpipe/statics.cpp | 70 | ||||
-rw-r--r-- | engines/fullpipe/utils.cpp | 2 |
17 files changed, 169 insertions, 96 deletions
diff --git a/engines/fullpipe/behavior.cpp b/engines/fullpipe/behavior.cpp index faef1672ca..4f70553033 100644 --- a/engines/fullpipe/behavior.cpp +++ b/engines/fullpipe/behavior.cpp @@ -49,6 +49,8 @@ void BehaviorManager::clear() { } void BehaviorManager::initBehavior(Scene *sc, GameVar *var) { + debugC(2, kDebugBehavior, "BehaviorManager::initBehavior(%d, %s)", sc->_sceneId, transCyrillic((byte *)var->_varName)); + clear(); _scene = sc; @@ -58,7 +60,10 @@ void BehaviorManager::initBehavior(Scene *sc, GameVar *var) { if (!behvar) return; + debugC(3, kDebugBehavior, "BehaviorManager::initBehavior. have Variable"); + for (GameVar *subvar = behvar->_subVars; subvar; subvar = subvar->_nextVarObj) { + debugC(3, kDebugBehavior, "BehaviorManager::initBehavior. subVar %s", transCyrillic((byte *)subvar->_varName)); if (!strcmp(subvar->_varName, "AMBIENT")) { behinfo = new BehaviorInfo; behinfo->initAmbientBehavior(subvar, sc); @@ -66,8 +71,8 @@ void BehaviorManager::initBehavior(Scene *sc, GameVar *var) { _behaviors.push_back(behinfo); } else { StaticANIObject *ani = sc->getStaticANIObject1ByName(subvar->_varName, -1); - if (ani) - for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) + if (ani) { + for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) { if (((StaticANIObject *)sc->_staticANIObjectList1[i])->_id == ani->_id) { behinfo = new BehaviorInfo; behinfo->initObjectBehavior(subvar, sc, ani); @@ -75,6 +80,8 @@ void BehaviorManager::initBehavior(Scene *sc, GameVar *var) { _behaviors.push_back(behinfo); } + } + } } } } @@ -83,7 +90,7 @@ void BehaviorManager::updateBehaviors() { if (!_isActive) return; - debugC(4, kDebugBehavior, "BehaviorManager::updateBehaviors()"); + debugC(6, kDebugBehavior, "BehaviorManager::updateBehaviors()"); for (uint i = 0; i < _behaviors.size(); i++) { BehaviorInfo *beh = _behaviors[i]; @@ -122,7 +129,7 @@ void BehaviorManager::updateBehaviors() { } void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorAnim *entry) { - debugC(4, kDebugBehavior, "BehaviorManager::updateBehavior() %d", entry->_movesCount); + debugC(7, kDebugBehavior, "BehaviorManager::updateBehavior() moves: %d", entry->_movesCount); for (int i = 0; i < entry->_movesCount; i++) { BehaviorMove *bhi = entry->_behaviorMoves[i]; if (!(bhi->_flags & 1)) { @@ -144,7 +151,7 @@ void BehaviorManager::updateBehavior(BehaviorInfo *behaviorInfo, BehaviorAnim *e } void BehaviorManager::updateStaticAniBehavior(StaticANIObject *ani, int delay, BehaviorAnim *bhe) { - debugC(4, kDebugBehavior, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName)); + debugC(6, kDebugBehavior, "BehaviorManager::updateStaticAniBehavior(%s)", transCyrillic((byte *)ani->_objectName)); MessageQueue *mq = 0; @@ -224,7 +231,7 @@ BehaviorMove *BehaviorManager::getBehaviorMoveByMessageQueueDataId(StaticANIObje } void BehaviorInfo::clear() { - _ani = 0; + _ani = NULL; _staticsId = 0; _counter = 0; _counterMax = 0; @@ -260,7 +267,8 @@ void BehaviorInfo::initAmbientBehavior(GameVar *var, Scene *sc) { } void BehaviorInfo::initObjectBehavior(GameVar *var, Scene *sc, StaticANIObject *ani) { - debugC(4, kDebugBehavior, "BehaviorInfo::initObjectBehavior(%s)", transCyrillic((byte *)var->_varName)); + Common::String s((char *)transCyrillic((byte *)var->_varName)); + debugC(4, kDebugBehavior, "BehaviorInfo::initObjectBehavior(%s, %d, %s)", s.c_str(), sc->_sceneId, transCyrillic((byte *)ani->_objectName)); clear(); diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 22f2050d16..54a77938c9 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -55,6 +55,8 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) DebugMan.addDebugChannel(kDebugBehavior, "behavior", "Behavior"); DebugMan.addDebugChannel(kDebugMemory, "memory", "Memory management"); DebugMan.addDebugChannel(kDebugEvents, "events", "Event handling"); + DebugMan.addDebugChannel(kDebugInventory, "inventory", "Inventory"); + DebugMan.addDebugChannel(kDebugSceneLogic, "scenelogic", "Scene Logic"); // Setup mixer if (!_mixer->isReady()) { @@ -404,6 +406,7 @@ void FullpipeEngine::updateEvents() { _lastInputTicks = _updateTicks; ex->handle(); } + _mouseScreenPos = event.mouse; break; case Common::EVENT_LBUTTONDOWN: if (!_inputArFlag && (_updateTicks - _lastInputTicks) >= 2) { @@ -416,6 +419,7 @@ void FullpipeEngine::updateEvents() { _lastInputTicks = _updateTicks; ex->handle(); } + _mouseScreenPos = event.mouse; break; case Common::EVENT_LBUTTONUP: if (!_inputArFlag && (_updateTicks - _lastButtonUpTicks) >= 2) { @@ -424,6 +428,7 @@ void FullpipeEngine::updateEvents() { _lastButtonUpTicks = _updateTicks; ex->handle(); } + _mouseScreenPos = event.mouse; break; default: break; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 2012d7a344..09c9559199 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -55,7 +55,9 @@ enum { kDebugAnimation = 1 << 3, kDebugMemory = 1 << 4, kDebugEvents = 1 << 5, - kDebugBehavior = 1 << 6 + kDebugBehavior = 1 << 6, + kDebugInventory = 1 << 7, + kDebugSceneLogic = 1 << 8 }; class BehaviorManager; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 174f66a3c8..eba5d442d5 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -290,8 +290,8 @@ bool GameObject::load(MfcArchive &file) { _id = file.readUint16LE(); _objectName = file.readPascalString(); - _ox = file.readUint32LE(); - _oy = file.readUint32LE(); + _ox = file.readSint32LE(); + _oy = file.readSint32LE(); _priority = file.readUint16LE(); if (g_fp->_gameProjectVersion >= 11) { @@ -353,7 +353,6 @@ bool GameObject::getPicAniInfo(PicAniInfo *info) { info->ox = _ox; info->oy = _oy; info->priority = _priority; - warning("Yep %d", _id); return true; } @@ -495,8 +494,8 @@ bool Picture::load(MfcArchive &file) { debugC(5, kDebugLoading, "Picture::load()"); MemoryObject::load(file); - _x = file.readUint32LE(); - _y = file.readUint32LE(); + _x = file.readSint32LE(); + _y = file.readSint32LE(); _field_44 = file.readUint16LE(); assert(g_fp->_gameProjectVersion >= 2); @@ -786,8 +785,8 @@ Bitmap::~Bitmap() { void Bitmap::load(Common::ReadStream *s) { debugC(5, kDebugLoading, "Bitmap::load()"); - _x = s->readUint32LE(); - _y = s->readUint32LE(); + _x = s->readSint32LE(); + _y = s->readSint32LE(); _width = s->readUint32LE(); _height = s->readUint32LE(); s->readUint32LE(); // pixels @@ -806,7 +805,7 @@ bool Bitmap::isPixelHitAtPos(int x, int y) { if (!_surface) return false; - return ((*((int32 *)_surface->getBasePtr(x - _x, y - _y)) & 0xff000000) != 0); + return ((*((int32 *)_surface->getBasePtr(x - _x, y - _y)) & 0xff) != 0); } void Bitmap::decode(int32 *palette) { @@ -1139,13 +1138,14 @@ Bitmap *Bitmap::flipVertical() { } void Bitmap::drawShaded(int type, int x, int y, byte *palette, int alpha) { - warning("STUB: Bitmap::drawShaded(%d, %d, %d)", type, x, y); + if (alpha != 255) + warning("STUB: Bitmap::drawShaded(%d, %d, %d, %d)", type, x, y, alpha); putDib(x, y, (int32 *)palette, alpha); } void Bitmap::drawRotated(int x, int y, int angle, byte *palette, int alpha) { - warning("STUB: Bitmap::drawShaded(%d, %d, %d)", x, y, angle); + warning("STUB: Bitmap::drawRotated(%d, %d, %d, %d)", x, y, angle, alpha); putDib(x, y, (int32 *)palette, alpha); } diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index f0abd0d02c..dc40750fe6 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -450,8 +450,8 @@ bool Interaction::load(MfcArchive &file) { _objectId3 = file.readUint16LE(); _objectState2 = file.readUint32LE(); _objectState1 = file.readUint32LE(); - _xOffs = file.readUint32LE(); - _yOffs = file.readUint32LE(); + _xOffs = file.readSint32LE(); + _yOffs = file.readSint32LE(); _sceneId = file.readUint32LE(); _flags = file.readUint32LE(); _actionName = file.readPascalString(); diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index aa229d55d7..f1dafeba7d 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -35,7 +35,7 @@ Inventory::~Inventory() { } bool Inventory::load(MfcArchive &file) { - debugC(5, kDebugLoading, "Inventory::load()"); + debugC(5, kDebugLoading | kDebugInventory, "Inventory::load()"); _sceneId = file.readUint16LE(); int numInvs = file.readUint32LE(); @@ -119,12 +119,36 @@ void Inventory2::addItem2(StaticANIObject *obj) { } void Inventory2::removeItem(int itemId, int count) { - warning("STUB: Inventory2::removeItem(%d, %d)", itemId, count); + debugC(2, kDebugInventory, "Inventory2::removeItem(%d, %d)", itemId, count); + + while (count) { + int i; + for (i = _inventoryItems.size() - 1; i >= 0; i--) { + if (_inventoryItems[i]->itemId == itemId) { + if (_selectedId == itemId) + unselectItem(false); + + if (_inventoryItems[i]->count > count) { + _inventoryItems[i]->count -= count; + } else { + count -= _inventoryItems[i]->count; + _inventoryItems.remove_at(i); + } + + if (getCountItemsWithId(itemId) < 0) + getInventoryPoolItemFieldCById(itemId); + + break; + } + } + } } void Inventory2::removeItem2(Scene *sceneObj, int itemId, int x, int y, int priority) { int idx = getInventoryItemIndexById(itemId); + debugC(2, kDebugInventory, "removeItem2(*, %d, %d, %d, %d)", itemId, x, y, priority); + if (idx >= 0) { if (_inventoryItems[idx]->count) { removeItem(itemId, 1); @@ -187,11 +211,15 @@ int Inventory2::getItemFlags(int itemId) { } void Inventory2::rebuildItemRects() { + debugC(2, kDebugInventory, "rebuildItemRects()"); + _scene = g_fp->accessScene(_sceneId); if (!_scene) return; + _inventoryIcons.clear(); + _picture = _scene->getBigPicture(0, 0); _picture->setAlpha(50); diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index d066c89d4a..93bfbaaa24 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -392,7 +392,8 @@ void FullpipeEngine::lift_clickButton() { lift_walkAndGo(); } -void FullpipeEngine::lift_goAnimation() { if (_lastLiftButton) { +void FullpipeEngine::lift_goAnimation() { + if (_lastLiftButton) { int parentId = _currentScene->_sceneId; int buttonId = lift_getButtonIdN(_lastLiftButton->_statics->_staticsId); @@ -428,6 +429,8 @@ void FullpipeEngine::lift_goAnimation() { if (_lastLiftButton) { delete mq; _aniMan->_flags |= 1; + + return; } } } diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 9085e92832..981797cea2 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -61,8 +61,8 @@ bool ExCommand::load(MfcArchive &file) { _parentId = file.readUint16LE(); _messageKind = file.readUint32LE(); - _x = file.readUint32LE(); - _y = file.readUint32LE(); + _x = file.readSint32LE(); + _y = file.readSint32LE(); _field_14 = file.readUint32LE(); _sceneClickX = file.readUint32LE(); _sceneClickY = file.readUint32LE(); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 096323781f..382cdfd688 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -309,7 +309,7 @@ bool ModalMap::init(int counterdiff) { _rect2.right = _rect2.left + 800; _rect2.bottom = _rect2.top + 600; - g_fp->_sceneRect =_rect2; + g_fp->_sceneRect = _rect2; _mapScene->updateScrolling2(); @@ -346,17 +346,17 @@ bool ModalMap::handleMessage(ExCommand *cmd) { _mouseX = g_fp->_mouseScreenPos.x; _mouseY = g_fp->_mouseScreenPos.x; - _field_3C = _rect2.top; _field_38 = _rect2.left; + _field_3C = _rect2.top; - break; + return false; case 30: _flag = 0; - break; + return false; case 36: - if (cmd->_keyCode != 9 && cmd->_keyCode != 27 ) + if (cmd->_keyCode != 9 && cmd->_keyCode != 27) return false; break; @@ -431,20 +431,20 @@ PictureObject *ModalMap::getScenePicture() { switch (g_fp->_currentScene->_sceneId) { case SC_1: - picId = PIC_MAP_S01; - break; + picId = PIC_MAP_S01; + break; case SC_2: - picId = PIC_MAP_S02; - break; + picId = PIC_MAP_S02; + break; case SC_3: - picId = PIC_MAP_S03; - break; + picId = PIC_MAP_S03; + break; case SC_4: - picId = PIC_MAP_S04; - break; + picId = PIC_MAP_S04; + break; case SC_5: - picId = PIC_MAP_S05; - break; + picId = PIC_MAP_S05; + break; case SC_6: picId = PIC_MAP_S06; break; @@ -489,7 +489,7 @@ PictureObject *ModalMap::getScenePicture() { picId = PIC_MAP_S20; break; case SC_21: - picId = PIC_MAP_S21; + picId = PIC_MAP_S21; break; case SC_22: picId = PIC_MAP_S22; diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index d3b29b324a..81d92ccac8 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -372,16 +372,16 @@ bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement if (!v) return false; - v = v->getSubVarByName("Test_Ladder"); + GameVar *l = v->getSubVarByName("Test_Ladder"); - if (!v) + if (!l) return false; movement->staticIdsSize = 6; movement->movVars = new MctlLadderMovementVars; movement->staticIds = new int[movement->staticIdsSize]; - v = v->getSubVarByName("Up"); + v = l->getSubVarByName("Up"); if (!v) return false; @@ -393,7 +393,7 @@ bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement movement->staticIds[0] = ani->getMovementById(movement->movVars->varUpStart)->_staticsObj1->_staticsId; movement->staticIds[2] = ani->getMovementById(movement->movVars->varUpGo)->_staticsObj1->_staticsId; - v = v->getSubVarByName("Down"); + v = l->getSubVarByName("Down"); if (!v) return false; @@ -1332,9 +1332,9 @@ double MovGraph::putToLink(Common::Point *point, MovGraphLink *link, int fuzzyMa int n2x = link->_graphDst->_x; int n2y = link->_graphDst->_y; double dist1x = (double)(point->x - n1x); - double dist1y = (double)(point->y - n1y); + double dist1y = (double)(n1y - point->y); double dist2x = (double)(n2x - n1x); - double dist2y = (double)(n2y - n1y); + double dist2y = (double)(n1y - n2y); double dist1 = sqrt(dist1x * dist1x + dist1y * dist1y); double dist2 = (dist2y * dist1y + dist2x * dist1x) / link->_length / dist1; double distm = dist2 * dist1; @@ -1355,8 +1355,8 @@ double MovGraph::putToLink(Common::Point *point, MovGraphLink *link, int fuzzyMa return -1.0; } } else { - point->x = (int)(n1x + (dist2x * distm / link->_length)); - point->y = (int)(n1y + (dist2y * distm / link->_length)); + point->x = n1x + (int)((double)(n2x - n1x) * distm / link->_length); + point->y = n1y + (int)((double)(n2y - n1y) * distm / link->_length); } return res; @@ -2476,7 +2476,7 @@ int MctlGraph::getLinkDir(Common::Array<MovGraphLink *> *linkList, int idx, Comm } if (abs(node3->_x - node2->_x) <= abs(node3->_y - node2->_y)) - return (node3->_y < node2->_x) + 2; + return (node3->_y < node2->_y) + 2; else return node3->_x >= node2->_x; } @@ -2918,9 +2918,9 @@ bool MovGraphNode::load(MfcArchive &file) { debugC(5, kDebugLoading, "MovGraphNode::load()"); _field_14 = file.readUint32LE(); - _x = file.readUint32LE(); - _y = file.readUint32LE(); - _z = file.readUint32LE(); + _x = file.readSint32LE(); + _y = file.readSint32LE(); + _z = file.readSint32LE(); return true; } @@ -2937,12 +2937,12 @@ ReactParallel::ReactParallel() { bool ReactParallel::load(MfcArchive &file) { debugC(5, kDebugLoading, "ReactParallel::load()"); - _x1 = file.readUint32LE(); - _y1 = file.readUint32LE(); - _x2 = file.readUint32LE(); - _y2 = file.readUint32LE(); - _dx = file.readUint32LE(); - _dy = file.readUint32LE(); + _x1 = file.readSint32LE(); + _y1 = file.readSint32LE(); + _x2 = file.readSint32LE(); + _y2 = file.readSint32LE(); + _dx = file.readSint32LE(); + _dy = file.readSint32LE(); createRegion(); @@ -2995,8 +2995,8 @@ ReactPolygonal::~ReactPolygonal() { bool ReactPolygonal::load(MfcArchive &file) { debugC(5, kDebugLoading, "ReactPolygonal::load()"); - _centerX = file.readUint32LE(); - _centerY = file.readUint32LE(); + _centerX = file.readSint32LE(); + _centerY = file.readSint32LE(); _pointCount = file.readUint32LE(); if (_pointCount > 0) { diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index 1849bcb96e..f9a641d562 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -61,6 +61,8 @@ struct PicAniInfo { int32 someDynamicPhaseIndex; bool load(MfcArchive &file); + + PicAniInfo() { memset(this, 0, sizeof(PicAniInfo)); } }; union VarValue { diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index b47988d768..70f5f1aa81 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -601,7 +601,7 @@ StaticANIObject *Scene::getStaticANIObjectAtPos(int x, int y) { if ((p->_field_8 & 0x100) && (p->_flags & 4) && p->getPixelAtPos(x, y, &pixel) && - (!res || res->_priority >= p->_priority)) + (!res || res->_priority > p->_priority)) res = p; } diff --git a/engines/fullpipe/scenes/scene03.cpp b/engines/fullpipe/scenes/scene03.cpp index e6c9fa3bbd..e374c87971 100644 --- a/engines/fullpipe/scenes/scene03.cpp +++ b/engines/fullpipe/scenes/scene03.cpp @@ -48,6 +48,8 @@ void FullpipeEngine::setSwallowedEggsState() { } void scene03_initScene(Scene *sc) { + debugC(1, kDebugSceneLogic, "scene03_initScene()"); + g_vars->scene03_eggeater = sc->getStaticANIObject1ById(ANI_EGGEATER, -1); g_vars->scene03_domino = sc->getStaticANIObject1ById(ANI_DOMINO_3, -1); @@ -60,6 +62,9 @@ void scene03_initScene(Scene *sc) { g_fp->lift_setButton(sO_Level2, ST_LBN_2N); g_fp->lift_init(sc, QU_SC3_ENTERLIFT, QU_SC3_EXITLIFT); + + debugC(2, kDebugSceneLogic, "scene03: egg1: %d egg2: %d egg3: %d", g_vars->swallowedEgg1->_value.intValue, + g_vars->swallowedEgg2->_value.intValue, g_vars->swallowedEgg3->_value.intValue); } void scene03_setEaterState() { @@ -90,10 +95,13 @@ void sceneHandler03_eaterFat() { void sceneHandler03_swallowEgg(int item) { if (!g_vars->swallowedEgg1->_value.intValue) { g_vars->swallowedEgg1->_value.intValue = item; + debugC(2, kDebugSceneLogic, "scene03: setting egg1: %d", g_vars->swallowedEgg1->_value.intValue); } else if (!g_vars->swallowedEgg2->_value.intValue) { g_vars->swallowedEgg2->_value.intValue = item; + debugC(2, kDebugSceneLogic, "scene03: setting egg2: %d", g_vars->swallowedEgg2->_value.intValue); } else if (!g_vars->swallowedEgg3->_value.intValue) { g_vars->swallowedEgg3->_value.intValue = item; + debugC(2, kDebugSceneLogic, "scene03: setting egg3: %d", g_vars->swallowedEgg3->_value.intValue); g_fp->setObjectState(sO_EggGulperGaveCoin, g_fp->getObjectEnumState(sO_EggGulperGaveCoin, sO_Yes)); diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index d901d74289..b6239c219f 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -60,6 +60,10 @@ void scene04_speakerCallback(int *phase) { } } +void scene04_springCallback(int *phase) { + // do nothing +} + void scene04_initScene(Scene *sc) { g_vars->scene04_dudeOnLadder = false; g_vars->scene04_bottle = sc->getPictureObjectById(PIC_SC4_BOTTLE, 0); @@ -127,7 +131,7 @@ void scene04_initScene(Scene *sc) { StaticANIObject *spring = sc->getStaticANIObject1ById(ANI_SPRING, -1); if (spring) - spring->_callback2 = 0; + spring->_callback2 = scene04_springCallback; g_vars->scene04_bottleObjList.clear(); g_vars->scene04_bottleObjList.push_back(sc->getPictureObjectById(PIC_SC4_BOTTLE, 0)); @@ -949,7 +953,8 @@ void sceneHandler04_springWobble() { if (g_vars->scene04_bottleWeight < newdelta) g_vars->scene04_springOffset--; - if ((oldDynIndex <= g_vars->scene04_bottleWeight && newdelta > g_vars->scene04_bottleWeight) || newdelta <= g_vars->scene04_bottleWeight) { + if ((oldDynIndex <= g_vars->scene04_bottleWeight && newdelta > g_vars->scene04_bottleWeight) + || (oldDynIndex > g_vars->scene04_bottleWeight && newdelta <= g_vars->scene04_bottleWeight)) { g_vars->scene04_springDelay++; if (g_vars->scene04_springOffset && g_vars->scene04_springDelay > 1) { diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index c95f6c67f3..02053aa94e 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -350,8 +350,8 @@ bool PicAniInfo::load(MfcArchive &file) { field_8 = file.readUint32LE(); sceneId = file.readUint16LE(); field_E = file.readUint16LE(); - ox = file.readUint32LE(); - oy = file.readUint32LE(); + ox = file.readSint32LE(); + oy = file.readSint32LE(); priority = file.readUint32LE(); staticsId = file.readUint16LE(); movementId = file.readUint16LE(); diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 22be04b393..1f25bfb46e 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -108,20 +108,22 @@ bool StepArray::gotoNextPoint() { void StepArray::insertPoints(Common::Point **points, int pointsCount) { if (_currPointIndex + pointsCount >= _pointsCount) { - _points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_currPointIndex + pointsCount)); + _points = (Common::Point **)realloc(_points, sizeof(Common::Point *) * (_pointsCount + pointsCount)); if (!_points) { error("Out of memory at StepArray::insertPoints()"); } + + for(int i = 0; i < pointsCount; i++) + _points[_pointsCount + i] = new Common::Point; + + _pointsCount += pointsCount; } _maxPointIndex = _currPointIndex + pointsCount; - for (int i = 0; i < pointsCount; i++) { - _points[_currPointIndex + i] = new Common::Point; - + for (int i = 0; i < pointsCount; i++) *_points[_currPointIndex + i] = *points[i]; - } } StaticANIObject::StaticANIObject() { @@ -831,7 +833,7 @@ void StaticANIObject::update(int counterdiff) { } } - if (dyn->_initialCountdown != dyn->_countdown || dyn->_field_68 == 0) { + if (dyn->_initialCountdown == dyn->_countdown && dyn->_field_68 != 0) { newex = new ExCommand(_id, 17, dyn->_field_68, 0, 0, 0, 1, 0, 0, 0); newex->_excFlags = 2; newex->_keyCode = _okeyCode; @@ -952,7 +954,7 @@ Common::Point *StaticANIObject::calcNextStep(Common::Point *pRes) { } void StaticANIObject::stopAnim_maybe() { - debugC(6, kDebugAnimation, "StaticANIObject::stopAnim_maybe()"); + debugC(2, kDebugAnimation, "StaticANIObject::stopAnim_maybe()"); if (!(_flags & 1)) return; @@ -967,7 +969,10 @@ void StaticANIObject::stopAnim_maybe() { setOXY(_movement->_ox, _movement->_oy); if (_flags & 0x40) { - if (!_movement->_currMovement && !_movement->_currDynamicPhaseIndex) { + if (!_movement->_currMovement) { + if (_movement->_currDynamicPhaseIndex) + goto L11; +L8: _statics = _movement->_staticsObj1; _movement->getCurrDynamicPhaseXY(point); _ox -= point.x; @@ -985,13 +990,14 @@ void StaticANIObject::stopAnim_maybe() { _ox += point.x; _oy += point.y; } - } else { - _statics = _movement->_staticsObj2; + goto L12; } - } else { - _statics = _movement->_staticsObj2; + if (!_movement->_currDynamicPhaseIndex) + goto L8; } - +L11: + _statics = _movement->_staticsObj2; +L12: _statics->getSomeXY(point); _statics->_x = _ox - point.x; @@ -1697,8 +1703,8 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) { _staticsObj1 = ani->addReverseStatics(s); } - _mx = file.readUint32LE(); - _my = file.readUint32LE(); + _mx = file.readSint32LE(); + _my = file.readSint32LE(); staticsid = file.readUint16LE(); @@ -1709,8 +1715,8 @@ bool Movement::load(MfcArchive &file, StaticANIObject *ani) { _staticsObj2 = ani->addReverseStatics(s); } - _m2x = file.readUint32LE(); - _m2y = file.readUint32LE(); + _m2x = file.readSint32LE(); + _m2y = file.readSint32LE(); if (_staticsObj2) { _dynamicPhases.push_back(_staticsObj2); @@ -2148,11 +2154,17 @@ void Movement::gotoFirstFrame() { void Movement::gotoLastFrame() { if (_currMovement) { - while ((uint)_currDynamicPhaseIndex != _currMovement->_dynamicPhases.size() - 1) - gotoNextFrame(0, 0); + if ((uint)_currDynamicPhaseIndex != _currMovement->_dynamicPhases.size() - 1) { + do { + gotoNextFrame(0, 0); + } while ((uint)_currDynamicPhaseIndex != _currMovement->_dynamicPhases.size() - 1); + } } else { - while ((uint)_currDynamicPhaseIndex != _dynamicPhases.size() - 1) - gotoNextFrame(0, 0); + if ((uint)_currDynamicPhaseIndex != _dynamicPhases.size() - 1) { + do { + gotoNextFrame(0, 0); + } while ((uint)_currDynamicPhaseIndex != _dynamicPhases.size() - 1); + } } } @@ -2261,17 +2273,17 @@ bool DynamicPhase::load(MfcArchive &file) { _field_7C = file.readUint16LE(); _rect = new Common::Rect(); - _rect->left = file.readUint32LE(); - _rect->top = file.readUint32LE(); - _rect->right = file.readUint32LE(); - _rect->bottom = file.readUint32LE(); + _rect->left = file.readSint32LE(); + _rect->top = file.readSint32LE(); + _rect->right = file.readSint32LE(); + _rect->bottom = file.readSint32LE(); - assert (g_fp->_gameProjectVersion >= 1); + assert(g_fp->_gameProjectVersion >= 1); - _someX = file.readUint32LE(); - _someY = file.readUint32LE(); + _someX = file.readSint32LE(); + _someY = file.readSint32LE(); - assert (g_fp->_gameProjectVersion >= 12); + assert(g_fp->_gameProjectVersion >= 12); _dynFlags = file.readUint32LE(); diff --git a/engines/fullpipe/utils.cpp b/engines/fullpipe/utils.cpp index a8e00468b5..148f779d1e 100644 --- a/engines/fullpipe/utils.cpp +++ b/engines/fullpipe/utils.cpp @@ -84,7 +84,7 @@ bool DWordArray::load(MfcArchive &file) { resize(count); for (int i = 0; i < count; i++) { - int32 t = file.readUint32LE(); + int32 t = file.readSint32LE(); push_back(t); } |