Subversion Repositories spacemission

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. unit SplCheat;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ExtCtrls, ShellAPI;
  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 SplMain, SplInfo;
  36.  
  37. {$R *.DFM}
  38.  
  39. const
  40.   // Cheat1 = 'Kmkjk'+#39+'Khyc'; {Johnny Cash}
  41.   Cheat1 = #75+#109+#107+#106+#107+#127+#39+#75+#104+#121+#99;
  42.   Cheat1Text = 'Unendlich Leben!';
  43.  
  44. procedure TCheatForm.AbbBtnClick(Sender: TObject);
  45. begin
  46.   close;  
  47. end;
  48.  
  49. procedure TCheatForm.SearchCheats;
  50. begin
  51.   Cheatbox.Items.Clear;
  52.   if mainform.FCheat then Cheatbox.Items.Append(Cheat1Text);
  53. end;
  54.  
  55. procedure TCheatForm.OKBtnClick(Sender: TObject);
  56. var
  57.   temp: string;
  58.   i, j: integer;
  59. begin
  60.   temp := '';
  61.   j := 0;
  62.   for i := 1 to length(CheatEdit.text) do
  63.   begin
  64.     inc(j);
  65.     temp := temp + chr(byte(copy(CheatEdit.text, i, 1)[1]) xor j);
  66.   end;
  67.   if lowercase(temp) = lowercase(Cheat1) then
  68.   begin
  69.     if mainform.FCheat then
  70.       showmessage('Dieser Cheat wurde bereits freigeschaltet!')
  71.     else
  72.     begin
  73.       showmessage('Dieser Cheat wurde freigeschaltet!');
  74.       mainform.FCheat := true;
  75.       SearchCheats;
  76.     end;
  77.     close;
  78.   end
  79.   else
  80.   begin
  81.     showmessage('Dies ist kein offizieller Cheat!');
  82.     CheatEdit.text := '';
  83.     CheatEdit.setfocus;
  84.   end;
  85. end;
  86.  
  87. procedure TCheatForm.FormShow(Sender: TObject);
  88. begin
  89.   mainform.dxtimer.enabled := false;
  90.   SearchCheats;
  91.   CheatEdit.text := '';
  92.   CheatEdit.setfocus;
  93. end;
  94.  
  95. procedure TCheatForm.FormHide(Sender: TObject);
  96. begin
  97.   if not mainform.gamepause.checked then mainform.dxtimer.enabled := true;
  98. end;
  99.  
  100. procedure TCheatForm.CheatEditKeyPress(Sender: TObject; var Key: Char);
  101. begin
  102.   if key = #13 then
  103.   begin
  104.     // key := #0;
  105.     OKBtn.click;
  106.   end;
  107. end;
  108.  
  109. procedure TCheatForm.Label2Click(Sender: TObject);
  110. begin
  111.   if not CheatBox.items.IndexOf(Cheat1Text) = -1 then
  112.   begin
  113.     if CheatBox.Selected[CheatBox.items.IndexOf(Cheat1Text)] then
  114.     begin
  115.       if MessageDlg('Diesen Cheat wirklich deaktivieren?',
  116.         mtConfirmation, [mbYes, mbNo], 0) = mrYes then
  117.       begin
  118.         mainform.FCheat := false;
  119.         showmessage('Dieser Cheat wurde deakiviert!');
  120.         SearchCheats;
  121.       end;
  122.     end;
  123.   end;
  124. end;
  125.  
  126. procedure TCheatForm.Label3Click(Sender: TObject);
  127. begin
  128.   shellexecute(handle, 'open', pchar('mailto:daniel.marschall@surfeu.de?subject=Cheats für SpaceMission '+MainForm.FEngineVersion), '', '', 1);
  129. end;
  130.  
  131. end.
  132.  
  133.