diff --git a/src/shared/MAPDEF.pas b/src/shared/MAPDEF.pas
index ededbdd40c7f885f7d8ea932af4493002678f51d..ad160252dcc5877460d99f413785999aa8df791f 100644 (file)
--- a/src/shared/MAPDEF.pas
+++ b/src/shared/MAPDEF.pas
public
constructor Create (ax, ay: LongInt);
+
+ function isZero (): Boolean; inline;
end;
Char16 = packed array[0..15] of Char;
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;
{$INCLUDE mapdef_help.inc}
function trigMonsterId (): Integer; inline;
+ function trigPanelId (): Integer; inline; // panel index in list
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;
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
// ////////////////////////////////////////////////////////////////////////// //
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['gamePanelId'];
- if (fld = nil) or (fld.baseType <> TDynField.TType.TInt) then result := -1 else result := fld.ival;
+ 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;
-procedure TDynRecordHelper.setGamePanelId (v: Integer); inline;
+function TDynRecordHelper.getUserTrigRef (): Boolean; inline;
+var
+ fld: TDynField;
begin
- setUserField('gamePanelId', Integer(v));
+ 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;
+
+
// ////////////////////////////////////////////////////////////////////////// //
function TDynRecordHelper.getFieldWithType (const aname: AnsiString; atype: TDynField.TType): TDynField; inline;
begin
end;
+// panel index in list
+function TDynRecordHelper.trigPanelId (): Integer; inline;
+var
+ fld: TDynField;
+begin
+ fld := getFieldWithType('panelid', TDynField.TType.TInt);
+ result := fld.recrefIndex;
+end;
+
+
// ////////////////////////////////////////////////////////////////////////// //
function TDynRecordHelper.mapName (): AnsiString; inline; begin result := utf2win(getFieldWithType('name', TDynField.TType.TChar).sval); end;
function TDynRecordHelper.mapAuthor (): AnsiString; inline; begin result := utf2win(getFieldWithType('author', TDynField.TType.TChar).sval); end;