Add map_scr_remove_spatial

This commit is contained in:
Alexander Batalov 2023-07-25 11:56:20 +03:00
parent 8329d2fcf6
commit cba1fc8f61
2 changed files with 36 additions and 0 deletions

View File

@ -7,6 +7,41 @@
namespace fallout {
// 0x49B170
int map_scr_remove_spatial(int tile, int elevation)
{
Script* scr;
Object* obj;
Rect rect;
scr = scriptGetFirstSpatialScript(elevation);
while (scr != NULL) {
if (builtTileGetTile(scr->sp.built_tile) == tile) {
scriptRemove(scr->sid);
scr = scriptGetFirstSpatialScript(elevation);
continue;
}
scr = scriptGetNextSpatialScript();
}
obj = objectFindFirstAtElevation(elevation);
while (obj != NULL) {
if (obj->tile == tile && buildFid(OBJ_TYPE_INTERFACE, 3, 0, 0, 0) == obj->fid) {
objectDestroy(obj, &rect);
tileWindowRefreshRect(&rect, elevation);
obj = objectFindFirstAtElevation(elevation);
continue;
}
obj = objectFindNextAtElevation();
}
return 0;
}
// 0x49B214
int map_scr_remove_all_spatials()
{

View File

@ -3,6 +3,7 @@
namespace fallout {
int map_scr_remove_spatial(int tile, int elevation);
int map_scr_remove_all_spatials();
} // namespace fallout