Browse Source

Added mdl decompiler

master
M.C. 10 months ago
parent
commit
7faa3b8b77
  1. 46
      Makefile
  2. 0
      src_mdl/LICENSE
  3. 39
      src_mdl/Makefile
  4. 0
      src_mdl/README
  5. 0
      src_mdl/common/studio_event.h
  6. 0
      src_mdl/dlls/activity.h
  7. 0
      src_mdl/dlls/activitymap.h
  8. 0
      src_mdl/engine/studio.h
  9. 0
      src_mdl/public/archtypes.h
  10. 0
      src_mdl/public/steam/steamtypes.h
  11. 0
      src_mdl/utils/common/cmdlib.c
  12. 0
      src_mdl/utils/common/cmdlib.h
  13. BIN
      src_mdl/utils/common/cmdlib.o
  14. 0
      src_mdl/utils/common/lbmlib.c
  15. 0
      src_mdl/utils/common/lbmlib.h
  16. BIN
      src_mdl/utils/common/lbmlib.o
  17. 0
      src_mdl/utils/common/mathlib.c
  18. 0
      src_mdl/utils/common/mathlib.h
  19. BIN
      src_mdl/utils/common/mathlib.o
  20. 0
      src_mdl/utils/common/scriplib.c
  21. 0
      src_mdl/utils/common/scriplib.h
  22. BIN
      src_mdl/utils/common/scriplib.o
  23. 0
      src_mdl/utils/common/trilib.c
  24. 0
      src_mdl/utils/common/trilib.h
  25. BIN
      src_mdl/utils/common/trilib.o
  26. 0
      src_mdl/utils/studiomdl/bmpread.c
  27. BIN
      src_mdl/utils/studiomdl/bmpread.o
  28. 0
      src_mdl/utils/studiomdl/studiomdl.c
  29. 0
      src_mdl/utils/studiomdl/studiomdl.h
  30. BIN
      src_mdl/utils/studiomdl/studiomdl.o
  31. 0
      src_mdl/utils/studiomdl/tristrip.c
  32. BIN
      src_mdl/utils/studiomdl/tristrip.o
  33. 0
      src_mdl/utils/studiomdl/write.c
  34. BIN
      src_mdl/utils/studiomdl/write.o
  35. 49
      src_mdldec/Makefile
  36. 303
      src_mdldec/common/bspfile.h
  37. 523
      src_mdldec/common/com_model.h
  38. 765
      src_mdldec/common/const.h
  39. 45
      src_mdldec/common/cvardef.h
  40. 32
      src_mdldec/common/port.h
  41. 37
      src_mdldec/common/studio_event.h
  42. 151
      src_mdldec/common/types.h
  43. 177
      src_mdldec/engine/anorms.h
  44. 37
      src_mdldec/engine/common/imagelib/img_bmp.h
  45. 93
      src_mdldec/engine/custom.h
  46. 510
      src_mdldec/engine/eiface.h
  47. 1003
      src_mdldec/engine/studio.h
  48. 26
      src_mdldec/public/crclib.h
  49. 1021
      src_mdldec/public/crtlib.c
  50. 79
      src_mdldec/public/crtlib.h
  51. BIN
      src_mdldec/public/crtlib.o
  52. 860
      src_mdldec/public/mathlib.c
  53. 214
      src_mdldec/public/mathlib.h
  54. BIN
      src_mdldec/public/mathlib.o
  55. 836
      src_mdldec/public/matrixlib.c
  56. BIN
      src_mdldec/public/matrixlib.o
  57. 322
      src_mdldec/utils/mdldec/mdldec.c
  58. 11
      src_mdldec/utils/mdldec/mdldec.h
  59. BIN
      src_mdldec/utils/mdldec/mdldec.o
  60. 633
      src_mdldec/utils/mdldec/qc.c
  61. 10
      src_mdldec/utils/mdldec/qc.h
  62. BIN
      src_mdldec/utils/mdldec/qc.o
  63. 541
      src_mdldec/utils/mdldec/smd.c
  64. 7
      src_mdldec/utils/mdldec/smd.h
  65. BIN
      src_mdldec/utils/mdldec/smd.o
  66. 115
      src_mdldec/utils/mdldec/texture.c
  67. 7
      src_mdldec/utils/mdldec/texture.h
  68. BIN
      src_mdldec/utils/mdldec/texture.o
  69. 70
      src_mdldec/utils/mdldec/utils.c
  70. 9
      src_mdldec/utils/mdldec/utils.h
  71. BIN
      src_mdldec/utils/mdldec/utils.o
  72. 7
      src_mdldec/utils/mdldec/version.h

46
Makefile

