30 #define private         public 
   31 #define protected       public 
   33 #include "../../idlib/precompiled.h" 
   36 #include "../Game_local.h" 
   38 #ifdef ID_DEBUG_MEMORY 
   39 #include "GameTypeInfo.h"                                
   48 typedef void (*
WriteVariableType_t)( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *
value, 
const void *varPtr, 
int varSize );
 
   55         static bool                                             IsSubclassOf( 
const char *typeName, 
const char *superType );
 
   56         static void                                             PrintType( 
const void *typePtr, 
const char *typeName );
 
   71         static void                                             PrintVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *value, 
const void *varPtr, 
int varSize );
 
   72         static void                                             WriteVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *value, 
const void *varPtr, 
int varSize );
 
   73         static void                                             WriteGameStateVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *value, 
const void *varPtr, 
int varSize );
 
   74         static void                                             InitVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *value, 
const void *varPtr, 
int varSize );
 
   75         static void                                             VerifyVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *value, 
const void *varPtr, 
int varSize );
 
   76         static int                                              WriteVariable_r( 
const void *varPtr, 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const int pointerDepth );
 
   77         static void                                             WriteClass_r( 
const void *classPtr, 
const char *className, 
const char *classType, 
const char *scope, 
const char *prefix, 
const int pointerDepth );
 
   93         static char varName[1024];
 
   96         for ( i = 0; classTypeInfo[
i].typeName != 
NULL; i++ ) {
 
   97                 if ( 
idStr::Cmp( typeName, classTypeInfo[i].typeName ) == 0 ) {
 
   98                         if ( classTypeInfo[i].variables[0].
name != 
NULL && offset >= classTypeInfo[i].variables[0].offset ) {
 
  101                         typeName = classTypeInfo[
i].superType;
 
  102                         if ( *typeName == 
'\0' ) {
 
  132         for ( i = 0; classTypeInfo[
i].typeName != 
NULL; i++ ) {
 
  133                 if ( 
idStr::Cmp( typeName, classTypeInfo[i].typeName ) == 0 ) {
 
  134                         return &classTypeInfo[
i];
 
  148         for ( i = 0; enumTypeInfo[
i].typeName != 
NULL; i++ ) {
 
  149                 if ( 
idStr::Cmp( typeName, enumTypeInfo[i].typeName ) == 0 ) {
 
  150                         return &enumTypeInfo[
i];
 
  164         while( *typeName != 
'\0' ) {
 
  165                 if ( 
idStr::Cmp( typeName, superType ) == 0 ) {
 
  168                 for ( i = 0; classTypeInfo[
i].typeName != 
NULL; i++ ) {
 
  169                         if ( 
idStr::Cmp( typeName, classTypeInfo[i].typeName ) == 0 ) {
 
  170                                 typeName = classTypeInfo[
i].superType;
 
  174                 if ( classTypeInfo[i].typeName == 
NULL ) {
 
  188         static int index = 0;
 
  193         out = buffers[
index];
 
  194         index = ( index + 1 ) & 3;
 
  196         if ( 
string == 
NULL ) {
 
  200         for ( i = 0; i < 
sizeof( buffers[0] ) - 2; i++ ) {
 
  203                         case '\0': out[
i] = 
'\0'; 
return out;
 
  204                         case '\\': out[i++] = 
'\\'; out[
i] = 
'\\'; 
break;
 
  205                         case '\n': out[i++] = 
'\\'; out[
i] = 
'n'; 
break;
 
  206                         case '\r': out[i++] = 
'\\'; out[
i] = 
'r'; 
break;
 
  207                         case '\t': out[i++] = 
'\\'; out[
i] = 
't'; 
break;
 
  208                         case '\v': out[i++] = 
'\\'; out[
i] = 
'v'; 
break;
 
  209                         default: out[
i] = 
c; 
break;
 
  236                 if ( token == 
"<" ) {
 
  238                 } 
else if ( token == 
">" ) {
 
  241                         if ( arguments.
Length() ) {
 
  256         idTypeInfoTools::fp = 
NULL;
 
  268         idTypeInfoTools::fp = 
fp;
 
  280         idTypeInfoTools::fp = 
NULL;
 
  293                 if ( 
idStr::Icmp( varName, 
"forceUpdate" ) == 0 ) {
 
  296                 if ( 
idStr::Icmp( varName, 
"lastTransformTime" ) == 0 ) {
 
  302                 if ( 
idStr::Icmp( varName, 
"frameBounds" ) == 0 ) {
 
  305         } 
else if ( 
idStr::Icmp( scope, 
"idClipModel" ) == 0 ) {
 
  309         } 
else if ( 
idStr::Icmp( scope, 
"idEntity" ) == 0 ) {
 
  310                 if ( 
idStr::Icmp( varName, 
"numPVSAreas" ) == 0 ) {
 
  316         } 
else if ( 
idStr::Icmp( scope, 
"idBrittleFracture" ) == 0 ) {
 
  320         } 
else if ( 
idStr::Icmp( scope, 
"idPhysics_AF" ) == 0 ) {
 
  322         } 
else if ( 
idStr::Icmp( scope, 
"renderEntity_t" ) == 0 ) {
 
  335         if ( 
idStr::Icmpn( prefix, 
"idAFEntity_Base::af.idAF::physicsObj.idPhysics_AF", 49) == 0 ) {
 
  347 bool IsRenderHandleVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *
value ) {
 
  349                 if ( 
idStr::Icmp( varName, 
"renderModelHandle" ) == 0 ) {
 
  352         } 
else if ( 
idStr::Icmp( scope, 
"idFXLocalAction" ) == 0 ) {
 
  353                 if ( 
idStr::Icmp( varName, 
"lightDefHandle" ) == 0 ) {
 
  356                 if ( 
idStr::Icmp( varName, 
"modelDefHandle" ) == 0 ) {
 
  359         } 
else if ( 
idStr::Icmp( scope, 
"idEntity" ) == 0 ) {
 
  360                 if ( 
idStr::Icmp( varName, 
"modelDefHandle" ) == 0 ) {
 
  363         } 
else if ( 
idStr::Icmp( scope, 
"idLight" ) == 0 ) {
 
  364                 if ( 
idStr::Icmp( varName, 
"lightDefHandle" ) == 0 ) {
 
  367         } 
else if ( 
idStr::Icmp( scope, 
"idAFEntity_Gibbable" ) == 0 ) {
 
  368                 if ( 
idStr::Icmp( varName, 
"skeletonModelDefHandle" ) == 0 ) {
 
  371         } 
else if ( 
idStr::Icmp( scope, 
"idAFEntity_SteamPipe" ) == 0 ) {
 
  372                 if ( 
idStr::Icmp( varName, 
"steamModelHandle" ) == 0 ) {
 
  375         } 
else if ( 
idStr::Icmp( scope, 
"idItem" ) == 0 ) {
 
  376                 if ( 
idStr::Icmp( varName, 
"itemShellHandle" ) == 0 ) {
 
  379         } 
else if ( 
idStr::Icmp( scope, 
"idExplodingBarrel" ) == 0 ) {
 
  380                 if ( 
idStr::Icmp( varName, 
"particleModelDefHandle" ) == 0 ) {
 
  383                 if ( 
idStr::Icmp( varName, 
"lightDefHandle" ) == 0 ) {
 
  386         } 
else if ( 
idStr::Icmp( scope, 
"idProjectile" ) == 0 ) {
 
  387                 if ( 
idStr::Icmp( varName, 
"lightDefHandle" ) == 0 ) {
 
  390         } 
else if ( 
idStr::Icmp( scope, 
"idBFGProjectile" ) == 0 ) {
 
  391                 if ( 
idStr::Icmp( varName, 
"secondModelDefHandle" ) == 0 ) {
 
  394         } 
else if ( 
idStr::Icmp( scope, 
"idSmokeParticles" ) == 0 ) {
 
  395                 if ( 
idStr::Icmp( varName, 
"renderEntityHandle" ) == 0 ) {
 
  398         } 
else if ( 
idStr::Icmp( scope, 
"idWeapon" ) == 0 ) {
 
  399                 if ( 
idStr::Icmp( varName, 
"muzzleFlashHandle" ) == 0 ) {
 
  402                 if ( 
idStr::Icmp( varName, 
"worldMuzzleFlashHandle" ) == 0 ) {
 
  405                 if ( 
idStr::Icmp( varName, 
"guiLightHandle" ) == 0 ) {
 
  408                 if ( 
idStr::Icmp( varName, 
"nozzleGlowHandle" ) == 0 ) {
 
  420 void idTypeInfoTools::PrintVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *
value, 
const void *varPtr, 
int varSize ) {
 
  421         common->
Printf( 
"%s%s::%s%s = \"%s\"\n", prefix, scope, varName, postfix, value );
 
  429 void idTypeInfoTools::WriteVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *
value, 
const void *varPtr, 
int varSize ) {
 
  437                         common->
Warning( 
"%s%s::%s%s = \"%s\"", prefix, scope, varName, postfix, value );
 
  441         fp->
WriteFloatString( 
"%s%s::%s%s = \"%s\"\n", prefix, scope, varName, postfix, value );
 
  457                         common->
Warning( 
"%s%s::%s%s = \"%s\"", prefix, scope, varName, postfix, value );
 
  470         fp->
WriteFloatString( 
"%s%s::%s%s = \"%s\"\n", prefix, scope, varName, postfix, value );
 
  478 void idTypeInfoTools::InitVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *
value, 
const void *varPtr, 
int varSize ) {
 
  479         if ( varPtr != 
NULL && varSize > 0 ) {
 
  484                 memset( const_cast<void*>(varPtr), 
initValue, varSize );
 
  493 void idTypeInfoTools::VerifyVariable( 
const char *varName, 
const char *varType, 
const char *scope, 
const char *prefix, 
const char *postfix, 
const char *
value, 
const void *varPtr, 
int varSize ) {
 
  500         src->SkipUntilString( 
"=" );
 
  502         if ( token.
Cmp( value ) != 0 ) {
 
  514                 src->Warning( 
"state diff for %s%s::%s%s\n%s\n%s", prefix, scope, varName, postfix, token.
c_str(), 
value );
 
  525         int i, isPointer, typeSize;
 
  528         idStr typeString, templateArgs;
 
  536                 if ( token != 
"const" && token != 
"mutable" && token != 
"class" && token != 
"struct" && token != 
"union" ) {
 
  537                         typeString += token + 
" ";
 
  544         if ( typeString[typeString.
Length() - 1] == 
']' ) {
 
  545                 for ( i = typeString.
Length(); i > 0 && typeString[i - 1] != 
'['; i-- ) {
 
  547                 int num = atoi( &typeString[i] );
 
  548                 idStr listVarType = typeString;
 
  551                 for ( i = 0; i < 
num; i++ ) {
 
  552                         idStr listVarName = 
va( 
"%s[%d]", varName, i );
 
  553                         int size = 
WriteVariable_r( varPtr, listVarName, listVarType, scope, prefix, pointerDepth );
 
  558                         varPtr = (
void *)( ( (
byte *) varPtr ) + 
size );
 
  565         for ( i = typeString.
Length(); i > 0 && typeString[i - 1] == 
'*'; i -= 2 ) {
 
  566                 if ( varPtr == (
void *)0xcdcdcdcd || ( varPtr != 
NULL && *((
unsigned long *)varPtr) == 0xcdcdcdcd ) ) {
 
  567                         common->
Warning( 
"%s%s::%s%s references uninitialized memory", prefix, scope, varName, 
"" );
 
  570                 if ( varPtr != 
NULL  ) {
 
  571                         varPtr = *((
void **)varPtr);
 
  576         if ( varPtr == 
NULL ) {
 
  577                 Write( varName, varType, scope, prefix, 
"", 
"<NULL>", varPtr, 0 );
 
  578                 return sizeof( 
void * );
 
  581         typeSrc.
LoadMemory( typeString, typeString.Length(), varName );
 
  584                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), varPtr, 0 );
 
  592                 token += 
"::" + newToken;
 
  595         if ( token == 
"signed" ) {
 
  598                         Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), varPtr, 0 );
 
  601                 if ( token == 
"char" ) {
 
  603                         typeSize = 
sizeof( 
signed char );
 
  604                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
signed char *)varPtr) ), varPtr, typeSize );
 
  606                 } 
else if ( token == 
"short" ) {
 
  608                         typeSize = 
sizeof( 
signed short );
 
  609                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
signed short *)varPtr) ), varPtr, typeSize );
 
  611                 } 
else if ( token == 
"int" ) {
 
  613                         typeSize = 
sizeof( 
signed int );
 
  614                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
signed int *)varPtr) ), varPtr, typeSize );
 
  616                 } 
else if ( token == 
"long" ) {
 
  618                         typeSize = 
sizeof( 
signed long );
 
  619                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%ld", *((
signed long *)varPtr) ), varPtr, typeSize );
 
  623                         Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), varPtr, 0 );
 
  627         } 
else if ( token == 
"unsigned" ) {
 
  630                         Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), varPtr, 0 );
 
  633                 if ( token == 
"char" ) {
 
  635                         typeSize = 
sizeof( 
unsigned char );
 
  636                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
unsigned char *)varPtr) ), varPtr, typeSize );
 
  638                 } 
else if ( token == 
"short" ) {
 
  640                         typeSize = 
sizeof( 
unsigned short );
 
  641                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
unsigned short *)varPtr) ), varPtr, typeSize );
 
  643                 } 
else if ( token == 
"int" ) {
 
  645                         typeSize = 
sizeof( 
unsigned int );
 
  646                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
unsigned int *)varPtr) ), varPtr, typeSize );
 
  648                 } 
else if ( token == 
"long" ) {
 
  650                         typeSize = 
sizeof( 
unsigned long );
 
  651                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%lu", *((
unsigned long *)varPtr) ), varPtr, typeSize );
 
  655                         Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), varPtr, 0 );
 
  659         } 
else if ( token == 
"byte" ) {
 
  661                 typeSize = 
sizeof( 
byte );
 
  662                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
byte *)varPtr) ), varPtr, typeSize );
 
  664         } 
else if ( token == 
"word" ) {
 
  666                 typeSize = 
sizeof( 
word );
 
  667                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
word *)varPtr) ), varPtr, typeSize );
 
  669         } 
else if ( token == 
"dword" ) {
 
  671                 typeSize = 
sizeof( 
dword );
 
  672                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
dword *)varPtr) ), varPtr, typeSize );
 
  674         } 
