88 lines
2.6 KiB
C++
88 lines
2.6 KiB
C++
/*
|
|
=======================================================================================
|
|
Name : SpecRef.cpp
|
|
|
|
Author : vincent lhullier Date :10/09/97
|
|
|
|
Description : functions to transform special references
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
#include "stdafx.h"
|
|
#include "SpecRef.h"
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
|
|
/*
|
|
=======================================================================================
|
|
globals
|
|
=======================================================================================
|
|
*/
|
|
tdstSpecialReference g_a_stSpecialRef[ C_lNumberOfSpecialRefs ] =
|
|
{
|
|
{ "PHY", "CS", 0, fn_vTransformCSRef }
|
|
};
|
|
|
|
|
|
/*
|
|
=======================================================================================
|
|
functions
|
|
=======================================================================================
|
|
*/
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : called for a special reference
|
|
_szSectionType -> section type
|
|
_szEntryName -> entry name
|
|
_cParam -> parameter index
|
|
_szRef -> reference to transform
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void fn_SpRef_vTransformSpecialRef( char *_szSectionType, char *_szEntryName, char _cParam, char *_szRef )
|
|
{
|
|
char cSpecialRef;
|
|
tdstSpecialReference *p_stRef = g_a_stSpecialRef;
|
|
|
|
for (cSpecialRef = 0; cSpecialRef < C_lNumberOfSpecialRefs; cSpecialRef++, p_stRef++ )
|
|
{
|
|
if
|
|
(
|
|
( stricmp( _szSectionType, p_stRef->szSectionType) == 0)
|
|
&& ( stricmp( _szEntryName, p_stRef->szEntry ) == 0)
|
|
&& ( _cParam == p_stRef->cParam )
|
|
)
|
|
{
|
|
p_stRef->pfn_vTransform( _szRef );
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
----------------------------------------------------------------------------------------
|
|
Description : transform bad CS reference from
|
|
<filename>^CS:<name> to <filename>^AllCollideSets^CS:<Name>
|
|
_szRef -> bad reference : <filename>
|
|
----------------------------------------------------------------------------------------
|
|
*/
|
|
void fn_vTransformCSRef( char *_szRef )
|
|
{
|
|
char szEnd[ 100 ];
|
|
char *szSectionName;
|
|
|
|
if ((szSectionName = strchr( _szRef, '^' )) == NULL)
|
|
return;
|
|
szSectionName++;
|
|
if ( strnicmp( szSectionName, "CS", 2 ) == 0)
|
|
{
|
|
strcpy( szEnd, szSectionName );
|
|
strcpy( szSectionName, "AllCollideSets^" );
|
|
strcat( szSectionName, szEnd );
|
|
}
|
|
}
|
|
|
|
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|