From: Ketmar Dark Date: Fri, 1 Sep 2017 09:37:46 +0000 (+0300) Subject: saving/loading moving panels X-Git-Url: https://deadsoftware.ru/gitweb?a=commitdiff_plain;h=6bd2d9edce694fa161d621cced65cbb1a33692f6;p=d2df-sdl.git saving/loading moving panels --- diff --git a/src/game/g_map.pas b/src/game/g_map.pas index 9470057..5c3a8a1 100644 --- a/src/game/g_map.pas +++ b/src/game/g_map.pas @@ -3010,7 +3010,7 @@ var i := 0; while i < Length(panels) do begin - if panels[i].SaveIt then + if true{panels[i].SaveIt} then begin // ID ïàíåëè: PAMem.WriteInt(i); @@ -3128,7 +3128,7 @@ var for i := 0 to Length(panels)-1 do begin - if panels[i].SaveIt then + if true{panels[i].SaveIt} then begin // ID ïàíåëè: PAMem.ReadInt(id); diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index 3b2830e..634e21b 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -653,8 +653,8 @@ var sig: DWORD; anim: Boolean; begin - if (not SaveIt) or (Mem = nil) then - Exit; + if (Mem = nil) then exit; + //if not SaveIt then exit; // Ñèãíàòóðà ïàíåëè: sig := PANEL_SIGNATURE; // 'PANL' @@ -695,9 +695,10 @@ procedure TPanel.LoadState(var Mem: TBinMemoryReader); var sig: DWORD; anim: Boolean; + ox, oy: Integer; begin - if (not SaveIt) or (Mem = nil) then - Exit; + if (Mem = nil) then exit; + //if not SaveIt then exit; // Ñèãíàòóðà ïàíåëè: Mem.ReadDWORD(sig); @@ -712,8 +713,11 @@ begin // Íîìåð òåêóùåé òåêñòóðû: Mem.ReadInt(FCurTexture); // Êîîðäû + ox := FX; + oy := FY; Mem.ReadInt(FX); Mem.ReadInt(FY); + //e_LogWritefln('panel %s(%s): old=(%s,%s); new=(%s,%s); delta=(%s,%s)', [arrIdx, proxyId, ox, oy, FX, FY, FX-ox, FY-oy]); // Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà: Mem.ReadBoolean(anim); // Åñëè äà - çàãðóæàåì àíèìàöèþ: @@ -733,6 +737,8 @@ begin Mem.ReadInt(mMovingEnd.X); Mem.ReadInt(mMovingEnd.Y); Mem.ReadBoolean(mMovingActive); + + if (proxyId >= 0) then mapGrid.moveBody(proxyId, X, Y); end; end.