else if ( token == 
"bool" ) {
 
  676                 typeSize = 
sizeof( 
bool );
 
  677                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
bool *)varPtr) ), varPtr, typeSize );
 
  679         } 
else if ( token == 
"char" ) {
 
  681                 typeSize = 
sizeof( char );
 
  682                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
char *)varPtr) ), varPtr, typeSize );
 
  684         } 
else if ( token == 
"short" ) {
 
  686                 typeSize = 
sizeof( short );
 
  687                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
short *)varPtr) ), varPtr, typeSize );
 
  689         } 
else if ( token == 
"int" ) {
 
  691                 typeSize = 
sizeof( 
int );
 
  692                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
int *)varPtr) ), varPtr, typeSize );
 
  694         } 
else if ( token == 
"long" ) {
 
  696                 typeSize = 
sizeof( long );
 
  697                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%ld", *((
long *)varPtr) ), varPtr, typeSize );
 
  699         } 
else if ( token == 
"float" ) {
 
  701                 typeSize = 
sizeof( 
float );
 
  702                 Write( varName, varType, scope, prefix, 
"", 
idStr( *((
float *)varPtr) ).c_str(), varPtr, typeSize );
 
  704         } 
else if ( token == 
"double" ) {
 
  706                 typeSize = 
sizeof( double );
 
  707                 Write( varName, varType, scope, prefix, 
"", 
idStr( (
float)*((
double *)varPtr) ).c_str(), varPtr, typeSize );
 
  709         } 
