WOW! That sounds awful! It could be a few things, especially since you said there was poop in the room, it is possible that he might not know where the litter tray is, try bringing the litter tray upstairs. Whenever my cat is sick and he can't make it to the litter in time, he either goes under something or goes to the corner, digs, then does his business. You could even try a 2nd litter tray and place it outside your room, or even in your room and see if this helps him to stop.
It might also be that he is trying to mark his territory, with the spraying so be careful with anything that has a scent as he might try and cover it up with his own! Make sure the cat knows it is loved and make it feel safe and secure it its surroundings. It could be he is longing to go outside, or feels like he is being trapped or punished and he is trying to show he still in charge. You could try maybe taking the cat our for short intervals if you have time, I know it's cold, but then he might realise why he can't go out. Stay with him and watch him, make sure he is safe. Usually with my cat she'll cry at the door to go outside, and if I take her outside on the leash even just for 5 minutes, she settles.