source: trunk/ncurses/test/xmas.c@ 2787

Last change on this file since 2787 was 2621, checked in by bird, 19 years ago

GNU ncurses 5.5

File size: 33.3 KB
Line 
1/******************************************************************************/
2/* asciixmas */
3/* December 1989 Larry Bartz Indianapolis, IN */
4/* */
5/* */
6/* I'm dreaming of an ascii character-based monochrome Christmas, */
7/* Just like the one's I used to know! */
8/* Via a full duplex communications channel, */
9/* At 9600 bits per second, */
10/* Even though it's kinda slow. */
11/* */
12/* I'm dreaming of an ascii character-based monochrome Christmas, */
13/* With ev'ry C program I write! */
14/* May your screen be merry and bright! */
15/* And may all your Christmases be amber or green, */
16/* (for reduced eyestrain and improved visibility)! */
17/* */
18/* */
19/* */
20/* */
21/* */
22/* IMPLEMENTATION */
23/* */
24/* Feel free to modify the defined string FROMWHO to reflect you, your */
25/* organization, your site, whatever. */
26/* */
27/* This really looks a lot better if you can turn off your cursor before */
28/* execution. I wanted to do that here but very few termcap entries or */
29/* terminfo definitions have the appropriate string defined. If you know */
30/* the string(s) for the terminal(s) you use or which your site supports, */
31/* you could call asciixmas from within a shell in which you issue the */
32/* string to the terminal. The cursor is distracting but it doesn't really */
33/* ruin the show. */
34/* */
35/* At our site, we invoke this for our users just after login and the */
36/* determination of terminal type. */
37/* */
38/* */
39/* PORTABILITY */
40/* */
41/* I wrote this using only the very simplest curses functions so that it */
42/* might be the most portable. I was personally able to test on five */
43/* different cpu/UNIX combinations. */
44/* */
45/* */
46/* COMPILE */
47/* */
48/* usually this: */
49/* */
50/* cc -O asciixmas.c -lcurses -o asciixmas -s */
51/* */
52/* */
53/* Zilog S8000 models 11, 21, 31, etc with ZEUS variant of SYSTEM III */
54/* maybe other SYSTEM III also: */
55/* */
56/* cc asciixmas.c -lcurses -ltermlib -o asciixmas -s */
57/* */
58/* as above with optional "peephole optimizer" installed: */
59/* */
60/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s */
61/* */
62/* */
63/* Zilog S8000 models 32, 130 with WE32100 chip and SYS V, REL2 */
64/* maybe 3B2 also? */
65/* */
66/* cc -f -O -K sd asciixmas.c -lcurses -o asciixmas -s */
67/* */
68/* */
69/* Pyramid, Sequent, any other "dual universe" types compile and execute */
70/* under either universe. The compile line for the ucb universe (as you */
71/* might expect) is the same as for SYS III UNIX: */
72/* */
73/* cc -O asciixmas.c -lcurses -ltermlib -o asciixmas -s */
74/* */
75/* The above compile will also hold true for other BSD systems. (I hope) */
76/* */
77/* */
78/* */
79/* */
80/* For the Scrooges out there among you who don't want this thing to loop */
81/* forever (or until the user hits a key), insert this into your compile */
82/* line just after "cc" : */
83/* */
84/* -DNOLOOP */
85/* */
86/* like so: */
87/* */
88/* cc -DNOLOOP -O asciixmas.c -lcurses -o asciixmas -s */
89/* */
90/* */
91/* */
92/******************************************************************************/
93
94/*
95 * $Id: xmas.c,v 1.20 2005/04/16 16:34:38 tom Exp $
96 */
97#include <test.priv.h>
98
99#define FROMWHO "Mark Hessling - (M.Hessling@gu.edu.au)"
100
101static int my_bg = COLOR_BLACK;
102static int y_pos, x_pos;
103
104static WINDOW *treescrn;
105static WINDOW *treescrn2;
106static WINDOW *treescrn3;
107static WINDOW *treescrn4;
108static WINDOW *treescrn5;
109static WINDOW *treescrn6;
110static WINDOW *treescrn7;
111static WINDOW *treescrn8;
112static WINDOW *dotdeer0;
113static WINDOW *stardeer0;
114static WINDOW *lildeer0;
115static WINDOW *lildeer1;
116static WINDOW *lildeer2;
117static WINDOW *lildeer3;
118static WINDOW *middeer0;
119static WINDOW *middeer1;
120static WINDOW *middeer2;
121static WINDOW *middeer3;
122static WINDOW *bigdeer0;
123static WINDOW *bigdeer1;
124static WINDOW *bigdeer2;
125static WINDOW *bigdeer3;
126static WINDOW *bigdeer4;
127static WINDOW *lookdeer0;
128static WINDOW *lookdeer1;
129static WINDOW *lookdeer2;
130static WINDOW *lookdeer3;
131static WINDOW *lookdeer4;
132static WINDOW *w_holiday;
133static WINDOW *w_del_msg;
134
135static int boxit(void);
136static int seas(void);
137static int greet(void);
138static int fromwho(void);
139static int tree(void);
140static int balls(void);
141static int star(void);
142static int strng1(void);
143static int strng2(void);
144static int strng3(void);
145static int strng4(void);
146static int strng5(void);
147static int reindeer(void);
148static int blinkit(void);
149
150static RETSIGTYPE done(int sig) GCC_NORETURN;
151
152static void
153set_color(WINDOW *win, chtype color)
154{
155 if (has_colors()) {
156 static bool *pairs;
157 int n = (color + 1);
158 if (pairs == 0)
159 pairs = (bool *) calloc((unsigned) (COLORS + 1), sizeof(bool));
160 if (!pairs[n]) {
161 init_pair(n, color, my_bg);
162 pairs[n] = TRUE;
163 }
164 wattroff(win, A_COLOR);
165 wattron(win, COLOR_PAIR(n));
166 }
167}
168
169static void
170unset_color(WINDOW *win)
171{
172 if (has_colors())
173 wattrset(win, COLOR_PAIR(0));
174}
175
176static void
177look_out(int msecs)
178{
179 napms(msecs);
180 if (getch() != ERR) {
181 beep();
182 done(0);
183 }
184}
185
186int
187main(int argc GCC_UNUSED, char **argv GCC_UNUSED)
188{
189 int loopy;
190
191 setlocale(LC_ALL, "");
192
193 initscr();
194 noecho();
195 nonl();
196 refresh();
197 signal(SIGINT, done);
198 signal(SIGTERM, done);
199#if !defined DOS && !defined OS2
200 signal(SIGHUP, done);
201 signal(SIGQUIT, done);
202#endif
203 if (has_colors()) {
204 start_color();
205#if HAVE_USE_DEFAULT_COLORS
206 if (use_default_colors() == OK)
207 my_bg = -1;
208#endif
209 }
210 curs_set(0);
211
212 treescrn = newwin(16, 27, 3, 53);
213 treescrn2 = newwin(16, 27, 3, 53);
214 treescrn3 = newwin(16, 27, 3, 53);
215 treescrn4 = newwin(16, 27, 3, 53);
216 treescrn5 = newwin(16, 27, 3, 53);
217 treescrn6 = newwin(16, 27, 3, 53);
218 treescrn7 = newwin(16, 27, 3, 53);
219 treescrn8 = newwin(16, 27, 3, 53);
220
221 dotdeer0 = newwin(3, 71, 0, 8);
222
223 stardeer0 = newwin(4, 56, 0, 8);
224
225 lildeer0 = newwin(7, 53, 0, 8);
226 lildeer1 = newwin(2, 4, 0, 0);
227 lildeer2 = newwin(2, 4, 0, 0);
228 lildeer3 = newwin(2, 4, 0, 0);
229
230 middeer0 = newwin(15, 42, 0, 8);
231 middeer1 = newwin(3, 7, 0, 0);
232 middeer2 = newwin(3, 7, 0, 0);
233 middeer3 = newwin(3, 7, 0, 0);
234
235 bigdeer0 = newwin(10, 23, 0, 0);
236 bigdeer1 = newwin(10, 23, 0, 0);
237 bigdeer2 = newwin(10, 23, 0, 0);
238 bigdeer3 = newwin(10, 23, 0, 0);
239 bigdeer4 = newwin(10, 23, 0, 0);
240
241 lookdeer0 = newwin(10, 25, 0, 0);
242 lookdeer1 = newwin(10, 25, 0, 0);
243 lookdeer2 = newwin(10, 25, 0, 0);
244 lookdeer3 = newwin(10, 25, 0, 0);
245 lookdeer4 = newwin(10, 25, 0, 0);
246
247 w_holiday = newwin(1, 26, 3, 27);
248
249 w_del_msg = newwin(1, 19, 23, 60);
250
251 mvwaddstr(w_del_msg, 0, 0, "Hit any key to quit");
252
253 mvwaddstr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S");
254
255 /* set up the windows for our various reindeer */
256
257 /* lildeer1 */
258 mvwaddch(lildeer1, 0, 0, (chtype) 'V');
259 mvwaddch(lildeer1, 1, 0, (chtype) '@');
260 mvwaddch(lildeer1, 1, 1, (chtype) '<');
261 mvwaddch(lildeer1, 1, 2, (chtype) '>');
262 mvwaddch(lildeer1, 1, 3, (chtype) '~');
263
264 /* lildeer2 */
265 mvwaddch(lildeer2, 0, 0, (chtype) 'V');
266 mvwaddch(lildeer2, 1, 0, (chtype) '@');
267 mvwaddch(lildeer2, 1, 1, (chtype) '|');
268 mvwaddch(lildeer2, 1, 2, (chtype) '|');
269 mvwaddch(lildeer2, 1, 3, (chtype) '~');
270
271 /* lildeer3 */
272 mvwaddch(lildeer3, 0, 0, (chtype) 'V');
273 mvwaddch(lildeer3, 1, 0, (chtype) '@');
274 mvwaddch(lildeer3, 1, 1, (chtype) '>');
275 mvwaddch(lildeer3, 1, 2, (chtype) '<');
276 mvwaddch(lildeer2, 1, 3, (chtype) '~');
277
278 /* middeer1 */
279 mvwaddch(middeer1, 0, 2, (chtype) 'y');
280 mvwaddch(middeer1, 0, 3, (chtype) 'y');
281 mvwaddch(middeer1, 1, 2, (chtype) '0');
282 mvwaddch(middeer1, 1, 3, (chtype) '(');
283 mvwaddch(middeer1, 1, 4, (chtype) '=');
284 mvwaddch(middeer1, 1, 5, (chtype) ')');
285 mvwaddch(middeer1, 1, 6, (chtype) '~');
286 mvwaddch(middeer1, 2, 3, (chtype) '\\');
287 mvwaddch(middeer1, 2, 4, (chtype) '/');
288
289 /* middeer2 */
290 mvwaddch(middeer2, 0, 2, (chtype) 'y');
291 mvwaddch(middeer2, 0, 3, (chtype) 'y');
292 mvwaddch(middeer2, 1, 2, (chtype) '0');
293 mvwaddch(middeer2, 1, 3, (chtype) '(');
294 mvwaddch(middeer2, 1, 4, (chtype) '=');
295 mvwaddch(middeer2, 1, 5, (chtype) ')');
296 mvwaddch(middeer2, 1, 6, (chtype) '~');
297 mvwaddch(middeer2, 2, 3, (chtype) '|');
298 mvwaddch(middeer2, 2, 5, (chtype) '|');
299
300 /* middeer3 */
301 mvwaddch(middeer3, 0, 2, (chtype) 'y');
302 mvwaddch(middeer3, 0, 3, (chtype) 'y');
303 mvwaddch(middeer3, 1, 2, (chtype) '0');
304 mvwaddch(middeer3, 1, 3, (chtype) '(');
305 mvwaddch(middeer3, 1, 4, (chtype) '=');
306 mvwaddch(middeer3, 1, 5, (chtype) ')');
307 mvwaddch(middeer3, 1, 6, (chtype) '~');
308 mvwaddch(middeer3, 2, 2, (chtype) '/');
309 mvwaddch(middeer3, 2, 6, (chtype) '\\');
310
311 /* bigdeer1 */
312 mvwaddch(bigdeer1, 0, 17, (chtype) '\\');
313 mvwaddch(bigdeer1, 0, 18, (chtype) '/');
314 mvwaddch(bigdeer1, 0, 20, (chtype) '\\');
315 mvwaddch(bigdeer1, 0, 21, (chtype) '/');
316 mvwaddch(bigdeer1, 1, 18, (chtype) '\\');
317 mvwaddch(bigdeer1, 1, 20, (chtype) '/');
318 mvwaddch(bigdeer1, 2, 19, (chtype) '|');
319 mvwaddch(bigdeer1, 2, 20, (chtype) '_');
320 mvwaddch(bigdeer1, 3, 18, (chtype) '/');
321 mvwaddch(bigdeer1, 3, 19, (chtype) '^');
322 mvwaddch(bigdeer1, 3, 20, (chtype) '0');
323 mvwaddch(bigdeer1, 3, 21, (chtype) '\\');
324 mvwaddch(bigdeer1, 4, 17, (chtype) '/');
325 mvwaddch(bigdeer1, 4, 18, (chtype) '/');
326 mvwaddch(bigdeer1, 4, 19, (chtype) '\\');
327 mvwaddch(bigdeer1, 4, 22, (chtype) '\\');
328 mvwaddstr(bigdeer1, 5, 7, "^~~~~~~~~// ~~U");
329 mvwaddstr(bigdeer1, 6, 7, "( \\_____( /");
330 mvwaddstr(bigdeer1, 7, 8, "( ) /");
331 mvwaddstr(bigdeer1, 8, 9, "\\\\ /");
332 mvwaddstr(bigdeer1, 9, 11, "\\>/>");
333
334 /* bigdeer2 */
335 mvwaddch(bigdeer2, 0, 17, (chtype) '\\');
336 mvwaddch(bigdeer2, 0, 18, (chtype) '/');
337 mvwaddch(bigdeer2, 0, 20, (chtype) '\\');
338 mvwaddch(bigdeer2, 0, 21, (chtype) '/');
339 mvwaddch(bigdeer2, 1, 18, (chtype) '\\');
340 mvwaddch(bigdeer2, 1, 20, (chtype) '/');
341 mvwaddch(bigdeer2, 2, 19, (chtype) '|');
342 mvwaddch(bigdeer2, 2, 20, (chtype) '_');
343 mvwaddch(bigdeer2, 3, 18, (chtype) '/');
344 mvwaddch(bigdeer2, 3, 19, (chtype) '^');
345 mvwaddch(bigdeer2, 3, 20, (chtype) '0');
346 mvwaddch(bigdeer2, 3, 21, (chtype) '\\');
347 mvwaddch(bigdeer2, 4, 17, (chtype) '/');
348 mvwaddch(bigdeer2, 4, 18, (chtype) '/');
349 mvwaddch(bigdeer2, 4, 19, (chtype) '\\');
350 mvwaddch(bigdeer2, 4, 22, (chtype) '\\');
351 mvwaddstr(bigdeer2, 5, 7, "^~~~~~~~~// ~~U");
352 mvwaddstr(bigdeer2, 6, 7, "(( )____( /");
353 mvwaddstr(bigdeer2, 7, 7, "( / |");
354 mvwaddstr(bigdeer2, 8, 8, "\\/ |");
355 mvwaddstr(bigdeer2, 9, 9, "|> |>");
356
357 /* bigdeer3 */
358 mvwaddch(bigdeer3, 0, 17, (chtype) '\\');
359 mvwaddch(bigdeer3, 0, 18, (chtype) '/');
360 mvwaddch(bigdeer3, 0, 20, (chtype) '\\');
361 mvwaddch(bigdeer3, 0, 21, (chtype) '/');
362 mvwaddch(bigdeer3, 1, 18, (chtype) '\\');
363 mvwaddch(bigdeer3, 1, 20, (chtype) '/');
364 mvwaddch(bigdeer3, 2, 19, (chtype) '|');
365 mvwaddch(bigdeer3, 2, 20, (chtype) '_');
366 mvwaddch(bigdeer3, 3, 18, (chtype) '/');
367 mvwaddch(bigdeer3, 3, 19, (chtype) '^');
368 mvwaddch(bigdeer3, 3, 20, (chtype) '0');
369 mvwaddch(bigdeer3, 3, 21, (chtype) '\\');
370 mvwaddch(bigdeer3, 4, 17, (chtype) '/');
371 mvwaddch(bigdeer3, 4, 18, (chtype) '/');
372 mvwaddch(bigdeer3, 4, 19, (chtype) '\\');
373 mvwaddch(bigdeer3, 4, 22, (chtype) '\\');
374 mvwaddstr(bigdeer3, 5, 7, "^~~~~~~~~// ~~U");
375 mvwaddstr(bigdeer3, 6, 6, "( ()_____( /");
376 mvwaddstr(bigdeer3, 7, 6, "/ / /");
377 mvwaddstr(bigdeer3, 8, 5, "|/ \\");
378 mvwaddstr(bigdeer3, 9, 5, "/> \\>");
379
380 /* bigdeer4 */
381 mvwaddch(bigdeer4, 0, 17, (chtype) '\\');
382 mvwaddch(bigdeer4, 0, 18, (chtype) '/');
383 mvwaddch(bigdeer4, 0, 20, (chtype) '\\');
384 mvwaddch(bigdeer4, 0, 21, (chtype) '/');
385 mvwaddch(bigdeer4, 1, 18, (chtype) '\\');
386 mvwaddch(bigdeer4, 1, 20, (chtype) '/');
387 mvwaddch(bigdeer4, 2, 19, (chtype) '|');
388 mvwaddch(bigdeer4, 2, 20, (chtype) '_');
389 mvwaddch(bigdeer4, 3, 18, (chtype) '/');
390 mvwaddch(bigdeer4, 3, 19, (chtype) '^');
391 mvwaddch(bigdeer4, 3, 20, (chtype) '0');
392 mvwaddch(bigdeer4, 3, 21, (chtype) '\\');
393 mvwaddch(bigdeer4, 4, 17, (chtype) '/');
394 mvwaddch(bigdeer4, 4, 18, (chtype) '/');
395 mvwaddch(bigdeer4, 4, 19, (chtype) '\\');
396 mvwaddch(bigdeer4, 4, 22, (chtype) '\\');
397 mvwaddstr(bigdeer4, 5, 7, "^~~~~~~~~// ~~U");
398 mvwaddstr(bigdeer4, 6, 6, "( )______( /");
399 mvwaddstr(bigdeer4, 7, 5, "(/ \\");
400 mvwaddstr(bigdeer4, 8, 0, "v___= ----^");
401
402 /* lookdeer1 */
403 mvwaddstr(lookdeer1, 0, 16, "\\/ \\/");
404 mvwaddstr(lookdeer1, 1, 17, "\\Y/ \\Y/");
405 mvwaddstr(lookdeer1, 2, 19, "\\=/");
406 mvwaddstr(lookdeer1, 3, 17, "^\\o o/^");
407 mvwaddstr(lookdeer1, 4, 17, "//( )");
408 mvwaddstr(lookdeer1, 5, 7, "^~~~~~~~~// \\O/");
409 mvwaddstr(lookdeer1, 6, 7, "( \\_____( /");
410 mvwaddstr(lookdeer1, 7, 8, "( ) /");
411 mvwaddstr(lookdeer1, 8, 9, "\\\\ /");
412 mvwaddstr(lookdeer1, 9, 11, "\\>/>");
413
414 /* lookdeer2 */
415 mvwaddstr(lookdeer2, 0, 16, "\\/ \\/");
416 mvwaddstr(lookdeer2, 1, 17, "\\Y/ \\Y/");
417 mvwaddstr(lookdeer2, 2, 19, "\\=/");
418 mvwaddstr(lookdeer2, 3, 17, "^\\o o/^");
419 mvwaddstr(lookdeer2, 4, 17, "//( )");
420 mvwaddstr(lookdeer2, 5, 7, "^~~~~~~~~// \\O/");
421 mvwaddstr(lookdeer2, 6, 7, "(( )____( /");
422 mvwaddstr(lookdeer2, 7, 7, "( / |");
423 mvwaddstr(lookdeer2, 8, 8, "\\/ |");
424 mvwaddstr(lookdeer2, 9, 9, "|> |>");
425
426 /* lookdeer3 */
427 mvwaddstr(lookdeer3, 0, 16, "\\/ \\/");
428 mvwaddstr(lookdeer3, 1, 17, "\\Y/ \\Y/");
429 mvwaddstr(lookdeer3, 2, 19, "\\=/");
430 mvwaddstr(lookdeer3, 3, 17, "^\\o o/^");
431 mvwaddstr(lookdeer3, 4, 17, "//( )");
432 mvwaddstr(lookdeer3, 5, 7, "^~~~~~~~~// \\O/");
433 mvwaddstr(lookdeer3, 6, 6, "( ()_____( /");
434 mvwaddstr(lookdeer3, 7, 6, "/ / /");
435 mvwaddstr(lookdeer3, 8, 5, "|/ \\");
436 mvwaddstr(lookdeer3, 9, 5, "/> \\>");
437
438 /* lookdeer4 */
439 mvwaddstr(lookdeer4, 0, 16, "\\/ \\/");
440 mvwaddstr(lookdeer4, 1, 17, "\\Y/ \\Y/");
441 mvwaddstr(lookdeer4, 2, 19, "\\=/");
442 mvwaddstr(lookdeer4, 3, 17, "^\\o o/^");
443 mvwaddstr(lookdeer4, 4, 17, "//( )");
444 mvwaddstr(lookdeer4, 5, 7, "^~~~~~~~~// \\O/");
445 mvwaddstr(lookdeer4, 6, 6, "( )______( /");
446 mvwaddstr(lookdeer4, 7, 5, "(/ \\");
447 mvwaddstr(lookdeer4, 8, 0, "v___= ----^");
448
449 /***********************************************/
450 cbreak();
451 nodelay(stdscr, TRUE);
452 for (;;) {
453 clear();
454 werase(treescrn);
455 touchwin(w_del_msg);
456 touchwin(treescrn);
457 werase(treescrn2);
458 touchwin(treescrn2);
459 werase(treescrn8);
460 touchwin(treescrn8);
461 refresh();
462 look_out(150);
463 boxit();
464 refresh();
465 look_out(150);
466 seas();
467 refresh();
468 look_out(150);
469 greet();
470 refresh();
471 look_out(150);
472 fromwho();
473 refresh();
474 look_out(150);
475 tree();
476 look_out(150);
477 balls();
478 look_out(150);
479 star();
480 look_out(150);
481 strng1();
482 strng2();
483 strng3();
484 strng4();
485 strng5();
486
487 /* set up the windows for our blinking trees */
488 /* **************************************** */
489 /* treescrn3 */
490
491 overlay(treescrn, treescrn3);
492
493 /*balls */
494 mvwaddch(treescrn3, 4, 18, ' ');
495 mvwaddch(treescrn3, 7, 6, ' ');
496 mvwaddch(treescrn3, 8, 19, ' ');
497 mvwaddch(treescrn3, 11, 22, ' ');
498
499 /*star */
500 mvwaddch(treescrn3, 0, 12, '*');
501
502 /*strng1 */
503 mvwaddch(treescrn3, 3, 11, ' ');
504
505 /*strng2 */
506 mvwaddch(treescrn3, 5, 13, ' ');
507 mvwaddch(treescrn3, 6, 10, ' ');
508
509 /*strng3 */
510 mvwaddch(treescrn3, 7, 16, ' ');
511 mvwaddch(treescrn3, 7, 14, ' ');
512
513 /*strng4 */
514 mvwaddch(treescrn3, 10, 13, ' ');
515 mvwaddch(treescrn3, 10, 10, ' ');
516 mvwaddch(treescrn3, 11, 8, ' ');
517
518 /*strng5 */
519 mvwaddch(treescrn3, 11, 18, ' ');
520 mvwaddch(treescrn3, 12, 13, ' ');
521
522 /* treescrn4 */
523
524 overlay(treescrn, treescrn4);
525
526 /*balls */
527 mvwaddch(treescrn4, 3, 9, ' ');
528 mvwaddch(treescrn4, 4, 16, ' ');
529 mvwaddch(treescrn4, 7, 6, ' ');
530 mvwaddch(treescrn4, 8, 19, ' ');
531 mvwaddch(treescrn4, 11, 2, ' ');
532 mvwaddch(treescrn4, 12, 23, ' ');
533
534 /*star */
535 wstandout(treescrn4);
536 mvwaddch(treescrn4, 0, 12, '*');
537 wstandend(treescrn4);
538
539 /*strng1 */
540 mvwaddch(treescrn4, 3, 13, ' ');
541
542 /*strng2 */
543
544 /*strng3 */
545 mvwaddch(treescrn4, 7, 15, ' ');
546 mvwaddch(treescrn4, 8, 11, ' ');
547
548 /*strng4 */
549 mvwaddch(treescrn4, 9, 16, ' ');
550 mvwaddch(treescrn4, 10, 12, ' ');
551 mvwaddch(treescrn4, 11, 8, ' ');
552
553 /*strng5 */
554 mvwaddch(treescrn4, 11, 18, ' ');
555 mvwaddch(treescrn4, 12, 14, ' ');
556
557 /* treescrn5 */
558
559 overlay(treescrn, treescrn5);
560
561 /*balls */
562 mvwaddch(treescrn5, 3, 15, ' ');
563 mvwaddch(treescrn5, 10, 20, ' ');
564 mvwaddch(treescrn5, 12, 1, ' ');
565
566 /*star */
567 mvwaddch(treescrn5, 0, 12, '*');
568
569 /*strng1 */
570 mvwaddch(treescrn5, 3, 11, ' ');
571
572 /*strng2 */
573 mvwaddch(treescrn5, 5, 12, ' ');
574
575 /*strng3 */
576 mvwaddch(treescrn5, 7, 14, ' ');
577 mvwaddch(treescrn5, 8, 10, ' ');
578
579 /*strng4 */
580 mvwaddch(treescrn5, 9, 15, ' ');
581 mvwaddch(treescrn5, 10, 11, ' ');
582 mvwaddch(treescrn5, 11, 7, ' ');
583
584 /*strng5 */
585 mvwaddch(treescrn5, 11, 17, ' ');
586 mvwaddch(treescrn5, 12, 13, ' ');
587
588 /* treescrn6 */
589
590 overlay(treescrn, treescrn6);
591
592 /*balls */
593 mvwaddch(treescrn6, 6, 7, ' ');
594 mvwaddch(treescrn6, 7, 18, ' ');
595 mvwaddch(treescrn6, 10, 4, ' ');
596 mvwaddch(treescrn6, 11, 23, ' ');
597
598 /*star */
599 wstandout(treescrn6);
600 mvwaddch(treescrn6, 0, 12, '*');
601 wstandend(treescrn6);
602
603 /*strng1 */
604
605 /*strng2 */
606 mvwaddch(treescrn6, 5, 11, ' ');
607
608 /*strng3 */
609 mvwaddch(treescrn6, 7, 13, ' ');
610 mvwaddch(treescrn6, 8, 9, ' ');
611
612 /*strng4 */
613 mvwaddch(treescrn6, 9, 14, ' ');
614 mvwaddch(treescrn6, 10, 10, ' ');
615 mvwaddch(treescrn6, 11, 6, ' ');
616
617 /*strng5 */
618 mvwaddch(treescrn6, 11, 16, ' ');
619 mvwaddch(treescrn6, 12, 12, ' ');
620
621 /* treescrn7 */
622
623 overlay(treescrn, treescrn7);
624
625 /*balls */
626 mvwaddch(treescrn7, 3, 15, ' ');
627 mvwaddch(treescrn7, 6, 7, ' ');
628 mvwaddch(treescrn7, 7, 18, ' ');
629 mvwaddch(treescrn7, 10, 4, ' ');
630 mvwaddch(treescrn7, 11, 22, ' ');
631
632 /*star */
633 mvwaddch(treescrn7, 0, 12, '*');
634
635 /*strng1 */
636 mvwaddch(treescrn7, 3, 12, ' ');
637
638 /*strng2 */
639 mvwaddch(treescrn7, 5, 13, ' ');
640 mvwaddch(treescrn7, 6, 9, ' ');
641
642 /*strng3 */
643 mvwaddch(treescrn7, 7, 15, ' ');
644 mvwaddch(treescrn7, 8, 11, ' ');
645
646 /*strng4 */
647 mvwaddch(treescrn7, 9, 16, ' ');
648 mvwaddch(treescrn7, 10, 12, ' ');
649 mvwaddch(treescrn7, 11, 8, ' ');
650
651 /*strng5 */
652 mvwaddch(treescrn7, 11, 18, ' ');
653 mvwaddch(treescrn7, 12, 14, ' ');
654
655 look_out(150);
656 reindeer();
657
658 touchwin(w_holiday);
659 wrefresh(w_holiday);
660 wrefresh(w_del_msg);
661
662 look_out(500);
663 for (loopy = 0; loopy < 100; loopy++) {
664 blinkit();
665 }
666
667#ifdef NOLOOP
668 done(0);
669#endif
670 }
671 /*NOTREACHED */
672}
673
674static int
675boxit(void)
676{
677 int x = 0;
678
679 while (x < 20) {
680 mvaddch(x, 7, '|');
681 ++x;
682 }
683
684 x = 8;
685
686 while (x < 80) {
687 mvaddch(19, x, '_');
688 ++x;
689 }
690
691 x = 0;
692
693 while (x < 80) {
694 mvaddch(22, x, '_');
695 ++x;
696 }
697
698 return (0);
699}
700
701static int
702seas(void)
703{
704 mvaddch(4, 1, 'S');
705 mvaddch(6, 1, 'E');
706 mvaddch(8, 1, 'A');
707 mvaddch(10, 1, 'S');
708 mvaddch(12, 1, 'O');
709 mvaddch(14, 1, 'N');
710 mvaddch(16, 1, '`');
711 mvaddch(18, 1, 'S');
712
713 return (0);
714}
715
716static int
717greet(void)
718{
719 mvaddch(3, 5, 'G');
720 mvaddch(5, 5, 'R');
721 mvaddch(7, 5, 'E');
722 mvaddch(9, 5, 'E');
723 mvaddch(11, 5, 'T');
724 mvaddch(13, 5, 'I');
725 mvaddch(15, 5, 'N');
726 mvaddch(17, 5, 'G');
727 mvaddch(19, 5, 'S');
728
729 return (0);
730}
731
732static int
733fromwho(void)
734{
735 mvaddstr(21, 13, FROMWHO);
736 return (0);
737}
738
739static int
740tree(void)
741{
742 set_color(treescrn, COLOR_GREEN);
743 mvwaddch(treescrn, 1, 11, (chtype) '/');
744 mvwaddch(treescrn, 2, 11, (chtype) '/');
745 mvwaddch(treescrn, 3, 10, (chtype) '/');
746 mvwaddch(treescrn, 4, 9, (chtype) '/');
747 mvwaddch(treescrn, 5, 9, (chtype) '/');
748 mvwaddch(treescrn, 6, 8, (chtype) '/');
749 mvwaddch(treescrn, 7, 7, (chtype) '/');
750 mvwaddch(treescrn, 8, 6, (chtype) '/');
751 mvwaddch(treescrn, 9, 6, (chtype) '/');
752 mvwaddch(treescrn, 10, 5, (chtype) '/');
753 mvwaddch(treescrn, 11, 3, (chtype) '/');
754 mvwaddch(treescrn, 12, 2, (chtype) '/');
755
756 mvwaddch(treescrn, 1, 13, (chtype) '\\');
757 mvwaddch(treescrn, 2, 13, (chtype) '\\');
758 mvwaddch(treescrn, 3, 14, (chtype) '\\');
759 mvwaddch(treescrn, 4, 15, (chtype) '\\');
760 mvwaddch(treescrn, 5, 15, (chtype) '\\');
761 mvwaddch(treescrn, 6, 16, (chtype) '\\');
762 mvwaddch(treescrn, 7, 17, (chtype) '\\');
763 mvwaddch(treescrn, 8, 18, (chtype) '\\');
764 mvwaddch(treescrn, 9, 18, (chtype) '\\');
765 mvwaddch(treescrn, 10, 19, (chtype) '\\');
766 mvwaddch(treescrn, 11, 21, (chtype) '\\');
767 mvwaddch(treescrn, 12, 22, (chtype) '\\');
768
769 mvwaddch(treescrn, 4, 10, (chtype) '_');
770 mvwaddch(treescrn, 4, 14, (chtype) '_');
771 mvwaddch(treescrn, 8, 7, (chtype) '_');
772 mvwaddch(treescrn, 8, 17, (chtype) '_');
773
774 mvwaddstr(treescrn, 13, 0, "//////////// \\\\\\\\\\\\\\\\\\\\\\\\");
775
776 mvwaddstr(treescrn, 14, 11, "| |");
777 mvwaddstr(treescrn, 15, 11, "|_|");
778
779 unset_color(treescrn);
780 wrefresh(treescrn);
781 wrefresh(w_del_msg);
782
783 return (0);
784}
785
786static int
787balls(void)
788{
789 overlay(treescrn, treescrn2);
790
791 set_color(treescrn2, COLOR_BLUE);
792 mvwaddch(treescrn2, 3, 9, (chtype) '@');
793 mvwaddch(treescrn2, 3, 15, (chtype) '@');
794 mvwaddch(treescrn2, 4, 8, (chtype) '@');
795 mvwaddch(treescrn2, 4, 16, (chtype) '@');
796 mvwaddch(treescrn2, 5, 7, (chtype) '@');
797 mvwaddch(treescrn2, 5, 17, (chtype) '@');
798 mvwaddch(treescrn2, 7, 6, (chtype) '@');
799 mvwaddch(treescrn2, 7, 18, (chtype) '@');
800 mvwaddch(treescrn2, 8, 5, (chtype) '@');
801 mvwaddch(treescrn2, 8, 19, (chtype) '@');
802 mvwaddch(treescrn2, 10, 4, (chtype) '@');
803 mvwaddch(treescrn2, 10, 20, (chtype) '@');
804 mvwaddch(treescrn2, 11, 2, (chtype) '@');
805 mvwaddch(treescrn2, 11, 22, (chtype) '@');
806 mvwaddch(treescrn2, 12, 1, (chtype) '@');
807 mvwaddch(treescrn2, 12, 23, (chtype) '@');
808
809 unset_color(treescrn2);
810 wrefresh(treescrn2);
811 wrefresh(w_del_msg);
812 return (0);
813}
814
815static int
816star(void)
817{
818 wattrset(treescrn2, A_BOLD | A_BLINK);
819 set_color(treescrn2, COLOR_YELLOW);
820
821 mvwaddch(treescrn2, 0, 12, (chtype) '*');
822 wstandend(treescrn2);
823
824 unset_color(treescrn2);
825 wrefresh(treescrn2);
826 wrefresh(w_del_msg);
827 return (0);
828}
829
830static int
831strng1(void)
832{
833 wattrset(treescrn2, A_BOLD | A_BLINK);
834 set_color(treescrn2, COLOR_WHITE);
835
836 mvwaddch(treescrn2, 3, 13, (chtype) '\'');
837 mvwaddch(treescrn2, 3, 12, (chtype) ':');
838 mvwaddch(treescrn2, 3, 11, (chtype) '.');
839
840 wattroff(treescrn2, A_BOLD | A_BLINK);
841 unset_color(treescrn2);
842
843 wrefresh(treescrn2);
844 wrefresh(w_del_msg);
845 return (0);
846}
847
848static int
849strng2(void)
850{
851 wattrset(treescrn2, A_BOLD | A_BLINK);
852 set_color(treescrn2, COLOR_WHITE);
853
854 mvwaddch(treescrn2, 5, 14, (chtype) '\'');
855 mvwaddch(treescrn2, 5, 13, (chtype) ':');
856 mvwaddch(treescrn2, 5, 12, (chtype) '.');
857 mvwaddch(treescrn2, 5, 11, (chtype) ',');
858 mvwaddch(treescrn2, 6, 10, (chtype) '\'');
859 mvwaddch(treescrn2, 6, 9, (chtype) ':');
860
861 wattroff(treescrn2, A_BOLD | A_BLINK);
862 unset_color(treescrn2);
863
864 wrefresh(treescrn2);
865 wrefresh(w_del_msg);
866 return (0);
867}
868
869static int
870strng3(void)
871{
872 wattrset(treescrn2, A_BOLD | A_BLINK);
873 set_color(treescrn2, COLOR_WHITE);
874
875 mvwaddch(treescrn2, 7, 16, (chtype) '\'');
876 mvwaddch(treescrn2, 7, 15, (chtype) ':');
877 mvwaddch(treescrn2, 7, 14, (chtype) '.');
878 mvwaddch(treescrn2, 7, 13, (chtype) ',');
879 mvwaddch(treescrn2, 8, 12, (chtype) '\'');
880 mvwaddch(treescrn2, 8, 11, (chtype) ':');
881 mvwaddch(treescrn2, 8, 10, (chtype) '.');
882 mvwaddch(treescrn2, 8, 9, (chtype) ',');
883
884 wattroff(treescrn2, A_BOLD | A_BLINK);
885 unset_color(treescrn2);
886
887 wrefresh(treescrn2);
888 wrefresh(w_del_msg);
889 return (0);
890}
891
892static int
893strng4(void)
894{
895 wattrset(treescrn2, A_BOLD | A_BLINK);
896 set_color(treescrn2, COLOR_WHITE);
897
898 mvwaddch(treescrn2, 9, 17, (chtype) '\'');
899 mvwaddch(treescrn2, 9, 16, (chtype) ':');
900 mvwaddch(treescrn2, 9, 15, (chtype) '.');
901 mvwaddch(treescrn2, 9, 14, (chtype) ',');
902 mvwaddch(treescrn2, 10, 13, (chtype) '\'');
903 mvwaddch(treescrn2, 10, 12, (chtype) ':');
904 mvwaddch(treescrn2, 10, 11, (chtype) '.');
905 mvwaddch(treescrn2, 10, 10, (chtype) ',');
906 mvwaddch(treescrn2, 11, 9, (chtype) '\'');
907 mvwaddch(treescrn2, 11, 8, (chtype) ':');
908 mvwaddch(treescrn2, 11, 7, (chtype) '.');
909 mvwaddch(treescrn2, 11, 6, (chtype) ',');
910 mvwaddch(treescrn2, 12, 5, (chtype) '\'');
911
912 wattroff(treescrn2, A_BOLD | A_BLINK);
913 unset_color(treescrn2);
914
915 wrefresh(treescrn2);
916 wrefresh(w_del_msg);
917 return (0);
918}
919
920static int
921strng5(void)
922{
923 wattrset(treescrn2, A_BOLD | A_BLINK);
924 set_color(treescrn2, COLOR_WHITE);
925
926 mvwaddch(treescrn2, 11, 19, (chtype) '\'');
927 mvwaddch(treescrn2, 11, 18, (chtype) ':');
928 mvwaddch(treescrn2, 11, 17, (chtype) '.');
929 mvwaddch(treescrn2, 11, 16, (chtype) ',');
930 mvwaddch(treescrn2, 12, 15, (chtype) '\'');
931 mvwaddch(treescrn2, 12, 14, (chtype) ':');
932 mvwaddch(treescrn2, 12, 13, (chtype) '.');
933 mvwaddch(treescrn2, 12, 12, (chtype) ',');
934
935 wattroff(treescrn2, A_BOLD | A_BLINK);
936 unset_color(treescrn2);
937
938 /* save a fully lit tree */
939 overlay(treescrn2, treescrn);
940
941 wrefresh(treescrn2);
942 wrefresh(w_del_msg);
943 return (0);
944}
945
946static int
947blinkit(void)
948{
949 static int cycle;
950
951 if (cycle > 4) {
952 cycle = 0;
953 }
954
955 touchwin(treescrn8);
956
957 switch (cycle) {
958 case 0:
959 overlay(treescrn3, treescrn8);
960 wrefresh(treescrn8);
961 wrefresh(w_del_msg);
962 break;
963 case 1:
964 overlay(treescrn4, treescrn8);
965 wrefresh(treescrn8);
966 wrefresh(w_del_msg);
967 break;
968 case 2:
969 overlay(treescrn5, treescrn8);
970 wrefresh(treescrn8);
971 wrefresh(w_del_msg);
972 break;
973 case 3:
974 overlay(treescrn6, treescrn8);
975 wrefresh(treescrn8);
976 wrefresh(w_del_msg);
977 break;
978 case 4:
979 overlay(treescrn7, treescrn8);
980 wrefresh(treescrn8);
981 wrefresh(w_del_msg);
982 break;
983 }
984 touchwin(treescrn8);
985
986 /*ALL ON************************************************** */
987
988 overlay(treescrn, treescrn8);
989 wrefresh(treescrn8);
990 wrefresh(w_del_msg);
991
992 ++cycle;
993 return (0);
994}
995
996static void
997deer_step(WINDOW *win, int y, int x)
998{
999 mvwin(win, y, x);
1000 wrefresh(win);
1001 wrefresh(w_del_msg);
1002 look_out(5);
1003}
1004
1005static int
1006reindeer(void)
1007{
1008 int looper;
1009 y_pos = 0;
1010
1011 for (x_pos = 70; x_pos > 62; x_pos--) {
1012 if (x_pos < 62) {
1013 y_pos = 1;
1014 }
1015 for (looper = 0; looper < 4; looper++) {
1016 mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '.');
1017 wrefresh(dotdeer0);
1018 wrefresh(w_del_msg);
1019 werase(dotdeer0);
1020 wrefresh(dotdeer0);
1021 wrefresh(w_del_msg);
1022 look_out(50);
1023 }
1024 }
1025
1026 y_pos = 2;
1027
1028 for (; x_pos > 50; x_pos--) {
1029 for (looper = 0; looper < 4; looper++) {
1030
1031 if (x_pos < 56) {
1032 y_pos = 3;
1033
1034 mvwaddch(stardeer0, y_pos, x_pos, (chtype) '*');
1035 wrefresh(stardeer0);
1036 wrefresh(w_del_msg);
1037 werase(stardeer0);
1038 wrefresh(stardeer0);
1039 wrefresh(w_del_msg);
1040 } else {
1041 mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*');
1042 wrefresh(dotdeer0);
1043 wrefresh(w_del_msg);
1044 werase(dotdeer0);
1045 wrefresh(dotdeer0);
1046 wrefresh(w_del_msg);
1047 }
1048 }
1049 }
1050
1051 x_pos = 58;
1052
1053 for (y_pos = 2; y_pos < 5; y_pos++) {
1054
1055 touchwin(lildeer0);
1056 wrefresh(lildeer0);
1057 wrefresh(w_del_msg);
1058
1059 for (looper = 0; looper < 4; looper++) {
1060 deer_step(lildeer3, y_pos, x_pos);
1061 deer_step(lildeer2, y_pos, x_pos);
1062 deer_step(lildeer1, y_pos, x_pos);
1063 deer_step(lildeer2, y_pos, x_pos);
1064 deer_step(lildeer3, y_pos, x_pos);
1065
1066 touchwin(lildeer0);
1067 wrefresh(lildeer0);
1068 wrefresh(w_del_msg);
1069
1070 x_pos -= 2;
1071 }
1072 }
1073
1074 x_pos = 35;
1075
1076 for (y_pos = 5; y_pos < 10; y_pos++) {
1077
1078 touchwin(middeer0);
1079 wrefresh(middeer0);
1080 wrefresh(w_del_msg);
1081
1082 for (looper = 0; looper < 2; looper++) {
1083 deer_step(middeer3, y_pos, x_pos);
1084 deer_step(middeer2, y_pos, x_pos);
1085 deer_step(middeer1, y_pos, x_pos);
1086 deer_step(middeer2, y_pos, x_pos);
1087 deer_step(middeer3, y_pos, x_pos);
1088
1089 touchwin(middeer0);
1090 wrefresh(middeer0);
1091 wrefresh(w_del_msg);
1092
1093 x_pos -= 3;
1094 }
1095 }
1096
1097 look_out(300);
1098
1099 y_pos = 1;
1100
1101 for (x_pos = 8; x_pos < 16; x_pos++) {
1102 deer_step(bigdeer4, y_pos, x_pos);
1103 deer_step(bigdeer3, y_pos, x_pos);
1104 deer_step(bigdeer2, y_pos, x_pos);
1105 deer_step(bigdeer1, y_pos, x_pos);
1106 deer_step(bigdeer2, y_pos, x_pos);
1107 deer_step(bigdeer3, y_pos, x_pos);
1108 deer_step(bigdeer4, y_pos, x_pos);
1109 deer_step(bigdeer0, y_pos, x_pos);
1110 }
1111
1112 --x_pos;
1113
1114 for (looper = 0; looper < 6; looper++) {
1115 deer_step(lookdeer4, y_pos, x_pos);
1116 deer_step(lookdeer3, y_pos, x_pos);
1117 deer_step(lookdeer2, y_pos, x_pos);
1118 deer_step(lookdeer1, y_pos, x_pos);
1119 deer_step(lookdeer2, y_pos, x_pos);
1120 deer_step(lookdeer3, y_pos, x_pos);
1121 deer_step(lookdeer4, y_pos, x_pos);
1122 }
1123
1124 deer_step(lookdeer0, y_pos, x_pos);
1125
1126 for (; y_pos < 10; y_pos++) {
1127 for (looper = 0; looper < 2; looper++) {
1128 deer_step(bigdeer4, y_pos, x_pos);
1129 deer_step(bigdeer3, y_pos, x_pos);
1130 deer_step(bigdeer2, y_pos, x_pos);
1131 deer_step(bigdeer1, y_pos, x_pos);
1132 deer_step(bigdeer2, y_pos, x_pos);
1133 deer_step(bigdeer3, y_pos, x_pos);
1134 deer_step(bigdeer4, y_pos, x_pos);
1135 }
1136 deer_step(bigdeer0, y_pos, x_pos);
1137 }
1138
1139 --y_pos;
1140
1141 deer_step(lookdeer3, y_pos, x_pos);
1142 return (0);
1143}
1144
1145static RETSIGTYPE
1146done(int sig GCC_UNUSED)
1147{
1148 signal(SIGINT, done);
1149 signal(SIGTERM, done);
1150#if !defined DOS && !defined OS2
1151 signal(SIGHUP, done);
1152 signal(SIGQUIT, done);
1153#endif
1154 move(LINES - 1, 0);
1155 refresh();
1156 endwin();
1157 curs_set(1);
1158 ExitProgram(EXIT_SUCCESS);
1159}
Note: See TracBrowser for help on using the repository browser.