@ -1,39 +1,11 @@
# studiomdl Makefile
STUDIOMDL_CFLAGS=-Os -I./utils/common/ -I./public/ -I./common/
STUDIOMDL_LDFLAGS=-lm -lpthread
DO_CC=$(CC) $(CFLAGS) $(STUDIOMDL_CFLAGS) -o $@ -c $<
.c.o:
$(DO_CC)
STUDIOMDL_OBJS = \
utils/studiomdl/bmpread.o \
utils/common/cmdlib.o \
utils/common/lbmlib.o \
utils/common/mathlib.o \
utils/common/scriplib.o \
utils/studiomdl/studiomdl.o \
utils/common/trilib.o \
utils/studiomdl/tristrip.o \
utils/studiomdl/write.o
# binary target
studiomdl: $(STUDIOMDL_OBJS)
$(CC) -o $@ $(STUDIOMDL_OBJS) $(LDFLAGS) $(STUDIOMDL_LDFLAGS)
all:
cd src_mdl && $(MAKE)
cd src_mdldec && $(MAKE)
mv src_mdl/mdl mdl
mv src_mdldec/mdldec mdldec
clean:
-rm -f ./utils/studiomdl/*.o
-rm -f ./utils/common/*.o
-rm studiomdl
cd src_mdl && $(MAKE) clean
cd src_mdldec && $(MAKE) clean
rm -f mdl
rm -f mdldec
# object files
utils/studiomdl/bmpread.o: utils/studiomdl/bmpread.c
utils/common/cmdlib.o: utils/common/cmdlib.c
utils/common/lbmlib.o: utils/common/lbmlib.c
utils/common/mathlib.o: utils/common/mathlib.c
utils/common/scriplib.o: utils/common/scriplib.c
utils/studiomdl/studiomdl.o: utils/studiomdl/studiomdl.c
utils/common/trilib.o: utils/common/trilib.c
utils/studiomdl/tristrip.o: utils/studiomdl/tristrip.c
utils/studiomdl/write.o: utils/studiomdl/write.c

0
LICENSE → src_mdl/LICENSE

39
src_mdl/Makefile

@ -0,0 +1,39 @@
# studiomdl Makefile
STUDIOMDL_CFLAGS=-Os -I./utils/common/ -I./public/ -I./common/
STUDIOMDL_LDFLAGS=-lm -lpthread
DO_CC=$(CC) $(CFLAGS) $(STUDIOMDL_CFLAGS) -o $@ -c $<
.c.o:
$(DO_CC)
STUDIOMDL_OBJS = \
utils/studiomdl/bmpread.o \
utils/common/cmdlib.o \
utils/common/lbmlib.o \
utils/common/mathlib.o \
utils/common/scriplib.o \
utils/studiomdl/studiomdl.o \
utils/common/trilib.o \
utils/studiomdl/tristrip.o \
utils/studiomdl/write.o
# binary target
mdl: $(STUDIOMDL_OBJS)
$(CC) -o $@ $(STUDIOMDL_OBJS) $(LDFLAGS) $(STUDIOMDL_LDFLAGS)
clean:
-rm -f ./utils/studiomdl/*.o
-rm -f ./utils/common/*.o
-rm -f mdl
# object files
utils/studiomdl/bmpread.o: utils/studiomdl/bmpread.c
utils/common/cmdlib.o: utils/common/cmdlib.c
utils/common/lbmlib.o: utils/common/lbmlib.c
utils/common/mathlib.o: utils/common/mathlib.c
utils/common/scriplib.o: utils/common/scriplib.c
utils/studiomdl/studiomdl.o: utils/studiomdl/studiomdl.c
utils/common/trilib.o: utils/common/trilib.c
utils/studiomdl/tristrip.o: utils/studiomdl/tristrip.c
utils/studiomdl/write.o: utils/studiomdl/write.c

0
README → src_mdl/README

0
common/studio_event.h → src_mdl/common/studio_event.h

0
dlls/activity.h → src_mdl/dlls/activity.h

0
dlls/activitymap.h → src_mdl/dlls/activitymap.h

0
engine/studio.h → src_mdl/engine/studio.h

0
public/archtypes.h → src_mdl/public/archtypes.h

0
public/steam/steamtypes.h → src_mdl/public/steam/steamtypes.h

0
utils/common/cmdlib.c → src_mdl/utils/common/cmdlib.c

0
utils/common/cmdlib.h → src_mdl/utils/common/cmdlib.h

BIN
src_mdl/utils/common/cmdlib.o

Binary file not shown.

0
utils/common/lbmlib.c → src_mdl/utils/common/lbmlib.c

0
utils/common/lbmlib.h → src_mdl/utils/common/lbmlib.h

BIN
src_mdl/utils/common/lbmlib.o

Binary file not shown.

0
utils/common/mathlib.c → src_mdl/utils/common/mathlib.c

0
utils/common/mathlib.h → src_mdl/utils/common/mathlib.h

BIN
src_mdl/utils/common/mathlib.o

Binary file not shown.

0
utils/common/scriplib.c → src_mdl/utils/common/scriplib.c

0
utils/common/scriplib.h → src_mdl/utils/common/scriplib.h

BIN
src_mdl/utils/common/scriplib.o

Binary file not shown.

0
utils/common/trilib.c → src_mdl/utils/common/trilib.c

0
utils/common/trilib.h → src_mdl/utils/common/trilib.h

BIN
src_mdl/utils/common/trilib.o

Binary file not shown.

0
utils/studiomdl/bmpread.c → src_mdl/utils/studiomdl/bmpread.c

BIN
src_mdl/utils/studiomdl/bmpread.o

Binary file not shown.

0
utils/studiomdl/studiomdl.c → src_mdl/utils/studiomdl/studiomdl.c

0
utils/studiomdl/studiomdl.h → src_mdl/utils/studiomdl/studiomdl.h

BIN
src_mdl/utils/studiomdl/studiomdl.o

Binary file not shown.

0
utils/studiomdl/tristrip.c → src_mdl/utils/studiomdl/tristrip.c

BIN
src_mdl/utils/studiomdl/tristrip.o

Binary file not shown.

0
utils/studiomdl/write.c → src_mdl/utils/studiomdl/write.c

BIN
src_mdl/utils/studiomdl/write.o

Binary file not shown.

49
src_mdldec/Makefile

@ -0,0 +1,49 @@
MODULE = mdldec
CC ?= gcc
CFLAGS ?= -Os -pipe -DHAVE_TGMATH_H -DSTDINT_H=\<stdint.h\>
LDFLAGS ?= -Wl,--no-undefined
SYS = $(shell $(CC) -dumpmachine)
ifneq (, $(findstring mingw, $(SYS)))
EXT = .exe
else
EXT =
endif
APP = $(MODULE)$(EXT)
SRC = utils/mdldec/mdldec.c \
utils/mdldec/qc.c \
utils/mdldec/smd.c \
utils/mdldec/texture.c \
utils/mdldec/utils.c \
public/mathlib.c \
public/matrixlib.c \
public/crtlib.c
INCLUDE = -Iutils/mdldec \
-Icommon \
-Iengine \
-Iengine/common \
-Iengine/common/imagelib \
-Ipublic
LIBS = -lm
OBJS = $(SRC:%.c=%.o)
all: $(APP)
$(APP): $(OBJS)
$(CC) $(LDFLAGS) -o $(APP) $(OBJS) $(LIBS)
.c.o:
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
.PHONY: all clean
clean:
$(RM) $(OBJS)
$(RM) $(APP)

303
src_mdldec/common/bspfile.h

@ -0,0 +1,303 @@
#ifndef BSPFILE_H
#define BSPFILE_H
//#define SUPPORT_BSP2_FORMAT // allow to loading Darkplaces BSP2 maps (with broke binary compatibility)
/*
==============================================================================
BRUSH MODELS
.bsp contain level static geometry with including PVS and lightning info
==============================================================================
*/
// header
#define BSP_VERSION 30 // half-life regular version
#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_PLANEBACK BIT( 1 ) // plane should be negated
#define SURF_DRAWSKY BIT( 2 ) // sky surface
#define SURF_DRAWTURB_QUADS BIT( 3 ) // all subidivided polygons are quads
#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)
// lightstyle management
#define LM_STYLES 4 // MAXLIGHTMAPS
#define LS_NORMAL 0x00
#define LS_UNUSED 0xFE
#define LS_NONE 0xFF
// these limis not using by modelloader but only for displaying 'mapstats' correctly
#ifdef SUPPORT_BSP2_FORMAT
#define MAX_MAP_MODELS 2048 // embedded models
#define MAX_MAP_ENTSTRING 0x200000 // 2 Mb should be enough
#define MAX_MAP_PLANES 131072 // can be increased without problems
#define MAX_MAP_NODES 262144 // can be increased without problems
#define MAX_MAP_CLIPNODES 524288 // can be increased without problems
#define MAX_MAP_LEAFS 131072 // CRITICAL STUFF to run ad_sepulcher!!!
#define MAX_MAP_VERTS 524288 // can be increased without problems
#define MAX_MAP_FACES 262144 // can be increased without problems
#define MAX_MAP_MARKSURFACES 524288 // can be increased without problems
#else
#define MAX_MAP_MODELS 768 // embedded models
#define MAX_MAP_ENTSTRING 0x100000 // 1 Mb 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
#endif
#define MAX_MAP_ENTITIES 8192 // network 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 needs
#define MAX_MAP_SURFEDGES 0x200000 // can be increased but not needs
#define MAX_MAP_TEXTURES 2048 // can be increased but not needs
#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 0x1000000 // 16 Mb visdata
#define MAX_MAP_FACEINFO 8192 // can be increased but not needs
// 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
// extra lump ordering
#define LUMP_LIGHTVECS 0 // deluxemap data
#define LUMP_FACEINFO 1 // landscape and lightmap resolution info
#define LUMP_CUBEMAPS 2 // cubemap description
#define LUMP_VERTNORMALS 3 // phong shaded vertex normals
#define LUMP_LEAF_LIGHTING 4 // store vertex lighting for statics
#define LUMP_WORLDLIGHTS 5 // list of all the virtual and real lights (used to relight models in-game)
#define LUMP_COLLISION 6 // physics engine collision hull dump (userdata)
#define LUMP_AINODEGRAPH 7 // node graph that stored into the bsp (userdata)
#define LUMP_SHADOWMAP 8 // contains shadow map for direct light
#define LUMP_VERTEX_LIGHT 9 // store vertex lighting for statics
#define LUMP_UNUSED0 10 // one lump reserved for me
#define LUMP_UNUSED1 11 // one lump reserved for me
#define EXTRA_LUMPS 12 // count of the extra lumps
// texture flags
#define TEX_SPECIAL BIT( 0 ) // sky or slime, no lightmap or 256 subdivision
#define TEX_WORLD_LUXELS BIT( 1 ) // alternative lightmap matrix will be used (luxels per world units instead of luxels per texels)
#define TEX_AXIAL_LUXELS BIT( 2 ) // force world luxels to axial positive scales
#define TEX_EXTRA_LIGHTMAP BIT( 3 ) // bsp31 legacy - using 8 texels per luxel instead of 16 texels per luxel
#define TEX_SCROLL BIT( 6 ) // Doom special FX
#define IsLiquidContents( cnt ) ( cnt == CONTENTS_WATER || cnt == CONTENTS_SLIME || cnt == CONTENTS_LAVA )
// 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 id;
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;
typedef struct
{
int planenum;
int children[2]; // negative numbers are -(leafs+1), not nodes
float mins[3]; // for sphere culling
float maxs[3];
int firstface;
int numfaces; // counting both sides
} dnode32_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 contents;
int visofs; // -1 = no visibility info
float mins[3]; // for frustum culling
float maxs[3];
int firstmarksurface;
int nummarksurfaces;
byte ambient_level[NUM_AMBIENTS];
} dleaf32_t;
typedef struct
{
int planenum;
short children[2]; // negative numbers are contents
} dclipnode_t;
typedef struct
{
int planenum;
int children[2]; // negative numbers are contents
} dclipnode32_t;
typedef struct
{
float vecs[2][4]; // texmatrix [s/t][xyz offset]
int miptex;
short flags;
short faceinfo; // -1 no face info otherwise dfaceinfo_t
} dtexinfo_t;
typedef struct
{
char landname[16]; // name of decsription in mapname_land.txt
unsigned short texture_step; // default is 16, pixels\luxels ratio
unsigned short max_extent; // default is 16, subdivision step ((texture_step * max_extent) - texture_step)
short groupid; // to determine equal landscapes from various groups, -1 - no group
} dfaceinfo_t;
typedef word dmarkface_t; // leaf marksurfaces indexes
typedef int dmarkface32_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
{
int v[2]; // vertex numbers
} dedge32_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;
typedef struct
{
int planenum;
int side;
int firstedge; // we must support > 64k edges
int numedges;
int texinfo;
// lighting info
byte styles[LM_STYLES];
int lightofs; // start of [numstyles*surfsize] samples
} dface32_t;
#endif//BSPFILE_H

