public static Fruit Load(BinaryReader reader) { Fruit fruit = new Fruit(); fruit.unknown = reader.ReadBytes(3); fruit._ID = reader.ReadByte(); fruit.unknown2 = reader.ReadBytes(64); fruit.fruitType = IndexResolver.Load(reader, fruitType_LENGTH); fruit.unknown3 = reader.ReadBytes(13); return(fruit); }
public static Stage Load(BinaryReader reader) { Stage level = new Stage(); level.tutorialText1 = reader.ReadBytes(2); level.tutorialText2 = reader.ReadBytes(2); level.tutorialTextbuffer = reader.ReadBytes(2); level.unknownCP = reader.ReadBytes(2); level.unknownPostCP = reader.ReadBytes(3); level._ID = reader.ReadByte(); if (level._ID == 0) { level._ID = 99; } else { --level._ID; } level.backgroundID = IndexResolver.Load(reader, backgroundID_LENGTH); level.notDoor = IndexResolver.Load(reader, notDoor_LENGTH); level.teleportIndices = IndexResolver.Load(reader, teleportIndices_LENGTH); foreach (byte key in HOLE_DEFINITION_KEYS) { level.holeDefinitions.Add(key, (NintendoLand.TileTypes.Hole.Size)reader.ReadByte()); reader.ReadBytes(holeDefinitions_LENGTH - 1); } for (int contentFlagIndex = 0; contentFlagIndex < MAXIMUM_CONTENT_FLAGS; contentFlagIndex++) { level.contentFlags.Add((ContentFlag)reader.ReadByte()); bool isDone = reader.ReadByte() != 0x20; if (isDone) { contentFlagIndex++; for (int i = contentFlagIndex; i < MAXIMUM_CONTENT_FLAGS; i++) { reader.ReadBytes(contentFlag_LENGTH); } break; } } for (int switchOrPepperIndex = 0; switchOrPepperIndex < SWITCHORPEPPER_DEFINITIONS; switchOrPepperIndex++) { level.switchOrPepperDefinitions[switchOrPepperIndex] = (PepperOrSwitchFlag)reader.ReadByte(); // < SWITCHORPEPPER_DEFINITIONS * (1 byte (value) + 7 bytes (padding)) reader.ReadBytes(switchOrPepperDefinitions_LENGTH - 1); } for (int patternIndex = 0; patternIndex < MOVEMENTPATTERN_DEFINITIONS; patternIndex++) { level.movementPatterns[patternIndex] = IndexResolver.Load(reader, movementPattern_LENGTH); } for (int FDefinitionIndex = 0; FDefinitionIndex < FRUIT_ORDER_DEFINITIONS; FDefinitionIndex++) // < FRUIT_ORDER_DEFINITIONS * (1 or 2 bytes (value) + 10 or 11 bytes (padding)) { // related to fruit order? actual usage unknown level.orderedFruitDefinition[FDefinitionIndex] = IndexResolver.Load(reader, orderedFruitDefinition_LENGTH); } for (int fruitAssociationIndex = 0; fruitAssociationIndex < FRUIT_ASSOCIATIONS_DEFINITIONS; fruitAssociationIndex++) // < FRUIT_ASSOCIATIONS_DEFINITIONS * (2 bytes (min) + 1 byte (delimiter) + 2 bytes (max)) + 7 bytes (padding)) { // related to fruit order? actual usage unknown level.fruitAssociations[fruitAssociationIndex] = IndexResolver.Load(reader, fruitAssociations_LENGTH); } return(level); }