Browse files

iwd2: respect actor DifficultyMargin vs. area difficulty level

fixes hordes of orcs/... being spawned in ch1 and more problematic
multiple spawns of npcs like Illium and Odea in ar4000
  • Loading branch information...
1 parent 489ade9 commit 833056db6f0ed650c2d5e4fefa2ce6b6898c6dda @lynxlynxlynx lynxlynxlynx committed Jun 10, 2013
Showing with 13 additions and 0 deletions.
  1. +13 −0 gemrb/plugins/AREImporter/AREImporter.cpp
View
13 gemrb/plugins/AREImporter/AREImporter.cpp
@@ -1045,6 +1045,19 @@ Map* AREImporter::GetMap(const char *ResRef, bool day_or_night)
if (Flags&AF_INVULNERABLE) {
ab->SetMCFlag(MC_INVULNERABLE,BM_OR);
}
+ if (!(Flags&AF_ENABLED)) {
+ // DifficultyMargin - only enable actors that are difficult enough vs the area difficulty
+ // 1 - area difficulty 1
+ // 2 - area difficulty 2
+ // 4 - area difficulty 3
+ if (!DifficultyMargin || (DifficultyMargin & map->AreaDifficulty)) {
+ //TODO: save AF_ENABLED instead, so if someone implements Imprisonment for iwd2, this won't interfere
+ ab->SetBase(IE_AVATARREMOVAL, 0);
+ } else {
+ // iwd2 has GF_START_ACTIVE off, but that only touches IF_IDLE
+ ab->SetBase(IE_AVATARREMOVAL, 1);
+ }
+ }
}
ab->DifficultyMargin = DifficultyMargin;

0 comments on commit 833056d

Please sign in to comment.