Subversion Repositories spacemission

Rev

Rev 51 | Rev 61 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 51 Rev 54
Line 8... Line 8...
8
  RasterH = 32;
8
  RasterH = 32;
9
  MaxPossibleEnemyLives = 999;
9
  MaxPossibleEnemyLives = 999;
10
  MaxPossibleLevels = 9999;
10
  MaxPossibleLevels = 9999;
11
  RegistrySettingsKey = 'SOFTWARE\ViaThinkSoft\SpaceMission\Settings';
11
  RegistrySettingsKey = 'SOFTWARE\ViaThinkSoft\SpaceMission\Settings';
12
  DefaultLevelLength = 1200;
12
  DefaultLevelLength = 1200;
-
 
13
  StartLives = 6;
-
 
14
  conleicht =  650 div 60; // 10
-
 
15
  conmittel = 1000 div 60; // 16
-
 
16
  conschwer = 1350 div 60; // 22
-
 
17
  conmaster = 2000 div 60; // 33
-
 
18
  DEFAULT_ANIMSPEED = 15/1000;
-
 
19
  ADDITIONAL_ENEMIES_PER_LEVEL = 75;
13
 
20
 
14
type
21
type
15
  // DirectX\Music.dxm
22
  // DirectX\Music.dxm
16
  TSpaceMissionMusicTrack = (
23
  TSpaceMissionMusicTrack = (
17
    smmNone,
24
    smmNone,
Line 63... Line 70...
63
function OwnDirectory: string;
70
function OwnDirectory: string;
64
 
71
 
65
const
72
const
66
  FOLDERID_SavedGames: TGuid = '{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}';
73
  FOLDERID_SavedGames: TGuid = '{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}';
67
 
74
 
-
 
75
// Useful functions
68
function GetKnownFolderPath(const rfid: TGUID): string;
76
function GetKnownFolderPath(const rfid: TGUID): string;
-
 
77
function KillTask(ExeFileName: string): Integer;
69
 
78
 
70
implementation
79
implementation
71
 
80
 
72
uses
81
uses
73
  SysUtils, ActiveX, ShlObj;
82
  Windows, SysUtils, ActiveX, ShlObj, TlHelp32;
74
 
83
 
75
function GetKnownFolderPath(const rfid: TGUID): string;
84
function GetKnownFolderPath(const rfid: TGUID): string;
76
var
85
var
77
  OutPath: PWideChar;
86
  OutPath: PWideChar;
78
begin
87
begin
Line 92... Line 101...
92
  begin
101
  begin
93
    Result := '';
102
    Result := '';
94
  end;
103
  end;
95
end;
104
end;
96
 
105
 
-
 
106
// https://stackoverflow.com/questions/43774320/how-to-kill-a-process-by-name
-
 
107
function KillTask(ExeFileName: string): Integer;
-
 
108
const
-
 
109
  PROCESS_TERMINATE = $0001;
-
 
110
var
-
 
111
  ContinueLoop: BOOL;
-
 
112
  FSnapshotHandle: THandle;
-
 
113
  FProcessEntry32: TProcessEntry32;
-
 
114
begin
-
 
115
  Result := 0;
-
 
116
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
-
 
117
  FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
-
 
118
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
-
 
119
 
-
 
120
  while Integer(ContinueLoop) <> 0 do
-
 
121
  begin
-
 
122
    if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
-
 
123
      UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
-
 
124
      UpperCase(ExeFileName))) then
-
 
125
      Result := Integer(TerminateProcess(
-
 
126
                        OpenProcess(PROCESS_TERMINATE,
-
 
127
                                    BOOL(0),
-
 
128
                                    FProcessEntry32.th32ProcessID),
-
 
129
                                    0));
-
 
130
     ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
-
 
131
  end;
-
 
132
  CloseHandle(FSnapshotHandle);
-
 
133
end;
-
 
134
 
97
function OwnDirectory: string;
135
function OwnDirectory: string;
98
begin
136
begin
99
  result := extractfilepath(paramstr(0));
137
  result := extractfilepath(paramstr(0));
100
end;
138
end;
101
 
139