Small cleanup to animation code, and fix copy&paste typo in 3ds2pie.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3412 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
691f3640aa
commit
f7fbf845c0
|
@ -47,7 +47,12 @@
|
|||
/***************************************************************************/
|
||||
/* global variables */
|
||||
|
||||
static ANIMGLOBALS g_animGlobals;
|
||||
struct
|
||||
{
|
||||
BASEANIM *psAnimList;
|
||||
UWORD uwCurObj, uwCurState;
|
||||
}
|
||||
static g_animGlobals;
|
||||
|
||||
/***************************************************************************/
|
||||
/*
|
||||
|
@ -55,14 +60,12 @@ static ANIMGLOBALS g_animGlobals;
|
|||
*/
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL
|
||||
anim_Init( GETSHAPEFUNC pGetShapeFunc )
|
||||
BOOL anim_Init()
|
||||
{
|
||||
/* init globals */
|
||||
g_animGlobals.psAnimList = NULL;
|
||||
g_animGlobals.uwCurObj = 0;
|
||||
g_animGlobals.uwCurState = 0;
|
||||
g_animGlobals.pGetShapeFunc = pGetShapeFunc;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -119,7 +122,7 @@ anim_Shutdown( void )
|
|||
|
||||
static void
|
||||
anim_InitBaseMembers( BASEANIM * psAnim, UWORD uwStates, UWORD uwFrameRate,
|
||||
UWORD uwObj, UBYTE ubType, UWORD uwID )
|
||||
UWORD uwObj, ANIM_MODE ubType, UWORD uwID )
|
||||
{
|
||||
psAnim->uwStates = uwStates;
|
||||
psAnim->uwFrameRate = uwFrameRate;
|
||||
|
@ -136,7 +139,7 @@ anim_InitBaseMembers( BASEANIM * psAnim, UWORD uwStates, UWORD uwFrameRate,
|
|||
|
||||
BOOL
|
||||
anim_Create3D( char szPieFileName[], UWORD uwStates,
|
||||
UWORD uwFrameRate, UWORD uwObj, UBYTE ubType, UWORD uwID )
|
||||
UWORD uwFrameRate, UWORD uwObj, ANIM_MODE ubType, UWORD uwID )
|
||||
{
|
||||
ANIM3D *psAnim3D;
|
||||
iIMDShape *psFrames;
|
||||
|
@ -149,7 +152,7 @@ anim_Create3D( char szPieFileName[], UWORD uwStates,
|
|||
}
|
||||
|
||||
/* get local pointer to shape */
|
||||
psAnim3D->psFrames = (g_animGlobals.pGetShapeFunc) (szPieFileName);
|
||||
psAnim3D->psFrames = (iIMDShape*)resGetData("IMD", szPieFileName);
|
||||
|
||||
/* count frames in imd */
|
||||
psFrames = psAnim3D->psFrames;
|
||||
|
|
|
@ -44,7 +44,12 @@
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
enum{ ANIM_2D, ANIM_3D_FRAMES, ANIM_3D_TRANS };
|
||||
typedef enum
|
||||
{
|
||||
ANIM_2D,
|
||||
ANIM_3D_FRAMES,
|
||||
ANIM_3D_TRANS
|
||||
} ANIM_MODE;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
@ -59,7 +64,7 @@ struct BASEANIM;
|
|||
UWORD uwStates; \
|
||||
UWORD uwObj; \
|
||||
UWORD uwAnimTime; \
|
||||
UBYTE ubType; \
|
||||
ANIM_MODE ubType; \
|
||||
struct ANIM_STATE *psStates; \
|
||||
struct BASEANIM *psNext;
|
||||
|
||||
|
@ -92,31 +97,16 @@ typedef struct ANIM3D
|
|||
}
|
||||
ANIM3D;
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
typedef iIMDShape * (* GETSHAPEFUNC) ( char *pStr );
|
||||
|
||||
typedef struct ANIMGLOBALS
|
||||
{
|
||||
BASEANIM *psAnimList;
|
||||
UWORD uwCurObj, uwCurState;
|
||||
GETSHAPEFUNC pGetShapeFunc;
|
||||
}
|
||||
ANIMGLOBALS;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
BOOL anim_Init( GETSHAPEFUNC );
|
||||
BOOL anim_Init(void);
|
||||
BOOL anim_Shutdown( void );
|
||||
BASEANIM * anim_LoadFromBuffer(char *pBuffer, UDWORD size);
|
||||
BASEANIM * anim_LoadFromFile(PHYSFS_file* fileHandle);
|
||||
void anim_ReleaseAnim( BASEANIM *psAnim );
|
||||
BOOL anim_Create3D( char szPieFileName[], UWORD uwFrames,
|
||||
UWORD uwFrameRate, UWORD uwObj,
|
||||
UBYTE ubType, UWORD uwID );
|
||||
ANIM_MODE ubType, UWORD uwID );
|
||||
void anim_BeginScript( void );
|
||||
BOOL anim_EndScript( void );
|
||||
BOOL anim_AddFrameToAnim( int iFrame, Vector3i vecPos, Vector3i vecRot, Vector3i vecScale );
|
||||
|
|
|
@ -551,11 +551,6 @@ init_ObjectDead( void * psObj )
|
|||
return psBaseObj->died;
|
||||
}
|
||||
|
||||
static iIMDShape *anim_GetShapeFunc( char * pStr )
|
||||
{
|
||||
return (iIMDShape*)resGetData( "IMD", pStr );
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// Called At Frontend Startup.
|
||||
|
@ -586,7 +581,7 @@ BOOL frontendInitialise(const char *ResourceFile)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !anim_Init( anim_GetShapeFunc ) )
|
||||
if (!anim_Init())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -741,7 +736,7 @@ BOOL stageOneInitialise(void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !anim_Init( anim_GetShapeFunc ) )
|
||||
if (!anim_Init())
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ static void dump_pie_file(Lib3dsFile *f, FILE *o)
|
|||
{
|
||||
if (i > 0)
|
||||
{
|
||||
fprintf(stderr, "Mesh %d %s: More than one texture currently not supported!\n", i, m->name);
|
||||
fprintf(stderr, "Mesh %d %s: More than one frame currently not supported!\n", i, m->name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,9 @@ static void dump_pie_file(Lib3dsFile *f, FILE *o)
|
|||
for (i = 0; i < m->points; i++)
|
||||
{
|
||||
Lib3dsVector pos;
|
||||
lib3ds_vector_copy(pos, m->pointL[i].pos);
|
||||
|
||||
lib3ds_vector_copy(pos, m->pointL[i].pos);
|
||||
|
||||
if (switchYZ)
|
||||
{
|
||||
fprintf(o, "\t%d %d %d\n", (int)pos[0], (int)pos[2], (int)pos[1]);
|
||||
|
|
Loading…
Reference in New Issue