Changeset 666
- Timestamp:
- Jul 9, 2025, 10:36:23 PM (7 hours ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Direct.pas
r664 r666 135 135 Background.Update; 136 136 end; 137 MusicPlayer.LoadPlaylistFromDir(GetMusicDir); 138 MusicPlayer.RandomizePlaylist; 139 if MusicPlayer.Playlist.Count > 0 then MusicPlayer.Play; 137 if MusicEnabled then begin 138 MusicPlayer.LoadPlaylistFromDir(GetMusicDir); 139 MusicPlayer.RandomizePlaylist; 140 if MusicPlayer.Playlist.Count > 0 then MusicPlayer.Play; 141 end; 140 142 end; 141 143 ntStartGo, ntStartGoRefresh, ntStartGoRefreshMaps: -
trunk/Language.txt
r614 r666 964 964 Custom DPI 965 965 DPI 966 Music -
trunk/Language2.txt
r304 r666 27 27 28 28 'Start Dialog 29 #ACTIONHEADER_CONFIG Configurat or30 #ACTION_CONFIG Change language, add maps and AIs29 #ACTIONHEADER_CONFIG Configuration 30 #ACTION_CONFIG Change language, key bindings, audio 31 31 #ACTIONHEADER_MANUAL Manual 32 32 #ACTION_MANUAL Rules and user interface in detail … … 67 67 #AITSTAT 68 68 No. of rounds colony ship was completed 69 No. of rounds all other nations were erased 70 No. of rounds own nation was erased 69 No. of rounds all other nations were erased 70 No. of rounds own nation was erased 71 71 Share of total calculation time -
trunk/LocalPlayer/Term.pas
r660 r666 655 655 656 656 uses 657 Directories, Log, Sound, Registry, Global, KeyBindings, CmdList ;657 Directories, Log, Sound, Registry, Global, KeyBindings, CmdList, Music; 658 658 659 659 {$R *.lfm} … … 8094 8094 else TermBounds := BoundsRect; 8095 8095 Timer1.Enabled := False; 8096 if MusicPlayer.Playing then MusicPlayer.Stop; 8096 8097 end; 8097 8098 -
trunk/Localization/cs/Language.txt
r614 r666 964 964 Vlastní DPI 965 965 DPI 966 Hudba -
trunk/Localization/cs/Language2.txt
r436 r666 27 27 28 28 'Start Dialog 29 #ACTIONHEADER_CONFIG Konfigurátor30 #ACTION_CONFIG Změna jazyka, při dání map a AI29 #ACTIONHEADER_CONFIG Nastavení 30 #ACTION_CONFIG Změna jazyka, přiřazení kláves, zvuku 31 31 #ACTIONHEADER_MANUAL Příručka 32 32 #ACTION_MANUAL Popis pravidel a uživatelského rozhraní … … 67 67 #AITSTAT 68 68 Počet kol, kdy byla dokončena kolonizační loď 69 Počet kol, kdy byly zničeny všechny ostatní národy 70 Počet kol, kdy byl zničen náš národ 69 Počet kol, kdy byly zničeny všechny ostatní národy 70 Počet kol, kdy byl zničen náš národ 71 71 Podíl na celkovém času -
trunk/Localization/de/Language.txt
r614 r666 982 982 Custom DPI 983 983 DPI 984 Musik -
trunk/Localization/de/Language2.txt
r454 r666 27 27 28 28 'Start Dialog 29 #ACTIONHEADER_CONFIG Konfigurator30 #ACTION_CONFIG Sprache ändern, Karten und KIs hinzufügen29 #ACTIONHEADER_CONFIG Einstellungen 30 #ACTION_CONFIG Ändern von Sprache, Tastenbelegung, Ton 31 31 #ACTIONHEADER_MANUAL Handbuch 32 32 #ACTION_MANUAL Regeln und Benutzeroberfläche im Detail … … 67 67 #AITSTAT 68 68 Anzahl der Runden Kolonieschiff wurde abgeschlossen 69 Anzahl der Runden alle anderen Nationen wurden gelöscht 70 Anzahl der Runden eigene Nation wurde gelöscht 69 Anzahl der Runden alle anderen Nationen wurden gelöscht 70 Anzahl der Runden eigene Nation wurde gelöscht 71 71 Anteil an der Gesamtberechnungszeit -
trunk/Localization/fr/Language.txt
r643 r666 964 964 DPI personnalisé 965 965 DPI 966 Musique -
trunk/Localization/fr/Language2.txt
r453 r666 28 28 'Start Dialog 29 29 #ACTIONHEADER_CONFIG Configurateur 30 #ACTION_CONFIG Changer de langue, ajouter des cartes et des IA30 #ACTION_CONFIG Modification de la langue, des affectations de touches 31 31 #ACTIONHEADER_MANUAL Manuel 32 32 #ACTION_MANUAL Règles et interface utilisateur en détail -
trunk/Localization/it/Language.txt
r614 r666 954 954 Custom DPI 955 955 DPI 956 Musica -
trunk/Localization/it/Language2.txt
r304 r666 27 27 28 28 'Start Dialog 29 #ACTIONHEADER_CONFIG Configuratore30 #ACTION_CONFIG Cambia lingua, aggiungi mappe e I.A.29 #ACTIONHEADER_CONFIG Impostazioni 30 #ACTION_CONFIG Modifica della lingua, assegnazione dei tasti 31 31 #ACTIONHEADER_MANUAL Manuale 32 32 #ACTION_MANUAL Regole e interfaccia in dettaglio -
trunk/Localization/ru/Language.txt
r614 r666 989 989 Custom DPI 990 990 DPI 991 Музыка -
trunk/Localization/zh-Hans/Language.txt
r614 r666 981 981 Custom DPI 982 982 DPI 983 Music -
trunk/Localization/zh-Hant/Language.txt
r614 r666 981 981 Custom DPI 982 982 DPI 983 Music -
trunk/Music.pas
r665 r666 12 12 TMusicPlayer = class 13 13 private 14 FVolume: Single; 14 15 PlayerIndex1: Integer; 15 16 InputIndex1: Integer; … … 18 19 InputLength: Integer; 19 20 AutoPlayNext: Boolean; 21 function GetPlaying: Boolean; 20 22 procedure Initialize; 21 23 procedure EndPlay(PlayerIndex: cint32); 22 24 function GetNextPlaylistItem: string; 23 25 procedure PlayNext(Data: PtrInt); 26 procedure SetVolume(AValue: Single); 24 27 public 25 28 Playlist: TStringList; … … 30 33 procedure Play; 31 34 procedure Stop; 35 property Playing: Boolean read GetPlaying; 36 property Volume: Single read FVolume write SetVolume; 32 37 end; 33 38 … … 78 83 end; 79 84 85 function TMusicPlayer.GetPlaying: Boolean; 86 begin 87 Result := PlayerIndex1 >= 0; 88 end; 89 80 90 procedure TMusicPlayer.EndPlay(PlayerIndex: cint32); 81 91 begin 82 if AutoPlayNext and (PlayerIndex = PlayerIndex1) then Application.QueueAsyncCall(PlayNext, 0); 92 if AutoPlayNext then begin 93 if PlayerIndex = PlayerIndex1 then Application.QueueAsyncCall(PlayNext, 0); 94 end else PlayerIndex1 := -1; 83 95 end; 84 96 … … 95 107 end; 96 108 109 procedure TMusicPlayer.SetVolume(AValue: Single); 110 begin 111 if FVolume = AValue then Exit; 112 FVolume := AValue; 113 if FVolume > 1 then FVolume := 1; 114 if FVolume < 0 then FVolume := 0; 115 if Playing then 116 uos_InputSetDSPVolume(PlayerIndex1, InputIndex1, Volume, Volume, True); 117 end; 118 97 119 constructor TMusicPlayer.Create; 98 120 begin 99 121 Playlist := TStringList.Create; 122 PlayerIndex1 := -1; 123 FVolume := 1; 100 124 end; 101 125 … … 154 178 155 179 AutoPlayNext := False; 156 uos_Stop(PlayerIndex1);180 if PlayerIndex1 >= 0 then uos_Stop(PlayerIndex1); 157 181 158 182 Inc(PlayerIndex1); … … 171 195 uos_InputSetPositionEnable(PlayerIndex1, InputIndex1, 1); 172 196 InputLength := uos_InputLength(PlayerIndex1, InputIndex1); 173 uos_InputAddDSPVolume(PlayerIndex1, InputIndex1, 0.5, 0.5);197 uos_InputAddDSPVolume(PlayerIndex1, InputIndex1, Volume, Volume); 174 198 175 199 OutputIndex1 := uos_AddIntoDevOut(PlayerIndex1, -1, -1, -1, -1, -1, -1, -1); … … 185 209 procedure TMusicPlayer.Stop; 186 210 begin 187 Initialize;188 211 AutoPlayNext := False; 189 uos_Stop(PlayerIndex1); 212 if PlayerIndex1 >= 0 then begin 213 Initialize; 214 uos_Stop(PlayerIndex1); 215 end; 216 PlayerIndex1 := -1; 190 217 end; 191 218 -
trunk/Packages/CevoComponents/ScreenTools.pas
r659 r666 197 197 DrawBuffer: TBitmap; 198 198 FullScreen: Boolean; 199 MusicEnabled: Boolean; 200 MusicVolume: Single; 199 201 TermBounds: TRect; 200 202 GenerateNames: Boolean; -
trunk/Settings.lfm
r568 r666 11 11 DesignTimePPI = 144 12 12 Font.Color = clWindowText 13 Font.Height = -1 113 Font.Height = -17 14 14 Font.Name = 'MS Sans Serif' 15 15 FormStyle = fsStayOnTop 16 Position = poScreenCenter 17 LCLVersion = '4.0.0.4' 18 Scaled = False 16 19 OnClose = FormClose 17 20 OnCreate = FormCreate … … 19 22 OnPaint = FormPaint 20 23 OnShow = FormShow 21 Position = poScreenCenter22 LCLVersion = '2.2.6.0'23 Scaled = False24 24 object ListLanguages: TListBoxEx 25 25 Tag = 15360 26 26 Left = 16 27 Height = 2 9127 Height = 280 28 28 Top = 32 29 29 Width = 144 … … 39 39 ParentFont = False 40 40 ScrollWidth = 144 41 Style = lbOwnerDrawVariable 41 42 TabOrder = 1 42 43 TabStop = False … … 62 63 end 63 64 object ButtonFullscreen: TButtonC 64 Left = 2465 Left = 16 65 66 Height = 18 66 67 Top = 368 … … 110 111 ParentFont = False 111 112 ScrollWidth = 288 113 Style = lbOwnerDrawVariable 112 114 TabOrder = 0 113 115 TabStop = False 114 116 TopIndex = -1 115 117 OnSelectionChange = ListKeyBindingsSelectionChange 116 end117 object EditShortCutPrimary: TEdit118 Left = 176119 Height = 27120 Top = 296121 Width = 136122 BorderStyle = bsNone123 Color = clBlack124 Enabled = False125 Font.Color = 4176863126 Font.Height = -15127 Font.Name = 'Times New Roman'128 Font.Style = [fsBold]129 ParentFont = False130 TabOrder = 2131 OnKeyUp = EditShortCutPrimaryKeyUp132 end133 object EditShortCutSecondary: TEdit134 Left = 328135 Height = 27136 Top = 296137 Width = 136138 BorderStyle = bsNone139 Color = clBlack140 Enabled = False141 Font.Color = 4176863142 Font.Height = -15143 Font.Name = 'Times New Roman'144 Font.Style = [fsBold]145 ParentFont = False146 TabOrder = 3147 OnKeyUp = EditShortCutSecondaryKeyUp148 118 end 149 119 object ButtonReset: TButtonA … … 157 127 end 158 128 object ButtonCustomDpi: TButtonC 159 Left = 24129 Left = 176 160 130 Height = 18 161 Top = 33 6131 Top = 334 162 132 Width = 18 163 133 Down = False … … 188 158 ButtonIndex = 0 189 159 end 160 object ButtonMusicVolumeDown: TButtonC 161 Tag = 6912 162 Left = 136 163 Height = 12 164 Top = 340 165 Width = 12 166 Down = False 167 Permanent = False 168 OnClick = ButtonMusicVolumeDownClick 169 ButtonIndex = 0 170 end 171 object ButtonMusicVolumeUp: TButtonC 172 Tag = 6912 173 Left = 136 174 Height = 12 175 Top = 328 176 Width = 12 177 Down = False 178 Permanent = False 179 OnClick = ButtonMusicVolumeUpClick 180 ButtonIndex = 1 181 end 182 object EditShortCutPrimary: TEdit 183 AutoSize = True 184 ClientHeight = 27 185 ClientWidth = 136 186 Top = 296 187 Left = 176 188 Width = 136 189 Height = 27 190 Enabled = False 191 ShowHint = False 192 Font.Color = 4176863 193 Font.Name = 'Times New Roman' 194 Font.Style = [fsBold] 195 Font.PixelsPerInch = 96 196 Font.Height = -15 197 Align = alNone 198 Color = clBlack 199 TabStop = True 200 OnKeyUp = EditShortCutPrimaryKeyUp 201 BorderStyle = bsNone 202 ParentFont = False 203 end 204 object EditShortCutSecondary: TEdit 205 AutoSize = True 206 ClientHeight = 27 207 ClientWidth = 136 208 Top = 296 209 Left = 328 210 Width = 136 211 Height = 27 212 Enabled = False 213 ShowHint = False 214 Font.Color = 4176863 215 Font.Name = 'Times New Roman' 216 Font.Style = [fsBold] 217 Font.PixelsPerInch = 96 218 Font.Height = -15 219 Align = alNone 220 Color = clBlack 221 TabStop = True 222 OnKeyUp = EditShortCutSecondaryKeyUp 223 BorderStyle = bsNone 224 ParentFont = False 225 end 190 226 end -
trunk/Settings.pas
r570 r666 13 13 14 14 TSettingsDlg = class(TDrawDlg) 15 ButtonMusicVolumeDown: TButtonC; 16 ButtonMusicVolumeUp: TButtonC; 15 17 ButtonFullscreen: TButtonC; 16 18 ButtonCustomDpi: TButtonC; … … 31 33 procedure ButtonFullscreenClick(Sender: TObject); 32 34 procedure ButtonCancelClick(Sender: TObject); 35 procedure ButtonMusicVolumeDownClick(Sender: TObject); 36 procedure ButtonMusicVolumeUpClick(Sender: TObject); 33 37 procedure ButtonResetClick(Sender: TObject); 34 38 procedure ButtonGammaDownClick(Sender: TObject); … … 48 52 LocalGamma: Integer; 49 53 LocalKeyBindings: TKeyBindings; 54 LocalMusicVolume: Integer; 50 55 CurrentKeyBinding: TKeyBinding; 51 56 LocalDpi: Integer; … … 65 70 DpiMax = 500; 66 71 DpiStep = 25; 72 MusicVolumeMin = 0; 73 MusicVolumeMax = 100; 74 MusicVolumeStep = 10; 67 75 68 76 … … 76 84 var 77 85 SFullScreen, SGamma, SRestartMsg, SShortCutPrimary, SShortCutSecondary, 78 SLanguages, SKeyBindings, SCustomDpi, SDpi : string;86 SLanguages, SKeyBindings, SCustomDpi, SDpi, SMusic: string; 79 87 80 88 procedure ReloadLanguages; … … 89 97 SCustomDpi := Phrases.Lookup('SETTINGS', 7); 90 98 SDpi := Phrases.Lookup('SETTINGS', 8); 99 SMusic := Phrases.Lookup('SETTINGS', 9); 91 100 end; 92 101 … … 112 121 end; 113 122 123 procedure TSettingsDlg.ButtonMusicVolumeDownClick(Sender: TObject); 124 begin 125 Dec(LocalMusicVolume, MusicVolumeStep); 126 if LocalMusicVolume < MusicVolumeMin then LocalMusicVolume := MusicVolumeMin; 127 Invalidate; 128 end; 129 130 procedure TSettingsDlg.ButtonMusicVolumeUpClick(Sender: TObject); 131 begin 132 Inc(LocalMusicVolume, MusicVolumeStep); 133 if LocalMusicVolume > MusicVolumeMax then LocalMusicVolume := MusicVolumeMax; 134 Invalidate; 135 end; 136 114 137 procedure TSettingsDlg.ButtonResetClick(Sender: TObject); 115 138 begin … … 117 140 ListLanguages.ItemIndex := 0; 118 141 ButtonFullscreen.ButtonIndex := 3; 142 LocalMusicVolume := 50; 119 143 ButtonCustomDpi.ButtonIndex := 2; 120 144 LocalDpi := 100; … … 202 226 203 227 procedure TSettingsDlg.FormPaint(Sender: TObject); 228 const 229 TextDistanceX = 20; 230 UpDownTextWidth = 120; 204 231 begin 205 232 PaintBackground(Canvas, 3, 3, ClientWidth - 6, ClientHeight - 6, … … 223 250 ButtonCustomDpi.Left + 12, ButtonCustomDpi.Top + 12, MainTexture.ColorBevelShade, 224 251 MainTexture.ColorBevelLight); 225 LoweredTextOut(Canvas, -2, MainTexture, ButtonCustomDpi.Left + 32,252 LoweredTextOut(Canvas, -2, MainTexture, ButtonCustomDpi.Left + TextDistanceX, 226 253 ButtonCustomDpi.Top - 4, SCustomDpi); 227 254 UnderlinedTitleValue(Canvas, SDpi, IntToStr(LocalDpi) + '%', 228 ButtonDpiUp.Left - 150 - 4, ButtonDpiUp.Top + 2, 150);255 ButtonDpiUp.Left - UpDownTextWidth - 4, ButtonDpiUp.Top + 2, UpDownTextWidth); 229 256 {$ENDIF} 257 258 UnderlinedTitleValue(Canvas, SMusic, IntToStr(LocalMusicVolume) + '%', 259 ButtonMusicVolumeUp.Left - UpDownTextWidth - 4, ButtonMusicVolumeUp.Top + 2, UpDownTextWidth); 230 260 231 261 LoweredTextOut(Canvas, -2, MainTexture, ListLanguages.Left, … … 233 263 LoweredTextOut(Canvas, -2, MainTexture, ListKeyBindings.Left, 234 264 ListKeyBindings.Top - 26, SKeyBindings); 235 LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + 32,265 LoweredTextOut(Canvas, -2, MainTexture, ButtonFullscreen.Left + TextDistanceX, 236 266 ButtonFullscreen.Top - 4, SFullScreen); 237 267 UnderlinedTitleValue(Canvas, SGamma, IntToStr(LocalGamma) + '%', 238 ButtonGammaUp.Left - 150 - 4, ButtonGammaUp.Top + 2, 150);268 ButtonGammaUp.Left - UpDownTextWidth - 4, ButtonGammaUp.Top + 2, UpDownTextWidth); 239 269 LoweredTextOut(Canvas, -2, MainTexture, EditShortCutPrimary.Left, 240 270 EditShortCutPrimary.Top - 26, SShortCutPrimary); … … 343 373 if FullScreen then ButtonFullscreen.ButtonIndex := 3 344 374 else ButtonFullscreen.ButtonIndex := 2; 375 if MusicEnabled then LocalMusicVolume := Round(MusicVolume * 100) 376 else LocalMusicVolume := 0; 345 377 LocalGamma := Gamma; 346 378 LocalKeyBindings.Assign(KeyBindings.KeyBindings); … … 366 398 end; 367 399 FullScreen := (ButtonFullscreen.ButtonIndex and 1) = 1; 400 MusicEnabled := LocalMusicVolume > 0; 401 MusicVolume := LocalMusicVolume / 100; 368 402 Gamma := LocalGamma; 369 403 ScreenTools.CustomDpiEnabled := CustomDpiEnabled; -
trunk/Start.pas
r664 r666 123 123 LastGame: string; 124 124 LastMap: string; 125 procedure UpdateMusic; 125 126 procedure DrawAction(Y, IconIndex: Integer; HeaderItem, TextItem: string); 126 127 procedure InitPopup(PlayerIndex: Integer); … … 337 338 338 339 procedure TStartDlg.SmartInvalidate(x0, y0, x1, y1: Integer; 339 invalidateTab0: Boolean);340 InvalidateTab0: Boolean); 340 341 var 341 342 I: Integer; … … 414 415 else ScreenMode := 1; 415 416 FullScreen := ScreenMode > 0; 417 if ValueExists('MusicEnabled') then MusicEnabled := ReadBool('MusicEnabled') 418 else MusicEnabled := True; 419 if ValueExists('MusicVolume') then MusicVolume := ReadFloat('MusicVolume') 420 else MusicVolume := 0.5; 416 421 if ValueExists('TermLeft') then TermBounds.Left := ReadInteger('TermLeft') 417 422 else TermBounds.Left := 0; … … 460 465 if FullScreen then WriteInteger('ScreenMode', 1) 461 466 else WriteInteger('ScreenMode', 0); 467 WriteBool('MusicEnabled', MusicEnabled); 468 WriteFloat('MusicVolume', MusicVolume); 462 469 WriteInteger('TermWidth', TermBounds.Width); 463 470 WriteInteger('TermHeight', TermBounds.Height); … … 537 544 UpdateInterface; 538 545 Background.UpdateInterface; 546 UpdateMusic; 539 547 end; 540 548 FreeAndNil(SettingsDlg); … … 943 951 Background.Enabled := False; 944 952 945 MusicPlayer.LoadPlaylistFromDir(GetMusicDir + DirectorySeparator + 'Start'); 946 MusicPlayer.RandomizePlaylist; 947 if MusicPlayer.Playlist.Count > 0 then MusicPlayer.Play; 953 UpdateMusic; 948 954 end; 949 955 … … 1961 1967 end; 1962 1968 1969 procedure TStartDlg.UpdateMusic; 1970 begin 1971 if MusicEnabled then begin 1972 MusicPlayer.Volume := MusicVolume; 1973 if not MusicPlayer.Playing then begin 1974 MusicPlayer.LoadPlaylistFromDir(GetMusicDir + DirectorySeparator + 'Start'); 1975 MusicPlayer.RandomizePlaylist; 1976 if MusicPlayer.Playlist.Count > 0 then MusicPlayer.Play; 1977 end; 1978 end else begin 1979 if MusicPlayer.Playing then MusicPlayer.Stop; 1980 end; 1981 end; 1982 1963 1983 end.
Note:
See TracChangeset
for help on using the changeset viewer.