336 lines
5.0 KiB
C
336 lines
5.0 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;
|
|
|
|
typedef enum {
|
|
ACTION_FORWARD,
|
|
ACTION_BACKWARD,
|
|
ACTION_LEFT,
|
|
ACTION_RIGHT,
|
|
ACTION_PRIMARY,
|
|
ACTION_SECONDARY,
|
|
ACTION_USE,
|
|
ACTION_GRAB,
|
|
ACTION_JUMP,
|
|
ACTION_DASH,
|
|
ACTION_SKILL1,
|
|
ACTION_TOOLBAR1,
|
|
} PLAYER_ACTION;
|
|
|
|
typedef enum {
|
|
DENDRITIC_VOLTAGE,
|
|
LAZENBYCOMP_LIQUID,
|
|
LAZENBYCOMP_SMOOTH,
|
|
POTRA,
|
|
} FONTS_ENUM;
|
|
|
|
# endif
|
|
|
|
#ifndef ENGINE_STRUCT
|
|
# define ENGINE_STRUCT
|
|
|
|
typedef struct {
|
|
Font fonts[4];//
|
|
Texture textures;//
|
|
Model models;//
|
|
Sound sound;
|
|
} Assets;
|
|
|
|
// 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 camera3d;
|
|
Camera2D camera2d;
|
|
ShaderRD shader;
|
|
bool hud_on, debug_on;
|
|
} RenderCtx;
|
|
|
|
// Event
|
|
typedef struct {
|
|
EVENT_TYPE type;
|
|
int value;
|
|
double time;
|
|
char* info;
|
|
int initiator;
|
|
int actors;
|
|
int actions;
|
|
} Event;
|
|
|
|
//cities
|
|
//hideout
|
|
//tiles
|
|
//level
|
|
//npc
|
|
//clan
|
|
//army
|
|
//team
|
|
|
|
typedef struct {
|
|
|
|
} Damage;
|
|
|
|
typedef struct {
|
|
EVENT_TYPE trigger;
|
|
ACTIVITY_STATE required_state;
|
|
bool (*condition)(int e, Event ev);
|
|
void *(*effect)(int e, Event ev);
|
|
} virtualRule;
|
|
|
|
typedef struct {
|
|
EVENT_TYPE trigger;
|
|
ACTIVITY_STATE required_state;
|
|
bool (*condition)(int e, Event ev);
|
|
void *(*effect)(int 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];
|
|
BodyStats body_stats;
|
|
MentalStats mental_stats;
|
|
int mass;
|
|
Vector3 pos;
|
|
Vector3 velocity;
|
|
int health;
|
|
} Body;
|
|
|
|
typedef struct {
|
|
Body body;
|
|
int faction;
|
|
ENTITY_STATE state;//can be multiple flag
|
|
} Entity;
|
|
|
|
typedef struct {
|
|
Entity entity;
|
|
void (*ai)(void);
|
|
} Mob;
|
|
|
|
// 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[100];
|
|
} Inventory;
|
|
|
|
// Player
|
|
|
|
typedef struct {
|
|
char *name;
|
|
char *gender;
|
|
char *nickname;//can be changed, what npc refers to when talking to you, also npc do not know you until you interact with them
|
|
} Identity;
|
|
|
|
typedef struct {
|
|
} Skill;
|
|
|
|
typedef struct {
|
|
Entity entity;
|
|
Identity identity;
|
|
Skill skills[10];
|
|
Inventory inventory;
|
|
} 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 struct {
|
|
int key[4];//should be the number of action in PLAYER_ACTION
|
|
union {
|
|
int key;
|
|
int pad;
|
|
int mouse;
|
|
} press;
|
|
Vector2 mouse_pos;
|
|
Vector2 mouse_delta;
|
|
//int mouse_pressed[2];
|
|
} Input;
|
|
|
|
typedef struct {
|
|
int state;
|
|
Player player;
|
|
Assets assets;
|
|
} Context;
|
|
|
|
# endif
|
|
|
|
# ifndef ENGINE_PROTOTYPE
|
|
# define ENGINE_PROTOTYPE
|
|
|
|
//Render
|
|
void LoadPipeline();
|
|
void UnloadPipeline();
|
|
|
|
//UI
|
|
void UserInterface(const Player *player);
|
|
//void Menu();
|
|
|
|
# endif
|
|
|
|
#endif
|