diff --git a/io.c b/io.c index 921efe4..3614f54 100644 --- a/io.c +++ b/io.c @@ -5840,6 +5840,14 @@ void dolook(cell_t *where, int onpurpose) { } } +void lfstatheading(char *headstr, int offset) { + char buf[BUFLEN]; + snprintf(buf, BUFLEN, "%s%s", headstr, offset ? " (continued)" : ""); + wattron(mainwin, A_UNDERLINE); + centre(mainwin, C_WHITE, 0, "SKILLS"); + wattroff(mainwin, A_UNDERLINE); +} + char *makedesc_god(lifeform_t *god, char *retbuf) { char thisline[BUFLEN]; char godname[BUFLEN]; @@ -6109,12 +6117,13 @@ char *makedesc_job(job_t *j, char *retbuf) { strcpy(thisline, ""); for (sk = firstskill ; sk ; sk = sk->next) { - char lev[BUFLEN]; + char *lev = NULL; enum SKILLLEVEL slev = PR_INEPT; - strcpy(lev, ""); f = hasflagval(j->flags, F_STARTSKILL, sk->id, NA, NA, NULL); if (f) { slev = f->val[1]; + lev = getskilllevelabbr(slev); + /* switch (slev) { case PR_INEPT: strcpy(lev, "---"); break; case PR_NOVICE: strcpy(lev, "Nov"); break; @@ -6124,8 +6133,9 @@ char *makedesc_job(job_t *j, char *retbuf) { case PR_EXPERT: strcpy(lev, "Exp"); break; case PR_MASTER: strcpy(lev, "Mst"); break; } + */ } - if (strlen(lev)) { + if (lev) { char *p; char buf[BUFLEN]; //char bufpad[BUFLEN]; @@ -8785,6 +8795,7 @@ void dooptions(void) { char part1[BUFLEN]; char promptstr[BUFLEN],cmdchars[BUFLENSMALL]; char ch; + int headinglines = 2; int y,h,done = B_FALSE; option_t *opt; @@ -8804,7 +8815,7 @@ void dooptions(void) { while (!done) { cls(); centre(mainwin,C_WHITE, 0, "OPTIONS"); - y = 2; + y = headinglines; ch = '\0'; for (opt = firstoption ; opt ; opt = opt->next) { sprintf(part1, "%c - %s", opt->letter, opt->text); @@ -8812,9 +8823,10 @@ void dooptions(void) { if (opt->enabled == opt->def) strcat(buf, " (default)"); wmove(mainwin, y, 0); textwithcol(mainwin, buf); - if (opt->next && downline(&y, h, "INVENTORY", NULL, promptstr, cmdchars, &ch)) { + if (opt->next && downline(&y, h, headinglines, NULL)) { + //finished = B_TRUE; break; - } + } } if (!ch) { centre(mainwin, C_WHITE, h-1, promptstr); @@ -9578,18 +9590,21 @@ int dothrow(obpile_t *op, object_t *o) { return B_TRUE; } -// returns TRUE if escape pressed -int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, char *cmdchars, char *retchar) { - char headbuf[BUFLEN]; - int ch; +// returns TRUE if we hit the bottom of the screen. +int downline(int *y, int h, int headinglines, int *nextoffset) { int w; w = getmaxx(mainwin); + /* + // this is the heading we'll print after going past the 'MORE' strong snprintf(headbuf, w-1, "%s (continued)", heading); + (*y)++; + // are we aff the bottom of the screen? if (*y >= (h-3)) { + // prompt to press a key centre(mainwin,C_WHITE, h-2, MORESTRING); - if (bottomstring) { + if (bottomstring) { // show extra prompt if required. centre(mainwin, C_WHITE, h-1, bottomstring); } ch = getch(); @@ -9601,6 +9616,7 @@ int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, return B_TRUE; } + // clear screen and print the heading cls(); *y = 0; centre(mainwin, C_WHITE, *y, headbuf); @@ -9611,6 +9627,17 @@ int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, } } return B_FALSE; +*/ + + (*y)++; + // are we aff the bottom of the screen? + if (*y >= (h-3)) { + if (nextoffset) *nextoffset = *y - headinglines - 2; + return B_TRUE; + } else { + if (nextoffset) *nextoffset = 0; + } + return B_FALSE; } @@ -12269,6 +12296,7 @@ void showlfarmour(lifeform_t *lf) { void showlfstats(lifeform_t *lf, int showall) { int y = 0, y2 = 0, x2 = 40; int startx,starty; + int headinglines = 2; int x; int arating, evasion; int acc; @@ -12295,14 +12323,14 @@ void showlfstats(lifeform_t *lf, int showall) { obpile_t *op = NULL; char ch; char mode = '@'; - char promptstr[BUFLEN]; + char promptstr[BUFLEN],navstr[BUFLEN]; char cmdchars[BUFLEN]; int done = B_FALSE; enum SKILLLEVEL lorelev; enum COLOUR lorecol; int min,max; flag_t *retflag[MAXCANDIDATES]; - int nretflags; + int nretflags,offset = 0, nextoffset = 0; h = getmaxy(mainwin); @@ -12325,29 +12353,6 @@ void showlfstats(lifeform_t *lf, int showall) { showall = B_TRUE; } - if (isplayer(lf) || showall) { - snprintf(promptstr, BUFLEN, "^h[^W@^n=stats ^WS^nkills ^WA^nbils ^WM^nagic ^WE^nffects %s%s^W?^n=describe ^WESC^n=quit^h]", - isplayer(lf) ? "^WG^nods " : "", - isplayer(lf) ? "" : "^WI^ntems " ); - snprintf(cmdchars, BUFLEN, "@asme%s%s",isplayer(lf) ? "g" : "", isplayer(lf) ? "" : "i"); - } else { - snprintf(cmdchars, BUFLEN, "@e?"); - // can always see stats & effects - snprintf(promptstr, BUFLEN, "^h[^W@^n=stats ^WE^nffects "); - if (!isplayer(lf)) { - snprintf(buf, BUFLEN, "^WI^ntems "); - strcat(promptstr, buf); - strcat(cmdchars, "i"); - } - if ((lorelev >= PR_ADEPT) || (getskill(player, SK_LORE_ARCANA) >= PR_ADEPT)) { - snprintf(buf, BUFLEN, "^WM^nagic "); - strcat(promptstr, buf); - strcat(cmdchars, "m"); - } - snprintf(buf, BUFLEN, "^W?^n=describe ^WESC^n=quit]"); - strcat(promptstr, buf); - } - while (!done) { cls(); y = 0; @@ -12366,10 +12371,10 @@ void showlfstats(lifeform_t *lf, int showall) { } wattroff(mainwin, A_UNDERLINE); x = 0; - centre(mainwin, C_MAGENTA, 1, "[Press ? for a full description]"); - y = 2; - y2 = 2; + //centre(mainwin, C_MAGENTA, 1, "[Press ? for a full description]"); + y = headinglines; + y2 = headinglines; dammod = getstrdammod(lf); //accmod = getstatmod(lf, A_AGI); @@ -13295,58 +13300,63 @@ void showlfstats(lifeform_t *lf, int showall) { wrapprint(mainwin, &y, &x, 0, "Nothing obvious."); } } else if (mode == 'a') { + int count = 0; wattron(mainwin, A_UNDERLINE); centre(mainwin, C_WHITE, 0, "ABILITIES"); wattroff(mainwin, A_UNDERLINE); - y = 2; + y = headinglines; for (ot = objecttype ; ot ; ot = ot->next) { f = lfhasknownflagval(lf, F_CANWILL, ot->id, NA, NA, NULL); if (f && (f->known)) { - char expirebuf[BUFLEN]; - char eb2[BUFLEN],racestr[BUFLEN]; - int needgrab = B_FALSE; - int range; - - if (f->val[2] == NA) { - snprintf(expirebuf, BUFLEN, "at will"); - } else { - snprintf(expirebuf, BUFLEN, "every %d turn%s",f->val[2], - (f->val[2] == 1) ? "" : "s"); - } + if (count >= offset) { + char expirebuf[BUFLEN]; + char eb2[BUFLEN],racestr[BUFLEN]; + int needgrab = B_FALSE; + int range; + + if (f->val[2] == NA) { + snprintf(expirebuf, BUFLEN, "at will"); + } else { + snprintf(expirebuf, BUFLEN, "every %d turn%s",f->val[2], + (f->val[2] == 1) ? "" : "s"); + } - // extra options? - texttospellopts(f->text, "needgrab:", &needgrab, "range:", &range, "race:", racestr, NULL); - if (needgrab) { - strcat(expirebuf, ",after grab"); - } - if (range) { - char rbuf[BUFLEN]; - snprintf(rbuf, BUFLEN, ",range:%d",range); - strcat(expirebuf, rbuf); - } - if (strlen(racestr)) { - char rbuf[BUFLEN]; - snprintf(rbuf, BUFLEN, ",race:%s",racestr); - strcat(expirebuf, rbuf); - } + // extra options? + texttospellopts(f->text, "needgrab:", &needgrab, "range:", &range, "race:", racestr, NULL); + if (needgrab) { + strcat(expirebuf, ",after grab"); + } + if (range) { + char rbuf[BUFLEN]; + snprintf(rbuf, BUFLEN, ",range:%d",range); + strcat(expirebuf, rbuf); + } + if (strlen(racestr)) { + char rbuf[BUFLEN]; + snprintf(rbuf, BUFLEN, ",race:%s",racestr); + strcat(expirebuf, rbuf); + } - if (strlen(expirebuf)) { - snprintf(eb2, BUFLEN,"(%s)",expirebuf); - } else { - strcpy(eb2, ""); - } - setcol(mainwin, C_GREEN); - snprintf(buf, BUFLEN, "%-12s", ot->name); - mvwprintw(mainwin, y, 0, buf); - unsetcol(mainwin, C_GREEN); + if (strlen(expirebuf)) { + snprintf(eb2, BUFLEN,"(%s)",expirebuf); + } else { + strcpy(eb2, ""); + } + setcol(mainwin, C_GREEN); + snprintf(buf, BUFLEN, "%-12s", ot->name); + mvwprintw(mainwin, y, 0, buf); + unsetcol(mainwin, C_GREEN); - snprintf(buf, BUFLEN, "%s%s", ot->desc, eb2); - wprintw(mainwin, buf); + snprintf(buf, BUFLEN, "%s%s", ot->desc, eb2); + wprintw(mainwin, buf); - if (downline(&y, h, "ABILITIES", NULL, promptstr, cmdchars, &ch)) { - break; + if (downline(&y, h, headinglines, &nextoffset)) { + nextoffset += offset; + break; + } } + count++; } } y++; @@ -13356,13 +13366,13 @@ void showlfstats(lifeform_t *lf, int showall) { enum SKILLLEVEL slev; skill_t *sk; int finished = B_FALSE,dounknown; + int count = 0; - wattron(mainwin, A_UNDERLINE); - centre(mainwin, C_WHITE, 0, "SKILLS"); - wattroff(mainwin, A_UNDERLINE); - - y = 2; + lfstatheading("SKILLS", offset); +//ooooooo start of skills + y = headinglines; + // construct headings snprintf(skilltitle, BUFLEN, "%-21s"," "); for (i = PR_NOVICE; i <= PR_MASTER; i++) { char toadd[BUFLEN], *sn; @@ -13383,7 +13393,8 @@ void showlfstats(lifeform_t *lf, int showall) { } doheading(mainwin, &y, 0, skilltitle); - // for each skill... + // go through and list each skill, known ones first. + count = 0; for (dounknown = 0; dounknown <= 1; dounknown++) { for (sk = firstskill ; sk ; sk = sk->next) { char thisline[BUFLEN]; @@ -13391,76 +13402,109 @@ void showlfstats(lifeform_t *lf, int showall) { slev = getskill(lf, sk->id); if (!dounknown && (slev != PR_INEPT)) { - char endbit[BUFLEN]; - char basecolour = 'n'; - int max; - if (ismaxedskill(lf, sk->id)) { - basecolour = 'h'; - } - // known skill - sprintf(thisline, "^%c%-21s^%c[^%d", basecolour, sk->name, basecolour, - getskilllevelcolour(slev)); - max = getmaxskilllevel(player, sk->id); - for (i = PR_NOVICE; i <= PR_MASTER; i++) { - char toadd[BUFLEN]; - - /*if (i == (max+1)) { - sprintf(toadd, "^n]########"); - } else if (i > max) { - sprintf(toadd, "^n#########"); - } else*/ - if (i <= max) { - if (i == slev) { - if (ismaxedskill(lf, sk->id)) { - sprintf(toadd, "*********"); + if (count >= offset) { + char endbit[BUFLEN]; + char basecolour = 'n'; + int max; + if (ismaxedskill(lf, sk->id)) { + basecolour = 'h'; + } + // known skill + sprintf(thisline, "^%c%-21s^%c[^%d", basecolour, sk->name, basecolour, + getskilllevelcolour(slev)); + max = getmaxskilllevel(player, sk->id); + for (i = PR_NOVICE; i <= PR_MASTER; i++) { + char toadd[BUFLEN]; + + /*if (i == (max+1)) { + sprintf(toadd, "^n]########"); + } else if (i > max) { + sprintf(toadd, "^n#########"); + } else*/ + if (i <= max) { + if (i == slev) { + char blank[2],endchar[2]; + int n,blanklen; + char *sn; + sn = getskilllevelabbr(slev); + if (ismaxedskill(lf, sk->id)) { + strcpy(blank, "*"); + strcpy(endchar, "*"); + blanklen = 7 - strlen(sn); + } else { + strcpy(blank, "="); + strcpy(endchar, "|"); + blanklen = 7 - strlen(sn); + } + + strcpy(toadd,""); + for (n = 0; n < blanklen; n++) { + strncat(toadd, blank, BUFLEN); + } + strncat(toadd, sn, BUFLEN); + strncat(toadd, blank, BUFLEN); + strncat(toadd, endchar, BUFLEN); + + /* + if (ismaxedskill(lf, sk->id)) { + sprintf(toadd, "*********"); + } else { + sprintf(toadd, "========|"); + } + */ + } else if (i < slev) { + if (ismaxedskill(lf, sk->id)) { + sprintf(toadd, "*********"); + } else { + sprintf(toadd, "========="); + } } else { - sprintf(toadd, "========|"); + sprintf(toadd, "^n........."); } - } else if (i < slev) { - if (ismaxedskill(lf, sk->id)) { - sprintf(toadd, "*********"); - } else { - sprintf(toadd, "========="); - } - } else { - sprintf(toadd, "^n........."); + strcat(thisline, toadd); } - strcat(thisline, toadd); } + sprintf(endbit, "^%c]^n",basecolour); + strcat(thisline, endbit); + wmove(mainwin, y, 0); + textwithcol(mainwin, thisline); + printed = B_TRUE; } - sprintf(endbit, "^%c]^n",basecolour); - strcat(thisline, endbit); - wmove(mainwin, y, 0); - textwithcol(mainwin, thisline); - printed = B_TRUE; + + count++; } else if (dounknown && !slev && lfhasflagval(lf, F_CANLEARN, sk->id, NA, NA, NULL)) { - char toadd[BUFLEN]; - int max; - // learnable skill - sprintf(toadd, "^B%-21s[", sk->name ); - wmove(mainwin, y, 0); - textwithcol(mainwin, toadd); - max = getmaxskilllevel(player, sk->id); - for (i = PR_NOVICE; i <= PR_MASTER; i++) { - /* - if (i == max+1) { - textwithcol(mainwin, "^B]########"); - } else if (i > max) { - textwithcol(mainwin, "^B#########"); - } else { - wprintw(mainwin, " "); - } - */ - if (i <= max) { - textwithcol(mainwin, "^B........."); + if (count >= offset) { + char toadd[BUFLEN]; + int max; + // learnable skill + sprintf(toadd, "^B%-21s[", sk->name ); + wmove(mainwin, y, 0); + textwithcol(mainwin, toadd); + max = getmaxskilllevel(player, sk->id); + for (i = PR_NOVICE; i <= PR_MASTER; i++) { + /* + if (i == max+1) { + textwithcol(mainwin, "^B]########"); + } else if (i > max) { + textwithcol(mainwin, "^B#########"); + } else { + wprintw(mainwin, " "); + } + */ + if (i <= max) { + textwithcol(mainwin, "^B........."); + } } + textwithcol(mainwin, "^B]^n"); + printed = B_TRUE; } - textwithcol(mainwin, "^B]^n"); - printed = B_TRUE; + + count++; } if (printed) { - if (downline(&y, h, "SKILLS", skilltitle, promptstr, cmdchars, &ch)) { + if (downline(&y, h, headinglines, &nextoffset)) { + nextoffset += offset; finished = B_TRUE; break; } @@ -13468,11 +13512,13 @@ void showlfstats(lifeform_t *lf, int showall) { } if (finished) break; } +//oooooooooooo end of skills oooooooooo } else if (mode == 'm') { char subheading[BUFLEN]; int lev; int anyfound; int exitnow = B_FALSE; + int count = 0; snprintf(subheading, BUFLEN, " %-4s%-26s%-15s%-13s%s","Lv","Spell", "School", "Power", "Cost"); @@ -13489,68 +13535,72 @@ void showlfstats(lifeform_t *lf, int showall) { if (thislev == lev) { f = lfhasknownflagval(lf, F_CANCAST, ot->id, NA, NA, NULL); if (f && (f->known)) { - char spellname[BUFLEN]; - char mpbuf[BUFLEN]; - char powerbuf[BUFLEN]; - int power; - int mpcost; - int castable = B_TRUE; - int atwill = B_FALSE; + if (count >= offset) { + char spellname[BUFLEN]; + char mpbuf[BUFLEN]; + char powerbuf[BUFLEN]; + int power; + int mpcost; + int castable = B_TRUE; + int atwill = B_FALSE; - // power - power = getspellpower(lf, ot->id); - snprintf(powerbuf, BUFLEN, "["); - for (i = 0; i < power; i++) { - strcat(powerbuf, "#"); - } - for (i = 0; i < (getspellmaxpower(ot->id) - power); i++) { - strcat(powerbuf, "-"); - } - strcat(powerbuf, "]"); + // power + power = getspellpower(lf, ot->id); + snprintf(powerbuf, BUFLEN, "["); + for (i = 0; i < power; i++) { + strcat(powerbuf, "#"); + } + for (i = 0; i < (getspellmaxpower(ot->id) - power); i++) { + strcat(powerbuf, "-"); + } + strcat(powerbuf, "]"); - // mp cost - if (f->id == F_CANWILL) { - mpcost = 0; + // mp cost + if (f->id == F_CANWILL) { + mpcost = 0; - if (f->val[2] == NA) { - snprintf(mpbuf, BUFLEN, "At will"); + if (f->val[2] == NA) { + snprintf(mpbuf, BUFLEN, "At will"); + } else { + snprintf(mpbuf, BUFLEN, "At will, every %d turn%s",f->val[2], + (f->val[2] == 1) ? "" : "s"); + } + atwill = B_TRUE; } else { - snprintf(mpbuf, BUFLEN, "At will, every %d turn%s",f->val[2], - (f->val[2] == 1) ? "" : "s"); + mpcost = getmpcost(lf, ot->id); + if (mpcost) { + getspellcosttext(lf, ot->id, power, mpbuf); + } else { + snprintf(mpbuf, BUFLEN, "At will"); + } } - atwill = B_TRUE; - } else { - mpcost = getmpcost(lf, ot->id); - if (mpcost) { - getspellcosttext(lf, ot->id, power, mpbuf); - } else { - snprintf(mpbuf, BUFLEN, "At will"); - } - } - if (!atwill) { - if ((mpcost > getmaxmp(lf)) || (power <= 0)) { - castable = B_FALSE; + if (!atwill) { + if ((mpcost > getmaxmp(lf)) || (power <= 0)) { + castable = B_FALSE; + } } - } - - getspellname(ot->id, lf, spellname, B_FALSE); - if (castable || !isplayer(lf)) setcol(mainwin, C_GREEN); - else setcol(mainwin, C_RED); - snprintf(buf, BUFLEN, " %-4d%-26s%-15s%-13s%s",thislev, spellname, getschoolnameshort(getspellschoolknown(lf, ot->id)), powerbuf, mpbuf); - mvwprintw(mainwin, y, 0, "%s\n", buf); - if (castable || !isplayer(lf)) unsetcol(mainwin, C_GREEN); - else unsetcol(mainwin, C_RED); - anyfound = B_TRUE; - if (downline(&y, h, "MAGIC", subheading, promptstr, cmdchars, &ch)) { - exitnow = B_TRUE; - break; - } + + getspellname(ot->id, lf, spellname, B_FALSE); + if (castable || !isplayer(lf)) setcol(mainwin, C_GREEN); + else setcol(mainwin, C_RED); + snprintf(buf, BUFLEN, " %-4d%-26s%-15s%-13s%s",thislev, spellname, getschoolnameshort(getspellschoolknown(lf, ot->id)), powerbuf, mpbuf); + mvwprintw(mainwin, y, 0, "%s\n", buf); + if (castable || !isplayer(lf)) unsetcol(mainwin, C_GREEN); + else unsetcol(mainwin, C_RED); + anyfound = B_TRUE; + if (downline(&y, h, headinglines, &nextoffset)) { + nextoffset += offset; + exitnow = B_TRUE; + break; + } + } // end if count >= offset + count++; } } } - } + } // end foreach obtype } if (!anyfound) { mvwprintw(mainwin, y, 0, "%s cannot cast any spells.", you(lf)); @@ -13643,7 +13693,6 @@ void showlfstats(lifeform_t *lf, int showall) { } } - // spells nfound = 0; for (f = lf->flags->first ; f ; f = f->next) { @@ -14766,7 +14815,7 @@ void showlfstats(lifeform_t *lf, int showall) { } wattroff(mainwin, A_UNDERLINE); - y = 2; + y = headinglines; if ((lf == player) && lfhasflag(lf, F_NOPACK)) { mvwprintw(mainwin, y, 0, "It cannot carry anything."); } else if (countobs(lf->pack, B_FALSE)) { @@ -14790,7 +14839,8 @@ void showlfstats(lifeform_t *lf, int showall) { mvwprintw(mainwin, y, 0, "%s", buf); - if (o->next && downline(&y, h, "INVENTORY", NULL, promptstr, cmdchars, &ch)) { + if (o->next && downline(&y, h, headinglines, &nextoffset)) { + nextoffset += offset; break; } } @@ -14805,7 +14855,7 @@ void showlfstats(lifeform_t *lf, int showall) { wattron(mainwin, A_UNDERLINE); centre(mainwin, C_WHITE, 0, "GODS"); wattroff(mainwin, A_UNDERLINE); - y = 2; + y = headinglines; snprintf(line, BUFLEN, "%-29s Worship? %-22s %s","God","Piety", "Happiness"); @@ -14896,8 +14946,70 @@ void showlfstats(lifeform_t *lf, int showall) { } } - // wait for key + // display the prompt + if (isplayer(lf) || showall) { + snprintf(promptstr, BUFLEN, "^h[^W@^n=stats ^WS^nkills ^WA^nbils ^WM^nagic ^WE^nffects %s%s ^WESC^n=quit^h]", + isplayer(lf) ? "^WG^nods " : "", + isplayer(lf) ? "" : "^WI^ntems " + ); + + snprintf(cmdchars, BUFLEN, "@asme%s%s",isplayer(lf) ? "g" : "", isplayer(lf) ? "" : "i"); + } else { + snprintf(cmdchars, BUFLEN, "@e"); + // can always see stats & effects + snprintf(promptstr, BUFLEN, "^h[^W@^n=stats ^WE^nffects "); + if (!isplayer(lf)) { + snprintf(buf, BUFLEN, "^WI^ntems "); + strcat(promptstr, buf); + strcat(cmdchars, "i"); + } + if ((lorelev >= PR_ADEPT) || (getskill(player, SK_LORE_ARCANA) >= PR_ADEPT)) { + snprintf(buf, BUFLEN, "^WM^nagic "); + strcat(promptstr, buf); + strcat(cmdchars, "m"); + } + + snprintf(buf, BUFLEN, "^WESC^n=quit]"); + strcat(promptstr, buf); + } + + switch (mode) { + case 'g': // help on gods + case 's': // help on skills + case '@': // help on current race + strcat(cmdchars, "?"); + default: + break; + } + + // are there other pages to go to (or go back to)? + strcpy(navstr, ""); + if (nextoffset) { + strcat(cmdchars, "']}"); + if (offset) { + strcat(cmdchars, "[{"); + } + snprintf(buf, BUFLEN, "^W'^n=next page %s^W]^n=forward %s^W}^n=pgdn", + (offset) ? "^W[^n=back " : "", + (offset) ? "^W{^n=pgup " : ""); + + strncat(navstr, buf, BUFLEN); + } else if (offset) { + strcat(cmdchars, "'[{"); + snprintf(buf, BUFLEN, "^W'^n=back to start ^W[^n=back ^W{^n=pgup"); + strncat(navstr, buf, BUFLEN); + } + if (strlen(navstr)) { + centre(mainwin, C_GREY, h-3, "(%s)", navstr); + } + + if (strchr(cmdchars, '?')) { + centre(mainwin, C_MAGENTA, 1, "[Press ? for a full description]"); + } + centre(mainwin, C_WHITE, h-1, promptstr); + + // wait for key if (ch == '\0') { ch = getch(); } @@ -14918,6 +15030,34 @@ void showlfstats(lifeform_t *lf, int showall) { case 's': case 'i': mode = ch; + offset = 0; + nextoffset = 0; + break; + case '\'': + // go to next page, or back to start + if (nextoffset) { + offset = nextoffset; + } else { + offset = 0; + } + break; + case ']': + // go forward one line + offset++; + break; + case '[': + // go back one line + offset--; + break; + case '}': + // go forward one page + offset += 18; + limit (&offset, NA, nextoffset); + break; + case '{': + // go back one page + offset -= 18; + limit (&offset, 0, NA); break; case '?': if (mode == 'g') { // help on gods diff --git a/io.h b/io.h index 8494d92..3c63cd7 100644 --- a/io.h +++ b/io.h @@ -87,7 +87,8 @@ int dotakeoff(obpile_t *op); int dothrow(obpile_t *op, object_t *o); int dowear(obpile_t *op); int doweild(obpile_t *op); -int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, char *cmdchars, char *retchar); +//int downline(int *y, int h, char *heading, char *subheading, char *bottomstring, char *cmdchars, char *retchar); +int downline(int *y, int h, int headinglines, int *nextoffset); void drawbar(WINDOW *win, char *title, int cur, int max, int realmax, int lossamt, enum COLOUR textcol, enum COLOUR textcolwithbg, int barbg, int lossbg); void drawglyph(glyph_t *g, int x, int y); //void drawunviscell(cell_t *cell, int x, int y); @@ -123,6 +124,7 @@ void initgfx(void); void initprompt(prompt_t *p, char *q1); int keycodetokey(int keycode, int escseqok); void listobs(WINDOW *win, object_t **mylist, int *sellist, int *selcount, int firstob, int *counter, int lastline, int *y, char *myletters, int forpickup, int showpoints, object_t *sellshop, enum SHOPACTION sellaction); +void lfstatheading(char *headstr, int offset); char *makedesc_god(lifeform_t *god, char *retbuf); char *makedesc_job(job_t *j, char *retbuf); char *makedesc_ob(object_t *o, char *retbuf); diff --git a/lf.c b/lf.c index 91e8d76..bbc10ac 100644 --- a/lf.c +++ b/lf.c @@ -11496,6 +11496,26 @@ char *getskillname(enum SKILL id) { return "?unknownskill?"; } +char *getskilllevelabbr(enum SKILLLEVEL sl) { + switch (sl) { + case PR_INEPT: + return "---"; + case PR_NOVICE: + return "Nov"; + case PR_BEGINNER: + return "Beg"; + case PR_ADEPT: + return "Adp"; + case PR_SKILLED: + return "Skl"; + case PR_EXPERT: + return "Exp"; + case PR_MASTER: + return "Mst"; + } + return "???"; +} + char *getskilllevelname(enum SKILLLEVEL sl) { switch (sl) { case PR_INEPT: diff --git a/lf.h b/lf.h index 3028935..530e0a0 100644 --- a/lf.h +++ b/lf.h @@ -306,6 +306,7 @@ long getspforpoint(lifeform_t *lf); float getstatmod(lifeform_t *lf, enum ATTRIB att); char *getskilldesc(enum SKILL id ); char *getskillname(enum SKILL id ); +char *getskilllevelabbr(enum SKILLLEVEL sl); char *getskilllevelname(enum SKILLLEVEL sl); int getteachableskills(lifeform_t *teacher, lifeform_t *student, int *info, enum TRADEINFOTYPE *tradetype, int *ninfo ); int gettr(lifeform_t *lf); diff --git a/spell.c b/spell.c index 10bfae2..347602a 100644 --- a/spell.c +++ b/spell.c @@ -15084,8 +15084,9 @@ enum SPELLSCHOOL getspellschoolknown(lifeform_t *lf, enum OBTYPE spellid) { } } - // pick one randomly - thisschool = poss2[rnd(0,nposs2-1)]; + // pick the first one. + //thisschool = poss2[rnd(0,nposs2-1)]; + thisschool = poss2[0]; } else { // if we don't know any of the schools... // just pick the first one.