Berserker
Posts: 16657
|
XEPOMAHT, если pcx загружается после данного триггера и освобождается после боя, то вполне можно. И дай, плагин банально использует АПИ ЭРЫ: Redirect File.
Code:
LIBRARY RandomSkin;
{
DESCRIPTION: Random skin plugin for Era
AUTHOR: Alexander Shostak (aka Berserker aka EtherniDee aka BerSoft)
}
USES
Utils, SysUtils, Era, Lists, Files, StrLib;
CONST
RANDOM_SKIN_FOLDER = 'Data\RandomSkin';
VAR
{o} RandomSets: {O} Lists.TList {OF Lists.TStringList};
PROCEDURE RandomizeSkin;
VAR
{U} RandomSet: Lists.TStringList;
i: INTEGER;
BEGIN
RandomSet := NIL;
// * * * * * //
FOR i := 0 TO RandomSets.Count - 1 DO BEGIN
RandomSet := RandomSets[i];
Era.GlobalRedirectFile(PCHAR(RandomSet[0]), PCHAR(RandomSet[Random(RandomSet.Count)]));
END; // .FOR
END; // .PROCEDURE RandomizeSkin
FUNCTION LoadSettingsFile (SearchRec: SysUtils.TSearchRec): BOOLEAN; (* ContSearch? *)
VAR
{U} RandomSet: Lists.TStringList;
FileContents: STRING;
SkinSets: Utils.TArrayOfString;
SetItems: Utils.TArrayOfString;
i, j: INTEGER;
BEGIN
RandomSet := NIL;
// * * * * * //
IF
(SearchRec.Size > 0) AND
Files.ReadFileContents(RANDOM_SKIN_FOLDER + '\' + SearchRec.Name, FileContents)
THEN BEGIN
SkinSets := StrLib.Explode(FileContents, '*');
FOR i := 0 TO HIGH(SkinSets) DO BEGIN
RandomSet := Lists.NewSimpleStrList;
SetItems := StrLib.Explode(SkinSets[i], #13#10);
FOR j := 0 TO HIGH(SetItems) DO BEGIN
SetItems[j] := SysUtils.Trim(SetItems[j]);
IF SetItems[j] <> '' THEN BEGIN
RandomSet.Add(SetItems[j]);
END; // .IF
END; // .FOR
IF RandomSet.Count = 0 THEN BEGIN
SysUtils.FreeAndNil(RandomSet);
END // .IF
ELSE BEGIN
RandomSets.Add(RandomSet); RandomSet := NIL;
END; // .ELSE
END; // .FOR
END; // .IF
RESULT := TRUE;
END; // .FUNCTION LoadSettingsFile
PROCEDURE LoadSettings;
BEGIN
Files.Scan
(
RANDOM_SKIN_FOLDER + '\*.txt',
Files.faNotDirectory,
'.txt',
LoadSettingsFile
);
END; // .PROCEDURE LoadSettings
PROCEDURE OnBeforeErmInstructions (Event: Era.PEvent); STDCALL;
BEGIN
RandomizeSkin;
END; // .PROCEDURE OnBeforeErmInstructions
PROCEDURE OnAfterLoadGame (Event: Era.PEvent); STDCALL;
BEGIN
RandomizeSkin;
END; // .PROCEDURE OnAfterLoadGame
PROCEDURE OnAfterWoG (Event: Era.PEvent); STDCALL;
BEGIN
LoadSettings;
RandomizeSkin;
END; // .PROCEDURE OnAfterWoG
BEGIN
Randomize;
RandomSets := Lists.NewStrictList(Lists.TStringList);
Era.RegisterHandler(OnAfterWoG, 'OnAfterWoG');
Era.RegisterHandler(OnBeforeErmInstructions, 'OnBeforeErmInstructions');
Era.RegisterHandler(OnAfterLoadGame, 'OnAfterLoadGame');
END.
Думаешь, стоит вызывать выбор случайных pcx и перед боем?
Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
|
|
24.12.2017 21:34 |
|
Valery
Posts: 2196
|
So, a bit of reporting, as I started finally test with tew4 which is heavily scripted. The first problem I ran in was that if you install Homm+HD+era, it will ask you to reinstall HD because patcher not updated. Installing Homm+era+HD is fine.
Then game runs perfect, only played 2 weeks or so, but pushed all buttons, activated 18 interface mods, until now looks great and I love the new fonts for experience screen + the display of values for luck/morale, thx to whoever worked on them (igrik?).
And thx to Bersy for coming back from marriage clouds to finalize his master work. ))
(This post was last modified: 24.12.2017 23:28 by Valery.)
|
|
24.12.2017 23:27 |
|
Berserker
Posts: 16657
|
Great thanks to igrik and many other guys, including you, Val. Without you any work would be senseless )
And I'm still in marriage clouds, working on ability to load and png/bmp/jpeg as in-game pcx16 image with scaling support.
Code:
i := ResizeBmp24(LoadImageAsBmp24('D:\a4.jpg'), 800, 600, FREE_ORIGINAL_BMP);
ResourceTree.AddItem(Bmp24ToPcx16(i, 'zpic1005.pcx'));
Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
|
|
25.12.2017 00:56 |
|
Berserker
Posts: 16657
|
|
25.12.2017 03:51 |
|
igrik
Posts: 2819
|
(25.12.2017 00:56)Berserker Wrote: And I'm still in marriage clouds, working on ability to load and png/bmp/jpeg as in-game pcx16 image with scaling support.
Code:
i := ResizeBmp24(LoadImageAsBmp24('D:\a4.jpg'), 800, 600, FREE_ORIGINAL_BMP);
ResourceTree.AddItem(Bmp24ToPcx16(i, 'zpic1005.pcx'));
Berserker, дай мне эту dll-ку, чтобы я мог продолжить IF:E/D
game bug fixes extended.dll || My Plugins || My GitHub
|
|
25.12.2017 16:31 |
|
Berserker
Posts: 16657
|
|
27.12.2017 02:46 |
|
Berserker
Posts: 16657
|
|
27.12.2017 14:46 |
|
igrik
Posts: 2819
|
|
27.12.2017 19:56 |
|
Valery
Posts: 2196
|
Following a bug complain in HC, I updated "monsters drop resources" script, as it didn't check if mithril is enabled, thus wasted a lot of rewards with mithril which could not be used.
monsters drop resources.erm
Modifications :
|
|
27.12.2017 20:16 |
|
Berserker
Posts: 16657
|
|
27.12.2017 20:23 |
|