Changeset 68 for trunk/LocalPlayer
- Timestamp:
- Jan 14, 2017, 8:42:46 PM (8 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Help.pas
r55 r68 960 960 inc(p) 961 961 until (p > length(s)) or (s[p] = '\'); 962 if LoadLocalizedGraphicFile(ExtPic, 'Help' + DirectorySeparator + copy(s, 2, p - 2)) then 962 if LoadGraphicFile(ExtPic, LocalizedFilePath('Help' + 963 DirectorySeparator + copy(s, 2, p - 2))) then 963 964 begin 964 965 MainText.AddLine('', pkExternal); -
trunk/LocalPlayer/IsoEngine.pas
r58 r68 104 104 105 105 function ApplyTileSize(xxtNew, yytNew: integer): boolean; 106 type107 TLine = array [0 .. INFIN, 0 .. 2] of Byte;108 106 var 109 107 i, x, y, xSrc, ySrc, HGrTerrainNew, HGrCitiesNew, age, size: integer; 110 108 LandMore, OceanMore, DitherMask, Mask24: TBitmap; 111 MaskLine: array [0 .. 32 * 3 - 1] of ^TLine; // 32 = assumed maximum for yyt109 MaskLine: array [0 .. 32 * 3 - 1] of TPixelPointer; // 32 = assumed maximum for yyt 112 110 Border: boolean; 113 111 begin … … 346 344 begin 347 345 for i := 0 to yyt * 3 - 1 do 348 MaskLine[i] := Mask24.ScanLine[1 + ySrc * (yyt * 3 + 1) + i];346 MaskLine[i].Init(Mask24, 0, 1 + ySrc * (yyt * 3 + 1) + i); 349 347 for xSrc := 0 to 9 - 1 do 350 348 begin … … 353 351 repeat 354 352 Border := true; 355 for y := 0 to yyt * 3 - 1 do 356 if MaskLine[y]^[1 + xSrc * (xxt * 2 + 1) + TSpriteSize[i].Left, 0] = 0 357 then 358 Border := false; 359 if Border then 360 inc(TSpriteSize[i].Left); 353 for y := 0 to yyt * 3 - 1 do begin 354 MaskLine[y].SetX(1 + xSrc * (xxt * 2 + 1) + TSpriteSize[i].Left); 355 if MaskLine[y].Pixel^.B = 0 then Border := false; 356 end; 357 if Border then Inc(TSpriteSize[i].Left); 361 358 until not Border or (TSpriteSize[i].Left = xxt * 2 - 1); 362 359 TSpriteSize[i].Top := 0; 363 360 repeat 364 361 Border := true; 365 for x := 0 to xxt * 2 - 1 do 366 if MaskLine[TSpriteSize[i].Top]^[1 + xSrc * (xxt * 2 + 1) + x, 0] = 0 367 then 368 Border := false; 369 if Border then 370 inc(TSpriteSize[i].Top); 362 for x := 0 to xxt * 2 - 1 do begin 363 MaskLine[TSpriteSize[i].Top].SetX(1 + xSrc * (xxt * 2 + 1) + x); 364 if MaskLine[TSpriteSize[i].Top].Pixel^.B = 0 then Border := false; 365 end; 366 if Border then inc(TSpriteSize[i].Top); 371 367 until not Border or (TSpriteSize[i].Top = yyt * 3 - 1); 372 368 TSpriteSize[i].Right := xxt * 2; 373 369 repeat 374 370 Border := true; 375 for y := 0 to yyt * 3 - 1 do 376 if MaskLine[y]^[xSrc * (xxt * 2 + 1) + TSpriteSize[i].Right, 0] = 0 377 then 378 Border := false; 379 if Border then 380 dec(TSpriteSize[i].Right); 371 for y := 0 to yyt * 3 - 1 do begin 372 MaskLine[y].SetX(xSrc * (xxt * 2 + 1) + TSpriteSize[i].Right); 373 if MaskLine[y].Pixel^.B = 0 then Border := false; 374 end; 375 if Border then Dec(TSpriteSize[i].Right); 381 376 until not Border or (TSpriteSize[i].Right = TSpriteSize[i].Left); 382 377 TSpriteSize[i].Bottom := yyt * 3; 383 378 repeat 384 379 Border := true; 385 for x := 0 to xxt * 2 - 1 do 386 if MaskLine[TSpriteSize[i].Bottom - 1]^[1 + xSrc * (xxt * 2 + 1) + x, 387 0] = 0 then 388 Border := false; 389 if Border then 390 dec(TSpriteSize[i].Bottom); 380 for x := 0 to xxt * 2 - 1 do begin 381 MaskLine[TSpriteSize[i].Bottom - 1].SetX(1 + xSrc * (xxt * 2 + 1) + x); 382 if MaskLine[TSpriteSize[i].Bottom - 1].Pixel^.B = 0 then Border := false; 383 end; 384 if Border then Dec(TSpriteSize[i].Bottom); 391 385 until not Border or (TSpriteSize[i].Bottom = TSpriteSize[i].Top); 392 386 end … … 930 924 procedure TIsoMap.PaintTileObjects(x, y, Loc, CityLoc, CityOwner: integer; 931 925 UseBlink: boolean); 932 type933 TLine = array [0 .. 9 * 65, 0 .. 2] of Byte;934 926 var 935 927 p1, p2, uix, cix, dy, Loc1, Tile, Multi, Destination: integer; … … 1299 1291 1300 1292 procedure ShadeOutside(x0, y0, x1, y1, xm, ym: integer); 1293 1294 procedure MakeDark(Line: PPixelPointer; Length: Integer); 1295 var 1296 I: Integer; 1297 begin 1298 for I := 0 to Length - 1 do begin 1299 Line^.Pixel^.B := (Line^.Pixel^.B shr 1) and $7f; 1300 Line^.Pixel^.G := (Line^.Pixel^.G shr 1) and $7f; 1301 Line^.Pixel^.R := (Line^.Pixel^.R shr 1) and $7f; 1302 Line^.NextPixel; 1303 end; 1304 end; 1305 1301 1306 const 1302 1307 rShade = 3.75; 1303 1304 procedure MakeDark(Line: pointer; length: integer);1305 type1306 TCardArray = array [0 .. 9999] of Cardinal;1307 PCardArray = ^TCardArray;1308 TByteArray = array [0 .. 9999] of Byte;1309 PByteArray = ^TByteArray;1310 var1311 i, rest: integer;1312 begin1313 for i := length * 3 div 4 - 1 downto 0 do1314 PCardArray(Line)[i] := PCardArray(Line)[i] shr 1 and $7F7F7F7F;1315 rest := (length * 3 div 4) * 4;1316 for i := length * 3 mod 4 - 1 downto 0 do1317 PByteArray(Line)[rest + i] := PByteArray(Line)[rest + i] shr 1 and $7F;1318 end;1319 1320 type1321 TLine = array [0 .. 99999, 0 .. 2] of Byte;1322 1308 var 1323 1309 y, wBright: integer; 1324 1310 y_n, w_n: single; 1325 Line: ^TLine;1311 Line: TPixelPointer; 1326 1312 begin 1327 1313 FOutput.BeginUpdate; 1328 for y := y0 to y1 - 1 do 1329 begin 1330 Line := FOutput.ScanLine[y]; 1314 for y := y0 to y1 - 1 do begin 1315 Line.Init(FOutput, 0, y); 1331 1316 y_n := (y - ym) / yyt; 1332 if abs(y_n) < rShade then 1333 begin1317 if abs(y_n) < rShade then begin 1318 // Darken left and right parts of elipsis 1334 1319 w_n := sqrt(sqr(rShade) - sqr(y_n)); 1335 1320 wBright := trunc(w_n * xxt + 0.5); 1336 MakeDark(@Line[x0], xm - x0 - wBright); 1337 MakeDark(@Line[xm + wBright], x1 - xm - wBright); 1338 end 1339 else 1340 MakeDark(@Line[x0], x1 - x0); 1321 Line.SetX(x0); 1322 MakeDark(@Line, xm - x0 - wBright); 1323 Line.SetX(xm + wBright); 1324 MakeDark(@Line, x1 - xm - wBright); 1325 end else begin 1326 // Darken entire line 1327 Line.SetX(x0); 1328 MakeDark(@Line, x1 - x0); 1329 end; 1341 1330 end; 1342 1331 FOutput.EndUpdate;
Note:
See TracChangeset
for help on using the changeset viewer.