Blindfold removal fix
[slashemextended.git] / src / botl.c
blob11040efd5402940ff94a5f846e50c56303cd6fd6
1 /* SCCS Id: @(#)botl.c 3.4 1996/07/15 */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 #include "hack.h"
6 #include "wintty.h"
8 #ifdef OVL0
9 extern const char *hu_stat[]; /* defined in eat.c */
11 const char *hu_abbrev_stat[] = { /* must be kept consistent with eat.c */
12 "Sat",
13 "",
14 "Hun",
15 "Wea",
16 "Ftg",
17 "Ftd",
18 "Sta"
21 const char * const enc_stat[] = {
22 "",
23 "Burdened",
24 "Stressed",
25 "Strained",
26 "Overtaxed",
27 "Overloaded"
30 const char *enc_abbrev_stat[] = {
31 "",
32 "Brd",
33 "Ssd",
34 "Snd",
35 "Otd",
36 "Old"
39 int uhp();
40 int uhpmax();
42 STATIC_DCL void bot1(void);
43 STATIC_DCL void bot2(void);
44 #ifdef ALLEG_FX
45 STATIC_DCL void set_botl_warn(int);
46 #endif
47 #endif /* OVL0 */
49 /* MAXCO must hold longest uncompressed status line, and must be larger
50 * than COLNO
52 * longest practical second status line at the moment is
53 * Astral Plane $:12345 HP:700(700) Pw:111(111) AC:-127 Xp:30/123456789
54 * Wt:5000/1000 T:123456 Satiated Lev Conf FoodPois Ill Blind Stun Hallu
55 * Slime Held Overloaded
56 * -- or somewhat over 160 characters
58 #if COLNO <= 170
59 #define MAXCO 320
60 #else
61 #define MAXCO (COLNO+150)
62 #endif
64 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
66 extern const struct percent_color_option *hp_colors;
67 extern const struct percent_color_option *pw_colors;
68 extern const struct text_color_option *text_colors;
70 struct color_option
71 text_color_of(text, color_options)
72 const char *text;
73 const struct text_color_option *color_options;
75 if (color_options == NULL) {
76 struct color_option result = {NO_COLOR, 0};
77 return result;
79 if (strstri(color_options->text, text)
80 || strstri(text, color_options->text))
81 return color_options->color_option;
82 return text_color_of(text, color_options->next);
85 struct color_option
86 percentage_color_of(value, max, color_options)
87 int value, max;
88 const struct percent_color_option *color_options;
90 if (color_options == NULL) {
91 struct color_option result = {NO_COLOR, 0};
92 return result;
94 if (100 * value <= color_options->percentage * max)
95 return color_options->color_option;
96 return percentage_color_of(value, max, color_options->next);
99 void
100 start_color_option(color_option)
101 struct color_option color_option;
103 #if defined(UNIX) || !defined(CURSES_GRAPHICS)
104 int i;
105 if (color_option.color != NO_COLOR)
106 term_start_color(color_option.color);
107 for (i = 0; (1 << i) <= color_option.attr_bits; ++i)
108 if (i != ATR_NONE && color_option.attr_bits & (1 << i))
109 term_start_attr(i);
110 #endif
113 void
114 end_color_option(color_option)
115 struct color_option color_option;
117 #if defined(UNIX) || !defined(CURSES_GRAPHICS)
118 int i;
119 if (color_option.color != NO_COLOR)
120 term_end_color();
121 for (i = 0; (1 << i) <= color_option.attr_bits; ++i)
122 if (i != ATR_NONE && color_option.attr_bits & (1 << i))
123 term_end_attr(i);
124 #endif
127 /*static*/
128 void
129 apply_color_option(color_option, newbot2, statusline)
130 struct color_option color_option;
131 const char *newbot2;
132 int statusline; /* apply color on this statusline: 1 or 2 */
134 if (!iflags.use_status_colors) return;
135 curs(WIN_STATUS, 1, statusline-1);
136 start_color_option(color_option);
137 putstr(WIN_STATUS, 0, newbot2);
138 end_color_option(color_option);
141 void
142 add_colored_text(text, newbot2)
143 const char *text;
144 char *newbot2;
146 register char *nb;
147 struct color_option color_option;
149 if (*text == '\0') return;
151 if (!iflags.use_status_colors) {
152 sprintf(nb = eos(newbot2), " %s", text);
153 return;
156 strcat(nb = eos(newbot2), " ");
157 curs(WIN_STATUS, 1, 1);
158 putstr(WIN_STATUS, 0, newbot2);
160 strcat(nb = eos(nb), text);
161 curs(WIN_STATUS, 1, 1);
162 color_option = text_color_of(text, text_colors);
163 start_color_option(color_option);
164 putstr(WIN_STATUS, 0, newbot2);
165 end_color_option(color_option);
168 void
169 add_flicker_text(text, newbot2)
170 const char *text;
171 char *newbot2;
173 register char *nb;
175 int flickercolor = rn2(CLR_MAX);
176 while (flickercolor == NO_COLOR) flickercolor = rn2(CLR_MAX);
179 if (*text == '\0') return;
181 strcat(nb = eos(newbot2), " ");
182 curs(WIN_STATUS, 1, 1);
183 putstr(WIN_STATUS, 0, newbot2);
185 strcat(nb = eos(nb), text);
186 curs(WIN_STATUS, 1, 1);
188 struct color_option color_option = {flickercolor, 0};
189 start_color_option(color_option);
190 putstr(WIN_STATUS, 0, newbot2);
191 end_color_option(color_option);
195 void
196 add_flicker_textA(text, newbot1)
197 const char *text;
198 char *newbot1;
200 register char *nb;
201 int flickercolor = rn2(CLR_MAX);
203 if (*text == '\0') return;
205 strcat(nb = eos(newbot1), " ");
206 curs(WIN_STATUS, 1, 0);
207 putstr(WIN_STATUS, 0, newbot1);
209 strcat(nb = eos(nb), text);
210 curs(WIN_STATUS, 1, 0);
212 struct color_option color_option = {flickercolor, 0};
213 start_color_option(color_option);
214 putstr(WIN_STATUS, 0, newbot1);
215 end_color_option(color_option);
219 #endif
221 #ifndef OVLB
222 STATIC_DCL int mrank_sz;
223 #else /* OVLB */
224 STATIC_OVL NEARDATA int mrank_sz = 0; /* loaded by max_rank_sz (from u_init) */
225 #endif /* OVLB */
227 #ifdef OVL1
229 #ifdef ALLEG_FX
230 static int botl_warn = 0;
232 static void
233 set_botl_warn(level)
234 int level;
236 botl_warn = level;
237 flags.botl = 1;
239 #endif
241 /* convert experience level (1..30) to rank index (0..8) */
243 xlev_to_rank(xlev)
244 int xlev;
246 return (xlev <= 2) ? 0 : (xlev <= 30) ? ((xlev + 2) / 4) : 8;
249 #if 0 /* not currently needed */
250 /* convert rank index (0..8) to experience level (1..30) */
252 rank_to_xlev(rank)
253 int rank;
255 return (rank <= 0) ? 1 : (rank <= 8) ? ((rank * 4) - 2) : 30;
257 #endif
259 const char *
260 rank_of(lev, monnum, female)
261 int lev;
262 int monnum;
263 boolean female;
265 register struct Role *role;
266 register int i;
269 /* Find the role */
270 for (role = (struct Role *) roles; role->name.m; role++)
271 if (monnum == role->malenum || monnum == role->femalenum)
272 break;
273 if (!role->name.m)
274 role = &urole;
276 /* Find the rank */
277 for (i = xlev_to_rank((int)lev); i >= 0; i--) {
278 if (female && role->rank[i].f) return (role->rank[i].f);
279 if (role->rank[i].m) return (role->rank[i].m);
282 /* Try the role name, instead */
283 if (female && role->name.f) return (role->name.f);
284 else if (role->name.m) return (role->name.m);
285 return ("Player");
289 const char *
290 rank()
292 return(rank_of(u.ulevel, Role_switch, flags.female));
296 title_to_mon(str, rank_indx, title_length)
297 const char *str;
298 int *rank_indx, *title_length;
300 register int i, j;
303 /* Loop through each of the roles */
304 for (i = 0; roles[i].name.m; i++)
305 for (j = 0; j < 9; j++) {
306 if (roles[i].rank[j].m && !strncmpi(str,
307 roles[i].rank[j].m, strlen(roles[i].rank[j].m))) {
308 if (rank_indx) *rank_indx = j;
309 if (title_length) *title_length = strlen(roles[i].rank[j].m);
310 return roles[i].malenum;
312 if (roles[i].rank[j].f && !strncmpi(str,
313 roles[i].rank[j].f, strlen(roles[i].rank[j].f))) {
314 if (rank_indx) *rank_indx = j;
315 if (title_length) *title_length = strlen(roles[i].rank[j].f);
316 return ((roles[i].femalenum != NON_PM) ?
317 roles[i].femalenum : roles[i].malenum);
320 return NON_PM;
323 #endif /* OVL1 */
324 #ifdef OVLB
326 void
327 max_rank_sz()
329 register int i, r, maxr = 0;
332 for (i = 0; i < 9; i++) {
333 if (urole.rank[i].m && (r = strlen(urole.rank[i].m)) > maxr) maxr = r;
334 if (urole.rank[i].f && (r = strlen(urole.rank[i].f)) > maxr) maxr = r;
336 mrank_sz = maxr;
337 return;
340 #endif /* OVLB */
341 #ifdef OVL0
343 long
344 botl_score()
346 int deepest = deepest_lev_reached(FALSE);
347 #ifndef GOLDOBJ
348 long ugold = u.ugold + hidden_gold();
350 if ((ugold -= u.ugold0) < 0L) ugold = 0L;
351 return ugold + u.urexp + (long)(50 * (deepest - 1))
352 #else
353 long umoney = money_cnt(invent) + hidden_gold();
355 if ((umoney -= u.umoney0) < 0L) umoney = 0L;
356 return umoney + u.urexp + (long)(50 * (deepest - 1))
357 #endif
361 static char *
362 botl_player()
364 static char player[MAXCO];
365 char *nb;
366 int i=0,k=0;
367 char mbot[MAXCO - 15];
369 strcpy(player, "");
370 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
371 if (flags.hitpointbar) {
372 flags.botlx = 0;
373 curs(WIN_STATUS, 1, 0);
374 putstr(WIN_STATUS, 0, player);
375 strcat(player, "[");
376 i = 1; /* don't overwrite the string in front */
377 curs(WIN_STATUS, 1, 0);
378 putstr(WIN_STATUS, 0, player);
380 #endif
381 strcat(player, playeraliasname);
382 if('a' <= player[i] && player[i] <= 'z') player[i] += 'A'-'a';
383 player[10] = '\0';
384 sprintf(nb = eos(player)," the ");
386 if (Upolyd && !missingnoprotect) {
388 (void) strncpy(mbot, mons[u.umonnum].mname, SIZE(mbot) - 1);
390 mbot[/*SIZE(mbot) - 1*/80] = 0;
391 while(mbot[k] != 0) {
392 if ((k == 0 || (k > 0 && mbot[k-1] == ' ')) &&
393 'a' <= mbot[k] && mbot[k] <= 'z')
394 mbot[k] += 'A' - 'a';
395 k++;
398 sprintf(eos(nb), "%s", mbot);
399 } else
400 sprintf(eos(nb), "%s", rank());
401 return player;
404 static char *
405 botl_strength()
407 static char strength[6];
408 if (ACURR(A_STR) > 18) {
409 if (ACURR(A_STR) > STR18(100))
410 sprintf(strength, "%2d", ACURR(A_STR)-100);
411 else if (ACURR(A_STR) < STR18(100))
412 sprintf(strength, "18/%02d", ACURR(A_STR)-18);
413 else
414 sprintf(strength, "18/**");
415 } else
416 sprintf(strength, "%-1d", ACURR(A_STR));
417 return strength;
420 #ifdef DUMP_LOG
421 void bot1str(char *newbot1)
422 #else
423 STATIC_OVL void
424 bot1()
425 #endif
427 #ifndef DUMP_LOG
428 char newbot1[MAXCO];
429 #endif
430 register char *nb;
431 register int i,j;
433 if (FlimmeringStrips) {
435 strcpy(newbot1, " ");
437 if (FunnyHallu) {
438 int funnyhallucnt = rnd(37);
439 if (!rn2(2)) funnyhallucnt += rnd(12);
441 while (funnyhallucnt > 0) {
442 funnyhallucnt--;
443 add_flicker_textA(generate_garbage_char(), newbot1);
446 } else {
448 add_flicker_textA(generate_garbage_string(), newbot1);
449 add_flicker_textA(generate_garbage_string(), newbot1);
450 add_flicker_textA(generate_garbage_string(), newbot1);
451 if (!rn2(2)) add_flicker_textA(generate_garbage_string(), newbot1);
454 goto flicker1;
457 strcpy(newbot1, botl_player());
459 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
460 if (flags.hitpointbar) {
461 int bar_length = strlen(newbot1)-1;
462 char tmp[MAXCO];
463 char *p = tmp;
464 /* filledbar >= 0 and < MAXCO */
465 int hp = (uhp() < 0) ? 0 : uhp();
466 int filledbar = (uhpmax() > 0) ? (hp * bar_length / uhpmax()) : 0;
467 if (filledbar >= MAXCO) { filledbar = MAXCO-1; }
468 strcpy(tmp, newbot1);
469 p++;
471 /* draw hp bar */
472 #if defined(UNIX) || !defined(CURSES_GRAPHICS)
473 if (iflags.use_inverse) term_start_attr(ATR_INVERSE);
474 p[filledbar] = '\0';
475 apply_color_option(percentage_color_of(uhp(), uhpmax(), hp_colors), tmp, 1);
476 term_end_color();
477 if (iflags.use_inverse) term_end_attr(ATR_INVERSE);
478 #endif
480 strcat(newbot1, "]");
482 #endif
484 sprintf(nb = eos(newbot1)," ");
485 i = mrank_sz + 15;
486 j = (nb + 2) - newbot1; /* aka strlen(newbot1) but less computation */
487 /*if((i - j) > 0)
488 sprintf(nb = eos(nb),"%*s", i-j, " "); pad with spaces */
490 sprintf(nb = eos(nb), "St%s ", botl_strength());
491 sprintf(nb = eos(nb),
492 "Dx%-1d Co%-1d In%-1d Wi%-1d Ch%-1d ",
493 ACURR(A_DEX), ACURR(A_CON), ACURR(A_INT), ACURR(A_WIS), ACURR(A_CHA));
494 if (!TheInfoIsFucked) sprintf(nb = eos(nb), "%s", urole.filecode); /* fully disclosing what character you're playing */
495 if (!TheInfoIsFucked) sprintf(nb = eos(nb), "%s", urace.filecode); /* abbreviated so the line doesn't roll over --Amy */
496 if (!TheInfoIsFucked) sprintf(nb = eos(nb), flags.female ? "Fem" : "Mal"); /* allowing you to always know what you are */
497 if (!TheInfoIsFucked) sprintf(nb = eos(nb), (u.ualign.type == A_CHAOTIC) ? "Cha" :
498 (u.ualign.type == A_NEUTRAL) ? "Neu" : "Law");
500 /* abbreviate hybridizations since we don't have infinite space on the status line --Amy */
501 if (flags.hybridization && !TheInfoIsFucked) {sprintf(nb = eos(nb), "+");
502 if (flags.hybridcurser) sprintf(nb = eos(nb), "C");
503 if (flags.hybridhaxor) sprintf(nb = eos(nb), "H");
504 if (flags.hybridangbander) sprintf(nb = eos(nb), "A");
505 if (flags.hybridhomicider) sprintf(nb = eos(nb), "O");
506 if (flags.hybridsuxxor) sprintf(nb = eos(nb), "S");
507 /* sorry but I just couldn't resist allowing the "CHAOS" string. :D */
508 if (flags.hybridaquarian) sprintf(nb = eos(nb), "Q");
509 if (flags.hybridwarper) sprintf(nb = eos(nb), "W");
510 if (flags.hybridrandomizer) sprintf(nb = eos(nb), "R");
511 if (flags.hybridnullrace) sprintf(nb = eos(nb), "N");
512 if (flags.hybridmazewalker) sprintf(nb = eos(nb), "M");
513 if (flags.hybridsoviet) sprintf(nb = eos(nb), "V");
514 if (flags.hybridxrace) sprintf(nb = eos(nb), "X");
515 if (flags.hybridspecialist) sprintf(nb = eos(nb), "P");
516 if (flags.hybridminimalist) sprintf(nb = eos(nb), "L");
517 if (flags.hybridamerican) sprintf(nb = eos(nb), "I");
518 if (flags.hybridsokosolver) sprintf(nb = eos(nb), "K");
519 if (flags.hybridheretic) sprintf(nb = eos(nb), "E");
520 if (flags.hybridnastinator) sprintf(nb = eos(nb), "Y");
521 if (flags.hybridrougelike) sprintf(nb = eos(nb), "U");
522 if (flags.hybridsegfaulter) sprintf(nb = eos(nb), "F");
523 if (flags.hybridironman) sprintf(nb = eos(nb), "J");
524 if (flags.hybridamnesiac) sprintf(nb = eos(nb), "Z");
525 if (flags.hybridproblematic) sprintf(nb = eos(nb), "B");
526 if (flags.hybridwindinhabitant) sprintf(nb = eos(nb), "D");
527 if (flags.hybridaggravator) sprintf(nb = eos(nb), "G");
528 if (flags.hybridevilvariant) sprintf(nb = eos(nb), "T");
529 if (flags.hybridlevelscaler) sprintf(nb = eos(nb), "s");
530 if (flags.hybriderosator) sprintf(nb = eos(nb), "e");
531 if (flags.hybridroommate) sprintf(nb = eos(nb), "r");
532 if (flags.hybridextravator) sprintf(nb = eos(nb), "g");
533 if (flags.hybridhallucinator) sprintf(nb = eos(nb), "h");
534 if (flags.hybridbossrusher) sprintf(nb = eos(nb), "b");
535 if (flags.hybriddorian) sprintf(nb = eos(nb), "d");
536 if (flags.hybridtechless) sprintf(nb = eos(nb), "t");
537 if (flags.hybridblait) sprintf(nb = eos(nb), "l");
538 if (flags.hybridgrouper) sprintf(nb = eos(nb), "o");
539 if (flags.hybridscriptor) sprintf(nb = eos(nb), "c");
540 if (flags.hybridunbalancor) sprintf(nb = eos(nb), "u");
541 if (flags.hybridbeacher) sprintf(nb = eos(nb), "a");
542 if (flags.hybridstairseeker) sprintf(nb = eos(nb), "i");
543 if (flags.hybridmatrayser) sprintf(nb = eos(nb), "m");
544 if (flags.hybridfeminizer) sprintf(nb = eos(nb), "f");
545 if (flags.hybridchallenger) sprintf(nb = eos(nb), "n");
546 if (flags.hybridhardmoder) sprintf(nb = eos(nb), "x");
547 if (flags.hybridstunfish) sprintf(nb = eos(nb), "q");
548 if (flags.hybridkillfiller) sprintf(nb = eos(nb), "k");
549 if (flags.hybridbadstatter) sprintf(nb = eos(nb), "y");
550 if (flags.hybriddroughter) sprintf(nb = eos(nb), "w");
551 if (flags.hybridvanillaoid) sprintf(nb = eos(nb), "j");
554 if (flags.showscore)
555 sprintf(nb = eos(nb), " S%ld", botl_score());
557 flicker1:
560 #ifdef DUMP_LOG
562 STATIC_OVL void
563 bot1()
565 char newbot1[MAXCO];
566 int save_botlx = flags.botlx;
568 bot1str(newbot1);
569 #endif
570 curs(WIN_STATUS, 1, 0);
571 putstr(WIN_STATUS, 0, newbot1);
572 flags.botlx = save_botlx;
575 /* provide the name of the current level for display by various ports */
577 describe_level(buf, verbose)
578 char *buf;
579 int verbose;
581 int ret = 1;
583 /* TODO: Add in dungeon name */
584 /* done by Amy */
585 /* It was INCREDIBLY stOOpid that Ludios still did not display its depth. */
586 /*if (Is_knox(&u.uz))
587 sprintf(buf, "%s ", dungeons[u.uz.dnum].dname);
588 else*/ if (In_quest(&u.uz))
589 sprintf(buf, flags.showlongstats ? "Quest %d " : "Ques %d ", dunlev(&u.uz)); /* used to be called home --Amy */
590 else if (Is_astralevel(&u.uz)) /* why the heck is there a "l" missing in "astra_l_level"? */
591 sprintf(buf, flags.showlongstats ? "Astral Plane " : "Astral ");
592 else if (Is_earthlevel(&u.uz))
593 sprintf(buf, flags.showlongstats ? "Earth Plane " : "Earth ");
594 else if (Is_firelevel(&u.uz))
595 sprintf(buf, flags.showlongstats ? "Fire Plane " : "Fire ");
596 else if (Is_waterlevel(&u.uz))
597 sprintf(buf, flags.showlongstats ? "Water Plane " : "Water ");
598 else if (Is_airlevel(&u.uz))
599 sprintf(buf, flags.showlongstats ? "Air Plane " : "Air ");
600 else if (!strcmp(dungeons[u.uz.dnum].dname, "One-eyed Sam's Market"))
601 sprintf(buf, flags.showlongstats ? "Blackmarket:%d " : "Blk:%d ", depth(&u.uz));
602 else if (!strcmp(dungeons[u.uz.dnum].dname, "Sokoban"))
603 sprintf(buf, flags.showlongstats ? "Sokoban:%d " : "Sok:%d ", depth(&u.uz));
604 else if (!strcmp(dungeons[u.uz.dnum].dname, "Gehennom"))
605 sprintf(buf, flags.showlongstats ? "Gehennom:%d " : "Geh:%d ", depth(&u.uz));
606 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Gnomish Mines"))
607 sprintf(buf, flags.showlongstats ? "Mines:%d " : "Min:%d ", depth(&u.uz));
608 else if (!strcmp(dungeons[u.uz.dnum].dname, "Town"))
609 sprintf(buf, flags.showlongstats ? "Town:%d " : "Tow:%d ", depth(&u.uz));
610 else if (!strcmp(dungeons[u.uz.dnum].dname, "Grund's Stronghold"))
611 sprintf(buf, flags.showlongstats ? "Stronghold:%d " : "Str:%d ", depth(&u.uz));
612 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Ice Queen's Realm"))
613 sprintf(buf, flags.showlongstats ? "Icequeen:%d " : "Ice:%d ", depth(&u.uz));
614 else if (!strcmp(dungeons[u.uz.dnum].dname, "Lawful Quest"))
615 sprintf(buf, flags.showlongstats ? "Nightmare:%d " : "Nig:%d ", depth(&u.uz));
616 else if (!strcmp(dungeons[u.uz.dnum].dname, "Neutral Quest"))
617 sprintf(buf, flags.showlongstats ? "Beholder:%d " : "Beh:%d ", depth(&u.uz));
618 else if (!strcmp(dungeons[u.uz.dnum].dname, "Chaotic Quest"))
619 sprintf(buf, flags.showlongstats ? "Vecna:%d " : "Vec:%d ", depth(&u.uz));
620 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Temple of Moloch"))
621 sprintf(buf, flags.showlongstats ? "Temple:%d " : "Tem:%d ", depth(&u.uz));
622 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Giant Caverns"))
623 sprintf(buf, flags.showlongstats ? "Giants:%d " : "Gia:%d ", depth(&u.uz));
624 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Sunless Sea"))
625 sprintf(buf, "Sea:%d ", depth(&u.uz));
626 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Spider Caves"))
627 sprintf(buf, flags.showlongstats ? "Spider:%d " : "Spi:%d ", depth(&u.uz));
628 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Lost Tomb"))
629 sprintf(buf, flags.showlongstats ? "Lost Tomb:%d " : "Los:%d ", depth(&u.uz));
630 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Wyrm Caves"))
631 sprintf(buf, flags.showlongstats ? "Wyrm Caves:%d " : "Wyr:%d ", depth(&u.uz));
632 else if (!strcmp(dungeons[u.uz.dnum].dname, "Fort Ludios"))
633 sprintf(buf, flags.showlongstats ? "Ludios:%d " : "Lud:%d ", depth(&u.uz));
634 else if (!strcmp(dungeons[u.uz.dnum].dname, "Vlad's Tower"))
635 sprintf(buf, flags.showlongstats ? "Vlad's Tower:%d " : "Vla:%d ", depth(&u.uz));
636 else if (!strcmp(dungeons[u.uz.dnum].dname, "Frankenstein's Lab"))
637 sprintf(buf, "Lab:%d ", depth(&u.uz));
638 else if (!strcmp(dungeons[u.uz.dnum].dname, "Sheol"))
639 sprintf(buf, flags.showlongstats ? "Sheol:%d " : "She:%d ", depth(&u.uz));
640 else if (!strcmp(dungeons[u.uz.dnum].dname, "Yendorian Tower"))
641 sprintf(buf, flags.showlongstats ? "Yendor:%d " : "Yen:%d ", depth(&u.uz));
642 else if (!strcmp(dungeons[u.uz.dnum].dname, "Forging Chamber"))
643 sprintf(buf, flags.showlongstats ? "Forging:%d " : "For:%d ", depth(&u.uz));
644 else if (!strcmp(dungeons[u.uz.dnum].dname, "Ordered Chaos"))
645 sprintf(buf, flags.showlongstats ? "Ordered:%d " : "Ord:%d ", depth(&u.uz));
646 else if (!strcmp(dungeons[u.uz.dnum].dname, "Dead Grounds"))
647 sprintf(buf, flags.showlongstats ? "Deadground:%d " : "Ded:%d ", depth(&u.uz));
648 else if (!strcmp(dungeons[u.uz.dnum].dname, "The Subquest"))
649 sprintf(buf, flags.showlongstats ? "Subquest:%d " : "Sub:%d ", depth(&u.uz));
650 else if (!strcmp(dungeons[u.uz.dnum].dname, "Rival Quest"))
651 sprintf(buf, flags.showlongstats ? "Rival Quest:%d " : "Riv:%d ", depth(&u.uz));
652 else if (!strcmp(dungeons[u.uz.dnum].dname, "Bell Caves"))
653 sprintf(buf, flags.showlongstats ? "Bell Caves:%d " : "Bel:%d ", depth(&u.uz));
654 else if (!strcmp(dungeons[u.uz.dnum].dname, "Illusory Castle"))
655 sprintf(buf, flags.showlongstats ? "Illusory:%d " : "Ill:%d ", depth(&u.uz));
656 else if (!strcmp(dungeons[u.uz.dnum].dname, "Deep Mines"))
657 sprintf(buf, flags.showlongstats ? "Deep Mines:%d " : "Dee:%d ", depth(&u.uz));
658 else if (!strcmp(dungeons[u.uz.dnum].dname, "Space Base"))
659 sprintf(buf, flags.showlongstats ? "Space Base:%d " : "Spa:%d ", depth(&u.uz));
660 else if (!strcmp(dungeons[u.uz.dnum].dname, "Sewer Plant"))
661 sprintf(buf, flags.showlongstats ? "Sewer Plant:%d " : "Sew:%d ", depth(&u.uz));
662 else if (!strcmp(dungeons[u.uz.dnum].dname, "Gamma Caves"))
663 sprintf(buf, flags.showlongstats ? "Gamma Caves:%d " : "Gam:%d ", depth(&u.uz));
664 else if (!strcmp(dungeons[u.uz.dnum].dname, "Mainframe"))
665 sprintf(buf, flags.showlongstats ? "Mainframe:%d " : "Mai:%d ", depth(&u.uz));
666 else if (!strcmp(dungeons[u.uz.dnum].dname, "Pool Challenge"))
667 sprintf(buf, flags.showlongstats ? "Pool:%d " : "Poo:%d ", depth(&u.uz));
668 else if (!strcmp(dungeons[u.uz.dnum].dname, "Digdug Challenge"))
669 sprintf(buf, flags.showlongstats ? "Digdug:%d " : "Dig:%d ", depth(&u.uz));
670 else if (!strcmp(dungeons[u.uz.dnum].dname, "Pacman Challenge"))
671 sprintf(buf, flags.showlongstats ? "Pacman:%d " : "Pac:%d ", depth(&u.uz));
672 else if (!strcmp(dungeons[u.uz.dnum].dname, "Joust Challenge"))
673 sprintf(buf, flags.showlongstats ? "Joust:%d " : "Jou:%d ", depth(&u.uz));
674 else if (!strcmp(dungeons[u.uz.dnum].dname, "Grue Challenge"))
675 sprintf(buf, flags.showlongstats ? "Grue:%d " : "Gre:%d ", depth(&u.uz));
676 else if (!strcmp(dungeons[u.uz.dnum].dname, "Void"))
677 sprintf(buf, flags.showlongstats ? "The Void:%d " : "Voi:%d ", depth(&u.uz));
678 else if (!strcmp(dungeons[u.uz.dnum].dname, "Nether Realm"))
679 sprintf(buf, flags.showlongstats ? "Nether Realm:%d " : "Net:%d ", depth(&u.uz));
680 else if (!strcmp(dungeons[u.uz.dnum].dname, "Angmar"))
681 sprintf(buf, flags.showlongstats ? "Angmar:%d " : "Ang:%d ", depth(&u.uz));
682 else if (!strcmp(dungeons[u.uz.dnum].dname, "Green Cross"))
683 sprintf(buf, flags.showlongstats ? "Green Cross:%d " : "Grc:%d ", depth(&u.uz));
684 else if (!strcmp(dungeons[u.uz.dnum].dname, "Emyn Luin"))
685 sprintf(buf, flags.showlongstats ? "Emyn Luin:%d " : "Emy:%d ", depth(&u.uz));
686 else if (!strcmp(dungeons[u.uz.dnum].dname, "Minotaur Maze"))
687 sprintf(buf, flags.showlongstats ? "Minotaur:%d " : "Mit:%d ", depth(&u.uz));
688 else if (!strcmp(dungeons[u.uz.dnum].dname, "Swimming Pool"))
689 sprintf(buf, flags.showlongstats ? "Swimming Pool:%d " : "Swi:%d ", depth(&u.uz));
690 else if (!strcmp(dungeons[u.uz.dnum].dname, "Hell's Bathroom"))
691 sprintf(buf, flags.showlongstats ? "Hell's Bathroom:%d " : "Bat:%d ", depth(&u.uz));
692 else if (!strcmp(dungeons[u.uz.dnum].dname, "Minus World"))
693 sprintf(buf, flags.showlongstats ? "Minus World:%d " : "Miw:%d ", depth(&u.uz));
694 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone GA"))
695 sprintf(buf, flags.showlongstats ? "Resting Zone GA:%d " : "RGA:%d ", depth(&u.uz));
696 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone GB"))
697 sprintf(buf, flags.showlongstats ? "Resting Zone GB:%d " : "RGB:%d ", depth(&u.uz));
698 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone GC"))
699 sprintf(buf, flags.showlongstats ? "Resting Zone GC:%d " : "RGC:%d ", depth(&u.uz));
700 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone GD"))
701 sprintf(buf, flags.showlongstats ? "Resting Zone GD:%d " : "RGD:%d ", depth(&u.uz));
702 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone GE"))
703 sprintf(buf, flags.showlongstats ? "Resting Zone GE:%d " : "RGE:%d ", depth(&u.uz));
704 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TA"))
705 sprintf(buf, flags.showlongstats ? "Resting Zone TA:%d " : "RTA:%d ", depth(&u.uz));
706 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TB"))
707 sprintf(buf, flags.showlongstats ? "Resting Zone TB:%d " : "RTB:%d ", depth(&u.uz));
708 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TC"))
709 sprintf(buf, flags.showlongstats ? "Resting Zone TC:%d " : "RTC:%d ", depth(&u.uz));
710 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TD"))
711 sprintf(buf, flags.showlongstats ? "Resting Zone TD:%d " : "RTD:%d ", depth(&u.uz));
712 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TE"))
713 sprintf(buf, flags.showlongstats ? "Resting Zone TE:%d " : "RTE:%d ", depth(&u.uz));
714 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TF"))
715 sprintf(buf, flags.showlongstats ? "Resting Zone TF:%d " : "RTF:%d ", depth(&u.uz));
716 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TG"))
717 sprintf(buf, flags.showlongstats ? "Resting Zone TG:%d " : "RTG:%d ", depth(&u.uz));
718 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TH"))
719 sprintf(buf, flags.showlongstats ? "Resting Zone TH:%d " : "RTH:%d ", depth(&u.uz));
720 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TI"))
721 sprintf(buf, flags.showlongstats ? "Resting Zone TI:%d " : "RTI:%d ", depth(&u.uz));
722 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone TJ"))
723 sprintf(buf, flags.showlongstats ? "Resting Zone TJ:%d " : "RTJ:%d ", depth(&u.uz));
724 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone A"))
725 sprintf(buf, flags.showlongstats ? "Resting Zone A:%d " : "RZA:%d ", depth(&u.uz));
726 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone S"))
727 sprintf(buf, flags.showlongstats ? "Resting Zone S:%d " : "RZS:%d ", depth(&u.uz));
728 else if (!strcmp(dungeons[u.uz.dnum].dname, "Resting Zone E"))
729 sprintf(buf, flags.showlongstats ? "Resting Zone E:%d " : "RZE:%d ", depth(&u.uz));
730 else {
731 if (verbose)
732 sprintf(buf, "%s, level %d ",
733 dungeons[u.uz.dnum].dname, depth(&u.uz));
734 else
735 sprintf(buf, "Dlvl:%d ", depth(&u.uz));
736 ret = 0;
738 return ret;
741 /* [ALI] Line 2 abbreviation levels:
742 * 0 - No abbreviation
743 * 1 - Omit gold
744 * 2 - Abbreviated status tags
745 * 3 - Disable show options
746 * 4 - Omit dungeon level
748 * We omit gold first since the '$' command is always available.
750 * While the abbreviated status tags are very difficult to interpret, we use
751 * these before disabling the show options on the basis that the user always
752 * has the choice of turning the show options off if that would be preferable.
754 * Last to go is the dungeon level on the basis that there is no way of
755 * finding this information other than via the status line.
758 static int bot2_abbrev = 0; /* Line 2 abbreviation level (max 4) */
760 /* armor that sufficiently covers the body might be able to block magic */
762 magic_negationX(mon)
763 struct monst *mon;
765 if (program_state.bonesdo) return 0; /* should prevent stupid crashes */
767 return magic_negation(mon);
771 #ifdef DUMP_LOG
772 void
773 #else
774 STATIC_OVL void
775 #endif
776 bot2str(char *newbot2)
778 register char *nb;
779 int hp, hpmax;
780 int cap = near_capacity();
781 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
782 struct color_option color_option;
783 int save_botlx = flags.botlx;
784 #endif
785 #ifdef ALLEG_FX
786 int w;
787 #endif
789 hp = Upolyd ? u.mh : u.uhp;
790 hpmax = Upolyd ? u.mhmax : u.uhpmax;
792 if (FlimmeringStrips) {
793 nb = newbot2;
794 strcpy(newbot2, " ");
796 if (FunnyHallu) {
797 int funnyhallucnt = rnd(12);
798 if (rn2(3)) funnyhallucnt += rnd(12);
800 while (funnyhallucnt > 0) {
801 funnyhallucnt--;
802 add_flicker_text(generate_garbage_char(), newbot2);
805 sprintf(nb = eos(nb), "%d", hp);
806 sprintf(nb = eos(nb), "(");
807 sprintf(nb = eos(nb), "%d", hpmax);
808 sprintf(nb = eos(nb), ")");
810 funnyhallucnt = rnd(12);
811 if (rn2(3)) funnyhallucnt += rnd(12);
813 while (funnyhallucnt > 0) {
814 funnyhallucnt--;
815 add_flicker_text(generate_garbage_char(), newbot2);
818 sprintf(nb = eos(nb), "%d", u.uen);
819 sprintf(nb = eos(nb), "(");
820 sprintf(nb = eos(nb), "%d", u.uenmax);
821 sprintf(nb = eos(nb), ")");
823 funnyhallucnt = rnd(12);
824 if (rn2(3)) funnyhallucnt += rnd(12);
825 if (!rn2(2)) funnyhallucnt += rnd(12);
826 if (!rn2(3)) funnyhallucnt += rnd(12);
828 while (funnyhallucnt > 0) {
829 funnyhallucnt--;
830 add_flicker_text(generate_garbage_char(), newbot2);
834 } else {
836 add_flicker_text(generate_garbage_string(), newbot2);
837 if (rn2(3)) add_flicker_text(generate_garbage_string(), newbot2);
838 sprintf(nb = eos(nb), "%d(%d)", hp, hpmax);
839 add_flicker_text(generate_garbage_string(), newbot2);
840 if (rn2(3)) add_flicker_text(generate_garbage_string(), newbot2);
841 sprintf(nb = eos(nb), "%d(%d)", u.uen, u.uenmax);
842 add_flicker_text(generate_garbage_string(), newbot2);
843 if (rn2(3)) add_flicker_text(generate_garbage_string(), newbot2);
844 if (!rn2(2)) add_flicker_text(generate_garbage_string(), newbot2);
845 if (!rn2(3)) add_flicker_text(generate_garbage_string(), newbot2);
848 goto flicker2;
851 /*if(hp < 0) hp = 0;*/ /* show by how much you have been overkilled --Amy */
852 if (bot2_abbrev < 4)
853 (void) describe_level(newbot2, FALSE);
854 else
855 newbot2[0] = '\0';
856 if (bot2_abbrev < 1)
857 sprintf(nb = eos(newbot2), "%c%ld ",
858 #ifdef GMMODE
859 flags.supergmmode ? monsyms[S_SNAKE] : flags.gmmode ? monsyms[S_GNOME] :
860 #endif
861 oc_syms[COIN_CLASS],
862 #ifndef GOLDOBJ
863 u.ugold
864 #else
865 money_cnt(invent)
866 #endif
868 else
869 nb = newbot2;
871 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
872 strcat(nb = eos(newbot2), "HP");
873 curs(WIN_STATUS, 1, 1);
874 putstr(WIN_STATUS, 0, newbot2);
875 flags.botlx = 0;
877 sprintf(nb = eos(nb), "%d(%d)", hp, hpmax);
878 apply_color_option(percentage_color_of(hp, hpmax, hp_colors), newbot2, 2);
879 #else
880 sprintf(nb = eos(nb), "HP%d(%d)", hp, hpmax);
881 #endif
882 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
883 strcat(nb = eos(nb), " Pw");
884 curs(WIN_STATUS, 1, 1);
885 putstr(WIN_STATUS, 0, newbot2);
887 sprintf(nb = eos(nb), "%d(%d)", u.uen, u.uenmax);
888 apply_color_option(percentage_color_of(u.uen, u.uenmax, pw_colors), newbot2, 2);
889 #else
890 sprintf(nb = eos(nb), " Pw%d(%d)", u.uen, u.uenmax);
891 #endif
892 sprintf(nb = eos(nb), " AC%d", u.uac);
894 if (flags.showmc)
895 sprintf(nb = eos(nb), " MC%d", magic_negationX(&youmonst));
897 if (flags.showmovement)
898 sprintf(nb = eos(nb), " Mov%d", youmonst.data->mmove);
900 if (flags.showsanity)
901 sprintf(nb = eos(nb), " Sn%d", u.usanity);
903 if (Upolyd)
904 sprintf(nb = eos(nb), " HD%d", ((u.ulycn == u.umonnum) ?
905 u.ulevel : mons[u.umonnum].mlevel));
906 /*else*/ if(flags.showexp && bot2_abbrev < 3) /* show this when polymorphed, too --Amy */
907 sprintf(nb = eos(nb), " Xp%u/%-1ld", u.ulevel,u.uexp);
908 else
909 sprintf(nb = eos(nb), " Exp%u", u.ulevel);
911 if (flags.showsymbiotehp && uinsymbiosis) {
912 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
913 strcat(nb = eos(nb), " SH");
914 curs(WIN_STATUS, 1, 1);
915 putstr(WIN_STATUS, 0, newbot2);
917 sprintf(nb = eos(nb), "%d(%d)", u.usymbiote.mhp, u.usymbiote.mhpmax);
918 apply_color_option(percentage_color_of(u.usymbiote.mhp, u.usymbiote.mhpmax, hp_colors), newbot2, 2);
919 #else
920 sprintf(nb = eos(nb), " SH%d(%d)", u.usymbiote.mhp, u.usymbiote.mhpmax);
921 #endif
922 if (u.usymbiote.cursed) {
923 sprintf(nb = eos(nb), "%s", u.usymbiote.stckcurse ? "S" : "C");
924 sprintf(nb = eos(nb), "%s", (u.usymbiote.evilcurse || u.usymbiote.bbcurse || u.usymbiote.morgcurse) ? "XXX" : u.usymbiote.prmcurse ? "XX" : u.usymbiote.hvycurse ? "X" : "");
926 if (symbiote_is_shut_down()) sprintf(nb = eos(nb), "sd");
929 #ifdef SHOW_WEIGHT
930 if (flags.showweight && !WeightDisplayIsArbitrary && bot2_abbrev < 3)
931 sprintf(nb = eos(nb), " Wt%ld/%ld", (long)(inv_weight()+weight_cap()),
932 (long)weight_cap());
933 #endif
935 if(flags.time && bot2_abbrev < 3)
936 sprintf(nb = eos(nb), " T%ld", moves);
938 #ifdef REALTIME_ON_BOTL
939 if(iflags.showrealtime) {
940 /* somehow, without the gameover check, the displayed amount would be doubled upon getting a game over --Amy
941 * this used to have no real effect but now we want to display the realtime amount in the dumplog */
943 if (program_state.gameover) {
945 time_t currenttime = (long)realtime_data.realtime;
947 sprintf(nb = eos(nb), " %ld:%2.2ld", currenttime / 3600, (currenttime % 3600) / 60);
949 } else {
951 time_t currenttime = get_realtime();
952 sprintf(nb = eos(nb), " %ld:%2.2ld", currenttime / 3600, (currenttime % 3600) / 60);
957 #endif
959 #ifdef ALLEG_FX
960 if(iflags.usealleg && botl_warn && !Hallucination)
962 sprintf(nb = eos(nb), " ");
963 for(w = 0; w < botl_warn; w++)
964 sprintf(nb = eos(nb), "!");
966 #endif
968 /* if (bot2_abbrev >= 2) {
969 if (hu_abbrev_stat[u.uhs][0]!='\0') {
970 sprintf(nb = eos(nb), " ");
971 strcat(newbot2, hu_abbrev_stat[u.uhs]);
974 else if(strcmp(hu_stat[u.uhs], " ")) {
975 sprintf(nb = eos(nb), " ");
976 strcat(newbot2, hu_stat[u.uhs]);
980 if (!YouAreThirsty && u.urealedibility && u.uhunger >= 4500)
981 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
982 add_colored_text(flags.showlongstats ? "Oversatiated" : "Ovs", newbot2);
983 #else
984 strcat(nb = eos(nb), flags.showlongstats ? " Oversatiated" : " Ovs");
985 #endif
987 else if(!YouAreThirsty && strcmp(hu_stat[u.uhs], " "))
988 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
989 add_colored_text(flags.showlongstats ? hu_stat[u.uhs] : hu_abbrev_stat[u.uhs], newbot2);
990 #else
991 sprintf(nb = eos(nb), " %s", flags.showlongstats ? hu_stat[u.uhs] : hu_abbrev_stat[u.uhs]);
992 #endif
994 /* WAC further Up
995 if (flags.showscore)
996 sprintf(nb,"%c%d Score%ld", oc_syms[COIN_CLASS],
997 u.ugold, botl_score());
1000 if (isok(u.ux, u.uy) && invocation_pos(u.ux, u.uy))
1001 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1002 add_colored_text(flags.showlongstats ? "Vibration" : "Vib", newbot2);
1003 #else
1004 strcat(nb = eos(nb), flags.showlongstats ? " Vibration" : " Vib");
1005 #endif
1007 if(Slimed)
1008 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1009 add_colored_text(flags.showlongstats ? "Slime" : "Sli", newbot2);
1010 #else
1011 strcat(nb = eos(nb), flags.showlongstats ? " Slime" : " Sli");
1012 #endif
1013 if(Stoned)
1014 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1015 add_colored_text(flags.showlongstats ? "Stone" : "Sto", newbot2);
1016 #else
1017 strcat(nb = eos(nb), flags.showlongstats ? " Stone" : " Sto");
1018 #endif
1019 if(Sick) {
1020 if (u.usick_type & SICK_VOMITABLE)
1021 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1022 add_colored_text(flags.showlongstats ? "FoodPois" : "FPo", newbot2);
1023 #else
1024 strcat(nb = eos(nb), flags.showlongstats ? " FoodPois" : " FPo");
1025 #endif
1026 if (u.usick_type & SICK_NONVOMITABLE)
1027 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1028 add_colored_text("Ill", newbot2);
1029 #else
1030 strcat(nb = eos(nb), " Ill");
1031 #endif
1034 if (multi < 0)
1035 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1036 add_colored_text(flags.showlongstats ? "Paralyzed" : "Par", newbot2);
1037 #else
1038 strcat(nb = eos(nb), flags.showlongstats ? " Paralyzed" : " Par");
1039 #endif
1041 /* KMH -- changed to Lev */
1042 if (Levitation)
1043 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1044 add_colored_text("Lev", newbot2);
1045 #else
1046 strcat(nb = eos(nb), " Lev");
1047 #endif
1048 if (IsGlib)
1049 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1050 add_colored_text(flags.showlongstats ? "Glib" : "Glb", newbot2);
1051 #else
1052 strcat(nb = eos(nb), flags.showlongstats ? " Glib" : " Glb");
1053 #endif
1054 if (Wounded_legs)
1055 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1056 add_colored_text(flags.showlongstats ? "Legs" : "Leg", newbot2);
1057 #else
1058 strcat(nb = eos(nb), flags.showlongstats ? " Legs" : " Leg");
1059 #endif
1060 if (Strangled)
1061 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1062 add_colored_text(flags.showlongstats ? "Choke" : "Chk", newbot2);
1063 #else
1064 strcat(nb = eos(nb), flags.showlongstats ? " Choke" : " Chk");
1065 #endif
1066 if (PlayerBleeds)
1067 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1068 add_colored_text(flags.showlongstats ? "Bleed" : "Bld", newbot2);
1069 #else
1070 strcat(nb = eos(nb), flags.showlongstats ? " Bleed" : " Bld");
1071 #endif
1072 if (Vomiting)
1073 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1074 add_colored_text(flags.showlongstats ? "Vomit" : "Vmt", newbot2);
1075 #else
1076 strcat(nb = eos(nb), flags.showlongstats ? " Vomit" : " Vmt");
1077 #endif
1078 if(Confusion && !HeavyConfusion)
1079 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1080 add_colored_text(flags.showlongstats ? "Conf" : "Cnf", newbot2);
1081 #else
1082 strcat(nb = eos(nb), flags.showlongstats ? " Conf" : " Cnf");
1083 #endif
1084 if(Confusion && HeavyConfusion)
1085 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1086 add_colored_text(flags.showlongstats ? "XConf" : "XCnf", newbot2);
1087 #else
1088 strcat(nb = eos(nb), flags.showlongstats ? " XConf" : " XCnf");
1089 #endif
1091 if(Blind && !HeavyBlind)
1092 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1093 add_colored_text(flags.showlongstats ? "Blind" : "Bli", newbot2);
1094 #else
1095 strcat(nb = eos(nb), flags.showlongstats ? " Blind" : " Bli");
1096 #endif
1097 if(Blind && HeavyBlind)
1098 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1099 add_colored_text(flags.showlongstats ? "XBlind" : "XBli", newbot2);
1100 #else
1101 strcat(nb = eos(nb), flags.showlongstats ? " XBlind" : " XBli");
1102 #endif
1103 if(sengr_at("Elbereth", u.ux, u.uy))
1104 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1105 add_colored_text(flags.showlongstats ? "Elbereth" : "Elb", newbot2);
1106 #else
1107 strcat(nb = eos(nb), flags.showlongstats ? " Elbereth" : " Elb");
1108 #endif
1109 /* Yes I know, this should have a "is the player blind?" check. But I'm lenient. --Amy */
1111 if(Feared && !HeavyFeared)
1112 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1113 add_colored_text((Race_if(PM_TUMBLRER) || Role_if(PM_SOCIAL_JUSTICE_WARRIOR)) ? (flags.showlongstats ? "Triggered" : "Trg") : (flags.showlongstats ? "Fear" : "Fea"), newbot2);
1114 #else
1115 strcat(nb = eos(nb), (Race_if(PM_TUMBLRER) || Role_if(PM_SOCIAL_JUSTICE_WARRIOR)) ? (flags.showlongstats ? " Triggered" : " Trg") : (flags.showlongstats ? " Fear" : " Fea") );
1116 #endif
1117 if(Feared && HeavyFeared)
1118 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1119 add_colored_text((Race_if(PM_TUMBLRER) || Role_if(PM_SOCIAL_JUSTICE_WARRIOR)) ? (flags.showlongstats ? "XTriggered" : "XTrg") : (flags.showlongstats ? "XFear" : "XFea"), newbot2);
1120 #else
1121 strcat(nb = eos(nb), (Race_if(PM_TUMBLRER) || Role_if(PM_SOCIAL_JUSTICE_WARRIOR)) ? (flags.showlongstats ? " XTriggered" : " XTrg") : (flags.showlongstats ? " XFear" : " XFea"));
1122 #endif
1123 if(Numbed && !HeavyNumbed)
1124 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1125 add_colored_text(flags.showlongstats ? "Numb" : "Nmb", newbot2);
1126 #else
1127 strcat(nb = eos(nb), flags.showlongstats ? " Numb" : " Nmb");
1128 #endif
1129 if(Numbed && HeavyNumbed)
1130 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1131 add_colored_text(flags.showlongstats ? "XNumb" : "XNmb", newbot2);
1132 #else
1133 strcat(nb = eos(nb), flags.showlongstats ? " XNumb" : " XNmb");
1134 #endif
1135 if(Frozen && !HeavyFrozen)
1136 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1137 add_colored_text(flags.showlongstats ? "Freeze" : "Frz", newbot2);
1138 #else
1139 strcat(nb = eos(nb), flags.showlongstats ? " Freeze" : " Frz");
1140 #endif
1141 if(Frozen && HeavyFrozen)
1142 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1143 add_colored_text(flags.showlongstats ? "XFreeze" : "XFrz", newbot2);
1144 #else
1145 strcat(nb = eos(nb), flags.showlongstats ? " XFreeze" : " XFrz");
1146 #endif
1147 if(Burned && !HeavyBurned)
1148 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1149 add_colored_text(flags.showlongstats ? "Burn" : "Brn", newbot2);
1150 #else
1151 strcat(nb = eos(nb), flags.showlongstats ? " Burn" : " Brn");
1152 #endif
1153 if(Burned && HeavyBurned)
1154 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1155 add_colored_text(flags.showlongstats ? "XBurn" : "XBrn", newbot2);
1156 #else
1157 strcat(nb = eos(nb), flags.showlongstats ? " XBurn" : " XBrn");
1158 #endif
1159 if(Dimmed && !HeavyDimmed)
1160 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1161 add_colored_text("Dim", newbot2);
1162 #else
1163 strcat(nb = eos(nb), " Dim");
1164 #endif
1165 if(Dimmed && HeavyDimmed)
1166 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1167 add_colored_text("XDim", newbot2);
1168 #else
1169 strcat(nb = eos(nb), " XDim");
1170 #endif
1171 if(Stunned && !HeavyStunned)
1172 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1173 add_colored_text(flags.showlongstats ? "Stun" : "Stn", newbot2);
1174 #else
1175 strcat(nb = eos(nb), flags.showlongstats ? " Stun" : " Stn");
1176 #endif
1177 if(Stunned && HeavyStunned)
1178 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1179 add_colored_text(flags.showlongstats ? "XStun" : "XStn", newbot2);
1180 #else
1181 strcat(nb = eos(nb), flags.showlongstats ? " XStun" : " XStn");
1182 #endif
1183 if(Hallucination && !HeavyHallu)
1184 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1185 add_colored_text(flags.showlongstats ? "Hallu" : "Hal", newbot2);
1186 #else
1187 strcat(nb = eos(nb), flags.showlongstats ? " Hallu" : " Hal");
1188 #endif
1189 if(Hallucination && HeavyHallu)
1190 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1191 add_colored_text(flags.showlongstats ? "XHallu" : "XHal", newbot2);
1192 #else
1193 strcat(nb = eos(nb), flags.showlongstats ? " XHallu" : " XHal");
1194 #endif
1195 if(u.ustuck && !u.uswallow && !sticks(youmonst.data))
1196 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1197 add_colored_text(flags.showlongstats ? "Held" : "Hld", newbot2);
1198 #else
1199 strcat(nb = eos(nb), flags.showlongstats ? " Held" : " Hld");
1200 #endif
1201 if(cap > UNENCUMBERED)
1202 #if defined(STATUS_COLORS) && defined(TEXTCOLOR)
1203 add_colored_text(flags.showlongstats ? enc_stat[cap] : enc_abbrev_stat[cap], newbot2);
1204 #else
1205 sprintf(nb = eos(nb), " %s", enc_stat[cap]);
1206 #endif
1208 flicker2:
1213 STATIC_OVL void
1214 bot2()
1217 char newbot2[MAXCO];
1219 bot2str(newbot2);
1220 curs(WIN_STATUS, 1, 1);
1222 putstr(WIN_STATUS, 0, newbot2);
1223 return;
1226 /* WAC -- Shorten bot1 to fit in len spaces.
1227 * Not currently used
1228 * Longest string past Str: is
1229 * ". Str:18/99 Dx:11 Co:13 In:12 Wi:14 Ch:14 Neutral" or 49 Chars long.
1231 #if 0
1232 const char*
1233 shorten_bot1(str, len)
1234 const char *str;
1235 int len;
1237 static char cbuf[BUFSZ];
1239 register const char *bp0 = str;
1240 register char *bp1 = cbuf;
1241 int k = 0;
1243 do {
1244 *bp1++ = *bp0;
1245 k++;
1246 } while(*bp0++ && k < (len - 49));
1248 cbuf[k] = '.';
1249 bp1++;
1251 bp0 = index(str, ':') - 3;
1252 do {
1253 *bp1++ = *bp0;
1254 } while(*bp0++);
1255 return cbuf;
1257 #endif /* 0 */
1259 /* ALI -- Shorten bot2 to fit in len spaces.
1260 * Currently only used by tty port
1261 * After the forth attempt the longest practical bot2 becomes:
1262 * HP:700(700) Pw:111(111) AC:-127 Exp:30
1263 * Sat Lev Cnf FPs Ill Bnd Stn Hal Slm Old
1264 * -- or just under 80 characters
1266 #ifdef TTY_GRAPHICS
1267 const char*
1268 shorten_bot2(str, len)
1269 const char *str;
1270 unsigned int len;
1272 static char cbuf[MAXCO];
1273 /*for(bot2_abbrev = 1; bot2_abbrev <= 4; bot2_abbrev++) {
1274 bot2str(cbuf);
1275 if (strlen(cbuf) <= len)
1276 break;
1278 bot2_abbrev = 5;
1279 /*if (bot2_abbrev > 4)
1280 cbuf[len] = '\0';*/ /* If all else fails, truncate the line */
1281 bot2_abbrev = 0;
1282 return cbuf;
1284 #endif /* TTY_GRAPHICS */
1286 static void (*raw_handler)();
1288 static void bot_raw(reconfig)
1289 boolean reconfig;
1291 const char *botl_raw_values[24], **rv = botl_raw_values;
1292 char dex[3], con[3], itl[3], wis[3], cha[3], score[21];
1293 int uhp;
1294 char dlevel[BUFSZ];
1295 char hp[21], hpmax[21], pw[21], pwmax[21], gold[21], ac[21], elevel[21];
1296 char expr[21], iweight[21], capacity[21], flgs[21], tim[21];
1297 *rv++ = reconfig ? "player" : botl_player();
1298 *rv++ = reconfig ? "strength" : botl_strength();
1299 *rv++ = reconfig ? "dexterity" : (sprintf(dex, "%d", ACURR(A_DEX)), dex);
1300 *rv++ = reconfig ? "constitution" : (sprintf(con, "%d", ACURR(A_CON)), con);
1301 *rv++ = reconfig ? "intelligence" : (sprintf(itl, "%d", ACURR(A_INT)), itl);
1302 *rv++ = reconfig ? "wisdom" : (sprintf(wis, "%d", ACURR(A_WIS)), wis);
1303 *rv++ = reconfig ? "charisma" : (sprintf(cha, "%d", ACURR(A_CHA)), cha);
1304 *rv++ = reconfig ? "alignment" : u.ualign.type == A_CHAOTIC ? "Chaotic" :
1305 u.ualign.type == A_NEUTRAL ? "Neutral" : "Lawful";
1306 if (flags.showscore)
1307 *rv++ = reconfig ? "score" :
1308 (sprintf(score, "%ld", botl_score()), score);
1309 uhp = Upolyd ? u.mh : u.uhp;
1310 if (uhp < 0) uhp = 0;
1311 (void) describe_level(dlevel, TRUE);
1312 eos(dlevel)[-1] = 0;
1313 *rv++ = reconfig ? "dlevel" : dlevel;
1314 *rv++ = reconfig ? "gold" : (sprintf(gold, "%ld",
1315 #ifndef GOLDOBJ
1316 u.ugold
1317 #else
1318 money_cnt(invent)
1319 #endif
1320 ), gold);
1321 *rv++ = reconfig ? "hp" : (sprintf(hp, "%d", uhp), hp);
1322 *rv++ = reconfig ? "hpmax" :
1323 (sprintf(hpmax, "%d", Upolyd ? u.mhmax : u.uhpmax), hpmax);
1324 *rv++ = reconfig ? "pw" : (sprintf(pw, "%d", u.uen), pw);
1325 *rv++ = reconfig ? "pwmax" : (sprintf(pwmax, "%d", u.uenmax), pwmax);
1326 *rv++ = reconfig ? "ac" : (sprintf(ac, "%d", u.uac), ac);
1327 sprintf(elevel, "%u",
1328 Upolyd && u.ulycn != u.umonnum ? mons[u.umonnum].mlevel : u.ulevel);
1329 *rv++ = reconfig ? (Upolyd ? "hitdice" : "elevel") : elevel;
1330 if (flags.showexp)
1331 *rv++ = reconfig ? "experience" : (sprintf(expr, "%ld", u.uexp), expr);
1332 #ifdef SHOW_WEIGHT
1333 if (flags.showweight && !WeightDisplayIsArbitrary) {
1334 *rv++ = reconfig ? "weight" : (sprintf(iweight,
1335 "%ld", (long)(inv_weight() + weight_cap())), iweight);
1336 *rv++ = reconfig ? "capacity" : (sprintf(capacity,
1337 "%ld", (long)weight_cap()), capacity);
1339 #endif
1340 if (flags.time)
1341 *rv++ = reconfig ? "time" : (sprintf(tim, "%ld", moves), tim);
1342 if (!YouAreThirsty) *rv++ = reconfig ? "hunger" : strcmp(hu_stat[u.uhs], " ") ?
1343 hu_stat[u.uhs] : "";
1344 *rv++ = reconfig ? "encumberance" : enc_stat[near_capacity()];
1345 *rv++ = reconfig ? "flags" : (sprintf(flgs, "%d",
1346 (Levitation ? RAW_STAT_LEVITATION : 0) |
1347 (Confusion ? RAW_STAT_CONFUSION : 0) |
1348 (Sick && (u.usick_type & SICK_VOMITABLE) ? RAW_STAT_FOODPOIS : 0) |
1349 (Sick && (u.usick_type & SICK_NONVOMITABLE) ? RAW_STAT_ILL : 0) |
1350 (Blind ? RAW_STAT_BLIND : 0) |
1351 (Stunned ? RAW_STAT_STUNNED : 0) |
1352 (Numbed ? RAW_STAT_NUMBED : 0) |
1353 (Feared ? RAW_STAT_FEARED : 0) |
1354 (Frozen ? RAW_STAT_FROZEN : 0) |
1355 (Burned ? RAW_STAT_BURNED : 0) |
1356 (Dimmed ? RAW_STAT_DIMMED : 0) |
1357 (Hallucination ? RAW_STAT_HALLUCINATION : 0) |
1358 (Slimed ? RAW_STAT_SLIMED : 0)), flgs);
1359 (*raw_handler)(reconfig, rv - botl_raw_values, botl_raw_values);
1362 void bot_reconfig()
1364 if (raw_handler)
1365 bot_raw(TRUE);
1366 flags.botl = 1;
1369 void
1370 bot_set_handler(handler)
1371 void (*handler)();
1373 raw_handler = handler;
1374 bot_reconfig();
1377 void
1378 bot()
1382 * ALI: Cope with the fact that u_init may not have been
1383 * called yet. This happens if the player selection menus
1384 * are long enough to overwite the status line. In this
1385 * case we will be called when the menu is removed while
1386 * youmonst.data is still NULL.
1388 if (!youmonst.data)
1389 return;
1391 if (raw_handler)
1392 bot_raw(FALSE);
1393 else {
1394 if (StuckAnnouncement || u.uprops[STUCK_ANNOUNCEMENT_BUG].extrinsic || have_stuckannouncementstone()) return;
1396 if (!DisplayDoesNotGo) bot1();
1397 if (!DisplayDoesNotGo) bot2();
1399 flags.botl = flags.botlx = 0;
1402 void
1403 botreal()
1407 * ALI: Cope with the fact that u_init may not have been
1408 * called yet. This happens if the player selection menus
1409 * are long enough to overwite the status line. In this
1410 * case we will be called when the menu is removed while
1411 * youmonst.data is still NULL.
1413 if (!youmonst.data)
1414 return;
1415 if (raw_handler)
1416 bot_raw(FALSE);
1417 else {
1418 if (!DisplayDoesNotGo) bot1();
1419 if (!DisplayDoesNotGo) bot2();
1421 flags.botl = flags.botlx = 0;
1424 #endif /* OVL0 */
1426 /*botl.c*/