void CGCam_Roff( void ) { if ( cg.time < client_camera.next_roff_time ) { // Nothing else to do for now... return; } int roff_id; // Make sure that the roff is cached roff_id = G_LoadRoff( client_camera.sRoff ); if ( !roff_id ) { return; } roff_list_t *roff = &roffs[ roff_id - 1 ]; move_rotate_t *data = &roff->data[ client_camera.roff_frame ]; #ifdef _DEBUG Com_Printf( S_COLOR_GREEN"ROFF dat: o:<%.2f %.2f %.2f> a:<%.2f %.2f %.2f>\n", data->origin_delta[0], data->origin_delta[1], data->origin_delta[2], data->rotate_delta[0], data->rotate_delta[1], data->rotate_delta[2] ); #endif if ( client_camera.roff_frame ) { // Don't mess with angles if we are following if ( !(client_camera.info_state & CAMERA_FOLLOWING) ) { VectorCopy( client_camera.angles2, client_camera.angles ); } VectorCopy( client_camera.origin2, client_camera.origin ); } // Don't mess with angles if we are following if ( !(client_camera.info_state & CAMERA_FOLLOWING) ) { VectorCopy( data->rotate_delta, client_camera.angles2 ); client_camera.pan_time = cg.time; client_camera.pan_duration = 100; } VectorAdd( client_camera.origin, data->origin_delta, client_camera.origin2 ); client_camera.move_time = cg.time; client_camera.move_duration = 100; if ( ++client_camera.roff_frame >= roff->frames ) { CGCam_StopRoff(); return; } // Check back in 100 ms to get the next roff entry client_camera.next_roff_time = cg.time + 100; }
static void CGCam_Roff( void ) { while ( client_camera.next_roff_time <= cg.time ) { // Make sure that the roff is cached const int roff_id = G_LoadRoff( client_camera.sRoff ); if ( !roff_id ) { return; } // The ID is one higher than the array index const roff_list_t *roff = &roffs[ roff_id - 1 ]; vec3_t org, ang; if ( roff->type == 2 ) { move_rotate2_t *data = &((move_rotate2_t *)roff->data)[ client_camera.roff_frame ]; VectorCopy( data->origin_delta, org ); VectorCopy( data->rotate_delta, ang ); // since we just hit a new frame, clear our CUT flag client_camera.info_state &= ~CAMERA_CUT; if (data->mStartNote != -1 || data->mNumNotes) { CG_RoffNotetrackCallback(roffs[roff_id - 1].mNoteTrackIndexes[data->mStartNote]); } } else { move_rotate_t *data = &((move_rotate_t *)roff->data)[ client_camera.roff_frame ]; VectorCopy( data->origin_delta, org ); VectorCopy( data->rotate_delta, ang ); } // Yeah, um, I guess this just has to be negated? //ang[PITCH] =- ang[PITCH]; ang[ROLL] = -ang[ROLL]; // might need to to yaw as well. need a test... if ( cg_developer.integer ) { Com_Printf( S_COLOR_GREEN"CamROFF: frame: %d o:<%.2f %.2f %.2f> a:<%.2f %.2f %.2f>\n", client_camera.roff_frame, org[0], org[1], org[2], ang[0], ang[1], ang[2] ); } if ( client_camera.roff_frame ) { // Don't mess with angles if we are following if ( !(client_camera.info_state & CAMERA_FOLLOWING) ) { VectorAdd( client_camera.angles, client_camera.angles2, client_camera.angles ); } VectorCopy( client_camera.origin2, client_camera.origin ); } // Don't mess with angles if we are following if ( !(client_camera.info_state & CAMERA_FOLLOWING) ) { VectorCopy( ang, client_camera.angles2 ); client_camera.pan_time = cg.time; client_camera.pan_duration = roff->mFrameTime; } VectorAdd( client_camera.origin, org, client_camera.origin2 ); client_camera.move_time = cg.time; client_camera.move_duration = roff->mFrameTime; if ( ++client_camera.roff_frame >= roff->frames ) { CGCam_StopRoff(); return; } // Check back in frameTime to get the next roff entry client_camera.next_roff_time += roff->mFrameTime; } }
static void CGCam_Roff( void ) { while ( client_camera.next_roff_time <= cg.time ) { int roff_id; // Make sure that the roff is cached roff_id = G_LoadRoff( client_camera.sRoff ); if ( !roff_id ) { return; } roff_list_t *roff = &roffs[ roff_id - 1 ]; vec3_t org, ang; if ( roff->type == 2 ) { move_rotate2_t *data = &((move_rotate2_t *)roff->data)[ client_camera.roff_frame ]; VectorCopy( data->origin_delta, org ); VectorCopy( data->rotate_delta, ang ); } else { move_rotate_t *data = &((move_rotate_t *)roff->data)[ client_camera.roff_frame ]; VectorCopy( data->origin_delta, org ); VectorCopy( data->rotate_delta, ang ); } // Yeah, um, I guess this just has to be negated? ang[PITCH] =- ang[PITCH]; ang[ROLL] =- ang[ROLL]; // might need to to yaw as well. need a test... #ifdef _DEBUG if ( cg_developer.integer ) { Com_Printf( S_COLOR_GREEN"CamROFF : o:<%.2f %.2f %.2f> a:<%.2f %.2f %.2f>\n", org[0], org[1], org[2], ang[0], ang[1], ang[2] ); } #endif if ( client_camera.roff_frame ) { // Don't mess with angles if we are following if ( !(client_camera.info_state & CAMERA_FOLLOWING) ) { VectorAdd( client_camera.angles, client_camera.angles2, client_camera.angles ); } VectorCopy( client_camera.origin2, client_camera.origin ); } // Don't mess with angles if we are following if ( !(client_camera.info_state & CAMERA_FOLLOWING) ) { VectorCopy( ang, client_camera.angles2 ); client_camera.pan_time = cg.time; client_camera.pan_duration = roff->mFrameTime; } VectorAdd( client_camera.origin, org, client_camera.origin2 ); client_camera.move_time = cg.time; client_camera.move_duration = roff->mFrameTime; if ( ++client_camera.roff_frame >= roff->frames ) { CGCam_StopRoff(); return; } // Check back in frameTime to get the next roff entry client_camera.next_roff_time += roff->mFrameTime; } }