diff --git a/src/acs/environment.cpp b/src/acs/environment.cpp index 0a4939811..b14d825df 100644 --- a/src/acs/environment.cpp +++ b/src/acs/environment.cpp @@ -228,8 +228,7 @@ void Environment::loadModule(ACSVM::Module *module) if (name->i == (size_t)LUMPERROR) { // No lump given for module. - CONS_Alert(CONS_WARNING, "Could not find ACS module \"%s\"; scripts will not function properly!\n", name->s->str); - return; //throw ACSVM::ReadError("file open failure"); + throw ACSVM::ReadError("invalid lump"); } lumpLen = W_LumpLength(name->i); @@ -280,9 +279,7 @@ void Environment::loadModule(ACSVM::Module *module) } else { - // Unlike Hexen, a BEHAVIOR lump is not required. - // Simply ignore in this instance. - CONS_Debug(DBG_SETUP, "ACS module has no data, ignoring...\n"); + throw ACSVM::ReadError("file empty"); } } diff --git a/src/acs/interface.cpp b/src/acs/interface.cpp index 60689d24a..50eb51241 100644 --- a/src/acs/interface.cpp +++ b/src/acs/interface.cpp @@ -142,6 +142,13 @@ void ACS_LoadLevelScripts(size_t mapID) map->active = true; // Insert BEHAVIOR lump into the list. + virtres_t *vRes = vres_GetMap(mapheaderinfo[mapID]->lumpnum); + auto _ = srb2::finally([vRes]() { vres_Free(vRes); }); + + // Unlike Hexen, a BEHAVIOR lump is not required. + // Simply ignore in this instance. + virtlump_t *vLump = vres_Find(vRes, "BEHAVIOR"); + if (vLump != nullptr && vLump->size > 0) { ACSVM::ModuleName name = ACSVM::ModuleName( env->getString( mapheaderinfo[mapID]->lumpname ), @@ -150,6 +157,7 @@ void ACS_LoadLevelScripts(size_t mapID) ); modules.push_back(env->getModule(name)); + CONS_Debug(DBG_SETUP, "Found BEHAVIOR lump.\n"); } if (modules.empty() == false)