X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fgame%2Frenders%2Fopengl%2Fr_map.pas;h=d58daee2ce5516c22223cf3573623312d73f24ec;hb=d0374fd617aa1703e4aa31b8ff3b0f5228636021;hp=927d251f4075f6081af9e7eb989ab51adcc0cace;hpb=a2ba3b4f4ea42350560a7670f3be97a55f6d3ab5;p=d2df-sdl.git diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index 927d251..d58daee 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -584,20 +584,19 @@ implementation end; procedure r_Map_DrawPanel (p: TPanel); - var Texture, spec: Integer; t: TGLMultiTexture; count, frame: LongInt; a: TAnimInfo; + var Texture, x, y, w, h: 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 + r_Common_GetPanelPos(p, x, y, w, h); 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 @@ -608,32 +607,23 @@ implementation a.loop := p.AnimLoop; g_Anim_GetFrameByTime(a, (gTime - p.AnimTime) DIV GAME_TICK, count, frame); end; - r_Draw_TextureRepeat(t.GetTexture(frame), p.x, p.y, p.width, p.height, false, 255, 255, 255, 255 - p.alpha, p.blending); + r_Draw_TextureRepeat(t.GetTexture(frame), x, y, w, h, false, 255, 255, 255, 255 - p.alpha, p.blending); end else if RenTextures[Texture].spec = 0 then begin - r_Draw_TextureRepeat(nil, p.x, p.y, p.width, p.height, false, 255, 255, 255, 255, false); + r_Draw_TextureRepeat(nil, x, y, w, h, false, 255, 255, 255, 255, false); end; + case RenTextures[Texture].spec of + TEXTURE_SPECIAL_WATER: r_Draw_Filter(x, y, x + w, y + h, 0, 0, 255, 255); + TEXTURE_SPECIAL_ACID1: r_Draw_Filter(x, y, x + w, y + h, 0, 230, 0, 255); + TEXTURE_SPECIAL_ACID2: r_Draw_Filter(x, y, x + w, y + h, 230, 0, 0, 255); + end; + end + else + begin + r_Draw_TextureRepeat(nil, x, y, w, h, 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); @@ -763,16 +753,20 @@ implementation end; procedure r_Map_DrawMonster (constref mon: TMonster); - var m, a, xx, yy, dx, dy: Integer; d: TDirection; flip: Boolean; t: TGLMultiTexture; + var m, a, xx, yy, dx, dy: Integer; d, da: TDirection; flip: Boolean; t: TGLMultiTexture; begin m := mon.MonsterType; a := mon.MonsterAnim; d := mon.GameDirection; + (* hack: barrel tracks player, fix it in game logic *) + if m = MONSTER_BARREL then d := TDirection.D_LEFT; + r_Common_GetObjectPos(mon.obj, xx, yy); if r_Map_GetMonsterTexture(m, a, d, t, dx, dy, flip) then begin - r_Draw_MultiTextureRepeat(t, mon.DirAnim[a, d], false, xx + dx, yy + dy, t.width, t.height, flip, 255, 255, 255, 255, false); + da := mon.GameDirection; + r_Draw_MultiTextureRepeat(t, mon.DirAnim[a, da], false, xx + dx, yy + dy, t.width, t.height, flip, 255, 255, 255, 255, false); end; if DebugFrames then begin