xref: /original-bsd/games/sail/extern.h (revision 014fe330)
1 /*
2  * sccsid = "@(#)extern.h	1.4 83/05/20";
3  */
4 #include <stdio.h>
5 #include <signal.h>
6 #include <ctype.h>
7 #include "machdep.h"
8 
9 #define NUMOFSCENES 32
10 
11 #define die() (((rand() >> 6) % 6) + 1)
12 #define fouled(a) Fouled(a, 342)
13 #define grappled(a) Fouled(a, 382)
14 #define grapple(a,b) Grapple(a,b,382)
15 #define foul(a,b) Grapple(a,b,342)
16 #define sqr(a) ((a) * (a))
17 #define abs(a) ((a) > 0 ? (a) : -(a))
18 #define min(a,b) ((a) < (b) ? (a) : (b))
19 
20 #define GRAPE   1
21 #define CHAIN   2
22 #define ROUND   3
23 #define DOUBLE  4
24 
25 #define HULL    0
26 #define RIGGING 1
27 
28 #define SPECS	32
29 #define FILES	64
30 #define SCENARIO	128
31 
32 struct logs {
33     char fname[20];
34     int uid, fshipnum, fgamenum, netpoints;
35 };
36 
37 struct BP {
38 	int turnsent, toship, mensent;
39 };
40 
41 struct snag {
42 	int turnfoul, toship;
43 };
44 
45 typedef struct {
46 	int row, col, dir;
47 } postype;
48 postype pos[20];
49 
50 struct File {
51 	char captain[20];
52 	int points;
53 	int loadL, loadR, readyL, readyR;
54 	struct BP OBP[3], DBP[3];
55 	int struck, captured, pcrew;
56 	char last[10];
57 	int drift;
58 	struct snag fouls[10], grapples[10];
59 	char signal[60];
60 	int RH, RG, RR, FS, explode, sink;
61 };
62 
63 typedef struct {
64 	char *shipname;
65 	int shipnum, nationality;
66 	int shiprow, shipcol, shipdir;
67 	struct File *file;
68 } ships;
69 
70 struct scenario {
71 	int winddir, windspeed, windchange;
72 	int turn, people, time, vessels;
73 	char *name;
74 	ships ship[10];
75 };
76 struct scenario scene[NUMOFSCENES];
77 
78 struct shipspecs {
79 	int bs, fs, ta, guns, class, hull, qual, crew1,
80 		crew2, crew3, gunL, gunR, carL, carR,
81 		rig1, rig2, rig3, rig4, pts;
82 };
83 struct shipspecs specs[];
84 
85 struct windeffects {
86 	int A, B, C, D;
87 };
88 struct windeffects WET[7][6];
89 
90 struct Tables {
91 	int H, G, C, R;
92 };
93 struct Tables RigTable[11][6];
94 struct Tables HullTable[11][6];
95 
96 int AMMO[9][4];
97 
98 int HDT[9][10];
99 
100 int HDTrake[9][10];
101 
102 int QUAL[9][5];
103 
104 int MT[9][3];
105 
106 int loaded, fired, changed, repaired, buffercount, xlast, ylast;
107 long lastsync;
108 int winddir, windspeed, turn, viewrow, viewcol;
109 int player, nation[5], scroll, game;
110 int MIGHTYCAPTAIN;
111 char Outbuf[BUFSIZE], movebuf[10], loadwith[20];
112 FILE *syncfile;
113 
114 char colours();
115 char gunsbear();
116 char *info();
117 char iinitial();
118 char *quality();
119 char sterncolor();
120 char strend();
121 char symbol();
122 double arctan();
123