AniMotion Software Library -------------------------- What's in this file : --------------------- - - Intro 1 - Drawing a TIM 2 - Writing the AMT file going with your TIM 3 - Converting AMT file into AMB file 4 - Setting up your program 5 - Using the long offset option 6 - Some more options - - Intro --------- Well, here it is, I think this is the most important text file in this package, since it explains how to set un, initialize and use an AniMotion (AM). I'll try to be as clear as possible, but since I'm writing this file at high speed to match the release date (late july), there could be errors or missing info. If you're lost, please check the example (wich is working correctly) to see if you can't see by yourself what's wrong. It will avoid me a lot of "Your library don't even compile, you're stupid..." mails. By the way, this release is a beta, so it may remain bugs in it, even if I don't think so, since there's not so much code in it ;) . So, here's what you need to do to put great AniMotions into your game(s) : 1 - Draw a TIM !!! ------------------ Yes, that's true, the AniMotion library doesn't have a DrawCoolFighter() function, so you still need to draw sprites by yourself :( At this point I can't help you, you're by yourself. Usually, the limit size of your TIM depends on the clut mode : Since the sprite offsets (u & v) can't exeed 255 into the TPage, you're limited to 256*256 TIMs, so the sprite remains in the same TPage. This is also true with AniMotion, but you can use the Large Offset option to make the system change the TPage when needed, and then use offsets higher than 255. That mean you can fill up the entire video memory with one HUGE TIM, the system handle the situation. This is however a bit slower with the Large Offset option set on. 2 - Write the AMT file going with your TIM ------------------------------------------ This is a very important step : this is where you create the AniMotion pattern. Here's an example of file : <----------------> 03 03 is the number of moves within the AniMotion 01 01 05 This is the description on the first move : ID, MODE, number of frames 00 00 05 each line here is: X offset within TIM, Y offset, and duration of theframe (in frame count) 16 00 05 32 00 05 48 00 05 64 00 05 02 01 03 this is the move of ID 2, mode is AM_LOOP_STRAIGHT, 3 frames used 00 16 10 X offset : 0, Y offset : 16, stay for 10 frames 16 16 10 32 16 05 04 02 04 move of ID 4, mode is AL_LOOP_BACK, 4 frames used 48 32 05 64 32 12 80 32 10 96 32 05 <----------------> Keep in mind that by now there is right now absolutly no control on what you put in file : you can write down multiple moves of same ID, invalid modes, declare 4 frames an write down only 2... The program assume that you did the file correctly. The file is also syntax free, you can write it just like above, or in watever form you like, for example : 03 01 01 05 00 00 05 16 00 05 32 00 05 48 00 05 64 00 05 02 01 03 00 16 10 16 16 10 32 16 05 04 02 04 48 32 05 64 32 12 80 32 10 96 32 05 Just a bit harder to read ... Also remember : only put NUMBERS in your AMT file. 3 - Convert AMT file into AMB file ---------------------------------- To do this, use the ambuild tool provided in the package. If your file is anim.amt, just write (at dos shell) : ambuild anim The program will create anim.amb binary file. Note : if you plan to use the long offset option, use amlbuild instead of ambuild. 4 - Set up your program ----------------------- Here's what to do to initialise an AniMotion. Take note that this procedure will surely be simplified in future times, but that's a good starting point for this Beta. Initialize your AM : AMInit(&AM_NAME); Set the size of the frames : AMSetSize(&AM,X,Y); Load up you AMB file into your AM : AMLoadAMB(&AM,(u_long *)AMB_ADDR); load your TIM into video memory : ChargeTIM((u_long *)TIM_ADDR,&GSImage); Set up the texture : AMSetTexture(&AM,&GSImage); The GSImage must be the same that the one that was used by ChargeTIM specify the clut mode (still manual, sorry) Rick.TPageMode=TPage4Bit; Set up the location of the AM (default : 0,0) AMSetLocation(&AM,x,y); Actuvate the AutoCount option (if deactivated, the frames won't update) AMSetAutoCount(&Rick,TRUE); Choose your move (if wanted): AMSetMove(&AM,MOVE_ID); Note : on error, this function returns AM_NO_SUCH_MOVE -------- now, in your main loop, just put : AMDraw(&AM); when you need to change the move, call : AMSetMove(&AM,MOVE_ID); don't make anything else, the AM will update by itself. 5 - Using the long offset option -------------------------------- Just locate the following line into AniMotion.h : //#define TPageCalculate Just remove "//" from the line, and the long offset option is ON Put back "//" and it's back to OFF Remember to use the appropriate building file for building your AMBs. If you set the option ON, you need to use amlbuild.exe. Also think that you can't use sprites wich are on the offset 255 line : _____|_____ [ | ] [ | ] [_____|_____] | | : offset multiple of 256. [] :sprite this kind of sprite can't work. 6 - Some more options --------------------- You can change the AM_MAX_MOVES and AM_MAX_FRAMES values in the AniMotion.h file. Default values are 16. That mean you can put 16 moves of 16 Frames max. Keep in mind that by now, memory will be allocated for 16 moves, even if you only use 4.