int switch_auto_edit_camera_mode (camera *raw) { camera_modes new_camera_mode; int changed; ASSERT (raw); new_camera_mode = get_auto_edit_random_camera_mode (raw); if (new_camera_mode == raw->camera_mode) { changed = FALSE; } else { set_camera_mode (raw, new_camera_mode, TRUE); if (new_camera_mode == CAMERA_MODE_FLY_BY) { update_fly_by_camera_continued (raw); } else { update_cinematic_camera_continued (raw); } changed = TRUE; } return (changed); }
void update_cinematic_camera (camera *raw) { // // pre-amble // ASSERT (raw); ASSERT (raw->external_view_entity); //////////////////////////////////////// // // This code has been added to protect against cases where an object // and its destroyed version have a different number of cameras. // switch (raw->cinematic_camera_index) { case OBJECT_3D_CAMERA_SCENIC_MOVING: case OBJECT_3D_CAMERA_SCENIC_STATIC: { object_3d_instance *inst3d; inst3d = get_local_entity_ptr_value (raw->external_view_entity, PTR_TYPE_INSTANCE_3D_OBJECT); if (raw->cinematic_camera_depth >= get_number_of_3d_object_cameras (inst3d, raw->cinematic_camera_index)) { #if DEBUG_MODULE debug_colour_log (DEBUG_COLOUR_RED, "CINEMATIC CAMERA ERROR - forced reset!!!"); #endif reset_cinematic_camera (raw); } break; } } // //////////////////////////////////////// // // update timer // raw->cinematic_camera_timer += get_delta_time (); if (raw->cinematic_camera_timer > raw->cinematic_camera_lifetime) { if (raw->auto_edit) { switch_auto_edit_entity (raw); if (switch_auto_edit_camera_mode (raw)) { // // switched to a different camera // return; } } reset_cinematic_camera (raw); } // // continue update // update_cinematic_camera_continued (raw); }