Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

ENTITIES.H

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  Entities.h                                                                          */
00003 /*                                                                                      */
00004 /*  Author: Eli Boling / John Pollard                                                   */
00005 /*  Description: EntitySet creation / Entity Compiler                                   */
00006 /*                                                                                      */
00007 /*  The contents of this file are subject to the Genesis3D Public License               */
00008 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00009 /*  compliance with the License. You may obtain a copy of the License at                */
00010 /*  http://www.genesis3d.com                                                            */
00011 /*                                                                                      */
00012 /*  Software distributed under the License is distributed on an "AS IS"                 */
00013 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00014 /*  the License for the specific language governing rights and limitations              */
00015 /*  under the License.                                                                  */
00016 /*                                                                                      */
00017 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00018 /*  Genesis3D Version 1.1 released November 15, 1999                                 */
00019 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
00020 /*                                                                                      */
00021 /****************************************************************************************/
00022 #ifndef GE_ENTITIES_H
00023 #define GE_ENTITIES_H
00024 
00025 #include <Assert.h>
00026 #include <Windows.h>
00027 
00028 #include "BaseType.h"
00029 #include "Errorlog.h"
00030 #include "Vec3d.h"
00031 #include "System.h"
00032 #include "World.h"
00033 #include "Ram.h"
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 //=====================================================================================
00040 //      Defines / Structure defines
00041 //=====================================================================================
00042 // Enumerated types
00043 typedef enum
00044 {
00045         TYPE_INT,
00046         TYPE_FLOAT,
00047         TYPE_COLOR,
00048         TYPE_POINT,
00049         TYPE_STRING,
00050         TYPE_MODEL,
00051         TYPE_STRUCT,
00052         TYPE_PTR,
00053 } geEntity_ClassType;
00054 
00055 typedef struct  geEntity_Class  geEntity_Class;
00056 
00057 // Fields within a geEntity_Class
00058 typedef struct geEntity_Field
00059 {
00060         char                                    *Name;                                  // Name of the field
00061         geEntity_Class                  *TypeClass;                             // Atomic class the defines field
00062         int32                                   Offset;                                 // Offset in Entity's UserData
00063 
00064         struct geEntity_Field   *Next;                                  // Next Field list
00065 
00066 } geEntity_Field;
00067 
00068 typedef struct geEntity_Class
00069 {
00070         char                                    *Name;                                  // Class Name
00071         geEntity_ClassType              Type;                                   // Type of class
00072         int32                                   TypeSize;
00073         geEntity_Field                  *Fields;                                // Fields in this Class
00074         int32                                   FieldSize;                              // Size of all fields
00075 
00076         struct geEntity_Class   *Next;
00077 
00078 } geEntity_Class; 
00079 
00080 typedef struct geEntity_Epair
00081 {
00082         struct geEntity_Epair   *Next;
00083         char                                    *Key;
00084         char                                    *Value;
00085 } geEntity_Epair;
00086 
00087 typedef struct geEntity
00088 {
00089         geEntity_Class                  *Class;                                 // Class data
00090 
00091         geEntity_Epair                  *Epairs;                                // Parsed epair list from entity string list
00092 
00093         void                                    *UserData;                              // User structure parsed from entity
00094 } geEntity;
00095 
00096 typedef struct geEntity_EntitySet
00097 {
00098         struct geEntity_EntitySet       *Next;                          // Next entity in this set
00099         struct geEntity_EntitySet       *Current;                       // Current entity set as an iterator
00100 
00101         geBoolean                                       OwnsEntities;           // GE_TRUE if 
00102 
00103         geEntity                                        *Entity;                        // The entity
00104         geEntity_Class                          *Classes;                       // List of classes for set
00105 
00106 } geEntity_EntitySet;
00107 
00108 
00109 //=====================================================================================
00110 //      Function prototypes
00111 //=====================================================================================
00112 geBoolean       Ent_WorldInit(geWorld *World);
00113 void            Ent_WorldShutdown(geWorld *World);
00114 
00115 geEntity                                *geEntity_Create(void);
00116 void                                    geEntity_Destroy(geEntity *Entity);
00117 geBoolean                               geEntity_GetModelNumForKey(geEntity *Entity, const char *Key, int32 *ModelNum);
00118 geBoolean                               geEntity_AddEpair(geEntity *Entity, geEntity_Epair *Epair);
00119 const char                              *geEntity_GetStringForKey(const geEntity *Entity, const char *Key);
00120 geEntity_Epair                  *geEntity_EpairCreate(void);
00121 void                                    geEntity_EpairDestroy(geEntity_Epair *Epair);
00122 geEntity_Field                  *geEntity_FieldCreate(const char *Name, int32 Offset, geEntity_Class *TypeClass);
00123 void                                    geEntity_FieldDestroy(geEntity_Field *Field);
00124 geEntity_Class                  *geEntity_ClassCreate(geEntity_ClassType Type, const char *Name, int32 TypeSize);
00125 void                                    geEntity_ClassDestroy(geEntity_Class *Class);
00126 geBoolean                               geEntity_ClassAddField(geEntity_Class   *Class, geEntity_Field *Field);
00127 geEntity_Field                  *geEntity_ClassFindFieldByName(geEntity_Class *Class, const char *Name);
00128 geEntity_EntitySet              *geEntity_EntitySetCreate(void);
00129 void                                    geEntity_EntitySetDestroy(geEntity_EntitySet *EntitySet);
00130 geEntity_Class                  *geEntity_EntitySetFindClassByName(geEntity_EntitySet *Set, const char *Name);
00131 geEntity                                *geEntity_EntitySetFindEntityByName(geEntity_EntitySet *EntitySet, const char *Name);
00132 GENESISAPI void                                 geEntity_GetName(const geEntity *Entity, char *Buff, int MaxLen);
00133 geBoolean       geEntity_EntitySetAddEntity(geEntity_EntitySet *EntitySet, geEntity *Entity);
00134 GENESISAPI      geEntity        *geEntity_EntitySetGetNextEntity(geEntity_EntitySet *EntitySet, geEntity *Entity);
00135 geBoolean                               geEntity_EntitySetAddClass(geEntity_EntitySet *EntitySet, geEntity_Class *Class);
00136 geEntity_EntitySet              *LoadEntitySet(const char *EntityData, int32 EntityDataSize);
00137 
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141 
00142 #endif

Generated on Tue Sep 30 12:35:42 2003 for GTestAndEngine by doxygen 1.3.2