Import OA 0.8.8 tree
This commit is contained in:
1316
code/qcommon/q_math.c
Normal file
1316
code/qcommon/q_math.c
Normal file
File diff suppressed because it is too large
Load Diff
365
code/qcommon/q_platform.h
Normal file
365
code/qcommon/q_platform.h
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code 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.
|
||||
|
||||
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __Q_PLATFORM_H
|
||||
#define __Q_PLATFORM_H
|
||||
|
||||
// this is for determining if we have an asm version of a C function
|
||||
#ifdef Q3_VM
|
||||
|
||||
#define id386 0
|
||||
#define idppc 0
|
||||
#define idppc_altivec 0
|
||||
|
||||
#else
|
||||
|
||||
#if (defined _M_IX86 || defined __i386__) && !defined(C_ONLY)
|
||||
#define id386 1
|
||||
#else
|
||||
#define id386 0
|
||||
#endif
|
||||
|
||||
#if (defined(powerc) || defined(powerpc) || defined(ppc) || \
|
||||
defined(__ppc) || defined(__ppc__)) && !defined(C_ONLY)
|
||||
#define idppc 1
|
||||
#if defined(__VEC__)
|
||||
#define idppc_altivec 1
|
||||
#ifdef MACOS_X // Apple's GCC does this differently than the FSF.
|
||||
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
|
||||
(vector unsigned char) (a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
|
||||
#else
|
||||
#define VECCONST_UINT8(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p) \
|
||||
(vector unsigned char) {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}
|
||||
#endif
|
||||
#else
|
||||
#define idppc_altivec 0
|
||||
#endif
|
||||
#else
|
||||
#define idppc 0
|
||||
#define idppc_altivec 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef __ASM_I386__ // don't include the C bits if included from qasm.h
|
||||
|
||||
// for windows fastcall option
|
||||
#define QDECL
|
||||
|
||||
//================================================================= WIN32 ===
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
#undef QDECL
|
||||
#define QDECL __cdecl
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
#define OS_STRING "win_msvc"
|
||||
#elif defined __MINGW32__
|
||||
#define OS_STRING "win_mingw"
|
||||
#endif
|
||||
|
||||
#define ID_INLINE __inline
|
||||
#define PATH_SEP '\\'
|
||||
|
||||
#if defined( _M_IX86 ) || defined( __i386__ )
|
||||
#define ARCH_STRING "x86"
|
||||
#elif defined _M_ALPHA
|
||||
#define ARCH_STRING "AXP"
|
||||
#endif
|
||||
|
||||
#define Q3_LITTLE_ENDIAN
|
||||
|
||||
#define DLL_EXT ".dll"
|
||||
|
||||
#endif
|
||||
|
||||
//KK-OAX, This is a little hack to be able to build dll's for debugging under Visual Studio
|
||||
//Simple copy/paste/rename of the #ifdef __MINGW32__
|
||||
#ifdef VSTUDIO
|
||||
|
||||
#undef QDECL
|
||||
#define QDECL __cdecl
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
#define OS_STRING "win_msvc"
|
||||
#elif defined __MINGW32__
|
||||
#define OS_STRING "win_mingw"
|
||||
#endif
|
||||
|
||||
#define ID_INLINE __inline
|
||||
#define PATH_SEP '\\'
|
||||
|
||||
#if defined( _M_IX86 ) || defined( __i386__ )
|
||||
#define ARCH_STRING "x86"
|
||||
#elif defined _M_ALPHA
|
||||
#define ARCH_STRING "AXP"
|
||||
#endif
|
||||
|
||||
#define Q3_LITTLE_ENDIAN
|
||||
|
||||
#define DLL_EXT ".dll"
|
||||
|
||||
#endif
|
||||
//============================================================== MAC OS X ===
|
||||
|
||||
#if defined(MACOS_X) || defined(__APPLE_CC__)
|
||||
|
||||
// make sure this is defined, just for sanity's sake...
|
||||
#ifndef MACOS_X
|
||||
#define MACOS_X
|
||||
#endif
|
||||
|
||||
#define OS_STRING "macosx"
|
||||
#define ID_INLINE inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#ifdef __ppc__
|
||||
#define ARCH_STRING "ppc"
|
||||
#define Q3_BIG_ENDIAN
|
||||
#elif defined __i386__
|
||||
#define ARCH_STRING "i386"
|
||||
#define Q3_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define DLL_EXT ".dylib"
|
||||
|
||||
#endif
|
||||
|
||||
//================================================================= LINUX ===
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include <endian.h>
|
||||
|
||||
#define OS_STRING "linux"
|
||||
#define ID_INLINE inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#if defined __i386__
|
||||
#define ARCH_STRING "i386"
|
||||
#elif defined __x86_64__
|
||||
#define ARCH_STRING "x86_64"
|
||||
#elif defined __powerpc64__
|
||||
#define ARCH_STRING "ppc64"
|
||||
#elif defined __powerpc__
|
||||
#define ARCH_STRING "ppc"
|
||||
#elif defined __s390__
|
||||
#define ARCH_STRING "s390"
|
||||
#elif defined __s390x__
|
||||
#define ARCH_STRING "s390x"
|
||||
#elif defined __ia64__
|
||||
#define ARCH_STRING "ia64"
|
||||
#elif defined __alpha__
|
||||
#define ARCH_STRING "alpha"
|
||||
#elif defined __sparc__
|
||||
#define ARCH_STRING "sparc"
|
||||
#elif defined __arm__
|
||||
#define ARCH_STRING "arm"
|
||||
#elif defined __cris__
|
||||
#define ARCH_STRING "cris"
|
||||
#elif defined __hppa__
|
||||
#define ARCH_STRING "hppa"
|
||||
#elif defined __mips__
|
||||
#define ARCH_STRING "mips"
|
||||
#elif defined __sh__
|
||||
#define ARCH_STRING "sh"
|
||||
#endif
|
||||
|
||||
#if __FLOAT_WORD_ORDER == __BIG_ENDIAN
|
||||
#define Q3_BIG_ENDIAN
|
||||
#else
|
||||
#define Q3_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define DLL_EXT ".so"
|
||||
|
||||
#endif
|
||||
|
||||
//=================================================================== BSD ===
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/endian.h>
|
||||
|
||||
#ifndef __BSD__
|
||||
#define __BSD__
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#define OS_STRING "freebsd"
|
||||
#elif defined(__OpenBSD__)
|
||||
#define OS_STRING "openbsd"
|
||||
#elif defined(__NetBSD__)
|
||||
#define OS_STRING "netbsd"
|
||||
#endif
|
||||
|
||||
#define ID_INLINE inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#ifdef __i386__
|
||||
#define ARCH_STRING "i386"
|
||||
#elif defined __axp__
|
||||
#define ARCH_STRING "alpha"
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#define Q3_BIG_ENDIAN
|
||||
#else
|
||||
#define Q3_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define DLL_EXT ".so"
|
||||
|
||||
#endif
|
||||
|
||||
//================================================================= SUNOS ===
|
||||
|
||||
#ifdef __sun
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/byteorder.h>
|
||||
|
||||
#define OS_STRING "solaris"
|
||||
#define ID_INLINE inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#ifdef __i386__
|
||||
#define ARCH_STRING "i386"
|
||||
#elif defined __sparc
|
||||
#define ARCH_STRING "sparc"
|
||||
#endif
|
||||
|
||||
#if defined( _BIG_ENDIAN )
|
||||
#define Q3_BIG_ENDIAN
|
||||
#elif defined( _LITTLE_ENDIAN )
|
||||
#define Q3_LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define DLL_EXT ".so"
|
||||
|
||||
#endif
|
||||
|
||||
//================================================================== IRIX ===
|
||||
|
||||
#ifdef __sgi
|
||||
|
||||
#define OS_STRING "irix"
|
||||
#define ID_INLINE __inline
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#define ARCH_STRING "mips"
|
||||
|
||||
#define Q3_BIG_ENDIAN // SGI's MIPS are always big endian
|
||||
|
||||
#define DLL_EXT ".so"
|
||||
|
||||
#endif
|
||||
|
||||
//================================================================== Q3VM ===
|
||||
|
||||
#ifdef Q3_VM
|
||||
|
||||
#define OS_STRING "q3vm"
|
||||
#define ID_INLINE
|
||||
#define PATH_SEP '/'
|
||||
|
||||
#define ARCH_STRING "bytecode"
|
||||
|
||||
#define DLL_EXT ".qvm"
|
||||
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
|
||||
//catch missing defines in above blocks
|
||||
#if !defined( OS_STRING )
|
||||
#error "Operating system not supported"
|
||||
#endif
|
||||
|
||||
#if !defined( ARCH_STRING )
|
||||
#error "Architecture not supported"
|
||||
#endif
|
||||
|
||||
#ifndef ID_INLINE
|
||||
#error "ID_INLINE not defined"
|
||||
#endif
|
||||
|
||||
#ifndef PATH_SEP
|
||||
#error "PATH_SEP not defined"
|
||||
#endif
|
||||
|
||||
#ifndef DLL_EXT
|
||||
#error "DLL_EXT not defined"
|
||||
#endif
|
||||
|
||||
|
||||
//endianness
|
||||
short ShortSwap (short l);
|
||||
int LongSwap (int l);
|
||||
float FloatSwap (const float *f);
|
||||
|
||||
#if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN )
|
||||
#error "Endianness defined as both big and little"
|
||||
#elif defined( Q3_BIG_ENDIAN )
|
||||
|
||||
#define LittleShort(x) ShortSwap(x)
|
||||
#define LittleLong(x) LongSwap(x)
|
||||
#define LittleFloat(x) FloatSwap(&x)
|
||||
#define BigShort
|
||||
#define BigLong
|
||||
#define BigFloat
|
||||
|
||||
#elif defined( Q3_LITTLE_ENDIAN )
|
||||
|
||||
#define LittleShort
|
||||
#define LittleLong
|
||||
#define LittleFloat
|
||||
#define BigShort(x) ShortSwap(x)
|
||||
#define BigLong(x) LongSwap(x)
|
||||
#define BigFloat(x) FloatSwap(&x)
|
||||
|
||||
#elif defined( Q3_VM )
|
||||
|
||||
#define LittleShort
|
||||
#define LittleLong
|
||||
#define LittleFloat
|
||||
#define BigShort
|
||||
#define BigLong
|
||||
#define BigFloat
|
||||
|
||||
#else
|
||||
#error "Endianness not defined"
|
||||
#endif
|
||||
|
||||
|
||||
//platform string
|
||||
#ifdef NDEBUG
|
||||
#define PLATFORM_STRING OS_STRING "-" ARCH_STRING
|
||||
#else
|
||||
#define PLATFORM_STRING OS_STRING "-" ARCH_STRING "-debug"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1398
code/qcommon/q_shared.c
Normal file
1398
code/qcommon/q_shared.c
Normal file
File diff suppressed because it is too large
Load Diff
1311
code/qcommon/q_shared.h
Normal file
1311
code/qcommon/q_shared.h
Normal file
File diff suppressed because it is too large
Load Diff
1136
code/qcommon/qcommon.h
Normal file
1136
code/qcommon/qcommon.h
Normal file
File diff suppressed because it is too large
Load Diff
581
code/qcommon/qfiles.h
Normal file
581
code/qcommon/qfiles.h
Normal file
@@ -0,0 +1,581 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code 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.
|
||||
|
||||
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __QFILES_H__
|
||||
#define __QFILES_H__
|
||||
|
||||
//
|
||||
// qfiles.h: quake file formats
|
||||
// This file must be identical in the quake and utils directories
|
||||
//
|
||||
|
||||
//Ignore __attribute__ on non-gcc platforms
|
||||
#ifndef __GNUC__
|
||||
#ifndef __attribute__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// surface geometry should not exceed these limits
|
||||
#define SHADER_MAX_VERTEXES 1000
|
||||
#define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES)
|
||||
|
||||
|
||||
// the maximum size of game relative pathnames
|
||||
#define MAX_QPATH 64
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
QVM files
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define VM_MAGIC 0x12721444
|
||||
#define VM_MAGIC_VER2 0x12721445
|
||||
typedef struct {
|
||||
int vmMagic;
|
||||
|
||||
int instructionCount;
|
||||
|
||||
int codeOffset;
|
||||
int codeLength;
|
||||
|
||||
int dataOffset;
|
||||
int dataLength;
|
||||
int litLength; // ( dataLength - litLength ) should be byteswapped on load
|
||||
int bssLength; // zero filled memory appended to datalength
|
||||
|
||||
//!!! below here is VM_MAGIC_VER2 !!!
|
||||
int jtrgLength; // number of jump table targets
|
||||
} vmHeader_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.MD3 triangle model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define MD3_VERSION 15
|
||||
|
||||
// limits
|
||||
#define MD3_MAX_LODS 3
|
||||
#define MD3_MAX_TRIANGLES 8192 // per surface
|
||||
#define MD3_MAX_VERTS 4096 // per surface
|
||||
#define MD3_MAX_SHADERS 256 // per surface
|
||||
#define MD3_MAX_FRAMES 1024 // per model
|
||||
#define MD3_MAX_SURFACES 32 // per model
|
||||
#define MD3_MAX_TAGS 16 // per frame
|
||||
|
||||
// vertex scales
|
||||
#define MD3_XYZ_SCALE (1.0/64)
|
||||
|
||||
typedef struct md3Frame_s {
|
||||
vec3_t bounds[2];
|
||||
vec3_t localOrigin;
|
||||
float radius;
|
||||
char name[16];
|
||||
} md3Frame_t;
|
||||
|
||||
typedef struct md3Tag_s {
|
||||
char name[MAX_QPATH]; // tag name
|
||||
vec3_t origin;
|
||||
vec3_t axis[3];
|
||||
} md3Tag_t;
|
||||
|
||||
/*
|
||||
** md3Surface_t
|
||||
**
|
||||
** CHUNK SIZE
|
||||
** header sizeof( md3Surface_t )
|
||||
** shaders sizeof( md3Shader_t ) * numShaders
|
||||
** triangles[0] sizeof( md3Triangle_t ) * numTriangles
|
||||
** st sizeof( md3St_t ) * numVerts
|
||||
** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames
|
||||
*/
|
||||
typedef struct {
|
||||
int ident; //
|
||||
|
||||
char name[MAX_QPATH]; // polyset name
|
||||
|
||||
int flags;
|
||||
int numFrames; // all surfaces in a model should have the same
|
||||
|
||||
int numShaders; // all surfaces in a model should have the same
|
||||
int numVerts;
|
||||
|
||||
int numTriangles;
|
||||
int ofsTriangles;
|
||||
|
||||
int ofsShaders; // offset from start of md3Surface_t
|
||||
int ofsSt; // texture coords are common for all frames
|
||||
int ofsXyzNormals; // numVerts * numFrames
|
||||
|
||||
int ofsEnd; // next surface follows
|
||||
} md3Surface_t;
|
||||
|
||||
typedef struct {
|
||||
char name[MAX_QPATH];
|
||||
int shaderIndex; // for in-game use
|
||||
} md3Shader_t;
|
||||
|
||||
typedef struct {
|
||||
int indexes[3];
|
||||
} md3Triangle_t;
|
||||
|
||||
typedef struct {
|
||||
float st[2];
|
||||
} md3St_t;
|
||||
|
||||
typedef struct {
|
||||
short xyz[3];
|
||||
short normal;
|
||||
} md3XyzNormal_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
char name[MAX_QPATH]; // model name
|
||||
|
||||
int flags;
|
||||
|
||||
int numFrames;
|
||||
int numTags;
|
||||
int numSurfaces;
|
||||
|
||||
int numSkins;
|
||||
|
||||
int ofsFrames; // offset for first frame
|
||||
int ofsTags; // numFrames * numTags
|
||||
int ofsSurfaces; // first surface, others follow
|
||||
|
||||
int ofsEnd; // end of file
|
||||
} md3Header_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
MD4 file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#define MD4_IDENT (('4'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define MD4_VERSION 1
|
||||
#define MD4_MAX_BONES 128
|
||||
|
||||
typedef struct {
|
||||
int boneIndex; // these are indexes into the boneReferences,
|
||||
float boneWeight; // not the global per-frame bone list
|
||||
vec3_t offset;
|
||||
} md4Weight_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t normal;
|
||||
vec2_t texCoords;
|
||||
int numWeights;
|
||||
md4Weight_t weights[1]; // variable sized
|
||||
} md4Vertex_t;
|
||||
|
||||
typedef struct {
|
||||
int indexes[3];
|
||||
} md4Triangle_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
|
||||
char name[MAX_QPATH]; // polyset name
|
||||
char shader[MAX_QPATH];
|
||||
int shaderIndex; // for in-game use
|
||||
|
||||
int ofsHeader; // this will be a negative number
|
||||
|
||||
int numVerts;
|
||||
int ofsVerts;
|
||||
|
||||
int numTriangles;
|
||||
int ofsTriangles;
|
||||
|
||||
// Bone references are a set of ints representing all the bones
|
||||
// present in any vertex weights for this surface. This is
|
||||
// needed because a model may have surfaces that need to be
|
||||
// drawn at different sort times, and we don't want to have
|
||||
// to re-interpolate all the bones for each surface.
|
||||
int numBoneReferences;
|
||||
int ofsBoneReferences;
|
||||
|
||||
int ofsEnd; // next surface follows
|
||||
} md4Surface_t;
|
||||
|
||||
typedef struct {
|
||||
float matrix[3][4];
|
||||
} md4Bone_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
|
||||
vec3_t localOrigin; // midpoint of bounds, used for sphere cull
|
||||
float radius; // dist from localOrigin to corner
|
||||
md4Bone_t bones[1]; // [numBones]
|
||||
} md4Frame_t;
|
||||
|
||||
typedef struct {
|
||||
int numSurfaces;
|
||||
int ofsSurfaces; // first surface, others follow
|
||||
int ofsEnd; // next lod follows
|
||||
} md4LOD_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
char name[MAX_QPATH]; // model name
|
||||
|
||||
// frames and bones are shared by all levels of detail
|
||||
int numFrames;
|
||||
int numBones;
|
||||
int ofsBoneNames; // char name[ MAX_QPATH ]
|
||||
int ofsFrames; // md4Frame_t[numFrames]
|
||||
|
||||
// each level of detail has completely separate sets of surfaces
|
||||
int numLODs;
|
||||
int ofsLODs;
|
||||
|
||||
int ofsEnd; // end of file
|
||||
} md4Header_t;
|
||||
|
||||
/*
|
||||
* Here are the definitions for Ravensoft's model format of md4. Raven stores their
|
||||
* playermodels in .mdr files, in some games, which are pretty much like the md4
|
||||
* format implemented by ID soft. It seems like ID's original md4 stuff is not used at all.
|
||||
* MDR is being used in EliteForce, JediKnight2 and Soldiers of Fortune2 (I think).
|
||||
* So this comes in handy for anyone who wants to make it possible to load player
|
||||
* models from these games.
|
||||
* This format has bone tags, which is similar to the thing you have in md3 I suppose.
|
||||
* Raven has released their version of md3view under GPL enabling me to add support
|
||||
* to this codebase. Thanks to Steven Howes aka Skinner for helping with example
|
||||
* source code.
|
||||
*
|
||||
* - Thilo Schulz (arny@ats.s.bawue.de)
|
||||
*/
|
||||
|
||||
// If you want to enable support for Raven's .mdr / md4 format, uncomment the next
|
||||
// line.
|
||||
//#define RAVENMD4
|
||||
|
||||
#ifdef RAVENMD4
|
||||
|
||||
#define MDR_IDENT (('5'<<24)+('M'<<16)+('D'<<8)+'R')
|
||||
#define MDR_VERSION 2
|
||||
#define MDR_MAX_BONES 128
|
||||
|
||||
typedef struct {
|
||||
int boneIndex; // these are indexes into the boneReferences,
|
||||
float boneWeight; // not the global per-frame bone list
|
||||
vec3_t offset;
|
||||
} mdrWeight_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t normal;
|
||||
vec2_t texCoords;
|
||||
int numWeights;
|
||||
mdrWeight_t weights[1]; // variable sized
|
||||
} mdrVertex_t;
|
||||
|
||||
typedef struct {
|
||||
int indexes[3];
|
||||
} mdrTriangle_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
|
||||
char name[MAX_QPATH]; // polyset name
|
||||
char shader[MAX_QPATH];
|
||||
int shaderIndex; // for in-game use
|
||||
|
||||
int ofsHeader; // this will be a negative number
|
||||
|
||||
int numVerts;
|
||||
int ofsVerts;
|
||||
|
||||
int numTriangles;
|
||||
int ofsTriangles;
|
||||
|
||||
// Bone references are a set of ints representing all the bones
|
||||
// present in any vertex weights for this surface. This is
|
||||
// needed because a model may have surfaces that need to be
|
||||
// drawn at different sort times, and we don't want to have
|
||||
// to re-interpolate all the bones for each surface.
|
||||
int numBoneReferences;
|
||||
int ofsBoneReferences;
|
||||
|
||||
int ofsEnd; // next surface follows
|
||||
} mdrSurface_t;
|
||||
|
||||
typedef struct {
|
||||
float matrix[3][4];
|
||||
} mdrBone_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
|
||||
vec3_t localOrigin; // midpoint of bounds, used for sphere cull
|
||||
float radius; // dist from localOrigin to corner
|
||||
char name[16];
|
||||
mdrBone_t bones[1]; // [numBones]
|
||||
} mdrFrame_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char Comp[24]; // MC_COMP_BYTES is in MatComp.h, but don't want to couple
|
||||
} mdrCompBone_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
|
||||
vec3_t localOrigin; // midpoint of bounds, used for sphere cull
|
||||
float radius; // dist from localOrigin to corner
|
||||
mdrCompBone_t bones[1]; // [numBones]
|
||||
} mdrCompFrame_t;
|
||||
|
||||
typedef struct {
|
||||
int numSurfaces;
|
||||
int ofsSurfaces; // first surface, others follow
|
||||
int ofsEnd; // next lod follows
|
||||
} mdrLOD_t;
|
||||
|
||||
typedef struct {
|
||||
int boneIndex;
|
||||
char name[32];
|
||||
} mdrTag_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
char name[MAX_QPATH]; // model name
|
||||
|
||||
// frames and bones are shared by all levels of detail
|
||||
int numFrames;
|
||||
int numBones;
|
||||
int ofsFrames; // mdrFrame_t[numFrames]
|
||||
|
||||
// each level of detail has completely separate sets of surfaces
|
||||
int numLODs;
|
||||
int ofsLODs;
|
||||
|
||||
int numTags;
|
||||
int ofsTags;
|
||||
|
||||
int ofsEnd; // end of file
|
||||
} mdrHeader_t;
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.BSP file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
#define BSP_IDENT (('P'<<24)+('S'<<16)+('B'<<8)+'I')
|
||||
// little-endian "IBSP"
|
||||
|
||||
#define BSP_VERSION 46
|
||||
|
||||
|
||||
// there shouldn't be any problem with increasing these values at the
|
||||
// expense of more memory allocation in the utilities
|
||||
#define MAX_MAP_MODELS 0x400
|
||||
#define MAX_MAP_BRUSHES 0x8000
|
||||
#define MAX_MAP_ENTITIES 0x800
|
||||
#define MAX_MAP_ENTSTRING 0x40000
|
||||
#define MAX_MAP_SHADERS 0x400
|
||||
|
||||
#define MAX_MAP_AREAS 0x100 // MAX_MAP_AREA_BYTES in q_shared must match!
|
||||
#define MAX_MAP_FOGS 0x100
|
||||
#define MAX_MAP_PLANES 0x20000
|
||||
#define MAX_MAP_NODES 0x20000
|
||||
#define MAX_MAP_BRUSHSIDES 0x20000
|
||||
#define MAX_MAP_LEAFS 0x20000
|
||||
#define MAX_MAP_LEAFFACES 0x20000
|
||||
#define MAX_MAP_LEAFBRUSHES 0x40000
|
||||
#define MAX_MAP_PORTALS 0x20000
|
||||
#define MAX_MAP_LIGHTING 0x800000
|
||||
#define MAX_MAP_LIGHTGRID 0x800000
|
||||
#define MAX_MAP_VISIBILITY 0x200000
|
||||
|
||||
#define MAX_MAP_DRAW_SURFS 0x20000
|
||||
#define MAX_MAP_DRAW_VERTS 0x80000
|
||||
#define MAX_MAP_DRAW_INDEXES 0x80000
|
||||
|
||||
|
||||
// key / value pair sizes in the entities lump
|
||||
#define MAX_KEY 32
|
||||
#define MAX_VALUE 1024
|
||||
|
||||
// the editor uses these predefined yaw angles to orient entities up or down
|
||||
#define ANGLE_UP -1
|
||||
#define ANGLE_DOWN -2
|
||||
|
||||
#define LIGHTMAP_WIDTH 128
|
||||
#define LIGHTMAP_HEIGHT 128
|
||||
|
||||
#define MAX_WORLD_COORD ( 128*1024 )
|
||||
#define MIN_WORLD_COORD ( -128*1024 )
|
||||
#define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
typedef struct {
|
||||
int fileofs, filelen;
|
||||
} lump_t;
|
||||
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_SHADERS 1
|
||||
#define LUMP_PLANES 2
|
||||
#define LUMP_NODES 3
|
||||
#define LUMP_LEAFS 4
|
||||
#define LUMP_LEAFSURFACES 5
|
||||
#define LUMP_LEAFBRUSHES 6
|
||||
#define LUMP_MODELS 7
|
||||
#define LUMP_BRUSHES 8
|
||||
#define LUMP_BRUSHSIDES 9
|
||||
#define LUMP_DRAWVERTS 10
|
||||
#define LUMP_DRAWINDEXES 11
|
||||
#define LUMP_FOGS 12
|
||||
#define LUMP_SURFACES 13
|
||||
#define LUMP_LIGHTMAPS 14
|
||||
#define LUMP_LIGHTGRID 15
|
||||
#define LUMP_VISIBILITY 16
|
||||
#define HEADER_LUMPS 17
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
lump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct {
|
||||
float mins[3], maxs[3];
|
||||
int firstSurface, numSurfaces;
|
||||
int firstBrush, numBrushes;
|
||||
} dmodel_t;
|
||||
|
||||
typedef struct {
|
||||
char shader[MAX_QPATH];
|
||||
int surfaceFlags;
|
||||
int contentFlags;
|
||||
} dshader_t;
|
||||
|
||||
// planes x^1 is allways the opposite of plane x
|
||||
|
||||
typedef struct {
|
||||
float normal[3];
|
||||
float dist;
|
||||
} dplane_t;
|
||||
|
||||
typedef struct {
|
||||
int planeNum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
int mins[3]; // for frustom culling
|
||||
int maxs[3];
|
||||
} dnode_t;
|
||||
|
||||
typedef struct {
|
||||
int cluster; // -1 = opaque cluster (do I still store these?)
|
||||
int area;
|
||||
|
||||
int mins[3]; // for frustum culling
|
||||
int maxs[3];
|
||||
|
||||
int firstLeafSurface;
|
||||
int numLeafSurfaces;
|
||||
|
||||
int firstLeafBrush;
|
||||
int numLeafBrushes;
|
||||
} dleaf_t;
|
||||
|
||||
typedef struct {
|
||||
int planeNum; // positive plane side faces out of the leaf
|
||||
int shaderNum;
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct {
|
||||
int firstSide;
|
||||
int numSides;
|
||||
int shaderNum; // the shader that determines the contents flags
|
||||
} dbrush_t;
|
||||
|
||||
typedef struct {
|
||||
char shader[MAX_QPATH];
|
||||
int brushNum;
|
||||
int visibleSide; // the brush side that ray tests need to clip against (-1 == none)
|
||||
} dfog_t;
|
||||
|
||||
typedef struct {
|
||||
vec3_t xyz;
|
||||
float st[2];
|
||||
float lightmap[2];
|
||||
vec3_t normal;
|
||||
byte color[4];
|
||||
} drawVert_t;
|
||||
|
||||
#define drawVert_t_cleared(x) drawVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0}, {0, 0, 0, 0}}
|
||||
|
||||
typedef enum {
|
||||
MST_BAD,
|
||||
MST_PLANAR,
|
||||
MST_PATCH,
|
||||
MST_TRIANGLE_SOUP,
|
||||
MST_FLARE
|
||||
} mapSurfaceType_t;
|
||||
|
||||
typedef struct {
|
||||
int shaderNum;
|
||||
int fogNum;
|
||||
int surfaceType;
|
||||
|
||||
int firstVert;
|
||||
int numVerts;
|
||||
|
||||
int firstIndex;
|
||||
int numIndexes;
|
||||
|
||||
int lightmapNum;
|
||||
int lightmapX, lightmapY;
|
||||
int lightmapWidth, lightmapHeight;
|
||||
|
||||
vec3_t lightmapOrigin;
|
||||
vec3_t lightmapVecs[3]; // for patches, [0] and [1] are lodbounds
|
||||
|
||||
int patchWidth;
|
||||
int patchHeight;
|
||||
} dsurface_t;
|
||||
|
||||
|
||||
#endif
|
||||
80
code/qcommon/surfaceflags.h
Normal file
80
code/qcommon/surfaceflags.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 1999-2005 Id Software, Inc.
|
||||
|
||||
This file is part of Quake III Arena source code.
|
||||
|
||||
Quake III Arena source code 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.
|
||||
|
||||
Quake III Arena source code 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 Quake III Arena source code; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
===========================================================================
|
||||
*/
|
||||
//
|
||||
// This file must be identical in the quake and utils directories
|
||||
|
||||
// contents flags are seperate bits
|
||||
// a given brush can contribute multiple content bits
|
||||
|
||||
// these definitions also need to be in q_shared.h!
|
||||
|
||||
#define CONTENTS_SOLID 1 // an eye is never valid in a solid
|
||||
#define CONTENTS_LAVA 8
|
||||
#define CONTENTS_SLIME 16
|
||||
#define CONTENTS_WATER 32
|
||||
#define CONTENTS_FOG 64
|
||||
|
||||
#define CONTENTS_NOTTEAM1 0x0080
|
||||
#define CONTENTS_NOTTEAM2 0x0100
|
||||
#define CONTENTS_NOBOTCLIP 0x0200
|
||||
|
||||
#define CONTENTS_AREAPORTAL 0x8000
|
||||
|
||||
#define CONTENTS_PLAYERCLIP 0x10000
|
||||
#define CONTENTS_MONSTERCLIP 0x20000
|
||||
//bot specific contents types
|
||||
#define CONTENTS_TELEPORTER 0x40000
|
||||
#define CONTENTS_JUMPPAD 0x80000
|
||||
#define CONTENTS_CLUSTERPORTAL 0x100000
|
||||
#define CONTENTS_DONOTENTER 0x200000
|
||||
#define CONTENTS_BOTCLIP 0x400000
|
||||
#define CONTENTS_MOVER 0x800000
|
||||
|
||||
#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity
|
||||
|
||||
#define CONTENTS_BODY 0x2000000 // should never be on a brush, only in game
|
||||
#define CONTENTS_CORPSE 0x4000000
|
||||
#define CONTENTS_DETAIL 0x8000000 // brushes not used for the bsp
|
||||
#define CONTENTS_STRUCTURAL 0x10000000 // brushes used for the bsp
|
||||
#define CONTENTS_TRANSLUCENT 0x20000000 // don't consume surface fragments inside
|
||||
#define CONTENTS_TRIGGER 0x40000000
|
||||
#define CONTENTS_NODROP 0x80000000 // don't leave bodies or items (death fog, lava)
|
||||
|
||||
#define SURF_NODAMAGE 0x1 // never give falling damage
|
||||
#define SURF_SLICK 0x2 // effects game physics
|
||||
#define SURF_SKY 0x4 // lighting from environment map
|
||||
#define SURF_LADDER 0x8
|
||||
#define SURF_NOIMPACT 0x10 // don't make missile explosions
|
||||
#define SURF_NOMARKS 0x20 // don't leave missile marks
|
||||
#define SURF_FLESH 0x40 // make flesh sounds and effects
|
||||
#define SURF_NODRAW 0x80 // don't generate a drawsurface at all
|
||||
#define SURF_HINT 0x100 // make a primary bsp splitter
|
||||
#define SURF_SKIP 0x200 // completely ignore, allowing non-closed brushes
|
||||
#define SURF_NOLIGHTMAP 0x400 // surface doesn't need a lightmap
|
||||
#define SURF_POINTLIGHT 0x800 // generate lighting info at vertexes
|
||||
#define SURF_METALSTEPS 0x1000 // clanking footsteps
|
||||
#define SURF_NOSTEPS 0x2000 // no footstep sounds
|
||||
#define SURF_NONSOLID 0x4000 // don't collide against curves with this set
|
||||
#define SURF_LIGHTFILTER 0x8000 // act as a light filter during q3map -light
|
||||
#define SURF_ALPHASHADOW 0x10000 // do per-pixel light shadow casting in q3map
|
||||
#define SURF_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies)
|
||||
#define SURF_DUST 0x40000 // leave a dust trail when walking on this surface
|
||||
Reference in New Issue
Block a user