home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
vmsnet.sources.games
/
vmsnetrek
/
part21
< prev
next >
Wrap
Text File
|
1992-11-14
|
15KB
|
568 lines
Newsgroups: vmsnet.sources.games
Path: uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!usenet.coe.montana.edu!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!asdmf
From: asdmf@acad2.alaska.edu
Subject: Vmsnetrek 21/47
Message-ID: <1992Nov13.135301.1@acad2.alaska.edu>
Lines: 555
Sender: news@raven.alaska.edu (USENET News System)
Nntp-Posting-Host: acad2.alaska.edu
Organization: University of Alaska
Date: Fri, 13 Nov 1992 17:53:01 GMT
Xref: uunet vmsnet.sources.games:507
-+-+-+-+-+-+-+-+ START OF PART 21 -+-+-+-+-+-+-+-+
V udpopt.obj, -
X`009xlibshr/lib, dwtlibshr/lib, sys$library:ucx$ipc.olb/lib
X`009vmsnetrek :== "$''f$environment("DEFAULT")'netrek.exe"
X
Xcolors.obj : colors.c
X`009cc /optimize COLORS.C
Xcoup.obj : coup.c
X`009cc /optimize COUP.C
Xdata.obj : data.c
X`009cc /optimize DATA.C
Xdeath.obj : death.c
X`009cc /optimize DEATH.C
Xdefaults.obj : defaults.c
X`009cc /optimize DEFAULTS.C
Xdetonate.obj : detonate.c
X`009cc /optimize DETONATE.C
Xdmessage.obj : dmessage.c
X`009cc /optimize DMESSAGE.C
Xenter.obj : enter.c
X`009cc /optimize ENTER.C
Xfindslot.obj : findslot.c
X`009cc /optimize FINDSLOT.C
Xgetname.obj : getname.c
X`009cc /optimize GETNAME.C
Xgetship.obj : getship.c
X`009cc /optimize GETSHIP.C
Xinform.obj : inform.c
X`009cc /optimize INFORM.C
Xinput.obj : input.c
X`009cc /optimize INPUT.C
Xinterface.obj : interface.c
X`009cc /optimize INTERFACE.C
Xmain.obj : main.c
X`009cc /optimize MAIN.C
Xnewwin.obj : newwin.c
X`009cc /optimize NEWWIN.C
Xoption.obj : option.c
X`009cc /optimize OPTION.C
Xorbit.obj : orbit.c
X`009cc /optimize ORBIT.C
Xplanetlist.obj : planetlist.c
X`009cc /optimize PLANETLIST.C
Xplanets.obj : planets.c
X`009cc /optimize PLANETS.C
Xplayerlist.obj : playerlist.c
X`009cc /optimize PLAYERLIST.C
Xranklist.obj : ranklist.c
X`009cc /optimize RANKLIST.C
Xredraw.obj : redraw.c
X`009cc /optimize REDRAW.C
Xreserved.obj : reserved.c
X`009cc /optimize RESERVED.C
Xsintab.obj : sintab.c
X`009cc /optimize SINTAB.C
Xsmessage.obj : smessage.c
X`009cc /optimize SMESSAGE.C
Xsocket.obj : socket.c
X`009cc /optimize SOCKET.C
Xstats.obj : stats.c
X`009cc /optimize STATS.C
Xutil.obj : util.c
X`009cc /optimize UTIL.C
Xwar.obj : war.c
X`009cc /optimize WAR.C
Xwarning.obj : warning.c
X`009cc /optimize WARNING.C
Xx11window.obj : x11window.c
X`009cc /optimize X11WINDOW.C
XVMSutils.obj : VMSutils.c
X`009cc /optimize VMSutils.c
Xudpopt.obj : udpopt.c
X`009cc /optimize udpopt.c
Xscan.obj : scan.c
X`009cc /optimize scan.c
X
X
Xlibs :`032
X`009library/create/share xlibshr sys$library:decw$xlibshr
X`009library/create/share dwtlibshr sys$library:decw$dwtlibshr
X
Xdisplay :
X`009set display /create /node=kingfisher /screen=0 /trans=tcpip
X
Xdefines :
X`009define/job sys sys$common:`091syslib`093
X`009define/job x11 DECW$INCLUDE
X`009define/job netinet sys$common:`091syslib`093`009
X
X
Xclean :
X`009if f$search("*.obj") .nes. "" then delete *.obj.*
$ CALL UNPACK DESCRIP.MMS;1 792357143
$ create/nolog 'f'
X/*
X * detonate.c
X */
X#include "copyright.h"
X
X#include <stdio.h>
X#include <types.h>
X#include "Wlib.h"
X#include "defs.h"
X#include "struct.h"
X#include "data.h"
X
X/* Detonate torp */
X
X/*
X** Detonating torps have become a difficult part of the game. Players
X** quickly learned that detonating their own torps when the cloud was
X** around another player, caused that player to die very quickly. I
X** removed that feature because it lead to people not having to shoot
X** well to collect kills. Now when players detonate their own torps,
X** the torps just vanish and become available for future firing.
X*/
X
Xdetmine()
X`123
X register int i;
X
X for (i = 0; i < MAXTORP; i++) `123
X`009if (torps`091i + (me->p_no * MAXTORP)`093.t_status == TMOVE) `123
X`009 sendDetMineReq(i + (me->p_no * MAXTORP));
X`009`125
X `125
X`125
X
$ CALL UNPACK DETONATE.C;1 1261782327
$ create/nolog 'f'
X/*
X * dmessage.c`032
X *
X * for the client of a socket based protocol.
X */
X#include "copyright.h"
X
X#include <stdio.h>
X#include <math.h>
X#include "Wlib.h"
X#include "defs.h"
X#include "struct.h"
X#include "data.h"
X
Xdmessage(message,flags,from,to)
Xchar *message;
Xunsigned char flags, from, to;
X`123
X register int len;
X W_Color color;
X
X to = to;`009/* make compiler shut up */
X len = strlen(message);
X if (from==255) `123
X`009/* From God */
X`009color=textColor;
X `125 else `123
X`009color=playerColor(&(players`091from`093));
X `125
X /* Kludge stuff for report kills...`032
X */
X if ((strncmp(message, "GOD->ALL", 8)==0 &&`032
X`009 (instr(message, "was kill") `124`124
X`009 instr(message, "killed by"))) `124`124`032
X`009 (*message!=' ' && instr(message, "We are being attacked"))) `123
X`009W_WriteText(messwk, 0, 0, color, message, len, 0);
X`009if (!reportKills) return;
X`009W_WriteText(reviewWin, 0, 0, color, message, len, 0);
X`009return;
X `125
X switch(flags & (MTEAM`124MINDIV`124MALL)) `123
X case MTEAM:
X`009W_WriteText(messwt, 0, 0, color, message, len, 0);
X`009if (msgBeep) W_Beep();`009`009/* ATM - message beep */
X`009break;
X case MINDIV:
X`009W_WriteText(messwi, 0, 0, color, message, len, 0);
X`009if (msgBeep) W_Beep();`009`009/* ATM - message beep */
X`009break;
X default:
X`009W_WriteText(messwa, 0, 0, color, message, len, 0);
X`009break;
X `125
X W_WriteText(reviewWin, 0, 0, color, message, len, 0);
X`125
X
Xinstr(string1, string2)
Xchar *string1, *string2;
X`123
X char *s;
X int length;
X
X length=strlen(string2);
X for (s=string1; *s!=0; s++) `123
X`009if (*s == *string2 && strncmp(s, string2, length)==0) return(1);
X `125
X return(0);
X`125
$ CALL UNPACK DMESSAGE.C;1 1517218106
$ create/nolog 'f'
X/*
X * enter.c
X *
X * This version modified to work as the client in a socket based protocol.
X */
X#include "copyright.h"
X
X#include <stdio.h>
X#include <types.h>
X#include <errno.h>
X#ifndef VMS `032
X/* we don't have this file in VMS 5.4 */
X#include <pwd.h>
X#endif
X#include <string.h>
X#include <ctype.h>
X#include "Wlib.h"
X#include "defs.h"
X#include "struct.h"
X#include "data.h"
X
X/* Enter the game */
X
Xlong random();
X
Xenter()
X`123
X drawTstats();
X delay = 0;
X`125
X
X/* Doesn't really openmem, but it will
X * set some stuff up...
X */
Xopenmem()
X`123
X int i;
X
X players = universe.players;
X torps = universe.torps;
X plasmatorps = universe.plasmatorps;
X status = universe.status;
X planets = universe.planets;
X phasers = universe.phasers;
X mctl = universe.mctl;
X messages = universe.messages;
X for (i=0; i<MAXPLAYER; i++) `123
X`009players`091i`093.p_status = PFREE;
X`009players`091i`093.p_cloakphase = 0;
X`009players`091i`093.p_no = i;
X`009players`091i`093.p_ntorp = 0;
X`009players`091i`093.p_explode = 1;
X`009players`091i`093.p_stats.st_tticks = 1;
X `125
X mctl->mc_current=0;
X status->time=1;
X status->timeprod=1;
X status->kills=1;
X status->losses=1;
X status->time=1;
X status->planets=1;
X status->armsbomb=1;
X for (i=0; i<MAXPLAYER*MAXTORP; i++) `123
X`009torps`091i`093.t_status=TFREE;
X`009torps`091i`093.t_no=i;
X`009torps`091i`093.t_owner=(i / MAXTORP);
X `125
X for (i=0; i<MAXPLAYER; i++) `123
X`009phasers`091i`093.ph_status=PHFREE;
X `125
X for (i=0; i<MAXPLAYER*MAXPLASMA; i++) `123
X`009plasmatorps`091i`093.pt_status=PTFREE;
X`009plasmatorps`091i`093.pt_no=i;
X`009plasmatorps`091i`093.pt_owner=(i / MAXPLASMA);
X `125
X for (i=0; i<MAXPLANETS; i++) `123
X`009planets`091i`093.pl_no=i;
X `125
X`125
X
XdrawTstats()
X`123
X char buf`091BUFSIZ`093;
X
X sprintf(buf, "Flags Warp Dam Shd Torps Kills Armies Fuel Wtem
Vp Etemp");
X W_WriteText(tstatw, 50, 5, textColor, buf, strlen(buf), W_RegularFont);
X sprintf(buf,
X`009 "Maximum: %2d %3d %3d %3d %6d %3d %3d",
X`009 me->p_ship.s_maxspeed, me->p_ship.s_maxdamage,
X`009 me->p_ship.s_maxshield, me->p_ship.s_maxarmies,`032
X`009 me->p_ship.s_maxfuel, me->p_ship.s_maxwpntemp/10,`032
X`009 me->p_ship.s_maxegntemp/10);
X W_WriteText(tstatw, 50, 27, textColor, buf, strlen(buf), W_RegularFont);
X`125
$ CALL UNPACK ENTER.C;1 930207090
$ create/nolog 'f'
X/*`032
X * findslot.c
X *
X * Kevin Smith 03/23/88
X *
X */
X#include "copyright2.h"
X
X#include <stdio.h>
X#include <types.h>
X#include <errno.h>
X#ifndef VMS /* vms doesn't have this file */
X#include <pwd.h>
X#endif
X#include <string.h>
X#include <ctype.h>
X#include "Wlib.h"
X#include "defs.h"
X#include "struct.h"
X#include "data.h"
X
X#define WAITWIDTH 180
X#define WAITHEIGHT 60
X#define WAITTITLE 15`009/* height of title for wait window */
X
Xfindslot()
X`123
X int oldcount= -1;
X W_Window waitWin, qwin, countWin;
X W_Event event;
X
X
X /* Wait for some kind of indication about in/not in */
X while (queuePos==-1) `123
X`009socketPause();
X`009if (isServerDead()) `123
X`009 printf("Augh! Ghostbusted!\n");
X`009 exit(0);
X`009`125
X `009readFromServer();
X `032
X`009if (me!=NULL) `123
X`009 /* We are in! */
X`009 return(me->p_no);
X`009`125
X `125
X
X `032
X /* We have to wait. Make appropriate windows, etc... */
X waitWin=W_MakeWindow("wait", 0,0,WAITWIDTH, WAITHEIGHT,NULL,2,foreColor)
V;
X countWin=W_MakeWindow("count",WAITWIDTH/2,WAITTITLE,WAITWIDTH/2,
X`009WAITHEIGHT-WAITTITLE, waitWin, 1, foreColor);
X qwin=W_MakeWindow("waitquit",0,WAITTITLE, WAITWIDTH/2,WAITHEIGHT-WAITTIT
VLE,
X`009waitWin, 1, foreColor);
X W_MapWindow(waitWin);
X W_MapWindow(countWin);
X W_MapWindow(qwin);
X for (;;) `123
X`009socketPause();
X`009readFromServer();
X`009if (isServerDead()) `123
X`009 printf("We've been ghostbusted!\n");
X`009 exit(0);
X`009`125
X`009while (W_EventsPending()) `123
X`009 W_NextEvent(&event);
X`009 switch((int) event.type) `123
X`009`009case W_EV_BUTTON:
X`009`009case W_EV_KEY:
X`009`009 if (event.Window==qwin) `123
X`009`009`009printf("OK, bye!\n");
X`009`009`009exit(0);
X`009`009 `125
X`009`009 break;
X`009`009case W_EV_EXPOSE:
X`009`009 if (event.Window == waitWin) `123
X`009`009`009mapWaitWin(waitWin);
X`009`009 `125 else if (event.Window == qwin) `123
X`009`009`009mapWaitQuit(qwin);
X`009`009 `125 else if (event.Window == countWin) `123
X`009`009`009mapWaitCount(countWin, queuePos);
X`009`009 `125
X`009`009 break;
X`009`009default:
X`009`009 break;
X`009 `125
X`009`125
X`009if (queuePos != oldcount) `123
X`009 mapWaitCount(countWin, queuePos);
X`009 oldcount=queuePos;
X`009`125
X`009if (me!=NULL) `123
X`009 W_DestroyWindow(waitWin);
X`009 return(me->p_no);
X`009`125
X `125
X`125
X `032
XmapWaitWin(waitWin)
XW_Window waitWin;
X`123
X /*char *s = "Xtrek: Game is full.";*/
X char s`09180`093;
X
X if (netaddrstr == NULL)
X`009sprintf(s, "%s is full", serverName);
X else
X`009sprintf(s, "%s is full", netaddrstr);
X W_WriteText(waitWin, 15, 5, textColor, s, strlen(s), W_RegularFont);
X`125
X
XmapWaitQuit(qwin)
XW_Window qwin;
X`123
X char *s = "Quit";
X
X W_WriteText(qwin, 10, 15, textColor, s, strlen(s), W_RegularFont);
X`125
X
XmapWaitCount(countWin, count)
XW_Window countWin;
Xunsigned int count;
X`123
X char *s = "Wait Queue";
X char buf`09110`093;
X `032
X W_WriteText(countWin, 5, 10, textColor, s, strlen(s), W_RegularFont);
X sprintf(buf, "%d ", count);
X if (count==-1) strcpy(buf, "?");
X W_WriteText(countWin, 5, 25, textColor, buf, strlen(buf), W_RegularFont)
V;
X`125
X
$ CALL UNPACK FINDSLOT.C;1 443236952
$ create/nolog 'f'
X/*`032
X * getname.c
X *
X * Kevin P. Smith 09/28/88
X *
X */
X#include "copyright2.h"
X
X#include <stdio.h>
X#include <types.h>
X#include <stat.h>
X#include <file.h>
X#include <errno.h>
X#ifdef VMS
X#include <stdlib.h>
X#else
X#include <pwd.h>
X#include <string.h>
X#endif
X#include <ctype.h>
X#include "Wlib.h"
X#include "defs.h"
X#include "struct.h"
X#include "data.h"
Xlong time();
X
Xstatic char tempname`09116`093;
Xstatic char password1`09116`093;
Xstatic char password2`09116`093;
Xstatic int state;
X
X#ifdef VMS
X#include "vmsutils.h"
X/* VMS does not use the same utilities as unix to get a passwd */
X/* create our own passwd struct to avoid changing too much */
Xstatic struct passwd *passwd;
X#else /* unix */
Xstatic struct passwd *passwd;
X#endif
X
X
X#define ST_GETNAME 0
X#define ST_GETPASS 1
X#define ST_MAKEPASS1 2
X#define ST_MAKEPASS2 3
X#define ST_DONE 4
X
X
X#ifdef VMS /* added f to avoid name collision */
Xgetnamef(defname)
X#else
Xgetname(defname)
X#endif
Xchar *defname;
X/* Let person identify themselves from w */
X`123
X W_Event event;
X char ch;
X int secondsLeft=99;
X char tempstr`09140`093;
X long lasttime;
X int j;
X extern struct passwd *getpwuid();
X
X passwd=getpwuid(getuid());
X bzero(mystats, sizeof(struct stats)); `032
X mystats->st_tticks=1;
X for (j=0; j<95; j++) `123
X`009mystats->st_keymap`091j`093=j+32;
X `125
X mystats->st_keymap`09195`093=0;
X mystats->st_flags=ST_MAPMODE+ST_NAMEMODE+ST_SHOWSHIELDS+
X`009ST_KEEPPEACE+ST_SHOWLOCAL*2+ST_SHOWGLOBAL*2;
X lasttime = time(NULL);
X tempname`0910`093='\0';
X password1`0910`093='\0';
X password2`0910`093='\0';
X state=ST_GETNAME;
X displayStartup(defname);
X for (;;) `123
X`009if (isServerDead()) `123
X`009 printf("Ack! We've been ghostbusted!\n");
X`009 exit(0);
X`009`125
X`009if (lasttime != time(NULL)) `123
X`009 lasttime++;
X`009 secondsLeft--;
X`009 sprintf(tempstr, "Seconds to go: %d ", secondsLeft);
X`009 W_WriteText(w, 150, 400, textColor, tempstr, strlen(tempstr),
X`009`009W_BoldFont);
X`009 if (secondsLeft==0) `123
X`009`009me->p_status = PFREE;
X`009`009printf("Auto-Quit\n");
X`009`009exit(0);
X`009 `125
X`009`125
X`009if (state==ST_DONE) `123
X`009 W_ClearWindow(w);
X`009 return;
X`009`125
X`009readFromServer();`009/* Just in case it wants to say something */
X`009if (!W_EventsPending()) continue;
X`009W_NextEvent(&event);
X`009if (event.Window != w) continue;
X`009switch ((int) event.type) `123
X`009case W_EV_EXPOSE:
X`009 displayStartup(defname);
X`009 break;
X`009case W_EV_KEY:
X`009 ch = event.key;
X`009 if (ch==10) ch=13;
X`009 if (ch==4 && state==ST_GETNAME && *tempname=='\0') exit(0);
X`009 if (ch<32 && ch!=21 && ch!=13 && ch!=8) break;
X`009 switch(state) `123
X`009 case ST_GETNAME:
X`009`009if (ch == 13) `123
X`009`009 if (*tempname == '\0') `123
X`009`009`009strcpy(tempname, defname);
X`009`009 `125
X`009`009 loaddude();
+-+-+-+-+-+-+-+- END OF PART 21 +-+-+-+-+-+-+-+-