X-Git-Url: https://deadsoftware.ru/gitweb?p=d2df-editor.git;a=blobdiff_plain;f=src%2Feditor%2Ff_addresource_texture.pas;h=32a4da1d8b8c96597489e82f5474cb9f50f438ab;hp=86566cfa9627df9eeab1238aed7ad118dd19bc41;hb=8b5918f7194cae0c5cf3fb0d03e677e6d50cf7f8;hpb=797ba76501e5360f4d02d6aade613dc529a24213 diff --git a/src/editor/f_addresource_texture.pas b/src/editor/f_addresource_texture.pas index 86566cf..32a4da1 100644 --- a/src/editor/f_addresource_texture.pas +++ b/src/editor/f_addresource_texture.pas @@ -10,7 +10,11 @@ uses StdCtrls, ExtCtrls, utils, Imaging, ImagingTypes, ImagingUtility; type + + { TAddTextureForm } + TAddTextureForm = class (TAddResourceForm) + lStats: TLabel; PanelTexPreview: TPanel; iPreview: TImage; eTextureName: TEdit; @@ -35,6 +39,7 @@ type var AddTextureForm: TAddTextureForm; + NumFrames: Integer = 0; function IsAnim(Res: String): Boolean; function GetFrame(Res: String; var Data: Pointer; var DataLen: Integer; @@ -142,7 +147,7 @@ begin Exit; end; -// Ищем в них описание анимации - "AINM": +// Ищем в них описание анимации - "ANIM": ok := False; for a := 0 to High(Resources) do if Resources[a] = 'ANIM' then @@ -294,6 +299,9 @@ begin ii^ := clr.b; Inc(ii); ii^ := clr.g; Inc(ii); ii^ := clr.r; Inc(ii); + + (* Why this works in linux? *) + {$IFNDEF WINDOWS}Inc(ii){$ENDIF} end; end; FreeImage(img); @@ -335,6 +343,7 @@ begin // Читаем лист текстур: WAD.GetResource('TEXTURES', config.ReadStr('', 'resource', ''), TextureData, Len); + NumFrames := config.ReadInt('', 'framecount', 0); if (TextureData <> nil) and (WAD.GetLastError = DFWAD_NOERROR) then @@ -394,6 +403,7 @@ procedure TAddTextureForm.FormActivate(Sender: TObject); begin Inherited; + lStats.Caption := ''; cbWADList.Items.Add(_lc[I_WAD_SPECIAL_TEXS]); eTextureName.Text := ''; @@ -407,10 +417,12 @@ procedure TAddTextureForm.lbResourcesListClick(Sender: TObject); var Texture: TBitMap; wad: String; + Anim: Boolean; begin Inherited; + lStats.Caption := ''; if lbResourcesList.ItemIndex = -1 then Exit; if FResourceName = '' then @@ -422,13 +434,20 @@ begin if wad = _lc[I_WAD_SPECIAL_TEXS] then Exit; - if IsAnim(FFullResourceName) then + Anim := IsAnim(FFullResourceName); + if Anim then Texture := ShowAnim(FFullResourceName) else Texture := ShowTGATexture(FFullResourceName); if Texture = nil then Exit; + + if Anim then + lStats.Caption := Format(_lc[I_CAP_ANIMATION], [Texture.Width, Texture.Height, NumFrames]) + else + lStats.Caption := Format(_lc[I_CAP_TEXTURE], [Texture.Width, Texture.Height]); + iPreview.Canvas.FillRect(iPreview.Canvas.ClipRect); iPreview.Canvas.CopyRect(Texture.Canvas.ClipRect, Texture.Canvas, Texture.Canvas.ClipRect); Texture.Free();