Saffith
11-05-2013, 09:06 PM
Some stuff for recording and playing back input. Useful for cutscenes, and maybe for testing some things.
First, a few functions:
-=SPOILER=-
GetInput() and GetPressed() return numbers representing the state of Link->Input* and Link->Press* for all standard keys (directions, start, map, A/B/L/R/Ex*). SetInput() takes those same numbers as arguments and sets each Input and Press variable accordingly.
ReplayInput() takes two arrays. The first is a series of Input*, and the second is a series of Press*. The arrays consist of pairs of input states and durations. For instance:
int inputArr[] = { CRKEY_DOWN, 30, CRKEY_DOWN | CRKEY_A, 10, CRKEY_UP, 15 };
That represents down being held for 30 frames, down+A for 10 frames, and up for 15 frames. The Press* array works the same way, even though keys aren't normally newly pressed for consecutive frames.
Hit the character limit. Continued below.
First, a few functions:
-=SPOILER=-
GetInput() and GetPressed() return numbers representing the state of Link->Input* and Link->Press* for all standard keys (directions, start, map, A/B/L/R/Ex*). SetInput() takes those same numbers as arguments and sets each Input and Press variable accordingly.
ReplayInput() takes two arrays. The first is a series of Input*, and the second is a series of Press*. The arrays consist of pairs of input states and durations. For instance:
int inputArr[] = { CRKEY_DOWN, 30, CRKEY_DOWN | CRKEY_A, 10, CRKEY_UP, 15 };
That represents down being held for 30 frames, down+A for 10 frames, and up for 15 frames. The Press* array works the same way, even though keys aren't normally newly pressed for consecutive frames.
Hit the character limit. Continued below.