Commit Graph

2841 Commits

Author SHA1 Message Date
Haven1433
6a761d9d23 Merge branch 'master' of https://github.com/haven1433/HexManiacAdvance 2022-09-01 10:55:06 -05:00
TheDiamondMiner
55958724a0
Added a new value to default toml which is the owtextcolor for the unused value in overworld sprite (#95) 2022-09-01 10:54:45 -05:00
Haven1433
9a9d020f6e fix goto textbox height
wasn't quite tall enough for the text
2022-09-01 08:08:16 -05:00
Haven1433
bdcd527858 allow long tablestreams to become multiline
useful for pokemon teams, which can get very wide
2022-09-01 08:01:56 -05:00
Haven1433
c1651807d6 fix issues from tests
thanks tests
2022-09-01 08:01:21 -05:00
Haven1433
587dada550 update script commands 2022-09-01 07:24:44 -05:00
Haven1433
ca2ec54581 bump to 0.4.4.4
clear non-required files from the build directory
2022-08-31 22:48:02 -05:00
Haven1433
a2b01ca309 enum for trainer double battles 2022-08-31 22:28:54 -05:00
Haven1433
b7cd14f2c6 add emerald pc text table 2022-08-31 22:26:35 -05:00
Haven1433
967cec0d85 add pokeball catchrates 2022-08-31 22:26:08 -05:00
Haven1433
24184d4d1f fix tile removal edge case
if a tile isn't changed, don't remove it. This fixes an edge case in certain tilemaps (ex. emerald summary screen tilemap1) where a specific tile is used no matter what the tilemap says. Edits on the tilemap that don't effect the specific tile won't change the tile, and everything should still look right.
2022-08-31 22:13:22 -05:00
Haven1433
a70cdd38af match á and é 2022-08-31 20:40:56 -05:00
Haven1433
280fae25a6 scripts should remember their length
instead of calculating their length each time, an edited script can be passed its previous length. This lets you have multiple ends within the same script without issue.
2022-08-31 20:30:17 -05:00
Haven1433
68b4bc520d add macro support for gray as well as grey 2022-08-31 20:29:05 -05:00
Haven1433
1e9d380e22 Add a TableControl prototype
The Measure step of the ColumnStackPanel is very slow, because the ContentControls that it holds, created from the DataTemplates, are very complex. Maybe a custom control could be created for the table with a much simpler visual tree.
2022-08-31 20:14:49 -05:00
Haven1433
e49df51a98 Improve string matching logic performance
Instead of taking the available name.token.parts and concatenating them in every possible order, add an algorithm that can check for the best match among the possible tokens and use that. Then remove that token from the list and try to match the rest.

This algorithm is more complicated, but doesn't require as many string and list operations, and searches k short strings instead of E(k) long strings, so it's faster.
2022-08-31 20:12:45 -05:00
Haven1433
262180bee0 use a threadsafe dictionary for address/anchor mapping
In rare cases, you can get a race condition where we try to turn the address-for-anchor keys into a list while also adding a new address-for-anchor key. This multi-threaded work can crash the app.

Use a thread-locking version of version of the dictionary to prevent Keys from being accessed at the same time as Add.
2022-08-30 21:42:01 -05:00
Haven1433
b2e776105f Improve script parsing logic
Previously, trying to edit a script with gotos/calls inline would cause trouble, because the destination is likely contained within the same script. But HMA parses the anchor and puts the script in a separate textbox, which is confusing. Worse, it prevents you from making your script longer, because it thinks it would overwrite itself because of the anchor.

Add logic to handle this case.
- If a script is completely contained within the script that's currently under edit, don't give the script its own textbox.
- If the script would overwrite some bytes, but those bytes are a script that (1) is totally contained within the script you're editing, and (2) is only referenced by the script you're editing; then allow the overwrite to occur.
2022-08-30 21:40:13 -05:00
Haven1433
7994bbc78d add logic for offsetting the sprite based on the elevation 2022-08-29 22:00:46 -05:00
Haven1433
7833c7fbe5 put limits on memory usage
* don't store undo/redo for patches
* don't store more than 1000 byte changes in the model
2022-08-29 21:39:28 -05:00
Haven1433
c79652d2fd don't copy text for splitter segments
these have no data and are purely for modeling
2022-08-29 20:49:59 -05:00
Haven1433
ce27bdcd53 trainers must have at least 1 pokemon
other arrays are limited to have at least 1 element, add that limit for trainer teams as well
2022-08-29 20:49:29 -05:00
Haven1433
6bd154ea22 Add easier-to-use expansion for uncompressed sprites
This works for LzRuns, make it work for uncompressed sprites as well
2022-08-29 20:24:17 -05:00
Haven1433
ed21535626 Store ToolPanelWidth in the ViewModel
WPF destroys the view whenever we switch tabs.
Store the ToolPanelWidth in the ViewModel so we can remember the value when changing tabs.
2022-08-29 07:38:13 -05:00
Haven1433
bc6fb382b2 typing text macros works in the hex content
also fixes a copy/paste bug
2022-08-26 22:55:24 -05:00
Haven1433
49fae5db0b allow tilemaps to include image switcher in the image tool 2022-08-26 21:31:38 -05:00
Haven1433
64050a4345 Cleanup Auto-Implement
This has been a thorn in the project's side for too long. Remove Auto-Implement from the project. Include the needed types, and the created implementations. If more implementations are needed, or the current implementations need to be updated, I can add them by hand. The implementations that I've actually needed have been comparable simple compared to what AutomImplement provides: I haven't needed custom property or event implementations, for example. And I haven't needed custom constructor overrides, or overrides for multiple methods with the same name. Go ahead and remove it, along with the code generation steps that come with compiling the app/tests.
2022-08-26 21:30:50 -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
131eca5481 Don't double-clear anchors during script edits
Double-clearing it is a problem if it's created in the same token, because then it counts as clearing something that isn't there... which means that undoing the interaction will bring back an anchor, even though it wasn't there to begin with.
2022-08-25 20:47:59 -05:00
Haven1433
6bb8fd0998 Fix dispatcher issue
better to block rather than being non-deterministic
2022-08-25 07:37:49 -05:00
Haven1433
810f8c7a65 ScriptParser needs to know which game it is.
The 'showmoney' and 'updatemoney' commands are different from game to game. It has 2 parameters in R/S, but 3 parameters in FR/LG/E.

Update the scriptReference to specify that these commands have different versions for the different games.

Update ScriptParser to be able to read this new addition to the script reference format.

Add tests to show that the new commands are read correctly between games.
2022-08-25 06:51:51 -05:00
Haven1433
05434521d3 pass a parent in to ArrayRunElementSegment.Write
This method is used when calling TableStreamRun.DeserializeRun. There is always a parent table that owns the element. We need to know the parent in order to correctly deserialize child pointers.
2022-08-24 07:41:00 -05:00
Haven1433
11b4a6fc58 Improve logic for clearing unused tiles during edit 2022-08-24 07:05:07 -05:00
Haven1433
288a37ad2c Don't clear custom-token flag if marked to continue current transaction
The current transaction can be continued through 'ChangeCompleted' operations via use of the `continueCurrentTransaction` flag. But calling `ChangeCompleted` was still clearing the `customChangeInProgress` flag, which made the ChangeHistory forget that it was in the middle of a custom change. This caused issues if the selection was automatically changed (such as clicking in the text tool) after a custom no-data change (such as from changing the anchor name in the anchor-text)
2022-08-21 20:03:03 -05:00
Haven1433
49fdf2927e undo should reset model size 2022-08-20 13:50:15 -05:00
Haven1433
66faeb1d47 fix multi-export button (menu) in image tool 2022-08-20 13:44:37 -05:00
Haven1433
b19dda6701 fix header update during single-table mode 2022-08-19 22:13:46 -05:00
Haven1433
216887b7d7 retry clipboard on failure 2022-08-19 21:53:38 -05:00
Haven1433
f2301e5562 Reload metadata after applying patch
Applying a patch can break pointers / anchors, or change the length /location of text / images. Reload metadata after applying a patch.
2022-08-19 20:31:07 -05:00
Haven1433
76ae4efee1 clean up map banks 2022-08-19 20:12:46 -05:00
Haven1433
3148daf751 improve guard logic 2022-08-17 22:49:23 -05:00
Haven1433
e26cf56a2b don't allow writing nameless anchors with nothing pointing to them 2022-08-17 22:31:15 -05:00
Haven1433
762e719984 closing a non-selected tab needs to update the right-click diff options 2022-08-17 20:47:52 -05:00
Haven1433
28d0237b25 add hex converter to tool menu 2022-08-16 23:16:10 -05:00
Haven1433
cd0a66edbe fix initial selection in goto box 2022-08-16 23:08:57 -05:00
Haven1433
54e9557690 Make selection address/length into controls instead of indicators
HxD allows users to set the start address and length of selection using a dialog. Make this work in HMA as well, since it can make it easier to follow guides.
2022-08-16 23:07:44 -05:00
Haven1433
26bbd116a5 Improve ability_type_swaps
This now works for every game, and is included as an official script.
2022-08-16 19:45:01 -05:00
Haven1433
5405aa3daa add final fantasy text decoding
further edits are needed to make this useful, but I'm committing this so we don't lose track of it
2022-08-04 20:27:22 -05:00
Haven1433
965620921a allow decoding of non-formatted data as uncompressed images
This lets us quickly scan the rom for uncompressed images when we don't know where they are. As with decoding text, you can often tell if it's actually an image or not just by looking at it.
* press +/- to quickly increase/decrease a digit to scan through the rom
* change the width/height to change how much of the rom you can decode at once
2022-07-09 21:45:43 -05:00
Haven1433
43cafabb2e prevent render errors when rendering rom overview for short files 2022-07-09 21:11:30 -05:00