-
Notifications
You must be signed in to change notification settings - Fork 3
/
GamCheat.pas
145 lines (126 loc) · 3.48 KB
/
GamCheat.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
unit GamCheat;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ShellAPI{$IF CompilerVersion >= 23.0}, System.UITypes{$IFEND};
type
TCheatForm = class(TForm)
Label1: TLabel;
CheatEdit: TEdit;
OKBtn: TButton;
AbbBtn: TButton;
GroupBox1: TGroupBox;
CheatBox: TListBox;
Label2: TLabel;
Label3: TLabel;
procedure AbbBtnClick(Sender: TObject);
procedure OKBtnClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormHide(Sender: TObject);
procedure CheatEditKeyPress(Sender: TObject; var Key: Char);
procedure Label2Click(Sender: TObject);
procedure Label3Click(Sender: TObject);
public
procedure SearchCheats;
end;
var
CheatForm: TCheatForm;
implementation
uses
GamMain, Global;
{$R *.DFM}
procedure TCheatForm.AbbBtnClick(Sender: TObject);
begin
close;
end;
procedure TCheatForm.SearchCheats;
begin
Cheatbox.Items.Clear;
if ctInfiniteLives in mainform.FCheats then Cheatbox.Items.Append(Cheat1Text);
end;
procedure TCheatForm.OKBtnClick(Sender: TObject);
resourcestring
SCheatUnlocked = 'Dieser Cheat wurde freigeschaltet!';
SCheckAlreadyUnlocked = 'Dieser Cheat wurde bereits freigeschaltet!';
SNoCheat = 'Dies ist kein offizieller Cheat!';
var
temp: string;
i, j: integer;
begin
temp := '';
j := 0;
if CheatEdit.text = '' then
begin
Close;
Exit;
end;
for i := 1 to length(CheatEdit.text) do
begin
inc(j);
temp := temp + chr(byte(copy(CheatEdit.text, i, 1)[1]) xor j);
end;
{$REGION 'Check and unlock Cheat 1 (Infinite lives)'}
if lowercase(temp) = lowercase(Cheat1) then
begin
if ctInfiniteLives in mainform.FCheats then
showmessage(SCheckAlreadyUnlocked)
else
begin
showmessage(SCheatUnlocked);
Include(mainform.FCheats, ctInfiniteLives);
SearchCheats;
end;
close;
end
{$ENDREGION}
else
begin
showmessage(SNoCheat);
CheatEdit.text := '';
CheatEdit.setfocus;
end;
end;
procedure TCheatForm.FormShow(Sender: TObject);
begin
mainform.dxtimer.enabled := false;
SearchCheats;
CheatEdit.text := '';
CheatEdit.setfocus;
end;
procedure TCheatForm.FormHide(Sender: TObject);
begin
if not mainform.gamepause.checked then mainform.dxtimer.enabled := true;
end;
procedure TCheatForm.CheatEditKeyPress(Sender: TObject; var Key: Char);
begin
if key = #13 then
begin
// key := #0;
OKBtn.click;
end;
end;
procedure TCheatForm.Label2Click(Sender: TObject);
resourcestring
SDisableCheat = 'Diesen Cheat wirklich deaktivieren?';
SCheatDisabled = 'Dieser Cheat wurde deaktiviert!';
begin
{$REGION 'Disable Cheat 1 (Infinite lives)'}
if not CheatBox.items.IndexOf(Cheat1Text) = -1 then
begin
if CheatBox.Selected[CheatBox.items.IndexOf(Cheat1Text)] then
begin
if MessageDlg(SDisableCheat, mtConfirmation, mbYesNoCancel, 0) = mrYes then
begin
Exclude(mainform.FCheats, ctInfiniteLives);
showmessage(SCheatDisabled);
SearchCheats;
end;
end;
end;
{$ENDREGION}
end;
procedure TCheatForm.Label3Click(Sender: TObject);
begin
shellexecute(handle, 'open', pchar('mailto:[email protected]?subject=Cheats für SpaceMission '+ProgramVersion), '', '', 1); // do not localize
end;
end.