else if ( token == 
"idVec2" ) {
 
  711                 typeSize = 
sizeof( 
idVec2 );
 
  712                 Write( varName, varType, scope, prefix, 
"", ((
idVec2 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  714         } 
else if ( token == 
"idVec3" ) {
 
  716                 typeSize = 
sizeof( 
idVec3 );
 
  717                 Write( varName, varType, scope, prefix, 
"", ((
idVec3 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  719         } 
else if ( token == 
"idVec4" ) {
 
  721                 typeSize = 
sizeof( 
idVec4 );
 
  722                 Write( varName, varType, scope, prefix, 
"", ((
idVec4 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  724         } 
else if ( token == 
"idVec5" ) {
 
  726                 typeSize = 
sizeof( 
idVec5 );
 
  727                 Write( varName, varType, scope, prefix, 
"", ((
idVec5 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  729         } 
else if ( token == 
"idVec6" ) {
 
  731                 typeSize = 
sizeof( 
idVec6 );
 
  732                 Write( varName, varType, scope, prefix, 
"", ((
idVec6 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  734         } 
else if ( token == 
"idVecX" ) {
 
  740                         Write( varName, varType, scope, prefix, 
"", 
"<NULL>", varPtr, 0 );
 
  742                 typeSize = 
sizeof( 
idVecX );
 
  744         } 
else if ( token == 
"idMat2" ) {
 
  746                 typeSize = 
sizeof( 
idMat2 );
 
  747                 Write( varName, varType, scope, prefix, 
"", ((
idMat2 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  749         } 
else if ( token == 
"idMat3" ) {
 
  751                 typeSize = 
sizeof( 
idMat3 );
 
  752                 Write( varName, varType, scope, prefix, 
"", ((
idMat3 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  754         } 
else if ( token == 
"idMat4" ) {
 
  756                 typeSize = 
sizeof( 
idMat4 );
 
  757                 Write( varName, varType, scope, prefix, 
"", ((
idMat4 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  759         } 
else if ( token == 
"idMat5" ) {
 
  761                 typeSize = 
sizeof( 
idMat5 );
 
  762                 Write( varName, varType, scope, prefix, 
"", ((
idMat5 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  764         } 
else if ( token == 
"idMat6" ) {
 
  766                 typeSize = 
sizeof( 
idMat6 );
 
  767                 Write( varName, varType, scope, prefix, 
"", ((
idMat6 *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  769         } 
else if ( token == 
"idMatX" ) {
 
  771                 typeSize = 
sizeof( 
idMatX );
 
  776                         Write( varName, varType, scope, prefix, 
"", 
"<NULL>", 
NULL, 0 );
 
  779         } 
else if ( token == 
"idAngles" ) {
 
  782                 Write( varName, varType, scope, prefix, 
"", ((
idAngles *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  784         } 
else if ( token == 
"idQuat" ) {
 
  786                 typeSize = 
sizeof( 
idQuat );
 
  787                 Write( varName, varType, scope, prefix, 
"", ((
idQuat *)varPtr)->ToString( 8 ), varPtr, typeSize );
 
  789         } 
else if ( token == 
"idBounds" ) {
 
  794                         Write( varName, varType, scope, prefix, 
"", 
"<cleared>", varPtr, typeSize );
 
  796                         Write( varName, varType, scope, prefix, 
"", 
va( 
"(%s)-(%s)", (*bounds)[0].ToString( 8 ), (*bounds)[1].ToString( 8 ) ), varPtr, typeSize );
 
  799         } 
else if ( token == 
"idList" ) {
 
  802                 Write( varName, varType, scope, prefix, 
".num", 
va( 
"%d", list->
Num() ), 
NULL, 0 );
 
  808                         void *listVarPtr = list->
Ptr();
 
  809                         for ( i = 0; i < list->
Num(); i++ ) {
 
  810                                 idStr listVarName = 
va( 
"%s[%d]", varName, i );
 
  811                                 int size = 
WriteVariable_r( listVarPtr, listVarName, templateArgs, scope, prefix, pointerDepth );
 
  815                                 listVarPtr = (
void *)( ( (
byte *) listVarPtr ) + 
size );
 
  821         } 
else if ( token == 
"idStaticList" ) {
 
  824                 Write( varName, varType, scope, prefix, 
".num", 
va( 
"%d", list->
Num() ), 
NULL, 0 );
 
  828                         void *listVarPtr = list->
Ptr();
 
  829                         for ( i = 0; i < list->
Num(); i++ ) {
 
  830                                 idStr listVarName = 
va( 
"%s[%d]", varName, i );
 
  831                                 int size = 
WriteVariable_r( listVarPtr, listVarName, templateArgs, scope, prefix, pointerDepth );
 
  836                                 listVarPtr = (
void *)( ( (
byte *) listVarPtr ) + 
size );
 
  840                 typeSize = 
sizeof( 
int ) + totalSize;
 
  842         } 
else if ( token == 
"idLinkList" ) {
 
  846                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), 
NULL, 0 );
 
  848         } 
else if ( token == 
"idStr" ) {
 
  850                 typeSize = 
sizeof( 
idStr );
 
  855         } 
else if ( token == 
"idStrList" ) {
 
  861                         for ( i = 0; i < list->
Num(); i++ ) {
 
  862                                 Write( varName, varType, scope, prefix, 
va(
"[%d]", i ), 
OutputString( (*list)[i].c_str() ), (*list)[i].c_str(), (*list)[i].Length() );
 
  865                         Write( varName, varType, scope, prefix, 
"", 
"<empty>", 
NULL, 0 );
 
  868         } 
else if ( token == 
"idDict" ) {
 
  870                 typeSize = 
sizeof( 
idDict );
 
  876                                 Write( varName, varType, scope, prefix, 
va(
"[%d]", i ), 
va( 
"\'%s\'  \'%s\'", 
OutputString( kv->
GetKey().
c_str() ), 
OutputString( kv->
GetValue().
c_str() ) ), 
NULL, 0 );
 
  879                         Write( varName, varType, scope, prefix, 
"", 
"<empty>", 
NULL, 0 );
 
  882         } 
else if ( token == 
"idExtrapolate" ) {
 
  890                         if ( templateArgs == 
"int" ) {
 
  894                                 Write( varName, varType, scope, prefix, 
".speed", 
idStr( interpolate->
GetSpeed() ).c_str(), &interpolate->
speed, 
sizeof( interpolate->
speed ) );
 
  896                         } 
else if ( templateArgs == 
"float" ) {
 
  900                                 Write( varName, varType, scope, prefix, 
".speed", 
idStr( interpolate->
GetSpeed() ).c_str(), &interpolate->
speed, 
sizeof( interpolate->
speed ) );
 
  902                         } 
else if ( templateArgs == 
"idVec3" ) {
 
  908                         } 
else if ( templateArgs == 
"idAngles" ) {
 
  915                                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown template argument type '%s' for idExtrapolate>", templateArgs.
c_str() ), 
NULL, 0 );
 
  919         } 
else if ( token == 
"idInterpolate" ) {
 
  926                         if ( templateArgs == 
"int" ) {
 
  931                         } 
else if ( templateArgs == 
"float" ) {
 
  937                                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown template argument type '%s' for idInterpolate>", templateArgs.
c_str() ), 
NULL, 0 );
 
  941         } 
else if ( token == 
"idInterpolateAccelDecelLinear" ) {
 
  950                         if ( templateArgs == 
"int" ) {
 
  955                         } 
else if ( templateArgs == 
"float" ) {
 
  961                                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown template argument type '%s' for idInterpolateAccelDecelLinear>", templateArgs.
c_str() ), 
NULL, 0 );
 
  965         } 
else if ( token == 
"idInterpolateAccelDecelSine" ) {
 
  974                         if ( templateArgs == 
"int" ) {
 
  979                         } 
else if ( templateArgs == 
"float" ) {
 
  985                                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown template argument type '%s' for idInterpolateAccelDecelSine>", templateArgs.
c_str() ), 
NULL, 0 );
 
  989         } 
else if ( token == 
"idUserInterface" ) {
 
  993                 Write( varName, varType, scope, prefix, 
"", gui->
Name(), varPtr, 
sizeof( varPtr ) );
 
  995         } 
else if ( token == 
"idRenderModel" ) {
 
  999                 Write( varName, varType, scope, prefix, 
"", model->
Name(), varPtr, 
sizeof( varPtr ) );
 
 1001         } 
else if ( token == 
"qhandle_t" ) {
 
 1003                 typeSize = 
sizeof( 
int );
 
 1004                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
int *)varPtr) ), varPtr, typeSize );
 
 1006         } 
else if ( token == 
"cmHandle_t" ) {
 
 1008                 typeSize = 
sizeof( 
int );
 
 1009                 Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
int *)varPtr) ), varPtr, typeSize );
 
 1011         } 
else if ( token == 
"idEntityPtr" ) {
 
 1018                         Write( varName, varType, scope, prefix, 
".", 
va( 
"entity %d: \'%s\'", entity->
entityNumber, entity->
name.
c_str() ), varPtr, typeSize );
 
 1020                         Write( varName, varType, scope, prefix, 
"", 
"<NULL>", varPtr, typeSize );
 
 1023         } 
else if ( token == 
"idEntity::entityFlags_s" ) {
 
 1026                 Write( varName, varType, scope, prefix, 
".notarget", flags->
notarget ? 
"true" : 
"false", 
NULL, 0 );
 
 1027                 Write( varName, varType, scope, prefix, 
".noknockback", flags->
noknockback ? 
"true" : 
"false", 
NULL, 0 );
 
 1028                 Write( varName, varType, scope, prefix, 
".takedamage", flags->
takedamage ? 
"true" : 
"false", 
NULL, 0 );
 
 1029                 Write( varName, varType, scope, prefix, 
".hidden", flags->
hidden ? 
"true" : 
"false", 
NULL, 0 );
 
 1030                 Write( varName, varType, scope, prefix, 
".bindOrientated", flags->
bindOrientated ? 
"true" : 
"false", 
NULL, 0 );
 
 1031                 Write( varName, varType, scope, prefix, 
".solidForTeam", flags->
solidForTeam ? 
"true" : 
"false", 
NULL, 0 );
 
 1033                 Write( varName, varType, scope, prefix, 
".selected", flags->
selected ? 
"true" : 
"false", 
NULL, 0 );
 
 1034                 Write( varName, varType, scope, prefix, 
".neverDormant", flags->
neverDormant ? 
"true" : 
"false", 
NULL, 0 );
 
 1035                 Write( varName, varType, scope, prefix, 
".isDormant", flags->
isDormant ? 
"true" : 
"false", 
NULL, 0 );
 
 1036                 Write( varName, varType, scope, prefix, 
".hasAwakened", flags->
hasAwakened ? 
"true" : 
"false", 
NULL, 0 );
 
 1037                 Write( varName, varType, scope, prefix, 
".networkSync", flags->
networkSync ? 
"true" : 
"false", 
NULL, 0 );
 
 1040         } 
else if ( token == 
"idScriptBool" ) {
 
 1046                         Write( varName, varType, scope, prefix, 
"", ( *scriptBool != 0 ) ? 
"true" : 
"false", varPtr, typeSize );
 
 1048                         Write( varName, varType, scope, prefix, 
"", 
"<not linked>", varPtr, typeSize );
 
 1054                 if ( classTypeInfo == 
NULL ) {
 
 1057                 if ( classTypeInfo != 
NULL ) {
 
 1059                         typeSize = classTypeInfo->
size;
 
 1063                                 char newPrefix[1024];
 
 1064                                 idStr::snPrintf( newPrefix, 
sizeof( newPrefix ), 
"%s%s::%s.", prefix, scope, varName );
 
 1065                                 WriteClass_r( varPtr, 
"", token, token, newPrefix, pointerDepth );
 
 1067                         } 
else if ( token == 
"idAnim" ) {
 
 1070                                 Write( varName, varType, scope, prefix, 
"", anim->
Name(), 
NULL, 0 );
 
 1072                         } 
else if ( token == 
"idPhysics" ) {
 
 1087                         } 
else if ( pointerDepth == 0 && (
 
 1088                                                 token == 
"idAFBody" ||
 
 1089                                                 token == 
"idAFTree" ||
 
 1090                                                 token == 
"idClipModel" ||
 
 1094                                 char newPrefix[1024];
 
 1095                                 idStr::snPrintf( newPrefix, 
sizeof( newPrefix ), 
"%s%s::%s->", prefix, scope, varName );
 
 1096                                 WriteClass_r( varPtr, 
"", token, token, newPrefix, pointerDepth + 1 );
 
 1100                                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<pointer type '%s' not listed>", varType ), 
NULL, 0 );
 
 1105                         if ( enumTypeInfo == 
NULL ) {
 
 1108                         if ( enumTypeInfo != 
NULL ) {
 
 1110                                 typeSize = 
sizeof( 
int );       
 
 1113                                         if ( *((
int *)varPtr) == enumTypeInfo->
values[
i].
value ) {
 
 1120                                         Write( varName, varType, scope, prefix, 
"", 
va( 
"%d", *((
int *)varPtr) ), 
NULL, 0 );
 
 1124                                 Write( varName, varType, scope, prefix, 
"", 
va( 
"<unknown type '%s'>", varType ), 
NULL, 0 );
 
 1132                 if ( *((
unsigned long *)varPtr) == 0xcdcdcdcd ) {
 
 1133                         common->
Warning( 
"%s%s::%s%s uses uninitialized memory", prefix, scope, varName, 
"" );
 
 1136         } 
while( ++i < typeSize );
 
 1139                 return sizeof( 
void * );
 
 1149 void idTypeInfoTools::WriteClass_r( 
const void *classPtr, 
const char *className, 
const char *classType, 
const char *scope, 
const char *prefix, 
const int pointerDepth ) {
 
 1163                 void *varPtr = (
void *) (((
byte *)classPtr) + classVar.
offset);
 
 1187 #ifdef DUMP_GAMELOCAL 
 1197                 if ( ent == 
NULL ) {
 
 1223         if ( !
src->LoadFile( fileName ) ) {
 
 1233 #ifdef DUMP_GAMELOCAL 
 1235         if ( !
src->ExpectTokenString( 
"gameLocal" ) || !
src->ExpectTokenString( 
"{" ) ) {
 
 1243         if ( !
src->ExpectTokenString( 
"}" ) ) {
 
 1251         while( 
src->ReadToken( &token ) ) {
 
 1252                 if ( token != 
"entity" ) {
 
 1262                         src->Warning( 
"entity number %d out of range", entityNum );
 
 1270                         src->Warning( 
"entity %d is not spawned", entityNum );
 
 1271                         src->SkipBracedSection( 
true );
 
 1275                 if ( !
src->ExpectTokenType( 
TT_NAME, 0, &token ) ) {
 
 1280                         src->Warning( 
"entity %d has wrong type", entityNum );
 
 1281                         src->SkipBracedSection( 
true );
 
 1285                 if ( !
src->ExpectTokenString( 
"{" ) ) {
 
 1286                         src->Warning( 
"entity %d missing leading {", entityNum );
 
 1292                 if ( !
src->SkipBracedSection( 
false ) ) {
 
 1293                         src->Warning( 
"entity %d missing trailing }", entityNum );
 
 1310         if ( args.
Argc() > 1 ) {
 
 1311                 fileName = args.
Argv(1);
 
 1313                 fileName = 
"GameState.txt";
 
 1328         if ( args.
Argc() > 1 ) {
 
 1329                 fileName = args.
Argv(1);
 
 1331                 fileName = 
"GameState.txt";
 
 1346         if ( args.
Argc() <= 1 ) {
 
 1351         name = args.
Argv( 1 );
 
 1380 void PrintType( 
const void *typePtr, 
const char *typeName ) {
 
 1399         return idStr::Icmp( classTypeInfo[*a].typeName, classTypeInfo[*b].typeName );
 
 1403         if ( classTypeInfo[*a].
size < classTypeInfo[*b].
size ) {
 
 1406         if ( classTypeInfo[*a].size > classTypeInfo[*b].size ) {
 
 1416         common->
Printf( 
"%-32s : %-32s size (B)\n", 
"type name", 
"super type name" );
 
 1417         for ( i = 0; classTypeInfo[
i].typeName != 
NULL; i++ ) {
 
 1427         for ( i = 0; classTypeInfo[
i].typeName != 
NULL; i++ ) {
 
 1429                 common->
Printf( 
"%-32s : %-32s %d\n", classTypeInfo[j].typeName, classTypeInfo[j].superType, classTypeInfo[j].
size );
 
int CheckTokenString(const char *string)
 
static int snPrintf(char *dest, int size, const char *fmt,...) id_attribute((format(printf
 
GLsizei const GLfloat * value
 
void WriteGameState_f(const idCmdArgs &args)
 
idStr & SetFileExtension(const char *extension)
 
const type & GetEndValue(void) const 
 
int Cmp(const char *text) const 
 
static idTypeInfo * GetType(int num)
 
void Printf(const char *fmt,...) const id_attribute((format(printf
 
type * GetEntity(void) const 
 
const idStr & GetKey(void) const 
 
const char * ToString(int precision=2) const 
 
void WriteTypeToFile(idFile *fp, const void *typePtr, const char *typeName)
 
const type & GetStartValue(void) const 
 
int GetGranularity(void) const 
 
void TestSaveGame_f(const idCmdArgs &args)
 
void StripTrailing(const char c)
 
idFileSystem * fileSystem
 
const enumValueInfo_t * values
 
const classVariableInfo_t * variables
 
const char * GetName(void) const 
 
virtual const char * Name() const =0
 
float GetDeceleration(void) const 
 
float GetDuration(void) const 
 
float GetAcceleration(void) const 
 
const type & GetEndValue(void) const 
 
int Icmp(const char *text) const 
 
const type & GetEndValue(void) const 
 
int SortTypeInfoBySize(const int *a, const int *b)
 
const type & GetStartValue(void) const 
 
int Icmpn(const char *text, int n) const 
 
virtual void BufferCommandText(cmdExecution_t exec, const char *text)=0
 
void PrintType(const void *typePtr, const char *typeName)
 
void Sort(cmp_t *compare=(cmp_t *)&idListSortCompare< type >)
 
int ExpectTokenType(int type, int subtype, idToken *token)
 
int GetNumColumns(void) const 
 
float GetDeceleration(void) const 
 
void ListTypeInfo_f(const idCmdArgs &args)
 
const char * GetTypeVariableName(const char *typeName, int offset)
 
void(* WriteVariableType_t)(const char *varName, const char *varType, const char *scope, const char *prefix, const char *postfix, const char *value, const void *varPtr, int varSize)
 
const char * ToString(int precision=2) const 
 
float GetStartTime(void) const 
 
const float * ToFloatPtr(void) const 
 
float GetStartTime(void) const 
 
virtual idFile * OpenFileWrite(const char *relativePath, const char *basePath="fs_savepath")=0
 
const char * ToString(int precision=2) const 
 
virtual const char * Name() const =0
 
int GetNumRows(void) const 
 
const idStr & GetValue(void) const 
 
void CompareGameState_f(const idCmdArgs &args)
 
bool IsLinked(void) const 
 
virtual int WriteFloatString(const char *fmt,...) id_attribute((format(printf
 
GLubyte GLubyte GLubyte a
 
virtual void Printf(const char *fmt,...) id_attribute((format(printf
 
const char * Name(void) const 
 
int LoadMemory(const char *ptr, int length, const char *name, int startLine=1)
 
float GetAcceleration(void) const 
 
bool IsRenderHandleVariable(const char *varName, const char *varType, const char *scope, const char *prefix, const char *postfix, const char *value)
 
idList< idStr > idStrList
 
const char * ToString(int precision=2) const 
 
idEntity * entities[MAX_GENTITIES]
 
const type & GetStartValue(void) const 
 
int ExpectTokenString(const char *string)
 
static int FindChar(const char *str, const char c, int start=0, int end=-1)
 
int Append(const type &obj)
 
void InitTypeVariables(const void *typePtr, const char *typeName, int value)
 
bool IsCleared(void) const 
 
float GetStartTime(void) const 
 
idScriptVariable< int, ev_boolean, int > idScriptBool
 
bool IsAllowedToChangedFromSaveGames(const char *varName, const char *varType, const char *scope, const char *prefix, const char *postfix, const char *value)
 
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
 
const char * c_str(void) const 
 
int SortTypeInfoByName(const int *a, const int *b)
 
const idKeyValue * GetKeyVal(int index) const 
 
const char * Argv(int arg) const 
 
char * va(const char *fmt,...)
 
virtual void CloseFile(idFile *f)=0
 
void Replace(const char *old, const char *nw)
 
const float * ToFloatPtr(void) const 
 
int GetNumKeyVals(void) const 
 
virtual void virtual void Warning(const char *fmt,...) id_attribute((format(printf
 
int ReadToken(idToken *token)