summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: af02bc9)
raw | patch | inline | side by side (parent: af02bc9)
author | fgsfds <pvt.fgsfds@gmail.com> | |
Tue, 6 Feb 2018 20:35:42 +0000 (23:35 +0300) | ||
committer | fgsfds <pvt.fgsfds@gmail.com> | |
Tue, 6 Feb 2018 20:35:42 +0000 (23:35 +0300) |
src/game/g_map.pas | patch | blob | history | |
src/game/g_netmsg.pas | patch | blob | history | |
src/game/g_panel.pas | patch | blob | history |
diff --git a/src/game/g_map.pas b/src/game/g_map.pas
index 1ddbffdd052253d446f2163e1f4597294dd445ff..c4e818fe319d289a38fe4f908cc609d89e085811 100644 (file)
--- a/src/game/g_map.pas
+++ b/src/game/g_map.pas
function CreateTrigger (amapIdx: Integer; Trigger: TDynRecord; atpanid, atrigpanid: Integer): Integer;
var
_trigger: TTrigger;
+ tp: TPanel;
begin
result := -1;
if g_Game_IsClient and not (Trigger.TriggerType in [TRIGGER_SOUND, TRIGGER_MUSIC]) then Exit;
ActivateType := Trigger.ActivateType;
Keys := Trigger.Keys;
trigPanelGUID := atrigpanid;
+ // HACK: used in TPanel.CanChangeTexture. maybe there's a better way?
+ if TexturePanelGUID <> -1 then
+ begin
+ tp := g_Map_PanelByGUID(TexturePanelGUID);
+ if (tp <> nil) then tp.hasTexTrigger := True;
+ end;
end;
result := Integer(g_Triggers_Create(_trigger, Trigger));
diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas
index 29e9223af93c0994aa62eab83b0b70c4a03893a7..ce4238a69d454b185a3fc0f57a08ec292a865e30 100644 (file)
--- a/src/game/g_netmsg.pas
+++ b/src/game/g_netmsg.pas
@@ -644,7 +644,7 @@ procedure MH_SEND_Everything(CreatePlayers: Boolean = False; ID: Integer = NET_E
begin
result := false; // don't stop
MH_SEND_PanelState(pan.guid, ID); // anyway, to sync mplats
- if (pan.GetTextureCount > 1) then MH_SEND_PanelTexture(pan.guid, pan.LastAnimLoop, ID);
+ if (pan.CanChangeTexture) then MH_SEND_PanelTexture(pan.guid, pan.LastAnimLoop, ID);
end;
var
diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas
index e88db6b18c7f715304e23662957e504e8984af35..d0eb1ce7dc3ed2ec7e4b5f0e6ac6f12b96a6fccc 100644 (file)
--- a/src/game/g_panel.pas
+++ b/src/game/g_panel.pas
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);
Enabled := True;
Door := False;
LiftType := 0;
+ hasTexTrigger := False;
case PanelType of
PANEL_OPENDOOR: begin Enabled := False; Door := True; end;
Result := Result + 100;
end;
+function TPanel.CanChangeTexture(): Boolean;
+begin
+ Result := (GetTextureCount() > 1) or hasTexTrigger;
+end;
const
PAN_SAVE_VERSION = 1;