Corrected enemy entity mapping
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -50,7 +50,7 @@ void main() async {
|
|||||||
|
|
||||||
final engine = WolfEngine(
|
final engine = WolfEngine(
|
||||||
data: data,
|
data: data,
|
||||||
difficulty: Difficulty.bringEmOn,
|
difficulty: Difficulty.medium,
|
||||||
startingEpisode: 0,
|
startingEpisode: 0,
|
||||||
audio: cliAudio,
|
audio: cliAudio,
|
||||||
input: input,
|
input: input,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class _DifficultyScreenState extends State<DifficultyScreen> {
|
|||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
backgroundColor: Colors.red[900],
|
backgroundColor: Colors.red[900],
|
||||||
onPressed: () => _startGame(Difficulty.bringEmOn, showGallery: true),
|
onPressed: () => _startGame(Difficulty.medium, showGallery: true),
|
||||||
child: const Icon(Icons.bug_report, color: Colors.white),
|
child: const Icon(Icons.bug_report, color: Colors.white),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/// Defines the game difficulty levels, matching the original titles.
|
/// Defines the game difficulty levels, matching the original titles.
|
||||||
enum Difficulty {
|
enum Difficulty {
|
||||||
canIPlayDaddy(0, "Can I play, Daddy?"),
|
baby(0, "Can I play, Daddy?"),
|
||||||
dontHurtMe(0, "Don't hurt me."),
|
easy(0, "Don't hurt me."),
|
||||||
bringEmOn(1, "Bring em' on!"),
|
medium(1, "Bring em' on!"),
|
||||||
iAmDeathIncarnate(2, "I am Death incarnate!"),
|
hard(2, "I am Death incarnate!"),
|
||||||
;
|
;
|
||||||
|
|
||||||
/// The friendly string shown in menus.
|
/// The friendly string shown in menus.
|
||||||
|
|||||||
@@ -91,11 +91,11 @@ abstract class MapObject {
|
|||||||
// --- Enemy Range Constants ---
|
// --- Enemy Range Constants ---
|
||||||
// Every enemy type occupies a block of 36 IDs.
|
// Every enemy type occupies a block of 36 IDs.
|
||||||
// Modulo math is used on these ranges to determine orientation and patrol status.
|
// Modulo math is used on these ranges to determine orientation and patrol status.
|
||||||
static const int guardStart = 108; // 108-143
|
static const int guardStart = 108; // Claims 108-115, 144-151, 180-187
|
||||||
static const int dogStart = 144; // 144-179
|
static const int dogStart = 116; // Claims 116-123, 152-159, 188-195
|
||||||
static const int ssStart = 180; // 180-215
|
static const int ssStart = 126; // Claims 126-133, 162-169, 198-205
|
||||||
static const int mutantStart = 216; // 216-251
|
static const int mutantStart = 136; // Claims 136-143, 172-179, 208-215
|
||||||
static const int officerStart = 252; // 252-287
|
static const int officerStart = 252; // Claims 252-259, 288-295, 324-331
|
||||||
|
|
||||||
// --- Missing Decorative Bodies ---
|
// --- Missing Decorative Bodies ---
|
||||||
static const int deadGuard = 124; // Decorative only in WL1
|
static const int deadGuard = 124; // Decorative only in WL1
|
||||||
|
|||||||
@@ -220,8 +220,8 @@ class WolfEngine {
|
|||||||
final double timeScale = delta.inMilliseconds / 16.666;
|
final double timeScale = delta.inMilliseconds / 16.666;
|
||||||
|
|
||||||
// Apply the timeScale multiplier to ensure consistent speed at any framerate
|
// Apply the timeScale multiplier to ensure consistent speed at any framerate
|
||||||
double moveSpeed = 0.14 * timeScale;
|
final double moveSpeed = 0.10 * timeScale;
|
||||||
double turnSpeed = 0.10 * timeScale;
|
final double turnSpeed = 0.08 * timeScale;
|
||||||
|
|
||||||
Coordinate2D movement = const Coordinate2D(0, 0);
|
Coordinate2D movement = const Coordinate2D(0, 0);
|
||||||
double dAngle = 0.0;
|
double dAngle = 0.0;
|
||||||
|
|||||||
@@ -99,12 +99,21 @@ enum EnemyType {
|
|||||||
|
|
||||||
/// Identifies an [EnemyType] based on a tile ID from the map's object layer.
|
/// Identifies an [EnemyType] based on a tile ID from the map's object layer.
|
||||||
static EnemyType? fromMapId(int id) {
|
static EnemyType? fromMapId(int id) {
|
||||||
// Each enemy occupies exactly 48 IDs across 3 states.
|
for (final type in EnemyType.values) {
|
||||||
if (id >= 108 && id <= 155) return EnemyType.guard;
|
final data = type.mapData;
|
||||||
if (id >= 156 && id <= 203) return EnemyType.dog;
|
|
||||||
if (id >= 204 && id <= 251) return EnemyType.ss;
|
// Check Easy (Base)
|
||||||
if (id >= 252 && id <= 299) return EnemyType.mutant;
|
if (id >= data.baseId && id < data.baseId + 8) return type;
|
||||||
if (id >= 300 && id <= 347) return EnemyType.officer;
|
|
||||||
|
// Check Medium (+1 Offset)
|
||||||
|
int mediumBase = data.baseId + data.tierOffset;
|
||||||
|
if (id >= mediumBase && id < mediumBase + 8) return type;
|
||||||
|
|
||||||
|
// Check Hard (+2 Offsets)
|
||||||
|
int hardBase = data.baseId + (data.tierOffset * 2);
|
||||||
|
if (id >= hardBase && id < hardBase + 8) return type;
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user