Andrey Akhmichin
4 years ago
50 changed files with 510 additions and 1524 deletions
@ -1,246 +0,0 @@
@@ -1,246 +0,0 @@
|
||||
/*
|
||||
bspfile.h - BSP format included q1, hl1 support |
||||
Copyright (C) 2010 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef BSPFILE_H |
||||
#define BSPFILE_H |
||||
|
||||
/*
|
||||
============================================================================== |
||||
|
||||
BRUSH MODELS |
||||
|
||||
.bsp contain level static geometry with including PVS and lightning info |
||||
============================================================================== |
||||
*/ |
||||
|
||||
// header
|
||||
#define Q1BSP_VERSION 29 // quake1 regular version (beta is 28)
|
||||
#define HLBSP_VERSION 30 // half-life regular version
|
||||
#define XTBSP_VERSION 31 // extended lightmaps and expanded clipnodes limit
|
||||
|
||||
#define IDEXTRAHEADER (('H'<<24)+('S'<<16)+('A'<<8)+'X') // little-endian "XASH"
|
||||
#define EXTRA_VERSION 2 // because version 1 was occupied by old versions of XashXT
|
||||
|
||||
#define DELUXEMAP_VERSION 1 |
||||
#define IDDELUXEMAPHEADER (('T'<<24)+('I'<<16)+('L'<<8)+'Q') // little-endian "QLIT"
|
||||
|
||||
// worldcraft predefined angles
|
||||
#define ANGLE_UP -1 |
||||
#define ANGLE_DOWN -2 |
||||
|
||||
// bmodel limits
|
||||
#define MAX_MAP_HULLS 4 // MAX_HULLS
|
||||
|
||||
#define SURF_NOCULL BIT( 0 ) // two-sided polygon (e.g. 'water4b')
|
||||
#define SURF_PLANEBACK BIT( 1 ) // plane should be negated
|
||||
#define SURF_DRAWSKY BIT( 2 ) // sky surface
|
||||
#define SURF_WATERCSG BIT( 3 ) // culled by csg (was SURF_DRAWSPRITE)
|
||||
#define SURF_DRAWTURB BIT( 4 ) // warp surface
|
||||
#define SURF_DRAWTILED BIT( 5 ) // face without lighmap
|
||||
#define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND)
|
||||
#define SURF_UNDERWATER BIT( 7 ) // caustics
|
||||
#define SURF_TRANSPARENT BIT( 8 ) // it's a transparent texture (was SURF_DONTWARP)
|
||||
|
||||
#define SURF_REFLECT BIT( 31 ) // reflect surface (mirror)
|
||||
|
||||
// lightstyle management
|
||||
#define LM_STYLES 4 // MAXLIGHTMAPS
|
||||
#define LS_NORMAL 0x00 |
||||
#define LS_UNUSED 0xFE |
||||
#define LS_NONE 0xFF |
||||
|
||||
#define MAX_MAP_MODELS 1024 // can be increased up to 2048 if needed
|
||||
#define MAX_MAP_BRUSHES 32768 // unsigned short limit
|
||||
#define MAX_MAP_ENTITIES 8192 // can be increased up to 32768 if needed
|
||||
#define MAX_MAP_ENTSTRING 0x80000 // 512 kB should be enough
|
||||
#define MAX_MAP_PLANES 65536 // can be increased without problems
|
||||
#define MAX_MAP_NODES 32767 // because negative shorts are leafs
|
||||
#define MAX_MAP_CLIPNODES 32767 // because negative shorts are contents
|
||||
#define MAX_MAP_LEAFS 32767 // signed short limit
|
||||
#define MAX_MAP_VERTS 65535 // unsigned short limit
|
||||
#define MAX_MAP_FACES 65535 // unsigned short limit
|
||||
#define MAX_MAP_MARKSURFACES 65535 // unsigned short limit
|
||||
#define MAX_MAP_TEXINFO MAX_MAP_FACES // in theory each face may have personal texinfo
|
||||
#define MAX_MAP_EDGES 0x100000 // can be increased but not needed
|
||||
#define MAX_MAP_SURFEDGES 0x200000 // can be increased but not needed
|
||||
#define MAX_MAP_TEXTURES 2048 // can be increased but not needed
|
||||
#define MAX_MAP_MIPTEX 0x2000000 // 32 Mb internal textures data
|
||||
#define MAX_MAP_LIGHTING 0x2000000 // 32 Mb lightmap raw data (can contain deluxemaps)
|
||||
#define MAX_MAP_VISIBILITY 0x800000 // 8 Mb visdata
|
||||
|
||||
// quake lump ordering
|
||||
#define LUMP_ENTITIES 0 |
||||
#define LUMP_PLANES 1 |
||||
#define LUMP_TEXTURES 2 // internal textures
|
||||
#define LUMP_VERTEXES 3 |
||||
#define LUMP_VISIBILITY 4 |
||||
#define LUMP_NODES 5 |
||||
#define LUMP_TEXINFO 6 |
||||
#define LUMP_FACES 7 |
||||
#define LUMP_LIGHTING 8 |
||||
#define LUMP_CLIPNODES 9 |
||||
#define LUMP_LEAFS 10 |
||||
#define LUMP_MARKSURFACES 11 |
||||
#define LUMP_EDGES 12 |
||||
#define LUMP_SURFEDGES 13 |
||||
#define LUMP_MODELS 14 // internal submodels
|
||||
#define HEADER_LUMPS 15 |
||||
|
||||
// version 31
|
||||
#define LUMP_CLIPNODES2 15 // hull0 goes into LUMP_NODES, hull1 goes into LUMP_CLIPNODES,
|
||||
#define LUMP_CLIPNODES3 16 // hull2 goes into LUMP_CLIPNODES2, hull3 goes into LUMP_CLIPNODES3
|
||||
#define HEADER_LUMPS_31 17 |
||||
|
||||
#define LUMP_FACES_EXTRADATA 0 // extension of dface_t
|
||||
#define LUMP_VERTS_EXTRADATA 1 // extension of dvertex_t
|
||||
#define LUMP_CUBEMAPS 2 // cubemap description
|
||||
|
||||
#define EXTRA_LUMPS 8 // g-cont. just for future expansions
|
||||
|
||||
// texture flags
|
||||
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
|
||||
|
||||
// ambient sound types
|
||||
enum |
||||
{ |
||||
AMBIENT_WATER = 0, // waterfall
|
||||
AMBIENT_SKY, // wind
|
||||
AMBIENT_SLIME, // never used in quake
|
||||
AMBIENT_LAVA, // never used in quake
|
||||
NUM_AMBIENTS // automatic ambient sounds
|
||||
}; |
||||
|
||||
//
|
||||
// BSP File Structures
|
||||
//
|
||||
|
||||
typedef struct |
||||
{ |
||||
int fileofs; |
||||
int filelen; |
||||
} dlump_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int version; |
||||
dlump_t lumps[HEADER_LUMPS]; |
||||
} dheader_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int version; |
||||
dlump_t lumps[HEADER_LUMPS_31]; |
||||
} dheader31_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int id; // must be little endian XASH
|
||||
int version; |
||||
dlump_t lumps[EXTRA_LUMPS]; |
||||
} dextrahdr_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
vec3_t mins; |
||||
vec3_t maxs; |
||||
vec3_t origin; // for sounds or lights
|
||||
int headnode[MAX_MAP_HULLS]; |
||||
int visleafs; // not including the solid leaf 0
|
||||
int firstface; |
||||
int numfaces; |
||||
} dmodel_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int nummiptex; |
||||
int dataofs[4]; // [nummiptex]
|
||||
} dmiptexlump_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
vec3_t point; |
||||
} dvertex_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
vec3_t normal; |
||||
float dist; |
||||
int type; // PLANE_X - PLANE_ANYZ ?
|
||||
} dplane_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int planenum; |
||||
short children[2]; // negative numbers are -(leafs + 1), not nodes
|
||||
short mins[3]; // for sphere culling
|
||||
short maxs[3]; |
||||
word firstface; |
||||
word numfaces; // counting both sides
|
||||
} dnode_t; |
||||
|
||||
// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
|
||||
// all other leafs need visibility info
|
||||
typedef struct |
||||
{ |
||||
int contents; |
||||
int visofs; // -1 = no visibility info
|
||||
|
||||
short mins[3]; // for frustum culling
|
||||
short maxs[3]; |
||||
word firstmarksurface; |
||||
word nummarksurfaces; |
||||
|
||||
// automatic ambient sounds
|
||||
byte ambient_level[NUM_AMBIENTS]; // ambient sound level (0 - 255)
|
||||
} dleaf_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int planenum; |
||||
short children[2]; // negative numbers are contents
|
||||
} dclipnode_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
float vecs[2][4]; // texmatrix [s/t][xyz offset]
|
||||
int miptex; |
||||
int flags; |
||||
} dtexinfo_t; |
||||
|
||||
typedef word dmarkface_t; // leaf marksurfaces indexes
|
||||
typedef int dsurfedge_t; // map surfedges
|
||||
|
||||
// NOTE: that edge 0 is never used, because negative edge nums
|
||||
// are used for counterclockwise use of the edge in a face
|
||||
typedef struct |
||||
{ |
||||
word v[2]; // vertex numbers
|
||||
} dedge_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
word planenum; |
||||
short side; |
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
short numedges; |
||||
short texinfo; |
||||
|
||||
// lighting info
|
||||
byte styles[LM_STYLES]; |
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} dface_t; |
||||
|
||||
#endif//BSPFILE_H
|
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
gameinfo.h - current game info |
||||
Copyright (C) 2010 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef GAMEINFO_H |
||||
#define GAMEINFO_H |
||||
|
||||
#define GFL_NOMODELS (1<<0) |
||||
|
||||
/*
|
||||
======================================================================== |
||||
|
||||
GAMEINFO stuff |
||||
|
||||
internal shared gameinfo structure (readonly for engine parts) |
||||
======================================================================== |
||||
*/ |
||||
typedef struct |
||||
{ |
||||
// filesystem info
|
||||
char gamefolder[64]; // used for change game '-game x'
|
||||
char startmap[64]; // map to start singleplayer game
|
||||
char trainmap[64]; // map to start hazard course (if specified)
|
||||
char title[64]; // Game Main Title
|
||||
char version[14]; // game version (optional)
|
||||
short flags; // game flags
|
||||
|
||||
// about mod info
|
||||
char game_url[256]; // link to a developer's site
|
||||
char update_url[256]; // link to updates page
|
||||
char type[64]; // single, toolkit, multiplayer etc
|
||||
char date[64]; |
||||
char size[64]; // displayed mod size
|
||||
|
||||
int gamemode; |
||||
} GAMEINFO; |
||||
|
||||
#endif//GAMEINFO_H
|
@ -1,29 +0,0 @@
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
lightstyle.h - lighstyle description |
||||
Copyright (C) 2011 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef LIGHTSTYLE_H |
||||
#define LIGHTSTYLE_H |
||||
|
||||
typedef struct |
||||
{ |
||||
char pattern[256]; |
||||
float map[256]; |
||||
int length; |
||||
float value; |
||||
qboolean interp; // allow to interpolate this lightstyle
|
||||
float time; // local time is gurantee what new style begins from the start, not mid or end of the sequence
|
||||
} lightstyle_t; |
||||
|
||||
#endif//LIGHTSTYLE_H
|
@ -1,261 +0,0 @@
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
render_api.h - Xash3D extension for client interface |
||||
Copyright (C) 2011 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef RENDER_API_H |
||||
#define RENDER_API_H |
||||
|
||||
#include "lightstyle.h" |
||||
#include "dlight.h" |
||||
|
||||
// changes for version 28
|
||||
// replace decal_t from software declaration to hardware (matched to normal HL)
|
||||
// mextrasurf_t->increased limit of reserved fields (up from 7 to 32)
|
||||
// replace R_StoreEfrags with him extended version
|
||||
// formed group for BSP decal manipulating
|
||||
// move misc functions at end of the interface
|
||||
// added new export for clearing studio decals
|
||||
|
||||
#define CL_RENDER_INTERFACE_VERSION 35 |
||||
#define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals
|
||||
|
||||
#define SURF_INFO( surf, mod ) ((mextrasurf_t *)mod->cache.data + (surf - mod->surfaces)) |
||||
#define INFO_SURF( surf, mod ) (mod->surfaces + (surf - (mextrasurf_t *)mod->cache.data)) |
||||
|
||||
// render info parms
|
||||
#define PARM_TEX_WIDTH 1 // all parms with prefix 'TEX_' receive arg as texnum
|
||||
#define PARM_TEX_HEIGHT 2 // otherwise it's not used
|
||||
#define PARM_TEX_SRC_WIDTH 3 |
||||
#define PARM_TEX_SRC_HEIGHT 4 |
||||
#define PARM_TEX_SKYBOX 5 // second arg as skybox ordering num
|
||||
#define PARM_TEX_SKYTEXNUM 6 // skytexturenum for quake sky
|
||||
#define PARM_TEX_LIGHTMAP 7 // second arg as number 0 - 128
|
||||
#define PARM_TEX_TARGET 8 |
||||
#define PARM_TEX_TEXNUM 9 |
||||
#define PARM_TEX_FLAGS 10 |
||||
#define PARM_TEX_TYPE 11 |
||||
#define PARM_TEX_CACHEFRAME 12 // compare with worldmodel->needload
|
||||
#define PARM_TEX_GLFORMAT 13 // get a texture GL-format
|
||||
// reserved
|
||||
#define PARM_WORLD_VERSION 16 // return the version of bsp
|
||||
#define PARM_SKY_SPHERE 17 // sky is quake sphere ?
|
||||
#define PARM_MAP_HAS_MIRRORS 18 // current map has mirorrs
|
||||
#define PARM_MAP_HAS_DELUXE 19 // map has deluxedata
|
||||
#define PARM_MAX_ENTITIES 20 |
||||
#define PARM_WIDESCREEN 21 |
||||
#define PARM_FULLSCREEN 22 |
||||
#define PARM_SCREEN_WIDTH 23 |
||||
#define PARM_SCREEN_HEIGHT 24 |
||||
#define PARM_CLIENT_INGAME 25 |
||||
#define PARM_FEATURES 26 // same as movevars->features
|
||||
#define PARM_ACTIVE_TMU 27 // for debug
|
||||
#define PARM_CACHEFRAME 28 |
||||
#define PARM_MAX_IMAGE_UNITS 29 |
||||
#define PARM_CLIENT_ACTIVE 30 |
||||
#define PARM_REBUILD_GAMMA 31 // if true lightmaps rebuilding for gamma change
|
||||
|
||||
enum |
||||
{ |
||||
// skybox ordering
|
||||
SKYBOX_RIGHT = 0, |
||||
SKYBOX_BACK, |
||||
SKYBOX_LEFT, |
||||
SKYBOX_FORWARD, |
||||
SKYBOX_UP, |
||||
SKYBOX_DOWN, |
||||
}; |
||||
|
||||
typedef enum |
||||
{ |
||||
TEX_INVALID = 0, // free slot
|
||||
TEX_SYSTEM, // generated by engine
|
||||
TEX_NOMIP, // hud pics, menu etc
|
||||
TEX_BRUSH, // a map texture
|
||||
TEX_SPRITE, // sprite frames
|
||||
TEX_STUDIO, // studio skins
|
||||
TEX_LIGHTMAP, // lightmap textures
|
||||
TEX_DECAL, // decals
|
||||
TEX_VGUI, // vgui fonts or images
|
||||
TEX_CUBEMAP, // cubemap textures (sky)
|
||||
TEX_DETAIL, // detail textures
|
||||
TEX_REMAP, // local copy of remap texture
|
||||
TEX_SCREENCOPY, // keep screen copy e.g. for mirror
|
||||
TEX_CUSTOM, // user created texture
|
||||
TEX_DEPTHMAP // shadowmap texture
|
||||
} texType_t; |
||||
|
||||
typedef enum |
||||
{ |
||||
TF_NEAREST = (1<<0), // disable texfilter
|
||||
TF_KEEP_RGBDATA = (1<<1), // some images keep source
|
||||
TF_NOFLIP_TGA = (1<<2), // Steam background completely ignore tga attribute 0x20
|
||||
TF_KEEP_8BIT = (1<<3), // keep original 8-bit image (if present)
|
||||
TF_NOPICMIP = (1<<4), // ignore r_picmip resample rules
|
||||
TF_UNCOMPRESSED = (1<<5), // don't compress texture in video memory
|
||||
TF_CUBEMAP = (1<<6), // it's cubemap texture
|
||||
TF_DEPTHMAP = (1<<7), // custom texture filter used
|
||||
TF_INTENSITY = (1<<8), // monochrome intensity image
|
||||
TF_LUMINANCE = (1<<9), // force image to grayscale
|
||||
TF_SKYSIDE = (1<<10), // this is a part of skybox
|
||||
TF_CLAMP = (1<<11), // clamp texcoords to [0..1] range
|
||||
TF_NOMIPMAP = (1<<12), // don't build mips for this image
|
||||
TF_HAS_LUMA = (1<<13), // sets by GL_UploadTexture
|
||||
TF_MAKELUMA = (1<<14), // create luma from quake texture (only q1 textures contain luma-pixels)
|
||||
TF_NORMALMAP = (1<<15), // is a normalmap
|
||||
TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture)
|
||||
TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures)
|
||||
TF_TEXTURE_1D = (1<<18), // this is GL_TEXTURE_1D
|
||||
TF_BORDER = (1<<19), // zero clamp for projected textures
|
||||
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
|
||||
TF_STATIC = (1<<21), // a marker for purge mechanism (not used by engine)
|
||||
TF_TEXTURE_RECTANGLE= (1<<22), // this is GL_TEXTURE_RECTANGLE
|
||||
TF_ALPHA_BORDER = (1<<23), // clamp to (0,0,0,255) (probably no difference)
|
||||
TF_IMAGE_PROGRAM = (1<<24), // enable image program support like in Doom3
|
||||
TF_ALPHACONTRAST = (1<<25), // special texture flags for internal usage
|
||||
TF_FLOAT = (1<<26), // float textures
|
||||
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
|
||||
TF_FLOATDATA = (1<<28), // incoming dataType has type GL_FLOAT
|
||||
} texFlags_t; |
||||
|
||||
typedef struct beam_s BEAM; |
||||
typedef struct particle_s particle_t; |
||||
|
||||
// 12 bytes here
|
||||
typedef struct modelstate_s |
||||
{ |
||||
short sequence; |
||||
short frame; // 10 bits multiple by 4, should be enough
|
||||
byte blending[2]; |
||||
byte controller[4]; |
||||
byte body; |
||||
byte skin; |
||||
} modelstate_t; |
||||
|
||||
typedef struct decallist_s |
||||
{ |
||||
vec3_t position; |
||||
char name[64]; |
||||
short entityIndex; |
||||
byte depth; |
||||
byte flags; |
||||
float scale; |
||||
|
||||
// this is the surface plane that we hit so that
|
||||
// we can move certain decals across
|
||||
// transitions if they hit similar geometry
|
||||
vec3_t impactPlaneNormal; |
||||
|
||||
modelstate_t studio_state; // studio decals only
|
||||
} decallist_t; |
||||
|
||||
typedef struct render_api_s |
||||
{ |
||||
// Get renderer info (doesn't changes engine state at all)
|
||||
int (*RenderGetParm)( int parm, int arg ); // generic
|
||||
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale ); |
||||
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha ); |
||||
lightstyle_t* (*GetLightStyle)( int number ); |
||||
dlight_t* (*GetDynamicLight)( int number ); |
||||
dlight_t* (*GetEntityLight)( int number ); |
||||
byte (*TextureToTexGamma)( byte color ); // software gamma support
|
||||
void (*GetBeamChains)( BEAM ***active_beams, BEAM ***free_beams, particle_t ***free_trails ); |
||||
|
||||
// Set renderer info (tell engine about changes)
|
||||
void (*R_SetCurrentEntity)( struct cl_entity_s *ent ); // tell engine about both currententity and currentmodel
|
||||
void (*R_SetCurrentModel)( struct model_s *mod ); // change currentmodel but leave currententity unchanged
|
||||
void (*GL_SetWorldviewProjectionMatrix)( const float *glmatrix ); // update viewprojection matrix (tracers uses it)
|
||||
void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities
|
||||
|
||||
// Texture tools
|
||||
int (*GL_FindTexture)( const char *name ); |
||||
const char* (*GL_TextureName)( unsigned int texnum ); |
||||
const byte* (*GL_TextureData)( unsigned int texnum ); // may be NULL
|
||||
int (*GL_LoadTexture)( const char *name, const byte *buf, size_t size, int flags ); |
||||
int (*GL_CreateTexture)( const char *name, int width, int height, const void *buffer, int flags ); |
||||
void (*GL_SetTextureType)( unsigned int texnum, unsigned int type ); |
||||
void (*GL_TextureCacheFrame)( unsigned int texnum ); |
||||
void (*GL_FreeTexture)( unsigned int texnum ); |
||||
|
||||
// Decals manipulating (draw & remove)
|
||||
void (*DrawSingleDecal)( struct decal_s *pDecal, struct msurface_s *fa ); |
||||
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount ); |
||||
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
|
||||
|
||||
// AVIkit support
|
||||
void *(*AVI_LoadVideo)( const char *filename, int ignore_hwgamma ); |
||||
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration ); |
||||
long (*AVI_GetVideoFrameNumber)( void *Avi, float time ); |
||||
byte *(*AVI_GetVideoFrame)( void *Avi, long frame ); |
||||
void (*AVI_UploadRawFrame)( int texture, int cols, int rows, int width, int height, const byte *data ); |
||||
void (*AVI_FreeVideo)( void *Avi ); |
||||
int (*AVI_IsActive)( void *Avi ); |
||||
|
||||
// glState related calls (must use this instead of normal gl-calls to prevent de-synchornize local states between engine and the client)
|
||||
void (*GL_Bind)( int tmu, unsigned int texnum ); |
||||
void (*GL_SelectTexture)( int tmu ); |
||||
void (*GL_LoadTextureMatrix)( const float *glmatrix ); |
||||
void (*GL_TexMatrixIdentity)( void ); |
||||
void (*GL_CleanUpTextureUnits)( int last ); // pass 0 for clear all the texture units
|
||||
void (*GL_TexGen)( unsigned int coord, unsigned int mode ); |
||||
void (*GL_TextureTarget)( unsigned int target ); // change texture unit mode without bind texture
|
||||
void (*GL_TexCoordArrayMode)( unsigned int texmode ); |
||||
void (*GL_Reserved0)( void ); // for potential interface expansion without broken compatibility
|
||||
void (*GL_Reserved1)( void ); |
||||
void (*GL_Reserved2)( void ); |
||||
void (*GL_Reserved3)( void ); |
||||
|
||||
// Misc renderer functions
|
||||
void (*GL_DrawParticles)( const float *vieworg, const float *fwd, const float *rt, const float *up, unsigned int clipFlags ); |
||||
void (*EnvShot)( const float *vieworg, const char *name, qboolean skyshot, int shotsize ); // creates a cubemap or skybox into gfx\env folder
|
||||
int (*COM_CompareFileTime)( const char *filename1, const char *filename2, int *iCompare ); |
||||
void (*Host_Error)( const char *error, ... ); // cause Host Error
|
||||
int (*SPR_LoadExt)( const char *szPicName, unsigned int texFlags ); // extended version of SPR_Load
|
||||
void (*TessPolygon)( struct msurface_s *surf, struct model_s *mod, float tessSize ); |
||||
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e ); |
||||
const struct ref_overview_s *( *GetOverviewParms )( void ); |
||||
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
|
||||
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
||||
// static allocations
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); |
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline ); |
||||
// find in files
|
||||
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly ); |
||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 35
|
||||
} render_api_t; |
||||
|
||||
// render callbacks
|
||||
typedef struct render_interface_s |
||||
{ |
||||
int version; |
||||
// passed through R_RenderFrame (0 - use engine renderer, 1 - use custom client renderer)
|
||||
int (*GL_RenderFrame)( const struct ref_params_s *pparams, qboolean drawWorld ); |
||||
// build all the lightmaps on new level or when gamma is changed
|
||||
void (*GL_BuildLightmaps)( void ); |
||||
// setup map bounds for ortho-projection when we in dev_overview mode
|
||||
void (*GL_OrthoBounds)( const float *mins, const float *maxs ); |
||||
// handle decals which hit mod_studio or mod_sprite
|
||||
void (*R_StudioDecalShoot)( int decalTexture, struct cl_entity_s *ent, const float *start, const float *pos, int flags, modelstate_t *state ); |
||||
// prepare studio decals for save
|
||||
int (*R_CreateStudioDecalList)( decallist_t *pList, int count, qboolean changelevel ); |
||||
// clear decals by engine request (e.g. for demo recording or vid_restart)
|
||||
void (*R_ClearStudioDecals)( void ); |
||||
// grab r_speeds message
|
||||
qboolean (*R_SpeedsMessage)( char *out, size_t size ); |
||||
// replace with built-in R_DrawCubemapView for make skyshots or envshots
|
||||
qboolean (*R_DrawCubemapView)( const float *origin, const float *angles, int size ); |
||||
// alloc or destroy studiomodel custom data
|
||||
void (*Mod_ProcessUserData)( struct model_s *mod, qboolean create, const byte *buffer ); |
||||
} render_interface_t; |
||||
|
||||
#endif//RENDER_API_H
|
@ -1,24 +0,0 @@
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
wrect.h - rectangle definition |
||||
Copyright (C) 2010 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef WRECT_H |
||||
#define WRECT_H |
||||
|
||||
typedef struct wrect_s |
||||
{ |
||||
int left, right, top, bottom; |
||||
} wrect_t; |
||||
|
||||
#endif//WRECT_H
|
@ -1,33 +0,0 @@
@@ -1,33 +0,0 @@
|
||||
/***
|
||||
* |
||||
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. |
||||
* |
||||
* This product contains software technology licensed from Id |
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. |
||||
* All Rights Reserved. |
||||
* |
||||
* Use, distribution, and modification of this source code and/or resulting |
||||
* object code is restricted to non-commercial enhancements to products from |
||||
* Valve LLC. All other use, distribution, or modification is prohibited |
||||
* without written permission from Valve LLC. |
||||
* |
||||
****/ |
||||
#pragma once |
||||
#ifndef PHYSCALLBACK_H |
||||
#define PHYSCALLBACK_H |
||||
|
||||
#include "physint.h" |
||||
|
||||
// Must be provided by user of this code
|
||||
extern server_physics_api_t g_physfuncs; |
||||
|
||||
// The actual physic callbacks
|
||||
#define LINK_ENTITY (*g_physfuncs.pfnLinkEdict) |
||||
#define PHYSICS_TIME (*g_physfuncs.pfnGetServerTime) |
||||
#define HOST_FRAMETIME (*g_physfuncs.pfnGetFrameTime) |
||||
#define MODEL_HANDLE (*g_physfuncs.pfnGetModel) |
||||
#define GET_AREANODE (*g_physfuncs.pfnGetHeadnode) |
||||
#define GET_SERVER_STATE (*g_physfuncs.pfnServerState) |
||||
#define HOST_ERROR (*g_physfuncs.pfnHost_Error) |
||||
|
||||
#endif //PHYSCALLBACK_H
|
@ -1,70 +0,0 @@
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
cdll_exp.h - exports for client |
||||
Copyright (C) 2013 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef CDLL_EXP_H |
||||
#define CDLL_EXP_H |
||||
|
||||
// NOTE: ordering is important!
|
||||
typedef struct cldll_func_s |
||||
{ |
||||
int (*pfnInitialize)( cl_enginefunc_t *pEnginefuncs, int iVersion ); |
||||
void (*pfnInit)( void ); |
||||
int (*pfnVidInit)( void ); |
||||
int (*pfnRedraw)( float flTime, int intermission ); |
||||
int (*pfnUpdateClientData)( client_data_t *cdata, float flTime ); |
||||
void (*pfnReset)( void ); |
||||
void (*pfnPlayerMove)( struct playermove_s *ppmove, int server ); |
||||
void (*pfnPlayerMoveInit)( struct playermove_s *ppmove ); |
||||
char (*pfnPlayerMoveTexture)( char *name ); |
||||
void (*IN_ActivateMouse)( void ); |
||||
void (*IN_DeactivateMouse)( void ); |
||||
void (*IN_MouseEvent)( int mstate ); |
||||
void (*IN_ClearStates)( void ); |
||||
void (*IN_Accumulate)( void ); |
||||
void (*CL_CreateMove)( float frametime, struct usercmd_s *cmd, int active ); |
||||
int (*CL_IsThirdPerson)( void ); |
||||
void (*CL_CameraOffset)( float *ofs ); |
||||
void *(*KB_Find)( const char *name ); |
||||
void (*CAM_Think)( void ); // camera stuff
|
||||
void (*pfnCalcRefdef)( ref_params_t *pparams ); |
||||
int (*pfnAddEntity)( int type, cl_entity_t *ent, const char *modelname ); |
||||
void (*pfnCreateEntities)( void ); |
||||
void (*pfnDrawNormalTriangles)( void ); |
||||
void (*pfnDrawTransparentTriangles)( void ); |
||||
void (*pfnStudioEvent)( const struct mstudioevent_s *event, const cl_entity_t *entity ); |
||||
void (*pfnPostRunCmd)( struct local_state_s *from, struct local_state_s *to, usercmd_t *cmd, int runfuncs, double time, unsigned int random_seed ); |
||||
void (*pfnShutdown)( void ); |
||||
void (*pfnTxferLocalOverrides)( entity_state_t *state, const clientdata_t *client ); |
||||
void (*pfnProcessPlayerState)( entity_state_t *dst, const entity_state_t *src ); |
||||
void (*pfnTxferPredictionData)( entity_state_t *ps, const entity_state_t *pps, clientdata_t *pcd, const clientdata_t *ppcd, weapon_data_t *wd, const weapon_data_t *pwd ); |
||||
void (*pfnDemo_ReadBuffer)( int size, byte *buffer ); |
||||
int (*pfnConnectionlessPacket)( const struct netadr_s *net_from, const char *args, char *buffer, int *size ); |
||||
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs ); |
||||
void (*pfnFrame)( double time ); |
||||
int (*pfnKey_Event)( int eventcode, int keynum, const char *pszCurrentBinding ); |
||||
void (*pfnTempEntUpdate)( double frametime, double client_time, double cl_gravity, struct tempent_s **ppTempEntFree, struct tempent_s **ppTempEntActive, int ( *Callback_AddVisibleEntity )( cl_entity_t *pEntity ), void ( *Callback_TempEntPlaySound )( struct tempent_s *pTemp, float damp )); |
||||
cl_entity_t *(*pfnGetUserEntity)( int index ); |
||||
void (*pfnVoiceStatus)( int entindex, qboolean bTalking ); |
||||
void (*pfnDirectorMessage)( int iSize, void *pbuf ); |
||||
int (*pfnGetStudioModelInterface)( int version, struct r_studio_interface_s **ppinterface, struct engine_studio_api_s *pstudio ); |
||||
void (*pfnChatInputPosition)( int *x, int *y ); |
||||
int (*pfnGetPlayerTeam)( int playerIndex ); |
||||
void *(*pfnGetClientFactory)( void ); |
||||
// Xash3D extension
|
||||
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback ); |
||||
void (*pfnClipMoveToEntity)( struct physent_s *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, struct pmtrace_s *tr ); |
||||
} cldll_func_t; |
||||
|
||||
#endif//CDLL_EXP_H
|
@ -1,188 +0,0 @@
@@ -1,188 +0,0 @@
|
||||
/*
|
||||
menu_int.h - interface between engine and menu |
||||
Copyright (C) 2010 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef MENU_INT_H |
||||
#define MENU_INT_H |
||||
|
||||
#include "cvardef.h" |
||||
#include "gameinfo.h" |
||||
#include "wrect.h" |
||||
|
||||
typedef int HIMAGE; // handle to a graphic
|
||||
|
||||
// flags for PIC_Load
|
||||
#define PIC_NEAREST (1<<0) // disable texfilter
|
||||
#define PIC_KEEP_RGBDATA (1<<1) // some images keep source
|
||||
#define PIC_NOFLIP_TGA (1<<2) // Steam background completely ignore tga attribute 0x20
|
||||
#define PIC_KEEP_8BIT (1<<3) // keep original 8-bit image (if present)
|
||||
|
||||
typedef struct ui_globalvars_s |
||||
{ |
||||
float time; // unclamped host.realtime
|
||||
float frametime; |
||||
|
||||
int scrWidth; // actual values
|
||||
int scrHeight; |
||||
|
||||
int maxClients; |
||||
int developer; |
||||
int demoplayback; |
||||
int demorecording; |
||||
char demoname[64]; // name of currently playing demo
|
||||
char maptitle[64]; // title of active map
|
||||
} ui_globalvars_t; |
||||
|
||||
typedef struct ui_enginefuncs_s |
||||
{ |
||||
// image handlers
|
||||
HIMAGE (*pfnPIC_Load)( const char *szPicName, const byte *ucRawImage, long ulRawImageSize, long flags ); |
||||
void (*pfnPIC_Free)( const char *szPicName ); |
||||
int (*pfnPIC_Width)( HIMAGE hPic ); |
||||
int (*pfnPIC_Height)( HIMAGE hPic ); |
||||
void (*pfnPIC_Set)( HIMAGE hPic, int r, int g, int b, int a ); |
||||
void (*pfnPIC_Draw)( int x, int y, int width, int height, const wrect_t *prc ); |
||||
void (*pfnPIC_DrawHoles)( int x, int y, int width, int height, const wrect_t *prc ); |
||||
void (*pfnPIC_DrawTrans)( int x, int y, int width, int height, const wrect_t *prc ); |
||||
void (*pfnPIC_DrawAdditive)( int x, int y, int width, int height, const wrect_t *prc ); |
||||
void (*pfnPIC_EnableScissor)( int x, int y, int width, int height ); |
||||
void (*pfnPIC_DisableScissor)( void ); |
||||
|
||||
// screen handlers
|
||||
void (*pfnFillRGBA)( int x, int y, int width, int height, int r, int g, int b, int a ); |
||||
|
||||
// cvar handlers
|
||||
cvar_t* (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags ); |
||||
float (*pfnGetCvarFloat)( const char *szName ); |
||||
char* (*pfnGetCvarString)( const char *szName ); |
||||
void (*pfnCvarSetString)( const char *szName, const char *szValue ); |
||||
void (*pfnCvarSetValue)( const char *szName, float flValue ); |
||||
|
||||
// command handlers
|
||||
int (*pfnAddCommand)( const char *cmd_name, void (*function)(void) ); |
||||
void (*pfnClientCmd)( int execute_now, const char *szCmdString ); |
||||
void (*pfnDelCommand)( const char *cmd_name ); |
||||
int (*pfnCmdArgc)( void ); |
||||
char* (*pfnCmdArgv)( int argc ); |
||||
char* (*pfnCmd_Args)( void ); |
||||
|
||||
// debug messages (in-menu shows only notify)
|
||||
void (*Con_Printf)( char *fmt, ... ); |
||||
void (*Con_DPrintf)( char *fmt, ... ); |
||||
void (*Con_NPrintf)( int pos, char *fmt, ... ); |
||||
void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... ); |
||||
|
||||
// sound handlers
|
||||
void (*pfnPlayLocalSound)( const char *szSound ); |
||||
|
||||
// cinematic handlers
|
||||
void (*pfnDrawLogo)( const char *filename, float x, float y, float width, float height ); |
||||
int (*pfnGetLogoWidth)( void ); |
||||
int (*pfnGetLogoHeight)( void ); |
||||
float (*pfnGetLogoLength)( void ); // cinematic duration in seconds
|
||||
|
||||
// text message system
|
||||
void (*pfnDrawCharacter)( int x, int y, int width, int height, int ch, int ulRGBA, HIMAGE hFont ); |
||||
int (*pfnDrawConsoleString)( int x, int y, const char *string ); |
||||
void (*pfnDrawSetTextColor)( int r, int g, int b, int alpha ); |
||||
void (*pfnDrawConsoleStringLen)( const char *string, int *length, int *height ); |
||||
void (*pfnSetConsoleDefaultColor)( int r, int g, int b ); // color must came from colors.lst
|
||||
|
||||
// custom rendering (for playermodel preview)
|
||||
struct cl_entity_s* (*pfnGetPlayerModel)( void ); // for drawing playermodel previews
|
||||
void (*pfnSetModel)( struct cl_entity_s *ed, const char *path ); |
||||
void (*pfnClearScene)( void ); |
||||
void (*pfnRenderScene)( const struct ref_params_s *fd ); |
||||
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent ); |
||||
|
||||
// misc handlers
|
||||
void (*pfnHostError)( const char *szFmt, ... ); |
||||
int (*pfnFileExists)( const char *filename, int gamedironly ); |
||||
void (*pfnGetGameDir)( char *szGetGameDir ); |
||||
|
||||
// gameinfo handlers
|
||||
int (*pfnCreateMapsList)( int fRefresh ); |
||||
int (*pfnClientInGame)( void ); |
||||
void (*pfnClientJoin)( const struct netadr_s adr ); |
||||
|
||||
// parse txt files
|
||||
byte* (*COM_LoadFile)( const char *filename, int *pLength ); |
||||
char* (*COM_ParseFile)( char *data, char *token ); |
||||
void (*COM_FreeFile)( void *buffer ); |
||||
|
||||
// keyfuncs
|
||||
void (*pfnKeyClearStates)( void ); // call when menu open or close
|
||||
void (*pfnSetKeyDest)( int dest ); |
||||
const char *(*pfnKeynumToString)( int keynum ); |
||||
const char *(*pfnKeyGetBinding)( int keynum ); |
||||
void (*pfnKeySetBinding)( int keynum, const char *binding ); |
||||
int (*pfnKeyIsDown)( int keynum ); |
||||
int (*pfnKeyGetOverstrikeMode)( void ); |
||||
void (*pfnKeySetOverstrikeMode)( int fActive ); |
||||
void *(*pfnKeyGetState)( const char *name ); // for mlook, klook etc
|
||||
|
||||
// engine memory manager
|
||||
void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); |
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline ); |
||||
|
||||
// collect info from engine
|
||||
int (*pfnGetGameInfo)( GAMEINFO *pgameinfo ); |
||||
GAMEINFO **(*pfnGetGamesList)( int *numGames ); // collect info about all mods
|
||||
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly ); // find in files
|
||||
int (*pfnGetSaveComment)( const char *savename, char *comment ); |
||||
int (*pfnGetDemoComment)( const char *demoname, char *comment ); |
||||
int (*pfnCheckGameDll)( void ); // returns false if hl.dll is missed or invalid
|
||||
char *(*pfnGetClipboardData)( void ); |
||||
|
||||
// engine launcher
|
||||
void (*pfnShellExecute)( const char *name, const char *args, int closeEngine ); |
||||
void (*pfnWriteServerConfig)( const char *name ); |
||||
void (*pfnChangeInstance)( const char *newInstance, const char *szFinalMessage ); |
||||
void (*pfnPlayBackgroundTrack)( const char *introName, const char *loopName ); |
||||
void (*pfnHostEndGame)( const char *szFinalMessage ); |
||||
|
||||
// menu interface is freezed at version 0.75
|
||||
// new functions starts here
|
||||
float (*pfnRandomFloat)( float flLow, float flHigh ); |
||||
int (*pfnRandomLong)( int lLow, int lHigh ); |
||||
|
||||
void (*pfnSetCursor)( void *hCursor ); // change cursor
|
||||
int (*pfnIsMapValid)( char *filename ); |
||||
void (*pfnProcessImage)( int texnum, float gamma, int topColor, int bottomColor ); |
||||
int (*pfnCompareFileTime)( char *filename1, char *filename2, int *iCompare ); |
||||
} ui_enginefuncs_t; |
||||
|
||||
typedef struct |
||||
{ |
||||
int (*pfnVidInit)( void ); |
||||
void (*pfnInit)( void ); |
||||
void (*pfnShutdown)( void ); |
||||
void (*pfnRedraw)( float flTime ); |
||||
void (*pfnKeyEvent)( int key, int down ); |
||||
void (*pfnMouseMove)( int x, int y ); |
||||
void (*pfnSetActiveMenu)( int active ); |
||||
void (*pfnAddServerToList)( struct netadr_s adr, const char *info ); |
||||
void (*pfnGetCursorPos)( int *pos_x, int *pos_y ); |
||||
void (*pfnSetCursorPos)( int pos_x, int pos_y ); |
||||
void (*pfnShowCursor)( int show ); |
||||
void (*pfnCharEvent)( int key ); |
||||
int (*pfnMouseInRect)( void ); // mouse entering\leave game window
|
||||
int (*pfnIsVisible)( void ); |
||||
int (*pfnCreditsActive)( void ); // unused
|
||||
void (*pfnFinalCredits)( void ); // show credits + game end
|
||||
} UI_FUNCTIONS; |
||||
|
||||
typedef int (*MENUAPI)( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* engfuncs, ui_globalvars_t *pGlobals ); |
||||
|
||||
#endif//MENU_INT_H
|
@ -1,114 +0,0 @@
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
physint.h - Server Physics Interface |
||||
Copyright (C) 2011 Uncle Mike |
||||
|
||||
This program is free software: you can redistribute it and/or modify |
||||
it under the terms of the GNU General Public License as published by |
||||
the Free Software Foundation, either version 3 of the License, or |
||||
(at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
GNU General Public License for more details. |
||||
*/ |
||||
#pragma once |
||||
#ifndef PHYSINT_H |
||||
#define PHYSINT_H |
||||
|
||||
#define SV_PHYSICS_INTERFACE_VERSION 6 |
||||
|
||||
#define STRUCT_FROM_LINK( l, t, m ) ((t *)((byte *)l - (int)&(((t *)0)->m))) |
||||
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, edict_t, area ) |
||||
|
||||
// values that can be returned with pfnServerState
|
||||
#define SERVER_DEAD 0 |
||||
#define SERVER_LOADING 1 |
||||
#define SERVER_ACTIVE 2 |
||||
|
||||
typedef struct areanode_s |
||||
{ |
||||
int axis; // -1 = leaf node
|
||||
float dist; |
||||
struct areanode_s *children[2]; |
||||
link_t trigger_edicts; |
||||
link_t solid_edicts; |
||||
link_t water_edicts; // func water
|
||||
} areanode_t; |
||||
|
||||
typedef struct server_physics_api_s |
||||
{ |
||||
// unlink edict from old position and link onto new
|
||||
void ( *pfnLinkEdict) ( edict_t *ent, qboolean touch_triggers ); |
||||
double ( *pfnGetServerTime )( void ); // unclamped
|
||||
double ( *pfnGetFrameTime )( void ); // unclamped
|
||||
void* ( *pfnGetModel )( int modelindex ); |
||||
areanode_t* ( *pfnGetHeadnode )( void ); // BSP tree for all physic entities
|
||||
int ( *pfnServerState )( void ); |
||||
void ( *pfnHost_Error )( const char *error, ... ); // cause Host Error
|
||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 6
|
||||
struct triangleapi_s *pTriAPI; // draw coliisions etc. Only for local system
|
||||
|
||||
// draw debug messages (must be called from DrawOrthoTriangles). Only for local system
|
||||
int ( *pfnDrawConsoleString )( int x, int y, char *string ); |
||||
void ( *pfnDrawSetTextColor )( float r, float g, float b ); |
||||
void ( *pfnDrawConsoleStringLen )( const char *string, int *length, int *height ); |
||||
void ( *Con_NPrintf )( int pos, char *fmt, ... ); |
||||
void ( *Con_NXPrintf )( struct con_nprint_s *info, char *fmt, ... ); |
||||
const char *( *pfnGetLightStyle )( int style ); // read custom appreance for selected lightstyle
|
||||
void ( *pfnUpdateFogSettings )( unsigned int packed_fog ); |
||||
char **(*pfnGetFilesList)( const char *pattern, int *numFiles, int gamedironly ); |
||||
struct msurface_s *(*pfnTraceSurface)( edict_t *pTextureEntity, const float *v1, const float *v2 ); |
||||
const byte *(*pfnGetTextureData)( unsigned int texnum ); |
||||
|
||||
// static allocations
|
||||
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); |
||||
void (*pfnMemFree)( void *mem, const char *filename, const int fileline ); |
||||
} server_physics_api_t; |
||||
|
||||
// physic callbacks
|
||||
typedef struct physics_interface_s |
||||
{ |
||||
int version; |
||||
// passed through pfnCreate (0 is attempt to create, -1 is reject)
|
||||
int ( *SV_CreateEntity )( edict_t *pent, const char *szName ); |
||||
// run custom physics for each entity (return 0 to use built-in engine physic)
|
||||
int ( *SV_PhysicsEntity )( edict_t *pEntity ); |
||||
// spawn entities with internal mod function e.g. for re-arrange spawn order (0 - use engine parser, 1 - use mod parser)
|
||||
int ( *SV_LoadEntities )( const char *mapname, char *entities ); |
||||
// update conveyor belt for clients
|
||||
void ( *SV_UpdatePlayerBaseVelocity )( edict_t *ent ); |
||||
// The game .dll should return 1 if save game should be allowed
|
||||
int ( *SV_AllowSaveGame )( void ); |
||||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 6
|
||||
// override trigger area checking and touching
|
||||
int ( *SV_TriggerTouch )( edict_t *pent, edict_t *trigger ); |
||||
// some engine features can be enabled only through this function
|
||||
unsigned int ( *SV_CheckFeatures )( void ); |
||||
// used for draw debug collisions for custom physic engine etc
|
||||
void ( *DrawDebugTriangles )( void ); |
||||
// used for draw debug overlay (textured)
|
||||
void ( *DrawNormalTriangles )( void ); |
||||
// used for draw debug messages (2d mode)
|
||||
void ( *DrawOrthoTriangles )( void ); |
||||
// tracing entities with SOLID_CUSTOM mode on a server (not used by pmove code)
|
||||
void ( *ClipMoveToEntity)( edict_t *ent, const float *start, float *mins, float *maxs, const float *end, trace_t *trace ); |
||||
// tracing entities with SOLID_CUSTOM mode on a server (only used by pmove code)
|
||||
void ( *ClipPMoveToEntity)( struct physent_s *pe, const float *start, float *mins, float *maxs, const float *end, struct pmtrace_s *tr ); |
||||
// called at end the frame of SV_Physics call
|
||||
void ( *SV_EndFrame )( void ); |
||||
// called through save\restore process
|
||||
void (*pfnCreateEntitiesInTransitionList)( SAVERESTOREDATA*, int levelMask ); |
||||
// called through save\restore process
|
||||
void (*pfnCreateEntitiesInRestoreList)( SAVERESTOREDATA*, int createPlayers ); |
||||
// allocate custom string (e.g. using user implementation of stringtable, not engine strings)
|
||||
string_t (*pfnAllocString)( const char *szValue ); |
||||
// make custom string (e.g. using user implementation of stringtable, not engine strings)
|
||||
string_t (*pfnMakeString)( const char *szValue ); |
||||
// read custom string (e.g. using user implementation of stringtable, not engine strings)
|
||||
const char* (*pfnGetString)( string_t iString ); |
||||
// helper for restore custom decals that have custom message (e.g. Paranoia)
|
||||
int (*pfnRestoreDecal)( struct decallist_s *entry, edict_t *pEdict, qboolean adjacent ); |
||||
} physics_interface_t; |
||||
|
||||
#endif//PHYSINT_H
|
@ -1,53 +0,0 @@
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc. |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program; if not, write to the Free Software |
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
||||
*/ |
||||
|
||||
|
||||
0.000000, 0.098165, 0.196270, 0.294259, 0.392069, 0.489643, 0.586920, 0.683850, |
||||
0.780360, 0.876405, 0.971920, 1.066850, 1.161140, 1.254725, 1.347560, 1.439580, |
||||
1.530735, 1.620965, 1.710220, 1.798445, 1.885585, 1.971595, 2.056410, 2.139990, |
||||
2.222280, 2.303235, 2.382795, 2.460925, 2.537575, 2.612690, 2.686235, 2.758160, |
||||
2.828425, 2.896990, 2.963805, 3.028835, 3.092040, 3.153385, 3.212830, 3.270340, |
||||
3.325880, 3.379415, 3.430915, 3.480350, 3.527685, 3.572895, 3.615955, 3.656840, |
||||
3.695520, 3.731970, 3.766175, 3.798115, 3.827760, 3.855105, 3.880125, 3.902810, |
||||
3.923140, 3.941110, 3.956705, 3.969920, 3.980740, 3.989160, 3.995180, 3.998795, |
||||
4.000000, 3.998795, 3.995180, 3.989160, 3.980740, 3.969920, 3.956705, 3.941110, |
||||
3.923140, 3.902810, 3.880125, 3.855105, 3.827760, 3.798115, 3.766175, 3.731970, |
||||
3.695520, 3.656840, 3.615955, 3.572895, 3.527685, 3.480350, 3.430915, 3.379415, |
||||
3.325880, 3.270340, 3.212830, 3.153385, 3.092040, 3.028835, 2.963805, 2.896990, |
||||
2.828425, 2.758160, 2.686235, 2.612690, 2.537575, 2.460925, 2.382795, 2.303235, |
||||
2.222280, 2.139990, 2.056410, 1.971595, 1.885585, 1.798445, 1.710220, 1.620965, |
||||
1.530735, 1.439580, 1.347560, 1.254725, 1.161140, 1.066850, 0.971920, 0.876405, |
||||
0.780360, 0.683850, 0.586920, 0.489643, 0.392069, 0.294259, 0.196270, 0.098165, |
||||
0.000000, -0.098165, -0.196270, -0.294259, -0.392069, -0.489643, -0.586920, -0.683850, |
||||
-0.780360, -0.876405, -0.971920, -1.066850, -1.161140, -1.254725, -1.347560, -1.439580, |
||||
-1.530735, -1.620965, -1.710220, -1.798445, -1.885585, -1.971595, -2.056410, -2.139990, |
||||
-2.222280, -2.303235, -2.382795, -2.460925, -2.537575, -2.612690, -2.686235, -2.758160, |
||||
-2.828425, -2.896990, -2.963805, -3.028835, -3.092040, -3.153385, -3.212830, -3.270340, |
||||
-3.325880, -3.379415, -3.430915, -3.480350, -3.527685, -3.572895, -3.615955, -3.656840, |
||||
-3.695520, -3.731970, -3.766175, -3.798115, -3.827760, -3.855105, -3.880125, -3.902810, |
||||
-3.923140, -3.941110, -3.956705, -3.969920, -3.980740, -3.989160, -3.995180, -3.998795, |
||||
-4.000000, -3.998795, -3.995180, -3.989160, -3.980740, -3.969920, -3.956705, -3.941110, |
||||
-3.923140, -3.902810, -3.880125, -3.855105, -3.827760, -3.798115, -3.766175, -3.731970, |
||||
-3.695520, -3.656840, -3.615955, -3.572895, -3.527685, -3.480350, -3.430915, -3.379415, |
||||
-3.325880, -3.270340, -3.212830, -3.153385, -3.092040, -3.028835, -2.963805, -2.896990, |
||||
-2.828425, -2.758160, -2.686235, -2.612690, -2.537575, -2.460925, -2.382795, -2.303235, |
||||
-2.222280, -2.139990, -2.056410, -1.971595, -1.885585, -1.798445, -1.710220, -1.620965, |
||||
-1.530735, -1.439580, -1.347560, -1.254725, -1.161140, -1.066850, -0.971920, -0.876405, |
||||
-0.780360, -0.683850, -0.586920, -0.489643, -0.392069, -0.294259, -0.196270, -0.098165, |
Loading…
Reference in new issue