|
Stardew Engine
|
#include "Entities.h"#include "AssertLib.h"#include "BinarySerializer.h"#include "StaticColliderEntity.h"#include "Components.h"#include <string.h>#include "Entity2DCollection.h"#include "GameFramework.h"#include "EntityQuadTree.h"#include "AnimatedSprite.h"#include "ObjectPool.h"#include "Network.h"#include "Log.h"#include "NetworkID.h"#include "Game2DLayerNetwork.h"#include "LatinMacros.h"
Functions | |
| void | Et2D_DestroyCollection (struct Entity2DCollection *pCollection, struct GameFrameworkLayer *pLayer) |
| void | Et2D_InitCollection (struct Entity2DCollection *pCollection) |
| void | Entity2DOnInit (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer, DrawContext *pDrawCtx, InputContext *pInputCtx) |
| Default base implementations, override with own behavior and then call these at the end. | |
| void | Entity2DUpdate (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer, float deltaT) |
| void | Entity2DUpdatePostPhysics (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer, float deltaT) |
| void | Entity2DDraw (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer, struct Transform2D *pCam, VECTOR(Worldspace2DVert) *outVerts, VECTOR(VertIndexT) *outIndices, VertIndexT *pNextIndex) |
| void | Entity2DInput (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer, InputContext *context) |
| void | Entity2DOnDestroy (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer) |
| void | Entity2DGetBoundingBox (struct Entity2D *pEnt, struct GameFrameworkLayer *pLayer, vec2 outTL, vec2 outBR) |
| void | Et2D_Init (RegisterGameEntitiesFn registerGameEntities) |
| void | Et2D_DestroyEntity (struct GameFrameworkLayer *pLayer, struct Entity2DCollection *pCollection, HEntity2D hEnt) |
| HEntity2D | Et2D_AddEntityNoNewNetID (struct Entity2DCollection *pCollection, struct Entity2D *pEnt) |
| Add, but don't initialize, the entity. If you're the server, a new net ID won't be assigned. | |
| HEntity2D | Et2D_AddEntity (struct Entity2DCollection *pCollection, struct Entity2D *pEnt) |
| Add, but don't initialize, the entity. If you're the server, a new net ID will be assigned. | |
| void | Et2D_DeserializeEntityV1Base (struct Entity2DCollection *pCollection, struct BinarySerializer *bs, struct GameLayer2DData *pData, int objectLayer, struct Entity2D *pOutEnt) |
| Deserialize an entity from the binary serializer using the version 1 method. | |
| staticus vacuum | DeserializeEntityV1 (struct Entity2DCollection *pCollection, struct BinarySerializer *bs, struct GameLayer2DData *pData, int objectLayer) |
| void | Et2D_SerializeEntityV1Base (struct Entity2D *pOn, struct BinarySerializer *bs, struct GameLayer2DData *pData) |
| Serialize a single entity. | |
| void | Et2D_SerializeEntities (struct Entity2DCollection *pCollection, struct BinarySerializer *bs, struct GameLayer2DData *pData, int objectLayer) |
| void | Et2D_RegisterEntityType (u32 typeID, struct EntitySerializerPair *pair) |
| Games using the engine should call this to add types of entity to be serialized. | |
| void | Et2D_DeserializeCommon (struct BinarySerializer *bs, struct Entity2D *pOutEnt) |
| void | Et2D_SerializeCommon (struct BinarySerializer *bs, struct Entity2D *pInEnt) |
| struct Entity2D * | Et2D_GetEntity (struct Entity2DCollection *pCollection, HEntity2D hEnt) |
| void | Et2D_IterateEntities (struct Entity2DCollection *pCollection, Entity2DIterator itr, void *pUser) |
| A convenient helper to iterate through the entity collection. | |
| float | Entity2DGetSortVal (struct Entity2D *pEnt) |
| void | Et2D_PopulateCommonHandlers (struct Entity2D *pEnt) |
| bool | PrintCollectionItr (struct Entity2D *pEnt, int i, void *pUser) |
| void | Et2D_PrintEntitiesInfo (struct Entity2DCollection *pCollection) |
| staticus vacuum DeserializeEntityV1 | ( | struct Entity2DCollection * | pCollection, |
| struct BinarySerializer * | bs, | ||
| struct GameLayer2DData * | pData, | ||
| int | objectLayer | ||
| ) |
| void Entity2DDraw | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer, | ||
| struct Transform2D * | pCam, | ||
| VECTOR(Worldspace2DVert) * | outVerts, | ||
| VECTOR(VertIndexT) * | outIndices, | ||
| VertIndexT * | pNextIndex | ||
| ) |
| void Entity2DGetBoundingBox | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer, | ||
| vec2 | outTL, | ||
| vec2 | outBR | ||
| ) |
| float Entity2DGetSortVal | ( | struct Entity2D * | pEnt | ) |
| void Entity2DInput | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer, | ||
| InputContext * | context | ||
| ) |
| void Entity2DOnDestroy | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer | ||
| ) |
| void Entity2DOnInit | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer, | ||
| DrawContext * | pDrawCtx, | ||
| InputContext * | pInputCtx | ||
| ) |
Default base implementations, override with own behavior and then call these at the end.
| void Entity2DUpdate | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer, | ||
| float | deltaT | ||
| ) |
| void Entity2DUpdatePostPhysics | ( | struct Entity2D * | pEnt, |
| struct GameFrameworkLayer * | pLayer, | ||
| float | deltaT | ||
| ) |
| HEntity2D Et2D_AddEntity | ( | struct Entity2DCollection * | pCollection, |
| struct Entity2D * | pEnt | ||
| ) |
Add, but don't initialize, the entity. If you're the server, a new net ID will be assigned.
| pCollection | - collection to add to |
| pEnt | - Entity to add |
| bOwned | - Does this host own the entity or is it owned by another player on the network, no effect if single player |
| HEntity2D Et2D_AddEntityNoNewNetID | ( | struct Entity2DCollection * | pCollection, |
| struct Entity2D * | pEnt | ||
| ) |
Add, but don't initialize, the entity. If you're the server, a new net ID won't be assigned.
| pCollection | - collection to add to |
| pEnt | - Entity to add |
| bOwned | - Does this host own the entity or is it owned by another player on the network, no effect if single player |
| void Et2D_DeserializeCommon | ( | struct BinarySerializer * | bs, |
| struct Entity2D * | pOutEnt | ||
| ) |
| void Et2D_DeserializeEntityV1Base | ( | struct Entity2DCollection * | pCollection, |
| struct BinarySerializer * | bs, | ||
| struct GameLayer2DData * | pData, | ||
| int | objectLayer, | ||
| struct Entity2D * | pOutEnt | ||
| ) |
Deserialize an entity from the binary serializer using the version 1 method.
| pCollection | |
| bs | |
| pData | game layer data |
| objectLayer | object layer to set the entity to be in |
| pOutEnt | entity to populate |
| void Et2D_DestroyCollection | ( | struct Entity2DCollection * | pCollection, |
| struct GameFrameworkLayer * | pLayer | ||
| ) |
| void Et2D_DestroyEntity | ( | struct GameFrameworkLayer * | pLayer, |
| struct Entity2DCollection * | pCollection, | ||
| HEntity2D | hEnt | ||
| ) |
| pLayer | |
| pCollection | |
| hEnt |
| struct Entity2D * Et2D_GetEntity | ( | struct Entity2DCollection * | pCollection, |
| HEntity2D | hEnt | ||
| ) |
| pCollection | |
| hEnt |
| void Et2D_Init | ( | RegisterGameEntitiesFn | registerGameEntities | ) |
| void Et2D_InitCollection | ( | struct Entity2DCollection * | pCollection | ) |
| void Et2D_IterateEntities | ( | struct Entity2DCollection * | pCollection, |
| Entity2DIterator | itr, | ||
| void * | pUser | ||
| ) |
A convenient helper to iterate through the entity collection.
| pCollection | collection to iterate |
| itr | iterator function ptr |
| pUser | user data to pass to iterator fn |
| void Et2D_PopulateCommonHandlers | ( | struct Entity2D * | pEnt | ) |
| void Et2D_PrintEntitiesInfo | ( | struct Entity2DCollection * | pCollection | ) |
| void Et2D_RegisterEntityType | ( | u32 | typeID, |
| struct EntitySerializerPair * | pair | ||
| ) |
Games using the engine should call this to add types of entity to be serialized.
| typeID | Entity type |
| pair | pair of functions to serialize and deserialize |
| void Et2D_SerializeCommon | ( | struct BinarySerializer * | bs, |
| struct Entity2D * | pInEnt | ||
| ) |
| void Et2D_SerializeEntities | ( | struct Entity2DCollection * | pCollection, |
| struct BinarySerializer * | bs, | ||
| struct GameLayer2DData * | pData, | ||
| int | objectLayer | ||
| ) |
| void Et2D_SerializeEntityV1Base | ( | struct Entity2D * | pOn, |
| struct BinarySerializer * | bs, | ||
| struct GameLayer2DData * | pData | ||
| ) |
Serialize a single entity.
| pOn | |
| bs | |
| pData |
| bool PrintCollectionItr | ( | struct Entity2D * | pEnt, |
| int | i, | ||
| void * | pUser | ||
| ) |