523
src_mdldec/common/com_model.h

@ -0,0 +1,523 @@
#ifndef COM_MODEL_H
#define COM_MODEL_H
#include "types.h"
#include "bspfile.h" // we need some declarations from it
/*
==============================================================================
ENGINE MODEL FORMAT
==============================================================================
*/
#define STUDIO_RENDER 1
#define STUDIO_EVENTS 2
#define ZISCALE ((float)0x8000)
#define MIPLEVELS 4
#define VERTEXSIZE 7
#define MAXLIGHTMAPS 4 // max light styles per face
#define MAXDYNLIGHTS 8 // maximum dynamic lights per one pixel
#define NUM_AMBIENTS 4 // automatic ambient sounds
// model types
typedef enum
{
mod_bad = -1,
mod_brush,
mod_sprite,
mod_alias,
mod_studio
} modtype_t;
typedef struct mplane_s
{
vec3_t normal;
float dist;
byte type; // for fast side tests
byte signbits; // signx + (signy<<1) + (signz<<1)
byte pad[2];
} mplane_t;
typedef struct
{
vec3_t position;
} mvertex_t;
typedef struct
{
int planenum;
#ifdef SUPPORT_BSP2_FORMAT
int children[2]; // negative numbers are contents
#else
short children[2]; // negative numbers are contents
#endif
} mclipnode_t;
// size is matched but representation is not
typedef struct
{
#ifdef SUPPORT_BSP2_FORMAT
unsigned int v[2];
#else
unsigned short v[2];
unsigned int cachededgeoffset;
#endif
} medge_t;
typedef struct texture_s
{
char name[16];
unsigned int width, height;
int gl_texturenum;
struct msurface_s *texturechain; // for gl_texsort drawing
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned short fb_texturenum; // auto-luma texturenum
unsigned short dt_texturenum; // detail-texture binding
unsigned int unused[3]; // reserved
} texture_t;
typedef struct
{
char landname[16]; // name of decsription in mapname_land.txt
unsigned short texture_step; // default is 16, pixels\luxels ratio
unsigned short max_extent; // default is 16, subdivision step ((texture_step * max_extent) - texture_step)
short groupid; // to determine equal landscapes from various groups, -1 - no group
vec3_t mins, maxs; // terrain bounds (fill by user)
int reserved[32]; // just for future expansions or mod-makers
} mfaceinfo_t;
typedef struct
{
mplane_t *edges;
int numedges;
vec3_t origin;
vec_t radius; // for culling tests
int contents; // sky or solid
} mfacebevel_t;
typedef struct
{
float vecs[2][4]; // [s/t] unit vectors in world space.
// [i][3] is the s/t offset relative to the origin.
// s or t = dot( 3Dpoint, vecs[i] ) + vecs[i][3]
mfaceinfo_t *faceinfo; // pointer to landscape info and lightmap resolution (may be NULL)
texture_t *texture;
int flags; // sky or slime, no lightmap or 256 subdivision
} mtexinfo_t;
typedef struct glpoly_s
{
struct glpoly_s *next;
struct glpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// node specific
mplane_t *plane;
struct mnode_s *children[2];
#ifdef SUPPORT_BSP2_FORMAT
int firstsurface;
int numsurfaces;
#else
unsigned short firstsurface;
unsigned short numsurfaces;
#endif
} mnode_t;
typedef struct msurface_s msurface_t;
typedef struct decal_s decal_t;
// JAY: Compress this as much as possible
struct decal_s
{
decal_t *pnext; // linked list for each surface
msurface_t *psurface; // Surface id for persistence / unlinking
float dx; // local texture coordinates
float dy; //
float scale; // Pixel scale
short texture; // Decal texture
short flags; // Decal flags FDECAL_*
short entityIndex; // Entity this is attached to
// Xash3D specific
vec3_t position; // location of the decal center in world space.
glpoly_t *polys; // precomputed decal vertices
int reserved[4]; // just for future expansions or mod-makers
};
typedef struct mleaf_s
{
// common with node
int contents;
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
struct efrag_s *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
int cluster; // helper to acess to uncompressed visdata
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
// surface extradata
typedef struct mextrasurf_s
{
vec3_t mins, maxs;
vec3_t origin; // surface origin
struct msurface_s *surf; // upcast to surface
// extended light info
int dlight_s, dlight_t; // gl lightmap coordinates for dynamic lightmaps
short lightmapmins[2]; // lightmatrix
short lightextents[2];
float lmvecs[2][4];
color24 *deluxemap; // note: this is the actual deluxemap data for this surface
byte *shadowmap; // note: occlusion map for this surface
// begin userdata
struct msurface_s *lightmapchain; // lightmapped polys
struct mextrasurf_s *detailchain; // for detail textures drawing
mfacebevel_t *bevel; // for exact face traceline
struct mextrasurf_s *lumachain; // draw fullbrights
struct cl_entity_s *parent; // upcast to owner entity
int mirrortexturenum; // gl texnum
float mirrormatrix[4][4];
struct grasshdr_s *grass; // grass that linked by this surface
unsigned short grasscount; // number of bushes per polygon (used to determine total VBO size)
unsigned short numverts; // world->vertexes[]
int firstvertex; // fisrt look up in tr.tbn_vectors[], then acess to world->vertexes[]
int reserved[32]; // just for future expansions or mod-makers
} mextrasurf_t;
struct msurface_s
{
int visframe; // should be drawn when node is crossed
mplane_t *plane; // pointer to shared plane
int flags; // see SURF_ #defines
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
short texturemins[2];
short extents[2];
int light_s, light_t; // gl lightmap coordinates
glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain;
mtexinfo_t *texinfo;
// lighting info
int dlightframe; // last frame the surface was checked by an animated light
int dlightbits; // dynamically generated. Indicates if the surface illumination
// is modified by an animated light.
int lightmaptexturenum;
byte styles[MAXLIGHTMAPS];
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
mextrasurf_t *info; // pointer to surface extradata (was cached_dlight)
color24 *samples; // note: this is the actual lightmap data for this surface
decal_t *pdecals;
};
typedef struct hull_s
{
mclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
#ifndef CACHE_USER
#define CACHE_USER
typedef struct cache_user_s
{
void *data; // extradata
} cache_user_t;
#endif
typedef struct model_s
{
char name[64]; // model name
qboolean needload; // bmodels and sprites don't cache normally
// shared modelinfo
modtype_t type; // model type
int numframes; // sprite's framecount
poolhandle_t mempool; // private mempool (was synctype)
int flags; // hl compatibility
//
// volume occupied by the model
//
vec3_t mins, maxs; // bounding box at angles '0 0 0'
float radius;
// brush model
int firstmodelsurface;
int nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels; // or studio animations
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numvertexes;
mvertex_t *vertexes;
int numedges;
medge_t *edges;
int numnodes;
mnode_t *nodes;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int numclipnodes;
mclipnode_t *clipnodes;
int nummarksurfaces;
msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS];
int numtextures;
texture_t **textures;
byte *visdata;
color24 *lightdata;
char *entities;
//
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
typedef struct alight_s
{
int ambientlight; // clip at 128
int shadelight; // clip at 192 - ambientlight
vec3_t color;
float *plightvec;
} alight_t;
typedef struct auxvert_s
{
float fv[3]; // viewspace x, y
} auxvert_t;
#define MAX_SCOREBOARDNAME 32
#define MAX_INFO_STRING 256
#include "custom.h"
typedef struct player_info_s
{
int userid; // User id on server
char userinfo[MAX_INFO_STRING]; // User info string
char name[MAX_SCOREBOARDNAME]; // Name (extracted from userinfo)
int spectator; // Spectator or not, unused (frags for quake demo playback)
int ping;
int packet_loss;
// skin information
char model[64];
int topcolor;
int bottomcolor;
// last frame rendered
int renderframe;
// Gait frame estimation
int gaitsequence;
float gaitframe;
float gaityaw;
vec3_t prevgaitorigin;
customization_t customdata;
// hashed cd key
char hashedcdkey[16];
} player_info_t;
//
// sprite representation in memory
//
typedef enum { SPR_SINGLE = 0, SPR_GROUP, SPR_ANGLED } spriteframetype_t;
typedef struct mspriteframe_s
{
int width;
int height;
float up, down, left, right;
int gl_texturenum;
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
short type;
short texFormat;
int maxwidth;
int maxheight;
int numframes;
int radius;
int facecull;
int synctype;
mspriteframedesc_t frames[1];
} msprite_t;
/*
==============================================================================
ALIAS MODELS
Alias models are position independent, so the cache manager can move them.
==============================================================================
*/
#define MAXALIASVERTS 2048
#define MAXALIASFRAMES 256
#define MAXALIASTRIS 4096
#define MAX_SKINS 32
// This mirrors trivert_t in trilib.h, is present so Quake knows how to
// load this data
typedef struct
{
byte v[3];
byte lightnormalindex;
} trivertex_t;
typedef struct
{
int firstpose;
int numposes;
trivertex_t bboxmin;
trivertex_t bboxmax;
float interval;
char name[16];
} maliasframedesc_t;
typedef struct
{
int ident;
int version;
vec3_t scale;
vec3_t scale_origin;
float boundingradius;
vec3_t eyeposition;
int numskins;
int skinwidth;
int skinheight;
int numverts;
int numtris;
int numframes;
int synctype;
int flags;
float size;
int reserved[8]; // VBO offsets
int numposes;
int poseverts;
trivertex_t *posedata; // numposes * poseverts trivert_t
int *commands; // gl command list with embedded s/t
unsigned short gl_texturenum[MAX_SKINS][4];
unsigned short fb_texturenum[MAX_SKINS][4];
unsigned short gl_reserved0[MAX_SKINS][4]; // detail tex
unsigned short gl_reserved1[MAX_SKINS][4]; // normalmap
unsigned short gl_reserved2[MAX_SKINS][4]; // glossmap
maliasframedesc_t frames[1]; // variable sized
} aliashdr_t;
// remapping info
#define SUIT_HUE_START 192
#define SUIT_HUE_END 223
#define PLATE_HUE_START 160
#define PLATE_HUE_END 191
#define SHIRT_HUE_START 16
#define SHIRT_HUE_END 32
#define PANTS_HUE_START 96
#define PANTS_HUE_END 112
// 1/32 epsilon to keep floating point happy
#define DIST_EPSILON (1.0f / 32.0f)
#define FRAC_EPSILON (1.0f / 1024.0f)
#define BACKFACE_EPSILON 0.01f
#define MAX_BOX_LEAFS 256
#define ANIM_CYCLE 2
#define MOD_FRAMES 20
#define MAX_DEMOS 32
#define MAX_MOVIES 8
#define MAX_CDTRACKS 32
#define MAX_CLIENT_SPRITES 256 // SpriteTextures
#define MAX_EFRAGS 8192 // Arcane Dimensions required
#define MAX_REQUESTS 64
#endif//COM_MODEL_H

765
src_mdldec/common/const.h

@ -0,0 +1,765 @@
/***
*
* 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.
*
****/
#ifndef CONST_H
#define CONST_H
//
// Constants shared by the engine and dlls
// This header file included by engine files and DLL files.
// Most came from server.h
// edict->flags
#define FL_FLY (1U<<0) // Changes the SV_Movestep() behavior to not need to be on ground
#define FL_SWIM (1U<<1) // Changes the SV_Movestep() behavior to not need to be on ground (but stay in water)
#define FL_CONVEYOR (1U<<2)
#define FL_CLIENT (1U<<3)
#define FL_INWATER (1U<<4)
#define FL_MONSTER (1U<<5)
#define FL_GODMODE (1U<<6)
#define FL_NOTARGET (1U<<7)
#define FL_SKIPLOCALHOST (1U<<8) // Don't send entity to local host, it's predicting this entity itself
#define FL_ONGROUND (1U<<9) // At rest / on the ground
#define FL_PARTIALGROUND (1U<<10) // not all corners are valid
#define FL_WATERJUMP (1U<<11) // player jumping out of water
#define FL_FROZEN (1U<<12) // Player is frozen for 3rd person camera
#define FL_FAKECLIENT (1U<<13) // JAC: fake client, simulated server side; don't send network messages to them
#define FL_DUCKING (1U<<14) // Player flag -- Player is fully crouched
#define FL_FLOAT (1U<<15) // Apply floating force to this entity when in water
#define FL_GRAPHED (1U<<16) // worldgraph has this ent listed as something that blocks a connection
// UNDONE: Do we need these?
#define FL_IMMUNE_WATER (1U<<17)
#define FL_IMMUNE_SLIME (1U<<18)
#define FL_IMMUNE_LAVA (1U<<19)
#define FL_PROXY (1U<<20) // This is a spectator proxy
#define FL_ALWAYSTHINK (1U<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path)
#define FL_BASEVELOCITY (1U<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum)
#define FL_MONSTERCLIP (1U<<23) // Only collide in with monsters who have FL_MONSTERCLIP set
#define FL_ONTRAIN (1U<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1U<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1U<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_LASERDOT (1U<<27) // Predicted laser spot from rocket launcher
#define FL_CUSTOMENTITY (1U<<29) // This is a custom entity
#define FL_KILLME (1U<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1U<<31) // Entity is dormant, no updates to client
// Goes into globalvars_t.trace_flags
#define FTRACE_SIMPLEBOX (1U<<0) // Traceline with a simple box
#define FTRACE_IGNORE_GLASS (1U<<1) // traceline will be ignored entities with rendermode != kRenderNormal
// walkmove modes
#define WALKMOVE_NORMAL 0 // normal walkmove
#define WALKMOVE_WORLDONLY 1 // doesn't hit ANY entities, no matter what the solid type
#define WALKMOVE_CHECKONLY 2 // move, but don't touch triggers
// edict->movetype values
#define MOVETYPE_NONE 0 // never moves
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // gravity/collisions
#define MOVETYPE_PUSH 7 // no clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
#define MOVETYPE_COMPOUND 14 // glue two entities together (simple movewith)
// edict->solid values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
// SOLID only effects OTHER entities colliding with this one when they move - UGH!
#define SOLID_NOT 0 // no interaction with other objects
#define SOLID_TRIGGER 1 // touch on edge, but not blocking
#define SOLID_BBOX 2 // touch on edge, block
#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
#define SOLID_BSP 4 // bsp clip, touch on edge, block
#define SOLID_CUSTOM 5 // call external callbacks for tracing
#define SOLID_PORTAL 6 // borrowed from FTE
// edict->deadflag values
#define DEAD_NO 0 // alive
#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground
#define DEAD_DEAD 2 // dead. lying still.
#define DEAD_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4
#define DAMAGE_NO 0
#define DAMAGE_YES 1
#define DAMAGE_AIM 2
// entity effects
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#define EF_NOINTERP 32 // don't interpolate the next frame
#define EF_LIGHT 64 // rocket flare glow sprite
#define EF_NODRAW 128 // don't draw entity
#define EF_WATERSIDES (1U<<26) // Do not remove sides for func_water entity
#define EF_FULLBRIGHT (1U<<27) // Just get fullbright
#define EF_NOSHADOW (1U<<28) // ignore shadow for this entity
#define EF_MERGE_VISIBILITY (1U<<29) // this entity allowed to merge vis (e.g. env_sky or portal camera)
#define EF_REQUEST_PHS (1U<<30) // This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls
// g-cont. one reserved bit here for me
// entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity
//
// temp entity events
//
#define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position)
// coord coord coord (end position)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // beam effect between point and entity
// short (start entity)
// coord coord coord (end position)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_GUNSHOT 2 // particle effect plus ricochet sound
// coord coord coord (position)
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
// byte (flags)
//
// The Explosion effect has some flags to control performance/aesthetic features:
#define TE_EXPLFLAG_NONE 0 // all flags clear makes default Half-Life explosion
#define TE_EXPLFLAG_NOADDITIVE 1 // sprite will be drawn opaque (ensure that the sprite you send is a non-additive sprite)
#define TE_EXPLFLAG_NODLIGHTS 2 // do not render dynamic lights
#define TE_EXPLFLAG_NOSOUND 4 // do not play client explosion sound
#define TE_EXPLFLAG_NOPARTICLES 8 // do not draw particles
#define TE_EXPLFLAG_DRAWALPHA 16 // sprite will be drawn alpha
#define TE_EXPLFLAG_ROTATE 32 // rotate the sprite randomly
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position)
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
// coord coord coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (framerate)
#define TE_TRACER 6 // tracer effect from point to point
// coord, coord, coord (start)
// coord, coord, coord (end)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start)
// coord, coord, coord (end)
// byte (life in 0.1's)
// byte (width in 0.1's)
// byte (amplitude in 0.01's)
// short (sprite model index)
#define TE_BEAMENTS 8
// short (start entity)
// short (end entity)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// coord coord coord (position)
#define TE_LAVASPLASH 10 // Quake1 lava splash
// coord coord coord (position)
#define TE_TELEPORT 11 // Quake1 teleport splash
// coord coord coord (position)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// coord coord coord (position)
// byte (starting color)
// byte (num colors)
#define TE_BSPDECAL 13 // Decal from the .BSP file
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// short (texture index of precached decal texture name)
// short (entity index)
// [optional - only included if previous short is non-zero (not the world)] short (index of model of above entity)
#define TE_IMPLOSION 14 // tracers moving toward a point
// coord, coord, coord (position)
// byte (radius)
// byte (count)
// byte (life in 0.1's)
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
// coord, coord, coord (start)
// coord, coord, coord (end)
// short (sprite index)
// byte (count)
// byte (life in 0.1's)
// byte (scale in 0.1's)
// byte (velocity along vector in 10's)
// byte (randomness of velocity in 10's)
#define TE_BEAM 16 // obsolete
#define TE_SPRITE 17 // additive sprite, plays 1 cycle
// coord, coord, coord (position)
// short (sprite index)
// byte (scale in 0.1's)
// byte (brightness)
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end
// coord, coord, coord (start position)
// coord, coord, coord (end position)
// short (beam sprite index)
// short (end sprite index)
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
// coord coord coord (center position)
// coord coord coord (axis and radius)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
// short (entity:attachment to follow)
// short (sprite index)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte,byte,byte (color)
// byte (brightness)
#define TE_GLOWSPRITE 23
// coord, coord, coord (pos) short (model index) byte (scale / 10)
#define TE_BEAMRING 24 // connect a beam ring to two entities
// short (start entity)
// short (end entity)
// short (sprite index)
// byte (starting frame)
// byte (frame rate in 0.1's)
// byte (life in 0.1's)
// byte (line width in 0.1's)
// byte (noise amplitude in 0.01's)
// byte,byte,byte (color)
// byte (brightness)
// byte (scroll speed in 0.1's)
#define TE_STREAK_SPLASH 25 // oriented shower of tracers
// coord coord coord (start position)
// coord coord coord (direction vector)
// byte (color)
// short (count)
// short (base speed)
// short (random velocity)
#define TE_BEAMHOSE 26 // obsolete
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
// coord, coord, coord (pos)
// byte (radius in 10's)
// byte byte byte (color)
// byte (life in 10's)
// byte (decay rate in 10's)
#define TE_ELIGHT 28 // point entity light, no world effect
// short (entity:attachment to follow)
// coord coord coord (initial position)
// coord (radius)
// byte byte byte (color)
// byte (life in 0.1's)
// coord (decay rate)
#define TE_TEXTMESSAGE 29
// short 1.2.13 x (-1 = center)
// short 1.2.13 y (-1 = center)
// byte Effect 0 = fade in/fade out
// 1 is flickery credits
// 2 is write out (training room)
// 4 bytes r,g,b,a color1 (text color)
// 4 bytes r,g,b,a color2 (effect color)
// ushort 8.8 fadein time
// ushort 8.8 fadeout time
// ushort 8.8 hold time
// optional ushort 8.8 fxtime (time the highlight lags behing the leading text in effect 2)
// string text message (512 chars max sz string)
#define TE_LINE 30
// coord, coord, coord startpos
// coord, coord, coord endpos
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_BOX 31
// coord, coord, coord boxmins
// coord, coord, coord boxmaxs
// short life in 0.1 s
// 3 bytes r, g, b
#define TE_KILLBEAM 99 // kill all beams attached to entity
// short (entity)
#define TE_LARGEFUNNEL 100
// coord coord coord (funnel position)
// short (sprite index)
// short (flags)
#define TE_BLOODSTREAM 101 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_SHOWLINE 102 // line of particles every 5 units, dies in 30 seconds
// coord coord coord (start position)
// coord coord coord (end position)
#define TE_BLOOD 103 // particle spray
// coord coord coord (start position)
// coord coord coord (spray vector)
// byte (color)
// byte (speed)
#define TE_DECAL 104 // Decal applied to a brush entity (not the world)
// coord, coord, coord (x,y,z), decal position (center of texture in world)
// byte (texture index of precached decal texture name)
// short (entity index)
#define TE_FIZZ 105 // create alpha sprites inside of entity, float upwards
// short (entity)
// short (sprite index)
// byte (density)
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// angle (initial yaw)
// short (model index)
// byte (bounce sound type)
// byte (life in 0.1's)
#define TE_EXPLODEMODEL 107 // spherical shower of models, picks from set
// coord, coord, coord (origin)
// coord (velocity)
// short (model index)
// short (count)
// byte (life in 0.1's)
#define TE_BREAKMODEL 108 // box of models or sprites
// coord, coord, coord (position)
// coord, coord, coord (size)
// coord, coord, coord (velocity)
// byte (random velocity in 10's)
// short (sprite or model index)
// byte (count)
// byte (life in 0.1 secs)
// byte (flags)
#define TE_GUNSHOTDECAL 109 // decal and ricochet sound
// coord, coord, coord (position)
// short (entity index???)
// byte (decal???)
#define TE_SPRITE_SPRAY 110 // spay of alpha sprites
// coord, coord, coord (position)
// coord, coord, coord (velocity)
// short (sprite index)
// byte (count)
// byte (speed)
// byte (noise)
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
// coord, coord, coord (position)
// byte (scale in 0.1's)
#define TE_PLAYERDECAL 112 // ???
// byte (playerindex)
// coord, coord, coord (position)
// short (entity???)
// byte (decal number???)
// [optional] short (model index???)
#define TE_BUBBLES 113 // create alpha sprites inside of box, float upwards