@@ -43,7 +43,7 @@ class VswapParser {
|
||||
/// Extracts the compiled scaled sprites from VSWAP.WL1
|
||||
static List<Matrix<int>> parseSprites(ByteData vswap) {
|
||||
int chunks = vswap.getUint16(0, Endian.little);
|
||||
int spriteStart = vswap.getUint16(2, Endian.little); // 64
|
||||
int spriteStart = vswap.getUint16(2, Endian.little);
|
||||
int soundStart = vswap.getUint16(4, Endian.little);
|
||||
|
||||
List<int> offsets = [];
|
||||
|
||||
@@ -18,7 +18,7 @@ class WolfMap {
|
||||
);
|
||||
|
||||
/// Asynchronously loads the map files and parses them into a new WolfMap instance.
|
||||
static Future<WolfMap> load() async {
|
||||
static Future<WolfMap> loadDemo() async {
|
||||
// 1. Load the binary data
|
||||
final mapHead = await rootBundle.load("assets/MAPHEAD.WL1");
|
||||
final gameMaps = await rootBundle.load("assets/GAMEMAPS.WL1");
|
||||
@@ -36,4 +36,24 @@ class WolfMap {
|
||||
parsedSprites,
|
||||
);
|
||||
}
|
||||
|
||||
/// Asynchronously loads the map files and parses them into a new WolfMap instance.
|
||||
static Future<WolfMap> load() async {
|
||||
// 1. Load the binary data
|
||||
final mapHead = await rootBundle.load("assets/MAPHEAD.WL6");
|
||||
final gameMaps = await rootBundle.load("assets/GAMEMAPS.WL6");
|
||||
final vswap = await rootBundle.load("assets/VSWAP.WL6");
|
||||
|
||||
// 2. Parse the data using the parser we just built
|
||||
final parsedLevels = WolfMapParser.parseMaps(mapHead, gameMaps);
|
||||
final parsedTextures = VswapParser.parseWalls(vswap);
|
||||
final parsedSprites = VswapParser.parseSprites(vswap);
|
||||
|
||||
// 3. Return the populated instance!
|
||||
return WolfMap._(
|
||||
parsedLevels,
|
||||
parsedTextures,
|
||||
parsedSprites,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user