- [+] hiscores - show "Killed by xxx on level 5 of the dungeons."

- [+] extra suffix text.
    - [+] use two lines for each entry.
    - [+] have to use modified version of wrapprint for this.
        - [+] wrapprint needs a "wrapped_lines_indent_amt" option.
    - [+] this should give exactly 24 lines.
This commit is contained in:
Rob Pearce 2012-02-07 04:26:29 +00:00
parent 24d95368b6
commit 22c316437e
13 changed files with 197 additions and 135 deletions

View File

@ -1980,6 +1980,14 @@ int getextradamwep(object_t *wep, int *dam, enum DAMTYPE *damtype, int *ndam) {
} }
*(damtype + *ndam) = DT_FIRE; *(damtype + *ndam) = DT_FIRE;
(*ndam)++; (*ndam)++;
} else if (f->id == F_HOT) {
if (strlen(f->text)) {
*(dam + *ndam) = roll(f->text);
} else {
*(dam + *ndam) = rolldie(1,2);
}
*(damtype + *ndam) = DT_HEAT;
(*ndam)++;
} else if (f->id == F_FROZEN) { } else if (f->id == F_FROZEN) {
*(dam + *ndam) = rolldie(1,4); *(dam + *ndam) = rolldie(1,4);
*(damtype + *ndam) = DT_COLD; *(damtype + *ndam) = DT_COLD;

Binary file not shown.

10
defs.h
View File

@ -285,6 +285,13 @@ enum RELATIVEDIR {
RD_SIDEWAYS, RD_SIDEWAYS,
}; };
enum REGIONNAMEFORMAT {
RF_SHORT, // %s
RF_WITHLEVEL, // %s (L%d)
RF_LONG, // on level %d of %s
};
enum TURNDIR { enum TURNDIR {
TD_RIGHT, TD_RIGHT,
TD_LEFT TD_LEFT
@ -315,7 +322,7 @@ enum SHOPACTION {
#define SAVEDIR "data" #define SAVEDIR "data"
#define VAULTDIR "data/vaults" #define VAULTDIR "data/vaults"
// rank, score, name, job, killer // rank, score, name, job, killer
#define HISCOREFORMAT "%-5s%-7s%-10s%-23s%s" #define HISCOREFORMAT "%-4s%-7s%-10s%-23s"
// game strings // game strings
#define MORESTRING "--More--" #define MORESTRING "--More--"
@ -2370,6 +2377,7 @@ enum FLAG {
// weapons. // weapons.
F_HOT, // object is very hot to the touch. F_HOT, // object is very hot to the touch.
// v0 = amt of damage to deal if touched while gloveless // v0 = amt of damage to deal if touched while gloveless
// text = amt of extra damage for weapons to deal
F_ENCHANTED, // weapon also deals 'text' extra fire damage F_ENCHANTED, // weapon also deals 'text' extra fire damage
F_HEADLESS, // for corpses. can go on LFs too. F_HEADLESS, // for corpses. can go on LFs too.
F_MASTERWORK, // weps do higher damager, armour protects better F_MASTERWORK, // weps do higher damager, armour protects better

View File

@ -29,7 +29,7 @@ m = mutant
n = small humanoid / nymph / sprite n = small humanoid / nymph / sprite
N = necron N = necron
o = orc o = orc
O = ogre O = monstrous humanoid (ie. ogre)
p = sPirit p = sPirit
P = gastroPod P = gastroPod
q = quadraped q = quadraped

137
io.c
View File

@ -3620,7 +3620,7 @@ void describeob(object_t *o) {
//textwithcol(mainwin, buf2); //textwithcol(mainwin, buf2);
x = 0; y = 2; x = 0; y = 2;
getyx(mainwin, y, x); getyx(mainwin, y, x);
wrapprint(mainwin, &y, &x, "%s", buf2); wrapprint(mainwin, &y, &x, 0, "%s", buf2);
free(buf2); free(buf2);
wrefresh(mainwin); wrefresh(mainwin);
@ -3652,7 +3652,7 @@ void describerace(enum RACE rid) {
makedesc_race(rid, buf2, B_TRUE, B_FALSE); makedesc_race(rid, buf2, B_TRUE, B_FALSE);
//textwithcol(mainwin, buf2); //textwithcol(mainwin, buf2);
getyx(mainwin,y,x); getyx(mainwin,y,x);
ch = wrapprint(mainwin, &y, &x, "%s", buf2); ch = wrapprint(mainwin, &y, &x, 0, "%s", buf2);
free(buf2); free(buf2);
wrefresh(mainwin); wrefresh(mainwin);
@ -5320,6 +5320,11 @@ char *makedesc_ob(object_t *o, char *retbuf) {
sprintf(buf,"@It also inflicts %s extra burning damage.\n", strlen(f->text) ? f->text : "1-4"); sprintf(buf,"@It also inflicts %s extra burning damage.\n", strlen(f->text) ? f->text : "1-4");
strncat(retbuf, buf, HUGEBUFLEN); strncat(retbuf, buf, HUGEBUFLEN);
} }
f = hasflag(o->flags, F_HOT);
if (f) {
sprintf(buf,"@It also inflicts %s extra burning damage.\n", strlen(f->text) ? f->text : "1-2");
strncat(retbuf, buf, HUGEBUFLEN);
}
f = hasflag(o->flags, F_FROZEN); f = hasflag(o->flags, F_FROZEN);
if (f) { if (f) {
sprintf(buf,"@It also inflicts %s extra cold damage.\n", strlen(f->text) ? f->text : "1-4"); sprintf(buf,"@It also inflicts %s extra cold damage.\n", strlen(f->text) ? f->text : "1-4");
@ -8773,7 +8778,7 @@ char getchoicestr(prompt_t *prompt, int useshortcuts, int showallatstart) {
if (showall) y++; if (showall) y++;
wmove(mainwin, y, 0); wmove(mainwin, y, 0);
//textwithcol(mainwin, prompt->choice[validchoice].longdesc); //textwithcol(mainwin, prompt->choice[validchoice].longdesc);
wrapprint(mainwin, &y, &x, "%s", prompt->choice[validchoice].longdesc); wrapprint(mainwin, &y, &x, 0, "%s", prompt->choice[validchoice].longdesc);
getyx(mainwin, descendy, dummy); // remember bottom of description getyx(mainwin, descendy, dummy); // remember bottom of description
} }
} else if (descendy != -1) { } else if (descendy != -1) {
@ -10068,7 +10073,7 @@ void drawstatus(void) {
//wprintw(statwin, "DLev:%d", player->cell->map->depth); //wprintw(statwin, "DLev:%d", player->cell->map->depth);
setcol(statwin, C_BROWN); setcol(statwin, C_BROWN);
getregionname(buf, player->cell->map, NULL, B_TRUE); getregionname(buf, player->cell->map, NULL, RF_WITHLEVEL);
capitalise(buf); capitalise(buf);
wprintw(statwin, "%s", buf); wprintw(statwin, "%s", buf);
unsetcol(statwin, C_BROWN); unsetcol(statwin, C_BROWN);
@ -10212,7 +10217,7 @@ void setobcolour(WINDOW *win, object_t *o, int set) {
// dump out a single hiscore line // dump out a single hiscore line
int showhiscoreline(void *hilitescore, int ncols, char **argv, char **colname) { int showhiscoreline(void *hilitescore, int ncols, char **argv, char **colname) {
int i; int i,x,y,origy;
char *rank = NULL, *score = NULL, *name = NULL, *job = NULL, *killer = NULL; char *rank = NULL, *score = NULL, *name = NULL, *job = NULL, *killer = NULL;
for (i = 0; i < ncols; i++) { for (i = 0; i < ncols; i++) {
if (streq(colname[i], "rank")) rank = strdup(argv[i]); if (streq(colname[i], "rank")) rank = strdup(argv[i]);
@ -10222,10 +10227,20 @@ int showhiscoreline(void *hilitescore, int ncols, char **argv, char **colname) {
else if (streq(colname[i], "killedby")) killer = strdup(argv[i]); else if (streq(colname[i], "killedby")) killer = strdup(argv[i]);
} }
if (streq(score, (char *)hilitescore)) setcol(mainwin, C_BOLDGREEN); if (streq(score, (char *)hilitescore)) setcol(mainwin, C_BOLDGREEN);
wprintw(mainwin, HISCOREFORMAT, rank, score, name, job, killer); wprintw(mainwin, HISCOREFORMAT, rank, score, name, job);
// last field should be wrapped with lines 2+ indented
getyx(mainwin, y, x);
origy = y;
wrapprint(mainwin, &y, &x, x, "%s", killer);
if (streq(score, (char *)hilitescore)) unsetcol(mainwin, C_BOLDGREEN); if (streq(score, (char *)hilitescore)) unsetcol(mainwin, C_BOLDGREEN);
if (y == origy) {
wprintw(mainwin, "\n\n");
} else {
wprintw(mainwin, "\n"); wprintw(mainwin, "\n");
}
free(score); free(score);
free(name); free(name);
free(job); free(job);
@ -10898,7 +10913,7 @@ void showlfstats(lifeform_t *lf, int showall) {
descbuf = malloc(HUGEBUFLEN * sizeof(char)); descbuf = malloc(HUGEBUFLEN * sizeof(char));
makedesc_race(lf->race->id, descbuf, B_FALSE ); makedesc_race(lf->race->id, descbuf, B_FALSE );
//mvwprintw(mainwin, y, 0, "%s", descbuf); //mvwprintw(mainwin, y, 0, "%s", descbuf);
wrapprint(mainwin, &y, &x, "%s", descbuf); wrapprint(mainwin, &y, &x, 0, "%s", descbuf);
free(descbuf); free(descbuf);
getyx(mainwin, y, x); getyx(mainwin, y, x);
@ -10951,33 +10966,33 @@ void showlfstats(lifeform_t *lf, int showall) {
if (hitstokillit == hitstokillyou) { if (hitstokillit == hitstokillyou) {
if (hitstokillit) { if (hitstokillit) {
setcol(mainwin, lorecol); setcol(mainwin, lorecol);
wrapprint(mainwin, &y, &x, "You could both kill each other in %d hit%s. ", hitstokillit, wrapprint(mainwin, &y, &x, 0, "You could both kill each other in %d hit%s. ", hitstokillit,
(hitstokillit == 1) ? "" : "s"); (hitstokillit == 1) ? "" : "s");
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
} else { } else {
setcol(mainwin, lorecol); setcol(mainwin, lorecol);
wrapprint(mainwin, &y, &x, "Neither of you would be able to kill the other. "); wrapprint(mainwin, &y, &x, 0, "Neither of you would be able to kill the other. ");
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
} }
} else { } else {
if (hitstokillit) { if (hitstokillit) {
setcol(mainwin, lorecol); setcol(mainwin, lorecol);
wrapprint(mainwin, &y, &x, "You could kill it in %d hit%s. ", hitstokillit, wrapprint(mainwin, &y, &x, 0, "You could kill it in %d hit%s. ", hitstokillit,
(hitstokillit == 1) ? "" : "s"); (hitstokillit == 1) ? "" : "s");
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
} else { } else {
setcol(mainwin, lorecol); setcol(mainwin, lorecol);
wrapprint(mainwin, &y, &x, "You probably couldn't kill it. "); wrapprint(mainwin, &y, &x, 0, "You probably couldn't kill it. ");
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
} }
if (hitstokillyou) { if (hitstokillyou) {
setcol(mainwin, lorecol); setcol(mainwin, lorecol);
wrapprint(mainwin, &y, &x, "It could kill you in %d hit%s. ", hitstokillyou, wrapprint(mainwin, &y, &x, 0, "It could kill you in %d hit%s. ", hitstokillyou,
(hitstokillyou == 1) ? "" : "s"); (hitstokillyou == 1) ? "" : "s");
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
} else { } else {
setcol(mainwin, lorecol); setcol(mainwin, lorecol);
wrapprint(mainwin, &y, &x, "It probably couldn't kill you. "); wrapprint(mainwin, &y, &x, 0, "It probably couldn't kill you. ");
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
} }
} }
@ -11005,7 +11020,7 @@ void showlfstats(lifeform_t *lf, int showall) {
snprintf(buf, BUFLEN, "It is EXTREMELY dangerous to you."); snprintf(buf, BUFLEN, "It is EXTREMELY dangerous to you.");
} }
//mvwprintw(mainwin, y, 0, "Threat rating: %0.1f",comparelfs(player, lf)); //mvwprintw(mainwin, y, 0, "Threat rating: %0.1f",comparelfs(player, lf));
wrapprint(mainwin, &y, &x, "%s ", buf); wrapprint(mainwin, &y, &x, 0, "%s ", buf);
unsetcol(mainwin, lorecol); unsetcol(mainwin, lorecol);
y++; x = 0; y++; x = 0;
} }
@ -11024,7 +11039,7 @@ void showlfstats(lifeform_t *lf, int showall) {
case ST_KO: case ST_KO:
strcpy(sleepname, "unconscious"); break; strcpy(sleepname, "unconscious"); break;
} }
wrapprint(mainwin, &y, &x, "%s %s %s. ", you(lf), is(lf), sleepname); wrapprint(mainwin, &y, &x, 0, "%s %s %s. ", you(lf), is(lf), sleepname);
} }
f = lfhasknownflag(lf, F_ATTACHEDTO); f = lfhasknownflag(lf, F_ATTACHEDTO);
if (f && (f->known)) { if (f && (f->known)) {
@ -11037,40 +11052,40 @@ void showlfstats(lifeform_t *lf, int showall) {
strcpy(grabeename, "something"); strcpy(grabeename, "something");
} }
snprintf(buf, BUFLEN,"%s %s attached to %s.",you(lf), is(lf), grabeename); snprintf(buf, BUFLEN,"%s %s attached to %s.",you(lf), is(lf), grabeename);
wrapprint(mainwin, &y, &x, "%s ", buf); wrapprint(mainwin, &y, &x, 0, "%s ", buf);
} }
if (isbleeding(lf)) { if (isbleeding(lf)) {
wrapprint(mainwin, &y, &x, "%s %s bleeding. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s bleeding. ", you(lf), is(lf));
} }
f = lfhasknownflag(lf, F_CLIMBING); f = lfhasknownflag(lf, F_CLIMBING);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s climbing on a wall. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s climbing on a wall. ", you(lf), is(lf));
} }
f = lfhasknownflag(lf, F_FASTMETAB); f = lfhasknownflag(lf, F_FASTMETAB);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s metabolic rate has been increased. ", your(lf), getpossessive(you(lf))); wrapprint(mainwin, &y, &x, 0, "%s metabolic rate has been increased. ", your(lf), getpossessive(you(lf)));
} }
f = lfhasknownflag(lf, F_FEIGNINGDEATH); f = lfhasknownflag(lf, F_FEIGNINGDEATH);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s pretending to be dead. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s pretending to be dead. ", you(lf), is(lf));
} }
f = lfhasknownflag(lf, F_FLYING); f = lfhasknownflag(lf, F_FLYING);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s flying. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s flying. ", you(lf), is(lf));
} }
if (isswimming(lf)) { if (isswimming(lf)) {
wrapprint(mainwin, &y, &x, "%s %s swimming. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s swimming. ", you(lf), is(lf));
} }
if (isclimbing(lf)) { if (isclimbing(lf)) {
wrapprint(mainwin, &y, &x, "%s %s currently climbing. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s currently climbing. ", you(lf), is(lf));
} }
f = lfhasknownflag(lf, F_PRONE); f = lfhasknownflag(lf, F_PRONE);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s lying on the ground. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s lying on the ground. ", you(lf), is(lf));
} }
f = lfhasflag(lf, F_FROZEN); f = lfhasflag(lf, F_FROZEN);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s been turned to ice, and %s slowly melting. ", you(lf), isplayer(lf) ? "have" : "has", wrapprint(mainwin, &y, &x, 0, "%s %s been turned to ice, and %s slowly melting. ", you(lf), isplayer(lf) ? "have" : "has",
is(lf)); is(lf));
} }
f = lfhasknownflag(lf, F_GRABBEDBY); f = lfhasknownflag(lf, F_GRABBEDBY);
@ -11084,7 +11099,7 @@ void showlfstats(lifeform_t *lf, int showall) {
strcpy(grabbername, "something"); strcpy(grabbername, "something");
} }
snprintf(buf, BUFLEN,"%s %s being held by %s.",you(lf), is(lf), grabbername); snprintf(buf, BUFLEN,"%s %s being held by %s.",you(lf), is(lf), grabbername);
wrapprint(mainwin, &y, &x, "%s ",buf); wrapprint(mainwin, &y, &x, 0, "%s ",buf);
} }
f = lfhasknownflag(lf, F_GRABBING); f = lfhasknownflag(lf, F_GRABBING);
if (f && (f->known)) { if (f && (f->known)) {
@ -11097,11 +11112,11 @@ void showlfstats(lifeform_t *lf, int showall) {
strcpy(grabeename, "something"); strcpy(grabeename, "something");
} }
snprintf(buf, BUFLEN,"%s %s holding on to %s.",you(lf), is(lf), grabeename); snprintf(buf, BUFLEN,"%s %s holding on to %s.",you(lf), is(lf), grabeename);
wrapprint(mainwin, &y, &x, "%s ", buf); wrapprint(mainwin, &y, &x, 0, "%s ", buf);
} }
f = lfhasknownflag(lf, F_HIDING); f = lfhasknownflag(lf, F_HIDING);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s hiding. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s hiding. ", you(lf), is(lf));
} }
getflags(lf->flags, retflag, &nretflags, F_INJURY, F_NONE); getflags(lf->flags, retflag, &nretflags, F_INJURY, F_NONE);
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
@ -11110,40 +11125,40 @@ void showlfstats(lifeform_t *lf, int showall) {
f = retflag[i]; f = retflag[i];
p = readuntil(injname, f->text, '^'); p = readuntil(injname, f->text, '^');
readuntil(injdesc, p, '^'); readuntil(injdesc, p, '^');
wrapprint(mainwin, &y, &x, "^%c%s %s (%s). ", getlfcol(lf, CC_VBAD), your(lf), injname, injdesc); wrapprint(mainwin, &y, &x, 0, "^%c%s %s (%s). ", getlfcol(lf, CC_VBAD), your(lf), injname, injdesc);
} }
f = lfhasknownflag(lf, F_INVISIBLE); f = lfhasknownflag(lf, F_INVISIBLE);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s invisible. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s invisible. ", you(lf), is(lf));
} }
f = lfhasknownflag(lf, F_LEVITATING); f = lfhasknownflag(lf, F_LEVITATING);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s levitating. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s levitating. ", you(lf), is(lf));
} }
f = lfhasflag(lf, F_NONCORPOREAL); f = lfhasflag(lf, F_NONCORPOREAL);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s noncorporeal and can walk through walls. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s noncorporeal and can walk through walls. ", you(lf), is(lf));
} }
f = lfhasflag(lf, F_PRODUCESLIGHT); f = lfhasflag(lf, F_PRODUCESLIGHT);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s produce%s light. ", you(lf), isplayer(lf) ? "" : "s"); wrapprint(mainwin, &y, &x, 0, "%s produce%s light. ", you(lf), isplayer(lf) ? "" : "s");
} }
f = lfhasknownflag(lf, F_SLOWMETAB); f = lfhasknownflag(lf, F_SLOWMETAB);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s metabolic rate has been decreased. ", your(lf), getpossessive(you(lf))); wrapprint(mainwin, &y, &x, 0, "%s metabolic rate has been decreased. ", your(lf), getpossessive(you(lf)));
} }
f = lfhasknownflag(lf, F_SPRINTING); f = lfhasknownflag(lf, F_SPRINTING);
if (f) { if (f) {
wrapprint(mainwin, &y, &x, "%s %s sprinting. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s sprinting. ", you(lf), is(lf));
} }
if (!getstamina(lf)) { if (!getstamina(lf)) {
wrapprint(mainwin, &y, &x, "%s %s exhausted. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s exhausted. ", you(lf), is(lf));
} }
f = lfhasknownflag(lf, F_UNDEAD); f = lfhasknownflag(lf, F_UNDEAD);
if (f) { if (f) {
wrapprint(mainwin, &y, &x, "%s %s undead. ", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s undead. ", you(lf), is(lf));
} }
// non-intrinsic effecst like polymorph, eye shading // non-intrinsic effecst like polymorph, eye shading
@ -11154,11 +11169,11 @@ void showlfstats(lifeform_t *lf, int showall) {
snprintf(buf2, BUFLEN, " [%d left]", f->lifetime); snprintf(buf2, BUFLEN, " [%d left]", f->lifetime);
strcat(buf, buf2); strcat(buf, buf2);
// } // }
wrapprint(mainwin, &y, &x, "%s ", buf); wrapprint(mainwin, &y, &x, 0, "%s ", buf);
} }
if (!canuseweapons(lf)) { if (!canuseweapons(lf)) {
wrapprint(mainwin, &y, &x, "%s cannot use weapons. ", you(lf)); wrapprint(mainwin, &y, &x, 0, "%s cannot use weapons. ", you(lf));
} }
nmissingbp = 0; nmissingbp = 0;
@ -11203,20 +11218,20 @@ void showlfstats(lifeform_t *lf, int showall) {
} }
} }
strcat(buf, "."); strcat(buf, ".");
wrapprint(mainwin, &y, &x, "%s ", buf); wrapprint(mainwin, &y, &x, 0, "%s ", buf);
} }
f = lfhasflag(lf, F_REFLECTION); f = lfhasflag(lf, F_REFLECTION);
if (f && (f->known)) { if (f && (f->known)) {
wrapprint(mainwin, &y, &x, "%s %s surrounded by a negative gravity field.", you(lf), is(lf)); wrapprint(mainwin, &y, &x, 0, "%s %s surrounded by a negative gravity field.", you(lf), is(lf));
} }
f = lfhasflag(lf, F_RETALIATE); f = lfhasflag(lf, F_RETALIATE);
if (f && (f->known)) { if (f && (f->known)) {
if (showall || (lorelev >= PR_BEGINNER)) { if (showall || (lorelev >= PR_BEGINNER)) {
wrapprint(mainwin, &y, &x, "%s %s covered by %s (%dd%d %s dmg to attackers). ", you(lf), is(lf), f->text, wrapprint(mainwin, &y, &x, 0, "%s %s covered by %s (%dd%d %s dmg to attackers). ", you(lf), is(lf), f->text,
f->val[0], f->val[1], getdamname(f->val[2])); f->val[0], f->val[1], getdamname(f->val[2]));
} else { } else {
wrapprint(mainwin, &y, &x, "%s %s covered by %s ", you(lf), is(lf), f->text); wrapprint(mainwin, &y, &x, 0, "%s %s covered by %s ", you(lf), is(lf), f->text);
} }
} }
@ -11228,7 +11243,7 @@ void showlfstats(lifeform_t *lf, int showall) {
lf2 = findlf(NULL, f->val[0]); lf2 = findlf(NULL, f->val[0]);
if (lf2) { if (lf2) {
getlfname(lf2, buf); getlfname(lf2, buf);
wrapprint(mainwin, &y, &x, "%s %s fleeing from %s. ", you(lf), is(lf), buf); wrapprint(mainwin, &y, &x, 0, "%s %s fleeing from %s. ", you(lf), is(lf), buf);
} }
} }
} }
@ -11238,7 +11253,7 @@ void showlfstats(lifeform_t *lf, int showall) {
if (getlfmaterial(lf) != MT_FLESH) { if (getlfmaterial(lf) != MT_FLESH) {
material_t *mt; material_t *mt;
mt = findmaterial(getlfmaterial(lf)); mt = findmaterial(getlfmaterial(lf));
wrapprint(mainwin, &y, &x, "%s %s made out of %s. ",you(lf), is(lf), mt->name); wrapprint(mainwin, &y, &x, 0, "%s %s made out of %s. ",you(lf), is(lf), mt->name);
} }
} else if (mode == 'a') { } else if (mode == 'a') {
centre(mainwin, C_WHITE, 0, "ABILITIES"); centre(mainwin, C_WHITE, 0, "ABILITIES");
@ -11823,7 +11838,7 @@ void showlfstats(lifeform_t *lf, int showall) {
} }
if (strlen(buf) > 0) { if (strlen(buf) > 0) {
strcat(buf, ".\n"); strcat(buf, ".\n");
wrapprint(mainwin, &y, &x, buf); wrapprint(mainwin, &y, &x, 0, buf);
} }
// immunities // immunities
strcpy(buf, ""); strcpy(buf, "");
@ -11849,7 +11864,7 @@ void showlfstats(lifeform_t *lf, int showall) {
if (strlen(buf) > 0) { if (strlen(buf) > 0) {
strcat(buf, ".\n"); strcat(buf, ".\n");
wrapprint(mainwin, &y, &x, buf); wrapprint(mainwin, &y, &x, 0, buf);
} }
// vulnerabilities // vulnerabilities
strcpy(buf, ""); strcpy(buf, "");
@ -11883,7 +11898,7 @@ void showlfstats(lifeform_t *lf, int showall) {
} }
if (strlen(buf) > 0) { if (strlen(buf) > 0) {
strcat(buf, ".\n"); strcat(buf, ".\n");
wrapprint(mainwin, &y, &x, buf); wrapprint(mainwin, &y, &x, 0, buf);
} }
// wants/desires // wants/desires
@ -11896,7 +11911,7 @@ void showlfstats(lifeform_t *lf, int showall) {
objecttype_t *ot; objecttype_t *ot;
ot = findot(f->val[0]); ot = findot(f->val[0]);
pname = makeplural(ot->name); pname = makeplural(ot->name);
mvwprintw(mainwin, y, 0, "It %s %s.", (f->val[1] == B_COVETS) ? "covets" : "wants", pname); mvwprintw(mainwin, y, 0, 0, "It %s %s.", (f->val[1] == B_COVETS) ? "covets" : "wants", pname);
y++; y++;
free(pname); free(pname);
} else if (f->id == F_WANTSOBFLAG) { } else if (f->id == F_WANTSOBFLAG) {
@ -12521,15 +12536,10 @@ void tombstone(lifeform_t *lf) {
//printf("%s\n",lf->name); //printf("%s\n",lf->name);
centre(mainwin, C_GREY, y, "%s (%ld points)",pname, playerscore); y++; centre(mainwin, C_GREY, y, "%s (%ld points)",pname, playerscore); y++;
if (player->cell->map->region->rtype->id == RG_WORLDMAP) { getregionname(buf, player->cell->map, NULL, RF_LONG);
getregionname(buf, player->cell->map, NULL, B_TRUE); centre(mainwin, C_GREY, y, "Died %s.", buf); y++; // ie. "Died on level 1 of the dungeon"
centre(mainwin, C_GREY, y, "Died on %s.", buf); y++;
} else {
getregionname(buf, player->cell->map, NULL, B_FALSE);
centre(mainwin, C_GREY, y, "Died on level %d of %s.", player->cell->map->depth, buf); y++;
}
makekillertext(killer, lf->killverb, lf->lastdam, B_TRUE); makekillertext(killer, lf->killverb, lf->lastdam, lf->cell->map, B_TRUE, B_FALSE);
p = readuntil(buf, killer, '\n'); p = readuntil(buf, killer, '\n');
while (strlen(buf)) { while (strlen(buf)) {
@ -12567,9 +12577,10 @@ void tombstone(lifeform_t *lf) {
limit(&maxrank, NA, 100); limit(&maxrank, NA, 100);
} }
centre(mainwin, C_GREY, y, "High Scores"); y += 2; centre(mainwin, C_GREY, y, "High Scores"); y++;
wattron(mainwin, A_BOLD); wattron(mainwin, A_BOLD);
mvwprintw(mainwin, y, 0, HISCOREFORMAT, "Rank", "Score", "Name", "Job", "Method of death"); y++; mvwprintw(mainwin, y, 0, HISCOREFORMAT, "Pos", "Score", "Name", "Job");
wprintw(mainwin, "Method of death"); y++;
wmove(mainwin, y, 0); wmove(mainwin, y, 0);
wattroff(mainwin, A_BOLD); wattroff(mainwin, A_BOLD);
@ -12622,7 +12633,7 @@ int real_warnabout(char *what, int lifetime, int doquestion) {
} }
// @ = tab // @ = tab
char wrapprint(WINDOW *win, int *y, int *x, char *format, ... ) { char wrapprint(WINDOW *win, int *y, int *x, int newlineindent, char *format, ... ) {
char word[HUGEBUFLEN],buf[HUGEBUFLEN]; char word[HUGEBUFLEN],buf[HUGEBUFLEN];
char *p; char *p;
va_list args; va_list args;
@ -12659,9 +12670,9 @@ char wrapprint(WINDOW *win, int *y, int *x, char *format, ... ) {
} }
// if this word won't fit, put it on the next line. // if this word won't fit, put it on the next line.
if (*x != 0) { if (*x != 0) {
if (*x + strlen(repword) >= w) { if (*x + strlen(repword) >= (w-1)) {
(*y)++; (*y)++;
*x = 0; *x = newlineindent;
} }
} }
@ -12685,7 +12696,7 @@ char wrapprint(WINDOW *win, int *y, int *x, char *format, ... ) {
if (first) { if (first) {
first = B_FALSE; first = B_FALSE;
} else if (*x != 0) { } else if (*x != newlineindent) {
textwithcol_real(win, " ", B_FALSE); textwithcol_real(win, " ", B_FALSE);
} }
textwithcol_real(win, repword, B_FALSE); textwithcol_real(win, repword, B_FALSE);

2
io.h
View File

@ -137,4 +137,4 @@ void updatestatus(void);
int updateviewfor(cell_t *cell); int updateviewfor(cell_t *cell);
int warnabout(char *what); int warnabout(char *what);
int real_warnabout(char *what, int lifetime, int doquestion); int real_warnabout(char *what, int lifetime, int doquestion);
char wrapprint(WINDOW *win, int *y, int *x, char *format, ... ); char wrapprint(WINDOW *win, int *y, int *x, int newlineindent, char *format, ... );

6
lf.c
View File

@ -17357,7 +17357,7 @@ void startlfturn(lifeform_t *lf) {
if (!movedlastturn) { if (!movedlastturn) {
getflags(lf->flags, retflag, &nretflags, F_HOTFEET, F_NONE); getflags(lf->flags, retflag, &nretflags, F_HOTFEET, F_NONE);
if (nretflags && !hasobofmaterial(lf->cell->obpile, MT_WATER) && !isimmuneto(lf->flags, DT_FIRE)) { if (nretflags && !hasobofmaterial(lf->cell->obpile, MT_WATER) && !isimmuneto(lf->flags, DT_FIRE, B_FALSE)) {
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
int dam; int dam;
enum DAMTYPE dt; enum DAMTYPE dt;
@ -17462,7 +17462,7 @@ void startlfturn(lifeform_t *lf) {
// effects from pack objects // effects from pack objects
for (o = lf->pack->first ; o ; o = o->next) { for (o = lf->pack->first ; o ; o = o->next) {
// hot equipped objects? // hot equipped objects?
if (isequipped(o) && !isweapon(o) && !isimmuneto(lf->flags, DT_FIRE)) { if (isequipped(o) && !isweapon(o) && !isimmuneto(lf->flags, DT_FIRE, B_FALSE)) {
f = hasflag(o->flags, F_HOT); f = hasflag(o->flags, F_HOT);
if (f) { if (f) {
f->known = B_TRUE; f->known = B_TRUE;
@ -18466,6 +18466,7 @@ int touch(lifeform_t *lf, object_t *o) {
} }
// flaming or red-hot objects? // flaming or red-hot objects?
if (!isimmuneto(lf->flags, DT_FIRE, B_FALSE)) {
getflags(o->flags, retflag, &nretflags, F_ONFIRE, F_HOT, F_NONE); // IMPORTANT - check ONFIRE first! getflags(o->flags, retflag, &nretflags, F_ONFIRE, F_HOT, F_NONE); // IMPORTANT - check ONFIRE first!
for (i = 0; i < nretflags; i++) { for (i = 0; i < nretflags; i++) {
f = retflag[i]; f = retflag[i];
@ -18513,6 +18514,7 @@ int touch(lifeform_t *lf, object_t *o) {
} }
} }
} // end if !immune to fire
return B_FALSE; return B_FALSE;
} }

4
map.c
View File

@ -2941,7 +2941,7 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
map->region = region; map->region = region;
if (db) { if (db) {
getregionname(buf, map, NULL, B_FALSE); getregionname(buf, map, NULL, RF_SHORT);
dblog("Creating new map of region '%s'",buf); dblog("Creating new map of region '%s'",buf);
} }
map->habitat = findhabitat(habitat); map->habitat = findhabitat(habitat);
@ -3079,7 +3079,7 @@ void createmap(map_t *map, int depth, region_t *region, map_t *parentmap, int ex
//if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging //if (gamemode == GM_GAMESTARTED) checkallflags(player->cell->map); // debugging
// we now have the map name! // we now have the map name!
getregionname(buf2, map, NULL, B_TRUE); getregionname(buf2, map, NULL, RF_WITHLEVEL);
snprintf(buf, BUFLEN, "%s (id #%d)",buf2, map->id); snprintf(buf, BUFLEN, "%s (id #%d)",buf2, map->id);
map->name = strdup(buf); map->name = strdup(buf);

View File

@ -5340,7 +5340,7 @@ char *real_getobname(object_t *o, char *buf, int count, int wantpremods, int wan
} else { } else {
char buf2[BUFLEN]; char buf2[BUFLEN];
strcat(localbuf, " to "); strcat(localbuf, " to ");
getregionname(buf2, newmap, NULL, B_FALSE); getregionname(buf2, newmap, NULL, RF_SHORT);
strcat(localbuf, buf2); strcat(localbuf, buf2);
} }
} }
@ -7638,7 +7638,7 @@ int makeduller(object_t *o, int howmuch) {
void makehot(object_t *o, int howmuch, int howlong) { void makehot(object_t *o, int howmuch, int howlong) {
flag_t *f; flag_t *f;
int seen = B_FALSE; int seen = B_FALSE;
f = addtempflag(o->flags, F_HOT, howmuch, NA, NA, NULL, howlong); f = addtempflag(o->flags, F_HOT, howmuch, NA, NA, "1d2", howlong);
if (isequipped(o) && o->pile->owner) { if (isequipped(o) && o->pile->owner) {
if (isplayer(o->pile->owner) || cansee(player, o->pile->owner)) { if (isplayer(o->pile->owner) || cansee(player, o->pile->owner)) {
seen = B_TRUE; seen = B_TRUE;
@ -10797,13 +10797,13 @@ int readsomething(lifeform_t *lf, object_t *o) {
case PR_ADEPT: case PR_ADEPT:
case PR_SKILLED: case PR_SKILLED:
// tell which area it is in (without level) // tell which area it is in (without level)
getregionname(buf, NULL, srcregion, B_FALSE); getregionname(buf, NULL, srcregion, RF_SHORT);
msg("%s %s somewhere within %s.", f->text, isare, buf); msg("%s %s somewhere within %s.", f->text, isare, buf);
break; break;
case PR_EXPERT: case PR_EXPERT:
case PR_MASTER: case PR_MASTER:
// which area it is in, plus which floor // which area it is in, plus which floor
getregionname(buf, NULL, srcregion, B_TRUE); getregionname(buf, NULL, srcregion, RF_WITHLEVEL);
msg("%s %s in %s.", f->text, isare, buf); msg("%s %s in %s.", f->text, isare, buf);
break; break;
} }

2
save.c
View File

@ -1156,7 +1156,7 @@ int writehiscore(lifeform_t *lf, int *rank) {
capitalise(racename); capitalise(racename);
snprintf(jobname, BUFLEN, "Lv%d %s %s", player->level, racename, j->name); snprintf(jobname, BUFLEN, "Lv%d %s %s", player->level, racename, j->name);
makekillertext(killedby, lf->killverb, lf->lastdam, B_FALSE); makekillertext(killedby, lf->killverb, lf->lastdam, lf->cell->map, B_FALSE, B_TRUE);
// add escapes // add escapes
escaped = strdup(killedby); escaped = strdup(killedby);

View File

@ -8169,7 +8169,7 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
char ch = 'a'; char ch = 'a';
char mapname[BUFLEN]; char mapname[BUFLEN];
getregionname(mapname, m, NULL, B_TRUE); getregionname(mapname, m, NULL, RF_WITHLEVEL);
capitalise(mapname); capitalise(mapname);
if (m->habitat->id == H_HEAVEN) continue; if (m->habitat->id == H_HEAVEN) continue;

57
text.c
View File

@ -1100,23 +1100,23 @@ char *getrarityname(enum RARITY rr) {
// pass in EITHER m or r, not both. // pass in EITHER m or r, not both.
// //
// if withlevel is TRUE, "m" should be passed. // if how is anything other than RF_SHORT, "m" should be passed.
char *getregionname(char *buf, map_t *m, region_t *r, int withlevel) { char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how) {
int x = NA,y = NA;
if (!r) { if (!r) {
r = m->region; r = m->region;
} }
if (withlevel && m) { if (m) {
flag_t *f; flag_t *f;
int x,y;
f = hasflag(m->flags, F_MAPCOORDS); f = hasflag(m->flags, F_MAPCOORDS);
if (f) { if (f) {
x = f->val[0]; x = f->val[0];
y = f->val[1]; y = f->val[1];
} else {
x = NA;
y = NA;
} }
}
if ((how == RF_WITHLEVEL) && m) {
switch (r->rtype->id) { switch (r->rtype->id) {
case RG_CAVE: case RG_CAVE:
snprintf(buf, BUFLEN, "goblin caves L%d", m->depth); snprintf(buf, BUFLEN, "goblin caves L%d", m->depth);
@ -1140,7 +1140,31 @@ char *getregionname(char *buf, map_t *m, region_t *r, int withlevel) {
snprintf(buf, BUFLEN, "a stomach"); snprintf(buf, BUFLEN, "a stomach");
break; break;
} }
} else { } else if ((how == RF_LONG) && m) {
switch (r->rtype->id) {
case RG_CAVE:
snprintf(buf, BUFLEN, "on level %d of the goblin caves", m->depth);
break;
case RG_WORLDMAP:
snprintf(buf, BUFLEN, "on the surface(%d,%d)",x,y);
break;
case RG_MAINDUNGEON:
snprintf(buf, BUFLEN, "on level %d of the dungeon", m->depth);
break;
case RG_HEAVEN:
snprintf(buf, BUFLEN, "in the realm of gods");
break;
case RG_PIT:
snprintf(buf, BUFLEN, "in a pit");
break;
case RG_SEWER:
snprintf(buf, BUFLEN, "in a sewer");
break;
case RG_STOMACH:
snprintf(buf, BUFLEN, "inside a worm's stomach"); // TODO: " in a stomach of of xxx"
break;
}
} else { // ie. RF_SHORT
switch (r->rtype->id) { switch (r->rtype->id) {
case RG_CAVE: case RG_CAVE:
strcpy(buf, "the goblin caves"); strcpy(buf, "the goblin caves");
@ -1337,14 +1361,15 @@ void makegunaimstring(lifeform_t *lf, int lfid, char *retbuf) {
sprintf(retbuf, "%s%s", noprefix(targname), accbuf); sprintf(retbuf, "%s%s", noprefix(targname), accbuf);
} }
char *makekillertext(char *retbuf, char *killverb, char *lastdam, int wantextra) { char *makekillertext(char *retbuf, char *killverb, char *lastdam, map_t *where, int wantextra, int wantlocation) {
char *p, *dummy; char *p, *dummy;
char regionbuf[BUFLEN];
p = strtok_r(lastdam,"^", &dummy); p = strtok_r(lastdam,"^", &dummy);
if (p) { if (p) {
if (!strcmp(p, "you")) { if (!strcmp(p, "you")) {
strcpy(retbuf, "Committed suicide."); strcpy(retbuf, "Committed suicide");
} else { } else {
snprintf(retbuf, BUFLEN, "%s %s %s.",killverb, snprintf(retbuf, BUFLEN, "%s %s %s",killverb,
streq(killverb, "Drowned") ? "in" : "by", streq(killverb, "Drowned") ? "in" : "by",
p); p);
} }
@ -1358,8 +1383,16 @@ char *makekillertext(char *retbuf, char *killverb, char *lastdam, int wantextra)
} }
} }
} else { } else {
sprintf(retbuf, "%s by something unknown.", killverb); sprintf(retbuf, "%s by something unknown", killverb);
} }
if (wantlocation) {
// now include WHERE they died.
getregionname(regionbuf, where, NULL, RF_LONG);
strcat(retbuf, " ");
strcat(retbuf, regionbuf);
}
strcat(retbuf, ".");
return retbuf; return retbuf;
} }

4
text.h
View File

@ -29,7 +29,7 @@ char *getinjuryname(enum DAMTYPE dt);
char *getinjurydesc(enum BODYPART bp, enum DAMTYPE dt); char *getinjurydesc(enum BODYPART bp, enum DAMTYPE dt);
char *getobmodprefix(object_t *o, obmod_t *om); char *getobmodprefix(object_t *o, obmod_t *om);
char *getrarityname(enum RARITY rr); char *getrarityname(enum RARITY rr);
char *getregionname(char *buf, map_t *m, region_t *r, int withlevel); char *getregionname(char *buf, map_t *m, region_t *r, enum REGIONNAMEFORMAT how);
char *getreldirname(int reldir); char *getreldirname(int reldir);
char *getsizetext(enum LFSIZE sz); char *getsizetext(enum LFSIZE sz);
char *gettimetext(char *retbuf); char *gettimetext(char *retbuf);
@ -39,7 +39,7 @@ char *getweighttext(float weight, char *buf, int shortfmt);
char *is(lifeform_t *lf); char *is(lifeform_t *lf);
int isvowel(char c); int isvowel(char c);
void makegunaimstring(lifeform_t *lf, int lfid, char *retbuf); void makegunaimstring(lifeform_t *lf, int lfid, char *retbuf);
char *makekillertext(char *retbuf, char *killverb, char *lastdam, int wantextra); char *makekillertext(char *retbuf, char *killverb, char *lastdam, map_t *where, int wantextra, int wantlocation);
char *makelowercase(char *text); char *makelowercase(char *text);
char *makeplural(char *text); char *makeplural(char *text);
char *makethrowaccstring(lifeform_t *lf, cell_t *c, flag_t *throwflag, char *retbuf); char *makethrowaccstring(lifeform_t *lf, cell_t *c, flag_t *throwflag, char *retbuf);