3 {$INCLUDE ../shared/a_modes.inc}
8 LCLIntf
, LCLType
, LMessages
, SysUtils
, Variants
, Classes
,
9 Graphics
, Controls
, Forms
, Dialogs
, StdCtrls
, ExtCtrls
;
12 TSaveMapForm
= class (TForm
)
20 procedure GetMaps(FileName
: String; placeName
: Boolean);
21 procedure FormActivate(Sender
: TObject
);
22 procedure eMapNameChange(Sender
: TObject
);
23 procedure lbMapListClick(Sender
: TObject
);
24 procedure bOKClick(Sender
: TObject
);
27 { Private declarations }
29 { Public declarations }
33 SaveMapForm
: TSaveMapForm
;
38 BinEditor
, MAPREADER
, WADEDITOR
, WADSTRUCT
, MAPSTRUCT
, g_language
;
42 procedure TSaveMapForm
.FormActivate(Sender
: TObject
);
44 bOK
.Enabled
:= (eMapName
.Text <> '');
48 procedure TSaveMapForm
.eMapNameChange(Sender
: TObject
);
50 if eMapName
.Text <> '' then
56 procedure TSaveMapForm
.lbMapListClick(Sender
: TObject
);
58 if lbMapList
.ItemIndex
> -1 then
59 eMapName
.Text := lbMapList
.Items
[lbMapList
.ItemIndex
];
62 procedure TSaveMapForm
.bOKClick(Sender
: TObject
);
69 for a
:= 0 to lbMapList
.Count
-1 do
70 if eMapName
.Text = lbMapList
.Items
[a
] then
72 ok
:= MessageBox(0, PChar(Format(_lc
[I_MSG_MAP_EXISTS
],
74 PChar(_lc
[I_MSG_SAVE_MAP
]),
75 MB_ICONQUESTION
or MB_YESNO
or MB_DEFBUTTON1
) = mrYes
;
82 SaveMapForm
.ModalResult
:= mrOk
84 SaveMapForm
.ModalResult
:= mrCancel
;
87 procedure TSaveMapForm
.GetMaps(FileName
: String; placeName
: Boolean);
90 a
, max_num
, j
: Integer;
94 Sign
: Array [0..2] of Char;
98 lbMapList
.Items
.Clear();
101 WAD
:= TWADEditor_1
.Create();
102 WAD
.ReadFile(FileName
);
103 ResList
:= WAD
.GetResourcesList('');
105 if ResList
<> nil then
106 for a
:= 0 to High(ResList
) do
108 if not WAD
.GetResource('', ResList
[a
], Data
, Len
) then
111 CopyMemory(@Sign
[0], Data
, 3);
114 if Sign
= MAP_SIGNATURE
then
117 lbMapList
.Items
.Add(nm
);
126 nm
:= Trim(Copy(nm
, 4, Length(nm
)-3));
127 j
:= StrToIntDef(nm
, 0);
141 nm
:= IntToStr(max_num
);
142 if Length(nm
) < 2 then