3 {$INCLUDE ../shared/a_modes.inc}
8 LCLIntf
, LCLType
, LMessages
, Messages
, SysUtils
, Variants
, Classes
,
9 Graphics
, Controls
, Forms
, Dialogs
, StdCtrls
, ExtCtrls
,
13 TMapTestForm
= class (TForm
)
23 cbTwoPlayers
: TCheckBox
;
24 cbTeamDamage
: TCheckBox
;
25 cbAllowExit
: TCheckBox
;
26 cbWeaponStay
: TCheckBox
;
27 cbMonstersDM
: TCheckBox
;
42 FindD2dDialog
: TOpenDialog
;
44 procedure bOKClick(Sender
: TObject
);
45 procedure bCancelClick(Sender
: TObject
);
46 procedure FormActivate(Sender
: TObject
);
47 procedure FormCreate(Sender
: TObject
);
48 procedure bChooseD2dClick(Sender
: TObject
);
51 { Private declarations }
53 { Public declarations }
57 MapTestForm
: TMapTestForm
;
66 procedure TMapTestForm
.bOKClick(Sender
: TObject
);
73 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
81 if rbCOOP
.Checked
then
85 config
.WriteStr('TestRun', 'GameMode', s
);
89 if (not TryStrToInt(s
, n
)) then
91 config
.WriteStr('TestRun', 'LimTime', s
);
95 if (not TryStrToInt(s
, n
)) then
97 config
.WriteStr('TestRun', 'LimScore', s
);
100 config
.WriteBool('TestRun', 'TwoPlayers', cbTwoPlayers
.Checked
);
101 TestOptionsTwoPlayers
:= cbTwoPlayers
.Checked
;
102 config
.WriteBool('TestRun', 'TeamDamage', cbTeamDamage
.Checked
);
103 TestOptionsTeamDamage
:= cbTeamDamage
.Checked
;
104 config
.WriteBool('TestRun', 'AllowExit', cbAllowExit
.Checked
);
105 TestOptionsAllowExit
:= cbAllowExit
.Checked
;
106 config
.WriteBool('TestRun', 'WeaponStay', cbWeaponStay
.Checked
);
107 TestOptionsWeaponStay
:= cbWeaponStay
.Checked
;
108 config
.WriteBool('TestRun', 'MonstersDM', cbMonstersDM
.Checked
);
109 TestOptionsMonstersDM
:= cbMonstersDM
.Checked
;
111 config
.WriteBool('TestRun', 'MapOnce', cbMapOnce
.Checked
);
112 TestMapOnce
:= cbMapOnce
.Checked
;
114 config
.WriteStr('TestRun', 'Exe', edD2dExe
.Text);
115 TestD2dExe
:= edD2dExe
.Text;
117 config
.SaveFile(EditorDir
+'Editor.cfg');
122 procedure TMapTestForm
.bCancelClick(Sender
: TObject
);
127 procedure TMapTestForm
.FormActivate(Sender
: TObject
);
129 if TestGameMode
= 'TDM' then
130 rbTDM
.Checked
:= True
132 if TestGameMode
= 'CTF' then
133 rbCTF
.Checked
:= True
135 if TestGameMode
= 'COOP' then
136 rbCOOP
.Checked
:= True
138 rbDM
.Checked
:= True;
140 edTime
.Text := TestLimTime
;
141 edScore
.Text := TestLimScore
;
142 cbTwoPlayers
.Checked
:= TestOptionsTwoPlayers
;
143 cbTeamDamage
.Checked
:= TestOptionsTeamDamage
;
144 cbAllowExit
.Checked
:= TestOptionsAllowExit
;
145 cbWeaponStay
.Checked
:= TestOptionsWeaponStay
;
146 cbMonstersDM
.Checked
:= TestOptionsMonstersDM
;
147 cbMapOnce
.Checked
:= TestMapOnce
;
148 edD2dExe
.Text := TestD2dExe
;
151 procedure TMapTestForm
.FormCreate(Sender
: TObject
);
156 config
:= TConfig
.CreateFile(EditorDir
+'Editor.cfg');
158 TestGameMode
:= config
.ReadStr('TestRun', 'GameMode', 'DM');
159 TestLimTime
:= config
.ReadStr('TestRun', 'LimTime', '0');
160 TestLimScore
:= config
.ReadStr('TestRun', 'LimScore', '0');
161 TestOptionsTwoPlayers
:= config
.ReadBool('TestRun', 'TwoPlayers', False);
162 TestOptionsTeamDamage
:= config
.ReadBool('TestRun', 'TeamDamage', False);
163 TestOptionsAllowExit
:= config
.ReadBool('TestRun', 'AllowExit', True);
164 TestOptionsWeaponStay
:= config
.ReadBool('TestRun', 'WeaponStay', False);
165 TestOptionsMonstersDM
:= config
.ReadBool('TestRun', 'MonstersDM', False);
166 TestMapOnce
:= config
.ReadBool('TestRun', 'MapOnce', False);
167 TestD2dExe
:= config
.ReadStr('TestRun', 'Exe', EditorDir
+'Doom2DF.exe');
171 FindD2dDialog
.InitialDir
:= TestD2dExe
;
174 procedure TMapTestForm
.bChooseD2dClick(Sender
: TObject
);
176 if FindD2dDialog
.Execute
then
178 edD2dExe
.Text := FindD2dDialog
.FileName
;