Commit Graph

27 Commits

Author SHA1 Message Date
Benjamin Popp
c3b0156502 Improve script tokenizing 2020-05-15 11:12:31 -05:00
Benjamin Popp
1d0d030434 Improve BattleScript support 2020-05-03 22:12:45 -05:00
Benjamin Popp
0e963da3de Load battle-scripts for move effects 2020-05-01 16:52:50 -05:00
Benjamin Popp
93250ec061 Add backbone for battle-script support
battle scripts are almost identical to pokescripts in how they work. Each command has a single-byte code, followed by some number of arguments, each of which are 1 to 4 bytes.

Because of these similarities, we can reuse the same engine code and just load the engine from another file. So the code tool can have a 4th mode and basically just work for free. Runs for battle scripts can be as simple as XSE runs: just a single byte, don't bothe decoding, show decoding only in the tool.

Still to add: how to know which battle script commands are ending commands, or which ones point to other battle scripts, or which ones point to strings. How to view battle scripts in the editor? Etc.
2020-05-01 08:16:04 -05:00
Benjamin Popp
6ed54cd459 Bugfix: show more scripts in script tool 2020-04-28 08:19:45 -05:00
Benjamin Popp
0f73e7b3e4 Tooltip help during scripting 2020-04-27 22:57:18 -05:00
Benjamin Popp
bef73ad75f Support editing marts in scripts 2020-04-24 08:09:54 -05:00
Benjamin Popp
8ffe70dda4 Pointers update when scripts change/move 2020-04-22 22:53:04 -05:00
Benjamin Popp
eb69c8ec46 Update script with new movement/text 2020-04-22 22:07:27 -05:00
Benjamin Popp
38a7d99392 Scripting fixes
* Put the selection in the right place when moving a script
* Don't make an orphan run in the location we moved away from
2020-04-22 17:22:50 -05:00
Benjamin Popp
4f9dd0b3ca Allow <??????> to translate to a new pointer 2020-04-22 15:22:55 -05:00
Benjamin Popp
15d68115bb Show compile errors instead of crashing 2020-04-22 13:10:08 -05:00
Benjamin Popp
8b1320aeff UI for multi-contents
Don't swap out the UI element that's currently being updated.
2020-04-22 11:27:51 -05:00
Benjamin Popp
86b0f1e99b Initial ViewModel for a multi-script editor 2020-04-22 10:56:04 -05:00
Benjamin Popp
a63769e119 Cascade scripts on TOML load
If a toml file contains an XSE script, add the children when loading.
2020-04-21 22:45:48 -05:00
Benjamin Popp
16f34c6d9e Name orphan scripts 2020-04-21 22:16:49 -05:00
Benjamin Popp
053fc56a6b Include streams in scripts
Scripts that access text / movement data should include those inline.
2020-04-21 15:51:01 -05:00
Benjamin Popp
9c6212bcac Abbreviate underscore_values in enums 2020-04-21 11:07:26 -05:00
Benjamin Popp
1fb1460965 Add movement data from script 2020-04-21 08:16:10 -05:00
Benjamin Popp
3d441ce570 Add text decoding 2020-04-20 16:26:18 -05:00
Benjamin Popp
0e37719ca2 Use an anchor instead of a run for the initial XSE script add 2020-04-20 15:38:27 -05:00
Benjamin Popp
85422d06e1 Make it possible to edit scripts inline
Also add support for operator decoding for if statements
Inform users on repoint
2020-04-20 14:56:28 -05:00
Benjamin Popp
5b11e11c7a Parse argless commands correctly 2020-04-20 12:43:40 -05:00
Benjamin Popp
b79d7a6ea1 Allow inline script editing 2020-04-20 11:18:42 -05:00
Benjamin Popp
9c0732c2da Load useful scripting info when opening from AMap
* Add XSERun, which right now is just a 1-byte header that marks the start of a script segment.
* Add the ability to cascade down through script segments to find all endpoints, adding XSERuns and pointers as needed.
2020-04-18 16:08:04 -05:00
Benjamin Popp
3e8fd018a1 Refactor Singletons
Previously, the creating a new ViewPort loaded from 2 text files and creating a new HardcodeTablesMoel loaded from 1 text file. This is a lot of parsing!

Refactor to do the parsing once, in the EditorViewModel, using a Singleton class to hold the non-editable loaded data. Inject that data into the appropriate structers later on.

To prevent massive refactoring in the tests, not every ViewPort needs to be given a Singletons instance. Instead, allow a ViewPort to still do its own parsing. However, BaseViewModelTestClass has been updated to make this work for a majority of tests, along with changes to AutoSearchTests's fixture and several of the Setup methods that are used by multiple tests.
2020-02-08 21:25:48 -06:00
Benjamin Popp
7f2655655e Add Scripting to Code Tool
Being able to dissassemble ARM code is only half of the code that hackers want to see. They also need to be able to read/write pokescript, often done via tools like XSE. Eventually I can be more intelligent with scripts, but for now a simple decoder is plenty.
2019-07-17 22:02:15 -05:00