Changeset 173 for trunk/Packages/CevoComponents/ScreenTools.pas
- Timestamp:
- Jun 16, 2019, 10:57:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r170 r173 21 21 {$ENDIF} 22 22 procedure RestoreResolution; 23 function Play(Item: string; Index: integer = -1): boolean;24 procedure PreparePlay(Item: string; Index: integer = -1);25 23 procedure EmptyMenu(MenuItems: TMenuItem; Keep: Integer = 0); 26 24 function TurnToYear(Turn: integer): integer; … … 121 119 hOrna = 26; // ornament 122 120 123 // sound modes124 smOff = 0;125 smOn = 1;126 smOnAlt = 2;127 128 121 // color matrix 129 122 clkAge0 = 1; … … 173 166 174 167 var 175 Phrases, Phrases2, Sounds: TStringTable; 176 nGrExt: integer; 168 Phrases: TStringTable; 169 Phrases2: TStringTable; 170 nGrExt: Integer; 177 171 GrExt: array [0 .. nGrExtmax - 1] of ^TGrExtDescr; 178 HGrSystem, HGrSystem2, ClickFrameColor, SoundMode, MainTextureAge: integer;172 HGrSystem, HGrSystem2, ClickFrameColor, MainTextureAge: Integer; 179 173 MainTexture: TTexture; 180 174 Templates, Colors, Paper, BigImp, LogoBuffer: TBitmap; … … 227 221 ResolutionChanged := False; 228 222 {$ENDIF} 229 end;230 231 function Play(Item: string; Index: integer = -1): boolean;232 {$IFNDEF DEBUG}233 var234 WavFileName: string;235 {$ENDIF}236 begin237 Result := False;238 {$IFNDEF DEBUG}239 if (Sounds = nil) or (SoundMode = smOff) or (Item = '') then240 begin241 Result := True;242 Exit;243 end;244 WavFileName := Sounds.Lookup(Item, Index);245 Assert(WavFileName[1] <> '[');246 Result := (WavFileName <> '') and (WavFileName[1] <> '[') and (WavFileName <> '*');247 if Result then248 // SndPlaySound(pchar(HomeDir+'Sounds' +DirectorySeparator+WavFileName+'.wav'),SND_ASYNC)249 PlaySound(HomeDir + 'Sounds' + DirectorySeparator + WavFileName);250 {$ENDIF}251 end;252 253 procedure PreparePlay(Item: string; Index: Integer = -1);254 {$IFNDEF DEBUG}255 var256 WavFileName: string;257 {$ENDIF}258 begin259 {$IFNDEF DEBUG}260 if (Sounds = nil) or (SoundMode = smOff) or (Item = '') then261 Exit;262 WavFileName := Sounds.Lookup(Item, Index);263 Assert(WavFileName[1] <> '[');264 if (WavFileName <> '') and (WavFileName[1] <> '[') and (WavFileName <> '*') then265 PrepareSound(HomeDir + 'Sounds' + DirectorySeparator + WavFileName);266 {$ENDIF}267 223 end; 268 224 … … 1403 1359 procedure LoadPhrases; 1404 1360 begin 1405 if Phrases = nil then 1406 Phrases := TStringTable.Create; 1407 if Phrases2 = nil then 1408 Phrases2 := TStringTable.Create; 1361 if Phrases = nil then Phrases := TStringTable.Create; 1362 if Phrases2 = nil then Phrases2 := TStringTable.Create; 1409 1363 Phrases2FallenBackToEnglish := False; 1410 1364 if FileExists(LocalizedFilePath('Language.txt')) then 1411 1365 begin 1412 Phrases. loadfromfile(LocalizedFilePath('Language.txt'));1366 Phrases.LoadFromFile(LocalizedFilePath('Language.txt')); 1413 1367 if FileExists(LocalizedFilePath('Language2.txt')) then 1414 Phrases2. loadfromfile(LocalizedFilePath('Language2.txt'))1368 Phrases2.LoadFromFile(LocalizedFilePath('Language2.txt')) 1415 1369 else 1416 1370 begin 1417 Phrases2. loadfromfile(HomeDir + 'Language2.txt');1371 Phrases2.LoadFromFile(HomeDir + 'Language2.txt'); 1418 1372 Phrases2FallenBackToEnglish := True; 1419 1373 end; … … 1421 1375 else 1422 1376 begin 1423 Phrases.loadfromfile(HomeDir + 'Language.txt'); 1424 Phrases2.loadfromfile(HomeDir + 'Language2.txt'); 1425 end; 1426 1427 if Sounds = nil then 1428 Sounds := TStringTable.Create; 1429 if not Sounds.loadfromfile(HomeDir + 'Sounds' + DirectorySeparator + 'sound.txt') then 1377 Phrases.LoadFromFile(HomeDir + 'Language.txt'); 1378 Phrases2.LoadFromFile(HomeDir + 'Language2.txt'); 1379 end; 1380 1381 if Sounds = nil then Sounds := TStringTable.Create; 1382 if not Sounds.LoadFromFile(HomeDir + 'Sounds' + DirectorySeparator + 'sound.txt') then 1430 1383 begin 1431 1384 FreeAndNil(Sounds); … … 1454 1407 if s[1] = '#' then begin 1455 1408 s := TrimRight(s); 1456 if s = '#SMALL' then 1457 Section := ftSmall 1458 else if s = '#TINY' then 1459 Section := ftTiny 1460 else if s = '#CAPTION' then 1461 Section := ftCaption 1462 else if s = '#BUTTON' then 1463 Section := ftButton 1464 else 1465 Section := ftNormal; 1409 if s = '#SMALL' then Section := ftSmall 1410 else if s = '#TINY' then Section := ftTiny 1411 else if s = '#CAPTION' then Section := ftCaption 1412 else if s = '#BUTTON' then Section := ftButton 1413 else Section := ftNormal; 1466 1414 end else begin 1467 1415 p := Pos(',', s); … … 1599 1547 FreeAndNil(Phrases); 1600 1548 FreeAndNil(Phrases2); 1601 if Sounds <> nil then1602 FreeAndNil(Sounds);1603 1549 FreeAndNil(LogoBuffer); 1604 1550 FreeAndNil(BigImp);
Note:
See TracChangeset
for help on using the changeset viewer.