Rev 74 | Rev 80 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 74 | Rev 79 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | unit Global; |
1 | unit Global; |
2 | 2 | ||
3 | interface |
3 | interface |
4 | 4 | ||
5 | const |
5 | const |
6 | ProgramVersion = '1.2'; |
6 | ProgramVersion = '1.2.1'; |
7 | RasterW = 48; |
7 | LevEditRasterW = 48; |
8 | RasterH = 32; |
8 | LevEditRasterH = 32; |
9 | MaxPossibleEnemyLives = 999; |
9 | MaxPossibleEnemyLives = 999; |
10 | MaxPossibleLevels = 999; |
10 | MaxPossibleLevels = 999; |
11 | RegistrySettingsKey = 'SOFTWARE\ViaThinkSoft\SpaceMission\Settings'; |
11 | RegistrySettingsKey = 'SOFTWARE\ViaThinkSoft\SpaceMission\Settings'; // do not localize |
- | 12 | MusicSettingKey = 'Music'; // do not localize |
|
- | 13 | SoundSettingKey = 'Sound'; // do not localize |
|
- | 14 | SpeedSettingKey = 'Speed'; // do not localize |
|
12 | DefaultLevelLength = 1200; |
15 | DefaultLevelLength = 1200; |
13 | StartLives = 6; |
16 | StartLives = 6; |
14 | conleicht = 650 div 60; // 10 |
17 | conleicht = 650 div 60; // 10 |
15 | conmittel = 1000 div 60; // 16 |
18 | conmittel = 1000 div 60; // 16 |
16 | conschwer = 1350 div 60; // 22 |
19 | conschwer = 1350 div 60; // 22 |
17 | conmaster = 2000 div 60; // 33 |
20 | conmaster = 2000 div 60; // 33 |
18 | DEFAULT_ANIMSPEED = 15/1000; |
21 | DEFAULT_ANIMSPEED = 15/1000; |
19 | ADDITIONAL_ENEMIES_PER_LEVEL = 75; |
22 | ADDITIONAL_ENEMIES_PER_LEVEL = 75; // Zufalls-Level |
- | 23 | BossWidth = 4; |
|
- | 24 | BossHeight = 2; |
|
- | 25 | SpaceMissionExe = 'SpaceMission.exe'; // do not localize |
|
- | 26 | LevEditExe = 'LevEdit.exe'; // do not localize |
|
20 | 27 | ||
21 | type |
28 | type |
22 | // DirectX\Music.dxm |
29 | // DirectX\Music.dxm |
23 | TSpaceMissionMusicTrack = ( |
30 | TSpaceMissionMusicTrack = ( |
24 | smmNone, |
31 | smmNone, |
Line 66... | Line 73... | ||
66 | ); |
73 | ); |
67 | 74 | ||
68 | function OwnDirectory: string; |
75 | function OwnDirectory: string; |
69 | 76 | ||
70 | const |
77 | const |
71 | FOLDERID_SavedGames: TGuid = '{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}'; |
78 | FOLDERID_SavedGames: TGuid = '{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}'; // do not localize |
72 | 79 | ||
73 | // Useful functions |
80 | // Useful functions |
74 | function GetKnownFolderPath(const rfid: TGUID): string; |
81 | function GetKnownFolderPath(const rfid: TGUID): string; |
75 | function KillTask(ExeFileName: string): Integer; |
82 | function KillTask(ExeFileName: string): Integer; |
76 | procedure CheckForUpdates(ViaThinkSoftProjectName: string; AVersion: string); |
83 | procedure CheckForUpdates(ViaThinkSoftProjectName: string; AVersion: string); |
77 | 84 | ||
78 | implementation |
85 | implementation |
79 | 86 | ||
80 | uses |
87 | uses |
81 | Windows, SysUtils, ActiveX, ShlObj, TlHelp32, wininet, Forms, ShellAPI; |
88 | Windows, SysUtils, Dialogs, ActiveX, ShlObj, TlHelp32, wininet, Forms, ShellAPI, |
- | 89 | System.UITypes; |
|
82 | 90 | ||
83 | function GetKnownFolderPath(const rfid: TGUID): string; |
91 | function GetKnownFolderPath(const rfid: TGUID): string; |
84 | var |
92 | var |
85 | OutPath: PWideChar; |
93 | OutPath: PWideChar; |
86 | begin |
94 | begin |
Line 146... | Line 154... | ||
146 | dwcode : array[1..20] of char; |
154 | dwcode : array[1..20] of char; |
147 | res : pchar; |
155 | res : pchar; |
148 | Str : pansichar; // SIC! pansichar |
156 | Str : pansichar; // SIC! pansichar |
149 | begin |
157 | begin |
150 | ResStr:=''; |
158 | ResStr:=''; |
151 | if (system.pos('http://',lowercase(AUrl))=0) and |
159 | if (system.pos('http://',lowercase(AUrl))=0) and // do not localize |
152 | (system.pos('https://',lowercase(AUrl))=0) then |
160 | (system.pos('https://',lowercase(AUrl))=0) then // do not localize |
153 | AUrl:='http://'+AUrl; |
161 | AUrl:='http://'+AUrl; // do not localize |
154 | 162 | ||
155 | // Hinzugefügt |
163 | // Hinzugefügt |
156 | if Assigned(Application) then Application.ProcessMessages; |
164 | if Assigned(Application) then Application.ProcessMessages; |
157 | 165 | ||
158 | hSession:=InternetOpen('InetURL:/1.0', |
166 | hSession:=InternetOpen('InetURL:/1.0', // do not localize |
159 | INTERNET_OPEN_TYPE_PRECONFIG, |
167 | INTERNET_OPEN_TYPE_PRECONFIG, |
160 | nil, |
168 | nil, |
161 | nil, |
169 | nil, |
162 | 0); |
170 | 0); |
163 | if assigned(hsession) then |
171 | if assigned(hsession) then |
Line 183... | Line 191... | ||
183 | @dwcode, |
191 | @dwcode, |
184 | dwcodeLen, |
192 | dwcodeLen, |
185 | dwIndex); |
193 | dwIndex); |
186 | res := pchar(@dwcode); |
194 | res := pchar(@dwcode); |
187 | dwNumber := sizeof(databuffer)-1; |
195 | dwNumber := sizeof(databuffer)-1; |
188 | if (res ='200') or (res = '302') then |
196 | if (res ='200') or (res = '302') then // do not localize |
189 | begin |
197 | begin |
190 | while (InternetReadfile(hfile, |
198 | while (InternetReadfile(hfile, |
191 | @databuffer, |
199 | @databuffer, |
192 | dwNumber, |
200 | dwNumber, |
193 | DwRead)) do |
201 | DwRead)) do |
Line 202... | Line 210... | ||
202 | Str := pansichar(@databuffer); |
210 | Str := pansichar(@databuffer); |
203 | resStr := resStr + Str; |
211 | resStr := resStr + Str; |
204 | end; |
212 | end; |
205 | end |
213 | end |
206 | else |
214 | else |
207 | ResStr := 'Status:'+AnsiString(res); |
215 | ResStr := 'Status:'+AnsiString(res); // do not localize |
208 | if assigned(hfile) then |
216 | if assigned(hfile) then |
209 | InternetCloseHandle(hfile); |
217 | InternetCloseHandle(hfile); |
210 | end; |
218 | end; |
211 | 219 | ||
212 | // Hinzugefügt |
220 | // Hinzugefügt |
Line 215... | Line 223... | ||
215 | InternetCloseHandle(hsession); |
223 | InternetCloseHandle(hsession); |
216 | Result := resStr; |
224 | Result := resStr; |
217 | end; |
225 | end; |
218 | 226 | ||
219 | procedure CheckForUpdates(ViaThinkSoftProjectName: string; AVersion: string); |
227 | procedure CheckForUpdates(ViaThinkSoftProjectName: string; AVersion: string); |
- | 228 | resourcestring |
|
- | 229 | SDownloadError = 'Ein Fehler ist aufgetreten. Wahrscheinlich ist keine Internetverbindung aufgebaut, oder der der ViaThinkSoft-Server vorübergehend offline.'; |
|
- | 230 | SNewProgramVersionAvailable = 'Eine neue Programmversion ist vorhanden. Möchten Sie diese jetzt herunterladen?'; |
|
- | 231 | SNoUpdateAvailable = 'Es ist keine neue Programmversion vorhanden.'; |
|
220 | var |
232 | var |
221 | cont: RawByteString; |
233 | cont: RawByteString; |
222 | begin |
234 | begin |
223 | cont := GetHTML('https://www.viathinksoft.de/update/?id='+ViaThinkSoftProjectName); |
235 | cont := GetHTML('https://www.viathinksoft.de/update/?id='+ViaThinkSoftProjectName); // do not localize |
224 | if copy(cont, 0, 7) = 'Status:' then |
236 | if copy(cont, 0, 7) = 'Status:' then |
225 | begin |
237 | begin |
226 | Application.MessageBox('Ein Fehler ist aufgetreten. Wahrscheinlich ist keine Internetverbindung aufgebaut, oder der der ViaThinkSoft-Server vorübergehend offline.', 'Fehler', MB_OK + MB_ICONERROR) |
238 | MessageDlg(SDownloadError, mtError, [mbOk], 0); |
227 | end |
239 | end |
228 | else |
240 | else |
229 | begin |
241 | begin |
230 | if string(cont) <> AVersion then |
242 | if string(cont) <> AVersion then |
231 | begin |
243 | begin |
232 | if Application.MessageBox('Eine neue Programmversion ist vorhanden. Möchten Sie diese jetzt herunterladen?', 'Information', MB_YESNO + MB_ICONASTERISK) = ID_YES then |
244 | if MessageDlg(SNewProgramVersionAvailable, mtConfirmation, mbYesNoCancel, 0) = mrYes then |
233 | shellexecute(application.handle, 'open', pchar('https://www.viathinksoft.de/update/?id=@'+ViaThinkSoftProjectName), '', '', sw_normal); |
245 | shellexecute(application.handle, 'open', pchar('https://www.viathinksoft.de/update/?id=@'+ViaThinkSoftProjectName), '', '', sw_normal); // do not localize |
234 | end |
246 | end |
235 | else |
247 | else |
236 | begin |
248 | begin |
237 | Application.MessageBox('Es ist keine neue Programmversion vorhanden.', 'Information', MB_OK + MB_ICONASTERISK); |
249 | MessageDlg(SNoUpdateAvailable, mtInformation, [mbOk], 0); |
238 | end; |
250 | end; |
239 | end; |
251 | end; |
240 | end; |
252 | end; |
241 | 253 | ||
242 | end. |
254 | end. |