geEntity

Description: EntitySet creation / Entity Compiler

Source file: ...\genesis3d\OpenSource\Entities\ENTITIES.h

Contents:

Core Functions: geWorld_GetEntitySet, EntitySetGetNextEntity, GetUserData, GetName

Core Type: geEntity

[The following "other" functions and types are probably NOT available in the precompiled files]

Other Functions: WorldInit, WorldShutdown, Create, Destroy, GetModelNumForKey, AddEpair, GetStringForKey, EpairCreate, EpairDestroy, FieldCreate, FieldDestroy, ClassCreate, ClassDestroy, ClassAddField, ClassFindFieldByName, EntitySetCreate, EntitySetDestroy, EntitySetFindClassByName, EntitySetFindEntityByName, EntitySetAddEntity, EntitySetAddClass, LoadEntitySet

Other Types: geEntity_ClassType, geEntity_Field, geEntity_Class, geEntity_Epair, geEntity_EntitySet

 Changes for Genesis3D v1.6: None

Notes:

What are entities? Entities are place-holder entries put into the level files (i.e. via Genesis World Editor), to be later implemented by the program. And example could be the following entity: ItemHealth1: Origin = 0, 0, 0. At run-time, the program can search for all items, and add them to the world as indicated. In this case, it could put a health kit at location (0, 0, 0).

The following functions (geWorld_GetEntitySet, EntitySetGetNextEntity, GetUserData, GetName) are defined in "…\genesis3d\include\Genesis.h". The rest of the functions in this file are not included there. Instead, they were found in "…\genesis3d\OpenSource\Entities\Entities.h". Thus they are probably not required for most interactions with the Genesis3D engine. (Indeed, because they are not prefaced with GENESISAPI, they are likely not available in the precompiled library files.)

 

Types:

geEntity

typedef struct geEntity {
      geEntity_Class*    Class;     // Class data
      geEntity_Epair*    Epairs;    // Parsed epair list from entity string list
      void*                  UserData;    // User structure parsed from entity
} geEntity;

Return to Contents

 

geEntity_ClassType

typedef enum {
      TYPE_INT,
      TYPE_FLOAT,
      TYPE_COLOR,
      TYPE_POINT,
      TYPE_STRING,
      TYPE_MODEL,
      TYPE_STRUCT,
      TYPE_PTR,
} geEntity_ClassType;

 Return to Contents

 

geEntity_Field

// Fields within a geEntity_Class
typedef struct geEntity_Field {
      char*                          Name;     // Name of the field
      geEntity_Class*         TypeClass;    // Atomic class the defines field
      int32                            Offset;     // Offset in Entity's UserData
      struct geEntity_Field*   Next;     // Next Field list
} geEntity_Field;

Return to Contents

 

geEntity_Class

typedef struct geEntity_Class {
      char*                           Name;     // Class Name
      geEntity_ClassType      Type;     // Type of class
      int32                            TypeSize;
      geEntity_Field*          Fields;    // Fields in this Class
      int32                            FieldSize;    // Size of all fields
      struct geEntity_Class*  Next;
} geEntity_Class;

Return to Contents

 

geEntity_Epair

typedef struct geEntity_Epair {
      struct geEntity_Epair* Next;
      char*                        Key;
      char*                        Value;
} geEntity_Epair;

Return to Contents

 

geEntity_EntitySet

typedef struct geEntity_EntitySet {
      struct geEntity_EntitySet*      Next;    // Next entity in this set
      struct geEntity_EntitySet*      Current;   // Current entity set as an iterator
      geBoolean                             OwnsEntities;  // GE_TRUE if
      geEntity*                               Entity;   // The entity
      geEntity_Class*                     Classes;   // List of classes for set
} geEntity_EntitySet;

Return to Contents

 

 

Core Functions:

GENESISAPI geEntity_EntitySet* geWorld_GetEntitySet(geWorld* World, const char* ClassName);

Searches through all entities located in the current World, and returns a pointer to a Set containing those entities whose names begin with ClassName.

Return to Contents

GENESISAPI geEntity* geEntity_EntitySetGetNextEntity(geEntity_EntitySet* EntitySet, geEntity* Entity);

Returns the next entity that occurs after Entity. To get the first entity in the set, make Entity=NULL

Return to Contents

GENESISAPI void* geEntity_GetUserData(geEntity* Entity);

Returns an untyped pointer to the user data for Entity. The user must then typecast the pointer to a known type.

Return to Contents

GENESISAPI void geEntity_GetName(const geEntity* Entity, char* Buff, int MaxLen);

Gets the name of the Entity.

Return to Contents

Other Functions:

geBoolean Ent_WorldInit(geWorld* World);

 

Return to Contents

void  Ent_WorldShutdown(geWorld* World);

 

Return to Contents

geEntity* geEntity_Create(void);

 

Return to Contents

void geEntity_Destroy(geEntity* Entity);

 

Return to Contents

geBoolean geEntity_GetModelNumForKey(geEntity* Entity, const char* Key, int32* ModelNum);

 

Return to Contents

geBoolean geEntity_AddEpair(geEntity* Entity, geEntity_Epair* Epair);

 

Return to Contents

const char* geEntity_GetStringForKey(const geEntity* Entity, const char* Key);

 

Return to Contents

geEntity_Epair* geEntity_EpairCreate(void);

 

Return to Contents

void geEntity_EpairDestroy(geEntity_Epair* Epair);

 

Return to Contents

geEntity_Field* geEntity_FieldCreate(const char* Name, int32 Offset, geEntity_Class* TypeClass);

 

Return to Contents

void geEntity_FieldDestroy(geEntity_Field* Field);

 

Return to Contents

geEntity_Class* geEntity_ClassCreate(geEntity_ClassType Type, const char* Name, int32 TypeSize);

 

Return to Contents

void geEntity_ClassDestroy(geEntity_Class* Class);

 

Return to Contents

geBoolean geEntity_ClassAddField(geEntity_Class* Class, geEntity_Field* Field);

 

Return to Contents

geEntity_Field* geEntity_ClassFindFieldByName(geEntity_Class* Class, const char* Name);

 

Return to Contents

geEntity_EntitySet* geEntity_EntitySetCreate(void);

 

Return to Contents

void geEntity_EntitySetDestroy(geEntity_EntitySet* EntitySet);

 

Return to Contents

geEntity_Class* geEntity_EntitySetFindClassByName(geEntity_EntitySet* Set, const char* Name);

 

Return to Contents

geEntity* geEntity_EntitySetFindEntityByName(geEntity_EntitySet* EntitySet, const char* Name);

 

Return to Contents

geBoolean geEntity_EntitySetAddEntity(geEntity_EntitySet* EntitySet, geEntity* Entity);

 

Return to Contents

geBoolean geEntity_EntitySetAddClass(geEntity_EntitySet* EntitySet, geEntity_Class* Class);

 

Return to Contents

geEntity_EntitySet* LoadEntitySet(const char* EntityData, int32 EntityDataSize);

 

Return to Contents