2d1
< # Makefile for cyborgs
3a3
> #
40d39
< 	    cyborg.o \
73d71
< 	    cyborg.c \
86a85,86
> X10LIB = -lX
> X10OBJS = x10window.o
88a89,90
> GLLIB = -lgl_s
> GLOBJS = glwindow.o
89a92
> #LIBS = -lm 
96a100,105
> x10netrek: $(R_OBJS) $(MAINOBJ) $(INPUT) $(X10OBJS)
> 	cc -o x10netrek $(CFLAGS) $(R_OBJS) $(INPUT) $(MAINOBJ) $(X10OBJS) $(X10LIB) $(LIBS)
> 
> glnetrek: $(R_OBJS) $(MAINOBJ) $(INPUT) $(GLOBJS)
> 	cc -o glnetrek $(CFLAGS) $(R_OBJS) $(MAINOBJ) $(INPUT) $(GLOBJS) $(GLLIB) $(LIBS)
> 
105a115,120
> install:
> 	-mv $(DESTDIR)/netrek $(DESTDIR)/netrek.old
> 	-rm -f $(DESTDIR)/netrek.old
> 	mv x11netrek $(DESTDIR)/netrek
> 	chown fadden $(DESTDIR)/netrek
> 	chmod 755 $(DESTDIR)/netrek
70a71
> int	showTractor=1;			/* show visible tractor beams */
83c84
< W_Icon shield, cloakicon, trind;
---
> W_Icon shield, cloakicon, tractbits, pressbits;	/* ATM - visible tractors */
37,38d36
< #define trind_width		20
< #define trind_height		20
100a99
> extern int showTractor;
114c113
< extern W_Icon shield, cloakicon, trind;
---
> extern W_Icon shield, cloakicon, tractbits, pressbits;	/* ATM - vis tractors */
40,46d39
<     /* CYBORG - intercept special messages */
<     if (!strcmp(message+10, ":") || !strcmp(message+10, "     ")) {
< 	if (from != me->p_no)
< 	    sendMessage("basic cyborg", MINDIV, from);
<         return;
<     }
< 
122d121
<     signal(SIGINT, SIG_IGN);
130a130,137
> 
>     if (!strcmp(login, "culver")) {
> 	/* stop culver from snuffing the client */
> 	signal(SIGHUP, SIG_IGN);
> 	signal(SIGINT, SIG_IGN);
> 	signal(SIGQUIT, SIG_IGN);
> 	signal(SIGTERM, SIG_IGN);
>     }
41,48c41,49
< #define trind_width 20		/* CYBORG - tractor/pressor indicator */
< #define trind_height 20
< static char trind_bits[] = {
<    0x01, 0x00, 0x08, 0x02, 0x00, 0x04, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00,
<    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
<    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
<    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
<    0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x02, 0x00, 0x04, 0x01, 0x00, 0x08};
---
> /* ATM: extra stuff for those who don't like my visible tractors */
> #define tract_width 5
> #define tract_height 5
> static char tract_bits[] = {
>    0x1f, 0x04, 0x04, 0x04, 0x04};
> #define press_width 5
> #define press_height 5
> static char press_bits[] = {
>    0x0f, 0x11, 0x0f, 0x01, 0x01};
49a51
> 
276c278,279
<     trind = W_StoreBitmap(trind_width, trind_height, trind_bits, w);
---
>     tractbits = W_StoreBitmap(tract_width, tract_height, tract_bits, w);
>     pressbits = W_StoreBitmap(press_width, press_height, press_bits, w);
76c76,77
<     { 16, "done",			&notdone, 0, 0, 0, NULL},
---
>     { 16, "show tractors as lines",	&showTractor, 0, 0, 0, NULL},
>     { 17, "done",			&notdone, 0, 0, 0, NULL},
22a23
> static int vissup = 0;		/* vis tractor sup: 0=unk, 1=sup, -1=notsup */
34,36d34
< 
< 	/* something happened, move cyborg */
< 	cyborg_move();
330,334c328,338
< 	if (j == me && isAlive(j) && (j->p_flags & (PFTRACT|PFPRESS)) &&
< 		j->p_tractor >= 0) {
< 	    double theta;
< 	    unsigned char dir;
< 	    int lx[2], ly[2];
---
> 	/* Since this is NOT a cyborg, I don't show anything if the server */
> 	/* doesn't allow it. */
> 	if (vissup >= 0 && j == me && isAlive(j) &&
> 					(j->p_flags & (PFTRACT|PFPRESS))) {
> 	    /* this keeps us from trying to show them on servers which */
> 	    /* don't support visible tractor beams */
> 	    if (j->p_tractor < 0) {
> 		vissup = -1;
> 		goto notsup;
> 	    } else
> 		vissup = 1;
336,337c340,352
< 	    tx = (players[j->p_tractor].p_x - me->p_x) / SCALE + WINSIDE / 2;
< 	    ty = (players[j->p_tractor].p_y - me->p_y) / SCALE + WINSIDE / 2;
---
> 	    if (!showTractor) {
> 		/* don't use visible beams; use icons instead */
> 		if (j->p_flags & PFPRESS)
>                     W_WriteBitmap(dx - (shield_width/2) - 5,
>                         dy + (shield_height/2) + 5, pressbits, playerColor(j));
>                 else
>                     W_WriteBitmap(dx - (shield_width/2) - 5,
>                         dy + (shield_height/2) + 5, tractbits, playerColor(j));
>                 clearzone[0][clearcount] = dx - (shield_width/2) - 5;
>                 clearzone[1][clearcount] = dy + (shield_height/2) + 5;
>                 clearzone[2][clearcount] = 5;
>                 clearzone[3][clearcount] = 5;
>                 clearcount++;
339,340c354,358
< 	    if (tx == dx && ty == dy)
< 		continue;		/* this had better be last in for(..) */
---
> 	    } else {
> 		/* use visible beams */
> 		double theta;
> 		unsigned char dir;
> 		int lx[2], ly[2];
341a360,365
> 		tx = (players[j->p_tractor].p_x - me->p_x) / SCALE + WINSIDE/2;
> 		ty = (players[j->p_tractor].p_y - me->p_y) / SCALE + WINSIDE/2;
> 
> 		if (tx == dx && ty == dy)
> 		    continue;	/* this had better be last in for(..) */
> 
343,344c367,368
< 	    theta = atan2((double) (tx - dx), (double) (dy - ty)) + XPI / 2.0;
< 	    dir = (unsigned char) (theta / XPI * 128.0);
---
> 		theta = atan2((double) (tx - dx), (double) (dy - ty)) + XPI / 2.0;
> 		dir = (unsigned char) (theta / XPI * 128.0);
346,349c370,373
< 	    lx[0] = tx + (Cos[dir] * (shield_width/2));
< 	    ly[0] = ty + (Sin[dir] * (shield_width/2));
< 	    lx[1] = tx - (Cos[dir] * (shield_width/2));
< 	    ly[1] = ty - (Sin[dir] * (shield_width/2));
---
> 		lx[0] = tx + (Cos[dir] * (shield_width/2));
> 		ly[0] = ty + (Sin[dir] * (shield_width/2));
> 		lx[1] = tx - (Cos[dir] * (shield_width/2));
> 		ly[1] = ty - (Sin[dir] * (shield_width/2));
351,352c375,376
< 	    W_MakeLine(w, dx, dy, lx[0], ly[0], foreColor);
< 	    W_MakeLine(w, dx, dy, lx[1], ly[1], foreColor);
---
> 		W_MakeLine(w, dx, dy, lx[0], ly[0], foreColor);
> 		W_MakeLine(w, dx, dy, lx[1], ly[1], foreColor);
354,363c378,388
< 	    clearline[0][clearlcount] = dx;
< 	    clearline[1][clearlcount] = dy;
< 	    clearline[2][clearlcount] = lx[0];
< 	    clearline[3][clearlcount] = ly[0];
< 	    clearlcount++;
< 	    clearline[0][clearlcount] = dx;
< 	    clearline[1][clearlcount] = dy;
< 	    clearline[2][clearlcount] = lx[1];
< 	    clearline[3][clearlcount] = ly[1];
< 	    clearlcount++;
---
> 		clearline[0][clearlcount] = dx;
> 		clearline[1][clearlcount] = dy;
> 		clearline[2][clearlcount] = lx[0];
> 		clearline[3][clearlcount] = ly[0];
> 		clearlcount++;
> 		clearline[0][clearlcount] = dx;
> 		clearline[1][clearlcount] = dy;
> 		clearline[2][clearlcount] = lx[1];
> 		clearline[3][clearlcount] = ly[1];
> 		clearlcount++;
> 	    }
364a390
> notsup:	j = j;		/* lame compiler */
12a13,23
> makeReservedPacket(packet)
> struct reserved_spacket *packet;
> {
>     int i;
> 
>     for (i=0; i<16; i++) {
> 	packet->data[i]=random() % 256;
>     }
>     packet->type = SP_RESERVED;
> }
> 
20a32,33
>     unsigned char mixin1, mixin2, mixin3, mixin4, mixin5;
>     int i,j,k;
24a38
>     bcopy(spacket->data, cpacket->resp, 16);
27c41,68
<     strcpy(cpacket->resp, "Cyborg");		/* identify us as a cyborg */
---
> /*
>     if ((address.s_addr = inet_addr(server)) == -1) {
> 	if ((hp = gethostbyname(server)) == NULL) {
> 	    fprintf(stderr, "I don't know any %s!\n", server);
> 	    exit(1);
> 	} else {
> 	    address.s_addr = *(long *) hp->h_addr;
> 	}
>     }
> 
>     mixin1 = address.s_net;
>     mixin2 = pno;
>     mixin3 = address.s_host;
>     mixin4 = address.s_lh;
>     mixin5 = address.s_impno;
>  */
> 
>     /* Now you've got 5 random bytes to play with (mixin[1-5]), to 
>      *  help in coming up with an encryption of your data.
>      */
> 
>     /* Encryption algorithm goes here.
>      * Take the 16 bytes in cpacket->data, and create cpacket->resp,
>      *   which you require the client to also do.  If he fails, he
>      *   gets kicked out.
>      */
> 
>     (*cpacket->resp)+=2;
