-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Reminder: Test converting Battle Script cmd from u8 to u16 #2377
Comments
An option I thought of back in December would be to have a mixture of one-byte opcodes and two-byte opcodes. For example you could make typedef void (*BattleScriptCmdFunc)(const void *args);
static const BattleScriptCmdFunc sBattleScriptCmdFuncs[] =
{
// ...
};
/* Decodes and executes the current battle script instruction.
*
* Opcodes are variable-length and decode to an index into
* sBattleScriptCmdFuncs.
* Indexes 0x0000 to 0x00EF are encoded in 1 byte.
* Indexes 0x00F0 to 0x10EF are encoded in 2 bytes.
*
* See also the opcode macro in battle_scripts.inc. */
void RunBattlescriptCurrInstr(void)
{
const u8 *instr = gBattlescriptCurrInstr;
u32 index = *instr++;
if (index >= 0xF0)
{
index -= 0xF0;
index = (index << 8) | *instr++;
index += 0xF0;
}
sBattleScriptCmdFuncs[index](instr);
}
|
That's the best option I think. Saves more space this way. |
Closing in favor of #2464 |
We need to see how noticeable it would be, as piling stuff in
various
is starting to get messy.The text was updated successfully, but these errors were encountered: