Commit Graph

57 Commits

Author SHA1 Message Date
d3b0b26deb More scenario record read tests 2015-09-03 12:22:12 -04:00
812f485809 Stop applying lexical_cast to a stream manipulator as this seems to fail with later versions of clang; also close file after showing error, instead of before 2015-08-30 22:58:08 -04:00
bbd47088e1 Basic test cases for reading town, dialogue, and outdoor records 2015-08-28 13:38:08 -04:00
5762c2bb90 Tweak to error dialogs and add separate warning dialogs
(Also some error messages tweaked)
2015-08-14 23:30:18 -04:00
7719d62773 Test cases for reading terrain, monster, and item definitions
- For monster attacks, 'd4' now means '1d4' instead of '0d4', and simple numbers without a 'd' are not accepted
- Pop string path after pushing it in the shop test cases
2015-07-29 15:25:19 -04:00
9972c3d27d Various damage-related changes
- Rename unblockable damage to "weird" and special damage to "unblockable"
- Monsters now support immunity to any damage type
- Fix using wrong damage type for bonus damage in PC-on-PC attacks
- Forbid use of unblockable (formerly special) damage by the scenario designer, except in special nodes; if hacked in, it's replaced with weird (formerly unblockable) damage.
- Fix damage amount text in animations (both single-frame booms and fully animated booms)

