X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fshared%2FMAPDEF.pas;h=ad160252dcc5877460d99f413785999aa8df791f;hb=8213065ce7c035c3c2bb8d8b90ab423d42c0a5ac;hp=d22e73f60a6f77aaf4a501e1a2d0cc2c948a40ba;hpb=2fa77a7c9667395ef6d4141cde69ff6349bf301e;p=d2df-sdl.git diff --git a/src/shared/MAPDEF.pas b/src/shared/MAPDEF.pas index d22e73f..ad16025 100644 --- a/src/shared/MAPDEF.pas +++ b/src/shared/MAPDEF.pas @@ -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; @@ -116,6 +122,7 @@ type {$INCLUDE mapdef_help.inc} function trigMonsterId (): Integer; inline; + function trigPanelId (): Integer; inline; // panel index in list private // user fields @@ -145,6 +152,7 @@ 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; // ////////////////////////////////////////////////////////////////////////// // @@ -153,13 +161,14 @@ 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) 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 - setUserField('userPanelId', Integer(v)); + user['userPanelId'] := v; end; @@ -168,16 +177,23 @@ var fld: TDynField; begin fld := field['userPanelTrigRef']; - if (fld = nil) or (fld.baseType <> TDynField.TType.TBool) then result := false else result := (fld.ival <> 0); + 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 - setUserField('userPanelTrigRef', 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 @@ -264,6 +280,16 @@ 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;