diff --git a/Source/inv.cpp b/Source/inv.cpp index e2cac611e..ebeaac823 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -2084,7 +2084,7 @@ void CloseInventory() void DoTelekinesis() { if (pcursobj != -1) - NetSendCmdParam1(true, CMD_OPOBJT, pcursobj); + NetSendCmdLoc(MyPlayerId, true, CMD_OPOBJT, cursPosition); if (pcursitem != -1) NetSendCmdGItem(true, CMD_REQUESTAGITEM, MyPlayerId, pcursitem); if (pcursmonst != -1) { diff --git a/Source/msg.cpp b/Source/msg.cpp index 267746b47..0217c9dbc 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1215,14 +1215,15 @@ size_t OnTargetSpellTile(const TCmd *pCmd, Player &player) return sizeof(message); } -size_t OnObjectTileAction(const TCmd &cmd, Player &player, action_id action) +size_t OnObjectTileAction(const TCmd &cmd, Player &player, action_id action, bool pathToObject = true) { const auto &message = reinterpret_cast(cmd); const Point position { message.x, message.y }; const Object *object = ObjectAtPosition(position); if (gbBufferMsgs != 1 && player.isOnActiveLevel() && object != nullptr) { - MakePlrPath(player, position, !object->_oSolidFlag && !object->_oDoorFlag); + if (pathToObject) + MakePlrPath(player, position, !object->_oSolidFlag && !object->_oDoorFlag); player.destAction = action; player.destParam1 = object->GetId(); @@ -1231,18 +1232,6 @@ size_t OnObjectTileAction(const TCmd &cmd, Player &player, action_id action) return sizeof(message); } -size_t OnOperateObjectTelekinesis(const TCmd *pCmd, Player &player) -{ - const auto &message = *reinterpret_cast(pCmd); - - if (gbBufferMsgs != 1 && player.isOnActiveLevel() && message.wParam1 < MAXOBJECTS) { - player.destAction = ACTION_OPERATETK; - player.destParam1 = message.wParam1; - } - - return sizeof(message); -} - size_t OnAttackMonster(const TCmd *pCmd, Player &player) { const auto &message = *reinterpret_cast(pCmd); @@ -3005,7 +2994,7 @@ size_t ParseCmd(int pnum, const TCmd *pCmd) case CMD_DISARMXY: return OnObjectTileAction(*pCmd, player, ACTION_DISARM); case CMD_OPOBJT: - return OnOperateObjectTelekinesis(pCmd, player); + return OnObjectTileAction(*pCmd, player, ACTION_OPERATETK, false); case CMD_ATTACKID: return OnAttackMonster(pCmd, player); case CMD_ATTACKPID: diff --git a/Source/msg.h b/Source/msg.h index feb204a38..ad144deaa 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -164,8 +164,9 @@ enum _cmd_id : uint8_t { CMD_RESURRECT, // Operate object using telekinesis. // - // body (TCmdParam1): - // int16_t object_num + // body (TCmdLoc): + // int8_t x + // int8_t y CMD_OPOBJT, // Knockback target monster using telekinesis. //