Replace Jazz's animations

Version:

1.0

Added on:

14 Apr 2015 00:32

Tags:

Description:
Loads a new set of animations from your custom .j2a file and replaces Jazz's animations with them. Works in either 1.23 or 1.24, and people using the opposite version of yours in an online server will still see your animations displayed correctly.
  1. #pragma require "myCustom.j2a"
  2.  
  3. namespace RABBIT { //save some extra typing
  4.   array<Anim> Anims = { //This should correspond exactly to the order of animations in your .j2a. I'm assuming you're using the same order that TSF does.
  5.     AIRBOARD, AIRBOARDTURN, BUTTSTOMPLAND, CORPSE, DIE, DIVE, DIVEFIREQUIT, DIVEFIRERIGHT, DIVEUP, EARBRACHIATE, ENDOFLEVEL, FALL, FALLBUTTSTOMP, FALLLAND, FIRE, FIREUP, FIREUPQUIT, FROG, HANGFIREQUIT, HANGFIREREST, HANGFIREUP, HANGIDLE1, HANGIDLE2, HANGINGFIREQUIT, HANGINGFIRERIGHT, HELICOPTER, HELICOPTERFIREQUIT, HELICOPTERFIRERIGHT, HPOLE, HURT, IDLE1, IDLE2, IDLE3, IDLE4, IDLE5, JUMPFIREQUIT, JUMPFIRERIGHT, JUMPING1, JUMPING2, JUMPING3, LEDGEWIGGLE, LIFT, LIFTJUMP, LIFTLAND, LOOKUP, LOOPY, PUSH, QUIT, REV1, REV2, REV3, RIGHTFALL, RIGHTJUMP, ROLLING, RUN1, RUN2, RUN3, SKID1, SKID2, SKID3, SPRING, STAND, STATIONARYJUMP, STATIONARYJUMPEND, STATIONARYJUMPSTART, STONED, SWIMDOWN, SWIMRIGHT, SWIMTURN1, SWIMTURN2, SWIMUP, SWINGINGVINE, TELEPORT, TELEPORTFALL, TELEPORTFALLING, TELEPORTFALLTELEPORT, TELEPORTSTAND, VPOLE
  6.   };
  7. }
  8.  
  9. void onLevelLoad() {
  10.   uint emptyCustomAnimSlot = 0;
  11.   while (jjAnimSets[ANIM::CUSTOM[emptyCustomAnimSlot]].firstAnim != 0) //find an unused slot in ANIM::CUSTOM
  12.     ++emptyCustomAnimSlot;
  13.   jjANIMSET@ emptyCustomAnim = jjAnimSets[ANIM::CUSTOM[emptyCustomAnimSlot]];
  14.   emptyCustomAnim.load(0, "myCustom.j2a"); //adjust as needed for your particular circumstances
  15.   const uint firstCustomCharacterAnimID = emptyCustomAnim.firstAnim;
  16.  
  17.   const uint firstCharAnimID = jjAnimSets[ANIM::JAZZ].firstAnim;
  18.   for (uint i = 0; i < RABBIT::Anims.length; ++i)
  19.     jjAnimations[firstCharAnimID + RABBIT::Anims[i]] = jjAnimations[firstCustomCharacterAnimID + i];
  20.  
  21.   //If replacing Spaz or Lori instead, you'll need to do some extra work because of ANIM::SPAZ2 and ANIM::LORI2.
  22.   //Also don't forget the lives icon.
  23. }