diff --git a/src/mapper/mp_scrpt.cc b/src/mapper/mp_scrpt.cc new file mode 100644 index 0000000..5a100f9 --- /dev/null +++ b/src/mapper/mp_scrpt.cc @@ -0,0 +1,55 @@ +#include "mapper/mp_scrpt.h" + +#include "art.h" +#include "object.h" +#include "scripts.h" +#include "tile.h" + +namespace fallout { + +// 0x49B214 +int map_scr_remove_all_spatials() +{ + int elevation; + Script* scr; + Object* obj; + int sid; + + for (elevation = 0; elevation < ELEVATION_COUNT; elevation++) { + scr = scriptGetFirstSpatialScript(elevation); + while (scr != NULL) { + scriptRemove(scr->sid); + + scr = scriptGetFirstSpatialScript(elevation); + } + + obj = objectFindFirstAtElevation(elevation); + while (obj != NULL) { + if (buildFid(OBJ_TYPE_INTERFACE, 3, 0, 0, 0) == obj->fid) { + objectDestroy(obj, NULL); + + obj = objectFindFirstAtElevation(elevation); + continue; + } + + obj = objectFindNextAtElevation(); + } + } + + tileWindowRefresh(); + + for (sid = 0; sid < 15000; sid++) { + if (scriptGetScript(sid, &scr) != -1) { + if (scr->owner != NULL) { + if (scr->owner->pid == 0x500000C) { + scr->owner->sid = -1; + scriptRemove(sid); + } + } + } + } + + return 0; +} + +} // namespace fallout diff --git a/src/mapper/mp_scrpt.h b/src/mapper/mp_scrpt.h new file mode 100644 index 0000000..6912a8e --- /dev/null +++ b/src/mapper/mp_scrpt.h @@ -0,0 +1,10 @@ +#ifndef FALLOUT_MAPPER_MP_SCRPTR_H_ +#define FALLOUT_MAPPER_MP_SCRPTR_H_ + +namespace fallout { + +int map_scr_remove_all_spatials(); + +} // namespace fallout + +#endif /* FALLOUT_MAPPER_MP_SCRPTR_H_ */