Changed the following things from weird (formerly unblockable) damage to unblockable (formerly special) damage:
- Starvation
- Debug 'K' command
- Damage from items forcibly ending flight
- Damage from bashing doors
2015-07-19 10:59:22 -04:00
21c5c98c24 Some tweaks to scenario format 2015-07-10 14:43:15 -04:00
5458bc0d7b Scenario format tweaks
- Fix monster attitude enumerator not being reflected in schemas
- Store the sound ID for sound names, instead of the index into the sound name array
2015-07-09 20:32:45 -04:00
c957987b45 Tests for reading and writing map data
- Fix saving and loading boat/horse positions and property flag
2015-07-09 15:53:34 -04:00
59f60710c5 More test cases for reading shops 2015-07-07 22:22:10 -04:00
93f9860624 Tests for saving and loading shops
- Fix shop name not being loaded from the file
- Fix skills in shops not storing the skill ID
2015-07-07 22:04:11 -04:00
137a3aa5d4 A few more scenario read tests
- Introduce enum for scenario content rating
2015-07-07 18:58:35 -04:00
2218513aa5 Several more tests for scenario loading 2015-07-07 17:10:09 -04:00
7b76d37237 Store talk node type in scenario file as enumerator instead of numer
- Also, don't write empty CDATA sections when dialogue name/look/job sections are completely empty.
2015-07-05 23:30:43 -04:00
2d73bb01ae Nuke oopsError and out-dated "can't load game" error dialogs 2015-07-03 18:11:03 -04:00
1f5a1118f8 Some test cases for saving scenarios, and fix some bugs they revealed
- Fix variable town entry and saved item rects not being saved if they referenced an invalid town
- Fix "blank" scenario timers being saved
- Fix junk data appearing in timers
- Output operators for location and rectangle types
- Set timer node_type to 2 when loading from town record
2015-07-01 18:05:42 -04:00
d8b4ee9c56 Start building some unit tests using Catch test library
- Current version of Catch is included in the repo at test/catch.hpp
2015-07-01 16:10:36 -04:00
cea602ce6d Don't share the same temporary scenario directory between all programs
(Also fixes loading of unpacked scenarios)
2015-06-30 12:46:00 -04:00
c1fa65a01d Much better error-checking when loading scenarios
- First of all, the program no longer crashes after an error.
- A lot more constraints are now checked for, such as required elements; even some constraints not expressed in the schema
- Special node parsing now has actually useful error messages
- Map data parsing now has error messages for the few invalid cases
- Fix the XML utility exception classes originally used only by the dialog engine; they're now correctly caught and properly report the error
- Fix loading of special shop entries
- Fix accepting any character as the separator in dice constants
- Verify that the monster ability type is on the right ability tag, that the extra element is present only if needed for general abilities, and that the missile and range elements are present for non-touch general abilities
- Use "infinite" for quantity in special shop items, instead of 0
- Tweak ticpp to fill out file/line/col information for _all_ exceptions, not just parse errors
- Raise error (ie, set stream failbit) when failing to convert an enumerator, instead of silently returning a default value (they do still return a default value though, if you don't bother to check stream state)
- Fix status effect enumerator not being correctly saved/loaded
2015-06-29 19:55:59 -04:00
8a534c0524 Fix crash when loading scenarios packed by "tar -cf" 2015-06-27 16:16:12 -04:00
95b3d7e30e Implement recursive search for scenarios, allowing you to organize your scenarios directory 2015-06-26 14:18:17 -04:00
fc83f656bb Merge branch 'master' from windows 2015-06-26 12:33:54 -04:00
b30b2d3a58 Improve loading time for custom scenarios list 2015-06-24 11:21:34 -04:00
dcca4d30be Fix issues with the Edit Sheets dialog 2015-06-23 19:48:53 -04:00
dd90a18569 Fix legacy graphics not working on Windows 2015-06-23 19:48:15 -04:00
9d74f78df3 Implement all the missing parts of the Edit Sheets and Edit Sounds dialogs
- On load, the game now detects graphic sheets and sounds whose IDs are "discontinuous", as well as graphics intended to directly replace preset graphic sheets.
- Edit sheets dialog can now handle "discontinuous" graphics. (The edit sounds dialog already could.)
- Edit sheets dialog prompts user to create a new sheet if there are none already, and also if there are some but not ID 0 (in the latter case they can cancel and still edit the sheets).
- Edit sheets dialog prompts user to convert sheets if the scenario is legacy, rather than doing it silently
- Edit sheets dialog now has "new" and "delete" buttons
- Edit sounds dialog now has functioning "delete" button
2015-06-17 04:29:10 -04:00
580f70f49a Add a dialog in scenario editor to import/export custom sounds in WAV format 2015-06-17 01:03:17 -04:00
0798f98523 Symbolic I/O for more enums
- Nearly every enum that gets written to a file now uses a symbolic form rather than a numeric form. Input supports both forms.
- The special node type enum, however, no longer has a symbolic form output operator, as the only place it's output is in the special nodes file which uses the opcode.
- Collected some enums scattered around the files into one place in simpletypes.hpp
2015-06-13 15:43:29 -04:00
a990921e90 Several tweaks/fixes
- 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
2015-06-11 22:32:28 -04:00
a5a784c4f1 Several tweaks/fixes
- Enlightenment status now wears off over time
- Improve ghost mode - now you can pass through force barriers and forcecages too (but not escape forcecages); also locked doors or specials that block your progress... pretty much nothing can block your way now in ghost mode.
--> Part of this change was made in the previous commit as well.
- New debug command - Give Item. Since this is meant for debug use only, you have to enter the item's ID; players should instead use the character editor.
- Fixed custom spells (with Start Targeting node) not correctly honouring the range in combat mode (instead they had a range of 0)
- Fixed custom spells (with Start Targeting node) always calling a local node to determine the effect of the spell. Now they call the same type of node that initiated the targeting (so, if it was initiated in a scenario node, they call a scenario node, etc).
- Fix some unintentional switch fallthroughs
   - Flash Step erroneously printed a "not implemented" error message
- Fix get num response dialog incorrectly formatting the prompt
- Fix some crashes while talking due to the game still assuming there were 60 nodes
- Fix SDFs with y >= 10 not being zero-initialized when you enter a new scenario
- Allow special nodes to aware more than 200 XP in one batch (though in most cases, you probably don't want to)
- Fix Display Small Message node trying to use the wrong string, due to applying the legacy string modifiers. This also affected Debug Print Nums, which just copy-pasted the same code.
- The Dumbfound/Enlightened and Sleep/Hyperactivity status effects no longer "wrap" into each other. Thus, if you're dumbfounded, a "Cure Dumbfounding" item never enlightens you, but if you're not dumbfounded, it will.
- Fix an issue with invalid strings when porting outdoor shops
- Fix Reset Help option in the preferences causing a crash
2015-06-10 14:54:49 -04:00
dd5faacd4f Mac: Make preset sounds and graphics show as file packages
- Remove legacy sound/graphic file definitions
- Fix a couple of compiler warnings
2015-06-09 11:31:59 -04:00
1eac640d89 Fix loading of new-format scenarios on Windows 2015-06-08 22:14:56 -04:00
b807a1842f Fix shops loading incorrectly 2015-06-08 22:14:51 -04:00
2d9c3ba2d9 Remove the arbitrary limits on the following quantities:
- Number of terrain types - as long as the last terrain in the list is unused, you can delete it
- Number of monster types - as long as the last monster in the list is unused, you can delete it
- Number of item types - as long as the last item in the list is unused, you can delete it
- Number of special items
- Number of strings (scenario, journal, outdoors, town)
- Number of signs (outdoors, town)
- Number of description rectangles (outdoors, town)
- Number of town entrances (outdoors)
- Number of dialog nodes (town); number of personalities per town is still limited, but since you can use personalities from any town and the number of towns is unlimited, you still have effectively unlimited personalities

Other related stuff:
- Fix ability to select nonexistent terrains/items/monsters from the palette
- Fix inability to find unused special strings in some cases
- Fix sometimes incorrectly selecting the current node as the next node in the chain, instead of a new node
- When cancelling from the special node dialog, it's a bit more intelligent about whether or not to drop nodes from the end of the list
- Edit string dialog now has a cancel button
- Save otherwise unused talk nodes if they contain strings, to avoid loss of data that might be important
- Fix scenario and journal strings loading incorrectly if some strings were blank
- Fix some issues with list modes activated by menu not appearing until the mouse moves over the window
- Fix incorrect instructions in list modes (it's alt-click, not command-click as the instructions indicated)
- Implement "erase town entrance" button and create a visual difference between town entrances with an assigned town and those without
- Fix inability to erase monsters after the first 60 in town
- Fix escape key accepting changes in the shop dialog, instead of cancelling
- Fix quest/shop list resetting to top after editing one
2015-06-08 22:14:47 -04:00
01d317b007 .h -> .hpp 2015-06-08 22:14:43 -04:00
80f95ba9ae Several bugfixes
- Fix light mask not rendering correctly
- Fix terrain-sourced lighting not being calculated on scenario load
- Fix light-removing items incorrectly applying their ability strength
- Fix smash patterns not affecting opaque tiles (such as mouldy walls)
- Fix monsters outside the light range not being rendered when fog is lifted
- Fix town timers not being cancelled when you leave town
- Fix non-existent outdoor wandering encounters sometimes triggering due to uninitialized data
- Hard-wrap some doc lines
2015-06-04 21:50:08 -04:00
6c5e2b5118 Several tweaks and fixes
Bugs:
- Arrow keys activated the arrow buttons in the list-mode edit string dialog
- Graphics classification was not saved correctly in some cases
- Contact info was not correctly saved/loaded
- Place Monster node didn't have a choose button for the monster type
- Alt-Backspace and Alt-Delete did not work correctly in dialog text fields
- When clicking Edit Terrain Types, sometimes the list of items or monsters would appear instead
- Fix monster 0 being selectable in the choose monster dialog
- Fix the hotspots of all the cursors to be more intuitive

New:
- When interrupting a special node sequence with Cmd-. / Ctrl-C, the dialog that appears is more relevant.
- In the choose sound dialog, the sound now plays when you select a choice, so you can hear what it will sound like
- Added a tiny icon so you can distinguish fire and force barriers in the editor
2015-06-04 15:50:05 -04:00
49ec6278d3 Fix a few scenario load/save issues
- More uninitialized data issues
- Some values incorrectly loaded (monster radiate chance, terrain horse blockage, town lighting type)
- Some values incorrectly saved (item magic-use flag)
2015-06-04 01:14:57 -04:00
1b754619dc Several more tweaks/fixes
- Missing special node opcodes
- Pass the party's (or in combat, the active character's) current location to special nodes triggered by timers
- Fix the set pointer node
- Fix terrain palette not correctly registering clicks while scrolled down
- Fix sheets not correctly being copied from the temporary files folder
- Fix monster abilities not being loaded from new scenarios
- Fix custom sheets not being reloaded if they have changed
- Documentation tweaks
2015-06-02 22:01:22 -04:00
7dddcdb86e Several little tweaks and fixes
- Fix some uninitialized fields getting populated with random data
- Fix identity of last edited town and outdoor section not being saved
- Fix editor sometimes saving to application directory instead of overwriting the loaded scenario
- Fix town specials being saved to outdoors list and vice versa
- Fix right-most column of map not being loaded properly
- Fix town entry node for start town being called after the first turn of the scenario
- Add option to call a special node at startup (right after the intro dialog)
2015-06-01 22:43:41 -04:00
72add651a5 Fix some bugs in loading and saving new-format scenarios 2015-06-01 17:23:15 -04:00
3fc1b8cd7e Fix most of the warnings in the Visual Studio build
- Fix energy-draining weapons
- Specials called when a spell is targeted on a space now work a little differently if the spell is multi-target. For each target, the special is triggered if it exists; otherwise the normal spell behaviour occurs.
2015-02-20 12:18:38 -05:00
7ba874f1d2 Correctly handle saving a scenario that was loaded in unpacked form 2015-02-14 13:35:26 -05:00
4fbc6cfa77 Various code cleanup stuff 2015-02-14 12:24:25 -05:00
a7da59c858 Fix scenario difficulty increasing by 1 between saving and loading 2015-02-13 20:35:26 -05:00
a029836720 Fix some issues with loading legacy scenarios and custom graphics
- Unfortunately, the PICT loader is still very fragile.
2015-02-13 20:34:41 -05:00
Ben Scott
1477fef7ce Fixed warnings and IMPLEMENTED A THING in the menu item switch. 2015-02-12 01:47:48 -05:00
bb98455e4f Fix some issues with loading/saving new-format scenarios
- Terrain was saved rotated and was not loaded
- Graphics were not loaded (also for old-format scenarios)
- Crashed when attempting to convert a scenario without custom graphics
2015-02-11 17:01:32 -05:00
1894b31e20 Implement loading of scenarios
- This also tweaks the scenario schemas for consistency between schemas and code, adds some unique key restraints, and makes some attributes required.
2015-02-11 14:03:03 -05:00
7f6992da56 Store sign locations and text in the same structure 2015-02-06 14:43:26 -05:00