New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add separate overmap font, Fix framebuffer artifacts #9429
Add separate overmap font, Fix framebuffer artifacts #9429
Conversation
I'm kinda scatterbrained at this time of night...
@@ -499,6 +507,10 @@ WINDOW *curses_init(void) | |||
jOut.member("map_fontheight", map_fontheight); | |||
jOut.member("map_fontsize", map_fontsize); | |||
jOut.member("map_typeface", map_typeface); | |||
jOut.member("overmap_fontwidth", overmap_fontwidth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can skip those changes in wincurses.cpp - not even the existing map_typeface is used there at all.
Neither of map_fontwidth, map_fontheight, map_fontsize nor map_typeface are used after they have been loaded from json. They seem to be pointless. Note that sdltiles.cpp has its own instances of those variable, they are not the same as those used here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was under the impression that they store default config data, seeing as the game's config files are generated if not present (as they are on first run).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I retract my statement.
Er, whops. How'd that slip past me. >_>
Okay, this error is odd. No member named "draw" in the WINDOW struct? It works fine in both configurations on my end, what could be causing this? |
|
||
// Draw black padding space to avoid gap between map and legend | ||
g->w_blackspace = newwin(TERMY, TERMX - 28, 0, 0); | ||
g->w_blackspace->draw = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The WINDOW struct from catacurse.h is only used in builds without ncurse. With ncurses, the WINDOW struct that ncurses supplies is used instead. And as far as I know the content of that struct is not public, you're supposed to use the ncurses functions with a pointer to those windows.
I guess it's easier to mvwputch a character of some kind into that window so it's marked as active as normal, since its contents aren't actually used. Its only purpose is to provide the dimensions of the black-out area. |
Well, I suppose this is all ready. I'm don't think anything else needs to be done here, unless some kind of bug crops up later. |
OK, I haven't had a good hard code-read on this one so maybe I'm missing something. Is this SDL-only or does it apply to Curses builds too? KA101 rereads Never mind, this is within my scope. Queued. |
I don't know if the framebuffer even works in Curses (it might), but even if it does the only problems arose due to the difference in font sizes between terrain and the rest of the game in SDL. Since Curses is hard-locked to the one font, neither the framebuffer fix nor the overmap thing apply to the Curses builds. Nor indeed the window gaps, or anything else. |
That's what I'd been thinking, but since this was being coded for Curses, I thought perhaps I was wrong. |
Can verify that it doesn't seem to immediately break anything on Curses, at least. ;-) |
What changes I did for Curses was exactly so that it wouldn't break anything. :-P |
I don't see any IDs here.
Btw. technically you can't even read a pointer after it has been deleted, so |
I call them IDs because that's what I see them as. They're pointers in principle, but insofar as I'm referring to them by their variable name, I call them IDs. And I would be very much fine with that example not working, but it does. Yeah, I sort of suspected that was the reason. w_overmap and w_blackspace are deleted when you leave the overmap. (w_blackspace is actually deleted immediately after being created and drawn... there has to be a better way to blank a section of screen from outside the window-drawing functions) The only reason they're noticeable is because they're the two windows that have special drawing clauses that don't exist in memory when other windows are being created. I'll work on a way to fix that. I'd consider adding an |
The pointer checking is intended to detect layout changes, and suppress the caching if it has changed, right? How about hooking into wrefresh() in wrefresh()->curses::draw_window()->font::drawwindow() to either set a flag or pass a parameter to tell drawwindow() to not use the cache? |
It's not just caching, I'll make the changes to keep |
Shouldn't impact memory use, I think.
Okay, now it should be actually ready. There are no more holes that I can see, and no more bugs showed themselves after the last change. |
Adds support for a separate, different-sized ASCII font for the overmap.
Now almost all map/terrain display in the game can be decoupled from the text, allowing to use readable rectangular fonts for one, and pretty square fonts for the other.
In the making of this feature, my previous attempt at fixing the framebuffer artifacts as reported in #9348 was broken on the overmap, and as a result it was folded into this feature as well, as it depends on some of the new window IDs.