Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
// **********************************************************************************
// * "inifile.h" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
void fn_v_IniFileInit(char * szFamilyName);
// **********************************************************************************

View File

@@ -0,0 +1,39 @@
// **********************************************************************************
// * "Tbl_Format.h" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef TBL_FORMAT_H
#define TBL_FORMAT_H
/////////////////////////////////////////////////////////// Key word use in TBL Files
// header
#define TBL_HEADER_SECTION "TBL_HEADER"
#define TBL_VERSION "VersionNumber"
#define TBL_MAXINDEX "MaximumIndex"
// physic objects
#define TBL_PHYSIC_SECTION "TBL"
#define TBL_PHYSIC "PHY"
#define TBL_ZOOM "CustomZoom"
// Event
#define TBL_EVENT_SECTION "EVT"
#define TBL_OBJECTTYPE "ObjectType"
#define TBL_SOUNDEVT "SoundEvent"
#define TBL_GENERICEVT "GenericEvent"
#define TBL_GENERATEEVT "GenerateEvent"
#define TBL_MECHANICEVT "MechanicEvent"
#define TBL_FIRSTCALL "FirstCall"
#define TBL_PERIOD "Period"
#define TBL_PRIORITY "Priority"
//////////////////////////////////////////////////////////////////////////// Constant
// TBL Version
#define C_TblVersion 1
#define C_TBL_MAXOBJECT 0x7FFF
#endif

View File

@@ -0,0 +1,29 @@
// **********************************************************************************
// * "a3i_intb.h" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef A3X_INTB_H
#define A3X_INTB_H
#ifndef A3I_INTB_C
// **********************************************************************************
// Interpolations computations
extern void fn_v_BinInterpolBetweenKeys( tdstBinFrame *_p_stKey1,
tdstBinFrame *_p_stKey2,
tdxMatrix33 _a3a3_xMtxOri,
tdxMatrix33 _a3a3_xMtxSca,
tdxVector3 _a3_xPosition,
register SEB_xReal _xT,
tdxVector3 _a3_xPivotPosition,
tdxQuater4 _a4_xQuatOri,
tdxQuater4 _a4_xQuatSca,
tdxVector3 _a3_xVecSca );
// **********************************************************************************
#endif
#endif

View File

@@ -0,0 +1,16 @@
// **********************************************************************************
// * "l_Sta_v6.h" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef L_STA_V6_H
#define L_STA_V6_H
// **********************************************************************************
// fonctions definitions
void fn_v_InitSTAV6i( void );
// **********************************************************************************
#endif

View File

@@ -0,0 +1,33 @@
// **********************************************************************************
// * "l_Tbl_v6.h" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef L_TBL_V6_H
#define L_TBL_V6_H
#define OBJECT_IN_TBL 0x01
#define OBJECT_IN_ANIM 0x02
// **********************************************************************************
typedef struct tdstTBL_
{
unsigned char ucTypeOfEvent;
unsigned char ucFlag;
unsigned short swNewObjectNumber;
unsigned char ucIsObject;
} tdstTBL;
extern tdstTBL ax_tdstTabTBL[];
extern unsigned long g_ulTblMaxIndex;
// **********************************************************************************
// fonctions definitions
void fn_v_InitTBLV6i( void );
void fn_vCompactTBL(char * szTblFile);
void fn_vGenerateNewObjectNumber(int bCompact);
// **********************************************************************************
#endif

View File

@@ -0,0 +1,21 @@
// **********************************************************************************
// * "l_a3d_v6.h" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef L_A3D_V6_H
#define L_A3D_V6_H
#ifndef L_A3D_V6_C
// **********************************************************************************
// Extern fonctions definitions
extern void fn_v_InitA3dV6i( void );
// **********************************************************************************
#endif
#endif

View File

@@ -0,0 +1,25 @@
// **********************************************************************************
// * "l_chl_v6.h" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef L_CHL_V6_H
#define L_CHL_V6_H
// **********************************************************************************
extern signed long slMaxInChannel; // Max in channel name le to set ChannelNumber value !!!
#ifndef L_CHL_V6_C
// **********************************************************************************
// Extern fonctions definitions
extern void fn_v_InitCHLV6i( void );
// **********************************************************************************
#endif
#endif

View File

@@ -0,0 +1,180 @@
// **********************************************************************************
// * "l_global_v6.h" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef L_GLOBAL_V6_H
#define L_GLOBAL_V6_H
#include "a3x_glob.h"
// **********************************************************************************
// Enumerates values
enum
{ eNoKey,
eSimpleKey,
eDoubleKey
};
enum
{ eStackBinStrings,
eStackBinVertexes,
eStackBinQuaternions,
eStackBinA3dGENERAL,
eStackBinChannels,
eStackBinFrames,
eStackBinOnlyFrames,
eStackBinHierarchies,
eStackBinChannelNames,
eStackSavedVertexes,
eStackSavedQuaternions,
eStackSavedNTTO,
eStackFileA3dAnimationGENERAL,
eStackFileVertexes,
eStackFileQuaternions,
eStackFileHierarchy,
eStackFileNTTO,
eStackFileOnlyFrame,
eStackFileKeyFrame,
eStackFileFrame,
eStackFileChannel,
eStackFileEvent,
eStackBinMorphInformation,
eStackBinSndEventIdList,
eStackBinEvent,
eStackBinNbMax
};
// **********************************************************************************
// Constant definitions
#define MaxInFileA3dAnimationGENERALTab 2000
#define MaxInFileVertexesTab 30000
#define MaxInFileQuaternionsTab 30000
#define MaxInFileHierarchyTab 1000
#define MaxInFileNTTOTab 10000
#define MaxInFileEventTab 2000
#define MaxInFileOnlyFrameTab 2000
#define MaxInFileChannelTab 1000
#define MaxInFileFrameTab 20000
#define MaxInFileKeyFrameTab 15000
#define MaxInSndEventIdTab 10000
#define MaxInEventTab 8000
#define MaxInFileEventTab 2000
#define MaxInFileMorphTab 20000
#define NombreDanimationsParDirectory 1000
// **********************************************************************************
// Macros definitions
#define D_BINSCR_LogOld 0
#define D_BINSCR_LogNew 1
#define M_GetStackAlloc( NumStack ) (tdstStacks[(NumStack)].slPosAlloc)
#define M_GetStackPos( NumStack ) (tdstStacks[(NumStack)].slStackPos)
#define ReadUChar( Num ) ( (unsigned char) atoi(_ap_SzParam[(Num)]) )
#define ReadSChar( Num ) ( (signed char) atoi(_ap_SzParam[(Num)]) )
#define ReadUShort( Num ) ( (unsigned short) atoi(_ap_SzParam[(Num)]) )
#define ReadSShort( Num ) ( (signed short) atoi(_ap_SzParam[(Num)]) )
#define ReadULong( Num ) ( (unsigned long) atol(_ap_SzParam[(Num)]) )
#define ReadSLong( Num ) ( (signed long) atol(_ap_SzParam[(Num)]) )
#define ReadFloat( Num ) ( (float) atof(_ap_SzParam[(Num)]) )
#define ReadDouble( Num ) ( (double) atof(_ap_SzParam[(Num)]) )
#define ReadSebReal( Num ) ( (SEB_xReal) atof(_ap_SzParam[(Num)]) )
// **********************************************************************************
// Types definitions
typedef struct tdstBinStackInfos_
{
signed long slPosAlloc;
signed long slStackPos;
signed long slAllocNeeded;
signed long slMaxPos;
} tdstBinStackInfos;
typedef struct tdstSndEventId_
{
char sName[200];
unsigned long ulVal1;
unsigned long ulVal2;
} tdstSndEventId;
// **********************************************************************************
// Extern datas definitions
extern tdstBinStackInfos tdstStacks [];
extern tdFileName ax_xStrings [];
extern tdxVector3 axa3_xVertexes [];
extern tdxQuater4 axa4_xBinQuaternions [];
extern tdstBinA3dAnimationGENERAL ax_tdstA3dGENERAL [];
extern tdstBinChannel ax_tdstChannels [];
extern tdstBinFrame ax_tdstFrames [];
extern tdstBinOnlyFrame ax_tdstOnlyFrames [];
extern tdstBinHierarchy ax_tdstHierarchies [];
extern tdFileName ax_xChannelNames [];
extern tdstSndEventId ax_tdstSndEventId [];
extern tdstBinEvent ax_tdstEvents [];
extern tdstBinMorphData ax_tdstBinMorphInfos [];
extern tdxVector3 ax_tdxSavedVertexes [];
extern tdxQuater4 ax_tdxSavedQuaternions [];
extern tdstNTTO ax_tdstSavedNTTO [];
extern tdstFileA3dAnimationGENERAL ax_tdstFileA3dGENERAL [];
extern tdxULongVector3 ax_tdxFileVertexes [];
extern tdxSShortQuater4 ax_tdxFileQuaternions [];
extern tdstFileHierarchy ax_tdstFileHierarchy [];
extern tdstNTTO ax_tdstFileNTTO [];
extern tdstFileOnlyFrame ax_tdstFileOnlyFrame [];
extern tdstFileKeyFrame ax_tdstFileKeyFrame [];
extern tdstFileFrame ax_tdstFileFrame [];
extern tdstFileChannel ax_tdstFileChannel [];
extern tdstFileEvent ax_tdstFileEvent [];
extern tdstFileMorphData ax_tdstFileMorphInfos []; //AR980305
extern unsigned short uwOkAnimationFile; // Flag
extern tdxVector3 a3_xVector0;
extern tdxVector3 a3_xVector1;
extern tdxQuater4 a4_xQuater0;
extern FILE *ErrorFile, *WarningFile, *SizeOut, *EventFile;
#ifndef L_GLOBAL_V6_C
// **********************************************************************************
// Extern fonctions definitions
extern void fn_v_AllocateOnStack( unsigned short uwNumStack,
signed long slWantedSize );
extern void fn_v_DeAllocateOnStack( unsigned short uwNumStack,
signed long slSize );
extern void fn_v_ResetStacks( void );
extern void fn_vCheckStacks( void );
extern void fn_v_LogSectionBegin( int _bFlagNew,
char *_szType,
char *_szString );
extern void fn_v_LogSectionEnd( void );
extern void fn_v_InitMemV6i( void );
extern void fn_v_KillMem( void );
// **********************************************************************************
#endif
#endif

View File

