geBoolean AProject_AddMotion
	(
	  AProject *pProject,
	  const char *MotionName,
	  const char *Filename,
	  const ApjMotionFormat Fmt,
	  const geBoolean OptFlag,
	  const int OptLevel,
	  const char *BoneName,
	  int *pIndex	// returned index
	)
{
	ApjMotionEntry *pEntry;
	int ArraySize;

	assert ((OptLevel >= 0) && (OptLevel <= 9));
	assert ((Fmt > ApjMotion_Invalid) && (Fmt < ApjMotion_TypeCount));

	ArraySize = Array_GetSize (pProject->Motions.Items);
	if (pProject->Motions.Count == ArraySize)
	{
		// array is full, have to extend it
		int NewSize;
		
		NewSize = Array_Resize (pProject->Motions.Items, 2*ArraySize);
		if (NewSize <= ArraySize)
		{
			// couldn't resize
			geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Adding Motion",NULL);
			return GE_FALSE;
		}
	}
	pEntry = Array_ItemPtr (pProject->Motions.Items, pProject->Motions.Count);
	pEntry->Name = NULL;
	pEntry->Filename = NULL;
	pEntry->Bone = NULL;
	pEntry->Fmt = Fmt;

	if (((pEntry->Name = Util_Strdup (MotionName)) == NULL) ||
		((pEntry->Filename = Util_Strdup (Filename)) == NULL) ||
		((pEntry->Bone = Util_Strdup (BoneName)) == NULL))
	{
		geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Adding Motion",NULL);
		AProject_FreeMotionInfo (pEntry);
		return GE_FALSE;
	}
	pEntry->OptFlag = OptFlag;
	pEntry->OptLevel = OptLevel;

	*pIndex = (pProject->Motions.Count)++;
	return GE_TRUE;
}
geBoolean AProject_AddMaterial
	(
	  AProject *pProject,
	  const char *MaterialName,
	  const ApjMaterialFormat Fmt,
	  const char *TextureFilename,
	  const float Red, const float Green, const float Blue, const float Alpha,
	  int *pIndex		// returned index
	)
{
	ApjMaterialEntry *pEntry;
	int ArraySize;

	assert ((Fmt == ApjMaterial_Color) || (Fmt == ApjMaterial_Texture));

	ArraySize = Array_GetSize (pProject->Materials.Items);
	if (pProject->Materials.Count == ArraySize)
	{
		// array is full, have to extend it
		int NewSize;
		
		NewSize = Array_Resize (pProject->Materials.Items, 2*ArraySize);
		if (NewSize <= ArraySize)
		{
			// couldn't resize
			geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Adding material",NULL);
			return GE_FALSE;
		}
	}
	pEntry = Array_ItemPtr (pProject->Materials.Items, pProject->Materials.Count);
	pEntry->Name = NULL;
	pEntry->Filename = NULL;

	if (((pEntry->Name = Util_Strdup (MaterialName)) == NULL) ||
		((pEntry->Filename = Util_Strdup (TextureFilename)) == NULL))
	{
		geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Adding material",NULL);
		AProject_FreeMaterialInfo (pEntry);
		return GE_FALSE;
	}
	pEntry->Fmt = Fmt;
	pEntry->Color.r = Red;
	pEntry->Color.g = Green;
	pEntry->Color.b = Blue;
	pEntry->Color.a = Alpha;

	*pIndex = (pProject->Materials.Count)++;
	return GE_TRUE;
}
Group *Group_Create
	(
	  int id,
	  char const *pName
	)
{
	Group *pGroup;
	
	assert (pName != NULL);

	pGroup = (Group *)geRam_Allocate (sizeof (Group));
	if (pGroup != NULL)
	{
		pGroup->Visible = TRUE;
		pGroup->Locked = FALSE ;
		pGroup->GroupId = id;
		pGroup->GroupName = Util_Strdup (pName);
		pGroup->Color.r = 255.0 ;
		pGroup->Color.g = 255.0 ;
		pGroup->Color.b = 255.0 ;
		pGroup->Color.a = 255.0 ;
		pGroup->Next = NULL;
	}
	return pGroup;
}
Exemple #4
0
/*@@
  @routine    ActivateImp
  @date       Mon May 21 22:09:47 2001
  @author     Tom Goodale
  @desc
  Activate one implementation - assumes all error checking done by calling routine.
  @enddesc
  @calls
  @calledby
  @history

  @endhistory
  @var     implementation
  @vdesc   Name of implementation to activate
  @vtype   const char *
  @vio     in
  @vcomment

  @endvar
  @var     thorn
  @vdesc   Name of thorn activating this imp
  @vtype   const char *
  @vio     in
  @vcomment

  @endvar

  @returntype int
  @returndesc
  0  - success
  -1 - can't find implementation
  @endreturndesc
@@*/
static int ActivateImp(const char *implementation, const char *thorn)
{
    int retval;
    t_sktree *impnode;

    struct IMPLEMENTATION *imp;

    /* Find the implementation */
    impnode = SKTreeFindNode(implist, implementation);

    if(impnode)
    {
        imp = (struct IMPLEMENTATION *)(impnode->data);

        imp->active = 1;
        /* Remember which thorn activated this imp. */
        imp->activating_thorn = Util_Strdup(thorn);
        retval = 0;
    }
    else
    {
        retval = -1;
    }

    return retval;
}
void Group_SetGroupName (Group *g, const char *pName)
{
	assert (g != NULL);
	assert (pName != NULL);

	if (g->GroupName != NULL)
	{
		geRam_Free (g->GroupName);
	}
	g->GroupName = Util_Strdup (pName);
}
static void stripQuotes
	(
	  CString &str
	)
{
	char *temp = Util_Strdup (str);
	
	if (*temp == '"')
	{
	    strcpy (temp, temp+1);
	}
	if (temp[strlen (temp) - 1] == '"')
	{
		temp[strlen (temp) - 1] = '\0';
	}
	str = temp;

	geRam_Free (temp);
}
geBoolean Util_SetString (char **ppString, const char *NewValue)
{
	char *pNewString;

	if (NewValue == NULL)
	{
		pNewString = NULL;
	}
	else 
	{
		pNewString = Util_Strdup (NewValue);
		if (pNewString == NULL)
		{
			return GE_FALSE;
		}
	}
	if (*ppString != NULL)
	{
		geRam_Free (*ppString);
	}
	*ppString = pNewString;

	return GE_TRUE;
}
// Create empty project
AProject *AProject_Create (const char *OutputName)
{
	AProject *pProject;
	geBoolean NoErrors;
	char OutputNameAndExt[MAX_PATH];

	assert (OutputName != NULL);

	pProject = GE_RAM_ALLOCATE_STRUCT (AProject);
	if (pProject == NULL)
	{
		geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Allocating project structure",NULL);
		return NULL;
	}

	// Initialize defaults
	// Output
	pProject->Output.Filename = NULL;
	pProject->Output.Fmt = ApjOutput_Binary;

	// Paths
	pProject->Paths.ForceRelative = GE_TRUE;
	pProject->Paths.Materials = NULL;

	// Body
	pProject->Body.Filename = NULL;
	pProject->Body.Fmt = ApjBody_Max;

	// Materials
	pProject->Materials.Count = 0;
	pProject->Materials.Items = NULL;

	// Motions
	pProject->Motions.Count = 0;
	pProject->Motions.Items = NULL;

	FilePath_SetExt (OutputName, ".act", OutputNameAndExt);

	// Allocate required memory
	NoErrors = 
		((pProject->Output.Filename = Util_Strdup (OutputNameAndExt)) != NULL) &&
		((pProject->Paths.Materials = Util_Strdup ("")) != NULL) &&
		((pProject->Paths.TempFiles = Util_Strdup (".\\BldTemp")) != NULL) &&
		((pProject->Body.Filename	= Util_Strdup ("")) != NULL);
		
	// Build motion and material arrays.  Initially empty.
	NoErrors = NoErrors &&
		((pProject->Materials.Items = Array_Create (1, sizeof (ApjMaterialEntry))) != NULL);

	NoErrors = NoErrors &&
		((pProject->Motions.Items = Array_Create (1, sizeof (ApjMotionEntry))) != NULL);

	// if unsuccessful, destroy any allocated data
	if (!NoErrors)
	{
		geErrorLog_AddString (GE_ERR_MEMORY_RESOURCE, "Initializing project structure",NULL);
		if (pProject != NULL)
		{
			AProject_Destroy (&pProject);
		}
	}

	return pProject;
}
Exemple #9
0
/*@@
  @routine    CCTKi_ActivateThorn
  @date       Sun Jul  4 17:46:15 1999
  @author     Tom Goodale
  @desc
  Activates a thorn and the associated implementation assuming
  the implementation isn't already active.
  @enddesc
  @calls
  @calledby
  @history

  @endhistory
  @var     name
  @vdesc   Name of thorn to activate
  @vtype   const char *
  @vio     in
  @vcomment

  @endvar

  @returntype int
  @returndesc
   0 - success
  -1 - non-existent thorn
  -2 - internal error
  -3 - thorn already active
  -4 - implementation already active
  @endreturndesc
@@*/
int CCTKi_ActivateThorn(const char *name)
{
    int retval;
    t_sktree *thornnode;
    t_sktree *impnode;

    struct THORN *thorn;
    struct IMPLEMENTATION *imp;

    printf("Activating thorn %s...", name);

    /* Find the thorn */
    thornnode = SKTreeFindNode(thornlist, name);

    if(thornnode)
    {
        thorn = (struct THORN *)(thornnode->data);

        /* Find the implementation */
        impnode = SKTreeFindNode(implist, thorn->implementation);

        if(impnode)
        {
            imp = (struct IMPLEMENTATION *)(impnode->data);

            if(!thorn->active)
            {
                if(!imp->active)
                {
                    /* Activate the thorn. */
                    printf("Success -> active implementation %s\n", thorn->implementation);
                    thorn->active = 1;
                    imp->active = 1;
                    /* Remember which thorn activated this imp. */
                    imp->activating_thorn = Util_Strdup(name);
                    retval = 0;
                }
                else
                {
                    printf("Failure -> Implementation %s already activated by %s\n", thorn->implementation, imp->activating_thorn);
                    retval = -4;
                }
            }
            else
            {
                printf("Failure -> Thorn %s already active\n", name);
                retval = -3;
            }
        }
        else
        {
            printf("Internal error - can't find imp %s from thorn %s\n", thorn->implementation, name);
            retval = -2;
        }
    }
    else
    {
        printf("Failure -> non-existent thorn.\n");
        retval = -1;
    }

    return retval;

}
Exemple #10
0
/*@@
  @routine    RegisterImp
  @date       Sun Jul  4 17:44:42 1999
  @author     Tom Goodale
  @desc
  Registers an implementation.
  @enddesc
  @calls
  @calledby
  @history

  @endhistory
  @var     name
  @vdesc   name of the implementation
  @vtype   const char *
  @vio     in
  @vcomment

  @endvar
  @var     thorn
  @vdesc   name of the thorn
  @vtype   const char *
  @vio     in
  @vcomment

  @endvar
  @var     ancestors
  @vdesc   ancestors of the implementation
  @vtype   const char **
  @vio     in
  @vcomment

  @endvar
  @var     friends
  @vdesc   friends of the implementation
  @vtype   const char **
  @vio     in
  @vcomment

  @endvar

  @returntype int
  @returndesc
   0 - success
  -1 - failed to store thorn in implementation
  -2 - memory failure creating implementation
  -3 - failed to store implementtion in tree
  @endreturndesc
@@*/
static int RegisterImp(const char *name,
                       const char *thorn,
                       const char **ancestors,
                       const char **friends)
{
    int retval;
    int count;
    t_sktree *node;
    t_sktree *temp;

    struct IMPLEMENTATION *imp;

    /* Does the implementation already exist ? */
    node = SKTreeFindNode(implist, name);

    if(!node)
    {
        n_imps++;

        /* Create the structure to hold info about it. */
        imp = (struct IMPLEMENTATION *)malloc(sizeof(struct IMPLEMENTATION));

        if(imp)
        {
            imp->active = 0;

            /* Store the name of this thorn in a tree */
            imp->thornlist = SKTreeStoreData(NULL,NULL, thorn, NULL);

            /* Store the info in the tree. */
            temp = SKTreeStoreData(implist, implist, name, imp);

            if(!implist) implist = temp;

            if(temp)
            {
                retval = 0;
            }
            else
            {
                retval = -3;
            }

            if(!retval)
            {
                /* Count the ancestors */
                for(count=0; ancestors[count]; count++);

                imp->n_ancestors = count;
                imp->ancestors = (char **)malloc((count+1)*sizeof(char *));

                if(imp->ancestors)
                {
                    for(count=0; ancestors[count]; count++)
                    {
                        imp->ancestors[count] = Util_Strdup(ancestors[count]);
                    }
                    imp->ancestors[count] = NULL;

                    qsort(imp->ancestors, count, sizeof(char *), CompareStrings);

                }

                /* Count the friends */
                for(count=0; friends[count]; count++);

                imp->n_friends = count;
                imp->friends = (char **)malloc((count+1)*sizeof(char *));

                if(imp->friends)
                {
                    for(count=0; friends[count]; count++)
                    {
                        imp->friends[count] = Util_Strdup(friends[count]);
                    }
                    imp->friends[count] = NULL;

                    qsort(imp->friends, count, sizeof(char *), CompareStrings);
                }
            }
        }
        else
        {
            retval = -2;
        }
    }
    else
    {
        imp = (struct IMPLEMENTATION *)(node->data);
        SKTreeStoreData(imp->thornlist,imp->thornlist, thorn, NULL);

        retval = -1;
    }

    return retval;
}
Exemple #11
0
/*@@
  @routine    CCTKi_RegisterThorn
  @date       Sun Jul  4 17:44:14 1999
  @author     Tom Goodale
  @desc
  Registers a thorn with the flesh.
  @enddesc
  @calls
  @calledby
  @history

  @endhistory
  @var     attributes
  @vdesc   Thorn attributes
  @vtype   const struct iAttrributeList
  @vio     in
  @vcomment

  @endvar

  @returntype int
  @returndesc
   0 - success
  -1 - Duplicate thorn
  -2 - memory failure storing thorn
  -3 - memory failure storing implementation name
  -4 - failed to store thorn in tree
  @endreturndesc
@@*/
int CCTKi_RegisterThorn(const struct iAttributeList *attributes)
{
    int retval;
    int i;

    t_sktree *node;
    t_sktree *temp;

    struct THORN *thorn;

    const char *name;
    const char *imp;

    const char **ancestors;
    const char **friends;


    name = imp = NULL;
    ancestors = friends = NULL;

#if 0
    for(i=0; attributes[i].attribute; i++)
    {
        if(!strcmp(attributes[i].attribute, "functions"))
        {
            printf("Functions: \n");
            for(j=0; attributes[i].AttributeData.FuncList[j].keyword; j++)
            {
                printf("keyword   is %s\n", attributes[i].AttributeData.FuncList[j].keyword);
                printf("signature is %s\n", attributes[i].AttributeData.FuncList[j].signature);
                printf("pointer   is %p\n", attributes[i].AttributeData.FuncList[j].func);
            }
        }
        else
        {
            printf("attribute is %s\n", attributes[i].attribute);
            if(attributes[i].AttributeData.StringList)
            {
                for(j=0; attributes[i].AttributeData.StringList[j]; j++)
                {
                    printf("   datapoint %s\n", attributes[i].AttributeData.StringList[j]);
                }
            }
        }
    }
#endif /* 0 */

    for(i=0; attributes[i].attribute; i++)
    {
        if(!strcmp(attributes[i].attribute, "name"))
        {
            if(attributes[i].AttributeData.StringList)
            {
                name = attributes[i].AttributeData.StringList[0];
            }
        }
        else if(!strcmp(attributes[i].attribute, "implementation"))
        {
            if(attributes[i].AttributeData.StringList)
            {
                imp = attributes[i].AttributeData.StringList[0];
            }
        }
        else if(!strcmp(attributes[i].attribute, "ancestors"))
        {
            ancestors = attributes[i].AttributeData.StringList;
        }
        else if(!strcmp(attributes[i].attribute, "friends"))
        {
            friends = attributes[i].AttributeData.StringList;
        }
        else
        {
            fprintf(stderr, "Unknown/unimplemented thorn attribute %s\n", attributes[i].attribute);
        }
    }

    /*  printf("Registering thorn %s, which provides %s\n", name, imp);*/

    /* Does the thorn already exist ? */
    node = SKTreeFindNode(thornlist, name);

    if(!node)
    {
        n_thorns++;
        /* Create the structure to hold thorn info. */
        thorn = (struct THORN *)malloc(sizeof(struct THORN));

        if(thorn)
        {
            thorn->implementation = Util_Strdup(imp);

            if(thorn->implementation)
            {
                /* Fill out data for the thorn. */
                thorn->active = 0;

                /* Store the data in the tree */
                temp = SKTreeStoreData(thornlist, thornlist, name, thorn);

                if(!thornlist)
                {
                    thornlist = temp;
                }

                if(temp)
                {

                    /* Register the implementation */
                    RegisterImp(imp, name, ancestors, friends);

                    retval = 0;
                }
                else
                {
                    retval = -4;
                }
            }
            else
            {
                retval = -3;
            }
        }
        else
        {
            retval = -2;
        }
    }
    else
    {
        retval = -1;
    }

    return retval;
}
Exemple #12
0
/*@@
  @routine    CCTKi_ActivateThorns
  @date       Mon May 21 22:06:37 2001
  @author     Tom Goodale
  @desc
  Activates a list of thorns if they are self consistent.
  @enddesc
  @calls
  @calledby
  @history

  @endhistory
  @var     activethornlist
  @vdesc   The list of thorns to activate.
  @vtype   const char *
  @vio     in
  @vcomment

  @endvar

  @returntype int
  @returndesc
  -ve Number of errors encountered.
  @endreturndesc
@@*/
int CCTKi_ActivateThorns(const char *activethornlist)
{
    int retval;
    char *local_list;
    uStringList *required_thorns;
    uStringList *requested_imps;
    uStringList *required_imps;
    char *token;
    const char *this_imp;
    int n_warnings;
    int n_errors;
    t_sktree *impnode;
    t_sktree *impthornlist;

    struct IMPLEMENTATION *imp;
    int i;

    const char *imp1, *imp2;
    const char *thorn;

    local_list = Util_Strdup(activethornlist);

    required_thorns  = Util_StringListCreate(n_thorns);
    required_imps    = Util_StringListCreate(n_imps);
    requested_imps   = Util_StringListCreate(n_imps);

    printf("Activation requested for \n--->%s<---\n", activethornlist);

    n_errors = 0;
    n_warnings = 0;

    token = strtok(local_list, " \t\n");
    while(token)
    {
        if(CCTK_IsThornActive(token))
        {
            printf("Warning: thorn %s already active\n", token);
            n_warnings++;
        }
        else if(! (this_imp = CCTK_ThornImplementation(token)))
        {
            printf("Error: Thorn %s not found\n", token);
            n_errors++;
            /*  Give some more help */
            if (CCTK_IsImplementationCompiled(token))
            {
                impthornlist = CCTK_ImpThornList(token);

                printf("       However, implementation %s was found and is\n",token);
                printf("       provided by thorn(s):");
                SKTreeTraverseInorder(impthornlist,
                                      JustPrintThornName, NULL);
                printf("\n");
            }
        }
        else if(CCTK_IsImplementationActive(this_imp))
        {
            printf("Error: thorn %s provides implementation %s - already active\n", token, this_imp);
            n_errors++;
        }
        else if(! Util_StringListAdd(required_thorns,token))
        {
            printf("Warning: thorn %s already scheduled for activation\n", token);
            n_warnings++;
        }
        else if(! Util_StringListAdd(requested_imps,this_imp))
        {
            printf("Error: thorn %s provides implementation %s which is already scheduled for activation\n", token, this_imp);
            n_errors++;
        }
        else if((impnode = SKTreeFindNode(implist, this_imp)))
        {
            /* Ok, this thorn exists, and isn't active, a duplicate, or provide the same imp as another thorn
             * which is active or has just been schedule for activation, so can get on with cataloging
             * dependencies.
             */

            Util_StringListAdd(required_imps,this_imp);

            imp = (struct IMPLEMENTATION *)(impnode->data);

            /* Look at ancestors */
            for(i=0; imp->ancestors[i]; i++)
            {
                if(!CCTK_IsImplementationActive(imp->ancestors[i]))
                {
                    /* We need this imp */
                    Util_StringListAdd(required_imps, imp->ancestors[i]);
                }
            }

            /* Look at friends */
            for(i=0; imp->friends[i]; i++)
            {
                if(!CCTK_IsImplementationActive(imp->friends[i]))
                {
                    /* We need this imp */
                    Util_StringListAdd(required_imps, imp->friends[i]);
                }
            }
        }
        else
        {
            CCTK_Warn(0, __LINE__, __FILE__, "Cactus",
                      "Internal error :- please report this to [email protected]");
        }
        token = strtok(NULL," \t\n");
    }

    /* No longer need the local list */
    free(local_list);

    if(! n_errors)
    {
        /* So, let's see if we are requesting all the imps we need */

        for(imp1=Util_StringListNext(requested_imps,1),
                imp2=Util_StringListNext(required_imps,1);
                imp1&&imp2;
                imp1=Util_StringListNext(requested_imps,0),
                imp2=Util_StringListNext(required_imps,0))
        {
            do
            {
                if(Util_StrCmpi(imp1,imp2))
                {
                    printf("Error: Required implementation %s not activated.\n", imp2);
                    printf("       Add a thorn providing this implementation to ActiveThorns parameter.\n");
                    n_errors++;
                    /*  Give some more help */
                    if (CCTK_IsImplementationCompiled(imp2))
                    {
                        impthornlist = CCTK_ImpThornList(imp2);

                        printf("       This implementation is provided by compiled thorns:\n");
                        printf("          ");
                        SKTreeTraverseInorder(impthornlist,
                                              JustPrintThornName, NULL);
                        printf("\n");
                    }
                    else
                    {
                        printf("       This implementation is not provided by any "
                               "compiled thorn\n");
                    }
                }
                else
                {
                    break;
                }
            } while((imp2=Util_StringListNext(required_imps,0)));
        }
        /* Since the requested imps is a subset of the required imps,
         * we may still have some required imps to go through.
         */
        while((imp2))
        {
            printf("Error: required implementation %s not requested\n", imp2);
            printf("       Add a thorn providing this implementation to ActiveThorns parameter.\n");
            n_errors++;
            /*  Give some more help */
            if (CCTK_IsImplementationCompiled(imp2))
            {
                impthornlist = CCTK_ImpThornList(imp2);

                printf("       This implementation is provided by compiled thorns:\n");
                printf("          ");
                SKTreeTraverseInorder(impthornlist,
                                      JustPrintThornName, NULL);
                printf("\n");
            }
            else
            {
                printf("       This implementation is not provided by any "
                       "compiled thorn\n");
            }
            imp2=Util_StringListNext(required_imps,0);
        }
    }


    if(! n_errors)
    {
        /* Ok, so we have all required imps, so can activate the thorns, finally */

        for(thorn = Util_StringListNext(required_thorns, 1);
                thorn;
                thorn = Util_StringListNext(required_thorns, 0))
        {
            ActivateThorn(thorn);
        }

        retval = 0;
    }
    else
    {
        printf("Activation failed - %d errors in activation sequence\n", n_errors);
        retval = -n_errors;
    }

    Util_StringListDestroy(required_thorns);
    Util_StringListDestroy(required_imps);
    Util_StringListDestroy(requested_imps);

    return retval;
}
geBoolean CWadFile::Setup(const char *Filename)
{
	geVFile *			Library;

	geBoolean			NoErrors = GE_FALSE;

	Library = geVFile_OpenNewSystem (NULL, GE_VFILE_TYPE_VIRTUAL, Filename, NULL, GE_VFILE_OPEN_READONLY | GE_VFILE_OPEN_DIRECTORY);
	if (Library != NULL)
	{
		NoErrors = GE_TRUE;

		DestroyBitmapArray ();

		int nFiles = wadCountFiles (Library, "*.*");

		if (nFiles > 0)
		{
			// make new array and fill it with loaded bitmaps
			mBitmaps = (WadFileEntry *)geRam_Allocate (nFiles * sizeof (WadFileEntry));

			// and fill array with filenames
			NoErrors = GE_FALSE;
			geVFile_Finder *Finder = geVFile_CreateFinder (Library, "*.*");
			if (Finder != NULL)
			{
				NoErrors = GE_TRUE;
				geVFile_Properties Props;

				while (geVFile_FinderGetNextFile (Finder) != GE_FALSE)
				{
					geVFile_FinderGetProperties (Finder, &Props);

					// load the file and create a DibBitmap from it
					geVFile *BmpFile = geVFile_Open (Library, Props.Name, GE_VFILE_OPEN_READONLY);
					geBitmap *TheBitmap;

					if (BmpFile == NULL)
					{
						NoErrors = GE_FALSE;
					}
					else
					{
						TheBitmap = geBitmap_CreateFromFile (BmpFile);
						geVFile_Close (BmpFile);
						if (TheBitmap == NULL)
						{
							NoErrors = GE_FALSE;
						}
						else
						{
							if (geBitmap_SetFormat (TheBitmap, GE_PIXELFORMAT_16BIT_555_RGB, GE_FALSE, 0, NULL) != GE_FALSE)
							{
								WadFileEntry *pe;
								geBitmap_Info info, info2;

								geBitmap_GetInfo (TheBitmap, &info, &info2);
								pe = &mBitmaps[mBitmapCount];
								pe->bmp = TheBitmap;
								pe->Height = info.Height;
								pe->Width = info.Width;
								pe->Name = Util_Strdup (Props.Name);
								geBitmap_LockForReadNative (pe->bmp, &pe->LockedBitmap, 0, 0);
								pe->BitsPtr = geBitmap_GetBits (pe->LockedBitmap);

								++mBitmapCount;
							}
							else
							{
								geBitmap_Destroy (&TheBitmap);
								NoErrors = GE_FALSE;
							}
						}
					}
				}

				geVFile_DestroyFinder (Finder);
			}
		}
		geVFile_Close (Library);
	}

	return GE_TRUE;
}