mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-01-31 13:20:34 +00:00
Reformat of qfiles.h
This commit is contained in:
parent
581389bdee
commit
a390cc589f
1 changed files with 136 additions and 184 deletions
|
@ -1,35 +1,33 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
* 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.
|
||||
*
|
||||
* =======================================================================
|
||||
*
|
||||
* The prototypes for most file formats used by Quake II
|
||||
*
|
||||
* =======================================================================
|
||||
*/
|
||||
|
||||
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.
|
||||
#ifndef CO_FILES_H
|
||||
#define CO_FILES_H
|
||||
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
//
|
||||
// qfiles.h: quake file formats
|
||||
// This file must be identical in the quake and utils directories
|
||||
//
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
The .pak files are just a linear collapse of a directory tree
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
/* The .pak files are just a linear collapse of a directory tree */
|
||||
|
||||
#define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P')
|
||||
|
||||
|
@ -41,7 +39,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int ident; // == IDPAKHEADER
|
||||
int ident; /* == IDPAKHEADER */
|
||||
int dirofs;
|
||||
int dirlen;
|
||||
} dpackheader_t;
|
||||
|
@ -49,41 +47,29 @@ typedef struct
|
|||
#define MAX_FILES_IN_PACK 4096
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
PCX files are used for as many images as possible
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
/* PCX files are used for as many images as possible */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char manufacturer;
|
||||
char version;
|
||||
char encoding;
|
||||
char bits_per_pixel;
|
||||
unsigned short xmin,ymin,xmax,ymax;
|
||||
unsigned short hres,vres;
|
||||
unsigned char palette[48];
|
||||
char reserved;
|
||||
char color_planes;
|
||||
unsigned short bytes_per_line;
|
||||
unsigned short palette_type;
|
||||
char filler[58];
|
||||
unsigned char data; // unbounded
|
||||
char manufacturer;
|
||||
char version;
|
||||
char encoding;
|
||||
char bits_per_pixel;
|
||||
unsigned short xmin,ymin,xmax,ymax;
|
||||
unsigned short hres,vres;
|
||||
unsigned char palette[48];
|
||||
char reserved;
|
||||
char color_planes;
|
||||
unsigned short bytes_per_line;
|
||||
unsigned short palette_type;
|
||||
char filler[58];
|
||||
unsigned char data; /* unbounded */
|
||||
} pcx_t;
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
/* .MD2 triangle model file format */
|
||||
|
||||
.MD2 triangle model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define ALIAS_VERSION 8
|
||||
|
||||
#define MAX_TRIANGLES 4096
|
||||
|
@ -98,7 +84,7 @@ typedef struct
|
|||
short t;
|
||||
} dstvert_t;
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
short index_xyz[3];
|
||||
short index_st[3];
|
||||
|
@ -106,7 +92,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
byte v[3]; // scaled byte to fit in frame mins/maxs
|
||||
byte v[3]; /* scaled byte to fit in frame mins/maxs */
|
||||
byte lightnormalindex;
|
||||
} dtrivertx_t;
|
||||
|
||||
|
@ -118,21 +104,19 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
float scale[3]; // multiply byte verts by this
|
||||
float translate[3]; // then add this
|
||||
char name[16]; // frame name from grabbing
|
||||
dtrivertx_t verts[1]; // variable sized
|
||||
float scale[3]; /* multiply byte verts by this */
|
||||
float translate[3]; /* then add this */
|
||||
char name[16]; /* frame name from grabbing */
|
||||
dtrivertx_t verts[1]; /* variable sized */
|
||||
} daliasframe_t;
|
||||
|
||||
|
||||
// the glcmd format:
|
||||
// a positive integer starts a tristrip command, followed by that many
|
||||
// vertex structures.
|
||||
// a negative integer starts a trifan command, followed by -x vertexes
|
||||
// a zero indicates the end of the command list.
|
||||
// a vertex consists of a floating point s, a floating point t,
|
||||
// and an integer vertex index.
|
||||
|
||||
/* the glcmd format:
|
||||
- a positive integer starts a tristrip command, followed by that many
|
||||
vertex structures.
|
||||
- a negative integer starts a trifan command, followed by -x vertexes
|
||||
a zero indicates the end of the command list.
|
||||
- a vertex consists of a floating point s, a floating point t,
|
||||
and an integer vertex index. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -141,90 +125,66 @@ typedef struct
|
|||
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int framesize; // byte size of each frame
|
||||
int framesize; /* byte size of each frame */
|
||||
|
||||
int num_skins;
|
||||
int num_xyz;
|
||||
int num_st; // greater than num_xyz for seams
|
||||
int num_st; /* greater than num_xyz for seams */
|
||||
int num_tris;
|
||||
int num_glcmds; // dwords in strip/fan command list
|
||||
int num_glcmds; /* dwords in strip/fan command list */
|
||||
int num_frames;
|
||||
|
||||
int ofs_skins; // each skin is a MAX_SKINNAME string
|
||||
int ofs_st; // byte offset from start for stverts
|
||||
int ofs_tris; // offset for dtriangles
|
||||
int ofs_frames; // offset for first frame
|
||||
int ofs_glcmds;
|
||||
int ofs_end; // end of file
|
||||
int ofs_skins; /* each skin is a MAX_SKINNAME string */
|
||||
int ofs_st; /* byte offset from start for stverts */
|
||||
int ofs_tris; /* offset for dtriangles */
|
||||
int ofs_frames; /* offset for first frame */
|
||||
int ofs_glcmds;
|
||||
int ofs_end; /* end of file */
|
||||
|
||||
} dmdl_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
/* .SP2 sprite file format */
|
||||
|
||||
.SP2 sprite file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
|
||||
// little-endian "IDS2"
|
||||
#define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I') /* little-endian "IDS2" */
|
||||
#define SPRITE_VERSION 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int width, height;
|
||||
int origin_x, origin_y; // raster coordinates inside pic
|
||||
char name[MAX_SKINNAME]; // name of pcx file
|
||||
int origin_x, origin_y; /* raster coordinates inside pic */
|
||||
char name[MAX_SKINNAME]; /* name of pcx file */
|
||||
} dsprframe_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
int numframes;
|
||||
dsprframe_t frames[1]; // variable sized
|
||||
dsprframe_t frames[1]; /* variable sized */
|
||||
} dsprite_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.WAL texture file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
/* .WAL texture file format */
|
||||
|
||||
#define MIPLEVELS 4
|
||||
typedef struct miptex_s
|
||||
{
|
||||
char name[32];
|
||||
unsigned width, height;
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
char animname[32]; // next frame in animation chain
|
||||
unsigned offsets[MIPLEVELS]; /* four mip maps stored */
|
||||
char animname[32]; /* next frame in animation chain */
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
} miptex_t;
|
||||
|
||||
/* .BSP file format */
|
||||
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.BSP file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
|
||||
// little-endian "IBSP"
|
||||
|
||||
#define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I') /* little-endian "IBSP" */
|
||||
#define BSPVERSION 38
|
||||
|
||||
|
||||
// upper design bounds
|
||||
// leaffaces, leafbrushes, planes, and verts are still bounded by
|
||||
// 16 bit short limits
|
||||
/* upper design bounds */
|
||||
/* leaffaces, leafbrushes, planes, and verts are still bounded by */
|
||||
/* 16 bit short limits */
|
||||
#define MAX_MAP_MODELS 1024
|
||||
#define MAX_MAP_BRUSHES 8192
|
||||
#define MAX_MAP_ENTITIES 2048
|
||||
|
@ -247,12 +207,12 @@ typedef struct miptex_s
|
|||
#define MAX_MAP_LIGHTING 0x200000
|
||||
#define MAX_MAP_VISIBILITY 0x100000
|
||||
|
||||
// key / value pair sizes
|
||||
/* key / value pair sizes */
|
||||
|
||||
#define MAX_KEY 32
|
||||
#define MAX_VALUE 1024
|
||||
|
||||
//=============================================================================
|
||||
/* ================================================================== */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -283,17 +243,17 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
int version;
|
||||
lump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3]; // for sounds or lights
|
||||
float origin[3]; /* for sounds or lights */
|
||||
int headnode;
|
||||
int firstface, numfaces; // submodels just draw faces
|
||||
// without walking the bsp tree
|
||||
int firstface, numfaces; /* submodels just draw faces */
|
||||
/* without walking the bsp tree */
|
||||
} dmodel_t;
|
||||
|
||||
|
||||
|
@ -303,35 +263,33 @@ typedef struct
|
|||
} dvertex_t;
|
||||
|
||||
|
||||
// 0-2 are axial planes
|
||||
/* 0-2 are axial planes */
|
||||
#define PLANE_X 0
|
||||
#define PLANE_Y 1
|
||||
#define PLANE_Z 2
|
||||
|
||||
// 3-5 are non-axial planes snapped to the nearest
|
||||
/* 3-5 are non-axial planes snapped to the nearest */
|
||||
#define PLANE_ANYX 3
|
||||
#define PLANE_ANYY 4
|
||||
#define PLANE_ANYZ 5
|
||||
|
||||
// planes (x&~1) and (x&~1)+1 are always opposites
|
||||
/* planes (x&~1) and (x&~1)+1 are always opposites */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float normal[3];
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
int type; /* PLANE_X - PLANE_ANYZ */
|
||||
} dplane_t;
|
||||
|
||||
|
||||
// contents flags are seperate bits
|
||||
// a given brush can contribute multiple content bits
|
||||
// multiple brushes can be in a single leaf
|
||||
/* contents flags are seperate bits
|
||||
- given brush can contribute multiple content bits
|
||||
- multiple brushes can be in a single leaf */
|
||||
|
||||
// these definitions also need to be in q_shared.h!
|
||||
|
||||
// lower bits are stronger, and will eat weaker brushes completely
|
||||
#define CONTENTS_SOLID 1 // an eye is never valid in a solid
|
||||
#define CONTENTS_WINDOW 2 // translucent, but not watery
|
||||
/* lower bits are stronger, and will eat weaker brushes completely */
|
||||
#define CONTENTS_SOLID 1 /* an eye is never valid in a solid */
|
||||
#define CONTENTS_WINDOW 2 /* translucent, but not watery */
|
||||
#define CONTENTS_AUX 4
|
||||
#define CONTENTS_LAVA 8
|
||||
#define CONTENTS_SLIME 16
|
||||
|
@ -339,14 +297,13 @@ typedef struct
|
|||
#define CONTENTS_MIST 64
|
||||
#define LAST_VISIBLE_CONTENTS 64
|
||||
|
||||
// remaining contents are non-visible, and don't eat brushes
|
||||
|
||||
/* remaining contents are non-visible, and don't eat brushes */
|
||||
#define CONTENTS_AREAPORTAL 0x8000
|
||||
|
||||
#define CONTENTS_PLAYERCLIP 0x10000
|
||||
#define CONTENTS_MONSTERCLIP 0x20000
|
||||
|
||||
// currents can be added to any other contents, and may be mixed
|
||||
/* currents can be added to any other contents, and may be mixed */
|
||||
#define CONTENTS_CURRENT_0 0x40000
|
||||
#define CONTENTS_CURRENT_90 0x80000
|
||||
#define CONTENTS_CURRENT_180 0x100000
|
||||
|
@ -354,56 +311,49 @@ typedef struct
|
|||
#define CONTENTS_CURRENT_UP 0x400000
|
||||
#define CONTENTS_CURRENT_DOWN 0x800000
|
||||
|
||||
#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
|
||||
#define CONTENTS_ORIGIN 0x1000000 /* removed before bsping an entity */
|
||||
|
||||
#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game
|
||||
#define CONTENTS_MONSTER 0x2000000 /* should never be on a brush, only in game */
|
||||
#define CONTENTS_DEADMONSTER 0x4000000
|
||||
#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs
|
||||
#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
|
||||
#define CONTENTS_DETAIL 0x8000000 /* brushes to be added after vis leafs */
|
||||
#define CONTENTS_TRANSLUCENT 0x10000000 /* auto set if any surface has trans */
|
||||
#define CONTENTS_LADDER 0x20000000
|
||||
|
||||
#define SURF_LIGHT 0x1 /* value will hold the light strength */
|
||||
|
||||
#define SURF_SLICK 0x2 /* effects game physics */
|
||||
|
||||
#define SURF_LIGHT 0x1 // value will hold the light strength
|
||||
|
||||
#define SURF_SLICK 0x2 // effects game physics
|
||||
|
||||
#define SURF_SKY 0x4 // don't draw, but add to skybox
|
||||
#define SURF_WARP 0x8 // turbulent water warp
|
||||
#define SURF_SKY 0x4 /* don't draw, but add to skybox */
|
||||
#define SURF_WARP 0x8 /* turbulent water warp */
|
||||
#define SURF_TRANS33 0x10
|
||||
#define SURF_TRANS66 0x20
|
||||
#define SURF_FLOWING 0x40 // scroll towards angle
|
||||
#define SURF_NODRAW 0x80 // don't bother referencing the texture
|
||||
|
||||
|
||||
|
||||
#define SURF_FLOWING 0x40 /* scroll towards angle */
|
||||
#define SURF_NODRAW 0x80 /* don't bother referencing the texture */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
short mins[3]; // for frustom culling
|
||||
int children[2]; /* negative numbers are -(leafs+1), not nodes */
|
||||
short mins[3]; /* for frustom culling */
|
||||
short maxs[3];
|
||||
unsigned short firstface;
|
||||
unsigned short numfaces; // counting both sides
|
||||
unsigned short numfaces; /* counting both sides */
|
||||
} dnode_t;
|
||||
|
||||
|
||||
typedef struct texinfo_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset]
|
||||
int flags; // miptex flags + overrides
|
||||
int value; // light emission, etc
|
||||
char texture[32]; // texture name (textures/*.wal)
|
||||
int nexttexinfo; // for animations, -1 = end of chain
|
||||
float vecs[2][4]; /* [s/t][xyz offset] */
|
||||
int flags; /* miptex flags + overrides */
|
||||
int value; /* light emission, etc */
|
||||
char texture[32]; /* texture name (textures*.wal) */
|
||||
int nexttexinfo; /* for animations, -1 = end of chain */
|
||||
} texinfo_t;
|
||||
|
||||
|
||||
// note that edge 0 is never used, because negative edge nums are used for
|
||||
// counterclockwise use of the edge in a face
|
||||
/* note that edge 0 is never used, because negative edge nums are used for */
|
||||
/* counterclockwise use of the edge in a face */
|
||||
typedef struct
|
||||
{
|
||||
unsigned short v[2]; // vertex numbers
|
||||
unsigned short v[2]; /* vertex numbers */
|
||||
} dedge_t;
|
||||
|
||||
#define MAXLIGHTMAPS 4
|
||||
|
@ -412,23 +362,23 @@ typedef struct
|
|||
unsigned short planenum;
|
||||
short side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
short numedges;
|
||||
int firstedge; /* we must support > 64k edges */
|
||||
short numedges;
|
||||
short texinfo;
|
||||
|
||||
// lighting info
|
||||
/* lighting info */
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
int lightofs; /* start of [numstyles*surfsize] samples */
|
||||
} dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // OR of all brushes (not needed?)
|
||||
int contents; /* OR of all brushes (not needed?) */
|
||||
|
||||
short cluster;
|
||||
short area;
|
||||
|
||||
short mins[3]; // for frustum culling
|
||||
short mins[3]; /* for frustum culling */
|
||||
short maxs[3];
|
||||
|
||||
unsigned short firstleafface;
|
||||
|
@ -440,7 +390,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum; // facing out of the leaf
|
||||
unsigned short planenum; /* facing out of the leaf */
|
||||
short texinfo;
|
||||
} dbrushside_t;
|
||||
|
||||
|
@ -454,20 +404,20 @@ typedef struct
|
|||
#define ANGLE_UP -1
|
||||
#define ANGLE_DOWN -2
|
||||
|
||||
// the visibility lump consists of a header with a count, then
|
||||
// byte offsets for the PVS and PHS of each cluster, then the raw
|
||||
// compressed bit vectors
|
||||
/* the visibility lump consists of a header with a count, then */
|
||||
/* byte offsets for the PVS and PHS of each cluster, then the raw */
|
||||
/* compressed bit vectors */
|
||||
#define DVIS_PVS 0
|
||||
#define DVIS_PHS 1
|
||||
typedef struct
|
||||
{
|
||||
int numclusters;
|
||||
int bitofs[8][2]; // bitofs[numclusters][2]
|
||||
int bitofs[8][2]; /* bitofs[numclusters][2] */
|
||||
} dvis_t;
|
||||
|
||||
// each area has a list of portals that lead into other areas
|
||||
// when portals are closed, other areas may not be visible or
|
||||
// hearable even if the vis info says that it should be
|
||||
/* each area has a list of portals that lead into other areas */
|
||||
/* when portals are closed, other areas may not be visible or */
|
||||
/* hearable even if the vis info says that it should be */
|
||||
typedef struct
|
||||
{
|
||||
int portalnum;
|
||||
|
@ -479,3 +429,5 @@ typedef struct
|
|||
int numareaportals;
|
||||
int firstareaportal;
|
||||
} darea_t;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue