Changeset 327 for trunk/LocalPlayer/Term.pas
- Timestamp:
- Mar 25, 2021, 2:09:42 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r326 r327 271 271 procedure InitModule; 272 272 procedure InitTurn(NewPlayer: integer); 273 procedure SaveMenuItemsState; 273 274 procedure ScrollBarUpdate(Sender: TObject); 274 275 procedure ArrangeMidPanel; … … 421 422 // lines of system icons in icons.bmp before improvements 422 423 423 // save options apart from what's defined by SaveOption424 soTellAI = 30;425 soExtraMask = $40000000;426 427 424 nCityEventPriority = 16; 428 425 CityEventPriority: array [0 .. nCityEventPriority - 1] of integer = … … 485 482 Age: Integer; 486 483 UnFocus: Integer; 487 OptionChecked: Integer;488 MapOptionChecked: Integer;484 OptionChecked: TSaveOptions; 485 MapOptionChecked: TMapOptions; 489 486 nLostArmy: Integer; 490 487 ScienceSum: Integer; … … 570 567 flImmUpdate = $0002; 571 568 572 nSaveOption = 22;573 574 569 var 575 570 Jump: array [0 .. nPl - 1] of integer; … … 577 572 SmallScreen, GameOK, MapValid, skipped, idle: boolean; 578 573 579 SaveOption: array [0..nSaveOption - 1]of integer;574 SaveOption: array of integer; 580 575 MiniColors: array [0..11, 0..1] of TColor; 581 576 MainMap: TIsoMap; … … 1266 1261 procedure TMainScreen.SetMapOptions; 1267 1262 begin 1268 MiniMap. Options := MapOptionChecked;1269 IsoEngine. Options := MapOptionChecked;1263 MiniMap.MapOptions := MapOptionChecked; 1264 IsoEngine.MapOptions := MapOptionChecked; 1270 1265 if ClientMode = cEditMap then 1271 IsoEngine. Options := IsoEngine.Options or (1 shl moEditMode);1266 IsoEngine.MapOptions := IsoEngine.MapOptions + [moEditMode]; 1272 1267 if mLocCodes.Checked then 1273 IsoEngine. Options := IsoEngine.Options or (1 shl moLocCodes);1268 IsoEngine.MapOptions := IsoEngine.MapOptions + [moLocCodes]; 1274 1269 end; 1275 1270 … … 3458 3453 BaseWin.CreateOffscreen(Offscreen); 3459 3454 3460 // define which menu settings to save 3455 // define which menu settings to save 3456 SetLength(SaveOption, 22); 3461 3457 SaveOption[0] := mAlEffectiveMovesOnly.Tag; 3462 3458 SaveOption[1] := mEnMoves.Tag; … … 3490 3486 for i := 0 to ComponentCount - 1 do 3491 3487 if Components[i].Tag and $FF <> 0 then 3492 if Components[i] is TMenuItem then 3493 begin 3488 if Components[i] is TMenuItem then begin 3494 3489 TMenuItem(Components[i]).Caption := Phrases.Lookup('CONTROLS', 3495 3490 -1 + Components[i].Tag and $FF); 3496 for j := 0 to nSaveOption- 1 do3491 for j := 0 to Length(SaveOption) - 1 do 3497 3492 if Components[i].Tag and $FF = SaveOption[j] then 3498 TMenuItem(Components[i]).Checked := ((1 shl j) and OptionChecked) <> 0; 3499 end 3500 else if Components[i] is TButtonBase then 3501 begin 3493 TMenuItem(Components[i]).Checked := TSaveOption(j) in OptionChecked; 3494 end else 3495 if Components[i] is TButtonBase then begin 3502 3496 TButtonBase(Components[i]).Hint := Phrases.Lookup('CONTROLS', 3503 3497 -1 + Components[i].Tag and $FF); … … 3505 3499 (TButtonC(Components[i]).ButtonIndex <> 1) then 3506 3500 TButtonC(Components[i]).ButtonIndex := 3507 MapOptionCheckedshr (Components[i].Tag shr 8) and 1 + 23501 Integer(MapOptionChecked) shr (Components[i].Tag shr 8) and 1 + 2 3508 3502 end; 3509 3503 … … 5015 5009 procedure TMainScreen.Timer1Timer(Sender: TObject); 5016 5010 var 5017 dx, dy, speed: integer;5011 dx, dy, ScrollSpeed: integer; 5018 5012 begin 5019 5013 if idle and (me >= 0) and (GameMode <> cMovie) then … … 5036 5030 if Application.Active and not mScrollOff.Checked then 5037 5031 begin 5038 if mScrollFast.Checked then 5039 speed := 2 5040 else 5041 speed := 1; 5032 if mScrollFast.Checked then ScrollSpeed := 2 5033 else ScrollSpeed := 1; 5042 5034 dx := 0; 5043 5035 dy := 0; 5044 5036 if Mouse.CursorPos.y < Screen.height - PanelHeight then 5045 5037 if Mouse.CursorPos.x = 0 then 5046 dx := - speed // scroll left5038 dx := -ScrollSpeed // scroll left 5047 5039 else if Mouse.CursorPos.x = Screen.width - 1 then 5048 dx := speed; // scroll right5040 dx := ScrollSpeed; // scroll right 5049 5041 if Mouse.CursorPos.y = 0 then 5050 dy := - speed // scroll up5042 dy := -ScrollSpeed // scroll up 5051 5043 else if (Mouse.CursorPos.y = Screen.height - 1) and 5052 5044 (Mouse.CursorPos.x >= TerrainBtn.Left + TerrainBtn.width) and 5053 5045 (Mouse.CursorPos.x < xRightPanel + 10 - 8) then 5054 dy := speed; // scroll down5046 dy := ScrollSpeed; // scroll down 5055 5047 if (dx <> 0) or (dy <> 0) then 5056 5048 begin … … 6382 6374 begin 6383 6375 IsoEngine.pDebugMap := p; 6384 IsoEngine. Options := IsoEngine.Options and not(1 shl moLocCodes);6376 IsoEngine.MapOptions := IsoEngine.MapOptions - [moLocCodes]; 6385 6377 mLocCodes.Checked := false; 6386 6378 MapValid := false; … … 7706 7698 var 7707 7699 Reg: TRegistry; 7708 DefaultOptionChecked: Integer;7709 begin 7710 DefaultOptionChecked := 1 shl 1 + 1 shl 7 + 1 shl 10 + 1 shl 12 + 1 shl 14 +7711 1 shl 18 + 1 shl 19;7700 DefaultOptionChecked: TSaveOptions; 7701 begin 7702 DefaultOptionChecked := [soEnMoves, soSlowMoves, soNames, soRepScreens, 7703 soSoundOn, soScrollOff, soAlSlowMoves]; 7712 7704 Reg := TRegistry.Create; 7713 7705 with Reg do try … … 7717 7709 xxt := TileSizes[TileSize].X; 7718 7710 yyt := TileSizes[TileSize].Y; 7719 if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')7711 if ValueExists('OptionChecked') then OptionChecked := TSaveOptions(ReadInteger('OptionChecked')) 7720 7712 else OptionChecked := DefaultOptionChecked; 7721 if ValueExists('MapOptionChecked') then MapOptionChecked := ReadInteger('MapOptionChecked')7722 else MapOptionChecked := 1 shl moCityNames;7713 if ValueExists('MapOptionChecked') then MapOptionChecked := TMapOptions(ReadInteger('MapOptionChecked')) 7714 else MapOptionChecked := [moCityNames]; 7723 7715 if ValueExists('CityReport') then CityRepMask := Cardinal(ReadInteger('CityReport')) 7724 7716 else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and 7725 7717 not chCaptured); 7726 if OptionChecked and (7 shl 16) = 0 then 7727 OptionChecked := OptionChecked or (1 shl 16); 7718 if (not (soScrollFast in OptionChecked)) and (not (soScrollSlow in OptionChecked)) and 7719 (not (soScrollOff in OptionChecked)) then 7720 OptionChecked := OptionChecked + [soScrollSlow]; 7728 7721 // old regver with no scrolling 7729 7722 finally … … 7731 7724 end; 7732 7725 7733 if 1 shl 13 and OptionChecked <> 0then7726 if soSoundOff in OptionChecked then 7734 7727 SoundMode := smOff 7735 else if 1 shl 15 and OptionChecked <> 0then7728 else if soSoundOnAlt in OptionChecked then 7736 7729 SoundMode := smOnAlt 7737 7730 else … … 7803 7796 with TButtonC(Sender) do 7804 7797 begin 7805 MapOptionChecked := MapOptionChecked xor (1 shl (Tag shr 8));7798 MapOptionChecked := TMapOptions(Integer(MapOptionChecked) xor (1 shl (Tag shr 8))); 7806 7799 SetMapOptions; 7807 ButtonIndex := MapOptionCheckedshr (Tag shr 8) and 1 + 2;7800 ButtonIndex := Integer(MapOptionChecked) shr (Tag shr 8) and 1 + 2; 7808 7801 end; 7809 7802 if Sender = MapBtn0 then … … 7823 7816 if TButtonBase(Sender).Down then 7824 7817 begin 7825 MapOptionChecked := MapOptionChecked or (1 shl moGreatWall);7818 MapOptionChecked := MapOptionChecked + [moGreatWall]; 7826 7819 TButtonBase(Sender).Hint := ''; 7827 7820 end 7828 7821 else 7829 7822 begin 7830 MapOptionChecked := MapOptionChecked and not(1 shl moGreatWall);7823 MapOptionChecked := MapOptionChecked - [moGreatWall]; 7831 7824 TButtonBase(Sender).Hint := Phrases.Lookup('CONTROLS', 7832 7825 -1 + TButtonBase(Sender).Tag and $FF); … … 7841 7834 if TButtonBase(Sender).Down then 7842 7835 begin 7843 MapOptionChecked := MapOptionChecked or (1 shl moBareTerrain);7836 MapOptionChecked := MapOptionChecked + [moBareTerrain]; 7844 7837 TButtonBase(Sender).Hint := ''; 7845 7838 end 7846 7839 else 7847 7840 begin 7848 MapOptionChecked := MapOptionChecked and not(1 shl moBareTerrain);7841 MapOptionChecked := MapOptionChecked - [moBareTerrain]; 7849 7842 TButtonBase(Sender).Hint := Phrases.Lookup('CONTROLS', 7850 7843 -1 + TButtonBase(Sender).Tag and $FF); … … 7973 7966 end; 7974 7967 7968 procedure TMainScreen.SaveMenuItemsState; 7969 var 7970 i, j: integer; 7971 begin 7972 if soTellAI in OptionChecked then OptionChecked := [soTellAI] 7973 else OptionChecked := []; 7974 for i := 0 to ComponentCount - 1 do 7975 if Components[i] is TMenuItem then 7976 for j := 0 to Length(SaveOption) - 1 do 7977 if TMenuItem(Components[i]).Checked and 7978 (TMenuItem(Components[i]).Tag = SaveOption[j]) then 7979 OptionChecked := OptionChecked + [TSaveOption(j)]; 7980 end; 7981 7975 7982 procedure TMainScreen.SaveSettings; 7976 7983 var 7977 i, j: integer;7978 7984 Reg: TRegistry; 7979 7985 begin 7980 OptionChecked := OptionChecked and soExtraMask; 7981 for i := 0 to ComponentCount - 1 do 7982 if Components[i] is TMenuItem then 7983 for j := 0 to nSaveOption - 1 do 7984 if TMenuItem(Components[i]).Checked and 7985 (TMenuItem(Components[i]).Tag = SaveOption[j]) then 7986 inc(OptionChecked, 1 shl j); 7986 SaveMenuItemsState; 7987 7987 7988 7988 Reg := TRegistry.Create; … … 7991 7991 OpenKey(AppRegistryKey, true); 7992 7992 WriteInteger('TileSize', Integer(TileSize)); 7993 WriteInteger('OptionChecked', OptionChecked);7994 WriteInteger('MapOptionChecked', MapOptionChecked);7993 WriteInteger('OptionChecked', Integer(OptionChecked)); 7994 WriteInteger('MapOptionChecked', Integer(MapOptionChecked)); 7995 7995 WriteInteger('CityReport', integer(CityRepMask)); 7996 7996 finally
Note:
See TracChangeset
for help on using the changeset viewer.