Adding more enemy types
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
@@ -65,13 +65,6 @@ abstract class MapObject {
|
||||
static const int secretExitTrigger = 99;
|
||||
static const int normalExitTrigger = 100;
|
||||
|
||||
// --- Enemy Base IDs (Easy, North) ---
|
||||
static const int _guardBase = 108;
|
||||
static const int _officerBase = 126; // WL6 only
|
||||
static const int _ssBase = 144; // WL6 only
|
||||
static const int _dogBase = 162;
|
||||
static const int _mutantBase = 180; // Episode 2+
|
||||
|
||||
// Bosses (Shared between WL1 and WL6)
|
||||
static const int bossHansGrosse = 214;
|
||||
|
||||
@@ -87,55 +80,38 @@ abstract class MapObject {
|
||||
static const int bossFettgesicht = 223;
|
||||
|
||||
// --- Enemy Range Constants ---
|
||||
static const int guardStart = 108;
|
||||
static const int officerStart = 126;
|
||||
static const int ssStart = 144;
|
||||
static const int dogStart = 162;
|
||||
static const int mutantStart = 180;
|
||||
static const int guardStart = 108; // 108-143
|
||||
static const int officerStart = 144; // 144-179 (WL6)
|
||||
static const int ssStart = 180; // 180-215 (WL6)
|
||||
static const int dogStart = 216; // 216-251
|
||||
static const int mutantStart = 252; // 252-287 (WL6)
|
||||
|
||||
// --- Missing Decorative Bodies ---
|
||||
static const int deadGuard = 124; // Decorative only in WL1
|
||||
static const int deadAardwolf = 125; // Decorative only in WL1
|
||||
|
||||
/// Returns true if the object ID exists in the Shareware version.
|
||||
/// Returns true if the object ID exists in the Shareware version.
|
||||
static bool isSharewareCompatible(int id) {
|
||||
// WL1 only had Guards (108-125), Dogs (162-179), and Hans Grosse (214)
|
||||
if (id >= 126 && id < 162) return false; // No Officers or SS
|
||||
if (id >= 180 && id < 214) return false; // No Mutants
|
||||
if (id > 214) return false; // No other bosses
|
||||
return true;
|
||||
// Standard Decorations & Collectibles
|
||||
if (id <= vines) return true;
|
||||
|
||||
// Logic Triggers (Exits/Pushwalls)
|
||||
if (id >= pushwallTrigger && id <= normalExitTrigger) return true;
|
||||
|
||||
// Guards (108-143 includes dead bodies at 124/125)
|
||||
if (id >= guardStart && id < officerStart) return true;
|
||||
|
||||
// Dogs (216-251) - These ARE in Shareware!
|
||||
if (id >= dogStart && id < mutantStart) return true;
|
||||
|
||||
// Episode 1 Boss
|
||||
if (id == bossHansGrosse) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Resolves which enemy type a map ID belongs to.
|
||||
static String getEnemyType(int id) {
|
||||
if (id >= 108 && id <= 125) return "Guard";
|
||||
if (id >= 126 && id <= 143) return "Officer";
|
||||
if (id >= 144 && id <= 161) return "SS";
|
||||
if (id >= 162 && id <= 179) return "Dog";
|
||||
if (id >= 180 && id <= 197) return "Mutant";
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
/// Checks if an object should be spawned based on chosen difficulty.
|
||||
static bool shouldSpawn(int id, Difficulty selectedDifficulty) {
|
||||
if (id < 108 || id > 213) return true; // Items/Players/Bosses always spawn
|
||||
|
||||
// Enemy blocks are 18 IDs wide (e.g., 108-125 for Guards)
|
||||
int relativeId = (id - 108) % 18;
|
||||
|
||||
// 0-3: Easy, 4-7: Medium, 8-11: Hard
|
||||
if (relativeId < 4) return true; // Easy spawns on everything
|
||||
if (relativeId < 8) {
|
||||
return selectedDifficulty != Difficulty.canIPlayDaddy; // Medium/Hard
|
||||
}
|
||||
if (relativeId < 12) {
|
||||
return selectedDifficulty == Difficulty.iAmDeathIncarnate; // Hard only
|
||||
}
|
||||
|
||||
// 12-15 are typically "Ambush" versions of the Easy/Medium/Hard guards
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Determines the spawn orientation of an enemy or player.
|
||||
/// Determines the spawn orientation of an enemy or player.
|
||||
static double getAngle(int id) {
|
||||
// Player spawn angles
|
||||
switch (id) {
|
||||
case playerNorth:
|
||||
return CardinalDirection.north.radians;
|
||||
@@ -147,9 +123,52 @@ abstract class MapObject {
|
||||
return CardinalDirection.west.radians;
|
||||
}
|
||||
|
||||
if (id < 108 || id > 213) return 0.0;
|
||||
// FIX: Expand the boundary to include ALL enemies (Dogs and Mutants)
|
||||
if (id < guardStart || id > (mutantStart + 35)) return 0.0;
|
||||
|
||||
// Enemy directions are mapped in groups of 4
|
||||
return CardinalDirection.fromEnemyIndex(id - 108).radians;
|
||||
int baseId;
|
||||
if (id >= mutantStart) {
|
||||
baseId = mutantStart;
|
||||
} else if (id >= dogStart) {
|
||||
baseId = dogStart;
|
||||
} else if (id >= ssStart) {
|
||||
baseId = ssStart;
|
||||
} else if (id >= officerStart) {
|
||||
baseId = officerStart;
|
||||
} else {
|
||||
baseId = guardStart;
|
||||
}
|
||||
|
||||
// FIX: Normalize patrolling enemies back to the standing block, THEN get the 4-way angle
|
||||
int directionIndex = ((id - baseId) % 18) % 4;
|
||||
return CardinalDirection.fromEnemyIndex(directionIndex).radians;
|
||||
}
|
||||
|
||||
static bool shouldSpawn(int id, Difficulty selectedDifficulty) {
|
||||
// FIX: Expand the boundary so Dogs and Mutants aren't bypassing difficulty checks
|
||||
if (id < guardStart || id > (mutantStart + 35)) return true;
|
||||
|
||||
int baseId;
|
||||
if (id >= mutantStart) {
|
||||
baseId = mutantStart;
|
||||
} else if (id >= dogStart) {
|
||||
baseId = dogStart;
|
||||
} else if (id >= ssStart) {
|
||||
baseId = ssStart;
|
||||
} else if (id >= officerStart) {
|
||||
baseId = officerStart;
|
||||
} else {
|
||||
baseId = guardStart;
|
||||
}
|
||||
|
||||
int relativeId = (id - baseId) % 18;
|
||||
|
||||
return switch (relativeId) {
|
||||
< 4 => true,
|
||||
< 8 => selectedDifficulty.level >= Difficulty.dontHurtMe.level,
|
||||
< 12 => selectedDifficulty.level >= Difficulty.bringEmOn.level,
|
||||
< 16 => selectedDifficulty.level >= Difficulty.iAmDeathIncarnate.level,
|
||||
_ => true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user