Reading a magic marker shows the specific red ink color

This commit is contained in:
Pasi Kallinen
2022-02-19 13:11:24 +02:00
parent c434236f1e
commit 26ea5824c1
4 changed files with 32 additions and 1 deletions
+1
View File
@@ -789,6 +789,7 @@ candy bars are bright blue in text mode
towels weigh more than blindfolds towels weigh more than blindfolds
knight quest home level contains some saddled warhorses knight quest home level contains some saddled warhorses
allow creating unhidden traps in special levels allow creating unhidden traps in special levels
reading magic marker shows the specific red ink color
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
+1
View File
@@ -955,6 +955,7 @@ extern char lowc(char);
extern char *lcase(char *); extern char *lcase(char *);
extern char *ucase(char *); extern char *ucase(char *);
extern char *upstart(char *); extern char *upstart(char *);
extern char *upwords(char *);
extern char *mungspaces(char *); extern char *mungspaces(char *);
extern char *trimspaces(char *); extern char *trimspaces(char *);
extern char *strip_newline(char *); extern char *strip_newline(char *);
+20
View File
@@ -18,6 +18,7 @@
char * lcase (char *) char * lcase (char *)
char * ucase (char *) char * ucase (char *)
char * upstart (char *) char * upstart (char *)
char * upwords (char *)
char * mungspaces (char *) char * mungspaces (char *)
char * trimspaces (char *) char * trimspaces (char *)
char * strip_newline (char *) char * strip_newline (char *)
@@ -147,6 +148,25 @@ upstart(char *s)
return s; return s;
} }
/* capitalize first letter of every word in a string (in place) */
char *
upwords(char *s)
{
char *p;
boolean space = TRUE;
for (p = s; *p; p++)
if (*p == ' ') {
space = TRUE;
} else if (space && letter(*p)) {
*p = highc(*p);
space = FALSE;
} else {
space = FALSE;
}
return s;
}
/* remove excess whitespace from a string buffer (in place) */ /* remove excess whitespace from a string buffer (in place) */
char * char *
mungspaces(char *bp) mungspaces(char *bp)
+10 -1
View File
@@ -489,13 +489,22 @@ doread(void)
pline("This %s has no label.", singular(scroll, xname)); pline("This %s has no label.", singular(scroll, xname));
return ECMD_OK; return ECMD_OK;
} else if (otyp == MAGIC_MARKER) { } else if (otyp == MAGIC_MARKER) {
char buf[BUFSZ];
const int red_mons[] = { PM_FIRE_ANT, PM_PYROLISK, PM_HELL_HOUND,
PM_IMP, PM_LARGE_MIMIC, PM_LEOCROTTA, PM_SCORPION, PM_XAN,
PM_GIANT_BAT, PM_WATER_MOCCASIN, PM_FLESH_GOLEM, PM_BARBED_DEVIL,
PM_MARILITH, PM_PIRANHA };
struct permonst *pm = &mons[red_mons[scroll->o_id % SIZE(red_mons)]];
if (Blind) { if (Blind) {
You_cant(find_any_braille); You_cant(find_any_braille);
return ECMD_OK; return ECMD_OK;
} }
if (flags.verbose) if (flags.verbose)
pline("It reads:"); pline("It reads:");
pline("\"Magic Marker(TM) Red Ink Marker Pen. Water Soluble.\""); Sprintf(buf, "%s", pmname(pm, NEUTRAL));
pline("\"Magic Marker(TM) %s Red Ink Marker Pen. Water Soluble.\"",
upwords(buf));
if (!u.uconduct.literate++) if (!u.uconduct.literate++)
livelog_printf(LL_CONDUCT, livelog_printf(LL_CONDUCT,
"became literate by reading a magic marker"); "became literate by reading a magic marker");