DEADSOFTWARE

moving platforms experiment (DO NOT USE YET!)
[d2df-sdl.git] / src / shared / MAPDEF.pas
index a7137162c81c5be25db278bc34b11462913c11a9..8f6a3cefbc4a080e54a1dacc20b173b7ae1f7059 100644 (file)
@@ -40,6 +40,8 @@ type
 
   public
     constructor Create (ax, ay: LongInt);
+
+    function isZero (): Boolean; inline;
   end;
 
   Char16     = packed array[0..15] of Char;
@@ -90,6 +92,10 @@ type
     function Alpha (): Byte; inline;
     function Flags (): Byte; inline;
 
+    function moveSpeed (): TDFPoint; inline;
+    function moveStart (): TDFPoint; inline;
+    function moveEnd (): TDFPoint; inline;
+
     // texture
     function Resource (): AnsiString; inline;
     function Anim (): Boolean; inline;
@@ -117,6 +123,14 @@ type
     {$INCLUDE mapdef_help.inc}
     function trigMonsterId (): Integer; inline;
 
+  private
+    // user fields
+    function getUserPanelId (): Integer; inline;
+    procedure setUserPanelId (v: Integer); inline;
+
+    function getUserTrigRef (): Boolean; inline;
+    procedure setUserTrigRef (v: Boolean); inline;
+
   public
     property panel[idx: Integer]: TDynRecord read getPanelByIdx;
     property panelIndex[pan: TDynRecord]: Integer read getPanelIndex;
@@ -124,6 +138,9 @@ type
     property tgPanelID: Integer read getPanelId {write setPanelId};
     property tgShotPanelID: Integer read getPanelId {write setPanelId};
     property TexturePanel: Integer read getTexturePanel {write setTexturePanel}; // texturepanel, int
+    // user fields
+    property userPanelId: Integer read getUserPanelId write setUserPanelId;
+    property userPanelTrigRef: Boolean read getUserTrigRef write setUserTrigRef;
   end;
 
 implementation
@@ -134,6 +151,46 @@ uses
 
 // ////////////////////////////////////////////////////////////////////////// //
 constructor TDFPoint.Create (ax, ay: LongInt); begin X := ax; Y := ay; end;
+function TDFPoint.isZero (): Boolean; inline; begin result := (X = 0) and (Y = 0); end;
+
+
+// ////////////////////////////////////////////////////////////////////////// //
+function TDynRecordHelper.getUserPanelId (): Integer; inline;
+var
+  fld: TDynField;
+begin
+  fld := field['userPanelId'];
+  //if (fld = nil) or (fld.baseType <> TDynField.TType.TInt) then result := -1 else result := fld.ival;
+  if (fld = nil) then result := -1 else result := Integer(fld.varvalue);
+end;
+
+
+procedure TDynRecordHelper.setUserPanelId (v: Integer); inline;
+begin
+  user['userPanelId'] := v;
+end;
+
+
+function TDynRecordHelper.getUserTrigRef (): Boolean; inline;
+var
+  fld: TDynField;
+begin
+  fld := field['userPanelTrigRef'];
+  if (fld = nil) then result := false else result := Boolean(fld.varvalue);
+  //if (fld = nil) or (fld.baseType <> TDynField.TType.TBool) then result := false else result := (fld.ival <> 0);
+end;
+
+
+procedure TDynRecordHelper.setUserTrigRef (v: Boolean); inline;
+begin
+  user['userPanelTrigRef'] := v;
+end;
+
+
+// ////////////////////////////////////////////////////////////////////////// //
+function TDynRecordHelper.moveSpeed (): TDFPoint; inline; begin result := getPointField('move_speed'); end;
+function TDynRecordHelper.moveStart (): TDFPoint; inline; begin result := getPointField('move_start'); end;
+function TDynRecordHelper.moveEnd (): TDFPoint; inline; begin result := getPointField('move_end'); end;
 
 
 // ////////////////////////////////////////////////////////////////////////// //