xref: /original-bsd/games/sail/player.h (revision a141c157)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)player.h	5.3 (Berkeley) 06/18/88
18  */
19 
20 #include <curses.h>
21 #include "externs.h"
22 
23 /* sizes and coordinates for the screen */
24 
25 #define LINE_T		0
26 #define LINE_L		0
27 #define LINE_X		COLS
28 #define LINE_Y		1
29 #define LINE_B		(LINE_T+LINE_Y-1)
30 #define LINE_R		(LINE_L+LINE_X-1)
31 
32 #define BOX_T		1
33 #define BOX_L		0
34 #define BOX_X		65
35 #define BOX_Y		16
36 #define BOX_B		(BOX_T+BOX_Y-1)
37 #define BOX_R		(BOX_L+BOX_X-1)
38 
39 #define TURN_T		BOX_B
40 #define TURN_Y		1
41 #define TURN_L		((BOX_L+BOX_R-TURN_X)/2)
42 #define TURN_X		9
43 #define TURN_B		(TURN_T+TURN_Y+1)
44 #define TURN_R		(TURN_L+TURN_X+1)
45 
46 #define STAT_T		0
47 #define STAT_B		BOX_B
48 #define STAT_L		(BOX_R+2)
49 #define STAT_X		14
50 #define STAT_Y		(STAT_B-STAT_T+1)
51 #define STAT_R		(STAT_L+STAT_X-1)
52 #define STAT_1		0
53 #define STAT_2          (STAT_1+4)
54 #define STAT_3          (STAT_2+7)
55 
56 #define SCROLL_T	(BOX_B+1)
57 #define SCROLL_L	0
58 #define SCROLL_B	(LINES-1)
59 #define SCROLL_R	(COLS-1)
60 #define SCROLL_X	(SCROLL_R-SCROLL_L+1)
61 #define SCROLL_Y	(SCROLL_B-SCROLL_T+1)
62 
63 #define VIEW_T		(BOX_T+1)
64 #define VIEW_L		(BOX_L+1)
65 #define VIEW_X		(BOX_X-5)
66 #define VIEW_Y		(BOX_Y-2)
67 #define VIEW_B		(VIEW_T+VIEW_Y-1)
68 #define VIEW_R		(VIEW_L+VIEW_X-1)
69 
70 #define SLOT_T		VIEW_T
71 #define SLOT_L		(VIEW_R+1)
72 #define SLOT_X		3
73 #define SLOT_Y		VIEW_Y
74 #define SLOT_B		VIEW_B
75 #define SLOT_R		(SLOT_L+SLOT_X-1)
76 
77 #ifdef SIGTSTP
78 #define SCREENTEST()	(initscr() != ERR && signal(SIGTSTP, SIG_DFL) != BADSIG && STAT_R < COLS && SCROLL_Y > 0)
79 #else
80 #define SCREENTEST()	(initscr() != ERR && STAT_R < COLS && SCROLL_Y > 0)
81 #endif
82 
83 WINDOW *view_w;
84 WINDOW *slot_w;
85 WINDOW *scroll_w;
86 WINDOW *stat_w;
87 WINDOW *turn_w;
88 
89 char done_curses;
90 char loaded, fired, changed, repaired;
91 char dont_adjust;
92 int viewrow, viewcol;
93 char movebuf[sizeof SHIP(0)->file->movebuf];
94 char version[];
95 int player;
96 struct ship *ms;		/* memorial structure, &cc->ship[player] */
97 struct File *mf;		/* ms->file */
98 struct shipspecs *mc;		/* ms->specs */
99 
100 /* condition codes for leave() */
101 #define LEAVE_QUIT	0
102 #define LEAVE_CAPTURED	1
103 #define LEAVE_HURRICAN	2
104 #define LEAVE_DRIVER	3
105 #define LEAVE_FORK	4
106 #define LEAVE_SYNC	5
107