Moved data types to its own package and added empty synth package
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
enum GameFile {
|
||||
vswap('VSWAP'),
|
||||
mapHead('MAPHEAD'),
|
||||
gameMaps('GAMEMAPS'),
|
||||
vgaDict('VGADICT'),
|
||||
vgaHead('VGAHEAD'),
|
||||
vgaGraph('VGAGRAPH'),
|
||||
audioHed('AUDIOHED'),
|
||||
audioT('AUDIOT')
|
||||
;
|
||||
|
||||
final String baseName;
|
||||
|
||||
const GameFile(this.baseName);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
enum GameVersion {
|
||||
shareware("WL1"),
|
||||
retail("WL6"),
|
||||
spearOfDestiny("SOD"),
|
||||
spearOfDestinyDemo("SDM"),
|
||||
;
|
||||
|
||||
final String fileExtension;
|
||||
|
||||
const GameVersion(this.fileExtension);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
class VgaImage {
|
||||
final int width;
|
||||
final int height;
|
||||
final Uint8List pixels; // 8-bit paletted pixel data
|
||||
|
||||
VgaImage({
|
||||
required this.width,
|
||||
required this.height,
|
||||
required this.pixels,
|
||||
});
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
class PcmSound {
|
||||
final Uint8List bytes;
|
||||
PcmSound(this.bytes);
|
||||
}
|
||||
|
||||
class AdLibSound {
|
||||
final Uint8List bytes;
|
||||
AdLibSound(this.bytes);
|
||||
}
|
||||
|
||||
class ImfInstruction {
|
||||
final int register;
|
||||
final int data;
|
||||
final int delay; // Delay in 1/700ths of a second
|
||||
|
||||
ImfInstruction({
|
||||
required this.register,
|
||||
required this.data,
|
||||
required this.delay,
|
||||
});
|
||||
}
|
||||
|
||||
class ImfMusic {
|
||||
final List<ImfInstruction> instructions;
|
||||
|
||||
ImfMusic(this.instructions);
|
||||
|
||||
factory ImfMusic.fromBytes(Uint8List bytes) {
|
||||
List<ImfInstruction> instructions = [];
|
||||
|
||||
// Read the file in 4-byte chunks
|
||||
for (int i = 0; i < bytes.length - 3; i += 4) {
|
||||
instructions.add(
|
||||
ImfInstruction(
|
||||
register: bytes[i],
|
||||
data: bytes[i + 1],
|
||||
delay: bytes[i + 2] | (bytes[i + 3] << 8), // 16-bit little-endian
|
||||
),
|
||||
);
|
||||
}
|
||||
return ImfMusic(instructions);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
typedef Matrix<T> = List<List<T>>;
|
||||
|
||||
typedef Sprite = Matrix<int>;
|
||||
|
||||
typedef Wall = Sprite;
|
||||
|
||||
typedef Level = Matrix<int>;
|
||||
@@ -1,13 +0,0 @@
|
||||
import 'package:wolf_3d_data/wolf_3d_data.dart';
|
||||
|
||||
class WolfLevel {
|
||||
final String name;
|
||||
final Sprite wallGrid;
|
||||
final Sprite objectGrid;
|
||||
|
||||
const WolfLevel({
|
||||
required this.name,
|
||||
required this.wallGrid,
|
||||
required this.objectGrid,
|
||||
});
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import 'package:wolf_3d_data/wolf_3d_data.dart';
|
||||
|
||||
class WolfensteinData {
|
||||
final GameVersion version;
|
||||
final List<Sprite> walls;
|
||||
final List<Sprite> sprites;
|
||||
final List<PcmSound> sounds;
|
||||
final List<AdLibSound> adLibSounds;
|
||||
final List<ImfMusic> music;
|
||||
final List<WolfLevel> levels;
|
||||
final List<VgaImage> vgaImages;
|
||||
|
||||
const WolfensteinData({
|
||||
required this.version,
|
||||
required this.walls,
|
||||
required this.sprites,
|
||||
required this.sounds,
|
||||
required this.adLibSounds,
|
||||
required this.music,
|
||||
required this.levels,
|
||||
required this.vgaImages,
|
||||
});
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import '../classes/game_file.dart';
|
||||
import '../classes/game_version.dart';
|
||||
import '../classes/wolfenstein_data.dart';
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
|
||||
import '../wl_parser.dart';
|
||||
|
||||
/// dart:io implementation for directory discovery.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import '../classes/game_version.dart';
|
||||
import '../classes/wolfenstein_data.dart';
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
|
||||
/// Web-safe stub for directory discovery.
|
||||
Future<Map<GameVersion, WolfensteinData>> discoverInDirectory({
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:wolf_3d_data/src/classes/game_version.dart';
|
||||
import 'package:wolf_3d_data/src/classes/image.dart';
|
||||
import 'package:wolf_3d_data/src/classes/sound.dart';
|
||||
import 'package:wolf_3d_data/src/classes/wolf_level.dart';
|
||||
import 'package:wolf_3d_data/src/classes/wolfenstein_data.dart';
|
||||
|
||||
import 'classes/sprite.dart';
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
|
||||
abstract class WLParser {
|
||||
/// Asynchronously discovers the game version and loads all necessary files.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'classes/game_version.dart';
|
||||
import 'classes/wolfenstein_data.dart';
|
||||
// --- The Magic Conditional Import ---
|
||||
// If dart:io is available, use the real scanner. Otherwise, use the stub.
|
||||
import 'package:wolf_3d_data_types/wolf_3d_data_types.dart';
|
||||
|
||||
import 'io/discovery_stub.dart'
|
||||
if (dart.library.io) 'io/discovery_io.dart'
|
||||
as platform;
|
||||
|
||||
@@ -3,13 +3,5 @@
|
||||
/// More dartdocs go here.
|
||||
library;
|
||||
|
||||
export 'src/classes/game_file.dart' show GameFile;
|
||||
export 'src/classes/game_version.dart' show GameVersion;
|
||||
export 'src/classes/image.dart' show VgaImage;
|
||||
export 'src/classes/sound.dart'
|
||||
show PcmSound, AdLibSound, ImfMusic, ImfInstruction;
|
||||
export 'src/classes/sprite.dart' hide Matrix;
|
||||
export 'src/classes/wolf_level.dart' show WolfLevel;
|
||||
export 'src/classes/wolfenstein_data.dart' show WolfensteinData;
|
||||
export 'src/wl_parser.dart' show WLParser;
|
||||
export 'src/wolfenstein_loader.dart' show WolfensteinLoader;
|
||||
|
||||
Reference in New Issue
Block a user