#ifndef GEN_H
#define GEN_H

typedef struct entry {
    room* area ;
    int weight ;
} entry ;

typedef struct fct_entry {
    int id ;
    char* name ;
    void (*updatePos)(double x, double y, double z, double w, double h, double d, double hz_angle, double vt_angle, float dtime, entity* ent, cube_0* ret) ;    
    // act as velocity function
    void (*onHit)(float dtime, int* hp, int* dmg, entity* ent, cube_0* ret) ;
    // triggers when object is hit
    void (*onDeath)(float dtime) ;

    // metadata //
    int metai1;
    int metai2;
    int metai3;
    int metai4;
    int metai5;
    int metai6;
    double metad1;
    double metad2;
    double metad3;
    double metad4;
    double metad5;
    double metad6;
    double metad7;
    double metad8;
    double metad9;
    char* metach1;
    char* metach2;

    int tex;
    int tex2;
} fct_entry ;

extern int build_text_box(char* msg, int red, int green, int blue);
extern int build_lock_box(char* msg, int red, int green, int blue);

void init_ent_generator(int n);

void copy_room(room* src, room* dest, int chx, int chy) ;
void build_starting_chunk(int chx, int chy) ;

void init_hashtbl() ;

void get_number_blocks(int* ret_cubes, int* ret_tps, int* ret_ent, FILE* ptr) ;
void align_to(FILE* ptr, char ch) ;
int read_int(FILE* ptr) ;
double read_float(FILE* ptr) ;
char* read_string(FILE* ptr);
void parse_one_room(int id, char* filename) ;
void parse_rooms(int n_rooms, char* folder) ;

void generate_nearby_chunks(int render_dist) ;

void free_pool();
void free_ent_generator();

void init_to_free();
void free_to_free();

#endif