Merge branch 'NetHack:NetHack-3.7' into NetHack-3.7

This commit is contained in:
RainRat
2024-04-13 23:45:32 -07:00
committed by GitHub
6 changed files with 85 additions and 16 deletions

View File

@@ -1399,6 +1399,7 @@ gold thrown or kicked at a sleeping monster with the 'greedy' attribute gets
neglected to report that target monster was awakened in the process neglected to report that target monster was awakened in the process
hero movement affects the water bubble movement direction hero movement affects the water bubble movement direction
pets and peacefuls avoid a location hero just kicked pets and peacefuls avoid a location hero just kicked
shopkeepers bill you for using their bear trap or land mine
Fixes to 3.7.0-x General Problems Exposed Via git Repository Fixes to 3.7.0-x General Problems Exposed Via git Repository

View File

@@ -2847,6 +2847,7 @@ extern void globby_bill_fixup(struct obj *, struct obj *) NONNULLARG12;
/*extern void globby_donation(struct obj *, struct obj *); */ /*extern void globby_donation(struct obj *, struct obj *); */
extern void credit_report(struct monst *shkp, int idx, extern void credit_report(struct monst *shkp, int idx,
boolean silent) NONNULLARG1; boolean silent) NONNULLARG1;
extern void use_unpaid_trapobj(struct obj *, coordxy, coordxy) NONNULLARG1;
/* ### shknam.c ### */ /* ### shknam.c ### */

View File

@@ -2880,6 +2880,7 @@ use_trap(struct obj *otmp)
} }
} }
You("begin setting %s%s.", shk_your(buf, otmp), trapname(ttyp, FALSE)); You("begin setting %s%s.", shk_your(buf, otmp), trapname(ttyp, FALSE));
use_unpaid_trapobj(otmp, u.ux, u.uy);
set_occupation(set_trap, occutext, 0); set_occupation(set_trap, occutext, 0);
return; return;
} }

View File

@@ -219,6 +219,10 @@ static struct nethack_color colortable[] = {
{ rgb_color, 154, 138, "white", "#FFFFFF", 255, 255, 255 }, { rgb_color, 154, 138, "white", "#FFFFFF", 255, 255, 255 },
}; };
#ifdef CHANGE_COLOR
staticfn int32 alt_color_spec(const char *cp);
#endif
int32 int32
colortable_to_int32(struct nethack_color *cte) colortable_to_int32(struct nethack_color *cte)
{ {
@@ -1068,6 +1072,9 @@ alternative_palette(char *op)
if (c_colorval && coloridx >= 0 && coloridx < CLR_MAX) { if (c_colorval && coloridx >= 0 && coloridx < CLR_MAX) {
rgb = rgbstr_to_int32(c_colorval); rgb = rgbstr_to_int32(c_colorval);
if (rgb == -1) {
rgb = alt_color_spec(c_colorval);
}
if (rgb != -1) { if (rgb != -1) {
ga.altpalette[coloridx] = (uint32) rgb | NH_ALTPALETTE; ga.altpalette[coloridx] = (uint32) rgb | NH_ALTPALETTE;
/* use COLORVAL(ga.altpalette[coloridx]) to get /* use COLORVAL(ga.altpalette[coloridx]) to get
@@ -1085,11 +1092,68 @@ change_palette(void)
for (clridx = 0; clridx < CLR_MAX; ++clridx) { for (clridx = 0; clridx < CLR_MAX; ++clridx) {
if (ga.altpalette[clridx] != 0) { if (ga.altpalette[clridx] != 0) {
long rgb = (long) (ga.altpalette[clridx] & ~NH_ALTPALETTE); long rgb = (long) COLORVAL(ga.altpalette[clridx]);
(*windowprocs.win_change_color)(clridx, rgb, 0); (*windowprocs.win_change_color)(clridx, rgb, 0);
} }
} }
} }
staticfn int32
alt_color_spec(const char *str)
{
static NEARDATA const char oct[] = "01234567", dec[] = "0123456789";
/* hexdd[] is defined in decl.c */
const char *dp, *cp = str;
int32 cval = -1;
int dcount, dlimit = 6;
boolean hexescape = FALSE, octescape = FALSE;
dcount = 0; /* for decimal, octal, hexadecimal cases */
hexescape =
(*cp == '\\' && cp[1] && (cp[1] == 'x' || cp[1] == 'X') && cp[2]);
if (!hexescape) {
octescape =
(*cp == '\\' && cp[1] && (cp[1] == 'o' || cp[1] == 'O') && cp[2]);
}
if (hexescape || octescape) {
cval = 0;
cp += 2;
if (octescape)
dlimit = 8;
} else if (*cp == '#' && cp[1]) {
hexescape = TRUE;
cval = 0;
cp += 1;
} else if (cp[1]) {
cval = 0;
dlimit = 8;
} else if (!cp[1]) {
if (strchr(dec, *cp) != 0) {
/* simple val, or nothing left for \ to escape */
cval = (*cp - '0');
}
dlimit = 1;
cp++;
}
while (*cp) {
if (!hexescape && !octescape && strchr(dec, *cp)) {
cval = (cval * 10) + (*cp - '0');
} else if (octescape && strchr(oct, *cp)) {
cval = (cval * 8) + (*cp - '0');
} else if (hexescape && (dp = strchr(hexdd, *cp)) != 0) {
cval = (cval * 16) + ((int) (dp - hexdd) / 2);
}
++cp;
if (++dcount > dlimit) {
cval = -1;
break;
}
}
return cval;
}
#endif /* CHANGE_COLOR */ #endif /* CHANGE_COLOR */
/*coloratt.c*/ /*coloratt.c*/

View File

@@ -5523,4 +5523,21 @@ globby_bill_fixup(struct obj *obj_absorber, struct obj *obj_absorbed)
return; return;
} }
/* Shopkeeper bills for use of a land mine or bear trap they own */
void
use_unpaid_trapobj(struct obj *otmp, coordxy x, coordxy y)
{
if (otmp->unpaid) {
if (!Deaf) {
struct monst *shkp = find_objowner(otmp, x, y);
if (shkp && !muteshk(shkp)) {
SetVoice(shkp, 0, 80, 0);
verbalize("You set it, you buy it!");
}
}
bill_dummy_object(otmp);
}
}
/*shk.c*/ /*shk.c*/

View File

@@ -2000,21 +2000,6 @@ tty_ibmgraphics_fixup(void)
#endif /* VIRTUAL_TERMINAL_SEQUENCES */ #endif /* VIRTUAL_TERMINAL_SEQUENCES */
} }
#ifdef CHANGE_COLOR
#ifdef NO_TERMS
void
tty_change_color(int color UNUSED, long rgb UNUSED, int reverse UNUSED)
{
}
char *
tty_get_color_string(void)
{
return ("");
}
#endif
#endif /* CHANGE_COLOR */
#ifdef PORT_DEBUG #ifdef PORT_DEBUG
void void
win32con_debug_keystrokes(void) win32con_debug_keystrokes(void)