It still may not be legal consent if it's done/agreed upon while one of you is intoxicated (depends on the law what legal consent is) bc generally, being intoxicated means that your decision making capabilities are impaired.
And it depends for r@pe too. The legally classification of r@pe tends to depend on the law and circumstances, but most require intent by the person, which usually means that they know they don't have consent and still commit the act.
But intent is put into also question if the person is also intoxicated (bc their decision making capabilities are impaired) or reasonably believed they had consent. And technically, if both parties are intoxicated, depending on the law, it means both parties lacked the ability to consent and both could charge the other for r@pe (tho, both would likely lose their case bc there's also a lack of intent from both parties for r@pe charges to stick in that case).
It'd be best for everyone to check what your laws say abt consent, r@pe, etc.
And this is only on the legal side of things. Your laws may not match what you feel abt these topics morally/ethically/personally.