Changeset 321 for trunk/LocalPlayer
- Timestamp:
- Mar 22, 2021, 10:51:43 PM (4 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/IsoEngine.pas
r318 r321 77 77 function IsJungle(y: integer): boolean; 78 78 procedure Init(InitEnemyModelHandler: TInitEnemyModelEvent); 79 function ApplyTileSize( xxtNew, yytNew: integer): boolean;79 function ApplyTileSize(ATileSize: TTileSize): boolean; 80 80 procedure Done; 81 81 procedure Reset; … … 137 137 end; 138 138 139 function ApplyTileSize( xxtNew, yytNew: integer): boolean;139 function ApplyTileSize(ATileSize: TTileSize): boolean; 140 140 var 141 141 i: Integer; … … 151 151 MaskLine: array [0 .. 50 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt 152 152 Border: boolean; 153 begin 153 xxtNew: Integer; 154 yytNew: Integer; 155 begin 156 xxtNew := TileSizes[ATileSize].X; 157 yytNew := TileSizes[ATileSize].Y; 154 158 result := false; 155 159 HGrTerrainNew := LoadGraphicSet(Format('Terrain%dx%d.png', … … 163 167 xxt := xxtNew; 164 168 yyt := yytNew; 169 TileSize := ATileSize; 165 170 HGrTerrain := HGrTerrainNew; 166 171 HGrCities := HGrCitiesNew; -
trunk/LocalPlayer/Term.lfm
r288 r321 446 446 GroupIndex = 1 447 447 object mSmallTiles: TMenuItem 448 Caption = '40px'448 Tag = 97 449 449 RadioItem = True 450 450 OnClick = mSmallTilesClick 451 451 end 452 452 object mNormalTiles: TMenuItem 453 Caption = '60px'453 Tag = 98 454 454 RadioItem = True 455 455 OnClick = mNormalTilesClick 456 456 end 457 457 object mBigTiles: TMenuItem 458 Caption = '90px'458 Tag = 99 459 459 RadioItem = True 460 460 OnClick = mBigTilesClick -
trunk/LocalPlayer/Term.pas
r319 r321 19 19 WM_EOT = WM_USER; 20 20 21 pltsNormal = 0;22 pltsBlink = 1;23 24 21 type 22 TPaintLocTempStyle = (pltsNormal, pltsBlink); 23 TTileSize = (tsSmall, tsMedium, tsBig); 25 24 26 25 { TMainScreen } … … 257 256 procedure PaintLoc(Loc: integer; Radius: integer = 0); 258 257 procedure PaintLoc_BeforeMove(FromLoc: integer); 259 procedure PaintLocTemp(Loc: integer; Style: integer= pltsNormal);258 procedure PaintLocTemp(Loc: integer; Style: TPaintLocTempStyle = pltsNormal); 260 259 procedure PaintBufferToScreen(xMap, yMap, width, height: integer); 261 260 procedure PaintDestination; … … 277 276 procedure SetViewpoint(p: integer); 278 277 function LocationOfScreenPixel(x, y: integer): integer; 279 procedure SetTileSize( x, y: integer);278 procedure SetTileSize(TileSize: TTileSize); 280 279 procedure RectInvalidate(Left, Top, Rigth, Bottom: integer); 281 280 procedure ShowEnemyShipChange(ShowShipChange: TShowShipChange); … … 312 311 FileName: ShortString; 313 312 end; 313 314 314 TCityNameInfo = record 315 315 ID: integer; 316 316 NewName: ShortString; 317 317 end; 318 318 319 TModelNameInfo = record 319 320 mix: integer; 320 321 NewName: ShortString; 321 322 end; 323 322 324 TPriceSet = Set of $00 .. $FF; 323 325 … … 413 415 sbTurn = $10; 414 416 sbAll = $FF; 417 418 TileSizes: array [TTileSize] of TPoint = ((X: 33; Y: 16), (X: 48; Y: 24), (X: 72; Y: 36)); 415 419 416 420 type … … 434 438 AdvIcon: array [0 .. nAdv - 1] of Integer; 435 439 { 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; 437 443 GameMode: Integer; 438 444 ClientMode: Integer; … … 1606 1612 MiniColors[x, y] := HGrSystem.Data.Canvas.Pixels[66 + x, 67 + y]; 1607 1613 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); 1611 1616 // non-default tile size is missing a file, switch to default 1612 1617 MainMap := TIsoMap.Create; … … 3537 3542 PanelPaint; 3538 3543 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)); 3539 3547 end; 3540 3548 end; … … 3981 3989 end; 3982 3990 3983 procedure TMainScreen.PaintLocTemp(Loc: integer; Style: integer);3991 procedure TMainScreen.PaintLocTemp(Loc: integer; Style: TPaintLocTempStyle); 3984 3992 var 3985 3993 y0, x0, xMap, yMap: integer; … … 7295 7303 end; 7296 7304 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; 7300 7308 end 7301 7309 else if Popup = StatPopup then … … 7759 7767 with Reg do try 7760 7768 OpenKey(AppRegistryKey, False); 7761 if ValueExists('Tile Width') then xxt := ReadInteger('TileWidth') div 27762 else xxt := 48;7763 if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 27764 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; 7765 7773 if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked') 7766 7774 else OptionChecked := DefaultOptionChecked; … … 7991 7999 procedure TMainScreen.mSmallTilesClick(Sender: TObject); 7992 8000 begin 7993 SetTileSize( 33, 16);8001 SetTileSize(tsSmall); 7994 8002 end; 7995 8003 7996 8004 procedure TMainScreen.mNormalTilesClick(Sender: TObject); 7997 8005 begin 7998 SetTileSize( 48, 24);8006 SetTileSize(tsMedium); 7999 8007 end; 8000 8008 8001 8009 procedure TMainScreen.mBigTilesClick(Sender: TObject); 8002 8010 begin 8003 SetTileSize( 72, 36);8004 end; 8005 8006 procedure TMainScreen.SetTileSize( x, y: integer);8011 SetTileSize(tsBig); 8012 end; 8013 8014 procedure TMainScreen.SetTileSize(TileSize: TTileSize); 8007 8015 var 8008 8016 i, CenterLoc: integer; … … 8010 8018 CenterLoc := (xw + MapWidth div (xxt * 4)) mod G.lx + 8011 8019 (yw + MapHeight div (yyt * 2)) * G.lx; 8012 IsoEngine.ApplyTileSize( x, y);8020 IsoEngine.ApplyTileSize(TileSize); 8013 8021 FormResize(nil); 8014 8022 Centre(CenterLoc); … … 8036 8044 try 8037 8045 OpenKey(AppRegistryKey, true); 8038 WriteInteger('TileWidth', xxt * 2); 8039 WriteInteger('TileHeight', yyt * 2); 8046 WriteInteger('TileSize', Integer(TileSize)); 8040 8047 WriteInteger('OptionChecked', OptionChecked); 8041 8048 WriteInteger('MapOptionChecked', MapOptionChecked); … … 8061 8068 8062 8069 end. 8070
Note:
See TracChangeset
for help on using the changeset viewer.