Rev 61 | Rev 64 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 61 | Rev 63 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | interface |
3 | interface |
4 | 4 | ||
5 | uses |
5 | uses |
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, |
6 | Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, |
7 | StdCtrls, ExtCtrls, Menus, DIB, DXClass, DXSprite, DXDraws, DXInput, DXSounds, |
7 | StdCtrls, ExtCtrls, Menus, DIB, DXClass, DXSprite, DXDraws, DXInput, DXSounds, |
8 | ShellAPI, wininet, DirectX{$IF CompilerVersion >= 23.0}, |
8 | ShellAPI, DirectX{$IF CompilerVersion >= 23.0}, |
9 | System.UITypes{$IFEND}, ComLevelReader, DirectMusic, Global; |
9 | System.UITypes{$IFEND}, ComLevelReader, DirectMusic, Global; |
10 | 10 | ||
11 | type |
11 | type |
12 | TGameScene = ( |
12 | TGameScene = ( |
13 | gsNone, |
13 | gsNone, |
Line 214... | Line 214... | ||
214 | Leer6: TMenuItem; |
214 | Leer6: TMenuItem; |
215 | Leer1: TMenuItem; |
215 | Leer1: TMenuItem; |
216 | Cheat: TMenuItem; |
216 | Cheat: TMenuItem; |
217 | CheckUpdates: TMenuItem; |
217 | CheckUpdates: TMenuItem; |
218 | Master: TMenuItem; |
218 | Master: TMenuItem; |
- | 219 | Hilfe1: TMenuItem; |
|
219 | procedure DXDrawFinalize(Sender: TObject); |
220 | procedure DXDrawFinalize(Sender: TObject); |
220 | procedure DXDrawInitialize(Sender: TObject); |
221 | procedure DXDrawInitialize(Sender: TObject); |
221 | procedure FormCreate(Sender: TObject); |
222 | procedure FormCreate(Sender: TObject); |
222 | procedure DXTimerTimer(Sender: TObject; LagCount: Integer); |
223 | procedure DXTimerTimer(Sender: TObject; LagCount: Integer); |
223 | procedure DXTimerActivate(Sender: TObject); |
224 | procedure DXTimerActivate(Sender: TObject); |
Line 239... | Line 240... | ||
239 | procedure FormClose(Sender: TObject; var Action: TCloseAction); |
240 | procedure FormClose(Sender: TObject; var Action: TCloseAction); |
240 | procedure FormDestroy(Sender: TObject); |
241 | procedure FormDestroy(Sender: TObject); |
241 | procedure CheckUpdatesClick(Sender: TObject); |
242 | procedure CheckUpdatesClick(Sender: TObject); |
242 | procedure MasterClick(Sender: TObject); |
243 | procedure MasterClick(Sender: TObject); |
243 | procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); |
244 | procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); |
- | 245 | procedure Hilfe1Click(Sender: TObject); |
|
244 | private |
246 | private |
245 | ProgrammGestartet: boolean; |
247 | ProgrammGestartet: boolean; |
246 | FInterval: TGameInterval; |
248 | FInterval: TGameInterval; |
247 | FScene: TGameScene; |
249 | FScene: TGameScene; |
248 | FMusic: TSpaceMissionMusicTrack; |
250 | FMusic: TSpaceMissionMusicTrack; |
Line 330... | Line 332... | ||
330 | MainForm: TMainForm; |
332 | MainForm: TMainForm; |
331 | 333 | ||
332 | implementation |
334 | implementation |
333 | 335 | ||
334 | uses |
336 | uses |
335 | GamSplash, GamSpeicherung, ComInfo, GamCheat, MMSystem, Registry; |
337 | GamSplash, GamSpeicherung, ComInfo, GamCheat, MMSystem, Registry, |
- | 338 | ComHilfe; |
|
336 | 339 | ||
337 | {$R *.DFM} |
340 | {$R *.DFM} |
338 | 341 | ||
339 | const |
342 | const |
340 | DXInputButton = [isButton1, isButton2, isButton3, |
343 | DXInputButton = [isButton1, isButton2, isButton3, |
341 | isButton4, isButton5, isButton6, isButton7, isButton8, isButton9, isButton10, isButton11, |
344 | isButton4, isButton5, isButton6, isButton7, isButton8, isButton9, isButton10, isButton11, |
342 | isButton12, isButton13, isButton14, isButton15, isButton16, isButton17, isButton18, |
345 | isButton12, isButton13, isButton14, isButton15, isButton16, isButton17, isButton18, |
343 | isButton19, isButton20, isButton21, isButton22, isButton23, isButton24, isButton25, |
346 | isButton19, isButton20, isButton21, isButton22, isButton23, isButton24, isButton25, |
344 | isButton26, isButton27, isButton28, isButton29, isButton30, isButton31, isButton32]; |
347 | isButton26, isButton27, isButton28, isButton29, isButton30, isButton31, isButton32]; |
345 | 348 | ||
346 | // https://www.delphipraxis.net/post43515.html |
- | |
347 | function GetHTML(AUrl: string): string; |
- | |
348 | var |
- | |
349 | databuffer : array[0..4095] of char; |
- | |
350 | ResStr : string; |
- | |
351 | hSession, hfile: hInternet; |
- | |
352 | dwindex,dwcodelen,dwread,dwNumber: cardinal; |
- | |
353 | dwcode : array[1..20] of char; |
- | |
354 | res : pchar; |
- | |
355 | Str : pchar; |
- | |
356 | begin |
- | |
357 | ResStr:=''; |
- | |
358 | if (system.pos('http://',lowercase(AUrl))=0) and |
- | |
359 | (system.pos('https://',lowercase(AUrl))=0) then |
- | |
360 | AUrl:='http://'+AUrl; |
- | |
361 | - | ||
362 | // Hinzugefügt |
- | |
363 | application.ProcessMessages; |
- | |
364 | - | ||
365 | hSession:=InternetOpen('InetURL:/1.0', |
- | |
366 | INTERNET_OPEN_TYPE_PRECONFIG, |
- | |
367 | nil, |
- | |
368 | nil, |
- | |
369 | 0); |
- | |
370 | if assigned(hsession) then |
- | |
371 | begin |
- | |
372 | // Hinzugefügt |
- | |
373 | application.ProcessMessages; |
- | |
374 | - | ||
375 | hfile:=InternetOpenUrl( |
- | |
376 | hsession, |
- | |
377 | pchar(AUrl), |
- | |
378 | nil, |
- | |
379 | 0, |
- | |
380 | INTERNET_FLAG_RELOAD, |
- | |
381 | 0); |
- | |
382 | dwIndex := 0; |
- | |
383 | dwCodeLen := 10; |
- | |
384 | - | ||
385 | // Hinzugefügt |
- | |
386 | application.ProcessMessages; |
- | |
387 | - | ||
388 | HttpQueryInfo(hfile, |
- | |
389 | HTTP_QUERY_STATUS_CODE, |
- | |
390 | @dwcode, |
- | |
391 | dwcodeLen, |
- | |
392 | dwIndex); |
- | |
393 | res := pchar(@dwcode); |
- | |
394 | dwNumber := sizeof(databuffer)-1; |
- | |
395 | if (res ='200') or (res ='302') then |
- | |
396 | begin |
- | |
397 | while (InternetReadfile(hfile, |
- | |
398 | @databuffer, |
- | |
399 | dwNumber, |
- | |
400 | DwRead)) do |
- | |
401 | begin |
- | |
402 | - | ||
403 | // Hinzugefügt |
- | |
404 | application.ProcessMessages; |
- | |
405 | - | ||
406 | if dwRead =0 then |
- | |
407 | break; |
- | |
408 | databuffer[dwread]:=#0; |
- | |
409 | Str := pchar(@databuffer); |
- | |
410 | resStr := resStr + Str; |
- | |
411 | end; |
- | |
412 | end |
- | |
413 | else |
- | |
414 | ResStr := 'Status:'+res; |
- | |
415 | if assigned(hfile) then |
- | |
416 | InternetCloseHandle(hfile); |
- | |
417 | end; |
- | |
418 | - | ||
419 | // Hinzugefügt |
- | |
420 | application.ProcessMessages; |
- | |
421 | - | ||
422 | InternetCloseHandle(hsession); |
- | |
423 | Result := resStr; |
- | |
424 | end; |
- | |
425 | - | ||
426 | - | ||
427 | { TBackground } |
349 | { TBackground } |
428 | 350 | ||
429 | procedure TBackground.DoMove(MoveCount: Integer); |
351 | procedure TBackground.DoMove(MoveCount: Integer); |
430 | var |
352 | var |
431 | ran: integer; |
353 | ran: integer; |
Line 1336... | Line 1258... | ||
1336 | result := imagelist.Items.Items[Ord(Sprite)-1] |
1258 | result := imagelist.Items.Items[Ord(Sprite)-1] |
1337 | else |
1259 | else |
1338 | result := nil; |
1260 | result := nil; |
1339 | end; |
1261 | end; |
1340 | 1262 | ||
- | 1263 | procedure TMainForm.Hilfe1Click(Sender: TObject); |
|
- | 1264 | begin |
|
- | 1265 | HilfeForm.Caption := TMenuItem(Sender).Caption; |
|
- | 1266 | HilfeForm.Caption := StringReplace(HilfeForm.Caption, '&&', #1, [rfReplaceAll]); |
|
- | 1267 | HilfeForm.Caption := StringReplace(HilfeForm.Caption, '&', '', [rfReplaceAll]); |
|
- | 1268 | HilfeForm.Caption := StringReplace(HilfeForm.Caption, #1, '&', [rfReplaceAll]); |
|
- | 1269 | HilfeForm.ShowMarkDownHelp(OwnDirectory+'Doku.md'); |
|
- | 1270 | HilfeForm.ShowModal; |
|
- | 1271 | end; |
|
- | 1272 | ||
1341 | procedure TMainForm.GamePauseClick(Sender: TObject); |
1273 | procedure TMainForm.GamePauseClick(Sender: TObject); |
1342 | begin |
1274 | begin |
1343 | GamePause.Checked := not GamePause.Checked; |
1275 | GamePause.Checked := not GamePause.Checked; |
1344 | DXTimer.Enabled := not GamePause.Checked; |
1276 | DXTimer.Enabled := not GamePause.Checked; |
1345 | if GamePause.Checked then |
1277 | if GamePause.Checked then |
Line 1371... | Line 1303... | ||
1371 | //application.terminate; |
1303 | //application.terminate; |
1372 | end; |
1304 | end; |
1373 | end; |
1305 | end; |
1374 | 1306 | ||
1375 | procedure TMainForm.CheckUpdatesClick(Sender: TObject); |
1307 | procedure TMainForm.CheckUpdatesClick(Sender: TObject); |
1376 | var |
- | |
1377 | cont: string; |
- | |
1378 | begin |
- | |
1379 | cont := GetHTML('https://www.viathinksoft.de/update/?id=spacemission'); |
- | |
1380 | if copy(cont, 0, 7) = 'Status:' then |
- | |
1381 | begin |
- | |
1382 | Application.MessageBox('Ein Fehler ist aufgetreten. Wahrscheinlich ist keine Internetverbindung aufgebaut, oder der der ViaThinkSoft-Server vorübergehend offline.', 'Fehler', MB_OK + MB_ICONERROR) |
- | |
1383 | end |
- | |
1384 | else |
- | |
1385 | begin |
1308 | begin |
1386 | if cont <> ProgramVersion then |
1309 | CheckForUpdates('spacemission'); |
1387 | begin |
- | |
1388 | if Application.MessageBox('Eine neue Programmversion ist vorhanden. Möchten Sie diese jetzt herunterladen?', 'Information', MB_YESNO + MB_ICONASTERISK) = ID_YES then |
- | |
1389 | shellexecute(application.handle, 'open', pchar('https://www.viathinksoft.de/update/?id=@spacemission'), '', '', sw_normal); |
- | |
1390 | end |
- | |
1391 | else |
- | |
1392 | begin |
- | |
1393 | Application.MessageBox('Es ist keine neue Programmversion vorhanden.', 'Information', MB_OK + MB_ICONASTERISK); |
- | |
1394 | end; |
- | |
1395 | end; |
- | |
1396 | end; |
1310 | end; |
1397 | 1311 | ||
1398 | procedure TMainForm.BeendenClick(Sender: TObject); |
1312 | procedure TMainForm.BeendenClick(Sender: TObject); |
1399 | begin |
1313 | begin |
1400 | close; |
1314 | close; |