Changeset 315
- Timestamp:
- Mar 18, 2021, 10:58:28 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Draft.pas
r313 r315 275 275 x := xDomain + d * DomainPitch; 276 276 if d = Domain then 277 ImageOp_BCC(offscreen, Templates , x, yDomain, 142, 246 + 37 * d, 36,277 ImageOp_BCC(offscreen, Templates.Data, x, yDomain, 142, 246 + 37 * d, 36, 278 278 36, 0, $00C0FF) 279 279 else 280 ImageOp_BCC(offscreen, Templates , x, yDomain, 142, 246 + 37 * d, 36,280 ImageOp_BCC(offscreen, Templates.Data, x, yDomain, 142, 246 + 37 * d, 36, 281 281 36, 0, $606060); 282 282 end; … … 300 300 for i := 0 to MaxWeight - 1 do 301 301 if i < Weight then 302 ImageOp_BCC(offscreen, Templates , xWeight + 20 * i, yWeight, 123, 400,302 ImageOp_BCC(offscreen, Templates.Data, xWeight + 20 * i, yWeight, 123, 400, 303 303 18, 20, 0, $949494) 304 304 else 305 ImageOp_BCC(offscreen, Templates , xWeight + 20 * i, yWeight, 105, 400,305 ImageOp_BCC(offscreen, Templates.Data, xWeight + 20 * i, yWeight, 105, 400, 306 306 18, 20, 0, $949494); 307 307 end; -
trunk/LocalPlayer/Help.pas
r313 r315 465 465 if ((ScaleToNative(y0) + y) >= 0) and ((ScaleToNative(y0) + y) < ScaleToNative(InnerHeight)) then begin 466 466 PaintPtr := PixelPointer(OffScreen, 0, ScaleToNative(y0) + y); 467 CoalPtr := PixelPointer(Templates , 0, ScaleToNative(yCoal) + y);467 CoalPtr := PixelPointer(Templates.Data, 0, ScaleToNative(yCoal) + y); 468 468 for dy := -1 to 1 do 469 469 if ((Max(y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then -
trunk/LocalPlayer/IsoEngine.pas
r314 r315 628 628 if Flags and unFortified <> 0 then 629 629 begin 630 { DataCanvas:= GrExt[HGrTerrain].Data.Canvas;631 MaskCanvas:= GrExt[HGrTerrain].Mask.Canvas;630 { DataCanvas:=HGrTerrain.Data.Canvas; 631 MaskCanvas:=HGrTerrain.Mask.Canvas; 632 632 TSprite(x,y+16,12*9+7); } 633 633 Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1); -
trunk/LocalPlayer/MessgEx.pas
r313 r315 310 310 Trunc(Screwed[ix, iy, 0] / Screwed[ix, iy, 3]) shl 16; 311 311 312 ImageOp_BCC(LogoBuffer, Templates , 0, 0, xb, yb, wb, hb, clCover, clPage);312 ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, xb, yb, wb, hb, clCover, clPage); 313 313 314 314 BitBltCanvas(ca, x, y, wb, hb, LogoBuffer.Canvas, 0, 0); … … 441 441 BitBltCanvas(Buffer.Canvas, 0, 0, 140, 120, Canvas, 442 442 (ClientWidth - 140) div 2, 24); 443 ImageOp_BCC(Buffer, Templates , 0, 0, 1, 279, 140, 120, 0, $FFFFFF);443 ImageOp_BCC(Buffer, Templates.Data, 0, 0, 1, 279, 140, 120, 0, $FFFFFF); 444 444 BitBltCanvas(Canvas, (ClientWidth - 140) div 2, 24, 140, 120, 445 445 Buffer.Canvas, 0, 0); -
trunk/LocalPlayer/NatStat.pas
r313 r315 82 82 ReportText := TStringList.Create; 83 83 InitButtons(); 84 ContactBtn.Template := Templates ;84 ContactBtn.Template := Templates.Data; 85 85 HelpContext := 'DIPLOMACY'; 86 86 ToggleBtn.Hint := Phrases.Lookup('BTN_SELECT'); -
trunk/LocalPlayer/Select.pas
r313 r315 819 819 BitBltCanvas(ScienceNationDot.Canvas, 0, 0, 17, 17, Canvas, 820 820 xScreen - 10, ClientHeight - 27); 821 ImageOp_BCC(ScienceNationDot, Templates , 0, 0, 114, 211, 17, 17,821 ImageOp_BCC(ScienceNationDot, Templates.Data, 0, 0, 114, 211, 17, 17, 822 822 MainTexture.clBevelShade, Tribe[ScienceNation].Color); 823 823 BitBltCanvas(Canvas, xScreen - 10, ClientHeight - 27, 17, 17, -
trunk/LocalPlayer/TechTree.pas
r295 r315 131 131 NewWidth: Integer; 132 132 NewHeight: Integer; 133 const134 TransparentColor: Cardinal = $7F007F;135 133 begin 136 134 if Image = nil then begin … … 156 154 TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s); 157 155 Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1] 158 := TransparentColor ;156 := TransparentColor2; 159 157 end 160 158 end; … … 171 169 end; 172 170 173 Texturize(Image, Paper, TransparentColor );171 Texturize(Image, Paper, TransparentColor2); 174 172 end; 175 173 -
trunk/LocalPlayer/Term.pas
r314 r315 2547 2547 Jump[0] := 999999; 2548 2548 GameMode := Command; 2549 for i := 0 to GrExt.Count - 1 do 2550 GrExt[i].ResetPixUsed; 2549 GrExt.ResetPixUsed; 2551 2550 IsoEngine.Reset; 2552 2551 Tribes.Init; … … 3512 3511 Canvas.Font.Assign(UniFont[ftSmall]); 3513 3512 InitButtons; 3514 EOT.Template := Templates ;3513 EOT.Template := Templates.Data; 3515 3514 end; 3516 3515 … … 4844 4843 end; 4845 4844 if GameMode <> cMovie then 4846 ImageOp_BCC(TopBar, Templates , 2, 1, 145, 38, 36, 36, $BFBF20, $4040DF);4845 ImageOp_BCC(TopBar, Templates.Data, 2, 1, 145, 38, 36, 36, $BFBF20, $4040DF); 4847 4846 if MyRO.nCity > 0 then 4848 4847 begin … … 4860 4859 4861 4860 // treasury section 4862 ImageOp_BCC(TopBar, Templates , xTreasurySection + 8, 1, 145, 1, 36, 36,4861 ImageOp_BCC(TopBar, Templates.Data, xTreasurySection + 8, 1, 145, 1, 36, 36, 4863 4862 $40A040, $4030C0); 4864 4863 s := IntToStr(TrueMoney); … … 4867 4866 if MyRO.Government <> gAnarchy then 4868 4867 begin 4869 ImageOp_BCC(TopBar, Templates , xTreasurySection + 48, 22, 124, 1, 14, 14,4868 ImageOp_BCC(TopBar, Templates.Data, xTreasurySection + 48, 22, 124, 1, 14, 14, 4870 4869 $0000C0, $0080C0); 4871 4870 if TaxSum >= 0 then … … 4878 4877 4879 4878 // research section 4880 ImageOp_BCC(TopBar, Templates , xResearchSection + 8, 1, 145, 75, 36, 36,4879 ImageOp_BCC(TopBar, Templates.Data, xResearchSection + 8, 1, 145, 75, 36, 36, 4881 4880 $FF0000, $00FFE0); 4882 4881 if MyData.FarTech <> adNexus then … … 4929 4928 if (MyData.FarTech <> adNexus) and (ScienceSum > 0) then 4930 4929 begin 4931 ImageOp_BCC(TopBar, Templates , xResearchSection + 48 + CostFactor + 11,4930 ImageOp_BCC(TopBar, Templates.Data, xResearchSection + 48 + CostFactor + 11, 4932 4931 22, 124, 1, 14, 14, $0000C0, $0080C0); 4933 4932 s := Format(Phrases.Lookup('TECHGAIN'), [ScienceSum]); -
trunk/LocalPlayer/Tribes.pas
r314 r315 466 466 facepix div 10 * 49 + 48] := $000000; 467 467 Gray := $B8B8B8; 468 ImageOp_BCC(faceHGr.Data, Templates ,468 ImageOp_BCC(faceHGr.Data, Templates.Data, 469 469 facepix mod 10 * 65 + 1, facepix div 10 * 49 + 1, 1, 25, 64, 48, 470 470 Gray, Color); -
trunk/Packages/CevoComponents/ButtonA.pas
r290 r315 4 4 5 5 uses 6 ButtonBase, Classes, Graphics, LCLIntf, LCLType, ScreenTools ;6 ButtonBase, Classes, Graphics, LCLIntf, LCLType, ScreenTools, Types; 7 7 8 8 type … … 41 41 42 42 procedure TButtonA.Paint; 43 var 44 TextSize: TSize; 43 45 begin 44 46 with Canvas do 45 if FGraphic <> nil then 46 begin 47 if FGraphic <> nil then begin 47 48 BitBltCanvas(Canvas, 0, 0, 100, 25, Graphic.Canvas, 195, 48 49 243 + 26 * Byte(Down)); 49 50 Canvas.Brush.Style := bsClear; 50 Textout(50 - (TextWidth(FCaption) + 1) div 2, 12 - textheight(FCaption) 51 div 2, FCaption); 52 end 53 else 54 begin 51 TextSize := TextExtent(FCaption); 52 TextOut(50 - (TextSize.Width + 1) div 2, 53 12 - TextSize.Height div 2, FCaption); 54 end else begin 55 55 Brush.Color := $0000FF; 56 56 FrameRect(Rect(0, 0, 100, 25)) -
trunk/Packages/CevoComponents/ScreenTools.pas
r314 r315 40 40 function LoadGraphicFile(Bmp: TBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): boolean; 41 41 function LoadGraphicSet(const Name: string): TGraphicSet; 42 function LoadGraphicSet2(const Name: string): TGraphicSet; 42 43 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer); 43 44 procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer); … … 107 108 108 109 const 110 TransparentColor1 = $FF00FF; 111 TransparentColor2 = $7F007F; 112 109 113 wMainTexture = 640; 110 114 hMainTexture = 480; 111 115 112 // template positions in Template .bmp116 // template positions in Templates.png 113 117 xLogo = 1; 114 118 yLogo = 1; … … 172 176 CityMark2: TGraphicSetItem; 173 177 Ornament: TGraphicSetItem; 178 Logo: TGraphicSetItem; 174 179 ClickFrameColor: Integer; 175 180 MainTextureAge: Integer; 176 181 MainTexture: TTexture; 177 Templates: T Bitmap;182 Templates: TGraphicSet; 178 183 Colors: TBitmap; 179 184 Paper: TBitmap; … … 474 479 x: Integer; 475 480 y: Integer; 476 xmax: Integer;477 481 OriginalColor: Integer; 478 482 FileName: string; … … 484 488 Result := GrExt.AddNew(Name); 485 489 FileName := GetGraphicsDir + DirectorySeparator + Name; 486 if not LoadGraphicFile(Result.Data, FileName) then begin 490 // Do not apply gamma during file load as it would affect also transparency colors 491 if not LoadGraphicFile(Result.Data, FileName, [gfNoGamma]) then begin 487 492 Result := nil; 488 493 Exit; … … 494 499 495 500 Result.ResetPixUsed; 496 497 xmax := Result.Data.Width - 1; // allows 4-byte access even for last pixel498 // Why there was that limit?499 //if xmax > 970 then500 // xmax := 970;501 501 502 502 Result.Mask.SetSize(Result.Data.Width, Result.Data.Height); … … 507 507 MaskPixel := PixelPointer(Result.Mask); 508 508 for y := 0 to ScaleToNative(Result.Data.Height) - 1 do begin 509 for x := 0 to ScaleToNative( xmax) - 1 do begin509 for x := 0 to ScaleToNative(Result.Data.Width) - 1 do begin 510 510 OriginalColor := DataPixel.Pixel^.ARGB and $FFFFFF; 511 if (OriginalColor = $FF00FF) or (OriginalColor = $7F007F) then 512 begin // transparent 513 MaskPixel.Pixel^.ARGB := $FFFFFF; 514 DataPixel.Pixel^.ARGB := DataPixel.Pixel^.ARGB and $FF000000; 515 end 516 else begin 517 MaskPixel.Pixel^.ARGB := $000000; // non-transparent 518 if Gamma <> 100 then 519 DataPixel.Pixel^ := ApplyGammaToPixel(DataPixel.Pixel^); 511 if (OriginalColor = TransparentColor1) or (OriginalColor = TransparentColor2) then begin 512 MaskPixel.Pixel^.R := $FF; 513 MaskPixel.Pixel^.G := $FF; 514 MaskPixel.Pixel^.B := $FF; 515 DataPixel.Pixel^.R := 0; 516 DataPixel.Pixel^.G := 0; 517 DataPixel.Pixel^.B := 0; 518 end else begin 519 MaskPixel.Pixel^.R := $00; 520 MaskPixel.Pixel^.G := $00; 521 MaskPixel.Pixel^.B := $00; 520 522 end; 521 523 DataPixel.NextPixel; … … 527 529 Result.Data.EndUpdate; 528 530 Result.Mask.EndUpdate; 531 532 if Gamma <> 100 then 533 ApplyGammaToBitmap(Result.Data); 534 end; 535 end; 536 537 function LoadGraphicSet2(const Name: string): TGraphicSet; 538 var 539 FileName: string; 540 begin 541 Result := GrExt.SearchByName(Name); 542 if not Assigned(Result) then begin 543 Result := GrExt.AddNew(Name); 544 FileName := GetGraphicsDir + DirectorySeparator + Name; 545 if not LoadGraphicFile(Result.Data, FileName, [gfNoGamma]) then begin 546 Result := nil; 547 Exit; 548 end; 549 550 FileName := ExtractFileNameWithoutExt(FileName) + GraphicSetFileExt; 551 if FileExists(FileName) then 552 Result.LoadFromFile(FileName); 553 554 Result.ResetPixUsed; 529 555 end; 530 556 end; … … 1114 1140 procedure Corner(ca: TCanvas; x, y, Kind: Integer; const T: TTexture); 1115 1141 begin 1116 { BitBltCanvas(ca,x,y,8,8, GrExt[T.HGr].Mask.Canvas,1142 { BitBltCanvas(ca,x,y,8,8,T.HGr.Mask.Canvas, 1117 1143 T.xGr+29+Kind*9,T.yGr+89,SRCAND); 1118 BitBltCanvas(ca,x,y,8,8, GrExt[T.HGr].Data.Canvas,1144 BitBltCanvas(ca,x,y,8,8,T.HGr.Data.Canvas, 1119 1145 T.xGr+29+Kind*9,T.yGr+89,SRCPAINT); } 1120 1146 end; … … 1134 1160 sp: string; 1135 1161 shadow: Boolean; 1162 Text: string; 1136 1163 begin 1137 1164 Inc(x); … … 1157 1184 else 1158 1185 begin 1159 Textout(xp, y, copy(sp, 1, p - 1)); 1160 Inc(xp, ca.TextWidth(copy(sp, 1, p - 1))); 1186 Text := Copy(sp, 1, p - 1); 1187 Textout(xp, y, Text); 1188 Inc(xp, ca.TextWidth(Text)); 1161 1189 if not shadow then 1162 1190 case sp[p + 1] of … … 1471 1499 LogoBuffer.Canvas.FillRect(0, 0, LogoBuffer.Width, LogoBuffer.Height); 1472 1500 BitBltCanvas(LogoBuffer.Canvas, 0, 0, wLogo, hLogo, ca, x, y); 1473 ImageOp_BCC(LogoBuffer, Templates , 0, 0, 1, 1, wLogo, hLogo,1501 ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, 1, 1, wLogo, hLogo, 1474 1502 clLight, clShade); 1475 1503 BitBltCanvas(ca, x, y, wLogo, hLogo, LogoBuffer.Canvas, 0, 0); … … 1653 1681 LoadPhrases; 1654 1682 LoadFonts; 1655 LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator + 1656 'Templates.png', [gfNoGamma]); 1683 Templates := LoadGraphicSet2('Templates.png'); 1657 1684 LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png'); 1658 1685 LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg'); … … 1688 1715 Ornament := HGrSystem2.GetItem('Ornament'); 1689 1716 1690 Templates := TBitmap.Create;1691 Templates.PixelFormat := pf24bit;1692 1717 Colors := TBitmap.Create; 1693 1718 Colors.PixelFormat := pf24bit; … … 1706 1731 1707 1732 procedure UnitDone; 1708 var1709 I: Integer;1710 1733 begin 1711 1734 RestoreResolution; … … 1717 1740 FreeAndNil(BigImp); 1718 1741 FreeAndNil(Paper); 1719 FreeAndNil(Templates);1720 1742 FreeAndNil(Colors); 1721 1743 FreeAndNil(MainTexture.Image); -
trunk/Packages/CevoComponents/UGraphicSet.pas
r314 r315 60 60 function SearchByName(Name: string): TGraphicSet; 61 61 function AddNew(Name: string): TGraphicSet; 62 procedure ResetPixUsed; 62 63 end; 63 64 … … 259 260 end; 260 261 262 procedure TGraphicSets.ResetPixUsed; 263 var 264 I: Integer; 265 begin 266 for I := 0 to Count - 1 do 267 Items[I].ResetPixUsed; 268 end; 269 261 270 end. 262 271 -
trunk/Start.pas
r314 r315 5 5 6 6 uses 7 GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, 7 GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Types, 8 8 LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls, 9 9 Menus, Registry, DrawDlg, fgl, Protocol; … … 671 671 AIBrains: TBrains; 672 672 I: Integer; 673 TextSize: TSize; 673 674 begin 674 675 AIBrains := TBrains.Create(False); … … 684 685 Font.Style := []; 685 686 Font.Color := $5FDBFF; 686 Textout(32 - TextWidth(FileName) div 2, 687 32 - TextHeight(FileName) div 2, FileName); 687 TextSize := TextExtent(FileName); 688 Textout(32 - TextSize.Width div 2, 689 32 - TextSize.Height div 2, FileName); 688 690 end; 689 691 end; … … 830 832 3 + 2 * integer(Tab <> tbMain)); 831 833 832 ImageOp_BCC(LogoBuffer, Templates , 0, 0, 145, 38, 36, 27, $BFBF20, $4040DF);834 ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, 145, 38, 36, 27, $BFBF20, $4040DF); 833 835 // logo part 1 834 ImageOp_BCC(LogoBuffer, Templates , 10, 27, 155, 38 + 27, 26, 9, $BFBF20,836 ImageOp_BCC(LogoBuffer, Templates.Data, 10, 27, 155, 38 + 27, 26, 9, $BFBF20, 835 837 $4040DF); // logo part 2 836 838 BitBltCanvas(Canvas, 6, 3 + 2 * integer(Tab <> tbMain), 36, 36, … … 879 881 BitBltCanvas(LogoBuffer.Canvas, 0, 0, 91, 25, Canvas, 880 882 xActionIcon, y + 2); 881 ImageOp_BCC(LogoBuffer, Templates , 0, 0, 1, 400, 91, 25, 0,883 ImageOp_BCC(LogoBuffer, Templates.Data, 0, 0, 1, 400, 91, 25, 0, 882 884 Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText]); 883 885 BitBltCanvas(Canvas, xActionIcon, y + 2, 91, 25,
Note:
See TracChangeset
for help on using the changeset viewer.