mirror of
https://github.com/id-Software/GtkRadiant.git
synced 2026-03-20 17:09:39 +01:00
The GtkRadiant sources as originally released under the GPL license.
This commit is contained in:
76
tools/quake2/qdata_heretic2/qcommon/angles.h
Normal file
76
tools/quake2/qdata_heretic2/qcommon/angles.h
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Angles in radians
|
||||
|
||||
#define ANGLE_0 0.0F
|
||||
#define ANGLE_1 0.017453292F
|
||||
#define ANGLE_5 0.087266462F
|
||||
#define ANGLE_10 0.174532925F
|
||||
#define ANGLE_15 0.261799387F
|
||||
#define ANGLE_20 0.392699081F
|
||||
#define ANGLE_30 0.523598775F
|
||||
#define ANGLE_45 0.785398163F
|
||||
#define ANGLE_60 1.047197551F
|
||||
#define ANGLE_72 1.256637061F
|
||||
#define ANGLE_90 1.570796327F
|
||||
#define ANGLE_120 2.094395102F
|
||||
#define ANGLE_135 2.35619449F
|
||||
#define ANGLE_144 2.513274123F
|
||||
#define ANGLE_180 3.141592653F
|
||||
#define ANGLE_225 3.926990817F
|
||||
#define ANGLE_270 4.71238898F
|
||||
#define ANGLE_315 5.497787144F
|
||||
#define ANGLE_360 6.283185307F
|
||||
|
||||
// Angles in degrees
|
||||
|
||||
#define DEGREE_0 0.0F
|
||||
#define DEGREE_180 180.0F
|
||||
#define DEGREE_45 (DEGREE_180 / 4.0F)
|
||||
#define DEGREE_90 (DEGREE_180 / 2.0F)
|
||||
#define DEGREE_135 (DEGREE_90 + DEGREE_45)
|
||||
#define DEGREE_270 (DEGREE_180 + DEGREE_90)
|
||||
#define DEGREE_360 (DEGREE_180 * 2.0F)
|
||||
|
||||
#define DEGREE_225 (DEGREE_180 + DEGREE_45)
|
||||
#define DEGREE_315 (DEGREE_270 + DEGREE_45)
|
||||
|
||||
#define DEGREE_30 (DEGREE_180 / 6.0F)
|
||||
#define DEGREE_60 (DEGREE_180 / 3.0F)
|
||||
#define DEGREE_120 (DEGREE_360 / 3.0F)
|
||||
|
||||
#define DEGREE_1 (DEGREE_180 / 180.0F)
|
||||
#define DEGREE_5 (DEGREE_180 / 36.0F)
|
||||
#define DEGREE_10 (DEGREE_180 / 18.0F)
|
||||
#define DEGREE_15 (DEGREE_180 / 12.0F)
|
||||
#define DEGREE_20 (DEGREE_180 / 8.0F)
|
||||
|
||||
// Conversion routines
|
||||
|
||||
#define ANGLE_TO_RAD ANGLE_1
|
||||
#define RAD_TO_ANGLE (180.0F / ANGLE_180)
|
||||
|
||||
#define SHORT_TO_ANGLE (360.0/65536)
|
||||
|
||||
|
||||
#pragma warning(disable : 4305) // 'initializing' : truncation from 'const double ' to 'float '
|
||||
|
||||
71
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h
Normal file
71
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef _ARRAYEDLIST_H
|
||||
#define _ARRAYEDLIST_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct ArrayedListNode_s
|
||||
{
|
||||
int data;
|
||||
int next;
|
||||
int inUse;
|
||||
} ArrayedListNode_t;
|
||||
|
||||
#define ARRAYEDLISTNODE_NULL -1
|
||||
|
||||
static
|
||||
#ifdef _WIN32
|
||||
_inline
|
||||
#else
|
||||
inline
|
||||
#endif
|
||||
int GetFreeNode(ArrayedListNode_t *nodeArray, int max)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; i < max; ++i)
|
||||
{
|
||||
if(!nodeArray[i].inUse)
|
||||
{
|
||||
nodeArray[i].inUse = 1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static
|
||||
#ifdef _WIN32
|
||||
_inline
|
||||
#else
|
||||
inline
|
||||
#endif
|
||||
void FreeNode(ArrayedListNode_t *nodeArray, int index)
|
||||
{
|
||||
nodeArray[index].inUse = 0;
|
||||
}
|
||||
|
||||
#endif //_ARRAYEDLIST_H
|
||||
|
||||
33
tools/quake2/qdata_heretic2/qcommon/flex.h
Normal file
33
tools/quake2/qdata_heretic2/qcommon/flex.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Generic flexible format
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char ident[32];
|
||||
int version;
|
||||
int size;
|
||||
} header_t;
|
||||
|
||||
void WriteHeader(FILE *, char *, int, int, void *);
|
||||
|
||||
// end
|
||||
202
tools/quake2/qdata_heretic2/qcommon/fmodel.h
Normal file
202
tools/quake2/qdata_heretic2/qcommon/fmodel.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.FM triangle flexible model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __FMODEL_HEADER
|
||||
#define __FMODEL_HEADER
|
||||
|
||||
#include "bspfile.h"
|
||||
|
||||
//typedef unsigned char byte;
|
||||
//typedef int qboolean;
|
||||
//typedef float vec3_t[3];
|
||||
|
||||
#define MAX_FM_TRIANGLES 2048
|
||||
#define MAX_FM_VERTS 2048
|
||||
#define MAX_FM_FRAMES 2048
|
||||
#define MAX_FM_SKINS 64
|
||||
#define MAX_FM_SKINNAME 64
|
||||
#define MAX_FM_MESH_NODES 16 // also defined in game/qshared.h
|
||||
|
||||
|
||||
#define DTRIVERTX_V0 0
|
||||
#define DTRIVERTX_V1 1
|
||||
#define DTRIVERTX_V2 2
|
||||
#define DTRIVERTX_LNI 3
|
||||
#define DTRIVERTX_SIZE 4
|
||||
|
||||
#define SKINPAGE_WIDTH 640
|
||||
#define SKINPAGE_HEIGHT 480
|
||||
|
||||
#define ENCODED_WIDTH_X 92
|
||||
#define ENCODED_WIDTH_Y 475
|
||||
#define ENCODED_HEIGHT_X 128
|
||||
#define ENCODED_HEIGHT_Y 475
|
||||
|
||||
#define SCALE_ADJUST_FACTOR 0.96
|
||||
|
||||
#define INFO_HEIGHT 5
|
||||
#define INFO_Y (SKINPAGE_HEIGHT-INFO_HEIGHT)
|
||||
|
||||
extern byte *BasePalette;
|
||||
extern byte *BasePixels,*TransPixels;
|
||||
extern int BaseWidth, BaseHeight, TransWidth, TransHeight;
|
||||
extern int ScaleWidth, ScaleHeight;
|
||||
|
||||
int ExtractNumber(byte *pic, int x, int y);
|
||||
void DrawTextChar(int x, int y, char *text);
|
||||
void DrawLine(int x1, int y1, int x2, int y2);
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
// Initial Header
|
||||
#define FM_HEADER_NAME "header"
|
||||
#define FM_HEADER_VER 2
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int framesize; // byte size of each frame
|
||||
|
||||
int num_skins;
|
||||
int num_xyz;
|
||||
int num_st; // greater than num_xyz for seams
|
||||
int num_tris;
|
||||
int num_glcmds; // dwords in strip/fan command list
|
||||
int num_frames;
|
||||
int num_mesh_nodes;
|
||||
} fmheader_t;
|
||||
|
||||
|
||||
// Skin Header
|
||||
#define FM_SKIN_NAME "skin"
|
||||
#define FM_SKIN_VER 1
|
||||
|
||||
|
||||
// ST Coord Header
|
||||
#define FM_ST_NAME "st coord"
|
||||
#define FM_ST_VER 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short s;
|
||||
short t;
|
||||
} fmstvert_t;
|
||||
|
||||
|
||||
// Tri Header
|
||||
#define FM_TRI_NAME "tris"
|
||||
#define FM_TRI_VER 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short index_xyz[3];
|
||||
short index_st[3];
|
||||
} fmtriangle_t;
|
||||
|
||||
|
||||
// Frame Header
|
||||
#define FM_FRAME_NAME "frames"
|
||||
#define FM_FRAME_VER 1
|
||||
|
||||
// Frame for compression, just the names
|
||||
#define FM_SHORT_FRAME_NAME "short frames"
|
||||
#define FM_SHORT_FRAME_VER 1
|
||||
|
||||
// Normals for compressed frames
|
||||
#define FM_NORMAL_NAME "normals"
|
||||
#define FM_NORMAL_VER 1
|
||||
|
||||
// Compressed Frame Data
|
||||
#define FM_COMP_NAME "comp data"
|
||||
#define FM_COMP_VER 1
|
||||
|
||||
// GL Cmds Header
|
||||
#define FM_GLCMDS_NAME "glcmds"
|
||||
#define FM_GLCMDS_VER 1
|
||||
|
||||
|
||||
// Mesh Nodes Header
|
||||
#define FM_MESH_NAME "mesh nodes"
|
||||
#define FM_MESH_VER 3
|
||||
|
||||
// Skeleton Header
|
||||
#define FM_SKELETON_NAME "skeleton"
|
||||
#define FM_SKELETON_VER 1
|
||||
|
||||
// References Header
|
||||
#define FM_REFERENCES_NAME "references"
|
||||
#define FM_REFERENCES_VER 1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
union
|
||||
{
|
||||
|
||||
byte tris[MAX_FM_TRIANGLES>>3];
|
||||
|
||||
struct {
|
||||
short *triIndicies;
|
||||
int num_tris;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
byte verts[MAX_FM_VERTS>>3];
|
||||
short start_glcmds, num_glcmds;
|
||||
} fmmeshnode_t;
|
||||
|
||||
//=================================================================
|
||||
|
||||
// Frame info
|
||||
typedef struct
|
||||
{
|
||||
byte v[3]; // scaled byte to fit in frame mins/maxs
|
||||
byte lightnormalindex;
|
||||
} fmtrivertx_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float scale[3]; // multiply byte verts by this
|
||||
float translate[3]; // then add this
|
||||
char name[16]; // frame name from grabbing
|
||||
fmtrivertx_t verts[1]; // variable sized
|
||||
} fmaliasframe_t;
|
||||
|
||||
|
||||
#endif // #define __FMODEL_HEADER
|
||||
26
tools/quake2/qdata_heretic2/qcommon/h2common.h
Normal file
26
tools/quake2/qdata_heretic2/qcommon/h2common.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef H2COMMON_H
|
||||
#define H2COMMON_H
|
||||
#define H2COMMON_API
|
||||
#endif
|
||||
|
||||
38
tools/quake2/qdata_heretic2/qcommon/placement.h
Normal file
38
tools/quake2/qdata_heretic2/qcommon/placement.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef PLACEMENT_H
|
||||
#define PLACEMENT_H
|
||||
|
||||
#include "q_typedef.h"
|
||||
|
||||
//typedef float vec3_t[3];
|
||||
|
||||
typedef struct Placement_s
|
||||
{
|
||||
vec3_t origin;
|
||||
vec3_t direction;
|
||||
vec3_t up;
|
||||
} Placement_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
63
tools/quake2/qdata_heretic2/qcommon/q_typedef.h
Normal file
63
tools/quake2/qdata_heretic2/qcommon/q_typedef.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef Q_TYPEDEF_H
|
||||
#define Q_TYPEDEF_H
|
||||
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec2_t[2];
|
||||
typedef vec_t vec3_t[3];
|
||||
typedef double vec3d_t[3];
|
||||
typedef vec_t vec5_t[5];
|
||||
|
||||
typedef float matrix3_t[3][3];
|
||||
typedef float matrix3d_t[3][3];
|
||||
|
||||
typedef int fixed4_t;
|
||||
typedef int fixed8_t;
|
||||
typedef int fixed16_t;
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum {false, true} qboolean;
|
||||
#else
|
||||
typedef int qboolean;
|
||||
#endif
|
||||
|
||||
typedef struct edict_s edict_t;
|
||||
|
||||
typedef struct paletteRGBA_s
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
byte r,g,b,a;
|
||||
};
|
||||
unsigned c;
|
||||
byte c_array[4];
|
||||
};
|
||||
} paletteRGBA_t;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
604
tools/quake2/qdata_heretic2/qcommon/qfiles.h
Normal file
604
tools/quake2/qdata_heretic2/qcommon/qfiles.h
Normal file
@@ -0,0 +1,604 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P')
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[56];
|
||||
int filepos, filelen;
|
||||
} dpackfile_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident; // == IDPAKHEADER
|
||||
int dirofs;
|
||||
int dirlen;
|
||||
} dpackheader_t;
|
||||
|
||||
#define MAX_FILES_IN_PACK 6144
|
||||
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
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
|
||||
} pcx_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.MD2 compressed triangle model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
#define IDCOMPRESSEDALIASHEADER (('2'<<24)+('C'<<16)+('D'<<8)+'I')
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.MD2 compressed triangle model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
#define IDJOINTEDALIASHEADER (('2'<<24)+('J'<<16)+('D'<<8)+'I')
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.MD2 triangle model file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
|
||||
#define ALIAS_VERSION 8
|
||||
|
||||
#define MAX_TRIANGLES 4096
|
||||
#define MAX_VERTS 2048
|
||||
#define MAX_FRAMES 512
|
||||
#define MAX_MD2SKINS 64
|
||||
#define MAX_SKINNAME 64
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short s;
|
||||
short t;
|
||||
} dstvert_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
short index_xyz[3];
|
||||
short index_st[3];
|
||||
} dtriangle_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
byte v[3]; // scaled byte to fit in frame mins/maxs
|
||||
byte lightnormalindex;
|
||||
};
|
||||
|
||||
int vert;
|
||||
};
|
||||
} dtrivertx_t;
|
||||
|
||||
#define DTRIVERTX_V0 0
|
||||
#define DTRIVERTX_V1 1
|
||||
#define DTRIVERTX_V2 2
|
||||
#define DTRIVERTX_LNI 3
|
||||
#define DTRIVERTX_SIZE 4
|
||||
|
||||
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
|
||||
} 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.
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
|
||||
int skinwidth;
|
||||
int skinheight;
|
||||
int framesize; // byte size of each frame
|
||||
|
||||
int num_skins;
|
||||
int num_xyz;
|
||||
int num_st; // greater than num_xyz for seams
|
||||
int num_tris;
|
||||
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
|
||||
|
||||
} dmdl_t;
|
||||
|
||||
// compressed model
|
||||
typedef struct dcompmdl_s
|
||||
{
|
||||
dmdl_t header;
|
||||
short CompressedFrameSize;
|
||||
short UniqueVerts;
|
||||
short *remap;
|
||||
float *translate; // then add this
|
||||
float *scale; // multiply byte verts by this
|
||||
char *mat;
|
||||
char *frames;
|
||||
char *base;
|
||||
float *ctranslate;
|
||||
float *cscale;
|
||||
char data[1];
|
||||
} dcompmdl_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
dcompmdl_t compModInfo;
|
||||
int rootCluster;
|
||||
int skeletalType;
|
||||
struct ModelSkeleton_s *skeletons;
|
||||
} JointedModel_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.BK file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#define IDBOOKHEADER (('K'<<24)+('O'<<16)+('O'<<8)+'B')
|
||||
#define BOOK_VERSION 2
|
||||
|
||||
typedef struct bookframe_s
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
int h;
|
||||
char name[MAX_SKINNAME]; // name of gfx file
|
||||
} bookframe_t;
|
||||
|
||||
typedef struct bookheader_s
|
||||
{
|
||||
unsigned int ident;
|
||||
unsigned int version;
|
||||
int num_segments;
|
||||
int total_w;
|
||||
int total_h;
|
||||
} bookheader_t;
|
||||
|
||||
typedef struct book_s
|
||||
{
|
||||
bookheader_t bheader;
|
||||
bookframe_t bframes[MAX_MD2SKINS];
|
||||
} book_t;
|
||||
|
||||
/*
|
||||
========================================================================
|
||||
|
||||
.SP2 sprite file format
|
||||
|
||||
========================================================================
|
||||
*/
|
||||
|
||||
#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
|
||||
} dsprframe_t;
|
||||
|
||||
typedef struct {
|
||||
int ident;
|
||||
int version;
|
||||
int numframes;
|
||||
dsprframe_t frames[1]; // variable sized
|
||||
} dsprite_t;
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.M8 texture file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
typedef struct palette_s
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
byte r,g,b;
|
||||
};
|
||||
};
|
||||
} palette_t;
|
||||
|
||||
#define MIP_VERSION 2
|
||||
#define PAL_SIZE 256
|
||||
#define MIPLEVELS 16
|
||||
|
||||
typedef struct miptex_s
|
||||
{
|
||||
int version;
|
||||
char name[32];
|
||||
unsigned width[MIPLEVELS], height[MIPLEVELS];
|
||||
unsigned offsets[MIPLEVELS]; // four mip maps stored
|
||||
char animname[32]; // next frame in animation chain
|
||||
palette_t palette[PAL_SIZE];
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
} miptex_t;
|
||||
|
||||
|
||||
|
||||
#define MIP32_VERSION 4
|
||||
|
||||
typedef struct miptex32_s
|
||||
{
|
||||
int version;
|
||||
char name[128];
|
||||
char altname[128]; // texture substitution
|
||||
char animname[128]; // next frame in animation chain
|
||||
char damagename[128]; // image that should be shown when damaged
|
||||
unsigned width[MIPLEVELS], height[MIPLEVELS];
|
||||
unsigned offsets[MIPLEVELS];
|
||||
int flags;
|
||||
int contents;
|
||||
int value;
|
||||
float scale_x, scale_y;
|
||||
int mip_scale;
|
||||
|
||||
// detail texturing info
|
||||
char dt_name[128]; // detailed texture name
|
||||
float dt_scale_x, dt_scale_y;
|
||||
float dt_u, dt_v;
|
||||
float dt_alpha;
|
||||
int dt_src_blend_mode, dt_dst_blend_mode;
|
||||
|
||||
int unused[20]; // future expansion to maintain compatibility with h2
|
||||
} miptex32_t;
|
||||
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
.BSP file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#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
|
||||
#define MAX_MAP_MODELS 1024
|
||||
//#define MAX_MAP_BRUSHES 8192 // Quake 2 original
|
||||
#define MAX_MAP_BRUSHES 10240
|
||||
#define MAX_MAP_ENTITIES 2048
|
||||
#define MAX_MAP_ENTSTRING 0x40000
|
||||
#define MAX_MAP_TEXINFO 8192
|
||||
|
||||
#define MAX_MAP_AREAS 256
|
||||
#define MAX_MAP_AREAPORTALS 1024
|
||||
#define MAX_MAP_PLANES 65536
|
||||
#define MAX_MAP_NODES 65536
|
||||
#define MAX_MAP_BRUSHSIDES 65536
|
||||
#define MAX_MAP_LEAFS 65536
|
||||
#define MAX_MAP_VERTS 65536
|
||||
#define MAX_MAP_FACES 65536
|
||||
#define MAX_MAP_LEAFFACES 65536
|
||||
#define MAX_MAP_LEAFBRUSHES 65536
|
||||
#define MAX_MAP_PORTALS 65536
|
||||
#define MAX_MAP_EDGES 128000
|
||||
#define MAX_MAP_SURFEDGES 256000
|
||||
#define MAX_MAP_LIGHTING 0x200000
|
||||
#define MAX_MAP_VISIBILITY 0x180000
|
||||
|
||||
// key / value pair sizes
|
||||
|
||||
#define MAX_KEY 32
|
||||
#define MAX_VALUE 1024
|
||||
|
||||
//=============================================================================
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs, filelen;
|
||||
} lump_t;
|
||||
|
||||
#define LUMP_ENTITIES 0
|
||||
#define LUMP_PLANES 1
|
||||
#define LUMP_VERTEXES 2
|
||||
#define LUMP_VISIBILITY 3
|
||||
#define LUMP_NODES 4
|
||||
#define LUMP_TEXINFO 5
|
||||
#define LUMP_FACES 6
|
||||
#define LUMP_LIGHTING 7
|
||||
#define LUMP_LEAFS 8
|
||||
#define LUMP_LEAFFACES 9
|
||||
#define LUMP_LEAFBRUSHES 10
|
||||
#define LUMP_EDGES 11
|
||||
#define LUMP_SURFEDGES 12
|
||||
#define LUMP_MODELS 13
|
||||
#define LUMP_BRUSHES 14
|
||||
#define LUMP_BRUSHSIDES 15
|
||||
#define LUMP_POP 16
|
||||
#define LUMP_AREAS 17
|
||||
#define LUMP_AREAPORTALS 18
|
||||
#define HEADER_LUMPS 19
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
lump_t lumps[HEADER_LUMPS];
|
||||
} dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3]; // for sounds or lights
|
||||
int headnode;
|
||||
int firstface, numfaces; // submodels just draw faces
|
||||
// without walking the bsp tree
|
||||
} dmodel_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float point[3];
|
||||
} dvertex_t;
|
||||
|
||||
|
||||
// 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
|
||||
#define PLANE_ANYX 3
|
||||
#define PLANE_ANYY 4
|
||||
#define PLANE_ANYZ 5
|
||||
|
||||
// planes (x&~1) and (x&~1)+1 are allways opposites
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float normal[3];
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
} dplane_t;
|
||||
|
||||
|
||||
// contents flags are seperate bits
|
||||
// a 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!
|
||||
|
||||
// ************************************************************************************************
|
||||
// CONTENTS_XXX
|
||||
// ------------
|
||||
// Contents flags.
|
||||
// ************************************************************************************************
|
||||
|
||||
// Lower bits are stronger, and will eat weaker brushes completely.
|
||||
|
||||
#define CONTENTS_SOLID 0x00000001 // An eye is never valid in a solid.
|
||||
#define CONTENTS_WINDOW 0x00000002 // Translucent, but not watery.
|
||||
#define CONTENTS_AUX 0x00000004
|
||||
#define CONTENTS_LAVA 0x00000008
|
||||
#define CONTENTS_SLIME 0x00000010
|
||||
#define CONTENTS_WATER 0x00000020
|
||||
#define CONTENTS_MIST 0x00000040
|
||||
#define LAST_VISIBLE_CONTENTS CONTENTS_MIST
|
||||
|
||||
// Remaining contents are non-visible, and don't eat brushes.
|
||||
|
||||
#define CONTENTS_AREAPORTAL 0x00008000
|
||||
#define CONTENTS_PLAYERCLIP 0x00010000
|
||||
#define CONTENTS_MONSTERCLIP 0x00020000
|
||||
|
||||
// Currents can be added to any other contents, and may be mixed.
|
||||
|
||||
#define CONTENTS_CURRENT_0 0x00040000
|
||||
#define CONTENTS_CURRENT_90 0x00080000
|
||||
#define CONTENTS_CURRENT_180 0x00100000
|
||||
#define CONTENTS_CURRENT_270 0x00200000
|
||||
#define CONTENTS_CURRENT_UP 0x00400000
|
||||
#define CONTENTS_CURRENT_DOWN 0x00800000
|
||||
#define CONTENTS_ORIGIN 0x01000000 // Removed before bsping an entity.
|
||||
#define CONTENTS_MONSTER 0x02000000 // Should never be on a brush, only in game.
|
||||
#define CONTENTS_DEADMONSTER 0x04000000
|
||||
#define CONTENTS_DETAIL 0x08000000 // Brushes to be added after vis leaves.
|
||||
#define CONTENTS_TRANSLUCENT 0x10000000 // Auto set if any surface has transparency.
|
||||
#define CONTENTS_LADDER 0x20000000
|
||||
#define CONTENTS_CAMERANOBLOCK 0x40000000 // Camera LOS ignores any brushes with this flag.
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
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
|
||||
} 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
|
||||
} texinfo_t;
|
||||
|
||||
|
||||
// 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
|
||||
} dedge_t;
|
||||
|
||||
#define MAXLIGHTMAPS 4
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum;
|
||||
short side;
|
||||
|
||||
int firstedge; // we must support > 64k edges
|
||||
short numedges;
|
||||
short texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // OR of all brushes (not needed?)
|
||||
|
||||
short cluster;
|
||||
short area;
|
||||
|
||||
short mins[3]; // for frustum culling
|
||||
short maxs[3];
|
||||
|
||||
unsigned short firstleafface;
|
||||
unsigned short numleaffaces;
|
||||
|
||||
unsigned short firstleafbrush;
|
||||
unsigned short numleafbrushes;
|
||||
} dleaf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short planenum; // facing out of the leaf
|
||||
short texinfo;
|
||||
} dbrushside_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int firstside;
|
||||
int numsides;
|
||||
int contents;
|
||||
} dbrush_t;
|
||||
|
||||
#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
|
||||
#define DVIS_PVS 0
|
||||
#define DVIS_PHS 1
|
||||
typedef struct
|
||||
{
|
||||
int numclusters;
|
||||
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
|
||||
typedef struct
|
||||
{
|
||||
int portalnum;
|
||||
int otherarea;
|
||||
} dareaportal_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numareaportals;
|
||||
int firstareaportal;
|
||||
} darea_t;
|
||||
|
||||
124
tools/quake2/qdata_heretic2/qcommon/reference.c
Normal file
124
tools/quake2/qdata_heretic2/qcommon/reference.c
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "reference.h"
|
||||
#include "arrayedlist.h"
|
||||
#include "resourcemanager.h"
|
||||
#include "skeletons.h"
|
||||
|
||||
char *referenceRootNames[] =
|
||||
{
|
||||
"elf_Lhandroot",//0
|
||||
"elf_Rhandroot",
|
||||
"elf_Rfootroot",
|
||||
"elf_Lfootroot",
|
||||
"elf_Bstaffroot",
|
||||
"elf_bladeroot",
|
||||
"elf_hellroot",
|
||||
"StaffBone",//7
|
||||
"SwordBone",
|
||||
"SpearBone",
|
||||
"RFootBone",
|
||||
"LFootBone",
|
||||
"hp_backroot",//12
|
||||
"hp_staffroot",
|
||||
"hp_lhandroot",
|
||||
"hp_rhandroot",
|
||||
"hp_rfootroot",
|
||||
"hp_lfootroot",
|
||||
"staffroot",//18
|
||||
"rfootroot",
|
||||
"lfootroot",
|
||||
"rhandroot",
|
||||
"lhandroot",
|
||||
"leyeroot",
|
||||
"reyeroot"
|
||||
};
|
||||
|
||||
int referenceRootNameOffsets[NUM_REFERENCED] =
|
||||
{
|
||||
0, // CORVUS
|
||||
7, // INSECT
|
||||
12, // HIGH PRIESTESS
|
||||
18, // MORCALAVIN
|
||||
};
|
||||
|
||||
int numReferences[NUM_REFERENCED] =
|
||||
{
|
||||
NUM_REFERENCES_CORVUS,
|
||||
NUM_REFERENCES_INSECT,
|
||||
NUM_REFERENCES_PRIESTESS,
|
||||
NUM_REFERENCES_MORK,
|
||||
};
|
||||
|
||||
int corvusJointIDs[NUM_REFERENCES_CORVUS] =
|
||||
{
|
||||
CORVUS_UPPERBACK,
|
||||
CORVUS_UPPERBACK,
|
||||
-1,
|
||||
-1,
|
||||
CORVUS_UPPERBACK,
|
||||
CORVUS_UPPERBACK,
|
||||
CORVUS_UPPERBACK,
|
||||
};
|
||||
|
||||
int *jointIDs[NUM_REFERENCED] =
|
||||
{
|
||||
corvusJointIDs,
|
||||
};
|
||||
|
||||
static ResourceManager_t ReferenceMngr;
|
||||
|
||||
void InitReferenceMngr()
|
||||
{
|
||||
#define REFERENCE_BLOCK_SIZE 8
|
||||
char *dummystr = NULL;
|
||||
|
||||
ResMngr_Con(&ReferenceMngr, sizeof(LERPedReferences_t), REFERENCE_BLOCK_SIZE, dummystr);
|
||||
}
|
||||
|
||||
void ReleaseReferenceMngr()
|
||||
{
|
||||
ResMngr_Des(&ReferenceMngr);
|
||||
}
|
||||
|
||||
LERPedReferences_t *LERPedReferences_new(int init_refType)
|
||||
{
|
||||
LERPedReferences_t *newRefs;
|
||||
|
||||
newRefs = ResMngr_AllocateResource(&ReferenceMngr, sizeof(*newRefs));
|
||||
newRefs->refType = init_refType;
|
||||
newRefs->jointIDs = jointIDs[init_refType];
|
||||
newRefs->lastUpdate = -(REF_MINCULLTIME*2.0);
|
||||
|
||||
memset(newRefs->references, 0, MAX_REFPOINTS*sizeof(Reference_t));
|
||||
memset(newRefs->oldReferences, 0, MAX_REFPOINTS*sizeof(Reference_t));
|
||||
|
||||
return newRefs;
|
||||
}
|
||||
|
||||
void LERPedReferences_delete(LERPedReferences_t *toDelete)
|
||||
{
|
||||
ResMngr_DeallocateResource(&ReferenceMngr, toDelete, sizeof(*toDelete));
|
||||
}
|
||||
|
||||
// end
|
||||
126
tools/quake2/qdata_heretic2/qcommon/reference.h
Normal file
126
tools/quake2/qdata_heretic2/qcommon/reference.h
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef REFERENCE_H
|
||||
#define REFERENCE_H
|
||||
|
||||
#include "placement.h"
|
||||
|
||||
#define MAX_REFPOINTS 16
|
||||
#define REF_MINCULLTIME 1.0
|
||||
|
||||
typedef struct Reference_s
|
||||
{
|
||||
int activecount;
|
||||
Placement_t placement;
|
||||
} Reference_t;
|
||||
|
||||
typedef struct LERPedReferences_s
|
||||
{
|
||||
int refType;
|
||||
int *jointIDs;
|
||||
float lastUpdate;
|
||||
Reference_t references[MAX_REFPOINTS];
|
||||
Reference_t oldReferences[MAX_REFPOINTS];
|
||||
} LERPedReferences_t;
|
||||
|
||||
// Reference Types
|
||||
enum {
|
||||
REF_NULL = -1,
|
||||
REF_CORVUS,//0
|
||||
REF_INSECT,//1
|
||||
REF_PRIESTESS,//2
|
||||
REF_MORK,//3
|
||||
NUM_REFERENCED//4
|
||||
};
|
||||
|
||||
// Corvus Reference Points
|
||||
enum {
|
||||
CORVUS_LEFTHAND,//0
|
||||
CORVUS_RIGHTHAND,
|
||||
CORVUS_LEFTFOOT,
|
||||
CORVUS_RIGHTFOOT,
|
||||
CORVUS_STAFF,
|
||||
CORVUS_BLADE,
|
||||
CORVUS_HELL_HEAD,
|
||||
NUM_REFERENCES_CORVUS//7
|
||||
};
|
||||
|
||||
// Tchekrik Reference Points
|
||||
enum {
|
||||
INSECT_STAFF,//0
|
||||
INSECT_SWORD,
|
||||
INSECT_SPEAR,
|
||||
INSECT_RIGHTFOOT,
|
||||
INSECT_LEFTFOOT,
|
||||
NUM_REFERENCES_INSECT//5
|
||||
};
|
||||
|
||||
// High Priestess Reference Points
|
||||
enum {
|
||||
PRIESTESS_BACK,//0
|
||||
PRIESTESS_STAFF,
|
||||
PRIESTESS_LHAND,
|
||||
PRIESTESS_RHAND,
|
||||
PRIESTESS_RFOOT,
|
||||
PRIESTESS_LFOOT,
|
||||
NUM_REFERENCES_PRIESTESS//6
|
||||
};
|
||||
|
||||
// Morcalavin Reference Points
|
||||
enum
|
||||
{
|
||||
MORK_STAFFREF,//0
|
||||
MORK_RFOOTREF,//1
|
||||
MORK_LFOOTREF,//2
|
||||
MORK_RHANDREF,//3
|
||||
MORK_LHANDREF,//4
|
||||
MORK_LEYEREF,//5
|
||||
MORK_REYEREF,//6
|
||||
NUM_REFERENCES_MORK//7
|
||||
};
|
||||
|
||||
#define CORVUS_LIMBS_MASK ((1 << CORVUS_LEFTHAND) | (1 << CORVUS_RIGHTHAND) | (1 << CORVUS_LEFTFOOT) | (1 << CORVUS_RIGHTFOOT))
|
||||
#define CORVUS_WEAPON_MASK ((1 << CORVUS_STAFF) | (1 << CORVUS_BLADE) | (1 << CORVUS_HELL_HEAD))
|
||||
#define CORVUS_MASK (CORVUS_LIMBS_MASK | CORVUS_WEAPON_MASK)
|
||||
|
||||
#define INSECT_MASK ((1 << INSECT_STAFF) | (1 << INSECT_SWORD) | (1 << INSECT_SPEAR) | (1 << INSECT_RIGHTFOOT) | (1 << INSECT_LEFTFOOT))
|
||||
|
||||
#define PRIESTESS_MASK ((1 << PRIESTESS_BACK) | (1 << PRIESTESS_STAFF) | (1 << PRIESTESS_LHAND) | (1 << PRIESTESS_RHAND) | (1 << PRIESTESS_RFOOT) | (1 << PRIESTESS_LFOOT))
|
||||
|
||||
#define MORK_MASK ((1 << MORK_STAFFREF) | (1 << MORK_RFOOTREF) | (1 << MORK_LFOOTREF) | (1 << MORK_RHANDREF) | (1 << MORK_LHANDREF) | (1 << MORK_LEYEREF) | (1 << MORK_REYEREF))
|
||||
|
||||
extern char *referenceRootNames[];
|
||||
extern int referenceRootNameOffsets[];
|
||||
extern int numReferences[];
|
||||
|
||||
void EnableRefPoints(LERPedReferences_t *refInfo, int mask);
|
||||
void DisableRefPoints(LERPedReferences_t *refInfo, int mask);
|
||||
|
||||
void InitReferenceMngr();
|
||||
void ReleaseReferenceMngr();
|
||||
|
||||
LERPedReferences_t *LERPedReferences_new(int init_refType);
|
||||
void LERPedReferences_delete(LERPedReferences_t *toDelete);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
159
tools/quake2/qdata_heretic2/qcommon/resourcemanager.c
Normal file
159
tools/quake2/qdata_heretic2/qcommon/resourcemanager.c
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// ResourceManager.c
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include "resourcemanager.h"
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct ResMngr_Block_s
|
||||
{
|
||||
char *start;
|
||||
unsigned int size;
|
||||
struct ResMngr_Block_s *next;
|
||||
} ResMngr_Block_t;
|
||||
|
||||
static void ResMngr_CreateBlock(ResourceManager_t *resource)
|
||||
{
|
||||
unsigned int _blockSize;
|
||||
char *block;
|
||||
char **current;
|
||||
ResMngr_Block_t *temp;
|
||||
unsigned int i;
|
||||
|
||||
_blockSize = resource->nodeSize * resource->resPerBlock;
|
||||
|
||||
block = malloc(_blockSize);
|
||||
|
||||
assert(block);
|
||||
|
||||
temp = malloc(sizeof(*temp));
|
||||
|
||||
temp->start = block;
|
||||
temp->size = _blockSize;
|
||||
temp->next = resource->blockList;
|
||||
|
||||
resource->blockList = temp;
|
||||
|
||||
resource->free = (char **)(block);
|
||||
|
||||
current = resource->free;
|
||||
|
||||
for(i = 1; i < resource->resPerBlock; ++i)
|
||||
{
|
||||
// set current->next to point to next node
|
||||
*current = (char *)(current) + resource->nodeSize;
|
||||
|
||||
// set current node to current->next
|
||||
current = (char **)(*current);
|
||||
}
|
||||
|
||||
*current = NULL;
|
||||
}
|
||||
|
||||
H2COMMON_API void ResMngr_Con(ResourceManager_t *resource, size_t init_resSize, unsigned int init_resPerBlock, char *resman_name)
|
||||
{
|
||||
resource->resSize = init_resSize;
|
||||
|
||||
resource->resPerBlock = init_resPerBlock;
|
||||
|
||||
resource->nodeSize = resource->resSize + sizeof(*resource->free);
|
||||
|
||||
resource->blockList = NULL;
|
||||
|
||||
resource->numResourcesAllocated = 0;
|
||||
|
||||
ResMngr_CreateBlock(resource);
|
||||
}
|
||||
|
||||
H2COMMON_API void ResMngr_Des(ResourceManager_t *resource)
|
||||
{
|
||||
ResMngr_Block_t *toDelete;
|
||||
|
||||
#if 0
|
||||
if (resource->numResourcesAllocated)
|
||||
{
|
||||
char mess[100];
|
||||
sprintf(mess,"Potential memory leak %d bytes unfreed\n",resource->resSize*resource->numResourcesAllocated);
|
||||
OutputDebugString(mess);
|
||||
}
|
||||
#endif
|
||||
|
||||
while(resource->blockList)
|
||||
{
|
||||
toDelete = resource->blockList;
|
||||
resource->blockList = resource->blockList->next;
|
||||
free(toDelete->start);
|
||||
free(toDelete);
|
||||
}
|
||||
}
|
||||
|
||||
H2COMMON_API void *ResMngr_AllocateResource(ResourceManager_t *resource, size_t size)
|
||||
{
|
||||
char **toPop;
|
||||
|
||||
assert(size == resource->resSize);
|
||||
|
||||
++resource->numResourcesAllocated;
|
||||
|
||||
assert(resource->free); // constructor not called; possibly due to a static object
|
||||
// containing a static ResourceManagerFastLarge member being
|
||||
// constructed before its own static members
|
||||
|
||||
toPop = resource->free;
|
||||
|
||||
// set unallocated to the next node and check for NULL (end of list)
|
||||
if(!(resource->free = (char **)(*resource->free)))
|
||||
{ // if at end create new block
|
||||
ResMngr_CreateBlock(resource);
|
||||
}
|
||||
|
||||
// set next to NULL
|
||||
*toPop = NULL;
|
||||
|
||||
// return the resource for the node
|
||||
return (void *)(toPop + 1);
|
||||
}
|
||||
|
||||
H2COMMON_API void ResMngr_DeallocateResource(ResourceManager_t *resource, void *toDeallocate, size_t size)
|
||||
{
|
||||
char **toPush;
|
||||
|
||||
assert(size == resource->resSize);
|
||||
|
||||
--resource->numResourcesAllocated;
|
||||
|
||||
toPush = (char **)(toDeallocate) - 1;
|
||||
|
||||
assert(resource->free); // see same assert at top of AllocateResource
|
||||
|
||||
// set toPop->next to current unallocated front
|
||||
*toPush = (char *)(resource->free);
|
||||
|
||||
// set unallocated to the node removed from allocated
|
||||
resource->free = toPush;
|
||||
}
|
||||
|
||||
// end
|
||||
47
tools/quake2/qdata_heretic2/qcommon/resourcemanager.h
Normal file
47
tools/quake2/qdata_heretic2/qcommon/resourcemanager.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// ResourceManager.h
|
||||
//
|
||||
|
||||
#include "h2common.h"
|
||||
#include <stdlib.h> // needed here for size_t
|
||||
|
||||
typedef struct ResourceManager_s
|
||||
{
|
||||
size_t resSize;
|
||||
unsigned int resPerBlock;
|
||||
unsigned int nodeSize;
|
||||
struct ResMngr_Block_s *blockList;
|
||||
char **free;
|
||||
char *ResMan_Name;
|
||||
|
||||
unsigned numResourcesAllocated;
|
||||
|
||||
} ResourceManager_t;
|
||||
|
||||
extern H2COMMON_API void ResMngr_Con(ResourceManager_t *resource, size_t init_resSize, unsigned int init_resPerBlock, char *resman_name);
|
||||
extern H2COMMON_API void ResMngr_Des(ResourceManager_t *resource);
|
||||
extern H2COMMON_API void *ResMngr_AllocateResource(ResourceManager_t *resource, size_t size);
|
||||
extern H2COMMON_API void ResMngr_DeallocateResource(ResourceManager_t *resource, void *toDeallocate, size_t size);
|
||||
|
||||
|
||||
232
tools/quake2/qdata_heretic2/qcommon/skeletons.c
Normal file
232
tools/quake2/qdata_heretic2/qcommon/skeletons.c
Normal file
@@ -0,0 +1,232 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
//
|
||||
// Skeletons.c
|
||||
//
|
||||
|
||||
#include "skeletons.h"
|
||||
|
||||
char *skeletonRootNames[] =
|
||||
{
|
||||
"RAVEN_ROOT",
|
||||
"BOX_ROOT",
|
||||
"BEETLE_ROOT",
|
||||
"ELFLORD_ROOT",
|
||||
"PLAGUELF_ROOT",
|
||||
"ELF_BACKROOT",
|
||||
};
|
||||
|
||||
int skeletonRNameOffsets[] =
|
||||
{
|
||||
0, // RAVEN
|
||||
1, // BOX
|
||||
2, // BEETLE
|
||||
3, // ELFLORD
|
||||
4, // PLAGUE ELF
|
||||
5, // CORVUS
|
||||
};
|
||||
|
||||
char *skeletonJointNames[] =
|
||||
{
|
||||
"RAVEN_LOWERBACK", // 0
|
||||
"RAVEN_UPPERBACK",
|
||||
"RAVEN_NECK",
|
||||
"BOX_CENTER", // 3
|
||||
"BEETLE_NECK", // 4
|
||||
"BEETLE_HEAD",
|
||||
"PLAGUELF_BACKB", // 6
|
||||
"PLAGUELF_BACKC",
|
||||
"PLAGUELF_NECK",
|
||||
"ELF_BACKB", // 9
|
||||
"ELF_BACKC",
|
||||
"ELF_NECKB",
|
||||
};
|
||||
|
||||
int skeletonNameOffsets[] =
|
||||
{
|
||||
0, // RAVEN
|
||||
3, // BOX
|
||||
4, // BEETLE
|
||||
-1, // ELFLORD
|
||||
6, // PLAGUE ELF
|
||||
9, // CORVUS
|
||||
};
|
||||
|
||||
char *skeletonEffectorNames[] =
|
||||
{
|
||||
"BEETLE_EYES", // 0
|
||||
"CORVUS_EYES", // 1
|
||||
};
|
||||
|
||||
int skeletonENameOffsets[] =
|
||||
{
|
||||
-1, // RAVEN
|
||||
-1, // BOX
|
||||
0, // BEETLE
|
||||
-1, // ELFLORD
|
||||
1, // PLAGUE ELF
|
||||
};
|
||||
|
||||
int numJointsInSkeleton[] =
|
||||
{
|
||||
NUM_JOINTS_RAVEN,
|
||||
NUM_JOINTS_BOX,
|
||||
NUM_JOINTS_BEETLE,
|
||||
NUM_JOINTS_ELFLORD,
|
||||
NUM_JOINTS_PLAGUE_ELF,
|
||||
NUM_JOINTS_CORVUS,
|
||||
};
|
||||
|
||||
int numNodesInSkeleton[] =
|
||||
{
|
||||
2, // RAVEN
|
||||
0, // BOX
|
||||
1, // BEETLE
|
||||
-1, // ELFLORD
|
||||
2, // PLAGUE ELF
|
||||
2, // CORVUS
|
||||
};
|
||||
|
||||
void CreateRavenSkel(void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root);
|
||||
void CreateBoxSkel(void *g_skeletalJoints, size_t jointSize, struct ArrayedListNode_s *g_jointNodes, int root);
|
||||
void CreateBeetleSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);
|
||||
void CreateElfLordSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);
|
||||
void CreatePlagueElfSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex);
|
||||
|
||||
CreateSkeleton_t SkeletonCreators[NUM_SKELETONS] =
|
||||
{
|
||||
CreateRavenSkel,
|
||||
CreateBoxSkel,
|
||||
CreateBeetleSkel,
|
||||
CreateElfLordSkel,
|
||||
CreatePlagueElfSkel,
|
||||
CreatePlagueElfSkel, // Corvus has the same structure as the Plague Elf
|
||||
};
|
||||
|
||||
void CreateRavenSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
|
||||
{
|
||||
char *root;
|
||||
int *children;
|
||||
int nodeIndex;
|
||||
|
||||
root = (char *)g_skeletalJoints + rootIndex * jointSize;
|
||||
|
||||
children = (int *)(root + RAVEN_HEAD * jointSize);
|
||||
*children = ARRAYEDLISTNODE_NULL;
|
||||
|
||||
nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
|
||||
|
||||
children = (int *)(root + RAVEN_UPPERBACK * jointSize);
|
||||
*children = nodeIndex;
|
||||
|
||||
g_jointNodes[nodeIndex].data = rootIndex + RAVEN_HEAD;
|
||||
g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
|
||||
|
||||
nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
|
||||
|
||||
children = (int *)(root + RAVEN_LOWERBACK * jointSize);
|
||||
*children = nodeIndex;
|
||||
|
||||
g_jointNodes[nodeIndex].data = rootIndex + RAVEN_UPPERBACK;
|
||||
g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
|
||||
}
|
||||
|
||||
void CreateBoxSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
|
||||
{
|
||||
char *root;
|
||||
int *children;
|
||||
|
||||
root = (char *)g_skeletalJoints + rootIndex * jointSize;
|
||||
|
||||
children = (int *)(root + RAVEN_HEAD * jointSize);
|
||||
*children = ARRAYEDLISTNODE_NULL;
|
||||
}
|
||||
|
||||
void CreateBeetleSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
|
||||
{
|
||||
char *root;
|
||||
int *children;
|
||||
int nodeIndex;
|
||||
|
||||
root = (char *)g_skeletalJoints + rootIndex * jointSize;
|
||||
|
||||
children = (int *)(root + BEETLE_HEAD * jointSize);
|
||||
*children = ARRAYEDLISTNODE_NULL;
|
||||
|
||||
nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
|
||||
|
||||
children = (int *)(root + BEETLE_NECK * jointSize);
|
||||
*children = nodeIndex;
|
||||
|
||||
g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;
|
||||
g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
|
||||
}
|
||||
|
||||
void CreateElfLordSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
|
||||
{
|
||||
char *root;
|
||||
int *children;
|
||||
int nodeIndex;
|
||||
|
||||
root = (char *)g_skeletalJoints + rootIndex * jointSize;
|
||||
|
||||
children = (int *)(root + BEETLE_HEAD * jointSize);
|
||||
*children = ARRAYEDLISTNODE_NULL;
|
||||
|
||||
nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
|
||||
|
||||
children = (int *)(root + BEETLE_NECK * jointSize);
|
||||
*children = nodeIndex;
|
||||
|
||||
g_jointNodes[nodeIndex].data = rootIndex + BEETLE_HEAD;
|
||||
g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
|
||||
}
|
||||
|
||||
void CreatePlagueElfSkel(void *g_skeletalJoints, size_t jointSize, ArrayedListNode_t *g_jointNodes, int rootIndex)
|
||||
{
|
||||
char *root;
|
||||
int *children;
|
||||
int nodeIndex;
|
||||
|
||||
root = (char *)g_skeletalJoints + rootIndex * jointSize;
|
||||
|
||||
children = (int *)(root + PLAGUE_ELF_HEAD * jointSize);
|
||||
*children = ARRAYEDLISTNODE_NULL;
|
||||
|
||||
nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
|
||||
|
||||
children = (int *)(root + PLAGUE_ELF_UPPERBACK * jointSize);
|
||||
*children = nodeIndex;
|
||||
|
||||
g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_HEAD;
|
||||
g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
|
||||
|
||||
nodeIndex = GetFreeNode(g_jointNodes, MAX_ARRAYED_JOINT_NODES);
|
||||
|
||||
children = (int *)(root + PLAGUE_ELF_LOWERBACK * jointSize);
|
||||
*children = nodeIndex;
|
||||
|
||||
g_jointNodes[nodeIndex].data = rootIndex + PLAGUE_ELF_UPPERBACK;
|
||||
g_jointNodes[nodeIndex].next = ARRAYEDLISTNODE_NULL;
|
||||
}
|
||||
|
||||
|
||||
107
tools/quake2/qdata_heretic2/qcommon/skeletons.h
Normal file
107
tools/quake2/qdata_heretic2/qcommon/skeletons.h
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
Copyright (C) 1999-2006 Id Software, Inc. and contributors.
|
||||
For a list of contributors, see the accompanying CONTRIBUTORS file.
|
||||
|
||||
This file is part of GtkRadiant.
|
||||
|
||||
GtkRadiant 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.
|
||||
|
||||
GtkRadiant 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 GtkRadiant; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h> // for size_t
|
||||
#include "arrayedlist.h"
|
||||
|
||||
#define JN_YAW_CHANGED 0x00000001
|
||||
#define JN_PITCH_CHANGED 0x00000002
|
||||
#define JN_ROLL_CHANGED 0x00000004
|
||||
|
||||
// Skeleton types
|
||||
enum {
|
||||
SKEL_NULL = -1,
|
||||
SKEL_RAVEN = 0,
|
||||
SKEL_BOX,
|
||||
SKEL_BEETLE,
|
||||
SKEL_ELFLORD,
|
||||
SKEL_PLAGUE_ELF,
|
||||
SKEL_CORVUS,
|
||||
NUM_SKELETONS
|
||||
};
|
||||
|
||||
// Raven Skeletal joints
|
||||
enum {
|
||||
RAVEN_LOWERBACK = 0,
|
||||
RAVEN_UPPERBACK,
|
||||
RAVEN_HEAD,
|
||||
NUM_JOINTS_RAVEN
|
||||
};
|
||||
|
||||
// Box Skeletal joints
|
||||
enum {
|
||||
BOX_CENTER = 0,
|
||||
NUM_JOINTS_BOX
|
||||
};
|
||||
|
||||
// Beetle Skeletal joints
|
||||
enum {
|
||||
BEETLE_NECK = 0,
|
||||
BEETLE_HEAD,
|
||||
NUM_JOINTS_BEETLE
|
||||
};
|
||||
|
||||
// Elflord Skeletal joints
|
||||
enum {
|
||||
ELFLORD_,
|
||||
ELFLORD__,
|
||||
NUM_JOINTS_ELFLORD
|
||||
};
|
||||
|
||||
// Plague Elf Skeletal joints
|
||||
enum {
|
||||
PLAGUE_ELF_LOWERBACK,
|
||||
PLAGUE_ELF_UPPERBACK,
|
||||
PLAGUE_ELF_HEAD,
|
||||
NUM_JOINTS_PLAGUE_ELF
|
||||
};
|
||||
|
||||
// Corvus Skeletal joints
|
||||
enum {
|
||||
CORVUS_LOWERBACK,
|
||||
CORVUS_UPPERBACK,
|
||||
CORVUS_HEAD,
|
||||
NUM_JOINTS_CORVUS
|
||||
};
|
||||
|
||||
#define NO_SWAP_FRAME -1
|
||||
#define NULL_ROOT_JOINT -1
|
||||
|
||||
#define MAX_ARRAYED_SKELETAL_JOINTS 255 // has max of 65,535 (if this remains at 255, net code can be changed to reflect)
|
||||
#define MAX_ARRAYED_JOINT_NODES (MAX_ARRAYED_SKELETAL_JOINTS - 1)
|
||||
|
||||
#define MAX_JOINTS_PER_SKELETON 8 // arbitrary small number
|
||||
#define MAX_JOINT_NODES_PER_SKELETON (MAX_JOINTS_PER_SKELETON - 1)
|
||||
|
||||
extern char *skeletonRootNames[];
|
||||
extern int skeletonRNameOffsets[];
|
||||
extern char *skeletonJointNames[];
|
||||
extern int skeletonNameOffsets[];
|
||||
extern int numJointsInSkeleton[];
|
||||
extern char *skeletonEffectorNames[];
|
||||
extern int skeletonENameOffsets[];
|
||||
extern int numNodesInSkeleton[];
|
||||
|
||||
typedef void (*CreateSkeleton_t)(void *skeletalJoints, size_t jointSize, struct ArrayedListNode_s *jointNodes, int rootIndex);
|
||||
|
||||
extern CreateSkeleton_t SkeletonCreators[NUM_SKELETONS];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user