Tilted or turned to one side, or prepared and ready to fire (as in a gun).
From cock (to tilt), which comes from Old English, originally meaning the rooster's crowing position. It evolved to mean any tilted position, and separately to mean preparing a firearm for discharge.
A 'cocked hat' becomes a 'three-cornered' hat when you cock it—this is why 'knocked into a cocked hat' means knocked completely out of shape, an expression that's now mostly forgotten but reveals how hats shaped old slang.
Complete word intelligence in one call. Free tier — 50 lookups/day.