/* * GetPointFloor: Return height of floor at (x, y). If (x, y) is not in * a leaf node, return 0. */ int GetPointFloor(BSPTree tree, int x, int y) { int floor, ceiling; if (!GetPointHeights(tree, x, y, &floor, &ceiling)) return 0; return floor; }
/* * RoomObjectSetHeight: Set z coordinate of object to floor height at object's position. * NOTE: If it is a hanging object we have to attach to the ceiling height minus the * object height. */ void RoomObjectSetHeight(room_contents_node *r) { int floor,ceiling; GetPointHeights(r->motion.x,r->motion.y,&floor,&ceiling); if (r->obj.flags & OF_HANGING) { if (r->obj.boundingHeight == 0) { int width,height; if(GetObjectSize(r->obj.icon_res, r->obj.animate->group, 0, *(r->obj.overlays), &width, &height)) { r->obj.boundingHeight = height; r->obj.boundingWidth = width; } } r->motion.z = ceiling - r->obj.boundingHeight; } else if (ROOM_OVERRIDE_MASK & GetRoomFlags()) { int height = floor; int depth = GetPointDepth(r->motion.x, r->motion.y); switch (depth) { case SF_DEPTH1: if (ROOM_OVERRIDE_DEPTH1 & GetRoomFlags()) height = GetOverrideRoomDepth(SF_DEPTH1); break; case SF_DEPTH2: if (ROOM_OVERRIDE_DEPTH2 & GetRoomFlags()) height = GetOverrideRoomDepth(SF_DEPTH2); break; case SF_DEPTH3: if (ROOM_OVERRIDE_DEPTH3 & GetRoomFlags()) height = GetOverrideRoomDepth(SF_DEPTH3); break; } r->motion.z = height; } else { int depth = GetPointDepth(r->motion.x, r->motion.y); r->motion.z = floor - sector_depths[depth]; } }