source: OniTrainer/current/Unit15.pas@ 711

Last change on this file since 711 was 251, checked in by alloc, 17 years ago
File size: 5.3 KB
RevLine 
[251]1UNIT Unit15;
2INTERFACE
3USES
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls, ExtCtrls, ComCtrls, StrUtils;
6TYPE
7 TForm15 = Class(TForm)
8 Label2: TLabel;
9 list: TListBox;
10 check_ai: TCheckBox;
11 GroupBox1: TGroupBox;
12 check_atPlayer: TRadioButton;
13 check_atCoords: TRadioButton;
14 edit_player_x: TEdit;
15 lbl_player_x: TLabel;
16 edit_player_y: TEdit;
17 lbl_player_y: TLabel;
18 edit_player_z: TEdit;
19 lbl_player_z: TLabel;
20 edit_coords_x: TEdit;
21 lbl_coords_x: TLabel;
22 lbl_coords_y: TLabel;
23 edit_coords_y: TEdit;
24 lbl_coords_z: TLabel;
25 edit_coords_z: TEdit;
26 btn_create: TButton;
27 tim_check: TTimer;
28 check_multiple: TCheckBox;
29 edit_multiple: TEdit;
30 GroupBox2: TGroupBox;
31 Label1: TLabel;
32 Label3: TLabel;
33 procedure check_multipleClick(Sender: TObject);
34 procedure check_atCoordsClick(Sender: TObject);
35 PROCEDURE check_atPlayerClick(Sender: TObject);
36 PROCEDURE btn_createClick(Sender: TObject);
37 PROCEDURE tim_checkTimer(Sender: TObject);
38 PROCEDURE FormCloseQuery(Sender: TObject; var CanClose: Boolean);
39 PRIVATE
40 PUBLIC
41 END;
42
43VAR
44 Form15: TForm15;
45
46IMPLEMENTATION
47USES Unit1, Unit2, Unit8,Unit11;
48{$R *.dfm}
49VAR
50 lvl_shown:Byte;
51
52FUNCTION patch_loader_loaded:Boolean;
53 CONST check_for:LongWord=$0010656EE9;
54 address_at:LongWord=$4228ED;
55 BEGIN
56 IF Decode_Int(ReadMem(address_at,4))=check_for THEN result:=True
57 ELSE result:=False;
58 END;
59
60PROCEDURE TForm15.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
61 BEGIN
62 Self.Visible:=False;
63 CanClose:=False;
64 Form1.menu_Spawn.Checked:=False;
65 END;
66
67PROCEDURE TForm15.tim_checkTimer(Sender: TObject);
68 VAR i,modelcount:Byte;
69 BEGIN
70 IF _connected AND (lvlnumber>0) AND patch_loader_loaded THEN BEGIN
71 IF lvl_shown<>lvlnumber THEN BEGIN
72 list.Items.Clear;
73 modelcount:=Decode_Int(ReadMem($10F05,1));
74 FOR i:=0 TO modelcount-1 DO BEGIN
75 list.Items.Add('Model'+IntToStr(i+1)+' ('+IntToStr(Decode_Int(ReadMem($10F20+i*4,4)))+')');
76 END;
77 lvl_shown:=lvlnumber;
78 END;
79 END ELSE BEGIN
80 list.Items.Clear;
81 lvl_shown:=0;
82 END;
83 END;
84
85PROCEDURE TForm15.btn_createClick(Sender: TObject);
86 VAR x,y,z:Single;
87 address_trigger:LongWord;
88 address_counter:LongWord;
89 start_count:Byte;
90 base_name:String;
91 ai:Byte;
92 BEGIN
93 IF _connected AND (lvlnumber>0) AND patch_loader_loaded THEN BEGIN
94 //VALIDATIONS!
95 IF Form15.check_atPlayer.Checked THEN BEGIN
96 END;
97 IF Form15.check_atCoords.Checked THEN BEGIN
98 END;
99 IF Form15.check_ai.Checked THEN ai:=2
100 ELSE ai:=1;
101 address_trigger:=Decode_Int(ReadMem(address_script_var_pointer,4))+3*$10E0;
102 address_counter:=Decode_Int(ReadMem(address_script_var_pointer,4))+4*$10E0;
103 start_count:=Decode_Int(ReadMem(address_counter,1));
104 base_name:='spawned';
105 IF Form15.check_multiple.Checked THEN BEGIN
106 REPEAT
107 WriteMem(address_trigger,1,Encode_Int(ai));
108 Sleep(100);
109 UNTIL Decode_Int(ReadMem(address_counter,1))=(start_count+StrToInt(Form15.edit_multiple.Text));
110 END ELSE WriteMem(address_trigger,1,Encode_Int(ai));
111 END ELSE BEGIN
112 IF _connected AND (lvlnumber>0) THEN BEGIN
113 MessageBox(Form15.Handle,PChar('Oni.exe is not patched.'),PChar('Error'),MB_OK);
114 END;
115 END;
116 END;
117
118PROCEDURE TForm15.check_atPlayerClick(Sender: TObject);
119 BEGIN
120 Form15.lbl_player_x.Enabled:=Form15.check_atPlayer.Checked;
121 Form15.lbl_player_y.Enabled:=Form15.check_atPlayer.Checked;
122 Form15.lbl_player_z.Enabled:=Form15.check_atPlayer.Checked;
123 Form15.edit_player_x.Enabled:=Form15.check_atPlayer.Checked;
124 Form15.edit_player_y.Enabled:=Form15.check_atPlayer.Checked;
125 Form15.edit_player_z.Enabled:=Form15.check_atPlayer.Checked;
126 Form15.lbl_coords_x.Enabled:=Form15.check_atCoords.Checked;
127 Form15.lbl_coords_y.Enabled:=Form15.check_atCoords.Checked;
128 Form15.lbl_coords_z.Enabled:=Form15.check_atCoords.Checked;
129 Form15.edit_coords_x.Enabled:=Form15.check_atCoords.Checked;
130 Form15.edit_coords_y.Enabled:=Form15.check_atCoords.Checked;
131 Form15.edit_coords_z.Enabled:=Form15.check_atCoords.Checked;
132 END;
133
134PROCEDURE TForm15.check_atCoordsClick(Sender: TObject);
135 BEGIN
136 Form15.lbl_player_x.Enabled:=Form15.check_atPlayer.Checked;
137 Form15.lbl_player_y.Enabled:=Form15.check_atPlayer.Checked;
138 Form15.lbl_player_z.Enabled:=Form15.check_atPlayer.Checked;
139 Form15.edit_player_x.Enabled:=Form15.check_atPlayer.Checked;
140 Form15.edit_player_y.Enabled:=Form15.check_atPlayer.Checked;
141 Form15.edit_player_z.Enabled:=Form15.check_atPlayer.Checked;
142 Form15.lbl_coords_x.Enabled:=Form15.check_atCoords.Checked;
143 Form15.lbl_coords_y.Enabled:=Form15.check_atCoords.Checked;
144 Form15.lbl_coords_z.Enabled:=Form15.check_atCoords.Checked;
145 Form15.edit_coords_x.Enabled:=Form15.check_atCoords.Checked;
146 Form15.edit_coords_y.Enabled:=Form15.check_atCoords.Checked;
147 Form15.edit_coords_z.Enabled:=Form15.check_atCoords.Checked;
148 END;
149
150PROCEDURE TForm15.check_multipleClick(Sender: TObject);
151 BEGIN
152 Form15.edit_multiple.Enabled:=Form15.check_multiple.Checked;
153 END;
154
155END.
Note: See TracBrowser for help on using the repository browser.