Skip to content

Commit

Permalink
MM6Patch v2.5.5:
Browse files Browse the repository at this point in the history
[-] My bug: A bug when taking an item from character's inventory that could lead to immunities corruption in MM8.
[-] My bug: FixChests option got broken by 2.5.4 changes.
  • Loading branch information
GrayFace committed Jan 13, 2022
1 parent 4cff7b1 commit 18a034c
Show file tree
Hide file tree
Showing 12 changed files with 3,636 additions and 3,584 deletions.
7,118 changes: 3,561 additions & 3,557 deletions MMPatches/Install/MM6patch.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion MMPatches/Install/MM6patch/Files/MM6Patch ReadMe.TXT
@@ -1,4 +1,4 @@
GrayFace MM6 Patch v2.5.4
GrayFace MM6 Patch v2.5.5
By Sergey Rozhenko <mailto:sergroj@mail.ru>
https://grayface.github.io/

Expand All @@ -11,6 +11,11 @@ At the end of ReadMe you'll find info on how to report errors.

([+] - feature, [-] - fixed bug, [*] - other)

New in version 2.5.5:
<< MM6 - MM8 >>
[-] My bug: Possible character resistances corruption when taking an item from the inventory.
[-] My bug: FixChests option got broken by 2.5.4 changes.

New in version 2.5.4:
<< MM6 - MM8 >>
[-] Now, when a location re-spawns, all artifacts generated in chests you've never opened get cleared from "obtained artifacts" list.
Expand Down
Binary file modified MMPatches/Install/MM6patch/Files/MM6patch.dll
Binary file not shown.
7 changes: 6 additions & 1 deletion MMPatches/Install/MM6patchBuka/Files/MM6Patch ReadMe_rus.TXT
@@ -1,4 +1,4 @@
GrayFace MM6 Patch v2.5.4
GrayFace MM6 Patch v2.5.5
�����: ������ ������� <mailto:sergroj@mail.ru>
https://grayface.github.io/ru/
������� ����� ReadMe �� �������: Black Phantom <mailto:mm6789@yandex.ru>
Expand All @@ -10,6 +10,11 @@ https://grayface.github.io/ru/

([+] - ����, [-] - ������������ ���, [*] - ������)

��������� ������ 2.5.5:
<< MM6 - MM8 >>
[-] ��� ���: ������ �������� �� ��������� ����� ��������� � ����������� ������ � ����������������� ���������.
[-] ��� ���: ��������� ������ 2.5.4 ������� ����� "FixChests".

��������� ������ 2.5.4:
<< MM6 - MM8 >>
[-] ������, ��� �������� �������, ��� ��������������� ��������� �� �� �������� �������� ��������� �� ������ ��������� ����������.
Expand Down
Binary file modified MMPatches/Install/MM6patchBuka/Files/MM6patch.dll
Binary file not shown.
Binary file modified MMPatches/Install/MM6patchLoc/Files/MM6patch.dll
Binary file not shown.
7 changes: 6 additions & 1 deletion MMPatches/Install/MM6patchLoc/eng/MM6Patch ReadMe.TXT
@@ -1,4 +1,4 @@
GrayFace MM6 Patch v2.5.4
GrayFace MM6 Patch v2.5.5
By Sergey Rozhenko <mailto:sergroj@mail.ru>
https://grayface.github.io/

Expand All @@ -11,6 +11,11 @@ At the end of ReadMe you'll find info on how to report errors.

([+] - feature, [-] - fixed bug, [*] - other)

New in version 2.5.5:
<< MM6 - MM8 >>
[-] My bug: Possible character resistances corruption when taking an item from the inventory.
[-] My bug: FixChests option got broken by 2.5.4 changes.

New in version 2.5.4:
<< MM6 - MM8 >>
[-] Now, when a location re-spawns, all artifacts generated in chests you've never opened get cleared from "obtained artifacts" list.
Expand Down
7 changes: 6 additions & 1 deletion MMPatches/Install/MM6patchLoc/rus/MM6Patch ReadMe_rus.TXT
@@ -1,4 +1,4 @@
GrayFace MM6 Patch v2.5.4
GrayFace MM6 Patch v2.5.5
�����: ������ ������� <mailto:sergroj@mail.ru>
https://grayface.github.io/ru/
������� ����� ReadMe �� �������: Black Phantom <mailto:mm6789@yandex.ru>
Expand All @@ -10,6 +10,11 @@ https://grayface.github.io/ru/

