mirror of
https://github.com/moparisthebest/Simba
synced 2025-01-30 14:50:18 -05:00
Fixed bug with open parameter. Added new TPA function. Fixed bug with interpreter where it wouldn't return right in case of a class as result.
This commit is contained in:
parent
12fca93826
commit
486e22d0db
@ -1418,13 +1418,13 @@ var
|
|||||||
ErrorMsg : string;
|
ErrorMsg : string;
|
||||||
begin
|
begin
|
||||||
DoRun := false;
|
DoRun := false;
|
||||||
if Paramcount = 1 then
|
if (Paramcount = 1) and not (Application.HasOption('open')) then
|
||||||
begin
|
begin
|
||||||
if FileExists(ParamStr(1)) then
|
if FileExists(ParamStr(1)) then
|
||||||
LoadScriptFile(paramstr(1));
|
LoadScriptFile(paramstr(1));
|
||||||
end else
|
end else
|
||||||
begin;
|
begin;
|
||||||
ErrorMsg:=Application.CheckOptions('ro:','run open:');
|
ErrorMsg:=Application.CheckOptions('ro:',['run','open:']);
|
||||||
if ErrorMsg <> '' then
|
if ErrorMsg <> '' then
|
||||||
mDebugLn(ErrorMSG)
|
mDebugLn(ErrorMSG)
|
||||||
else
|
else
|
||||||
|
@ -133,6 +133,16 @@ begin
|
|||||||
FilterPointsPie(points,sd,ed,minr,maxr,mx,my);
|
FilterPointsPie(points,sd,ed,minr,maxr,mx,my);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ps_FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer); extdecl;
|
||||||
|
begin
|
||||||
|
FilterPointsDist(points,mindist,maxdist,mx,my);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure ps_FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);extdecl;
|
||||||
|
begin
|
||||||
|
FilterPointsLine(points,radial,radius,mx,my);
|
||||||
|
end;
|
||||||
|
|
||||||
function ps_GetATPABounds(const ATPA: T2DPointArray): TBox;extdecl;
|
function ps_GetATPABounds(const ATPA: T2DPointArray): TBox;extdecl;
|
||||||
begin
|
begin
|
||||||
result := GetATPABounds(ATPA);
|
result := GetATPABounds(ATPA);
|
||||||
@ -355,11 +365,6 @@ begin
|
|||||||
Res := ReturnPointsNotInTPA(TotalTPA,box);
|
Res := ReturnPointsNotInTPA(TotalTPA,box);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ps_FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);extdecl;
|
|
||||||
begin
|
|
||||||
FilterPointsLine(points,radial,radius,mx,my);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function ps_SameTPA(const aTPA, bTPA: TPointArray): Boolean;extdecl;
|
function ps_SameTPA(const aTPA, bTPA: TPointArray): Boolean;extdecl;
|
||||||
begin
|
begin
|
||||||
result := SameTPA(atpa,btpa);
|
result := SameTPA(atpa,btpa);
|
||||||
|
@ -339,6 +339,8 @@ AddFunction(@ps_SplitTPAEx,'function SplitTPAEx(const arr: TPointArray; w, h: In
|
|||||||
AddFunction(@ps_SplitTPA,'function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;');
|
AddFunction(@ps_SplitTPA,'function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;');
|
||||||
AddFunction(@ps_FloodFillTPA,'function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;');
|
AddFunction(@ps_FloodFillTPA,'function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;');
|
||||||
AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);');
|
AddFunction(@ps_FilterPointsPie,'procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);');
|
||||||
|
AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);');
|
||||||
|
AddFunction(@ps_filterpointsdist,'procedure FilterPointsDist(var Points: TPointArray; const MinDist, MaxDist: Extended; Mx, My: Integer);');
|
||||||
AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;');
|
AddFunction(@ps_GetATPABounds,'function GetATPABounds(const ATPA: T2DPointArray): TBox;');
|
||||||
AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;');
|
AddFunction(@ps_GetTPABounds,'function GetTPABounds(const TPA: TPointArray): TBox;');
|
||||||
AddFunction(@ps_FindTPAinTPA,'function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;');
|
AddFunction(@ps_FindTPAinTPA,'function FindTPAinTPA(const SearchTPA, TotalTPA: TPointArray; var Matches: TPointArray): Boolean;');
|
||||||
@ -386,7 +388,6 @@ AddFunction(@ps_TPAFromBoxWrap,'procedure TPAFromBoxWrap(const Box : TBox; var R
|
|||||||
AddFunction(@ps_RotatePointsWrap,'procedure RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; var Res : TPointArray);');
|
AddFunction(@ps_RotatePointsWrap,'procedure RotatePointsWrap(Const P: TPointArray; A, cx, cy: Extended; var Res : TPointArray);');
|
||||||
AddFunction(@ps_FindTPAEdgesWrap,'procedure FindTPAEdgesWrap(const p: TPointArray; var Res : TPointArray);');
|
AddFunction(@ps_FindTPAEdgesWrap,'procedure FindTPAEdgesWrap(const p: TPointArray; var Res : TPointArray);');
|
||||||
AddFunction(@ps_ClearTPAFromTPAWrap,'procedure ClearTPAFromTPAWrap(const arP, ClearPoints: TPointArray; var Res : TPointArray);');
|
AddFunction(@ps_ClearTPAFromTPAWrap,'procedure ClearTPAFromTPAWrap(const arP, ClearPoints: TPointArray; var Res : TPointArray);');
|
||||||
AddFunction(@ps_FilterPointsLine,'procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);');
|
|
||||||
AddFunction(@ps_SameTPA,'function SameTPA(const aTPA, bTPA: TPointArray): Boolean;');
|
AddFunction(@ps_SameTPA,'function SameTPA(const aTPA, bTPA: TPointArray): Boolean;');
|
||||||
AddFunction(@ps_TPAInATPA,'function TPAInATPA(const TPA: TPointArray;const InATPA: T2DPointArray; var Index: LongInt): Boolean;');
|
AddFunction(@ps_TPAInATPA,'function TPAInATPA(const TPA: TPointArray;const InATPA: T2DPointArray; var Index: LongInt): Boolean;');
|
||||||
AddFunction(@ps_offsetTPA,'procedure OffsetTPA(var TPA : TPointArray; const Offset : TPoint);');
|
AddFunction(@ps_offsetTPA,'procedure OffsetTPA(var TPA : TPointArray; const Offset : TPoint);');
|
||||||
|
@ -595,7 +595,7 @@ begin
|
|||||||
Result := TMufasaBitmap.Create;
|
Result := TMufasaBitmap.Create;
|
||||||
Result.SetSize(xe-xs+1, ye-ys+1);
|
Result.SetSize(xe-xs+1, ye-ys+1);
|
||||||
for i := ys to ye do
|
for i := ys to ye do
|
||||||
Move(self.FData[i * self.w + xs], Result.FData[i-ys],result.Width * SizeOf(TRGB32));
|
Move(self.FData[i * self.w + xs], Result.FData[(i-ys) * result.w],result.Width * SizeOf(TRGB32));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMufasaBitmap.ToTBitmap: TBitmap;
|
function TMufasaBitmap.ToTBitmap: TBitmap;
|
||||||
|
@ -65,6 +65,7 @@ function SplitTPAEx(const arr: TPointArray; w, h: Integer): T2DPointArray;
|
|||||||
function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;
|
function SplitTPA(const arr: TPointArray; Dist: Integer): T2DPointArray;
|
||||||
function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;
|
function FloodFillTPA(const TPA : TPointArray) : T2DPointArray;
|
||||||
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
|
procedure FilterPointsPie(var Points: TPointArray; const SD, ED, MinR, MaxR: Extended; Mx, My: Integer);
|
||||||
|
procedure FilterPointsDist(var Points: TPointArray; const MinDist,MaxDist: Extended; Mx, My: Integer);
|
||||||
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
|
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
|
||||||
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
|
function RemoveDistTPointArray(x, y, dist: Integer;const ThePoints: TPointArray; RemoveHigher: Boolean): TPointArray;
|
||||||
function GetATPABounds(const ATPA: T2DPointArray): TBox;
|
function GetATPABounds(const ATPA: T2DPointArray): TBox;
|
||||||
@ -1101,9 +1102,37 @@ begin
|
|||||||
Points := G;
|
Points := G;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{/\
|
||||||
|
Removes the points that don't have a dist between mindist/maxdist with (mx,my)
|
||||||
|
/\}
|
||||||
|
|
||||||
|
procedure FilterPointsDist(var Points: TPointArray; const MinDist,
|
||||||
|
MaxDist: Extended; Mx, My: Integer);
|
||||||
|
var
|
||||||
|
c,i,l : integer;
|
||||||
|
d : extended;
|
||||||
|
mind,maxd : extended;
|
||||||
|
begin
|
||||||
|
l := high(points);
|
||||||
|
c := 0;
|
||||||
|
mind := sqr(mindist);
|
||||||
|
maxd := sqr(maxdist);
|
||||||
|
for i := 0 to l do
|
||||||
|
begin
|
||||||
|
d := sqr(Points[i].x - mx) + sqr(points[i].y - my);
|
||||||
|
if (d >= mind) and (d <= maxd) then
|
||||||
|
begin
|
||||||
|
points[c] := points[i];
|
||||||
|
inc(c);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
setlength(points,c);
|
||||||
|
end;
|
||||||
|
|
||||||
{/\
|
{/\
|
||||||
Removes the points in the TPointArray Points that are not on the line defined by angle, radius and center.
|
Removes the points in the TPointArray Points that are not on the line defined by angle, radius and center.
|
||||||
/\}
|
/\}
|
||||||
|
|
||||||
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
|
procedure FilterPointsLine(var Points: TPointArray; Radial: Extended; Radius, MX, MY: Integer);
|
||||||
var
|
var
|
||||||
I, Hi, Ind, y: Integer;
|
I, Hi, Ind, y: Integer;
|
||||||
|
@ -573,13 +573,16 @@ begin
|
|||||||
btchar,btU8, btS8: tbtu8(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 1, nil);
|
btchar,btU8, btS8: tbtu8(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 1, nil);
|
||||||
{$IFNDEF PS_NOWIDESTRING}btWideChar, {$ENDIF}btu16, bts16: tbtu16(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 2, nil);
|
{$IFNDEF PS_NOWIDESTRING}btWideChar, {$ENDIF}btu16, bts16: tbtu16(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 2, nil);
|
||||||
btClass :
|
btClass :
|
||||||
|
begin
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
tbtu32(res.dta^) := RealCall_Register(Address, EDX, EAX, ECX,
|
if IsConstructor then
|
||||||
@Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil);
|
tbtu32(res.dta^) := RealCall_Register(Address, EDX, EAX, ECX,
|
||||||
{$ELSE}
|
@Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil)
|
||||||
tbtu32(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX,
|
else
|
||||||
@Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil);
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
tbtu32(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX,
|
||||||
|
@Stack[Length(Stack) - 3], Length(Stack) div 4, 4, nil);
|
||||||
|
end;
|
||||||
|
|
||||||
btu32,bts32{$IFDEF FPC},btArray{$ENDIF}: tbtu32(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil);
|
btu32,bts32{$IFDEF FPC},btArray{$ENDIF}: tbtu32(res.dta^) := RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil);
|
||||||
btPChar: pansichar(res.dta^) := Pansichar(RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil));
|
btPChar: pansichar(res.dta^) := Pansichar(RealCall_Register(Address, EAX, EDX, ECX, @Stack[Length(Stack)-3], Length(Stack) div 4, 4, nil));
|
||||||
|
Loading…
Reference in New Issue
Block a user