Corrected enemy entity mapping
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/// Defines the game difficulty levels, matching the original titles.
|
||||
enum Difficulty {
|
||||
canIPlayDaddy(0, "Can I play, Daddy?"),
|
||||
dontHurtMe(0, "Don't hurt me."),
|
||||
bringEmOn(1, "Bring em' on!"),
|
||||
iAmDeathIncarnate(2, "I am Death incarnate!"),
|
||||
baby(0, "Can I play, Daddy?"),
|
||||
easy(0, "Don't hurt me."),
|
||||
medium(1, "Bring em' on!"),
|
||||
hard(2, "I am Death incarnate!"),
|
||||
;
|
||||
|
||||
/// The friendly string shown in menus.
|
||||
|
||||
@@ -91,11 +91,11 @@ abstract class MapObject {
|
||||
// --- Enemy Range Constants ---
|
||||
// Every enemy type occupies a block of 36 IDs.
|
||||
// Modulo math is used on these ranges to determine orientation and patrol status.
|
||||
static const int guardStart = 108; // 108-143
|
||||
static const int dogStart = 144; // 144-179
|
||||
static const int ssStart = 180; // 180-215
|
||||
static const int mutantStart = 216; // 216-251
|
||||
static const int officerStart = 252; // 252-287
|
||||
static const int guardStart = 108; // Claims 108-115, 144-151, 180-187
|
||||
static const int dogStart = 116; // Claims 116-123, 152-159, 188-195
|
||||
static const int ssStart = 126; // Claims 126-133, 162-169, 198-205
|
||||
static const int mutantStart = 136; // Claims 136-143, 172-179, 208-215
|
||||
static const int officerStart = 252; // Claims 252-259, 288-295, 324-331
|
||||
|
||||
// --- Missing Decorative Bodies ---
|
||||
static const int deadGuard = 124; // Decorative only in WL1
|
||||
|
||||
@@ -220,8 +220,8 @@ class WolfEngine {
|
||||
final double timeScale = delta.inMilliseconds / 16.666;
|
||||
|
||||
// Apply the timeScale multiplier to ensure consistent speed at any framerate
|
||||
double moveSpeed = 0.14 * timeScale;
|
||||
double turnSpeed = 0.10 * timeScale;
|
||||
final double moveSpeed = 0.10 * timeScale;
|
||||
final double turnSpeed = 0.08 * timeScale;
|
||||
|
||||
Coordinate2D movement = const Coordinate2D(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.
|
||||
static EnemyType? fromMapId(int id) {
|
||||
// Each enemy occupies exactly 48 IDs across 3 states.
|
||||
if (id >= 108 && id <= 155) return EnemyType.guard;
|
||||
if (id >= 156 && id <= 203) return EnemyType.dog;
|
||||
if (id >= 204 && id <= 251) return EnemyType.ss;
|
||||
if (id >= 252 && id <= 299) return EnemyType.mutant;
|
||||
if (id >= 300 && id <= 347) return EnemyType.officer;
|
||||
for (final type in EnemyType.values) {
|
||||
final data = type.mapData;
|
||||
|
||||
// Check Easy (Base)
|
||||
if (id >= data.baseId && id < data.baseId + 8) return type;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user