Document battle animation scripts #2070
Draft
+1,149
−833
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.
Local aliases for
gBattleAnimArgs
Uses a
CMD_ARGS
macro similar to rh-hideout#2529, which allows the developer to name the arguments.CMD_ARGS(x, y);
is similar in purpose to our#define tX data[0]
,#define tY data[1]
pattern for naming task data.Example:
Wrapper macros for
createsprite
/createvisualtask
/createsoundtask
Creates wrappers with the same names as the arguments used in
CMD_ARGS
. The arguments are passed by namename=...
rather than by position; exceptions:anim_battler
andsubpriority_offset
forcreatesprite
wrappers are passed by position.createsprite
wrappers which really represent tasks rather than sprites (e.g.simplepaletteblend
) try to defaultunused_anim_battler
andunused_subpriority_offset
to whatever is used in the majority of cases. Sometimes GF decided to specify those values, which forces me to specify them for matching purposes (see also the mess ofshakemonorterrain
). Downstream projects such as RHH Expansion could consider removing these arguments and parameters.Question: should I introduce warnings for specifying any parameters which have no purpose except matching? Possibly gated behind some define?
createvisualtask
wrappers which are always called with the samepriority
specify that priority as a default (e.g.shakebattleterrain
defaults topriority=2
).The usages of the macros do not reorder the arguments so that it's simpler for downstream users to migrate to the wrapper macros if they want to.
Example:
Special cases
TODO: Document how these don't fit the usual pattern.
shakemonorterrain
: optional argument.tintpalettes
: takescolor
and splits it up.metallicshine
: nouseColor
, optionalcolor
.setgrayscalepal
&setoriginalpal
: split up fromAnimTask_SetGrayscaleOrOriginalPal
.TODO
A second pass over everything to make the names consistent. In particular, I think a lot of
x
s andy
s will becomex_offset
s andy_offset
s, and I want to verify thatrelative_to
is only used in contexts where all the coordinates are relative to that battler (and if not, the names of parameters should specify which battler argument they're relative to).