Had we been playing for two hours yesterday when Tom arrived? Yesterday we hadn't been playing for two hours when Tom arrived.
Had I been waiting for Bob for two hours when it was 3:00 pm? I hadn't been waiting for Bob for two hours when it was 3:00 pm.