Textui reform (warning: long and full of C)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • takkaria
    Veteran
    • Apr 2007
    • 1951

    #91
    Originally posted by t4nk
    Well I got around to doing it:

    Where can I place other prompts and messages, though? Some stores have tons of stuff...
    https://postimg.org/image/fbgs8uckl/
    I guess I was imagining something more like:

    "Buying: 5 Potions of See Invisible
    You already have 4 of this item.
    How many do you want?
    ___"

    Just to make it a bit clearer about what you're actually buying...

    Also I just found the following bugs after running around a bit:

    1. I just hit a teleport trap and the panel didn't shift to show the @ until I moved around a bit.
    2. Nomad's tiles should be 8x16, not 16x16.
    3. When you try to read/quaff etc. the letters displayed next to the items are not the letters used for the slot they're in - e.g. if you have scrolls in slots c and d, pressing 'r' will say "Read which scroll? (c-d)" but the actual menu tags will be a and b.

    PS Having Shockbolt's tiles working properly is amazing!
    Last edited by takkaria; October 25, 2016, 02:04.
    takkaria whispers something about options. -more-

    Comment

    • t4nk
      Swordsman
      • May 2016
      • 336

      #92
      Originally posted by takkaria
      I guess I was imagining something more like:

      "Buying: 5 Potions of See Invisible
      You already have 4 of this item.
      How many do you want?
      ___"
      What to do with messages, though? "You have no room for this item" and things like that... maybe I'll just leave them where they are, on the message line. They don't seem very useful...

      1. I just hit a teleport trap and the panel didn't shift to show the @ until I moved around a bit.
      I'll look into it... the new viewport shifting system is still pretty experimental
      edit: was that the latest code? (8d4b3c53e2a6062099 or later) also, did the panel fail to shift, or just the @ was invisible?
      edit2: well, can't reproduce this one! but there were changes to how map is redrawn several days ago, which were supposed to fix problems like this. I'll think about it...
      edit3: wait, I reproduced it! that was with (shockbolts) tiles and indeed a trap...
      edit4: that was embarassing. fixed

      2. Nomad's tiles should be 8x16, not 16x16.
      Not a bug, they're declared as 16x16 and they actually are 16x16. It's impossible to determine (programmatically) that they should be squished horizontally. The only (easy) way to do it is to special-case Nomads tiles.
      edit: well, I guess I could parse their name... but really, they should just be rescaled. I don't know why they're square in the first place.

      3. When you try to read/quaff etc. the letters displayed next to the items are not the letters used for the slot they're in - e.g. if you have scrolls in slots c and d, pressing 'r' will say "Read which scroll? (c-d)" but the actual menu tags will be a and b.
      Ah, right. Well, that's easy to fix... That's because Angband must stop inventory shuffling

      Thanks for bug reports, keep them coming!
      Last edited by t4nk; October 25, 2016, 06:09.

      Comment

      • t4nk
        Swordsman
        • May 2016
        • 336

        #93
        LOL! No so embarassed anymore! I was puzzled why I couldn't reproduce it with a staff of teleportation...
        Code:
        #define PR_MAP			0x00010000L	/* Redraw whole map */
        #define PR_INVEN		0x00010000L /* Display inven/equip */
        (player-calcs.h)
        Whenever something changes in inventory (such as number of charges in a staff), it tries to redraw whole map! (and flushes the term). And it probably was like this for years! Maybe Ben Harrison made this typo and no one ever noticed.
        I'll complain to Nick about it

        Comment

        • Nick
          Vanilla maintainer
          • Apr 2007
          • 9637

          #94
          Originally posted by t4nk
          LOL! No so embarassed anymore! I was puzzled why I couldn't reproduce it with a staff of teleportation...
          Code:
          #define PR_MAP			0x00010000L	/* Redraw whole map */
          #define PR_INVEN		0x00010000L /* Display inven/equip */
          (player-calcs.h)
          Whenever something changes in inventory (such as number of charges in a staff), it tries to redraw whole map! (and flushes the term). And it probably was like this for years! Maybe Ben Harrison made this typo and no one ever noticed.
          I'll complain to Nick about it
          All my own work
          One for the Dark Lord on his dark throne
          In the Land of Mordor where the Shadows lie.

          Comment

          • t4nk
            Swordsman
            • May 2016
            • 336

            #95
            Ah, ok then

            Comment

            • t4nk
              Swordsman
              • May 2016
              • 336

              #96
              ncurses client
              After some thinking, I decided to go for it. Unfortunately, I didn't find good documentation about ncurses, so I guess I'll have to do with this guide, manpages and I recall "The Linux Programming Interface" had some good chapters on pseudo ttys and job control (not particular to Linux). I intend to keep textui2 current with upstream, and fix bugs, but otherwise won't be pushing updates for a while. So don't take it as I sign that I'm done! Although I do think textui2 is in a pretty good shape now.

              Comment

              • takkaria
                Veteran
                • Apr 2007
                • 1951

                #97
                Hey, sorry I never replied here!

                Originally posted by t4nk
                What to do with messages, though? "You have no room for this item" and things like that... maybe I'll just leave them where they are, on the message line. They don't seem very useful...
                I guess you've resolved some of these things. I do like the using of the bottom line in the store as a prompt, that's good use of space.

                I'll look into it... the new viewport shifting system is still pretty experimental
                edit: was that the latest code? (8d4b3c53e2a6062099 or later) also, did the panel fail to shift, or just the @ was invisible?
                edit2: well, can't reproduce this one! but there were changes to how map is redrawn several days ago, which were supposed to fix problems like this. I'll think about it...
                edit3: wait, I reproduced it! that was with (shockbolts) tiles and indeed a trap...
                edit4: that was embarassing. fixed
                Hehe. Thanks for sorting it out

                Not a bug, they're declared as 16x16 and they actually are 16x16. It's impossible to determine (programmatically) that they should be squished horizontally. The only (easy) way to do it is to special-case Nomads tiles.
                edit: well, I guess I could parse their name... but really, they should just be rescaled. I don't know why they're square in the first place.
                Ah OK, my bad. I wonder if they're 16x16 because when the tileset was made, there was no support for non-square tiles. Hm.
                takkaria whispers something about options. -more-

                Comment

                • t4nk
                  Swordsman
                  • May 2016
                  • 336

                  #98
                  I guess you've resolved some of these things. I do like the using of the bottom line in the store as a prompt, that's good use of space.
                  Yeah, I did a pretty substantial prompts reform. The goal is to eventually make message line term optional. So all the prompts that want user input ("Really do that? [y/n]" and stuff like that) are now popups, and only "informational" prompts go to the DISPLAY_MESSAGE_LINE ("Read which scroll? (c-c, ESC)").

                  Comment

                  • t4nk
                    Swordsman
                    • May 2016
                    • 336

                    #99
                    ncurses client
                    So I learned some interesting things:
                    1) The design of curses was obviously a big inpiration for textui, notably in having separate "old" and "pending" screens. And then people just kept adding hack upon hack to it!
                    2) ncurses, OTOH, does have support for stacking/overlapping subwindows. ncurses is actually several libraries, its tarball includes the "basic" one (libncursesw) and additional things. Of interest there is libpanelw, which handles stacks of subwindows. If someone knows why it shouldn't be used, speak up! Perhaps one argument could be that some people compile only libncursesw, but I don't see why "some people" should expect to run videogames using minimal ncurses? Again, libpanelw is a part of ncurses distribution.
                    3) ncurses defines its own struct term, bastards The comment in main-gcu.c mentions that its the case on AIX? I don't know about AIX, but on Debian 8 <term.h> does define struct term. There is a bit of preprocessor hackery in main-gcu.c to deal with that, which, I suspect, breaks strict aliasing? (pedantry...) Maybe it would be better to rename Angband's term to angband_term.
                    4) I still have no idea what GCU means! Does anyone know?

                    Comment

                    • Derakon
                      Prophet
                      • Dec 2009
                      • 9022

                      Originally posted by t4nk
                      4) I still have no idea what GCU means! Does anyone know?
                      I googled for "gcu linux", and the third result is about Angband (and the first two results are irrelevant). So I'm guessing that it's someone's initials.

                      Comment

                      • t4nk
                        Swordsman
                        • May 2016
                        • 336

                        I got some results:



                        Exciting, right? Well, maybe not... after all, ncurses is obsolete crap Still, it displays something and can even be played a little!
                        I'll have to think what to do with overlapping terms (the ones created with Term_push_new()). Ncurses has some limited ability to draw borders, but, naturally, those take additional space, so it would increase minimal practical size of the screen to (80 + 2)x(24 + 2). Also, cursor handling has to be adjusted in textui2... perhaps some callback that is particular to ncurses (analogous to TERM_XTRA_SHAPE).
                        The ncurses branch is in "ui2-ncurses". Don't forget to include correct ncurses.h (widestring version - it probably lives in /usr/include/ncursesw or some such) and link with -lncursesw. I don't use panels (yet?), so libncursesw is the only dependency.

                        Comment

                        • t4nk
                          Swordsman
                          • May 2016
                          • 336

                          Ncurses is kind of fun. Regrettably, its documentation is garbage. So I have to figure out how to do things mostly by experimenting. I can't even read its source for long, cause it's written in disgusting GNU style
                          Anyway, it (or, rather, uxterm) can draw some questionable looking borders:


                          I also got the cursor working. I won't be using the panels library, since I have enough troubles with base ncurses already
                          So, the question. I don't want to do any term-choosing GUI for it. I'd rather hardcode everything... Which terms should it display? Perhaps two options - "minimal" (map, status line, sidebar, messages line - like "-b" in main-gcu.c) and "extended" (previous four + monster list + item list)? Or maybe environment variables, like X11 frontend does? Or Poschengband-style args? (probably not, I don't see any advantage of it over env vars). Or what?

                          Comment

                          • Nick
                            Vanilla maintainer
                            • Apr 2007
                            • 9637

                            Originally posted by t4nk
                            So, the question. I don't want to do any term-choosing GUI for it. I'd rather hardcode everything... Which terms should it display? Perhaps two options - "minimal" (map, status line, sidebar, messages line - like "-b" in main-gcu.c) and "extended" (previous four + monster list + item list)? Or maybe environment variables, like X11 frontend does? Or Poschengband-style args? (probably not, I don't see any advantage of it over env vars). Or what?
                            Can you get it to read the Angband subwindow setup options, and then make a smart choice based on that?
                            One for the Dark Lord on his dark throne
                            In the Land of Mordor where the Shadows lie.

                            Comment

                            • t4nk
                              Swordsman
                              • May 2016
                              • 336

                              Originally posted by Nick
                              Can you get it to read the Angband subwindow setup options, and then make a smart choice based on that?
                              Well, textui2 doesn't have any subwindow optons... that's not a problem on its own (that's just a bit of code, after all), the problem is the "smart" part

                              Comment

                              • Nick
                                Vanilla maintainer
                                • Apr 2007
                                • 9637

                                Originally posted by t4nk
                                Well, textui2 doesn't have any subwindow options...
                                Right, of course, it's all new, that's kind of the point...

                                Actually I quite like the environment variables idea, if I still have any credibility left
                                One for the Dark Lord on his dark throne
                                In the Land of Mordor where the Shadows lie.

                                Comment

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