I'm in the process of remodeling a basement bathroom directly next to an exterior wall. Previously there was a shower and now I want to put in a bathtub. When I took out the fiberglass shower, I found that the shower drain was connected directly to the main waste line leading out of the house. The shower drain had no p-trap. It just 90 degree into the waste line. I also discovered that there was no vent pipe nearby for the shower. However on the outside of the house adjacent to the foundation wall is a vent pipe sticking out of the ground that is in line with the existing shower drain/main waste line. Also b/w the shower drain and outside vent pipe is a toilet. Is this the pipe that vents the toilet and shower? The distance between the shower drain and outside vent pipe is about 4 feet. Also right after the vent pipe is the whole house U trap.

My next questions is regarding the new bathtub drain. Does it need a P trap since the old shower didn't have one. If so, How far downstream from the bathtub drain can I put a new P trap and still be considered vented using that outside vent pipe. Reasoning being the new drain is going to be 2 feet further upstream from existing shower drain.

Sorry for the long post. Just trying to give as much info.