Create notion of state switching for entities

Encapsulate the process required to switch an entity from state to state
using a state switching function. Add extra minor debug markers.
This commit is contained in:
2016-07-19 15:19:08 +10:00
parent 403999b566
commit 5fc58ca643
5 changed files with 190 additions and 79 deletions
+5 -3
View File
@@ -10,9 +10,6 @@
#include "WorldTraveller/WorldTraveller.h"
#define INVALID_CODE_PATH TRUE
#define DEBUG_PUSH_STRING(formatString, data, type) \
debug_pushString(formatString, CAST(void *)&data, type)
enum DebugCallCount
{
debugcallcount_drawArrays,
@@ -101,7 +98,12 @@ inline char *debug_entityattack_string(i32 val)
void debug_init();
#define DEBUG_PUSH_STRING(string) debug_pushString(string, NULL, "char")
#define DEBUG_PUSH_VAR(formatString, data, type) \
debug_pushString(formatString, CAST(void *)&data, type)
void debug_pushString(char *formatString, void *data, char *dataType);
void debug_stringUpdateAndRender(Renderer *renderer, Font *font, f32 dt);
void debug_drawUi(GameState *state, f32 dt);
+2
View File
@@ -65,6 +65,8 @@ typedef struct EntityAnim_
typedef struct Entity
{
u32 id;
v2 pos; // Position
v2 dPos; // Velocity
v2 hitboxSize;
+3 -2
View File
@@ -16,9 +16,9 @@ typedef struct World
{
Entity *entities;
i32 maxEntities;
b32 *entitiesInBattleIds;
b32 *entityIdInBattle;
i32 numEntitiesInBattle;
enum TexList texType;
v2 cameraPos; // In pixels
@@ -26,6 +26,7 @@ typedef struct World
i32 heroIndex;
i32 freeEntityIndex;
u32 uniqueIdAccumulator;
} World;
typedef struct GameState