mikew@wyse.wyse.com (Mike Wexler) (12/09/88)
Submitted-by: ddickey@gonzo.eta.com (Dan A. Dickey) Posting-number: Volume 2, Issue 41 Archive-name: xtrek/part07 #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 7 (of 7)." # Contents: TODO clock.bitmap data.c data.h dmessage.c getship.c # itoa.c orbit.c patchlevel.h planetlist.c playerlist.c random.c # scores.c torp.c warning.c xtrek.6 xtrekfont.h # Wrapped by mikew@wyse on Thu Dec 8 17:51:45 1988 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'TODO' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'TODO'\" else echo shar: Extracting \"'TODO'\" \(587 characters\) sed "s/^X//" >'TODO' <<'END_OF_FILE' XThings to be done... X X- Add copilot/watch support back in X- Cleanup the Makefile. X- Create an Imakefile that works X- Modify ship types/information to give them different capabilities X- Create more planet types (Stars, & Moons needed). X- Make the planet's orbit other planets (moons orbit planets, X planets orbit stars) X- Arrange the planets into systems, ala VMS conquest. X- Test the program on other X-displays X- Add scorefile printing capability X XIf you do any of these things, send patches, files, notes, questions to Xddickey@unix.eta.com X/* static char sccsid[] = "@(#)TODO 1.1"; */ END_OF_FILE if test 587 -ne `wc -c <'TODO'`; then echo shar: \"'TODO'\" unpacked with wrong size! fi # end of 'TODO' fi if test -f 'clock.bitmap' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'clock.bitmap'\" else echo shar: Extracting \"'clock.bitmap'\" \(1930 characters\) sed "s/^X//" >'clock.bitmap' <<'END_OF_FILE' X/* static char sccsid[] = "@(#)clock.bitmap 1.1"; */ X#define clock_width 48 X#define clock_height 48 Xstatic char clock_bits[] = { X 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x87, 0xf0, 0x00, 0x00, X 0x00, 0x60, 0x80, 0x00, 0x03, 0x00, 0x00, 0x18, 0x80, 0x00, 0x0c, 0x00, X 0x00, 0x14, 0x00, 0x00, 0x10, 0x00, 0x00, 0x23, 0x00, 0x00, 0x68, 0x00, X 0x80, 0x00, 0x00, 0x00, 0x84, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, X 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, X 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x18, 0x00, 0x00, 0x00, 0x00, 0x08, X 0x28, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, X 0x04, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, X 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, X 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, X 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, X 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x78, X 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, X 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, X 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, 0x02, 0x00, 0x00, 0x00, 0x00, 0x20, X 0x02, 0x40, 0xdd, 0x5d, 0x01, 0x20, 0x02, 0x80, 0xc8, 0xcc, 0x00, 0x20, X 0x04, 0x40, 0x49, 0x5d, 0x01, 0x10, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10, X 0x28, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0c, X 0x10, 0x00, 0x00, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, X 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x01, X 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x23, 0x00, 0x00, 0x62, 0x00, X 0x00, 0x14, 0x00, 0x00, 0x14, 0x00, 0x00, 0x18, 0x80, 0x00, 0x0c, 0x00, X 0x00, 0x60, 0x80, 0x00, 0x03, 0x00, 0x00, 0x80, 0x87, 0xf0, 0x00, 0x00, X 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; END_OF_FILE if test 1930 -ne `wc -c <'clock.bitmap'`; then echo shar: \"'clock.bitmap'\" unpacked with wrong size! fi # end of 'clock.bitmap' fi if test -f 'data.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'data.c'\" else echo shar: Extracting \"'data.c'\" \(1205 characters\) sed "s/^X//" >'data.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)data.c 1.1"; X X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X#include <X11/Xlib.h> X#include "defs.h" X#include "data.h" X Xint xtrek_socket; X Xstruct player players[MAXPLAYER]; Xstruct torp torps[MAXPLAYER * MAXTORP]; Xstruct status status[1]; Xstruct planet planets[MAXPLANETS]; Xstruct phaser phasers[MAXPLAYER]; Xstruct message messages[MAXMESSAGE]; Xstruct mctl mctl[MAXMESSAGE]; X Xint remap[9] = { 0, 1, 2, -1, 3, -1, -1, -1, 4 }; Xint udcounter; Xint debug = 0; Xint tcount[MAXTEAM + 1]; X Xdouble Sin[], Cos[]; /* Initialized in sintab.c */ X Xchar teamlet[] = {'I', 'F', 'R', 'X', 'K', 'X', 'X', 'X', 'O'}; Xchar *teamshort[9] = {"IND", "FED", "ROM", "X", "KLI", "X", "X", "X", "ORI"}; Xchar *rnames[4] = { "M5", "Colossus", "Guardian", "HAL" }; END_OF_FILE if test 1205 -ne `wc -c <'data.c'`; then echo shar: \"'data.c'\" unpacked with wrong size! fi # end of 'data.c' fi if test -f 'data.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'data.h'\" else echo shar: Extracting \"'data.h'\" \(998 characters\) sed "s/^X//" >'data.h' <<'END_OF_FILE' X/* static char sccsid[] = "@(#)data.h 1.1"; */ X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X Xextern int xtrek_socket; X Xextern struct player players[MAXPLAYER]; Xextern struct torp torps[MAXPLAYER * MAXTORP]; Xextern struct status status[1]; Xextern struct planet planets[MAXPLANETS]; Xextern struct phaser phasers[MAXPLAYER]; Xextern struct message messages[MAXMESSAGE]; Xextern struct mctl mctl[MAXMESSAGE]; X Xextern int remap[]; Xextern int udcounter; Xextern int tcount[MAXTEAM + 1]; X Xextern double Sin[], Cos[]; X Xextern char teamlet[]; Xextern char *teamshort[]; END_OF_FILE if test 998 -ne `wc -c <'data.h'`; then echo shar: \"'data.h'\" unpacked with wrong size! fi # end of 'data.h' fi if test -f 'dmessage.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'dmessage.c'\" else echo shar: Extracting \"'dmessage.c'\" \(1908 characters\) sed "s/^X//" >'dmessage.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)dmessage.c 1.1"; X X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X#include <X11/Xlib.h> X#include <stdio.h> X#include <math.h> X#include <signal.h> X#include "defs.h" X#include "data.h" X Xdmessage(p) Xregister struct player *p; X{ X struct message *cur; X char buf[80]; X X if (p->p_umsg.m_pending) X return; X if (mctl->mc_current == p->lastm) { X if (p->mdisplayed) { X XFillRectangle(p->display, p->messagew, p->cleargc, p->dfont->ascent, 5, X fontWidth(p->dfont) * p->lastcount, X fontHeight(p->dfont)); X p->mdisplayed = 0; X } X return; X } X do { X if (++(p->lastm) >= MAXMESSAGE) X p->lastm = 0; X cur = &messages[p->lastm]; X if (cur->m_flags & MVALID) { X if ((cur->m_flags & MALL) || X ((cur->m_flags & MTEAM) && (cur->m_recpt & p->p_team)) || X ((cur->m_flags & MINDIV) && (cur->m_recpt == p->p_no))) { X if (p->mdisplayed) { X XFillRectangle(p->display, p->messagew, p->cleargc, p->dfont->ascent, 5, X fontWidth(p->dfont) * p->lastcount, X fontHeight(p->dfont)); X p->mdisplayed = 0; X } X (void) sprintf(buf, "%s", cur->m_data); X p->lastcount = strlen(buf); X if (p->lastcount > 80) X p->lastcount = 80; X XDrawImageString(p->display, p->messagew, p->dfgc, p->dfont->ascent, 5 + p->dfont->ascent, buf, p->lastcount); X XBell(p->display, p->screen); X p->mdisplayed = 1; X XFlush(p->display); X return; X } X } X } while (p->lastm != mctl->mc_current); X} END_OF_FILE if test 1908 -ne `wc -c <'dmessage.c'`; then echo shar: \"'dmessage.c'\" unpacked with wrong size! fi # end of 'dmessage.c' fi if test -f 'getship.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'getship.c'\" else echo shar: Extracting \"'getship.c'\" \(1043 characters\) sed "s/^X//" >'getship.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)getship.c 1.1"; X#ifndef lint Xstatic char *rcsid_getship_c = "$Header: /uraid2/riedl/src/xceltrek/RCS/getship.c,v 1.1 88/04/18 16:10:21 riedl Exp Locker: riedl $"; X#endif lint X/* Copyright (c) 1986 Chris Guthrie */ X X#include <X11/Xlib.h> X#include <stdio.h> X#include <sys/types.h> X#include <sys/ipc.h> X#include <sys/shm.h> X#include "defs.h" X#include "data.h" X X/* fill in ship characteristics */ X Xgetship(shipp) Xstruct ship *shipp; X{ X shipp->s_turns = 64000; X shipp->s_accint = 100; X shipp->s_decint = 200; X shipp->s_accs = 100; X shipp->s_torpdamage = 30; X shipp->s_phaserdamage = 100; X shipp->s_phasedist = shipp->s_phaserdamage * 60; X shipp->s_torpspeed = 12; X shipp->s_maxspeed = 9; X shipp->s_repair = 100; X shipp->s_maxfuel = 10000; X shipp->s_detcost = 100; X shipp->s_torpcost = 10 * shipp->s_torpdamage; X shipp->s_phasercost = 10 * shipp->s_phaserdamage; X shipp->s_warpcost = 2; X shipp->s_cloakcost = 30; X shipp->s_recharge = 10; X shipp->s_maxarmies = 10; X} END_OF_FILE if test 1043 -ne `wc -c <'getship.c'`; then echo shar: \"'getship.c'\" unpacked with wrong size! fi # end of 'getship.c' fi if test -f 'itoa.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'itoa.c'\" else echo shar: Extracting \"'itoa.c'\" \(341 characters\) sed "s/^X//" >'itoa.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)itoa.c 1.1"; Xitoa(n, len, buf) Xint n, len; Xchar *buf; X{ X int i; X char sign = ' '; X X if (0 > n) { X n = -n; X sign = '-'; X } X for (i = len; i > 0; i--) { X if (n > 0 || len == i) { X buf[i-1] = '0' + (n % 10); X n = n / 10; X } else { X buf[i-1] = sign; X sign = ' '; X } X } X} X END_OF_FILE if test 341 -ne `wc -c <'itoa.c'`; then echo shar: \"'itoa.c'\" unpacked with wrong size! fi # end of 'itoa.c' fi if test -f 'orbit.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'orbit.c'\" else echo shar: Extracting \"'orbit.c'\" \(1585 characters\) sed "s/^X//" >'orbit.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)orbit.c 1.1"; X X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X#include <X11/Xlib.h> X X#include <stdio.h> X#include <math.h> X#include <sys/types.h> X#include <sys/ipc.h> X#include <sys/shm.h> X#include "defs.h" X#include "data.h" X X/* orbit a planet */ X Xorbit(p) Xregister struct player *p; X{ X register int i; X register struct planet *l; X unsigned char dir; X int dx, dy; X X if (p->p_speed > ORBSPEED) { X warning(p, "Speed must be less than two to orbit"); X return; X } X for (i = 0, l = &planets[0]; i < MAXPLANETS; i++, l++) { X dx = ABS(l->pl_x - p->p_x); X dy = ABS(l->pl_y - p->p_y); X if (dx > ORBDIST || dy > ORBDIST) /*XXX*/ X continue; X if (dx * dx + dy * dy > ORBDIST * ORBDIST) X continue; X X dir = (unsigned char) (atan2((double) (p->p_x - l->pl_x), X (double) (l->pl_y - p->p_y)) X / 3.14159 * 128.); X l->pl_info |= p->p_team; X p->p_dir = dir + 64; X p->p_flags |= PFORBIT; X p->p_x = l->pl_x + ORBDIST * Cos[dir]; X p->p_y = l->pl_y + ORBDIST * Sin[dir]; X p->p_speed = p->p_desspeed = 0; X p->p_planet = l->pl_no; X return; X } X warning(p, "Not close enough to any planet to orbit"); X} END_OF_FILE if test 1585 -ne `wc -c <'orbit.c'`; then echo shar: \"'orbit.c'\" unpacked with wrong size! fi # end of 'orbit.c' fi if test -f 'patchlevel.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'patchlevel.h'\" else echo shar: Extracting \"'patchlevel.h'\" \(21 characters\) sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE' X#define PATCHLEVEL 1 END_OF_FILE if test 21 -ne `wc -c <'patchlevel.h'`; then echo shar: \"'patchlevel.h'\" unpacked with wrong size! fi # end of 'patchlevel.h' fi if test -f 'planetlist.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'planetlist.c'\" else echo shar: Extracting \"'planetlist.c'\" \(1763 characters\) sed "s/^X//" >'planetlist.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)planetlist.c 1.1"; X X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X X#include <X11/Xlib.h> X#include <stdio.h> X#include "defs.h" X#include "data.h" X Xstatic char *teamname[9] = { X "IND", X "FED", X "ROM", X "", X "KLI", X "", X "", X "", X "ORI" X}; X X/* X** Open a window which contains all the planets and their current X** statistics. Players will not know about planets that their team X** has not orbited. X*/ X Xplanetlist(p) Xregister struct player *p; X{ X register int i; X register int k = 0; X char buf[BUFSIZ]; X register struct planet *j; X X (void) sprintf(buf, " # Planet Name own armies REPAIR FUEL"); X XDrawImageString(p->display, p->planetw, p->dfgc, 0, p->dfont->ascent, buf, X strlen(buf)); X k = 2; X for (i = 0, j = &planets[0]; i < MAXPLANETS; i++, j++) { X if (j->pl_info & p->p_team) { X (void) sprintf(buf, " %2d %-16s %3s %3d %6s %4s", X j->pl_no, X j->pl_name, X teamname[j->pl_owner], X j->pl_armies, X (j->pl_flags & PLREPAIR ? "REPAIR" : " "), X (j->pl_flags & PLFUEL ? "FUEL" : " ")); X } X else { X (void) sprintf(buf, " %2d %-16s", X j->pl_no, X j->pl_name); X } X XDrawImageString(p->display, p->planetw, p->dfgc, 0, p->dfont->ascent + fontHeight(p->dfont) * k++, buf, strlen(buf)); X } X XFlush(p->display); X} END_OF_FILE if test 1763 -ne `wc -c <'planetlist.c'`; then echo shar: \"'planetlist.c'\" unpacked with wrong size! fi # end of 'planetlist.c' fi if test -f 'playerlist.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'playerlist.c'\" else echo shar: Extracting \"'playerlist.c'\" \(1421 characters\) sed "s/^X//" >'playerlist.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)playerlist.c 1.1"; X X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X#include <X11/Xlib.h> X#include <stdio.h> X#include "defs.h" X#include "data.h" X Xplayerlist(p) Xregister struct player *p; X{ X register int i; X register int k = 0; X char buf[BUFSIZ]; X register struct player *j; X X (void) sprintf(buf, " # Team Name Login Display dir spd kills"); X XDrawImageString(p->display, p->playerw, p->dfgc, 0, p->dfont->ascent, buf, strlen(buf)); X k = 2; X for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) { X if (j->p_status != PALIVE) X continue; X (void) sprintf(buf, " %1x %1c %-16.16s %-8s %-16.16s %3d %3d %5.2f", X j->p_no, X teamlet[j->p_team], X j->p_name, X j->p_login, X j->p_monitor, X j->p_dir, X j->p_speed, X j->p_kills); X XDrawImageString(p->display, p->playerw, p->dfgc, 0, p->dfont->ascent + fontHeight(p->dfont) * k++, buf, strlen(buf)); X } X XFlush(p->display); X} END_OF_FILE if test 1421 -ne `wc -c <'playerlist.c'`; then echo shar: \"'playerlist.c'\" unpacked with wrong size! fi # end of 'playerlist.c' fi if test -f 'random.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'random.c'\" else echo shar: Extracting \"'random.c'\" \(482 characters\) sed "s/^X//" >'random.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)random.c 1.1"; X/* X * The really nice random number generator that came with 4.3 uses X * too much state information to pass across the network so for our X * network-wide random generator we just use the old srand/rand X * combination. Sorry about the false naming. X */ X Xstatic long randx = 1; X Xsrandom(seed) Xint seed; X{ X randx = seed; X} X Xlong random() X{ X return((randx = randx * 1103515245 + 12345) & 0x7fffffff); X} X Xlong grandom() X{ X return(randx); X} END_OF_FILE if test 482 -ne `wc -c <'random.c'`; then echo shar: \"'random.c'\" unpacked with wrong size! fi # end of 'random.c' fi if test -f 'scores.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'scores.c'\" else echo shar: Extracting \"'scores.c'\" \(1740 characters\) sed "s/^X//" >'scores.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)scores.c 1.1"; X X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X#include <stdio.h> X#include <sys/types.h> X#include <sys/file.h> X#include <X11/X.h> X#include <X11/Xlib.h> X#include "defs.h" X#include <ndbm.h> X Xstruct stats old; X Xmain() X{ X DBM *sdb; X datum key, sinfo; X X sdb = dbm_open(SCOREFILE, O_RDONLY, 0700); X if (sdb < 0) { X perror(SCOREFILE); X exit(1); X } X X /* 0123456789012345678901234567890123456789012345678901234567890*/ Xfprintf(stdout, "Name rtime kills maxkills losses\n"); Xfprintf(stdout, "entries conqs coups torps phasers abomb aship planets gens ratio\n\n"); X X key = dbm_firstkey(sdb); X while (key.dptr) { X sinfo = dbm_fetch(sdb, key); X bcopy(sinfo.dptr, &old, sizeof (struct stats)); X if (old.st_entries > 0) { Xfprintf(stdout, "%-24s %8d %6.2f %6.2f %5d\n", X key.dptr, X old.st_time, X old.st_kills, X old.st_maxkills, X old.st_losses); Xfprintf(stdout, "%7d %5d %5d %7d %7d %6d %5d %7d %4d %5.3f\n", X old.st_entries, X old.st_conqs, X old.st_coups, X old.st_torps, X old.st_phasers, X old.st_armsbomb, X old.st_armsship, X old.st_planets, X old.st_genocides, X (old.st_losses ? old.st_kills / old.st_losses : 0.0)); Xfprintf(stdout, "\n"); X } X key = dbm_nextkey(sdb); X } X} END_OF_FILE if test 1740 -ne `wc -c <'scores.c'`; then echo shar: \"'scores.c'\" unpacked with wrong size! fi # end of 'scores.c' fi if test -f 'torp.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'torp.c'\" else echo shar: Extracting \"'torp.c'\" \(1810 characters\) sed "s/^X//" >'torp.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)torp.c 1.1"; X#ifndef lint Xstatic char *rcsid_torp_c = "$Header: /uraid2/riedl/src/xceltrek/RCS/torp.c,v 1.1 88/04/18 16:10:50 riedl Exp Locker: riedl $"; X#endif lint X/* Copyright (c) 1986 Chris Guthrie */ X X#include <X11/Xlib.h> X#include <stdio.h> X#include <sys/types.h> X#include <sys/ipc.h> X#include <sys/shm.h> X#include "defs.h" X#include "data.h" Xextern long isin[], icos[]; X X/* Launch torp */ X Xntorp(p, course, type) Xregister struct player *p; Xunsigned char course; Xint type; X{ X register int i, x, y; X register struct torp *k; X char buf[50]; X double sqrt(); X X if (p->p_ntorp >= MAXTORP) { X sprintf(buf, "Torps limited to %d", MAXTORP); X warning(p, buf); X return; X } X if (p->p_fuel < p->p_ship.s_torpcost) { X warning(p, "Not enough fuel for torp"); X return; X } X if (p->p_flags & PFREPAIR) { X warning(p, "Can't fire while repairing"); X return; X } X if (p->p_flags & PFWEP) { X warning(p, "Weapons overheated"); X return; X } X if (p->p_flags & PFCLOAK) { X warning(p, "Cannot fire while cloaked"); X return; X } X p->p_ntorp++; X p->p_fuel -= p->p_ship.s_torpcost; X p->p_wtemp += p->p_ship.s_torpcost / 10; X for (i = MAXTORP, k = &torps[p->p_no * MAXTORP]; i > 0; i--, k++) { X if (k->t_status == TFREE) X break; X } X if (i == 0) { X fprintf(stderr, "ntorp: sanity check failed - no torp to fire\n"); X p->p_ntorp--; X return; X } X k->t_no = MAXTORP - i; X k->t_status = type; X k->t_owner = p->p_no; X k->t_team = p->p_team; X k->t_x = p->p_x; X k->t_y = p->p_y; X k->t_dir = course; X k->t_damage = p->p_ship.s_torpdamage; X k->t_speed = p->p_ship.s_torpspeed; X k->t_war = p->p_hostile | p->p_swar; X k->t_fuse = (random() % TFIREVAR) + TFIREMIN; X p->p_stats.st_torps++; X} END_OF_FILE if test 1810 -ne `wc -c <'torp.c'`; then echo shar: \"'torp.c'\" unpacked with wrong size! fi # end of 'torp.c' fi if test -f 'warning.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'warning.c'\" else echo shar: Extracting \"'warning.c'\" \(1225 characters\) sed "s/^X//" >'warning.c' <<'END_OF_FILE' Xstatic char sccsid[] = "@(#)warning.c 1.1"; X/* X X Copyright (c) 1986 Chris Guthrie X XPermission to use, copy, modify, and distribute this Xsoftware and its documentation for any purpose and without Xfee is hereby granted, provided that the above copyright Xnotice appear in all copies and that both that copyright Xnotice and this permission notice appear in supporting Xdocumentation. No representations are made about the Xsuitability of this software for any purpose. It is Xprovided "as is" without express or implied warranty. X X*/ X X X#include <X11/Xlib.h> X#include <stdio.h> X#include <math.h> X#include <signal.h> X#include "defs.h" X#include "data.h" X X/* X** The warning in text will be printed in the warning window. X*/ Xwarning(p, text) Xregister struct player *p; Xregister char *text; X{ X if (p->p_flags & PFROBOT) X return; X X p->warntimer = udcounter + WARNTIME; /* WARNTIME updates later the line will be cleared */ X if (p->warncount > 0) X XFillRectangle(p->display, p->warnw, p->cleargc, X 5, 5, fontWidth(p->dfont) * p->warncount, fontHeight(p->dfont)); X p->warncount = strlen(text); X XDrawImageString(p->display, p->warnw, p->dfgc, X 5, 5 + p->dfont->ascent, text, p->warncount); X XFlush(p->display); X} END_OF_FILE if test 1225 -ne `wc -c <'warning.c'`; then echo shar: \"'warning.c'\" unpacked with wrong size! fi # end of 'warning.c' fi if test -f 'xtrek.6' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xtrek.6'\" else echo shar: Extracting \"'xtrek.6'\" \(479 characters\) sed "s/^X//" >'xtrek.6' <<'END_OF_FILE' X.\"static char sccsid[] = "@(#)xtrek.6 1.1"; X.TH XTREK 6 "06 Dec 1988" X.SH NAME Xxtrek \- X based multi-player space shoot 'em up game X.SH SYNOPSIS X.B xtrek Xxtrek-server-machine X.SH DESCRIPTION X.I Xtrek Xis a game based on the X window environment. XIt is thoroughly described in xtrek.doc which probably lives Xin /usr/games/lib/xtrek/xtrek.doc. X.SH OPTIONS X.I Xtrek Xwill get the monitor name from your environment variable DISPLAY. X.SH AUTHOR XChris Guthrie (chris@ic.berkeley.edu) END_OF_FILE if test 479 -ne `wc -c <'xtrek.6'`; then echo shar: \"'xtrek.6'\" unpacked with wrong size! fi # end of 'xtrek.6' fi if test -f 'xtrekfont.h' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'xtrekfont.h'\" else echo shar: Extracting \"'xtrekfont.h'\" \(563 characters\) sed "s/^X//" >'xtrekfont.h' <<'END_OF_FILE' X/* static char sccsid[] = "@(#)xtrekfont.h 1.1"; */ X/* X * Definitions of character offsets within the XTrek font. X */ X X/* X * $Header: /blackbird/home/jeff/TAPE2/xtrek.new/RCS/xtrekfont.h,v 3.1 88/09/20 00:45:48 jeff Exp $ X */ X X#define FED_GLYPHS 0 X#define ROM_GLYPHS 16 X#define KLI_GLYPHS 32 X#define ORI_GLYPHS 48 X#define EXP_GLYPHS_LEFT 64 X#define EXP_GLYPHS_RIGHT 69 X#define CLOUD_GLYPH 74 X#define ETORP_GLYPH 75 X#define MTORP_GLYPH 76 X#define PLANET_GLYPHS 77 X#define MPLANET_GLYPHS 82 X#define SHIELD_GLYPH 87 X#define YSHIELD_GLYPH 88 X#define RSHIELD_GLYPH 89 END_OF_FILE if test 563 -ne `wc -c <'xtrekfont.h'`; then echo shar: \"'xtrekfont.h'\" unpacked with wrong size! fi # end of 'xtrekfont.h' fi echo shar: End of archive 7 \(of 7\). cp /dev/null ark7isdone MISSING="" for I in 1 2 3 4 5 6 7 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 7 archives. rm -f ark[1-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Mike Wexler(wyse!mikew) Phone: (408)433-1000 x1330 Moderator of comp.sources.x