Commit Graph

52 Commits

Author SHA1 Message Date
haven1433
8a6f3ea559 Event improvements
* fix cut off text trainer range / berry id
* template for npcs
* template for signposts
* extended info in event panel for templates
* edit names
2022-09-23 16:06:24 -05:00
Haven1433
72faa5d79d beef up ASCII text logic
include the idea of escape characters, so we can type the anchor character, type spaces (or not if it's the start of the run), and type the escape character \ itself.
2022-09-11 21:27:27 -05:00
Haven1433
7c82d38d96 add new runtype / fix undo
also add some drag interactions
2022-09-07 19:51:59 -05:00
Haven1433
417eb04338 first pass at adding braille support
add the classes / types needed to support braille text. Still needs testing, but this is the skeleton.
2022-09-04 23:32:30 -05:00
Haven1433
ddf14d3837 Code cleanup 2022-09-03 00:07:36 -05:00
Haven1433
0becbfac3f Tilemap tileset loading needs to be table-index aware
When showing a sprite in the table tool, we check to see what table index it is so we can use that index to find the palette. We need to do the same thing with tilesets. This means that GetPixels() needs a new parameter, the tableIndex, which can be passed in from any context that cares about it. Most of the time, getting the pixels doesn't care what the table index is. But now tilemaps can use this to figure out which tileset to use.
2022-08-25 22:46:48 -05:00
Haven1433
e1aba728f7 Use correct palette for enum sprite tooltips 2022-06-18 15:29:19 -05:00
Haven1433
dd8bba7cab make unused ints appear in grey 2022-05-12 18:20:45 -05:00
Haven1433
5dfacf916b improve sprite transparency logic
If a sprite uses the same color for both the transparent slot and another slot and HMA intends to render the first color as transparent, HMA will now adjust the color in the transparent color so that it knows which pixels to make transparent and which pixels to keep.
2022-04-15 21:28:10 -05:00
Benjamin Popp
051a842a7d Improve Find Visibility Mode
Visibility mode changes the coloring of bytes to help certain bytes stick out more clearly. Previously, it only worked with a single byte. Now it's been more fully integrated into the model, and can work with any number of bytes. Note that it only cares about bytes that are on screen, so it won't find byte chunks where part of the chunk is off screen.
2021-10-13 11:13:28 -05:00
Benjamin Popp
42a122138a Fix LZRun backspace bugs
* When exactly an entire run is selected, treat backspace like delete: just clear the whole thing.
* When running DataClear on an LzCompressed token, set it to FFFF, not FF.
* When doing backspace on any DataFormatInstance, use ConvertCellToText to control how the element gets edited.
* Change various LZ formats so that they use DataFormatInstance.
2021-08-28 21:43:00 -05:00
Benjamin Popp
4d950d2916 Add support for signed fields
Most numbers are unsigned by default. But if a signed value is desired, you can use |z. Used in the pokedex stats.
2021-05-03 16:58:01 -05:00
Benjamin Popp
14aa655bd6 Improve paste performance
During paste operations, we don't actually need autocomplete. It's important to keep the options in mind, but we can delay evaluation until they're actually used.

Change autocomplete related methods to return lazy IEnumerable objects instead of returning a pre-populated read-only list. Add a LazyList<T> class that can handle the once-time evaluation logic. If no element of the list is ever checked, then the auto-complete code never runs.

Change ViewPort's UpdateToolsFromSelection tha happens when the selection changes. Only evaluate it after the edit operation is complete.
2021-04-07 14:48:23 -05:00
Benjamin Popp
7826d8246d Improve Tuple Copy/Paste
* Allow pasting tuple elements with spaces
* Improve how tuples treat leading space / +
* Allow typing [] to truncate a tuple run
* Include a [] at the end of a stream during deep copy
2021-04-02 23:44:47 -05:00
Benjamin Popp
ad8d2b4d6b Change the way initialization works / add pokemon icons to trainer team streams.
Initialization happens on a background thread. We want to be able to run commands when initialization is complete. The way this was done before wasn't very thread safe. The new version will always run the command.
* If initialization is complete, it runs the command right away.
* If initialization is not complete, it defers execution until initialization is done.
* Initialization is measured in scopes. An inner scope will not run initialization work when it's done, since there's still more initialization work that needs to be completed.
* Things like "goto" will now defer execution until initialization is complete. For most users, this won't matter. For speed users, it means that goto will now work the way they expect.

Streams now have the ability to express a "visualization" of the stream, which is a list of PixelViewModels. The table tool will display those in the background of the textbox, over to the right.
2021-02-26 09:14:19 -06:00
Benjamin Popp
31472fea77 ViewPort.GetSelectionSpan needs to be decorator aware 2021-02-20 21:04:59 -06:00
Benjamin Popp
32113ed0e4 Initial UI for tuples
Adding both the XAML for checkboxes / comboboxes, and the dataformat for displaying tuples inline.
2021-01-27 10:27:56 -06:00
Benjamin Popp
6a036654bd Allow Offsets on pointers to render less than 6 digits
This matters because a lot of offset pointers have very small numbers, like 1 or 4.
2021-01-13 08:58:16 -06:00
Benjamin Popp
2fb7236580 Introduce new decorator format
SpriteDecorator wraps other formats, providing the extra behavior of having a sprite background. This can be used to draw a sprite behind a single cell or behind a group of cells.

To get the z-ordering right, the info from SpriteDecorator is read during a new RenderBackground method, which happens before RenderData.
2020-12-31 14:32:38 -06:00
Benjamin Popp
08c515f4d3 Fix issues with Search results tab displaying bit arrays
Also fix an error that can crash HMA if you try to create an LZRun out of the data range
2020-10-16 23:56:05 -05:00
Benjamin Popp
e1669fed1a Improve Offset Pointers
Change the paradigm: instead of saying "final write + offset = destination", say "destination + offset = final write". This means that you can write things like <data.moves.stats.battle+4>, which will resolve in bytes to the pointer + 4, while resolving as a pointer to the move stats.
2020-10-09 21:27:58 -05:00
Benjamin Popp
be759bda29 Add tooltips for bit arrays
also add unit tests for the existing tool tips to make sure that there were no refactor errors
2020-09-05 22:23:19 -05:00
Benjamin Popp
335fff2915 Offset Pointers: Model
* add ability for model to import OffsetPointers
* add ability to undo/redo offset pointer changes
2020-08-10 21:39:42 -05:00
Benjamin Popp
0456d1d141 Allow Hex content in tables 2020-06-09 15:00:50 -05:00
Benjamin Popp
176b8896a7 Fix Castform sprite/palette pairing
when rendering a sprite, include an offset for which page of the sprite is being rendered. For a multi-page sprite with single page palettes or single-page sprites with multi-page palettes, this changes nothing. But for a multi-page sprite with multiple palettes, this allows the pages to correlate 1-to-1 as expected.
2020-06-01 20:23:29 -05:00
Benjamin Popp
0e8ae8a9f9 Refactor
Prep for palette copy/paste
2020-05-29 18:55:58 -05:00
Benjamin Popp
9c6212bcac Abbreviate underscore_values in enums 2020-04-21 11:07:26 -05:00
Benjamin Popp
021dfadb9d Bugfix: allow quotes to be typed into byte arrays
Also, render byte arrays correctly
2020-04-16 10:33:31 -05:00
Benjamin Popp
a26b2f101d Add new format for displaying RGB palette values inline. 2020-03-29 18:29:13 -05:00
Benjamin Popp
52a0fa9458 Fix test ExtendCompressedLzTokenShortensLzRun
This test was failing (intentionally) in the previous version. Added logic to read the modified run after a data change via ViewPort interaction, and calculate the next compressed length. The code should also handle repointing in the case of extension, but that's not tested yet. It does, however, clear unused bytes to `FF` if the new compressed length is shorter.

I also separated the idea of a IDataFormatInstance from a IDataFormatStreamInstance.
* a `IDataFormatInstance` represents a single format that is multiple cells long. The entire format should be selected at once. Examples include a level-up token (2 cells) or a pointer token (4 cells).
* a `IDataFormatStreamInstance` represents a single-cell format that is part of a 'stream' that is multiple cells long. The format includes a reference to the start of the stream and the data format's index within the stream for the Text Tool. Examples include ASCII and PCS data. The user can freely type to edit the stream, but each format is only a single-cell long.

This isn't actually used yet, but the separation of the concepts should allow me to simplify ViewPort cell selection group logic in the future.
2020-03-04 22:37:44 -06:00
Benjamin Popp
9aa27857a6 Initial introduction of LZ Data Formats
LZData isn't too complex, but it does involve many types of tokens, and thus many formats.
(1) the magic 1-byte header
(2) the 2-byte compressed token
(3) the 1-byte uncompressed token. This is really just raw data, but isn't the same as `None` because it can't be freely converted to a pointer or a length-token and shouldn't have the "this is text" right-click menu items
(4) the 1-byte section header. This is also similar to raw data, but we probably want to display it in a different color to make it obvious that it's a section header and not just an uncompressed byte.
2020-02-29 20:12:49 -06:00
Benjamin Popp
85a5e6e5a1 Table Streams with an EndCode should be able to render that end code as a data format
Adding this new data format required that we define its behaviors for lots of things. For now, we'll assume that the only valid thing the user can do with an end token is to extend the table.
2019-11-28 10:05:48 -06:00
Benjamin Popp
3d7157749b Display bad table pointers as errors
Now that table pointers are not guaranteed to be valid, we need a fast way to show this to the user.
2019-11-10 22:27:56 -06:00
Benjamin Popp
e4156c418d Better change tracking implementation & UI
change tracking was previously done in the model, but exposed in the ViewModel via a data format. The problem with this is that it meant that all changed formats were wrapped in a new format, which would require a lot of work to fully validate.

The new implementation is still in the model, but exposed in the ViewModel through a new property on the HexElement. The data formats are unchanged.
2019-11-06 12:36:26 -06:00
Benjamin Popp
d878c2ae9d Refactoring to make it possible to show edited cells 2019-11-05 22:11:24 -06:00
Benjamin Popp
9bc191f697 Introduce WordRuns
WordRuns, like PointerRuns, can live anywhere in the file and don't require anchors to them. Instead of needing an anchor to them, they specify the name of a table that they are matched to. Whenever that table's length changes, the WordRun's value is automatically updated to match the table length.
2019-06-28 21:54:47 -05:00
Benjamin Popp
3ff67cf455 BitArray Support - test passes 2019-06-23 22:14:29 -05:00
Benjamin Popp
11694e8424 Get it building 2019-06-23 20:57:31 -05:00
Benjamin Popp
fc3392c6c1 Working on bit arrays
Have the one test, started working on implementation
2019-06-23 14:09:50 -05:00
Benjamin Popp
33d5ddacbe Selection from text tool updates main selection for plm runs 2019-05-31 23:55:12 -05:00
Benjamin Popp
9ea56b36c3 Autocomplete and backspace for PlmItems 2019-05-31 21:28:34 -05:00
Benjamin Popp
b6b75deaae First push for PLM Streams
PLM Streams (pokemon learn moves)
I can now add streams via the ViewPort
2019-05-30 22:10:14 -05:00
Benjamin Popp
e6e1fd3f23 Egg Moves: Inline Editing / Autocomplete 2019-05-15 22:02:35 -05:00
Benjamin Popp
61ab55ea92 Egg moves ViewModel exposes data the UI needs. 2019-05-13 20:22:57 -05:00
Benjamin Popp
1c70f8379a Initial Introduction of EggMoveStream recognition
The Egg Move stream has 2 types of data in it, each of which is 2 bytes long. Either it's a pokemon, or it's a move. (There's also the end, FF FF). This is the initial test to show that we can read an egg move stream from a format.
2019-05-12 21:53:24 -05:00
Benjamin Popp
ebc9d1f33d first part of autocomplete is in
mostly the tests
need to make the pointers actually fill the model
need to make the UI still
need to handle enums still
2019-04-29 16:32:14 -05:00
Benjamin Popp
1915473a38 improve backspace. Implement for ints/enums in tables 2019-04-26 21:02:15 -05:00
Benjamin Popp
b71b3144d7 editing an enum/int moves you to the first space of that item
same as pointers
2019-04-24 22:02:35 -05:00
Benjamin Popp
45171ae5e1 wide text in a narrow cell no longer overflows into unrelated cells.
instead, wide text becomes right-aligned and clipped so you can
see what you're typing
2019-04-24 07:29:28 -05:00
Benjamin Popp
ae886b0402 enums can be rendered, but not edited 2019-03-16 20:07:47 -05:00