From: DeaDDooMER Date: Fri, 13 Dec 2019 20:45:34 +0000 (+0300) Subject: fix invalid value for TRIGGER_MUSIC.action X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=53ee9bbf75ec69253d01f1b073ab2a82476cea7e;p=d2df-editor.git fix invalid value for TRIGGER_MUSIC.action --- diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 225daec..1d1d2ce 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -5155,7 +5155,7 @@ begin if vleObjectProperty.Values[_lc[I_PROP_TR_MUSIC_ACT]] = _lc[I_PROP_TR_MUSIC_ON] then Data.MusicAction := 1 else - Data.MusicAction := 2; + Data.MusicAction := 0; end; TRIGGER_PUSH: diff --git a/src/shared/MAPWRITER.pas b/src/shared/MAPWRITER.pas index 4c7a637..95a181d 100644 --- a/src/shared/MAPWRITER.pas +++ b/src/shared/MAPWRITER.pas @@ -50,7 +50,7 @@ type implementation uses - BinEditor, SysUtils; + MAPDEF, BinEditor, SysUtils, Math; { TMapWriter } @@ -268,7 +268,8 @@ end; function TMapWriter_1.AddTriggers(Triggers: TTriggersRec1Array): Boolean; var - a, size: LongWord; + a, i, size: LongWord; + tr: ^TTriggerData; begin if Triggers = nil then begin @@ -276,6 +277,15 @@ begin Exit; end; + // fix broken maps + for i := 0 to High(Triggers) do + begin + tr := @Triggers[i].data; + case Triggers[i].TriggerType of + TRIGGER_MUSIC: tr.MusicAction := Min(Max(tr.MusicAction, 0), 1); + end + end; + SetLength(FDataBlocks, Length(FDataBlocks)+1); size := SizeOf(TTriggerRec_1);