gcu on linux with colors?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mibert
    Apprentice
    • Mar 2016
    • 57

    gcu on linux with colors?

    Hey all,

    does anyone know whether any version (sil, q, mpa) can be compiled with ncurses so that the gcu version runs with correct colors and also the background thing for unwary monsters?

    Thanks a lot!
  • Gwarl
    Administrator
    • Jan 2017
    • 1025

    #2
    Sil-Q works correctly (I know because I fixed it). If you simply copy the main-gcu.c file from Sil-Q over the one in regular Sil, regular Sil will work correctly as well.

    Comment

    • mibert
      Apprentice
      • Mar 2016
      • 57

      #3
      Originally posted by Gwarl
      Sil-Q works correctly (I know because I fixed it). If you simply copy the main-gcu.c file from Sil-Q over the one in regular Sil, regular Sil will work correctly as well.
      cool, thats great news.

      I compiled a freshly pulled sil-q with these pre-defined settings:
      Code:
      DEFINES= -D"USE_GCU"
      CFLAGS = -std=c99 -O2 -fno-strength-reduce -pipe
      LIBS = -lcurses
      But the executable gives me:
      Code:
      ./sil: Unable to prepare any 'display module' (such as 'x11' or 'gcu')!
      I then used my own settings:
      Code:
      CFLAGS = -std=c99 -O1 -pipe -g -D"USE_GCU" -I/usr/include/ncurses
      LIBS = -lncurses
      The game will then start just fine, but already on 50ft i can see that sleeping monsters do not have the respective background.

      Any help/idea would be really be appreciated

      Comment

      • Quirk
        Swordsman
        • Mar 2016
        • 462

        #4
        I'm afraid Sil-Q doesn't have the background colour highlighting for GCU either. I had a quick glance over it, but it looks to me like it requires the GCU colour handling to be overhauled to permit altering background colour. It's currently set using ncurses init_pair to initialise background and foreground colour together, and has a table of just 16 colours; it masks colours it encounters with 0xF to only use the last nibble. I'd need to extend the colour table, which might be easy or might not, I haven't really dug into this very much.

        Something that will definitely be in the next release is [ and ] to show you a list of monsters and objects, Angband style, and that will also tell you which monsters are wary or unwary.

        Apologies for the makefile issue; I merged someone else's changes and didn't copy Makefile.std over my Makefile so hadn't tested. I'll fix accordingly.
        Last edited by Quirk; January 8, 2018, 21:36.

        Comment

        • Gwarl
          Administrator
          • Jan 2017
          • 1025

          #5
          That's how it did work before I copied the colour handling from V over it. The 16 color pairs is more or less dead code now.

          Comment

          • Quirk
            Swordsman
            • Mar 2016
            • 462

            #6
            Originally posted by Gwarl
            That's how it did work before I copied the colour handling from V over it. The 16 color pairs is more or less dead code now.
            No, this is not true. The colour handling in the patch you applied still supports just 16 colours and the colour table has just 16 entries; there's a loop from i = 0 while i < 16 to fill them in, you can verify this for yourself. The difference is that it's using the xterm colour pairs not the built-in curses colour pairs, and it's overwriting the curses colours on receiving TERM_XTRA_REACT while compiled in 256 colour mode.

            Comment

            • Gwarl
              Administrator
              • Jan 2017
              • 1025

              #7
              I will confess I didn't bother to understand how it all worked, I just copied from poschengband which in turn had copied from V. But we definitely have more than 16 colors now, and angband itself iirc defines 27 colors. The main-gcu file to my understanding maps angband's internal colors to the 16 color pairs, and the patch maps them to xterm colors (all 27 of them).

              Again though it was mostly just copy/paste work that I did and it's entirely possible I'm wrong. MPA-Sil has its own 256 color support, but those colors look 'wrong' to me which is why I went with the vanilla patch instead.

              Comment

              • Quirk
                Swordsman
                • Mar 2016
                • 462

                #8
                From the comment in your patch:

                Code:
                /* If we have more than 16 colors, find the best matches. These numbers
                 * correspond to xterm/rxvt's builtin color numbers--they do not
                 * correspond to curses' constants OR with curses' color pairs.
                 *
                 * XTerm has 216 (6*6*6) RGB colors, with each RGB setting 0-5.
                 * RXVT has 64 (4*4*4) RGB colors, with each RGB setting 0-3.
                 *
                 * Both also have the basic 16 ANSI colors, plus some extra grayscale
                 * colors which we do not use.
                 */
                This is followed by looping over the 16 colours in the GCU "colortable" array, finding the most appropriate colour in the XTerm or RXVT colour space to use, and using it. Only the first 16 Angband colours (there are 32, specified in a table large enough to hold 256, the rest of the data apparently uninitialised!) are scaled into XTerm or RXVT colour space.

                For the most part it isn't really an issue - you don't want to have colours so similar that you're trying to determine whether that's a mauve 'd' or a lilac 'd' you're facing off against - but since in the GCU implementation the background colour is linked to the foreground colour, more work would need to be done to be able to change the background colour to highlight unwary monsters.

                Comment

                • Nick
                  Vanilla maintainer
                  • Apr 2007
                  • 9637

                  #9
                  I just came across this post on reddit which seems relevant here - there was a mention of having to edit main-gcu.c a bit, but it does look very pretty.
                  One for the Dark Lord on his dark throne
                  In the Land of Mordor where the Shadows lie.

                  Comment

                  Working...
                  😀
                  😂
                  🥰
                  😘
                  🤢
                  😎
                  😞
                  😡
                  👍
                  👎