Skip to content

Commit

Permalink
feat(Era): Update Era source code to commit: 3021c66
Browse files Browse the repository at this point in the history
Signed-off-by: VuceticBranislav <24853106+VuceticBranislav@users.noreply.github.com>
(cherry picked from commit d80c993334d94a5366d09dff8af2c3e5e9f6ff2b)
  • Loading branch information
VuceticBranislav committed Dec 1, 2023
1 parent cc3ac59 commit 6959502
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
6 changes: 2 additions & 4 deletions Era/Graph.pas
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ function LoadImage (const FilePath: myAStr): {n} TGraphic;
FileContentsStream := nil;
result := nil;
ImageType := GetImageTypeByName(FilePath);

if (ImageType <> IMG_UNKNOWN) and EraZip.ReadFileContentsFromZipFs(FilePath, FileContents) then begin
result := CreateImageOfType(ImageType);
FileContentsStream := Classes.TStringStream.Create(FileContents);
Expand Down Expand Up @@ -1178,6 +1179,7 @@ function GetDefPngFrame (Def: Heroes.PDefItem; GroupInd, FrameInd: integer): {On
// if PngFilePath <> '' then begin
// Lodman.FindRedirection(StrLib.Concat([Def.GetName, ':', PngFileName]), PngFilePath, [Lodman.FRF_EXCLUDE_FALLBACKS]);
// result := LoadPngResource(PngFilePath);

// if (result <> nil) and (ColorizationInfo.ColorizationType = COLORIZATION_SPECIAL_COLORS) then begin
// ApplyPaletteColorizationToPng(TRawImage(result.Data), ColorizationInfo.PlayerColor);
// end;
Expand Down Expand Up @@ -1885,8 +1887,6 @@ function Hook_LoadPcx8 (
if ImageResource <> nil then begin
Image := ImageResource.Data as TRawImage;
result := TPcx8ItemStatic.Create(FileNameStr, Image.Width, Image.Height);

ImageResource.DecRef;
end else begin
result := Ptr(PatchApi.Call(THISCALL_, OrigFunc, [FileName]));
end;
Expand Down Expand Up @@ -1917,8 +1917,6 @@ function Hook_LoadPcx16 (
if ImageResource <> nil then begin
Image := ImageResource.Data as TRawImage;
result := TPcx16ItemStatic.Create(FileNameStr, Image.Width, Image.Height);

ImageResource.DecRef;
end else begin
result := Ptr(PatchApi.Call(THISCALL_, OrigFunc, [FileName]));
end;
Expand Down
2 changes: 1 addition & 1 deletion Era/Heroes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ class function TPcx8ItemStatic.Create (const aName: myAStr; aWidth, aHeight: int
result := nil;

if (aWidth <= 0) or (aHeight <= 0) then begin
Core.NotifyError(Legacy.Format('Cannot create pcx16 image of size %dx%d', [aWidth, aHeight]));
Core.NotifyError(Legacy.Format('Cannot create pcx8 image of size %dx%d', [aWidth, aHeight]));

aWidth := UtilsB2.IfThen(aWidth > 0, aWidth, 1);
aHeight := UtilsB2.IfThen(aHeight > 0, aHeight, 1);
Expand Down
5 changes: 1 addition & 4 deletions Era/Tweaks.pas
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,6 @@ function Hook_StartBattle (OrigFunc: pointer; AdvMan: Heroes.PAdvManager; Packed
CombatId := DEFAULT_COMBAT_ID;
end;

// GlobalRng := BattleDeterministicRng; // FIXME DELETEME
// CombatId := Erm.UniqueRng.Random; // FIXME DELETEME

result := PatchApi.Call(THISCALL_, OrigFunc, [AdvMan, PackedCoords, AttackerHero, AttackerArmy, DefenderPlayerId, DefenderTown, DefenderHero, DefenderArmy, Seed, Unk10, IsBank]);
GlobalRng := QualitativeRng;
end; // .function Hook_StartBattle
Expand Down Expand Up @@ -1768,7 +1765,7 @@ procedure DumpExceptionContext (ExcRec: PExceptionRecord; Context: Windows.PCont

Line('EAX: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Eax), Core.ANALYZE_DATA));
Line('ECX: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Ecx), Core.ANALYZE_DATA));
Line('EDC: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Edx), Core.ANALYZE_DATA));
Line('EDX: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Edx), Core.ANALYZE_DATA));
Line('EBX: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Ebx), Core.ANALYZE_DATA));
Line('ESP: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Esp), Core.ANALYZE_DATA));
Line('EBP: ' + Core.ModuleContext.AddrToStr(Ptr(Context.Ebp), Core.ANALYZE_DATA));
Expand Down
2 changes: 1 addition & 1 deletion Era/VersionInfo.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VER_Major = 3;
VER_Minor = 9;
VER_Build = 4;
VER_Build = 5;
VER_Revision = 0;
VER_Sufix = '-port';

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<img src="https://user-images.githubusercontent.com/24853106/235458980-7db2599e-b53c-4ee3-83d9-bb0098543189.png" alt="Logo" width="312" height="256">
</a>

### ERA 3 - New era of mod making - Delphi XE, 10 & 11
### ERA 3 - New era of mod making - Delphi XE, 10, 11 & 12
<p align="center">
<i>Code ported from Delphi 7 version to modern Delphi (Delphi XE, 10 & 11)<br/>
<i>Code ported from Delphi 7 version to modern Delphi (Delphi XE, 10, 11 & 12)<br/>
Contains ERA and VFS projects as well as B2 library.<br/>
<br/></i>
Original commits containing code are from <a href="https://github.com/ethernidee">ethernidee</a> repositories:<br/>
ERA: <a href="https://github.com/ethernidee/era/tree/4dd5ea55340c0dd014138ea2940ba598acfbc0bb"><strong>4dd5ea5</strong></a><br/>
ERA: <a href="https://github.com/ethernidee/era/tree/3021c66faf646d013db3683ee56ba101e01caf5e"><strong>3021c66</strong></a><br/>
VFS: <a href="https://github.com/ethernidee/vfs/tree/5e4a7f0acf1bdfa9eadb3f63c7177e8f0ccbf2e0"><strong>5e4a7f0</strong></a><br/>
B2: <a href="https://github.com/ethernidee/b2/tree/001251eb5f45378c329b6a60a4a4d87c346f36a0"><strong>001251e</strong></a>
</p>
Expand Down

0 comments on commit 6959502

Please sign in to comment.