home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / vmsnet / vmstrek / part43 < prev    next >
Encoding:
Text File  |  1992-11-20  |  14.5 KB  |  450 lines

  1. Newsgroups: vmsnet.sources.games
  2. Path: uunet!zaphod.mps.ohio-state.edu!rpi!usenet.coe.montana.edu!news.u.washington.edu!raven.alaska.edu!acad2.alaska.edu!asdmf
  3. From: asdmf@acad2.alaska.edu
  4. Subject: Vmsnetrek 43/47
  5. Message-ID: <1992Nov20.210217.1@acad2.alaska.edu>
  6. Lines: 437
  7. Sender: news@raven.alaska.edu (USENET News System)
  8. Nntp-Posting-Host: acad2.alaska.edu
  9. Organization: University of Alaska
  10. Date: Sat, 21 Nov 1992 01:02:17 GMT
  11. Xref: uunet vmsnet.sources.games:543
  12.  
  13. -+-+-+-+-+-+-+-+ START OF PART 43 -+-+-+-+-+-+-+-+
  14. X    sliders`0910`093.low_red = .20 * ((double) sliders`0910`093.max);
  15. X    sliders`0910`093.high_red = sliders`0910`093.max;
  16. X
  17. X    sliders`0911`093.max = me->p_ship.s_maxdamage;
  18. X
  19. X    sliders`0912`093.max = me->p_ship.s_maxfuel;
  20. X    sliders`0912`093.low_red = .20 * ((double) sliders`0912`093.max);
  21. X    sliders`0912`093.high_red = sliders`0912`093.max;
  22. X
  23. X    sliders`0913`093.max = me->p_ship.s_maxspeed;
  24. X    sliders`0913`093.high_red = sliders`0913`093.max;
  25. X
  26. X    sliders`0914`093.max = 1.2 * ((double) me->p_ship.s_maxwpntemp);
  27. X    sliders`0914`093.high_red = .667 * ((double) sliders`0914`093.max);
  28. X
  29. X    sliders`0915`093.max = 1.2 * ((double) me->p_ship.s_maxegntemp);
  30. X    sliders`0915`093.high_red = .667 * ((double) sliders`0915`093.max);
  31. X
  32. X    for (i=0; i<NUM_SLIDERS; i++)`032
  33. X`009sliders`091i`093.diff = sliders`091i`093.max - sliders`091i`093.min;
  34. X
  35. X`125
  36. $ CALL UNPACK STATS.C;1 1495339030
  37. $ create/nolog 'f'
  38. X#ifndef STRUCT_H
  39. X#define STRUCT_H 1
  40. X/*
  41. X * struct.h for the client of an xtrek socket protocol.
  42. X *
  43. X * Most of the unneeded stuff in the structures has been thrown away.
  44. X */
  45. X#include "copyright.h"
  46. X
  47. Xstruct status `123
  48. X    unsigned char tourn;`009/* Tournament mode? */
  49. X`009    /* These stats only updated during tournament mode */
  50. X    unsigned int armsbomb, planets, kills, losses, time;
  51. X`009    /* Use long for this, so it never wraps */
  52. X    unsigned long timeprod;
  53. X`125;
  54. X
  55. X#define PFREE 0
  56. X#define POUTFIT 1
  57. X#define PALIVE 2
  58. X#define PEXPLODE 3
  59. X#define PDEAD 4
  60. X
  61. X#define PFSHIELD`0090x0001
  62. X#define PFREPAIR`0090x0002
  63. X#define PFBOMB`009`0090x0004
  64. X#define PFORBIT`009`0090x0008
  65. X#define PFCLOAK`009`0090x0010
  66. X#define PFWEP`009`0090x0020
  67. X#define PFENG`009`0090x0040
  68. X#define PFROBOT`009`0090x0080
  69. X#define PFBEAMUP`0090x0100
  70. X#define PFBEAMDOWN`0090x0200
  71. X#define PFSELFDEST`0090x0400
  72. X#define PFGREEN`009`0090x0800
  73. X#define PFYELLOW`0090x1000
  74. X#define PFRED`009`0090x2000
  75. X#define PFPLOCK`009`0090x4000`009`009/* Locked on a player */
  76. X#define PFPLLOCK`0090x8000`009`009/* Locked on a planet */
  77. X#define PFCOPILOT`0090x10000`009`009/* Allow copilots */
  78. X#define PFWAR`009`0090x20000`009`009/* computer reprogramming for war */
  79. X#define PFPRACTR`0090x40000`009`009/* practice type robot (no kills) */
  80. X#define PFDOCK          0x80000         /* true if docked to a starbase */
  81. X#define PFREFIT         0x100000        /* true if about to refit */
  82. X#define PFREFITTING`0090x200000`009/* true if currently refitting */
  83. X#define PFTRACT  `0090x400000`009/* tractor beam activated */
  84. X#define PFPRESS  `0090x800000`009/* pressor beam activated */
  85. X#define PFDOCKOK`0090x1000000`009/* docking permission */
  86. X
  87. X#define KQUIT`009`0090x01`009`009/* Player quit */
  88. X#define KTORP`009`0090x02`009`009/* killed by torp */
  89. X#define KPHASER`009`0090x03`009`009/* killed by phaser */
  90. X#define KPLANET`009`0090x04`009`009/* killed by planet */
  91. X#define KSHIP`009`0090x05`009`009/* killed by other ship */
  92. X#define KDAEMON`009`0090x06`009`009/* killed by dying daemon */
  93. X#define KWINNER`009`0090x07`009`009/* killed by a winner */
  94. X#define KGHOST`009`0090x08`009`009/* killed because a ghost */
  95. X#define KGENOCIDE`0090x09`009`009/* killed by genocide */
  96. X#define KPROVIDENCE`0090x0a`009`009/* killed by a hacker */
  97. X#define KPLASMA         0x0b            /* killed by a plasma torpedo */
  98. X#define KBADBIN`009`0090x0c`009`009/* ATM: bad netrek binary */
  99. X
  100. X#define NUM_TYPES 8`009/* ATM - Galaxy */
  101. X#define SCOUT 0
  102. X#define DESTROYER 1
  103. X#define CRUISER 2
  104. X#define BATTLESHIP 3
  105. X#define ASSAULT 4
  106. X#define STARBASE 5
  107. X#define GALAXY 6
  108. X#define ATT 7`009`009/* ATM */
  109. X
  110. Xstruct ship `123
  111. X    short s_phaserdamage;
  112. X    int s_maxspeed;
  113. X    int s_maxfuel;
  114. X    int s_maxshield;
  115. X    int s_maxdamage;
  116. X    int s_maxegntemp;
  117. X    int s_maxwpntemp;
  118. X    short s_maxarmies;
  119. X    short s_width;
  120. X    short s_height;
  121. X    short s_type;
  122. X    int s_torpspeed;
  123. X`125;
  124. X
  125. Xstruct stats `123
  126. X    double st_maxkills;`009`009/* max kills ever */
  127. X    int st_kills;`009`009/* how many kills */
  128. X    int st_losses;`009`009/* times killed */
  129. X    int st_armsbomb;`009`009/* armies bombed */
  130. X    int st_planets;`009`009/* planets conquered */
  131. X    int st_ticks;`009`009/* Ticks I've been in game */
  132. X    int st_tkills;`009`009/* Kills in tournament play */
  133. X    int st_tlosses;`009`009/* Losses in tournament play */
  134. X    int st_tarmsbomb;`009`009/* Tournament armies bombed */
  135. X    int st_tplanets;`009`009/* Tournament planets conquered */
  136. X    int st_tticks;`009`009/* Tournament ticks */
  137. X`009`009`009`009/* SB stats are entirely separate */
  138. X    int st_sbkills;`009`009/* Kills as starbase */
  139. X    int st_sblosses;`009`009/* Losses as starbase */
  140. X    int st_sbticks;`009`009/* Time as starbase */
  141. X    double st_sbmaxkills;       /* Max kills as starbase */
  142. X    long st_lastlogin;`009`009/* Last time this player was played */
  143. X    int st_flags;`009`009/* Misc option flags */
  144. X    char st_keymap`09196`093;`009`009/* keymap for this player */
  145. X    int st_rank;`009`009/* Ranking of the player */
  146. X`125;
  147. X
  148. X#define ST_MAPMODE      1
  149. X#define ST_NAMEMODE     2
  150. X#define ST_SHOWSHIELDS  4
  151. X#define ST_KEEPPEACE    8
  152. X#define ST_SHOWLOCAL    16      /* two bits for these two */
  153. X#define ST_SHOWGLOBAL   64
  154. X
  155. Xstruct player `123
  156. X    int p_no;
  157. X    int p_updates;`009`009/* Number of updates ship has survived */
  158. X    int p_status;`009`009/* Player status */
  159. X    unsigned int p_flags;`009/* Player flags */
  160. X    char p_name`09116`093;
  161. X    char p_login`09116`093;
  162. X    char p_monitor`09116`093;`009`009/* Monitor being played on */
  163. X    char p_mapchars`0912`093;`009`009/* Cache for map window image */
  164. X    struct ship p_ship;`009`009/* Personal ship statistics */
  165. X    int p_x;
  166. X    int p_y;
  167. X    unsigned char p_dir;`009/* Real direction */
  168. X    unsigned char p_desdir;`009/* desired direction */
  169. X    int p_subdir;`009`009/* fraction direction change */
  170. X    int p_speed;`009`009/* Real speed */
  171. X    short p_desspeed;`009`009/* Desired speed */
  172. X    int p_subspeed;`009`009/* Fractional speed */
  173. X    short p_team;`009`009`009/* Team I'm on */
  174. X    int p_damage;`009`009/* Current damage */
  175. X    int p_subdamage;`009`009/* Fractional damage repair */
  176. X    int p_shield;`009`009/* Current shield power */
  177. X    int p_subshield;`009`009/* Fractional shield recharge */
  178. X    short p_cloakphase;`009`009/* Drawing stage of cloaking engage/disengage
  179. V. */
  180. X    short p_ntorp;`009`009/* Number of torps flying */
  181. X    short p_nplasmatorp;        /* Number of plasma torps active */
  182. X    char p_hostile;`009`009/* Who my torps will hurt */
  183. X    char p_swar;`009`009/* Who am I at sticky war with */
  184. X    float p_kills;`009`009/* Enemies killed */
  185. X    short p_planet;`009`009/* Planet orbiting or locked onto */
  186. X    short p_playerl;`009`009/* Player locked onto */
  187. X    short p_armies;`009
  188. X    int p_fuel;
  189. X    short p_explode;`009`009/* Keeps track of final explosion */
  190. X    int p_etemp;
  191. X    short p_etime;
  192. X    int p_wtemp;
  193. X    short p_wtime;
  194. X    short p_whydead;`009`009/* Tells you why you died */
  195. X    short p_whodead;`009`009/* Tells you who killed you */
  196. X    struct stats p_stats;`009/* player statistics */
  197. X    short p_genoplanets;`009/* planets taken since last genocide */
  198. X    short p_genoarmsbomb;`009/* armies bombed since last genocide */
  199. X    short p_planets;`009`009/* planets taken this game */
  200. X    short p_armsbomb;`009`009/* armies bombed this game */
  201. X    int p_ghostbuster;
  202. X    int p_docked;`009`009/* If starbase, # docked to, else pno base host */
  203. X    int p_port`0914`093;`009`009/* If starbase, pno of ship docked to that p
  204. Vort,
  205. X`009`009`009`009   else p_port`0910`093 = port # docked to on host.   */
  206. X    short p_tractor;`009`009/* What player is in tractor lock */
  207. X    int p_pos;`009`009`009/* My position in the player file */
  208. X`125;
  209. X
  210. Xstruct statentry `123
  211. X    char name`09116`093, password`09116`093;
  212. X    struct stats stats;
  213. X`125;
  214. X
  215. X/* Torpedo states */
  216. X
  217. X#define TFREE 0
  218. X#define TMOVE 1
  219. X#define TEXPLODE 2
  220. X#define TDET 3
  221. X#define TOFF 4
  222. X#define TSTRAIGHT 5`009`009/* Non-wobbling torp */
  223. X
  224. Xstruct torp `123
  225. X    int t_no;
  226. X    int t_status;`009`009/* State information */
  227. X    int t_owner;`009`009
  228. X    int t_x;
  229. X    int t_y;
  230. X    unsigned char t_dir;`009/* direction */
  231. X    short t_turns; `009`009/* rate of change of direction if tracking */
  232. X    int t_damage;`009`009/* damage for direct hit */
  233. X    int t_speed;`009`009/* Moving speed */
  234. X    int t_fuse;`009`009`009/* Life left in current state */
  235. X    char t_war;`009`009`009/* enemies */
  236. X    char t_team;`009`009/* launching team */
  237. X    char t_whodet;`009`009/* who detonated... */
  238. X`125;
  239. X
  240. X/* Plasma Torpedo states */
  241. X
  242. X#define PTFREE 0
  243. X#define PTMOVE 1
  244. X#define PTEXPLODE 2
  245. X#define PTDET 3
  246. X
  247. Xstruct plasmatorp `123
  248. X    int pt_no;
  249. X    int pt_status;`009`009/* State information */
  250. X    int pt_owner;
  251. X    int pt_x;
  252. X    int pt_y;
  253. X    unsigned char pt_dir;`009/* direction */
  254. X    short pt_turns;             /* ticks turned per cycle */
  255. X    int pt_damage;`009`009/* damage for direct hit */
  256. X    int pt_speed;`009`009/* Moving speed */
  257. X    int pt_fuse;`009        /* Life left in current state */
  258. X    char pt_war;`009`009/* enemies */
  259. X    char pt_team;`009`009/* launching team */
  260. X`125;
  261. X
  262. X#define PHFREE 0x00
  263. X#define PHHIT  0x01`009/* When it hits a person */
  264. X#define PHMISS 0x02
  265. X#define PHHIT2 0x04`009/* When it hits a photon */
  266. X
  267. Xstruct phaser `123
  268. X    int ph_status;`009`009/* What it's up to */
  269. X    unsigned char ph_dir;`009/* direction */
  270. X    int ph_target;`009`009/* Who's being hit (for drawing) */
  271. X    int ph_x, ph_y;`009`009/* For when it hits a torp */
  272. X    int ph_fuse;`009`009/* Life left for drawing */
  273. X    int ph_damage;`009`009/* Damage inflicted on victim */
  274. X`125;
  275. X
  276. X/* An important note concerning planets:  The game assumes that
  277. X    the planets are in a 'known' order.  Ten planets per team,
  278. X    the first being the home planet.
  279. X*/
  280. X
  281. X/* the lower bits represent the original owning team */
  282. X#define PLREPAIR 0x010
  283. X#define PLFUEL 0x020
  284. X#define PLAGRI 0x040`009`009
  285. X#define PLREDRAW 0x080`009`009/* Player close for redraw */
  286. X#define PLHOME 0x100`009`009/* home planet for a given team */
  287. X#define PLCOUP 0x200`009`009/* Coup has occured */
  288. X#define PLCHEAP 0x400`009`009/* Planet was taken from undefended team */
  289. X
  290. Xstruct planet `123
  291. X    int pl_no;
  292. X    int pl_flags;`009`009/* State information */
  293. X    int pl_owner;
  294. X    int pl_x;
  295. X    int pl_y;
  296. X    char pl_name`09116`093;
  297. X    int pl_namelen;`009`009/* Cuts back on strlen's */
  298. X    int pl_armies;
  299. X    int pl_info;`009`009/* Teams which have info on planets */
  300. X    int pl_deadtime;`009`009/* Time before planet will support life */
  301. X    int pl_couptime;`009`009/* Time before coup may take place */
  302. X`125;
  303. X
  304. X#define MVALID 0x01
  305. X#define MINDIV 0x02
  306. X#define MTEAM  0x04
  307. X#define MALL   0x08
  308. X#define MGOD   0x10`009`009/* ATM */
  309. X
  310. Xstruct message `123
  311. X    int m_no;
  312. X    int m_flags;
  313. X    int m_time;
  314. X    int m_recpt;
  315. X    char m_data`09180`093;
  316. X`125;
  317. X
  318. X/* message control structure */
  319. X
  320. Xstruct mctl `123
  321. X    int mc_current;
  322. X`125;
  323. X
  324. X/* This is a structure used for objects returned by mouse pointing */
  325. X
  326. X#define PLANETTYPE 0x1
  327. X#define PLAYERTYPE 0x2
  328. X
  329. Xstruct obtype `123
  330. X    int o_type;
  331. X    int o_num;
  332. X`125;
  333. X
  334. Xstruct rank `123
  335. X    float hours, ratings, defense;
  336. X    char *name;
  337. X`125;
  338. X
  339. Xstruct memory `123
  340. X    struct player`009players`091MAXPLAYER`093;
  341. X    struct torp`009`009torps`091MAXPLAYER * MAXTORP`093;
  342. X    struct plasmatorp   plasmatorps`091MAXPLAYER * MAXPLASMA`093;
  343. X    struct status`009status`0911`093;
  344. X    struct planet`009planets`091MAXPLANETS`093;
  345. X    struct phaser`009phasers`091MAXPLAYER`093;
  346. X    struct mctl`009`009mctl`0911`093;
  347. X    struct message`009messages`091MAXMESSAGE`093;
  348. X`125;
  349. X
  350. X#endif STRUCT_H
  351. $ CALL UNPACK STRUCT.H;1 828679959
  352. $ create/nolog 'f'
  353. X/*
  354. X * udpopt.c - present UDP control window
  355. X */
  356. X#include "copyright.h"
  357. X
  358. X#include <stdio.h>
  359. X#include <ctype.h>
  360. X#include "Wlib.h"
  361. X#include "defs.h"
  362. X#include "struct.h"
  363. X#include "data.h"
  364. X
  365. X/*#define DOUBLE_UDP`009`009/* comment this out to remove it from menu */
  366. X
  367. X#define UDPBORDER`0092
  368. X#define UDPLEN`009`00935
  369. X
  370. X/* Set up the UDP control window */
  371. Xudpwindow()
  372. X`123
  373. X    int i;
  374. X
  375. X    for (i=0; i<UDP_NUMOPTS; i++)
  376. X`009udprefresh(i);
  377. X
  378. X    /* Map window */
  379. X    W_MapWindow(udpWin);
  380. X`125
  381. X
  382. X/*
  383. X * Refresh item i
  384. X */
  385. Xudprefresh(i)
  386. Xint i;
  387. X`123
  388. X    char buf`091BUFSIZ`093;
  389. X
  390. X    switch (i) `123
  391. X    case UDP_CURRENT:
  392. X`009sprintf(buf, "UDP channel is %s", (commMode==COMM_TCP) ?
  393. X`009`009"CLOSED" : "OPEN");
  394. X`009break;
  395. X    case UDP_STATUS:
  396. X`009strcpy(buf, "> Status: ");
  397. X`009switch (commStatus) `123
  398. X`009case STAT_CONNECTED:
  399. X`009    strcat(buf, "Connected"); break;
  400. X`009case STAT_SWITCH_UDP:
  401. X`009    strcat(buf, "Requesting switch to UDP"); break;
  402. X`009case STAT_SWITCH_TCP:
  403. X`009    strcat(buf, "Requesting switch to TCP"); break;
  404. X`009case STAT_VERIFY_UDP:
  405. X`009    strcat(buf, "Verifying UDP connection"); break;
  406. X`009default:
  407. X`009    fprintf(stderr, "netrek: UDP error: bad commStatus (%d)\n",
  408. X`009`009commStatus);
  409. X`009`125
  410. X`009break;
  411. X    case UDP_DROPPED:
  412. X`009sprintf(buf, "> UDP trans dropped: %d (%d%% `124 %d%%)", udpDropped,
  413. X`009`009udpDropped * 100 / udpTotal,`009/* (udpTotal always > 0) */
  414. X`009`009udpRecentDropped * 100 / UDP_RECENT_INTR);
  415. X`009break;
  416. X    case UDP_SEQUENCE:
  417. X`009sprintf(buf, "Sequence checking is %s", (udpSequenceChk) ? "ON":"OFF");
  418. X`009break;
  419. X    case UDP_DEBUG:
  420. X`009sprintf(buf, "Debugging info is ");
  421. X`009switch (udpDebug) `123
  422. X`009case 0:
  423. X`009    strcat(buf, "OFF"); break;
  424. X`009case 1:
  425. X`009    strcat(buf, "ON (connect msgs only)"); break;
  426. X`009case 2:
  427. X`009    strcat(buf, "ON (verbose output)"); break;
  428. X`009`125
  429. X`009break;
  430. X    case UDP_SEND:
  431. X`009sprintf(buf, "Sending with ");
  432. X`009switch (udpClientSend) `123
  433. X`009case 0:
  434. X`009    strcat(buf, "TCP only"); break;
  435. X`009case 1:
  436. X`009    strcat(buf, "simple UDP"); break;
  437. X`009case 2:
  438. X`009    strcat(buf, "enforced UDP (state only)"); break;
  439. X`009case 3:
  440. X`009    strcat(buf, "enforced UDP (state & weap)"); break;
  441. X`009`125
  442. X`009break;
  443. X    case UDP_RECV:
  444. X`009sprintf(buf, "Receiving with ");
  445. X`009switch (udpClientRecv) `123
  446. X`009case MODE_TCP:
  447. X`009    strcat(buf, "TCP only"); break;
  448. X`009case MODE_SIMPLE:
  449. +-+-+-+-+-+-+-+-  END  OF PART 43 +-+-+-+-+-+-+-+-
  450.