void WriteCommandWords(ref int cursor, byte[] targetBank, LEVEL_SCRIPT_COMMANDS command, short paramsHigh, params int[] moreParams) { int alignedLength = 4 * (moreParams.Length + 1); targetBank[cursor] = (byte)command; targetBank[cursor + 1] = (byte)alignedLength; targetBank[cursor + 2] = (byte)(paramsHigh >> 0x8); targetBank[cursor + 3] = (byte)(paramsHigh & 0xFF); for (int i = 0; i < moreParams.Length; i++) { cvt.writeInt32(targetBank, cursor + 4 * (i + 1), moreParams[i]); } cursor += alignedLength; }
void WriteCommand(ref int cursor, byte[] targetBank, LEVEL_SCRIPT_COMMANDS command, params byte[] parameters) { int alignedLength = ((parameters.Length + 5) / 4) * 4; targetBank[cursor] = (byte)command; targetBank[cursor + 1] = (byte)alignedLength; Array.Copy(parameters, 0, targetBank, cursor + 2, parameters.Length); int cursorEnd = cursor + parameters.Length + 2; for (int i = cursorEnd; i < cursor + alignedLength; i++) { targetBank[i] = 0; } cursor += alignedLength; }