"I have been waiting" references a period of time, the later end of which is now.
Tom didn't "came" now or in 15 minutes, right? :) So, in all cases, you need to bump things forward:
If Tom comes now, I will have waited for him for 20 minutes.
If Tom comes now, I will have been waiting for him for 20 minutes.
If Tom comes in 15 minutes, I will have waited for him for 35 minutes.
If Tom comes in 15 minutes, I will have been waiting for him for 35 minutes.
First point: if Tom comes now means that Tom hasn't come yet, so the construction is the same for both of these sentences. In effect, "now" is actually the future here.
Second point: the reason that we use the present "comes" is that we are advancing a hypothetical set of future events. So, we are saying if the hypothetical event becomes the present event now or in 15 minutes and so on.
Third point: you are referencing a point in time in the future (again, either "now" or "in 15 minutes", as explained in the first point), and from there referencing a period of time that begins at a point prior to that point and ends at that point. That's why you use will instead of would; none of this has happened yet in the present--keep in mind that the actual present is the point in time that you make the statement. Consider this, for comparison:
If Tom had come 15 minutes after [past point in time x], I would have been waiting for him for 35 minutes.