1 /*
2 * object.c
3 *
4 * This source herein may be modified and/or distributed by anybody who
5 * so desires, with the following restrictions:
6 * 1.) No portion of this notice shall be removed.
7 * 2.) Credit shall not be taken for the creation of this source.
8 * 3.) This code is not to be traded, sold, or used for personal
9 * gain or profit.
10 *
11 */
12
13 #include "rogue.h"
14
15 object level_objects;
16 unsigned short dungeon[DROWS][DCOLS];
17 short foods = 0;
18 short party_counter;
19 object *free_list = (object *) 0;
20
21 char *fruit = mesg[333];
22
23 fighter rogue = {
24 0, 0, /* armor, weapon */
25 0, 0, /* rings */
26 INIT_HP, /* Hp current */
27 INIT_HP, /* Hp max */
28 16, 16, /* Str */
29 {0}, /* pack */
30 0, /* gold */
31 1, 0, /* exp, exp_points */
32 0, 0, /* row, col */
33 '@', /* char */
34 1250 /* moves */
35 };
36
37 char *po_color[14] = {
38 mesg[334], mesg[335], mesg[336], mesg[337], mesg[338],
39 mesg[339], mesg[340], mesg[341], mesg[342], mesg[343],
40 mesg[344], mesg[345], mesg[346], mesg[347]
41 };
42
43 char po_title[14][34], sc_title[12][34], wa_title[10][34], ri_title[11][34];
44
45 struct id id_potions[POTIONS] = {
46 {100, po_title[ 0], mesg[348], 0},
47 {250, po_title[ 1], mesg[349], 0},
48 {100, po_title[ 2], mesg[350], 0},
49 {200, po_title[ 3], mesg[351], 0},
50 {10, po_title[ 4], mesg[352], 0},
51 {300, po_title[ 5], mesg[353], 0},
52 {10, po_title[ 6], mesg[354], 0},
53 {25, po_title[ 7], mesg[355], 0},
54 {100, po_title[ 8], mesg[356], 0},
55 {100, po_title[ 9], mesg[357], 0},
56 {10, po_title[10], mesg[358], 0},
57 {80, po_title[11], mesg[359], 0},
58 {150, po_title[12], mesg[360], 0},
59 {145, po_title[13], mesg[361], 0}
60 };
61
62 struct id id_scrolls[SCROLS] = {
63 {505, sc_title[ 0], mesg[362], 0},
64 {200, sc_title[ 1], mesg[363], 0},
65 {235, sc_title[ 2], mesg[364], 0},
66 {235, sc_title[ 3], mesg[365], 0},
67 {175, sc_title[ 4], mesg[366], 0},
68 {190, sc_title[ 5], mesg[367], 0},
69 {25, sc_title[ 6], mesg[368], 0},
70 {610, sc_title[ 7], mesg[369], 0},
71 {210, sc_title[ 8], mesg[370], 0},
72 {100, sc_title[ 9], mesg[371], 0},
73 {25, sc_title[10], mesg[372], 0},
74 {180, sc_title[11], mesg[373], 0}
75 };
76 struct id id_weapons[WEAPONS] = {
77 {150, mesg[374], "", 0},
78 {8, mesg[375], "", 0},
79 {15, mesg[376], "", 0},
80 {27, mesg[377], "", 0},
81 {35, mesg[378], "", 0},
82 {360, mesg[379], "", 0},
83 {470, mesg[380], "", 0},
84 {580, mesg[381], "", 0}
85 };
86
87 struct id id_armors[ARMORS] = {
88 {300, mesg[382], "", (UNIDENTIFIED)},
89 {300, mesg[383], "", (UNIDENTIFIED)},
90 {400, mesg[384], "", (UNIDENTIFIED)},
91 {500, mesg[385], "", (UNIDENTIFIED)},
92 {600, mesg[386], "", (UNIDENTIFIED)},
93 {600, mesg[387], "", (UNIDENTIFIED)},
94 {700, mesg[388], "", (UNIDENTIFIED)}
95 };
96
97 struct id id_wands[WANDS] = {
98 {25, wa_title[ 0], mesg[389], 0},
99 {50, wa_title[ 1], mesg[390], 0},
100 {45, wa_title[ 2], mesg[391], 0},
101 {8, wa_title[ 3], mesg[392], 0},
102 {55, wa_title[ 4], mesg[393], 0},
103 {2, wa_title[ 5], mesg[394], 0},
104 {25, wa_title[ 6], mesg[395], 0},
105 {20, wa_title[ 7], mesg[396], 0},
106 {20, wa_title[ 8], mesg[397], 0},
107 {0, wa_title[ 9], mesg[398], 0}
108 };
109
110 struct id id_rings[RINGS] = {
111 {250, ri_title[ 0], mesg[399], 0},
112 {100, ri_title[ 1], mesg[400], 0},
113 {255, ri_title[ 2], mesg[401], 0},
114 {295, ri_title[ 3], mesg[402], 0},
115 {200, ri_title[ 4], mesg[403], 0},
116 {250, ri_title[ 5], mesg[404], 0},
117 {250, ri_title[ 6], mesg[405], 0},
118 {25, ri_title[ 7], mesg[406], 0},
119 {300, ri_title[ 8], mesg[407], 0},
120 {290, ri_title[ 9], mesg[408], 0},
121 {270, ri_title[10], mesg[409], 0}
122 };
123
124 extern short cur_level, max_level;
125 extern short party_room;
126 extern char *error_file;
127 extern boolean is_wood[];
128
129 #ifdef COLOR
130 extern boolean do_color;
131 extern short c_attr[];
132
colored(c)133 colored(c)
134 register c;
135 {
136 c &= 0xff;
137 return (do_color? (c | c_attr[c]): c);
138 }
139 #endif
140
141 void
put_objects()142 put_objects()
143 {
144 short i, n;
145 object *obj;
146
147 if (cur_level < max_level) {
148 return;
149 }
150 n = coin_toss() ? get_rand(2, 4) : get_rand(3, 5);
151 while (rand_percent(33)) {
152 n++;
153 }
154 if (cur_level == party_counter) {
155 make_party();
156 party_counter = next_party();
157 }
158 for (i = 0; i < n; i++) {
159 obj = gr_object();
160 rand_place(obj);
161 }
162 put_gold();
163 }
164
put_gold()165 put_gold()
166 {
167 short i, j;
168 short row,col;
169 boolean is_maze, is_room;
170
171 for (i = 0; i < MAXROOMS; i++) {
172 is_maze = (rooms[i].is_room & R_MAZE) ? 1 : 0;
173 is_room = (rooms[i].is_room & R_ROOM) ? 1 : 0;
174
175 if (!(is_room || is_maze)) {
176 continue;
177 }
178 if (is_maze || rand_percent(GOLD_PERCENT)) {
179 for (j = 0; j < 50; j++) {
180 row = get_rand(rooms[i].top_row+1,
181 rooms[i].bottom_row-1);
182 col = get_rand(rooms[i].left_col+1,
183 rooms[i].right_col-1);
184 if ((dungeon[row][col] == FLOOR) ||
185 (dungeon[row][col] == TUNNEL)) {
186 plant_gold(row, col, is_maze);
187 break;
188 }
189 }
190 }
191 }
192 }
193
plant_gold(row,col,is_maze)194 plant_gold(row, col, is_maze)
195 short row, col;
196 boolean is_maze;
197 {
198 object *obj;
199
200 obj = alloc_object();
201 obj->row = row; obj->col = col;
202 obj->what_is = GOLD;
203 obj->quantity = get_rand((2 * cur_level), (16 * cur_level));
204 if (is_maze) {
205 obj->quantity += obj->quantity / 2;
206 }
207 dungeon[row][col] |= OBJECT;
208 (void) add_to_pack(obj, &level_objects, 0);
209 }
210
place_at(obj,row,col)211 place_at(obj, row, col)
212 object *obj;
213 {
214 obj->row = row;
215 obj->col = col;
216 dungeon[row][col] |= OBJECT;
217 (void) add_to_pack(obj, &level_objects, 0);
218 }
219
220 object *
object_at(pack,row,col)221 object_at(pack, row, col)
222 register object *pack;
223 short row, col;
224 {
225 object *obj;
226
227 obj = pack->next_object;
228
229 while (obj && ((obj->row != row) || (obj->col != col))) {
230 obj = obj->next_object;
231 }
232 return(obj);
233 }
234
235 object *
get_letter_object(ch)236 get_letter_object(ch)
237 {
238 object *obj;
239
240 obj = rogue.pack.next_object;
241
242 while (obj && (obj->ichar != ch)) {
243 obj = obj->next_object;
244 }
245 return(obj);
246 }
247
free_stuff(objlist)248 free_stuff(objlist)
249 object *objlist;
250 {
251 object *obj;
252
253 while (objlist->next_object) {
254 obj = objlist->next_object;
255 objlist->next_object =
256 objlist->next_object->next_object;
257 free_object(obj);
258 }
259 }
260
261 char *
name_of(obj)262 name_of(obj)
263 object *obj;
264 {
265 #ifndef ORIGINAL
266 int i;
267 #ifndef JAPAN
268 static char bf[81]; /* by Yasha */
269 #endif
270 static unsigned short wa[] = {
271 SCROL, POTION, WAND, ARMOR, RING, AMULET
272 };
273 static char *na[] = {
274 mesg[3], mesg[4], mesg[5], mesg[7], mesg[8], mesg[9]
275 };
276 #ifndef JAPAN
277 if (obj->what_is == WAND)
278 return is_wood[obj->which_kind] ? mesg[6] : mesg[5];
279 #endif
280 if (obj->what_is == WEAPON) {
281 #ifdef JAPAN
282 return id_weapons[obj->which_kind].title;
283 #else
284 strcpy(bf, id_weapons[obj->which_kind].title);
285 switch (obj->which_kind) {
286 case DART:
287 case ARROW:
288 case DAGGER:
289 case SHURIKEN:
290 if (obj->quantity == 1) {
291 i = strlen(bf);
292 bf[i-2] = ' ';
293 bf[i-1] = '\0';
294 }
295 break;
296 }
297 return bf;
298 #endif
299 }
300 if (obj->what_is == FOOD) {
301 return (obj->which_kind == RATION)? mesg[2]: fruit;
302 }
303 for (i = 0; i < 6; i++) {
304 if (obj->what_is == wa[i]) {
305 #ifdef JAPAN
306 return na[i];
307 #else
308 sprintf(bf, na[i], obj->quantity > 1 ? "s" : "");
309 return bf;
310 #endif
311 }
312 }
313 return mesg[80];
314 #else
315 char *retstring;
316
317 switch(obj->what_is) {
318 case SCROL:
319 retstring = mesg[3];
320 break;
321 case POTION:
322 retstring = mesg[4];
323 break;
324 case FOOD:
325 if (obj->which_kind == RATION) {
326 retstring = mesg[2];
327 } else {
328 retstring = fruit;
329 }
330 break;
331 case WAND:
332 retstring = mesg[5];
333 break;
334 case WEAPON:
335 retstring = id_weapons[obj->which_kind].title;
336 break;
337 case ARMOR:
338 retstring = mesg[7];
339 break;
340 case RING:
341 retstring = mesg[8];
342 break;
343 case AMULET:
344 retstring = mesg[9];
345 break;
346 default:
347 retstring = mesg[80];
348 break;
349 }
350 return(retstring);
351 #endif /* ORIGINAL */
352 }
353
354 object *
gr_object()355 gr_object()
356 {
357 object *obj;
358
359 obj = alloc_object();
360
361 if (foods < (cur_level / 3)) {
362 obj->what_is = FOOD;
363 foods++;
364 } else {
365 obj->what_is = gr_what_is();
366 }
367 switch(obj->what_is) {
368 case SCROL:
369 gr_scroll(obj);
370 break;
371 case POTION:
372 gr_potion(obj);
373 break;
374 case WEAPON:
375 gr_weapon(obj, 1);
376 break;
377 case ARMOR:
378 gr_armor(obj, 1);
379 break;
380 case WAND:
381 gr_wand(obj);
382 break;
383 case FOOD:
384 get_food(obj, 0);
385 break;
386 case RING:
387 gr_ring(obj, 1);
388 break;
389 }
390 return(obj);
391 }
392
393 unsigned short
gr_what_is()394 gr_what_is()
395 {
396 register short percent;
397 register int i;
398 static short per[] = { 30, 60, 64, 74, 83, 88, 91 };
399 static unsigned short ret[] = {
400 SCROL, POTION, WAND, WEAPON, ARMOR, FOOD, RING
401 };
402
403 percent = get_rand(1, 91);
404
405 for (i = 0;; i++) {
406 if (percent <= per[i])
407 return ret[i];
408 }
409 }
410
411 void
gr_scroll(obj)412 gr_scroll(obj)
413 object *obj;
414 {
415 short percent;
416 register int i;
417 static short per[SCROLS] = {
418 5, 11, 16, 21, 36, 44, 51, 56, 65, 74, 80, 85
419 };
420
421 percent = get_rand(0, 85);
422 obj->what_is = SCROL;
423 for (i = 0;; i++) {
424 if (percent <= per[i]) {
425 obj->which_kind = i;
426 return;
427 }
428 }
429 }
430
431 void
gr_potion(obj)432 gr_potion(obj)
433 object *obj;
434 {
435 short percent;
436 register int i;
437 static short per[POTIONS] = {
438 10, 20, 30, 40, 50, 55, 65, 75, 85, 95, 105, 110, 114, 118
439 };
440
441 percent = get_rand(1, 118);
442 obj->what_is = POTION;
443 for (i = 0; i < POTIONS; i++) {
444 if (percent <= per[i]) {
445 obj->which_kind = i;
446 return;
447 }
448 }
449 }
450
gr_weapon(obj,assign_wk)451 gr_weapon(obj, assign_wk)
452 object *obj;
453 int assign_wk;
454 {
455 short i;
456 short percent;
457 short blessing, increment;
458 static char *da[WEAPONS] = {
459 "1d1", "1d1", "1d2", "1d3", "1d4", "2d3", "3d4", "4d5"
460 };
461
462 obj->what_is = WEAPON;
463 if (assign_wk) {
464 obj->which_kind = get_rand(0, (WEAPONS - 1));
465 }
466 if ((i = obj->which_kind) == ARROW || i == DAGGER ||
467 i == SHURIKEN || i == DART) {
468 obj->quantity = get_rand(3, 15);
469 obj->quiver = get_rand(0, 126);
470 } else {
471 obj->quantity = 1;
472 }
473 obj->hit_enchant = obj->d_enchant = 0;
474
475 percent = get_rand(1, 96);
476 blessing = get_rand(1, 3);
477
478 if (percent <= 16) {
479 increment = 1;
480 } else if (percent <= 32) {
481 increment = -1;
482 obj->is_cursed = 1;
483 }
484 if (percent <= 32) {
485 for (i = 0; i < blessing; i++) {
486 if (coin_toss()) {
487 obj->hit_enchant += increment;
488 } else {
489 obj->d_enchant += increment;
490 }
491 }
492 }
493 obj->damage = da[obj->which_kind];
494 }
495
496 /*gr_armor(obj)*/
gr_armor(obj,assign_wk)497 gr_armor(obj, assign_wk) /* by Yasha */
498 object *obj;
499 int assign_wk; /* by Yasha */
500 {
501 short percent;
502 short blessing;
503
504 obj->what_is = ARMOR;
505 if (assign_wk) /* by Yasha */
506 obj->which_kind = get_rand(0, (ARMORS - 1));
507 obj->class = obj->which_kind + 2;
508 if ((obj->which_kind == PLATE) || (obj->which_kind == SPLINT)) {
509 obj->class--;
510 }
511 obj->is_protected = 0;
512 obj->d_enchant = 0;
513
514 percent = get_rand(1, 100);
515 blessing = get_rand(1, 3);
516
517 if (percent <= 16) {
518 obj->is_cursed = 1;
519 obj->d_enchant -= blessing;
520 } else if (percent <= 33) {
521 obj->d_enchant += blessing;
522 }
523 }
524
gr_wand(obj)525 gr_wand(obj)
526 object *obj;
527 {
528 obj->what_is = WAND;
529 obj->which_kind = get_rand(0, (WANDS - 1));
530 if (obj->which_kind == MAGIC_MISSILE) {
531 obj->class = get_rand(6, 12);
532 } else if (obj->which_kind == CANCELLATION) {
533 obj->class = get_rand(5, 9);
534 } else {
535 obj->class = get_rand(3, 6);
536 }
537 }
538
get_food(obj,force_ration)539 get_food(obj, force_ration)
540 object *obj;
541 boolean force_ration;
542 {
543 obj->what_is = FOOD;
544
545 if (force_ration || rand_percent(80)) {
546 obj->which_kind = RATION;
547 } else {
548 obj->which_kind = FRUIT;
549 }
550 }
551
put_stairs()552 put_stairs()
553 {
554 short row, col;
555
556 gr_row_col(&row, &col, (FLOOR | TUNNEL));
557 dungeon[row][col] |= STAIRS;
558 }
559
get_armor_class(obj)560 get_armor_class(obj)
561 object *obj;
562 {
563 if (obj) {
564 return(obj->class + obj->d_enchant);
565 }
566 return(0);
567 }
568
569 object *
alloc_object()570 alloc_object()
571 {
572 object *obj;
573
574 if (free_list) {
575 obj = free_list;
576 free_list = free_list->next_object;
577 } else if (!(obj = (object *) md_malloc(sizeof(object)))) {
578 #ifdef JAPAN
579 message("�������ޤ��� ��������֤��ޤ���", 0);
580 #else
581 message("Cannot allocate object, saving game", 0);
582 #endif
583 save_into_file(error_file);
584 }
585 obj->quantity = 1;
586 obj->ichar = 'L';
587 obj->picked_up = obj->is_cursed = 0;
588 obj->in_use_flags = NOT_USED;
589 obj->identified = UNIDENTIFIED;
590 obj->damage = "1d1";
591 return(obj);
592 }
593
free_object(obj)594 free_object(obj)
595 object *obj;
596 {
597 obj->next_object = free_list;
598 free_list = obj;
599 }
600
make_party()601 make_party()
602 {
603 short n;
604
605 party_room = gr_room();
606
607 n = rand_percent(99) ? party_objects(party_room) : 11;
608 if (rand_percent(99)) {
609 party_monsters(party_room, n);
610 }
611 }
612
show_objects()613 show_objects()
614 {
615 object *obj;
616 short mc, rc, row, col;
617 object *monster;
618
619 obj = level_objects.next_object;
620
621 while (obj) {
622 row = obj->row;
623 col = obj->col;
624
625 rc = get_mask_char(obj->what_is);
626
627 if (dungeon[row][col] & MONSTER) {
628 if (monster = object_at(&level_monsters, row, col)) {
629 monster->trail_char = rc;
630 }
631 }
632 mc = mvinch(row, col);
633 if (((mc < 'A') || (mc > 'Z')) &&
634 ((row != rogue.row) || (col != rogue.col))) {
635 mvaddch(row, col, colored(rc));
636 }
637 obj = obj->next_object;
638 }
639
640 monster = level_monsters.next_object;
641
642 while (monster) {
643 if (monster->m_flags & IMITATES) {
644 mvaddch(monster->row, monster->col, colored(monster->disguise));
645 }
646 monster = monster->next_monster;
647 }
648 }
649
put_amulet()650 put_amulet()
651 {
652 object *obj;
653
654 obj = alloc_object();
655 obj->what_is = AMULET;
656 rand_place(obj);
657 }
658
rand_place(obj)659 rand_place(obj)
660 object *obj;
661 {
662 short row, col;
663
664 gr_row_col(&row, &col, (FLOOR | TUNNEL));
665 place_at(obj, row, col);
666
667 }
668
669 void
new_object_for_wizard()670 new_object_for_wizard()
671 {
672 short ch, max;
673 #ifdef ORIGINAL
674 short wk;
675 #endif
676 object *obj;
677 char buf[80];
678
679 if (pack_count((object *) 0) >= MAX_PACK_COUNT) {
680 message(mesg[81], 0);
681 return;
682 }
683 message(mesg[82], 0);
684
685 while (r_index("!?:)]=/,\033", (ch = rgetchar()), 0) == -1)
686 sound_bell();
687 check_message();
688 if (ch == '\033')
689 return;
690
691 obj = alloc_object();
692
693 switch(ch) {
694 case '!':
695 obj->what_is = POTION;
696 max = POTIONS - 1;
697 break;
698 case '?':
699 obj->what_is = SCROL;
700 max = SCROLS - 1;
701 break;
702 case ',':
703 obj->what_is = AMULET;
704 break;
705 case ':':
706 get_food(obj, 0);
707 break;
708 case ')':
709 /* gr_weapon(obj, 0);*/
710 obj->what_is = WEAPON;
711 max = WEAPONS - 1;
712 break;
713 case ']':
714 /* gr_armor(obj);*/
715 obj->what_is = ARMOR; /* by Yasha */
716 max = ARMORS - 1;
717 break;
718 case '/':
719 gr_wand(obj);
720 max = WANDS - 1;
721 break;
722 case '=':
723 max = RINGS - 1;
724 obj->what_is = RING;
725 break;
726 }
727 if ((ch != ',') && (ch != ':')) {
728 #ifndef ORIGINAL
729 /* sprintf(buf, mesg[83], name_of(obj));*/
730 sprintf(buf, mesg[83], (obj->what_is == WEAPON) /* by Yasha */
731 ? mesg[84] : name_of(obj)); /* by Yasha */
732 for (;;) {
733 message(buf, 0);
734 for (;;) {
735 ch = rgetchar();
736 if (ch != LIST && ch != CANCEL
737 && ch < 'a' || ch > 'a'+max)
738 sound_bell();
739 else
740 break;
741 }
742 if (ch == LIST) {
743 check_message();
744 list_object(obj, max);
745 } else
746 break;
747 }
748 check_message();
749 if (ch == CANCEL) {
750 free_object(obj);
751 return;
752 }
753 obj->which_kind = ch - 'a';
754 if (obj->what_is == RING)
755 gr_ring(obj, 0);
756
757 if (obj->what_is == ARMOR) /* by Yasha */
758 gr_armor(obj, 0); /* by Yasha */
759 else if (obj->what_is == WEAPON) /* by Yasha */
760 gr_weapon(obj, 0); /* by Yasha */
761 #else /*ORIGINAL*/
762 if (get_input_line("Which kind?", "", buf, "", 0, 1)) {
763 wk = get_number(buf);
764 if ((wk >= 0) && (wk <= max)) {
765 obj->which_kind = (unsigned short) wk;
766 if (obj->what_is == RING) {
767 gr_ring(obj, 0);
768 }
769 } else {
770 sound_bell();
771 goto GIL;
772 }
773 } else {
774 free_object(obj);
775 return;
776 }
777 #endif /*ORIGINAL*/
778 }
779 get_desc(obj, buf, 1);
780 message(buf, 0);
781 (void) add_to_pack(obj, &rogue.pack, 1);
782 }
783
784 #ifndef ORIGINAL
785 void
list_object(obj,max)786 list_object(obj, max)
787 object *obj;
788 short max;
789 {
790 short i, j, maxlen, n;
791 char descs[DROWS][DCOLS];
792 short row, col;
793 struct id *id;
794 int weapon_or_armor; /* by Yasha */
795 #ifdef COLOR
796 char *p;
797 #endif
798 #ifdef JAPAN
799 char *msg = " ��ڡ������Ƥ���������";
800 short len = 30;
801 #else
802 char *msg = " --Press space to continue--";
803 short len = 28;
804 #endif
805
806 weapon_or_armor = 0;
807 switch (obj->what_is) {
808 case ARMOR: id = id_armors;
809 weapon_or_armor = 1; /* by Yasha */
810 break;
811 case WEAPON: id = id_weapons;
812 weapon_or_armor = 1; /* by Yasha */
813 break;
814 case SCROL: id = id_scrolls; break;
815 case POTION: id = id_potions; break;
816 case WAND: id = id_wands; break;
817 case RING: id = id_rings; break;
818 default: return;
819 }
820
821 maxlen = len;
822 for (i = 0; i <= max; i++) {
823 #if 1 /* by Yasha */
824 #ifdef JAPAN
825 sprintf(descs[i]," %c) %s%s",i+'a',
826 weapon_or_armor ? id[i].title : id[i].real,
827 weapon_or_armor ? "" : name_of(obj));
828 #else
829 sprintf(descs[i]," %c) %s%s",i+'a',
830 weapon_or_armor ? "" : name_of(obj),
831 weapon_or_armor ? id[i].title : id[i].real);
832 #endif
833 #else
834 #ifdef JAPAN
835 sprintf(descs[i]," %c) %s%s",i+'a',id[i].real,name_of(obj));
836 #else
837 sprintf(descs[i]," %c) %s%s",i+'a',name_of(obj),id[i].real);
838 #endif
839 #endif
840 if ((n = strlen(descs[i])) > maxlen)
841 maxlen = n;
842 }
843 (void) strcpy(descs[i++], msg);
844
845 col = DCOLS - (maxlen + 2);
846 for (row = 0; row < i; row++) {
847 if (row > 0) {
848 for (j = col; j < DCOLS; j++) {
849 descs[row-1][j-col] = mvinch(row, j);
850 }
851 descs[row-1][j-col] = 0;
852 }
853 mvaddstr(row, col, descs[row]);
854 clrtoeol();
855 }
856 refresh();
857 wait_for_ack();
858
859 move(0, 0);
860 clrtoeol();
861 #ifdef COLOR
862 for (j = 1; j < i; j++) {
863 move(j, col);
864 for (p = descs[j-1]; *p; p++)
865 addch(colored(*p));
866 }
867 #else
868 for (j = 1; j < i; j++)
869 mvaddstr(j, col, descs[j-1]);
870 #endif
871 }
872 #endif /*ORIGINAL*/
873
next_party()874 next_party()
875 {
876 int n;
877
878 n = cur_level;
879 while (n % PARTY_TIME) {
880 n++;
881 }
882 return(get_rand((n + 1), (n + PARTY_TIME)));
883 }
884