@@ -0,0 +1,29 @@
// **********************************************************************************
// * "l_optim_v6.h" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef L_OPTIM_V6_H
#define L_OPTIM_V6_H
#ifndef L_OPTIM_V6_C
// **********************************************************************************
// Extern fonctions definitions
extern void TagadaPouetPouet ( unsigned short uwNbAnims );
extern void fn_v_VerifyAnimationV6i ( unsigned short uwNbAnims );
extern void fn_v_OptimiseAnimationV6i ( unsigned short uwNbAnims );
extern void fn_v_OptimiseAnimation2V6i ( unsigned short uwNbAnims );
extern void fn_v_SaveAnimationV6i ( unsigned short uwNbFirstAnim,unsigned short uwNbAnims,char * p_szSaveDir);
extern void fn_v_StartA3dV6i ( void );
extern void fn_v_EndA3dV6i ( void );
extern unsigned short fn_uw_GetDirV6i ( char * LongActorName,unsigned char bTreatAll);
extern void fn_v_InitSaveAnimationV6i ( void );
extern void fn_v_EndSaveAnimationV6i ( void );
// **********************************************************************************
#endif
#endif

View File

@@ -0,0 +1,55 @@
// **********************************************************************************
// * "scr2bin.h" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#ifndef MAKEANIM_H
#define MAKEANIM_H
#include <conio.h>
#include "l_global_v6.h"
// ********************************************************************************** Constant
#define MAKEANIM_OPTIONS_FILE "MakeAnim.ini"
#define WaitKeyStroke() if (!bBatch) getch()
// ********************************************************************************** struct tdstAnimInfo
// ANIM INFO Struct
typedef struct tdstAnimInfo_ {
tdFileName szShortFileName;
SEB_xReal xPrecision;
int iValid;
} tdstAnimInfo;
// Macro Access
#define szAnimName(tab) (tab)->szShortFileName
#define xPrecision(tab) (tab)->xPrecision
#define bValid(tab) (tab)->iValid
// ********************************************************************************** Varaibles gloables
extern char szFamilyName[];
extern unsigned short uwAnalysedAnim;
// Table of anim info
extern tdstAnimInfo stAnims[NombreDanimationsParDirectory];
extern unsigned short g_uwTotalNumOfAnim;
extern char LongFileName[];
extern char AnimationName[];
// default epsilon precision
extern SEB_xReal xDefaultEps;
// compress TBL fla
extern int bCompactTbl;
// in batch mode no wait for key stroke
extern unsigned char bBatch;
// **********************************************************************************
#endif

View File

@@ -0,0 +1,178 @@
# Microsoft Developer Studio Project File - Name="makeanim" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=makeanim - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "makeanim.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "makeanim.mak" CFG="makeanim - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "makeanim - Win32 Release" (based on\
"Win32 (x86) Console Application")
!MESSAGE "makeanim - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""$/cpa/Appli/CvrtA3DtoA3i/Make", ZTOAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "makeanim - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "x:\cpa\appli\cvrta3dtoa3i\inc" /I "X:/CPA/Public" /I "x:/cpa/public/gam/playanim/interpol" /I "x:\cpa\public\gam" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "D_BINSCR_Packing" /D "_LANGUAGE_C" /D "D_BINSCR_GenerateRcpList" /D "_AFXDLL" /D "NOT_A_PRESS_DEMO" /FR /YX /FD /c
# ADD BASE RSC /l 0x40c /d "NDEBUG"
# ADD RSC /l 0x40c /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 SCRP5_vr.lib ERMP5_vr.lib MMGP5_vr.lib /nologo /subsystem:console /machine:I386 /libpath:"Lib" /libpath:"x:/cpa/lib"
!ELSEIF "$(CFG)" == "makeanim - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 2
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "x:\cpa\appli\cvrta3dtoa3i\inc" /I "X:/CPA/Public" /I "x:/cpa/public/gam/playanim/interpol" /I "x:\cpa\public\gam" /D "_DEBUG" /D "A3X_BINARISATION" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "D_BINSCR_Packing" /D "_LANGUAGE_C" /D "D_BINSCR_GenerateRcpList" /D "_AFXDLL" /D "NOT_A_PRESS_DEMO" /FR /YX /FD /c
# ADD BASE RSC /l 0x40c /d "_DEBUG"
# ADD RSC /l 0x40c /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 SCRP5_vd.lib MMGP5_vd.lib ERMP5_vd.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCD" /out:"X:\Cpa\Exe\Main\makeanim.exe" /pdbtype:sept /libpath:"x:\cpa\lib"
!ENDIF
# Begin Target
# Name "makeanim - Win32 Release"
# Name "makeanim - Win32 Debug"
# Begin Group "src"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\Src\a3x_int.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\a3x_intb.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\IniFile.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\l_a3d_v6.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\l_chl_v6.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\l_global_v6.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\l_optim_v6.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\l_sta_v6.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\l_Tbl_v6.cpp
# End Source File
# Begin Source File
SOURCE=..\Src\makeanim.cpp
# End Source File
# End Group
# Begin Group "inc"
# PROP Default_Filter "*.h"
# Begin Source File
SOURCE=..\Inc\a3x_intb.h
# End Source File
# Begin Source File
SOURCE=..\Inc\IniFile.h
# End Source File
# Begin Source File
SOURCE=..\Inc\l_a3d_v6.h
# End Source File
# Begin Source File
SOURCE=..\Inc\l_chl_v6.h
# End Source File
# Begin Source File
SOURCE=..\Inc\l_global_v6.h
# End Source File
# Begin Source File
SOURCE=..\Inc\l_optim_v6.h
# End Source File
# Begin Source File
SOURCE=..\Inc\l_Sta_v6.h
# End Source File
# Begin Source File
SOURCE=..\Inc\l_Tbl_v6.h
# End Source File
# Begin Source File
SOURCE=..\Inc\makeanim.h
# End Source File
# Begin Source File
SOURCE=..\Inc\Tbl_Format.h
# End Source File
# End Group
# Begin Source File
SOURCE=.\makeanim.mak
# End Source File
# End Target
# End Project

View File

@@ -0,0 +1,38 @@
--------------------Configuration: makeanim - Win32 Debug--------------------
Begining build with project "X:\cpa\Appli\CvrtA3DtoA3i\Make\makeanim.dsp", at root.
Active configuration is Win32 (x86) Console Application (based on Win32 (x86) Console Application)
Project's tools are:
"32-bit C/C++ Compiler for 80x86" with flags "/nologo /MDd /W3 /Gm /GX /Zi /Od /I "x:\cpa\appli\cvrta3dtoa3i\inc" /I "X:/CPA/Public" /I "x:/cpa/public/gam/playanim/interpol" /I "x:\cpa\public\gam" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "D_BINSCR_Packing" /D "_LANGUAGE_C" /D "D_BINSCR_GenerateRcpList" /D "_AFXDLL" /D "A3X_BINARISATION" /FR"Debug/" /Fp"Debug/makeanim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c "
"Win32 Resource Compiler" with flags "/l 0x40c /d "_DEBUG" /d "_AFXDLL" "
"Browser Database Maker" with flags "/nologo /o"Debug/makeanim.bsc" "
"COFF Linker for 80x86" with flags "SCRP5_vd.lib MMGP5_vd.lib ERMP5_vd.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/makeanim.pdb" /debug /machine:I386 /out:"X:\Cpa\Exe\Main\makeanim.exe" /pdbtype:sept /libpath:"x:\cpa\lib" "
"Custom Build" with flags ""
"<Component 0xa>" with flags ""
Creating temp file "F:\TEMP\RSP601.tmp" with contents </nologo /MDd /W3 /Gm /GX /Zi /Od /I "x:\cpa\appli\cvrta3dtoa3i\inc" /I "X:/CPA/Public" /I "x:/cpa/public/gam/playanim/interpol" /I "x:\cpa\public\gam" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "D_BINSCR_Packing" /D "_LANGUAGE_C" /D "D_BINSCR_GenerateRcpList" /D "_AFXDLL" /D "A3X_BINARISATION" /FR"Debug/" /Fp"Debug/makeanim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c
"X:\cpa\Appli\CvrtA3DtoA3i\Src\l_optim_v6.cpp"
>
Creating command line "cl.exe @F:\TEMP\RSP601.tmp"
Creating temp file "F:\TEMP\RSP602.tmp" with contents <SCRP5_vd.lib MMGP5_vd.lib ERMP5_vd.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/makeanim.pdb" /debug /machine:I386 /out:"X:\Cpa\Exe\Main\makeanim.exe" /pdbtype:sept /libpath:"x:\cpa\lib"
.\Debug\a3x_int.obj
.\Debug\a3x_intb.obj
.\Debug\l_a3d_v6.obj
.\Debug\l_chl_v6.obj
.\Debug\l_global_v6.obj
.\Debug\l_optim_v6.obj
.\Debug\l_Tbl_v6.obj
.\Debug\makeanim.obj>
Creating command line "link.exe @F:\TEMP\RSP602.tmp"
Compiling...
l_optim_v6.cpp
*** MTH : MTH_PC_DEV Defined
*** MTH : OPTIMIZED_FOR_PC_FLOATS Defined
*** MTH : OPTIMIZED_FOR_PC_FLOATS_WITH_ASM Defined
Linking...
Creating library X:\Cpa\Exe\Main\makeanim.lib and object X:\Cpa\Exe\Main\makeanim.exp
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
makeanim.exe - 0 error(s), 1 warning(s)

View File

@@ -0,0 +1,5 @@
SCC = This is a Source Code Control file
[makeanim.dsp]
SCC_Aux_Path = "\\srvprojets-ma\Rayman4_DS\Versions\Rayman4DS\Tools"
SCC_Project_Name = "$/CPA/Appli/CvrtA3DtoA3i/Make", NHAAAAAA

View File

