DEADSOFTWARE

added some more script functions
authorFGSFDSFGS <derp.primus@gmail.com>
Wed, 29 Jun 2016 00:23:45 +0000 (03:23 +0300)
committerFGSFDSFGS <derp.primus@gmail.com>
Wed, 29 Jun 2016 13:09:01 +0000 (16:09 +0300)
src/game/g_netmsg.pas
src/game/g_panel.pas
src/game/g_saveload.pas

index 1c678ecaf025866271191a651e9f38cb58d65dfd..869da64bf5c6556f5f7ef047c8d0380d40183a18 100644 (file)
@@ -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;
 
index c13693e7b0bc3aa3cefd820bfdd433fb35446973..8897c47f555b88b6dc6dbf70e081cff205b5372c 100644 (file)
@@ -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);
 // Åñëè äà - çàãðóæàåì àíèìàöèþ:
index c77147f87537902a514173bbfe081821576d6a96..f020b9bb69bc77aba28390dd431c50d1c3695550 100644 (file)
@@ -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'