From 0a0eae3ded9e0155ed17dc6990edf8fa836300c0 Mon Sep 17 00:00:00 2001 From: FGSFDSFGS Date: Wed, 29 Jun 2016 03:23:45 +0300 Subject: [PATCH] added some more script functions --- src/game/g_netmsg.pas | 37 ++++++++++++++++++++++++++++++++++++- src/game/g_panel.pas | 8 ++++++++ src/game/g_saveload.pas | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/game/g_netmsg.pas b/src/game/g_netmsg.pas index 1c678ec..869da64 100644 --- a/src/game/g_netmsg.pas +++ b/src/game/g_netmsg.pas @@ -663,14 +663,22 @@ begin for I := Low(gRenderForegrounds) to High(gRenderForegrounds) do if gRenderForegrounds[I] <> nil then with gRenderForegrounds[I] do + begin if (GetTextureCount > 1) then MH_SEND_PanelTexture(PanelType, I, LastAnimLoop, ID); + if Moved then + MH_SEND_PanelState(PanelType, I, ID); + end; if gRenderBackgrounds <> nil then for I := Low(gRenderBackgrounds) to High(gRenderBackgrounds) do if gRenderBackgrounds[I] <> nil then with gRenderBackgrounds[I] do - if GetTextureCount > 1 then + begin + if (GetTextureCount > 1) then MH_SEND_PanelTexture(PanelType, I, LastAnimLoop, ID); + if Moved then + MH_SEND_PanelState(PanelType, I, ID); + end; if gWater <> nil then for I := Low(gWater) to High(gWater) do if gWater[I] <> nil then @@ -1223,6 +1231,16 @@ begin TP := gWalls[PID]; PANEL_LIFTUP, PANEL_LIFTDOWN, PANEL_LIFTLEFT, PANEL_LIFTRIGHT: TP := gLifts[PID]; + PANEL_BACK: + begin + TP := gRenderBackgrounds[PID]; + TP.Moved := True; + end; + PANEL_FORE: + begin + TP := gRenderForegrounds[PID]; + TP.Moved := True; + end; else Exit; end; @@ -1232,6 +1250,8 @@ begin e_Buffer_Write(@NetOut, PID); e_Buffer_Write(@NetOut, Byte(TP.Enabled)); e_Buffer_Write(@NetOut, TP.LiftType); + e_Buffer_Write(@NetOut, TP.X); + e_Buffer_Write(@NetOut, TP.Y); g_Net_Host_Send(ID, True, NET_CHAN_LARGEDATA); end; @@ -2427,12 +2447,15 @@ var E: Boolean; Lift: Byte; PType: Word; + X, Y: Integer; begin if not gGameOn then Exit; PType := e_Raw_Read_Word(P); ID := e_Raw_Read_LongWord(P); E := (e_Raw_Read_Byte(P) <> 0); Lift := e_Raw_Read_Byte(P); + X := e_Raw_Read_LongInt(P); + Y := e_Raw_Read_LongInt(P); case PType of PANEL_WALL, PANEL_OPENDOOR, PANEL_CLOSEDOOR: @@ -2443,6 +2466,18 @@ begin PANEL_LIFTUP, PANEL_LIFTDOWN, PANEL_LIFTLEFT, PANEL_LIFTRIGHT: g_Map_SetLift(ID, Lift); + + PANEL_BACK: + begin + gRenderBackgrounds[ID].X := X; + gRenderBackgrounds[ID].Y := Y; + end; + + PANEL_FORE: + begin + gRenderForegrounds[ID].X := X; + gRenderForegrounds[ID].Y := Y; + end; end; end; diff --git a/src/game/g_panel.pas b/src/game/g_panel.pas index c13693e..8897c47 100644 --- a/src/game/g_panel.pas +++ b/src/game/g_panel.pas @@ -51,6 +51,7 @@ type SaveIt: Boolean; // Ñîõðàíÿòü ïðè SaveState? Enabled: Boolean; Door: Boolean; + Moved: Boolean; LiftType: Byte; LastAnimLoop: Byte; @@ -101,6 +102,7 @@ begin FCurFrame := 0; FCurFrameCount := 0; LastAnimLoop := 0; + Moved := False; // Òèï ïàíåëè: PanelType := PanelRec.PanelType; @@ -467,6 +469,9 @@ begin Mem.WriteByte(LiftType); // Íîìåð òåêóùåé òåêñòóðû: Mem.WriteInt(FCurTexture); +// Êîîðäû + Mem.WriteInt(X); + Mem.WriteInt(Y); // Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà: if (FCurTexture >= 0) and (FTextureIDs[FCurTexture].Anim) then begin @@ -502,6 +507,9 @@ begin Mem.ReadByte(LiftType); // Íîìåð òåêóùåé òåêñòóðû: Mem.ReadInt(FCurTexture); +// Êîîðäû + Mem.ReadInt(X); + Mem.ReadInt(Y); // Àíèìèðîâàííàÿ ëè òåêóùàÿ òåêñòóðà: Mem.ReadBoolean(anim); // Åñëè äà - çàãðóæàåì àíèìàöèþ: diff --git a/src/game/g_saveload.pas b/src/game/g_saveload.pas index c77147f..f020b9b 100644 --- a/src/game/g_saveload.pas +++ b/src/game/g_saveload.pas @@ -37,7 +37,7 @@ uses const SAVE_SIGNATURE = $56534644; // 'DFSV' - SAVE_VERSION = $02; + SAVE_VERSION = $03; END_MARKER_STRING = 'END'; PLAYER_VIEW_SIGNATURE = $57564C50; // 'PLVW' OBJ_SIGNATURE = $4A424F5F; // '_OBJ' -- 2.29.2