([+] - ����, [-] - ������������ ���, [*] - ������)

��������� ������ 2.5.5:
<< MM6 - MM8 >>
[-] ��� ���: ������ �������� �� ��������� ����� ��������� � ����������� ������ � ����������������� ���������.
[-] ��� ���: ��������� ������ 2.5.4 ������� ����� "FixChests".

��������� ������ 2.5.4:
<< MM6 - MM8 >>
[-] ������, ��� �������� �������, ��� ��������������� ��������� �� �� �������� �������� ��������� �� ������ ��������� ����������.
Expand Down
4 changes: 0 additions & 4 deletions MMPatches/MM6Patch/MM6patch.bdsproj
Expand Up @@ -170,10 +170,6 @@
<VersionInfoKeys Name="ProductName">GrayFace MM6 Patch</VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">2.5.3.0</VersionInfoKeys>
</VersionInfoKeys>




<Excluded_Packages>
<Excluded_Packages Name="C:\Documents and Settings\Serg\Мои документы\Borland Studio Projects\Bpl\dclrx2006.bpl">File C:\Documents and Settings\Serg\Мои документы\Borland Studio Projects\Bpl\dclrx2006.bpl not found</Excluded_Packages>
<Excluded_Packages Name="C:\Documents and Settings\Serg\Мои документы\Borland Studio Projects\Bpl\dclrxbd2006.bpl">File C:\Documents and Settings\Serg\Мои документы\Borland Studio Projects\Bpl\dclrxbd2006.bpl not found</Excluded_Packages>
Expand Down
7 changes: 7 additions & 0 deletions MMPatches/MM6Patch/MM6patch.dpr
Expand Up @@ -341,6 +341,13 @@ Version 2.5.4:
(MM6)
[-] Routine for intentional generation of artifacts was completely broken
Version 2.5.5:
(MM6-MM8)
[-] My bug: Possible corruption when taking an item from character's inventory
[-] My bug: FixChests option got broken by 2.5.4 changes
(MM7, MM8)
[*] FixUnmarkedArtifacts now also respects the 13 artifacts limit imposed by the game
Åñëè çàãðóçèòü ñåéâ, ãäå âñå ðîæè îäèíàêîâûå, à ïîòîì ñåéâ ñ ðàçíûìè, áóäóò ÷åðíûå ïÿòíà íà ìåñòå ðîæ
Expand Down
Binary file modified MMPatches/MM6Patch/MM6patch.res
Binary file not shown.
63 changes: 44 additions & 19 deletions MMPatches/MMCommon/MMHooks.pas
Expand Up @@ -1530,34 +1530,57 @@ procedure FixRandomizeArtifact6;
mov edx, [__pArtifactsFound]
end;

procedure FixUnmarkedArtifactsMax;
const
cmd1 = m6*$448ACF + m7*$456932;
cmd1v = m6*$18247C83 + m7*$0C7D83;
cmd2 = m6*$448AD4 + m7*$456936;
cmd2v = m6*$247D + m7*$1C7D;
count = cmd2 - 1;
asm
jz @std
movsx eax, byte ptr [count]
movzx edx, byte ptr [__ArtifactsFoundCount]
add eax, esi
cmp eax, edx
ja @std
// check that the limit hasn't been removed
cmp word ptr [cmd2], cmd2v
jnz @std
mov eax, [cmd1]
{$IFDEF mm7}
and eax, $ffffff
{$ENDIF}
cmp eax, cmd1v
@std:
end;

//----- Fix chests: place items that were left over

