|
Dumb-ways-to-memorize
2D game
|
#include "parseentity.h"#include "parseobject.h"#include "mystrings.h"#include <jsmn.h>#include <string.h>#include <stdio.h>#include <stdlib.h>
Include dependency graph for parseentity.c:Go to the source code of this file.
Functions | |
| void | AddComplexMemToEnt (entity_t *ent, entity_members_complex_t member, void *value) |
| void | AddVector2Entity (entity_t *ent, entity_members_vector2_t member, vec2_t *value) |
| void | AddSpritesToEnt (entity_t *ent, char **files, int size) |
| entity_t * | ParseToEntity (object_t *object, char *str) |
| void | ParseComplexMember (entity_t *ent, jsmntok_t *token, char *str, entity_members_complex_t member, int size) |
| void | PrintEntity (entity_t *ent) |
Variables | |
| char * | ComplexVariableNames [] = {"hazard(s)", "collisionType", "entityState", 0} |
| char * | Vector2VariableNames [] = {"accel", "velocity", "position", 0} |
| char * | SimpleVariableNames [] = {"sprite(s)", "health", "damage", "height", "width", "frames", 0 } |
| void AddComplexMemToEnt | ( | entity_t * | ent, |
| entity_members_complex_t | member, | ||
| void * | value | ||
| ) |
Alias for a switch case that handles complex member to entity.
| [in,out] | ent | If non-null, the ent. |
| member | The member. | |
| [in,out] | value | If non-null, the value. |
Definition at line 15 of file parseentity.c.
References ENTITY_MEMBER_COLLISION_TYPE, ENTITY_MEMBER_ENTITY_STATE, and ENTITY_MEMBER_HAZARDS.
Referenced by ParseComplexMember().
| void AddSpritesToEnt | ( | entity_t * | ent, |
| char ** | files, | ||
| int | size | ||
| ) |
Loads and adds the sprite files given to the entity.
| [in,out] | ent | If non-null, the ent. |
| [in,out] | files | If non-null, an array of the strings with file names of the sprites. |
| size | The size. |
Definition at line 49 of file parseentity.c.
References LoadSprite().
Referenced by ParseToEntity().
| void AddVector2Entity | ( | entity_t * | ent, |
| entity_members_vector2_t | member, | ||
| vec2_t * | value | ||
| ) |
Adds a vector2 to the entity, which is a switch case similar to AddComplexMemToEnt.
| [in,out] | ent | If non-null, the ent. |
| member | The vector member to enters. | |
| [in,out] | value | If non-null, the value of the vector. |
Definition at line 32 of file parseentity.c.
References ENTITY_MEMBER_ACCEL, ENTITY_MEMBER_POSITION, and ENTITY_MEMBER_VELOCITY.
Referenced by ParseToEntity().
| void ParseComplexMember | ( | entity_t * | ent, |
| jsmntok_t * | token, | ||
| char * | str, | ||
| entity_members_complex_t | member, | ||
| int | size | ||
| ) |
Handles entering / converting complex members into the entity given.
| [in,out] | ent | If non-null, the ent. |
| [in,out] | token | If non-null, the token(s) to parse. |
| [in,out] | str | If non-null, the global string to parse tokens from. |
| member | The complex member associated with values given. | |
| size | The amount of values to input. |
Definition at line 166 of file parseentity.c.
References AddComplexMemToEnt(), ENTITY_MEMBER_COLLISION_TYPE, ENTITY_MEMBER_ENTITY_STATE, ENTITY_MEMBER_HAZARDS, JsmnToString(), StrToCollisionType(), StrToEntityState(), and StrToHazard().
Referenced by ParseToEntity().
| entity_t* ParseToEntity | ( | object_t * | object, |
| char * | str | ||
| ) |
Parse to entity. Tries to Assign everything , and defaults all function pointers to generic. Current Frame = 0, Weight = 1
| [in,out] | object | If non-null, the object. |
| [in,out] | str | If non-null, the string. |
Definition at line 70 of file parseentity.c.
References AddSpritesToEnt(), AddVector2Entity(), ComplexVariableNames, CountMem(), DrawGeneric(), ENTITY_MEMBER_DAMAGE, ENTITY_MEMBER_FRAMES, ENTITY_MEMBER_HEALTH, ENTITY_MEMBER_HEIGHT, ENTITY_MEMBER_SPRITE, ENTITY_MEMBER_WIDTH, FindKey(), FindObject(), JsmnToInt(), JsmnToString(), LoadAnimation(), MAX_ANIMATIONS, ParseComplexMember(), ParseToVec2(), PrintEntity(), SimpleVariableNames, ThinkGeneric(), TouchGeneric(), and Vector2VariableNames.
Referenced by LoadEntityData().
| void PrintEntity | ( | entity_t * | ent | ) |
Prints the entities data, used for debug.
| [in,out] | ent | If non-null, the ent. |
Definition at line 195 of file parseentity.c.
Referenced by ParseToEntity().
| char* ComplexVariableNames[] = {"hazard(s)", "collisionType", "entityState", 0} |
The complex variables which need more processing to parse
Definition at line 11 of file parseentity.c.
Referenced by ParseToEntity().
| char* SimpleVariableNames[] = {"sprite(s)", "health", "damage", "height", "width", "frames", 0 } |
The simple variables are there given values
Definition at line 13 of file parseentity.c.
Referenced by ParseToEntity().
| char* Vector2VariableNames[] = {"accel", "velocity", "position", 0} |
The variables which parse to vectors
Definition at line 12 of file parseentity.c.
Referenced by ParseToEntity().
1.8.11