diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index 3969cba96bf4fbc02499c462835caa8a69e4394f..0a52568dd4706237bf1506fa881add0d2694c20f 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
Anim: Boolean;
end;
+ PPanel = ^TPanel;
TPanel = Class (TObject)
private
const
tag: Integer; // used in coldets and such; sorry; see g_map.GridTagXXX
proxyId: Integer; // proxy id in map grid (DO NOT USE!)
mapId: AnsiString; // taken directly from map file; dunno why it is here
+ hasTexTrigger: Boolean; // HACK: true when there's a trigger than can change my texture
constructor Create(PanelRec: TDynRecord;
AddTextures: TAddTextureArray;
procedure SetTexture(ID: Integer; AnimLoop: Byte = 0);
function GetTextureID(): Cardinal;
function GetTextureCount(): Integer;
+ function CanChangeTexture(): Boolean;
procedure SaveState (st: TStream);
procedure LoadState (st: TStream);
TPanelArray = Array of TPanel;
+const
+ LIFTTYPE_UP = 0;
+ LIFTTYPE_DOWN = 1;
+ LIFTTYPE_LEFT = 2;
+ LIFTTYPE_RIGHT = 3;
+
var
g_dbgpan_mplat_active: Boolean = {$IF DEFINED(D2F_DEBUG)}true{$ELSE}true{$ENDIF};
g_dbgpan_mplat_step: Boolean = false; // one step, and stop
implementation
uses
+ {$INCLUDE ../nogl/noGLuses.inc}
e_texture, g_basic, g_map, g_game, g_gfx, e_graphics, g_weapons, g_triggers,
- g_console, g_language, g_monsters, g_player, g_grid, e_log, GL, geom, utils, xstreams;
+ g_console, g_language, g_monsters, g_player, g_grid, e_log, geom, utils, xstreams;
const
PANEL_SIGNATURE = $4C4E4150; // 'PANL'
PanelType := PanelRec.PanelType;
Enabled := True;
Door := False;
- LiftType := 0;
+ LiftType := LIFTTYPE_UP;
+ hasTexTrigger := False;
case PanelType of
PANEL_OPENDOOR: begin Enabled := False; Door := True; end;
PANEL_CLOSEDOOR: Door := True;
- PANEL_LIFTUP: LiftType := 0; //???
- PANEL_LIFTDOWN: LiftType := 1;
- PANEL_LIFTLEFT: LiftType := 2;
- PANEL_LIFTRIGHT: LiftType := 3;
+ PANEL_LIFTUP: LiftType := LIFTTYPE_UP; //???
+ PANEL_LIFTDOWN: LiftType := LIFTTYPE_DOWN;
+ PANEL_LIFTLEFT: LiftType := LIFTTYPE_LEFT;
+ PANEL_LIFTRIGHT: LiftType := LIFTTYPE_RIGHT;
end;
// Íåâèäèìàÿ:
begin // Îáû÷íàÿ òåêñòóðà
case FTextureIDs[FCurTexture].Tex of
LongWord(TEXTURE_SPECIAL_WATER): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 0, 255, 0, TBlending.Filter);
- LongWord(TEXTURE_SPECIAL_ACID1): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 128, 0, 0, TBlending.Filter);
- LongWord(TEXTURE_SPECIAL_ACID2): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 128, 0, 0, 0, TBlending.Filter);
+ LongWord(TEXTURE_SPECIAL_ACID1): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 0, 230, 0, 0, TBlending.Filter);
+ LongWord(TEXTURE_SPECIAL_ACID2): e_DrawFillQuad(X, Y, X+Width-1, Y+Height-1, 230, 0, 0, 0, TBlending.Filter);
LongWord(TEXTURE_NONE):
if g_Texture_Get('NOTEXTURE', NoTextureID) then
begin
begin
if (ontop <> nil) then ontop^ := true;
// yes, move with it; but skip steps (no need to process size change here, 'cause platform top cannot be changed with it)
- mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, nil, (GridTagWall or GridTagDoor));
+ mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, (GridTagWall or GridTagDoor));
end
else
begin
trtag := (GridTagWall or GridTagDoor);
// if we're moving down, consider steps too
if (szdy > 0) then trtag := trtag or GridTagStep;
- mapGrid.traceBox(tex, tey, px, py, pw, ph, szdx, szdy, nil, trtag);
+ mapGrid.traceBox(tex, tey, px, py, pw, ph, szdx, szdy, trtag);
end;
end;
end;
trtag := (GridTagWall or GridTagDoor);
// if we're moving down, consider steps too
if (pdy > 0) then trtag := trtag or GridTagStep;
- mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, nil, trtag);
+ mapGrid.traceBox(tex, tey, px, py, pw, ph, pdx, pdy, trtag);
end;
end;
end;
(FTextureIDs[FCurTexture].AnTex <> nil) and
(Width > 0) and (Height > 0) and (FAlpha < 255) then
begin
- FCurFrame := ClampInt(Frame, 0, FTextureIDs[FCurTexture].AnTex.TotalFrames);
+ FCurFrame := ClampInt(Frame, 0, FTextureIDs[FCurTexture].AnTex.TotalFrames - 1);
FCurFrameCount := Count;
FTextureIDs[FCurTexture].AnTex.CurrentFrame := FCurFrame;
FTextureIDs[FCurTexture].AnTex.CurrentCounter := FCurFrameCount;
procedure TPanel.SetTexture(ID: Integer; AnimLoop: Byte = 0);
begin
-// Íåò òåêñòóð:
- if Length(FTextureIDs) = 0 then
- FCurTexture := -1
- else
- // Òîëüêî îäíà òåêñòóðà:
- if Length(FTextureIDs) = 1 then
- begin
- if (ID = 0) or (ID = -1) then
- FCurTexture := ID;
- end
- else
- // Áîëüøå îäíîé òåêñòóðû:
- begin
- if (ID >= -1) and (ID <= High(FTextureIDs)) then
- FCurTexture := ID;
- end;
+ if (ID >= -1) and (ID < Length(FTextureIDs)) then
+ FCurTexture := ID;
// Ïåðåêëþ÷èëèñü íà âèäèìóþ àíèì. òåêñòóðó:
if (FCurTexture >= 0) and FTextureIDs[FCurTexture].Anim then
Result := Result + 100;
end;
+function TPanel.CanChangeTexture(): Boolean;
+begin
+ Result := (GetTextureCount() > 1) or hasTexTrigger;
+end;
const
PAN_SAVE_VERSION = 1;