2021-10-24 21:17:09 +02:00
|
|
|
#pragma once
|
2021-10-24 22:21:00 +02:00
|
|
|
#include "xash3d_types.h"
|
2023-04-19 20:40:08 +02:00
|
|
|
#include "const.h" // typedef word, needed for bspfile.h
|
|
|
|
#include "bspfile.h" // MAX_MAP_ENTITIES
|
2021-10-24 21:17:09 +02:00
|
|
|
|
|
|
|
#define ENT_PROP_LIST(X) \
|
|
|
|
X(0, vec3_t, origin, Vec3) \
|
|
|
|
X(1, vec3_t, angles, Vec3) \
|
|
|
|
X(2, float, pitch, Float) \
|
|
|
|
X(3, vec3_t, _light, Rgbav) \
|
|
|
|
X(4, class_name_e, classname, Classname) \
|
|
|
|
X(5, float, angle, Float) \
|
|
|
|
X(6, float, _cone, Float) \
|
|
|
|
X(7, float, _cone2, Float) \
|
|
|
|
X(8, int, _sky, Int) \
|
|
|
|
X(9, string, wad, WadList) \
|
2021-10-24 22:17:13 +02:00
|
|
|
X(10, string, targetname, String) \
|
|
|
|
X(11, string, target, String) \
|
2021-10-26 18:56:16 +02:00
|
|
|
X(12, int, style, Int) \
|
2021-12-11 21:40:57 +01:00
|
|
|
X(13, int_array_t, _xvk_surface_id, IntArray) \
|
2021-11-27 08:59:48 +01:00
|
|
|
X(14, string, _xvk_texture, String) \
|
2021-12-11 21:40:57 +01:00
|
|
|
X(15, int_array_t, _xvk_ent_id, IntArray) \
|
2021-12-08 20:25:39 +01:00
|
|
|
X(16, float, _xvk_radius, Float) \
|
2023-04-12 20:29:24 +02:00
|
|
|
X(17, vec4_t, _xvk_svec, Vec4) \
|
|
|
|
X(18, vec4_t, _xvk_tvec, Vec4) \
|
2023-04-13 19:05:50 +02:00
|
|
|
X(19, vec2_t, _xvk_tex_offset, Vec2) \
|
|
|
|
X(20, vec2_t, _xvk_tex_scale, Vec2) \
|
2023-04-18 20:32:34 +02:00
|
|
|
X(21, string, model, String) \
|
2023-04-19 20:40:08 +02:00
|
|
|
|
|
|
|
/* NOTE: not used
|
2023-04-18 20:32:34 +02:00
|
|
|
X(22, int, rendermode, Int) \
|
|
|
|
X(23, int, renderamt, Int) \
|
|
|
|
X(24, vec3_t, rendercolor, Vec3) \
|
|
|
|
X(25, int, renderfx, Int) \
|
|
|
|
X(26, vec3_t, _xvk_offset, Vec3) \
|
2023-04-19 20:40:08 +02:00
|
|
|
*/
|
2021-10-24 21:17:09 +02:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
Unknown = 0,
|
|
|
|
Light,
|
|
|
|
LightSpot,
|
|
|
|
LightEnvironment,
|
|
|
|
Worldspawn,
|
2023-04-18 20:32:34 +02:00
|
|
|
FuncWall,
|
2021-10-24 21:17:09 +02:00
|
|
|
Ignored,
|
2023-04-19 20:40:08 +02:00
|
|
|
Xvk_Target,
|
2021-10-24 21:17:09 +02:00
|
|
|
} class_name_e;
|
|
|
|
|
2021-12-11 21:40:57 +01:00
|
|
|
#define MAX_INT_ARRAY_SIZE 64
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int num;
|
|
|
|
int values[MAX_INT_ARRAY_SIZE];
|
|
|
|
} int_array_t;
|
|
|
|
|
2021-10-24 21:17:09 +02:00
|
|
|
typedef struct {
|
|
|
|
#define DECLARE_FIELD(num, type, name, kind) type name;
|
|
|
|
ENT_PROP_LIST(DECLARE_FIELD)
|
|
|
|
#undef DECLARE_FIELD
|
|
|
|
} entity_props_t;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
None = 0,
|
|
|
|
#define DECLARE_FIELD(num, type, name, kind) Field_##name = (1<<num),
|
|
|
|
ENT_PROP_LIST(DECLARE_FIELD)
|
|
|
|
#undef DECLARE_FIELD
|
|
|
|
} fields_read_e;
|
|
|
|
|
|
|
|
typedef enum { LightTypePoint, LightTypeSurface, LightTypeSpot, LightTypeEnvironment} LightType;
|
|
|
|
|
|
|
|
typedef struct {
|
2021-11-28 22:38:01 +01:00
|
|
|
int entity_index;
|
2021-10-24 21:17:09 +02:00
|
|
|
LightType type;
|
|
|
|
|
|
|
|
vec3_t origin;
|
|
|
|
vec3_t color;
|
|
|
|
vec3_t dir;
|
|
|
|
|
2021-11-28 23:05:54 +01:00
|
|
|
float radius;
|
|
|
|
|
2021-10-26 18:56:16 +02:00
|
|
|
int style;
|
2021-10-24 21:17:09 +02:00
|
|
|
float stopdot, stopdot2;
|
2021-10-24 22:21:00 +02:00
|
|
|
|
2021-10-24 22:17:13 +02:00
|
|
|
string target_entity;
|
2021-10-24 21:17:09 +02:00
|
|
|
} vk_light_entity_t;
|
|
|
|
|
2021-10-24 22:17:13 +02:00
|
|
|
typedef struct {
|
|
|
|
string targetname;
|
|
|
|
vec3_t origin;
|
|
|
|
} xvk_mapent_target_t;
|
|
|
|
|
2023-03-03 05:25:25 +01:00
|
|
|
#define MAX_MAPENT_TARGETS 256
|
|
|
|
|
2023-04-18 20:32:34 +02:00
|
|
|
typedef struct {
|
2023-04-18 21:18:27 +02:00
|
|
|
int entity_index;
|
2023-04-18 20:32:34 +02:00
|
|
|
string model;
|
2023-04-19 20:40:08 +02:00
|
|
|
vec3_t origin;
|
|
|
|
|
|
|
|
/* NOTE: not used. Might be needed for #118 in the future.
|
2023-04-18 20:32:34 +02:00
|
|
|
int rendermode, renderamt, renderfx;
|
|
|
|
color24 rendercolor;
|
|
|
|
|
|
|
|
struct cl_entity_s *ent;
|
2023-04-19 20:40:08 +02:00
|
|
|
*/
|
2023-04-18 20:32:34 +02:00
|
|
|
} xvk_mapent_func_wall_t;
|
|
|
|
|
2023-04-19 20:40:08 +02:00
|
|
|
typedef struct {
|
|
|
|
class_name_e class;
|
|
|
|
int index;
|
|
|
|
} xvk_mapent_ref_t;
|
|
|
|
|
2023-03-03 05:25:25 +01:00
|
|
|
typedef struct {
|
|
|
|
int num_lights;
|
|
|
|
vk_light_entity_t lights[256];
|
|
|
|
|
|
|
|
int single_environment_index;
|
|
|
|
int entity_count;
|
|
|
|
|
|
|
|
string wadlist;
|
|
|
|
|
|
|
|
int num_targets;
|
|
|
|
xvk_mapent_target_t targets[MAX_MAPENT_TARGETS];
|
2023-04-18 20:32:34 +02:00
|
|
|
|
|
|
|
#define MAX_FUNC_WALL_ENTITIES 64
|
|
|
|
int func_walls_count;
|
|
|
|
xvk_mapent_func_wall_t func_walls[MAX_FUNC_WALL_ENTITIES];
|
2023-04-19 20:40:08 +02:00
|
|
|
|
|
|
|
// TODO find out how to read this from the engine, or make its size dynamic
|
|
|
|
//#define MAX_MAP_ENTITIES 2048
|
|
|
|
xvk_mapent_ref_t refs[MAX_MAP_ENTITIES];
|
2023-03-03 05:25:25 +01:00
|
|
|
} xvk_map_entities_t;
|
|
|
|
|
|
|
|
extern xvk_map_entities_t g_map_entities;
|
|
|
|
|
|
|
|
enum { NoEnvironmentLights = -1, MoreThanOneEnvironmentLight = -2 };
|
|
|
|
|
|
|
|
void XVK_ParseMapEntities( void );
|
|
|
|
void XVK_ParseMapPatches( void );
|
|
|
|
|
2021-11-27 08:59:48 +01:00
|
|
|
enum {
|
2021-11-28 20:15:02 +01:00
|
|
|
Patch_Surface_NoPatch = 0,
|
2023-04-12 20:29:24 +02:00
|
|
|
Patch_Surface_Delete = (1<<0),
|
|
|
|
Patch_Surface_Texture = (1<<1),
|
|
|
|
Patch_Surface_Emissive = (1<<2),
|
|
|
|
Patch_Surface_STvecs = (1<<3),
|
2023-04-13 19:05:50 +02:00
|
|
|
Patch_Surface_TexOffset = (1<<4),
|
|
|
|
Patch_Surface_TexScale = (1<<5),
|
2021-11-27 08:59:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct texture_s;
|
|
|
|
|
|
|
|
typedef struct {
|
2021-11-28 20:15:02 +01:00
|
|
|
uint32_t flags;
|
2021-12-22 20:55:35 +01:00
|
|
|
|
|
|
|
// Static texture index in case there's no texture_s pointer
|
2021-11-27 08:59:48 +01:00
|
|
|
int tex_id;
|
2021-12-22 20:55:35 +01:00
|
|
|
|
|
|
|
// Pointer to texture_s data (which also may include animation)
|
2021-11-27 08:59:48 +01:00
|
|
|
const struct texture_s *tex;
|
2021-12-22 20:55:35 +01:00
|
|
|
|
2021-11-28 20:15:02 +01:00
|
|
|
vec3_t emissive;
|
2023-04-12 20:29:24 +02:00
|
|
|
|
|
|
|
// Texture coordinate patches
|
|
|
|
vec4_t s_vec, t_vec;
|
2023-04-13 19:05:50 +02:00
|
|
|
vec2_t tex_offset, tex_scale;
|
2021-11-27 08:59:48 +01:00
|
|
|
} xvk_patch_surface_t;
|
|
|
|
|
2023-03-03 05:25:25 +01:00
|
|
|
const xvk_patch_surface_t* R_VkPatchGetSurface( int surface_index );
|
2021-11-27 08:59:48 +01:00
|
|
|
|