The Chicago Manual of Style sets out these rules for capitalizing "Captain":
Robert greeted Captain Jones, "Hello Captain."
"Good evening," replied the captain.
I looked at 20 books by the most famous novelists of the 1900s to see who follows the rules noted above. Generally, most writers follow those rules (Michael Chriton, Dan Brown, Ken Burns, Tom Clancy, Wilbur Smith, Clive Cussler, James A. Michener, Joseph Heller, Robert Ludlum, Nora Roberts, to name a few). Some other writers do not follow those rules and would write "replied the Captain." Those include Douglas Adams (in some books), William Goldman (the Princess Bride), JK Rowling (Harry Potter).
To me, it's strange that none of the "style books" cite any authority as I just did. Finding authority for a rule was the basis of the Oxford English Dictionary, and gave it credibility. Generally, American writers use "down style" as in the Chicago Manual of Style. British writers are more likely to use capitals.
I think it looks sloppy to have the word "captain" capitalized in some sentences, and lower case in other sentences, despite the fact the word is used differently. Should I consider the nature of the writing? If I were writing an article for the New York Times, I would use "down style." But if I were writing a fanciful book like the Princess Bride, should I consider using capitals, as William Goldman did?
People say "the captain" is correct, because with that use, it's a descriptive noun, whereas, when the character is addressed, "Hello, Captain" the word substitutes for the name and is thus a proper noun. To me, that is a rather fine distinction. When I choose between writing "said Captain Jones" or "said the captain" it is interchangeable, yet one is capitalized and one is not. When writing alternates like that, it looks sloppy to me.
Any thoughts are appreciated. Thanks!