xref: /original-bsd/games/sail/player.h (revision a0a7d8f4)
1 /*
2  * Copyright (c) 1983 Regents of the University of California,
3  * All rights reserved.  Redistribution permitted subject to
4  * the terms of the Berkeley Software License Agreement.
5  */
6 
7 /*
8  * @(#)player.h	2.8 04/23/85
9  */
10 
11 #include <curses.h>
12 #include "externs.h"
13 
14 /* sizes and coordinates for the screen */
15 
16 #define LINE_T		0
17 #define LINE_L		0
18 #define LINE_X		COLS
19 #define LINE_Y		1
20 #define LINE_B		(LINE_T+LINE_Y-1)
21 #define LINE_R		(LINE_L+LINE_X-1)
22 
23 #define BOX_T		1
24 #define BOX_L		0
25 #define BOX_X		65
26 #define BOX_Y		16
27 #define BOX_B		(BOX_T+BOX_Y-1)
28 #define BOX_R		(BOX_L+BOX_X-1)
29 
30 #define TURN_T		BOX_B
31 #define TURN_Y		1
32 #define TURN_L		((BOX_L+BOX_R-TURN_X)/2)
33 #define TURN_X		9
34 #define TURN_B		(TURN_T+TURN_Y+1)
35 #define TURN_R		(TURN_L+TURN_X+1)
36 
37 #define STAT_T		0
38 #define STAT_B		BOX_B
39 #define STAT_L		(BOX_R+2)
40 #define STAT_X		14
41 #define STAT_Y		(STAT_B-STAT_T+1)
42 #define STAT_R		(STAT_L+STAT_X-1)
43 #define STAT_1		0
44 #define STAT_2          (STAT_1+4)
45 #define STAT_3          (STAT_2+7)
46 
47 #define SCROLL_T	(BOX_B+1)
48 #define SCROLL_L	0
49 #define SCROLL_B	(LINES-1)
50 #define SCROLL_R	(COLS-1)
51 #define SCROLL_X	(SCROLL_R-SCROLL_L+1)
52 #define SCROLL_Y	(SCROLL_B-SCROLL_T+1)
53 
54 #define VIEW_T		(BOX_T+1)
55 #define VIEW_L		(BOX_L+1)
56 #define VIEW_X		(BOX_X-5)
57 #define VIEW_Y		(BOX_Y-2)
58 #define VIEW_B		(VIEW_T+VIEW_Y-1)
59 #define VIEW_R		(VIEW_L+VIEW_X-1)
60 
61 #define SLOT_T		VIEW_T
62 #define SLOT_L		(VIEW_R+1)
63 #define SLOT_X		3
64 #define SLOT_Y		VIEW_Y
65 #define SLOT_B		VIEW_B
66 #define SLOT_R		(SLOT_L+SLOT_X-1)
67 
68 #ifdef SIGTSTP
69 #define SCREENTEST()	(initscr() != ERR && signal(SIGTSTP, SIG_DFL) != BADSIG && STAT_R < COLS && SCROLL_Y > 0)
70 #else
71 #define SCREENTEST()	(initscr() != ERR && STAT_R < COLS && SCROLL_Y > 0)
72 #endif
73 
74 WINDOW *view_w;
75 WINDOW *slot_w;
76 WINDOW *scroll_w;
77 WINDOW *stat_w;
78 WINDOW *turn_w;
79 
80 char done_curses;
81 char loaded, fired, changed, repaired;
82 char dont_adjust;
83 int viewrow, viewcol;
84 char movebuf[sizeof SHIP(0)->file->movebuf];
85 char version[];
86 int player;
87 struct ship *ms;		/* memorial structure, &cc->ship[player] */
88 struct File *mf;		/* ms->file */
89 struct shipspecs *mc;		/* ms->specs */
90 
91 /* condition codes for leave() */
92 #define LEAVE_QUIT	0
93 #define LEAVE_CAPTURED	1
94 #define LEAVE_HURRICAN	2
95 #define LEAVE_DRIVER	3
96 #define LEAVE_FORK	4
97 #define LEAVE_SYNC	5
98