X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_panel.pas;h=abdb26d803ce88559ed170b957973e73aa703977;hb=8028f947967b9156e80eea51b7f8b50f3c5862b3;hp=f8a252edf80374a6abc32a59f229d7986f42f046;hpb=1170681f83ea7923ba2c52c6bc201f349a7b9930;p=d2df-sdl.git diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index f8a252e..abdb26d 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -23,16 +23,16 @@ uses MAPDEF, g_textures, xdynrec; type - TAddTextureArray = Array of - record - Texture: Cardinal; - Anim: Boolean; - end; + TAddTextureArray = array of record + Texture: Cardinal; // Textures[Texture] + Anim: Boolean; + end; ATextureID = array of record + Texture: Cardinal; // Textures[Texture] case Anim: Boolean of - False: (Tex: Cardinal); - True: (AnTex: TAnimation); + False: (); + True: (AnTex: TAnimationState); end; PPanel = ^TPanel; @@ -41,8 +41,6 @@ type const private mGUID: Integer; // will be assigned in "g_map.pas" - FTextureWidth: Word; - FTextureHeight: Word; FAlpha: Byte; FBlending: Boolean; FTextureIDs: ATextureID; @@ -195,8 +193,6 @@ type (* private state *) property Alpha: Byte read FAlpha; - property TextureWidth: Word read FTextureWidth; - property TextureHeight: Word read FTextureHeight; property Blending: Boolean read FBlending; property TextureIDs: ATextureID read FTextureIDs; @@ -319,6 +315,8 @@ begin SetLength(FTextureIDs, 1); FTextureIDs[0].Anim := False; +{ + // !!! set this case PanelRec.PanelType of PANEL_WATER: FTextureIDs[0].Tex := LongWord(TEXTURE_SPECIAL_WATER); @@ -327,6 +325,7 @@ begin PANEL_ACID2: FTextureIDs[0].Tex := LongWord(TEXTURE_SPECIAL_ACID2); end; +} FCurTexture := 0; Exit; @@ -344,19 +343,14 @@ begin for i := 0 to Length(FTextureIDs)-1 do begin + FTextureIDs[i].Texture := AddTextures[i].Texture; FTextureIDs[i].Anim := AddTextures[i].Anim; if FTextureIDs[i].Anim then - begin // Àíèìèðîâàííàÿ òåêñòóðà - FTextureIDs[i].AnTex := - TAnimation.Create(Textures[AddTextures[i].Texture].FramesID, - True, Textures[AddTextures[i].Texture].Speed); - FTextureIDs[i].AnTex.Blending := ByteBool(PanelRec.Flags and PANEL_FLAG_BLENDING); - FTextureIDs[i].AnTex.Alpha := PanelRec.Alpha; - end - else - begin // Îáû÷íàÿ òåêñòóðà - FTextureIDs[i].Tex := Textures[AddTextures[i].Texture].TextureID; - end; + begin // Àíèìèðîâàííàÿ òåêñòóðà + FTextureIDs[i].AnTex := TAnimationState.Create(True, Textures[AddTextures[i].Texture].Speed, Textures[AddTextures[i].Texture].FramesCount); + FTextureIDs[i].AnTex.Blending := ByteBool(PanelRec.Flags and PANEL_FLAG_BLENDING); + FTextureIDs[i].AnTex.Alpha := PanelRec.Alpha; + end end; // Òåêñòóð íåñêîëüêî - íóæíî ñîõðàíÿòü òåêóùóþ: @@ -369,15 +363,11 @@ begin if ({PanelRec.TextureNum}tnum > High(Textures)) then begin e_WriteLog(Format('WTF?! tnum is out of limits! (%d : %d)', [tnum, High(Textures)]), TMsgType.Warning); - FTextureWidth := 2; - FTextureHeight := 2; FAlpha := 0; FBlending := ByteBool(0); end else if not g_Map_IsSpecialTexture(Textures[{PanelRec.TextureNum}tnum].TextureName) then begin - FTextureWidth := Textures[{PanelRec.TextureNum}tnum].Width; - FTextureHeight := Textures[{PanelRec.TextureNum}tnum].Height; FAlpha := PanelRec.Alpha; FBlending := ByteBool(PanelRec.Flags and PANEL_FLAG_BLENDING); end; @@ -952,14 +942,20 @@ end; function TPanel.GetTextureID(): DWORD; begin Result := LongWord(TEXTURE_NONE); - - if (FCurTexture >= 0) then - begin +// if (FCurTexture >= 0) then +// begin +// if FTextureIDs[FCurTexture].Anim then +// Result := Textures[FTextureIDs[FCurTexture].Texture].FramesID +// else +// Result := Textures[FTextureIDs[FCurTexture].Texture].TextureID +{ + // !!! old behavior if FTextureIDs[FCurTexture].Anim then Result := FTextureIDs[FCurTexture].AnTex.FramesID else Result := FTextureIDs[FCurTexture].Tex; - end; +} +// end end; function TPanel.GetTextureCount(): Integer;