From ade35fb4a42dee563a0e3eee541ec3144cd82af1 Mon Sep 17 00:00:00 2001 From: galaxyhaxz Date: Thu, 14 Jun 2018 05:53:03 -0500 Subject: [PATCH] Fixed decompilation, game can now be played start to finish (#15) Fix Lazurus seals, dropping items, and Shrine spawning. --- Source/inv.cpp | 4 ++-- Source/items.cpp | 4 ++-- Source/objects.cpp | 2 +- Source/themes.cpp | 6 +++--- TODO | 21 ++++++++++----------- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/Source/inv.cpp b/Source/inv.cpp index 18fa6af..c6a7792 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -2540,7 +2540,7 @@ int __fastcall CanPut(int i, int j) v7 = v6 < 0; if ( v6 > 0 ) { - if ( _LOBYTE(objectavail[30 * v6 + 113]) ) /* check */ + if ( _LOBYTE(object[v6-1]._oSelFlag) ) /* check */ return 0; v7 = v6 < 0; } @@ -2550,7 +2550,7 @@ int __fastcall CanPut(int i, int j) if ( v8 > 0 ) { v9 = dObject[v2][j + 1]; - if ( v9 > 0 && _LOBYTE(objectavail[30 * v8 + 113]) && _LOBYTE(objectavail[30 * v9 + 113]) ) + if ( v9 > 0 && _LOBYTE(object[v8-1]._oSelFlag) && _LOBYTE(object[v9-1]._oSelFlag) ) return 0; } if ( !currlevel && (dMonster[0][v3] || dMonster[1][v3 + 1]) ) diff --git a/Source/items.cpp b/Source/items.cpp index 70a9796..e45e44d 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1636,7 +1636,7 @@ bool __fastcall ItemSpaceOk(int i, int j) v7 = v6 < 0; if ( v6 > 0 ) { - if ( _LOBYTE(objectavail[30 * v6 + 113]) ) /* check */ + if ( _LOBYTE(object[v6-1]._oSelFlag) ) /* check */ return 0; v7 = v6 < 0; } @@ -1646,7 +1646,7 @@ bool __fastcall ItemSpaceOk(int i, int j) if ( v8 <= 0 ) return nSolidTable[dPiece[0][v3]] == 0; v9 = dObject[v2][j + 1]; - if ( v9 <= 0 || !_LOBYTE(objectavail[30 * v8 + 113]) || !_LOBYTE(objectavail[30 * v9 + 113]) ) + if ( v9 <= 0 || !_LOBYTE(object[v8-1]._oSelFlag) || !_LOBYTE(object[v9-1]._oSelFlag) ) return nSolidTable[dPiece[0][v3]] == 0; } return 0; diff --git a/Source/objects.cpp b/Source/objects.cpp index 42fe154..047ae11 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -4204,7 +4204,7 @@ void __fastcall OperateBook(int pnum, int i) } if ( v4 ) { - ++objectavail[30 * dObject[35][36] + 123]; /* fix */ + ++object[dObject[35][36]-1]._oVar5; // ++objectavail[30 * dObject[35][36] + 123]; /* fix */ AddMissile(plr[v3].WorldX, plr[v3].WorldY, v1, v2, plr[v3]._pdir, MIS_RNDTELEPORT, 0, v3, 0, 0); v11 = 1; v4 = 0; diff --git a/Source/themes.cpp b/Source/themes.cpp index 6f2754a..5f4bf8e 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -87,7 +87,7 @@ bool __fastcall TFit_Shrine(int i) && !nSolidTable[dPiece[1][v3]] && dung_map[-1][v3] == v1 // block_lvid[v3 + 1940] == v1 && dung_map[1][v3] == v1 - && !dungeon[37][v3 + 7] + && !dObject[-1][v3 - 1] && !dObject[0][v3 + 111] ) { v6 = 1; @@ -99,8 +99,8 @@ bool __fastcall TFit_Shrine(int i) || nSolidTable[dPiece[0][v3 + 1]] || dung_map[0][v3 - 1] != v1 // *(&byte_5B78EB + v3) != v1 || dung_map[0][v3 + 1] != v1 - || dungeon[37][v3 + 7] - || dungeon[37][v3 + 9] ) + || dObject[-1][v3 - 1] + || dObject[-1][v3 + 1] ) /* check */ { goto LABEL_21; } diff --git a/TODO b/TODO index 5a2c022..223186c 100644 --- a/TODO +++ b/TODO @@ -11,19 +11,18 @@ 1000 - Sometimes dungeon will crash on loading if previous levels loaded (DrawClippedObject) 2000 - Generation of Cathedral/Catacombs is slightly inaccurate -2001 - The last seal in Lazarus' Lair doesn't trigger the video/teleport -2002 - White pixels on monsters/cathedral/catacombs (palette entry 256?) -2003 - Swapping items in inventory sometimes deletes the item -2004 - Some spells don't use any mana or charges when they should -2005 - Some tiles are drawn fully lit when they should be transparent (world.cpp) -2006 - Objects should darken with radius instead of being fully lit -2007 - Automap sometimes draws incorrectly, check 'engine_draw_automap_pixels' +2001 - White pixels on monsters/cathedral/catacombs (palette entry 256?) +2002 - Swapping items in inventory sometimes deletes the item +2003 - Some spells don't use any mana or charges when they should +2004 - Some tiles are drawn fully lit when they should be transparent (world.cpp) +2005 - Objects should darken with radius instead of being fully lit +2006 - Automap sometimes draws incorrectly, check 'engine_draw_automap_pixels' *Bad args ECX/EDX for 'engine_draw_pixel' (engine.cpp) -2008 - After being in the dungeon for awhile, the 'Control Panel' will sometimes +2007 - After being in the dungeon for awhile, the 'Control Panel' will sometimes corrupt and be filled with glitched colors (likely a buffer overflow) -2009 - Some CEL functions were written in ASM and have been disabled (engine.cpp) -2010 - Timed messages are broken and have been disabled (tmsg.cpp) -2011 - Server commands are broken and have been disabled (msgcmd.cpp) +2008 - Some CEL functions were written in ASM and have been disabled (engine.cpp) +2009 - Timed messages are broken and have been disabled (tmsg.cpp) +2010 - Server commands are broken and have been disabled (msgcmd.cpp) 3000 - Critical sections should be constructors using CCritSect 3001 - Function 'DRLG_L4TransFix', decompile and check (Test: seed 2349839 level 13)