From f31e170d48b803d97751ffcf36efbd4cd4d2ffce Mon Sep 17 00:00:00 2001 From: Sergey Semushin Date: Mon, 22 Apr 2019 06:28:05 +0300 Subject: [PATCH] Clean up SyncOpL2Door. --- Source/objects.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Source/objects.cpp b/Source/objects.cpp index 4bc30a4a8..f784b2de8 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4255,25 +4255,24 @@ void SyncOpL1Door(int pnum, int cmd, int i) void SyncOpL2Door(int pnum, int cmd, int i) { - signed int v3; // eax - ObjectStruct *v4; // esi + BOOL do_sync; - if (pnum != myplr) { - v3 = 0; - if (cmd == 43) { - if (object[i]._oVar4) - return; - v3 = 1; - } - if (cmd == 44 && object[i]._oVar4 == 1) - v3 = 1; - if (v3) { - v4 = &object[i]; - if (v4->_otype == OBJ_L2LDOOR) - OperateL2LDoor(-1, i, 0); - if (v4->_otype == OBJ_L2RDOOR) - OperateL2RDoor(-1, i, 0); - } + if (pnum == myplr) + return; + + do_sync = FALSE; + if (cmd == CMD_OPENDOOR) { + if (object[i]._oVar4 != 0) + return; + do_sync = TRUE; + } + if (cmd == CMD_CLOSEDOOR && object[i]._oVar4 == 1) + do_sync = TRUE; + if (do_sync) { + if (object[i]._otype == OBJ_L2LDOOR) + OperateL2LDoor(-1, i, 0); + if (object[i]._otype == OBJ_L2RDOOR) + OperateL2RDoor(-1, i, 0); } }