1 (* Copyright (C) DooM 2D:Forever Developers
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 {$INCLUDE ../shared/a_modes.inc}
23 MAPDEF
, BinEditor
, g_textures
, xdynrec
;
26 TAddTextureArray
= Array of
32 TPanel
= Class (TObject
)
41 False: (Tex
: Cardinal);
42 True: (AnTex
: TAnimation
);
45 mMovingSpeed
: TDFPoint
;
46 mMovingStart
: TDFPoint
;
48 mMovingActive
: Boolean;
51 function getx1 (): Integer; inline;
52 function gety1 (): Integer; inline;
53 function getvisvalid (): Boolean; inline;
56 FCurTexture
: Integer; // Íîìåð òåêóùåé òåêñòóðû
60 FWidth
, FHeight
: Word;
62 FSaveIt
: Boolean; // Ñîõðàíÿòü ïðè SaveState?
68 arrIdx
: Integer; // index in one of internal arrays; sorry
69 tag
: Integer; // used in coldets and such; sorry
70 proxyId
: Integer; // proxy id in map grid (DO NOT USE!)
72 constructor Create(PanelRec
: TDynRecord
;
73 AddTextures
: TAddTextureArray
;
75 var Textures
: TLevelTextureArray
);
76 destructor Destroy(); override;
79 procedure DrawShadowVolume(lightX
: Integer; lightY
: Integer; radius
: Integer);
81 procedure SetFrame(Frame
: Integer; Count
: Byte);
82 procedure NextTexture(AnimLoop
: Byte = 0);
83 procedure SetTexture(ID
: Integer; AnimLoop
: Byte = 0);
84 function GetTextureID(): Cardinal;
85 function GetTextureCount(): Integer;
87 procedure SaveState(var Mem
: TBinMemoryWriter
);
88 procedure LoadState(var Mem
: TBinMemoryReader
);
91 property visvalid
: Boolean read getvisvalid
; // panel is "visvalid" when it's width and height are positive
94 property x0
: Integer read FX
;
95 property y0
: Integer read FY
;
96 property x1
: Integer read getx1
; // inclusive!
97 property y1
: Integer read gety1
; // inclusive!
98 property x
: Integer read FX write FX
;
99 property y
: Integer read FY write FY
;
100 property width
: Word read FWidth write FWidth
;
101 property height
: Word read FHeight write FHeight
;
102 property panelType
: Word read FPanelType write FPanelType
;
103 property saveIt
: Boolean read FSaveIt write FSaveIt
; // Ñîõðàíÿòü ïðè SaveState?
104 property enabled
: Boolean read FEnabled write FEnabled
; // Ñîõðàíÿòü ïðè SaveState?
105 property door
: Boolean read FDoor write FDoor
; // Ñîõðàíÿòü ïðè SaveState?
106 property moved
: Boolean read FMoved write FMoved
; // Ñîõðàíÿòü ïðè SaveState?
107 property liftType
: Byte read FLiftType write FLiftType
; // Ñîõðàíÿòü ïðè SaveState?
108 property lastAnimLoop
: Byte read FLastAnimLoop write FLastAnimLoop
; // Ñîõðàíÿòü ïðè SaveState?
110 property movingActive
: Boolean read mMovingActive write mMovingActive
;
113 property movingSpeed
: TDFPoint read mMovingSpeed write mMovingSpeed
;
114 property movingStart
: TDFPoint read mMovingStart write mMovingStart
;
115 property movingEnd
: TDFPoint read mMovingEnd write mMovingEnd
;
118 TPanelArray
= Array of TPanel
;
123 SysUtils
, g_basic
, g_map
, g_game
, g_gfx
, e_graphics
,
124 g_console
, g_language
, g_monsters
, g_player
, e_log
, GL
;
127 PANEL_SIGNATURE
= $4C4E4150; // 'PANL'
131 constructor TPanel
.Create(PanelRec
: TDynRecord
;
132 AddTextures
: TAddTextureArray
;
134 var Textures
: TLevelTextureArray
);
140 Width
:= PanelRec
.Width
;
141 Height
:= PanelRec
.Height
;
149 mMovingSpeed
:= PanelRec
.moveSpeed
;
150 mMovingStart
:= PanelRec
.moveStart
;
151 mMovingEnd
:= PanelRec
.moveEnd
;
152 mMovingActive
:= PanelRec
['move_active'].varvalue
;
155 PanelType
:= PanelRec
.PanelType
;
193 if ByteBool(PanelRec
.Flags
and PANEL_FLAG_HIDE
) then
195 SetLength(FTextureIDs
, 0);
199 // Ïàíåëè, íå èñïîëüçóþùèå òåêñòóðû:
200 if ByteBool(PanelType
and
205 PANEL_BLOCKMON
)) then
207 SetLength(FTextureIDs
, 0);
212 // Åñëè ýòî æèäêîñòü áåç òåêñòóðû - ñïåöòåêñòóðó:
213 if WordBool(PanelType
and (PANEL_WATER
or PANEL_ACID1
or PANEL_ACID2
)) and
214 (not ByteBool(PanelRec
.Flags
and PANEL_FLAG_WATERTEXTURES
)) then
216 SetLength(FTextureIDs
, 1);
217 FTextureIDs
[0].Anim
:= False;
219 case PanelRec
.PanelType
of
221 FTextureIDs
[0].Tex
:= LongWord(TEXTURE_SPECIAL_WATER
);
223 FTextureIDs
[0].Tex
:= LongWord(TEXTURE_SPECIAL_ACID1
);
225 FTextureIDs
[0].Tex
:= LongWord(TEXTURE_SPECIAL_ACID2
);
232 SetLength(FTextureIDs
, Length(AddTextures
));
237 if CurTex
>= Length(FTextureIDs
) then
238 FCurTexture
:= Length(FTextureIDs
) - 1
240 FCurTexture
:= CurTex
;
242 for i
:= 0 to Length(FTextureIDs
)-1 do
244 FTextureIDs
[i
].Anim
:= AddTextures
[i
].Anim
;
245 if FTextureIDs
[i
].Anim
then
246 begin // Àíèìèðîâàííàÿ òåêñòóðà
247 FTextureIDs
[i
].AnTex
:=
248 TAnimation
.Create(Textures
[AddTextures
[i
].Texture
].FramesID
,
249 True, Textures
[AddTextures
[i
].Texture
].Speed
);
250 FTextureIDs
[i
].AnTex
.Blending
:= ByteBool(PanelRec
.Flags
and PANEL_FLAG_BLENDING
);
251 FTextureIDs
[i
].AnTex
.Alpha
:= PanelRec
.Alpha
;
255 begin // Îáû÷íàÿ òåêñòóðà
256 FTextureIDs
[i
].Tex
:= Textures
[AddTextures
[i
].Texture
].TextureID
;
260 // Òåêñòóð íåñêîëüêî - íóæíî ñîõðàíÿòü òåêóùóþ:
261 if Length(FTextureIDs
) > 1 then
264 // Åñëè íå ñïåöòåêñòóðà, òî çàäàåì ðàçìåðû:
265 if PanelRec
.TextureNum
> High(Textures
) then
267 e_WriteLog(Format('WTF?! PanelRec.TextureNum is out of limits! (%d : %d)', [PanelRec
.TextureNum
, High(Textures
)]), MSG_FATALERROR
);
271 FBlending
:= ByteBool(0);
273 else if not g_Map_IsSpecialTexture(Textures
[PanelRec
.TextureNum
].TextureName
) then
275 FTextureWidth
:= Textures
[PanelRec
.TextureNum
].Width
;
276 FTextureHeight
:= Textures
[PanelRec
.TextureNum
].Height
;
277 FAlpha
:= PanelRec
.Alpha
;
278 FBlending
:= ByteBool(PanelRec
.Flags
and PANEL_FLAG_BLENDING
);
282 destructor TPanel
.Destroy();
286 for i
:= 0 to High(FTextureIDs
) do
287 if FTextureIDs
[i
].Anim
then
288 FTextureIDs
[i
].AnTex
.Free();
289 SetLength(FTextureIDs
, 0);
294 function TPanel
.getx1 (): Integer; inline; begin result
:= X
+Width
-1; end;
295 function TPanel
.gety1 (): Integer; inline; begin result
:= Y
+Height
-1; end;
296 function TPanel
.getvisvalid (): Boolean; inline; begin result
:= (Width
> 0) and (Height
> 0); end;
298 procedure TPanel
.Draw();
304 if {Enabled and} (FCurTexture
>= 0) and
305 (Width
> 0) and (Height
> 0) and (FAlpha
< 255) and
306 (g_dbg_scale_05
or g_Collide(X
, Y
, Width
, Height
, sX
, sY
, sWidth
, sHeight
)) then
308 if FTextureIDs
[FCurTexture
].Anim
then
309 begin // Àíèìèðîâàííàÿ òåêñòóðà
310 if FTextureIDs
[FCurTexture
].AnTex
= nil then
313 for xx
:= 0 to (Width
div FTextureWidth
)-1 do
314 for yy
:= 0 to (Height
div FTextureHeight
)-1 do
315 FTextureIDs
[FCurTexture
].AnTex
.Draw(
316 X
+ xx
*FTextureWidth
,
317 Y
+ yy
*FTextureHeight
, M_NONE
);
320 begin // Îáû÷íàÿ òåêñòóðà
321 case FTextureIDs
[FCurTexture
].Tex
of
322 LongWord(TEXTURE_SPECIAL_WATER
):
323 e_DrawFillQuad(X
, Y
, X
+Width
-1, Y
+Height
-1,
324 0, 0, 255, 0, B_FILTER
);
325 LongWord(TEXTURE_SPECIAL_ACID1
):
326 e_DrawFillQuad(X
, Y
, X
+Width
-1, Y
+Height
-1,
327 0, 128, 0, 0, B_FILTER
);
328 LongWord(TEXTURE_SPECIAL_ACID2
):
329 e_DrawFillQuad(X
, Y
, X
+Width
-1, Y
+Height
-1,
330 128, 0, 0, 0, B_FILTER
);
331 LongWord(TEXTURE_NONE
):
332 if g_Texture_Get('NOTEXTURE', NoTextureID
) then
334 e_GetTextureSize(NoTextureID
, @NW
, @NH
);
335 e_DrawFill(NoTextureID
, X
, Y
, Width
div NW
, Height
div NH
,
339 xx
:= X
+ (Width
div 2);
340 yy
:= Y
+ (Height
div 2);
341 e_DrawFillQuad(X
, Y
, xx
, yy
,
343 e_DrawFillQuad(xx
, Y
, X
+Width
-1, yy
,
345 e_DrawFillQuad(X
, yy
, xx
, Y
+Height
-1,
347 e_DrawFillQuad(xx
, yy
, X
+Width
-1, Y
+Height
-1,
352 e_DrawFill(FTextureIDs
[FCurTexture
].Tex
, X
, Y
,
353 Width
div FTextureWidth
,
354 Height
div FTextureHeight
,
355 FAlpha
, True, FBlending
);
361 procedure TPanel
.DrawShadowVolume(lightX
: Integer; lightY
: Integer; radius
: Integer);
362 procedure extrude (x
: Integer; y
: Integer);
364 glVertex2i(x
+(x
-lightX
)*500, y
+(y
-lightY
)*500);
365 //e_WriteLog(Format(' : (%d,%d)', [x+(x-lightX)*300, y+(y-lightY)*300]), MSG_WARNING);
368 procedure drawLine (x0
: Integer; y0
: Integer; x1
: Integer; y1
: Integer);
370 // does this side facing the light?
371 if ((x1
-x0
)*(lightY
-y0
)-(lightX
-x0
)*(y1
-y0
) >= 0) then exit
;
372 //e_WriteLog(Format('lightpan: (%d,%d)-(%d,%d)', [x0, y0, x1, y1]), MSG_WARNING);
373 // this edge is facing the light, extrude and draw it
381 if radius
< 4 then exit
;
382 if Enabled
and (FCurTexture
>= 0) and (Width
> 0) and (Height
> 0) and (FAlpha
< 255) and g_Collide(X
, Y
, Width
, Height
, sX
, sY
, sWidth
, sHeight
) then
384 if not FTextureIDs
[FCurTexture
].Anim
then
386 case FTextureIDs
[FCurTexture
].Tex
of
387 LongWord(TEXTURE_SPECIAL_WATER
): exit
;
388 LongWord(TEXTURE_SPECIAL_ACID1
): exit
;
389 LongWord(TEXTURE_SPECIAL_ACID2
): exit
;
390 LongWord(TEXTURE_NONE
): exit
;
393 if (X
+Width
< lightX
-radius
) then exit
;
394 if (Y
+Height
< lightY
-radius
) then exit
;
395 if (X
> lightX
+radius
) then exit
;
396 if (Y
> lightY
+radius
) then exit
;
397 //e_DrawFill(FTextureIDs[FCurTexture].Tex, X, Y, Width div FTextureWidth, Height div FTextureHeight, FAlpha, True, FBlending);
400 drawLine(x
, y
, x
+width
, y
); // top
401 drawLine(x
+width
, y
, x
+width
, y
+height
); // right
402 drawLine(x
+width
, y
+height
, x
, y
+height
); // bottom
403 drawLine(x
, y
+height
, x
, y
); // left
410 monMoveList
: array of TMonster
= nil;
411 monMoveListUsed
: Integer = 0;
413 procedure TPanel
.Update();
418 function doPush (px
, py
, pw
, ph
: Integer; out dx
, dy
: Integer): Boolean;
420 result
:= g_Collide(px
, py
, pw
, ph
, nx
, ny
, Width
, Height
);
424 if (mMovingSpeed
.X
< 0) then dx
:= nx
-(px
+pw
)
425 else if (mMovingSpeed
.X
> 0) then dx
:= (nx
+Width
)-px
427 if (mMovingSpeed
.Y
< 0) then dy
:= ny
-(py
+ph
)
428 else if (mMovingSpeed
.Y
> 0) then dy
:= (ny
+Height
)-py
438 function monMove (mon
: TMonster
): Boolean;
440 result
:= false; // don't stop
441 mon
.GameX
:= mon
.GameX
+mMovingSpeed
.X
;
442 mon
.GameY
:= mon
.GameY
+mMovingSpeed
.Y
;
443 if (monMoveListUsed
>= Length(monMoveList
)) then SetLength(monMoveList
, monMoveListUsed
+64);
444 monMoveList
[monMoveListUsed
] := mon
;
445 Inc(monMoveListUsed
);
448 function monPush (mon
: TMonster
): Boolean;
450 px
, py
, pw
, ph
, dx
, dy
: Integer;
452 result
:= false; // don't stop
453 mon
.getMapBox(px
, py
, pw
, ph
);
454 if doPush(px
, py
, pw
, ph
, dx
, dy
) then
456 mon
.GameX
:= mon
.GameX
+dx
;
457 mon
.GameY
:= mon
.GameY
+dy
;
458 if (monMoveListUsed
>= Length(monMoveList
)) then SetLength(monMoveList
, monMoveListUsed
+64);
459 monMoveList
[monMoveListUsed
] := mon
;
460 Inc(monMoveListUsed
);
464 procedure plrMove (plr
: TPlayer
);
466 px
, py
, pw
, ph
, dx
, dy
: Integer;
468 if (plr
= nil) then exit
;
469 plr
.getMapBox(px
, py
, pw
, ph
);
473 if doPush(px
, py
, pw
, ph
, dx
, dy
) then
475 plr
.GameX
:= plr
.GameX
+dx
;
476 plr
.GameY
:= plr
.GameY
+dy
;
477 plr
.positionChanged();
481 if (px
+pw
<= X
) then exit
;
482 if (px
>= X
+Width
) then exit
;
483 plr
.GameX
:= plr
.GameX
+mMovingSpeed
.X
;
484 plr
.GameY
:= plr
.GameY
+mMovingSpeed
.Y
;
485 plr
.positionChanged();
489 if Enabled
and (FCurTexture
>= 0) and
490 (FTextureIDs
[FCurTexture
].Anim
) and
491 (FTextureIDs
[FCurTexture
].AnTex
<> nil) and
492 (Width
> 0) and (Height
> 0) and (FAlpha
< 255) then
494 FTextureIDs
[FCurTexture
].AnTex
.Update();
495 FCurFrame
:= FTextureIDs
[FCurTexture
].AnTex
.CurrentFrame
;
496 FCurFrameCount
:= FTextureIDs
[FCurTexture
].AnTex
.CurrentCounter
;
499 if mMovingActive
and (not mMovingSpeed
.isZero
) then
501 monMoveListUsed
:= 0;
502 nx
:= X
+mMovingSpeed
.X
;
503 ny
:= Y
+mMovingSpeed
.Y
;
504 // move monsters on lifts
505 g_Mons_ForEachAt(X
, Y
-1, Width
, 1, monMove
);
507 g_Mons_ForEachAt(nx
, ny
, Width
, Height
, monPush
);
508 // move and push players
509 for f
:= 0 to High(gPlayers
) do plrMove(gPlayers
[f
]);
510 // reverse moving direction, if necessary
511 if (mMovingSpeed
.X
< 0) and (nx
<= mMovingStart
.X
) then mMovingSpeed
.X
:= -mMovingSpeed
.X
512 else if (mMovingSpeed
.X
> 0) and (nx
>= mMovingEnd
.X
) then mMovingSpeed
.X
:= -mMovingSpeed
.X
;
513 if (mMovingSpeed
.Y
< 0) and (ny
<= mMovingStart
.Y
) then mMovingSpeed
.Y
:= -mMovingSpeed
.Y
514 else if (mMovingSpeed
.Y
> 0) and (ny
>= mMovingEnd
.Y
) then mMovingSpeed
.Y
:= -mMovingSpeed
.Y
;
516 g_Mark(X
, Y
, Width
, Height
, MARK_WALL
, false);
519 g_Mark(nx
, ny
, Width
, Height
, MARK_WALL
);
521 if (proxyId
>= 0) then mapGrid
.moveBody(proxyId
, nx
, ny
);
522 // notify moved monsters about their movement
523 for f
:= 0 to monMoveListUsed
-1 do monMoveList
[f
].positionChanged();
527 procedure TPanel
.SetFrame(Frame
: Integer; Count
: Byte);
529 function ClampInt(X
, A
, B
: Integer): Integer;
532 if X
< A
then Result
:= A
else if X
> B
then Result
:= B
;
536 if Enabled
and (FCurTexture
>= 0) and
537 (FTextureIDs
[FCurTexture
].Anim
) and
538 (FTextureIDs
[FCurTexture
].AnTex
<> nil) and
539 (Width
> 0) and (Height
> 0) and (FAlpha
< 255) then
541 FCurFrame
:= ClampInt(Frame
, 0, FTextureIDs
[FCurTexture
].AnTex
.TotalFrames
);
542 FCurFrameCount
:= Count
;
543 FTextureIDs
[FCurTexture
].AnTex
.CurrentFrame
:= FCurFrame
;
544 FTextureIDs
[FCurTexture
].AnTex
.CurrentCounter
:= FCurFrameCount
;
548 procedure TPanel
.NextTexture(AnimLoop
: Byte = 0);
550 Assert(FCurTexture
>= -1, 'FCurTexture < -1');
553 if Length(FTextureIDs
) = 0 then
556 // Òîëüêî îäíà òåêñòóðà:
557 if Length(FTextureIDs
) = 1 then
559 if FCurTexture
= 0 then
565 // Áîëüøå îäíîé òåêñòóðû:
569 // Ñëåäóþùåé íåò - âîçâðàò ê íà÷àëó:
570 if FCurTexture
>= Length(FTextureIDs
) then
574 // Ïåðåêëþ÷èëèñü íà âèäèìóþ àíèì. òåêñòóðó:
575 if (FCurTexture
>= 0) and FTextureIDs
[FCurTexture
].Anim
then
577 if (FTextureIDs
[FCurTexture
].AnTex
= nil) then
579 g_FatalError(_lc
[I_GAME_ERROR_SWITCH_TEXTURE
]);
584 FTextureIDs
[FCurTexture
].AnTex
.Loop
:= True
587 FTextureIDs
[FCurTexture
].AnTex
.Loop
:= False;
589 FTextureIDs
[FCurTexture
].AnTex
.Reset();
592 LastAnimLoop
:= AnimLoop
;
595 procedure TPanel
.SetTexture(ID
: Integer; AnimLoop
: Byte = 0);
598 if Length(FTextureIDs
) = 0 then
601 // Òîëüêî îäíà òåêñòóðà:
602 if Length(FTextureIDs
) = 1 then
604 if (ID
= 0) or (ID
= -1) then
608 // Áîëüøå îäíîé òåêñòóðû:
610 if (ID
>= -1) and (ID
<= High(FTextureIDs
)) then
614 // Ïåðåêëþ÷èëèñü íà âèäèìóþ àíèì. òåêñòóðó:
615 if (FCurTexture
>= 0) and FTextureIDs
[FCurTexture
].Anim
then
617 if (FTextureIDs
[FCurTexture
].AnTex
= nil) then
619 g_FatalError(_lc
[I_GAME_ERROR_SWITCH_TEXTURE
]);
624 FTextureIDs
[FCurTexture
].AnTex
.Loop
:= True
627 FTextureIDs
[FCurTexture
].AnTex
.Loop
:= False;
629 FTextureIDs
[FCurTexture
].AnTex
.Reset();
632 LastAnimLoop
:= AnimLoop
;
635 function TPanel
.GetTextureID(): DWORD
;
637 Result
:= LongWord(TEXTURE_NONE
);
639 if (FCurTexture
>= 0) then
641 if FTextureIDs
[FCurTexture
].Anim
then
642 Result
:= FTextureIDs
[FCurTexture
].AnTex
.FramesID
644 Result
:= FTextureIDs
[FCurTexture
].Tex
;
648 function TPanel
.GetTextureCount(): Integer;
650 Result
:= Length(FTextureIDs
);
651 if Enabled
and (FCurTexture
>= 0) then
652 if (FTextureIDs
[FCurTexture
].Anim
) and
653 (FTextureIDs
[FCurTexture
].AnTex
<> nil) and
654 (Width
> 0) and (Height
> 0) and (FAlpha
< 255) then
655 Result
:= Result
+ 100;
658 procedure TPanel
.SaveState(Var Mem
: TBinMemoryWriter
);
663 if (Mem
= nil) then exit
;
664 //if not SaveIt then exit;
667 sig
:= PANEL_SIGNATURE
; // 'PANL'
669 // Îòêðûòà/çàêðûòà, åñëè äâåðü:
670 Mem
.WriteBoolean(FEnabled
);
671 // Íàïðàâëåíèå ëèôòà, åñëè ëèôò:
672 Mem
.WriteByte(FLiftType
);
673 // Íîìåð òåêóùåé òåêñòóðû:
674 Mem
.WriteInt(FCurTexture
);
678 // Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà:
679 if (FCurTexture
>= 0) and (FTextureIDs
[FCurTexture
].Anim
) then
681 Assert(FTextureIDs
[FCurTexture
].AnTex
<> nil,
682 'TPanel.SaveState: No animation object');
687 Mem
.WriteBoolean(anim
);
688 // Åñëè äà - ñîõðàíÿåì àíèìàöèþ:
690 FTextureIDs
[FCurTexture
].AnTex
.SaveState(Mem
);
691 // moving platform state
692 Mem
.WriteInt(mMovingSpeed
.X
);
693 Mem
.WriteInt(mMovingSpeed
.Y
);
694 Mem
.WriteInt(mMovingStart
.X
);
695 Mem
.WriteInt(mMovingStart
.Y
);
696 Mem
.WriteInt(mMovingEnd
.X
);
697 Mem
.WriteInt(mMovingEnd
.Y
);
698 Mem
.WriteBoolean(mMovingActive
);
701 procedure TPanel
.LoadState(var Mem
: TBinMemoryReader
);
707 if (Mem
= nil) then exit
;
708 //if not SaveIt then exit;
712 if sig
<> PANEL_SIGNATURE
then // 'PANL'
714 raise EBinSizeError
.Create('TPanel.LoadState: Wrong Panel Signature');
716 // Îòêðûòà/çàêðûòà, åñëè äâåðü:
717 Mem
.ReadBoolean(FEnabled
);
718 // Íàïðàâëåíèå ëèôòà, åñëè ëèôò:
719 Mem
.ReadByte(FLiftType
);
720 // Íîìåð òåêóùåé òåêñòóðû:
721 Mem
.ReadInt(FCurTexture
);
727 //e_LogWritefln('panel %s(%s): old=(%s,%s); new=(%s,%s); delta=(%s,%s)', [arrIdx, proxyId, ox, oy, FX, FY, FX-ox, FY-oy]);
728 // Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà:
729 Mem
.ReadBoolean(anim
);
730 // Åñëè äà - çàãðóæàåì àíèìàöèþ:
733 Assert((FCurTexture
>= 0) and
734 (FTextureIDs
[FCurTexture
].Anim
) and
735 (FTextureIDs
[FCurTexture
].AnTex
<> nil),
736 'TPanel.LoadState: No animation object');
737 FTextureIDs
[FCurTexture
].AnTex
.LoadState(Mem
);
739 // moving platform state
740 Mem
.ReadInt(mMovingSpeed
.X
);
741 Mem
.ReadInt(mMovingSpeed
.Y
);
742 Mem
.ReadInt(mMovingStart
.X
);
743 Mem
.ReadInt(mMovingStart
.Y
);
744 Mem
.ReadInt(mMovingEnd
.X
);
745 Mem
.ReadInt(mMovingEnd
.Y
);
746 Mem
.ReadBoolean(mMovingActive
);
748 if (proxyId
>= 0) then mapGrid
.moveBody(proxyId
, X
, Y
);