home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / HACKSRC.ZIP / PRI.C < prev    next >
C/C++ Source or Header  |  1985-10-16  |  15KB  |  732 lines

  1. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  2. /* pri.c - version 1.0.3 */
  3.  
  4. #include <stdio.h>
  5. #include "hack.h"
  6. xchar scrlx, scrhx, scrly, scrhy;    /* corners of new area on screen */
  7.  
  8. extern char *hu_stat[];    /* in eat.c */
  9. extern char *CD;
  10.  
  11. swallowed()
  12. {
  13.     char *ulook = "|@|";
  14.     ulook[1] = u.usym;
  15.  
  16.     cls();
  17.     curs(u.ux-1, u.uy+1);
  18.     fputs("/-\\", stdout);
  19.     curx = u.ux+2;
  20.     curs(u.ux-1, u.uy+2);
  21.     fputs(ulook, stdout);
  22.     curx = u.ux+2;
  23.     curs(u.ux-1, u.uy+3);
  24.     fputs("\\-/", stdout);
  25.     curx = u.ux+2;
  26.     u.udispl = 1;
  27.     u.udisx = u.ux;
  28.     u.udisy = u.uy;
  29. }
  30.  
  31.  
  32. /*VARARGS1*/
  33. boolean panicking;
  34.  
  35. panic(str,a1,a2,a3,a4,a5,a6)
  36. char *str;
  37. {
  38.     if(panicking++) exit(1);    /* avoid loops - this should never happen*/
  39.     cls();
  40.     home();
  41.     puts(" Suddenly, the dungeon collapses.");
  42.     fputs(" ERROR:  ", stdout);
  43.     printf(str,a1,a2,a3,a4,a5,a6);
  44. #ifdef DEBUG
  45. #ifdef UNIX
  46.     if(!fork())
  47.         abort();    /* generate core dump */
  48. #endif UNIX
  49. #endif DEBUG
  50.     more();            /* contains a fflush() */
  51.     done("panicked");
  52. }
  53.  
  54. atl(x,y,ch)
  55. register x,y;
  56. {
  57.     register struct rm *crm = &levl[x][y];
  58.  
  59.     if(x<0 || x>COLNO-1 || y<0 || y>ROWNO-1){
  60.         impossible("atl(%d,%d,%c)",x,y,ch);
  61.         return;
  62.     }
  63.     if(crm->seen && crm->scrsym == ch) return;
  64.     crm->scrsym = ch;
  65.     crm->new = 1;
  66.     on_scr(x,y);
  67. }
  68.  
  69. on_scr(x,y)
  70. register x,y;
  71. {
  72.     if(x < scrlx) scrlx = x;
  73.     if(x > scrhx) scrhx = x;
  74.     if(y < scrly) scrly = y;
  75.     if(y > scrhy) scrhy = y;
  76. }
  77.  
  78. /* call: (x,y) - display
  79.     (-1,0) - close (leave last symbol)
  80.     (-1,-1)- close (undo last symbol)
  81.     (-1,let)-open: initialize symbol
  82.     (-2,let)-change let
  83. */
  84.  
  85. tmp_at(x,y) schar x,y; {
  86. static schar prevx, prevy;
  87. static char let;
  88.     if((int)x == -2){    /* change let call */
  89.         let = y;
  90.         return;
  91.     }
  92.     if((int)x == -1 && (int)y >= 0){    /* open or close call */
  93.         let = y;
  94.         prevx = -1;
  95.         return;
  96.     }
  97.     if(prevx >= 0 && cansee(prevx,prevy)) {
  98.         delay_output();
  99.         prl(prevx, prevy);    /* in case there was a monster */
  100.         at(prevx, prevy, levl[prevx][prevy].scrsym);
  101.     }
  102.     if(x >= 0){    /* normal call */
  103.         if(cansee(x,y)) at(x,y,let);
  104.         prevx = x;
  105.         prevy = y;
  106.     } else {    /* close call */
  107.         let = 0;
  108.         prevx = -1;
  109.     }
  110. }
  111.  
  112. /* like the previous, but the symbols are first erased on completion */
  113. Tmp_at(x,y) schar x,y; {
  114. static char let;
  115. static xchar cnt;
  116. static coord tc[COLNO];        /* but watch reflecting beams! */
  117. register xx,yy;
  118.     if((int)x == -1) {
  119.         if(y > 0) {    /* open call */
  120.             let = y;
  121.             cnt = 0;
  122.             return;
  123.         }
  124.         /* close call (do not distinguish y==0 and y==-1) */
  125.         while(cnt--) {
  126.             xx = tc[cnt].x;
  127.             yy = tc[cnt].y;
  128.             prl(xx, yy);
  129.             at(xx, yy, levl[xx][yy].scrsym);
  130.         }
  131.         cnt = let = 0;    /* superfluous */
  132.         return;
  133.     }
  134.     if((int)x == -2) {    /* change let call */
  135.         let = y;
  136.         return;
  137.     }
  138.     /* normal call */
  139.     if(cansee(x,y)) {
  140.         if(cnt) delay_output();
  141.         at(x,y,let);
  142.         tc[cnt].x = x;
  143.         tc[cnt].y = y;
  144.         if(++cnt >= COLNO) panic("Tmp_at overflow?");
  145.         levl[x][y].new = 0;    /* prevent pline-nscr erasing --- */
  146.     }
  147. }
  148.  
  149. setclipped(){
  150.     error("Hack needs a screen of size at least %d by %d.\n",
  151.         ROWNO+2, COLNO);
  152. }
  153.  
  154. at(x,y,ch)
  155. register xchar x,y;
  156. char ch;
  157. {
  158. #ifndef lint
  159.     /* if xchar is unsigned, lint will complain about  if(x < 0)  */
  160.     if(x < 0 || x > COLNO-1 || y < 0 || y > ROWNO-1) {
  161.         impossible("At gets 0%o at %d %d.", ch, x, y);
  162.         return;
  163.     }
  164. #endif lint
  165.     if(!ch) {
  166.         impossible("At gets null at %d %d.", x, y);
  167.         return;
  168.     }
  169.     y += 2;
  170.     curs(x,y);
  171.     (void) putchar(ch);
  172.     curx++;
  173. }
  174.  
  175. prme(){
  176.     if(!Invisible) at(u.ux,u.uy,u.usym);
  177. }
  178.  
  179. doredraw()
  180. {
  181.     docrt();
  182.     return(0);
  183. }
  184.  
  185. docrt()
  186. {
  187.     register x,y;
  188.     register struct rm *room;
  189.     register struct monst *mtmp;
  190.  
  191.     if(u.uswallow) {
  192.         swallowed();
  193.         return;
  194.     }
  195.     cls();
  196.  
  197. /* Some ridiculous code to get display of @ and monsters (almost) right */
  198.     if(!Invisible) {
  199.         levl[(u.udisx = u.ux)][(u.udisy = u.uy)].scrsym = u.usym;
  200.         levl[u.udisx][u.udisy].seen = 1;
  201.         u.udispl = 1;
  202.     } else    u.udispl = 0;
  203.  
  204.     seemons();    /* reset old positions */
  205.     for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
  206.         mtmp->mdispl = 0;
  207.     seemons();    /* force new positions to be shown */
  208. /* This nonsense should disappear soon --------------------------------- */
  209.  
  210. #ifdef DGK
  211. /* Here are two kinds of faster redraw -dgk
  212.  *    1) Using BIOS call 0x10 for cursor and printing (may not be portable)
  213.  *    2) Using a line buffer with ANSI for a speed up of about 50%
  214.  */
  215.     if (flags.BIOSok) {
  216.         fflush(stdout);            /* make the cls() occur */
  217.         for(y = 0; y < ROWNO; y++)
  218.             for(x = 0; x < COLNO; x++)
  219.                 if((room = &levl[x][y])->new) {
  220.                     room->new = 0;
  221.                     fastat(x, y, room->scrsym);
  222.                 } else if(room->seen)
  223.                     fastat(x, y, room->scrsym);
  224.     } else {
  225.         for(y = 0; y < ROWNO; y++) {
  226.             char buf[COLNO+1];
  227.             int start, end;
  228.  
  229.             memset(buf, ' ', COLNO);
  230.             for(x = 0, start = -1, end = -1; x < COLNO; x++)
  231.                 if((room = &levl[x][y])->new) {
  232.                     room->new = 0;
  233.                     buf[x] = room->scrsym;
  234.                     if (start < 0)
  235.                         start = x;
  236.                     end = x;
  237.                 } else if(room->seen) {
  238.                     buf[x] = room->scrsym;
  239.                     if (start < 0)
  240.                         start = x;
  241.                     end = x;
  242.                 }
  243.             if (end >= 0) {
  244.                 buf[end + 1] = '\0';
  245.                 curs(start, y + 2);
  246.                 fputs(buf + start, stdout);
  247.                 curx = end + 1;
  248.             }
  249.         }
  250.     }
  251. #else
  252.     for(y = 0; y < ROWNO; y++)
  253.         for(x = 0; x < COLNO; x++)
  254.             if((room = &levl[x][y])->new) {
  255.                 room->new = 0;
  256.                 at(x,y,room->scrsym);
  257.             } else if(room->seen)
  258.                 at(x,y,room->scrsym);
  259. #endif DGK
  260.     scrlx = COLNO;
  261.     scrly = ROWNO;
  262.     scrhx = scrhy = 0;
  263.     flags.botlx = 1;
  264.     bot();
  265. }
  266.  
  267. docorner(xmin,ymax) register xmin,ymax; {
  268.     register x,y;
  269.     register struct rm *room;
  270.     register struct monst *mtmp;
  271.  
  272.     if(u.uswallow) {    /* Can be done more efficiently */
  273.         swallowed();
  274.         return;
  275.     }
  276.  
  277.     seemons();    /* reset old positions */
  278.     for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
  279.         if(mtmp->mx >= xmin && mtmp->my < ymax)
  280.         mtmp->mdispl = 0;
  281.     seemons();    /* force new positions to be shown */
  282.  
  283.     for(y = 0; y < ymax; y++) {
  284.         if(y > ROWNO && CD) break;
  285.         curs(xmin,y+2);
  286.         cl_end();
  287.         if(y < ROWNO) {
  288.             for(x = xmin; x < COLNO; x++) {
  289.             if((room = &levl[x][y])->new) {
  290.                 room->new = 0;
  291.                 at(x,y,room->scrsym);
  292.             } else
  293.                 if(room->seen)
  294.                     at(x,y,room->scrsym);
  295.             }
  296.         }
  297.     }
  298.     if(ymax > ROWNO) {
  299.         cornbot(xmin-1);
  300.         if(ymax > ROWNO+1 && CD) {
  301.             curs(1,ROWNO+3);
  302.             cl_eos();
  303.         }
  304.     }
  305. }
  306.  
  307. curs_on_u(){
  308.     curs(u.ux, u.uy+2);
  309. }
  310.  
  311. pru()
  312. {
  313.     if(u.udispl && (Invisible || u.udisx != u.ux || u.udisy != u.uy))
  314.         /* if(! levl[u.udisx][u.udisy].new) */
  315.             if(!vism_at(u.udisx, u.udisy))
  316.                 newsym(u.udisx, u.udisy);
  317.     if(Invisible) {
  318.         u.udispl = 0;
  319.         prl(u.ux,u.uy);
  320.     } else
  321.     if(!u.udispl || u.udisx != u.ux || u.udisy != u.uy) {
  322.         atl(u.ux, u.uy, u.usym);
  323.         u.udispl = 1;
  324.         u.udisx = u.ux;
  325.         u.udisy = u.uy;
  326.     }
  327.     levl[u.ux][u.uy].seen = 1;
  328. }
  329.  
  330. #ifndef NOWORM
  331. #include    "wseg.h"
  332. extern struct wseg *m_atseg;
  333. #endif NOWORM
  334.  
  335. /* print a position that is visible for @ */
  336. prl(x,y)
  337. {
  338.     register struct rm *room;
  339.     register struct monst *mtmp;
  340.     register struct obj *otmp;
  341.  
  342.     if(x == u.ux && y == u.uy && (!Invisible)) {
  343.         pru();
  344.         return;
  345.     }
  346.     if(!isok(x,y)) return;
  347.     room = &levl[x][y];
  348.     if((!room->typ) ||
  349.        (IS_ROCK(room->typ) && levl[u.ux][u.uy].typ == CORR))
  350.         return;
  351.     if((mtmp = m_at(x,y)) && !mtmp->mhide &&
  352.         (!mtmp->minvis || See_invisible)) {
  353. #ifndef NOWORM
  354.         if(m_atseg)
  355.             pwseg(m_atseg);
  356.         else
  357. #endif NOWORM
  358.         pmon(mtmp);
  359.     }
  360.     else if((otmp = o_at(x,y)) && room->typ != POOL)
  361.         atl(x,y,otmp->olet);
  362.     else if(mtmp && (!mtmp->minvis || See_invisible)) {
  363.         /* must be a hiding monster, but not hiding right now */
  364.         /* assume for the moment that long worms do not hide */
  365.         pmon(mtmp);
  366.     }
  367.     else if(g_at(x,y) && room->typ != POOL)
  368.         atl(x,y,'$');
  369.     else if(!room->seen || room->scrsym == ' ') {
  370.         room->new = room->seen = 1;
  371.         newsym(x,y);
  372.         on_scr(x,y);
  373.     }
  374.     room->seen = 1;
  375. }
  376.  
  377. char
  378. news0(x,y)
  379. register xchar x,y;
  380. {
  381.     register struct obj *otmp;
  382.     register struct trap *ttmp;
  383.     struct rm *room;
  384.     register char tmp;
  385.  
  386.     room = &levl[x][y];
  387.     if(!room->seen) tmp = ' ';
  388.     else if(room->typ == POOL) tmp = POOL_SYM;
  389.     else if(!Blind && (otmp = o_at(x,y))) tmp = otmp->olet;
  390.     else if(!Blind && g_at(x,y)) tmp = '$';
  391.     else if(x == xupstair && y == yupstair) tmp = '<';
  392.     else if(x == xdnstair && y == ydnstair) tmp = '>';
  393.     else if((ttmp = t_at(x,y)) && ttmp->tseen) tmp = '^';
  394.     else switch(room->typ) {
  395.     case SCORR:
  396.     case SDOOR:
  397.         tmp = room->scrsym;    /* %% wrong after killing mimic ! */
  398.         break;
  399. #ifdef DGK
  400.     case HWALL:
  401.         tmp = room->scrsym;    /* OK for corners only */
  402.         if (!IS_CORNER(tmp))
  403.             tmp = symbol.hwall;
  404.         break;
  405.     case VWALL:
  406.         tmp = symbol.vwall;
  407.         break;
  408.     case LDOOR:
  409.     case DOOR:
  410.         tmp = symbol.door;
  411.         break;
  412.     case CORR:
  413.         tmp = symbol.corr;
  414.         break;
  415.     case ROOM:
  416.         if(room->lit || cansee(x,y) || Blind) tmp = symbol.room;
  417.         else tmp = ' ';
  418.         break;
  419. #else
  420.     case HWALL:
  421.         tmp = '-';
  422.         break;
  423.     case VWALL:
  424.         tmp = '|';
  425.         break;
  426.     case LDOOR:
  427.     case DOOR:
  428.         tmp = '+';
  429.         break;
  430.     case CORR:
  431.         tmp = CORR_SYM;
  432.         break;
  433.     case ROOM:
  434.         if(room->lit || cansee(x,y) || Blind) tmp = '.';
  435.         else tmp = ' ';
  436.         break;
  437. #endif DGK
  438. /*
  439.     case POOL:
  440.         tmp = POOL_SYM;
  441.         break;
  442. */
  443.     default:
  444.         tmp = ERRCHAR;
  445.     }
  446.     return(tmp);
  447. }
  448.  
  449. newsym(x,y)
  450. register x,y;
  451. {
  452.     atl(x,y,news0(x,y));
  453. }
  454.  
  455. /* used with wand of digging (or pick-axe): fill scrsym and force display */
  456. /* also when a POOL evaporates */
  457. mnewsym(x,y)
  458. register x,y;
  459. {
  460.     register struct rm *room;
  461.     char newscrsym;
  462.  
  463.     if(!vism_at(x,y)) {
  464.         room = &levl[x][y];
  465.         newscrsym = news0(x,y);
  466.         if(room->scrsym != newscrsym) {
  467.             room->scrsym = newscrsym;
  468.             room->seen = 0;
  469.         }
  470.     }
  471. }
  472.  
  473. nosee(x,y)
  474. register x,y;
  475. {
  476.     register struct rm *room;
  477.  
  478.     if(!isok(x,y)) return;
  479.     room = &levl[x][y];
  480. #ifdef DGK
  481.     if(room->scrsym == symbol.room && !room->lit && !Blind) {
  482. #else
  483.     if(room->scrsym == '.' && !room->lit && !Blind) {
  484. #endif DGK
  485.         room->scrsym = ' ';
  486.         room->new = 1;
  487.         on_scr(x,y);
  488.     }
  489. }
  490.  
  491. #ifndef QUEST
  492. prl1(x,y)
  493. register x,y;
  494. {
  495.     if(u.dx) {
  496.         if(u.dy) {
  497.             prl(x-(2*u.dx),y);
  498.             prl(x-u.dx,y);
  499.             prl(x,y);
  500.             prl(x,y-u.dy);
  501.             prl(x,y-(2*u.dy));
  502.         } else {
  503.             prl(x,y-1);
  504.             prl(x,y);
  505.             prl(x,y+1);
  506.         }
  507.     } else {
  508.         prl(x-1,y);
  509.         prl(x,y);
  510.         prl(x+1,y);
  511.     }
  512. }
  513.  
  514. nose1(x,y)
  515. register x,y;
  516. {
  517.     if(u.dx) {
  518.         if(u.dy) {
  519.             nosee(x,u.uy);
  520.             nosee(x,u.uy-u.dy);
  521.             nosee(x,y);
  522.             nosee(u.ux-u.dx,y);
  523.             nosee(u.ux,y);
  524.         } else {
  525.             nosee(x,y-1);
  526.             nosee(x,y);
  527.             nosee(x,y+1);
  528.         }
  529.     } else {
  530.         nosee(x-1,y);
  531.         nosee(x,y);
  532.         nosee(x+1,y);
  533.     }
  534. }
  535. #endif QUEST
  536.  
  537. vism_at(x,y)
  538. register x,y;
  539. {
  540.     register struct monst *mtmp;
  541.  
  542.     return((x == u.ux && y == u.uy && !Invisible)
  543.             ? 1 :
  544.            (mtmp = m_at(x,y))
  545.             ? ((Blind && Telepat) || canseemon(mtmp)) :
  546.         0);
  547. }
  548.  
  549. #ifdef NEWSCR
  550. pobj(obj) register struct obj *obj; {
  551. register int show = (!obj->oinvis || See_invisible) &&
  552.         cansee(obj->ox,obj->oy);
  553.     if(obj->odispl){
  554.         if(obj->odx != obj->ox || obj->ody != obj->oy || !show)
  555.         if(!vism_at(obj->odx,obj->ody)){
  556.             newsym(obj->odx, obj->ody);
  557.             obj->odispl = 0;
  558.         }
  559.     }
  560.     if(show && !vism_at(obj->ox,obj->oy)){
  561.         atl(obj->ox,obj->oy,obj->olet);
  562.         obj->odispl = 1;
  563.         obj->odx = obj->ox;
  564.         obj->ody = obj->oy;
  565.     }
  566. }
  567. #endif NEWSCR
  568.  
  569. unpobj(obj) register struct obj *obj; {
  570. /*     if(obj->odispl){
  571.         if(!vism_at(obj->odx, obj->ody))
  572.             newsym(obj->odx, obj->ody);
  573.         obj->odispl = 0;
  574.     }
  575. */
  576.     if(!vism_at(obj->ox,obj->oy))
  577.         newsym(obj->ox,obj->oy);
  578. }
  579.  
  580. seeobjs(){
  581. register struct obj *obj, *obj2;
  582.     for(obj = fobj; obj; obj = obj2) {
  583.         obj2 = obj->nobj;
  584.         if(obj->olet == FOOD_SYM && obj->otyp >= CORPSE
  585.             && obj->age + 250 < moves)
  586.                 delobj(obj);
  587.     }
  588.     for(obj = invent; obj; obj = obj2) {
  589.         obj2 = obj->nobj;
  590.         if(obj->olet == FOOD_SYM && obj->otyp >= CORPSE
  591.             && obj->age + 250 < moves)
  592.                 useup(obj);
  593.     }
  594. }
  595.  
  596. seemons(){
  597. register struct monst *mtmp;
  598.     for(mtmp = fmon; mtmp; mtmp = mtmp->nmon){
  599.         if(mtmp->data->mlet == ';')
  600.             mtmp->minvis = (u.ustuck != mtmp &&
  601.                     levl[mtmp->mx][mtmp->my].typ == POOL);
  602.         pmon(mtmp);
  603. #ifndef NOWORM
  604.         if(mtmp->wormno) wormsee(mtmp->wormno);
  605. #endif NOWORM
  606.     }
  607. }
  608.  
  609. pmon(mon) register struct monst *mon; {
  610. register int show = (Blind && Telepat) || canseemon(mon);
  611.     if(mon->mdispl){
  612.         if(mon->mdx != mon->mx || mon->mdy != mon->my || !show)
  613.             unpmon(mon);
  614.     }
  615.     if(show && !mon->mdispl){
  616.         atl(mon->mx,mon->my,
  617.          (!mon->mappearance
  618.           || u.uprops[PROP(RIN_PROTECTION_FROM_SHAPE_CHANGERS)].p_flgs
  619.          ) ? mon->data->mlet : mon->mappearance);
  620.         mon->mdispl = 1;
  621.         mon->mdx = mon->mx;
  622.         mon->mdy = mon->my;
  623.     }
  624. }
  625.  
  626. unpmon(mon) register struct monst *mon; {
  627.     if(mon->mdispl){
  628.         newsym(mon->mdx, mon->mdy);
  629.         mon->mdispl = 0;
  630.     }
  631. }
  632.  
  633. nscr()
  634. {
  635.     register x,y;
  636.     register struct rm *room;
  637.  
  638.     if(u.uswallow || u.ux == FAR || flags.nscrinh) return;
  639.     pru();
  640.     for(y = scrly; y <= scrhy; y++)
  641.         for(x = scrlx; x <= scrhx; x++)
  642.             if((room = &levl[x][y])->new) {
  643.                 room->new = 0;
  644.                 at(x,y,room->scrsym);
  645.             }
  646.     scrhx = scrhy = 0;
  647.     scrlx = COLNO;
  648.     scrly = ROWNO;
  649. }
  650.  
  651. /* 100 suffices for bot(); no relation with COLNO */
  652. char oldbot[100], newbot[100];
  653. cornbot(lth)
  654. register int lth;
  655. {
  656.     if(lth < sizeof(oldbot)) {
  657.         oldbot[lth] = 0;
  658.         flags.botl = 1;
  659.     }
  660. }
  661.  
  662. bot()
  663. {
  664. register char *ob = oldbot, *nb = newbot;
  665. register int i;
  666. extern char *eos();
  667.     if(flags.botlx) *ob = 0;
  668.     flags.botl = flags.botlx = 0;
  669. #define GOLD_ON_BOTL
  670. #ifdef GOLD_ON_BOTL
  671.     (void) sprintf(newbot,
  672.         "Level %-2d  Gold %-5lu  Hp %3d(%d)  Ac %-2d  Str ",
  673.         dlevel, u.ugold, u.uhp, u.uhpmax, u.uac);
  674. #else
  675.     (void) sprintf(newbot,
  676.         "Level %-2d   Hp %3d(%d)   Ac %-2d   Str ",
  677.         dlevel,  u.uhp, u.uhpmax, u.uac);
  678. #endif GOLD_ON_BOTL
  679.     if(u.ustr>18) {
  680.         if(u.ustr>117)
  681.         (void) strcat(newbot,"18/**");
  682.         else
  683.         (void) sprintf(eos(newbot), "18/%02d",u.ustr-18);
  684.     } else
  685.         (void) sprintf(eos(newbot), "%-2d   ",u.ustr);
  686. #ifdef EXP_ON_BOTL
  687.     (void) sprintf(eos(newbot), "  Exp %2d/%-5lu ", u.ulevel,u.uexp);
  688. #else
  689.     (void) sprintf(eos(newbot), "   Exp %2u  ", u.ulevel);
  690. #endif EXP_ON_BOTL
  691.     (void) strcat(newbot, hu_stat[u.uhs]);
  692.     if(flags.time)
  693.         (void) sprintf(eos(newbot), "  %ld", moves);
  694.     if(strlen(newbot) >= COLNO) {
  695.         register char *bp0, *bp1;
  696.         bp0 = bp1 = newbot;
  697.         do {
  698.             if(*bp0 != ' ' || bp0[1] != ' ' || bp0[2] != ' ')
  699.                 *bp1++ = *bp0;
  700.         } while(*bp0++);
  701.     }
  702.     for(i = 1; i<COLNO; i++) {
  703.         if(*ob != *nb){
  704.             curs(i,ROWNO+2);
  705.             (void) putchar(*nb ? *nb : ' ');
  706.             curx++;
  707.         }
  708.         if(*ob) ob++;
  709.         if(*nb) nb++;
  710.     }
  711.     (void) strcpy(oldbot, newbot);
  712. }
  713.  
  714. #ifdef WAN_PROBING
  715. mstatusline(mtmp) register struct monst *mtmp; {
  716.     pline("Status of %s: ", monnam(mtmp));
  717.     pline("Level %-2d  Gold %-5lu  Hp %3d(%d)  Ac %-2d  Dam %d",
  718.         mtmp->data->mlevel, mtmp->mgold, mtmp->mhp, mtmp->mhpmax,
  719.         mtmp->data->ac, (mtmp->data->damn + 1) * (mtmp->data->damd + 1));
  720. }
  721. #endif WAN_PROBING
  722.  
  723. cls(){
  724.     if(flags.toplin == 1)
  725.         more();
  726.     flags.toplin = 0;
  727.  
  728.     clear_screen();
  729.  
  730.     flags.botlx = 1;
  731. }
  732.