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