Skip to content

map_coloring: L's Coloured Walls and Floor v1 patch (adapted) - #6

Closed
tung wants to merge 1 commit into
NetHack:NetHack-3.6.0from
tung:map-coloring
Closed

tung wants to merge 1 commit into
NetHack:NetHack-3.6.0from
tung:map-coloring

Conversation

@tung

@tung tung commented Mar 11, 2016

Copy link
Copy Markdown
Contributor

This implements the Coloured Walls and Floor v1 patch by L (Leon Arnott):

This recolors various features of the dungeon:

  • Walls of the Wizard's Tower are magenta.
  • Other walls in Gehennom (except the Valley) are red.
  • Walls of the Gnomish Mines are brown, except for room walls.
  • Walls of the Astral Plane are white.
  • Altars are bright blue / gray / black / red depending on alignment, except on the Astral Plane, where they are all bright magenta.

This new feature can be toggled with the new map_coloring option (default on).

Compared to the original patch:

  • The original patch had no option and was thus unconditional.
  • Floors are no longer colored, since it looks ugly.
  • Walls of Sokoban are bright blue.
  • The Valley of the Dead is no longer grayscale, since it would be an interface screw.
  • Beehives are not colored, since it interacts poorly with the way special rooms are handled.
  • Lawful altars were white in the patch, but bright blue here, since white and gray are hard to distinguish.
  • Room preservation has been adapted for the new level compiler.
  • One of the tiny closets in Grotto Town is fixed to be colored as room wall instead of mine wall.
  • Orc Town area is considered rooms instead of mine wall.

This implements the Coloured Walls and Floor v1 patch by L (Leon
Arnott):

 * http://bilious.alt.org/?296
 * http://l.j-factor.com/nethack/glyphcolor.diff

This recolors various features of the dungeon:

 * Walls of the Wizard's Tower are magenta.
 * Other walls in Gehennom (except the Valley) are red.
 * Walls of the Gnomish Mines are brown, except for room walls.
 * Walls of the Astral Plane are white.
 * Altars are bright blue / gray / black / red depending on alignment,
   except on the Astral Plane, where they are all bright magenta.

This new feature can be toggled with the new `map_coloring` option
(default on).

Compared to the original patch:

 * The original patch had no option and was thus unconditional.
 * Floors are no longer colored, since it looks ugly.
 * Walls of Sokoban are bright blue.
 * The Valley of the Dead is no longer grayscale, since it would be an
   interface screw.
 * Beehives are not colored, since it interacts poorly with the way
   special rooms are handled.
 * Lawful altars were white in the patch, but bright blue here, since
   white and gray are hard to distinguish.
 * Room preservation has been adapted for the new level compiler.
 * One of the tiny closets in Grotto Town is fixed to be colored as room
   wall instead of mine wall.
 * Orc Town area is considered rooms instead of mine wall.
@moon-chilled

Copy link
Copy Markdown

IMO map_coloring should default to off, and that would probably also align more with the DT's values.

@paxed

paxed commented May 28, 2016

Copy link
Copy Markdown
Contributor

How does this work with tiles - especially the Wiz tower walls? The others I think already have branch-specific tiles.

@tung

tung commented May 28, 2016

Copy link
Copy Markdown
Contributor Author

How does this work with tiles - especially the Wiz tower walls? The others I think already have branch-specific tiles.

This should have no impact on tiles. It modifies mapglyph(), which is used almost exclusively by ASCII modes (e.g. TTY windowport, Win32 pseudo-ASCII). The only places mapglyph() is used by tiles is to grab special flags to e.g. mark pets with a heart icon, which is unaffected by the color that this feature changes. To windowports that render tiles, this feature is essentially invisible, except for the "map_coloring" option, which makes sense for e.g. Win32 pseudo-ASCII. Windowports that render ASCII don't need to do anything they weren't already doing; Wizard Tower walls are handled entirely inside mapglyph().

Apologies if the details are hazy; I'm not at all familiar with any of the tiles code, and it's been over two months since I've even looked at this code.

arekkusu42 referenced this pull request Mar 16, 2018
Making them easy to distinguish from walls.
@webbedspace

Copy link
Copy Markdown

I am Leon and wrote the original patch, which I've decided to no longer keep online due to being for a very old NH version, but I greatly appreciate this pullreq's gesture of support.

@arekkusu42

arekkusu42 commented Jun 11, 2020 via email

Copy link
Copy Markdown

@copperwater

Copy link
Copy Markdown
Contributor

SpliceHack and xNetHack, both based on 3.7, have up-to-date implementations of this patch. I can provide an updated pull request based on that if desired.

@bhaak

bhaak commented Jun 11, 2020 •

Copy link
Copy Markdown
Contributor

I am Leon and wrote the original patch, which I've decided to no longer keep online due to being for a very old NH version, but I greatly appreciate this pullreq's gesture of support.

@webbedspace Many of your patches made it (in one form or another) into various forks. E.g. dilapidated armouries, tinfoil hat, and this colored wall patch or also some into vanilla as well, like the picture-painting demon and the polysink patch.

Even though your old website is preserved on the Internet Archive and the patches are for an older version, a live version is much more preferred to show where the original inspiration came from.

