The first thing to do is change the OBJS line in your ‘makefile.’ So that it includes objctl.o todanim.o and graphics.o. Your resulting 'mak'e file should look something like this.
________________________________________________________
CFLAGS = -Wall
LINKER = -Xlinker -Ttext -Xlinker 80140000
PROG = main
OBJS = main.o loadTims.o loadTexs.o pad.o objctl.o todanim.o graphics.o
all: $(PROG)
main :$(OBJS) $(CC) $(LINKER) $(OBJS) -o $@ strip $@
.c.o: $(CC) $(CFLAGS) -funsigned-char -c $<
________________________________________________________
Next move all the relevant files to the data directory of your program, this includes the TMD, TOD and TIM files. Enter the file names into you ‘memtool.dat’ file, and then run memtool. As memtool doesn’t support TOD files correctly I suggest you list these last.
Once memtool has run you need to write a line in your ‘addrs.h’ file to define the TOD files address. To do this simply copy the address from the ‘auto.’ file adding ‘0x’ to the beginning. The following shows an example of how to do this with the file named ‘anim.tod’.
Auto. | Addrs.h |
local dload data\ANIM.TOD 800A31D | #define ANIM_TOD 0x800A31D |
Next comes the fun part.
In your program you must declare the model to be of type LinkObjectModel. Then at the beginning of your main function you must call the initializing functions for the model and one for each TOD file that is associated with that model. You must then reset the TOD or the model will not be visible and your program may even crash..
Then each screen refresh you call the DrawLinkModel function to draw the model to the screen. To advance a frame of the animation simply call the NextFrame function. A skeleton example program. The functions and their parameters are explained immediately after this example:-
//includes #include "lipps.h" #include "graphics.h" ... //globals LinkObjectModel theModel; //Instance of linked object … // Function Main void main() { ... InitialiseLModelLink(&theModel,8,1,0,0,0,MODEL_TMD); InitTod(&theModel,0,NULL,ANIM_TOD); ResetTod(&theModel,0); ... For(;;) { RenderPrepare(); ... DrawModelLink(&theModel.objs); … RenderFinish(); NextFrame(&theModel,0); } ... }
![]() |
Creating an animation on 3D Studio Max. |