UNIT Unit13;

INTERFACE

USES
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

TYPE
  TForm13 = Class(TForm)
    timer_getData: TTimer;
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    edit_x: TEdit;
    edit_y: TEdit;
    edit_z: TEdit;
    check_player: TCheckBox;
    GroupBox2: TGroupBox;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    edit_others_x: TEdit;
    edit_others_y: TEdit;
    edit_others_z: TEdit;
    check_others: TCheckBox;
    Label7: TLabel;
    PROCEDURE check_othersClick(Sender: TObject);
    PROCEDURE edit_others_zClick(Sender: TObject);
    PROCEDURE edit_others_yClick(Sender: TObject);
    PROCEDURE edit_others_xChange(Sender: TObject);
    PROCEDURE timer_getDataTimer(Sender: TObject);
    PROCEDURE check_playerClick(Sender: TObject);
    PROCEDURE edit_zChange(Sender: TObject);
    PROCEDURE edit_yChange(Sender: TObject);
    PROCEDURE edit_xChange(Sender: TObject);
  PRIVATE
  PUBLIC
  END;

VAR
  Form13: TForm13;

IMPLEMENTATION

USES Unit1,Unit2,Unit3,Unit5,Unit6,Unit7,Unit8,Unit9,Unit10,Unit11;

CONST
  address_settings:LongWord=$10EE0;

{$R *.dfm}

FUNCTION patch_movements_loaded:Boolean;
  CONST check_for:LongWord=$0EDCDEE9;
    address_at:LongWord=$43B23D;
  BEGIN
    IF Decode_Int(ReadMem(address_at,4))=check_for THEN result:=True
    ELSE result:=False;
  END;

PROCEDURE TForm13.edit_xChange(Sender: TObject);
  VAR tempfloat:Single;
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
        WriteMem(address_settings+$4,4,Encode_Float(tempfloat));
      END;
    END;
  END;

PROCEDURE TForm13.edit_yChange(Sender: TObject);
  VAR tempfloat:Single;
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
        WriteMem(address_settings+$8,4,Encode_Float(tempfloat));
      END;
    END;
  END;

PROCEDURE TForm13.edit_zChange(Sender: TObject);
  VAR tempfloat:Single;
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
        WriteMem(address_settings+$C,4,Encode_Float(tempfloat));
      END;
    END;
  END;

PROCEDURE TForm13.check_playerClick(Sender: TObject);
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF check_player.Checked=False THEN BEGIN
        _temp:=Encode_Int(0);
        WriteMem(address_settings,4,_temp);
      END ELSE BEGIN
        _temp:=Encode_Int(1);
        WriteMem(address_settings,4,_temp);
      END;
    END;
  END;

PROCEDURE TForm13.timer_getDataTimer(Sender: TObject);
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF NOT Form13.edit_x.Focused THEN Form13.edit_x.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$4,4)));
      IF NOT Form13.edit_y.Focused THEN Form13.edit_y.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$8,4)));
      IF NOT Form13.edit_z.Focused THEN Form13.edit_z.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$C,4)));
      IF Decode_Int(ReadMem(address_settings,4))=1 THEN
        Form13.check_player.Checked:=True
      ELSE
        Form13.check_player.Checked:=False;
      IF NOT Form13.edit_others_x.Focused THEN Form13.edit_others_x.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$14,4)));
      IF NOT Form13.edit_others_y.Focused THEN Form13.edit_others_y.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$18,4)));
      IF NOT Form13.edit_others_z.Focused THEN Form13.edit_others_z.Text:=FloatToStr(Decode_Float(ReadMem(address_settings+$1C,4)));
      IF Decode_Int(ReadMem(address_settings+$10,4))=1 THEN
        Form13.check_others.Checked:=True
      ELSE
        Form13.check_others.Checked:=False;
      Form13.check_player.Enabled:=True;
      Form13.edit_x.Enabled:=True;
      Form13.edit_y.Enabled:=True;
      Form13.edit_z.Enabled:=True;
      Form13.check_others.Enabled:=True;
      Form13.edit_others_x.Enabled:=True;
      Form13.edit_others_y.Enabled:=True;
      Form13.edit_others_z.Enabled:=True;
      Form13.Label1.Enabled:=True;
      Form13.Label2.Enabled:=True;
      Form13.Label3.Enabled:=True;
      Form13.Label4.Enabled:=True;
      Form13.Label5.Enabled:=True;
      Form13.Label6.Enabled:=True;
    END ELSE BEGIN
      Form13.check_player.Enabled:=False;
      Form13.edit_x.Enabled:=False;
      Form13.edit_y.Enabled:=False;
      Form13.edit_z.Enabled:=False;
      Form13.check_others.Enabled:=False;
      Form13.edit_others_x.Enabled:=False;
      Form13.edit_others_y.Enabled:=False;
      Form13.edit_others_z.Enabled:=False;
      Form13.Label1.Enabled:=False;
      Form13.Label2.Enabled:=False;
      Form13.Label3.Enabled:=False;
      Form13.Label4.Enabled:=False;
      Form13.Label5.Enabled:=False;
      Form13.Label6.Enabled:=False;
    END;
  END;

PROCEDURE TForm13.edit_others_xChange(Sender: TObject);
  VAR tempfloat:Single;
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
        WriteMem(address_settings+$14,4,Encode_Float(tempfloat));
      END;
    END;
  END;

PROCEDURE TForm13.edit_others_yClick(Sender: TObject);
  VAR tempfloat:Single;
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
        WriteMem(address_settings+$18,4,Encode_Float(tempfloat));
      END;
    END;
  END;

PROCEDURE TForm13.edit_others_zClick(Sender: TObject);
  VAR tempfloat:Single;
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF TryStrToFloat(TEdit(Sender).Text,tempfloat) THEN BEGIN
        WriteMem(address_settings+$1C,4,Encode_Float(tempfloat));
      END;
    END;
  END;

PROCEDURE TForm13.check_othersClick(Sender: TObject);
  BEGIN
    IF _connected AND patch_movements_loaded THEN BEGIN
      IF check_others.Checked=False THEN BEGIN
        _temp:=Encode_Int(0);
        WriteMem(address_settings+$10,4,_temp);
      END ELSE BEGIN
        _temp:=Encode_Int(1);
        WriteMem(address_settings+$10,4,_temp);
      END;
    END;
  END;

END.
