home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: vmsnet.sources.games
- Path: uunet!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 43/47
- Message-ID: <1992Nov20.210217.1@acad2.alaska.edu>
- Lines: 437
- Sender: news@raven.alaska.edu (USENET News System)
- Nntp-Posting-Host: acad2.alaska.edu
- Organization: University of Alaska
- Date: Sat, 21 Nov 1992 01:02:17 GMT
- Xref: uunet vmsnet.sources.games:543
-
- -+-+-+-+-+-+-+-+ START OF PART 43 -+-+-+-+-+-+-+-+
- X sliders`0910`093.low_red = .20 * ((double) sliders`0910`093.max);
- X sliders`0910`093.high_red = sliders`0910`093.max;
- X
- X sliders`0911`093.max = me->p_ship.s_maxdamage;
- X
- X sliders`0912`093.max = me->p_ship.s_maxfuel;
- X sliders`0912`093.low_red = .20 * ((double) sliders`0912`093.max);
- X sliders`0912`093.high_red = sliders`0912`093.max;
- X
- X sliders`0913`093.max = me->p_ship.s_maxspeed;
- X sliders`0913`093.high_red = sliders`0913`093.max;
- X
- X sliders`0914`093.max = 1.2 * ((double) me->p_ship.s_maxwpntemp);
- X sliders`0914`093.high_red = .667 * ((double) sliders`0914`093.max);
- X
- X sliders`0915`093.max = 1.2 * ((double) me->p_ship.s_maxegntemp);
- X sliders`0915`093.high_red = .667 * ((double) sliders`0915`093.max);
- X
- X for (i=0; i<NUM_SLIDERS; i++)`032
- X`009sliders`091i`093.diff = sliders`091i`093.max - sliders`091i`093.min;
- X
- X`125
- $ CALL UNPACK STATS.C;1 1495339030
- $ create/nolog 'f'
- X#ifndef STRUCT_H
- X#define STRUCT_H 1
- X/*
- X * struct.h for the client of an xtrek socket protocol.
- X *
- X * Most of the unneeded stuff in the structures has been thrown away.
- X */
- X#include "copyright.h"
- X
- Xstruct status `123
- X unsigned char tourn;`009/* Tournament mode? */
- X`009 /* These stats only updated during tournament mode */
- X unsigned int armsbomb, planets, kills, losses, time;
- X`009 /* Use long for this, so it never wraps */
- X unsigned long timeprod;
- X`125;
- X
- X#define PFREE 0
- X#define POUTFIT 1
- X#define PALIVE 2
- X#define PEXPLODE 3
- X#define PDEAD 4
- X
- X#define PFSHIELD`0090x0001
- X#define PFREPAIR`0090x0002
- X#define PFBOMB`009`0090x0004
- X#define PFORBIT`009`0090x0008
- X#define PFCLOAK`009`0090x0010
- X#define PFWEP`009`0090x0020
- X#define PFENG`009`0090x0040
- X#define PFROBOT`009`0090x0080
- X#define PFBEAMUP`0090x0100
- X#define PFBEAMDOWN`0090x0200
- X#define PFSELFDEST`0090x0400
- X#define PFGREEN`009`0090x0800
- X#define PFYELLOW`0090x1000
- X#define PFRED`009`0090x2000
- X#define PFPLOCK`009`0090x4000`009`009/* Locked on a player */
- X#define PFPLLOCK`0090x8000`009`009/* Locked on a planet */
- X#define PFCOPILOT`0090x10000`009`009/* Allow copilots */
- X#define PFWAR`009`0090x20000`009`009/* computer reprogramming for war */
- X#define PFPRACTR`0090x40000`009`009/* practice type robot (no kills) */
- X#define PFDOCK 0x80000 /* true if docked to a starbase */
- X#define PFREFIT 0x100000 /* true if about to refit */
- X#define PFREFITTING`0090x200000`009/* true if currently refitting */
- X#define PFTRACT `0090x400000`009/* tractor beam activated */
- X#define PFPRESS `0090x800000`009/* pressor beam activated */
- X#define PFDOCKOK`0090x1000000`009/* docking permission */
- X
- X#define KQUIT`009`0090x01`009`009/* Player quit */
- X#define KTORP`009`0090x02`009`009/* killed by torp */
- X#define KPHASER`009`0090x03`009`009/* killed by phaser */
- X#define KPLANET`009`0090x04`009`009/* killed by planet */
- X#define KSHIP`009`0090x05`009`009/* killed by other ship */
- X#define KDAEMON`009`0090x06`009`009/* killed by dying daemon */
- X#define KWINNER`009`0090x07`009`009/* killed by a winner */
- X#define KGHOST`009`0090x08`009`009/* killed because a ghost */
- X#define KGENOCIDE`0090x09`009`009/* killed by genocide */
- X#define KPROVIDENCE`0090x0a`009`009/* killed by a hacker */
- X#define KPLASMA 0x0b /* killed by a plasma torpedo */
- X#define KBADBIN`009`0090x0c`009`009/* ATM: bad netrek binary */
- X
- X#define NUM_TYPES 8`009/* ATM - Galaxy */
- X#define SCOUT 0
- X#define DESTROYER 1
- X#define CRUISER 2
- X#define BATTLESHIP 3
- X#define ASSAULT 4
- X#define STARBASE 5
- X#define GALAXY 6
- X#define ATT 7`009`009/* ATM */
- X
- Xstruct ship `123
- X short s_phaserdamage;
- X int s_maxspeed;
- X int s_maxfuel;
- X int s_maxshield;
- X int s_maxdamage;
- X int s_maxegntemp;
- X int s_maxwpntemp;
- X short s_maxarmies;
- X short s_width;
- X short s_height;
- X short s_type;
- X int s_torpspeed;
- X`125;
- X
- Xstruct stats `123
- X double st_maxkills;`009`009/* max kills ever */
- X int st_kills;`009`009/* how many kills */
- X int st_losses;`009`009/* times killed */
- X int st_armsbomb;`009`009/* armies bombed */
- X int st_planets;`009`009/* planets conquered */
- X int st_ticks;`009`009/* Ticks I've been in game */
- X int st_tkills;`009`009/* Kills in tournament play */
- X int st_tlosses;`009`009/* Losses in tournament play */
- X int st_tarmsbomb;`009`009/* Tournament armies bombed */
- X int st_tplanets;`009`009/* Tournament planets conquered */
- X int st_tticks;`009`009/* Tournament ticks */
- X`009`009`009`009/* SB stats are entirely separate */
- X int st_sbkills;`009`009/* Kills as starbase */
- X int st_sblosses;`009`009/* Losses as starbase */
- X int st_sbticks;`009`009/* Time as starbase */
- X double st_sbmaxkills; /* Max kills as starbase */
- X long st_lastlogin;`009`009/* Last time this player was played */
- X int st_flags;`009`009/* Misc option flags */
- X char st_keymap`09196`093;`009`009/* keymap for this player */
- X int st_rank;`009`009/* Ranking of the player */
- X`125;
- X
- X#define ST_MAPMODE 1
- X#define ST_NAMEMODE 2
- X#define ST_SHOWSHIELDS 4
- X#define ST_KEEPPEACE 8
- X#define ST_SHOWLOCAL 16 /* two bits for these two */
- X#define ST_SHOWGLOBAL 64
- X
- Xstruct player `123
- X int p_no;
- X int p_updates;`009`009/* Number of updates ship has survived */
- X int p_status;`009`009/* Player status */
- X unsigned int p_flags;`009/* Player flags */
- X char p_name`09116`093;
- X char p_login`09116`093;
- X char p_monitor`09116`093;`009`009/* Monitor being played on */
- X char p_mapchars`0912`093;`009`009/* Cache for map window image */
- X struct ship p_ship;`009`009/* Personal ship statistics */
- X int p_x;
- X int p_y;
- X unsigned char p_dir;`009/* Real direction */
- X unsigned char p_desdir;`009/* desired direction */
- X int p_subdir;`009`009/* fraction direction change */
- X int p_speed;`009`009/* Real speed */
- X short p_desspeed;`009`009/* Desired speed */
- X int p_subspeed;`009`009/* Fractional speed */
- X short p_team;`009`009`009/* Team I'm on */
- X int p_damage;`009`009/* Current damage */
- X int p_subdamage;`009`009/* Fractional damage repair */
- X int p_shield;`009`009/* Current shield power */
- X int p_subshield;`009`009/* Fractional shield recharge */
- X short p_cloakphase;`009`009/* Drawing stage of cloaking engage/disengage
- V. */
- X short p_ntorp;`009`009/* Number of torps flying */
- X short p_nplasmatorp; /* Number of plasma torps active */
- X char p_hostile;`009`009/* Who my torps will hurt */
- X char p_swar;`009`009/* Who am I at sticky war with */
- X float p_kills;`009`009/* Enemies killed */
- X short p_planet;`009`009/* Planet orbiting or locked onto */
- X short p_playerl;`009`009/* Player locked onto */
- X short p_armies;`009
- X int p_fuel;
- X short p_explode;`009`009/* Keeps track of final explosion */
- X int p_etemp;
- X short p_etime;
- X int p_wtemp;
- X short p_wtime;
- X short p_whydead;`009`009/* Tells you why you died */
- X short p_whodead;`009`009/* Tells you who killed you */
- X struct stats p_stats;`009/* player statistics */
- X short p_genoplanets;`009/* planets taken since last genocide */
- X short p_genoarmsbomb;`009/* armies bombed since last genocide */
- X short p_planets;`009`009/* planets taken this game */
- X short p_armsbomb;`009`009/* armies bombed this game */
- X int p_ghostbuster;
- X int p_docked;`009`009/* If starbase, # docked to, else pno base host */
- X int p_port`0914`093;`009`009/* If starbase, pno of ship docked to that p
- Vort,
- X`009`009`009`009 else p_port`0910`093 = port # docked to on host. */
- X short p_tractor;`009`009/* What player is in tractor lock */
- X int p_pos;`009`009`009/* My position in the player file */
- X`125;
- X
- Xstruct statentry `123
- X char name`09116`093, password`09116`093;
- X struct stats stats;
- X`125;
- X
- X/* Torpedo states */
- X
- X#define TFREE 0
- X#define TMOVE 1
- X#define TEXPLODE 2
- X#define TDET 3
- X#define TOFF 4
- X#define TSTRAIGHT 5`009`009/* Non-wobbling torp */
- X
- Xstruct torp `123
- X int t_no;
- X int t_status;`009`009/* State information */
- X int t_owner;`009`009
- X int t_x;
- X int t_y;
- X unsigned char t_dir;`009/* direction */
- X short t_turns; `009`009/* rate of change of direction if tracking */
- X int t_damage;`009`009/* damage for direct hit */
- X int t_speed;`009`009/* Moving speed */
- X int t_fuse;`009`009`009/* Life left in current state */
- X char t_war;`009`009`009/* enemies */
- X char t_team;`009`009/* launching team */
- X char t_whodet;`009`009/* who detonated... */
- X`125;
- X
- X/* Plasma Torpedo states */
- X
- X#define PTFREE 0
- X#define PTMOVE 1
- X#define PTEXPLODE 2
- X#define PTDET 3
- X
- Xstruct plasmatorp `123
- X int pt_no;
- X int pt_status;`009`009/* State information */
- X int pt_owner;
- X int pt_x;
- X int pt_y;
- X unsigned char pt_dir;`009/* direction */
- X short pt_turns; /* ticks turned per cycle */
- X int pt_damage;`009`009/* damage for direct hit */
- X int pt_speed;`009`009/* Moving speed */
- X int pt_fuse;`009 /* Life left in current state */
- X char pt_war;`009`009/* enemies */
- X char pt_team;`009`009/* launching team */
- X`125;
- X
- X#define PHFREE 0x00
- X#define PHHIT 0x01`009/* When it hits a person */
- X#define PHMISS 0x02
- X#define PHHIT2 0x04`009/* When it hits a photon */
- X
- Xstruct phaser `123
- X int ph_status;`009`009/* What it's up to */
- X unsigned char ph_dir;`009/* direction */
- X int ph_target;`009`009/* Who's being hit (for drawing) */
- X int ph_x, ph_y;`009`009/* For when it hits a torp */
- X int ph_fuse;`009`009/* Life left for drawing */
- X int ph_damage;`009`009/* Damage inflicted on victim */
- X`125;
- X
- X/* An important note concerning planets: The game assumes that
- X the planets are in a 'known' order. Ten planets per team,
- X the first being the home planet.
- X*/
- X
- X/* the lower bits represent the original owning team */
- X#define PLREPAIR 0x010
- X#define PLFUEL 0x020
- X#define PLAGRI 0x040`009`009
- X#define PLREDRAW 0x080`009`009/* Player close for redraw */
- X#define PLHOME 0x100`009`009/* home planet for a given team */
- X#define PLCOUP 0x200`009`009/* Coup has occured */
- X#define PLCHEAP 0x400`009`009/* Planet was taken from undefended team */
- X
- Xstruct planet `123
- X int pl_no;
- X int pl_flags;`009`009/* State information */
- X int pl_owner;
- X int pl_x;
- X int pl_y;
- X char pl_name`09116`093;
- X int pl_namelen;`009`009/* Cuts back on strlen's */
- X int pl_armies;
- X int pl_info;`009`009/* Teams which have info on planets */
- X int pl_deadtime;`009`009/* Time before planet will support life */
- X int pl_couptime;`009`009/* Time before coup may take place */
- X`125;
- X
- X#define MVALID 0x01
- X#define MINDIV 0x02
- X#define MTEAM 0x04
- X#define MALL 0x08
- X#define MGOD 0x10`009`009/* ATM */
- X
- Xstruct message `123
- X int m_no;
- X int m_flags;
- X int m_time;
- X int m_recpt;
- X char m_data`09180`093;
- X`125;
- X
- X/* message control structure */
- X
- Xstruct mctl `123
- X int mc_current;
- X`125;
- X
- X/* This is a structure used for objects returned by mouse pointing */
- X
- X#define PLANETTYPE 0x1
- X#define PLAYERTYPE 0x2
- X
- Xstruct obtype `123
- X int o_type;
- X int o_num;
- X`125;
- X
- Xstruct rank `123
- X float hours, ratings, defense;
- X char *name;
- X`125;
- X
- Xstruct memory `123
- X struct player`009players`091MAXPLAYER`093;
- X struct torp`009`009torps`091MAXPLAYER * MAXTORP`093;
- X struct plasmatorp plasmatorps`091MAXPLAYER * MAXPLASMA`093;
- X struct status`009status`0911`093;
- X struct planet`009planets`091MAXPLANETS`093;
- X struct phaser`009phasers`091MAXPLAYER`093;
- X struct mctl`009`009mctl`0911`093;
- X struct message`009messages`091MAXMESSAGE`093;
- X`125;
- X
- X#endif STRUCT_H
- $ CALL UNPACK STRUCT.H;1 828679959
- $ create/nolog 'f'
- X/*
- X * udpopt.c - present UDP control window
- 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
- X/*#define DOUBLE_UDP`009`009/* comment this out to remove it from menu */
- X
- X#define UDPBORDER`0092
- X#define UDPLEN`009`00935
- X
- X/* Set up the UDP control window */
- Xudpwindow()
- X`123
- X int i;
- X
- X for (i=0; i<UDP_NUMOPTS; i++)
- X`009udprefresh(i);
- X
- X /* Map window */
- X W_MapWindow(udpWin);
- X`125
- X
- X/*
- X * Refresh item i
- X */
- Xudprefresh(i)
- Xint i;
- X`123
- X char buf`091BUFSIZ`093;
- X
- X switch (i) `123
- X case UDP_CURRENT:
- X`009sprintf(buf, "UDP channel is %s", (commMode==COMM_TCP) ?
- X`009`009"CLOSED" : "OPEN");
- X`009break;
- X case UDP_STATUS:
- X`009strcpy(buf, "> Status: ");
- X`009switch (commStatus) `123
- X`009case STAT_CONNECTED:
- X`009 strcat(buf, "Connected"); break;
- X`009case STAT_SWITCH_UDP:
- X`009 strcat(buf, "Requesting switch to UDP"); break;
- X`009case STAT_SWITCH_TCP:
- X`009 strcat(buf, "Requesting switch to TCP"); break;
- X`009case STAT_VERIFY_UDP:
- X`009 strcat(buf, "Verifying UDP connection"); break;
- X`009default:
- X`009 fprintf(stderr, "netrek: UDP error: bad commStatus (%d)\n",
- X`009`009commStatus);
- X`009`125
- X`009break;
- X case UDP_DROPPED:
- X`009sprintf(buf, "> UDP trans dropped: %d (%d%% `124 %d%%)", udpDropped,
- X`009`009udpDropped * 100 / udpTotal,`009/* (udpTotal always > 0) */
- X`009`009udpRecentDropped * 100 / UDP_RECENT_INTR);
- X`009break;
- X case UDP_SEQUENCE:
- X`009sprintf(buf, "Sequence checking is %s", (udpSequenceChk) ? "ON":"OFF");
- X`009break;
- X case UDP_DEBUG:
- X`009sprintf(buf, "Debugging info is ");
- X`009switch (udpDebug) `123
- X`009case 0:
- X`009 strcat(buf, "OFF"); break;
- X`009case 1:
- X`009 strcat(buf, "ON (connect msgs only)"); break;
- X`009case 2:
- X`009 strcat(buf, "ON (verbose output)"); break;
- X`009`125
- X`009break;
- X case UDP_SEND:
- X`009sprintf(buf, "Sending with ");
- X`009switch (udpClientSend) `123
- X`009case 0:
- X`009 strcat(buf, "TCP only"); break;
- X`009case 1:
- X`009 strcat(buf, "simple UDP"); break;
- X`009case 2:
- X`009 strcat(buf, "enforced UDP (state only)"); break;
- X`009case 3:
- X`009 strcat(buf, "enforced UDP (state & weap)"); break;
- X`009`125
- X`009break;
- X case UDP_RECV:
- X`009sprintf(buf, "Receiving with ");
- X`009switch (udpClientRecv) `123
- X`009case MODE_TCP:
- X`009 strcat(buf, "TCP only"); break;
- X`009case MODE_SIMPLE:
- +-+-+-+-+-+-+-+- END OF PART 43 +-+-+-+-+-+-+-+-
-