xref: /openbsd/games/phantasia/map.c (revision d973fa72)
1 /*	$OpenBSD: map.c,v 1.4 2016/01/06 09:29:34 tb Exp $	*/
2 /*	$NetBSD: map.c,v 1.2 1995/03/24 03:58:58 cgd Exp $	*/
3 
4 #define	minusminus	plusplus
5 #define	minusplus	plusminus
6 
7 int
main(int argc,char * argv[])8 main(int argc, char *argv[])
9 {
10     /* Set up */
11 
12     openpl();
13     space(-1400, -1000, 1200, 1200);
14 
15     /* Big box */
16 
17     move(-1400, -1000);
18     cont(-1400, 1000);
19     cont(600, 1000);
20     cont(600, -1000);
21     cont(-1400, -1000);
22 
23     /* Grid -- horizontal lines every 200 */
24 
25     linemod("dotted");
26     line(600, -800, -1400, -800);
27     line(-1400, -600, 600, -600);
28     line(600, -400, -1400, -400);
29     line(-1400, -200, 600, -200);
30     linemod("solid");
31     line(600, 0, -1400, 0);
32     linemod("dotted");
33     line(-1400, 200, 600, 200);
34     line(600, 400, -1400, 400);
35     line(-1400, 600, 600, 600);
36     line(600, 800, -1400, 800);
37 
38     /* Grid -- vertical lines every 200 */
39 
40     line(-1200, 1000, -1200, -1000);
41     line(-1000, 1000, -1000, -1000);
42     line(-800, 1000, -800, -1000);
43     line(-600, 1000, -600, -1000);
44     linemod("solid");
45     line(-400, 1000, -400, -1000);
46     linemod("dotted");
47     line(-200, 1000, -200, -1000);
48     line(0, 1000, 0, -1000);
49     line(200, 1000, 200, -1000);
50     line(400, 1000, 400, -1000);
51 
52     /* Circles radius +250 on "center" */
53 
54     linemod("solid");
55     circle(-400, 0, 250);
56     circle(-400, 0, 500);
57     circle(-400, 0, 750);
58     circle(-400, 0, 1000);
59 
60     /* A few labels */
61 
62     move(-670, 1075);
63     label("- THE PHANTASIA UNIVERSE -");
64     line(-630, 1045, -115, 1045);
65     move(-360, 80);
66     label("Lorien");
67     move(-385, -100);
68     label("Ithilien");
69     move(-560, 80);
70     label("Rohan");
71     move(-580, -100);
72     label("Anorien");
73     plusplus("Rovanion", -250, 320);
74     plusplus("The Iron Hills", -100, 560);
75     plusplus("Rhun", 250, 570);
76     minusplus("Dunland", -700, 160);
77     minusplus("Eriador", -920, 300);
78     minusplus("The Northern Waste", -1240, 320);
79     minusminus("Gondor", -720, -180);
80     minusminus("South Gondor", -940, -270);
81     minusminus("Far Harad", -1100, -500);
82     plusminus("Mordor", -180, -300);
83     plusminus("Khand", 0, -500);
84     plusminus("Near Harad", 40, -780);
85     move(340, 900);
86     label("The Moors");
87     move(300, 840);
88     label("Adventurous");
89     move(340, -840);
90     label("The Moors");
91     move(300, -900);
92     label("Adventurous");
93     move(-1340, 900);
94     label("The Moors");
95     move(-1340, 840);
96     label("Adventurous");
97     move(-1340, -840);
98     label("The Moors");
99     move(-1340, -900);
100     label("Adventurous");
101     move(700, 1000);
102     label("OUTER CIRCLES:");
103     line(690, 970, 1000, 970);
104     move(700, 900);
105     label("> 9:  The Outer Waste");
106     move(700, 800);
107     label("> 20: The Dead Marshes");
108     move(700, 700);
109     label("> 35: Kennaquhair");
110     move(700, 600);
111     label("> 55: Morannon");
112     move(700, 300);
113     label("(0,0): The Lord's Chamber");
114 
115     move(700, -400);
116     label("Grid squares are 100 x 100");
117     move(700, -800);
118     label("Created by Ted Estes");
119     move(700, -860);
120     label("Plotted by Chris Robertson");
121     move(700, -920);
122     label(" c  1985");
123     circle(723, -923, 20);
124 
125     /* Close down */
126 
127     move(-1380, 1180);
128     closepl();
129     return 0;
130 }
131 
132 /* draw strings in plus plus quadrant */
133 void
plusplus(char * s,int x,int y)134 plusplus(char *s, int x, int y)
135 {
136 char	s1[2];
137 
138     while (*s)
139 	{
140 	move(x, y);
141 	s1[0] = *s++;
142 	s1[1] = '\0';
143 	label(s1);
144 	x += 25;
145 	y -= 30;
146 	}
147 }
148 
149 /* draw strings in plus minus quadrant */
150 void
plusminus(char * s,int x,int y)151 plusminus(char *s, int x, int y)
152 {
153 char	s1[2];
154 
155     while (*s)
156 	{
157 	move(x, y);
158 	s1[0] = *s++;
159 	s1[1] = '\0';
160 	label(s1);
161 	x += 25;
162 	y += 30;
163 	}
164 }
165