Browse Source

Clean up ItemSpaceOk (#757)

pull/78/head
Anders Jenbo 7 years ago committed by Robin Eklind
parent
commit
2d8ca24220
  1. 77
      Source/items.cpp

77
Source/items.cpp

@ -1458,49 +1458,40 @@ void __fastcall CreatePlrItems(int p)
BOOL __fastcall ItemSpaceOk(int i, int j) BOOL __fastcall ItemSpaceOk(int i, int j)
{ {
int v2; // eax int oi;
int v3; // esi
char v4; // cl if (i < 0 || i >= MAXDUNX || j < 0 || j >= MAXDUNY)
int v5; // ecx return FALSE;
char v6; // cl
BOOLEAN v7; // sf if (dMonster[i][j])
char v8; // cl return FALSE;
char v9; // al
if (dPlayer[i][j])
if (i < 0) return FALSE;
return 0;
if (i >= MAXDUNX) if (dItem[i][j])
return 0; return FALSE;
if (j < 0)
return 0; if (dObject[i][j]) {
if (j >= MAXDUNY) oi = dObject[i][j] > 0 ? dObject[i][j] - 1 : -(dObject[i][j] + 1) ;
return 0; if (object[oi]._oSolidFlag)
v2 = i; return FALSE;
v3 = 112 * i + j;
if (dMonster[0][v3] || dPlayer[v2][j] || dItem[v2][j])
return 0;
v4 = dObject[v2][j];
if (v4) {
v5 = v4 <= 0 ? -1 - v4 : v4 - 1;
if (object[v5]._oSolidFlag)
return 0;
}
v6 = dObject[v2 + 1][j + 1];
v7 = v6 < 0;
if (v6 > 0) {
if (object[v6 - 1]._oSelFlag) /* check */
return 0;
v7 = v6 < 0;
}
if (!v7 || !object[-(v6 + 1)]._oSelFlag) {
v8 = dObject[v2 + 1][j];
if (v8 <= 0)
return nSolidTable[dPiece[0][v3]] == 0;
v9 = dObject[v2][j + 1];
if (v9 <= 0 || !object[v8 - 1]._oSelFlag || !object[v9 - 1]._oSelFlag)
return nSolidTable[dPiece[0][v3]] == 0;
} }
return 0;
if (dObject[i + 1][j + 1] > 0 && object[dObject[i + 1][j + 1] - 1]._oSelFlag)
return FALSE;
if (dObject[i + 1][j + 1] < 0 && object[-(dObject[i + 1][j + 1] + 1)]._oSelFlag)
return FALSE;
if (dObject[i + 1][j] > 0
&& dObject[i][j + 1] > 0
&& object[dObject[i + 1][j] - 1]._oSelFlag
&& object[dObject[i][j + 1] - 1]._oSelFlag) {
return FALSE;
}
return !nSolidTable[dPiece[i][j]];
} }
BOOL __fastcall GetItemSpace(int x, int y, char inum) BOOL __fastcall GetItemSpace(int x, int y, char inum)
@ -3792,7 +3783,7 @@ void __fastcall DrawULine(int y)
src = &gpBuffer[SCREENXY(26, 25)]; src = &gpBuffer[SCREENXY(26, 25)];
dst = &gpBuffer[screen_y_times_768[SStringY[y] + 198] + 26 + 64]; dst = &gpBuffer[screen_y_times_768[SStringY[y] + 198] + 26 + 64];
for(i = 0; i < 3; i++, src += 768, dst += 768) for (i = 0; i < 3; i++, src += 768, dst += 768)
memcpy(dst, src, 266); memcpy(dst, src, 266);
#endif #endif
} }

Loading…
Cancel
Save