aboutsummaryrefslogtreecommitdiff
path: root/pkg/images/tv/tvmark/mknew.x
blob: 27a5a3af8c40fc39ad56920c744c2b56c43493c5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# MK_NEW -- Procedure to determine whether the current star is the same as
# the previous star and/or whether the current star belongs to the coordinate
# list or not.

int procedure mk_new (wx, wy, owx, owy, xlist, ylist, newlist)

real	wx		# x cursor coordinate
real	wy		# y cursor coordinate
real	owx		# old x cursor coordinate
real	owy		# old y cursor coordinate
real	xlist		# x list coordinate
real	ylist		# y list coordinate
int	newlist		# integer new list

int	newobject
real	deltaxy
bool	fp_equalr()

begin
	deltaxy = 1.0

	if (newlist == NO) {
            if (! fp_equalr (wx, owx) || ! fp_equalr (wy, owy))
		newobject = YES
	    else
		newobject = NO
	} else if ((abs (xlist - wx) <= deltaxy) &&
	        (abs (ylist - wy) <= deltaxy)) {
	    wx = xlist
	    wy = ylist
	    newobject = NO
	} else if (fp_equalr (wx, owx) && fp_equalr (wy, owy)) {
	    wx = xlist
	    wy = ylist
	    newobject = NO
	} else {
	    newlist = NO
	    newobject = YES
	}

	return (newobject)
end