Behaviorally: This change makes it so that Enter will never cancel
a dialog, unless that dialog only contains info to be read. Escape
will never unpredictably be treated as Enter. And some dialogs without
Escape to cancel, now can be canceled with Escape.
A lot of this just refactors dialogs to define the cancel button
at the top, not as a hotkey on a cancel button deep in the XML.
I think this makes enter/escape behavior in dialogxml files more
legible at a glance.
In addition, the default button is finally properly outlined when specified with the defbtn attribute.
(It would also be outlined if specified with def-key='enter'.)
The following preset buttons (available to special nodes) now respond to the enter key:
- "Leave", "Done", "OK"
- Modifiers are now given in the def-key attribute, as originally intended
- Dialogs that have a help button now assign F1 to that button (replacing shift+/ in some cases)
- F1 also brings up help in the main game (in addition to shift+/)
- Some item abilities didn't appear in the editor ability selection dialog
- If have (+take) nodes took by default (ie when left at -1)
- Rename button in edit terrain dialog, as the old name barely fit
- Nuke some uses of strcpy, sprintf, etc; current info strings in the scenario editor are now stored as std::string instead of C-strings.
- A smarter method of calculating the "erase" terrain for a given terrain type. In case of impassable spaces, trims, and walkways, instead of using the ground terrain, the trim terrain (if any) is used as the erase terrain; if there's no trim, ground 0 (cave, by default) is used. The method of determining if two terrains are essentially the same (ie, whether to paint or erase) has also been improved a little.
- Also, to reduce confusion, the erase terrain is now shown beneath the paint terrain.
Terrain changes:
- Add "archetype" flag as a better way of determining which amongst a set of terrains sharing the same ground type should be considered as the most basic terrain of that ground type. It's automatically applied to any terrains using original graphics when importing an old scenario; generally, any with no terrain special will be marked as an archetype, but if the lava graphic was used, it's instead any with a terrain special. It's a crude method that may easily break, but probably not possible to do better.
- When importing old scenarios, set the two walkways to be separate ground types while the crops should have grass as their ground, and the conveyors have cave.
- Fix fly, boat, block horse LEDs not being cleared if a terrain lacks that flag when using the arrow buttons. This could lead to terrains accidentally picking up the flags of nearby terrains in the list.
- Fix the block horse flag was not correctly saved when closing the dialog.
- Fix the block horse flag not being correctly loaded from the scenario file
- Fix documentation of how to format map graphics, to match the logic in the code
- Fix display of map graphics both on the automap and in dialogs
- Add Choose button to select the map graphic
- Fix the vanishing text bug again (this time it only triggered for fields with a single character in them)
- Introduce enum for step sounds
- Remove union for treating terrain flags as either signed or unsigned
Editor:
- Add Choose button to select the "transform to" terrain.
- Implement Choose buttons as appropriate for the terrain flags, including editing the special that a terrain calls.
- Range-check the terrain flags.
- Add Custom button to choose a town as the combat arena.
- Fix/tweak/improve several of the terrain flag prompts.
- Fix placing shortcut key in field as its ASCII code instead of the letter
- Fix some of the range checks that were already in place but were incorrect or improperly static
Game:
- The wilderness terrain types now allow specifying how many d6's of food you get when hunting there.
- Crumbling terrain uses flag 2 instead of 3 to determine method (flag 2 was supposed to be strength but was never used)
- Merge two functions that did almost exactly the same thing (namely altering a terrain space and potentially updating conveyor/lights info)
- Merge switch_level into handle_lever since it was the only place it was called
- Remove global store_special_loc; the location is stored in the stuff_done array now
- Change when use/step on terrains will now update lighting if they changed to a terrain with a different light level
- Terrains that call a special no longer support mixed global/local modes - they either always call a local special or always call a global special
- Use previously unused swap_ter function (which did the exact same thing as the swap terrain special node)
Dialog Engine:
- Don't "erase" invisible icons or buttons; it's not necessary, since the entire window is filled with background before the draw() method is called, and it causes problems in case of overlapping elements.
- Remove keybindings from terrain dialog arrow buttons
- Fix arrow buttons not bound-checking fields
Dialog engine:
- Fix fields crashing after text is set while it has focus
- Trigger focus handler on untoast() to balance that in toast()
- All Carbon code is gone
- Many dialogs converted; some are still left unimplemented since they still need to be converted
- Menus converted to a xib file
- The giant arrays specifying the configuration of the special node dialog for each special node type have been replaced with maps and sets.
Changes to dialogs:
- pict choice dialog can now show picts of differing types; this was required for picking a monster graphic, as monsters of all sizes need to be shown in the same dialog
- string choice dialog can set the title, and properly shows the currently selected string
- LEDs now accept font format
- Fixed LED group's calculation of its rect
- Fixed LED group crashing if it has no selection
- Tabbing between text fields now works
- Fix display of larger monster graphics in dialogs
- Fix the script element content showing in the browser preview
(PC Editor and Scenario Editor are unaffected by this commit.)
Things removed:
- All references to Carbon and QuickDraw are gone.
- No more Resource Manager; the game no longer relies on old resource files at all
- The old dialog framework (from dlogtool.c, functions usually prefixed with cd_) is no longer used.
- Files that weren't being compiled
- Boost libraries that are now in the C++ library (function, shared_ptr)
- Obsolete build settings
Replacement dependencies:
- Boost Filesystem replaces references to things like FSSpec
- SFML replaces all the QuickDraw code and most window management
- Cocoa replaces AppleEvent management, menu management, and some window management
- I wrote a resource manager interface to mimick the important aspects of the behaviour of the Mac Resource Manager
- I had to rewrite some functions that QuickDraw provided natively, such as clipping regions; not all of these are tested
Things added:
- Every referenced dialog has been converted from a DITL resource into the new XML-based dialog format.
- All referenced STR# resources have been extracted into simple text files
- Now compiles against Mac OSX 10.7 SDK and libc++
- The first item in the Help menu opens the docs on Sylae's website
- It seems all the constants for soundtool vanished somewhere, so I added them back from the original Mac source
Other changes:
- Updated to XCode 4(?) project format
- Added the xcschemes created by XCode 4; I'm not sure how important these are, but they seem like they might be important
- Added document on converting dialogs to the XML format.
- Make string formatting mismatches into errors instead of warnings
- Disable error limit
- Graphics sheets that previously used masking now have alpha transparency
- Converted all graphics sheets to 8-bit PNG
- Trimmed white border from intro image
- Converted dialogs in the resource file have their resource name set to the name of the XML file of the converted version
- Referenced string resources in the resource file have their resource name set to the name of the text file of the extracted version
- Add the black-and-white patterns from the PAT resources to the pixpats.png; at least one of them is used somewhere in the game
- Recreated the menu.xib as a Cocoa xib file instead of a Carbon xib file
- Disable GNU C++ extensions; maybe this'll make it easier to compile with cl.exe later
- Add marks to the enormous handle_action function to make it easier to navigate\
- A build step to validate the XML dialogs using xmllint (doesn't quite work properly yet but does at least catch dialogs that are not well-formed)- Fix a lot of warnings about assigning string constants to non-const char pointers
- Fixed the file and application icons (which had somehow become corrupted at some point)
- Lots of additional functions in the custom location and rectangle classes, including implicit conversion to and from SFML rects and vectors; also they now store coordinates as int instead of char
- A new enum for encounter note types
- Much tweaking of the encounter note recording mechanisms
- To ease porting, I added a simple function that converts from classic Mac ticks (about 1/60 of a second) to the SFML time type
- Python script to convert STR# resources to txt files, replacing newlines with vertical bars
- Extracted the Mac font (Dungeon Bold) from the resource file and also added the Windows font (MaidenWord)
XML Dialog Framework changes:
- Remove the static initialization object in favour of manually calling cDialog::init()
- {set,get}Format() no longer used for colour; there's a dedicated {set,get}Colour() instead
- draw() methods unprotected in the control classes so that controls can be drawn in the main window
- There's no longer a friend relationship between the dialogs and the controls
- Fixed buttons duplicating the "depressed" boolean
- Buttons now properly offset the label for tiny and push buttons, and for LEDs
- Buttons no longer assume that either none or both of "width" and "height" are given in the XML
- Add {get,set}BtnType() to cButton
- cLedGroup now overrides handleClick(), which has also been made virtual; this was necessary for LEDs within a group to properly hilite while being clicked
- Add addChoice() to cLedGroup to insert additional LED choices
- Moved the key enums and cKey to a separate file
- Add a method to get a control's attached key
- Add methods to get and set a control's rect and position
- Controls can now directly take a window as a parent rather than a dialog
- Add addLabelFor() method to cDialog which adds a static text control as a label for another control
- Remove hack for storing a dialog result of arbitrary type in favour of boost::any
- Add method to get default text colour for a dialog
- Add method to get a dialog's rect
- Add method to add the same event handler to multiple controls in a dialog
- Add concept of default button to dialogs
- Add enum for text field type (currently either number or text)
- Implement the text field without use of native controls, including somewhat decent text input and a flashing insertion point
- cPict no longer stores references to every sheet; it fetches them as needed from the resource manager
- The many draw functions in cPict are no longer static, since they need to access the window containing the pict (before they could only be static due to QuickDraw's global state)
- Add setPict() without a type argument to change the graphic without changing the type, which is a common operation
- Add a scrollbar control; the specifics aren't implemented yet
- Change signature of the record callback for cStrDlog; it will no longer be passed the strings
- Publicize the no-button constructor of cChoiceDlog; it'll assume "okay" is the only button
- Add operator-> to cPictChoice for accessing the underlying dialog
- Add constructor to cPictChoice that takes a starting and ending pic num
- Remove err parameter from giveError
- Many more keys handled, plus support for catching copy, paste, cut, and select all keyboard shortcuts
- Text input fields take priority, overriding any other keyboard shortcuts in the dialog, but they never catch help (F1), escape, or enter
- Some changes to the format itself:
-> keys go in the "def-key" attribute, but modifiers go in "key-mod"
-> "clickable" is no longer a recognized attribute
-> "title" is now a recognized text size (18pt, even larger than "large" at 12pt)
-> "defbtn" attribute on the root element