home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: vmsnet.sources.games
- Path: uunet!cs.utexas.edu!usc!rpi!usenet.coe.montana.edu!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!asdmf
- From: asdmf@acad2.alaska.edu
- Subject: Vmsnetrek 31/47
- Message-ID: <1992Nov15.214830.1@acad2.alaska.edu>
- Lines: 441
- Sender: news@raven.alaska.edu (USENET News System)
- Nntp-Posting-Host: acad2.alaska.edu
- Organization: University of Alaska
- Date: Mon, 16 Nov 1992 01:48:30 GMT
- Xref: uunet vmsnet.sources.games:521
-
- -+-+-+-+-+-+-+-+ START OF PART 31 -+-+-+-+-+-+-+-+
- X 0x00, 0x00, 0x00, 0x80, 0xe7, 0xee, 0x3c, 0x80, 0x01, 0x00, 0x41, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x80, 0x31, 0xc0, 0x80, 0x01, 0x00,
- X 0x47, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x60, 0xce, 0x00, 0x81,
- X 0x01, 0x00, 0xf9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,
- X 0x00, 0x81, 0x01, 0x00, 0xe4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe0, 0x00, 0x00, 0x80, 0x7f, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe0, 0x00, 0x00, 0xc0,
- X 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe0, 0x00,
- X 0x00, 0xe0, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
- X 0xf0, 0x01, 0x00, 0xf8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- X 0x01, 0x00, 0xe0, 0x00, 0x00, 0x7c, 0xf0, 0x3f, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x80, 0x01, 0x00, 0x40, 0x00, 0x00, 0xfa, 0xff, 0xff, 0xfe, 0x7f,
- X 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe0, 0x00, 0x00, 0x84, 0x0f, 0x7d,
- X 0xff, 0xff, 0x07, 0x00, 0x00, 0x80, 0x01, 0x00, 0x40, 0x00, 0xf0, 0xff,
- X 0xff, 0xfb, 0xff, 0xff, 0x03, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
- X 0xf0, 0xff, 0xff, 0x3f, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00,
- X 0x00, 0x00, 0x00, 0xfe, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
- X 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00,
- X 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
- X 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- X 0x00, 0xf0, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- X 0xff, 0xff, 0xff, 0x7f`125;
- $ CALL UNPACK OLDBITMAPS.H;1 1678054016
- $ create/nolog 'f'
- X/*
- X * option.c
- X */
- X#include "copyright.h"
- X
- X#include <stdio.h>
- X#include <ctype.h>
- X#include "Wlib.h"
- X#include "defs.h"
- X#include "struct.h"
- X#include "data.h"
- X
- Xstatic int notdone;`009`009/* not done flag */
- Xstatic int updateSpeed=2;`009/* speed of updates from server */
- Xstatic char newkeys`09114`093;
- X
- Xchar *localmes`091`093 = `123 "Show owner on local planets",
- X`009`009 "Show resources on local planets",
- X`009`009 "Show nothing on local planets",
- X`009`009 ""`125;
- X
- Xchar *galacticmes`091`093 = `123 "Show owner on galactic map",
- X`009`009 "Show resources on galactic map",
- X`009`009 "Show nothing on galactic map",
- X`009`009 ""`125;
- X
- Xchar *updatemess`091`093 = `123 "9 updates per second",
- X`009`009 "7 updates per second",
- X`009`009 "5 updates per second",
- X`009`009 "4 updates per second",
- X`009`009 "3 updates per second",
- X`009`009 "2 updates per second",
- X`009`009 "1 update per second",
- X`009`009 ""`125;
- X
- Xchar *mapupdates`091`093 = `123 "Don't update galactic map",
- X`009`009 "Update galactic map rarely",
- X`009`009 "Update galactic map frequently",
- X`009`009 ""`125;
- X
- Xstatic int uspeeds`091`093 = `123111111, 142857, 200000, 250000, 333333, 500
- V000, 999999`125;
- X
- X/*
- X * Only one of op_option, op_targetwin, and op_string should be
- X * defined. If op_string is defined, op_size should be too and
- X * op_text is used without a "Don't" prefix.
- X */
- Xstatic struct option `123
- X int op_num;
- X char *op_text;`009`009/* text to display when on */
- X int *op_option;`009`009/* variable to test/modify (optional) */
- X W_Window *op_targetwin;`009/* target window to map/unmap (optional) */
- X char *op_string;`009`009/* string to modify (optional) */
- X int op_size;`009`009/* size of *op_string (optional) */
- X char **op_array; `009`009/* array of strings to switch between */
- X`125;
- X
- Xstatic struct option option`091`093 = `123
- X `123 0, "show \"all\" message window",`009`0090, &messwa, 0, 0, NULL`125
- V,
- X `123 1, "show \"team\" message window",`0090, &messwt, 0, 0, NULL`125,
- X `123 2, "show \"your\" message window",`0090, &messwi, 0, 0, NULL`125,
- X `123 3, "show \"kill\" message window",`0090, &messwk, 0, 0, NULL`125,
- X `123 4, "show \"total\" message window",`0090, &reviewWin, 0, 0, NULL`12
- V5,
- X `123 5, "show tactical planet names",`009&namemode, 0, 0, 0, NULL`125,
- X `123 6, "show shields",`009`009&showShields, 0, 0, 0, NULL`125,
- X `123 7, "show statistic window",`0090, &statwin, 0, 0, NULL`125,
- X `123 8, "",`009`009`009`009&mapmode, 0, 0, 0, mapupdates`125,
- X `123 9, "show help window",`009`0090, &helpWin, 0, 0, NULL`125,
- X `123 10, "stay peaceful when reborn",`009&keeppeace, 0, 0, 0, NULL`125,
- X /* #define KEYMAP must specify this entry */
- X `123 11, "new keymap entries",`009`0090, 0, newkeys, 13, NULL`125,
- X `123 12, "",`009`009`009`009&showlocal, 0, 0, 0, localmes`125,
- X `123 13, "",`009`009`009`009&showgalactic, 0, 0, 0, galacticmes`125,
- X `123 14, "",`009`009`009`009&updateSpeed, 0, 0, 0, updatemess`125,
- X `123 15, "report kill messages",`009&reportKills, 0, 0, 0, NULL`125,
- X `123 16, "show tractors as lines",`009&showTractor, 0, 0, 0, NULL`125,
- X `123 17, "done",`009`009`009¬done, 0, 0, 0, NULL`125,
- X `123 NULL,`009`009`009`0090, 0, 0, 0, NULL`125
- X`125;
- X
- X#define NUMOPTION ((sizeof(option)/sizeof(option`0910`093))-1)
- X
- X#define KEYMAP 11
- X#define OPTIONBORDER`0092
- X#define OPTIONLEN`00935
- X
- X/* Set up the option window */
- Xoptionwindow()
- X`123
- X register int i;
- X
- X /* Init not done flag */
- X notdone = 1;
- X
- X *newkeys='\0';
- X
- X /* Create window big enough to hold option windows */
- X if (optionWin==NULL) `123
- X`009optionWin = W_MakeMenu("option", WINSIDE+10, -BORDER+10, OPTIONLEN,`032
- X`009 NUMOPTION, baseWin, OPTIONBORDER);
- X
- X`009for (i=0; i<NUMOPTION; i++) `123
- X`009 optionrefresh(&(option`091i`093));
- X`009`125
- X `125
- X
- X /* Map window */
- X W_MapWindow(optionWin);
- X`125
- X
- X/* Redraw the specified target window */
- Xoptionredrawtarget(win)
- XW_Window win;
- X`123
- X register struct option *op;
- X
- X for (op = option; op->op_text; op++) `123
- X`009if (op->op_targetwin && win == *op->op_targetwin) `123
- X`009 optionrefresh(op);
- X`009 break;
- X`009`125
- X `125
- X`125
- X
- X/* Redraw the specified option option */
- Xoptionredrawoption(ip)
- Xint *ip;
- X`123
- X register struct option *op;
- X
- X for (op = option; op->op_text; op++) `123
- X`009if (ip == op->op_option) `123
- X`009 optionrefresh(op);
- X`009 break;
- X`009`125
- X `125
- X`125
- X
- X/* Refresh the option window given by the option struct */
- Xoptionrefresh(op)
- Xregister struct option *op;
- X`123
- X register int on;
- X char buf`091BUFSIZ`093;
- X
- X if (op->op_string) `123
- X`009(void) sprintf(buf, "%s: %s_", op->op_text, op->op_string);
- X `125 else if (op->op_array) `123`009/* Array of strings */
- X`009strcpy(buf, op->op_array`091*op->op_option`093);
- X `125 else `123
- X`009/* Either a boolean or a window */
- X`009if (op->op_option)
- X`009 on = *op->op_option;`009`009/* use int for status */
- X`009else if (op->op_targetwin)
- X`009 on = W_IsMapped(*op->op_targetwin);`009/* use window for status */
- X`009else
- X`009 on = 1;`009`009`009`009/* shouldn't happen */
- X
- X`009if (!on)
- X`009 strcpy(buf, "Don't ");
- X`009else
- X`009 buf`0910`093 = '\0';
- X`009strcat(buf, op->op_text);
- X `125
- X if (islower(buf`0910`093))
- X`009buf`0910`093 = toupper(buf`0910`093);
- X
- X W_WriteText(optionWin, 0, op->op_num, textColor, buf, strlen(buf), 0);
- X`125
- X
- Xoptionaction(data)
- XW_Event *data;
- X`123
- X register struct option *op;
- X int i;
- X register char *cp;
- X
- X op= &(option`091data->y`093);
- X /* Update string; don't claim keystrokes for non-string options */
- X if (op->op_string == 0) `123
- X`009if (data->type == W_EV_KEY)
- X`009 return(0);
- X `125 else `123
- X`009if (data->type == W_EV_BUTTON) return(0);
- X`009switch (data->key) `123
- X
- X`009case '\b':
- X`009case '\177':
- X`009 cp = op->op_string;
- X`009 i = strlen(cp);
- X`009 if (i > 0) `123
- X`009`009cp += i - 1;
- X`009`009*cp = '\0';
- X`009 `125
- X`009 break;
- X
- X`009case '\027':`009/* word erase */
- X`009 cp = op->op_string;
- X`009 i = strlen(cp);
- X`009 /* back up over blanks */
- X`009 while (--i >= 0 && isspace(cp`091i`093))
- X`009`009;
- X`009 i++;
- X`009 /* back up over non-blanks */
- X`009 while (--i >= 0 && !isspace(cp`091i`093))
- X`009`009;
- X`009 i++;
- X`009 cp`091i`093 = '\0';
- X`009 break;
- X
- X`009case '\025':
- X`009case '\030':
- X`009 op->op_string`0910`093 = '\0';
- X`009 break;
- X
- X`009default:
- X`009 if (data->key < 32 `124`124 data->key > 127) break;
- X`009 cp = op->op_string;
- X`009 i = strlen(cp);
- X`009 if (i < (op->op_size - 1) && !iscntrl(data->key)) `123
- X`009`009cp += i;
- X`009`009cp`0911`093 = '\0';
- X`009`009cp`0910`093 = data->key;
- X`009 `125 else
- X`009`009W_Beep();
- X`009`009break;
- X`009`125
- X `125
- X
- X /* Toggle int, if it exists */
- X if (op->op_array) `123
- X`009(*op->op_option)++;
- X`009if (*(op->op_array)`091*op->op_option`093 == '\0') `123
- X`009 *op->op_option=0;
- X`009`125
- X `125 else if (op->op_option) `123
- X`009*op->op_option = ! *op->op_option;
- X `125
- X
- X /* Map/unmap window, if it exists */
- X if (op->op_targetwin) `123
- X`009if (W_IsMapped(*op->op_targetwin))
- X`009 W_UnmapWindow(*op->op_targetwin);
- X`009else
- X`009 W_MapWindow(*op->op_targetwin);
- X `125
- X if (!notdone)`009/* if done, that is */
- X`009optiondone();
- X else
- X`009optionrefresh(op);
- X return(1);
- X`125
- X
- Xoptiondone()
- X`123
- X char *str;
- X
- X /* Unmap window */
- X W_UnmapWindow(optionWin);
- X
- X for (str=newkeys; *str!='\0'; str+=2) `123
- X`009if (*str >= 32 && *str < 127 `124`124 *str == 'O') `123
- X`009 if (*(str+1)=='\0') break;
- X`009 mystats->st_keymap`091*str - 32`093= *(str+1);
- X`009`125
- X`009if (*(str+1)=='\0') break;
- X `125
- X *newkeys='\0';
- X optionrefresh(&(option`091KEYMAP`093));
- X sendOptionsPacket();
- X sendUpdatePacket(uspeeds`091updateSpeed`093);
- X`125
- $ CALL UNPACK OPTION.C;1 84758759
- $ create/nolog 'f'
- X/*
- X * orbit.c
- X */
- X#include "copyright.h"
- X
- X#include <stdio.h>
- X#include <math.h>
- X#include <types.h>
- X#include "Wlib.h"
- X#include "defs.h"
- X#include "struct.h"
- X#include "data.h"
- X
- X/* orbit a planet */
- X
- Xorbit()
- X`123
- X register int i;
- X register struct planet *l;
- X unsigned char dir;
- X int dx, dy;
- X
- X
- X if (me->p_speed > ORBSPEED ) `123
- X`009warning("Helmsman: Captain, the maximum safe speed for docking or orbiti
- Vng is warp 2!");
- X`009return;
- X `125
- X
- X me->p_flags &= `126PFORBIT;
- X
- X if (me->p_flags & PFDOCK) `123
- X`009players`091me->p_docked`093.p_docked--;
- X`009players`091me->p_docked`093.p_port`091me->p_port`0910`093`093 = VACANT;
- X`009me->p_flags &= `126PFDOCK;
- X `125
- X
- X if (me->p_ship.s_type != STARBASE) `123
- X`009for (i=0; i<MAXPLAYER; i++) `123
- X`009 if (me->p_no == i)`032
- X`009`009continue;
- X`009 if (players`091i`093.p_ship.s_type != STARBASE)
- X`009`009continue;
- X`009 if (!isAlive(&players`091i`093))
- X`009`009continue;
- X`009 if (!friendlyPlayer(&players`091i`093))
- X`009`009continue;
- X`009 dx = ABS(players`091i`093.p_x - me->p_x);
- X`009 dy = ABS(players`091i`093.p_y - me->p_y);
- X`009 if (dx > DOCKDIST `124`124 dy > DOCKDIST)
- X`009`009continue;
- X`009`009
- X`009 dock(i);
- X`009 return;
- X`009`125
- X `125
- X
- X for (i = 0, l = &planets`091i`093; i < MAXPLANETS; i++, l++) `123
- X`009dx = ABS(l->pl_x - me->p_x);
- X`009dy = ABS(l->pl_y - me->p_y);
- X`009if (dx > ENTORBDIST `124`124 dy > ENTORBDIST)
- X`009 continue;
- X`009if (dx * dx + dy * dy > ENTORBDIST * ENTORBDIST)
- X`009 continue;
- X`009if (!(me->p_team & planets`091i`093.pl_owner) &&`032
- X`009 me->p_ship.s_type==STARBASE) `123
- X`009 warning("Central Command regulations prohibits you from orbiting for
- Veign planets");
- X`009 return;
- X`009`125
- X
- X`009dir = (unsigned char) (atan2((double) (me->p_x - l->pl_x),
- X`009`009`009`009 (double) (l->pl_y - me->p_y))
- X`009`009`009 / 3.14159 * 128.);
- X`009l->pl_info `124= me->p_team;
- X`009me->p_dir = dir + 64;
- X`009me->p_flags `124= PFORBIT;
- X`009me->p_x = l->pl_x + ORBDIST * Costab`091dir`093;
- X`009me->p_y = l->pl_y + ORBDIST * Sintab`091dir`093;
- X`009me->p_speed = me->p_desspeed = 0;
- X`009me->p_planet = l->pl_no;
- X`009return;
- X `125
- X
- X warning("Helmsman: Sensors read no valid targets in range to dock or or
- Vbit sir!");
- X`125
- X
- X
- Xdock(base_id)
- X int base_id;
- X`123
- X int port_id=NUMPORTS;
- X char buf`09180`093;
- X
- X if (!(players`091base_id`093.p_flags & PFDOCKOK)) `123
- X`009sprintf(buf, "Starbase %s refusing us docking permission captain.",`032
- X`009 players`091base_id`093.p_name);
- X`009warning(buf);
- X`009return;
- X `125
- X
- X /* Try to dock on closest port, else pick first vacant port. */
- X if ((me->p_x < players`091base_id`093.p_x && me->p_y < players`091base_i
- Vd`093.p_y) && (players`091base_id`093.p_port`0913`093 == VACANT)) `123`032
- X`009port_id = 3;
- X `125 else if ((me->p_x < players`091base_id`093.p_x && me->p_y > players
- V`091base_id`093.p_y) && (players`091base_id`093.p_port`0912`093 == VACANT))
- V `123
- X`009port_id = 2;
- X `125 else if ((me->p_x > players`091base_id`093.p_x && me->p_y > players
- V`091base_id`093.p_y) && (players`091base_id`093.p_port`0911`093 == VACANT))
- V `123
- X`009port_id = 1;
- X `125 else if ((me->p_x > players`091base_id`093.p_x && me->p_y < players
- V`091base_id`093.p_y) && (players`091base_id`093.p_port`0910`093 == VACANT))
- V `123
- X`009port_id = 0;
- X `125 else if (players`091base_id`093.p_port`0910`093 == VACANT) `123
- X`009port_id = 0;
- X `125 else if (players`091base_id`093.p_port`0911`093 == VACANT) `123
- X`009port_id = 1;
- X `125 else if (players`091base_id`093.p_port`0912`093 == VACANT) `123
- X`009port_id = 2;
- X `125 else if (players`091base_id`093.p_port`0913`093 == VACANT) `123
- X`009port_id = 3;
- X `125
- X
- X if (port_id < NUMPORTS) `123
- X`009me->p_x = players`091base_id`093.p_x + DOCKDIST * Costab`091(port_id*90+
- V45)*255/360`093;
- X`009me->p_y = players`091base_id`093.p_y + DOCKDIST * Sintab`091(port_id*90+
- +-+-+-+-+-+-+-+- END OF PART 31 +-+-+-+-+-+-+-+-
-
-