1 /* This file is part of Alienwave, a game by Alessandro Pira */
2
3 #include <curses.h>
4 #include "defs.h"
5 #include "util.h"
6
7 extern int x_ofs;
8 extern int y_ofs;
9 extern int term_x;
10 extern int term_y;
11 extern WINDOW *term; /* our terminal */
12
13 /* Explosion blitting */
14
15 /* All the explosion functions must be called with the coordinates
16 of the center point as parameters */
17
blit_explosion_1(int x,int y)18 void blit_explosion_1(int x, int y)
19 {
20 /*
21 .
22 #@#
23 "
24 */
25 SET_COLOR(COL_DARKYELLOW);
26 if (is_y_range(y-1))
27 {
28 mvwaddch(term,y-1,x,(chtype)'.');
29 }
30 if (is_y_range(y))
31 {
32 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)'#');
33 SET_COLOR(COL_DARKRED);
34 mvwaddch(term,y,x,(chtype)'@');
35 SET_COLOR(COL_DARKYELLOW);
36 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)'#');
37 }
38 if (is_y_range(y+1))
39 {
40 mvwaddch(term,y+1,x,(chtype)'"');
41 }
42 SET_COLOR(COL_BKG);
43 }
44
clear_explosion_1(int x,int y)45 void clear_explosion_1(int x, int y)
46 {
47 SET_COLOR(COL_BKG);
48 if (is_y_range(y-1))
49 {
50 mvwaddch(term,y-1,x,(chtype)' ');
51 }
52 if (is_y_range(y))
53 {
54 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)' ');
55 mvwaddch(term,y,x,(chtype)' ');
56 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)' ');
57 }
58 if (is_y_range(y+1))
59 {
60 mvwaddch(term,y+1,x,(chtype)' ');
61 }
62 }
63
blit_explosion_2(int x,int y)64 void blit_explosion_2(int x, int y)
65 {
66 /*
67 @
68 @#@
69 @
70 */
71 SET_COLOR(COL_DARKRED);
72 if (is_y_range(y-1))
73 {
74 mvwaddch(term,y-1,x,(chtype)'@');
75 }
76 if (is_y_range(y))
77 {
78 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)'#');
79 SET_COLOR(COL_RED);
80 mvwaddch(term,y,x,(chtype)'@');
81 SET_COLOR(COL_DARKRED);
82 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)'#');
83 }
84 if (is_y_range(y+1))
85 {
86 mvwaddch(term,y+1,x,(chtype)'@');
87 }
88 SET_COLOR(COL_BKG);
89 }
90
clear_explosion_2(int x,int y)91 void clear_explosion_2(int x, int y)
92 {
93 clear_explosion_1(x,y);
94 }
95
blit_explosion_3(int x,int y)96 void blit_explosion_3(int x, int y)
97 {
98 /*
99 .
100 #@#
101 #@#@#
102 #@#
103 "
104 */
105
106 SET_COLOR(COL_DARKRED);
107 if (is_y_range(y-2))
108 {
109 mvwaddch(term,y-2,x,(chtype)'.');
110 }
111 if (is_y_range(y-1))
112 {
113 if (is_x_range(x-1)) mvwaddch(term,y-1,x-1,(chtype)'#');
114 SET_COLOR(COL_RED);
115 mvwaddch(term,y-1,x,(chtype)'@');
116 SET_COLOR(COL_DARKRED);
117 if (is_x_range(x+1)) mvwaddch(term,y-1,x+1,(chtype)'#');
118 }
119 if (is_y_range(y))
120 {
121 if (is_x_range(x-2)) mvwaddch(term,y,x-2,(chtype)'#');
122 SET_COLOR(COL_RED);
123 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)'@');
124 SET_COLOR(COL_YELLOW);
125 mvwaddch(term,y,x,(chtype)'#');
126 SET_COLOR(COL_RED);
127 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)'@');
128 SET_COLOR(COL_DARKRED);
129 if (is_x_range(x+2)) mvwaddch(term,y,x+2,(chtype)'#');
130 }
131 if (is_y_range(y+1))
132 {
133 if (is_x_range(x-1)) mvwaddch(term,y+1,x-1,(chtype)'#');
134 SET_COLOR(COL_RED);
135 mvwaddch(term,y+1,x,(chtype)'@');
136 SET_COLOR(COL_DARKRED);
137 if (is_x_range(x+1)) mvwaddch(term,y+1,x+1,(chtype)'#');
138 }
139 if (is_y_range(y+2))
140 {
141 mvwaddch(term,y+2,x,(chtype)'"');
142 }
143 SET_COLOR(COL_BKG);
144 }
145
clear_explosion_3(int x,int y)146 void clear_explosion_3(int x, int y)
147 {
148 SET_COLOR(COL_BKG);
149 if (is_y_range(y-2))
150 {
151 mvwaddch(term,y-2,x,(chtype)' ');
152 }
153 if (is_y_range(y-1))
154 {
155 if (is_x_range(x-1)) mvwaddch(term,y-1,x-1,(chtype)' ');
156 mvwaddch(term,y-1,x,(chtype)' ');
157 if (is_x_range(x+1)) mvwaddch(term,y-1,x+1,(chtype)' ');
158 }
159 if (is_y_range(y))
160 {
161 if (is_x_range(x-2)) mvwaddch(term,y,x-2,(chtype)' ');
162 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)' ');
163 mvwaddch(term,y,x,(chtype)' ');
164 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)' ');
165 if (is_x_range(x+2)) mvwaddch(term,y,x+2,(chtype)' ');
166 }
167 if (is_y_range(y+1))
168 {
169 if (is_x_range(x-1)) mvwaddch(term,y+1,x-1,(chtype)' ');
170 mvwaddch(term,y+1,x,(chtype)' ');
171 if (is_x_range(x+1)) mvwaddch(term,y+1,x+1,(chtype)' ');
172 }
173 if (is_y_range(y+2))
174 {
175 mvwaddch(term,y+2,x,(chtype)' ');
176 }
177 }
178
blit_explosion_4(int x,int y)179 void blit_explosion_4(int x, int y)
180 {
181 /*
182 .
183 @#@
184 @#@#@
185 @#@#@#@
186 @#@#@
187 @#@
188 "
189 */
190 SET_COLOR(COL_DARKYELLOW);
191 if (is_y_range(y-3))
192 {
193 mvwaddch(term,y-3,x,(chtype)'.');
194 }
195 if (is_y_range(y-2))
196 {
197 if (is_x_range(x-1)) mvwaddch(term,y-2,x-1,(chtype)'@');
198 SET_COLOR(COL_DARKRED);
199 mvwaddch(term,y-2,x,(chtype)'#');
200 SET_COLOR(COL_DARKYELLOW);
201 if (is_x_range(x+1)) mvwaddch(term,y-2,x+1,(chtype)'@');
202 }
203 if (is_y_range(y-1))
204 {
205 if (is_x_range(x-2)) mvwaddch(term,y-1,x-2,(chtype)'@');
206 SET_COLOR(COL_DARKRED);
207 if (is_x_range(x-1)) mvwaddch(term,y-1,x-1,(chtype)'#');
208 SET_COLOR(COL_RED);
209 mvwaddch(term,y-1,x,(chtype)'@');
210 SET_COLOR(COL_DARKRED);
211 if (is_x_range(x+1)) mvwaddch(term,y-1,x+1,(chtype)'#');
212 SET_COLOR(COL_DARKYELLOW);
213 if (is_x_range(x+2)) mvwaddch(term,y-1,x+2,(chtype)'@');
214 }
215 if (is_y_range(y))
216 {
217 if (is_x_range(x-3)) mvwaddch(term,y,x-3,(chtype)'@');
218 SET_COLOR(COL_DARKRED);
219 if (is_x_range(x-2)) mvwaddch(term,y,x-2,(chtype)'#');
220 SET_COLOR(COL_RED);
221 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)'@');
222 SET_COLOR(COL_YELLOW);
223 mvwaddch(term,y,x,(chtype)'#');
224 SET_COLOR(COL_RED);
225 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)'@');
226 SET_COLOR(COL_DARKRED);
227 if (is_x_range(x+2)) mvwaddch(term,y,x+2,(chtype)'#');
228 SET_COLOR(COL_DARKYELLOW);
229 if (is_x_range(x+3)) mvwaddch(term,y,x+3,(chtype)'@');
230 }
231 if (is_y_range(y+1))
232 {
233 if (is_x_range(x-2)) mvwaddch(term,y+1,x-2,(chtype)'@');
234 SET_COLOR(COL_DARKRED);
235 if (is_x_range(x-1)) mvwaddch(term,y+1,x-1,(chtype)'#');
236 SET_COLOR(COL_RED);
237 mvwaddch(term,y+1,x,(chtype)'@');
238 SET_COLOR(COL_DARKRED);
239 if (is_x_range(x+1)) mvwaddch(term,y+1,x+1,(chtype)'#');
240 SET_COLOR(COL_DARKYELLOW);
241 if (is_x_range(x+2)) mvwaddch(term,y+1,x+2,(chtype)'@');
242 }
243 if (is_y_range(y+2))
244 {
245 if (is_x_range(x-1)) mvwaddch(term,y+2,x-1,(chtype)'@');
246 SET_COLOR(COL_DARKRED);
247 mvwaddch(term,y+2,x,(chtype)'#');
248 SET_COLOR(COL_DARKYELLOW);
249 if (is_x_range(x+1)) mvwaddch(term,y+2,x+1,(chtype)'@');
250 }
251 if (is_y_range(y+3))
252 {
253 mvwaddch(term,y+3,x,(chtype)'"');
254 }
255 SET_COLOR(COL_BKG);
256 }
257
clear_explosion_4(int x,int y)258 void clear_explosion_4(int x, int y)
259 {
260 SET_COLOR(COL_BKG);
261 if (is_y_range(y-3))
262 {
263 mvwaddch(term,y-3,x,(chtype)' ');
264 }
265 if (is_y_range(y-2))
266 {
267 if (is_x_range(x-1)) mvwaddch(term,y-2,x-1,(chtype)' ');
268 mvwaddch(term,y-2,x,(chtype)' ');
269 if (is_x_range(x+1)) mvwaddch(term,y-2,x+1,(chtype)' ');
270 }
271 if (is_y_range(y-1))
272 {
273 if (is_x_range(x-2)) mvwaddch(term,y-1,x-2,(chtype)' ');
274 if (is_x_range(x-1)) mvwaddch(term,y-1,x-1,(chtype)' ');
275 mvwaddch(term,y-1,x,(chtype)' ');
276 if (is_x_range(x+1)) mvwaddch(term,y-1,x+1,(chtype)' ');
277 if (is_x_range(x+2)) mvwaddch(term,y-1,x+2,(chtype)' ');
278 }
279 if (is_y_range(y))
280 {
281 if (is_x_range(x-3)) mvwaddch(term,y,x-3,(chtype)' ');
282 if (is_x_range(x-2)) mvwaddch(term,y,x-2,(chtype)' ');
283 if (is_x_range(x-1)) mvwaddch(term,y,x-1,(chtype)' ');
284 mvwaddch(term,y,x,(chtype)' ');
285 if (is_x_range(x+1)) mvwaddch(term,y,x+1,(chtype)' ');
286 if (is_x_range(x+2)) mvwaddch(term,y,x+2,(chtype)' ');
287 if (is_x_range(x+3)) mvwaddch(term,y,x+3,(chtype)' ');
288 }
289 if (is_y_range(y+1))
290 {
291 if (is_x_range(x-2)) mvwaddch(term,y+1,x-2,(chtype)' ');
292 if (is_x_range(x-1)) mvwaddch(term,y+1,x-1,(chtype)' ');
293 mvwaddch(term,y+1,x,(chtype)' ');
294 if (is_x_range(x+1)) mvwaddch(term,y+1,x+1,(chtype)' ');
295 if (is_x_range(x+2)) mvwaddch(term,y+1,x+2,(chtype)' ');
296 }
297 if (is_y_range(y+2))
298 {
299 if (is_x_range(x-1)) mvwaddch(term,y+2,x-1,(chtype)' ');
300 mvwaddch(term,y+2,x,(chtype)' ');
301 if (is_x_range(x+1)) mvwaddch(term,y+2,x+1,(chtype)' ');
302 }
303 if (is_y_range(y+3))
304 {
305 mvwaddch(term,y+3,x,(chtype)' ');
306 }
307 }
308
blit_explosion(int x,int y,int dim)309 void blit_explosion(int x, int y, int dim)
310 {
311 switch (dim)
312 {
313 case 1:
314 blit_explosion_1(x,y);
315 break;
316 case 2:
317 blit_explosion_2(x,y);
318 break;
319 case 3:
320 blit_explosion_3(x,y);
321 break;
322 case 4:
323 blit_explosion_4(x,y);
324 break;
325 }
326 }
327
clear_explosion(int x,int y,int dim)328 void clear_explosion(int x, int y, int dim)
329 {
330 switch (dim)
331 {
332 case 1:
333 clear_explosion_1(x,y);
334 break;
335 case 2:
336 clear_explosion_2(x,y);
337 break;
338 case 3:
339 clear_explosion_3(x,y);
340 break;
341 case 4:
342 clear_explosion_4(x,y);
343 break;
344 }
345 }
346
347 /* End of explosion blitting */
348
blit_big_alien(int x,int y)349 void blit_big_alien(int x, int y)
350 {
351 /*
352 Big Alien:
353
354 |-v-|
355 | o |
356 \_/
357 */
358 if (is_y_range(y))
359 {
360 SET_COLOR(COL_GREEN);
361 mvwprintw(term,y,x,"|-");
362 SET_COLOR(COL_BLUE);
363 wprintw(term,"v");
364 SET_COLOR(COL_GREEN);
365 wprintw(term,"-|");
366 }
367 if (is_y_range(y+1))
368 {
369 SET_COLOR(COL_GREEN);
370 mvwprintw(term,y+1,x,"| ");
371 SET_COLOR(COL_CYAN);
372 wprintw(term,"o");
373 SET_COLOR(COL_GREEN);
374 wprintw(term," |");
375 }
376 if (is_y_range(y+2))
377 {
378 SET_COLOR(COL_GREEN);
379 mvwprintw(term,y+2,x+1,"\\_/");
380 }
381 SET_COLOR(COL_BKG);
382 }
383
clear_big_alien(int x,int y)384 void clear_big_alien(int x, int y)
385 {
386 SET_COLOR(COL_BKG);
387 if (is_y_range(y)) mvwprintw(term,y,x, " ");
388 if (is_y_range(y+1)) mvwprintw(term,y+1,x, " ");
389 if (is_y_range(y+2)) mvwprintw(term,y+2,x+1, " ");
390 }
391
blit_lit_alien(int x,int y)392 void blit_lit_alien(int x,int y)
393 {
394 /*
395 Little Alien:
396
397 W_W
398 "
399 */
400 if (is_y_range(y))
401 {
402 SET_COLOR(COL_BLUE);
403 mvwprintw(term,y,x,"W W");
404 SET_COLOR(COL_WHITE);
405 mvwaddch(term,y,x+1,(chtype)'_');
406 }
407 if (is_y_range(y+1))
408 {
409 SET_COLOR(COL_RED);
410 mvwprintw(term,y+1,x+1,"\"");
411 }
412 SET_COLOR(COL_BKG);
413 }
414
clear_lit_alien(int x,int y)415 void clear_lit_alien(int x, int y)
416 {
417 SET_COLOR(COL_BKG);
418 if (is_y_range(y)) mvwprintw(term,y,x," ");
419 if (is_y_range(y+1)) mvwprintw(term,y+1,x+1," ");
420 }
421
blit_ball_alien(int x,int y)422 void blit_ball_alien(int x,int y)
423 {
424 /*
425 /^\
426 \_/
427 */
428 SET_COLOR(COL_DARKMAGENTA);
429 if (is_y_range(y)) mvwprintw(term,y,x,"/^\\");
430 if (is_y_range(y+1)) mvwprintw(term,y+1,x,"\\_/");
431 SET_COLOR(COL_BKG);
432 }
433
clear_ball_alien(int x,int y)434 void clear_ball_alien(int x,int y)
435 {
436 SET_COLOR(COL_BKG);
437 if (is_y_range(y)) mvwprintw(term,y,x," ");
438 if (is_y_range(y+1)) mvwprintw(term,y+1,x," ");
439 }
440
blit_slime_alien(int x,int y)441 void blit_slime_alien(int x,int y)
442 {
443 /*
444 /~T~\
445 \/|\/
446 */
447 if (is_y_range(y))
448 {
449 SET_COLOR(COL_BLUE);
450 mvwprintw(term,y,x,"/");
451 SET_COLOR(COL_RED);
452 wprintw(term,"~T~");
453 SET_COLOR(COL_BLUE);
454 wprintw(term,"\\");
455 }
456 if (is_y_range(y+1))
457 {
458 SET_COLOR(COL_BLUE);
459 mvwprintw(term,y+1,x,"\\/");
460 SET_COLOR(COL_RED);
461 wprintw(term,"|");
462 SET_COLOR(COL_BLUE);
463 wprintw(term,"\\/");
464 }
465 SET_COLOR(COL_BKG);
466 }
467
clear_slime_alien(int x,int y)468 void clear_slime_alien(int x,int y)
469 {
470 SET_COLOR(COL_BKG);
471 if (is_y_range(y)) mvwprintw(term,y,x," ");
472 if (is_y_range(y+1)) mvwprintw(term,y+1,x," ");
473 }
474
blit_tiny_alien(int x,int y)475 void blit_tiny_alien(int x,int y)
476 {
477 /*
478 o
479 */
480 SET_COLOR(COL_GREEN);
481 if (is_y_range(y)) mvwprintw(term,y,x,"o");
482 SET_COLOR(COL_BKG);
483 }
484
clear_tiny_alien(int x,int y)485 void clear_tiny_alien(int x,int y)
486 {
487 SET_COLOR(COL_BKG);
488 if (is_y_range(y)) mvwprintw(term,y,x," ");
489 }
490
blit_fire(int x,int y)491 void blit_fire(int x,int y)
492 {
493 if (is_y_range(y))
494 {
495 SET_COLOR(COL_RED);
496 mvwaddch(term,y,x,(chtype)'!');
497 SET_COLOR(COL_BKG);
498 }
499 }
500
clear_fire(int x,int y)501 void clear_fire(int x, int y)
502 {
503 if (is_y_range(y))
504 {
505 SET_COLOR(COL_BKG);
506 mvwaddch(term,y,x,(chtype)' ');
507 }
508 }
509
blit_ship(int x,int y)510 void blit_ship(int x,int y)
511 {
512 /* This is the player's ship:
513 /^\
514 | _ |
515 < /_\ >
516 ^^^^^
517 */
518
519 if (is_y_range(y))
520 {
521 SET_COLOR(COL_GRAY);
522 mvwprintw(term,y,x+2, "/^\\");
523 }
524
525 if (is_y_range(y+1))
526 {
527 SET_COLOR(COL_GRAY);
528 mvwprintw(term,y+1,x+1,"| ");
529 SET_COLOR(COL_DARKCYAN);
530 wprintw(term,"_");
531 SET_COLOR(COL_GRAY);
532 wprintw(term," |");
533 }
534
535 if (is_y_range(y+2))
536 {
537 SET_COLOR(COL_GRAY);
538 mvwprintw(term,y+2,x,"< ");
539 SET_COLOR(COL_DARKCYAN);
540 wprintw(term,"/_\\");
541 SET_COLOR(COL_GRAY);
542 wprintw(term," >");
543 }
544
545 if (is_y_range(y+3))
546 {
547 SET_COLOR(COL_YELLOW);
548 mvwprintw(term,y+3,x+1,"^");
549 SET_COLOR(COL_RED);
550 wprintw(term,"^^^");
551 SET_COLOR(COL_YELLOW);
552 wprintw(term,"^");
553 }
554
555 SET_COLOR(COL_BKG);
556 }
557
clear_ship(int x,int y)558 void clear_ship(int x,int y)
559 {
560 SET_COLOR(COL_BKG);
561 if (is_y_range(y)) mvwprintw(term,y,x+2, " ");
562 if (is_y_range(y+1)) mvwprintw(term,y+1,x+1, " ");
563 if (is_y_range(y+2)) mvwprintw(term,y+2,x, " ");
564 if (is_y_range(y+3)) mvwprintw(term,y+3,x+1, " ");
565 }
566
blit_shield(int x,int y,int intensity)567 void blit_shield(int x,int y,int intensity)
568 {
569 /* This is the shield:
570
571 /~~~^~~~\
572
573 */
574 int col1=COL_DARKGREEN,col2=COL_DARKGREEN,col3=COL_DARKGREEN;
575 switch (intensity)
576 {
577 case 3:
578 col2=COL_GREEN;
579 col3=COL_CYAN;
580 break;
581 case 2:
582 col3=COL_GREEN;
583 break;
584 }
585
586 if (is_x_range(x))
587 {
588 SET_COLOR(col1);
589 mvwprintw(term,y,x,"/");
590 }
591 SET_COLOR(col2);
592 mvwprintw(term,y,x+1,"~~");
593 SET_COLOR(col3);
594 wprintw(term,"~^~");
595 SET_COLOR(col2);
596 wprintw(term,"~~");
597 if (is_x_range(x+8))
598 {
599 SET_COLOR(col1);
600 wprintw(term,"\\");
601 }
602 SET_COLOR(COL_BKG);
603 }
604
blit_shield_charge(int x,int y,int length)605 void blit_shield_charge(int x, int y, int length)
606 {
607 int i;
608 for (i=0;i<length;i++)
609 {
610 switch(i)
611 {
612 case 0:
613 SET_COLOR(COL_DARKYELLOW);
614 break;
615 case 5:
616 SET_COLOR(COL_DARKRED);
617 break;
618 case 10:
619 SET_COLOR(COL_RED);
620 break;
621 case 15:
622 SET_COLOR(COL_YELLOW);
623 break;
624 }
625 mvprintw(y,i+x,"-");
626 }
627 SET_COLOR(COL_BKG);
628 }
629
clear_shield(int x,int y)630 void clear_shield(int x,int y)
631 {
632 SET_COLOR(COL_BKG);
633 if (is_x_range(x))
634 {
635 mvwprintw(term,y,x," ");
636 }
637 mvwprintw(term,y,x+1," ");
638 if (is_x_range(x+8))
639 {
640 wprintw(term," ");
641 }
642 }
643
clear_shield_charge(int x,int y)644 void clear_shield_charge(int x, int y)
645 {
646 SET_COLOR(COL_BKG);
647 mvwprintw(term,y,x," ");
648 }
649
blit_score(int x,int y,int score)650 void blit_score(int x, int y, int score)
651 {
652 SET_COLOR(COL_WHITE);
653 mvwprintw(term,y,x,"%d",score);
654 SET_COLOR(COL_BKG);
655 }
656
blit_xzarna(int x,int y,unsigned int extra)657 void blit_xzarna(int x,int y,unsigned int extra)
658 {
659 /*
660 /^~~^~~^\
661 ( o o o o )
662 \ ~\~/~ /
663 > O O <
664 (_/\_/\_)
665 */
666 int eye_col = (extra & 0xFF);
667 unsigned char eggs = ((extra & 0xFF00) >> 8);
668 if (is_y_range(y))
669 {
670 SET_COLOR(COL_BLUE);
671 mvwprintw(term,y,x+1,"/");
672 SET_COLOR(COL_RED);
673 wprintw(term,"^");
674 SET_COLOR(COL_BLUE);
675 wprintw(term,"~~");
676 SET_COLOR(COL_RED);
677 wprintw(term,"^");
678 SET_COLOR(COL_BLUE);
679 wprintw(term,"~~");
680 SET_COLOR(COL_RED);
681 wprintw(term,"^");
682 SET_COLOR(COL_BLUE);
683 wprintw(term,"\\");
684 }
685 if (is_y_range(y+1))
686 {
687 int cnt=0;
688 SET_COLOR(COL_BLUE);
689 mvwprintw(term,y+1,x,"(");
690 SET_COLOR(COL_GREEN);
691 while (cnt<4)
692 {
693 if (eggs & (1<<(cnt++)))
694 wprintw(term," o");
695 else
696 wprintw(term," ");
697 }
698 SET_COLOR(COL_BLUE);
699 wprintw(term," )");
700 }
701 if (is_y_range(y+2))
702 {
703 SET_COLOR(COL_BLUE);
704 mvwprintw(term,y+2,x+1,"\\ ~");
705 SET_COLOR(COL_DARKCYAN);
706 wprintw(term,"\\");
707 SET_COLOR(COL_BLUE);
708 wprintw(term,"~");
709 SET_COLOR(COL_DARKCYAN);
710 wprintw(term,"/");
711 SET_COLOR(COL_BLUE);
712 wprintw(term,"~ /");
713 }
714 if (is_y_range(y+3))
715 {
716 SET_COLOR(COL_BLUE);
717 mvwprintw(term,y+3,x+2,"> ");
718 SET_COLOR(eye_col);
719 wprintw(term,"O O");
720 SET_COLOR(COL_BLUE);
721 wprintw(term," <");
722 }
723 if (is_y_range(y+4))
724 {
725 SET_COLOR(COL_BLUE);
726 mvwprintw(term,y+4,x+1,"(_");
727 SET_COLOR(COL_DARKRED);
728 wprintw(term,"/\\_/\\");
729 SET_COLOR(COL_BLUE);
730 wprintw(term,"_)");
731 }
732 SET_COLOR(COL_BKG);
733 }
734
clear_xzarna(int x,int y)735 void clear_xzarna(int x,int y)
736 {
737 SET_COLOR(COL_BKG);
738 if (is_y_range(y))
739 {
740 mvwprintw(term,y,x+1," ");
741 }
742 if (is_y_range(y+1))
743 {
744 mvwprintw(term,y+1,x," ");
745 }
746 if (is_y_range(y+2))
747 {
748 mvwprintw(term,y+2,x+1," ");
749 }
750 if (is_y_range(y+3))
751 {
752 mvwprintw(term,y+3,x+2," ");
753 }
754 if (is_y_range(y+4))
755 {
756 mvwprintw(term,y+4,x+1," ");
757 }
758 }
759
blit_borders(int color)760 void blit_borders(int color)
761 {
762 int i;
763 SET_COLOR(color);
764 if (y_ofs-1 >= 0)
765 {
766 for (i=x_ofs;i<80+x_ofs;i++)
767 mvwaddch(term,y_ofs-1,i,(chtype)'-');
768 }
769 if (y_ofs+25 < term_y)
770 {
771 for (i=x_ofs;i<80+x_ofs;i++)
772 mvwaddch(term,y_ofs+25,i,(chtype)'-');
773 }
774
775 if (x_ofs-1 >= 0)
776 {
777 for (i=y_ofs;i<25+y_ofs;i++)
778 mvwaddch(term,i,x_ofs-1,(chtype)'|');
779 }
780 if (x_ofs+80 < term_x)
781 {
782 for (i=y_ofs;i<25+y_ofs;i++)
783 mvwaddch(term,i,x_ofs+80,(chtype)'|');
784 }
785
786 if ((x_ofs-1 >= 0) && (y_ofs-1 >= 0))
787 mvwaddch(term,y_ofs-1,x_ofs-1,(chtype)'+');
788 if ((x_ofs-1 >= 0) && (y_ofs+25 < term_y))
789 mvwaddch(term,y_ofs+25,x_ofs-1,(chtype)'+');
790 if ((x_ofs+80 < term_x) && (y_ofs-1 >= 0))
791 mvwaddch(term,y_ofs-1,x_ofs+80,(chtype)'+');
792 if ((x_ofs+80 < term_x) && (y_ofs+25 < term_y))
793 mvwaddch(term,y_ofs+25,x_ofs+80,(chtype)'+');
794
795 SET_COLOR(COL_BKG);
796 }
797
798