Load sprites

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-13 17:28:23 +01:00
parent 630f027b68
commit af17a0aaf7
2 changed files with 73 additions and 2 deletions

View File

@@ -8,9 +8,14 @@ class WolfMap {
/// The fully parsed and decompressed levels from the game files.
final List<WolfLevel> levels;
final List<Matrix<int>> textures;
final List<Matrix<int>> sprites;
// A private constructor so we can only instantiate this from the async loader
WolfMap._(this.levels, this.textures);
WolfMap._(
this.levels,
this.textures,
this.sprites,
);
/// Asynchronously loads the map files and parses them into a new WolfMap instance.
static Future<WolfMap> load() async {
@@ -22,8 +27,13 @@ class WolfMap {
// 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);
return WolfMap._(
parsedLevels,
parsedTextures,
parsedSprites,
);
}
}