source: OniTrainer/current/Unit1.pas@ 521

Last change on this file since 521 was 251, checked in by alloc, 17 years ago
File size: 22.8 KB
Line 
1UNIT Unit1;
2INTERFACE
3USES
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls, ExtCtrls, ComCtrls, StrUtils, Menus, Registry, Math, Buttons,
6 Unit2, Unit3, Unit4, Unit5, Unit6, Unit7, Unit8, Unit9,
7 Unit10, Unit11, Unit12, Unit13, Unit14, Unit15;
8
9TYPE
10 TForm1 = Class(TForm)
11 connect_timer: TTimer;
12 InitStuff: TTimer;
13 not_running: TLabel;
14 get_values: TTimer;
15 Menu: TMainMenu;
16 Menu_Main: TMenuItem;
17 Menu_AOT: TMenuItem;
18 Menu_Exit: TMenuItem;
19 Menu_Options: TMenuItem;
20 Menu_SetHotKeys: TMenuItem;
21 Menu_FreezeTime: TMenuItem;
22 Menu_Windows: TMenuItem;
23 Menu_Chars: TMenuItem;
24 Menu_Items: TMenuItem;
25 Menu_About: TMenuItem;
26 Menu_RefreshTime: TMenuItem;
27 Patches1: TMenuItem;
28 Menu_Patch_Scriptvars: TMenuItem;
29 Menu_Patch_Movements: TMenuItem;
30 Menu_Patch_Messages: TMenuItem;
31 menu_Anims: TMenuItem;
32 menu_Models: TMenuItem;
33 menu_Spawn: TMenuItem;
34 procedure menu_SpawnClick(Sender: TObject);
35 procedure menu_ModelsClick(Sender: TObject);
36 procedure menu_AnimsClick(Sender: TObject);
37 PROCEDURE Menu_Patch_MovementsClick(Sender: TObject);
38 PROCEDURE Menu_Patch_MessagesClick(Sender: TObject);
39 PROCEDURE Menu_Patch_ScriptvarsClick(Sender: TObject);
40 PROCEDURE Menu_SetHotKeysClick(Sender: TObject);
41 PROCEDURE FormCreate(Sender: TObject);
42 PROCEDURE Menu_AboutClick(Sender: TObject);
43 PROCEDURE Menu_FreezeTimeClick(Sender: TObject);
44 PROCEDURE Menu_RefreshTimeClick(Sender: TObject);
45 PROCEDURE get_valuesTimer(Sender: TObject);
46 PROCEDURE InitStuffTimer(Sender: TObject);
47 PROCEDURE Menu_CharsClick(Sender: TObject);
48 PROCEDURE Menu_ExitClick(Sender: TObject);
49 PROCEDURE Menu_AOTClick(Sender: TObject);
50 PROCEDURE connect_timerTimer(Sender: TObject);
51 PROCEDURE Form1Close(Sender: TObject; var Action: TCloseAction);
52 PROCEDURE Menu_AnyCharClick(Sender: TObject);
53 PROCEDURE Menu_CharOverview(Sender: TObject);
54 PROCEDURE Debug_Click(Sender: TObject);
55 PROCEDURE OpenCloseClick(Sender: TObject);
56 PRIVATE
57 PROCEDURE WMHotKey(VAR Msg : TWMHotKey); MESSAGE WM_HOTKEY;
58 PUBLIC
59 END;
60
61VAR
62 Form1: TForm1;
63 CharForms: Array[0..ais_controlled] OF TCharForm;
64 CharMenus: Array[0..ais_controlled] OF TMenuItem;
65 CharOverviewMenu: TMenuItem;
66
67IMPLEMENTATION
68
69{$R *.dfm}
70
71PROCEDURE TForm1.Menu_AOTClick(Sender: TObject);
72 VAR i:Byte;
73 BEGIN
74 IF Form1.Menu_AOT.Checked THEN BEGIN
75 SetWindowAOT(Form1.Handle,False);
76 FOR i:=0 TO ais_controlled DO SetWindowAOT(CharForms[i].Handle,False);
77 SetWindowAOT(Form5.Handle,False);
78 SetWindowAOT(Form6.Handle,False);
79 SetWindowAOT(Form7.Handle,False);
80 SetWindowAOT(Form9.Handle,False);
81 SetWindowAOT(Form10.Handle,False);
82 Form1.Menu_AOT.Checked:=False;
83 END ELSE BEGIN
84 SetWindowAOT(Form1.Handle,True);
85 FOR i:=0 TO ais_controlled DO SetWindowAOT(CharForms[i].Handle,True);
86 SetWindowAOT(Form5.Handle,True);
87 SetWindowAOT(Form6.Handle,True);
88 SetWindowAOT(Form7.Handle,True);
89 SetWindowAOT(Form9.Handle,True);
90 SetWindowAOT(Form10.Handle,True);
91 Form1.Menu_AOT.Checked:=True;
92 END;
93 END;
94
95PROCEDURE TForm1.Menu_ExitClick(Sender: TObject);
96 BEGIN
97 Close;
98 END;
99
100PROCEDURE TForm1.Form1Close(Sender: TObject; var Action: TCloseAction);
101 BEGIN
102 UnregisterHotkey(Form1.Handle,1234);
103 Form9.UnregisterHotkeys;
104 CloseHandle(_ProcessHandle);
105
106 AssignFile(HotKeysFile,_path+'\hotkeys.cfg');
107 Reset(HotKeysFile);
108 Write(HotKeysFile,HotKeys);
109 CloseFile(HotKeysFile);
110 END;
111
112PROCEDURE TForm1.connect_timerTimer(Sender: TObject);
113 VAR temp:byte_array;
114 i:byte;
115 _height:Word;
116 BEGIN
117 IF _Connected=False THEN BEGIN
118 IF ConnectToProcess=True THEN BEGIN
119 _Connected:=True;
120 Menu_Windows.Enabled:=True;
121 not_running.Visible:=False;
122 IF menu_Anims.Checked THEN Form4.Visible:=False;
123 FOR i:=0 TO ais_controlled DO BEGIN
124 IF CharMenus[i].Checked THEN CharForms[i].Visible:=True;
125 END;
126// IF Menu_Messages.Checked THEN Form4.Visible:=True;
127 _height:=0;
128 FOR i:=1 TO number_main_groups DO BEGIN
129 _height:=_height+MainGroups[i].Count*16+20;
130 MainGroups[i].Item.Visible:=True;
131 END;
132 Form1.Height:=_height+44;
133 Form9.DrawTable;
134 END;
135 END ELSE BEGIN
136 temp:=ReadMem($10F50, 4);
137 IF temp[250]=123 THEN BEGIN
138 _Connected:=False;
139 Form1.Caption:='OniTrainer v'+version;
140 lvlnumber:=0;
141 Menu_Windows.Enabled:=False;
142 not_running.Visible:=True;
143 FOR i:=0 TO ais_controlled DO BEGIN
144 CharForms[i].Visible:=False;
145 END;
146 FOR i:=1 TO number_main_groups DO BEGIN
147 MainGroups[i].Item.Visible:=False;
148 END;
149 Form4.Visible:=False;
150 Form7.Visible:=False;
151// Form4.Visible:=False;
152 Form1.Height:=73;
153 Form9.UnregisterHotkeys;
154 END;
155 END;
156 END;
157
158PROCEDURE TForm1.Menu_AnyCharClick(Sender: TObject);
159 VAR charnumber:Byte;
160 BEGIN
161 charnumber:=StrToInt(MidStr(TMenuItem(Sender).Name, 5, 10));
162 IF CharMenus[charnumber].Checked=False THEN BEGIN
163 CharMenus[charnumber].Checked:=True;
164 CharForms[charnumber].Visible:=True;
165 END ELSE BEGIN
166 CharMenus[charnumber].Checked:=False;
167 CharForms[charnumber].Visible:=False;
168 END;
169 END;
170
171PROCEDURE TForm1.Menu_CharOverview(Sender: TObject);
172 BEGIN
173 IF CharOverviewMenu.Checked THEN BEGIN
174 CharOverviewMenu.Checked:=False;
175 Form7.Visible:=False;
176 END ELSE BEGIN
177 CharOverviewMenu.Checked:=True;
178 Form7.Visible:=True;
179 END;
180 END;
181
182PROCEDURE TForm1.Menu_CharsClick(Sender: TObject);
183 VAR i,j:Byte;
184 _top:Word;
185 tempitem:TMenuItem;
186 BEGIN
187 IF _charformsinitialized=False THEN BEGIN
188 _charformsinitialized:=True;
189 FOR i:=0 TO High(CharMenus) DO BEGIN
190 CharMenus[i]:=TMenuItem.Create(Self);
191 CharMenus[i].Name:='Char'+IntToStr(i);
192 IF i=0 THEN CharMenus[i].Caption:='&Player'
193 ELSE BEGIN
194 IF i<10 THEN CharMenus[i].Caption:='AI&'+IntToStr(i);
195 IF i=10 THEN CharMenus[i].Caption:='AI1&0';
196 IF i>10 THEN CharMenus[i].Caption:='AI'+IntToStr(i);
197 END;
198 IF i=0 THEN BEGIN
199 Menu.Items.Find('Windows').Find('Characters').Add(CharMenus[i]);
200 tempitem:=TMenuItem.Create(Self);
201 tempitem.Caption:='-';
202 tempitem.Name:='spacer';
203 Menu.Items.Find('Windows').Find('Characters').Add(tempitem);
204 CharOverviewMenu:=TMenuItem.Create(Self);
205 CharOverviewMenu.Name:='CharOverviewMenu';
206 CharOverviewMenu.Caption:='&CharOverview';
207 CharOverviewMenu.OnClick:=Menu_CharOverview;
208 CharOverviewMenu.ShortCut:=ShortCut(Word('O'),[ssCtrl]);
209 Menu.Items.Find('Windows').Find('Characters').Add(CharOverviewMenu);
210 END ELSE BEGIN
211 IF ((i-1) MOD 10)=0 THEN BEGIN
212 CharMenus[i].Break:=mbBarBreak;
213 END;
214 Menu.Items.Find('Windows').Find('Characters').Add(CharMenus[i]);
215 END;
216 CharMenus[i].OnClick:=Menu_AnyCharClick;
217 END;
218 FOR i:=0 TO ais_controlled DO BEGIN
219 Application.CreateForm(TCharForm,CharForms[i]);
220 CharForms[i].Name:='Char'+IntToStr(i);
221 IF i=0 THEN CharForms[i].Caption:='Player (Char'+IntToStr(i)+')'
222 ELSE CharForms[i].Caption:='AI'+IntToStr(i)+' (Char'+IntToStr(i)+')';
223 FOR j:=1 TO number_char_groups DO BEGIN
224 WITH CharGroups[i][j] DO BEGIN
225 name:=CharGroupsStuff[j].name;
226 Count:=0;
227 Item:=TGroupbox.Create(CharForms[i]);
228 Item.Caption:=name;
229 Item.Name:='Group'+IntToStr(j);
230 Item.Width:=CharForms[i].Width-6;
231 CharForms[i].InsertControl(Item);
232 OpenClose:=TSpeedButton.Create(Item);
233 OpenClose.AllowAllUp:=True;
234 OpenClose.GroupIndex:=j;
235 OpenClose.Flat:=True;
236 OpenClose.Glyph.LoadFromResourceName(HInstance,'ARROWS');
237 OpenClose.Layout:=blGlyphTop;
238 OpenClose.Margin:=0;
239 OpenClose.NumGlyphs:=4;
240 OpenClose.Transparent:=False;
241 OpenClose.Name:='OpenClose'+IntToStr(j);
242 OpenClose.Top:=0;
243 OpenClose.Left:=Item.Width-20;
244 OpenClose.Height:=13;
245 OpenClose.Width:=17;
246 OpenClose.OnClick:=CharForms[i].OpenCloseClick;
247 Item.InsertControl(OpenClose);
248 END;
249 END;
250 WITH CharData[i] DO BEGIN
251 FOR j:=1 TO number_items DO BEGIN
252 WITH Items[j] DO BEGIN
253 struct:=CharDataStuff[j].struct;
254 offset:=CharDataStuff[j].offset;
255 data_type:=CharDataStuff[j].data_type;
256 range:=CharDataStuff[j].range;
257 group:=CharDataStuff[j].group;
258 Inc(CharGroups[i][group].Count);
259 name:=CharDataStuff[j].name;
260 hint:=CharDataStuff[j].hint;
261 Item_Freeze:=TCheckBox.Create(CharGroups[i][group].Item);
262 Item_Freeze.Caption:=name;
263 Item_Freeze.Hint:=hint;
264 Item_Freeze.ShowHint:=True;
265 Item_Freeze.Name:='Char'+IntToStr(j);
266 Item_Freeze.Height:=19;
267 Item_Freeze.Top:=CharGroups[i][group].Count*19-4;
268 Item_Freeze.Left:=4;
269 Item_Freeze.Width:=220;
270 CharGroups[i][group].Item.InsertControl(Item_Freeze);
271 Item_Edit:=TEdit.Create(CharGroups[i][group].Item);
272 Item_Edit.AutoSize:=False;
273 Item_Edit.Hint:=hint;
274 Item_Edit.ShowHint:=True;
275 Item_Edit.Name:='Edit'+IntToStr(j);
276 Item_Edit.Top:=CharGroups[i][group].Count*19-5;
277 Item_Edit.Left:=230;
278 Item_Edit.Height:=18;
279 Item_Edit.Width:=CharGroups[i][group].Item.Width-Item_Edit.Left-4;
280 Item_Edit.OnChange:=CharForms[i].EditClick;
281 //Item_Edit.Text:=IntToStr(Decode_Int(ReadMem(edit_address, 1)));
282 CharGroups[i][group].Item.InsertControl(Item_Edit);
283 END;
284 END;
285 END;
286 _top:=1;
287 FOR j:=1 TO number_char_groups DO BEGIN
288 WITH CharGroups[i][j] DO BEGIN
289 Item.Top:=_top;
290 Item.Height:=Count*19+20;
291 _top:=_top+Item.Height;
292 END;
293 END;
294 CharForms[i].memo.Top:=_top+4;
295 CharForms[i].memo.Width:=CharForms[i].Width-8;
296 CharForms[i].Height:=CharForms[i].memo.Top+charforms[i].memo.height+26;
297 END;
298 Application.CreateForm(TForm9, Form9);
299 END;
300 END;
301
302PROCEDURE TForm1.Debug_Click(Sender: TObject);
303 VAR debugnumber:Byte;
304 bytes:Byte;
305 tempint:integer;
306 tempfloat:single;
307 buffer:byte_array;
308 BEGIN
309 debugnumber:=StrToInt(MidStr(TComponent(Sender).Name, 6, 10));
310 IF MidStr(TComponent(Sender).Name, 1, 5)='DEdit' THEN BEGIN
311 WITH Settings[debugnumber] DO BEGIN
312 IF NOT updating THEN BEGIN
313 CASE edit_type OF
314 1..4:BEGIN
315 bytes:=edit_type;
316 IF TryStrToInt(TEdit(Sender).Text,tempint) THEN BEGIN
317 IF tempint>=Floor(Power(256,bytes)) THEN tempint:=Floor(Power(256,bytes))-1;
318 IF tempint<0 THEN tempint:=0;
319 TEdit(Sender).Text:=IntToStr(tempint);
320 WriteMem(edit_address,bytes,Encode_Int(tempint));
321 END;
322 END;
323 5: BEGIN
324 bytes:=4;
325 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
326 IF Pos('(degrees)',TEdit(Sender).hint)>0 THEN tempfloat:=tempfloat*pi/180;
327 WriteMem(edit_address,bytes,Encode_Float(tempfloat));
328 END;
329 END;
330 6: BEGIN
331 bytes:=Length(TEdit(Sender).Text)+1;
332 WriteMem(edit_address,bytes,Encode_Str(TEdit(Sender).Text,bytes));
333 END;
334 END;
335 END;
336 END;
337 END ELSE BEGIN
338 IF Settings[debugnumber].Item_Checkbox.Checked=False THEN BEGIN
339 buffer[0]:=0;
340 WriteMem(Settings[debugnumber].Address,1,buffer);
341 END ELSE BEGIN
342 buffer[0]:=1;
343 WriteMem(Settings[debugnumber].Address,1,buffer);
344 END;
345 END;
346 END;
347
348PROCEDURE Create_Settings_Array;
349 VAR i:Byte;
350 _top:Word;
351 BEGIN
352 IF _charformsinitialized=False THEN BEGIN
353 FOR i:=1 TO number_main_groups DO BEGIN
354 WITH MainGroups[i] DO BEGIN
355 name:=MainGroupsStuff[i].name;
356 Count:=0;
357 Item:=TGroupbox.Create(Form1);
358 Item.Caption:=name;
359 Item.Name:='Group'+IntToStr(i);
360 Item.Width:=Form1.Width-6;
361 Item.Visible:=False;
362 Form1.InsertControl(Item);
363 OpenClose:=TSpeedButton.Create(Item);
364 OpenClose.AllowAllUp:=True;
365 OpenClose.GroupIndex:=i;
366 OpenClose.Flat:=True;
367 OpenClose.Glyph.LoadFromResourceName(HInstance,'ARROWS');
368 OpenClose.Layout:=blGlyphTop;
369 OpenClose.Margin:=0;
370 OpenClose.NumGlyphs:=4;
371 OpenClose.Transparent:=False;
372 OpenClose.Name:='OpenClose'+IntToStr(i);
373 OpenClose.Top:=0;
374 OpenClose.Left:=Item.Width-20;
375 OpenClose.Height:=13;
376 OpenClose.Width:=17;
377 OpenClose.OnClick:=Form1.OpenCloseClick;
378 Item.InsertControl(OpenClose);
379 END;
380 END;
381 FOR i:=1 TO number_settings DO BEGIN
382 WITH Settings[i] DO BEGIN
383 address:=SettingsStuff[i].address;
384 group:=SettingsStuff[i].group;
385 has_box:=SettingsStuff[i].has_box;
386 has_edit:=SettingsStuff[i].has_edit;
387 Inc(MainGroups[group].Count);
388 Item_Checkbox:=TCheckBox.Create(MainGroups[group].Item);
389 Item_Checkbox.Caption:=SettingsStuff[i].caption;
390 IF has_box THEN BEGIN
391 Item_Checkbox:=TCheckBox.Create(MainGroups[group].Item);
392 Item_Checkbox.Caption:=SettingsStuff[i].caption;
393 Item_Checkbox.hint:=SettingsStuff[i].hint;
394 Item_Checkbox.ShowHint:=True;
395 Item_Checkbox.Name:='Debug'+IntToStr(i);
396 Item_Checkbox.Height:=16;
397 Item_Checkbox.Top:=MainGroups[group].Count*16-4;
398 Item_Checkbox.Left:=8;
399 Item_Checkbox.Width:=170;
400 Item_Checkbox.OnClick:=Form1.Debug_Click;
401 MainGroups[group].Item.InsertControl(Item_Checkbox);
402 END ELSE BEGIN
403 Item_Label:=TLabel.Create(MainGroups[group].Item);
404 Item_Label.Caption:=SettingsStuff[i].caption;
405 Item_Label.Hint:=SettingsStuff[i].hint;
406 Item_Label.ShowHint:=True;
407 Item_Label.Name:='Debug'+IntToStr(i);
408 Item_Label.AutoSize:=False;
409 Item_Label.Height:=16;
410 Item_Label.Top:=MainGroups[group].Count*16-4;
411 Item_Label.Left:=27;
412 Item_Label.Width:=150;
413 MainGroups[group].Item.InsertControl(Item_Label);
414 END;
415 IF has_edit THEN BEGIN
416 edit_address:=SettingsStuff[i].edit_address;
417 edit_type:=SettingsStuff[i].edit_type;
418 Item_Edit:=TEdit.Create(MainGroups[group].Item);
419 Item_Edit.AutoSize:=False;
420 IF SettingsStuff[i].edit_hint='' THEN
421 Item_Edit.Hint:=SettingsStuff[i].hint
422 ELSE Item_Edit.Hint:=SettingsStuff[i].edit_hint;
423 Item_Edit.ShowHint:=True;
424 Item_Edit.Name:='DEdit'+IntToStr(i);
425 Item_Edit.Top:=MainGroups[group].Count*16-6;
426 Item_Edit.Left:=180;
427 Item_Edit.Height:=16;
428 Item_Edit.Width:=MainGroups[group].Item.Width-Item_Edit.Left-4;
429 Item_Edit.OnChange:=Form1.Debug_Click;
430 Item_Edit.Text:='';
431 MainGroups[group].Item.InsertControl(Item_Edit);
432 END;
433 END;
434 END;
435 _top:=1;
436 FOR i:=1 TO number_main_groups DO BEGIN
437 WITH MainGroups[i] DO BEGIN
438 Item.Top:=_top;
439 Item.Height:=Count*16+20;
440 _top:=_top+Item.Height;
441 END;
442 END;
443 END;
444 END;
445
446PROCEDURE TForm1.OpenCloseClick(Sender: TObject);
447 VAR number,i:Byte;
448 _top:Word;
449 BEGIN
450 number:=StrToInt(MidStr(TSpeedButton(Sender).Name, 10, 10));
451 IF MainGroups[number].OpenClose.Down THEN BEGIN
452 MainGroups[number].Item.Height:=20;
453 FOR i:=1 TO number_settings DO BEGIN
454 WITH Settings[i] DO BEGIN
455 IF group=number THEN BEGIN
456 IF has_box THEN Item_Checkbox.Visible:=False
457 ELSE Item_Label.Visible:=False;
458 IF has_edit THEN Item_Edit.Visible:=False;
459 break;
460 END;
461 END;
462 END;
463 _top:=1;
464 FOR i:=1 TO number_main_groups DO BEGIN
465 WITH MainGroups[i] DO BEGIN
466 Item.Top:=_top;
467 _top:=_top+Item.Height;
468 END;
469 END;
470 Form1.Height:=_top+44;
471 END ELSE BEGIN
472 MainGroups[number].Item.Height:=MainGroups[number].Count*16+20;
473 FOR i:=1 TO number_settings DO BEGIN
474 WITH Settings[i] DO BEGIN
475 IF group=number THEN BEGIN
476 IF has_box THEN Item_Checkbox.Visible:=True
477 ELSE Item_Label.Visible:=True;
478 IF has_edit THEN Item_Edit.Visible:=True;
479 break;
480 END;
481 END;
482 END;
483 _top:=1;
484 FOR i:=1 TO number_main_groups DO BEGIN
485 WITH MainGroups[i] DO BEGIN
486 Item.Top:=_top;
487 _top:=_top+Item.Height;
488 END;
489 END;
490 Form1.Height:=_top+44;
491 END;
492 END;
493
494PROCEDURE TForm1.InitStuffTimer(Sender: TObject);
495 BEGIN
496 Create_Settings_Array;
497 Form1.Menu_CharsClick(Menu);
498 Form1.InitStuff.Enabled:=False;
499 END;
500
501PROCEDURE TForm1.get_valuesTimer(Sender: TObject);
502 VAR i,bytes:byte;
503 tempstring:String[2];
504 tempfloat:Single;
505 BEGIN
506 IF _connected THEN BEGIN
507 FOR i:=1 TO number_settings DO BEGIN
508 WITH Settings[i] DO BEGIN
509 IF has_edit THEN BEGIN
510 IF NOT Item_Edit.Focused THEN BEGIN
511 updating:=True;
512 CASE edit_type OF
513 1..4: bytes:=edit_type;
514 5: bytes:=4;
515 6: bytes:=100;
516 ELSE bytes:=0;
517 END;
518 _temp:=ReadMem(edit_address,bytes);
519 CASE edit_type OF
520 1..4: Item_Edit.Text:=IntToStr(Decode_Int(_temp));
521 5: BEGIN
522 tempfloat:=Decode_Float(_temp);
523 IF Pos('(degrees)',Item_Edit.hint)>0 THEN tempfloat:=(tempfloat/pi)*180;
524 Item_Edit.Text:=FloatToStr(tempfloat);
525 END;
526 6: Item_Edit.Text:=Decode_Str(_temp);
527 END;
528 updating:=False;
529 END;
530 END;
531 IF has_box THEN BEGIN
532 IF Decode_Int(ReadMem(address,1))=1 THEN
533 Item_checkbox.Checked:=True
534 ELSE
535 Item_checkbox.Checked:=False;
536 END;
537 END;
538 END;
539 tempstring:=Decode_Str(ReadMem($10F00,2));
540 FOR i:=0 TO 14 DO BEGIN
541 IF lvl_mappings[i]=tempstring THEN BEGIN
542 IF lvlnumber<>i THEN BEGIN
543 lvlnumber:=i;
544 Form1.Caption:='OniTrainer v'+version+' (Current level: '+IntToStr(lvlnumber)+')';
545 END;
546 break;
547 END;
548 END;
549 FOR i:=0 TO ais_controlled DO
550 IF _ais_active[i] THEN CharMenus[i].Enabled:=True
551 ELSE CharMenus[i].Enabled:=False;
552 END;
553 END;
554
555PROCEDURE TForm1.Menu_RefreshTimeClick(Sender: TObject);
556 BEGIN
557 Form1.Menu_FreezeTime.Enabled:=False;
558 Form1.Menu_RefreshTime.Enabled:=False;
559 Form5.Caption:='Set RefreshTimer';
560 Form5.timer_label.Caption:='Set interval to refresh data (1/1000 seconds):';
561 Form5.timer_edit.Text:=IntToStr(Form1.get_values.Interval);
562 Form5.Visible:=True;
563 END;
564
565PROCEDURE TForm1.Menu_FreezeTimeClick(Sender: TObject);
566 BEGIN
567 Form1.Menu_FreezeTime.Enabled:=False;
568 Form1.Menu_RefreshTime.Enabled:=False;
569 Form5.Caption:='Set FreezeTimer';
570 Form5.timer_label.Caption:='Set interval to write data (1/1000 seconds):';
571 Form5.timer_edit.Text:=IntToStr(CharForms[0].timer_freeze.Interval);
572 Form5.Visible:=True;
573 Form5.timer_edit.SetFocus;
574 END;
575
576PROCEDURE TForm1.Menu_AboutClick(Sender: TObject);
577 BEGIN
578 IF Form6.Visible THEN Form6.Visible:=False
579 ELSE Form6.Visible:=True;
580 END;
581
582PROCEDURE TForm1.FormCreate(Sender: TObject);
583 VAR start:Word;
584 BEGIN
585 Form1.Caption:='OniTrainer v'+version;
586 Form1.Height:=73;
587 RegisterHotkey(Form1.Handle,1234,MOD_CONTROL,$41 {'A'});
588
589 _path:=Application.ExeName;
590 start:=1;
591 WHILE (PosEx('\',_path,start)>0) DO BEGIN
592 start:=PosEx('\',_path,start)+1;
593 END;
594 _path:=MidStr(_path,1,start-2);
595 END;
596
597PROCEDURE TForm1.WMHotKey(VAR Msg : TWMHotKey);
598 BEGIN
599 IF Msg.Hotkey=1234 THEN BEGIN
600 Form1.Menu_AOTClick(Form1);
601 END;
602 END;
603
604PROCEDURE TForm1.Menu_SetHotKeysClick(Sender: TObject);
605 BEGIN
606 IF Form9.Visible THEN Form9.Visible:=False
607 ELSE Form9.Visible:=True;
608 IF Form9.Visible THEN Form9.SetFocus;
609 END;
610
611PROCEDURE TForm1.Menu_Patch_ScriptvarsClick(Sender: TObject);
612 BEGIN
613 Menu_Patch_Scriptvars.Checked:=NOT Menu_Patch_Scriptvars.Checked;
614 Form11.Visible:=Menu_Patch_Scriptvars.Checked;
615 IF Form11.Visible THEN Form11.SetFocus;
616 END;
617
618PROCEDURE TForm1.Menu_Patch_MessagesClick(Sender: TObject);
619 BEGIN
620 Menu_Patch_Messages.Checked:=NOT Menu_Patch_Messages.Checked;
621 Form12.Visible:=Menu_Patch_Messages.Checked;
622 IF Form12.Visible THEN Form12.SetFocus;
623 END;
624
625PROCEDURE TForm1.Menu_Patch_MovementsClick(Sender: TObject);
626 BEGIN
627 Menu_Patch_Movements.Checked:=NOT Menu_Patch_Movements.Checked;
628 Form13.Visible:=Menu_Patch_Movements.Checked;
629 IF Form13.Visible THEN Form13.SetFocus;
630 END;
631
632PROCEDURE TForm1.menu_AnimsClick(Sender: TObject);
633 BEGIN
634 menu_Anims.Checked:=NOT menu_Anims.Checked;
635 Form4.Visible:=menu_Anims.Checked;
636 IF Form4.Visible THEN Form4.SetFocus;
637 END;
638
639PROCEDURE TForm1.menu_ModelsClick(Sender: TObject);
640 BEGIN
641 menu_Models.Checked:=NOT menu_Models.Checked;
642 Form14.Visible:=menu_Models.Checked;
643 IF Form14.Visible THEN Form14.SetFocus;
644 END;
645
646PROCEDURE TForm1.menu_SpawnClick(Sender: TObject);
647 BEGIN
648 menu_Spawn.Checked:=NOT menu_Spawn.Checked;
649 Form15.Visible:=menu_Spawn.Checked;
650 IF Form15.Visible THEN Form15.SetFocus;
651 END;
652
653END.
Note: See TracBrowser for help on using the repository browser.