00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <math.h>
00027 #include <windows.h>
00028
00029 #include "example1.h"
00030
00031 #if __ZTC__ || __SC__
00032 #ifndef max
00033 #define max(a,b) ( ((a) > (b)) ? (a) : (b) )
00034 #endif
00035 #endif
00036
00037 #if __X__MIPS__
00038 BOOL WINAPI _CRT_INIT(HINSTANCE ,DWORD , LPVOID );
00039 #endif
00040
00041 static HINSTANCE hDLLinstance=NULL;
00042
00043 #include "..\animate\astruct.h"
00044 #include "..\animate\dstruct.h"
00045
00046
00047 #if __WATCOMC__
00048 int APIENTRY LibMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00049 #else
00050 BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved){
00051 #endif
00052 switch (dwReason) {
00053 case DLL_PROCESS_ATTACH:
00054 #if __X__MIPS__
00055 if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00056 #endif
00057 hDLLinstance = hDLL;
00058 break;
00059 case DLL_PROCESS_DETACH:
00060 #if __X__MIPS__
00061 if(!_CRT_INIT(hDLL,dwReason,lpReserved))return(int)FALSE;
00062 #endif
00063 break;
00064 }
00065 return (int)TRUE;
00066 }
00067
00068 #if __SC__
00069 #pragma startaddress(LibMain)
00070 #endif
00071
00072
00073 BOOL _ExternalPreset(HWND parent, ANI_STRUCTURE *lpevi){
00074 object *Op;
00075 position *Pp;
00076 char f_name[255],f_dir[255];
00077 lpEVI=lpevi;
00078 MessageBox(parent,"Example1 External Script","Debug",MB_OK);
00079 SetNumberOfFrames(60);
00080
00081 if(CreatePosition(FirstNp,1,(short)Nframes) == NULL)return FALSE;
00082 FirstNp->fpos->finish[0]=TVpointX+TVsizeX*2;
00083 FirstNp->fpos->finish[1]=TVpointY+TVsizeY*2;
00084 FirstNp->fpos->finish[2]=TVpointZ+TVsizeZ*2;
00085
00086 if(CreateNode() == NULL)return FALSE;
00087 strcpy(MainNp->actorname,"Target");
00088 MainNp->type=TARGET;
00089 if((Op=CreateActor(MainNp,1,(short)Nframes)) == NULL)return FALSE;
00090 Op->type=MainNp->type;
00091
00092 if(CreateAlign(FirstNp,1,(short)Nframes) == NULL)return FALSE;
00093 FirstNp->fali->type=TRACK; FirstNp->fali->topath=MainNp;
00094
00095 if(CreateNode() == NULL)return FALSE;
00096 strcpy(MainNp->actorname,"Light");
00097 MainNp->type=LIGHT;
00098 if((Op=CreateActor(MainNp,1,Nframes)) == NULL)return FALSE;
00099 Op->type=MainNp->type;
00100 Op->lighttype=SPHERE; Op->colour[0]=Op->colour[1]=Op->colour[2]=255;
00101
00102 if((Pp=CreatePosition(MainNp,1,(short)Nframes)) == NULL)return FALSE;
00103 Pp->finish[0]=FirstNp->fpos->finish[0]+TVsizeX/2;
00104 Pp->finish[1]=FirstNp->fpos->finish[1]+TVsizeY;
00105 Pp->finish[2]=FirstNp->fpos->finish[2]+TVsizeZ*2;
00106
00107 if(CreateNode() == NULL)return FALSE;
00108 strcpy(MainNp->actorname,"Actor");
00109 MainNp->type=NORMAL;
00110 if((Op=CreateActor(MainNp,1,(short)Nframes)) == NULL)return FALSE;
00111 Op->type=MainNp->type;
00112 strcpy(f_dir,gszHomeDir); strcat(f_dir,"objects"); strcpy(f_name,"*.sce");
00113 if(SelectFileName(0,f_name,f_dir,"Choose Actor's Costume",
00114 "(*.SCE)|*.sce|",parent) == TRUE){
00115 strcpy(Op->name,f_name);
00116 Op->morph=NO;
00117 if(StageLoadObject(f_name,Op,YES,YES,NO) == FAIL)DeleteActor(MainNp,1);
00118 }
00119 else return FALSE;
00120
00121 return TRUE;
00122 }