Changed the names of the pointers to GraphicsManager
and CursorManager to be shorter, since they were
inconsistent with the rest of the managers, and typing
them out is a chore.
Replicating a bug in the original engine, where a value
from TBOX is used in all rendering, resulting in all wrapped
textlines appearing slightly indented inwards.
Implemented the Autotext record type, which is used for
text rendering (prior to its introduction in nancy6, all
in-game text was prerendered). Made relevant changes to
the Overlay and Hypertext classes to support it.
Modified the Textbox code so the conversation font is no
longer the default, but rather has to be requested by
Conversation types. This fixes the nancy6 tutorial having
a blue highlighted text while explicitly needing red.
Fixed some incorrect assumptions about the data found
inside TBOX and FONT boot chunks. Made relevant changes
to HypertextParser to reflect the new data.
Added a separate class for handling hypertext (tagged
text used in conversations, etc) in preparation for the
addition of Autotext, which will also use it.
Fixed an issue where strings with invalid color markup
were being processed differently from the way the original
engine did, making some strings colored when they
shouldn't be. This fixes the nancy4 intro and some other
strings in the same game.
Previously, the NancyEngine class was responsible for
handling creation and destruction of many naked pointers
to engine data, which led to several instances of memory
leaks that needed to be fixed. These changes introduce a
standard way of handling that same data, similar to the
one already used by PuzzleData inside Scene. Unfortunately,
this does add the need for relevant data to be casted to
the proper type before it is handled.
The previous design, where the textbox kept its contents
unless it was explicitly cleared, was probably a leftover
from the early days of the engine, though I honestly can't
remember.
Added logic for the <f#> token introduced in nancy5,
which selects which font to use when rendering the string.
Rewrote the hypertext handling to use StringTokenizer.
This makes the addition of new tokens much easier, while
also ensuring unimplemented tokens no longer crash the
engine.
Fixed an edge case where color wouldn't get toggled
correctly in the textbox drawing function. This fixes the
lose game dialogue when unhooking the chandelier
in nancy3.
Nancy3 did away with earlier versions of the engine's usage
of 1 and 2 as false/true values. This commit adds two
new values to NancyEngine: _true and _false, which hold
the correct values used by different versions of the engine.
Fixed the incorrect assumption that the <o> token is the last
thng to appear in a text line, since nancy2's dialogue has
newline tokens at the end instead.
Boot chunks BSUM, VIEW, INV, and TBOX are now read only at startup,
and their data is kept permanently inside NancyEngine. This removes the
need for the chunks to be read by multiple classes and always kept
in memory.
The calculations for getting the inner height of the textbox have been
tweaked to get results closer to the original engine. This fixes an issue
in The Vampire Diaries where longer text would get cut off at the end.
Scrollbars in The Vampire Diaries are now drawn one pixel to the left
so they are in the exact spot as the original engine. Also, the textbox
scrollbar now correctly overlaps the inventory box curtains.
Rewrote GraphicsManager::draw() to be simpler and more correct,
eliminating the need for RenderObjects to know what they're
overlapping at creation. This comes at the cost of slightly increased
redraw, but that can be reduced fairly easily if needed.
Changed the UI::Scrollbar class so it doesn't require subclassing and added functionality for horizontal scrollbars. Fixed the textbox and inventory box scrollbars so their lowest point is consistent with the original engine's.
Removed the BlitType enum and getBlitType() method from RenderObject, and replaced them with setTransparent(). This was done to reduce redundant code, since ManagedSurface can already pick between a transparent and regular blit depending on whether the provided source surface has a transparent color set. Also added the correct transparent color for The Vampire Diaries, and the transparent color for nancy1 now gets calculated on the fly.
Changed surfaces in the textbox and inventory box so they are now initialized with the screen pixel format instead of the one used inside images. With this change The Vampire Diaries no longer fails a particular assert in the ManagedSurface blitting code, and can now boot successfully.
Added generic methods for getting the pixel format and transparent color. Also added a method for loading an image directly into a ManagedSurface, which also loads the palette and lets The Vampire Diaries logo display properly.
Made all states (Scene, Credits, Help, etc.) singletons, as well as subclasses of a common State parent with a proper state switching API. Moved the OnPause virtual function from RenderObject to ActionRecord and hooked it into the state switching code. Also got rid of the NancyEngine pointer that got passed around between most classes, and replaced it with several convenience macros. As a result of these changes action records that render to the viewport no longer disappear after opening the menu, and state changes feel snappier.