Shakespeare was an actor before he was a playwright, and his great roles always give the actor a fair amount of leeway to make the part his own. One of the reasons that the role of Hamlet is so prized and so iconic is that in this role, the actor has the chance to decide what type of man Hamlet actually is. Crucially, Hamlet warns Horatio in act 1, scene 5 that he is to give nothing away:
How strange or odd soe'er I bear myself,
As I perchance hereafter shall think meet
To put an antic disposition on…
This gives the actor (or the reader) the latitude to decide if Hamlet is wholly mad later in the play or wholly feigning—or some of each. As far as Hamlet’s other mental states are concerned, he might well be diagnosed with bipolar disorder today. There is nothing wrong with this reading, as long as we acknowledge that we are reading a modern concept back into a Renaissance text rather than uncovering the author's intention, just as a Postcolonial theorist does when branding Prospero in The Tempest an imperialist aggressor.
Hamlet’s melancholy or depression do not detract from his honor or his honesty. He maintains at the end that his death is not a tragedy for him (asking Horatio to “Absent thee from felicity awhile” by remaining alive), but it would have been a tragedy for him to die before he achieved his revenge. Far from falling into the traps laid by his enemies—Claudius, Rosencrantz, and Guildenstern (for Laertes is not really his enemy)—he foils their plans and manages to kill all of them before dying himself.