To add a custom Kirby ability, use K_AddAbility(abilityfunction, secret, iconname)
abilityfunction is the function used for the ability. This is called every frame for the actual functionality of the ability, but it has a few other uses as well, which I'll get into later.
secret is wether or not this ability is a secret ability. The only real gameplay purpose of this is so that it has a ((1/256)/number of secret abilities) chance of appearing when the ability roulette appears.
iconname is a 7 character long name for the ability icon and name graphics. The ability icon graphic should be named I + iconname, and the name graphic N + iconname.
This will return a number for you to use in kirbyabilitytable, though keep in mind this function wont return a negative value for secret abilities!
Ability function:
The ability function should have the following arguments:
(checkflags, destroy, late, player)
If checkflags is true, the function is being called to check for ability flags. The function should immedietly return ability flags.
If destroy is true, then the ability is being discarded or otherwise lost. If you spawn an object for Kirby to hold, or mess with his flags, this is where you should restore them! Immedietly return after you're done cleaning up.
If late is true, then the function is being called at the end of Kirby's ThinkFrame hook. Once again, its a good idea to return after you do whatever you need to at this point, so normal and late functionality remain separate.
If none of the above are true, then the ability should run its normal functionality.
player is simply the player_t thats using the ability.
Ability flags:
AF_NOFLOAT Disable Kirby's ability to float
AF_NODUCK Disable Kirby's ability to duck
AF_NOJUMP Disable Kirby's ability to jump
AF_NOSWIM Disable Kirby's ability to swim
AF_NODROP Disable dropping the ability with toss flag
AF_NOLOSE Disable dropping the ability from taking damage or dying
AF_ALLOWSUCK Allow Kirby to inhale like normal Kirby (this will not allow him to copy abilities)
AF_WALKSWIM Use walking frames for swimming, even without something inhaled
Custom feet sprites:
If you create custom frames for Kirby, you probably want his feet to change color like normal
To do this, call K_AddCustomFeet(kirbysprite, feetsprite)
kirbysprite is the sprite Kirby is using, and feetsprite is the sprite the feet should use when Kirby uses this sprite.
If you use a sprite2 for your ability instead of a normal sprite, then make Kirby's feet the super version and he'll automatically use them.