Patrick Georgi | 3b77b72 | 2011-07-07 15:41:53 +0200 | [diff] [blame] | 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 | /* IMPLEMENTATION */ |
| 21 | /* */ |
| 22 | /* Feel free to modify the defined string FROMWHO to reflect you, your */ |
| 23 | /* organization, your site, whatever. */ |
| 24 | /* */ |
| 25 | /* This looks a lot better if you can turn off your cursor before execution. */ |
| 26 | /* The cursor is distracting but it doesn't really ruin the show. */ |
| 27 | /* */ |
| 28 | /* At our site, we invoke this for our users just after login and the */ |
| 29 | /* determination of terminal type. */ |
| 30 | /* */ |
| 31 | /* */ |
| 32 | /* PORTABILITY */ |
| 33 | /* */ |
| 34 | /* I wrote this using only the very simplest curses functions so that it */ |
| 35 | /* might be the most portable. I was personally able to test on five */ |
| 36 | /* different cpu/UNIX combinations. */ |
| 37 | /* */ |
| 38 | /* */ |
| 39 | /* COMPILE */ |
| 40 | /* */ |
| 41 | /* usually this: */ |
| 42 | /* */ |
| 43 | /* cc -O xmas.c -lcurses -o xmas -s */ |
| 44 | /* */ |
| 45 | /******************************************************************************/ |
| 46 | |
| 47 | /* $Id: xmas.c,v 1.29 2008/07/13 16:08:17 wmcbrine Exp $ */ |
| 48 | |
| 49 | #include <curses.h> |
| 50 | #include <signal.h> |
| 51 | |
| 52 | void lil(WINDOW *); |
| 53 | void midtop(WINDOW *); |
| 54 | void bigtop(WINDOW *); |
| 55 | void bigface(WINDOW *, chtype); |
| 56 | void legs1(WINDOW *); |
| 57 | void legs2(WINDOW *); |
| 58 | void legs3(WINDOW *); |
| 59 | void legs4(WINDOW *); |
| 60 | void initdeer(void); |
| 61 | void boxit(void); |
| 62 | void seas(void); |
| 63 | void greet(void); |
| 64 | void fromwho(void); |
| 65 | void del_msg(void); |
| 66 | void tree(void); |
| 67 | void balls(void); |
| 68 | void star(void); |
| 69 | void strng1(void); |
| 70 | void strng2(void); |
| 71 | void strng3(void); |
| 72 | void strng4(void); |
| 73 | void strng5(void); |
| 74 | void blinkit(void); |
| 75 | void reindeer(void); |
| 76 | |
| 77 | #define FROMWHO "From Larry Bartz, Mark Hessling and William McBrine" |
| 78 | |
| 79 | int y_pos, x_pos; |
| 80 | |
| 81 | WINDOW *treescrn, *treescrn2, *treescrn3, *treescrn4, *treescrn5, |
| 82 | *treescrn6, *treescrn7, *treescrn8, *dotdeer0, *stardeer0, |
| 83 | *lildeer0, *lildeer1, *lildeer2, *lildeer3, *middeer0, |
| 84 | *middeer1, *middeer2, *middeer3, *bigdeer0, *bigdeer1, |
| 85 | *bigdeer2, *bigdeer3, *bigdeer4, *lookdeer0, *lookdeer1, |
| 86 | *lookdeer2, *lookdeer3, *lookdeer4, *w_holiday, *w_del_msg; |
| 87 | |
| 88 | int main(int argc, char **argv) |
| 89 | { |
| 90 | int loopy; |
| 91 | |
| 92 | #ifdef XCURSES |
| 93 | Xinitscr(argc, argv); |
| 94 | #else |
| 95 | initscr(); |
| 96 | #endif |
| 97 | nodelay(stdscr, TRUE); |
| 98 | noecho(); |
| 99 | nonl(); |
| 100 | refresh(); |
| 101 | |
| 102 | #ifdef A_COLOR |
| 103 | if (has_colors()) |
| 104 | start_color(); |
| 105 | #endif |
| 106 | curs_set(0); |
| 107 | |
| 108 | treescrn = newwin(16, 27, 3, 53); |
| 109 | treescrn2 = newwin(16, 27, 3, 53); |
| 110 | treescrn3 = newwin(16, 27, 3, 53); |
| 111 | treescrn4 = newwin(16, 27, 3, 53); |
| 112 | treescrn5 = newwin(16, 27, 3, 53); |
| 113 | treescrn6 = newwin(16, 27, 3, 53); |
| 114 | treescrn7 = newwin(16, 27, 3, 53); |
| 115 | treescrn8 = newwin(16, 27, 3, 53); |
| 116 | |
| 117 | w_holiday = newwin(1, 26, 3, 27); |
| 118 | |
| 119 | w_del_msg = newwin(1, 12, 23, 60); |
| 120 | |
| 121 | mvwaddstr(w_holiday, 0, 0, "H A P P Y H O L I D A Y S"); |
| 122 | |
| 123 | initdeer(); |
| 124 | |
| 125 | clear(); |
| 126 | werase(treescrn); |
| 127 | touchwin(treescrn); |
| 128 | werase(treescrn2); |
| 129 | touchwin(treescrn2); |
| 130 | werase(treescrn8); |
| 131 | touchwin(treescrn8); |
| 132 | refresh(); |
| 133 | napms(1000); |
| 134 | |
| 135 | boxit(); |
| 136 | del_msg(); |
| 137 | napms(1000); |
| 138 | |
| 139 | seas(); |
| 140 | del_msg(); |
| 141 | napms(1000); |
| 142 | |
| 143 | greet(); |
| 144 | del_msg(); |
| 145 | napms(1000); |
| 146 | |
| 147 | fromwho(); |
| 148 | del_msg(); |
| 149 | napms(1000); |
| 150 | |
| 151 | tree(); |
| 152 | napms(1000); |
| 153 | |
| 154 | balls(); |
| 155 | napms(1000); |
| 156 | |
| 157 | star(); |
| 158 | napms(1000); |
| 159 | |
| 160 | strng1(); |
| 161 | strng2(); |
| 162 | strng3(); |
| 163 | strng4(); |
| 164 | strng5(); |
| 165 | |
| 166 | /* set up the windows for our blinking trees */ |
| 167 | /* **************************************** */ |
| 168 | /* treescrn3 */ |
| 169 | |
| 170 | overlay(treescrn, treescrn3); |
| 171 | |
| 172 | /* balls */ |
| 173 | mvwaddch(treescrn3, 4, 18, ' '); |
| 174 | mvwaddch(treescrn3, 7, 6, ' '); |
| 175 | mvwaddch(treescrn3, 8, 19, ' '); |
| 176 | mvwaddch(treescrn3, 11, 22, ' '); |
| 177 | |
| 178 | /* star */ |
| 179 | mvwaddch(treescrn3, 0, 12, '*'); |
| 180 | |
| 181 | /* strng1 */ |
| 182 | mvwaddch(treescrn3, 3, 11, ' '); |
| 183 | |
| 184 | /* strng2 */ |
| 185 | mvwaddch(treescrn3, 5, 13, ' '); |
| 186 | mvwaddch(treescrn3, 6, 10, ' '); |
| 187 | |
| 188 | /* strng3 */ |
| 189 | mvwaddch(treescrn3, 7, 16, ' '); |
| 190 | mvwaddch(treescrn3, 7, 14, ' '); |
| 191 | |
| 192 | /* strng4 */ |
| 193 | mvwaddch(treescrn3, 10, 13, ' '); |
| 194 | mvwaddch(treescrn3, 10, 10, ' '); |
| 195 | mvwaddch(treescrn3, 11, 8, ' '); |
| 196 | |
| 197 | /* strng5 */ |
| 198 | mvwaddch(treescrn3, 11, 18, ' '); |
| 199 | mvwaddch(treescrn3, 12, 13, ' '); |
| 200 | |
| 201 | /* treescrn4 */ |
| 202 | |
| 203 | overlay(treescrn, treescrn4); |
| 204 | |
| 205 | /* balls */ |
| 206 | mvwaddch(treescrn4, 3, 9, ' '); |
| 207 | mvwaddch(treescrn4, 4, 16, ' '); |
| 208 | mvwaddch(treescrn4, 7, 6, ' '); |
| 209 | mvwaddch(treescrn4, 8, 19, ' '); |
| 210 | mvwaddch(treescrn4, 11, 2, ' '); |
| 211 | mvwaddch(treescrn4, 12, 23, ' '); |
| 212 | |
| 213 | /* star */ |
| 214 | mvwaddch(treescrn4, 0, 12, '*' | A_STANDOUT); |
| 215 | |
| 216 | /* strng1 */ |
| 217 | mvwaddch(treescrn4, 3, 13, ' '); |
| 218 | |
| 219 | /* strng2 */ |
| 220 | |
| 221 | /* strng3 */ |
| 222 | mvwaddch(treescrn4, 7, 15, ' '); |
| 223 | mvwaddch(treescrn4, 8, 11, ' '); |
| 224 | |
| 225 | /* strng4 */ |
| 226 | mvwaddch(treescrn4, 9, 16, ' '); |
| 227 | mvwaddch(treescrn4, 10, 12, ' '); |
| 228 | mvwaddch(treescrn4, 11, 8, ' '); |
| 229 | |
| 230 | /* strng5 */ |
| 231 | mvwaddch(treescrn4, 11, 18, ' '); |
| 232 | mvwaddch(treescrn4, 12, 14, ' '); |
| 233 | |
| 234 | /* treescrn5 */ |
| 235 | |
| 236 | overlay(treescrn, treescrn5); |
| 237 | |
| 238 | /* balls */ |
| 239 | mvwaddch(treescrn5, 3, 15, ' '); |
| 240 | mvwaddch(treescrn5, 10, 20, ' '); |
| 241 | mvwaddch(treescrn5, 12, 1, ' '); |
| 242 | |
| 243 | /* star */ |
| 244 | mvwaddch(treescrn5, 0, 12, '*'); |
| 245 | |
| 246 | /* strng1 */ |
| 247 | mvwaddch(treescrn5, 3, 11, ' '); |
| 248 | |
| 249 | /* strng2 */ |
| 250 | mvwaddch(treescrn5, 5, 12, ' '); |
| 251 | |
| 252 | /* strng3 */ |
| 253 | mvwaddch(treescrn5, 7, 14, ' '); |
| 254 | mvwaddch(treescrn5, 8, 10, ' '); |
| 255 | |
| 256 | /* strng4 */ |
| 257 | mvwaddch(treescrn5, 9, 15, ' '); |
| 258 | mvwaddch(treescrn5, 10, 11, ' '); |
| 259 | mvwaddch(treescrn5, 11, 7, ' '); |
| 260 | |
| 261 | /* strng5 */ |
| 262 | mvwaddch(treescrn5, 11, 17, ' '); |
| 263 | mvwaddch(treescrn5, 12, 13, ' '); |
| 264 | |
| 265 | /* treescrn6 */ |
| 266 | |
| 267 | overlay(treescrn, treescrn6); |
| 268 | |
| 269 | /* balls */ |
| 270 | mvwaddch(treescrn6, 6, 7, ' '); |
| 271 | mvwaddch(treescrn6, 7, 18, ' '); |
| 272 | mvwaddch(treescrn6, 10, 4, ' '); |
| 273 | mvwaddch(treescrn6, 11, 23, ' '); |
| 274 | |
| 275 | /* star */ |
| 276 | mvwaddch(treescrn6, 0, 12, '*' | A_STANDOUT); |
| 277 | |
| 278 | /* strng1 */ |
| 279 | |
| 280 | /* strng2 */ |
| 281 | mvwaddch(treescrn6, 5, 11, ' '); |
| 282 | |
| 283 | /* strng3 */ |
| 284 | mvwaddch(treescrn6, 7, 13, ' '); |
| 285 | mvwaddch(treescrn6, 8, 9, ' '); |
| 286 | |
| 287 | /* strng4 */ |
| 288 | mvwaddch(treescrn6, 9, 14, ' '); |
| 289 | mvwaddch(treescrn6, 10, 10, ' '); |
| 290 | mvwaddch(treescrn6, 11, 6, ' '); |
| 291 | |
| 292 | /* strng5 */ |
| 293 | mvwaddch(treescrn6, 11, 16, ' '); |
| 294 | mvwaddch(treescrn6, 12, 12, ' '); |
| 295 | |
| 296 | /* treescrn7 */ |
| 297 | |
| 298 | overlay(treescrn, treescrn7); |
| 299 | |
| 300 | /* balls */ |
| 301 | mvwaddch(treescrn7, 3, 15, ' '); |
| 302 | mvwaddch(treescrn7, 6, 7, ' '); |
| 303 | mvwaddch(treescrn7, 7, 18, ' '); |
| 304 | mvwaddch(treescrn7, 10, 4, ' '); |
| 305 | mvwaddch(treescrn7, 11, 22, ' '); |
| 306 | |
| 307 | /* star */ |
| 308 | mvwaddch(treescrn7, 0, 12, '*'); |
| 309 | |
| 310 | /* strng1 */ |
| 311 | mvwaddch(treescrn7, 3, 12, ' '); |
| 312 | |
| 313 | /* strng2 */ |
| 314 | mvwaddch(treescrn7, 5, 13, ' '); |
| 315 | mvwaddch(treescrn7, 6, 9, ' '); |
| 316 | |
| 317 | /* strng3 */ |
| 318 | mvwaddch(treescrn7, 7, 15, ' '); |
| 319 | mvwaddch(treescrn7, 8, 11, ' '); |
| 320 | |
| 321 | /* strng4 */ |
| 322 | mvwaddch(treescrn7, 9, 16, ' '); |
| 323 | mvwaddch(treescrn7, 10, 12, ' '); |
| 324 | mvwaddch(treescrn7, 11, 8, ' '); |
| 325 | |
| 326 | /* strng5 */ |
| 327 | mvwaddch(treescrn7, 11, 18, ' '); |
| 328 | mvwaddch(treescrn7, 12, 14, ' '); |
| 329 | |
| 330 | napms(1000); |
| 331 | reindeer(); |
| 332 | |
| 333 | touchwin(w_holiday); |
| 334 | wrefresh(w_holiday); |
| 335 | wrefresh(w_del_msg); |
| 336 | |
| 337 | napms(1000); |
| 338 | |
| 339 | for (loopy = 0; loopy < 50; loopy++) |
| 340 | blinkit(); |
| 341 | |
| 342 | clear(); |
| 343 | refresh(); |
| 344 | endwin(); |
| 345 | |
| 346 | return 0; |
| 347 | } |
| 348 | |
| 349 | void lil(WINDOW *win) |
| 350 | { |
| 351 | mvwaddch(win, 0, 0, (chtype) 'V'); |
| 352 | mvwaddch(win, 1, 0, (chtype) '@'); |
| 353 | mvwaddch(win, 1, 3, (chtype) '~'); |
| 354 | } |
| 355 | |
| 356 | void midtop(WINDOW *win) |
| 357 | { |
| 358 | mvwaddstr(win, 0, 2, "yy"); |
| 359 | mvwaddstr(win, 1, 2, "0(=)~"); |
| 360 | } |
| 361 | |
| 362 | void bigtop(WINDOW *win) |
| 363 | { |
| 364 | mvwaddstr(win, 0, 17, "\\/"); |
| 365 | mvwaddstr(win, 0, 20, "\\/"); |
| 366 | mvwaddch(win, 1, 18, (chtype) '\\'); |
| 367 | mvwaddch(win, 1, 20, (chtype) '/'); |
| 368 | mvwaddstr(win, 2, 19, "|_"); |
| 369 | mvwaddstr(win, 3, 18, "/^0\\"); |
| 370 | mvwaddstr(win, 4, 17, "//\\"); |
| 371 | mvwaddch(win, 4, 22, (chtype) '\\'); |
| 372 | mvwaddstr(win, 5, 7, "^~~~~~~~~// ~~U"); |
| 373 | } |
| 374 | |
| 375 | void bigface(WINDOW *win, chtype noseattr) |
| 376 | { |
| 377 | mvwaddstr(win, 0, 16, "\\/ \\/"); |
| 378 | mvwaddstr(win, 1, 17, "\\Y/ \\Y/"); |
| 379 | mvwaddstr(win, 2, 19, "\\=/"); |
| 380 | mvwaddstr(win, 3, 17, "^\\o o/^"); |
| 381 | mvwaddstr(win, 4, 17, "//( )"); |
| 382 | mvwaddstr(win, 5, 7, "^~~~~~~~~// \\"); |
| 383 | waddch(win, 'O' | noseattr); |
| 384 | waddstr(win, "/"); |
| 385 | } |
| 386 | |
| 387 | void legs1(WINDOW *win) |
| 388 | { |
| 389 | mvwaddstr(win, 6, 7, "( \\_____( /"); |
| 390 | mvwaddstr(win, 7, 8, "( ) /"); |
| 391 | mvwaddstr(win, 8, 9, "\\\\ /"); |
| 392 | mvwaddstr(win, 9, 11, "\\>/>"); |
| 393 | } |
| 394 | |
| 395 | void legs2(WINDOW *win) |
| 396 | { |
| 397 | mvwaddstr(win, 6, 7, "(( )____( /"); |
| 398 | mvwaddstr(win, 7, 7, "( / |"); |
| 399 | mvwaddstr(win, 8, 8, "\\/ |"); |
| 400 | mvwaddstr(win, 9, 9, "|> |>"); |
| 401 | } |
| 402 | |
| 403 | void legs3(WINDOW *win) |
| 404 | { |
| 405 | mvwaddstr(win, 6, 6, "( ()_____( /"); |
| 406 | mvwaddstr(win, 7, 6, "/ / /"); |
| 407 | mvwaddstr(win, 8, 5, "|/ \\"); |
| 408 | mvwaddstr(win, 9, 5, "/> \\>"); |
| 409 | } |
| 410 | |
| 411 | void legs4(WINDOW *win) |
| 412 | { |
| 413 | mvwaddstr(win, 6, 6, "( )______( /"); |
| 414 | mvwaddstr(win, 7, 5, "(/ \\"); |
| 415 | mvwaddstr(win, 8, 0, "v___= ----^"); |
| 416 | } |
| 417 | |
| 418 | void initdeer(void) |
| 419 | { |
| 420 | chtype noseattr; |
| 421 | |
| 422 | #ifdef A_COLOR |
| 423 | if (has_colors()) |
| 424 | { |
| 425 | init_pair(31, COLOR_RED, COLOR_BLACK); |
| 426 | noseattr = COLOR_PAIR(31); |
| 427 | } |
| 428 | else |
| 429 | #endif |
| 430 | noseattr = A_NORMAL; |
| 431 | |
| 432 | /* set up the windows for our various reindeer */ |
| 433 | |
| 434 | dotdeer0 = newwin(3, 71, 0, 8); |
| 435 | stardeer0 = newwin(4, 56, 0, 8); |
| 436 | lildeer0 = newwin(7, 54, 0, 8); |
| 437 | middeer0 = newwin(15, 42, 0, 8); |
| 438 | bigdeer0 = newwin(10, 23, 0, 0); |
| 439 | lookdeer0 = newwin(10, 25, 0, 0); |
| 440 | |
| 441 | /* lildeer1 */ |
| 442 | lildeer1 = newwin(2, 4, 0, 0); |
| 443 | lil(lildeer1); |
| 444 | mvwaddstr(lildeer1, 1, 1, "<>"); |
| 445 | |
| 446 | /* lildeer2 */ |
| 447 | lildeer2 = newwin(2, 4, 0, 0); |
| 448 | lil(lildeer2); |
| 449 | mvwaddstr(lildeer2, 1, 1, "||"); |
| 450 | |
| 451 | /* lildeer3 */ |
| 452 | lildeer3 = newwin(2, 4, 0, 0); |
| 453 | lil(lildeer3); |
| 454 | mvwaddstr(lildeer3, 1, 1, "><"); |
| 455 | |
| 456 | /* middeer1 */ |
| 457 | middeer1 = newwin(3, 7, 0, 0); |
| 458 | midtop(middeer1); |
| 459 | mvwaddstr(middeer1, 2, 3, "\\/"); |
| 460 | |
| 461 | /* middeer2 */ |
| 462 | middeer2 = newwin(3, 7, 0, 0); |
| 463 | midtop(middeer2); |
| 464 | mvwaddch(middeer2, 2, 3, (chtype) '|'); |
| 465 | mvwaddch(middeer2, 2, 5, (chtype) '|'); |
| 466 | |
| 467 | /* middeer3 */ |
| 468 | middeer3 = newwin(3, 7, 0, 0); |
| 469 | midtop(middeer3); |
| 470 | mvwaddch(middeer3, 2, 2, (chtype) '/'); |
| 471 | mvwaddch(middeer3, 2, 6, (chtype) '\\'); |
| 472 | |
| 473 | /* bigdeer1 */ |
| 474 | bigdeer1 = newwin(10, 23, 0, 0); |
| 475 | bigtop(bigdeer1); |
| 476 | legs1(bigdeer1); |
| 477 | |
| 478 | /* bigdeer2 */ |
| 479 | bigdeer2 = newwin(10, 23, 0, 0); |
| 480 | bigtop(bigdeer2); |
| 481 | legs2(bigdeer2); |
| 482 | |
| 483 | /* bigdeer3 */ |
| 484 | bigdeer3 = newwin(10, 23, 0, 0); |
| 485 | bigtop(bigdeer3); |
| 486 | legs3(bigdeer3); |
| 487 | |
| 488 | /* bigdeer4 */ |
| 489 | bigdeer4 = newwin(10, 23, 0, 0); |
| 490 | bigtop(bigdeer4); |
| 491 | legs4(bigdeer4); |
| 492 | |
| 493 | /* lookdeer1 */ |
| 494 | lookdeer1 = newwin(10, 25, 0, 0); |
| 495 | bigface(lookdeer1, noseattr); |
| 496 | legs1(lookdeer1); |
| 497 | |
| 498 | /* lookdeer2 */ |
| 499 | lookdeer2 = newwin(10, 25, 0, 0); |
| 500 | bigface(lookdeer2, noseattr); |
| 501 | legs2(lookdeer2); |
| 502 | |
| 503 | /* lookdeer3 */ |
| 504 | lookdeer3 = newwin(10, 25, 0, 0); |
| 505 | bigface(lookdeer3, noseattr); |
| 506 | legs3(lookdeer3); |
| 507 | |
| 508 | /* lookdeer4 */ |
| 509 | lookdeer4 = newwin(10, 25, 0, 0); |
| 510 | bigface(lookdeer4, noseattr); |
| 511 | legs4(lookdeer4); |
| 512 | } |
| 513 | |
| 514 | void boxit(void) |
| 515 | { |
| 516 | int x; |
| 517 | |
| 518 | for (x = 0; x < 20; ++x) |
| 519 | mvaddch(x, 7, '|'); |
| 520 | |
| 521 | for (x = 0; x < 80; ++x) |
| 522 | { |
| 523 | if (x > 7) |
| 524 | mvaddch(19, x, '_'); |
| 525 | |
| 526 | mvaddch(22, x, '_'); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | void seas(void) |
| 531 | { |
| 532 | mvaddch(4, 1, 'S'); |
| 533 | mvaddch(6, 1, 'E'); |
| 534 | mvaddch(8, 1, 'A'); |
| 535 | mvaddch(10, 1, 'S'); |
| 536 | mvaddch(12, 1, 'O'); |
| 537 | mvaddch(14, 1, 'N'); |
| 538 | mvaddch(16, 1, '`'); |
| 539 | mvaddch(18, 1, 'S'); |
| 540 | } |
| 541 | |
| 542 | void greet(void) |
| 543 | { |
| 544 | mvaddch(3, 5, 'G'); |
| 545 | mvaddch(5, 5, 'R'); |
| 546 | mvaddch(7, 5, 'E'); |
| 547 | mvaddch(9, 5, 'E'); |
| 548 | mvaddch(11, 5, 'T'); |
| 549 | mvaddch(13, 5, 'I'); |
| 550 | mvaddch(15, 5, 'N'); |
| 551 | mvaddch(17, 5, 'G'); |
| 552 | mvaddch(19, 5, 'S'); |
| 553 | } |
| 554 | |
| 555 | void fromwho(void) |
| 556 | { |
| 557 | mvaddstr(21, 13, FROMWHO); |
| 558 | } |
| 559 | |
| 560 | void del_msg(void) |
| 561 | { |
| 562 | refresh(); |
| 563 | } |
| 564 | |
| 565 | void tree(void) |
| 566 | { |
| 567 | #ifdef A_COLOR |
| 568 | if (has_colors()) |
| 569 | { |
| 570 | init_pair(30, COLOR_GREEN, COLOR_BLACK); |
| 571 | wattrset(treescrn, COLOR_PAIR(30)); |
| 572 | } |
| 573 | #endif |
| 574 | mvwaddch(treescrn, 1, 11, (chtype) '/'); |
| 575 | mvwaddch(treescrn, 2, 11, (chtype) '/'); |
| 576 | mvwaddch(treescrn, 3, 10, (chtype) '/'); |
| 577 | mvwaddch(treescrn, 4, 9, (chtype) '/'); |
| 578 | mvwaddch(treescrn, 5, 9, (chtype) '/'); |
| 579 | mvwaddch(treescrn, 6, 8, (chtype) '/'); |
| 580 | mvwaddch(treescrn, 7, 7, (chtype) '/'); |
| 581 | mvwaddch(treescrn, 8, 6, (chtype) '/'); |
| 582 | mvwaddch(treescrn, 9, 6, (chtype) '/'); |
| 583 | mvwaddch(treescrn, 10, 5, (chtype) '/'); |
| 584 | mvwaddch(treescrn, 11, 3, (chtype) '/'); |
| 585 | mvwaddch(treescrn, 12, 2, (chtype) '/'); |
| 586 | |
| 587 | mvwaddch(treescrn, 1, 13, (chtype) '\\'); |
| 588 | mvwaddch(treescrn, 2, 13, (chtype) '\\'); |
| 589 | mvwaddch(treescrn, 3, 14, (chtype) '\\'); |
| 590 | mvwaddch(treescrn, 4, 15, (chtype) '\\'); |
| 591 | mvwaddch(treescrn, 5, 15, (chtype) '\\'); |
| 592 | mvwaddch(treescrn, 6, 16, (chtype) '\\'); |
| 593 | mvwaddch(treescrn, 7, 17, (chtype) '\\'); |
| 594 | mvwaddch(treescrn, 8, 18, (chtype) '\\'); |
| 595 | mvwaddch(treescrn, 9, 18, (chtype) '\\'); |
| 596 | mvwaddch(treescrn, 10, 19, (chtype) '\\'); |
| 597 | mvwaddch(treescrn, 11, 21, (chtype) '\\'); |
| 598 | mvwaddch(treescrn, 12, 22, (chtype) '\\'); |
| 599 | |
| 600 | mvwaddch(treescrn, 4, 10, (chtype) '_'); |
| 601 | mvwaddch(treescrn, 4, 14, (chtype) '_'); |
| 602 | mvwaddch(treescrn, 8, 7, (chtype) '_'); |
| 603 | mvwaddch(treescrn, 8, 17, (chtype) '_'); |
| 604 | |
| 605 | mvwaddstr(treescrn, 13, 0, |
| 606 | "//////////// \\\\\\\\\\\\\\\\\\\\\\\\"); |
| 607 | |
| 608 | #ifdef A_COLOR |
| 609 | if (has_colors()) |
| 610 | { |
| 611 | init_pair(20, COLOR_YELLOW, COLOR_BLACK); |
| 612 | wattrset(treescrn, COLOR_PAIR(20)); |
| 613 | } |
| 614 | #endif |
| 615 | mvwaddstr(treescrn, 14, 11, "| |"); |
| 616 | mvwaddstr(treescrn, 15, 11, "|_|"); |
| 617 | |
| 618 | wrefresh(treescrn); |
| 619 | wrefresh(w_del_msg); |
| 620 | } |
| 621 | |
| 622 | void balls(void) |
| 623 | { |
| 624 | chtype ball1, ball2, ball3, ball4, ball5, ball6; |
| 625 | |
| 626 | overlay(treescrn, treescrn2); |
| 627 | |
| 628 | #ifdef A_COLOR |
| 629 | if (has_colors()) |
| 630 | { |
| 631 | init_pair(1, COLOR_BLUE, COLOR_BLACK); |
| 632 | init_pair(2, COLOR_RED, COLOR_BLACK); |
| 633 | init_pair(3, COLOR_MAGENTA, COLOR_BLACK); |
| 634 | init_pair(4, COLOR_CYAN, COLOR_BLACK); |
| 635 | init_pair(5, COLOR_YELLOW, COLOR_BLACK); |
| 636 | init_pair(6, COLOR_WHITE, COLOR_BLACK); |
| 637 | ball1 = COLOR_PAIR(1) | '@'; |
| 638 | ball2 = COLOR_PAIR(2) | '@'; |
| 639 | ball3 = COLOR_PAIR(3) | '@'; |
| 640 | ball4 = COLOR_PAIR(4) | '@'; |
| 641 | ball5 = COLOR_PAIR(5) | '@'; |
| 642 | ball6 = COLOR_PAIR(6) | '@'; |
| 643 | } |
| 644 | else |
| 645 | #endif |
| 646 | ball1 = ball2 = ball3 = ball4 = ball5 = ball6 = '@'; |
| 647 | |
| 648 | mvwaddch(treescrn2, 3, 9, ball1); |
| 649 | mvwaddch(treescrn2, 3, 15, ball2); |
| 650 | mvwaddch(treescrn2, 4, 8, ball3); |
| 651 | mvwaddch(treescrn2, 4, 16, ball4); |
| 652 | mvwaddch(treescrn2, 5, 7, ball5); |
| 653 | mvwaddch(treescrn2, 5, 17, ball6); |
| 654 | mvwaddch(treescrn2, 7, 6, ball1 | A_BOLD); |
| 655 | mvwaddch(treescrn2, 7, 18, ball2 | A_BOLD); |
| 656 | mvwaddch(treescrn2, 8, 5, ball3 | A_BOLD); |
| 657 | mvwaddch(treescrn2, 8, 19, ball4 | A_BOLD); |
| 658 | mvwaddch(treescrn2, 10, 4, ball5 | A_BOLD); |
| 659 | mvwaddch(treescrn2, 10, 20, ball6 | A_BOLD); |
| 660 | mvwaddch(treescrn2, 11, 2, ball1); |
| 661 | mvwaddch(treescrn2, 11, 22, ball2); |
| 662 | mvwaddch(treescrn2, 12, 1, ball3); |
| 663 | mvwaddch(treescrn2, 12, 23, ball4); |
| 664 | |
| 665 | wrefresh(treescrn2); |
| 666 | wrefresh(w_del_msg); |
| 667 | } |
| 668 | |
| 669 | void star(void) |
| 670 | { |
| 671 | mvwaddch(treescrn2, 0, 12, (chtype) '*' | A_STANDOUT); |
| 672 | |
| 673 | wrefresh(treescrn2); |
| 674 | wrefresh(w_del_msg); |
| 675 | } |
| 676 | |
| 677 | void strng1(void) |
| 678 | { |
| 679 | #ifdef A_COLOR |
| 680 | if (has_colors()) |
| 681 | { |
| 682 | init_pair(10, COLOR_YELLOW, COLOR_BLACK); |
| 683 | wattrset(treescrn2, COLOR_PAIR(10) | A_BOLD); |
| 684 | } |
| 685 | #endif |
| 686 | mvwaddstr(treescrn2, 3, 11, ".:'"); |
| 687 | |
| 688 | wrefresh(treescrn2); |
| 689 | wrefresh(w_del_msg); |
| 690 | } |
| 691 | |
| 692 | void strng2(void) |
| 693 | { |
| 694 | #ifdef A_COLOR |
| 695 | if (has_colors()) |
| 696 | { |
| 697 | init_pair(11, COLOR_RED, COLOR_BLACK); |
| 698 | wattrset(treescrn2, COLOR_PAIR(11) | A_BOLD); |
| 699 | } |
| 700 | #endif |
| 701 | mvwaddstr(treescrn2, 5, 11, ",.:'"); |
| 702 | mvwaddstr(treescrn2, 6, 9, ":'"); |
| 703 | |
| 704 | wrefresh(treescrn2); |
| 705 | wrefresh(w_del_msg); |
| 706 | } |
| 707 | |
| 708 | void strng3(void) |
| 709 | { |
| 710 | #ifdef A_COLOR |
| 711 | if (has_colors()) |
| 712 | { |
| 713 | init_pair(12, COLOR_GREEN, COLOR_BLACK); |
| 714 | wattrset(treescrn2, COLOR_PAIR(12) | A_BOLD); |
| 715 | } |
| 716 | #endif |
| 717 | mvwaddstr(treescrn2, 7, 13, ",.:'"); |
| 718 | mvwaddstr(treescrn2, 8, 9, ",.:'"); |
| 719 | |
| 720 | wrefresh(treescrn2); |
| 721 | wrefresh(w_del_msg); |
| 722 | } |
| 723 | |
| 724 | void strng4(void) |
| 725 | { |
| 726 | #ifdef A_COLOR |
| 727 | if (has_colors()) |
| 728 | { |
| 729 | init_pair(13, COLOR_WHITE, COLOR_BLACK); |
| 730 | wattrset(treescrn2, COLOR_PAIR(13) | A_BOLD); |
| 731 | } |
| 732 | #endif |
| 733 | mvwaddstr(treescrn2, 9, 14, ",.:'"); |
| 734 | mvwaddstr(treescrn2, 10, 10, ",.:'"); |
| 735 | mvwaddstr(treescrn2, 11, 6, ",.:'"); |
| 736 | mvwaddch(treescrn2, 12, 5, (chtype) '\''); |
| 737 | |
| 738 | wrefresh(treescrn2); |
| 739 | wrefresh(w_del_msg); |
| 740 | } |
| 741 | |
| 742 | void strng5(void) |
| 743 | { |
| 744 | #ifdef A_COLOR |
| 745 | if (has_colors()) |
| 746 | { |
| 747 | init_pair(14, COLOR_CYAN, COLOR_BLACK); |
| 748 | wattrset(treescrn2, COLOR_PAIR(14) | A_BOLD); |
| 749 | } |
| 750 | #endif |
| 751 | mvwaddstr(treescrn2, 11, 16, ",.:'"); |
| 752 | mvwaddstr(treescrn2, 12, 12, ",.:'"); |
| 753 | |
| 754 | /* save a fully lit tree */ |
| 755 | overlay(treescrn2, treescrn); |
| 756 | |
| 757 | wrefresh(treescrn2); |
| 758 | wrefresh(w_del_msg); |
| 759 | } |
| 760 | |
| 761 | void blinkit(void) |
| 762 | { |
| 763 | static int cycle; |
| 764 | |
| 765 | if (cycle > 4) |
| 766 | cycle = 0; |
| 767 | |
| 768 | touchwin(treescrn8); |
| 769 | |
| 770 | switch (cycle) |
| 771 | { |
| 772 | case 0: |
| 773 | overlay(treescrn3, treescrn8); |
| 774 | break; |
| 775 | |
| 776 | case 1: |
| 777 | overlay(treescrn4, treescrn8); |
| 778 | break; |
| 779 | |
| 780 | case 2: |
| 781 | overlay(treescrn5, treescrn8); |
| 782 | break; |
| 783 | |
| 784 | case 3: |
| 785 | overlay(treescrn6, treescrn8); |
| 786 | break; |
| 787 | |
| 788 | case 4: |
| 789 | overlay(treescrn7, treescrn8); |
| 790 | } |
| 791 | |
| 792 | wrefresh(treescrn8); |
| 793 | wrefresh(w_del_msg); |
| 794 | |
| 795 | napms(50); |
| 796 | touchwin(treescrn8); |
| 797 | |
| 798 | /*ALL ON************************************************** */ |
| 799 | |
| 800 | overlay(treescrn, treescrn8); |
| 801 | wrefresh(treescrn8); |
| 802 | wrefresh(w_del_msg); |
| 803 | |
| 804 | ++cycle; |
| 805 | } |
| 806 | |
| 807 | #define TSHOW(win, pause) touchwin(win); wrefresh(win); \ |
| 808 | wrefresh(w_del_msg); napms(pause) |
| 809 | |
| 810 | #define SHOW(win, pause) mvwin(win, y_pos, x_pos); wrefresh(win); \ |
| 811 | wrefresh(w_del_msg); napms(pause) |
| 812 | |
| 813 | void reindeer(void) |
| 814 | { |
| 815 | int looper; |
| 816 | |
| 817 | y_pos = 0; |
| 818 | |
| 819 | for (x_pos = 70; x_pos > 62; x_pos--) |
| 820 | { |
| 821 | if (x_pos < 62) |
| 822 | y_pos = 1; |
| 823 | |
| 824 | for (looper = 0; looper < 4; looper++) |
| 825 | { |
| 826 | mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '.'); |
| 827 | wrefresh(dotdeer0); |
| 828 | wrefresh(w_del_msg); |
| 829 | werase(dotdeer0); |
| 830 | wrefresh(dotdeer0); |
| 831 | wrefresh(w_del_msg); |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | y_pos = 2; |
| 836 | |
| 837 | for (; x_pos > 50; x_pos--) |
| 838 | { |
| 839 | for (looper = 0; looper < 4; looper++) |
| 840 | { |
| 841 | if (x_pos < 56) |
| 842 | { |
| 843 | y_pos = 3; |
| 844 | |
| 845 | mvwaddch(stardeer0, y_pos, x_pos, (chtype) '*'); |
| 846 | wrefresh(stardeer0); |
| 847 | wrefresh(w_del_msg); |
| 848 | werase(stardeer0); |
| 849 | wrefresh(stardeer0); |
| 850 | } |
| 851 | else |
| 852 | { |
| 853 | mvwaddch(dotdeer0, y_pos, x_pos, (chtype) '*'); |
| 854 | wrefresh(dotdeer0); |
| 855 | wrefresh(w_del_msg); |
| 856 | werase(dotdeer0); |
| 857 | wrefresh(dotdeer0); |
| 858 | } |
| 859 | wrefresh(w_del_msg); |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | x_pos = 58; |
| 864 | |
| 865 | for (y_pos = 2; y_pos < 5; y_pos++) |
| 866 | { |
| 867 | TSHOW(lildeer0, 50); |
| 868 | |
| 869 | for (looper = 0; looper < 4; looper++) |
| 870 | { |
| 871 | SHOW(lildeer3, 50); |
| 872 | SHOW(lildeer2, 50); |
| 873 | SHOW(lildeer1, 50); |
| 874 | SHOW(lildeer2, 50); |
| 875 | SHOW(lildeer3, 50); |
| 876 | |
| 877 | TSHOW(lildeer0, 50); |
| 878 | |
| 879 | x_pos -= 2; |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | x_pos = 35; |
| 884 | |
| 885 | for (y_pos = 5; y_pos < 10; y_pos++) |
| 886 | { |
| 887 | touchwin(middeer0); |
| 888 | wrefresh(middeer0); |
| 889 | wrefresh(w_del_msg); |
| 890 | |
| 891 | for (looper = 0; looper < 2; looper++) |
| 892 | { |
| 893 | SHOW(middeer3, 50); |
| 894 | SHOW(middeer2, 50); |
| 895 | SHOW(middeer1, 50); |
| 896 | SHOW(middeer2, 50); |
| 897 | SHOW(middeer3, 50); |
| 898 | |
| 899 | TSHOW(middeer0, 50); |
| 900 | |
| 901 | x_pos -= 3; |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | napms(2000); |
| 906 | |
| 907 | y_pos = 1; |
| 908 | |
| 909 | for (x_pos = 8; x_pos < 16; x_pos++) |
| 910 | { |
| 911 | SHOW(bigdeer4, 30); |
| 912 | SHOW(bigdeer3, 30); |
| 913 | SHOW(bigdeer2, 30); |
| 914 | SHOW(bigdeer1, 30); |
| 915 | SHOW(bigdeer2, 30); |
| 916 | SHOW(bigdeer3, 30); |
| 917 | SHOW(bigdeer4, 30); |
| 918 | SHOW(bigdeer0, 30); |
| 919 | } |
| 920 | |
| 921 | --x_pos; |
| 922 | |
| 923 | for (looper = 0; looper < 6; looper++) |
| 924 | { |
| 925 | SHOW(lookdeer4, 40); |
| 926 | SHOW(lookdeer3, 40); |
| 927 | SHOW(lookdeer2, 40); |
| 928 | SHOW(lookdeer1, 40); |
| 929 | SHOW(lookdeer2, 40); |
| 930 | SHOW(lookdeer3, 40); |
| 931 | SHOW(lookdeer4, 40); |
| 932 | } |
| 933 | |
| 934 | SHOW(lookdeer0, 40); |
| 935 | |
| 936 | for (; y_pos < 10; y_pos++) |
| 937 | { |
| 938 | for (looper = 0; looper < 2; looper++) |
| 939 | { |
| 940 | SHOW(bigdeer4, 30); |
| 941 | SHOW(bigdeer3, 30); |
| 942 | SHOW(bigdeer2, 30); |
| 943 | SHOW(bigdeer1, 30); |
| 944 | SHOW(bigdeer2, 30); |
| 945 | SHOW(bigdeer3, 30); |
| 946 | SHOW(bigdeer4, 30); |
| 947 | } |
| 948 | |
| 949 | SHOW(bigdeer0, 30); |
| 950 | } |
| 951 | |
| 952 | --y_pos; |
| 953 | |
| 954 | mvwin(lookdeer3, y_pos, x_pos); |
| 955 | wrefresh(lookdeer3); |
| 956 | wrefresh(w_del_msg); |
| 957 | } |