aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/lift.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe/lift.cpp')
-rw-r--r--engines/fullpipe/lift.cpp275
1 files changed, 264 insertions, 11 deletions
diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp
index 25dd2613fe..6484aca30a 100644
--- a/engines/fullpipe/lift.cpp
+++ b/engines/fullpipe/lift.cpp
@@ -22,46 +22,299 @@
#include "fullpipe/fullpipe.h"
+#include "fullpipe/objects.h"
+#include "fullpipe/objectnames.h"
#include "fullpipe/constants.h"
+#include "fullpipe/scene.h"
+#include "fullpipe/statics.h"
+#include "fullpipe/messages.h"
+#include "fullpipe/gameloader.h"
+
namespace Fullpipe {
int FullpipeEngine::lift_getButtonIdP(int objid) {
switch (objid) {
case ST_LBN_0N:
return ST_LBN_0P;
- break;
+
case ST_LBN_1N:
return ST_LBN_1P;
- break;
+
case ST_LBN_2N:
return ST_LBN_2P;
- break;
+
case ST_LBN_3N:
return ST_LBN_3P;
- break;
+
case ST_LBN_4N:
return ST_LBN_4P;
- break;
+
case ST_LBN_5N:
return ST_LBN_5P;
- break;
+
case ST_LBN_6N:
return ST_LBN_6P;
- break;
+
case ST_LBN_7N:
return ST_LBN_7P;
- break;
+
case ST_LBN_8N:
return ST_LBN_8P;
- break;
+
case ST_LBN_9N:
return ST_LBN_9P;
- break;
+
+ default:
+ return 0;
+ }
+}
+
+int FullpipeEngine::lift_getButtonIdH(int objid) {
+ switch (objid) {
+ case ST_LBN_0P:
+ return ST_LBN_0H;
+
+ case ST_LBN_1P:
+ return ST_LBN_1H;
+
+ case ST_LBN_2P:
+ return ST_LBN_2H;
+
+ case ST_LBN_3P:
+ return ST_LBN_3H;
+
+ case ST_LBN_4P:
+ return ST_LBN_4H;
+
+ case ST_LBN_5P:
+ return ST_LBN_5H;
+
+ case ST_LBN_6P:
+ return ST_LBN_6H;
+
+ case ST_LBN_7P:
+ return ST_LBN_7H;
+
+ case ST_LBN_8P:
+ return ST_LBN_8H;
+
+ case ST_LBN_9P:
+ return ST_LBN_9H;
+
+ default:
+ return 0;
+ }
+}
+
+int FullpipeEngine::lift_getButtonIdN(int objid) {
+ switch (objid) {
+ case ST_LBN_0H:
+ case ST_LBN_0N:
+ case ST_LBN_0P:
+ return ST_LBN_0N;
+
+ case ST_LBN_1H:
+ case ST_LBN_1N:
+ case ST_LBN_1P:
+ return ST_LBN_1N;
+
+ case ST_LBN_2H:
+ case ST_LBN_2N:
+ case ST_LBN_2P:
+ return ST_LBN_2N;
+
+ case ST_LBN_3H:
+ case ST_LBN_3N:
+ case ST_LBN_3P:
+ return ST_LBN_3N;
+
+ case ST_LBN_4H:
+ case ST_LBN_4N:
+ case ST_LBN_4P:
+ return ST_LBN_4N;
+
+ case ST_LBN_5H:
+ case ST_LBN_5N:
+ case ST_LBN_5P:
+ return ST_LBN_5N;
+
+ case ST_LBN_6H:
+ case ST_LBN_6N:
+ case ST_LBN_6P:
+ return ST_LBN_6N;
+
+ case ST_LBN_7H:
+ case ST_LBN_7N:
+ case ST_LBN_7P:
+ return ST_LBN_7N;
+
+ case ST_LBN_8H:
+ case ST_LBN_8N:
+ case ST_LBN_8P:
+ return ST_LBN_8N;
+
+ case ST_LBN_9H:
+ case ST_LBN_9N:
+ case ST_LBN_9P:
+ return ST_LBN_9N;
+
default:
return 0;
- break;
}
}
+void FullpipeEngine::lift_setButton(const char *name, int state) {
+ GameVar *var = g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName(sO_LiftButtons);
+
+ if (var)
+ var->setSubVarAsInt(name, state);
+}
+
+void FullpipeEngine::lift_init(Scene *sc, int enterSeq, int exitSeq) {
+ _lastLiftButton = 0;
+
+ _liftEnterMQ = sc->getMessageQueueById(enterSeq);
+ if (!_liftEnterMQ)
+ return;
+
+ _liftExitMQ = sc->getMessageQueueById(exitSeq);
+
+ if (!_liftExitMQ)
+ return;
+
+ ExCommand *ex = _liftEnterMQ->getExCommandByIndex(0);
+
+ if (!ex)
+ return;
+
+ _liftX = ex->_x;
+ _liftY = ex->_y;
+
+ _lift = sc->getStaticANIObject1ById(ANI_LIFT, -1);
+
+ for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) {
+ StaticANIObject *ani = (StaticANIObject *)sc->_staticANIObjectList1[i];
+
+ if (ani->_id == ANI_LIFTBUTTON)
+ ani->_statics = ani->getStaticsById(lift_getButtonIdP(ani->_statics->_staticsId));
+ }
+
+ GameVar *var = getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName(sO_LiftButtons);
+ if (var) {
+ for (var = var->_subVars; var; var = var->_nextVarObj) {
+ for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) {
+ StaticANIObject *ani = (StaticANIObject *)sc->_staticANIObjectList1[i];
+
+ if (ani->_id == ANI_LIFTBUTTON) {
+ int id = lift_getButtonIdN(ani->_statics->_staticsId);
+
+ if (id == var->_value.intValue)
+ ani->_statics = ani->getStaticsById(id);
+ }
+
+ }
+ }
+ }
+}
+
+void FullpipeEngine::lift_exitSeq(ExCommand *ex) {
+ warning("STUB: FullpipeEngine::lift_exitSeq()");
+}
+
+void FullpipeEngine::lift_closedoorSeq() {
+ warning("STUB: FullpipeEngine::lift_closedoorSeq()");
+}
+
+void FullpipeEngine::lift_walkAndGo() {
+ warning("STUB: FullpipeEngine::lift_walkAndGo()");
+}
+
+void FullpipeEngine::lift_clickButton() {
+ if (_lastLiftButton)
+ lift_walkAndGo();
+}
+
+void FullpipeEngine::lift_goAnimation() { if (_lastLiftButton) {
+ int parentId = _currentScene->_sceneId;
+ int buttonId = lift_getButtonIdN(_lastLiftButton->_statics->_staticsId);
+
+ if (!buttonId)
+ return;
+
+ int numItems = _gameLoader->_preloadItems.size();
+
+ for (int i = 0; i < numItems; i++) {
+ PreloadItem *pre = _gameLoader->_preloadItems[i];
+
+ if (pre->preloadId2 == buttonId && pre->preloadId1 == _currentScene->_sceneId) {
+ MessageQueue *mq = new MessageQueue(_globalMessageQueueList->compact());
+
+ ExCommand *ex = new ExCommand(ANI_MAN, 1, (pre->keyCode != LiftDown ? MV_MAN_LIFTDOWN : MV_MAN_LIFTUP), 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = -1;
+ ex->_field_24 = 1;
+ ex->_excFlags |= 2;
+
+ mq->addExCommandToEnd(ex);
+
+ ex = new ExCommand(parentId, 17, 61, 0, 0, 0, 1, 0, 0, 0);
+
+ ex->_keyCode = buttonId;
+ ex->_excFlags |= 3;
+
+ mq->addExCommandToEnd(ex);
+
+ _aniMan->_flags &= 0xFEFF;
+
+ if (!mq->chain(_aniMan))
+ delete mq;
+
+ _aniMan->_flags |= 1;
+ }
+ }
+ }
+
+ lift_exitSeq(0);
+
+ if (_lastLiftButton) {
+ _lastLiftButton->_statics = _lastLiftButton->getStaticsById(lift_getButtonIdN(_lastLiftButton->_statics->_staticsId));
+ _lastLiftButton = 0;
+ }
+}
+
+void FullpipeEngine::lift_sub1(StaticANIObject *ani) {
+ warning("STUB: FullpipeEngine::lift_sub1()");
+}
+
+void FullpipeEngine::lift_startExitQueue() {
+ MessageQueue *mq = new MessageQueue(_liftExitMQ, 0, 0);
+
+ mq->chain(0);
+}
+
+void FullpipeEngine::lift_sub05(ExCommand *ex) {
+ warning("STUB: FullpipeEngine::lift_sub05()");
+}
+
+bool FullpipeEngine::lift_checkButton(const char *varname) {
+ warning("STUB: FullpipeEngine::lift_checkButton(%s)", varname);
+
+ return false;
+}
+
+void FullpipeEngine::lift_setButtonStatics(Scene *sc, int buttonId) {
+ for (uint i = 0; i < sc->_staticANIObjectList1.size(); i++) {
+ StaticANIObject *ani = (StaticANIObject *)sc->_staticANIObjectList1[i];
+
+ if (ani->_id == ANI_LIFTBUTTON) {
+ int id = lift_getButtonIdN(ani->_statics->_staticsId);
+
+ if (id == buttonId)
+ ani->_statics = ani->getStaticsById(id);
+ }
+ }
+}
+
+
} // End of namespace Fullpipe