OBJECT *Copy_Object (OBJECT *Old) { OBJECT *New; if (Old == NULL) { return (NULL); } New = (OBJECT *)Copy(Old); /* * The following copying of OBJECT_FIELDS is redundant if Copy * did *New = *Old but we cannot assume it did. It is safe for * Copy to do *New = *Old but it should not otherwise * touch OBJECT_FIELDS. */ New->Methods = Old->Methods; New->Type = Old->Type; New->Sibling = Old->Sibling; New->Texture = Old->Texture; New->Bound = Old->Bound; New->Clip = Old->Clip; New->BBox = Old->BBox; New->Flags = Old->Flags; New->LLights = NULL; /* Important */ New->Sibling = NULL; /* Important */ New->Texture = Copy_Textures (Old->Texture); New->Interior_Texture = Copy_Textures (Old->Interior_Texture); New->Bound = Copy_Bound_Clip (Old->Bound); New->Interior = Copy_Interior(Old->Interior); /* NK 1998 */ New->UV_Trans = Copy_Transform(Old->UV_Trans); /* NK ---- */ if (Old->Bound != Old->Clip) { New->Clip = Copy_Bound_Clip (Old->Clip); } else { New->Clip = New->Bound; } return (New); }
MATERIAL *Copy_Material(MATERIAL *Old) { MATERIAL *New; if (Old != NULL) { New = Create_Material(); *New = *Old; New->Texture = Copy_Textures(Old->Texture); New->Interior_Texture = Copy_Textures(Old->Interior_Texture); New->Interior = Copy_Interior(Old->Interior); return(New); } else { return(NULL); } }