Fighting the darkness, he counted off their names one by one.
Literal
He [topic-は] dimness [and-と] fighting [while-ながら], they [possessive-の] names [object-を] counted went.
薄暗がり ('dimness, semi-darkness') is a compound of 薄暗い + がり (nominalizer). 戦いながら ('while fighting') creates a vivid image of straining to see. 数えていった uses ~ていく for sequential progression through a list — counting away into the distance. Atmospheric narrative prose.