@@ -0,0 +1,109 @@
// **********************************************************************************
// * "inifile.c" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
// **********************************************************************************
// Included files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SCR.h"
#include "a3x_glob.h"
#include "makeanim.h"
#include "l_global_v6.h"
// **********************************************************************************
// SCRIPT FORMAT
// **********************************************************************************
#define KEY_UNCOMPRESS "Uncompactable"
#define KEY_PRECISION "Precision"
#define KEY_DEFAULT_EPS "DefaultPrecision"
// ********************************************************************************** fn_eFamilyCallBack
// FAMILY CALLBACK
// **********************************************************************************
SCR_tde_Anl_ReturnValue fn_eFamilyCallBack( SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction ) {
if (_eAction == SCR_EA_Anl_BeginSection) {
// Nothing to do
}
else if (_eAction == SCR_EA_Anl_Entry) {
// force uncompress for that family
if (!stricmp(_p_szName,KEY_UNCOMPRESS) ) {
bCompactTbl = FALSE;
}
// set default precision for all anim
else if (!stricmp(_p_szName,KEY_DEFAULT_EPS) ) {
int i;
SEB_xReal xPrecision;
// check and set epsilon
xPrecision = ReadDouble(0);
if ((xPrecision > 0) && (xPrecision < 0.1)) {
xDefaultEps = xPrecision;
for (i=0;i<g_uwTotalNumOfAnim;i++)
xPrecision(&stAnims[i]) = xDefaultEps;
}
else {
fprintf(ErrorFile,"Bad Default epsilon specify in %s file %f\n",MAKEANIM_OPTIONS_FILE,xPrecision,_ap_SzParam[0]);
}
}
// set specific precision for each anim
else if (!stricmp(_p_szName,KEY_PRECISION) ) {
int i;
tdstAnimInfo * p_stCurrAnim=stAnims;
// search the anim
for (i=0;i<g_uwTotalNumOfAnim;i++,p_stCurrAnim++) {
// find the good anim
if (!stricmp(szAnimName(p_stCurrAnim),_ap_SzParam[0])) {
SEB_xReal xPrecision;
// check and set epsilon
xPrecision = ReadDouble(1);
if ((xPrecision > 0) && (xPrecision < 0.1))
xPrecision(p_stCurrAnim) = xPrecision;
else {
fprintf(ErrorFile,"Bad epsilon specify in %s file %f for anim %s\n",MAKEANIM_OPTIONS_FILE,xPrecision,_ap_SzParam[0]);
}
break;
}
}
}
else {
fprintf( ErrorFile, "Unknown field in %s File (%s)\n",MAKEANIM_OPTIONS_FILE,_p_szName);
}
}
else if (_eAction == SCR_EA_Anl_EndSection) {
// Nothing to do
}
return SCR_ERV_Anl_NormalReturn;
}
// ********************************************************************************** fn_v_IniFileInit
//
// **********************************************************************************
void fn_v_IniFileInit(char * szFamilyName) {
// Register CallBack for the family to load
SCR_fn_v_RdL0_RegisterCallback(szFamilyName,fn_eFamilyCallBack,SCR_CRC_c_RdL0_ForSection);
}
// **********************************************************************************

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,165 @@
// **********************************************************************************
// * "a3i_intb.c" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#define A3I_INTB_C
// **********************************************************************************
// Included files
#include <stdio.h>
#include <math.h>
#include "specif\\a3x_pref.h"
#include "a3x_glob.h"
#include "a3x_int.h"
#include "a3x_intb.h"
// temp
extern SEB_xReal xEps;
extern SEB_xReal xOneSubEps;
// **********************************************************************************
// Interpolations computations
// Interpolation of the whole matrixial definition of an object
// By : S<>bastien Rubens (thursday 97/10/16)
// Input :
// _stKey1 = first key
// _stKey2 = second key
// _a3a3_xMtxOri <- interpolated orientation matrix
// _a3a3_xMtxSca <- interpolated scale matrix
// _a3a3_xVecTra <- interpolated translation vector
// _xT = interpolation parameter
// Output :
// void
// Modif 28/08/98 : Treat Interpolation - type 1 (Non Linear)
void fn_v_BinInterpolBetweenKeys( tdstBinFrame *_p_stKey1,
tdstBinFrame *_p_stKey2,
tdxMatrix33 _a3a3_xMtxOri,
tdxMatrix33 _a3a3_xMtxSca,
tdxVector3 _a3_xPosition,
register SEB_xReal _xT,
tdxVector3 _a3_xPivotPosition,
tdxQuater4 _a4_xQuatOri,
tdxQuater4 _a4_xQuatSca,
tdxVector3 _a3_xVecSca )
{ static tdxQuater4 a4_xQuatI;
static tdxVector3 a3_xTmpVec;
register SEB_xReal xSinOmega;
register SEB_xReal xCoef1, xCoef2;
register SEB_xReal xOmega, xCosOmega, xTbyOmega;
// -- Non linear T parameter -------
if ( (fabs(_p_stKey1->xInterpolationParameter) > xEps) && (_xT != xZero) )
{ register SEB_xReal xTmp;
xTmp= _p_stKey1->xInterpolationParameter * ((SEB_xReal) (1.0f / 8192.0f));
_xT= _xT * (_xT * xTmp + xOne - xTmp);
}
// -- Interpolation of scale -------
// Interpolation of scale direction
fn_v_InterpolQuat( _a4_xQuatSca, _p_stKey1->a4_xQuatSca, _p_stKey2->a4_xQuatSca, _xT );
//fn_v_InterpolQuatWithOmega( a4_xQuatI, _p_stKey1->a4_xQuatSca, _p_stKey2->a4_xQuatSca,
// _xT, _p_stKey1->uwOmegaSca );
fn_v_QuatToMatrix( _a3a3_xMtxOri, _a4_xQuatSca);
// Linear interpolation of scale values
fn_v_InterpolVect( _a3_xVecSca, _p_stKey1->a3_xScaleValues, _p_stKey2->a3_xScaleValues, _xT );
// Create final scale matrix
// Final matrix= [scale dir. matrix]^-1*[values scale matrix]*[scale dir. matrix]
fn_v_InvRotDiaRot( _a3a3_xMtxSca, _a3a3_xMtxOri, _a3_xVecSca );
//printf("%3.8f %3.8f %3.8f %3.8f\n", a4_xQuatI[0], a4_xQuatI[1], a4_xQuatI[2], a4_xQuatI[3] );
// -- Interpolation of orientation -------
fn_v_InterpolQuat( _a4_xQuatOri, _p_stKey1->a4_xQuatOri, _p_stKey2->a4_xQuatOri, _xT );
//fn_v_InterpolQuatWithOmega( a4_xQuatI, _p_stKey1->a4_xQuatOri, _p_stKey2->a4_xQuatOri,
// _xT, _p_stKey1->uwOmegaOri );
fn_v_QuatToMatrix( _a3a3_xMtxOri, _a4_xQuatOri );
// -- Les deux matrices multipli<6C>es -------
// Multiplie dans l'espace des quaternions (16 mul), et transformation en matrice (9 mul)
// puis multiplie par matrice diagonale (9 mul)
// -- Interpolation of position -------
if ( (_p_stKey1->uwTypeOfObject & SEB_xTypeHierarchized) == 0 )
{
// Interpolation with the pivot
// Rotate pivot (local to object)
fn_v_MatrixByVector( _a3_xPosition, _a3a3_xMtxSca, _a3_xPivotPosition );
fn_v_MatrixByVector( a3_xTmpVec, _a3a3_xMtxOri, _a3_xPosition );
// Pivot (linear) interpolation in world axes
fn_v_InterpolVect( _a3_xPosition, _p_stKey1->a3_xWorldPivotPosition,
_p_stKey2->a3_xWorldPivotPosition, _xT );
// Computes the interpolated position
_a3_xPosition[0]-= a3_xTmpVec[0];
_a3_xPosition[1]-= a3_xTmpVec[1];
_a3_xPosition[2]-= a3_xTmpVec[2];
}
else
{
// Interpolation with Hierarchy
if ( (_p_stKey1->xDistMaster > xEps) || (_p_stKey2->xDistMaster > xEps) )
{
// Computes values for "Geodesic" interpolation
if ( (_p_stKey1->xDistMaster > xEps) && (_p_stKey2->xDistMaster > xEps) )
{
xCosOmega= (_p_stKey1->a3_xPosition[0] * _p_stKey2->a3_xPosition[0] +
_p_stKey1->a3_xPosition[1] * _p_stKey2->a3_xPosition[1] +
_p_stKey1->a3_xPosition[2] * _p_stKey2->a3_xPosition[2]) /
(_p_stKey1->xDistMaster * _p_stKey2->xDistMaster);
xOmega= (SEB_xReal) acos( xCosOmega );
if ( xOneSubEps > xCosOmega )
{ xSinOmega= xOne / (SEB_xReal) sin( xOmega );
xTbyOmega= (_xT * xOmega); // Toujours < _lOmega et toujours positif
xCoef1= (SEB_xReal) sin( xOmega - xTbyOmega ) * xSinOmega;
xCoef2= (SEB_xReal) sin( xTbyOmega ) * xSinOmega;
}
else
{ xCoef1= xOne - _xT;
xCoef2= _xT;
}
// Linear interpolation of vector length
xSinOmega= ( _p_stKey2->xDistMaster - _p_stKey1->xDistMaster ) * _xT
+ _p_stKey1->xDistMaster;
xCoef1*= xSinOmega / _p_stKey1->xDistMaster;
xCoef2*= xSinOmega / _p_stKey2->xDistMaster;
// Computes the interpolated position
_a3_xPosition[0]= xCoef1 * _p_stKey1->a3_xPosition[0] + xCoef2 * _p_stKey2->a3_xPosition[0];
_a3_xPosition[1]= xCoef1 * _p_stKey1->a3_xPosition[1] + xCoef2 * _p_stKey2->a3_xPosition[1];
_a3_xPosition[2]= xCoef1 * _p_stKey1->a3_xPosition[2] + xCoef2 * _p_stKey2->a3_xPosition[2];
}
else
{ fn_v_InterpolVect( _a3_xPosition, _p_stKey1->a3_xPosition, _p_stKey2->a3_xPosition, _xT );
}
}
else
{
_a3_xPosition[0]= xZero;
_a3_xPosition[1]= xZero;
_a3_xPosition[2]= xZero;
}
}
}
// **********************************************************************************
#undef A3I_INTB_C

View File

