vn/code/vn_character.h

72 lines
1.9 KiB
C
Raw Normal View History

2023-09-05 17:50:49 +00:00
/* date = August 30th 2023 6:28 pm */
#ifndef VN_CHARACTER_H
#define VN_CHARACTER_H
2023-10-04 17:21:15 +00:00
#include "generated/vn_character.meta.h"
2023-09-13 04:42:11 +00:00
////////////////////////////////
//~ sixten: Character String Chunk Types
#define CHARACTER_STRING_CHUNK_DATA_SIZE (64 - sizeof(character_string_chunk *))
struct character_string_chunk
{
character_string_chunk *Next;
u8 Data[CHARACTER_STRING_CHUNK_DATA_SIZE];
};
CTAssert(sizeof(character_string_chunk) == 64);
struct character_string_list
{
character_string_chunk *First;
character_string_chunk *Last;
u64 ChunkCount;
s64 StringCount;
};
2023-09-05 17:50:49 +00:00
////////////////////////////////
//~ sixten: Character Registry Types
struct character_entry
{
character_entry *Next;
character_entry *Prev;
string Name;
};
struct character_list
{
character_entry *First;
character_entry *Last;
s64 Count;
};
struct character_registry
{
memory_arena *Arena;
character_list Characters;
2023-09-13 04:42:11 +00:00
memory_arena *StringArena;
character_string_chunk *FirstFreeChunk;
2023-09-05 17:50:49 +00:00
};
2023-09-13 04:42:11 +00:00
////////////////////////////////
//~ sixten: Character String Chunk Functions
static character_string_list CR_CharacterStringListAlloc(character_registry *Registry, string String);
static character_string_list CR_CharacterStringListRelease(character_registry *Registry, character_string_list *List);
static string CR_StringFromList(memory_arena *Arena, character_string_list *List);
2023-09-05 17:50:49 +00:00
////////////////////////////////
//~ sixten: Character Registry Functions
static void CR_SetState(character_registry *State);
static character_registry *CR_GetState(void);
static character_list CR_GetCharacters(void);
static void CR_Init(void);
static character_entry *CR_EntryFromName(string Name);
2023-10-04 17:21:15 +00:00
////////////////////////////////
//~ sixten: Misc. Character Functions
static character_state CR_CharacterStateFromString(string Input);
static string CR_StringFromCharacterState(character_state State);
2023-09-05 17:50:49 +00:00
#endif //VN_CHARACTER_H