source: OniTrainer/current/Unit13.pas@ 845

Last change on this file since 845 was 251, checked in by alloc, 17 years ago
File size: 6.3 KB
Line 
1UNIT Unit13;
2
3INTERFACE
4
5USES
6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, ExtCtrls;
8
9TYPE
10 TForm13 = Class(TForm)
11 timer_getData: TTimer;
12 GroupBox1: TGroupBox;
13 Label1: TLabel;
14 Label2: TLabel;
15 Label3: TLabel;
16 edit_x: TEdit;
17 edit_y: TEdit;
18 edit_z: TEdit;
19 check_player: TCheckBox;
20 GroupBox2: TGroupBox;
21 Label4: TLabel;
22 Label5: TLabel;
23 Label6: TLabel;
24 edit_others_x: TEdit;
25 edit_others_y: TEdit;
26 edit_others_z: TEdit;
27 check_others: TCheckBox;
28 Label7: TLabel;
29 PROCEDURE check_othersClick(Sender: TObject);
30 PROCEDURE edit_others_zClick(Sender: TObject);
31 PROCEDURE edit_others_yClick(Sender: TObject);
32 PROCEDURE edit_others_xChange(Sender: TObject);
33 PROCEDURE timer_getDataTimer(Sender: TObject);
34 PROCEDURE check_playerClick(Sender: TObject);
35 PROCEDURE edit_zChange(Sender: TObject);
36 PROCEDURE edit_yChange(Sender: TObject);
37 PROCEDURE edit_xChange(Sender: TObject);
38 PRIVATE
39 PUBLIC
40 END;
41
42VAR
43 Form13: TForm13;
44
45IMPLEMENTATION
46
47USES Unit1,Unit2,Unit3,Unit5,Unit6,Unit7,Unit8,Unit9,Unit10,Unit11;
48
49CONST
50 address_settings:LongWord=$10EE0;
51
52{$R *.dfm}
53
54FUNCTION patch_movements_loaded:Boolean;
55 CONST check_for:LongWord=$0EDCDEE9;
56 address_at:LongWord=$43B23D;
57 BEGIN
58 IF Decode_Int(ReadMem(address_at,4))=check_for THEN result:=True
59 ELSE result:=False;
60 END;
61
62PROCEDURE TForm13.edit_xChange(Sender: TObject);
63 VAR tempfloat:Single;
64 BEGIN
65 IF _connected AND patch_movements_loaded THEN BEGIN
66 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
67 WriteMem(address_settings+$4,4,Encode_Float(tempfloat));
68 END;
69 END;
70 END;
71
72PROCEDURE TForm13.edit_yChange(Sender: TObject);
73 VAR tempfloat:Single;
74 BEGIN
75 IF _connected AND patch_movements_loaded THEN BEGIN
76 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
77 WriteMem(address_settings+$8,4,Encode_Float(tempfloat));
78 END;
79 END;
80 END;
81
82PROCEDURE TForm13.edit_zChange(Sender: TObject);
83 VAR tempfloat:Single;
84 BEGIN
85 IF _connected AND patch_movements_loaded THEN BEGIN
86 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
87 WriteMem(address_settings+$C,4,Encode_Float(tempfloat));
88 END;
89 END;
90 END;
91
92PROCEDURE TForm13.check_playerClick(Sender: TObject);
93 BEGIN
94 IF _connected AND patch_movements_loaded THEN BEGIN
95 IF check_player.Checked=False THEN BEGIN
96 _temp:=Encode_Int(0);
97 WriteMem(address_settings,4,_temp);
98 END ELSE BEGIN
99 _temp:=Encode_Int(1);
100 WriteMem(address_settings,4,_temp);
101 END;
102 END;
103 END;
104
105PROCEDURE TForm13.timer_getDataTimer(Sender: TObject);
106 BEGIN
107 IF _connected AND patch_movements_loaded THEN BEGIN
108 IF NOT Form13.edit_x.Focused THEN Form13.edit_x.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$4,4)));
109 IF NOT Form13.edit_y.Focused THEN Form13.edit_y.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$8,4)));
110 IF NOT Form13.edit_z.Focused THEN Form13.edit_z.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$C,4)));
111 IF Decode_Int(ReadMem(address_settings,4))=1 THEN
112 Form13.check_player.Checked:=True
113 ELSE
114 Form13.check_player.Checked:=False;
115 IF NOT Form13.edit_others_x.Focused THEN Form13.edit_others_x.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$14,4)));
116 IF NOT Form13.edit_others_y.Focused THEN Form13.edit_others_y.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$18,4)));
117 IF NOT Form13.edit_others_z.Focused THEN Form13.edit_others_z.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$1C,4)));
118 IF Decode_Int(ReadMem(address_settings+$10,4))=1 THEN
119 Form13.check_others.Checked:=True
120 ELSE
121 Form13.check_others.Checked:=False;
122 Form13.check_player.Enabled:=True;
123 Form13.edit_x.Enabled:=True;
124 Form13.edit_y.Enabled:=True;
125 Form13.edit_z.Enabled:=True;
126 Form13.check_others.Enabled:=True;
127 Form13.edit_others_x.Enabled:=True;
128 Form13.edit_others_y.Enabled:=True;
129 Form13.edit_others_z.Enabled:=True;
130 Form13.Label1.Enabled:=True;
131 Form13.Label2.Enabled:=True;
132 Form13.Label3.Enabled:=True;
133 Form13.Label4.Enabled:=True;
134 Form13.Label5.Enabled:=True;
135 Form13.Label6.Enabled:=True;
136 END ELSE BEGIN
137 Form13.check_player.Enabled:=False;
138 Form13.edit_x.Enabled:=False;
139 Form13.edit_y.Enabled:=False;
140 Form13.edit_z.Enabled:=False;
141 Form13.check_others.Enabled:=False;
142 Form13.edit_others_x.Enabled:=False;
143 Form13.edit_others_y.Enabled:=False;
144 Form13.edit_others_z.Enabled:=False;
145 Form13.Label1.Enabled:=False;
146 Form13.Label2.Enabled:=False;
147 Form13.Label3.Enabled:=False;
148 Form13.Label4.Enabled:=False;
149 Form13.Label5.Enabled:=False;
150 Form13.Label6.Enabled:=False;
151 END;
152 END;
153
154PROCEDURE TForm13.edit_others_xChange(Sender: TObject);
155 VAR tempfloat:Single;
156 BEGIN
157 IF _connected AND patch_movements_loaded THEN BEGIN
158 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
159 WriteMem(address_settings+$14,4,Encode_Float(tempfloat));
160 END;
161 END;
162 END;
163
164PROCEDURE TForm13.edit_others_yClick(Sender: TObject);
165 VAR tempfloat:Single;
166 BEGIN
167 IF _connected AND patch_movements_loaded THEN BEGIN
168 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
169 WriteMem(address_settings+$18,4,Encode_Float(tempfloat));
170 END;
171 END;
172 END;
173
174PROCEDURE TForm13.edit_others_zClick(Sender: TObject);
175 VAR tempfloat:Single;
176 BEGIN
177 IF _connected AND patch_movements_loaded THEN BEGIN
178 IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
179 WriteMem(address_settings+$1C,4,Encode_Float(tempfloat));
180 END;
181 END;
182 END;
183
184PROCEDURE TForm13.check_othersClick(Sender: TObject);
185 BEGIN
186 IF _connected AND patch_movements_loaded THEN BEGIN
187 IF check_others.Checked=False THEN BEGIN
188 _temp:=Encode_Int(0);
189 WriteMem(address_settings+$10,4,_temp);
190 END ELSE BEGIN
191 _temp:=Encode_Int(1);
192 WriteMem(address_settings+$10,4,_temp);
193 END;
194 END;
195 END;
196
197END.
Note: See TracBrowser for help on using the repository browser.