X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_panel.pas;h=382d6f9880159c3d1ac5db8a772878e56252d8d1;hb=3a76b7e2235c387754facfcccd6e4de45f36a460;hp=854a15c512c5d4b089440b34a8d54bef1cb14684;hpb=f356426288dc03a804636aaa21c0d7e049e628ac;p=d2df-sdl.git diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index 854a15c..382d6f9 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -23,16 +23,15 @@ uses MAPDEF, g_textures, xdynrec; type - TAddTextureArray = Array of - record - Texture: Cardinal; - Anim: Boolean; - end; + TAddTextureArray = array of record + Texture: Cardinal; // Textures[Texture] + 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 +40,6 @@ type const private mGUID: Integer; // will be assigned in "g_map.pas" - FTextureWidth: Word; - FTextureHeight: Word; FAlpha: Byte; FBlending: Boolean; FTextureIDs: ATextureID; @@ -189,8 +186,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; @@ -222,7 +217,7 @@ var implementation uses - e_texture, g_basic, g_map, g_game, g_gfx, g_weapons, g_triggers, + g_basic, g_map, g_game, g_gfx, g_weapons, g_triggers, g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams; const @@ -309,6 +304,8 @@ begin SetLength(FTextureIDs, 1); FTextureIDs[0].Anim := False; +{ + // !!! set this case PanelRec.PanelType of PANEL_WATER: FTextureIDs[0].Tex := LongWord(TEXTURE_SPECIAL_WATER); @@ -317,6 +314,7 @@ begin PANEL_ACID2: FTextureIDs[0].Tex := LongWord(TEXTURE_SPECIAL_ACID2); end; +} FCurTexture := 0; Exit; @@ -334,19 +332,14 @@ begin for i := 0 to Length(FTextureIDs)-1 do begin - FTextureIDs[i].Anim := AddTextures[i].Anim; + FTextureIDs[i].Texture := AddTextures[i].Texture; + FTextureIDs[i].Anim := Textures[AddTextures[i].Texture].FramesCount > 0; 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; // Òåêñòóð íåñêîëüêî - íóæíî ñîõðàíÿòü òåêóùóþ: @@ -359,15 +352,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; @@ -889,14 +878,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;