Subversion Repositories spacemission

Rev

Rev 3 | Rev 6 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 daniel-mar 1
unit GamCheat;
2
 
3
interface
4
 
5
uses
6
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
4 daniel-mar 7
  StdCtrls, ExtCtrls, ShellAPI, System.UITypes;
3 daniel-mar 8
 
9
type
10
  TCheatForm = class(TForm)                                                                    
11
    Label1: TLabel;
12
    CheatEdit: TEdit;
13
    OKBtn: TButton;
14
    AbbBtn: TButton;
15
    GroupBox1: TGroupBox;
16
    CheatBox: TListBox;
17
    Label2: TLabel;
18
    Label3: TLabel;
19
    procedure AbbBtnClick(Sender: TObject);
20
    procedure OKBtnClick(Sender: TObject);
21
    procedure FormShow(Sender: TObject);
22
    procedure FormHide(Sender: TObject);
23
    procedure CheatEditKeyPress(Sender: TObject; var Key: Char);
24
    procedure Label2Click(Sender: TObject);
25
    procedure Label3Click(Sender: TObject);
26
  public
27
    procedure SearchCheats;
28
  end;
29
 
30
var
31
  CheatForm: TCheatForm;
32
 
33
implementation
34
 
35
uses
36
  GamMain, Global;
37
 
38
{$R *.DFM}
39
 
40
const
41
  // Cheat1 = 'Kmkjk'+#39+'Khyc'; {Johnny Cash}
42
  Cheat1 = #75+#109+#107+#106+#107+#127+#39+#75+#104+#121+#99;
43
  Cheat1Text = 'Unendlich Leben!';
44
 
45
procedure TCheatForm.AbbBtnClick(Sender: TObject);
46
begin
47
  close;
48
end;
49
 
50
procedure TCheatForm.SearchCheats;
51
begin
52
  Cheatbox.Items.Clear;
53
  if mainform.FCheat then Cheatbox.Items.Append(Cheat1Text);
54
end;
55
 
56
procedure TCheatForm.OKBtnClick(Sender: TObject);
57
var
58
  temp: string;
59
  i, j: integer;
60
begin
61
  temp := '';
62
  j := 0;
63
  for i := 1 to length(CheatEdit.text) do
64
  begin
65
    inc(j);
66
    temp := temp + chr(byte(copy(CheatEdit.text, i, 1)[1]) xor j);
67
  end;
68
  if lowercase(temp) = lowercase(Cheat1) then
69
  begin
70
    if mainform.FCheat then
71
      showmessage('Dieser Cheat wurde bereits freigeschaltet!')
72
    else
73
    begin
74
      showmessage('Dieser Cheat wurde freigeschaltet!');
75
      mainform.FCheat := true;
76
      SearchCheats;
77
    end;
78
    close;
79
  end
80
  else
81
  begin
82
    showmessage('Dies ist kein offizieller Cheat!');
83
    CheatEdit.text := '';
84
    CheatEdit.setfocus;
85
  end;
86
end;
87
 
88
procedure TCheatForm.FormShow(Sender: TObject);
89
begin
90
  mainform.dxtimer.enabled := false;
91
  SearchCheats;
92
  CheatEdit.text := '';
93
  CheatEdit.setfocus;
94
end;
95
 
96
procedure TCheatForm.FormHide(Sender: TObject);
97
begin
98
  if not mainform.gamepause.checked then mainform.dxtimer.enabled := true;
99
end;
100
 
101
procedure TCheatForm.CheatEditKeyPress(Sender: TObject; var Key: Char);
102
begin
103
  if key = #13 then
104
  begin
105
    // key := #0;
106
    OKBtn.click;
107
  end;
108
end;
109
 
110
procedure TCheatForm.Label2Click(Sender: TObject);
111
begin
112
  if not CheatBox.items.IndexOf(Cheat1Text) = -1 then
113
  begin
114
    if CheatBox.Selected[CheatBox.items.IndexOf(Cheat1Text)] then
115
    begin
116
      if MessageDlg('Diesen Cheat wirklich deaktivieren?',
117
        mtConfirmation, [mbYes, mbNo], 0) = mrYes then
118
      begin
119
        mainform.FCheat := false;
120
        showmessage('Dieser Cheat wurde deakiviert!');
121
        SearchCheats;
122
      end;
123
    end;
124
  end;
125
end;
126
 
127
procedure TCheatForm.Label3Click(Sender: TObject);
128
begin
129
  shellexecute(handle, 'open', pchar('mailto:daniel-marschall@viathinksoft.de?subject=Cheats fr SpaceMission '+ProgramVersion), '', '', 1);
130
end;
131
 
132
end.
133