@@ -0,0 +1,429 @@
// **********************************************************************************
// * "l_Tbl_v6.c" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
///////////////////////////////////////////////////////////////////////////// Include
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "SCR.h"
#include "Tbl_format.h"
#include "l_Tbl_v6.h"
#include "l_global_v6.h"
#include "makeanim.h"
#include "structur\\anim_s.h"
//////////////////////////////////////////////////////////////////////////// Constant
#define C_MaxInTBLTab 1000
////////////////////////////////////////////////////////////////////////// Structures
// copy of ACP strucure to make state (include is too complex)
typedef struct tdstObjectsTableElement_
{
void * p_stCustomZoom; // AR971014 Changed for alignment
// to create an Array of POs ...
void * h_Target;
unsigned long uwChannelNumber; // AR971107 Warning ! Bad prefix !!!
unsigned short wTypeOfTarget; // AR971014 Changed for alignment
unsigned char ucPhoneme;
unsigned char ucIntensity;
unsigned char ucExpression;
} tdstObjectsTableElement;
/////////////////////////////////////////////////////////////////// Intern Global Var
unsigned long g_ulTblMaxIndex = 0;
static unsigned long g_ulObjectNumber = 0;
static unsigned short g_uwNewTblMaxIndex = 0;
/////////////////////////////////////////////////////////////////// Extern Global Var
tdstTBL ax_tdstTabTBL[C_MaxInTBLTab];
// ******************************************************************** fn_eTblHEADER
// Call back for HEADER Section
// Check File version & get max index of TBL
// 23/06/98 Carlos Torres
// **********************************************************************************
static SCR_tde_Anl_ReturnValue fn_eTblHEADER( SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction )
{
// Section already analysed
if (_eAction == SCR_EA_Anl_AlreadyAnalysed) {
fprintf( ErrorFile, "%s : (Tbl) %s already analysed\n",TBL_HEADER_SECTION,szFamilyName);
}
// Beginning of section
if (_eAction == SCR_EA_Anl_BeginSection) {
// Nothing to do
}
// We are in the section
else if (_eAction == SCR_EA_Anl_Entry) {
// Version Number
if (!strcmp(_p_szName, TBL_VERSION) ) {
if (atoi(_ap_SzParam[0]) != C_TblVersion) {
fprintf( ErrorFile, "%s : (Tbl) A3dHEADER.%s is not equal to %d (%s)\n",szFamilyName,C_TblVersion,_ap_SzParam[0]);
}
}
// Maximum Index
else if (!strcmp(_p_szName,TBL_MAXINDEX)) {
g_ulTblMaxIndex = atoi(_ap_SzParam[0]);
if (g_ulTblMaxIndex > C_TBL_MAXOBJECT) {
fprintf( ErrorFile, "%s : (Obj) Wrong parameter in A3d file, A3dHEADER.VersionNumber is not equal 6 (%s)\n", szFamilyName, _ap_SzParam[0] );
printf( "%s : (Tbl) Wrong parameter in A3d file, A3dHEADER.VersionNumber is not equal 6 (%s)\n", szFamilyName, _ap_SzParam[0] );
WaitKeyStroke();
}
}
// Unknown field
else {
fprintf( ErrorFile, "%s : (Tbl) Unknown field in A3d file, %s.%s\n",
szFamilyName,TBL_HEADER_SECTION,_p_szName);
}
}
// End of section
else if (_eAction == SCR_EA_Anl_EndSection) {
// Nothing to do
}
return SCR_ERV_Anl_NormalReturn;
}
// ************************************************************* fn_eTblPhysicSection
// Call back for TBL Section
// mark all object used & Real Object
// 23/06/98 Carlos Torres
// **********************************************************************************
static SCR_tde_Anl_ReturnValue fn_eTblPhysicSection(SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction )
{
// Section already analysed
if (_eAction == SCR_EA_Anl_AlreadyAnalysed) {
fprintf( ErrorFile, "%s : (Tbl) %s already analysed\n",TBL_PHYSIC_SECTION,szFamilyName);
}
// Beginning of section - get object index
if (_eAction == SCR_EA_Anl_BeginSection) {
g_ulObjectNumber = atoi(_p_szName) - 1;
if (g_ulObjectNumber >= g_ulTblMaxIndex) {
fprintf(ErrorFile, "%s : (Tbl) Wrong parameter in A3d file %s ObjectNumber(%d) >= %s(%d)\n",
szFamilyName,TBL_PHYSIC_SECTION,g_ulObjectNumber,TBL_MAXINDEX,g_ulTblMaxIndex);
printf("%s : (Tbl) Wrong parameter in A3d file %s ObjectNumber(%d) >= %s(%d)\n",
szFamilyName,TBL_PHYSIC_SECTION,g_ulObjectNumber,TBL_MAXINDEX,g_ulTblMaxIndex);
WaitKeyStroke();
}
else {
ax_tdstTabTBL[g_ulObjectNumber].ucFlag |= OBJECT_IN_TBL;
ax_tdstTabTBL[g_ulObjectNumber].ucIsObject= TRUE;
}
}
// We are in the section
else if (_eAction == SCR_EA_Anl_Entry) {
// Physic object
if (!strcmp(_p_szName,TBL_PHYSIC)) {
// nothing to do
}
// Custom Zoom
else if (!strcmp(_p_szName,TBL_ZOOM)) {
// nothing to do
}
// Unknown field
else {
fprintf( ErrorFile, "%s : (Tbl) Unknown field in A3d file, %s.%s\n",
szFamilyName,TBL_PHYSIC_SECTION,_p_szName);
}
}
// End of section
else if (_eAction == SCR_EA_Anl_EndSection) {
// nothing to do
}
return SCR_ERV_Anl_NormalReturn;
}
// ************************************************************** fn_eTblEventSection
// Call back for EVENT Section
// mark all object used & NOT Real Object
// 23/06/98 Carlos Torres
// **********************************************************************************
static SCR_tde_Anl_ReturnValue fn_eTblEventSection(SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction )
{
// Section already analysed
if (_eAction == SCR_EA_Anl_AlreadyAnalysed) {
fprintf( ErrorFile, "%s : (Tbl) %s already analysed\n",TBL_EVENT_SECTION,szFamilyName);
}
// Beginning of section - get object index
if (_eAction == SCR_EA_Anl_BeginSection) {
g_ulObjectNumber = atoi(_p_szName) - 1;
if (g_ulObjectNumber >= g_ulTblMaxIndex) {
fprintf(ErrorFile, "%s : (Tbl) Wrong parameter in A3d file %s ObjectNumber(%d) >= %s(%d)\n",
szFamilyName,TBL_EVENT_SECTION,g_ulObjectNumber,TBL_MAXINDEX,g_ulTblMaxIndex);
printf("%s : (Tbl) Wrong parameter in A3d file %s ObjectNumber(%d) >= %s(%d)\n",
szFamilyName,TBL_EVENT_SECTION,g_ulObjectNumber,TBL_MAXINDEX,g_ulTblMaxIndex);
WaitKeyStroke();
}
else {
ax_tdstTabTBL[g_ulObjectNumber].ucFlag |= OBJECT_IN_TBL;
ax_tdstTabTBL[g_ulObjectNumber].ucIsObject= FALSE;
}
}
// We are in the section
else if (_eAction == SCR_EA_Anl_Entry) {
// Object Type
if (!strcmp(_p_szName,TBL_OBJECTTYPE)) {
// nothing to do
}
// Sound Event
else if (!strcmp(_p_szName,TBL_SOUNDEVT)) {
ax_tdstTabTBL[g_ulObjectNumber].ucTypeOfEvent = C_ucSOUND_EVENT;
}
// Generic Event
else if (!strcmp(_p_szName,TBL_GENERICEVT)) {
ax_tdstTabTBL[g_ulObjectNumber].ucTypeOfEvent = C_ucGENERIC_EVENT;
}
// Generate Event
else if (!strcmp(_p_szName,TBL_GENERATEEVT)) {
ax_tdstTabTBL[g_ulObjectNumber].ucTypeOfEvent = C_ucGENERATE_EVENT;
}
// Mechanic Event
else if (!strcmp(_p_szName,TBL_MECHANICEVT)) {
ax_tdstTabTBL[g_ulObjectNumber].ucTypeOfEvent = C_ucMECHANIC_EVENT;
}
// First Call
else if (!strcmp(_p_szName,TBL_FIRSTCALL)) {
// nothing to do
}
// Period
else if (!strcmp(_p_szName,TBL_PERIOD)) {
// nothing to do
}
// Priority
else if (!strcmp(_p_szName,TBL_PRIORITY)) {
// nothing to do
}
// Unknown field
else {
fprintf( ErrorFile, "%s : (Tbl) Unknown field in A3d file, %s.%s\n",
szFamilyName,TBL_EVENT_SECTION,_p_szName);
}
}
// End of section
else if (_eAction == SCR_EA_Anl_EndSection) {
// nothing to do
}
return SCR_ERV_Anl_NormalReturn;
}
// ****************************************************************** fn_v_InitTBLV6i
// init global table and register callback
// **********************************************************************************
void fn_v_InitTBLV6i( void ) {
unsigned short uwNumOfEntry;
tdstTBL stTBLElementInitValue={C_ucNeverPlay,0,0,0};
// Reset Table
for (uwNumOfEntry=0 ; uwNumOfEntry<C_MaxInTBLTab ; uwNumOfEntry++) {
ax_tdstTabTBL[uwNumOfEntry] = stTBLElementInitValue;
}
// Register CallBack on HEADER Section
SCR_fn_v_RdL0_RegisterCallback( TBL_HEADER_SECTION,
fn_eTblHEADER,
SCR_CRC_c_RdL0_ForSection );
// Register CallBack on Physic Object Section
SCR_fn_v_RdL0_RegisterCallback( TBL_PHYSIC_SECTION,
fn_eTblPhysicSection,
SCR_CRC_c_RdL0_ForSection );
// Register CallBack on Event Section
SCR_fn_v_RdL0_RegisterCallback( TBL_EVENT_SECTION,
fn_eTblEventSection,
SCR_CRC_c_RdL0_ForSection );
}
// ********************************************************** fn_vChangeSectionHeader
// Call back used to change max index of tbl
//
// 14/09/98 Carlos Torres
// **********************************************************************************
void fn_vChangeSectionHeader(SCR_tdst_File_Description * p_tdstFile,char * p_szSectionName,void * p_vData,SCR_tde_Ntfy_Action eAction) {
// Rebuild the header Section
if (eAction == SCR_EA_Ntfy_RebuildSection) {
char szMess[32];
sprintf(szMess,"%s%s",TBL_HEADER_SECTION,SCR_CC_sz_Cfg_SectionIdMark);
SCR_M_SvL0_SaveBeginSection(p_tdstFile,szMess,SCR_CC_C_Cfg_EOL);
SCR_M_SvL0_SaveEntry(p_tdstFile,TBL_VERSION,SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile,SCR_EF_SvL0_Scanf,2,"%d",C_TblVersion);
SCR_M_SvL0_SaveEntry(p_tdstFile,TBL_MAXINDEX, SCR_CC_C_Cfg_NoChar);
SCR_fn_v_SvL0_SaveParameters_MP(p_tdstFile,SCR_EF_SvL0_Scanf,2,"%d",p_vData);
SCR_M_SvL0_SaveEndSection(p_tdstFile,SCR_CC_C_Cfg_EOL);
}
}
// *********************************************************** fn_vChangeObjectNumber
// Call back used to change index of 1 objetc in the tbl
//
// 14/09/98 Carlos Torres
// **********************************************************************************
void fn_vChangeObjectNumber(SCR_tdst_File_Description * p_tdstFile,char * p_szSectionName,void * p_vData,SCR_tde_Ntfy_Action eAction) {
if (eAction == SCR_EA_Ntfy_ModifySection) {
char szMess[32];
tdstTBL * p_stCurrObject = (tdstTBL *)p_vData;
if (p_stCurrObject->ucIsObject)
sprintf(szMess,"%s%s%d",TBL_PHYSIC_SECTION,SCR_CC_sz_Cfg_SectionIdMark,p_stCurrObject->swNewObjectNumber+1);
else
sprintf(szMess,"%s%s%d",TBL_EVENT_SECTION,SCR_CC_sz_Cfg_SectionIdMark,p_stCurrObject->swNewObjectNumber+1);
SCR_fn_v_SvL1_ToPrevLine(p_tdstFile);
SCR_M_SvL0_SaveBeginSection(p_tdstFile,szMess,SCR_CC_C_Cfg_EOL);
SCR_fn_v_SvL1_DeleteLine(p_tdstFile);
}
}
// ******************************************************************* fn_vCompactTBL
// Compact the Tbl File
// we reduce the max object index
// Deleting unsed Object and change index to use minimum index
// 14/09/98 Carlos Torres
// **********************************************************************************
void fn_vCompactTBL(char * szTblFile) {
unsigned long i;
tdstTBL * p_stCurrObject;
char szSectionName[256];
for (i=0,p_stCurrObject=ax_tdstTabTBL;i<g_ulTblMaxIndex;i++,p_stCurrObject++) {
if ((p_stCurrObject->ucFlag & OBJECT_IN_TBL) && (p_stCurrObject->ucFlag & OBJECT_IN_ANIM)) {
//p_stCurrObject->ucNewObjectNumber = g_ucNewTblMaxIndex;
if (i != p_stCurrObject->swNewObjectNumber) {
// modify number in table for a 3D object
if (p_stCurrObject->ucIsObject)
sprintf(szSectionName,"%s^%s%s%d",szTblFile,TBL_PHYSIC_SECTION,SCR_CC_sz_Cfg_SectionIdMark,i+1);
else
sprintf(szSectionName,"%s^%s%s%d",szTblFile,TBL_EVENT_SECTION,SCR_CC_sz_Cfg_SectionIdMark,i+1);
if (SCR_fn_c_RdL0_IsSectionExists(szSectionName)) {
SCR_fn_v_SvL1_RegisterNotify(szSectionName,fn_vChangeObjectNumber,(void *)p_stCurrObject,SCR_EA_Ntfy_ModifySection);
SCR_fn_v_SvL1_UpdateAllNotify();
}
}
// check for overflow
/*if (g_ucNewTblMaxIndex == 0xEF) {
fprintf( ErrorFile, "%s : TBC Overflow, there is more than 256 object used in %s - Compression Fail\n",szFamilyName,szTblFile);
return;
}
else
g_ucNewTblMaxIndex++;*/
}
else {
// delete unused object from table
if (p_stCurrObject->ucIsObject)
sprintf(szSectionName,"%s^%s%s%d",szTblFile,TBL_PHYSIC_SECTION,SCR_CC_sz_Cfg_SectionIdMark,i+1);
else
sprintf(szSectionName,"%s^%s%s%d",szTblFile,TBL_EVENT_SECTION,SCR_CC_sz_Cfg_SectionIdMark,i+1);
if (SCR_fn_c_RdL0_IsSectionExists(szSectionName)) {
SCR_fn_v_SvL1_RegisterNotify(szSectionName,fn_vChangeObjectNumber,(void *)(g_uwNewTblMaxIndex+1),SCR_EA_Ntfy_DeleteSection);
SCR_fn_v_SvL1_UpdateAllNotify();
}
}
}
// modify the TBL max index
if (g_uwNewTblMaxIndex != g_ulTblMaxIndex) {
sprintf(szSectionName,"%s^%s",szTblFile,TBL_HEADER_SECTION);
if (SCR_fn_c_RdL0_IsSectionExists(szSectionName)) {
SCR_fn_v_SvL1_RegisterNotify(szSectionName,fn_vChangeSectionHeader,(void *)g_uwNewTblMaxIndex,SCR_EA_Ntfy_RebuildSection);
SCR_fn_v_SvL1_UpdateAllNotify();
}
}
}
// ****************************************************** fn_vGenerateNewObjectNumber
// Set new object number for each element of the TBL
// all unused element in anim are not numbered
// if bCompact is FALSE all elements keeps is number
// 14/09/98 Carlos Torres
// **********************************************************************************
void fn_vGenerateNewObjectNumber(int bCompact) {
unsigned long i;
tdstTBL * p_stCurrObject;
int iUnusedObject = 0;
for (i=0,p_stCurrObject=ax_tdstTabTBL;i<g_ulTblMaxIndex;i++,p_stCurrObject++) {
if (((p_stCurrObject->ucFlag & OBJECT_IN_TBL) && (p_stCurrObject->ucFlag & OBJECT_IN_ANIM)) || !bCompact) {
p_stCurrObject->swNewObjectNumber = g_uwNewTblMaxIndex;
// check for overflow
if (bCompact && (g_uwNewTblMaxIndex == 0xEF)) {
fprintf( ErrorFile, "%s : TBC Overflow, there is more than 256 object used in TBL - Compression Fail\n",szFamilyName);
return;
}
else
g_uwNewTblMaxIndex++;
}
else if (p_stCurrObject->ucFlag & OBJECT_IN_TBL)
iUnusedObject++;
}
// evaluate memory gain
/*{
FILE * MemoryGain;
char FileName[200];
// Open SizeOf File
sprintf(FileName,"TblMemoryGain.txt");
MemoryGain = fopen(FileName,"a+");
if (MemoryGain == NULL)
MemoryGain = stdout;
// Famille :NbTbl:NbTbc:TblSize:TbcSize:Gain:Unused in byte
fprintf(MemoryGain,"%s:%d:%d:%d:%d:%d:%d\n",szFamilyName,
g_ulTblMaxIndex,g_uwNewTblMaxIndex,
g_ulTblMaxIndex*sizeof(struct tdstObjectsTableElement_),g_uwNewTblMaxIndex*sizeof(struct tdstObjectsTableElement_),
g_ulTblMaxIndex*sizeof(struct tdstObjectsTableElement_)-g_uwNewTblMaxIndex*sizeof(struct tdstObjectsTableElement_),
iUnusedObject);
// Close SizeOf File
if (MemoryGain != stdout)
fclose(MemoryGain);
}*/
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,109 @@
// **********************************************************************************
// * "l_chl_v6.c" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#define L_CHL_V6_C
// **********************************************************************************
// Included files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SCR.h"
#include "specif\\a3x_pref.h"
#include "a3x_glob.h"
#include "makeanim.h"
#include "l_global_v6.h"
#include "l_chl_v6.h"
// **********************************************************************************
// Global Variables
static signed long slWaitedChannelNamesTableEntry;
static signed long slWaitedMax;
// Max in channel name le to set ChannelNumber value !!!
signed long slMaxInChannel;
// ******************************************************* fn_eChannelNameCallBackV6i
// CHANNEL NAMES CALLBACK
//
// Sebastien Rubens
// **********************************************************************************
SCR_tde_Anl_ReturnValue fn_eChannelNameCallBackV6i( SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction )
{
// Section already analysed
if (_eAction == SCR_EA_Anl_AlreadyAnalysed) {
fprintf( ErrorFile, "%s : A3dChannelNames already analysed\n", AnimationName );
}
// Beginning of section
if (_eAction == SCR_EA_Anl_BeginSection) {
#ifdef ShowInfos
fn_v_LogSectionBegin(D_BINSCR_LogNew,"A3dChannelNames",AnimationName);
#endif
slWaitedMax = ReadUShort(0);
slMaxInChannel = slWaitedMax;
fn_v_AllocateOnStack(eStackBinChannelNames,slWaitedMax);
slWaitedChannelNamesTableEntry = 0L;
}
// We are in the section
else if (_eAction == SCR_EA_Anl_Entry)
{
// AddChannelName
if ( !strcmp(_p_szName, "AddChannelName") ) {
strcpy( &ax_xChannelNames[M_GetStackAlloc(eStackBinChannelNames)+slWaitedChannelNamesTableEntry][0], _ap_SzParam[0] );
slWaitedChannelNamesTableEntry++;
}
// Unknown field
else {
fprintf( ErrorFile, "%s : Unknown field in A3d file, A3dChannelNames (%s)\n", AnimationName, _p_szName );
}
}
// End of section
else if (_eAction == SCR_EA_Anl_EndSection) {
if ( slWaitedChannelNamesTableEntry != slWaitedMax )
fprintf( ErrorFile, "Not enough entries in ChannelNamesTable", AnimationName );
#ifdef ShowInfos
fn_v_LogSectionEnd();
#endif
}
return SCR_ERV_Anl_NormalReturn;
}
// ****************************************************************** fn_v_InitCHLV6i
// Register Call back for the different sections
//
// Sebastien Rubens
// **********************************************************************************
void fn_v_InitCHLV6i( void ) {
// Channel Names Section
SCR_fn_v_RdL0_RegisterCallback("A3dChannelNames",fn_eChannelNameCallBackV6i,SCR_CRC_c_RdL0_ForSection );
}
// **********************************************************************************
#undef L_CHL_V6_C

View File

@@ -0,0 +1,247 @@
// **********************************************************************************
// * "l_global_v6.c" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#define L_GLOBAL_V6_C
// **********************************************************************************
//#define ShowInfos
//#define WaitGetChar
#define Details
// **********************************************************************************
// Included files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include "SCR.h"
#include "specif\\a3x_pref.h"
#include "a3x_glob.h"
#include "makeanim.h"
#include "l_global_v6.h"
// **********************************************************************************
// Globals datas
#define MaxInStringsTab 40000
#define MaxInVertexesTab 320000
#define MaxInQuaternionsTab 360000
#define MaxInA3dGENERALTab 2000
#define MaxInChannelsTab 12000
#define MaxInFramesTab 300000
#define MaxInFramesNTTOTab 400000
#define MaxInOnlyFramesTab 30000
#define MaxInHierarchiesTab 10000
#define MaxInChannelNamesTab 1000
#define MaxInSavedVertexesTab 200000
#define MaxInSavedQuaternionsTab 200000
#define MaxInSavedNTTOTab 40000
#define MaxInMorphTab 300000
//typedef char tdFileName[50];
tdstBinStackInfos tdstStacks[eStackBinNbMax]=
{ { 0, 0, 0, MaxInStringsTab }, // Strings
{ 0, 0, 0, MaxInVertexesTab }, // Vertexes
{ 0, 0, 0, MaxInQuaternionsTab }, // Quaternions
{ 0, 0, 0, MaxInA3dGENERALTab }, // A3dGENERAL
{ 0, 0, 0, MaxInChannelsTab }, // Channels
{ 0, 0, 0, MaxInFramesTab }, // Frames
{ 0, 0, 0, MaxInOnlyFramesTab }, // OnlyFrames
{ 0, 0, 0, MaxInHierarchiesTab }, // Hierarchies
{ 0, 0, 0, MaxInChannelNamesTab }, // ChannelNames
{ 0, 0, 0, MaxInSavedVertexesTab }, // SavedVertexes
{ 0, 0, 0, MaxInSavedQuaternionsTab}, // SavedQuaternions
{ 0, 0, 0, MaxInSavedNTTOTab }, // Saved FrameNumber and TypeOfObject
{ 0, 0, 0, MaxInFileA3dAnimationGENERALTab },
{ 0, 0, 0, MaxInFileVertexesTab },
{ 0, 0, 0, MaxInFileQuaternionsTab },
{ 0, 0, 0, MaxInFileHierarchyTab },
{ 0, 0, 0, MaxInFileNTTOTab },
{ 0, 0, 0, MaxInFileOnlyFrameTab },
{ 0, 0, 0, MaxInFileKeyFrameTab },
{ 0, 0, 0, MaxInFileFrameTab },
{ 0, 0, 0, MaxInFileChannelTab },
{ 0, 0, 0, MaxInFileEventTab },
{ 0, 0, 0, MaxInMorphTab },
{ 0, 0, 0, MaxInSndEventIdTab },
{ 0, 0, 0, MaxInEventTab }
};
tdFileName ax_xStrings [MaxInStringsTab];
tdxVector3 axa3_xVertexes [MaxInVertexesTab];
tdxQuater4 axa4_xBinQuaternions [MaxInQuaternionsTab];
tdstBinA3dAnimationGENERAL ax_tdstA3dGENERAL [MaxInA3dGENERALTab];
tdstBinChannel ax_tdstChannels [MaxInChannelsTab];
tdstBinFrame ax_tdstFrames [MaxInFramesTab];
unsigned long ax_ulFramesNTTO [MaxInFramesNTTOTab];
tdstBinOnlyFrame ax_tdstOnlyFrames [MaxInOnlyFramesTab];
tdstBinHierarchy ax_tdstHierarchies [MaxInHierarchiesTab];
tdFileName ax_xChannelNames [MaxInChannelNamesTab];
tdxVector3 ax_tdxSavedVertexes [MaxInSavedVertexesTab];
tdxQuater4 ax_tdxSavedQuaternions [MaxInSavedQuaternionsTab];
tdstNTTO ax_tdstSavedNTTO [MaxInSavedNTTOTab];
tdstFileA3dAnimationGENERAL ax_tdstFileA3dGENERAL [MaxInFileA3dAnimationGENERALTab];
tdxULongVector3 ax_tdxFileVertexes [MaxInFileVertexesTab];
tdxSShortQuater4 ax_tdxFileQuaternions [MaxInFileQuaternionsTab];
tdstFileHierarchy ax_tdstFileHierarchy [MaxInFileHierarchyTab];
tdstNTTO ax_tdstFileNTTO [MaxInFileNTTOTab];
tdstFileOnlyFrame ax_tdstFileOnlyFrame [MaxInFileOnlyFrameTab];
tdstFileKeyFrame ax_tdstFileKeyFrame [MaxInFileKeyFrameTab];
tdstFileFrame ax_tdstFileFrame [MaxInFileFrameTab];
unsigned short ax_uwFramesNTTO [];
tdstFileChannel ax_tdstFileChannel [MaxInFileChannelTab];
tdstFileEvent ax_tdstFileEvent [MaxInFileEventTab];
tdstFileMorphData ax_tdstFileMorphInfos [MaxInFileMorphTab];
tdstSndEventId ax_tdstSndEventId [MaxInSndEventIdTab];
tdstBinEvent ax_tdstEvents [MaxInEventTab];
tdstBinMorphData ax_tdstBinMorphInfos [MaxInMorphTab];
tdxVector3 a3_xVector0= { 0, 0, 0 };
tdxVector3 a3_xVector1= { 1, 1, 1 };
tdxQuater4 a4_xQuater0= { 0, 0, 0, 0 };
FILE *ErrorFile, *WarningFile, *SizeOut, *EventFile;
// **********************************************************************************
void fn_v_AllocateOnStack( unsigned short uwNumStack,
signed long slWantedSize )
{
tdstStacks[uwNumStack].slStackPos += slWantedSize;
tdstStacks[uwNumStack].slAllocNeeded += slWantedSize;
if (tdstStacks[uwNumStack].slStackPos > tdstStacks[uwNumStack].slMaxPos)
{ fprintf( ErrorFile, "%s : Stack #%d is full (monty)...\n", AnimationName, uwNumStack );
assert(FALSE);
tdstStacks[uwNumStack].slStackPos= tdstStacks[uwNumStack].slMaxPos - slWantedSize;
}
tdstStacks[uwNumStack].slPosAlloc= tdstStacks[uwNumStack].slStackPos - slWantedSize;
}
// **********************************************************************************
void fn_v_DeAllocateOnStack( unsigned short uwNumStack,
signed long slSize )
{
tdstStacks[uwNumStack].slStackPos-= slSize;
if (tdstStacks[uwNumStack].slStackPos < 0)
{ fprintf( ErrorFile, "%s : Stack #%d is over (2 be) free...\n", AnimationName, uwNumStack );
assert(FALSE);
tdstStacks[uwNumStack].slStackPos= 0;
}
}
// **********************************************************************************
void fn_v_ResetStacks( void )
{ unsigned short uwCnt;
for ( uwCnt=0 ; uwCnt<eStackBinNbMax ; uwCnt++ )
{ tdstStacks[uwCnt].slPosAlloc= 0;
tdstStacks[uwCnt].slStackPos= 0;
}
}
// **********************************************************************************
void fn_vCheckStacks( void )
{ unsigned short uwCnt;
for ( uwCnt=0 ; uwCnt<eStackBinNbMax ; uwCnt++ )
{ if (tdstStacks[uwCnt].slMaxPos < tdstStacks[uwCnt].slAllocNeeded)
fprintf( ErrorFile, "%s : Stack #%d max must be raise over %d (Now MAx = %d)\n", AnimationName,uwCnt,tdstStacks[uwCnt].slAllocNeeded,tdstStacks[uwCnt].slMaxPos);
//else
// fprintf( ErrorFile, "%s : Stack #%d use %d Elemnt and max is %d\n", AnimationName,uwCnt,tdstStacks[uwCnt].slStackPos,tdstStacks[uwCnt].slMaxPos);
}
}
// **********************************************************************************
static int gs_iPrintPos = 0;
void fn_v_LogSectionBegin( int _bFlagNew,
char *_szType,
char *_szString )
{ int iCnt;
char szTxt[1024];
for ( iCnt=0 ; iCnt<gs_iPrintPos ; iCnt++ )
putchar(' ');
gs_iPrintPos++;
if (_bFlagNew)
sprintf( szTxt, "New %s:%s", _szType, _szString );
else sprintf( szTxt, "Old %s:%s", _szType, _szString );
printf( "%s\n", szTxt );
}
void fn_v_LogSectionEnd(void)
{ gs_iPrintPos--;
}
// **********************************************************************************
void fn_v_InitMemV6i( void )
{
Erm_M_InitErrMsg(Erm);
Erm_M_InitErrMsg(Mmg);
Mmg_fn_vFirstInitMmgModule(10);
// For morphing datas -> reset !
memset(ax_tdstBinMorphInfos,0,MaxInMorphTab*sizeof(tdstBinMorphData));
SCR_fn_v_RdL0_Init();
}
// **********************************************************************************
void fn_v_KillMem( void )
{//#ifndef SCR_DM_LightVersion
//fn_v_Anl_CloseModule(); // Destroy CallBack
fn_v_Cxt_CloseModule();
fn_v_Err_CloseModule();
//#endif /* SCR_DM_LightVersion */
fn_v_Link_CloseModule();
fn_v_File_CloseModule();
//#ifndef SCR_DM_LightVersion
fn_v_Ntfy_CloseModule();
fn_v_Sect_CloseModule();
fn_v_Vars_CloseModule();
//#endif /* SCR_DM_LightVersion */
}
// **********************************************************************************
#undef L_GLOBAL_V6_C

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
// **********************************************************************************
// * "l_sta_v6.c" *
// * Written by : Carlos Torres *
// * Tabulations : 4 char *
// **********************************************************************************
// **********************************************************************************
// Included files
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "SCR.h"
#include "specif\\a3x_pref.h"
#include "makeanim.h"
#include "l_sta_v6.h"
// New State
#define STA_STATE_SECTION "CreateNewState"
#define STA_ANIM "Animation"
// **********************************************************************************
// Global Variables
// ********************************************************** fn_eNewStateCallBackV6i
// NEW STATE CALLBACK
//
// **********************************************************************************
SCR_tde_Anl_ReturnValue fn_eNewStateCallBackV6i( SCR_tdst_File_Description *_p_stFile,
char *_p_szName,
char *_ap_SzParam[],
SCR_tde_Anl_Action _eAction )
{
// Section already analysed
if (_eAction == SCR_EA_Anl_AlreadyAnalysed) {
fprintf( ErrorFile, "%s : STA NewState already analysed\n", AnimationName );
}
// Beginning of section
if (_eAction == SCR_EA_Anl_BeginSection) {
// nop
}
// We are in the section
else if (_eAction == SCR_EA_Anl_Entry)
{
// Create new State
if ( !strcmp(_p_szName, STA_ANIM) ) {
int i;
tdstAnimInfo * p_stCurrAnim=stAnims;
// search the anim
for (i=0;i<g_uwTotalNumOfAnim;i++,p_stCurrAnim++) {
char * p_szA3DExtension = szAnimName(p_stCurrAnim) + strlen(szAnimName(p_stCurrAnim)) - 4;
// supress .A3D for comparaison
*p_szA3DExtension = '\0';
// find the good anim and validate it
if (!stricmp(szAnimName(p_stCurrAnim),_ap_SzParam[0])) {
bValid(p_stCurrAnim) = 0;
// reset extension .A3D
*p_szA3DExtension = '.';
break;
}
else {
// reset extension .A3D
*p_szA3DExtension = '.';
}
}
if (i == g_uwTotalNumOfAnim) {
fprintf( ErrorFile,"Anim %s in STA File without an A3D File\n",_ap_SzParam[0]);
}
}
// Unknown field
else {
// nop
}
}
// End of section
else if (_eAction == SCR_EA_Anl_EndSection) {
// nop
}
return SCR_ERV_Anl_NormalReturn;
}
// ****************************************************************** fn_v_InitSTAV6i
// Register Call back for the different sections
//
// **********************************************************************************
void fn_v_InitSTAV6i( void ) {
int i;
tdstAnimInfo * p_stCurrAnim=stAnims;
// invalidate all anims
for (i=0;i<g_uwTotalNumOfAnim;i++,p_stCurrAnim++)
bValid(p_stCurrAnim) = 1;
// Channel Names Section
SCR_fn_v_RdL0_RegisterCallback(STA_STATE_SECTION,fn_eNewStateCallBackV6i,SCR_CRC_c_RdL0_ForSection );
}
// **********************************************************************************

View File

@@ -0,0 +1,564 @@
// **********************************************************************************
// * "makeanim.c" *
// * Written by : S<>bastien Rubens *
// * Tabulations : 4 char *
// **********************************************************************************
#define MAKEANIM_C
// **********************************************************************************
// Suivi des versions
// 1.01 : 17/07/98
// Sort channel by channel number
// Hierarchy now contains channel number (no more index in array of element)
// 1.02 : 21/07/98
// Bug correction in Hierarchy optimisation (when channel is supressed)
// 1.03 : 23/07/98
// Correction in Hierarchy optimisation : kill couple when channel number is undefined
// Remove Empty Error File
// 1.04 : 30/07/98
// Use a second Dir(found in Version.ini) to find Anim and generate A3i
// 1.05 : 17/08/98
// Generalized use of N Dir found in Version.ini separate by a DIR_SEPARATOR
// Treat CameraAngle Key in General Section of A3D
// 1.05b : 25/08/98
// Raise stack of event
// 1.06 : 25/08/98
// Generate All anim in a specific dir (first dir in version.ini)
// To Generate All anim use option -a
// 1.07 : 27/08/98
// Change Morph structure (like N64)
// Treat Morphing Entry in Key Section
// 1.08 : 28/08/98
// Accelerated Interpollation - Type 1
// Put Version in A3i File
// 1.09 : 11/09/98
// Correction of overwrite bug with anim with 0 channel
// Transparency in animation is now possible (transparency isn't interpolated)
// 1.09a : 16/09/98
// Correction Add the good number of Alignement bytes before events
// 1.09b : 24/09/98
// Correction of overwrite bug with anim with 0 channel (previous correction was lost)
// 1.09c : 25/09/98
// Merging end + correction from Seb Rubens
// 1.10 : 29/09/98
// Ajout du numero de canal dans les events et tri complet des events
// (correction bug tir et arret des sons)
// 1.10a : 29/09/98
// Bug correction : when last key is a simple key and wasn't on the last frame channel
// don't move after the last key
// 1.11 : 09/10/98
// Correction for scale computing
// 14/10/98
// New Option -z : to compact TBL (save original in a TBO file)
// All families in the file MakeAnim.in are not compacted
// MakeAnim.ini format:
// FamilyName1<CR>
// ...
// FamilyNameN<CR>
// 1.11a : 14/10/98
// Correction of transparence bug (in NTTO optimisation)
// 1.11b : 16/10/98
// Bug correction for object number > 255
// Bug correction, now deleting unused event
// 1.12 : 19/10/98
// Integration of the last change from Seb
// 1.13 : 22/10/98 FBF
// Integration modif from N64 version
// 1.13a : 26/10/98
// Bug correction when having V5 Anim (respect anim indexing)
// Add precision parameter
// Correction for emptyobject optimization
// Correction for Generate Channel object
// 1.13b : 27/10/98
// Correction for quaternion interpolation
// 1.13c : 28/10/98
// Correction with bad A3D file or Empty file (respect anim indexing)
// 1.13d : 30/10/98
// Sort of Warnings and Errors
// 1.13e : ???
// maybe structure modification for N64 version
// 1.13f : 7/12/98
// Correction of bug that add Key frame
// : 11/01/99
// Ajout de l'option "d'optimisation" -o
// 1.13g : 01/02/99
// Correction for Extra Key frames optimization
// 1.13h : 16/03/99
// Correction for vector optimization (fn_v_DiscretizeScal)
// 1.14 : 25/03/99
// Change treatment of Entry ObjectType in A3D file
// Check CHL and TBL presence before analysing
// return 0 if no problem
// no wait for keystroke in batch mode
// 1.14a : 30/03/99
// Correction of event sort
// 1.15 : 16/04/99
// change the format of ini file to set specific precision
// 1.15a : 16/06/99
// Correction for deleting hierarchy couple
// 1.16 : 24/06/99
// Correction precision option bug
// check STA file with compact option to suppress unused object
// 1.16a : 28/06/99
// Correction bug analyse STA & unvalidate unused anim
// : 05/07/99
// Modif event sort --> use qsort
// Create Anims dir if not exist
// 1.17 : 20/07/99
// Modif in quaternion compacting method
// **********************************************************************************
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/stat.h>
#include <direct.h>
#include "afx.h"
#include "SCR.h"
#include "specif\\a3x_pref.h"
#include "a3x_glob.h"
#include "makeanim.h"
#include "a3x_int.h"
#include "a3x_intb.h"
#include "l_global_v6.h"
#include "l_a3d_v6.h"
#include "l_chl_v6.h"
#include "l_Tbl_v6.h"
#include "l_Sta_v6.h"
#include "l_optim_v6.h"
#include "inifile.h"
#define FAMILY_NAME_LENGTH 32
#define NO_PROBLEMO 0
#define ERR_WRONG_PARAMETERS 1
#define ERR_NO_CHL_FILE 2
#define ERR_NO_TBL_FILE 3
#define ERR_NO_STA_FILE 4
// **********************************************************************************
// Files & Dir Defines
#define VERSION_OPTIONS_FILE "Version.ini"
#define DIR_SEPARATOR ","
// OPTION command
#define BATCH_ARG "b" // no interaction
#define BATCH_HELP "\t-b : Batch mode, no interaction\n"
#define ALL_ARG "a" // treat all anim found and save in the same dir
#define ALL_HELP "\t-a : Treat all anim found and convert in the corresponding Dir\n"
#define COMPAC_ARG "z" // compact Tbl
#define COMPAC_HELP "\t-z : Save Tbl in Tbo(Original Table) file and compact it\n"
#define EPSIL_ARG "p" // set precision
#define EPSIL_HELP "\t-p Epsilon : Set the precision for optimisation\n"
#define OPTIM_ARG "o" // pseudo-optimization of non-optim anim
#define OPTIM_HELP "\t-o KeyFreq : Set the keyFrequence of non-optimized animation(Default=1)\n"
unsigned short uwNumOfBank= 1;
unsigned short uwAnalysedAnim;
tdstAnimInfo stAnims[NombreDanimationsParDirectory];
unsigned short g_uwTotalNumOfAnim=0;
char LongActorName[5][500];
char LongChannelName[500];
char LongFileName[500],LongFileName2[500];
char AnimationName[500];
char szFamilyName[FAMILY_NAME_LENGTH];
int bCompactTbl=FALSE;
// parametrable variables
SEB_xReal xDefaultEps = (SEB_xReal) 0.0001;
extern int iKeyFreq;
unsigned char bBatch=FALSE;
// ***************************************************************************** Main
// MAIN
//
// Modif 30/07/98 : Second anim Dir treatment - Carlos Torres
// Modif 17/08/98 : Generalized use of N Dir - Carlos Torres
// Modif 25/08/98 : Add option -a, Let script module found Chl and Tbl File
// Save file in First dir of version.ini File
// Modif 08/01/99 : Add optim option
// **********************************************************************************
int main(int argc,char * argv[] ) {
FILE * fdTest;
int iCurArg = 1,iFamilyName = -1;
int bTreatAll=FALSE;
unsigned short uwNumOfAnim[5];
unsigned char ucNbDir = 1;
unsigned short uwNbAnims;
int i;
printf("MakeAnim.exe by Sebastien Rubens (Ubi R&D, Montreuil)\nVersion %d.%02d%c\n\n",
(A3i_Version&0xF000)>>12,(A3i_Version&0x0FF0)>>4,(A3i_Version&0x000F)?'a'+(A3i_Version&0x000F)-1:' ');
// ------------------------------------------------------------------------------
// Parameter Treatment
// ------------------------------------------------------------------------------
for(iCurArg=1;iCurArg<argc;iCurArg++) {
// options
if (*argv[iCurArg]=='-') {
// batch Option
if (!stricmp(&argv[iCurArg][1],BATCH_ARG)) {
bBatch = TRUE;
}
// All Option
else if (!stricmp(&argv[iCurArg][1],ALL_ARG)) {
bTreatAll = TRUE;
}
// Compact Option
else if (!stricmp(&argv[iCurArg][1],COMPAC_ARG)) {
bCompactTbl = TRUE;
}
// Set precision
else if (!stricmp(&argv[iCurArg][1],EPSIL_ARG)) {
if (++iCurArg < argc) {
sscanf(argv[iCurArg],"%f",&xDefaultEps);
if ((xDefaultEps < 0) || (xDefaultEps > 0.1)) {
printf("Bad epsilon specify %f\n",xDefaultEps);
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
}
else {
printf("No epsilon specify\n");
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
}
// Set Key Freq
else if (!stricmp(&argv[iCurArg][1],OPTIM_ARG)) {
if (++iCurArg < argc) {
sscanf(argv[iCurArg],"%d",&iKeyFreq);
if (iKeyFreq <= 0) {
printf("Bad KeyFreq specify %d\n",iKeyFreq);
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
}
else {
printf("No KeyFreq specify\n");
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
}
else {
printf("Option %s Unknown\n",argv[iCurArg]);
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
}
// Family name Option
else if (iFamilyName == -1) {
strcpy(szFamilyName,argv[iCurArg]);
iFamilyName=iCurArg;
}
// Argument unknown
else {
printf("Argument %s Unknowm\n",argv[iCurArg]);
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
}
// read parameter - just the name of character Family
if (iFamilyName == -1) {
printf("Family not specify\n");
printf("Command format is : MakeAnim [Options] <Family_Name>\n");
printf("\tGenerate Anim in A3i format in a specific dir(without option -a)\n");
printf("\tSpecific Dir is the first dir in the %s File\n",VERSION_OPTIONS_FILE);
printf("Incompatible with the version 1.06 and previous version\n");
printf("\nOptions :\n");
printf(BATCH_HELP);
printf(ALL_HELP);
printf(COMPAC_HELP);
printf(OPTIM_HELP);
WaitKeyStroke();
exit(ERR_WRONG_PARAMETERS);
}
// ------------------------------------------------------------------------------
// INIT
// ------------------------------------------------------------------------------
// init a table with sinus value
fn_v_InitSinTab();
// init others modules (ERM MMG SCR)
fn_v_InitMemV6i();
fn_v_InitSaveAnimationV6i();
fn_v_StartA3dV6i();
// Set channel&CHL path
sprintf(LongChannelName,"%s\\%s",DIR_FAMILIES,szFamilyName);
// Set Anims path
sprintf(LongActorName[0],"%s\\%s\\%s",DIR_DATA,DIR_ANIMS,szFamilyName);
// ------------------------------------------------------------------------------
// Get second Data Dir
fdTest = fopen(VERSION_OPTIONS_FILE,"rb");
if (fdTest) {
char szSecondDataDir[50];
char szAnimDir[50];
char * szToken;
struct _stat stBuf;
fgets(szSecondDataDir,50,fdTest);
// suppress last char (EOL)
szSecondDataDir[(i=strlen(szSecondDataDir))-2] = NULL;
fclose(fdTest);
// Look for a third Dir
szToken = strtok(szSecondDataDir,DIR_SEPARATOR);
// check Anims dir for specif gamedata
sprintf(szAnimDir,"%s\\%s",szToken,DIR_ANIMS,szFamilyName);
// check if Dir Exist & create it if necessary
if (_stat(szAnimDir,&stBuf))
_mkdir(szAnimDir);
// Get all dirs
while (szToken) {
// Set Anims path
sprintf(LongActorName[ucNbDir],"%s\\%s\\%s",szToken,DIR_ANIMS,szFamilyName);
// check if Dir Exist
if (!_stat(LongActorName[ucNbDir],&stBuf))
ucNbDir++;
// if not all option create Specific Dir
else if (!bTreatAll && (ucNbDir == 1)) {
// create Save Dir
_mkdir(LongActorName[ucNbDir]);
ucNbDir++;
}
szToken = strtok(NULL,DIR_SEPARATOR);
}
}
// Get anim number in each Directory for the family
for (i=0;i<ucNbDir;i++) {
uwNumOfAnim[i] = fn_uw_GetDirV6i(LongActorName[i],bTreatAll);
}
// ------------------------------------------------------------------------------
// LOAD MakeAnim.ini File
// ------------------------------------------------------------------------------
fn_v_IniFileInit(szFamilyName);
sprintf(LongFileName,"%s^%s",MAKEANIM_OPTIONS_FILE,szFamilyName);
// check if file exist
if (SCR_fn_c_RdL0_IsSectionExists(LongFileName)) {
SCR_fnp_st_RdL0_AnalyseSection( LongFileName, SCR_CDF_uw_Anl_NotSaveSection );
SCR_fn_v_RdL0_Close();
}
// ------------------------------------------------------------------------------
// LOAD CHL File
// ------------------------------------------------------------------------------
fn_v_InitCHLV6i();
sprintf(LongFileName,"%s\\%s.CHL",LongChannelName,szFamilyName);
// check if file exist
if (SCR_fn_c_RdL0_IsSectionExists(LongFileName)) {
SCR_fnp_st_RdL0_AnalyseSection( LongFileName, SCR_CDF_uw_Anl_NotSaveSection );
SCR_fn_v_RdL0_Close();
}
else {
printf("File %s not found\n",LongFileName);
WaitKeyStroke();
return ERR_NO_CHL_FILE;
}
// ------------------------------------------------------------------------------
// Copy Originals Table in Tbl File or save original TBL
// ------------------------------------------------------------------------------
if (bCompactTbl) {
struct _finddata_t stFileInfo;
long lHandle;
// Find Tbl in data
for (i=0;i<ucNbDir;i++) {
strcpy(LongFileName,LongActorName[i]);
sprintf(strchr(LongFileName,'\\') + 1,"%s\\%s\\*.TBL",REL_DIR_FAMILY,szFamilyName);
lHandle = _findfirst(LongFileName,&stFileInfo);
// stop at first TBL found
if (lHandle != -1)
break;
}
// compact all family's tbl
if (lHandle != -1) {
do {
// Build File name
sprintf(strrchr(LongFileName,'\\')+1,"%s",stFileInfo.name);
strcpy(LongFileName2,LongFileName);
LongFileName2[strlen(LongFileName2)-1] = 'O';
// Get tbl original
if (!CopyFile(LongFileName2,LongFileName,NULL))
// save original tbl
CopyFile(LongFileName,LongFileName2,NULL);
} while (!_findnext(lHandle,&stFileInfo));
_findclose(lHandle);
}
}
// ------------------------------------------------------------------------------
// LOAD TBL File
// ------------------------------------------------------------------------------
fn_v_InitTBLV6i();
sprintf(LongFileName,"%s\\%s.TBL",LongChannelName,szFamilyName);
// check if file exist
if (SCR_fn_c_RdL0_IsSectionExists(LongFileName)) {
SCR_fnp_st_RdL0_AnalyseSection( LongFileName, SCR_CDF_uw_Anl_NotSaveSection );
SCR_fn_v_RdL0_Close();
}
else {
printf("File %s not found\n",LongFileName);
WaitKeyStroke();
return ERR_NO_TBL_FILE;
}
// ------------------------------------------------------------------------------
// Check State file
// ------------------------------------------------------------------------------
if (bCompactTbl) {
fn_v_InitSTAV6i();
sprintf(LongFileName,"%s\\%s.STA",LongChannelName,szFamilyName);
// check if file exist
if (SCR_fn_c_RdL0_IsSectionExists(LongFileName)) {
SCR_fnp_st_RdL0_AnalyseSection( LongFileName, SCR_CDF_uw_Anl_NotSaveSection );
SCR_fn_v_RdL0_Close();
}
else {
printf("File %s not found\n",LongFileName);
WaitKeyStroke();
return ERR_NO_STA_FILE;
}
}
// ------------------------------------------------------------------------------
// LOAD A3D Files (all Family's animation)
// ------------------------------------------------------------------------------
fn_v_InitA3dV6i();
for ( uwAnalysedAnim=0 ; uwAnalysedAnim<g_uwTotalNumOfAnim; uwAnalysedAnim++ ) {
if (!bValid(&stAnims[uwAnalysedAnim])) {
// Set AnimationName
sprintf(AnimationName,"%s\\%s",szFamilyName,szAnimName(&stAnims[uwAnalysedAnim]));
// search the good dir
for (i=0,uwNbAnims=uwNumOfAnim[0];i<ucNbDir;i++,uwNbAnims+=uwNumOfAnim[i])
if (uwAnalysedAnim < uwNbAnims)
break;
// Set LongFileName
sprintf(LongFileName,"%s\\%s",LongActorName[i],szAnimName(&stAnims[uwAnalysedAnim]));
SCR_fnp_st_RdL0_AnalyseSection( LongFileName, SCR_CDF_uw_Anl_NotSaveSection );
fn_v_KillMem();
}
else {
// always allocate A3D General in stack to respect indexing
fn_v_AllocateOnStack( eStackBinA3dGENERAL, 1 );
}
}
// ------------------------------------------------------------------------------
// BINARISE ANIM
// ------------------------------------------------------------------------------
fn_v_VerifyAnimationV6i(g_uwTotalNumOfAnim);
fn_v_OptimiseAnimationV6i(g_uwTotalNumOfAnim);
fn_v_OptimiseAnimation2V6i(g_uwTotalNumOfAnim);
// ------------------------------------------------------------------------------
// UPDATE TBL
// ------------------------------------------------------------------------------
if (bCompactTbl) {
struct _finddata_t stFileInfo;
long lHandle;
// Find Tbl in data
for (i=0;i<ucNbDir;i++) {
strcpy(LongFileName,LongActorName[i]);
sprintf(strchr(LongFileName,'\\') + 1,"%s\\%s\\*.TBL",REL_DIR_FAMILY,szFamilyName);
lHandle = _findfirst(LongFileName,&stFileInfo);
// stop at first TBL found
if (lHandle != -1)
break;
}
// compact all family's tbl
if (lHandle != -1) {
fn_vGenerateNewObjectNumber(TRUE);
do {
// Build File name
sprintf(strrchr(LongFileName,'\\')+1,"%s",stFileInfo.name);
// update TBL to compact it
fn_vCompactTBL(LongFileName);
} while (!_findnext(lHandle,&stFileInfo));
_findclose(lHandle);
}
}
// Keep tbl index for uncompactable TBL
else
fn_vGenerateNewObjectNumber(FALSE);
// ------------------------------------------------------------------------------
// SAVE ANIM
// ------------------------------------------------------------------------------
for (i=0,uwNbAnims=0;i<ucNbDir;i++) {
if (bTreatAll || (ucNbDir==1))
fn_v_SaveAnimationV6i(uwNbAnims,uwNumOfAnim[i],LongActorName[i]);
else
fn_v_SaveAnimationV6i(uwNbAnims,uwNumOfAnim[i],LongActorName[1]);
uwNbAnims += uwNumOfAnim[i];
}
//TagadaPouetPouet( uwNumOfAnim );
// ------------------------------------------------------------------------------
// END OF PROGRAM
// ------------------------------------------------------------------------------
// verify if stacks is enough big
fn_vCheckStacks();
fn_v_EndA3dV6i();
SCR_fn_v_RdL0_Close();
fn_v_EndSaveAnimationV6i();
printf( "\n\nFin de binarisation...\n" );
return 0;
}
// **********************************************************************************
#undef MAKEANIM_C