This routine uses ptcgraph, ptccrt and ptcmouse. I couldn't get the drawpoly routine in ptcgraph to work so I made my own, even without the mouse selection of points. Thinking back I'm wondering if I had to pass a pointer to the var polypoints, instead of the array itself. Anyway, this works.
{ Select the first point with the left mouse button, then select the subsequent points using the right mouse button and then
close the polygon with a keypress}
procedure Poly(Paintcolor:byte);
var
GotFirst,
First: boolean;
fx, fy, mxx, myy, mx, my, mb: longint;
begin
First := True;
GotFirst := false;
setcolor(paintcolor);
repeat
getmousestate(mx, my, mb);
if lpressed and not gotfirst then {allow only one left mouse click}
begin
mxx := mx;
myy := my;
if First then
begin
fx := mx; {save starting points}
fy := my;
First := False;
putpixel(fx, fy, paintcolor);
end;
GotFirst := true;
while lpressed do {wait for mouse release}
begin
end;
end;
if rpressed then {set subsequent points with right mouse clicks}
begin
line(mx, my, mxx, myy);
mxx := mx;
myy := my;
while rpressed do {wait for mouse release}
begin
end;
end;
until keypressed;
line(mxx, myy, fx, fy); {close the polygon}
end;