The first couple of inches of slide movement cocks the hammer, so if your empties are ejecting normally, the problem lies elsewhere.
I suspect "hammer follow-through" of one kind or another. That is, the pistol's sear is not holding the hammer in the cocked position, after the slide has gone forward again.
Frequently this is caused by either the sear becoming chipped or worn, or the hammer's full-cock notch becoming worn. However, the problem could also be that the disconnector isn't functioning (it's the part that allows the sear to "catch" the hammer, even when the trigger remains fully pulled).
Start by spraying cleaning fluid through the "works," in case the source of the problem is caked-on dirt or lubricant. If this doesn't work, it's more serious. An experienced shooter might be able to correct these problems, but I suggest that you may need a gunsmith.