DEADSOFTWARE

faster particles awakening
[d2df-sdl.git] / src / shared / MAPDEF.pas
index ededbdd40c7f885f7d8ea932af4493002678f51d..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;
@@ -119,8 +125,11 @@ type
 
   private
     // user fields
-    function getGamePanelId (): Integer; inline;
-    procedure setGamePanelId (v: Integer); inline;
+    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;
@@ -130,7 +139,8 @@ type
     property tgShotPanelID: Integer read getPanelId {write setPanelId};
     property TexturePanel: Integer read getTexturePanel {write setTexturePanel}; // texturepanel, int
     // user fields
-    property gamePanelId: Integer read getGamePanelId write setGamePanelId;
+    property userPanelId: Integer read getUserPanelId write setUserPanelId;
+    property userPanelTrigRef: Boolean read getUserTrigRef write setUserTrigRef;
   end;
 
 implementation
@@ -141,24 +151,48 @@ 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.getGamePanelId (): Integer; inline;
+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['gamePanelId'];
-  if (fld = nil) or (fld.baseType <> TDynField.TType.TInt) then result := -1 else result := fld.ival;
+  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.setGamePanelId (v: Integer); inline;
+procedure TDynRecordHelper.setUserTrigRef (v: Boolean); inline;
 begin
-  setUserField('gamePanelId', Integer(v));
+  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;
+
+
 // ////////////////////////////////////////////////////////////////////////// //
 function TDynRecordHelper.getFieldWithType (const aname: AnsiString; atype: TDynField.TType): TDynField; inline;
 begin