procedure FixChest(p: pchar; chest: int);
procedure FixChest(p: PChest; chest: int);
var
ItemsToPlace: array[0..139] of int;
ItemsToPlace: array[1..140] of int;
placed: Boolean;
i, j, h: int;
begin
h:= pint(_pChestWidth^ + 4*pword(p)^)^*pint(_pChestHeight^ + 4*pword(p)^)^ - 1;
inc(p, 4);
for i := 0 to 139 do
ItemsToPlace[i]:= pint(p + _ItemOff_Size*i)^;
inc(p, _ItemOff_Size*140);
for i := 0 to h do
if pint2(p + i*2)^ > 0 then
ItemsToPlace[pint2(p + i*2)^ - 1]:= 0;
h:= pint(_pChestWidth^ + 4*p.Pic)^*pint(_pChestHeight^ + 4*p.Pic)^ - 1;
for i := 1 to 140 do
ItemsToPlace[i]:= p.Items[i].Number;
for j := 0 to h do
if p.Inventory[j] > 0 then
ItemsToPlace[p.Inventory[j]]:= 0;
placed:= false;
for i := 0 to 139 do
for i := 1 to 140 do
if ItemsToPlace[i] <> 0 then
for j := 0 to h do
if (pint2(p + j*2)^ = 0) and _Chest_CanPlaceItem(0, ItemsToPlace[i], j, chest) then
if (p.Inventory[j] = 0) and _Chest_CanPlaceItem(0, ItemsToPlace[i], j, chest) then
begin
_Chest_PlaceItem(0, i, j, chest);
_Chest_PlaceItem(0, i - 1, j, chest);
placed:= true;
break;
end;
if placed then
UnmarkChestArtifacts(ptr(p));
UnmarkChestArtifacts(p);
end;

procedure FixChestHook6;
Expand Down Expand Up @@ -2248,7 +2271,7 @@ procedure RemoveInvItem(a: PIntegerArray; slot: int);
begin
a[0]:= 0;
a:= @a[-slot];
for i := 0 to 137 do
for i := 0 to 125 do
if (a[i] < 0) and (a[-1 - a[i]] <= 0) then
a[i]:= 0;
end;
Expand All @@ -2272,7 +2295,7 @@ procedure RemoveInvItemChest(a: PInt2Array; slot: int);
i: int;
begin
a[slot]:= 0;
for i := 0 to 137 do
for i := 0 to 139 do
if (a[i] < 0) and (a[-1 - a[i]] <= 0) then
a[i]:= 0;
end;
Expand Down Expand Up @@ -3395,8 +3418,8 @@ procedure FixMonMissiles;

procedure FixMonsterSpells;
asm
mov dx, [ebp + $C]
mov [ebp - m7*$23 - m8*$1F], dx
mov dl, [ebp + $C]
mov [ebp - m7*$23 - m8*$1F], dl
end;

//----- Fix monsters' Shrapmetal spread
Expand Down Expand Up @@ -3948,7 +3971,7 @@ procedure DontSkipSimpleMessage;
//----- HooksList

var
HooksCommon: array[1..83] of TRSHookInfo = (
HooksCommon: array[1..84] of TRSHookInfo = (
(p: m6*$453ACE + m7*$463341 + m8*$461316; newp: @UpdateHintHook;
t: RShtCallStore; Querry: hqFixStayingHints), // Fix element hints staying active in some dialogs
(p: m6*$4226F8 + m7*$427E71 + m8*$4260A8; newp: @FixItemSpells;
Expand Down Expand Up @@ -4101,6 +4124,8 @@ procedure DontSkipSimpleMessage;
t: RShtBefore; size: 6), // Don't count artifacts generated in unopened chests as taken
(p: m6*$44A75C + m7*$450657; newp: @FixUnmarkedArtifacts;
t: RShtBefore; size: 5 + m6; Querry: hqFixUnmarkedArtifacts), // Fix deliberately generated artifacts not marked as found
(p: m6*$44A732 + m7*$450637; newp: @FixUnmarkedArtifactsMax;
t: RShtAfter; size: 5 + m7*2; Querry: hqFixUnmarkedArtifacts), // Fix deliberately generated artifacts not marked as found
()
);
{$IFDEF MM6}
Expand Down

0 comments on commit 18a034c

Please sign in to comment.