@nhmall nhmall closed this Jun 5, 2021
@nhmall
nhmall deleted the branch NetHack:NetHack-3.6.0 June 5, 2021 16:28
nhcopier pushed a commit that referenced this pull request Dec 1, 2022
If you were on a level teleporter, the spoteffects() call after
the hero gets expelled could end up going to a new level and
freeing all the monst chains from the level you were originally
engulfed on.

    #0 0xba0507 in free
    #1 0x87feda in dealloc_monst src/mon.c:2369
    #2 0x880a02 in dmonsfree src/mon.c:2194
    #3 0x9a7aa2 in savelev_core src/save.c:507
    #4 0x9a7a21 in savelev src/save.c:466
    #5 0x71eb9d in goto_level src/do.c:1483
    #6 0x71833f in deferred_goto src/do.c:1903
    #7 0xa2533f in level_tele src/teleport.c:1117
    #8 0xa2567b in level_tele_trap src/teleport.c:1198
    #9 0xa5c007 in trapeffect_level_telep src/trap.c:1861
    #10 0xa5f856 in trapeffect_selector src/trap.c:2497
    #11 0xa47497 in dotrap src/trap.c:2586
    #12 0x7d669b in spoteffects src/hack.c:2859
    #13 0x89d495 in xkilled src/mon.c:3187

The latter parts of xkilled() after the spoteffects() call would
then attempt to dereference the free'd monst pointer.

Save a copy of the monst struct prior to spoteffects() if you were
expelled, then point at the reference copy afterwards.

Resolves #938
nhcopier pushed a commit that referenced this pull request Aug 28, 2023
On GitHub issue 1090, Rhialto wrote:
Hi! I am currently in the process of adapting the pkgsrc packaging of NetHack 3.6.7 to include the curses window option. A bit late perhaps...

While working on that, I ran into a case of a NULL pointer being used. Apparently when linking with ncurses, this doesn't cause problems, but NetBSD's own curses doesn't like it, and crashes the game.

Here is the stack trace. It happens when #quitting, I think just before the high scores are about to be shown (but I guess it should show in the stack trace if I'm totally correct with that):

(gdb) bt
 #0  redrawwin (win=0x0) at /usr/src/lib/libcurses/touchwin.c:149
 #1  0x0000000017e104b4 in curses_refresh_nethack_windows () at ../win/curses/curswins.c:176
 #2  0x0000000017e1054a in curses_destroy_win (win=win@entry=0x7ad219520540) at ../win/curses/curswins.c:155
 #3  0x0000000017e1512c in curses_display_nhmenu (wid=<optimized out>, how=<optimized out>, _selected=0x7f7fff65d850) at ../win/curses/cursdial.c:771
 #4  0x0000000017e0ff81 in curses_select_menu (wid=wid@entry=21, how=how@entry=0, selected=selected@entry=0x7f7fff65d850) at ../win/curses/cursmain.c:607
 #5  0x0000000017e10257 in curses_display_nhwindow (wid=21, block=1) at ../win/curses/cursmain.c:385
 #6  0x0000000017ca8075 in really_done (how=<optimized out>, how@entry=13) at end.c:1609
 #7  0x0000000017ca993f in done (how=how@entry=13) at end.c:1201
 #8  0x0000000017ca9c85 in done2 () at end.c:381
 #9  done2 () at end.c:337
 #10 0x0000000017c489da in doextcmd () at cmd.c:363
 #11 0x0000000017c57e94 in rhack (cmd=<optimized out>, cmd@entry=0x0) at cmd.c:4909
 #12 0x0000000017c265da in moveloop (resuming=<optimized out>) at allmain.c:435
 #13 0x0000000017e1b862 in main (argc=<optimized out>, argv=<optimized out>) at ../sys/unix/unixmain.c:351
status_window is NULL here. Simply checking for NULL avoids the problem. I added checks for the other windows as well, while I was there.
nhcopier pushed a commit that referenced this pull request Dec 23, 2024
If freedynamicdata() gets called twice, for whatever reason, a "double free" can occur.

warning: 44     ./nptl/pthread_kill.c: No such file or directory
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff7c8b26e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff7c6e8ff in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff7c6f7b6 in __libc_message_impl (fmt=fmt@entry=0x7ffff7e148d7 "%s\n")
    at ../sysdeps/posix/libc_fatal.c:132
#6  0x00007ffff7ceefe5 in malloc_printerr (str=str@entry=0x7ffff7e17bf0 "free(): double free detected in tcache 2")
    at ./malloc/malloc.c:5772
#7  0x00007ffff7cf154f in _int_free (av=0x7ffff7e49ac0 <main_arena>, p=<optimized out>, have_lock=0)
    at ./malloc/malloc.c:4541
#8  0x00007ffff7cf3d9e in __GI___libc_free (mem=0x555555ad82a0) at ./malloc/malloc.c:3398
#9  0x00005555557c12e9 in free_rect () at rect.c:48
#10 0x00005555557d77a2 in freedynamicdata () at save.c:1240
#11 0x0000555555682754 in nh_terminate (status=0) at end.c:1671
#12 0x000055555589af15 in opt_terminate () at ../sys/unix/unixmain.c:768
#13 0x000055555589af7a in after_opt_showpaths (dir=0x0) at ../sys/unix/unixmain.c:796
#14 0x0000555555693dd9 in do_deferred_showpaths (code=0) at files.c:4491
#15 0x0000555555778405 in initoptions () at options.c:6948
#16 0x0000555555899cd9 in main (argc=2, argv=0x7fffffffdad8) at ../sys/unix/unixmain.c:151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants