Rev 28 | 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, |
||
6 | daniel-mar | 7 | StdCtrls, ExtCtrls, ShellAPI{$IF CompilerVersion >= 23.0}, System.UITypes{$IFEND}; |
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; |
||
79 | daniel-mar | 43 | |
44 | resourcestring |
||
3 | daniel-mar | 45 | Cheat1Text = 'Unendlich Leben!'; |
46 | |||
47 | procedure TCheatForm.AbbBtnClick(Sender: TObject); |
||
48 | begin |
||
49 | close; |
||
50 | end; |
||
51 | |||
52 | procedure TCheatForm.SearchCheats; |
||
53 | begin |
||
54 | Cheatbox.Items.Clear; |
||
55 | if mainform.FCheat then Cheatbox.Items.Append(Cheat1Text); |
||
56 | end; |
||
57 | |||
58 | procedure TCheatForm.OKBtnClick(Sender: TObject); |
||
79 | daniel-mar | 59 | resourcestring |
60 | SCheatUnlocked = 'Dieser Cheat wurde freigeschaltet!'; |
||
61 | SCheckAlreadyUnlocked = 'Dieser Cheat wurde bereits freigeschaltet!'; |
||
62 | SNoCheat = 'Dies ist kein offizieller Cheat!'; |
||
3 | daniel-mar | 63 | var |
64 | temp: string; |
||
65 | i, j: integer; |
||
66 | begin |
||
67 | temp := ''; |
||
68 | j := 0; |
||
69 | for i := 1 to length(CheatEdit.text) do |
||
70 | begin |
||
71 | inc(j); |
||
72 | temp := temp + chr(byte(copy(CheatEdit.text, i, 1)[1]) xor j); |
||
73 | end; |
||
74 | if lowercase(temp) = lowercase(Cheat1) then |
||
75 | begin |
||
76 | if mainform.FCheat then |
||
79 | daniel-mar | 77 | showmessage(SCheckAlreadyUnlocked) |
3 | daniel-mar | 78 | else |
79 | begin |
||
79 | daniel-mar | 80 | showmessage(SCheatUnlocked); |
3 | daniel-mar | 81 | mainform.FCheat := true; |
82 | SearchCheats; |
||
83 | end; |
||
84 | close; |
||
85 | end |
||
86 | else |
||
87 | begin |
||
79 | daniel-mar | 88 | showmessage(SNoCheat); |
3 | daniel-mar | 89 | CheatEdit.text := ''; |
90 | CheatEdit.setfocus; |
||
91 | end; |
||
92 | end; |
||
93 | |||
94 | procedure TCheatForm.FormShow(Sender: TObject); |
||
95 | begin |
||
96 | mainform.dxtimer.enabled := false; |
||
97 | SearchCheats; |
||
98 | CheatEdit.text := ''; |
||
99 | CheatEdit.setfocus; |
||
100 | end; |
||
101 | |||
102 | procedure TCheatForm.FormHide(Sender: TObject); |
||
103 | begin |
||
104 | if not mainform.gamepause.checked then mainform.dxtimer.enabled := true; |
||
105 | end; |
||
106 | |||
107 | procedure TCheatForm.CheatEditKeyPress(Sender: TObject; var Key: Char); |
||
108 | begin |
||
109 | if key = #13 then |
||
110 | begin |
||
111 | // key := #0; |
||
112 | OKBtn.click; |
||
113 | end; |
||
114 | end; |
||
115 | |||
116 | procedure TCheatForm.Label2Click(Sender: TObject); |
||
79 | daniel-mar | 117 | resourcestring |
118 | SDisableCheat = 'Diesen Cheat wirklich deaktivieren?'; |
||
119 | SCheatDisabled = 'Dieser Cheat wurde deakiviert!'; |
||
3 | daniel-mar | 120 | begin |
121 | if not CheatBox.items.IndexOf(Cheat1Text) = -1 then |
||
122 | begin |
||
123 | if CheatBox.Selected[CheatBox.items.IndexOf(Cheat1Text)] then |
||
124 | begin |
||
79 | daniel-mar | 125 | if MessageDlg(SDisableCheat, mtConfirmation, mbYesNoCancel, 0) = mrYes then |
3 | daniel-mar | 126 | begin |
127 | mainform.FCheat := false; |
||
79 | daniel-mar | 128 | showmessage(SCheatDisabled); |
3 | daniel-mar | 129 | SearchCheats; |
130 | end; |
||
131 | end; |
||
132 | end; |
||
133 | end; |
||
134 | |||
135 | procedure TCheatForm.Label3Click(Sender: TObject); |
||
136 | begin |
||
79 | daniel-mar | 137 | shellexecute(handle, 'open', pchar('mailto:daniel-marschall@viathinksoft.de?subject=Cheats für SpaceMission '+ProgramVersion), '', '', 1); // do not localize |
3 | daniel-mar | 138 | end; |
139 | |||
140 | end. |
||
141 |