Browse Source

Merge pull request #1015 from Predelnik/PR

Clean up SyncObjectAnim, OperateL1RDoor (bin exact)
pull/287/head^2
Robin Eklind 7 years ago committed by GitHub
parent
commit
43f19ad5b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 195
      Source/objects.cpp
  2. 2
      Source/objects.h

195
Source/objects.cpp

@ -2350,67 +2350,57 @@ void RedoPlayerVision()
}
}
void OperateL1RDoor(int pnum, int oi, unsigned char sendflag)
void OperateL1RDoor(int pnum, int oi, BOOL sendflag)
{
int v3; // esi
int v4; // eax
int v5; // ebx
int v6; // edi
int v7; // ST04_4
int v8; // [esp+Ch] [ebp-Ch]
int v9; // [esp+10h] [ebp-8h]
int param1; // [esp+14h] [ebp-4h]
int xp, yp, pn;
v3 = oi;
param1 = oi;
v9 = pnum;
v4 = object[oi]._oVar4;
if (v4 != 2) {
v5 = object[v3]._ox;
v6 = object[v3]._oy;
if (v4) {
if (!deltaload)
PlaySfxLoc(IS_DOORCLOS, v5, object[v3]._oy);
v8 = v6 + 112 * v5;
if (dDead[0][v8] != 0 || dMonster[0][v8] != 0 || dItem[0][v8] != 0) {
object[v3]._oVar4 = 2;
return;
}
if (v9 == myplr && sendflag)
NetSendCmdParam1(TRUE, CMD_CLOSEDOOR, param1);
v7 = object[v3]._oVar1;
object[v3]._oVar4 = 0;
object[v3]._oSelFlag = 3;
ObjSetMicro(v5, v6, v7);
if (object[v3]._oVar2 == 50) {
if (dPiece[-1][v8] == 396) /* check *(_DWORD *)&dflags[28][4 * v8 + 32] == 396 ) */
ObjSetMicro(v5 - 1, v6, 411);
else
ObjSetMicro(v5 - 1, v6, 50);
if (object[oi]._oVar4 == 2) {
if (!deltaload)
PlaySfxLoc(IS_DOORCLOS, object[oi]._ox, object[oi]._oy);
return;
}
xp = object[oi]._ox;
yp = object[oi]._oy;
if (object[oi]._oVar4 == 0) {
if (pnum == myplr && sendflag)
NetSendCmdParam1(TRUE, CMD_OPENDOOR, oi);
if (!deltaload)
PlaySfxLoc(IS_DOOROPEN, object[oi]._ox, object[oi]._oy);
ObjSetMicro(xp, yp, 395);
dArch[xp][yp] = 8;
objects_set_door_piece(xp, yp - 1);
object[oi]._oAnimFrame += 2;
object[oi]._oPreFlag = TRUE;
DoorSet(oi, xp - 1, yp);
object[oi]._oVar4 = 1;
object[oi]._oSelFlag = 2;
RedoPlayerVision();
} else {
if (!deltaload)
PlaySfxLoc(IS_DOORCLOS, xp, object[oi]._oy);
if (((dDead[xp][yp] != 0 ? 0 : 1) & (dMonster[xp][yp] != 0 ? 0 : 1) & (dItem[xp][yp] != 0 ? 0 : 1)) != 0) {
if (pnum == myplr && sendflag)
NetSendCmdParam1(TRUE, CMD_CLOSEDOOR, oi);
pn = object[oi]._oVar1;
object[oi]._oVar4 = 0;
object[oi]._oSelFlag = 3;
ObjSetMicro(xp, yp, pn);
if (object[oi]._oVar2 != 50) {
ObjSetMicro(xp - 1, yp, object[oi]._oVar2);
} else {
ObjSetMicro(v5 - 1, v6, object[v3]._oVar2);
if (dPiece[xp - 1][yp] == 396)
ObjSetMicro(xp - 1, yp, 411);
else
ObjSetMicro(xp - 1, yp, 50);
}
object[v3]._oAnimFrame -= 2;
object[v3]._oPreFlag = FALSE;
object[oi]._oAnimFrame -= 2;
object[oi]._oPreFlag = FALSE;
RedoPlayerVision();
} else {
if (pnum == myplr && sendflag)
NetSendCmdParam1(TRUE, CMD_OPENDOOR, oi);
if (!deltaload)
PlaySfxLoc(IS_DOOROPEN, object[v3]._ox, object[v3]._oy);
ObjSetMicro(v5, v6, 395);
dArch[v5][v6] = 8;
objects_set_door_piece(v5, v6 - 1);
object[v3]._oAnimFrame += 2;
object[v3]._oPreFlag = TRUE;
DoorSet(param1, v5 - 1, v6);
object[v3]._oVar4 = 1;
object[v3]._oSelFlag = 2;
object[oi]._oVar4 = 2;
}
RedoPlayerVision();
return;
}
if (!deltaload)
PlaySfxLoc(IS_DOORCLOS, object[v3]._ox, object[v3]._oy);
}
// 676190: using guessed type int deltaload;
@ -4666,60 +4656,51 @@ void SyncL3Doors(int i)
void SyncObjectAnim(int o)
{
int v1; // edx
int v2; // ebx
int v3; // esi
v1 = object[o]._otype;
v2 = ObjFileList[0];
v3 = 0;
while (v2 != (char)AllObjects[object[o]._otype].ofindex)
v2 = ObjFileList[v3++ + 1];
object[o]._oAnimData = pObjCels[v3];
if (v1 <= OBJ_BOOK2R) {
if (v1 != OBJ_BOOK2R) {
if (v1 > OBJ_L1LIGHT) {
if (v1 <= OBJ_L1RDOOR) {
SyncL1Doors(o);
} else {
if (v1 == OBJ_LEVER)
goto LABEL_30;
if (v1 > OBJ_SKSTICK5) {
if (v1 <= OBJ_CRUX3) {
SyncCrux(o);
return;
}
if (v1 == OBJ_BOOK2L || v1 == OBJ_SWITCHSKL)
LABEL_30:
SyncLever(o);
}
}
}
return;
}
LABEL_24:
SyncQSTLever(o);
return;
int file;
int i;
int ofindex;
file = ObjFileList[0];
ofindex = AllObjects[object[o]._otype].ofindex;
i = 0;
while (file != ofindex) {
file = ObjFileList[i + 1];
i++;
}
if (v1 >= OBJ_L2LDOOR) {
if (v1 <= OBJ_L2RDOOR) {
SyncL2Doors(o);
return;
}
if (v1 == OBJ_BLINDBOOK)
goto LABEL_24;
if (v1 == OBJ_PEDISTAL) {
SyncPedistal(o);
return;
}
if (v1 > OBJ_PEDISTAL) {
if (v1 <= OBJ_L3RDOOR) {
SyncL3Doors(o);
return;
}
if (v1 == OBJ_STEELTOME)
goto LABEL_24;
}
object[o]._oAnimData = pObjCels[i];
switch (object[o]._otype) {
case OBJ_BOOK2R:
case OBJ_BLINDBOOK:
case OBJ_STEELTOME:
SyncQSTLever(o);
break;
case OBJ_L1LIGHT:
break;
case OBJ_L1LDOOR:
case OBJ_L1RDOOR:
SyncL1Doors(o);
break;
case OBJ_L2LDOOR:
case OBJ_L2RDOOR:
SyncL2Doors(o);
break;
case OBJ_L3LDOOR:
case OBJ_L3RDOOR:
SyncL3Doors(o);
break;
case OBJ_LEVER:
case OBJ_BOOK2L:
case OBJ_SWITCHSKL:
SyncLever(o);
break;
case OBJ_CRUX1:
case OBJ_CRUX2:
case OBJ_CRUX3:
SyncCrux(o);
break;
case OBJ_PEDISTAL:
SyncPedistal(o);
break;
}
}

2
Source/objects.h

@ -90,7 +90,7 @@ void ObjL1Special(int x1, int y1, int x2, int y2);
void ObjL2Special(int x1, int y1, int x2, int y2);
void DoorSet(int oi, int dx, int dy);
void RedoPlayerVision();
void OperateL1RDoor(int pnum, int oi, unsigned char sendflag);
void OperateL1RDoor(int pnum, int oi, BOOL sendflag);
void OperateL1LDoor(int pnum, int oi, unsigned char sendflag);
void OperateL2RDoor(int pnum, int oi, unsigned char sendflag);
void OperateL2LDoor(int pnum, int oi, unsigned char sendflag);

Loading…
Cancel
Save