Use warps. (The orange 4-arrow box thingy.) If the first flag is enabled, warp the player to an identical screen. If the next flag is enabled, warp to the next, and on and on. Only the final screen should have the new room. Then, the warps on all the previous screens should warp back to the adjoining room.