Add 'readable' Hawaiian shirt designs
Functionally similar to reading a T-shirt or apron, but rather than
actual text printed on the shirt being displayed, the design of the
Hawaiian shirt is described: for example, "hula dancers on an orange
background" or "tropical fish on an abstract background". Much like
T-shirts have their text included in the game-end inventory list ('a
blessed +2 T-shirt with text "foo"'), Hawaiian shirts now have a brief
description of their design appended to their item name under the same
circumstances.
Because 'reading' a Hawaiian shirt doesn't actually involve reading
text, using the 'r' command in this way doesn't break illiterate
conduct.
This commit is contained in:
committed by
Patric Mueller
parent
71084bbf61
commit
d8dc16e393
@@ -2113,6 +2113,7 @@ extern long random(void);
|
|||||||
|
|
||||||
extern void learnscroll(struct obj *);
|
extern void learnscroll(struct obj *);
|
||||||
extern char *tshirt_text(struct obj *, char *);
|
extern char *tshirt_text(struct obj *, char *);
|
||||||
|
extern char *hawaiian_motif(struct obj *, char *);
|
||||||
extern char *apron_text(struct obj *, char *);
|
extern char *apron_text(struct obj *, char *);
|
||||||
extern const char *candy_wrapper_text(struct obj *);
|
extern const char *candy_wrapper_text(struct obj *);
|
||||||
extern void assign_candy_wrapper(struct obj *);
|
extern void assign_candy_wrapper(struct obj *);
|
||||||
|
|||||||
+1
-1
@@ -345,7 +345,7 @@ struct obj {
|
|||||||
|| (otmp)->otyp == ALCHEMY_SMOCK || (otmp)->otyp == CREDIT_CARD \
|
|| (otmp)->otyp == ALCHEMY_SMOCK || (otmp)->otyp == CREDIT_CARD \
|
||||||
|| (otmp)->otyp == CAN_OF_GREASE || (otmp)->otyp == MAGIC_MARKER \
|
|| (otmp)->otyp == CAN_OF_GREASE || (otmp)->otyp == MAGIC_MARKER \
|
||||||
|| (otmp)->oclass == COIN_CLASS || (otmp)->oartifact == ART_ORB_OF_FATE \
|
|| (otmp)->oclass == COIN_CLASS || (otmp)->oartifact == ART_ORB_OF_FATE \
|
||||||
|| (otmp)->otyp == CANDY_BAR)
|
|| (otmp)->otyp == CANDY_BAR || (otmp)->otyp == HAWAIIAN_SHIRT)
|
||||||
|
|
||||||
/* special stones */
|
/* special stones */
|
||||||
#define is_graystone(obj) \
|
#define is_graystone(obj) \
|
||||||
|
|||||||
@@ -750,6 +750,10 @@ xname_flags(
|
|||||||
if (*lbl)
|
if (*lbl)
|
||||||
Sprintf(eos(buf), " labeled \"%s\"", lbl);
|
Sprintf(eos(buf), " labeled \"%s\"", lbl);
|
||||||
break;
|
break;
|
||||||
|
case HAWAIIAN_SHIRT:
|
||||||
|
Sprintf(eos(buf), " with %s motif",
|
||||||
|
an(hawaiian_motif(obj, tmpbuf)));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+74
-2
@@ -15,6 +15,7 @@
|
|||||||
static boolean learnscrolltyp(short);
|
static boolean learnscrolltyp(short);
|
||||||
static void cap_spe(struct obj *);
|
static void cap_spe(struct obj *);
|
||||||
static char *erode_obj_text(struct obj *, char *);
|
static char *erode_obj_text(struct obj *, char *);
|
||||||
|
static char *hawaiian_design(struct obj *, char *);
|
||||||
static int read_ok(struct obj *);
|
static int read_ok(struct obj *);
|
||||||
static void stripspe(struct obj *);
|
static void stripspe(struct obj *);
|
||||||
static void p_glow1(struct obj *);
|
static void p_glow1(struct obj *);
|
||||||
@@ -186,6 +187,70 @@ tshirt_text(struct obj* tshirt, char* buf)
|
|||||||
return erode_obj_text(tshirt, buf);
|
return erode_obj_text(tshirt, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
hawaiian_motif(struct obj *shirt, char *buf)
|
||||||
|
{
|
||||||
|
static const char *hawaiian_motifs[] = {
|
||||||
|
/* birds */
|
||||||
|
"flamingo",
|
||||||
|
"parrot",
|
||||||
|
"toucan",
|
||||||
|
"bird of paradise", /* could be a bird or a flower */
|
||||||
|
/* sea creatures */
|
||||||
|
"sea turtle",
|
||||||
|
"tropical fish",
|
||||||
|
"jellyfish",
|
||||||
|
"giant eel",
|
||||||
|
"water nymph",
|
||||||
|
/* plants */
|
||||||
|
"plumeria",
|
||||||
|
"orchid",
|
||||||
|
"hibiscus flower",
|
||||||
|
"palm tree",
|
||||||
|
/* other */
|
||||||
|
"hula dancer",
|
||||||
|
"sailboat",
|
||||||
|
"ukulele",
|
||||||
|
};
|
||||||
|
|
||||||
|
/* a tourist's starting shirt always has the same o_id; we need some
|
||||||
|
additional randomness or else its design will never differ */
|
||||||
|
unsigned motif = shirt->o_id ^ (unsigned) ubirthday;
|
||||||
|
|
||||||
|
Strcpy(buf, hawaiian_motifs[motif % SIZE(hawaiian_motifs)]);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
hawaiian_design(struct obj *shirt, char *buf)
|
||||||
|
{
|
||||||
|
static const char *hawaiian_bgs[] = {
|
||||||
|
/* solid colors */
|
||||||
|
"purple",
|
||||||
|
"yellow",
|
||||||
|
"red",
|
||||||
|
"blue",
|
||||||
|
"orange",
|
||||||
|
"black",
|
||||||
|
"green",
|
||||||
|
/* adjectives */
|
||||||
|
"abstract",
|
||||||
|
"geometric",
|
||||||
|
"patterned",
|
||||||
|
"naturalistic",
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This hash method is slightly different than the one in hawaiian_motif;
|
||||||
|
using the same formula in both cases may lead to some shirt combos
|
||||||
|
never appearing, if the sizes of the two lists have common factors. */
|
||||||
|
unsigned bg = shirt->o_id ^ (unsigned) ~ubirthday;
|
||||||
|
|
||||||
|
Sprintf(buf, "%s on %s background",
|
||||||
|
makeplural(hawaiian_motif(shirt, buf)),
|
||||||
|
an(hawaiian_bgs[bg % SIZE(hawaiian_bgs)]));
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
apron_text(struct obj* apron, char* buf)
|
apron_text(struct obj* apron, char* buf)
|
||||||
{
|
{
|
||||||
@@ -303,7 +368,8 @@ doread(void)
|
|||||||
u.uconduct.literate++;
|
u.uconduct.literate++;
|
||||||
useup(scroll);
|
useup(scroll);
|
||||||
return 1;
|
return 1;
|
||||||
} else if (otyp == T_SHIRT || otyp == ALCHEMY_SMOCK) {
|
} else if (otyp == T_SHIRT || otyp == ALCHEMY_SMOCK
|
||||||
|
|| otyp == HAWAIIAN_SHIRT) {
|
||||||
char buf[BUFSZ], *mesg;
|
char buf[BUFSZ], *mesg;
|
||||||
const char *endpunct;
|
const char *endpunct;
|
||||||
|
|
||||||
@@ -312,12 +378,18 @@ doread(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* can't read shirt worn under suit (under cloak is ok though) */
|
/* can't read shirt worn under suit (under cloak is ok though) */
|
||||||
if (otyp == T_SHIRT && uarm && scroll == uarmu) {
|
if ((otyp == T_SHIRT || otyp == HAWAIIAN_SHIRT) && uarm
|
||||||
|
&& scroll == uarmu) {
|
||||||
pline("%s shirt is obscured by %s%s.",
|
pline("%s shirt is obscured by %s%s.",
|
||||||
scroll->unpaid ? "That" : "Your", shk_your(buf, uarm),
|
scroll->unpaid ? "That" : "Your", shk_your(buf, uarm),
|
||||||
suit_simple_name(uarm));
|
suit_simple_name(uarm));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (otyp == HAWAIIAN_SHIRT) {
|
||||||
|
pline("%s features %s.", flags.verbose ? "The design" : "It",
|
||||||
|
hawaiian_design(scroll, buf));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
u.uconduct.literate++;
|
u.uconduct.literate++;
|
||||||
/* populate 'buf[]' */
|
/* populate 'buf[]' */
|
||||||
mesg = (otyp == T_SHIRT) ? tshirt_text(scroll, buf)
|
mesg = (otyp == T_SHIRT) ? tshirt_text(scroll, buf)
|
||||||
|
|||||||
Reference in New Issue
Block a user