void CEntityDlg::DeleteCurvePoint() {

    if ( editEntity == NULL || editEntity->curve == NULL ) {
        return;
    }

    if ( g_qeglobals.d_select_mode != sel_editpoint ) {
        return;
    }


    if ( g_qeglobals.d_num_move_points == 0 ) {
        return;
    }

    for ( int i = 0; i < editEntity->curve->GetNumValues(); i++ ) {
        if ( PointInMoveList( editEntity->curve->GetValueAddress( i ) ) >= 0 ) {
            editEntity->curve->RemoveIndex( i );
            g_qeglobals.d_num_move_points = 0;
            break;
        }
    }
    UpdateEntityCurve();

    Sys_UpdateWindows( W_XY | W_CAMERA );

}
void CEntityDlg::InsertCurvePoint() {
	if( editEntity == NULL || editEntity->curve == NULL ) {
		return;
	}
	if( g_qeglobals.d_select_mode != sel_editpoint ) {
		return;
	}
	if( g_qeglobals.d_num_move_points == 0 ) {
		return;
	}
	for( int i = 0; i < editEntity->curve->GetNumValues(); i++ ) {
		if( PointInMoveList( editEntity->curve->GetValueAddress( i ) ) >= 0 ) {
			if( i == editEntity->curve->GetNumValues() - 1 ) {
				// just do an add
				AddCurvePoints();
			} else {
				idCurve<idVec3> *newCurve = Entity_MakeCurve( editEntity );
				if( newCurve == NULL ) {
					return;
				}
				for( int j = 0; j < editEntity->curve->GetNumValues(); j++ ) {
					if( j == i ) {
						idVec3 start;
						idVec3 end;
						if( i > 0 ) {
							start = editEntity->curve->GetValue( i - 1 );
							end = editEntity->curve->GetValue( i );
							start += end;
							start *= 0.5f;
						} else {
							start = editEntity->curve->GetValue( 0 );
							if( editEntity->curve->GetNumValues() > 1 ) {
								end = start;
								start = editEntity->curve->GetValue( 1 );
								idVec3 dir = end - start;
								dir.Normalize();
								start = end + 64 * dir;
							} else {
								end = start;
								end.x += 64;
								end.y += 64;
							}
						}
						newCurve->AddValue( newCurve->GetNumValues() * 100, start );
					}
					newCurve->AddValue( newCurve->GetNumValues() * 100, editEntity->curve->GetValue( j ) );
				}
				delete editEntity->curve;
				editEntity->curve = newCurve;
			}
			g_qeglobals.d_num_move_points = 0;
			break;
		}
	}
	UpdateEntityCurve();
	Sys_UpdateWindows( W_XY | W_CAMERA );
}