index 927d251f4075f6081af9e7eb989ab51adcc0cace..f27043e12a0cb26addf19793eddde58ad44bb6ba 100644 (file)
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
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);
end;
function r_Map_GetMonsterTexture (m, a: Integer; d: TDirection; out t: TGLMultiTexture; out dx, dy: Integer; out flip: Boolean): Boolean;
- // var c: Integer;
+ var w: Integer;
begin
t := nil; dx := 0; dy := 0; flip := false;
result := MonTextures[m, a, d] <> nil;
end;
if flip then
begin
-// c := (MONSTERTABLE[MonsterType].Rect.X - dx) + MONSTERTABLE[MonsterType].Rect.Width;
-// dx := MTABLE[m].width - c - MONSTERTABLE[MonsterType].Rect.X;
- dx := -dx;
+ if (m = MONSTER_SOUL) and (a = ANIM_DIE) then w := 64 else w := 0;
+ dx := -dx - w;
end;
end;
end;
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