aboutsummaryrefslogtreecommitdiff
path: root/engines/fullpipe/messagehandlers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/fullpipe/messagehandlers.cpp')
-rw-r--r--engines/fullpipe/messagehandlers.cpp106
1 files changed, 60 insertions, 46 deletions
diff --git a/engines/fullpipe/messagehandlers.cpp b/engines/fullpipe/messagehandlers.cpp
index 94754ad22a..f53a705ea9 100644
--- a/engines/fullpipe/messagehandlers.cpp
+++ b/engines/fullpipe/messagehandlers.cpp
@@ -100,7 +100,7 @@ void global_messageHandler_KickMetal() {
}
int global_messageHandler1(ExCommand *cmd) {
- debug(5, "global_messageHandler1: %d %d", cmd->_messageKind, cmd->_messageNum);
+ debugC(5, kDebugEvents, "global_messageHandler1: %d %d", cmd->_messageKind, cmd->_messageNum);
if (cmd->_excFlags & 0x10000) {
if (cmd->_messageNum == MV_MAN_TOLADDER)
@@ -159,9 +159,9 @@ int global_messageHandler1(ExCommand *cmd) {
}
break;
case 36: // keydown
- g_fp->defHandleKeyDown(cmd->_keyCode);
+ g_fp->defHandleKeyDown(cmd->_param);
- switch (cmd->_keyCode) {
+ switch (cmd->_param) {
case '\x1B': // ESC
if (g_fp->_currentScene) {
getGameLoaderInventory()->unselectItem(0);
@@ -188,15 +188,28 @@ int global_messageHandler1(ExCommand *cmd) {
}
break;
case '\t':
+ // Demo has no map
+ if (g_fp->isDemo() && g_fp->getLanguage() == Common::RU_RUS)
+ break;
+
if (g_fp->_flgCanOpenMap)
g_fp->openMap();
cmd->_messageKind = 0;
break;
- case 'p':
+ case Common::KEYCODE_F1:
if (g_fp->_flgCanOpenMap)
g_fp->openHelp();
cmd->_messageKind = 0;
break;
+ case '8':
+ {
+ int num = 32;
+ for (int i = 0; i < g_fp->_gameLoader->_sc2array[num]._picAniInfosCount; i++) {
+ debug("pic %d, %d:", num, i);
+ g_fp->_gameLoader->_sc2array[num]._picAniInfos[i]->print();
+ }
+ }
+ break;
default:
break;
}
@@ -221,7 +234,7 @@ int global_messageHandler1(ExCommand *cmd) {
}
if (newex) {
- newex->_keyCode = g_fp->_aniMan->_okeyCode;
+ newex->_param = g_fp->_aniMan->_odelay;
newex->_excFlags |= 3;
newex->postMessage();
}
@@ -286,26 +299,26 @@ int global_messageHandler2(ExCommand *cmd) {
break;
case 28:
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (ani)
ani->_priority = cmd->_field_14;
break;
case 25:
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (ani) {
if (cmd->_field_14) {
ani->setFlags40(true);
ani->_callback2 = staticANIObjectCallback;
} else {
ani->setFlags40(false);
- ani->_callback2 = 0;
+ ani->_callback2 = 0; // Really NULL
}
}
break;
case 26:
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (ani) {
Movement *mov = ani->_movement;
if (mov)
@@ -330,7 +343,7 @@ int global_messageHandler2(ExCommand *cmd) {
for (int snd = 0; snd < g_fp->_currSoundListCount; snd++) {
SoundList *s = g_fp->_currSoundList1[snd];
- int ms = s->getCount();
+ int ms = s->getCount();
for (int i = 0; i < ms; i++) {
s->getSoundByIndex(i)->setPanAndVolumeByStaticAni();
}
@@ -364,13 +377,13 @@ int global_messageHandler3(ExCommand *cmd) {
case 17:
switch (cmd->_messageNum) {
case 61:
- debug(0, "preload: { %d, %d },", cmd->_parentId, cmd->_keyCode);
- return g_fp->_gameLoader->preloadScene(cmd->_parentId, cmd->_keyCode);
+ debugC(0, kDebugEvents, "preload: { %d, %d },", cmd->_parentId, cmd->_param);
+ return g_fp->_gameLoader->preloadScene(cmd->_parentId, cmd->_param);
case 62:
- return g_fp->_gameLoader->gotoScene(cmd->_parentId, cmd->_keyCode);
+ return g_fp->_gameLoader->gotoScene(cmd->_parentId, cmd->_param);
case 64:
if (g_fp->_currentScene && g_fp->_msgObjectId2
- && (!(cmd->_keyCode & 4) || g_fp->_msgObjectId2 != cmd->_field_14 || g_fp->_msgId != cmd->_field_20)) {
+ && (!(cmd->_param & 4) || g_fp->_msgObjectId2 != cmd->_field_14 || g_fp->_msgId != cmd->_field_20)) {
ani = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_msgObjectId2, g_fp->_msgId);
if (ani) {
ani->_flags &= 0xFF7F;
@@ -382,11 +395,11 @@ int global_messageHandler3(ExCommand *cmd) {
g_fp->_msgY = 0;
g_fp->_msgObjectId2 = 0;
g_fp->_msgId = 0;
- if ((cmd->_keyCode & 1) || (cmd->_keyCode & 2)) {
+ if ((cmd->_param & 1) || (cmd->_param & 2)) {
g_fp->_msgX = cmd->_x;
g_fp->_msgY = cmd->_y;
}
- if (cmd->_keyCode & 4) {
+ if (cmd->_param & 4) {
g_fp->_msgObjectId2 = cmd->_field_14;
g_fp->_msgId = cmd->_field_20;
}
@@ -397,39 +410,40 @@ int global_messageHandler3(ExCommand *cmd) {
ani2 = g_fp->_currentScene->getStaticANIObject1ById(g_fp->_gameLoader->_field_FA, -1);
if (ani) {
- if (g_fp->_msgObjectId2 == ani->_id && g_fp->_msgId == ani->_okeyCode) {
+ if (g_fp->_msgObjectId2 == ani->_id && g_fp->_msgId == ani->_odelay) {
cmd->_messageKind = 0;
return result;
}
- if (canInteractAny(ani2, ani, cmd->_keyCode)) {
- handleObjectInteraction(ani2, ani, cmd->_keyCode);
+ if (canInteractAny(ani2, ani, cmd->_param)) {
+ handleObjectInteraction(ani2, ani, cmd->_param);
return 1;
}
} else {
int id = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY);
PictureObject *pic = g_fp->_currentScene->getPictureObjectById(id, 0);
if (pic) {
- if (g_fp->_msgObjectId2 == pic->_id && g_fp->_msgId == pic->_okeyCode) {
+ if (g_fp->_msgObjectId2 == pic->_id && g_fp->_msgId == pic->_odelay) {
cmd->_messageKind = 0;
return result;
}
- if (!ani2 || canInteractAny(ani2, pic, cmd->_keyCode)) {
+ if (!ani2 || canInteractAny(ani2, pic, cmd->_param)) {
if (!ani2 || (ani2->isIdle() && !(ani2->_flags & 0x80) && !(ani2->_flags & 0x100)))
- handleObjectInteraction(ani2, pic, cmd->_keyCode);
+ handleObjectInteraction(ani2, pic, cmd->_param);
return 1;
}
}
}
}
- if (getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->_isEnabled && cmd->_keyCode <= 0) {
+ if (getSc2MctlCompoundBySceneId(g_fp->_currentScene->_sceneId)->_isEnabled && cmd->_param <= 0) {
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))) {
+ debugC(0, kDebugPathfinding, "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);
- ex->_keyCode = 1;
+ ex->_param = 1;
ex->_excFlags |= 3;
ex->_x = cmd->_sceneClickX;
ex->_y = cmd->_sceneClickY;
@@ -445,7 +459,7 @@ int global_messageHandler3(ExCommand *cmd) {
return result;
}
case 58:
- g_fp->setCursor(cmd->_keyCode);
+ g_fp->setCursor(cmd->_param);
return result;
case 59:
setInputDisabled(1);
@@ -455,7 +469,7 @@ int global_messageHandler3(ExCommand *cmd) {
return result;
case 56:
if (cmd->_field_2C) {
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (ani) {
getGameLoaderInventory()->addItem2(ani);
result = 1;
@@ -491,16 +505,16 @@ int global_messageHandler3(ExCommand *cmd) {
obj = g_fp->_currentScene->getStaticANIObject1ById(cmd->_x, cmd->_y);
else
obj = g_fp->_currentScene->getPictureObjectById(cmd->_x, cmd->_y);
- handleObjectInteraction(g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode), obj, cmd->_field_20);
+ handleObjectInteraction(g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param), obj, cmd->_field_20);
result = 1;
}
return result;
case 51:
- return startWalkTo(cmd->_parentId, cmd->_keyCode, cmd->_x, cmd->_y, cmd->_field_20);
+ return startWalkTo(cmd->_parentId, cmd->_param, cmd->_x, cmd->_y, cmd->_field_20);
case 52:
- return doSomeAnimation(cmd->_parentId, cmd->_keyCode, cmd->_field_20);
+ return doSomeAnimation(cmd->_parentId, cmd->_param, cmd->_field_20);
case 53:
- return doSomeAnimation2(cmd->_parentId, cmd->_keyCode);
+ return doSomeAnimation2(cmd->_parentId, cmd->_param);
case 63:
if (cmd->_objtype == kObjTypeObjstateCommand) {
ObjstateCommand *c = (ObjstateCommand *)cmd;
@@ -532,7 +546,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -543,7 +557,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -562,7 +576,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -573,7 +587,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -594,7 +608,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -615,7 +629,7 @@ int global_messageHandler4(ExCommand *cmd) {
case 19: {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -633,7 +647,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -645,7 +659,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -653,7 +667,7 @@ int global_messageHandler4(ExCommand *cmd) {
break;
case 27:
- if (!g_fp->_currentScene || g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode) == 0) {
+ if (!g_fp->_currentScene || g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param) == 0) {
ani = g_fp->accessScene(cmd->_field_20)->getStaticANIObject1ById(cmd->_parentId, -1);
if (ani) {
ani = new StaticANIObject(ani);
@@ -664,7 +678,7 @@ int global_messageHandler4(ExCommand *cmd) {
// fall through
case 5:
if (g_fp->_currentScene)
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -679,7 +693,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -717,7 +731,7 @@ int global_messageHandler4(ExCommand *cmd) {
if (!g_fp->_currentScene)
break;
- ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_keyCode);
+ ani = g_fp->_currentScene->getStaticANIObject1ById(cmd->_parentId, cmd->_param);
if (!ani)
break;
@@ -765,7 +779,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 +789,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->_z);
+ top = off + (int)(sqrt(sq) * off2 / link->_length);
} else {
top = (gr->calcOffset(ani->_ox, ani->_oy)->_field_14 >> 8) & 0xff;
}