302 lines
4.5 KiB
C
302 lines
4.5 KiB
C
#ifndef ENGINE_H
|
|
# define ENGINE_H
|
|
|
|
#include <core.h>
|
|
|
|
# ifndef ENGINE_ENUM
|
|
# define ENGINE_ENUM
|
|
|
|
typedef enum {
|
|
EVT_HUNGER_TICK,
|
|
EVT_DAMAGE_TAKEN,
|
|
EVT_ITEM_OBSERVED,
|
|
EVT_ORDER_RECEIVED,
|
|
EVT_MEMORY_TRIGGERED,
|
|
} EVENT_TYPE;
|
|
|
|
typedef enum {
|
|
ACT_IDLE,
|
|
ACT_WORKING,
|
|
ACT_FIGHTING,
|
|
ACT_FLEEING,
|
|
ACT_UNCONSCIOUS,
|
|
ACT_DEAD,
|
|
} ACTIVITY_STATE;
|
|
|
|
typedef enum {
|
|
PHYSICAL_DMG,
|
|
MAGICA_DMG,
|
|
} DAMAGE_TYPE;
|
|
|
|
typedef enum {
|
|
STATS_STRENGHT,
|
|
STATS_DEXTERITY,
|
|
STATS_WITHDOM,
|
|
STATS_INTELLIGENCE,
|
|
STATS_
|
|
} STATS_TYPE;
|
|
|
|
typedef enum {
|
|
LIMB_ARM,
|
|
LIMB_LEG,
|
|
LIMB_HAND,
|
|
LIMB_FOOT,
|
|
LIMB_HEAD,
|
|
LIMB_NECK,
|
|
} LIMB_TYPE;
|
|
|
|
typedef enum {
|
|
LIMB_DAMAGED,
|
|
LIMB_PARALIZED,
|
|
LIMB_CUT,
|
|
LIMB_MISSING,
|
|
LIMB_SEVERE,
|
|
LIMB_INTACT,
|
|
LIMB_OK,
|
|
LIMB_INVINCIBLE,
|
|
} LIMB_STATE;
|
|
|
|
typedef enum {
|
|
SKILL_NONE,
|
|
SKILL_PASSIF,
|
|
SKILL_MASTERY,
|
|
SKILL_ACTIF,
|
|
SKILL_LABOR,
|
|
SKILL_COMBAT,
|
|
SKILL_KNOWLEDGE,
|
|
SKILL_PROGRESSION,
|
|
SKILL_INATE,
|
|
} SKILL_TYPE;
|
|
|
|
typedef enum {
|
|
ENTITY_DEAD,
|
|
ENTITY_ALIVE,
|
|
ENTITY_UNCONCIOUS,
|
|
} ENTITY_STATE;
|
|
|
|
typedef enum {
|
|
CRITICAL_FAIL,
|
|
FAIL,
|
|
SUCCESS,
|
|
CRITICAL_SUCCESS,
|
|
} CHECK_STATE;
|
|
|
|
typedef enum {
|
|
ITEM_EQUIPABLE,
|
|
ITEM_CONSUMABLE,
|
|
ITEM_PLACEABLE,
|
|
ITEM_QUEST,
|
|
} ITEM_FLAGS;
|
|
|
|
typedef enum {
|
|
SPLASH_SCREEN,
|
|
GAMELOOP_SCREEN,
|
|
CREDIT_SCREEN,
|
|
GAMEOVER_SCREEN,
|
|
SERVER_SCREEN,
|
|
SECRET_SCREEN,
|
|
DEBUG_SCREEN,
|
|
} ENGINE_STATE;
|
|
|
|
typedef enum {
|
|
QUEST_SUCCESS,
|
|
QUEST_FAILURE,
|
|
QUEST_TAKEN,
|
|
QUEST_KNOW,
|
|
QUEST_UNKNOW,
|
|
QUEST_COMPLETE,
|
|
} QUEST_STATE;
|
|
|
|
# endif
|
|
|
|
#ifndef ENGINE_STRUCT
|
|
# define ENGINE_STRUCT
|
|
|
|
// Render
|
|
|
|
typedef struct {
|
|
Shader gbuffer;
|
|
Shader deferred;
|
|
Shader filter;
|
|
} ShaderRD;
|
|
|
|
typedef struct {
|
|
unsigned int framebufferId;
|
|
unsigned int normal_tex_id;
|
|
unsigned int albedoSpec_tex_id;
|
|
unsigned int depth_tex_id;
|
|
|
|
} GBuffer;
|
|
|
|
typedef struct {
|
|
uint16_t height;
|
|
uint16_t width;
|
|
void* window;
|
|
//RenderTexture rendtex;
|
|
GBuffer gbuffer;
|
|
Camera3D camera;
|
|
ShaderRD shader;
|
|
bool hud_on, debug_on;
|
|
} RenderCtx;
|
|
|
|
// Event
|
|
|
|
typedef struct {
|
|
EVENT_TYPE type;
|
|
int value;
|
|
} Event;
|
|
|
|
typedef struct {
|
|
|
|
} Damage;
|
|
|
|
// Storage
|
|
|
|
typedef struct {
|
|
|
|
} Inventory;
|
|
|
|
// Entity
|
|
|
|
typedef struct {
|
|
int id;
|
|
} virtualEntity;
|
|
|
|
typedef struct {
|
|
int id;
|
|
} physicalEntity;
|
|
|
|
typedef struct {
|
|
EVENT_TYPE trigger;
|
|
ACTIVITY_STATE required_state;
|
|
bool (*condition)(virtualEntity e, Event ev);
|
|
void *(*effect)(virtualEntity e, Event ev);
|
|
} virtualRule;
|
|
|
|
typedef struct {
|
|
EVENT_TYPE trigger;
|
|
ACTIVITY_STATE required_state;
|
|
bool (*condition)(physicalEntity e, Event ev);
|
|
void *(*effect)(physicalEntity e, Event ev);
|
|
} physicalRule;
|
|
|
|
typedef struct {
|
|
int strenght;
|
|
int agility;
|
|
int toughness;
|
|
int proprioception;
|
|
int earing;
|
|
int touch;
|
|
int eyesight;
|
|
} BodyStats;
|
|
|
|
typedef struct {
|
|
int intellect;
|
|
int fortitude;
|
|
int charisma;
|
|
int eloquence;
|
|
int perception;
|
|
} MentalStats;
|
|
|
|
typedef struct {
|
|
LIMB_TYPE type;
|
|
LIMB_STATE state;
|
|
} Limb;
|
|
|
|
typedef struct {
|
|
Limb limbs[10];
|
|
} Body;
|
|
|
|
typedef struct {
|
|
Body body;
|
|
BodyStats body_stats;
|
|
MentalStats mental_stats;
|
|
ENTITY_STATE state;//can be multiple flag
|
|
} Entity;
|
|
|
|
// Item
|
|
|
|
typedef struct {
|
|
int number;
|
|
int description;//ref to item description table
|
|
int name;//ref to item name table
|
|
int rarity;
|
|
int flags;
|
|
int stack;
|
|
} Item;
|
|
|
|
typedef struct {
|
|
int size;
|
|
int capacity;
|
|
Item *storage;
|
|
} Inventory;
|
|
|
|
// Player
|
|
|
|
typedef struct {
|
|
char *name;
|
|
char *gender;
|
|
char *nickname;//can be changed, what npc refers to, also npc do not know you until you interact with them
|
|
} Identity;
|
|
|
|
typedef struct {
|
|
} Skill;
|
|
|
|
typedef struct {
|
|
Entity entity;
|
|
Identity identity;
|
|
Skill skills[10];
|
|
} Player;
|
|
//give more enphasis on the character than the item used (~60% ,~30%)
|
|
|
|
// Quest & Task
|
|
|
|
typedef struct {
|
|
int id;
|
|
int prerequisite;
|
|
int objectiv;
|
|
int status;//unknow, known, accepted, achieved, completed, unavailable
|
|
} Quest;
|
|
|
|
//Quest are missive or Scroll that the player can open with info on it, but no mini map or marker Also the map should be another scroll that is handdrawn, and the player can put marker and orient himself using landscape point of interest
|
|
|
|
// Other Struct
|
|
|
|
typedef enum {
|
|
ACTION_FORWARD,
|
|
ACTION_BACKWARD,
|
|
ACTION_LEFT,
|
|
ACTION_RIGHT,
|
|
} PLAYER_ACTION;
|
|
|
|
typedef struct {
|
|
int key[4];//should be the number of action in PLAYER_ACTION
|
|
int button;
|
|
int mbutton;
|
|
Vector2 mouse_pos;
|
|
Vector2 mouse_delta;
|
|
//int mouse_pressed[2];
|
|
} Input;
|
|
|
|
|
|
|
|
|
|
# endif
|
|
|
|
# ifndef ENGINE_PROTOTYPE
|
|
# define ENGINE_PROTOTYPE
|
|
|
|
//Render
|
|
void LoadPipeline();
|
|
void UnloadPipeline();
|
|
void Rendering();
|
|
void LoadAssets();
|
|
void UnloadAssets();
|
|
//UI
|
|
void UserInterface();
|
|
void Menu();
|
|
|
|
# endif
|
|
|
|
#endif
|