Changeset 321


Ignore:
Timestamp:
Mar 22, 2021, 10:51:43 PM (10 months ago)
Author:
chronos
Message:
  • Added: Allow to switch between three tile sizes by mouse wheel over map to perform zoom in or zoom out.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Language.txt

    r317 r321  
    542542Patrols, Attacks and Captures Only
    543543Tile Size
     544Small
     545Medium
     546Big
    544547
    545548#ADVANCES
  • trunk/LocalPlayer/IsoEngine.pas

    r318 r321  
    7777function IsJungle(y: integer): boolean;
    7878procedure Init(InitEnemyModelHandler: TInitEnemyModelEvent);
    79 function ApplyTileSize(xxtNew, yytNew: integer): boolean;
     79function ApplyTileSize(ATileSize: TTileSize): boolean;
    8080procedure Done;
    8181procedure Reset;
     
    137137end;
    138138
    139 function ApplyTileSize(xxtNew, yytNew: integer): boolean;
     139function ApplyTileSize(ATileSize: TTileSize): boolean;
    140140var
    141141  i: Integer;
     
    151151  MaskLine: array [0 .. 50 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt
    152152  Border: boolean;
    153 begin
     153  xxtNew: Integer;
     154  yytNew: Integer;
     155begin
     156  xxtNew := TileSizes[ATileSize].X;
     157  yytNew := TileSizes[ATileSize].Y;
    154158  result := false;
    155159  HGrTerrainNew := LoadGraphicSet(Format('Terrain%dx%d.png',
     
    163167  xxt := xxtNew;
    164168  yyt := yytNew;
     169  TileSize := ATileSize;
    165170  HGrTerrain := HGrTerrainNew;
    166171  HGrCities := HGrCitiesNew;
  • trunk/LocalPlayer/Term.lfm

    r288 r321  
    446446        GroupIndex = 1
    447447        object mSmallTiles: TMenuItem
    448           Caption = '40px'
     448          Tag = 97
    449449          RadioItem = True
    450450          OnClick = mSmallTilesClick
    451451        end
    452452        object mNormalTiles: TMenuItem
    453           Caption = '60px'
     453          Tag = 98
    454454          RadioItem = True
    455455          OnClick = mNormalTilesClick
    456456        end
    457457        object mBigTiles: TMenuItem
    458           Caption = '90px'
     458          Tag = 99
    459459          RadioItem = True
    460460          OnClick = mBigTilesClick
  • trunk/LocalPlayer/Term.pas

    r319 r321  
    1919  WM_EOT = WM_USER;
    2020
    21   pltsNormal = 0;
    22   pltsBlink = 1;
    23 
    2421type
     22  TPaintLocTempStyle = (pltsNormal, pltsBlink);
     23  TTileSize = (tsSmall, tsMedium, tsBig);
    2524
    2625  { TMainScreen }
     
    257256    procedure PaintLoc(Loc: integer; Radius: integer = 0);
    258257    procedure PaintLoc_BeforeMove(FromLoc: integer);
    259     procedure PaintLocTemp(Loc: integer; Style: integer = pltsNormal);
     258    procedure PaintLocTemp(Loc: integer; Style: TPaintLocTempStyle = pltsNormal);
    260259    procedure PaintBufferToScreen(xMap, yMap, width, height: integer);
    261260    procedure PaintDestination;
     
    277276    procedure SetViewpoint(p: integer);
    278277    function LocationOfScreenPixel(x, y: integer): integer;
    279     procedure SetTileSize(x, y: integer);
     278    procedure SetTileSize(TileSize: TTileSize);
    280279    procedure RectInvalidate(Left, Top, Rigth, Bottom: integer);
    281280    procedure ShowEnemyShipChange(ShowShipChange: TShowShipChange);
     
    312311    FileName: ShortString;
    313312  end;
     313
    314314  TCityNameInfo = record
    315315    ID: integer;
    316316    NewName: ShortString;
    317317  end;
     318
    318319  TModelNameInfo = record
    319320    mix: integer;
    320321    NewName: ShortString;
    321322  end;
     323
    322324  TPriceSet = Set of $00 .. $FF;
    323325
     
    413415  sbTurn = $10;
    414416  sbAll = $FF;
     417
     418  TileSizes: array [TTileSize] of TPoint = ((X: 33; Y: 16), (X: 48; Y: 24), (X: 72; Y: 36));
    415419
    416420type
     
    434438  AdvIcon: array [0 .. nAdv - 1] of Integer;
    435439  { icons displayed with the technologies }
    436   xxt, yyt, // half of tile size x/y
     440  xxt: Integer; // half of tile size x/y
     441  yyt: Integer; // half of tile size x/y
     442  TileSize: TTileSize;
    437443  GameMode: Integer;
    438444  ClientMode: Integer;
     
    16061612      MiniColors[x, y] := HGrSystem.Data.Canvas.Pixels[66 + x, 67 + y];
    16071613  IsoEngine.Init(InitEnemyModel);
    1608   if not IsoEngine.ApplyTileSize(xxt, yyt) and ((xxt <> 48) or (yyt <> 24) or (xxt <> 72))
    1609   then
    1610     ApplyTileSize(48, 24);
     1614  if not IsoEngine.ApplyTileSize(TileSize) and (TileSize <> tsMedium) then
     1615    ApplyTileSize(tsMedium);
    16111616  // non-default tile size is missing a file, switch to default
    16121617  MainMap := TIsoMap.Create;
     
    35373542    PanelPaint;
    35383543    Update;
     3544  end else begin
     3545    if (WheelDelta > 0) and (TileSize < High(TTileSize)) then SetTileSize(Succ(TileSize))
     3546    else if (WheelDelta < 0) and (TileSize > Low(TTileSize)) then SetTileSize(Pred(TileSize));
    35393547  end;
    35403548end;
     
    39813989end;
    39823990
    3983 procedure TMainScreen.PaintLocTemp(Loc: integer; Style: integer);
     3991procedure TMainScreen.PaintLocTemp(Loc: integer; Style: TPaintLocTempStyle);
    39843992var
    39853993  y0, x0, xMap, yMap: integer;
     
    72957303        end;
    72967304    end;
    7297     mSmallTiles.Checked := xxt = 33;
    7298     mNormalTiles.Checked := xxt = 48;
    7299     mBigTiles.Checked := xxt = 72;
     7305    mSmallTiles.Checked := TileSize = tsSmall;
     7306    mNormalTiles.Checked := TileSize = tsMedium;
     7307    mBigTiles.Checked := TileSize = tsBig;
    73007308  end
    73017309  else if Popup = StatPopup then
     
    77597767  with Reg do try
    77607768    OpenKey(AppRegistryKey, False);
    7761     if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2
    7762       else xxt := 48;
    7763     if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 2
    7764       else yyt := 24;
     7769    if ValueExists('TileSize') then TileSize := TTileSize(ReadInteger('TileSize'))
     7770      else TileSize := tsMedium;
     7771    xxt := TileSizes[TileSize].X;
     7772    yyt := TileSizes[TileSize].Y;
    77657773    if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')
    77667774      else OptionChecked := DefaultOptionChecked;
     
    79917999procedure TMainScreen.mSmallTilesClick(Sender: TObject);
    79928000begin
    7993   SetTileSize(33, 16);
     8001  SetTileSize(tsSmall);
    79948002end;
    79958003
    79968004procedure TMainScreen.mNormalTilesClick(Sender: TObject);
    79978005begin
    7998   SetTileSize(48, 24);
     8006  SetTileSize(tsMedium);
    79998007end;
    80008008
    80018009procedure TMainScreen.mBigTilesClick(Sender: TObject);
    80028010begin
    8003   SetTileSize(72, 36);
    8004 end;
    8005 
    8006 procedure TMainScreen.SetTileSize(x, y: integer);
     8011  SetTileSize(tsBig);
     8012end;
     8013
     8014procedure TMainScreen.SetTileSize(TileSize: TTileSize);
    80078015var
    80088016  i, CenterLoc: integer;
     
    80108018  CenterLoc := (xw + MapWidth div (xxt * 4)) mod G.lx +
    80118019    (yw + MapHeight div (yyt * 2)) * G.lx;
    8012   IsoEngine.ApplyTileSize(x, y);
     8020  IsoEngine.ApplyTileSize(TileSize);
    80138021  FormResize(nil);
    80148022  Centre(CenterLoc);
     
    80368044  try
    80378045    OpenKey(AppRegistryKey, true);
    8038     WriteInteger('TileWidth', xxt * 2);
    8039     WriteInteger('TileHeight', yyt * 2);
     8046    WriteInteger('TileSize', Integer(TileSize));
    80408047    WriteInteger('OptionChecked', OptionChecked);
    80418048    WriteInteger('MapOptionChecked', MapOptionChecked);
     
    80618068
    80628069end.
     8070
  • trunk/Localization/cs/Language.txt

    r317 r321  
    542542Pouze hlídkování, útoky a obsazení
    543543Velikost políčka
     544Malá
     545Střední
     546Velká
    544547
    545548#ADVANCES
  • trunk/Localization/de/Language.txt

    r167 r321  
    551551Nur Angriffe und Eroberungen
    552552Tile Size
     553Small
     554Medium
     555Big
    553556
    554557#ADVANCES
     
    963966#SETTINGS
    964967Full screen
     968Gamma
     969Restart is needed to apply changes
  • trunk/Localization/it/Language.txt

    r167 r321  
    532532Solo pattuglie, attacchi e conquiste
    533533Dimensione casella
     534Small
     535Medium
     536Big
    534537
    535538#ADVANCES
     
    935938#SETTINGS
    936939Full screen
     940Gamma
     941Restart is needed to apply changes
  • trunk/Localization/ru/Language.txt

    r167 r321  
    558558Только военные действия
    559559Размер секции
     560Small
     561Medium
     562Big
    560563
    561564#ADVANCES
     
    970973#SETTINGS
    971974Full screen
     975Gamma
     976Restart is needed to apply changes
  • trunk/Localization/zh-Hans/language.txt

    r167 r321  
    550550Ö»ÏÔʾѲÂß¡¢¹¥»÷¼°Õ¼ÁìÐж¯
    551551µØ¿é³ß´ç
     552Small
     553Medium
     554Big
    552555
    553556#ADVANCES
     
    962965#SETTINGS
    963966Full screen
     967Gamma
     968Restart is needed to apply changes
  • trunk/Localization/zh-Hant/language.txt

    r167 r321  
    550550¥uÅã¥Ü¨µÅÞ¡B§ðÀ»¤Î¥e»â¦æ°Ê
    551551¦a¶ô¤Ø¤o
     552Small
     553Medium
     554Big
    552555
    553556#ADVANCES
     
    962965#SETTINGS
    963966Full screen
     967Gamma
     968Restart is needed to apply changes
Note: See TracChangeset for help on using the changeset viewer.