Subversion Repositories spacemission

Rev

Rev 47 | Rev 54 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. unit Global;
  2.  
  3. interface
  4.  
  5. const
  6.   ProgramVersion = '1.2';
  7.   RasterW = 48;
  8.   RasterH = 32;
  9.   MaxPossibleEnemyLives = 999;
  10.   MaxPossibleLevels = 9999;
  11.   RegistrySettingsKey = 'SOFTWARE\ViaThinkSoft\SpaceMission\Settings';
  12.   DefaultLevelLength = 1200;
  13.  
  14. type
  15.   // DirectX\Music.dxm
  16.   TSpaceMissionMusicTrack = (
  17.     smmNone,
  18.     smmBoss,   // dxmusic.Midis[0]
  19.     smmGame,   // dxmusic.Midis[1]
  20.     smmScene,  // dxmusic.Midis[2]
  21.     smmTitle   // dxmusic.Midis[3]
  22.   );
  23.  
  24.   // DirectX\Graphics.dxg
  25.   TSpaceMissionGraphicSprite = (
  26.     smgNone,
  27.     smgEnemyDisk,         // ImageList.Items.Item[0]
  28.     smgEnemyAttacker,     // ImageList.Items.Item[1]
  29.     smgEnemyBoss,         // ImageList.Items.Item[2]
  30.     smgBounce,            // ImageList.Items.Item[3]
  31.     smgMachine,           // ImageList.Items.Item[4]
  32.     smgEnemyAttacker2,    // ImageList.Items.Item[5]
  33.     smgEnemyAttacker3,    // ImageList.Items.Item[6]
  34.     smgEnemyMeteor,       // ImageList.Items.Item[7]
  35.     smgBounce2,           // ImageList.Items.Item[8]
  36.     smgEnemyDisk2,        // ImageList.Items.Item[9]
  37.     smgLogo,              // ImageList.Items.Item[10]
  38.     smgExplosion,         // ImageList.Items.Item[11]
  39.     smgBackgroundPlanet1, // ImageList.Items.Item[12]
  40.     smgMatrix,            // ImageList.Items.Item[13]
  41.     smgStar1,             // ImageList.Items.Item[14]
  42.     smgStar2,             // ImageList.Items.Item[15]
  43.     smgStar3,             // ImageList.Items.Item[16]
  44.     smgBackgroundBlue,    // ImageList.Items.Item[17]
  45.     smgBackgroundRed,     // ImageList.Items.Item[18]
  46.     smgBackgroundYellow,  // ImageList.Items.Item[19]
  47.     smgHintergrundRot     // ImageList.Items.Item[20]
  48.   );
  49.  
  50.   // DirectX\Sound.dxw
  51.   TSpaceMissionSound = (
  52.     smsNone,
  53.     smsSceneMov,      // WaveList.Items.Item[0]
  54.     smsExplosion,     // WaveList.Items.Item[1]
  55.     smsHit,           // WaveList.Items.Item[2]
  56.     smsShoot,         // WaveList.Items.Item[3]
  57.     smsDanger,        // WaveList.Items.Item[4]
  58.     smsEnde,          // WaveList.Items.Item[5]
  59.     smsFrage,         // WaveList.Items.Item[6]
  60.     smsLevIntro       // WaveList.Items.Item[7]
  61.   );
  62.  
  63. function OwnDirectory: string;
  64.  
  65. const
  66.   FOLDERID_SavedGames: TGuid = '{4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4}';
  67.  
  68. function GetKnownFolderPath(const rfid: TGUID): string;
  69.  
  70. implementation
  71.  
  72. uses
  73.   SysUtils, ActiveX, ShlObj;
  74.  
  75. function GetKnownFolderPath(const rfid: TGUID): string;
  76. var
  77.   OutPath: PWideChar;
  78. begin
  79.   // https://www.delphipraxis.net/135471-unit-zur-verwendung-von-shgetknownfolderpath.html
  80.   if ShGetKnownFolderPath(rfid, 0, 0, OutPath) {>= 0} = S_OK then
  81.   begin
  82.     Result := OutPath;
  83.     // From MSDN
  84.     // ppszPath [out]
  85.     // Type: PWSTR*
  86.     // When this method returns, contains the address of a pointer to a null-terminated Unicode string that specifies the path of the known folder
  87.     // The calling process is responsible for freeing this resource once it is no longer needed by calling CoTaskMemFree.
  88.     // The returned path does not include a trailing backslash. For example, "C:\Users" is returned rather than "C:\Users\".
  89.     CoTaskMemFree(OutPath);
  90.   end
  91.   else
  92.   begin
  93.     Result := '';
  94.   end;
  95. end;
  96.  
  97. function OwnDirectory: string;
  98. begin
  99.   result := extractfilepath(paramstr(0));
  100. end;
  101.  
  102. end.
  103.