weight gain

I've gained 35 pounds and I'm only 30 weeks. My doctor is telling me I need to avoid gaining anymore or else I risk a c section or having to break his clavical if he can't fit through the birth canal. I'm a healthy 23 year old and I don't eat the healthiest but I don't completely pig out and I take my prenatal vitamins. I feel depressed about how much I've gained. Any advice on what I can do? I have pelvic pain really bad and the most exercise I can do is walk.