properly handle named palettes in SetAnimationID()

Fixes a possible crash with Abazigal in his dragon form, for example.