private void ReadActions(BinaryReader buffer) { actions = new List <VSAction>(); while (true) { byte f = buffer.ReadByte(); // frame number or 0xff // TODO probably wrong to break here if (f == 0xff) { break; } if (f > length) { Debug.Log("Unexpected frame number f:" + f + " > length:" + length + " in SEQ action section"); } byte a = buffer.ReadByte(); // action if (a == 0x00) { return; } VSAction action = GetAction(a); if (action == null) { Debug.Log("Unknown SEQ action " + a + " at frame " + f); } else { //Debug.Log(action.name); } byte[] parameters; if (action.count > 0) { parameters = new byte[action.count]; for (int i = 0; i < action.count; ++i) { parameters[i] = buffer.ReadByte(); } action.paremeters = parameters; } action.f = f; actions.Add(action); } }
private VSAction GetAction(byte a) { // TODO : make a switch statement VSAction[] ACTIONS = new VSAction[0x50]; ACTIONS[0x01] = new VSAction("loop", 0); // verified ACTIONS[0x02] = new VSAction("0x02", 0); // often at end, used for attack animations ACTIONS[0x04] = new VSAction("0x04", 1); // ACTIONS[0x0a] = new VSAction("0x0a", 1); // verified in 00_COM (no other options, 0x00 x00 follows) ACTIONS[0x0b] = new VSAction("0x0b", 0); // pretty sure, used with walk/run, followed by 0x17/left, 0x18/right ACTIONS[0x0c] = new VSAction("0x0c", 1); ACTIONS[0x0d] = new VSAction("0x0d", 0); ACTIONS[0x0f] = new VSAction("0x0f", 1); // first ACTIONS[0x13] = new VSAction("unlockBone", 1); // verified in emulation ACTIONS[0x14] = new VSAction("0x14", 1); // often at end of non-looping ACTIONS[0x15] = new VSAction("0x15", 1); // verified 00_COM (no other options, 0x00 0x00 follows) ACTIONS[0x16] = new VSAction("0x16", 2); // first, verified 00_BT3 ACTIONS[0x17] = new VSAction("0x17", 0); // + often at end ACTIONS[0x18] = new VSAction("0x18", 0); // + often at end ACTIONS[0x19] = new VSAction("0x19", 0); // first, verified 00_COM (no other options, 0x00 0x00 follows) ACTIONS[0x1a] = new VSAction("0x1a", 1); // first, verified 00_BT1 (0x00 0x00 follows) ACTIONS[0x1b] = new VSAction("0x1b", 1); // first, verified 00_BT1 (0x00 0x00 follows) ACTIONS[0x1c] = new VSAction("0x1c", 1); ACTIONS[0x1d] = new VSAction("paralyze?", 0); // first, verified 1C_BT1 ACTIONS[0x24] = new VSAction("0x24", 2); // first ACTIONS[0x27] = new VSAction("0x27", 4); // first, verified see 00_COM ACTIONS[0x34] = new VSAction("0x34", 3); // first ACTIONS[0x35] = new VSAction("0x35", 5); // first ACTIONS[0x36] = new VSAction("0x36", 3); ACTIONS[0x37] = new VSAction("0x37", 1); // pretty sure ACTIONS[0x38] = new VSAction("0x38", 1); ACTIONS[0x39] = new VSAction("0x39", 1); ACTIONS[0x3a] = new VSAction("disappear", 0); // used in death animations ACTIONS[0x3b] = new VSAction("land", 0); ACTIONS[0x3c] = new VSAction("adjustShadow", 1); // verified ACTIONS[0x3f] = new VSAction("0x3f", 0); // first, pretty sure, often followed by 0x16 ACTIONS[0x40] = new VSAction("0x40", 0); // often preceded by 0x1a, 0x1b, often at end return(ACTIONS[a]); }