summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1d3713f)
raw | patch | inline | side by side (parent: 1d3713f)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Mon, 20 Feb 2023 13:01:01 +0000 (16:01 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Fri, 9 Jun 2023 09:19:04 +0000 (12:19 +0300) |
src/game/g_panel.pas | patch | blob | history | |
src/game/renders/opengl/r_map.pas | patch | blob | history |
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index f259aa3d18492575f0547abf1aae34aa18ec4780..2681f1d43ec1e40e7b50712e0f3f7a5183c3c0ed 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
{ T P a n e l : }
- function FindTextureByName (const name: String): Integer;
- var i: Integer;
+ function GetSpecialTexture (const name: String): Integer;
+ (* HACK: get texture id, if not present -> insert it into list *)
+ (* required for older maps *)
+ var i, len: Integer;
begin
- Result := -1;
+ i := 0; len := 0;
if Textures <> nil then
begin
- for i := 0 to High(Textures) do
- begin
- if Textures[i].TextureName = name then
- begin
- Result := i;
- break;
- end
- end
- end
+ len := Length(Textures);
+ while (i < len) and (Textures[i].TextureName <> name) do
+ Inc(i);
+ end;
+ if i >= len then
+ begin
+ i := len;
+ SetLength(Textures, len + 1);
+ Textures[i].TextureName := name;
+ end;
+ result := i;
end;
constructor TPanel.Create(PanelRec: TDynRecord;
begin
SetLength(FTextureIDs, 1);
case PanelRec.PanelType of
- PANEL_WATER: FTextureIDs[0].Texture := FindTextureByName(TEXTURE_NAME_WATER);
- PANEL_ACID1: FTextureIDs[0].Texture := FindTextureByName(TEXTURE_NAME_ACID1);
- PANEL_ACID2: FTextureIDs[0].Texture := FindTextureByName(TEXTURE_NAME_ACID2);
+ PANEL_WATER: FTextureIDs[0].Texture := GetSpecialTexture(TEXTURE_NAME_WATER);
+ PANEL_ACID1: FTextureIDs[0].Texture := GetSpecialTexture(TEXTURE_NAME_ACID1);
+ PANEL_ACID2: FTextureIDs[0].Texture := GetSpecialTexture(TEXTURE_NAME_ACID2);
end;
FCurTexture := 0;
Exit;
index 927d251f4075f6081af9e7eb989ab51adcc0cace..371b13db5ac8810e30444257144ad501c272054e 100644 (file)
var Texture, spec: Integer; t: TGLMultiTexture; count, frame: LongInt; a: TAnimInfo;
begin
ASSERT(p <> nil);
-
- spec := -1;
+ ASSERT(p.FCurTexture >= -1); (* p.FCurTexture = -1 -> invisible texture *)
if p.FCurTexture >= 0 then
begin
ASSERT(p.FCurTexture <= High(p.TextureIDs));
Texture := p.TextureIDs[p.FCurTexture].Texture;
- ASSERT(Texture >= -1);
+ ASSERT(Texture >= -1); (* Texture = -1 -> texture not found *)
if Texture >= 0 then
begin
ASSERT(Texture <= High(RenTextures));
- spec := RenTextures[Texture].spec;
t := RenTextures[Texture].tex;
if t <> nil then
begin
begin
r_Draw_TextureRepeat(nil, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255, false);
end;
+ case RenTextures[Texture].spec of
+ TEXTURE_SPECIAL_WATER: r_Draw_Filter(p.x, p.y, p.x + p.width, p.y + p.height, 0, 0, 255, 255);
+ TEXTURE_SPECIAL_ACID1: r_Draw_Filter(p.x, p.y, p.x + p.width, p.y + p.height, 0, 230, 0, 255);
+ TEXTURE_SPECIAL_ACID2: r_Draw_Filter(p.x, p.y, p.x + p.width, p.y + p.height, 230, 0, 0, 255);
+ end;
+ end
+ else
+ begin
+ r_Draw_TextureRepeat(nil, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255, false);
end;
end;
-
- // legacy support:
- // older maps may omit textures for fluid panels
- // in such case default filters must be used automatically
- if spec = -1 then
- begin
- case p.PanelType of
- PANEL_WATER: spec := TEXTURE_SPECIAL_WATER;
- PANEL_ACID1: spec := TEXTURE_SPECIAL_ACID1;
- PANEL_ACID2: spec := TEXTURE_SPECIAL_ACID2;
- end;
- end;
-
- case spec of
- TEXTURE_SPECIAL_WATER: r_Draw_Filter(p.x, p.y, p.x + p.width, p.y + p.height, 0, 0, 255, 255);
- TEXTURE_SPECIAL_ACID1: r_Draw_Filter(p.x, p.y, p.x + p.width, p.y + p.height, 0, 230, 0, 255);
- TEXTURE_SPECIAL_ACID2: r_Draw_Filter(p.x, p.y, p.x + p.width, p.y + p.height, 230, 0, 0, 255);
- end;
end;
procedure r_Map_DrawPanels (constref panels: TPanelArray; drawDoors: Boolean = false);