Changeset 327 for trunk/LocalPlayer
- Timestamp:
- Mar 25, 2021, 2:09:42 PM (4 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/ClientTools.pas
r326 r327 16 16 TEnhancementJobs = array [0 .. 11, 0 .. 7] of byte; 17 17 JobResultSet = set of 0 .. 39; 18 19 TMapOption = ( 20 // options switched by buttons 21 moPolitical = 0, moCityNames = 1, moGreatWall = 4, moGrid = 5, moBareTerrain = 6, 22 // other options 23 moEditMode = 16, moLocCodes = 17 24 ); 25 TMapOptions = set of TMapOption; 26 27 TSaveOption = (soAlEffectiveMovesOnly = 0, soEnMoves = 1, soEnAttacks = 2, 28 soEnNoMoves = 3, soWaitTurn = 4, soEffectiveMovesOnly = 5, soEnFastMoves = 6, 29 soSlowMoves = 7, soFastMoves = 8, soVeryFastMoves = 9, soNames = 10, 30 soRepList = 11, soRepScreens = 12, soSoundOff = 13, soSoundOn = 14, 31 soSoundOnAlt = 15, soScrollSlow = 16, soScrollFast = 17, soScrollOff = 18, 32 soAlSlowMoves = 19, soAlFastMoves = 20, somAlNoMoves = 21, soTellAI = 30); 33 TSaveOptions = set of TSaveOption; 18 34 19 35 var -
trunk/LocalPlayer/IsoEngine.pas
r326 r327 66 66 end; 67 67 68 const69 // options switched by buttons70 moPolitical = 0;71 moCityNames = 1;72 moGreatWall = 4;73 moGrid = 5;74 moBareTerrain = 6;75 76 // other options77 moEditMode = 16;78 moLocCodes = 17;79 80 68 var 81 69 NoMap: TIsoMap; 82 Options: Integer;70 MapOptions: TMapOptions; 83 71 pDebugMap: Integer; // -1 for off 84 72 … … 1004 992 begin 1005 993 BehindCityInfo.Loc := Loc - 2 * G.lx; 1006 if ShowCityNames and (Options and (1 shl moEditMode) = 0) and994 if ShowCityNames and not (moEditMode in MapOptions) and 1007 995 (BehindCityInfo.Loc >= 0) and (BehindCityInfo.Loc < G.lx * G.ly) and 1008 996 (MyMap[BehindCityInfo.Loc] and fCity <> 0) then … … 1025 1013 procedure ShowSpacePort; 1026 1014 begin 1027 if ShowObjects and (Options and (1 shl moEditMode) = 0) and1015 if ShowObjects and not (moEditMode in MapOptions) and 1028 1016 (Tile and fCity <> 0) and (CityInfo.Flags and ciSpacePort <> 0) then 1029 1017 TSprite(x + xxt, y - 6, spSpacePort); … … 1093 1081 else 1094 1082 Tile := MyMap[Loc]; 1095 if ShowObjects and (Options and (1 shl moEditMode) = 0) and1083 if ShowObjects and not (moEditMode in MapOptions) and 1096 1084 (Tile and fCity <> 0) then 1097 1085 GetCityInfo(Loc, cix, CityInfo); … … 1148 1136 TSprite(x, y, spMinerals + (Tile shr 25 and 3) * TerrainIconCols); 1149 1137 1150 if Options and (1 shl moEditMode) <> 0then1138 if moEditMode in MapOptions then 1151 1139 fog := (Loc < 0) or (Loc >= G.lx * G.ly) 1152 1140 // else if CityLoc>=0 then … … 1182 1170 end; 1183 1171 {$ENDIF} 1184 if Options and (1 shl moEditMode) <> 0then1172 if moEditMode in MapOptions then 1185 1173 begin 1186 1174 if Tile and fPrefStartPos <> 0 then … … 1427 1415 begin 1428 1416 FoW := true; 1429 ShowLoc := Options and (1 shl moLocCodes) <> 0;1417 ShowLoc := moLocCodes in MapOptions; 1430 1418 ShowDebug := pDebugMap >= 0; 1431 ShowObjects := (CityOwner >= 0) or (Options and (1 shl moBareTerrain) = 0);1419 ShowObjects := (CityOwner >= 0) or not (moBareTerrain in MapOptions); 1432 1420 ShowCityNames := ShowObjects and (CityOwner < 0) and 1433 ( Options and (1 shl moCityNames) <> 0);1421 (moCityNames in MapOptions); 1434 1422 ShowBorder := true; 1435 1423 ShowMyBorder := CityOwner < 0; 1436 ShowGrWall := (CityOwner < 0) and ( Options and (1 shl moGreatWall) <> 0);1424 ShowGrWall := (CityOwner < 0) and (moGreatWall in MapOptions); 1437 1425 if ShowDebug then 1438 1426 Server(sGetDebugMap, me, pDebugMap, DebugMap) … … 1622 1610 else 1623 1611 begin 1624 if ShowLoc or ( Options and (1 shl moEditMode) <> 0) or1625 ( Options and (1 shl moGrid) <> 0) then1612 if ShowLoc or (moEditMode in MapOptions) or 1613 (moGrid in MapOptions) then 1626 1614 PaintGrid(x, y, nx, ny); 1627 1615 for dy := -2 to ny + 1 do -
trunk/LocalPlayer/NatStat.pas
r315 r327 141 141 ScrollDownBtn.Visible := (CurrentReport.TurnOfCivilReport >= 0) and 142 142 (ReportText.Count > ReportLines); 143 if OptionChecked and (1 shl soTellAI) <> 0then143 if soTellAI in OptionChecked then 144 144 TellAIBtn.ButtonIndex := 3 145 145 else … … 390 390 end; 391 391 392 if OptionChecked and (1 shl soTellAI) <> 0 then 393 begin 392 if soTellAI in OptionChecked then begin 394 393 Server(sGetAIInfo, me, pView, ps); 395 394 LoweredTextOut(Canvas, -1, MainTexture, 42, 445, ps); 396 end 397 else 395 end else 398 396 LoweredTextOut(Canvas, -2, MainTexture, 42, 445, 399 397 Phrases2.Lookup('MENU_TELLAI')); … … 537 535 procedure TNatStatDlg.TellAIBtnClick(Sender: TObject); 538 536 begin 539 OptionChecked := OptionChecked xor (1 shl soTellAI); 540 if OptionChecked and (1 shl soTellAI) <> 0 then 537 if soTellAI in OptionChecked then OptionChecked := OptionChecked - [soTellAI] 538 else OptionChecked := OptionChecked + [soTellAI]; 539 if soTellAI in OptionChecked then 541 540 TellAIBtn.ButtonIndex := 3 542 541 else -
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.