-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New thanm spec format (also featuring th18 support) #86
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Only dumping now. Recompiling will be added later.
Earlier, the struct used by the game itself was used for everything. This worked fine with the very simple dumping and recompiling, but in order to implement more features a better struct is needed, so thanm_instr_t was added.
Pretty large diff because of indentation change
Only tested with a very limited amount of (v8) ANM files so far, but for the ones it was tested with it recompiles perfecly byte-to-byte.
Did you know that some ANM files in IN have negative script IDs for whatever reason?
Some variable operations and conditional jumps
...and also warn on duplicate label declaration.
It allows specifying the default version for entries.
When writing custom ANMs, manually specifying things like THTXSize gets annoying quickly. Now many properties can be ommited to calculate it automatically (in fact, only filename is required now!) ...though, maybe it should be implemented in a different way than using a magic constant to indicate that default values should be set? Perhaps some additational bitmask property that would indicate which values should be generated from image properties?
Also fixed variables given as identifiers.
This makes things more consistent, since the quotes are not required for labels. Dumped label names were also changed to "offset%u".
Allows exporting script name-id pairs when creating an ANM, with an optional prefix (specified with `#symbol_prefix` directive). Uses the `global <prefix><scriptName> = <id>;` format, which can be used by thecl/thanm (and thstd once it gets updated with features like #include and globaldefs)
The arguments printed here are the main program arguments, not specific option arguments, so putting `-s SYMBOLS` is confusing
To be fair using -s with old format doesn't make sense anyway, as it'll literally do nothing....
Also fixed an issue where a type mismatch would not get detected sometimes.
Fixing all signatures to align with [my findings here](https://exphp.github.io/thpages/#anm/ins). (Note: the version of the website currently live misidentifies v7:102 as "drawRect" when it is actually "spriteRand", and mistakenly gives v8:436 an "SS" signature; the signatures in this commit are correct)
fix remaining signatures in v4 and v8 anm
Turns out that instructions don't refer to scripts by their ID, but by their index in the file, which is not always the same. Why.
v2 is identical to v3 except that color is a single dword
fix ALL remaining anm signatures :D
I'll probably end up rewriting some of actual compilation code to fix it in a better way later...
It's pointless to have it: one of the most used formats was changed because it was wrong, so the old files would not compile anyway.
Has some issues because ins_439 in VD has a different format. VD photo.anm now throws a bunch of warnings when recompiling, but it still works. It's the only workaround I could come up with, ideally in the future the game number gets passed as a command line parameter so that the proper ins_439 format can be used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces the spec format used by previous versions of thanm with a completely new one, using bison and flex for parsing. The format itself is similar to the one used by thecl. The old format support was completely removed, because due to some format changes it would not work properly anyway. Trying to use an old format spec file for ANM creation will result in the following message being displayed:
Features of the new format:
entry
fields if they are not specifiedint myVar = 0;
and they will automatically have a register assignedglobal someGlobal = 10;
timeof(labelname)
offsetof(labelname)
,spriteof(spritename)
,scriptof(scriptname)
operators: allow explicitly getting value of a symbol#version n
: set default version for all following entries ton
#include "filename.spec"
: include the given file#anmmap "filename.anmm"
: load an anmmap#symbol_prefix "prefix"
: explained below-s symbol-filename
option can be used to export script name to ID mapping in the global definition format (to later be#included
in ECL source files). The names can be prefixed using the name set by using the#symbol_prefix
directive.