72 lines
1.9 KiB
C
72 lines
1.9 KiB
C
/* date = August 30th 2023 6:28 pm */
|
|
|
|
#ifndef VN_CHARACTER_H
|
|
#define VN_CHARACTER_H
|
|
|
|
#include "generated/vn_character.meta.h"
|
|
|
|
////////////////////////////////
|
|
//~ 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;
|
|
};
|
|
|
|
////////////////////////////////
|
|
//~ 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;
|
|
|
|
memory_arena *StringArena;
|
|
character_string_chunk *FirstFreeChunk;
|
|
};
|
|
|
|
////////////////////////////////
|
|
//~ 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);
|
|
|
|
////////////////////////////////
|
|
//~ 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);
|
|
|
|
////////////////////////////////
|
|
//~ sixten: Misc. Character Functions
|
|
static character_state CR_CharacterStateFromString(string Input);
|
|
static string CR_StringFromCharacterState(character_state State);
|
|
|
|
#endif //VN_CHARACTER_H
|