Copies the data from one room into another Note: Portals are not copied, and the new room will have zero portals Parameters: destp - the destination room of the copy srcp - the source room for the copy
| 1942 | // Parameters: destp - the destination room of the copy |
| 1943 | // srcp - the source room for the copy |
| 1944 | void CopyRoom(room *destp, room *srcp) { |
| 1945 | // Initialize the new room |
| 1946 | InitRoom(destp, srcp->num_verts, srcp->num_faces, 0); |
| 1947 | |
| 1948 | // Copy over the faces |
| 1949 | for (int i = 0; i < destp->num_faces; i++) { |
| 1950 | CopyFace(&destp->faces[i], &srcp->faces[i]); |
| 1951 | #ifdef NEWEDITOR |
| 1952 | LevelTexIncrementTexture(srcp->faces[i].tmap); |
| 1953 | #endif |
| 1954 | } |
| 1955 | |
| 1956 | // Copy over the verts |
| 1957 | for (i = 0; i < destp->num_verts; i++) |
| 1958 | destp->verts[i] = srcp->verts[i]; |
| 1959 | |
| 1960 | // Copy doorway info |
| 1961 | if (srcp->doorway_data) { |
| 1962 | destp->doorway_data = (doorway *)mem_malloc(sizeof(*destp->doorway_data)); |
| 1963 | *destp->doorway_data = *srcp->doorway_data; |
| 1964 | } |
| 1965 | |
| 1966 | // Copy over the rest of the data |
| 1967 | destp->flags = srcp->flags; |
| 1968 | |
| 1969 | // Copy over room lighting |
| 1970 | Room_multiplier[destp - Rooms] = Room_multiplier[srcp - Rooms]; |
| 1971 | Room_ambience_r[destp - Rooms] = Room_ambience_r[srcp - Rooms]; |
| 1972 | Room_ambience_g[destp - Rooms] = Room_ambience_g[srcp - Rooms]; |
| 1973 | Room_ambience_b[destp - Rooms] = Room_ambience_b[srcp - Rooms]; |
| 1974 | } |
| 1975 | |
| 1976 | // Adds a new portal for this room. Returns the portal number. |
| 1977 | // Initializes the flags |
no test coverage detected